@aiwg/cli 2026.10.5 → 2026.10.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.
- package/agentic/code/addons/composition-engine/lib/runtime.mjs +1401 -0
- package/agentic/code/addons/composition-engine/lib/validator.mjs +513 -0
- package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +372 -0
- package/agentic/code/providers/model-capabilities.v1.json +74 -50
- package/bin/aiwg.mjs +7 -3
- package/dist/src/a2a/agent-card.js +11 -0
- package/dist/src/api/index.d.ts +1 -0
- package/dist/src/api/index.js +1 -0
- package/dist/src/artifacts/browser-export.js +1 -0
- package/dist/src/artifacts/citation-parser.js +8 -1
- package/dist/src/artifacts/cli.js +57 -6
- package/dist/src/artifacts/fortemi-core-query-adapter.js +2 -0
- package/dist/src/artifacts/fortemi-core-sync.js +26 -8
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/contract.json +103 -0
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/full-v1-embedding-config.schema.json +212 -0
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/full-v1-embedding-set.schema.json +240 -0
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/full-v1-manifest.schema.json +451 -0
- package/dist/src/artifacts/fortemi-shard-export.js +284 -0
- package/dist/src/artifacts/graph-query.js +18 -8
- package/dist/src/artifacts/index-adapters.js +339 -0
- package/dist/src/artifacts/index-builder.js +143 -14
- package/dist/src/artifacts/index-files.js +15 -4
- package/dist/src/artifacts/index-preparation.js +2 -0
- package/dist/src/artifacts/index-reader.js +44 -0
- package/dist/src/artifacts/index-refresh.js +114 -55
- package/dist/src/artifacts/index-status.js +20 -5
- package/dist/src/artifacts/memory-maintenance.js +503 -0
- package/dist/src/artifacts/prebuilt-relations.js +3 -1
- package/dist/src/artifacts/query-engine.js +263 -108
- package/dist/src/artifacts/relations-builder.js +2 -2
- package/dist/src/artifacts/source-graph.js +2 -2
- package/dist/src/artifacts/types.js +9 -1
- package/dist/src/auth/client.js +5 -1
- package/dist/src/auth/credential-store.js +5 -1
- package/dist/src/auth/sensitive-input.js +151 -0
- package/dist/src/channel/manager.mjs +3 -0
- package/dist/src/cli/handlers/agentcard.js +47 -25
- package/dist/src/cli/handlers/auth.js +22 -2
- package/dist/src/cli/handlers/decision.js +22 -3
- package/dist/src/cli/handlers/effect.js +4 -84
- package/dist/src/cli/handlers/guided-setup.js +470 -0
- package/dist/src/cli/handlers/help.js +2 -2
- package/dist/src/cli/handlers/housekeeper.js +1110 -0
- package/dist/src/cli/handlers/index.js +4 -2
- package/dist/src/cli/handlers/init.js +41 -6
- package/dist/src/cli/handlers/install.js +6 -0
- package/dist/src/cli/handlers/local-executor.js +5 -3
- package/dist/src/cli/handlers/marketplace.js +15 -4
- package/dist/src/cli/handlers/mc.js +509 -53
- package/dist/src/cli/handlers/models.js +32 -2
- package/dist/src/cli/handlers/ralph-launcher.js +76 -4
- package/dist/src/cli/handlers/rules.js +1 -1
- package/dist/src/cli/handlers/script-runner.js +73 -2
- package/dist/src/cli/handlers/serve.js +5 -3
- package/dist/src/cli/handlers/sessions.js +1 -0
- package/dist/src/cli/handlers/setup.js +432 -1
- package/dist/src/cli/handlers/skill-lint.js +1 -1
- package/dist/src/cli/handlers/subcommands.js +118 -8
- package/dist/src/cli/handlers/use.js +335 -107
- package/dist/src/cli/handlers/workspace.js +3 -1
- package/dist/src/cli/prompt-utils.js +81 -0
- package/dist/src/cli/router.js +16 -1
- package/dist/src/config/aiwg-config.js +42 -0
- package/dist/src/config/cli.js +7 -3
- package/dist/src/config/decision-config.js +14 -1
- package/dist/src/config/gitignore.js +4 -0
- package/dist/src/config/native-sandbox-warnings.js +25 -0
- package/dist/src/config/workspace.js +2 -1
- package/dist/src/contributors/validation.js +6 -5
- package/dist/src/decision/adapters/jev.js +20 -31
- package/dist/src/decision/admission.js +7 -3
- package/dist/src/decision/ask.js +6 -1
- package/dist/src/decision/benchmark.js +482 -0
- package/dist/src/decision/ledger.js +22 -3
- package/dist/src/decision/pricing.js +147 -0
- package/dist/src/decision/qualification/gate-evidence.js +23 -18
- package/dist/src/decision/qualification/load-staged.js +576 -0
- package/dist/src/decision/qualification/load.js +109 -33
- package/dist/src/decision/qualification/runner.js +12 -5
- package/dist/src/decision/review/service.js +6 -4
- package/dist/src/decision/review/validate.js +23 -2
- package/dist/src/decision/savings.js +8 -3
- package/dist/src/discovery/index.js +492 -0
- package/dist/src/discovery/interview.js +238 -0
- package/dist/src/discovery/plan-apply.js +567 -0
- package/dist/src/discovery/plan-store.js +171 -0
- package/dist/src/discovery/plan-types.js +2 -0
- package/dist/src/discovery/plan-validation.js +139 -0
- package/dist/src/discovery/types.js +2 -0
- package/dist/src/effects/host.js +91 -0
- package/dist/src/extensions/commands/definitions.js +49 -9
- package/dist/src/extensions/manifest.js +71 -44
- package/dist/src/extensions/project-local-discovery.js +1 -1
- package/dist/src/extensions/project-local-gitignore.js +2 -0
- package/dist/src/extensions/project-quickref.js +18 -17
- package/dist/src/extensions/validation.js +32 -29
- package/dist/src/housekeeper/daemon-config.js +148 -0
- package/dist/src/housekeeper/ipc.js +84 -0
- package/dist/src/housekeeper/lifecycle.js +148 -0
- package/dist/src/housekeeper/platform.js +35 -0
- package/dist/src/housekeeper/status.js +70 -0
- package/dist/src/housekeeper/units.js +114 -0
- package/dist/src/issues/cli.js +16 -5
- package/dist/src/issues/live.js +44 -12
- package/dist/src/jobs/flow.js +22 -21
- package/dist/src/lint/rule-activation.js +20 -5
- package/dist/src/lint/runner.js +1 -1
- package/dist/src/marketplace/exchange.js +18 -6
- package/dist/src/marketplace/provenance.js +3 -2
- package/dist/src/mcp/adapters/codex-runtime.js +46 -76
- package/dist/src/mcp/cli.mjs +22 -96
- package/dist/src/mcp/config-file.mjs +6 -2
- package/dist/src/mcp/config-layers.mjs +23 -7
- package/dist/src/mcp/grok-build-config.mjs +2 -1
- package/dist/src/mcp/muse-native-config.mjs +2 -1
- package/dist/src/mcp/profiles.js +18 -31
- package/dist/src/mcp/profiles.mjs +18 -32
- package/dist/src/mcp/registry.js +7 -27
- package/dist/src/mcp/registry.mjs +7 -28
- package/dist/src/mcp/server.mjs +34 -1
- package/dist/src/mcp/tools/agentic-sandbox.mjs +8 -7
- package/dist/src/mcp/tools/command-run.mjs +3 -2
- package/dist/src/mcp/tools/decision.mjs +49 -48
- package/dist/src/mcp/tools/discovery.mjs +46 -21
- package/dist/src/mcp/tools/orchestration.mjs +22 -22
- package/dist/src/mcp/tools/subsystems.mjs +9 -8
- package/dist/src/mcp/tools/worker-invoke.mjs +30 -6
- package/dist/src/mcp/tools/writer-profiles.mjs +1 -1
- package/dist/src/memory/audit.js +719 -0
- package/dist/src/memory/canonical-context.js +392 -13
- package/dist/src/memory/canonical-maintenance.js +95 -0
- package/dist/src/memory/cli-result.js +22 -0
- package/dist/src/memory/cli.js +176 -0
- package/dist/src/memory/context-pack.js +57 -6
- package/dist/src/memory/cost.js +512 -0
- package/dist/src/memory/firewall-classification.d.mts +7 -0
- package/dist/src/memory/firewall-classification.mjs +32 -0
- package/dist/src/memory/index.js +8 -0
- package/dist/src/memory/line-maintenance.js +68 -0
- package/dist/src/memory/maintenance-cli.js +286 -0
- package/dist/src/memory/maintenance-contract.js +136 -0
- package/dist/src/memory/maintenance-index.js +18 -0
- package/dist/src/memory/maintenance-owner.js +2 -0
- package/dist/src/memory/maintenance-record.js +138 -0
- package/dist/src/memory/maintenance.js +254 -0
- package/dist/src/memory/project-registry.js +2 -1
- package/dist/src/memory/provider-memory-adapter.js +154 -0
- package/dist/src/memory/recommend-cli.js +83 -0
- package/dist/src/memory/recommend.js +269 -0
- package/dist/src/memory/scheduled.js +81 -0
- package/dist/src/memory/taxonomy.js +44 -0
- package/dist/src/mission-protocol/codecs.js +19 -9
- package/dist/src/mission-protocol/worker-status.js +91 -1
- package/dist/src/models/config-loader.js +11 -1
- package/dist/src/models/model-capabilities.v1.json +74 -50
- package/dist/src/models/provider-policy.js +125 -62
- package/dist/src/models/resolver.js +45 -8
- package/dist/src/models/worker-installation.d.mts +8 -1
- package/dist/src/models/worker-installation.mjs +231 -38
- package/dist/src/models/wrapper-route.js +1 -1
- package/dist/src/output-modes/registry.js +8 -7
- package/dist/src/packages/adapters/git.js +99 -23
- package/dist/src/packages/adapters/gitea.js +8 -27
- package/dist/src/packages/adapters/github.js +7 -25
- package/dist/src/packages/registry.js +4 -4
- package/dist/src/plugin/metadata-validator.js +1 -1
- package/dist/src/process/cli-command.d.mts +5 -0
- package/dist/src/process/cli-command.mjs +42 -0
- package/dist/src/providers/deploy-version.d.mts +1 -0
- package/dist/src/providers/deploy-version.mjs +17 -0
- package/dist/src/providers/provider-definitions.js +19 -16
- package/dist/src/providers/skill-ownership.d.mts +11 -2
- package/dist/src/providers/skill-ownership.mjs +35 -17
- package/dist/src/rules/activation.d.mts +11 -2
- package/dist/src/rules/activation.mjs +82 -6
- package/dist/src/rules/inventory.js +1 -1
- package/dist/src/rules/rule-frontmatter.schema.json +2 -0
- package/dist/src/schema/zod-validation.d.mts +6 -0
- package/dist/src/schema/zod-validation.mjs +50 -0
- package/dist/src/serve/executor-registry.js +297 -20
- package/dist/src/serve/executor-token.d.mts +1 -0
- package/dist/src/serve/executor-token.mjs +8 -0
- package/dist/src/serve/shared-host-scheduler.js +1102 -31
- package/dist/src/serve/worker-invocation.js +124 -15
- package/dist/src/sessions/adapters/claude.js +19 -18
- package/dist/src/sessions/adapters/codex.js +10 -9
- package/dist/src/sessions/adapters/copilot.js +14 -13
- package/dist/src/sessions/adapters/cursor.js +19 -18
- package/dist/src/sessions/adapters/deepseek-harness.js +9 -8
- package/dist/src/sessions/adapters/factory.js +11 -10
- package/dist/src/sessions/adapters/generic.js +32 -23
- package/dist/src/sessions/adapters/grokbot.js +35 -35
- package/dist/src/sessions/adapters/hermes.js +20 -19
- package/dist/src/sessions/adapters/muse.js +50 -49
- package/dist/src/sessions/adapters/omp.js +5 -4
- package/dist/src/sessions/adapters/openclaw.js +30 -29
- package/dist/src/sessions/adapters/opencode.js +26 -26
- package/dist/src/sessions/adapters/openhuman.js +24 -23
- package/dist/src/sessions/adapters/pi.js +5 -4
- package/dist/src/sessions/adapters/windsurf.js +8 -8
- package/dist/src/sessions/analytics.js +10 -9
- package/dist/src/sessions/candidates.js +7 -6
- package/dist/src/sessions/contracts.js +63 -53
- package/dist/src/sessions/output-registration.js +11 -10
- package/dist/src/sessions/workspace-discovery.js +3 -4
- package/dist/src/smiths/context-pipeline/aiwg-md.js +18 -1
- package/dist/src/smiths/context-pipeline/claude-hook.js +46 -10
- package/dist/src/smiths/context-pipeline/context-file-safety.js +330 -9
- package/dist/src/smiths/context-pipeline/finalization.js +3 -2
- package/dist/src/smiths/context-pipeline/generator.js +7 -19
- package/dist/src/smiths/context-pipeline/legacy-inject.js +3 -10
- package/dist/src/smiths/context-pipeline/managed-hook.js +5 -5
- package/dist/src/smiths/context-pipeline/parallelism-section.js +72 -5
- package/dist/src/smiths/context-pipeline/workspace-context.js +110 -22
- package/dist/src/tracker/project-inputs.js +2 -0
- package/dist/src/update/checker.d.mts +4 -0
- package/dist/src/update/checker.mjs +14 -0
- package/dist/src/update/notifier.mjs +2 -4
- package/dist/src/writing/exemplar-selection.js +6 -6
- package/dist/src/writing/voice-evaluation.js +24 -23
- package/dist/src/writing/writer-migration.js +14 -13
- package/dist/src/writing/writer-profile.js +19 -18
- package/dist/src/writing/writing-brief.js +18 -17
- package/dist/src/writing/writing-receipt.js +47 -46
- package/package.json +5 -2
- package/schemas/decision/DecisionReview.schema.json +78 -1
- package/schemas/mission-v1.schema.json +3 -0
- package/tools/agents/deploy-agents.mjs +67 -39
- package/tools/agents/providers/antigravity.mjs +6 -1
- package/tools/agents/providers/base.mjs +24 -14
- package/tools/agents/providers/claude.mjs +6 -3
- package/tools/agents/providers/codex.mjs +54 -57
- package/tools/agents/providers/context-write.mjs +28 -0
- package/tools/agents/providers/copilot.mjs +13 -4
- package/tools/agents/providers/cursor.mjs +1 -1
- package/tools/agents/providers/deepseek-harness.mjs +1 -1
- package/tools/agents/providers/factory.mjs +7 -1
- package/tools/agents/providers/grok-build.mjs +18 -2
- package/tools/agents/providers/grokbot.mjs +1 -1
- package/tools/agents/providers/hermes.mjs +12 -15
- package/tools/agents/providers/muse-hooks.mjs +21 -14
- package/tools/agents/providers/muse.mjs +7 -2
- package/tools/agents/providers/omp.mjs +31 -5
- package/tools/agents/providers/opencode.mjs +14 -5
- package/tools/agents/providers/openhuman.mjs +1 -1
- package/tools/agents/providers/pi.mjs +1 -1
- package/tools/agents/providers/provider-prepare-coordinator.mjs +29 -9
- package/tools/agents/providers/rule-delivery.mjs +289 -80
- package/tools/agents/providers/warp.mjs +4 -1
- package/tools/agents/providers/windsurf.mjs +13 -3
- package/tools/cli/workspace-status.mjs +5 -0
- package/tools/commands/deploy-prompts-codex.mjs +11 -8
- package/tools/ralph-external/lib/codex-adapter.mjs +6 -2
- package/tools/ralph-external/lib/consecutive-failure-circuit-breaker.mjs +26 -0
- package/tools/ralph-external/lib/launcher-recovery-evidence.mjs +7 -1
- package/tools/ralph-external/lib/muse-adapter.mjs +12 -2
- package/tools/ralph-external/lib/recovery-probe.mjs +14 -4
- package/tools/ralph-external/lib/worker-health.mjs +1 -1
- package/tools/ralph-external/lib/worker-isolation.mjs +65 -9
- package/tools/ralph-external/process-monitor.mjs +49 -8
- package/tools/ralph-external/session-launcher.mjs +405 -35
- package/tools/skills/deploy-skills-codex.mjs +11 -7
- package/vscode-extension/schemas/aiwg.config.v1.json +11 -1
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
* --model-tier <tier> Override all artifacts with economy|standard|premium
|
|
33
33
|
* --as-agents-md Aggregate to single AGENTS.md (OpenAI/Codex)
|
|
34
34
|
* --create-agents-md Create/update AGENTS.md template
|
|
35
|
+
--no-context-files Preserve WORKSPACE.md, AIWG.md and AGENTS.md (including managed blocks)
|
|
35
36
|
* --skip-commands-migration Skip deleting the commands directory (warns about duplicate TUI entries) (Factory/Codex/OpenCode/Cursor)
|
|
36
37
|
* --deploy-source <name> Managed-marker source for deployed artifacts (default: bundled)
|
|
37
38
|
* --deploy-version <version> Managed-marker version for deployed artifacts (default: source package.json)
|
|
@@ -75,6 +76,8 @@ const staticModelCatalog = _require('../../agentic/code/providers/model-catalog.
|
|
|
75
76
|
let fs;
|
|
76
77
|
try { const gfs = _require('graceful-fs'); gfs.gracefulify(realFs); fs = realFs; } catch { fs = realFs; }
|
|
77
78
|
import path from 'path';
|
|
79
|
+
import { importImpl } from '../_resolve-impl.mjs';
|
|
80
|
+
const { resolveDeployVersion } = await importImpl(import.meta.url, 'providers/deploy-version.mjs');
|
|
78
81
|
import os from 'os';
|
|
79
82
|
import readline from 'readline';
|
|
80
83
|
import { fileURLToPath } from 'url';
|
|
@@ -96,20 +99,6 @@ import {
|
|
|
96
99
|
resolveAiwgRoot,
|
|
97
100
|
updateSidecarManifest,
|
|
98
101
|
} from './providers/base.mjs';
|
|
99
|
-
const modelCatalog = loadRuntimeModelCatalog(staticModelCatalog);
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Read version from package.json at the source root.
|
|
103
|
-
* Falls back to 'unknown' if unavailable.
|
|
104
|
-
*/
|
|
105
|
-
function getDeployVersion(srcRoot) {
|
|
106
|
-
try {
|
|
107
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(srcRoot, 'package.json'), 'utf8'));
|
|
108
|
-
return pkg.version || 'unknown';
|
|
109
|
-
} catch {
|
|
110
|
-
return 'unknown';
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
102
|
|
|
114
103
|
// ============================================================================
|
|
115
104
|
// Provider Registry
|
|
@@ -421,10 +410,8 @@ function pruneStaleAiwgArtifacts(provider, target, srcRoot, opts, explicitSource
|
|
|
421
410
|
}
|
|
422
411
|
|
|
423
412
|
if (opts.kernelOnly) {
|
|
424
|
-
//
|
|
425
|
-
//
|
|
426
|
-
// basis for judging any flat artifact stale. The empty desired set below
|
|
427
|
-
// exists for one narrow migration: clearing agents/commands/rules left by
|
|
413
|
+
// Kernel-only delivers skills and rules. The empty desired set below
|
|
414
|
+
// applies only to bulk agents/commands left by
|
|
428
415
|
// the pre-#152 bulk default, when the bulk install is the only thing this
|
|
429
416
|
// project ever deployed.
|
|
430
417
|
//
|
|
@@ -438,7 +425,7 @@ function pruneStaleAiwgArtifacts(provider, target, srcRoot, opts, explicitSource
|
|
|
438
425
|
}
|
|
439
426
|
return;
|
|
440
427
|
}
|
|
441
|
-
for (const type of ['agents', 'commands'
|
|
428
|
+
for (const type of ['agents', 'commands']) {
|
|
442
429
|
const relPath = provider.paths?.[type];
|
|
443
430
|
if (!relPath || relPath.endsWith('.md')) continue;
|
|
444
431
|
const destDir = path.isAbsolute(relPath) ? relPath : path.join(target, relPath);
|
|
@@ -499,6 +486,8 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
499
486
|
efficiencyModel: null,
|
|
500
487
|
asAgentsMd: false,
|
|
501
488
|
createAgentsMd: false,
|
|
489
|
+
contextFiles: true,
|
|
490
|
+
projectScope: false,
|
|
502
491
|
deployCommands: false,
|
|
503
492
|
deploySkills: false,
|
|
504
493
|
deployRules: false,
|
|
@@ -509,6 +498,8 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
509
498
|
strict: false,
|
|
510
499
|
reportOnly: true,
|
|
511
500
|
kernelOnly: false,
|
|
501
|
+
deferRuleProjection: false,
|
|
502
|
+
additionalSources: [],
|
|
512
503
|
filter: null, // Glob pattern for agent names
|
|
513
504
|
filterRole: null, // Filter by role: reasoning|coding|efficiency
|
|
514
505
|
save: false, // Save model config to project models.json
|
|
@@ -532,6 +523,11 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
532
523
|
for (let i = 0; i < args.length; i++) {
|
|
533
524
|
const a = args[i];
|
|
534
525
|
if (a === '--source' && args[i + 1]) cfg.source = path.resolve(args[++i]);
|
|
526
|
+
else if (a === '--additional-source') {
|
|
527
|
+
const source = args[++i];
|
|
528
|
+
if (!source || source.startsWith('--')) throw new Error('--additional-source requires a source directory');
|
|
529
|
+
cfg.additionalSources.push(path.resolve(source));
|
|
530
|
+
}
|
|
535
531
|
else if (a === '--target' && args[i + 1]) cfg.target = path.resolve(args[++i]);
|
|
536
532
|
else if (a === '--mode' && args[i + 1]) cfg.mode = String(args[++i]).toLowerCase();
|
|
537
533
|
else if (a === '--scope') {
|
|
@@ -540,6 +536,7 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
540
536
|
throw new Error(`--scope expected 'user' or 'project', got '${scope ?? '(missing)'}'`);
|
|
541
537
|
}
|
|
542
538
|
cfg.userScope = scope === 'user';
|
|
539
|
+
cfg.projectScope = scope === 'project';
|
|
543
540
|
}
|
|
544
541
|
else if (a === '--user') cfg.userScope = true;
|
|
545
542
|
else if (a === '--dry-run') cfg.dryRun = true;
|
|
@@ -563,6 +560,8 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
563
560
|
else if (a === '--allow-over-budget') cfg.allowOverBudget = true;
|
|
564
561
|
else if (a === '--report-only') cfg.reportOnly = true;
|
|
565
562
|
else if (a === '--kernel-only') cfg.kernelOnly = true;
|
|
563
|
+
// Internal use orchestration: the final source owns rule presentation.
|
|
564
|
+
else if (a === '--defer-rule-projection') cfg.deferRuleProjection = true;
|
|
566
565
|
else if (a === '--deploy-behaviors') cfg.deployBehaviors = true;
|
|
567
566
|
else if (a === '--filter' && args[i + 1]) cfg.filter = args[++i];
|
|
568
567
|
else if (a === '--filter-role' && args[i + 1]) cfg.filterRole = args[++i];
|
|
@@ -579,12 +578,12 @@ export function parseArgs(args = process.argv.slice(2)) {
|
|
|
579
578
|
// managed-hooks opt-out (default on, mirroring the Claude autoInstall policy).
|
|
580
579
|
else if (a === '--mcp') cfg.mcp = true;
|
|
581
580
|
else if (a === '--no-hooks') cfg.hooks = false;
|
|
581
|
+
else if (a === '--no-context-files') cfg.contextFiles = false;
|
|
582
582
|
else if (a === '--deploy-source' && args[i + 1]) cfg.deploySource = String(args[++i]);
|
|
583
583
|
else if (a === '--listing-budget') cfg.listingBudget = true;
|
|
584
584
|
else if (a === '--deploy-version' && args[i + 1]) cfg.deployVersion = String(args[++i]);
|
|
585
585
|
else if (a === '--help' || a === '-h') {
|
|
586
|
-
|
|
587
|
-
process.exit(0);
|
|
586
|
+
cfg.help = true;
|
|
588
587
|
}
|
|
589
588
|
}
|
|
590
589
|
return cfg;
|
|
@@ -610,7 +609,7 @@ Options:
|
|
|
610
609
|
--commands-only Deploy only commands (skip agents)
|
|
611
610
|
--skills-only Deploy only skills (skip agents)
|
|
612
611
|
--rules-only Deploy only rules (skip agents)
|
|
613
|
-
--kernel-only Deploy kernel skills
|
|
612
|
+
--kernel-only Deploy kernel skills and rules; prune managed bulk agents/commands
|
|
614
613
|
--dry-run Show what would be deployed without writing
|
|
615
614
|
--force Overwrite existing files
|
|
616
615
|
--provider <name> Target provider (see below)
|
|
@@ -630,6 +629,7 @@ Options:
|
|
|
630
629
|
(.muse/hooks.json; installed by default)
|
|
631
630
|
--as-agents-md Aggregate to single AGENTS.md (Codex)
|
|
632
631
|
--create-agents-md Create/update AGENTS.md template
|
|
632
|
+
--no-context-files Preserve WORKSPACE.md, AIWG.md and AGENTS.md (including managed blocks)
|
|
633
633
|
--skip-commands-migration Skip deleting the commands directory before skills deployment
|
|
634
634
|
--listing-budget Honor the provider startup-listing cap even with --copy-all
|
|
635
635
|
--deploy-source <name> Managed-marker source stamped into deployed artifacts.
|
|
@@ -743,7 +743,7 @@ function resolveProvider(name) {
|
|
|
743
743
|
console.error('');
|
|
744
744
|
for (const line of UNSUPPORTED_PROVIDER_HINTS[candidate]) console.error(line);
|
|
745
745
|
}
|
|
746
|
-
|
|
746
|
+
throw new Error(`Unknown provider: ${name}`);
|
|
747
747
|
}
|
|
748
748
|
return resolved;
|
|
749
749
|
}
|
|
@@ -753,14 +753,17 @@ function resolveProvider(name) {
|
|
|
753
753
|
*/
|
|
754
754
|
async function loadProvider(providerName) {
|
|
755
755
|
const resolved = resolveProvider(providerName);
|
|
756
|
-
|
|
756
|
+
// Resolve against this module, not the caller's cwd: in-process callers
|
|
757
|
+
// (including module runners such as Vitest) cannot resolve a bare relative
|
|
758
|
+
// specifier held in a variable.
|
|
759
|
+
const providerUrl = new URL(`./providers/${resolved}.mjs`, import.meta.url).href;
|
|
757
760
|
|
|
758
761
|
try {
|
|
759
|
-
const provider = await import(
|
|
762
|
+
const provider = await import(providerUrl);
|
|
760
763
|
return provider.default || provider;
|
|
761
764
|
} catch (err) {
|
|
762
765
|
console.error(`Failed to load provider '${resolved}':`, err.message);
|
|
763
|
-
|
|
766
|
+
throw err;
|
|
764
767
|
}
|
|
765
768
|
}
|
|
766
769
|
|
|
@@ -896,7 +899,7 @@ function deepMerge(target, source) {
|
|
|
896
899
|
* @param {string} targetDir - Resolved target directory
|
|
897
900
|
* @returns {Promise<boolean>} true = proceed with migration, false = skip
|
|
898
901
|
*/
|
|
899
|
-
async function promptCommandsMigration(cfg, provider, targetDir) {
|
|
902
|
+
async function promptCommandsMigration(cfg, provider, targetDir, interactive = process.stdout.isTTY) {
|
|
900
903
|
// Home-directory providers share commands across projects — do not delete.
|
|
901
904
|
if (provider.capabilities?.homeDirectoryDeploy) return false;
|
|
902
905
|
// Some providers intentionally expose both surfaces with different runtime
|
|
@@ -914,7 +917,7 @@ async function promptCommandsMigration(cfg, provider, targetDir) {
|
|
|
914
917
|
if (entries.length === 0) return false;
|
|
915
918
|
|
|
916
919
|
// Non-interactive context: migrate silently.
|
|
917
|
-
if (cfg.quiet || !
|
|
920
|
+
if (cfg.quiet || !interactive) return true;
|
|
918
921
|
|
|
919
922
|
const rel = path.relative(process.cwd(), commandsDir);
|
|
920
923
|
console.log(`\n⚠ Commands → Skills Migration`);
|
|
@@ -948,6 +951,8 @@ async function promptCommandsMigration(cfg, provider, targetDir) {
|
|
|
948
951
|
|
|
949
952
|
export async function main(args = process.argv.slice(2), internal = {}) {
|
|
950
953
|
const cfg = parseArgs(args);
|
|
954
|
+
if (cfg.help) { printHelp(); return 0; }
|
|
955
|
+
const modelCatalog = loadRuntimeModelCatalog(staticModelCatalog);
|
|
951
956
|
|
|
952
957
|
// Resolve source directory (default to repo root relative to this script)
|
|
953
958
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -956,8 +961,7 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
956
961
|
|
|
957
962
|
// Validate source directory
|
|
958
963
|
if (!fs.existsSync(srcRoot)) {
|
|
959
|
-
|
|
960
|
-
process.exit(1);
|
|
964
|
+
throw new Error(`Source directory not found: ${srcRoot}`);
|
|
961
965
|
}
|
|
962
966
|
|
|
963
967
|
// Validate target directory
|
|
@@ -1020,6 +1024,10 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
1020
1024
|
|
|
1021
1025
|
// Load provider module
|
|
1022
1026
|
const provider = await loadProvider(cfg.provider);
|
|
1027
|
+
if (cfg.additionalSources.length && provider.name !== 'omp') throw new Error('--additional-source requires the OMP provider');
|
|
1028
|
+
for (const source of cfg.additionalSources) {
|
|
1029
|
+
if (!fs.statSync(source).isDirectory()) throw new Error(`Additional source is not a directory: ${source}`);
|
|
1030
|
+
}
|
|
1023
1031
|
if (!cfg.quiet) console.log(`\nLoaded provider: ${provider.name}`);
|
|
1024
1032
|
|
|
1025
1033
|
// Build options for provider
|
|
@@ -1038,11 +1046,15 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
1038
1046
|
codingModel: cfg.codingModel,
|
|
1039
1047
|
efficiencyModel: cfg.efficiencyModel,
|
|
1040
1048
|
modelsConfig,
|
|
1049
|
+
modelCatalog,
|
|
1050
|
+
// Warnings belong to this pass, just as they do in an isolated CLI run.
|
|
1051
|
+
warnedCommandsDirs: new Set(),
|
|
1041
1052
|
asAgentsMd: cfg.asAgentsMd,
|
|
1042
|
-
createAgentsMd: cfg.createAgentsMd,
|
|
1053
|
+
createAgentsMd: cfg.contextFiles && cfg.createAgentsMd,
|
|
1054
|
+
contextFiles: cfg.contextFiles,
|
|
1043
1055
|
deployCommands: cfg.kernelOnly ? false : cfg.deployCommands,
|
|
1044
1056
|
deploySkills: cfg.kernelOnly ? true : cfg.deploySkills,
|
|
1045
|
-
deployRules: cfg.
|
|
1057
|
+
deployRules: !cfg.deferRuleProjection && (cfg.kernelOnly || cfg.deployRules),
|
|
1046
1058
|
deployBehaviors: cfg.kernelOnly ? false : cfg.deployBehaviors,
|
|
1047
1059
|
commandsOnly: cfg.commandsOnly,
|
|
1048
1060
|
skillsOnly: cfg.skillsOnly || cfg.kernelOnly,
|
|
@@ -1051,6 +1063,8 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
1051
1063
|
reportOnly: cfg.reportOnly,
|
|
1052
1064
|
allowOverBudget: cfg.allowOverBudget === true,
|
|
1053
1065
|
kernelOnly: cfg.kernelOnly,
|
|
1066
|
+
deferRuleProjection: cfg.deferRuleProjection,
|
|
1067
|
+
additionalSources: cfg.additionalSources,
|
|
1054
1068
|
filter: cfg.filter,
|
|
1055
1069
|
filterRole: cfg.filterRole,
|
|
1056
1070
|
save: cfg.save,
|
|
@@ -1070,17 +1084,23 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
1070
1084
|
mcp: cfg.mcp === true,
|
|
1071
1085
|
hooks: cfg.hooks !== false,
|
|
1072
1086
|
listingBudget: cfg.listingBudget === true,
|
|
1073
|
-
deployVersion:
|
|
1087
|
+
deployVersion: resolveDeployVersion(resolveAiwgRoot(srcRoot) || srcRoot, cfg.deployVersion),
|
|
1074
1088
|
deploySource: cfg.deploySource || 'bundled',
|
|
1075
1089
|
};
|
|
1076
|
-
|
|
1077
|
-
|
|
1090
|
+
if (provider.name === 'hermes' && cfg.projectScope && !cfg.userScope) {
|
|
1091
|
+
throw new Error('Hermes does not support --scope project: skills are discovered only under HERMES_HOME/skills (default ~/.hermes/skills). Use --scope user or an isolated HERMES_HOME profile shared with Hermes.');
|
|
1092
|
+
}
|
|
1093
|
+
// Deferred kernel source passes must not load the projection dependency
|
|
1094
|
+
// graph. Preparation still owns their staged deployment when a hook is active.
|
|
1095
|
+
const preparationActive = cfg.kernelOnly && cfg.deferRuleProjection
|
|
1096
|
+
? Boolean(globalThis[Symbol.for('aiwg.provider-preparation-hook.v1')])
|
|
1097
|
+
: (await import('./providers/rule-delivery.mjs')).isRuleDeploymentPreparationActive();
|
|
1078
1098
|
|
|
1079
1099
|
// Commands → Skills migration: prompt then delete the commands directory
|
|
1080
1100
|
// so stale command files don't create duplicates in the provider TUI.
|
|
1081
1101
|
if (!preparationActive && !internal.finalizeOnly) {
|
|
1082
1102
|
if (!cfg.dryRun && !cfg.skipCommandsMigration) {
|
|
1083
|
-
const doMigrate = await promptCommandsMigration(cfg, provider, cfg.target);
|
|
1103
|
+
const doMigrate = await promptCommandsMigration(cfg, provider, cfg.target, internal.capture ? false : process.stdout.isTTY);
|
|
1084
1104
|
if (doMigrate) {
|
|
1085
1105
|
const commandsRelPath = provider.paths?.commands;
|
|
1086
1106
|
if (commandsRelPath) {
|
|
@@ -1106,7 +1126,13 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
1106
1126
|
|
|
1107
1127
|
// Delegate to provider
|
|
1108
1128
|
try {
|
|
1109
|
-
if (!internal.finalizeOnly)
|
|
1129
|
+
if (!internal.finalizeOnly) {
|
|
1130
|
+
if (cfg.kernelOnly && (!cfg.deferRuleProjection || preparationActive)
|
|
1131
|
+
&& !['claude', 'codex', 'cursor', 'hermes', 'warp', 'openclaw', 'pi', 'copilot', 'factory', 'opencode', 'windsurf', 'antigravity', 'muse', 'omp', 'grok-build'].includes(provider.name)) {
|
|
1132
|
+
const { deployWithRuleDelivery } = await import('./providers/rule-delivery.mjs');
|
|
1133
|
+
await deployWithRuleDelivery(opts, provider, staged => provider.deploy(staged));
|
|
1134
|
+
} else await provider.deploy(opts);
|
|
1135
|
+
}
|
|
1110
1136
|
if (preparationActive) return;
|
|
1111
1137
|
|
|
1112
1138
|
const mirroredCommandCount = mirrorSkillsAsCommands(provider, cfg.target, srcRoot, opts);
|
|
@@ -1138,11 +1164,13 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
1138
1164
|
if (cfg.dryRun) {
|
|
1139
1165
|
console.error('(dry-run mode - no files were modified)');
|
|
1140
1166
|
}
|
|
1141
|
-
|
|
1167
|
+
return 1;
|
|
1142
1168
|
}
|
|
1169
|
+
return 0;
|
|
1143
1170
|
}
|
|
1144
1171
|
|
|
1145
1172
|
const invokedPath = process.argv[1] ? path.resolve(process.argv[1]) : null;
|
|
1146
1173
|
if (invokedPath === fileURLToPath(import.meta.url)) {
|
|
1147
|
-
await main();
|
|
1174
|
+
try { process.exitCode = (await main()) ?? 0; }
|
|
1175
|
+
catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
1148
1176
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import {
|
|
5
|
+
withRuleDeployment,
|
|
5
6
|
collectFrameworkArtifacts,
|
|
6
7
|
createAgentsMdFromTemplate,
|
|
7
8
|
deployFiles,
|
|
@@ -96,7 +97,7 @@ export async function postDeploy(target, opts) {
|
|
|
96
97
|
throw new Error('Antigravity global skill deployment is disabled: official 1.1.26 path documentation conflicts');
|
|
97
98
|
}
|
|
98
99
|
if (opts.createAgentsMd || (!opts.commandsOnly && !opts.skillsOnly && !opts.rulesOnly)) {
|
|
99
|
-
createAgentsMd(target, opts.srcRoot, opts.dryRun);
|
|
100
|
+
if (opts.contextFiles !== false) createAgentsMd(target, opts.srcRoot, opts.dryRun);
|
|
100
101
|
}
|
|
101
102
|
if (!opts.quiet) {
|
|
102
103
|
console.log('Antigravity resources are project scoped. Restart agy after resource changes; authenticate with the provider separately.');
|
|
@@ -106,6 +107,10 @@ export async function postDeploy(target, opts) {
|
|
|
106
107
|
export function getFileExtension() { return '.md'; }
|
|
107
108
|
|
|
108
109
|
export async function deploy(opts) {
|
|
110
|
+
return withRuleDeployment(opts, { name, paths, kernelSkillsPath }, deploySelected);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function deploySelected(opts) {
|
|
109
114
|
if (opts.global || opts.user || opts.scope === 'user') {
|
|
110
115
|
throw new Error('Antigravity global skill deployment is disabled: official 1.1.26 path documentation conflicts');
|
|
111
116
|
}
|
|
@@ -17,10 +17,13 @@ import { createHash } from 'crypto';
|
|
|
17
17
|
import { createRequire } from 'module';
|
|
18
18
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
19
19
|
|
|
20
|
+
import { writeContextFileSync } from './context-write.mjs';
|
|
21
|
+
|
|
20
22
|
const { parseRuleFrontmatter, inferRuleActivation } = await importImpl(import.meta.url, 'rules/activation.mjs');
|
|
21
23
|
const { resolveRulesInlineBudget, DEFAULT_RULES_INLINE_BUDGET_TOKENS } = await importImpl(import.meta.url, 'rules/inline-budget.mjs');
|
|
22
24
|
export { DEFAULT_RULES_INLINE_BUDGET_TOKENS, parseRuleFrontmatter as parseRuleActivation };
|
|
23
25
|
const { boundedExecFileSync } = await importImpl(import.meta.url, 'process/bounded-child-process.mjs');
|
|
26
|
+
const { helperEnvironment } = await importImpl(import.meta.url, 'process/cli-command.mjs');
|
|
24
27
|
const { extractFrameworkSlug, sameSkillOwner, canDeploySkill, pruneRecordedSkillFiles, releaseSkillOwnership } =
|
|
25
28
|
await importImpl(import.meta.url, 'providers/skill-ownership.mjs');
|
|
26
29
|
export { extractFrameworkSlug, sameSkillOwner, pruneRecordedSkillFiles, releaseSkillOwnership };
|
|
@@ -104,7 +107,7 @@ export function listMdFiles(dir, excludePatterns = []) {
|
|
|
104
107
|
const excluded = [...defaultExcluded, ...excludePatterns];
|
|
105
108
|
return fs
|
|
106
109
|
.readdirSync(dir, { withFileTypes: true })
|
|
107
|
-
.filter((e) => e.isFile() && e.name.toLowerCase().endsWith('.md') && !e.name.toLowerCase().endsWith('.soul.md') && !excluded.includes(e.name))
|
|
110
|
+
.filter((e) => e.isFile() && e.name.toLowerCase().endsWith('.md') && !e.name.toLowerCase().endsWith('.soul.md') && !e.name.toLowerCase().endsWith('.core.md') && !excluded.includes(e.name))
|
|
108
111
|
.map((e) => path.join(dir, e.name));
|
|
109
112
|
}
|
|
110
113
|
|
|
@@ -1840,6 +1843,7 @@ export function buildRemotesTopologyBlock(targetDir) {
|
|
|
1840
1843
|
function getUrl(remote) {
|
|
1841
1844
|
try {
|
|
1842
1845
|
return boundedExecFileSync('git', ['-C', targetDir, 'remote', 'get-url', '--', remote], 'quick', {
|
|
1846
|
+
env: helperEnvironment(),
|
|
1843
1847
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
1844
1848
|
encoding: 'utf8',
|
|
1845
1849
|
}).trim();
|
|
@@ -1949,7 +1953,7 @@ export function createManagedMdFromTemplate(target, destFilename, srcRoot, templ
|
|
|
1949
1953
|
if (dryRun) {
|
|
1950
1954
|
console.log(`[dry-run] Would ${verb} ${destFilename} AIWG-managed section`);
|
|
1951
1955
|
} else {
|
|
1952
|
-
|
|
1956
|
+
writeContextFileSync(destPath, content, 'utf8');
|
|
1953
1957
|
console.log(`${verb[0].toUpperCase()}${verb.slice(1)} ${destFilename} AIWG-managed section`);
|
|
1954
1958
|
}
|
|
1955
1959
|
};
|
|
@@ -2474,7 +2478,7 @@ export function applyInlineRuleBudget(ruleFiles) {
|
|
|
2474
2478
|
/**
|
|
2475
2479
|
* Tier gate (#1673, enforcement-tiered deployment ADR). Only CRITICAL and HIGH
|
|
2476
2480
|
* rules are inlined into a provider's always-on rule directory; MEDIUM/LOW are
|
|
2477
|
-
* left on-demand (reachable via `aiwg show rule <name
|
|
2481
|
+
* left on-demand (reachable via `aiwg show rule <name> --body` and the assembled
|
|
2478
2482
|
* RULES-INDEX pointer index). Index files and rules with no enforcement marker
|
|
2479
2483
|
* default to always-on, so an un-triaged or structural file is never dropped.
|
|
2480
2484
|
*/
|
|
@@ -2558,17 +2562,17 @@ export function renderOnDemandRuleSection(onDemandFiles, opts = {}) {
|
|
|
2558
2562
|
'on demand:',
|
|
2559
2563
|
'',
|
|
2560
2564
|
'```bash',
|
|
2561
|
-
'aiwg show rule <name>',
|
|
2565
|
+
'aiwg show rule <name> --body',
|
|
2562
2566
|
'```',
|
|
2563
2567
|
'',
|
|
2564
|
-
...names.map((n) => `- \`${n}\` — \`aiwg show rule ${n}\``),
|
|
2568
|
+
...names.map((n) => `- \`${n}\` — \`aiwg show rule ${n} --body\``),
|
|
2565
2569
|
].join('\n');
|
|
2566
2570
|
}
|
|
2567
2571
|
|
|
2568
2572
|
/**
|
|
2569
2573
|
* Write a compact on-demand rule index (#1673) into a provider's rule dir.
|
|
2570
2574
|
* Lists the MEDIUM/LOW rules that are NOT inlined at startup, with the
|
|
2571
|
-
* `aiwg show rule <name
|
|
2575
|
+
* `aiwg show rule <name> --body` fetch hint. Removes a stale index when empty.
|
|
2572
2576
|
*/
|
|
2573
2577
|
export function writeOnDemandRuleIndex(destDir, onDemandFiles, opts = {}) {
|
|
2574
2578
|
const indexPath = path.join(destDir, 'RULES-ONDEMAND.md');
|
|
@@ -2588,10 +2592,10 @@ export function writeOnDemandRuleIndex(destDir, onDemandFiles, opts = {}) {
|
|
|
2588
2592
|
'fetch any rule body on demand:',
|
|
2589
2593
|
'',
|
|
2590
2594
|
'```bash',
|
|
2591
|
-
'aiwg show rule <name>',
|
|
2595
|
+
'aiwg show rule <name> --body',
|
|
2592
2596
|
'```',
|
|
2593
2597
|
'',
|
|
2594
|
-
...names.map((n) => `- \`${n}\` — \`aiwg show rule ${n}\``),
|
|
2598
|
+
...names.map((n) => `- \`${n}\` — \`aiwg show rule ${n} --body\``),
|
|
2595
2599
|
'',
|
|
2596
2600
|
];
|
|
2597
2601
|
if (demotedNames.length > 0) {
|
|
@@ -2605,7 +2609,7 @@ export function writeOnDemandRuleIndex(destDir, onDemandFiles, opts = {}) {
|
|
|
2605
2609
|
'(AIWG_RULES_INLINE_BUDGET_TOKENS) and break subagent dispatch with "Prompt is too long".',
|
|
2606
2610
|
'Fetch any of them before work they govern:',
|
|
2607
2611
|
'',
|
|
2608
|
-
...demotedNames.map((n) => `- \`${n}\` — \`aiwg show rule ${n}\``),
|
|
2612
|
+
...demotedNames.map((n) => `- \`${n}\` — \`aiwg show rule ${n} --body\``),
|
|
2609
2613
|
'',
|
|
2610
2614
|
);
|
|
2611
2615
|
}
|
|
@@ -2803,7 +2807,9 @@ export function getAddonFiles(srcRoot, options = {}) {
|
|
|
2803
2807
|
// ============================================================================
|
|
2804
2808
|
|
|
2805
2809
|
/**
|
|
2806
|
-
* Load rules manifest from source directory
|
|
2810
|
+
* Load rules manifest from source directory.
|
|
2811
|
+
* Inventory metadata only: delivery is decided by rule `activation` (rule-delivery.mjs);
|
|
2812
|
+
* the former manifest `tiers` deploy policy was never consulted and was removed (#3450).
|
|
2807
2813
|
* @param {string} srcRoot - Source root directory
|
|
2808
2814
|
* @returns {object|null} - Parsed manifest or null if not found
|
|
2809
2815
|
*/
|
|
@@ -3168,8 +3174,9 @@ export function migrateCommandsDirectory(commandsDir, opts = {}) {
|
|
|
3168
3174
|
const rel = path.relative(process.cwd(), commandsDir);
|
|
3169
3175
|
// The condition is a property of the directory, not of each deployed unit;
|
|
3170
3176
|
// emit it once per run no matter how many units pass through.
|
|
3171
|
-
|
|
3172
|
-
|
|
3177
|
+
const warned = opts.warnedCommandsDirs || warnedCommandsDirs;
|
|
3178
|
+
if (warned.has(commandsDir)) return false;
|
|
3179
|
+
warned.add(commandsDir);
|
|
3173
3180
|
|
|
3174
3181
|
const stale = listManagedCommandFiles(commandsDir);
|
|
3175
3182
|
if (stale.length === 0) return false;
|
|
@@ -3338,7 +3345,7 @@ export function replaceBoundRulesBlock(content, rules = []) {
|
|
|
3338
3345
|
const unique = [...new Map(rules.map(rule => [rule.name, rule])).values()]
|
|
3339
3346
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
3340
3347
|
return `${clean}${clean.endsWith('\n') ? '' : '\n'}\n<!-- AIWG:bound-rules:start -->\n## Bound rules\n\nRequired reading on every invocation: fetch and follow every bound rule below before starting governed work. A summary or discovery pointer does not discharge this obligation.\n\n${unique.map(rule =>
|
|
3341
|
-
`- ${rule.name} — ${rule.summary}\n Fetch and follow before governed work: \`aiwg show rule ${rule.name}\`.`
|
|
3348
|
+
`- ${rule.name} — ${rule.summary}\n Fetch and follow before governed work: \`aiwg show rule ${rule.name} --body\`.`
|
|
3342
3349
|
).join('\n')}\n<!-- AIWG:bound-rules:end -->\n`;
|
|
3343
3350
|
}
|
|
3344
3351
|
|
|
@@ -3347,8 +3354,11 @@ export function injectBoundRules(content, source, opts = {}) {
|
|
|
3347
3354
|
return replaceBoundRulesBlock(content, opts.ruleDelivery.bindings.get(path.resolve(source)) || []);
|
|
3348
3355
|
}
|
|
3349
3356
|
|
|
3350
|
-
/**
|
|
3357
|
+
/** Rule delivery stages output and guards startup before promotion. Deferred
|
|
3358
|
+
* kernel passes leave rule delivery to the final source in the invocation. */
|
|
3351
3359
|
export async function withRuleDeployment(opts, provider, deploy) {
|
|
3360
|
+
if (opts.kernelOnly && opts.deferRuleProjection && provider.name !== 'warp'
|
|
3361
|
+
&& !globalThis[Symbol.for('aiwg.provider-preparation-hook.v1')]) return deploy(opts);
|
|
3352
3362
|
const { deployWithRuleDelivery } = await import('./rule-delivery.mjs');
|
|
3353
3363
|
return deployWithRuleDelivery(opts, provider, deploy);
|
|
3354
3364
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { importImpl } from '../../_resolve-impl.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* Claude Code Provider
|
|
3
4
|
*
|
|
@@ -61,6 +62,8 @@ import {
|
|
|
61
62
|
interpolateContextTokens
|
|
62
63
|
} from './base.mjs';
|
|
63
64
|
|
|
65
|
+
import { writeContextFileSync } from './context-write.mjs';
|
|
66
|
+
|
|
64
67
|
// ============================================================================
|
|
65
68
|
// Provider Configuration
|
|
66
69
|
// ============================================================================
|
|
@@ -416,7 +419,7 @@ export async function postDeploy(targetDir, opts) {
|
|
|
416
419
|
}
|
|
417
420
|
|
|
418
421
|
// Hook file architecture: write AIWG.md and wire @AIWG.md into CLAUDE.md
|
|
419
|
-
if (opts.srcRoot) {
|
|
422
|
+
if (opts.srcRoot && opts.contextFiles !== false) {
|
|
420
423
|
deployHookFile(targetDir, opts);
|
|
421
424
|
}
|
|
422
425
|
}
|
|
@@ -472,7 +475,7 @@ function deployHookFile(targetDir, opts) {
|
|
|
472
475
|
} else {
|
|
473
476
|
let content = fs.readFileSync(templatePath, 'utf8');
|
|
474
477
|
content = interpolateHookTokens(content, effectiveCounts, targetDir);
|
|
475
|
-
|
|
478
|
+
writeContextFileSync(hookDest, content, 'utf8');
|
|
476
479
|
console.log('Created AIWG.md (hook file)');
|
|
477
480
|
}
|
|
478
481
|
|
|
@@ -496,7 +499,7 @@ function deployHookFile(targetDir, opts) {
|
|
|
496
499
|
}
|
|
497
500
|
}
|
|
498
501
|
lines.splice(insertAt, 0, '', directive, '');
|
|
499
|
-
|
|
502
|
+
writeContextFileSync(claudeDest, lines.join('\n'), 'utf8');
|
|
500
503
|
console.log('Added @AIWG.md directive to CLAUDE.md');
|
|
501
504
|
}
|
|
502
505
|
}
|