Commit Graph

181 Commits

Author SHA1 Message Date
1337 9929df3d8c Merge branch 'backstage:master' into feature/catalog-export 2026-05-20 20:32:27 +02:00
github-actions[bot] b97fcb0a93 Version Packages 2026-05-19 18:28:24 +00:00
github-actions[bot] 7295193bb6 Version Packages (next) 2026-04-28 15:53:09 +00:00
Patrik Oldsberg 1b55701923 Merge pull request #34006 from backstage/rugvip/fix-lockfile-removal-detection
Fix lockfile dependency removal detection in PackageGraph
2026-04-22 15:36:14 +02:00
1337 e907ba6fe1 Merge branch 'backstage:master' into feature/catalog-export 2026-04-22 09:17:13 +02:00
github-actions[bot] 1cc86bee1c Version Packages (next) 2026-04-21 15:07:43 +00:00
Patrik Oldsberg 357d63949e Fix lockfile dependency removal detection in PackageGraph
The `otherGraph` variable in `listChangedPackages` was incorrectly
created from `thisLockfile` instead of `otherLockfile`, making the
merged dependency graph a duplicate of the current one. This meant
that dependencies only present in the old lockfile were never added
to the graph, so transitive removals could not be detected.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-20 16:37:26 +02:00
the-serious-programmer 82cf16f63c feat: catalog export feature
Signed-off-by: the-serious-programmer <19777147+the-serious-programmer@users.noreply.github.com>
2026-04-18 14:29:30 +02:00
Fredrik Adelöw 8e7f7249e7 chore: regenerate knip reports
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Made-with: Cursor
2026-04-16 12:14:47 +02:00
github-actions[bot] 93e643d142 Version Packages 2026-04-14 14:57:31 +00:00
Patrik Oldsberg 34bdd5ed7e cli-node: delete orphaned errors.ts (#33856)
Made-with: Cursor

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-04-13 12:24:14 +02:00
github-actions[bot] 6c10d88c13 Version Packages (next) 2026-04-07 15:30:58 +00:00
Patrik Oldsberg b2319ffe45 errors: add toError utility and migrate assertError usages
Add a `toError` utility function to `@backstage/errors` that converts
unknown values to `ErrorLike` objects. If the value is already error-like
it is returned as-is. Strings are used directly as the error message, and
other values are stringified with a fallback to JSON.stringify to avoid
unhelpful `[object Object]` messages.

Non-error causes passed to `CustomErrorBase` are now converted and stored
using `toError` rather than discarded. Existing `assertError` call sites
across the codebase are migrated to `toError`.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-04-03 10:16:23 +02:00
github-actions[bot] c1b510cabb Version Packages (next) 2026-03-24 14:54:00 +00:00
github-actions[bot] 5725b5fcfa Version Packages 2026-03-17 21:39:07 +00:00
Patrik Oldsberg 4d25b4b784 Address remaining PR review comments
- Fix getAllInstances to handle empty instance array without throwing
- Persist updated token expiry timestamps to disk after refresh
- Mark internal httpJson helpers as @internal instead of @public

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-17 20:53:10 +01:00
Patrik Oldsberg 4f6e7de133 Address second round of PR review feedback
- Replace getConfig<T> with getMetadata/setMetadata on CliAuth, removing
  the unsafe type parameter in favor of returning unknown
- Move updateInstanceConfig from cli-module-auth public API to
  CliAuth.setMetadata, removing the cross-package dependency
- Rename 'config' to 'metadata' in StoredInstance and storage schemas
- Add zod validation at consumer sites (cli-module-actions) for
  type-safe metadata access
- Fix zod imports to use zod/v3 for compatibility with zod v4
- Add proper-lockfile to cli-node for metadata write locking
- Refactor cli-node storage from fs-extra to node:fs
- Remove @backstage/cli-module-auth dependency from cli-module-actions

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-17 20:53:10 +01:00
Patrik Oldsberg 2b90358730 Address PR review feedback
- Convert CliAuth getters to methods (getInstanceName, getBaseUrl) so
  options can be added in the future
- Remove StoredInstance from cli-node public API, hiding instance details
- Move secretStore to cli-internal for re-use, refactoring from fs-extra
  to node:fs
- Add shared getAuthInstanceService helper in cli-internal for
  constructing secret-store service keys
- Define StoredInstance locally in cli-module-auth instead of importing
  from cli-node
- Update all consumers and tests for the new method-based API

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-17 20:53:10 +01:00
Patrik Oldsberg da8e6603a4 Clean up unreleased API surface
Since cli-module-auth and cli-module-actions are not yet released,
remove deprecated exports instead of keeping them. Also make httpJson
and getSecretStore internal to cli-node, duplicating the small httpJson
wrapper locally in each consuming package.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-17 20:53:10 +01:00
Patrik Oldsberg 12fa965e67 cli-node: add CliAuth class for shared CLI authentication
Introduces a class-based authentication management API in @backstage/cli-node
that reads the on-disk instance store, transparently refreshes expired tokens,
and provides a convenient surface for other CLI modules to consume.

The split keeps filesystem-based instance selection and writes owned by
cli-module-auth, while reading and consuming the current instance is
available through CliAuth in cli-node.

Migrates cli-module-actions to use the new API and deprecates the ad-hoc
function exports from cli-module-auth.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-17 20:07:50 +01:00
Fredrik Adelöw 68aca28f0e update the import anyway
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
2026-03-17 16:48:44 +01:00
Gabriel Dugny a49a40d314 Proper /v3 usage everywhere
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-03-17 16:48:42 +01:00
Gabriel Dugny 49171c9de4 chore: Update all imports to zod/v3
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-03-17 16:48:42 +01:00
Patrik Oldsberg 92b0f79d9c Make @swc/core an optional peer dependency of cli-node
The node transform config is only loaded at runtime when running
backend processes, so @swc/core should not be a hard dependency
for all cli-node consumers.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-16 13:03:17 +01:00
Patrik Oldsberg 4d081452b1 Address review feedback from freben
- Use cli-defaults instead of listing individual CLI modules in
  create-app template and root package.json
- Move nodeTransform config files from cli-module-build to cli-node
  to avoid cross-module direct imports
- Rename cli-module-create-github-app to cli-module-github
- Start createCliModule init chain with Promise.resolve()
- Deduplicate exitWithError in runCliModule.ts
- Extract shared isCommandNodeHidden to @internal/cli
- Add explanatory comment for fromArray deduplication field
- Restore error for cli role packages missing bin in runCliExtraction

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-16 12:55:22 +01:00
Patrik Oldsberg 7879215cca Add CLI module deduplication and improve conflict reporting
Individual CLI modules now silently take precedence over array-sourced
modules (e.g. from cli-defaults) when their commands overlap. Conflict
errors between non-array modules include both package names for easier
debugging.

Commands reference their parent module instead of storing a raw package
name string. createCliModule now validates that packageJson has a name.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-15 21:16:00 +01:00
Patrik Oldsberg c95a130f52 Add runCliModule helper for standalone module execution
Add a public `runCliModule` function to `@backstage/cli-node` that
allows CLI module packages to be executed directly as standalone
programs, without needing to be wired into a larger CLI host.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-14 12:40:43 +01:00
Patrik Oldsberg 18012b5802 Rename CliPlugin to CliModule and cli-plugin role to cli-module
Rename createCliPlugin to createCliModule, CliPlugin to CliModule, and
the cli-plugin package role to cli-module to better distinguish CLI
modules from other plugin types.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-14 12:40:43 +01:00
Patrik Oldsberg 1929a95b97 Rename BackstageCommand to CliCommand and CommandContext to CliCommandContext
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-14 12:40:43 +01:00
Patrik Oldsberg 7d055ef0c4 Merge cli-plugin-api into cli-node
Move createCliPlugin and related types from the standalone
@backstage/cli-plugin-api package into @backstage/cli-node and
remove the now-empty package.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
2026-03-14 12:40:43 +01:00
Patrik Oldsberg 94a885a2ef Add cli-plugin package role
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-03-14 12:39:21 +01:00
github-actions[bot] db0d171511 Version Packages (next) 2026-03-03 14:16:49 +00:00
Gabriel Dugny 3187a7a441 Merge remote-tracking branch 'origin/master' into package-workspaces 2026-02-27 12:05:03 +01:00
Patrik Oldsberg 09eb6b5187 Address further review feedback
- Rename hasYarnPlugin -> hasBackstageYarnPlugin for clarity
- Change SuccessCache.create to accept an options object

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-25 20:17:47 +01:00
Patrik Oldsberg 968570bbb5 Address review feedback
- Remove cli changeset, piggy-back on existing ones
- Rename getHasYarnPlugin -> hasYarnPlugin(workspaceDir?)
- Make SuccessCache constructor private, add static create()
- Consolidate duplicate @backstage/cli-node imports

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-25 20:17:47 +01:00
Patrik Oldsberg 3c811bf8a9 cli-node, cli: move yarnPlugin and SuccessCache to cli-node
Move `getHasYarnPlugin` and `SuccessCache` from `@backstage/cli` internal
modules to `@backstage/cli-node` as public exports, making them available
for reuse by other CLI tooling.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-25 20:17:22 +01:00
Patrik Oldsberg 5033936401 Keep versioning utilities internal to CLI migrate module
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-25 14:09:25 +01:00
Patrik Oldsberg 61cb976207 Consolidate Lockfile classes: move toString() and versioning utils to cli-node
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-25 11:59:30 +01:00
Gabriel Dugny 8ea65069f1 Merge branch 'master' into package-workspaces
Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>

# Conflicts:
#	packages/cli-node/src/pacman/yarn/Yarn.test.ts
#	packages/cli-node/src/pacman/yarn/Yarn.ts
2026-02-25 09:11:36 +01:00
github-actions[bot] 4bd6a3a1af Version Packages (next) 2026-02-24 19:24:06 +00:00
Patrik Oldsberg 641d88cb07 Address PR review comments
- Remove cli-node/src/paths.ts compat layer, migrate all cli-node
  internal usage to import targetPaths from @backstage/cli-common
- Use single-arg overrideTargetPaths('/root') where dir === rootDir
- Scope mockDir to each describe block in bump.test.ts to avoid
  shared state issues with overrideTargetPaths
- Remove unnecessary overrideTargetPaths from plugin-manager.test.ts
- Remove stale findPaths mock from createApp.test.ts
- Use overrideTargetPaths in getWorkspaceRoot.test.ts and cli-node tests

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 21:01:27 +01:00
Patrik Oldsberg 553e727d5f Fix lint errors: add eslint-disable for __dirname, fix no-use-before-define
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-23 14:44:11 +01:00
Patrik Oldsberg 07816d67f3 Address PR review comments
- Refactor targetPaths/findOwnPaths to class-based implementations with
  unified caching and .dir/.rootDir properties alongside resolve methods
- Replace jest.mock with jest.spyOn in plugin-manager.test.ts
- Remove paths compatibility wrapper from repo-tools, migrate all internal
  consumers to use targetPaths from @backstage/cli-common directly
- Fix changeset package name (@techdocs/cli not @backstage/techdocs-cli)
- Add migration examples to cli-common changeset
- Update API report for cli-common

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-23 14:44:11 +01:00
Patrik Oldsberg 70fc178697 Replace findPaths with targetPaths and findOwnPaths
Split the path resolution API in @backstage/cli-common into
targetPaths (cwd-based singleton) and findOwnPaths (package-relative).
Migrate all consumers across the repo away from the deprecated findPaths.

Rename TargetPaths/OwnPaths properties to resolve/resolveRoot,
removing the redundant type prefix from property names.

Make findOwnPaths calls lazy in modules - called inside functions
rather than at module scope.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 14:44:10 +01:00
Patrik Oldsberg f467a4126e Return object from runWorkerQueueThreads
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 11:38:23 +01:00
Patrik Oldsberg 90ffb54552 Rename parallel/ to concurrency/ and split into separate files
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 11:21:51 +01:00
Patrik Oldsberg 67958e2d6c Fix prettier formatting
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 10:59:43 +01:00
Patrik Oldsberg 4f0c7ec86a Address PR review feedback
- Rename runParallelWorkers to runConcurrentTasks, return void
- Rename ParallelWorkerOptions to ConcurrentTasksOptions
- Rename parallelismFactor to concurrencyFactor
- Remove unused runWorkerThreads and WorkerThreadsOptions
- Rename workerData to context in WorkerQueueThreadsOptions
- Drop threadCount from public API types
- Rename env var to BACKSTAGE_CLI_CONCURRENCY
- Make cli-node changeset a patch

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 00:41:17 +01:00
Gabriel Dugny bc6c024a4c chore: remove PackageManager getMonorepoPackages
Unused, prefer @manypkg/get-packages's getPackages instead.

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
2026-02-22 17:26:35 +01:00
Patrik Oldsberg c8237e212d Rename parallelism env var to BACKSTAGE_CLI_PARALLELISM
Renames from BACKSTAGE_CLI_BUILD_PARALLEL to the more general
BACKSTAGE_CLI_PARALLELISM. The old name is still supported but
logs a one-time deprecation warning.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2026-02-22 17:20:16 +01:00