Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions apps/cli/.releaserc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
*
* Keep in sync with .github/workflows/release-cli.yml paths: trigger.
*/
require('../../scripts/semantic-release/patch-commit-filter.cjs')([
const RELEASE_PATHS = [
'apps/cli',
'packages/document-api',
'packages/superdoc',
Comment on lines +15 to 18

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Release paths drift 🐞 Bug ≡ Correctness

apps/cli/.releaserc.cjs documents RELEASE_PATHS as needing to stay in sync with
.github/workflows/release-cli.yml, but it omits scripts/semantic-release/** which the workflow
uses to trigger. This can make the release workflow run while semantic-release commit analysis (via
patch-commit-filter) excludes the commits that triggered the run, leading to unexpected no-op
releases and/or missing scoped release notes.
Agent Prompt
### Issue description
`apps/cli/.releaserc.cjs` defines `RELEASE_PATHS` and explicitly says it must be kept in sync with `.github/workflows/release-cli.yml` trigger paths, but the lists are currently not aligned. The workflow triggers on changes under `scripts/semantic-release/**`, while `RELEASE_PATHS` does not include that path, and the same list is used both for commit filtering (via `patch-commit-filter.cjs`) and AI notes scoping.

Because `patch-commit-filter.cjs` appends the provided paths as `git log -- <paths>` filters, missing a workflow-trigger path can cause semantic-release to not see commits that caused the workflow run.

### Issue Context
- Workflow triggers include `scripts/semantic-release/**`.
- `RELEASE_PATHS` is used for:
  - commit analysis scope (`patch-commit-filter.cjs`)
  - stable AI notes scope (`semantic-release-ai-notes` config)

### Fix Focus Areas
- apps/cli/.releaserc.cjs[15-61]

### Suggested fix
Either:
1) Add the missing workflow-trigger paths (at least `scripts/semantic-release`) to `RELEASE_PATHS`, **or**
2) Split the configuration into two lists:
   - `COMMIT_INCLUDE_PATHS` (must match workflow trigger paths; include `scripts/semantic-release`)
   - `AI_NOTES_SCOPE_PATHS` (optional; can exclude release tooling if you don’t want it in notes)

Then pass `COMMIT_INCLUDE_PATHS` to `patch-commit-filter.cjs` and `AI_NOTES_SCOPE_PATHS` to the AI notes `scope.paths`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Expand All @@ -22,7 +22,9 @@ require('../../scripts/semantic-release/patch-commit-filter.cjs')([
'packages/preset-geometry',
'shared',
'pnpm-workspace.yaml',
]);
];

require('../../scripts/semantic-release/patch-commit-filter.cjs')(RELEASE_PATHS);

const branch = process.env.GITHUB_REF_NAME || process.env.CI_COMMIT_BRANCH;

Expand All @@ -42,7 +44,21 @@ const shouldCommentOnRelease = !isPrerelease;
const shouldCommentOnLinearRelease = true;

// Use AI-powered notes for stable releases, conventional generator for prereleases
const notesPlugin = isPrerelease ? createReleaseNotesGenerator() : ['semantic-release-ai-notes', { style: 'concise' }];
const notesPlugin = isPrerelease
? createReleaseNotesGenerator()
: [
'semantic-release-ai-notes',
{
style: 'concise',
scope: {
name: 'SuperDoc CLI',
paths: RELEASE_PATHS,
audience: 'Developers using the SuperDoc CLI to convert and process documents from the command line',
instructions:
'This CLI wraps the document engine. Only mention engine changes when they change CLI commands, output, or supported document operations.',
},
},
];

const config = {
branches,
Expand Down
15 changes: 15 additions & 0 deletions apps/cli/src/__tests__/lib/args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ describe('parseCommandArgs', () => {
expect(result.options.name).toBe('bob');
});

test('reports a missing value without consuming the following option', () => {
const result = parseCommandArgs(['--name', '--verbose'], specs);

expect(result.errors).toEqual(['--name requires a value.']);
expect(result.options.name).toBeUndefined();
expect(result.options.verbose).toBe(true);
});

test('accepts an option-like string when provided inline', () => {
const result = parseCommandArgs(['--name=--verbose'], specs);

expect(result.errors).toEqual([]);
expect(result.options.name).toBe('--verbose');
});

test('parses number options', () => {
const result = parseCommandArgs(['--count', '42'], specs);
expect(result.options.count).toBe(42);
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/lib/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export function parseCommandArgs(tokens: string[], specs: OptionSpec[]): ParsedA
}
} else {
const valueToken = inlineValue ?? tokens[i + 1];
if (valueToken == null) {
if (valueToken == null || (inlineValue == null && valueToken.startsWith('--'))) {
errors.push(`--${rawName} requires a value.`);
i += 1;
continue;
Expand Down
56 changes: 8 additions & 48 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ catalog:
rollup-plugin-copy: ^3.5.0
rollup-plugin-visualizer: ^5.12.0
semantic-release: ^24.2.7
semantic-release-ai-notes: ^0.2.3
semantic-release-ai-notes: ^0.4.0
semantic-release-commit-filter: ^1.0.2
sirv: ^3.0.2
tippy.js: ^6.3.7
Expand Down
Loading