@astryxdesign/cli 0.6.5-canary.84fdbd1 → 0.6.5-canary.8a5b3fb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +21 -21
  2. package/api/build/_adapter.d.mts +5 -0
  3. package/api/build/_adapter.mjs +2 -0
  4. package/api/build/build.type.d.mts +8 -0
  5. package/api/build/build.type.mjs +2 -0
  6. package/api/build/kit/kit.mjs +1 -0
  7. package/api/component/component.mjs +17 -15
  8. package/api/component/component.type.d.mts +33 -3
  9. package/api/component/component.type.mjs +10 -3
  10. package/api/component/detail/blocks/blocks.d.mts +2 -1
  11. package/api/component/detail/blocks/blocks.mjs +5 -2
  12. package/api/component/detail/detail.mjs +5 -1
  13. package/api/component/detail/props/props.d.mts +2 -1
  14. package/api/component/detail/props/props.mjs +3 -2
  15. package/api/component/detail/showcase/showcase.d.mts +3 -1
  16. package/api/component/detail/showcase/showcase.mjs +3 -1
  17. package/api/component/detail/source/source.d.mts +3 -2
  18. package/api/component/detail/source/source.mjs +7 -3
  19. package/api/component/list/list.mjs +18 -6
  20. package/api/docs/_adapter.d.mts +11 -0
  21. package/api/docs/_adapter.mjs +25 -0
  22. package/api/docs/detail/detail.mjs +19 -3
  23. package/api/docs/detail/section/section.mjs +7 -1
  24. package/api/docs/docs.depth.test.mjs +2 -0
  25. package/api/docs/docs.mjs +2 -0
  26. package/api/docs/docs.type.d.mts +43 -3
  27. package/api/docs/docs.type.mjs +23 -3
  28. package/api/docs/index/index.mjs +11 -2
  29. package/api/docs/index/index.test.mjs +2 -1
  30. package/api/docs/node/node.mjs +3 -0
  31. package/api/hook/_adapter.d.mts +1 -0
  32. package/api/hook/_adapter.mjs +3 -0
  33. package/api/hook/detail/detail.mjs +2 -2
  34. package/api/hook/detail/params/params.mjs +2 -2
  35. package/api/hook/hook.type.d.mts +12 -0
  36. package/api/hook/hook.type.mjs +3 -0
  37. package/api/hook/list/list.mjs +8 -8
  38. package/api/search/search.d.mts +3 -3
  39. package/api/search/search.mjs +9 -5
  40. package/api/search/search.type.d.mts +2 -2
  41. package/api/search/search.type.mjs +1 -1
  42. package/api/swizzle/_adapter.d.mts +1 -0
  43. package/api/swizzle/_adapter.mjs +3 -0
  44. package/api/swizzle/copy/copy.mjs +1 -1
  45. package/api/swizzle/list/list.mjs +2 -2
  46. package/api/swizzle/swizzle.type.d.mts +8 -0
  47. package/api/swizzle/swizzle.type.mjs +2 -0
  48. package/api/template/copy/copy.mjs +2 -1
  49. package/api/template/show/show.mjs +2 -0
  50. package/api/template/skeleton/skeleton.mjs +2 -1
  51. package/api/template/template.d.mts +1 -1
  52. package/api/template/template.mjs +1 -0
  53. package/api/template/template.type.d.mts +12 -0
  54. package/api/template/template.type.mjs +3 -0
  55. package/api/upgrade/_adapter.d.mts +1 -0
  56. package/api/upgrade/_adapter.mjs +3 -0
  57. package/api/upgrade/list/list.mjs +9 -3
  58. package/api/upgrade/upgrade.type.d.mts +4 -0
  59. package/api/upgrade/upgrade.type.mjs +1 -0
  60. package/clients/cli/commands/build.mjs +7 -6
  61. package/clients/cli/commands/build.text-fields.test.mjs +1 -1
  62. package/clients/cli/commands/component/index.mjs +34 -6
  63. package/clients/cli/commands/docs.mjs +63 -23
  64. package/clients/cli/commands/hook/index.mjs +7 -2
  65. package/clients/cli/commands/swizzle.mjs +2 -1
  66. package/clients/cli/commands/template.mjs +8 -4
  67. package/clients/cli/commands/text-json-parity.test.mjs +22 -0
  68. package/clients/cli/commands/upgrade.mjs +1 -1
  69. package/clients/cli/index.mjs +1 -1
  70. package/foundation/discovery/docs-output-budget.d.mts +6 -2
  71. package/foundation/discovery/docs-output-budget.mjs +2 -1
  72. package/foundation/discovery/docs-section-key.d.mts +4 -2
  73. package/foundation/discovery/docs-section-key.mjs +1 -1
  74. package/foundation/doc-compiler/lenses.d.mts +4 -2
  75. package/foundation/doc-compiler/lenses.mjs +1 -1
  76. package/foundation/response/base.d.ts +9 -3
  77. package/foundation/response/json.d.mts +7 -4
  78. package/foundation/response/json.mjs +10 -6
  79. package/foundation/response/response-types.doc.mjs +25 -20
  80. package/foundation/response/response.doc.mjs +17 -3
  81. package/package.json +9 -9
package/README.md CHANGED
@@ -104,7 +104,7 @@ Options:
104
104
 
105
105
  `--json` works with every command listed in `jsonSupported` (`astryx manifest --json`), which is every command except the bare groups such as `astryx theme`. The other four change only the reads named here; other commands ignore them:
106
106
 
107
- - `--json`: Output as typed JSON envelope: `{ apiVersion, type, data, meta? }` (errors: `{ apiVersion, error, code, suggestions? }`)
107
+ - `--json`: Output as typed JSON envelope: `{ apiVersion, type, package?, data, meta? }` (errors: `{ apiVersion, error, code, suggestions? }`)
108
108
  - `--detail <level>`: Detail level for `component`, `hook`, and docs tree reads (such as `astryx docs cli/commands/build`), increasing in size: `brief` (names only, default for lists) < `compact` (names + 1-line descriptions) < `full` (full docs per entry). Single-item views default to `full`.
109
109
  - `--zh`: Simplified Chinese for component reads and for docs topics that have a translation (English otherwise)
110
110
  - `--dense`: Token-efficient dense text for `astryx component <Name>` and `astryx docs <topic>`
@@ -424,18 +424,18 @@ Every response has a `type` discriminant. The full set is below (generated from
424
424
  | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
425
425
  | `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
426
426
  | `init.remove` | Confirmation that the managed agent-docs block was removed (`data.removed: true`) — returned when --remove-agents is set. |
427
- | `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries, or a full ComponentDoc per entry. |
427
+ | `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |
428
428
  | `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |
429
- | `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). |
430
- | `component.detail.props` | Just one component's props table (ComponentPropDoc[]). |
431
- | `component.detail.source` | One component's source file, as {component, source}. |
432
- | `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. |
433
- | `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry. |
429
+ | `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |
430
+ | `component.detail.props` | Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component. |
431
+ | `component.detail.source` | One component's source file, as {component, source}. The envelope's package names the npm package that owns the component. |
432
+ | `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |
433
+ | `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category}); each block names the package that owns it, and the envelope's package names the component's owner. |
434
434
  | `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |
435
- | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
436
- | `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, summary} (pass the id as the section argument; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
437
- | `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). |
438
- | `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |
435
+ | `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
436
+ | `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
437
+ | `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |
438
+ | `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |
439
439
  | `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
440
440
  | `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
441
441
  | `discover.list` | The integrations the project loads (name, category, components, version, a list per other kind they add, and latest when a source knows it); with a discover source, meta.available lists what the project could add and meta.sources reports each source; when empty it carries meta.configured to tell "nothing configured" from "nothing discovered". |
@@ -443,21 +443,21 @@ Every response has a `type` discriminant. The full set is below (generated from
443
443
  | `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |
444
444
  | `discover.item` | One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package. |
445
445
  | `discover.search` | The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list. |
446
- | `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, score, reason, description, command}, plus import (components, hooks), title, parent (the command that opens the level above), package (for a docs-tree hit), and, for a hit on one section, section (docs), or displayName and kind (templates). |
446
+ | `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, package, score, reason, description, command} (package is the npm package that owns the result), plus import (components, hooks), title, parent (the command that opens the level above), and, for a hit on one section, section (docs), or displayName and kind (templates). |
447
447
  | `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |
448
- | `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, command, basis, reason, alternatives, ...}, pages (search's closest templates), blocks and domain as SearchResultEntry[], frame, foundation, and hint {reason, commands} when thin. |
449
- | `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. |
450
- | `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. |
448
+ | `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, package, command, basis, reason, alternatives, ...} (the start and each alternative name the package that owns the template), pages (search's closest templates), blocks and domain as SearchResultEntry[] (each naming its package), frame and foundation (Core component names), and hint {reason, commands} when thin. |
449
+ | `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |
450
+ | `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package. |
451
451
  | `gap-report.categories` | The fixed gap category values and human-readable labels. |
452
452
  | `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals. |
453
453
  | `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |
454
454
  | `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |
455
- | `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. |
456
- | `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |
455
+ | `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. The envelope's package names the npm package that owns the template. |
456
+ | `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). The envelope's package names the npm package that owns the template. |
457
457
  | `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
458
- | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. |
459
- | `hook.detail` | One hook's full authored HookDoc. |
460
- | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). |
458
+ | `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |
459
+ | `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |
460
+ | `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |
461
461
  | `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
462
462
  | `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
463
463
  | `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
@@ -466,7 +466,7 @@ Every response has a `type` discriminant. The full set is below (generated from
466
466
  | `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
467
467
  | `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states, deprecatedFor?}, where props and states are its legal override keys and deprecatedFor names the canonical replacement key. |
468
468
  | `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
469
- | `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. |
469
+ | `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |
470
470
  | `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |
471
471
  | `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
472
472
  | `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
@@ -8,6 +8,7 @@
8
8
  * @property {string} command `astryx template <id> --type page`, the command that selects exactly this template: an integration replacement is selected by the Core id it replaces, and `--type page` keeps a block with the same id from making it ambiguous. Search prints template commands the same way.
9
9
  * @property {string} displayName Human-facing name.
10
10
  * @property {string} description What the page is and how it is laid out.
11
+ * @property {string} package The npm package that owns this template.
11
12
  * @property {string} category The template's own `Family - Variant` label; empty when it declares none.
12
13
  * @property {string[]} keywords The ideas the page serves, as its own descriptor names them; empty when it declares none.
13
14
  */
@@ -74,6 +75,10 @@ export type PageTemplate = {
74
75
  * What the page is and how it is laid out.
75
76
  */
76
77
  description: string;
78
+ /**
79
+ * The npm package that owns this template.
80
+ */
81
+ package: string;
77
82
  /**
78
83
  * The template's own `Family - Variant` label; empty when it declares none.
79
84
  */
@@ -29,6 +29,7 @@ import {findCoreDir} from '../../foundation/fs/paths.mjs';
29
29
  * @property {string} command `astryx template <id> --type page`, the command that selects exactly this template: an integration replacement is selected by the Core id it replaces, and `--type page` keeps a block with the same id from making it ambiguous. Search prints template commands the same way.
30
30
  * @property {string} displayName Human-facing name.
31
31
  * @property {string} description What the page is and how it is laid out.
32
+ * @property {string} package The npm package that owns this template.
32
33
  * @property {string} category The template's own `Family - Variant` label; empty when it declares none.
33
34
  * @property {string[]} keywords The ideas the page serves, as its own descriptor names them; empty when it declares none.
34
35
  */
@@ -65,6 +66,7 @@ export async function loadPageTemplates(cwd) {
65
66
  name: t.dirName,
66
67
  displayName: t.displayName || t.name,
67
68
  description: t.description || '',
69
+ package: t.package ?? '@astryxdesign/core',
68
70
  category: t.category || '',
69
71
  keywords: t.keywords ?? [],
70
72
  // The id `template()` resolves back to this entry: an active replacement
@@ -60,6 +60,10 @@ export type BuildStart = {
60
60
  * What the page is: its layout and the ideas it serves.
61
61
  */
62
62
  description: string;
63
+ /**
64
+ * The npm package that owns this template.
65
+ */
66
+ package: string;
63
67
  /**
64
68
  * The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is a placeholder for the file or folder to write the template to, and the `astryx` prefix is for the caller to replace with its own invocation.
65
69
  */
@@ -93,6 +97,10 @@ export type BuildAlternative = {
93
97
  * What the page is: its layout and the ideas it serves.
94
98
  */
95
99
  description: string;
100
+ /**
101
+ * The npm package that owns this template.
102
+ */
103
+ package: string;
96
104
  /**
97
105
  * The scaffold command, in the same form as the start's.
98
106
  */
@@ -42,6 +42,7 @@
42
42
  * @property {string} name Template id, as `astryx template <name>` takes it.
43
43
  * @property {string} displayName Human-facing template name.
44
44
  * @property {string} description What the page is: its layout and the ideas it serves.
45
+ * @property {string} package The npm package that owns this template.
45
46
  * @property {string} command The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is a placeholder for the file or folder to write the template to, and the `astryx` prefix is for the caller to replace with its own invocation.
46
47
  * @property {'direct' | 'closest' | 'fallback'} basis Why this template. The page ranker picks every start: it weighs each matched word by how rare it is among page templates, favors the family the idea's head names and the container it names ("in a modal"), and discounts words that only modify another. `direct` when its pick is also search's direct match (`directMatch`); `closest` when it is not; `fallback` when no template has the evidence to lead and the page starts from the app shell.
47
48
  * @property {string} reason One sentence saying the same as `basis`, for a reader.
@@ -55,6 +56,7 @@
55
56
  * @property {string} name Template id, as `astryx template <name>` takes it.
56
57
  * @property {string} displayName Human-facing template name.
57
58
  * @property {string} description What the page is: its layout and the ideas it serves.
59
+ * @property {string} package The npm package that owns this template.
58
60
  * @property {string} command The scaffold command, in the same form as the start's.
59
61
  */
60
62
 
@@ -120,6 +120,7 @@ const ALWAYS = new Set([...FRAME, ...FOUNDATION]);
120
120
  */
121
121
  const asTemplate = t => ({
122
122
  name: t.name,
123
+ package: t.package,
123
124
  displayName: t.displayName,
124
125
  description: t.description,
125
126
  command: `${t.command} <path>`,
@@ -394,6 +394,7 @@ export async function component(name, options = {}) {
394
394
  name,
395
395
  notFoundInPackage:
396
396
  scoped.kind === 'integration' ? packageScope : null,
397
+ ownerPackage: owner.package,
397
398
  });
398
399
  }
399
400
  // showcase/blocks were previously dropped on the scoped path — a
@@ -404,20 +405,20 @@ export async function component(name, options = {}) {
404
405
  // a showcase, so skip discovery entirely.
405
406
  if (showcase) {
406
407
  return scoped.kind === 'core'
407
- ? componentDetailShowcase(dirName, {cwd, name})
408
- : componentDetailShowcase(dirName, {cwd, name, resolve: false});
408
+ ? componentDetailShowcase(dirName, {cwd, name, ownerPackage: owner.package})
409
+ : componentDetailShowcase(dirName, {cwd, name, resolve: false, ownerPackage: owner.package});
409
410
  }
410
411
  if (blocks) {
411
- return componentDetailBlocks(dirName, cwd);
412
+ return componentDetailBlocks(dirName, cwd, owner.package);
412
413
  }
413
414
  const docs = await loadComponentDoc(owner.docPath, docOpts);
414
- if (props) return componentDetailProps(docs);
415
+ if (props) return componentDetailProps(docs, owner.package);
415
416
  return componentDetail(docs, owner, dirName, coreDir);
416
417
  }
417
418
 
418
419
  // Legacy `pkg.astryx.docs` external package.
419
420
  if (showcase) {
420
- return componentDetailShowcase(dirName, {cwd, name, packageScope});
421
+ return componentDetailShowcase(dirName, {cwd, name, packageScope, ownerPackage: packageScope});
421
422
  }
422
423
  const extDocPath = resolveLegacyExternalDoc(scoped.ext, dirName);
423
424
  if (extDocPath) {
@@ -426,13 +427,14 @@ export async function component(name, options = {}) {
426
427
  return componentDetailSource(dirName, null, {
427
428
  name,
428
429
  notFoundInPackage: packageScope,
430
+ ownerPackage: scoped.ext.name,
429
431
  });
430
432
  }
431
433
  if (blocks) {
432
- return componentDetailBlocks(dirName, cwd);
434
+ return componentDetailBlocks(dirName, cwd, scoped.ext.name);
433
435
  }
434
436
  const docs = await loadComponentDoc(extDocPath, docOpts);
435
- if (props) return componentDetailProps(docs);
437
+ if (props) return componentDetailProps(docs, scoped.ext.name);
436
438
  return componentDetail(
437
439
  docs,
438
440
  {package: scoped.ext.name, sourcePath: null},
@@ -476,14 +478,14 @@ export async function component(name, options = {}) {
476
478
  ) {
477
479
  const owner = effectiveOwners[0];
478
480
  if (source) {
479
- return componentDetailSource(dirName, owner.sourcePath, {name});
481
+ return componentDetailSource(dirName, owner.sourcePath, {name, ownerPackage: owner.package});
480
482
  }
481
483
  if (showcase) {
482
484
  // Integration components don't carry showcases — fail without scanning.
483
- return componentDetailShowcase(dirName, {cwd, name, resolve: false});
485
+ return componentDetailShowcase(dirName, {cwd, name, resolve: false, ownerPackage: owner.package});
484
486
  }
485
487
  const docs = await loadComponentDoc(owner.docPath, docOpts);
486
- if (props) return componentDetailProps(docs);
488
+ if (props) return componentDetailProps(docs, owner.package);
487
489
  return componentDetail(docs, owner, dirName, coreDir);
488
490
  }
489
491
 
@@ -493,11 +495,11 @@ export async function component(name, options = {}) {
493
495
  return componentDetailSource(
494
496
  dirName,
495
497
  resolveCoreSourcePath(coreDir, dirName),
496
- {name},
498
+ {name, ownerPackage: CORE_PACKAGE},
497
499
  );
498
500
  }
499
501
  if (showcase) {
500
- return componentDetailShowcase(dirName, {cwd, name});
502
+ return componentDetailShowcase(dirName, {cwd, name, ownerPackage: CORE_PACKAGE});
501
503
  }
502
504
 
503
505
  const resolved = await resolveUnscopedDoc(dirName, {coreDir, cwd, name});
@@ -505,7 +507,7 @@ export async function component(name, options = {}) {
505
507
 
506
508
  // ── Blocks mode ──────────────────────────────────────────────
507
509
  if (blocks) {
508
- return componentDetailBlocks(dirName, cwd);
510
+ return componentDetailBlocks(dirName, cwd, resolved.resolvedOwnerPackage);
509
511
  }
510
512
 
511
513
  // ── Sub-component scoping ────────────────────────────────────
@@ -514,7 +516,7 @@ export async function component(name, options = {}) {
514
516
  const sub = scopeSubComponent(docs, dirName, coreDir);
515
517
  if (sub) {
516
518
  if (props)
517
- return componentDetailProps({props: sub.matchingComponent.props});
519
+ return componentDetailProps({props: sub.matchingComponent.props}, resolved.resolvedOwnerPackage);
518
520
  return componentDetail(
519
521
  sub.scoped,
520
522
  {
@@ -526,7 +528,7 @@ export async function component(name, options = {}) {
526
528
  );
527
529
  }
528
530
 
529
- if (props) return componentDetailProps(docs);
531
+ if (props) return componentDetailProps(docs, resolved.resolvedOwnerPackage);
530
532
  return componentDetail(
531
533
  docs,
532
534
  {
@@ -8,8 +8,8 @@
8
8
  * the depth is carried in `data.detail` and `data.components` holds the grouped
9
9
  * map whose entry shape depends on that level:
10
10
  * - 'names' -> ComponentListEntry[] (name + owner package + optional import)
11
- * - 'compact' -> ComponentBriefEntry[] (name + 1-line description + import)
12
- * - 'full' -> ComponentDoc[] (full authored doc per entry)
11
+ * - 'compact' -> ComponentBriefEntry[] (name + owner package + 1-line description + import)
12
+ * - 'full' -> ComponentDoc[] (full authored doc per entry, plus its owner package)
13
13
  */
14
14
  export type ComponentListResponse = {
15
15
  type: "component.list";
@@ -26,7 +26,9 @@ export type ComponentListData = ({
26
26
  components: Record<string, ComponentBriefEntry[]>;
27
27
  } | {
28
28
  detail: "full";
29
- components: Record<string, import("@astryxdesign/cli/authoring").ComponentDoc[]>;
29
+ components: Record<string, Array<import("@astryxdesign/cli/authoring").ComponentDoc & {
30
+ package: string;
31
+ }>>;
30
32
  });
31
33
  /**
32
34
  * `component(string[])` always returns this type, including empty and one-item
@@ -77,6 +79,10 @@ export type ComponentListEntry = {
77
79
  */
78
80
  export type ComponentBriefEntry = {
79
81
  name: string;
82
+ /**
83
+ * - Owner package; '@astryxdesign/core' for a Core component.
84
+ */
85
+ package: string;
80
86
  description: string;
81
87
  import: string;
82
88
  };
@@ -85,6 +91,10 @@ export type ComponentBriefEntry = {
85
91
  */
86
92
  export type ComponentDetailResponse = {
87
93
  type: "component.detail";
94
+ /**
95
+ * The npm package that owns the component.
96
+ */
97
+ package: string;
88
98
  data: import("@astryxdesign/cli/authoring").ComponentDoc & ComponentOwnership & ComponentDetailScope;
89
99
  };
90
100
  /**
@@ -121,6 +131,10 @@ export type ComponentOwnership = {
121
131
  */
122
132
  export type ComponentDetailPropsResponse = {
123
133
  type: "component.detail.props";
134
+ /**
135
+ * The npm package that owns the component.
136
+ */
137
+ package: string;
124
138
  data: import("@astryxdesign/cli/authoring").ComponentPropDoc[];
125
139
  };
126
140
  /**
@@ -128,6 +142,10 @@ export type ComponentDetailPropsResponse = {
128
142
  */
129
143
  export type ComponentDetailSourceResponse = {
130
144
  type: "component.detail.source";
145
+ /**
146
+ * The npm package that owns the component.
147
+ */
148
+ package: string;
131
149
  data: {
132
150
  component: string;
133
151
  source: string;
@@ -138,6 +156,10 @@ export type ComponentDetailSourceResponse = {
138
156
  */
139
157
  export type ComponentDetailShowcaseResponse = {
140
158
  type: "component.detail.showcase";
159
+ /**
160
+ * The npm package that owns the component.
161
+ */
162
+ package: string;
141
163
  data: {
142
164
  component: string;
143
165
  aspectRatio: number;
@@ -149,6 +171,10 @@ export type ComponentDetailShowcaseResponse = {
149
171
  */
150
172
  export type ComponentDetailBlocksResponse = {
151
173
  type: "component.detail.blocks";
174
+ /**
175
+ * The npm package that owns the component.
176
+ */
177
+ package: string;
152
178
  data: {
153
179
  component: string;
154
180
  showcase: BlockEntry | null;
@@ -158,6 +184,10 @@ export type ComponentDetailBlocksResponse = {
158
184
  };
159
185
  export type BlockEntry = {
160
186
  name: string;
187
+ /**
188
+ * The npm package that owns the block template.
189
+ */
190
+ package: string;
161
191
  displayName: string;
162
192
  description: string;
163
193
  isShowcase: boolean;
@@ -36,8 +36,8 @@
36
36
  * the depth is carried in `data.detail` and `data.components` holds the grouped
37
37
  * map whose entry shape depends on that level:
38
38
  * - 'names' -> ComponentListEntry[] (name + owner package + optional import)
39
- * - 'compact' -> ComponentBriefEntry[] (name + 1-line description + import)
40
- * - 'full' -> ComponentDoc[] (full authored doc per entry)
39
+ * - 'compact' -> ComponentBriefEntry[] (name + owner package + 1-line description + import)
40
+ * - 'full' -> ComponentDoc[] (full authored doc per entry, plus its owner package)
41
41
  * @typedef {object} ComponentListResponse
42
42
  * @property {'component.list'} type
43
43
  * @property {ComponentListData} data
@@ -48,7 +48,7 @@
48
48
  * @typedef {(
49
49
  * | {detail: 'names'; components: Record<string, ComponentListEntry[]>}
50
50
  * | {detail: 'compact'; components: Record<string, ComponentBriefEntry[]>}
51
- * | {detail: 'full'; components: Record<string, import('@astryxdesign/cli/authoring').ComponentDoc[]>}
51
+ * | {detail: 'full'; components: Record<string, Array<import('@astryxdesign/cli/authoring').ComponentDoc & {package: string}>>}
52
52
  * )} ComponentListData
53
53
  */
54
54
 
@@ -110,6 +110,7 @@
110
110
  * A single entry in a `component.list` group at `detail: 'compact'`.
111
111
  * @typedef {object} ComponentBriefEntry
112
112
  * @property {string} name
113
+ * @property {string} package - Owner package; '@astryxdesign/core' for a Core component.
113
114
  * @property {string} description
114
115
  * @property {string} import
115
116
  */
@@ -118,6 +119,7 @@
118
119
  * astryx --json component <name>
119
120
  * @typedef {object} ComponentDetailResponse
120
121
  * @property {'component.detail'} type
122
+ * @property {string} package The npm package that owns the component.
121
123
  * @property {import('@astryxdesign/cli/authoring').ComponentDoc & ComponentOwnership & ComponentDetailScope} data
122
124
  */
123
125
 
@@ -142,6 +144,7 @@
142
144
  * astryx --json component <name> --props
143
145
  * @typedef {object} ComponentDetailPropsResponse
144
146
  * @property {'component.detail.props'} type
147
+ * @property {string} package The npm package that owns the component.
145
148
  * @property {import('@astryxdesign/cli/authoring').ComponentPropDoc[]} data
146
149
  */
147
150
 
@@ -149,6 +152,7 @@
149
152
  * astryx --json component <name> --source
150
153
  * @typedef {object} ComponentDetailSourceResponse
151
154
  * @property {'component.detail.source'} type
155
+ * @property {string} package The npm package that owns the component.
152
156
  * @property {{component: string; source: string}} data
153
157
  */
154
158
 
@@ -156,6 +160,7 @@
156
160
  * astryx --json component <name> --showcase
157
161
  * @typedef {object} ComponentDetailShowcaseResponse
158
162
  * @property {'component.detail.showcase'} type
163
+ * @property {string} package The npm package that owns the component.
159
164
  * @property {{component: string; aspectRatio: number; source: string}} data
160
165
  */
161
166
 
@@ -163,12 +168,14 @@
163
168
  * astryx --json component <name> --blocks
164
169
  * @typedef {object} ComponentDetailBlocksResponse
165
170
  * @property {'component.detail.blocks'} type
171
+ * @property {string} package The npm package that owns the component.
166
172
  * @property {{component: string; showcase: BlockEntry | null; examples: BlockEntry[]; related: BlockEntry[]}} data
167
173
  */
168
174
 
169
175
  /**
170
176
  * @typedef {object} BlockEntry
171
177
  * @property {string} name
178
+ * @property {string} package The npm package that owns the block template.
172
179
  * @property {string} displayName
173
180
  * @property {string} description
174
181
  * @property {boolean} isShowcase
@@ -7,6 +7,7 @@
7
7
  * and broader related blocks.
8
8
  * @param {string} componentName
9
9
  * @param {string} cwd - project to discover blocks from; never the process cwd
10
+ * @param {string} ownerPackage - the npm package that owns the component
10
11
  * @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
11
12
  */
12
- export function componentDetailBlocks(componentName: string, cwd: string): Promise<import("../../component.type.mjs").ComponentDetailBlocksResponse>;
13
+ export function componentDetailBlocks(componentName: string, cwd: string, ownerPackage: string): Promise<import("../../component.type.mjs").ComponentDetailBlocksResponse>;
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import * as path from 'node:path';
12
- import {findRelatedBlocks} from '../../../template/template.mjs';
12
+ import {findRelatedBlocks, pkgOf} from '../../../template/template.mjs';
13
13
 
14
14
  /**
15
15
  * Project a component's related blocks into the `component.detail.blocks`
@@ -17,12 +17,14 @@ import {findRelatedBlocks} from '../../../template/template.mjs';
17
17
  * and broader related blocks.
18
18
  * @param {string} componentName
19
19
  * @param {string} cwd - project to discover blocks from; never the process cwd
20
+ * @param {string} ownerPackage - the npm package that owns the component
20
21
  * @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
21
22
  */
22
- export async function componentDetailBlocks(componentName, cwd) {
23
+ export async function componentDetailBlocks(componentName, cwd, ownerPackage) {
23
24
  const allBlocks = await findRelatedBlocks(componentName, cwd);
24
25
  const toEntry = (/** @type {any} */ b) => ({
25
26
  name: b.dirName,
27
+ package: pkgOf(b),
26
28
  displayName: b.name,
27
29
  description: b.description,
28
30
  isShowcase: b.isShowcase ?? false,
@@ -46,6 +48,7 @@ export async function componentDetailBlocks(componentName, cwd) {
46
48
 
47
49
  return {
48
50
  type: 'component.detail.blocks',
51
+ package: ownerPackage,
49
52
  data: {
50
53
  component: componentName,
51
54
  showcase: showcaseBlock ? toEntry(showcaseBlock) : null,
@@ -19,5 +19,9 @@ import {withOwnership} from '../_adapter.mjs';
19
19
  * @returns {import('../component.type.mjs').ComponentDetailResponse}
20
20
  */
21
21
  export function componentDetail(docs, owner, componentName, coreDir) {
22
- return {type: 'component.detail', data: withOwnership(docs, owner, componentName, coreDir)};
22
+ return {
23
+ type: 'component.detail',
24
+ package: owner.package,
25
+ data: withOwnership(docs, owner, componentName, coreDir),
26
+ };
23
27
  }
@@ -4,6 +4,7 @@
4
4
  /**
5
5
  * Project a resolved doc into the `component.detail.props` envelope.
6
6
  * @param {import('../../_adapter.mjs').LoadedComponentDoc} docs
7
+ * @param {string} ownerPackage - the npm package that owns the component
7
8
  * @returns {import('../../component.type.mjs').ComponentDetailPropsResponse}
8
9
  */
9
- export function componentDetailProps(docs: import("../../_adapter.mjs").LoadedComponentDoc): import("../../component.type.mjs").ComponentDetailPropsResponse;
10
+ export function componentDetailProps(docs: import("../../_adapter.mjs").LoadedComponentDoc, ownerPackage: string): import("../../component.type.mjs").ComponentDetailPropsResponse;
@@ -13,8 +13,9 @@ import {extractProps} from '../../_adapter.mjs';
13
13
  /**
14
14
  * Project a resolved doc into the `component.detail.props` envelope.
15
15
  * @param {import('../../_adapter.mjs').LoadedComponentDoc} docs
16
+ * @param {string} ownerPackage - the npm package that owns the component
16
17
  * @returns {import('../../component.type.mjs').ComponentDetailPropsResponse}
17
18
  */
18
- export function componentDetailProps(docs) {
19
- return {type: 'component.detail.props', data: extractProps(docs)};
19
+ export function componentDetailProps(docs, ownerPackage) {
20
+ return {type: 'component.detail.props', package: ownerPackage, data: extractProps(docs)};
20
21
  }
@@ -12,11 +12,13 @@
12
12
  * @param {string} ctx.name - the caller's original input, used in the error message
13
13
  * @param {string|null} [ctx.packageScope] - scope block discovery + the error to a package
14
14
  * @param {boolean} [ctx.resolve] - when false, skip discovery and treat as not found
15
+ * @param {string} ctx.ownerPackage - the npm package that owns the component
15
16
  * @returns {Promise<import('../../component.type.mjs').ComponentDetailShowcaseResponse>}
16
17
  */
17
- export function componentDetailShowcase(componentName: string, { cwd, name, packageScope, resolve }: {
18
+ export function componentDetailShowcase(componentName: string, { cwd, name, packageScope, resolve, ownerPackage }: {
18
19
  cwd: string;
19
20
  name: string;
20
21
  packageScope?: string | null | undefined;
21
22
  resolve?: boolean | undefined;
23
+ ownerPackage: string;
22
24
  }): Promise<import("../../component.type.mjs").ComponentDetailShowcaseResponse>;
@@ -24,9 +24,10 @@ import {findShowcase} from '../../../template/template.mjs';
24
24
  * @param {string} ctx.name - the caller's original input, used in the error message
25
25
  * @param {string|null} [ctx.packageScope] - scope block discovery + the error to a package
26
26
  * @param {boolean} [ctx.resolve] - when false, skip discovery and treat as not found
27
+ * @param {string} ctx.ownerPackage - the npm package that owns the component
27
28
  * @returns {Promise<import('../../component.type.mjs').ComponentDetailShowcaseResponse>}
28
29
  */
29
- export async function componentDetailShowcase(componentName, {cwd, name, packageScope = null, resolve = true}) {
30
+ export async function componentDetailShowcase(componentName, {cwd, name, packageScope = null, resolve = true, ownerPackage}) {
30
31
  const match = resolve
31
32
  ? await findShowcase(componentName, cwd, packageScope ? {package: packageScope} : undefined)
32
33
  : null;
@@ -36,6 +37,7 @@ export async function componentDetailShowcase(componentName, {cwd, name, package
36
37
  }
37
38
  return {
38
39
  type: 'component.detail.showcase',
40
+ package: ownerPackage,
39
41
  data: {
40
42
  component: componentName,
41
43
  aspectRatio: /** @type {number} */ (match.aspectRatio),