@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContextWriteJournal } from '../../smiths/context-pipeline/context-file-safety.js';
|
|
1
2
|
import { trackTemporaryDirectory } from '../../utils/temporary-directory.js';
|
|
2
3
|
/**
|
|
3
4
|
* Use Command Handler
|
|
@@ -43,6 +44,7 @@ import { detectScope, mirrorToUserScope, rejectOpenClawProjectScope, USER_SCOPE_
|
|
|
43
44
|
import { maybeWarnProjectIsolation } from '../project-isolation/index.js';
|
|
44
45
|
import { formatWorkspaceSignalPlan, includedBundleIds, resolveWorkspaceSignalPlan, writeWorkspaceSignalPlan, } from '../workspace-signals.js';
|
|
45
46
|
import { getProviderArtifactPathStrings, getProviderDefinition, getProviderKernelSkillPath, normalizeProviderDefinitionId, } from '../../providers/provider-definitions.js';
|
|
47
|
+
import { resolveDeployVersion } from '../../providers/deploy-version.mjs';
|
|
46
48
|
import { deployedSkillRoots } from '../../providers/deployed-skill-roots.js';
|
|
47
49
|
// Module-level guard so the iteration loops further down (which re-enter
|
|
48
50
|
// execute() per framework/provider) don't re-emit the warning each pass.
|
|
@@ -152,10 +154,11 @@ const MODEL_OVERRIDE_VALUE_FLAGS = new Set([
|
|
|
152
154
|
'--model', '--reasoning-model', '--coding-model', '--efficiency-model', '--model-tier',
|
|
153
155
|
]);
|
|
154
156
|
const MODEL_DEPLOY_BOOLEAN_FLAGS = new Set(['--save', '--save-user']);
|
|
155
|
-
/** Forward explicit
|
|
157
|
+
/** Forward explicit scope to every provider deploy subprocess. */
|
|
156
158
|
export function collectUseScopeDeployArgs(args) {
|
|
157
159
|
const scope = detectScope(args);
|
|
158
|
-
return scope === 'user' || args.includes('--user') ? ['--scope', 'user']
|
|
160
|
+
return scope === 'user' || args.includes('--user') ? ['--scope', 'user']
|
|
161
|
+
: args.includes('--scope') ? ['--scope', 'project'] : [];
|
|
159
162
|
}
|
|
160
163
|
export function collectUseModelDeployArgs(args) {
|
|
161
164
|
const forwarded = [];
|
|
@@ -410,7 +413,7 @@ export function addonPath(frameworkRoot, name) {
|
|
|
410
413
|
* this only suppresses redundant deploy-agents subprocesses.
|
|
411
414
|
*/
|
|
412
415
|
export function mainDeploymentIncludesAddons(provider, selectedMode, providerDeployArgs) {
|
|
413
|
-
return (((provider === 'claude' || provider === 'pi')
|
|
416
|
+
return (((provider === 'claude' || provider === 'pi' || provider === 'omp')
|
|
414
417
|
&& ['general', 'sdlc', 'both', 'all'].includes(selectedMode))
|
|
415
418
|
|| (provider === 'codex' && selectedMode === 'all'))
|
|
416
419
|
&& !providerDeployArgs.some(arg => arg === '--source' || arg.startsWith('--source='))
|
|
@@ -628,7 +631,7 @@ async function mirrorStandardCommandSkills(opts) {
|
|
|
628
631
|
projectPath: opts.target,
|
|
629
632
|
dryRun: opts.dryRun,
|
|
630
633
|
verbose: opts.verbose,
|
|
631
|
-
deployVersion: (
|
|
634
|
+
deployVersion: deploymentVersion(opts.frameworkRoot),
|
|
632
635
|
nameFilter: shouldMirrorStandardCommandSkill,
|
|
633
636
|
});
|
|
634
637
|
count += result.translated.length;
|
|
@@ -1326,7 +1329,7 @@ async function deployOneProjectLocalBundle(opts) {
|
|
|
1326
1329
|
}
|
|
1327
1330
|
let exitCode = 0;
|
|
1328
1331
|
if (artifactTotal > 0) {
|
|
1329
|
-
const runner =
|
|
1332
|
+
const runner = createUseScriptRunner(frameworkRoot);
|
|
1330
1333
|
const args = [
|
|
1331
1334
|
'--source', bundle.artifactPath,
|
|
1332
1335
|
'--deploy-commands', '--deploy-skills', '--deploy-rules',
|
|
@@ -1622,6 +1625,106 @@ const USE_FLAGS_WITH_VALUES = new Set([
|
|
|
1622
1625
|
'--scope',
|
|
1623
1626
|
'--target',
|
|
1624
1627
|
]);
|
|
1628
|
+
// Public use options, including supported deployer passthroughs. Value flags
|
|
1629
|
+
// also drive positional parsing, so option values cannot become bundle names.
|
|
1630
|
+
for (const flag of [...MODEL_DEPLOY_VALUE_FLAGS, '--reasoning', '--coding', '--efficiency']) {
|
|
1631
|
+
USE_FLAGS_WITH_VALUES.add(flag);
|
|
1632
|
+
}
|
|
1633
|
+
const USE_BOOLEAN_FLAGS = new Set([
|
|
1634
|
+
'--force', '--copy-all', '--copy-standard-skills', '--dry-run', '--verbose', '-v', '--quiet', '-q',
|
|
1635
|
+
'--json', '--no-project-local', '--no-context-files', '--no-workspace-md',
|
|
1636
|
+
'--no-aiwg-md', '--no-agents-md', '--force-context-files', '--global', '--user',
|
|
1637
|
+
'--no-utils', '--ci-hooks-enabled', '--skip-conflicts', '--no-harness-agents',
|
|
1638
|
+
'--workspace-signals', '--no-workspace-signals', '--yes', '-y', '--non-interactive',
|
|
1639
|
+
'--allow-over-budget', '--no-hooks', '--enable-cross-provider-hooks',
|
|
1640
|
+
'--skip-commands-migration', '--listing-budget', '--mcp', '--as-agents-md',
|
|
1641
|
+
'--create-agents-md', '--commands-only', '--skills-only', '--rules-only',
|
|
1642
|
+
'--save', '--save-user', '--help', '-h',
|
|
1643
|
+
]);
|
|
1644
|
+
export function validateUseOptions(args, preparedCapabilities = new Set()) {
|
|
1645
|
+
for (let i = 0; i < args.length; i++) {
|
|
1646
|
+
const arg = args[i];
|
|
1647
|
+
if (arg === '--aiwg-provider-main-prepared' && preparedCapabilities.has(args[i + 1])) {
|
|
1648
|
+
i++;
|
|
1649
|
+
continue;
|
|
1650
|
+
}
|
|
1651
|
+
if (USE_FLAGS_WITH_VALUES.has(arg)) {
|
|
1652
|
+
if (!args[i + 1] || args[i + 1].startsWith('-'))
|
|
1653
|
+
return `Missing value for option '${arg}'. See aiwg use --help.`;
|
|
1654
|
+
i++;
|
|
1655
|
+
}
|
|
1656
|
+
else if (arg.startsWith('-') && !USE_BOOLEAN_FLAGS.has(arg)) {
|
|
1657
|
+
return `Unknown option '${arg}'. See aiwg use --help.`;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
return undefined;
|
|
1661
|
+
}
|
|
1662
|
+
/** Pi's agent discovery path doubles as its kernel skill directory. */
|
|
1663
|
+
export async function countPiAgentFiles(target, agentsPath) {
|
|
1664
|
+
if (!agentsPath)
|
|
1665
|
+
return 0;
|
|
1666
|
+
try {
|
|
1667
|
+
const dir = path.isAbsolute(agentsPath) ? agentsPath : path.join(target, agentsPath);
|
|
1668
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
1669
|
+
return entries.filter(entry => entry.isFile() && entry.name.endsWith('.md')).length;
|
|
1670
|
+
}
|
|
1671
|
+
catch {
|
|
1672
|
+
return 0;
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
// Capture provider previews here: their staging summaries count source entries,
|
|
1676
|
+
// and additive passes can describe the same destination more than once.
|
|
1677
|
+
let usePreviewActions;
|
|
1678
|
+
// Recursive framework/addon/provider passes share the boundary's resolved policy.
|
|
1679
|
+
async function generateDeploymentContextFiles(options) {
|
|
1680
|
+
const result = await generateContextFiles(options);
|
|
1681
|
+
useDeployment?.contextFiles.push(result);
|
|
1682
|
+
return result;
|
|
1683
|
+
}
|
|
1684
|
+
let useDeployment;
|
|
1685
|
+
function useDeploymentArgs(args) {
|
|
1686
|
+
const forwarded = [...args];
|
|
1687
|
+
if (useDeployment && !forwarded.includes('--deploy-version'))
|
|
1688
|
+
forwarded.push('--deploy-version', useDeployment.version);
|
|
1689
|
+
if (useDeployment?.skipContextFiles && !forwarded.includes('--no-context-files'))
|
|
1690
|
+
forwarded.push('--no-context-files');
|
|
1691
|
+
return forwarded;
|
|
1692
|
+
}
|
|
1693
|
+
function deploymentVersion(root) {
|
|
1694
|
+
return useDeployment?.version ?? resolveDeployVersion(root);
|
|
1695
|
+
}
|
|
1696
|
+
function createUseScriptRunner(frameworkRoot) {
|
|
1697
|
+
const runner = createScriptRunner(frameworkRoot);
|
|
1698
|
+
return {
|
|
1699
|
+
async run(script, args, options = {}) {
|
|
1700
|
+
if (script === 'tools/agents/deploy-agents.mjs')
|
|
1701
|
+
args = useDeploymentArgs(args);
|
|
1702
|
+
if (!usePreviewActions)
|
|
1703
|
+
return runner.run(script, args, options);
|
|
1704
|
+
const scratch = await fs.mkdtemp(path.join(os.tmpdir(), 'aiwg-use-preview-'));
|
|
1705
|
+
const removeScratch = trackTemporaryDirectory(scratch);
|
|
1706
|
+
const stdoutFile = await fs.open(path.join(scratch, 'stdout'), 'w+');
|
|
1707
|
+
try {
|
|
1708
|
+
// Keep the shared runner's timeout/error handling and injectable
|
|
1709
|
+
// execution boundary; capture only this invocation's stdout to disk.
|
|
1710
|
+
const result = await runner.run(script, args, { ...options, capture: true, stdoutFd: stdoutFile.fd });
|
|
1711
|
+
const stdout = await fs.readFile(path.join(scratch, 'stdout'), 'utf8');
|
|
1712
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
1713
|
+
if (/^\[dry-run\] Would (write|remove|deploy|copy|create) /i.test(line))
|
|
1714
|
+
usePreviewActions.add(line);
|
|
1715
|
+
}
|
|
1716
|
+
return result;
|
|
1717
|
+
}
|
|
1718
|
+
catch (error) {
|
|
1719
|
+
return { exitCode: 1, message: error instanceof Error ? error.message : String(error) };
|
|
1720
|
+
}
|
|
1721
|
+
finally {
|
|
1722
|
+
await stdoutFile.close();
|
|
1723
|
+
removeScratch();
|
|
1724
|
+
}
|
|
1725
|
+
},
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1625
1728
|
export const OPENHUMAN_DEFAULT_HARNESS_AGENTS = [
|
|
1626
1729
|
'architecture-designer',
|
|
1627
1730
|
'code-reviewer',
|
|
@@ -2013,13 +2116,15 @@ async function generateGlobalProjectContext(opts) {
|
|
|
2013
2116
|
if (!userPaths)
|
|
2014
2117
|
return;
|
|
2015
2118
|
const skipContext = opts.args.includes('--no-context-files');
|
|
2119
|
+
if (skipContext)
|
|
2120
|
+
return;
|
|
2016
2121
|
const sections = await discoverDeployedArtifacts(opts.projectPath, {
|
|
2017
2122
|
agents: userPaths.agents,
|
|
2018
2123
|
rules: userPaths.rules,
|
|
2019
2124
|
skills: userPaths.skills,
|
|
2020
2125
|
behaviors: userPaths.behaviors,
|
|
2021
2126
|
});
|
|
2022
|
-
await
|
|
2127
|
+
await generateDeploymentContextFiles({
|
|
2023
2128
|
provider: opts.provider,
|
|
2024
2129
|
projectPath: opts.projectPath,
|
|
2025
2130
|
sections,
|
|
@@ -2082,7 +2187,7 @@ async function ensurePostDeployPhases(opts) {
|
|
|
2082
2187
|
behaviors: paths.behaviors,
|
|
2083
2188
|
});
|
|
2084
2189
|
try {
|
|
2085
|
-
await
|
|
2190
|
+
await generateDeploymentContextFiles({
|
|
2086
2191
|
provider: opts.provider,
|
|
2087
2192
|
projectPath: opts.projectPath,
|
|
2088
2193
|
sections,
|
|
@@ -2095,8 +2200,8 @@ async function ensurePostDeployPhases(opts) {
|
|
|
2095
2200
|
},
|
|
2096
2201
|
});
|
|
2097
2202
|
}
|
|
2098
|
-
catch {
|
|
2099
|
-
|
|
2203
|
+
catch (error) {
|
|
2204
|
+
throw new Error(`Context generation failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
2100
2205
|
}
|
|
2101
2206
|
}
|
|
2102
2207
|
async function deploySourceDirectory(opts) {
|
|
@@ -2120,9 +2225,11 @@ async function deploySourceDirectory(opts) {
|
|
|
2120
2225
|
args.push('--copy-all');
|
|
2121
2226
|
if (opts.kernelOnly)
|
|
2122
2227
|
args.push('--kernel-only');
|
|
2228
|
+
if (opts.deferRuleProjection)
|
|
2229
|
+
args.push('--defer-rule-projection');
|
|
2123
2230
|
if (opts.quiet)
|
|
2124
2231
|
args.unshift('--quiet');
|
|
2125
|
-
const runner =
|
|
2232
|
+
const runner = createUseScriptRunner(opts.frameworkRoot);
|
|
2126
2233
|
const result = await runner.run('tools/agents/deploy-agents.mjs', args, opts.quiet ? { capture: true } : {});
|
|
2127
2234
|
if (result.exitCode === 0 && !opts.kernelOnly) {
|
|
2128
2235
|
try {
|
|
@@ -2207,7 +2314,7 @@ async function deployOmpUserSource(opts) {
|
|
|
2207
2314
|
const adapter = await import(pathToFileURL(path.join(opts.frameworkRoot, 'tools/agents/providers/omp.mjs')).href);
|
|
2208
2315
|
await adapter.deploy({ srcRoot: opts.source, target: opts.target, provider: 'omp', scope: 'user',
|
|
2209
2316
|
mode: opts.mode ?? 'general', deployCommands: true, deploySkills: true, deployRules: true,
|
|
2210
|
-
copyStandardSkills: opts.copyAll, quiet: true, deployVersion: (
|
|
2317
|
+
copyStandardSkills: opts.copyAll, quiet: true, contextFiles: !useDeployment?.skipContextFiles, deployVersion: deploymentVersion(opts.frameworkRoot) });
|
|
2211
2318
|
const sourceBundles = new Set([opts.source]);
|
|
2212
2319
|
const { resourceDirs } = resolveOmpPaths({ cwd: opts.target });
|
|
2213
2320
|
const entries = {
|
|
@@ -2359,7 +2466,7 @@ const USE_HELP = `Usage: aiwg use <bundle> [options]
|
|
|
2359
2466
|
Deploy an AIWG framework, addon, or extension into the current project.
|
|
2360
2467
|
|
|
2361
2468
|
Bundles:
|
|
2362
|
-
all Kernel surface only (kernel skills, rules, behaviors)
|
|
2469
|
+
all Kernel surface only (kernel skills, kernel and core rules, behaviors)
|
|
2363
2470
|
sdlc | research | ops | forensics | marketing | media-curator | ...
|
|
2364
2471
|
Full framework surface (agents, commands, skills, rules)
|
|
2365
2472
|
<addon> | <extension> Any installed addon or extension name
|
|
@@ -2371,15 +2478,56 @@ Options:
|
|
|
2371
2478
|
--force Re-write every artifact, replacing files AIWG does
|
|
2372
2479
|
not currently manage. Use this to reclaim a
|
|
2373
2480
|
directory left behind by an older AIWG install.
|
|
2374
|
-
--copy-all Mirror standard-tier skills into the project
|
|
2375
|
-
|
|
2481
|
+
--copy-all Mirror standard-tier skills into the project; for
|
|
2482
|
+
all, restore the full agent, command and rule surface
|
|
2376
2483
|
--dry-run Preview the deployment without writing files
|
|
2484
|
+
--quiet, -q Suppress deployer progress output
|
|
2377
2485
|
--verbose, -v Show per-artifact deploy decisions
|
|
2378
2486
|
--json Emit the machine-readable deployment result
|
|
2379
2487
|
--no-project-local Skip project-local bundles under .aiwg/
|
|
2380
|
-
--no-context-files
|
|
2488
|
+
--no-context-files Preserve WORKSPACE.md / AIWG.md / AGENTS.md, including managed blocks
|
|
2381
2489
|
-h, --help Show this help without deploying
|
|
2382
2490
|
|
|
2491
|
+
Additional options:
|
|
2492
|
+
--platform <name> Alias for --provider
|
|
2493
|
+
--providers <a,b> Providers for global bootstrap
|
|
2494
|
+
--prefix <dir> Alias for --target
|
|
2495
|
+
--global, --user Install to user scope
|
|
2496
|
+
--copy-standard-skills Alias for --copy-all (also restores the full surface)
|
|
2497
|
+
--profile <name> Select workspace profile (implicit target: all)
|
|
2498
|
+
--workspace-signals Show the workspace signal plan
|
|
2499
|
+
--no-workspace-signals Skip workspace signal resolution
|
|
2500
|
+
--model <name>, --model-tier <tier>
|
|
2501
|
+
--reasoning-model <name>, --coding-model <name>, --efficiency-model <name>
|
|
2502
|
+
--reasoning <name>, --coding <name>, --efficiency <name>
|
|
2503
|
+
Override deployer model selection
|
|
2504
|
+
--filter <glob>, --filter-role <role>
|
|
2505
|
+
Filter deployed agents
|
|
2506
|
+
--save, --save-user Persist model selection
|
|
2507
|
+
--no-utils Skip additive addon and extension passes
|
|
2508
|
+
--no-workspace-md, --no-aiwg-md, --no-agents-md
|
|
2509
|
+
Suppress individual context files
|
|
2510
|
+
--force-context-files Replace context files
|
|
2511
|
+
--no-hooks Skip managed hooks
|
|
2512
|
+
--enable-cross-provider-hooks
|
|
2513
|
+
Enable cross-provider hooks
|
|
2514
|
+
--ci-hooks-enabled Deploy CI workflows
|
|
2515
|
+
--skip-conflicts Skip the collision check
|
|
2516
|
+
--allow-over-budget Allow oversized startup context
|
|
2517
|
+
--harness-agents <list>, --no-harness-agents
|
|
2518
|
+
Select OpenHuman harness agents
|
|
2519
|
+
--skip-commands-migration Skip commands migration
|
|
2520
|
+
--listing-budget Honor startup listing caps with --copy-all
|
|
2521
|
+
--mcp Opt in to the Muse MCP profile
|
|
2522
|
+
--as-agents-md, --create-agents-md
|
|
2523
|
+
Select Codex context aggregation
|
|
2524
|
+
--commands-only, --skills-only, --rules-only
|
|
2525
|
+
Limit artifact kinds
|
|
2526
|
+
--yes, -y, --non-interactive
|
|
2527
|
+
Allow unattended setup
|
|
2528
|
+
|
|
2529
|
+
Source installs are detected automatically; no development flag is needed.
|
|
2530
|
+
|
|
2383
2531
|
Deployment counts report what the run wrote or already manages. Files AIWG does
|
|
2384
2532
|
not own are listed separately as unmanaged and are never counted as deployed.
|
|
2385
2533
|
`;
|
|
@@ -2395,6 +2543,59 @@ export class UseHandler {
|
|
|
2395
2543
|
return { exitCode: 0, message: USE_HELP, rawOutput: true };
|
|
2396
2544
|
}
|
|
2397
2545
|
async execute(ctx) {
|
|
2546
|
+
const invalidOption = validateUseOptions(ctx.args, this.preparedProviderContinuations);
|
|
2547
|
+
if (invalidOption)
|
|
2548
|
+
return { exitCode: 2, message: invalidOption };
|
|
2549
|
+
const previousDeployment = useDeployment;
|
|
2550
|
+
useDeployment = {
|
|
2551
|
+
version: previousDeployment?.version ?? resolveDeployVersion(ctx.frameworkRoot || await getFrameworkRoot()),
|
|
2552
|
+
skipContextFiles: previousDeployment?.skipContextFiles || ctx.args.includes('--no-context-files'),
|
|
2553
|
+
contextFiles: previousDeployment?.contextFiles ?? [],
|
|
2554
|
+
};
|
|
2555
|
+
const journal = previousDeployment ? undefined : new ContextWriteJournal();
|
|
2556
|
+
try {
|
|
2557
|
+
let result;
|
|
2558
|
+
try {
|
|
2559
|
+
result = await this.executeDeployment(ctx);
|
|
2560
|
+
}
|
|
2561
|
+
catch (error) {
|
|
2562
|
+
result = { exitCode: 1, message: error instanceof Error ? error.message : String(error) };
|
|
2563
|
+
}
|
|
2564
|
+
if (journal) {
|
|
2565
|
+
const rollback = result.exitCode !== 0 ? journal.rollback() : undefined;
|
|
2566
|
+
if (ctx.args.includes('--json')) {
|
|
2567
|
+
let structured;
|
|
2568
|
+
try {
|
|
2569
|
+
structured = JSON.parse(result.message || '{}');
|
|
2570
|
+
}
|
|
2571
|
+
catch {
|
|
2572
|
+
structured = { exitCode: result.exitCode, message: result.message };
|
|
2573
|
+
}
|
|
2574
|
+
structured.contextFiles = useDeployment.contextFiles;
|
|
2575
|
+
if (rollback)
|
|
2576
|
+
structured.contextRollback = rollback;
|
|
2577
|
+
result = { ...result, message: JSON.stringify(structured, null, 2), rawOutput: true };
|
|
2578
|
+
}
|
|
2579
|
+
else if (rollback?.conflicts.length) {
|
|
2580
|
+
result.message = [result.message, ...rollback.conflicts.map(conflict => `Context rollback conflict: ${conflict.path}: ${conflict.reason}`)].filter(Boolean).join('\n');
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
return result;
|
|
2584
|
+
}
|
|
2585
|
+
finally {
|
|
2586
|
+
journal?.dispose();
|
|
2587
|
+
useDeployment = previousDeployment;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
async executeDeployment(ctx) {
|
|
2591
|
+
// Normalize the physical framework directory just as addon folder aliases
|
|
2592
|
+
// are normalized, before orchestration/registry bookkeeping sees the name.
|
|
2593
|
+
const aliasIndex = ctx.args.indexOf('sdlc-complete');
|
|
2594
|
+
if (firstUsePositional(ctx.args) === 'sdlc-complete' && aliasIndex >= 0) {
|
|
2595
|
+
const args = [...ctx.args];
|
|
2596
|
+
args[aliasIndex] = 'sdlc';
|
|
2597
|
+
ctx = { ...ctx, args };
|
|
2598
|
+
}
|
|
2398
2599
|
const requestedBundle = firstUsePositional(ctx.args)
|
|
2399
2600
|
?? (ctx.args[0] === '--profile' ? 'all' : undefined);
|
|
2400
2601
|
const bypassOrchestration = this.orchestrationDepth > 0
|
|
@@ -2403,9 +2604,9 @@ export class UseHandler {
|
|
|
2403
2604
|
|| ctx.args.includes('--workspace-signals');
|
|
2404
2605
|
if (bypassOrchestration)
|
|
2405
2606
|
return this.executeCore(ctx);
|
|
2406
|
-
//
|
|
2407
|
-
// addon
|
|
2408
|
-
//
|
|
2607
|
+
// Projectors share one source-index snapshot for this invocation. Full
|
|
2608
|
+
// addon passes validate their bindings through the common query engine;
|
|
2609
|
+
// deferred kernel passes leave the shared rule set to the final projector.
|
|
2409
2610
|
const previousBindingCache = process.env.AIWG_RULE_BINDING_INDEX_CACHE;
|
|
2410
2611
|
const bindingCache = previousBindingCache || await fs.mkdtemp(path.join(os.tmpdir(), 'aiwg-use-bindings-'));
|
|
2411
2612
|
const removeBindingCache = previousBindingCache ? () => { } : trackTemporaryDirectory(bindingCache);
|
|
@@ -2457,8 +2658,13 @@ export class UseHandler {
|
|
|
2457
2658
|
warn: console.warn,
|
|
2458
2659
|
error: console.error,
|
|
2459
2660
|
};
|
|
2460
|
-
|
|
2461
|
-
|
|
2661
|
+
const previewActions = dryRun ? new Set() : undefined;
|
|
2662
|
+
const previousPreview = usePreviewActions;
|
|
2663
|
+
if (previewActions)
|
|
2664
|
+
usePreviewActions = previewActions;
|
|
2665
|
+
if (json || dryRun) {
|
|
2666
|
+
if (!dryRun)
|
|
2667
|
+
machineReadableUseDepth += 1;
|
|
2462
2668
|
console.log = () => { };
|
|
2463
2669
|
console.info = () => { };
|
|
2464
2670
|
console.warn = () => { };
|
|
@@ -2468,9 +2674,14 @@ export class UseHandler {
|
|
|
2468
2674
|
try {
|
|
2469
2675
|
coreResult = await this.executeCore({ ...ctx, args: coreArgs });
|
|
2470
2676
|
}
|
|
2677
|
+
catch (error) {
|
|
2678
|
+
coreResult = { exitCode: 1, message: error instanceof Error ? error.message : String(error) };
|
|
2679
|
+
}
|
|
2471
2680
|
finally {
|
|
2472
|
-
|
|
2473
|
-
|
|
2681
|
+
usePreviewActions = previousPreview;
|
|
2682
|
+
if (json || dryRun) {
|
|
2683
|
+
if (!dryRun)
|
|
2684
|
+
machineReadableUseDepth -= 1;
|
|
2474
2685
|
console.log = originalConsole.log;
|
|
2475
2686
|
console.info = originalConsole.info;
|
|
2476
2687
|
console.warn = originalConsole.warn;
|
|
@@ -2491,12 +2702,18 @@ export class UseHandler {
|
|
|
2491
2702
|
else {
|
|
2492
2703
|
if (coreResult.exitCode === 0 && !dryRun && !VALID_FRAMEWORKS.includes(requestedBundle)) {
|
|
2493
2704
|
for (const provider of providers) {
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2705
|
+
try {
|
|
2706
|
+
await ensurePostDeployPhases({
|
|
2707
|
+
frameworkRoot,
|
|
2708
|
+
projectPath: projectDir,
|
|
2709
|
+
provider,
|
|
2710
|
+
args: remainingArgs,
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
catch (error) {
|
|
2714
|
+
coreResult = { exitCode: 1, message: error instanceof Error ? error.message : String(error) };
|
|
2715
|
+
break;
|
|
2716
|
+
}
|
|
2500
2717
|
}
|
|
2501
2718
|
}
|
|
2502
2719
|
const providerResults = [];
|
|
@@ -2528,7 +2745,7 @@ export class UseHandler {
|
|
|
2528
2745
|
originalConsole.warn(`Provider receipt finalization failed for ${provider}: ${error instanceof Error ? error.message : String(error)}`);
|
|
2529
2746
|
}
|
|
2530
2747
|
}
|
|
2531
|
-
|
|
2748
|
+
const verified = await verifyProviderDeployment({
|
|
2532
2749
|
projectRoot: projectDir,
|
|
2533
2750
|
frameworkRoot,
|
|
2534
2751
|
provider,
|
|
@@ -2542,7 +2759,14 @@ export class UseHandler {
|
|
|
2542
2759
|
// yet, so receipt absence belongs in doctor/status rather than
|
|
2543
2760
|
// degrading an otherwise successful `aiwg use` result.
|
|
2544
2761
|
reportMissingReceipt: false,
|
|
2545
|
-
})
|
|
2762
|
+
});
|
|
2763
|
+
// Pi exposes agents through skills. The shared verifier counts skill
|
|
2764
|
+
// directories at that path as agents; report only actual agent files.
|
|
2765
|
+
if (provider === 'pi') {
|
|
2766
|
+
const paths = effectiveScope === 'user' ? USER_SCOPE_PATHS.pi : getProviderPaths(provider);
|
|
2767
|
+
verified.counts.agents = await countPiAgentFiles(projectDir, paths.agents);
|
|
2768
|
+
}
|
|
2769
|
+
providerResults.push(verified);
|
|
2546
2770
|
}
|
|
2547
2771
|
result = aggregateUseDeploymentResult({
|
|
2548
2772
|
projectRoot: projectDir,
|
|
@@ -2580,7 +2804,7 @@ export class UseHandler {
|
|
|
2580
2804
|
});
|
|
2581
2805
|
return {
|
|
2582
2806
|
exitCode: result.exitCode,
|
|
2583
|
-
message: [coreResult.message, rendered].filter(Boolean).join('\n'),
|
|
2807
|
+
message: [coreResult.message, rendered, ...(previewActions ? [...previewActions].sort() : [])].filter(Boolean).join('\n'),
|
|
2584
2808
|
};
|
|
2585
2809
|
}
|
|
2586
2810
|
async executeCore(ctx) {
|
|
@@ -2728,6 +2952,14 @@ export class UseHandler {
|
|
|
2728
2952
|
: null;
|
|
2729
2953
|
const projectDir = getProjectDir(ctx, remainingArgs);
|
|
2730
2954
|
let config = await readAiwgConfig(projectDir);
|
|
2955
|
+
if (detectScope(remainingArgs) === 'project' && remainingArgs.includes('--scope')) {
|
|
2956
|
+
for (const requested of configuredGlobalProviders(remainingArgs, config)) {
|
|
2957
|
+
const resolved = await resolveProjectLocalProviderAdapter(projectDir, requested);
|
|
2958
|
+
if (normalizeProviderDefinitionId(resolved.provider) === 'hermes') {
|
|
2959
|
+
return { exitCode: 1, message: "Hermes does not support --scope project: it discovers skills only under HERMES_HOME/skills (default ~/.hermes/skills). Use --scope user or an isolated HERMES_HOME profile shared with Hermes." };
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2731
2963
|
// Auto-init when no config found (#720)
|
|
2732
2964
|
// Check early for --provider/--platform and --providers flags
|
|
2733
2965
|
const _providerFlagIdx = remainingArgs.findIndex(a => a === '--provider' || a === '--platform');
|
|
@@ -2766,7 +2998,9 @@ export class UseHandler {
|
|
|
2766
2998
|
}
|
|
2767
2999
|
else if (process.stdin.isTTY) {
|
|
2768
3000
|
// Interactive terminal with no config → run init wizard inline (#720)
|
|
2769
|
-
const initResult = await initHandler.execute({ ...ctx,
|
|
3001
|
+
const initResult = await initHandler.execute({ ...ctx,
|
|
3002
|
+
args: remainingArgs.includes('--no-context-files') ? ['--no-context-files'] : [],
|
|
3003
|
+
});
|
|
2770
3004
|
if (initResult.exitCode !== 0)
|
|
2771
3005
|
return initResult;
|
|
2772
3006
|
config = await readAiwgConfig(projectDir);
|
|
@@ -2780,7 +3014,7 @@ export class UseHandler {
|
|
|
2780
3014
|
: '';
|
|
2781
3015
|
return {
|
|
2782
3016
|
exitCode: 1,
|
|
2783
|
-
message: `Error: Framework, addon, or extension name required\nFrameworks: sdlc, marketing, media-curator, research, forensics, dfir, security-engineering, ops, validation, knowledge-base, all\nAddons: rlm, ring, daemon, aiwg-dev (full list: \`aiwg list\`)\nExtensions: sys, net, it, sec, stream, dev (full list: \`ls $AIWG_ROOT/agentic/code/extensions\`)\n'all' deploys
|
|
3017
|
+
message: `Error: Framework, addon, or extension name required\nFrameworks: sdlc, marketing, media-curator, research, forensics, dfir, security-engineering, ops, validation, knowledge-base, all\nAddons: rlm, ring, daemon, aiwg-dev (full list: \`aiwg list\`)\nExtensions: sys, net, it, sec, stream, dev (full list: \`ls $AIWG_ROOT/agentic/code/extensions\`)\n'all' deploys the kernel surface (kernel skills, kernel and core rules, behaviors).${advisory}`,
|
|
2784
3018
|
};
|
|
2785
3019
|
}
|
|
2786
3020
|
const installedNames = Object.keys(config.installed);
|
|
@@ -2843,50 +3077,19 @@ export class UseHandler {
|
|
|
2843
3077
|
ui.dim(' Use `aiwg use all` for the full deployment.');
|
|
2844
3078
|
for (const providerName of providersForFiltered) {
|
|
2845
3079
|
const kernelOnly = !copyAll;
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
target,
|
|
2856
|
-
dryRun,
|
|
2857
|
-
verbose,
|
|
2858
|
-
force,
|
|
2859
|
-
copyAll,
|
|
2860
|
-
kernelOnly,
|
|
2861
|
-
quiet,
|
|
2862
|
-
modelArgs: modelDeployArgs,
|
|
2863
|
-
});
|
|
2864
|
-
if (result.exitCode !== 0)
|
|
2865
|
-
return result;
|
|
2866
|
-
}
|
|
2867
|
-
for (const selected of selectedAddons) {
|
|
2868
|
-
const result = await deploySourceDirectory({
|
|
2869
|
-
ctx,
|
|
2870
|
-
frameworkRoot,
|
|
2871
|
-
source: addonPath(frameworkRoot, selected),
|
|
2872
|
-
provider: providerName,
|
|
2873
|
-
target,
|
|
2874
|
-
dryRun,
|
|
2875
|
-
verbose,
|
|
2876
|
-
force,
|
|
2877
|
-
copyAll,
|
|
2878
|
-
kernelOnly,
|
|
2879
|
-
quiet,
|
|
2880
|
-
modelArgs: modelDeployArgs,
|
|
2881
|
-
});
|
|
2882
|
-
if (result.exitCode !== 0)
|
|
2883
|
-
return result;
|
|
2884
|
-
}
|
|
2885
|
-
for (const selected of selectedExtensions) {
|
|
3080
|
+
const sources = [
|
|
3081
|
+
...selectedFrameworks.flatMap(selected => {
|
|
3082
|
+
const directory = resolveFrameworkDir(selected);
|
|
3083
|
+
return directory ? [path.join(frameworkRoot, 'agentic/code/frameworks', directory)] : [];
|
|
3084
|
+
}),
|
|
3085
|
+
...selectedAddons.map(selected => addonPath(frameworkRoot, selected)),
|
|
3086
|
+
...selectedExtensions.map(selected => extensionPath(frameworkRoot, selected)),
|
|
3087
|
+
];
|
|
3088
|
+
for (const [index, source] of sources.entries()) {
|
|
2886
3089
|
const result = await deploySourceDirectory({
|
|
2887
3090
|
ctx,
|
|
2888
3091
|
frameworkRoot,
|
|
2889
|
-
source
|
|
3092
|
+
source,
|
|
2890
3093
|
provider: providerName,
|
|
2891
3094
|
target,
|
|
2892
3095
|
dryRun,
|
|
@@ -2894,6 +3097,10 @@ export class UseHandler {
|
|
|
2894
3097
|
force,
|
|
2895
3098
|
copyAll,
|
|
2896
3099
|
kernelOnly,
|
|
3100
|
+
// Kernel rule selection is invocation-wide, independent of the
|
|
3101
|
+
// source bundle. The last pass projects once over all deployed
|
|
3102
|
+
// skills, including their bound-rule pointers and startup blocks.
|
|
3103
|
+
deferRuleProjection: kernelOnly && index < sources.length - 1,
|
|
2897
3104
|
quiet,
|
|
2898
3105
|
modelArgs: modelDeployArgs,
|
|
2899
3106
|
});
|
|
@@ -3086,7 +3293,7 @@ export class UseHandler {
|
|
|
3086
3293
|
}
|
|
3087
3294
|
return {
|
|
3088
3295
|
exitCode: 1,
|
|
3089
|
-
message: `Error: Unknown target '${framework}'\nFrameworks: ${VALID_FRAMEWORKS.join(', ')}\n\n'all' deploys
|
|
3296
|
+
message: `Error: Unknown target '${framework}'\nFrameworks: ${VALID_FRAMEWORKS.join(', ')}\n\n'all' deploys the kernel surface (kernel skills, kernel and core rules, behaviors).\nFor a single addon, run 'aiwg list' to see available addons.\nFor extensions (sys, net, it, sec, stream, dev), see $AIWG_ROOT/agentic/code/extensions/.\nFor project-local artifacts, run 'aiwg list --project-local'.\nRun 'aiwg help' for usage information.`,
|
|
3090
3297
|
};
|
|
3091
3298
|
}
|
|
3092
3299
|
// Handle addon-only or extension-only deployment.
|
|
@@ -3113,7 +3320,7 @@ export class UseHandler {
|
|
|
3113
3320
|
message: `--scope user not supported for provider '${provider}' — see docs/customization/user-scope-deployment.md for the supported list`,
|
|
3114
3321
|
};
|
|
3115
3322
|
}
|
|
3116
|
-
const runner =
|
|
3323
|
+
const runner = createUseScriptRunner(frameworkRoot);
|
|
3117
3324
|
const addonBaseArgs = ['--deploy-commands', '--deploy-skills', '--deploy-rules'];
|
|
3118
3325
|
if (remainingArgs.includes('--allow-over-budget'))
|
|
3119
3326
|
addonBaseArgs.push('--allow-over-budget');
|
|
@@ -3422,8 +3629,8 @@ export class UseHandler {
|
|
|
3422
3629
|
const filteredArgs = removeFlagWithOptionalValue(deployArgs, preparedFlag).filter(a => a !== '--no-utils' && a !== '--no-project-local' && a !== '--ci-hooks-enabled' && a !== '--skip-conflicts' && a !== '--no-harness-agents');
|
|
3423
3630
|
const deployFilteredArgs = removeFlagWithOptionalValue(filteredArgs, '--harness-agents');
|
|
3424
3631
|
// Pass --quiet to suppress deploy-agents.mjs header/footer in default mode (#460)
|
|
3425
|
-
//
|
|
3426
|
-
//
|
|
3632
|
+
// Dry-run action output is captured and consolidated at the use boundary;
|
|
3633
|
+
// keep it available to the collector rather than silencing child plans.
|
|
3427
3634
|
if (machineReadableUseDepth > 0 || (!verbose && !dryRun))
|
|
3428
3635
|
deployFilteredArgs.push('--quiet');
|
|
3429
3636
|
// Extract provider and target from remainingArgs to pass to addon deployments
|
|
@@ -3467,10 +3674,17 @@ export class UseHandler {
|
|
|
3467
3674
|
canPrepareConcurrently = false;
|
|
3468
3675
|
break;
|
|
3469
3676
|
}
|
|
3470
|
-
const args = withProviderOverride([...deployFilteredArgs], resolved.provider);
|
|
3471
|
-
if (framework === 'all'
|
|
3472
|
-
|
|
3473
|
-
|
|
3677
|
+
const args = useDeploymentArgs(withProviderOverride([...deployFilteredArgs], resolved.provider));
|
|
3678
|
+
if (framework === 'all') {
|
|
3679
|
+
const kernelOnly = !['pi', 'omp'].includes(resolved.provider)
|
|
3680
|
+
&& !remainingArgs.includes('--copy-all') && !remainingArgs.includes('--copy-standard-skills');
|
|
3681
|
+
if (kernelOnly)
|
|
3682
|
+
args.push('--kernel-only');
|
|
3683
|
+
if (!skipUtils && ((!kernelOnly && (await getAllExtensions(frameworkRoot)).length > 0)
|
|
3684
|
+
|| (!mainDeploymentIncludesAddons(resolved.provider, mode, args) && (await getAllAddons(frameworkRoot)).length > 0))) {
|
|
3685
|
+
args.push('--defer-rule-projection');
|
|
3686
|
+
}
|
|
3687
|
+
}
|
|
3474
3688
|
preparedJobs.push({ order, provider: resolved.provider, target: path.resolve(target), args });
|
|
3475
3689
|
}
|
|
3476
3690
|
if (canPrepareConcurrently && preparedJobs.length === providers.length) {
|
|
@@ -3539,6 +3753,21 @@ export class UseHandler {
|
|
|
3539
3753
|
&& !remainingArgs.includes('--copy-standard-skills');
|
|
3540
3754
|
if (bulkKernelOnly)
|
|
3541
3755
|
providerDeployArgs.push('--kernel-only');
|
|
3756
|
+
const allAddons = skipUtils ? [] : await getAllAddons(frameworkRoot);
|
|
3757
|
+
const allExtensions = skipUtils || bulkKernelOnly ? [] : await getAllExtensions(frameworkRoot);
|
|
3758
|
+
const mainIncludesAddons = mainDeploymentIncludesAddons(provider, mode, providerDeployArgs);
|
|
3759
|
+
// OMP's extension sources share the root transaction and binding scan.
|
|
3760
|
+
// Their CLI contributions are still registered below in source order.
|
|
3761
|
+
const batchedOmpExtensions = provider === 'omp' && mainIncludesAddons ? allExtensions : [];
|
|
3762
|
+
for (const extension of batchedOmpExtensions) {
|
|
3763
|
+
providerDeployArgs.push('--additional-source', extensionPath(frameworkRoot, extension));
|
|
3764
|
+
}
|
|
3765
|
+
const additiveSources = (mainIncludesAddons ? 0 : allAddons.length)
|
|
3766
|
+
+ allExtensions.length - batchedOmpExtensions.length;
|
|
3767
|
+
// Keep the final source's rule selection and presentation, while earlier
|
|
3768
|
+
// full-surface passes still deploy their own agents/skills/flow resources.
|
|
3769
|
+
if (framework === 'all' && additiveSources > 0)
|
|
3770
|
+
providerDeployArgs.push('--defer-rule-projection');
|
|
3542
3771
|
if ((verbose || dryRun) && projectLocalProviderResolution.requestedProvider) {
|
|
3543
3772
|
ui.dim(` project-local provider '${projectLocalProviderResolution.requestedProvider}' extends '${provider}'`);
|
|
3544
3773
|
}
|
|
@@ -3619,18 +3848,18 @@ export class UseHandler {
|
|
|
3619
3848
|
const captureOpts = quiet ? { capture: true } : {};
|
|
3620
3849
|
if (quiet) {
|
|
3621
3850
|
const installLabel = framework === 'all'
|
|
3622
|
-
? 'Installing
|
|
3851
|
+
? (bulkKernelOnly ? 'Installing AIWG kernel surface' : 'Installing full AIWG surface')
|
|
3623
3852
|
: `Installing ${framework} framework`;
|
|
3624
3853
|
const providerLabel = getProviderDefinition(provider)?.displayName ?? provider;
|
|
3625
3854
|
ui.blank();
|
|
3626
3855
|
console.log(` ${ui.brandMark()} ${ui.bold(installLabel)} ${ui.dimText(`for ${providerLabel}`)}`);
|
|
3627
3856
|
ui.blank();
|
|
3628
3857
|
}
|
|
3629
|
-
const runner =
|
|
3858
|
+
const runner = createUseScriptRunner(ctx.frameworkRoot);
|
|
3630
3859
|
let mainResult;
|
|
3631
3860
|
if (mainProviderPrepared) {
|
|
3632
3861
|
try {
|
|
3633
|
-
await finalizePreparedProvider(frameworkRoot, providerDeployArgs);
|
|
3862
|
+
await finalizePreparedProvider(frameworkRoot, useDeploymentArgs(providerDeployArgs));
|
|
3634
3863
|
mainResult = { exitCode: 0 };
|
|
3635
3864
|
}
|
|
3636
3865
|
catch (error) {
|
|
@@ -3690,14 +3919,11 @@ export class UseHandler {
|
|
|
3690
3919
|
}
|
|
3691
3920
|
// Deploy all addons (excluding disallow list) unless --no-utils
|
|
3692
3921
|
if (!skipUtils) {
|
|
3693
|
-
const allAddons = await getAllAddons(frameworkRoot);
|
|
3694
3922
|
// These root collectors already deploy every eligible addon. Re-staging
|
|
3695
3923
|
// the entire deployment per addon duplicates that work. Codex's skills
|
|
3696
3924
|
// helper includes addons only in all mode; other modes retain their pass.
|
|
3697
3925
|
// CLI contribution registration below still runs for every addon.
|
|
3698
|
-
const
|
|
3699
|
-
const mainIncludesAddons = mainDeploymentIncludesAddons(provider, selectedMode, providerDeployArgs);
|
|
3700
|
-
for (const addon of allAddons) {
|
|
3926
|
+
for (const [index, addon] of allAddons.entries()) {
|
|
3701
3927
|
if (verbose) {
|
|
3702
3928
|
console.log('');
|
|
3703
3929
|
console.log(`Deploying ${addon} addon...`);
|
|
@@ -3706,6 +3932,9 @@ export class UseHandler {
|
|
|
3706
3932
|
const addonArgs = quiet
|
|
3707
3933
|
? ['--quiet', '--source', source, ...addonBaseArgs]
|
|
3708
3934
|
: ['--source', source, ...addonBaseArgs];
|
|
3935
|
+
if (framework === 'all' && (allExtensions.length > 0 || index < allAddons.length - 1)) {
|
|
3936
|
+
addonArgs.push('--defer-rule-projection');
|
|
3937
|
+
}
|
|
3709
3938
|
if (!mainIncludesAddons) {
|
|
3710
3939
|
const result = await runner.run('tools/agents/deploy-agents.mjs', addonArgs, captureOpts);
|
|
3711
3940
|
if (result.exitCode !== 0)
|
|
@@ -3727,10 +3956,9 @@ export class UseHandler {
|
|
|
3727
3956
|
// Deploy all extensions from agentic/code/extensions/* (#1222).
|
|
3728
3957
|
// Extensions are addon-shaped bundles (manifest type: "addon") that live
|
|
3729
3958
|
// in a separate top-level dir to keep ops/sysops/itops/devops grouped.
|
|
3730
|
-
//
|
|
3731
|
-
//
|
|
3732
|
-
const
|
|
3733
|
-
for (const ext of allExtensions) {
|
|
3959
|
+
// Kernel mode projects its shared rule set on the final framework/addon
|
|
3960
|
+
// pass. Extension-only passes would repeat that same surface.
|
|
3961
|
+
for (const [index, ext] of allExtensions.entries()) {
|
|
3734
3962
|
if (verbose) {
|
|
3735
3963
|
console.log('');
|
|
3736
3964
|
console.log(`Deploying ${ext} extension...`);
|
|
@@ -3739,9 +3967,12 @@ export class UseHandler {
|
|
|
3739
3967
|
const extArgs = quiet
|
|
3740
3968
|
? ['--quiet', '--source', source, ...addonBaseArgs]
|
|
3741
3969
|
: ['--source', source, ...addonBaseArgs];
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3970
|
+
if (framework === 'all' && index < allExtensions.length - 1)
|
|
3971
|
+
extArgs.push('--defer-rule-projection');
|
|
3972
|
+
if (!batchedOmpExtensions.includes(ext)) {
|
|
3973
|
+
const result = await runner.run('tools/agents/deploy-agents.mjs', extArgs, captureOpts);
|
|
3974
|
+
if (result.exitCode !== 0)
|
|
3975
|
+
return result;
|
|
3745
3976
|
}
|
|
3746
3977
|
try {
|
|
3747
3978
|
await registerSourceCliCommands({
|
|
@@ -3810,7 +4041,7 @@ export class UseHandler {
|
|
|
3810
4041
|
projectPath: target,
|
|
3811
4042
|
dryRun,
|
|
3812
4043
|
verbose,
|
|
3813
|
-
deployVersion: (
|
|
4044
|
+
deployVersion: deploymentVersion(frameworkRoot),
|
|
3814
4045
|
});
|
|
3815
4046
|
if (verbose && translationResult.translated.length > 0) {
|
|
3816
4047
|
ui.success(`Translated ${translationResult.translated.length} skills → commands (${provider})`);
|
|
@@ -3861,7 +4092,7 @@ export class UseHandler {
|
|
|
3861
4092
|
projectPath: target,
|
|
3862
4093
|
dryRun,
|
|
3863
4094
|
verbose,
|
|
3864
|
-
deployVersion: (
|
|
4095
|
+
deployVersion: deploymentVersion(frameworkRoot),
|
|
3865
4096
|
nameFilter: shouldMirrorKernelCommandSkill,
|
|
3866
4097
|
});
|
|
3867
4098
|
if (verbose && kernel.translated.length > 0) {
|
|
@@ -4177,11 +4408,10 @@ export class UseHandler {
|
|
|
4177
4408
|
// failed deploys produce shorter indexes, never broken links.
|
|
4178
4409
|
//
|
|
4179
4410
|
// Operators opt out via --no-context-files / --no-aiwg-md / --no-agents-md.
|
|
4180
|
-
if (!dryRun) {
|
|
4181
|
-
const
|
|
4182
|
-
const
|
|
4183
|
-
const
|
|
4184
|
-
const skipAgentsMd = skipContext || remainingArgs.includes('--no-agents-md');
|
|
4411
|
+
if (!dryRun && !remainingArgs.includes('--no-context-files')) {
|
|
4412
|
+
const skipWorkspaceMd = remainingArgs.includes('--no-workspace-md');
|
|
4413
|
+
const skipAiwgMd = remainingArgs.includes('--no-aiwg-md');
|
|
4414
|
+
const skipAgentsMd = remainingArgs.includes('--no-agents-md');
|
|
4185
4415
|
const forceContext = remainingArgs.includes('--force-context-files');
|
|
4186
4416
|
try {
|
|
4187
4417
|
const paths = getProviderPaths(provider);
|
|
@@ -4191,7 +4421,7 @@ export class UseHandler {
|
|
|
4191
4421
|
skills: paths.skills,
|
|
4192
4422
|
behaviors: paths.behaviors,
|
|
4193
4423
|
});
|
|
4194
|
-
const ctxResult = await
|
|
4424
|
+
const ctxResult = await generateDeploymentContextFiles({
|
|
4195
4425
|
provider: provider,
|
|
4196
4426
|
projectPath: target,
|
|
4197
4427
|
sections,
|
|
@@ -4245,10 +4475,8 @@ export class UseHandler {
|
|
|
4245
4475
|
}
|
|
4246
4476
|
}
|
|
4247
4477
|
catch (err) {
|
|
4248
|
-
// Non-fatal: context-pipeline emission must not block deployment.
|
|
4249
|
-
// Operator can re-run aiwg use to retry.
|
|
4250
4478
|
const msg = err instanceof Error ? err.message : String(err);
|
|
4251
|
-
|
|
4479
|
+
return { exitCode: 1, message: `Context generation failed: ${msg}` };
|
|
4252
4480
|
}
|
|
4253
4481
|
}
|
|
4254
4482
|
span.end('use:complete', { framework });
|