@event4u/agent-config 9.10.0 → 9.11.0

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 (121) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +59 -0
  3. package/README.md +12 -15
  4. package/agents/templates/.ai-council.yml.example +481 -0
  5. package/agents/templates/.ai-video.xml.example +247 -0
  6. package/dist/agent-src/rules/design-fidelity.md +1 -1
  7. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +15 -2
  8. package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
  9. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  10. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +30 -30
  11. package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
  12. package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +20 -0
  13. package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +20 -1
  14. package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +179 -0
  15. package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +155 -4
  16. package/dist/agent-src/templates/scripts/work_engine/state.ts +21 -4
  17. package/dist/cli/initRouting.js +74 -11
  18. package/dist/cli/initRouting.js.map +1 -1
  19. package/dist/cli/main.js +14 -3
  20. package/dist/cli/main.js.map +1 -1
  21. package/dist/cli-delegate/chunk-4SV3XGFA.js +6910 -0
  22. package/dist/cli-delegate/chunk-736JCWLM.js +1104 -0
  23. package/dist/cli-delegate/chunk-7DSAMZFU.js +356 -0
  24. package/dist/cli-delegate/chunk-7HQ52DHU.js +74 -0
  25. package/dist/cli-delegate/chunk-BJGXZNPM.js +266 -0
  26. package/dist/cli-delegate/chunk-FTAISGDQ.js +117 -0
  27. package/dist/cli-delegate/chunk-GME3Q44L.js +82 -0
  28. package/dist/cli-delegate/chunk-GRRPEPRN.js +336 -0
  29. package/dist/cli-delegate/chunk-HJ6DAJHR.js +502 -0
  30. package/dist/cli-delegate/chunk-IR7P7JWA.js +872 -0
  31. package/dist/cli-delegate/chunk-J55WI3RR.js +47 -0
  32. package/dist/cli-delegate/chunk-MCJYCQPF.js +35 -0
  33. package/dist/cli-delegate/chunk-NDJLNC6Q.js +169 -0
  34. package/dist/cli-delegate/chunk-OMIVVCG2.js +26 -0
  35. package/dist/cli-delegate/chunk-OY53J6II.js +7336 -0
  36. package/dist/cli-delegate/chunk-RDGRHAAB.js +259 -0
  37. package/dist/cli-delegate/chunk-TFG57JJM.js +1969 -0
  38. package/dist/cli-delegate/chunk-XX6TOPD7.js +715 -0
  39. package/dist/cli-delegate/chunk-YMFO6FDN.js +10603 -0
  40. package/dist/cli-delegate/cmd_analyze_session.js +294 -0
  41. package/dist/cli-delegate/cmd_conformance.js +646 -0
  42. package/dist/cli-delegate/cmd_converge.js +326 -0
  43. package/dist/cli-delegate/cmd_doctor.js +144 -0
  44. package/dist/cli-delegate/cmd_explain.js +2508 -0
  45. package/dist/cli-delegate/cmd_export.js +296 -0
  46. package/dist/cli-delegate/cmd_fleet.js +332 -0
  47. package/dist/cli-delegate/cmd_memory_get.js +3878 -0
  48. package/dist/cli-delegate/cmd_migrate.js +11 -0
  49. package/dist/cli-delegate/cmd_preflight.js +270 -0
  50. package/dist/cli-delegate/cmd_prune.js +444 -0
  51. package/dist/cli-delegate/cmd_refresh.js +28 -0
  52. package/dist/cli-delegate/cmd_settings_check.js +574 -0
  53. package/dist/cli-delegate/cmd_settings_migrate.js +223 -0
  54. package/dist/cli-delegate/cmd_sync.js +264 -0
  55. package/dist/cli-delegate/cmd_uninstall.js +656 -0
  56. package/dist/cli-delegate/cmd_update.js +425 -0
  57. package/dist/cli-delegate/cmd_upgrade.js +444 -0
  58. package/dist/cli-delegate/cmd_validate.js +305 -0
  59. package/dist/cli-delegate/cmd_versions.js +370 -0
  60. package/dist/discovery/deprecation-report.md +1 -1
  61. package/dist/discovery/discovery-manifest.json +14 -7
  62. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  63. package/dist/discovery/discovery-manifest.summary.md +2 -2
  64. package/dist/discovery/orphan-report.md +1 -1
  65. package/dist/discovery/packs.json +12 -7
  66. package/dist/discovery/trust-report.md +1 -1
  67. package/dist/discovery/workspaces.json +4 -3
  68. package/dist/install/emit_host_rules_cli.js +2 -1
  69. package/dist/install/emit_host_rules_cli.js.map +1 -1
  70. package/dist/install/install.mjs +410 -378
  71. package/dist/install/rule_scope.js +5 -1
  72. package/dist/install/rule_scope.js.map +1 -1
  73. package/dist/install/toolDetection.js +40 -12
  74. package/dist/install/toolDetection.js.map +1 -1
  75. package/dist/install/wizard-plan.js +2 -2
  76. package/dist/install/wizard-plan.js.map +1 -1
  77. package/dist/mcp/registry-manifest.json +1 -1
  78. package/dist/mcp/server.json +2 -2
  79. package/dist/mcp/server.mjs +1614 -765
  80. package/dist/router.json +1 -1
  81. package/package.json +4 -2
  82. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +30 -30
  83. package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
  84. package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +20 -0
  85. package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +20 -1
  86. package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +179 -0
  87. package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +155 -4
  88. package/src/agent-src/templates/scripts/work_engine/state.ts +21 -4
  89. package/src/config/discovery/packs.yml +7 -0
  90. package/src/config/evaluator-budgets.json +1 -1
  91. package/src/config/pack-size-budget.json +27 -0
  92. package/src/install/emit_host_rules_cli.ts +2 -1
  93. package/src/install/rule_scope.ts +5 -1
  94. package/src/install/toolDetection.ts +39 -8
  95. package/src/install/wizard-plan.ts +2 -2
  96. package/src/scripts/_cli/cmd_conformance.ts +2 -1
  97. package/src/scripts/_cli/cmd_converge.ts +2 -1
  98. package/src/scripts/_cli/cmd_doctor.ts +214 -13
  99. package/src/scripts/_cli/cmd_export.ts +2 -1
  100. package/src/scripts/_cli/cmd_fleet.ts +2 -1
  101. package/src/scripts/_cli/cmd_migrate.ts +2 -1
  102. package/src/scripts/_cli/cmd_preflight.ts +2 -1
  103. package/src/scripts/_cli/cmd_refresh.ts +2 -1
  104. package/src/scripts/_cli/cmd_update.ts +2 -1
  105. package/src/scripts/_cli/cmd_upgrade.ts +2 -1
  106. package/src/scripts/_cli/cmd_versions.ts +2 -1
  107. package/src/scripts/_cli/detection_report.ts +480 -0
  108. package/src/scripts/_dispatch.bash +52 -14
  109. package/src/scripts/_lib/changelog_eras.ts +103 -9
  110. package/src/scripts/_lib/environment_detector.ts +441 -0
  111. package/src/scripts/_lib/package_root.ts +72 -0
  112. package/src/scripts/ai_council/config.ts +15 -7
  113. package/src/scripts/ai_council/modes.ts +68 -2
  114. package/src/scripts/ai_council/transport_resolver.ts +331 -0
  115. package/src/scripts/check_bundle_path_leakage.ts +10 -4
  116. package/src/scripts/check_dependency_floors.ts +153 -0
  117. package/src/scripts/check_pack_size.ts +188 -0
  118. package/src/scripts/council_cli.ts +6 -2
  119. package/src/scripts/evaluator_umbrella.sh +34 -1
  120. package/src/scripts/lint_eval_fixture_citations.ts +113 -0
  121. package/src/scripts/lint_ui_stack_bundles.ts +170 -0
@@ -16,13 +16,24 @@ import {
16
16
  StepResult,
17
17
  agent_directive,
18
18
  } from '../../delivery_state.js';
19
+ import {
20
+ UNSUPPORTED_LANE,
21
+ bundle_line,
22
+ unsupported_stack_questions,
23
+ } from './stack_bundles.js';
19
24
 
20
- /** Map `state.stack.frontend` → agent-directive skill name. */
25
+ /** Map `state.stack.frontend` → agent-directive verb. */
21
26
  export const STACK_DIRECTIVES: Record<string, string> = {
22
27
  'blade-livewire-flux': 'ui-design-review-blade-livewire-flux',
28
+ 'blade-livewire': 'ui-design-review-blade-livewire',
29
+ filament: 'ui-design-review-filament',
23
30
  'react-shadcn': 'ui-design-review-react-shadcn',
31
+ react: 'ui-design-review-react',
24
32
  vue: 'ui-design-review-vue',
25
33
  plain: 'ui-design-review-plain',
34
+ // Present so the `keys == KNOWN_STACKS` invariant holds. Never emitted —
35
+ // the step intercepts this lane and refuses instead of dispatching.
36
+ unknown: 'ui-design-review-unsupported',
26
37
  };
27
38
 
28
39
  /** Fallback directive when `state.stack` is missing or malformed. */
@@ -181,12 +192,20 @@ function _stack_label(state: DeliveryState): string {
181
192
  function _delegate_to_review_skill(state: DeliveryState): StepResult {
182
193
  const directive = _resolve_directive(state);
183
194
  const stack_label = _stack_label(state);
195
+ if (stack_label === UNSUPPORTED_LANE) {
196
+ return new StepResult({
197
+ outcome: Outcome.BLOCKED,
198
+ questions: unsupported_stack_questions('review'),
199
+ message: 'UI review refused: frontend framework not modelled by any lane.',
200
+ });
201
+ }
184
202
  return new StepResult({
185
203
  outcome: Outcome.BLOCKED,
186
204
  questions: [
187
205
  agent_directive(directive),
188
206
  `> Stack: \`${stack_label}\`. Reviewing rendered components ` +
189
207
  'against the locked design brief.',
208
+ bundle_line(stack_label, 'review'),
190
209
  '> The review pass compares `state.ticket.ui_apply.rendered` ' +
191
210
  'against `state.ui_design` (microcopy, states, a11y, layout) ' +
192
211
  'and produces a structured `findings` list.',
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Verb → skill-bundle map for the stack-dispatched UI steps.
3
+ *
4
+ * The UI steps halt with `@agent-directive: ui-apply-<stack>` (and the
5
+ * `ui-design-review-` / `ui-polish-` equivalents). Those names are **directive
6
+ * verbs, not skill paths** — the same shape as `run-tests`, `create-plan`, and
7
+ * `apply-plan`, which likewise resolve to no skill file. Only 2 of the engine's
8
+ * 11 literal verbs name a real skill, so a verb is something the agent
9
+ * interprets, and the mapping from verb to the skills that implement it is a
10
+ * separate fact that has to be written down somewhere.
11
+ *
12
+ * Before this module that mapping lived only in a prose table in
13
+ * `docs/contracts/ui-track-flow.md`. Nothing verified it, and two of its four
14
+ * rows were wrong: `vue` pointed at the directive verb itself (naming no skill
15
+ * at all) and `plain` — which is also the fallback for every unrecognised
16
+ * project — pointed at `blade-ui`, a skill whose frontmatter is
17
+ * `packs: [laravel]` and which a non-Laravel consumer therefore does not have
18
+ * installed.
19
+ *
20
+ * Keeping the map here makes it checkable: `lint_ui_stack_bundles` asserts every
21
+ * member resolves to a real skill, and that no lane reachable without the
22
+ * `laravel` pack names a `laravel`-only skill. A CI check in this repo cannot
23
+ * see a consumer's installed pack combination, so the second assertion is the
24
+ * part that actually prevents the `plain → blade-ui` class of defect.
25
+ */
26
+
27
+ /** Skills that implement a lane, in the order the agent should load them. */
28
+ export interface StackBundle {
29
+ /** Skills that build / fix UI for this lane (`apply`, `polish`). */
30
+ readonly build: ReadonlyArray<string>;
31
+ /** Skills that review UI for this lane (`review`). */
32
+ readonly review: ReadonlyArray<string>;
33
+ /**
34
+ * True when every skill above ships outside the framework packs, i.e. the
35
+ * lane is safe as a fallback for a consumer whose packs we cannot predict.
36
+ * Only lanes marked `pack_agnostic` may be used as `DEFAULT_*`.
37
+ */
38
+ readonly pack_agnostic: boolean;
39
+ }
40
+
41
+ /**
42
+ * The pack-agnostic pair. Both live in `engineering-base`, so they are present
43
+ * in every install; both self-describe as stack-neutral
44
+ * (`ui-component-architect`: "the same lens applies to Blade, Livewire, React,
45
+ * or Vue trees"; `tailwind-engineer`: "the **how** for any Tailwind-stack
46
+ * screen"). This is the honest floor for a lane with no framework-specific
47
+ * executor — not a claim that the lane is fully served.
48
+ */
49
+ const GENERIC_BUILD: ReadonlyArray<string> = ['ui-component-architect', 'tailwind-engineer'];
50
+
51
+ /** `design-review` is stack-neutral and ships in `engineering-base`. */
52
+ const GENERIC_REVIEW: ReadonlyArray<string> = ['design-review'];
53
+
54
+ /**
55
+ * Lane → bundle. Keys mirror `KNOWN_STACKS`; the dispatch tables in
56
+ * `apply` / `review` / `polish` keep their own verb strings (a tested public
57
+ * contract) and consume this map only to name the skills in the halt body.
58
+ */
59
+ export const STACK_BUNDLES: Readonly<Record<string, StackBundle>> = {
60
+ 'blade-livewire-flux': {
61
+ build: ['flux', 'livewire', 'blade-ui'],
62
+ review: GENERIC_REVIEW,
63
+ pack_agnostic: false,
64
+ },
65
+ // Livewire without Flux — the common Laravel frontend. Previously fell
66
+ // into `plain` because detection required Livewire AND Flux.
67
+ 'blade-livewire': {
68
+ build: ['livewire', 'blade-ui'],
69
+ review: GENERIC_REVIEW,
70
+ pack_agnostic: false,
71
+ },
72
+ // Filament is Livewire + Blade + Tailwind under the hood; the same
73
+ // executors apply. A Filament-specific skill is gated on evidence that
74
+ // these produce unusable output for it, not assumed.
75
+ filament: {
76
+ build: ['livewire', 'blade-ui'],
77
+ review: GENERIC_REVIEW,
78
+ pack_agnostic: false,
79
+ },
80
+ 'react-shadcn': {
81
+ build: ['react-shadcn-ui'],
82
+ review: GENERIC_REVIEW,
83
+ pack_agnostic: false,
84
+ },
85
+ // React without Radix/shadcn. `react-shadcn-ui` still carries the React
86
+ // component idiom; the shadcn-specific parts simply do not apply.
87
+ react: {
88
+ build: ['react-shadcn-ui'],
89
+ review: GENERIC_REVIEW,
90
+ pack_agnostic: false,
91
+ },
92
+ // No Vue executor exists. The previous prose row pointed at the directive
93
+ // verb itself, which named nothing; the generic pair is a smaller lie and a
94
+ // stated one — the halt body says the lane has no Vue-specific skill.
95
+ vue: {
96
+ build: GENERIC_BUILD,
97
+ review: GENERIC_REVIEW,
98
+ pack_agnostic: true,
99
+ },
100
+ plain: {
101
+ build: GENERIC_BUILD,
102
+ review: GENERIC_REVIEW,
103
+ pack_agnostic: true,
104
+ },
105
+ };
106
+
107
+ /**
108
+ * Lanes served by the stack-neutral pair rather than a framework executor.
109
+ *
110
+ * `plain` and `vue` share the bundle but not the meaning, and the halt body has
111
+ * to say which it is. For `plain` the pair IS the right answer — there is no
112
+ * framework to be idiomatic about. For `vue` it is a gap: a Vue project has a
113
+ * definite idiom and the package has no executor for it, so the result must not
114
+ * read as Vue support.
115
+ */
116
+ export const GENERIC_LANES: ReadonlySet<string> = new Set(['vue', 'plain']);
117
+
118
+ /** Lanes where the stack-neutral pair is the correct answer, not a shortfall. */
119
+ const NATIVELY_GENERIC_LANES: ReadonlySet<string> = new Set(['plain']);
120
+
121
+ /**
122
+ * The label detection returns for a framework it recognises but does not
123
+ * model. Mirrors `stack/detect.ts::UNSUPPORTED_STACK`; duplicated as a literal
124
+ * because this module is import-free by design (the detector is a leaf module
125
+ * the directives must not depend on).
126
+ */
127
+ export const UNSUPPORTED_LANE = 'unknown';
128
+
129
+ /** Return the bundle for `stack`, or the `plain` bundle when unmapped. */
130
+ export function bundle_for(stack: string): StackBundle {
131
+ return STACK_BUNDLES[stack] ?? (STACK_BUNDLES['plain'] as StackBundle);
132
+ }
133
+
134
+ /**
135
+ * Questions for the refusal halt on an unmodelled framework.
136
+ *
137
+ * Not a directive — there is nothing honest to dispatch to. The agent names
138
+ * the actual markers from the manifest (it has filesystem access; the engine
139
+ * deliberately does not carry them on `StackResult`), and the user chooses
140
+ * between the stack-neutral floor and stopping.
141
+ */
142
+ export function unsupported_stack_questions(step: string): string[] {
143
+ return [
144
+ '> Detection found a frontend framework this package does not model, ' +
145
+ `so there is no \`${step}\` lane for it.`,
146
+ '> Name the markers you see in `composer.json` / `package.json` so the ' +
147
+ 'choice below is made on the real stack, not on a guess.',
148
+ '> 1. Continue on the stack-neutral floor — `ui-component-architect` + ' +
149
+ '`tailwind-engineer`. Output will not be idiomatic for this ' +
150
+ 'framework; say so in the result.',
151
+ '> 2. Abort — drop this UI request and add a lane first ' +
152
+ '(`docs/contracts/ui-stack-extension.md`).',
153
+ ];
154
+ }
155
+
156
+ /**
157
+ * Render the "load these skills" line for a dispatch halt.
158
+ *
159
+ * The engine cannot load a skill itself; naming the bundle is what stops the
160
+ * agent from resolving an unresolvable verb by guessing. A lane with no
161
+ * framework-specific executor says that outright rather than presenting the
162
+ * generic pair as if it were stack support.
163
+ */
164
+ export function bundle_line(stack: string, role: 'build' | 'review'): string {
165
+ const bundle = bundle_for(stack);
166
+ const skills = role === 'review' ? bundle.review : bundle.build;
167
+ const rendered = skills.map((name) => `\`${name}\``).join(' + ');
168
+ if (NATIVELY_GENERIC_LANES.has(stack)) {
169
+ return `> Skills: ${rendered} — stack-neutral, which is what \`${stack}\` means.`;
170
+ }
171
+ if (GENERIC_LANES.has(stack)) {
172
+ return (
173
+ `> Skills: ${rendered} — there is no \`${stack}\`-specific executor, ` +
174
+ 'so this is the stack-neutral floor, not idiomatic ' +
175
+ `\`${stack}\`. Say so in the result.`
176
+ );
177
+ }
178
+ return `> Skills: ${rendered}.`;
179
+ }
@@ -17,17 +17,35 @@
17
17
  *
18
18
  * 1. `composer.json` lists `livewire/livewire` AND `livewire/flux` →
19
19
  * `blade-livewire-flux`
20
- * 2. `package.json` lists `react` AND any of `@radix-ui/*`,
20
+ * 2. `composer.json` lists `filament/filament` → `filament` (before bare
21
+ * Livewire: Filament pulls Livewire in transitively)
22
+ * 3. `composer.json` lists `livewire/livewire` → `blade-livewire`
23
+ * 4. `package.json` lists `react` AND any of `@radix-ui/*`,
21
24
  * `shadcn-ui` or has a `components.json` (the shadcn marker file)
22
25
  * → `react-shadcn`
23
- * 3. `package.json` lists `vue` (any major) → `vue`
24
- * 4. Otherwise → `plain`
26
+ * 5. `package.json` lists `react` → `react`
27
+ * 6. `package.json` lists `vue` (any major) → `vue`
28
+ * 7. Either manifest names a recognised-but-unmodelled framework
29
+ * (Svelte, Angular, Nuxt, Astro, Solid, Qwik, Inertia) → `unknown`
30
+ * 8. Otherwise → `plain`
31
+ *
32
+ * Rules 3, 5 and 7 exist because the earlier table sent three common
33
+ * shapes into `plain`: Laravel+Livewire without Flux failed rule 1's `&&`,
34
+ * React without Radix failed rule 4, and every unmodelled framework was
35
+ * indistinguishable from a genuinely plain project. `plain` now means "no
36
+ * frontend markers"; `unknown` means "a framework we do not model", and
37
+ * dispatch refuses on it rather than handing over generic tooling silently.
25
38
  *
26
39
  * Detection is filesystem-cheap: at most three small JSON reads per
27
40
  * project root. Errors (missing file, malformed JSON, missing `require`
28
41
  * section) downgrade to `plain` rather than raising — a wrong stack
29
42
  * label is recoverable (audit catches it, user can override), but a
30
43
  * crash mid-dispatch is not.
44
+ *
45
+ * Root manifests only, by design: a monorepo caller passes the workspace
46
+ * root that carries the manifest it cares about. Note the consequence —
47
+ * a caller that always passes the repository root gets `plain` for a
48
+ * monorepo, so the caller owns scope selection, not the detector.
31
49
  */
32
50
  import * as fs from 'node:fs';
33
51
  import * as path from 'node:path';
@@ -43,18 +61,59 @@ import * as path from 'node:path';
43
61
  */
44
62
  export const KNOWN_STACKS: ReadonlySet<string> = new Set([
45
63
  'blade-livewire-flux',
64
+ 'blade-livewire',
65
+ 'filament',
46
66
  'react-shadcn',
67
+ 'react',
47
68
  'vue',
48
69
  'plain',
70
+ 'unknown',
49
71
  ]);
50
72
 
51
- /** Fallback when no manifest signal matches. */
73
+ /**
74
+ * Label for a project with no frontend markers at all.
75
+ *
76
+ * `plain` used to carry two meanings — "genuinely a plain HTML/Tailwind
77
+ * project" and "detection failed, here is generic tooling anyway" — which made
78
+ * a loud failure impossible without punishing real plain projects. The second
79
+ * meaning is now {@link UNSUPPORTED_STACK}.
80
+ */
52
81
  export const DEFAULT_STACK = 'plain';
53
82
 
83
+ /**
84
+ * Label for a project whose frontend IS recognisable but is not modelled.
85
+ *
86
+ * Dispatch refuses on this label instead of degrading to generic tooling: a
87
+ * Filament or Svelte project silently routed to a Tailwind-only bundle is
88
+ * user-hostile precisely because the output looks like it worked.
89
+ */
90
+ export const UNSUPPORTED_STACK = 'unknown';
91
+
54
92
  const _SHADCN_RADIX_PREFIX = '@radix-ui/';
55
93
  const _SHADCN_PACKAGE_NAMES: ReadonlySet<string> = new Set(['shadcn-ui', 'shadcn']);
56
94
  const _FLUX_PACKAGE = 'livewire/flux';
57
95
  const _LIVEWIRE_PACKAGE = 'livewire/livewire';
96
+ const _FILAMENT_PACKAGE = 'filament/filament';
97
+
98
+ /**
99
+ * Frontend markers this package recognises but does not model.
100
+ *
101
+ * One of these present means detection **succeeded** at recognising a
102
+ * framework and the package simply has no lane for it — the `unknown` case,
103
+ * not the `plain` case. Keep the list short and factual; a marker leaves it
104
+ * only when a real lane exists.
105
+ */
106
+ const _UNMODELLED_MARKERS: ReadonlyArray<string> = [
107
+ 'svelte',
108
+ '@angular/core',
109
+ 'nuxt',
110
+ 'astro',
111
+ 'solid-js',
112
+ '@builder.io/qwik',
113
+ '@inertiajs/vue3',
114
+ '@inertiajs/react',
115
+ 'inertiajs/inertia-laravel',
116
+ ];
58
117
 
59
118
  /**
60
119
  * A heterogeneous JSON object, mirroring a Python `dict[str, object]`.
@@ -109,14 +168,51 @@ export function detect_stack(project_root: string): StackResult {
109
168
  return new StackResult({ frontend: 'blade-livewire-flux', mtime });
110
169
  }
111
170
 
171
+ // Filament before bare Livewire: it pulls Livewire in transitively, so a
172
+ // Filament project would otherwise be labelled by its dependency rather
173
+ // than by the framework the developer actually works in.
174
+ if (_has_package(composer, ['require', 'require-dev'], _FILAMENT_PACKAGE)) {
175
+ return new StackResult({ frontend: 'filament', mtime });
176
+ }
177
+
178
+ // Livewire WITHOUT Flux is the common Laravel frontend, not an unknown
179
+ // one. It used to fail the `&&` above and land in `plain`.
180
+ if (_has_package(composer, ['require', 'require-dev'], _LIVEWIRE_PACKAGE)) {
181
+ return new StackResult({ frontend: 'blade-livewire', mtime });
182
+ }
183
+
112
184
  if (_is_react_shadcn(pkg, components_json)) {
113
185
  return new StackResult({ frontend: 'react-shadcn', mtime });
114
186
  }
115
187
 
188
+ // React without Radix/shadcn is a served stack, not an unknown one.
189
+ if (_has_package(pkg, _PKG_DEP_KEYS, 'react')) {
190
+ return new StackResult({ frontend: 'react', mtime });
191
+ }
192
+
116
193
  if (_has_vue(pkg)) {
117
194
  return new StackResult({ frontend: 'vue', mtime });
118
195
  }
119
196
 
197
+ // A recognised-but-unmodelled framework is NOT `plain`. Refusing here is
198
+ // the point: `plain` means "no frontend markers", and conflating the two
199
+ // is what let a Svelte or Inertia project receive Tailwind-only tooling
200
+ // and no warning.
201
+ if (_has_unmodelled_marker(composer, pkg)) {
202
+ return new StackResult({ frontend: UNSUPPORTED_STACK, mtime });
203
+ }
204
+
205
+ // Monorepo: no manifest at the root, but one sits in a workspace directory.
206
+ // That is a wrong-scope call, not a plain project — the caller owns scope
207
+ // selection, so say so instead of labelling the whole repo `plain` and
208
+ // dispatching generic tooling at it.
209
+ //
210
+ // A repo with no manifest ANYWHERE stays `plain`: that is greenfield, and
211
+ // the scaffold path depends on it.
212
+ if (mtime === 0.0 && _has_nested_manifest(project_root)) {
213
+ return new StackResult({ frontend: UNSUPPORTED_STACK, mtime });
214
+ }
215
+
120
216
  return new StackResult({ frontend: DEFAULT_STACK, mtime });
121
217
  }
122
218
 
@@ -185,6 +281,61 @@ function _all_dependencies(manifest: Manifest, ...keys: string[]): Manifest {
185
281
  return merged;
186
282
  }
187
283
 
284
+ /** Dependency sections a `package.json` can carry. */
285
+ const _PKG_DEP_KEYS: ReadonlyArray<string> = [
286
+ 'dependencies',
287
+ 'devDependencies',
288
+ 'peerDependencies',
289
+ 'optionalDependencies',
290
+ ];
291
+
292
+ /** True when `name` appears in any of `manifest`'s named dependency sections. */
293
+ function _has_package(
294
+ manifest: Manifest,
295
+ sections: ReadonlyArray<string>,
296
+ name: string,
297
+ ): boolean {
298
+ return name in _all_dependencies(manifest, ...sections);
299
+ }
300
+
301
+ /** Workspace directories a monorepo conventionally puts its packages in. */
302
+ const _WORKSPACE_DIRS: ReadonlyArray<string> = ['packages', 'apps', 'services', 'libs'];
303
+
304
+ /**
305
+ * True when no root manifest exists but a workspace directory holds one.
306
+ *
307
+ * Deliberately shallow — one `readdir` per conventional workspace directory,
308
+ * one `stat` per child. It answers "was this called at the wrong scope?", not
309
+ * "where is the real project", which stays the caller's job.
310
+ */
311
+ function _has_nested_manifest(project_root: string): boolean {
312
+ for (const dir of _WORKSPACE_DIRS) {
313
+ const base = path.join(project_root, dir);
314
+ let entries: string[];
315
+ try {
316
+ entries = fs.readdirSync(base);
317
+ } catch {
318
+ continue;
319
+ }
320
+ for (const entry of entries) {
321
+ if (
322
+ _is_file(path.join(base, entry, 'composer.json')) ||
323
+ _is_file(path.join(base, entry, 'package.json'))
324
+ ) {
325
+ return true;
326
+ }
327
+ }
328
+ }
329
+ return false;
330
+ }
331
+
332
+ /** True when either manifest names a framework we recognise but do not model. */
333
+ function _has_unmodelled_marker(composer: Manifest, pkg: Manifest): boolean {
334
+ const composer_deps = _all_dependencies(composer, 'require', 'require-dev');
335
+ const pkg_deps = _all_dependencies(pkg, ..._PKG_DEP_KEYS);
336
+ return _UNMODELLED_MARKERS.some((marker) => marker in composer_deps || marker in pkg_deps);
337
+ }
338
+
188
339
  function _is_blade_livewire_flux(composer: Manifest): boolean {
189
340
  const deps = _all_dependencies(composer, 'require', 'require-dev');
190
341
  return _LIVEWIRE_PACKAGE in deps && _FLUX_PACKAGE in deps;
@@ -629,10 +629,12 @@ function _validate_app_spec(app_spec: JsonValue): void {
629
629
  * agent-directive that populates it. An empty dict is the in-progress
630
630
  * shape after the skill returns but before the brief lands; the gate
631
631
  * treats it the same as `null`. Once populated, `design_confirmed`
632
- * (when present) must be a bool. Other keys (`layout`, `components`,
633
- * `states`, `microcopy`, `a11y`, `reused_from_audit`) are
634
- * validated by the design handler against the skill contract — the
635
- * schema only enforces shape, not content.
632
+ * (when present) must be a bool, and `states` (when present and not
633
+ * `null`) must be an object — the design gate's per-state loop is
634
+ * object-guarded, so a string or list would bypass all five checks.
635
+ * The remaining keys (`layout`, `components`, `microcopy`, `a11y`,
636
+ * `reused_from_audit`) are validated by the design handler against the
637
+ * skill contract — the schema only enforces shape, not content.
636
638
  */
637
639
  function _validate_ui_design(ui_design: JsonValue): void {
638
640
  if (ui_design === null) {
@@ -652,6 +654,21 @@ function _validate_ui_design(ui_design: JsonValue): void {
652
654
  'state.ui_design.design_confirmed must be a boolean when present',
653
655
  );
654
656
  }
657
+ // `states` is shape-checked here, not left to the handler. The design
658
+ // gate's per-state loop was guarded on "is this an object", so a string or
659
+ // list silently skipped all five required-state checks — the gate passed
660
+ // while covering no state at all. Rejecting the wrong shape at the schema
661
+ // boundary means the loop can no longer be bypassed by type.
662
+ if (
663
+ 'states' in ui_design &&
664
+ ui_design['states'] !== null &&
665
+ !_isDict(ui_design['states'])
666
+ ) {
667
+ throw new SchemaError(
668
+ 'state.ui_design.states must be a JSON object (one key per ' +
669
+ `required state) or null; got ${pyTypeName(ui_design['states'])}`,
670
+ );
671
+ }
655
672
  }
656
673
 
657
674
  /**
@@ -62,6 +62,11 @@
62
62
  description: Laravel framework patterns; depends on PHP at the artefact level.
63
63
  workspaces: [engineering]
64
64
  requires: [php, engineering-base]
65
+ # The design layer is a companion, not a dependency: this pack ships UI
66
+ # executors (blade-ui, flux, livewire) whose grounded selection lives in
67
+ # frontend-design, but a Laravel API-only project needs none of it. Advisory
68
+ # so the wizard offers it; `requires` would force the weight on every install.
69
+ suggests: [frontend-design]
65
70
  cluster: php
66
71
  trust_level_default: professional
67
72
  domain: engineering
@@ -98,6 +103,8 @@
98
103
  description: React framework patterns.
99
104
  workspaces: [engineering]
100
105
  requires: [javascript, engineering-base]
106
+ # Companion, not dependency — see the note on `laravel`.
107
+ suggests: [frontend-design]
101
108
  cluster: typescript
102
109
  trust_level_default: professional
103
110
  domain: engineering
@@ -8,7 +8,7 @@
8
8
  "unpacked_size_mb": {
9
9
  "max": 28,
10
10
  "last_measured": 26.05,
11
- "method": "npm pack --json → dist.unpackedSize / 1e6 — includes the Phase-1 precompiled bundles (dist/hooks/dispatch.js + dist/mcp/server.mjs, ~2.1 MB) that bought the 23x hook-latency win and the tsx removal"
11
+ "method": "npm pack --json → dist.unpackedSize / 1e6 — includes the Phase-1 precompiled bundles (dist/hooks/dispatch.js + dist/mcp/server.mjs, ~2.1 MB) that bought the 23x hook-latency win and the tsx removal, plus dist/cli-delegate/ (~1.40 MB, ADR-204) which finished that removal for the consumer command surface. This gate is the ONLY size trip-wire on those bundles by design: a dedicated per-bundle budget key would need its own measurement wired into evaluator_umbrella.sh, and an unwired key fails check_evaluator_budgets with 'no measurement supplied' instead of guarding anything. ADR-204 projected 27.45 against max 28 without packing — the next real measurement here is the confirming one, and headroom is thin"
12
12
  },
13
13
  "node_modules_mb": {
14
14
  "max": 140,
@@ -0,0 +1,27 @@
1
+ {
2
+ "_comment": "Payload budget for the published npm tarball (road-to-zero-ceremony-install Phase 4). MEASURED, NEVER INVENTED — the numbers below come from `npm pack --dry-run --json --ignore-scripts` on the tracked tree at 9.9.0 (2026-07-31). Two metrics, both genuinely ungated before this file: COMPRESSED tarball size, and PER-SKILL share of the skills subtree. The UNPACKED size is deliberately absent — it is already owned by src/config/evaluator-budgets.json (unpacked_size_mb), and a second number for one lever is how three conflicting figures start circulating.",
3
+ "schema_version": 1,
4
+ "owner": "maintainer",
5
+ "review_by": "2027-07-31",
6
+ "regression_pct": 10,
7
+ "measurement_conditions": "npm pack --dry-run --json --ignore-scripts, run at the repo root on a clean checkout. `--ignore-scripts` means NO build runs, so dist/cli, dist/ui, dist/mcp and dist/hooks are absent and the figure covers only the TRACKED payload (src/scripts/, dist/agent-src/, dist/install/, docs/guidelines/, templates). That is deliberate: this gate is always-on for every PR, and the tracked content tree is exactly the surface that grows by accretion. The built artifact is ~5.4 MB larger and is gated separately, at release time, by evaluator-budgets.unpacked_size_mb.",
8
+ "budgets": {
9
+ "packed_size_mb": {
10
+ "max": 6.4,
11
+ "last_measured": 5.903,
12
+ "method": "npm pack --dry-run --json --ignore-scripts → dist.size / 1e6 (the compressed tarball a consumer actually downloads)"
13
+ }
14
+ },
15
+ "per_skill_share": {
16
+ "max_pct": 5.0,
17
+ "basis": "a single skill's share of the total bytes under dist/agent-src/skills/ in the tarball",
18
+ "rationale": "Measured 2026-07-31: the largest non-excepted skill is corpus-grounding at 2.33%, so a 5% cap is green with better than 2x headroom and red for any skill that doubles. It is a falsifiable gate, not a ritual one.",
19
+ "exceptions": {
20
+ "design-intelligence": {
21
+ "max_pct": 23.0,
22
+ "measured_pct": 22.63,
23
+ "reason": "771 KB of BM25 corpus (27 CSVs + 16 design-language prose specs + manifest.json) consumed at runtime by corpus-grounding's retriever, and referenced by 6 further skills. Moving it behind a lazy fetch would add a network dependency to a skill that works offline today — the same trade-off ADR-061 §8 already REJECTED for a 745 KB font index. The exception is visible debt, not an endorsement: raising max_pct requires a reason in the same commit."
24
+ }
25
+ }
26
+ }
27
+ }
@@ -21,7 +21,8 @@
21
21
  * the Phase-1b rule filter, so scoped installs get scoped host files
22
22
  * for free;
23
23
  * - re-using the exported emitters keeps consumer output byte-identical
24
- * to the maintainer projection (Pipeline B never drifts from A).
24
+ * to the maintainer projection (the consumer install never drifts from
25
+ * Pipeline A, the source projection into `dist/agent-src/`).
25
26
  * The trade-off (node required at install time) matches the rule-scope
26
27
  * resolver: no node → install.sh keeps its legacy fallback surfaces.
27
28
  *
@@ -1,7 +1,11 @@
1
1
  /**
2
- * Install-time rule scoping — Pipeline B of consumer-scoped rule projection
2
+ * Install-time rule scoping for the consumer install
3
3
  * (road-to-request-scoped-rule-load Phase 1b).
4
4
  *
5
+ * Naming: this is the CONSUMER INSTALL path, not `docs/architecture.md`'s
6
+ * Pipeline B (which is the `.augment/` projection). Earlier drafts called it
7
+ * "Pipeline B" and collided with that name; use "the consumer install" here.
8
+ *
5
9
  * The projection filter (`rule_in_scope`, condense.ts) covered only the
6
10
  * maintainer projection; the consumer install pipeline shipped rules
7
11
  * unfiltered (dead `EXCLUDE_RULES` in install.sh; no exclude at all on the
@@ -71,6 +71,44 @@ export function knownToolIds(): readonly string[] {
71
71
  return Object.keys(TOOL_SIGNALS);
72
72
  }
73
73
 
74
+ /**
75
+ * Executable names declared for `id` on `$PATH`, in table order. Empty for
76
+ * tools detected only by a config dir / app bundle (and for the two
77
+ * signal-less ids). Exposed so callers that need the resolved *path* (not
78
+ * just a boolean) can reuse this table instead of restating the binary names.
79
+ */
80
+ export function toolBinaries(id: string): readonly string[] {
81
+ return TOOL_SIGNALS[id]?.bins ?? [];
82
+ }
83
+
84
+ /**
85
+ * First declared binary for `id` that resolves on `$PATH`, or `null`. This is
86
+ * the path-returning twin of `detectInstalledTools`, which reports presence as
87
+ * a boolean across all three signal kinds — a tool can be "installed" (config
88
+ * dir present) while this returns `null` (no executable on `$PATH`).
89
+ */
90
+ export function resolveToolBinary(id: string, pathEnv?: string): string | null {
91
+ const env = pathEnv ?? process.env['PATH'] ?? '';
92
+ for (const bin of toolBinaries(id)) {
93
+ const resolved = resolveBinaryPath(bin, env);
94
+ if (resolved !== null) return resolved;
95
+ }
96
+ return null;
97
+ }
98
+
99
+ /** Absolute path of `name` on `pathEnv`, or `null`. Mirrors `binOnPath`'s probe order. */
100
+ function resolveBinaryPath(name: string, pathEnv: string): string | null {
101
+ if (pathEnv.length === 0) return null;
102
+ for (const dir of pathEnv.split(delimiter)) {
103
+ if (dir.length === 0) continue;
104
+ for (const candidate of [name, `${name}.exe`, `${name}.cmd`]) {
105
+ const full = join(dir, candidate);
106
+ if (existsSync(full)) return full;
107
+ }
108
+ }
109
+ return null;
110
+ }
111
+
74
112
  /**
75
113
  * Is an executable named `name` resolvable on `$PATH`? Exported for one-off
76
114
  * presence checks (e.g. `rtk` on the Editor-and-tooling step). Defaults to
@@ -81,14 +119,7 @@ export function isBinaryOnPath(name: string, pathEnv?: string): boolean {
81
119
  }
82
120
 
83
121
  function binOnPath(name: string, pathEnv: string): boolean {
84
- if (pathEnv.length === 0) return false;
85
- for (const dir of pathEnv.split(delimiter)) {
86
- if (dir.length === 0) continue;
87
- if (existsSync(join(dir, name))) return true;
88
- // Windows-style executables.
89
- if (existsSync(join(dir, `${name}.exe`)) || existsSync(join(dir, `${name}.cmd`))) return true;
90
- }
91
- return false;
122
+ return resolveBinaryPath(name, pathEnv) !== null;
92
123
  }
93
124
 
94
125
  function isToolInstalled(signal: ToolSignal, home: string, pathEnv: string): boolean {
@@ -193,8 +193,8 @@ export function expandWizardSources(inputs: WizardExpandInputs): PlanSource[] {
193
193
  const srcDir = join(packageRoot, srcRel);
194
194
  const destDir = destSub.length === 0 ? destRoot : join(destRoot, destSub);
195
195
  // Rule sources get the install-time scoping filter — the same
196
- // predicate the projection path uses (Phase 1b: Pipeline B may
197
- // never drift from Pipeline A).
196
+ // predicate the projection path uses (Phase 1b: the consumer
197
+ // install may never drift from Pipeline A, the source projection).
198
198
  const isRuleSource = srcRel === 'dist/agent-src/rules';
199
199
  out.push({
200
200
  toolId,
@@ -37,6 +37,7 @@ import * as installed_tools from '../_lib/installed_tools.js';
37
37
  import { atomicAppendLine } from '../../install/atomic.js';
38
38
  import { readRecentEntries } from '../../install/txlog.js';
39
39
  import { detectToolPresence } from '../../install/detect.js';
40
+ import { resolvePackageRoot } from '../_lib/package_root.js';
40
41
  import {
41
42
  _classify,
42
43
  _collect_manifest_entries,
@@ -56,7 +57,7 @@ type Dict = Record<string, unknown>;
56
57
  const _HERE = fileURLToPath(import.meta.url);
57
58
 
58
59
  /** Package root — two levels above `src/scripts/_cli/`. */
59
- export const PACKAGE_ROOT = path.resolve(path.dirname(_HERE), '..', '..', '..');
60
+ export const PACKAGE_ROOT = resolvePackageRoot(import.meta.url);
60
61
 
61
62
  /** Ordered registry of conformance check identifiers. */
62
63
  export const CONFORMANCE_CHECK_IDS = [