@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
@@ -0,0 +1,259 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+ import {
3
+ detectToolPresence
4
+ } from "./chunk-OMIVVCG2.js";
5
+
6
+ // src/install/preflight.ts
7
+ import { accessSync, constants, existsSync as existsSync2, statSync as statSync2 } from "node:fs";
8
+ import * as fs from "node:fs";
9
+ import { dirname } from "node:path";
10
+
11
+ // src/install/plan.ts
12
+ import { createHash } from "node:crypto";
13
+ import { readFileSync, readdirSync, statSync } from "node:fs";
14
+ import { join, relative, resolve } from "node:path";
15
+ function sha256File(path) {
16
+ try {
17
+ const data = readFileSync(path);
18
+ return createHash("sha256").update(data).digest("hex");
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+ function fileEntry(path, kind, options) {
24
+ return {
25
+ path,
26
+ kind,
27
+ sha256: options.hashContent ? sha256File(path) : null
28
+ };
29
+ }
30
+ function walkSourceTree(dir) {
31
+ const out = [];
32
+ walkInto(dir, out);
33
+ return out;
34
+ }
35
+ function walkInto(dir, out) {
36
+ let entries;
37
+ try {
38
+ entries = readdirSync(dir).sort();
39
+ } catch {
40
+ return;
41
+ }
42
+ for (const name of entries) {
43
+ const full = join(dir, name);
44
+ let isDir;
45
+ try {
46
+ isDir = statSync(full).isDirectory();
47
+ } catch {
48
+ continue;
49
+ }
50
+ if (isDir) {
51
+ walkInto(full, out);
52
+ } else {
53
+ out.push(full);
54
+ }
55
+ }
56
+ }
57
+ function buildInstallPlan(inputs) {
58
+ const filesByTool = {};
59
+ for (const source of inputs.sources) {
60
+ const bucket = filesByTool[source.toolId] ?? [];
61
+ let files = walkSourceTree(source.srcDir);
62
+ if (source.fileFilter !== void 0) {
63
+ files = files.filter(source.fileFilter);
64
+ }
65
+ for (const srcFile of files) {
66
+ const rel = relative(source.srcDir, srcFile);
67
+ const destPath = resolve(source.destDir, rel);
68
+ bucket.push(
69
+ fileEntry(srcFile, source.kind, {
70
+ hashContent: source.kind !== "bridge"
71
+ })
72
+ );
73
+ bucket[bucket.length - 1] = {
74
+ ...bucket[bucket.length - 1],
75
+ path: destPath
76
+ };
77
+ }
78
+ filesByTool[source.toolId] = bucket;
79
+ }
80
+ for (const source of inputs.sources) {
81
+ if (!(source.toolId in filesByTool)) {
82
+ filesByTool[source.toolId] = [];
83
+ }
84
+ }
85
+ return {
86
+ version: 2,
87
+ target: inputs.target,
88
+ root: inputs.root,
89
+ filesByTool,
90
+ mergedKeysByTool: {},
91
+ policy: inputs.policy
92
+ };
93
+ }
94
+
95
+ // src/install/conflict.ts
96
+ import { existsSync } from "node:fs";
97
+ function isJsonTarget(entry) {
98
+ return entry.kind === "deployed" && entry.path.endsWith(".json");
99
+ }
100
+ function computeConflicts(plan) {
101
+ if (plan.policy.force) return [];
102
+ const out = [];
103
+ for (const entries of Object.values(plan.filesByTool)) {
104
+ for (const entry of entries) {
105
+ if (entry.kind === "bridge") continue;
106
+ if (entry.sha256 === null) continue;
107
+ if (!existsSync(entry.path)) continue;
108
+ if (plan.policy.knownPaths.has(entry.path)) continue;
109
+ const onDisk = sha256File(entry.path);
110
+ if (onDisk === entry.sha256) continue;
111
+ out.push({
112
+ path: entry.path,
113
+ kind: entry.kind,
114
+ plannedSha256: entry.sha256,
115
+ existingSha256: onDisk,
116
+ mergeable: isJsonTarget(entry)
117
+ });
118
+ }
119
+ }
120
+ return out;
121
+ }
122
+
123
+ // src/install/preflight.ts
124
+ var DEFAULT_DISK_FLOOR_BYTES = 50 * 1024 * 1024;
125
+ function nearestExistingAncestor(p) {
126
+ let cur = p;
127
+ while (!existsSync2(cur)) {
128
+ const parent = dirname(cur);
129
+ if (parent === cur) return cur;
130
+ cur = parent;
131
+ }
132
+ return cur;
133
+ }
134
+ function checkPermissions(inputs) {
135
+ const out = [];
136
+ const roots = /* @__PURE__ */ new Set([inputs.root, ...inputs.sources.map((s) => s.destDir)]);
137
+ for (const root of roots) {
138
+ const probe = nearestExistingAncestor(root);
139
+ try {
140
+ accessSync(probe, constants.W_OK);
141
+ } catch {
142
+ out.push({
143
+ id: "permissions",
144
+ severity: "blocking",
145
+ path: root,
146
+ message: `target root is not writable (nearest existing ancestor: ${probe})`,
147
+ remedy: `fix permissions on ${probe} or choose a different target`
148
+ });
149
+ }
150
+ if (existsSync2(root)) {
151
+ try {
152
+ if (!statSync2(root).isDirectory()) {
153
+ out.push({
154
+ id: "permissions",
155
+ severity: "blocking",
156
+ path: root,
157
+ message: "target root exists but is not a directory",
158
+ remedy: `move or remove the file at ${root}`
159
+ });
160
+ }
161
+ } catch {
162
+ }
163
+ }
164
+ }
165
+ return out;
166
+ }
167
+ function checkDiskSpace(inputs, opts = {}) {
168
+ const floor = opts.diskFloorBytes ?? DEFAULT_DISK_FLOOR_BYTES;
169
+ const probe = nearestExistingAncestor(inputs.root);
170
+ const statfsSync2 = fs.statfsSync;
171
+ if (typeof statfsSync2 !== "function") {
172
+ return [
173
+ {
174
+ id: "disk-space",
175
+ severity: "info",
176
+ path: probe,
177
+ message: "free-disk check unavailable on this Node runtime",
178
+ remedy: ""
179
+ }
180
+ ];
181
+ }
182
+ try {
183
+ const st = statfsSync2(probe);
184
+ const free = st.bavail * st.bsize;
185
+ if (free < floor) {
186
+ return [
187
+ {
188
+ id: "disk-space",
189
+ severity: "blocking",
190
+ path: probe,
191
+ message: `free disk ${free} B is below the ${floor} B floor`,
192
+ remedy: "free disk space on the target volume, then re-run"
193
+ }
194
+ ];
195
+ }
196
+ } catch {
197
+ return [
198
+ {
199
+ id: "disk-space",
200
+ severity: "info",
201
+ path: probe,
202
+ message: "free-disk probe failed (statfs error) \u2014 check skipped",
203
+ remedy: ""
204
+ }
205
+ ];
206
+ }
207
+ return [];
208
+ }
209
+ function checkConflicts(inputs) {
210
+ const plan = buildInstallPlan(inputs);
211
+ const conflicts = computeConflicts(plan);
212
+ return conflicts.map((c) => ({
213
+ id: "conflicts",
214
+ severity: "warning",
215
+ path: c.path,
216
+ message: `existing file conflicts with planned ${c.kind} content`,
217
+ remedy: "resolve interactively, or pass --force to overwrite"
218
+ }));
219
+ }
220
+ function checkHostDetection(inputs) {
221
+ const presence = detectToolPresence(inputs.root);
222
+ const detected = Object.entries(presence).filter(([, v]) => v === true).map(([k]) => k);
223
+ if (detected.length === 0) {
224
+ return [
225
+ {
226
+ id: "host-detection",
227
+ severity: "info",
228
+ path: inputs.root,
229
+ message: "no AI-tool directories detected at the target root",
230
+ remedy: "expected for a first global install; verify the target path is right"
231
+ }
232
+ ];
233
+ }
234
+ return [
235
+ {
236
+ id: "host-detection",
237
+ severity: "info",
238
+ path: inputs.root,
239
+ message: `detected AI-tool surfaces: ${detected.join(", ")}`,
240
+ remedy: ""
241
+ }
242
+ ];
243
+ }
244
+ function runPreflight(inputs, opts = {}) {
245
+ return [
246
+ ...checkPermissions(inputs),
247
+ ...checkDiskSpace(inputs, opts),
248
+ ...checkConflicts(inputs),
249
+ ...checkHostDetection(inputs)
250
+ ];
251
+ }
252
+ function hasBlockingFinding(findings) {
253
+ return findings.some((f) => f.severity === "blocking");
254
+ }
255
+
256
+ export {
257
+ runPreflight,
258
+ hasBlockingFinding
259
+ };