@aiwg/cli 2026.10.11 → 2026.10.14

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 (174) hide show
  1. package/agentic/code/providers/model-catalog.v1.json +62 -12
  2. package/agentic/code/providers/pi/aiwg-bridge.ts +44 -1
  3. package/dist/src/artifacts/binding-target-identity.js +51 -0
  4. package/dist/src/artifacts/checksum-manifest.js +12 -0
  5. package/dist/src/artifacts/index-builder.js +11 -13
  6. package/dist/src/artifacts/query-engine.js +5 -11
  7. package/dist/src/cli/handlers/doctor-help.js +32 -0
  8. package/dist/src/cli/handlers/gates.js +19 -18
  9. package/dist/src/cli/handlers/models-help.js +7 -1
  10. package/dist/src/cli/handlers/models.js +3 -3
  11. package/dist/src/cli/handlers/script-runner.js +8 -5
  12. package/dist/src/cli/handlers/sessions-intake.js +104 -0
  13. package/dist/src/cli/handlers/sessions-tail.js +172 -0
  14. package/dist/src/cli/handlers/sessions.js +90 -17
  15. package/dist/src/cli/handlers/skill-lint.js +10 -3
  16. package/dist/src/cli/handlers/steward-format.js +100 -0
  17. package/dist/src/cli/handlers/steward-models.js +167 -0
  18. package/dist/src/cli/handlers/steward.js +14 -248
  19. package/dist/src/cli/handlers/use-bundle-counts.js +87 -0
  20. package/dist/src/cli/handlers/use-skill-assets.js +207 -0
  21. package/dist/src/cli/handlers/use.js +35 -216
  22. package/dist/src/cli/handlers/utilities.js +1 -24
  23. package/dist/src/config/aiwg-config.js +7 -0
  24. package/dist/src/config/authorization-cli.js +97 -0
  25. package/dist/src/config/cli-help.js +1 -0
  26. package/dist/src/config/cli.js +10 -1
  27. package/dist/src/decision/context-pruning-common.js +41 -0
  28. package/dist/src/decision/context-pruning-evaluation.js +366 -0
  29. package/dist/src/decision/context-pruning-pilot.js +431 -0
  30. package/dist/src/decision/context-pruning-types.js +19 -0
  31. package/dist/src/decision/context-pruning.js +5 -846
  32. package/dist/src/decision/ensemble/contract.js +17 -26
  33. package/dist/src/decision/ensemble-study/artifacts.js +5 -0
  34. package/dist/src/decision/ensemble-study/score.js +4 -3
  35. package/dist/src/decision/feature-export.js +3 -9
  36. package/dist/src/decision/heldout/collector.js +2 -2
  37. package/dist/src/decision/issue-triage/runtime.js +3 -9
  38. package/dist/src/decision/qualification/gates.js +2 -1
  39. package/dist/src/decision/qualification/release.js +6 -64
  40. package/dist/src/decision/routing/report.js +2 -0
  41. package/dist/src/decision/sdlc-screening.js +3 -5
  42. package/dist/src/decision/sensitivity/comparative.js +5 -3
  43. package/dist/src/extensions/manifest.js +8 -1
  44. package/dist/src/extensions/project-local-doctor.js +78 -2
  45. package/dist/src/extensions/validation.js +10 -11
  46. package/dist/src/gates/driver.js +6 -77
  47. package/dist/src/gates/evaluate.js +6 -23
  48. package/dist/src/gates/floors.js +4 -4
  49. package/dist/src/gates/index.js +3 -3
  50. package/dist/src/gates/lattice.js +26 -0
  51. package/dist/src/gates/registry.js +2 -1
  52. package/dist/src/gates/report.js +19 -7
  53. package/dist/src/gates/upstream-ceiling.js +111 -0
  54. package/dist/src/issues/audit-cli.js +120 -0
  55. package/dist/src/issues/audit-contract.js +64 -0
  56. package/dist/src/issues/audit-local.js +82 -0
  57. package/dist/src/issues/audit.js +220 -0
  58. package/dist/src/lint/rule-activation.js +15 -1
  59. package/dist/src/mission-protocol/canonical-codecs.js +270 -0
  60. package/dist/src/mission-protocol/codecs.js +22 -550
  61. package/dist/src/mission-protocol/health-trace-codecs.js +281 -0
  62. package/dist/src/mission-protocol/health-trace-types.js +43 -0
  63. package/dist/src/mission-protocol/types.js +2 -42
  64. package/dist/src/mission-protocol/worker-contract-json.js +10 -0
  65. package/dist/src/mission-protocol/worker-review-gate.js +100 -0
  66. package/dist/src/mission-protocol/worker-review-types.js +2 -0
  67. package/dist/src/models/catalog-policy.js +280 -0
  68. package/dist/src/models/index.js +1 -1
  69. package/dist/src/models/model-catalog.v1.json +62 -12
  70. package/dist/src/models/policy-resources.js +28 -0
  71. package/dist/src/models/provider-models.js +5 -8
  72. package/dist/src/models/provider-policy.js +10 -546
  73. package/dist/src/models/resolver.js +26 -8
  74. package/dist/src/models/router.js +15 -2
  75. package/dist/src/models/tiers.js +13 -0
  76. package/dist/src/models/types.js +0 -6
  77. package/dist/src/models/worker-ceilings.js +59 -0
  78. package/dist/src/models/worker-invocation-policy.js +243 -0
  79. package/dist/src/models/worker-plan.js +16 -20
  80. package/dist/src/models/worker-review-lineage.js +55 -0
  81. package/dist/src/models/worker-selection-policy.js +1 -1
  82. package/dist/src/models/wrapper-definitions.js +14 -0
  83. package/dist/src/models/wrapper-deployment.js +48 -25
  84. package/dist/src/models/wrapper-enforcement.js +72 -0
  85. package/dist/src/models/wrapper-route.js +6 -3
  86. package/dist/src/policy/authorization.js +1 -0
  87. package/dist/src/policy/hitl-check.js +80 -0
  88. package/dist/src/policy/hitl-config.js +63 -0
  89. package/dist/src/policy/hitl-receipt.js +57 -0
  90. package/dist/src/policy/hitl-types.js +4 -0
  91. package/dist/src/policy/hitl-validation.js +39 -0
  92. package/dist/src/policy/hitl.js +117 -0
  93. package/dist/src/rules/activation.d.mts +3 -1
  94. package/dist/src/rules/activation.mjs +23 -2
  95. package/dist/src/rules/gate-coverage.js +51 -0
  96. package/dist/src/rules/gate-references.js +16 -0
  97. package/dist/src/rules/rule-frontmatter.schema.json +7 -1
  98. package/dist/src/serve/worker-command-request.js +21 -4
  99. package/dist/src/serve/worker-invocation-preparation.js +3 -1
  100. package/dist/src/serve/worker-invocation.js +21 -10
  101. package/dist/src/sessions/adapters/deepseek-harness.js +1 -0
  102. package/dist/src/sessions/adapters/grok-build-native.js +269 -0
  103. package/dist/src/sessions/adapters/grok-build.js +57 -15
  104. package/dist/src/sessions/adapters/hermes-state-db.js +252 -0
  105. package/dist/src/sessions/adapters/hermes.js +42 -3
  106. package/dist/src/sessions/adapters/warp.js +1 -1
  107. package/dist/src/sessions/batch-import.js +10 -0
  108. package/dist/src/sessions/contracts.js +1 -1
  109. package/dist/src/sessions/discovery-capability.js +38 -0
  110. package/dist/src/sessions/importer.js +8 -251
  111. package/dist/src/sessions/index.js +4 -0
  112. package/dist/src/sessions/intake-dir.js +71 -0
  113. package/dist/src/sessions/normalization.js +251 -0
  114. package/dist/src/sessions/tail.js +91 -0
  115. package/dist/src/sessions/workspace-discovery.js +83 -7
  116. package/dist/src/skills/adapters/local.js +32 -9
  117. package/dist/src/skills/agent-skill-sidecar.js +28 -0
  118. package/dist/src/skills/agent-skills.js +6 -23
  119. package/dist/src/skills/claude-surface-projection.js +25 -0
  120. package/dist/src/skills/cli-display.js +33 -0
  121. package/dist/src/skills/cli.js +2 -26
  122. package/dist/src/skills/collision-discovery.js +84 -0
  123. package/dist/src/skills/deployer.js +26 -361
  124. package/dist/src/skills/deployment-ownership.js +74 -0
  125. package/dist/src/skills/deployment-policy.js +114 -0
  126. package/dist/src/skills/deployment-projection.js +152 -0
  127. package/dist/src/skills/deployment-types.js +20 -0
  128. package/dist/src/skills/doctor.js +2 -2
  129. package/dist/src/skills/exporter.js +8 -31
  130. package/dist/src/skills/importer.js +4 -26
  131. package/dist/src/skills/provider-extensions.js +41 -0
  132. package/dist/src/skills/registry.js +22 -7
  133. package/dist/src/skills/run.js +6 -0
  134. package/dist/src/skills/types.js +0 -8
  135. package/dist/src/skills/validator-resources.js +68 -0
  136. package/dist/src/skills/validator.js +6 -55
  137. package/dist/src/smiths/context-pipeline/parallelism-section.js +7 -3
  138. package/dist/src/storage/cli-migrate-options.js +125 -0
  139. package/dist/src/storage/cli-migrate.js +111 -0
  140. package/dist/src/storage/cli.js +4 -279
  141. package/dist/src/storage/migration-adapter.js +79 -0
  142. package/dist/src/storage/migration-copy.js +108 -0
  143. package/dist/src/storage/migration-protocol.js +14 -197
  144. package/dist/src/storage/migration-records.js +186 -0
  145. package/dist/src/storage/migration-types.js +12 -0
  146. package/dist/src/tracker/forge-http.js +2 -1
  147. package/dist/src/tracker/issue-pages.js +110 -0
  148. package/package.json +3 -1
  149. package/schemas/mission-v1.schema.json +335 -0
  150. package/schemas/models/model-catalog.v1.schema.json +19 -1
  151. package/schemas/models/model-config-compatibility.v1.schema.json +3 -2
  152. package/schemas/models/model-policy.v1.schema.json +1 -1
  153. package/tools/agents/providers/antigravity.mjs +3 -5
  154. package/tools/agents/providers/base.mjs +3 -3
  155. package/tools/agents/providers/claude.mjs +3 -5
  156. package/tools/agents/providers/codex.mjs +3 -5
  157. package/tools/agents/providers/copilot.mjs +3 -5
  158. package/tools/agents/providers/cursor.mjs +3 -5
  159. package/tools/agents/providers/factory.mjs +3 -5
  160. package/tools/agents/providers/grok-build.mjs +9 -7
  161. package/tools/agents/providers/model-wrapper.mjs +86 -0
  162. package/tools/agents/providers/omp.mjs +3 -1
  163. package/tools/agents/providers/openclaw.mjs +3 -5
  164. package/tools/agents/providers/opencode.mjs +3 -5
  165. package/tools/agents/providers/provider-paths-staging.mjs +44 -0
  166. package/tools/agents/providers/rule-binding-targets.mjs +146 -0
  167. package/tools/agents/providers/rule-delivery.mjs +9 -128
  168. package/tools/agents/providers/warp.mjs +3 -5
  169. package/tools/agents/providers/windsurf.mjs +3 -5
  170. package/tools/plugin/package-plugins.mjs +2 -2
  171. package/tools/skills/codex-skill-transform.mjs +232 -0
  172. package/tools/skills/deploy-skills-codex.mjs +8 -249
  173. package/tools/warp/warp-content.mjs +548 -0
  174. package/vscode-extension/schemas/aiwg.config.v1.json +177 -0
@@ -38,10 +38,9 @@ try { const gfs = _require('graceful-fs'); gfs.gracefulify(realFs); fs = realFs;
38
38
  import path from 'path';
39
39
  import { fileURLToPath } from 'node:url';
40
40
  import os from 'os';
41
- import { contentHash, writeSidecarManifest, getFrameworksForMode, normalizeDeploymentMode, skillMatchesProvider, isKernelSkill } from '../agents/providers/base.mjs';
41
+ import { deploySkillDir, getFrameworksForMode, normalizeDeploymentMode, isKernelSkill } from '../agents/providers/base.mjs';
42
42
 
43
- const MAX_NAME_LENGTH = 100;
44
- const MAX_DESCRIPTION_LENGTH = 500;
43
+ import { stripWrappingQuotes, transformToCodexSkill } from './codex-skill-transform.mjs';
45
44
  const LEGACY_RENAMED_SKILLS = new Set(['aiwg-mcp']);
46
45
 
47
46
  /** Codex's built-in startup skill-listing cap, in characters (see doctor). */
@@ -146,68 +145,6 @@ function ensureDir(d) {
146
145
  if (!fs.existsSync(d)) fs.mkdirSync(d, { recursive: true });
147
146
  }
148
147
 
149
- function stripWrappingQuotes(value) {
150
- const trimmed = String(value ?? '').trim();
151
- if (
152
- (trimmed.startsWith('"') && trimmed.endsWith('"')) ||
153
- (trimmed.startsWith("'") && trimmed.endsWith("'"))
154
- ) {
155
- return trimmed.slice(1, -1);
156
- }
157
- return trimmed;
158
- }
159
-
160
- function yamlDoubleQuoted(value) {
161
- return String(value ?? '')
162
- .replace(/\\/g, '\\\\')
163
- .replace(/"/g, '\\"')
164
- .replace(/\r?\n/g, ' ')
165
- .trim();
166
- }
167
-
168
- function codexDisplayName(skillName) {
169
- const acronyms = new Map([
170
- ['aiwg', 'AIWG'],
171
- ['dfir', 'DFIR'],
172
- ['sdlc', 'SDLC'],
173
- ['mcp', 'MCP'],
174
- ['pr', 'PR'],
175
- ]);
176
-
177
- return String(skillName)
178
- .split('-')
179
- .filter(Boolean)
180
- .map((part) => acronyms.get(part.toLowerCase()) || part.charAt(0).toUpperCase() + part.slice(1))
181
- .join(' ');
182
- }
183
-
184
- function codexOpenAiMetadata(skill) {
185
- return `interface:
186
- display_name: "${yamlDoubleQuoted(codexDisplayName(skill.name))}"
187
- short_description: "${yamlDoubleQuoted(skill.description)}"
188
- `;
189
- }
190
-
191
- function resolveSkillModelPolicy(frontmatter) {
192
- const block = frontmatter.match(/^commandHint:\s*\n((?:[ \t]+[^\n]*\n?)*)/m)?.[1] || '';
193
- const hint = {};
194
- for (const line of block.split('\n')) {
195
- const match = line.trim().match(/^(model|modelRole|modelTier|modelEffort|modelRationale):\s*(.+)$/);
196
- if (match) hint[match[1]] = stripWrappingQuotes(match[2]);
197
- }
198
- const legacy = String(hint.model || '').toLowerCase();
199
- const role = hint.modelRole || (legacy === 'opus' ? 'reasoning'
200
- : legacy === 'haiku' ? 'efficiency' : legacy ? 'coding' : null);
201
- if (!role) return null;
202
- return {
203
- role,
204
- tier: hint.modelTier || (role === 'reasoning' ? 'premium'
205
- : role === 'efficiency' ? 'economy' : 'standard'),
206
- effort: hint.modelEffort,
207
- rationale: hint.modelRationale,
208
- };
209
- }
210
-
211
148
  /**
212
149
  * Find skill directories containing SKILL.md
213
150
  */
@@ -229,189 +166,14 @@ function findSkillDirs(baseDir) {
229
166
  return skillDirs;
230
167
  }
231
168
 
232
- /**
233
- * Parse AIWG SKILL.md - handles both frontmatter and non-frontmatter formats
234
- */
235
- function parseSkillContent(content, skillName) {
236
- // Try YAML frontmatter format first
237
- const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
238
- if (fmMatch) {
239
- const [, frontmatter, body] = fmMatch;
240
- const metadata = {};
241
-
242
- // Parse YAML-like frontmatter
243
- for (const line of frontmatter.split('\n')) {
244
- const colonIdx = line.indexOf(':');
245
- if (colonIdx > 0) {
246
- const key = line.slice(0, colonIdx).trim();
247
- const value = line.slice(colonIdx + 1).trim();
248
- metadata[key] = stripWrappingQuotes(value);
249
- }
250
- }
251
-
252
- return { metadata, body, modelPolicy: resolveSkillModelPolicy(frontmatter) };
253
- }
254
-
255
- // Fallback: Parse non-frontmatter format (# skill-name header)
256
- const lines = content.split('\n');
257
- let name = skillName;
258
- let description = '';
259
- let bodyStartIdx = 0;
260
-
261
- // Look for # header as name
262
- for (let i = 0; i < lines.length; i++) {
263
- const line = lines[i].trim();
264
- if (line.startsWith('# ')) {
265
- name = line.slice(2).trim();
266
- bodyStartIdx = i + 1;
267
- break;
268
- }
269
- }
270
-
271
- // Look for first paragraph as description (skip empty lines)
272
- for (let i = bodyStartIdx; i < lines.length; i++) {
273
- const line = lines[i].trim();
274
- if (
275
- line &&
276
- !line.endsWith(':') &&
277
- !line.startsWith('#') &&
278
- !line.startsWith('-') &&
279
- !line.startsWith('|')
280
- ) {
281
- description = line;
282
- break;
283
- }
284
- }
285
-
286
- // If description is too short, try next paragraph
287
- if (description.length < 20) {
288
- for (let i = bodyStartIdx; i < lines.length; i++) {
289
- const line = lines[i].trim();
290
- if (line.startsWith('## ') && line.toLowerCase().includes('purpose')) {
291
- // Look for content after ## Purpose
292
- for (let j = i + 1; j < lines.length && j < i + 10; j++) {
293
- const purposeLine = lines[j].trim();
294
- if (purposeLine && !purposeLine.startsWith('#') && !purposeLine.startsWith('-')) {
295
- description = purposeLine;
296
- break;
297
- }
298
- }
299
- break;
300
- }
301
- }
302
- }
303
-
304
- return {
305
- metadata: { name, description },
306
- body: content
307
- };
308
- }
309
-
310
- /**
311
- * Transform AIWG skill to Codex format
312
- */
313
- function transformToCodexSkill(skillDir) {
314
- const skillPath = path.join(skillDir, 'SKILL.md');
315
- const skillName = path.basename(skillDir);
316
- const content = fs.readFileSync(skillPath, 'utf8');
317
-
318
- // Platform filtering: skip skills with explicit restrictions that exclude codex.
319
- // Skills using platforms: [all] (the standard token) always pass this check.
320
- if (!skillMatchesProvider(content, 'codex')) {
321
- return null;
322
- }
323
-
324
- const parsed = parseSkillContent(content, skillName);
325
-
326
- if (!parsed) {
327
- console.warn(`Warning: Could not parse ${skillPath}`);
328
- return null;
329
- }
330
-
331
- const { metadata, body, modelPolicy } = parsed;
332
-
333
- // Validate and truncate
334
- const name = (metadata.name || path.basename(skillDir)).slice(0, MAX_NAME_LENGTH);
335
- let description = metadata.description || '';
336
-
337
- // Codex REQUIRES a non-empty description — it rejects SKILL.md files that
338
- // lack one. Fail loudly rather than silently writing `description: ""`
339
- // (the exact regression this guard defends against).
340
- if (!description || !String(description).trim()) {
341
- console.error(
342
- `ERROR: Skill '${name}' has empty/missing description in source ${skillPath}`
343
- );
344
- console.error(
345
- ` Codex rejects SKILL.md files without a description field.`
346
- );
347
- console.error(
348
- ` Fix the source file: add a non-empty 'description:' to the frontmatter.`
349
- );
350
- return null;
351
- }
352
-
353
- // Truncate description to 500 chars, ending at word boundary
354
- if (description.length > MAX_DESCRIPTION_LENGTH) {
355
- description = description.slice(0, MAX_DESCRIPTION_LENGTH - 3);
356
- const lastSpace = description.lastIndexOf(' ');
357
- if (lastSpace > MAX_DESCRIPTION_LENGTH - 50) {
358
- description = description.slice(0, lastSpace);
359
- }
360
- description += '...';
361
- }
362
-
363
- // Final guard: never emit `description: ""` under any circumstance.
364
- const quotedDescription = yamlDoubleQuoted(description);
365
- if (!quotedDescription || !quotedDescription.trim()) {
366
- console.error(
367
- `ERROR: Skill '${name}' description collapsed to empty after normalization (source: ${skillPath})`
368
- );
369
- return null;
370
- }
371
-
372
- // Build Codex skill format — include platforms: [codex] so deployed skills are self-describing
373
- const codexContent = `---
374
- name: "${yamlDoubleQuoted(name)}"
375
- description: "${quotedDescription}"
376
- platforms: [codex]
377
- ---
378
-
379
- ${modelPolicy
380
- ? `<!-- aiwg:model-policy role=${modelPolicy.role} tier=${modelPolicy.tier}${modelPolicy.effort ? ` effort=${modelPolicy.effort}` : ''} outcome=unsupported${modelPolicy.rationale ? ` rationale=${yamlDoubleQuoted(modelPolicy.rationale)}` : ''} -->\n\n`
381
- : ''}${body.trim()}
382
- `;
383
-
384
- return {
385
- name,
386
- description,
387
- content: codexContent,
388
- metadataContent: codexOpenAiMetadata({ name, description }),
389
- sourcePath: skillPath,
390
- modelPolicy,
391
- };
392
- }
393
-
394
169
  /**
395
170
  * Deploy skill to Codex skills directory
396
171
  */
397
172
  function deploySkill(skill, targetDir, opts) {
398
173
  const { force = false, dryRun = false } = opts;
399
174
  const skillDir = path.join(targetDir, skill.name);
400
- const destPath = path.join(skillDir, 'SKILL.md');
401
175
  const metadataPath = path.join(skillDir, 'agents', 'openai.yaml');
402
176
 
403
- // Check if skill already exists
404
- if (fs.existsSync(destPath)) {
405
- const existingContent = fs.readFileSync(destPath, 'utf8');
406
- const existingMetadata = fs.existsSync(metadataPath)
407
- ? fs.readFileSync(metadataPath, 'utf8')
408
- : null;
409
- if (existingContent === skill.content && existingMetadata === skill.metadataContent && !force) {
410
- console.log(` skip (unchanged): ${skill.name}`);
411
- return { action: 'skip', reason: 'unchanged' };
412
- }
413
- }
414
-
415
177
  if (dryRun) {
416
178
  console.log(` [dry-run] deploy: ${skill.name}`);
417
179
  if (skill.modelPolicy) {
@@ -422,17 +184,14 @@ function deploySkill(skill, targetDir, opts) {
422
184
  return { action: 'deploy', reason: 'dry-run' };
423
185
  }
424
186
 
425
- // Create skill directory and write SKILL.md
426
- ensureDir(skillDir);
427
- fs.writeFileSync(destPath, skill.content, 'utf8');
187
+ // Use the same whole-folder copier and ownership receipt as other providers.
188
+ const deployed = deploySkillDir(path.dirname(skill.sourcePath), targetDir, {
189
+ force, dryRun, provider: 'codex', skillName: skill.name,
190
+ transformSkillMd: () => skill.content,
191
+ });
192
+ if (deployed === false) return { action: 'skip', reason: 'ownership' };
428
193
  ensureDir(path.dirname(metadataPath));
429
194
  fs.writeFileSync(metadataPath, skill.metadataContent, 'utf8');
430
- // Drop a marker file so future deploys can identify AIWG-managed
431
- // skills regardless of frontmatter format (Codex strips `namespace:`
432
- // during transform, so the SKILL.md alone isn't a reliable signal).
433
- // Cleanup keys off this presence.
434
- fs.writeFileSync(path.join(skillDir, '.aiwg-managed'), 'aiwg\n', 'utf8');
435
- writeSidecarManifest(skillDir, { skillSource: path.dirname(skill.sourcePath), managed: { 'SKILL.md': { sourcePath: skill.sourcePath, hash: `sha256:${contentHash(skill.content)}` } } }, false);
436
195
  console.log(` deployed: ${skill.name}`);
437
196
 
438
197
  return { action: 'deploy', reason: 'success' };