feat(cem): add auro cem command to aggregate component manifests#297
feat(cem): add auro cem command to aggregate component manifests#297lindseyo1123 wants to merge 2 commits into
Conversation
Reviewer's GuideAdds a new Sequence diagram for auro cem manifest aggregation commandsequenceDiagram
actor User
participant auro_cli
participant Spinner
participant Unpkg
participant Logger
participant Filesystem
User->>auro_cli: auro cem --output <file>
auro_cli->>Spinner: ora.start()
loop AURO_COMPONENT_PACKAGES
auro_cli->>Unpkg: fetchManifest(pkg)
alt response_ok_and_valid_json
Unpkg-->>auro_cli: Manifest
else request_failed_or_not_ok_or_invalid_json
Unpkg-->>Logger: Logger.warn(...)
end
end
auro_cli->>auro_cli: mergeManifests(sources)
auro_cli->>Filesystem: writeFile(outputPath, aggregate)
alt write_success
Filesystem-->>Spinner: spinner.succeed(...)
else write_failure
Filesystem-->>Spinner: spinner.fail(...)
Spinner-->>auro_cli: process.exit(1)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
🚀 PR Release Published! |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
--aggregateoption is defined and documented but never read in the command action, so it currently has no effect and could either be removed or wired up to control behavior explicitly. - Given that
fetchManifestalways resolves (returningManifest | null) and never rejects,Promise.allSettledcan be simplified toPromise.alland the result mapping made more direct.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `--aggregate` option is defined and documented but never read in the command action, so it currently has no effect and could either be removed or wired up to control behavior explicitly.
- Given that `fetchManifest` always resolves (returning `Manifest | null`) and never rejects, `Promise.allSettled` can be simplified to `Promise.all` and the result mapping made more direct.
## Individual Comments
### Comment 1
<location path="src/commands/cem.ts" line_range="87" />
<code_context>
+ .description(
+ "Aggregate the Custom Elements Manifests of all published Auro components into a single file",
+ )
+ .option("--aggregate", "Fetch and merge every component manifest", true)
+ .option(
+ "-o, --output <file>",
</code_context>
<issue_to_address>
**issue (bug_risk):** The `--aggregate` option is defined but not used anywhere in the action handler.
Currently `--aggregate` has no effect; manifests are always aggregated. If you intend to support a non-aggregate mode, branch on `options.aggregate`. Otherwise, remove the option to prevent user confusion.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
🚀 PR Release Published! |
1abd81e to
621078e
Compare
|
🚀 PR Release Published! |
Adds 'auro cem' which fetches each published Auro component's custom-elements.json from unpkg and merges them into a single aggregated Custom Elements Manifest. Components that don't publish a manifest are skipped with a warning. Source module paths are namespaced by package so consumers can trace each declaration to its component. Produces one machine-readable API index for IDEs, docs tooling, and AI assistants. - src/static/auroComponents.ts: list of component packages to aggregate - src/commands/cem.ts: the command (--output, --aggregate) - registers the command and documents it in the README
Addresses review feedback on the cem aggregation command: - Deep-namespace internal module references (exports' declaration.module, references, etc.), not just the top-level module path, so the merged manifest's internal references stay valid. External references (those with a package) are left untouched. - Distinguish genuine 404s (component has no CEM yet) from transient network/5xx failures; exit non-zero when the aggregate is incomplete due to transient errors so CI can retry. - Defer skip messages until after the spinner so output isn't garbled. - Warn on mixed CEM schema versions. - Drop the no-op --aggregate flag and the empty readme field. - Correct the component-list doc comment (not all components publish a CEM).
621078e to
138c81f
Compare
|
🚀 PR Release Published! |
Summary
Adds a new
auro cemcommand that fetches each published Auro component'scustom-elements.jsonfrom unpkg and merges them into a single aggregated Custom Elements Manifest.An aggregated manifest gives IDEs, documentation tooling, and AI assistants one machine-readable index of every Auro component's API — props, attributes, slots, CSS parts, and events — instead of 30+ separate files.
Usage
Behavior
https://unpkg.com/<pkg>/custom-elements.jsonfor each component insrc/static/auroComponents.ts.pathis namespaced with its package (e.g.@aurodesignsystem/auro-button/src/auro-button.js) so paths stay unique and every declaration is traceable to its component.Testing
npm run buildsucceeds (TypeScript typechecks clean).auro-button(7 modules) andauro-card(4 modules) manifests → 11 correctly namespaced modules, valid CEM JSON.Follow-ups
Summary by Sourcery
Add a CLI command to aggregate Custom Elements Manifests for all published Auro components into a single output file.
New Features:
auro cemcommand to fetch and merge Custom Elements Manifests from all configured Auro component packages into one aggregated manifest.Enhancements:
cemcommand with the main CLI entrypoint and centralize the list of Auro component packages that publish manifests.Documentation:
auro cemcommand, its options, and usage examples in the README.