* Replace duplicate error utilities with @backstage/cli-common imports
Remove dead CustomError and ExitCodeError classes from repo-tools and
create-app, replacing them with the ExitCodeError import from
@backstage/cli-common. This fixes the instanceof check in exitWithError
so it actually catches errors thrown by cli-common's run().
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
* Add changeset for repo-tools and create-app
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
---------
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Remove the unused exported constants GENERATOR_VERSION, GENERATOR_NAME,
GENERATOR_FILE, and TS_MODULE from the OpenAPI constants module. The
TS_MODULE intermediate variable is inlined into TS_SCHEMA_PATH.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
The peer-deps verification was requiring all tracked peer dependencies
(including react-router-dom) for every package that references any of
them. Now it only requires a peer dependency if the package actually
references it or if it belongs to a group containing a referenced dep.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
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
Glob v13 treats backslashes as escape characters by default, unlike v7
which treated them as path separators on Windows. This broke Windows CI
where path.join/resolve produce backslash paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Addresses the high severity rollup path traversal vulnerability
(GHSA-mw96-cpmx-2vgc) and the glob security advisory by upgrading
all instances across the monorepo. Updates code that used the legacy
callback-based glob API to use the modern promise/sync API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Addresses the high severity rollup path traversal vulnerability
(GHSA-mw96-cpmx-2vgc) and the glob security advisory by upgrading
all instances across the monorepo. Updates code that used the legacy
callback-based glob API to use the modern promise/sync API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Addresses the high severity rollup path traversal vulnerability
(GHSA-mw96-cpmx-2vgc) and the glob security advisory by upgrading
all instances across the monorepo. Updates code that used the legacy
callback-based glob API to use the modern promise/sync API.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Converts createBinRunner from spawnSync to async spawn, and processes
all CLI packages concurrently with a shared p-limit limiter bounded
by CPU count. Reduces wall-clock time from ~50s to ~12s.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
- 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
The runApiExtraction function was detecting cli-report.md files as
stale API reports because they matched the report filename pattern.
These files are managed by runCliExtraction instead and should be
excluded from the stale report check.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Include cli-module role in CLI report generation alongside the
existing cli role. Packages without a bin field are silently skipped.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
The jest.mock('crypto') was replacing the entire module, causing
@smithy/uuid to fail with "Cannot read properties of undefined
(reading 'bind')" when @backstage/backend-test-utils was imported.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Re-add `.allowExcessArguments(true)` which was dropped during
conflict resolution in the Commander v14 upgrade (PR #32583).
lint-staged passes staged file paths as extra arguments when
invoking `generate-catalog-info` via the pre-commit hook, causing
Commander v14 to reject them with "too many arguments".
Signed-off-by: Johan Persson <johanopersson@gmail.com>
Cleye outputs ANSI bold escape sequences around section headers
(e.g. Usage:, Flags:) unconditionally, which prevented the help
page parser from recognizing them. Strip ANSI SGR sequences from
captured output and set NO_COLOR=1 in the child environment.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Remove fragile process.stdout._handle.setBlocking calls from CLI test
commands. Revert the preload workaround in repo-tools since the root
cause is removed.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Add a --require preload that stubs process.stdout._handle when stdout is
a SyncWriteStream (file-backed). Some CLI code accesses _handle.setBlocking
directly and would crash without the stub.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Use a temp file instead of a pipe for child process stdout in
createBinRunner. Node.js uses a SyncWriteStream for regular files, so
all writes complete synchronously before process.exit() can discard them.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Use spawnSync instead of spawn for child processes in createBinRunner.
This avoids stdout data loss when child processes call process.exit()
before Node.js flushes its internal stream buffer to the pipe.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
Add cleye-based --help handling to all commands using the loader pattern.
Update the CLI report parser to support cleye's USAGE: and FLAGS: sections.
Revert accidental backstage.role addition to eslint-plugin.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Adds `overrideTargetPaths` to `@backstage/cli-common/testUtils` for
cleanly mocking `targetPaths` in tests without `jest.mock` or
`jest.spyOn`. Migrates all existing test mocks to use the new utility.
Also fixes translations module imports broken by the rebase.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>