@aiwg/cli 2026.9.5 → 2026.9.7

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 (33) hide show
  1. package/dist/src/cli/handlers/help.js +7 -1
  2. package/dist/src/cli/handlers/installation.js +4 -0
  3. package/dist/src/cli/handlers/mc.js +13 -20
  4. package/dist/src/cli/handlers/ralph.js +14 -4
  5. package/dist/src/cli/handlers/refresh.js +298 -30
  6. package/dist/src/cli/handlers/runtime-info.js +3 -0
  7. package/dist/src/cli/handlers/serve.js +21 -3
  8. package/dist/src/cli/handlers/use.js +114 -8
  9. package/dist/src/cli/handlers/utilities.js +26 -10
  10. package/dist/src/cli/services/deployment-verification.js +117 -1
  11. package/dist/src/cli/watch-service.js +47 -4
  12. package/dist/src/config/project-artifacts-health.mjs +15 -2
  13. package/dist/src/cost/fleet-report.js +19 -5
  14. package/dist/src/extensions/project-local-doctor.js +40 -2
  15. package/dist/src/extensions/project-quickref.js +4 -0
  16. package/dist/src/installation/manager.mjs +38 -3
  17. package/dist/src/mcp/helpers.mjs +56 -22
  18. package/dist/src/mcp/registry.js +32 -22
  19. package/dist/src/mcp/registry.mjs +31 -26
  20. package/dist/src/mcp/toml-editor.mjs +117 -0
  21. package/dist/src/mcp/tools/orchestration.mjs +7 -7
  22. package/dist/src/mcp/tools/subsystems.mjs +7 -7
  23. package/dist/src/memory/context-pack.js +5 -1
  24. package/dist/src/plugin/skill-command-translator.js +70 -1
  25. package/dist/src/serve/a2a-terminal-observer.js +19 -1
  26. package/dist/src/serve/mission-hitl.js +91 -0
  27. package/dist/src/sessions/import-lease.js +5 -1
  28. package/dist/src/smiths/context-pipeline/workspace-context.js +81 -5
  29. package/dist/src/testing/fixtures/test-data-factory.js +3 -3
  30. package/dist/src/writing/pattern-library.js +29 -6
  31. package/package.json +3 -1
  32. package/tools/agents/deploy-agents.mjs +87 -5
  33. package/tools/agents/providers/base.mjs +61 -2
@@ -199,7 +199,7 @@ export function addManagedMarker(content, version, source, style = 'markdown') {
199
199
  /**
200
200
  * Compute SHA-256 hash of content (hex string).
201
201
  */
202
- function contentHash(content) {
202
+ export function contentHash(content) {
203
203
  return createHash('sha256').update(content).digest('hex');
204
204
  }
205
205
 
@@ -240,9 +240,12 @@ export function updateSidecarManifest(dir, deployedEntries, opts) {
240
240
  const existing = readSidecarManifest(dir) || { managed: {} };
241
241
 
242
242
  for (const entry of deployedEntries) {
243
- const { filename, hash, frameworkSlug } = entry;
243
+ const { filename, hash, frameworkSlug, kind } = entry;
244
244
  const sidecarEntry = { hash: `sha256:${hash}`, source, version };
245
245
  if (frameworkSlug) sidecarEntry.frameworkSlug = frameworkSlug;
246
+ // `kind` marks artifacts whose lifecycle is governed elsewhere — currently
247
+ // only `skill-command` wrappers, which follow their source skill (#2507).
248
+ if (kind) sidecarEntry.kind = kind;
246
249
  existing.managed[filename] = sidecarEntry;
247
250
  }
248
251
 
@@ -1342,6 +1345,39 @@ export function resolveAiwgRoot(srcRoot) {
1342
1345
  return null;
1343
1346
  }
1344
1347
 
1348
+ /**
1349
+ * Names of every skill AIWG ships, kernel and standard alike (#2511).
1350
+ *
1351
+ * `computeAllKernelNames` filters to kernel skills, but skill-command wrappers
1352
+ * are generated from both tiers, so retiring an orphaned wrapper needs the full
1353
+ * set. Anchored to the AIWG root rather than `srcRoot` for the same reason
1354
+ * `computeAllArtifactBasenames` is: a bundle-scoped deploy must not produce an
1355
+ * empty desired set and retire everything.
1356
+ *
1357
+ * @param {string} srcRoot AIWG repo / install root (or a subdir of it)
1358
+ * @returns {Set<string>|null} skill directory names, or null when no AIWG tree
1359
+ * is found — callers MUST then skip pruning.
1360
+ */
1361
+ export function computeAllSkillNames(srcRoot) {
1362
+ const aiwgRoot = resolveAiwgRoot(srcRoot);
1363
+ if (!aiwgRoot) return null;
1364
+
1365
+ const names = new Set();
1366
+ for (const group of ['frameworks', 'addons']) {
1367
+ const root = path.join(aiwgRoot, 'agentic', 'code', group);
1368
+ if (!fs.existsSync(root)) continue;
1369
+ for (const component of fs.readdirSync(root, { withFileTypes: true })) {
1370
+ if (!component.isDirectory()) continue;
1371
+ const skillsDir = path.join(root, component.name, 'skills');
1372
+ if (!fs.existsSync(skillsDir)) continue;
1373
+ for (const skill of fs.readdirSync(skillsDir, { withFileTypes: true })) {
1374
+ if (skill.isDirectory()) names.add(skill.name);
1375
+ }
1376
+ }
1377
+ }
1378
+ return names;
1379
+ }
1380
+
1345
1381
  /**
1346
1382
  * Holistic post-deploy prune of stale AIWG-managed flat artifacts
1347
1383
  * (agents / commands / rules). The flat-file analogue of
@@ -1371,6 +1407,15 @@ export function resolveAiwgRoot(srcRoot) {
1371
1407
  export function pruneStaleAiwgFiles(destDir, desiredStems, opts = {}) {
1372
1408
  const { dryRun = false, verbose = false } = opts;
1373
1409
  const artifactExtensions = opts.artifactExtensions || ['.md', '.mdc'];
1410
+ // When supplied, skill-command wrappers are retired against the set of skills
1411
+ // that still exist rather than exempted outright (#2511). `null`/absent keeps
1412
+ // the blanket exemption, so callers without a skill inventory cannot retire a
1413
+ // wrapper by accident.
1414
+ const skillCommandStems = opts.skillCommandStems instanceof Set
1415
+ ? opts.skillCommandStems
1416
+ : Array.isArray(opts.skillCommandStems)
1417
+ ? new Set(opts.skillCommandStems)
1418
+ : null;
1374
1419
  const removed = [];
1375
1420
  if (!destDir || !fs.existsSync(destDir)) return removed;
1376
1421
 
@@ -1397,6 +1442,15 @@ export function pruneStaleAiwgFiles(destDir, desiredStems, opts = {}) {
1397
1442
 
1398
1443
  if (desired.has(artifactStem(name))) continue;
1399
1444
 
1445
+ // Skill-command wrappers are named after skills, not command sources, so
1446
+ // they are absent from the command desired set by construction — pruning
1447
+ // them against it would delete wrappers the same deploy just wrote (#2507).
1448
+ // They are retired against the skill inventory instead, when one is given
1449
+ // (#2511); without one they stay exempt.
1450
+ if (managed[name]?.kind === 'skill-command') {
1451
+ if (!skillCommandStems || skillCommandStems.has(artifactStem(name))) continue;
1452
+ }
1453
+
1400
1454
  // Ownership gate — never delete a file AIWG didn't deploy.
1401
1455
  let owned = Object.prototype.hasOwnProperty.call(managed, name);
1402
1456
  if (!owned) {
@@ -2907,6 +2961,11 @@ export function migrateCommandsDirectory(commandsDir, opts = {}) {
2907
2961
  const lower = entry.name.toLowerCase();
2908
2962
  if (!lower.endsWith('.md')) continue; // only command markdown files
2909
2963
  const filePath = path.join(commandsDir, entry.name);
2964
+ // Skill-command wrappers ARE the current skill surface, not legacy command
2965
+ // files superseded by it. Migrating them away deletes what the same deploy
2966
+ // just wrote — and on a kernel-only run, which does not re-translate, they
2967
+ // are never restored (#2507).
2968
+ if (managed[entry.name]?.kind === 'skill-command') continue;
2910
2969
  let owned = Object.prototype.hasOwnProperty.call(managed, entry.name);
2911
2970
  if (!owned) {
2912
2971
  try {