@aiwg/cli 2026.10.18 → 2026.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/agentic/code/providers/capability-matrix.yaml +51 -0
- package/agentic/code/providers/flue/README.md +62 -0
- package/agentic/code/providers/flue/templates/aiwg/tools.ts +120 -0
- package/agentic/code/providers/model-capabilities.v1.json +23 -0
- package/agentic/code/providers/model-catalog.v1.json +9 -0
- package/dist/src/artifacts/corpus-tools/resolve.js +7 -2
- package/dist/src/cli/handlers/bundle-declaration.js +55 -0
- package/dist/src/cli/handlers/bundle-deployment-mode.js +71 -0
- package/dist/src/cli/handlers/bundle-hash-prune.js +37 -0
- package/dist/src/cli/handlers/bundle-reconciliation.js +140 -0
- package/dist/src/cli/handlers/help.js +1 -1
- package/dist/src/cli/handlers/init.js +1 -0
- package/dist/src/cli/handlers/refresh-bundles.js +35 -0
- package/dist/src/cli/handlers/refresh-rule-inventory.js +10 -0
- package/dist/src/cli/handlers/refresh.js +15 -52
- package/dist/src/cli/handlers/remove-bundled.js +7 -4
- package/dist/src/cli/handlers/remove-flue-modules.js +19 -0
- package/dist/src/cli/handlers/remove-historical-bundle.js +18 -0
- package/dist/src/cli/handlers/remove.js +8 -0
- package/dist/src/cli/handlers/script-runner.js +10 -0
- package/dist/src/cli/handlers/subcommands-list-format.js +4 -4
- package/dist/src/cli/handlers/update.js +18 -8
- package/dist/src/cli/handlers/use-additive-bundles.js +87 -0
- package/dist/src/cli/handlers/use-bundle-counts.js +5 -1
- package/dist/src/cli/handlers/use-owned-counts.js +75 -0
- package/dist/src/cli/handlers/use.js +53 -102
- package/dist/src/cli/services/deployment-verification.js +5 -1
- package/dist/src/config/aiwg-config.js +10 -5
- package/dist/src/config/framework-aliases.js +14 -0
- package/dist/src/config/installed-selection.js +9 -1
- package/dist/src/config/installed-validation.js +35 -0
- package/dist/src/extensions/project-local-doctor.js +1 -1
- package/dist/src/extensions/project-local-remove.js +3 -3
- package/dist/src/mcp/cli.mjs +12 -7
- package/dist/src/mcp/helpers.mjs +5 -1
- package/dist/src/mcp/http-options.mjs +101 -0
- package/dist/src/mcp/http-tools.mjs +51 -0
- package/dist/src/mcp/http-transport.mjs +201 -0
- package/dist/src/mcp/server.mjs +9 -7
- package/dist/src/mcp/tool-context.mjs +25 -0
- package/dist/src/mcp/tools/orchestration.mjs +2 -1
- package/dist/src/memory/provider-memory-adapter.js +1 -0
- package/dist/src/models/model-capabilities.v1.json +23 -0
- package/dist/src/models/model-catalog.v1.json +9 -0
- package/dist/src/models/policy-resources.js +1 -1
- package/dist/src/providers/capability-matrix.yaml +51 -0
- package/dist/src/providers/deployment-ownership.d.mts +2 -1
- package/dist/src/providers/deployment-ownership.mjs +27 -3
- package/dist/src/providers/deployment-preservation.d.mts +5 -0
- package/dist/src/providers/deployment-preservation.mjs +110 -0
- package/dist/src/providers/deployment-removal.js +26 -2
- package/dist/src/providers/flue-package-mode.js +19 -0
- package/dist/src/providers/provider-context-contracts.js +8 -0
- package/dist/src/providers/provider-definition-schema.js +1 -0
- package/dist/src/providers/provider-definitions.js +1 -0
- package/dist/src/providers/provider-seeds-3.js +18 -0
- package/dist/src/providers/skill-ownership.d.mts +1 -0
- package/dist/src/providers/skill-ownership.mjs +1 -0
- package/dist/src/research/reference-match.js +33 -6
- package/dist/src/skills/deployment-ownership.js +2 -2
- package/dist/src/skills/deployment-policy.js +9 -0
- package/dist/src/smiths/context-pipeline/flue-context.js +25 -0
- package/dist/src/smiths/context-pipeline/generator.js +6 -1
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +9 -7
- package/package.json +3 -1
- package/tools/agents/deploy-agents.mjs +11 -4
- package/tools/agents/deploy-options.mjs +11 -0
- package/tools/agents/providers/base-inventory.mjs +6 -1
- package/tools/agents/providers/base-kernel-skills.mjs +9 -5
- package/tools/agents/providers/base-migrations.mjs +1 -0
- package/tools/agents/providers/base-skill-copy.mjs +9 -1
- package/tools/agents/providers/claude.mjs +2 -1
- package/tools/agents/providers/codex.mjs +5 -1
- package/tools/agents/providers/flue-bundles.mjs +42 -0
- package/tools/agents/providers/flue-cloudflare.mjs +20 -0
- package/tools/agents/providers/flue-project.mjs +118 -0
- package/tools/agents/providers/flue-skill-copy.mjs +25 -0
- package/tools/agents/providers/flue-skills.mjs +45 -0
- package/tools/agents/providers/flue-specialists.mjs +82 -0
- package/tools/agents/providers/flue-validation.mjs +14 -0
- package/tools/agents/providers/flue.mjs +54 -0
- package/tools/agents/providers/hermes-skill-lifecycle.mjs +1 -0
- package/tools/agents/providers/rule-delivery-surface.mjs +16 -1
- package/tools/agents/providers/rule-deployment-commit.mjs +14 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +6 -1
- package/tools/agents/providers/rule-startup.mjs +3 -3
- package/tools/agents/providers/skill-copy-prune.mjs +49 -0
- package/tools/agents/providers/stale-artifact-prune.mjs +1 -0
- package/tools/agents/use-rule-selection.mjs +17 -0
- package/tools/skills/codex-skill-metadata.mjs +22 -0
- package/tools/skills/deploy-skills-codex.mjs +8 -7
- package/vscode-extension/schemas/aiwg.config.v1.json +44 -19
|
@@ -52,6 +52,7 @@ const PROVIDER_LABELS = {
|
|
|
52
52
|
openclaw: 'OpenClaw ~/.openclaw/',
|
|
53
53
|
hermes: 'Hermes (MCP) aiwg mcp',
|
|
54
54
|
omp: 'Oh My Pi .omp/ + .agents/skills/',
|
|
55
|
+
flue: 'Flue (experimental) .agents/skills/ + AGENTS.md + db.ts',
|
|
55
56
|
pi: 'Pi Coding Agent .pi/ + .agents/skills/',
|
|
56
57
|
};
|
|
57
58
|
// Local aliases for the shared prompt utilities. These preserve existing
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Redeploy each selected bundle only to its declared providers.
|
|
2
|
+
import { bundleCopyArgs } from './bundle-deployment-mode.js';
|
|
3
|
+
import { withInstalledSelection } from '../../config/installed-selection.js';
|
|
4
|
+
import { bundleProviders, bundleUseName, pruneUndeclaredBundles, pruneAfterScopedDeployments } from './bundle-reconciliation.js';
|
|
5
|
+
export async function refreshDeclaredBundles(ctx, config, frameworks, requested, opts) {
|
|
6
|
+
const failed = [];
|
|
7
|
+
if (await pruneUndeclaredBundles(ctx.cwd, config, requested, opts.dryRun, opts.frameworkRoot))
|
|
8
|
+
failed.push('prune');
|
|
9
|
+
if (!frameworks.length && !opts.quiet)
|
|
10
|
+
console.log(' No installed frameworks or addons to re-deploy');
|
|
11
|
+
for (const fw of frameworks)
|
|
12
|
+
for (const provider of bundleProviders(config?.installed ?? {}, fw, requested)) {
|
|
13
|
+
const copyArgs = bundleCopyArgs(config?.installed ?? {}, fw, provider);
|
|
14
|
+
if (opts.dryRun) {
|
|
15
|
+
console.log(` Would re-deploy: ${fw} for ${provider} — aiwg use ${bundleUseName(fw)} --provider ${provider}${copyArgs.length ? ` ${copyArgs.join(' ')}` : ''}`);
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const result = await withInstalledSelection(ctx.cwd, config?.installed, () => opts.handler.execute({ ...ctx, frameworkRoot: opts.frameworkRoot,
|
|
19
|
+
args: [bundleUseName(fw), '--provider', provider, '--target', ctx.cwd, '--yes', '--json', ...copyArgs,
|
|
20
|
+
...(opts.forceDeploy ? ['--force'] : []), ...(ctx.args.includes('--allow-over-budget') ? ['--allow-over-budget'] : []), ...opts.modelDeployArgs],
|
|
21
|
+
rawArgs: ['use', fw],
|
|
22
|
+
}));
|
|
23
|
+
if (result.exitCode) {
|
|
24
|
+
failed.push(fw);
|
|
25
|
+
if (!opts.quiet)
|
|
26
|
+
console.warn(`Deploy issue: ${fw} for ${provider} (exit ${result.exitCode}): ${result.message || ''}`);
|
|
27
|
+
}
|
|
28
|
+
else if (!opts.quiet)
|
|
29
|
+
console.log(`Deployed: ${fw} for ${provider}`);
|
|
30
|
+
}
|
|
31
|
+
if (!opts.dryRun && await pruneAfterScopedDeployments(ctx.cwd, config, requested, opts.frameworkRoot))
|
|
32
|
+
failed.push('prune');
|
|
33
|
+
return failed;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=refresh-bundles.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Include native core projections when inventorying still-shipped rule files.
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { parseRuleFrontmatter } from '../../rules/activation.mjs';
|
|
5
|
+
export async function bundledRuleOutputNames(file) {
|
|
6
|
+
const name = path.basename(file);
|
|
7
|
+
const parsed = parseRuleFrontmatter(await fs.readFile(file, 'utf8'));
|
|
8
|
+
return parsed.valid && parsed.rule?.activation === 'core' ? [name, `core-${name}`] : [name];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=refresh-rule-inventory.js.map
|
|
@@ -19,6 +19,9 @@ import { promisify } from 'node:util';
|
|
|
19
19
|
const execFileAsync = promisify(execFile);
|
|
20
20
|
import { createScriptRunner } from './script-runner.js';
|
|
21
21
|
import { createUseHandler } from './use.js';
|
|
22
|
+
import { automaticRemovalAllowed } from '../../providers/deployment-preservation.mjs';
|
|
23
|
+
import { refreshDeclaredBundles } from './refresh-bundles.js';
|
|
24
|
+
import { bundledRuleOutputNames } from './refresh-rule-inventory.js';
|
|
22
25
|
import { getFrameworkRoot } from '../../channel/manager.mjs';
|
|
23
26
|
import { refreshAllPackages } from '../../packages/registry.js';
|
|
24
27
|
import { resolveActiveProvider } from '../provider-resolution.js';
|
|
@@ -76,8 +79,10 @@ export async function currentBundledRuleBasenames(frameworkRoot) {
|
|
|
76
79
|
continue;
|
|
77
80
|
}
|
|
78
81
|
for (const entry of entries) {
|
|
79
|
-
if (entry.isFile() && entry.name.endsWith('.md'))
|
|
80
|
-
|
|
82
|
+
if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
83
|
+
for (const name of await bundledRuleOutputNames(path.join(rulesDir, entry.name)))
|
|
84
|
+
names.add(name);
|
|
85
|
+
}
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
}
|
|
@@ -278,6 +283,8 @@ export async function pruneStaleManagedAgentFiles(options) {
|
|
|
278
283
|
record(trackedSkipped, provider, hit.relativePath);
|
|
279
284
|
continue;
|
|
280
285
|
}
|
|
286
|
+
if (!automaticRemovalAllowed(options.projectRoot, provider, hit.absolutePath))
|
|
287
|
+
continue;
|
|
281
288
|
if (!options.dryRun)
|
|
282
289
|
await fs.rm(hit.absolutePath, { force: true });
|
|
283
290
|
record(removals, provider, hit.relativePath);
|
|
@@ -331,15 +338,15 @@ async function reconcileDeployedToAfterPrune(projectRoot, removals, refreshedPro
|
|
|
331
338
|
let outstanding = removal.paths.length;
|
|
332
339
|
const byAgentsDesc = entries
|
|
333
340
|
.slice()
|
|
334
|
-
.sort((a, b) => b.deployedTo[removal.provider].agents - a.deployedTo[removal.provider].agents);
|
|
341
|
+
.sort((a, b) => (b.deployedTo[removal.provider].agents ?? 0) - (a.deployedTo[removal.provider].agents ?? 0));
|
|
335
342
|
for (const entry of byAgentsDesc) {
|
|
336
343
|
if (outstanding <= 0)
|
|
337
344
|
break;
|
|
338
345
|
const counts = entry.deployedTo[removal.provider];
|
|
339
|
-
const deduct = Math.min(counts.agents, outstanding);
|
|
346
|
+
const deduct = Math.min(counts.agents ?? 0, outstanding);
|
|
340
347
|
if (deduct <= 0)
|
|
341
348
|
continue;
|
|
342
|
-
counts.agents
|
|
349
|
+
counts.agents = (counts.agents ?? 0) - deduct;
|
|
343
350
|
outstanding -= deduct;
|
|
344
351
|
changed = true;
|
|
345
352
|
}
|
|
@@ -550,53 +557,9 @@ export const refreshHandler = {
|
|
|
550
557
|
: requestedFrameworks;
|
|
551
558
|
if (!quiet)
|
|
552
559
|
ui.info(dryRun ? 'Would re-deploy frameworks...' : 'Re-deploying frameworks...');
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
557
|
-
for (const fw of frameworks) {
|
|
558
|
-
// Invoke the active installation's handler directly. The historical
|
|
559
|
-
// deploy.mjs bridge shells out to the first `aiwg` on PATH, which can
|
|
560
|
-
// be a different version/root and therefore cannot safely refresh
|
|
561
|
-
// addons installed by this package (#143/#2102).
|
|
562
|
-
const useResult = await activeUseHandler.execute({
|
|
563
|
-
...ctx,
|
|
564
|
-
cwd: ctx.cwd,
|
|
565
|
-
frameworkRoot,
|
|
566
|
-
args: [
|
|
567
|
-
fw,
|
|
568
|
-
'--provider', detectedProvider,
|
|
569
|
-
'--target', ctx.cwd,
|
|
570
|
-
'--yes',
|
|
571
|
-
'--json',
|
|
572
|
-
// #2507: give operators a reclaim path for artifacts an older
|
|
573
|
-
// AIWG left behind without a managed marker.
|
|
574
|
-
...(forceDeploy ? ['--force'] : []),
|
|
575
|
-
...(hasFlag(ctx.args, '--allow-over-budget') ? ['--allow-over-budget'] : []),
|
|
576
|
-
...modelDeployArgs,
|
|
577
|
-
],
|
|
578
|
-
rawArgs: ['use', fw],
|
|
579
|
-
});
|
|
580
|
-
if (useResult.exitCode === 0) {
|
|
581
|
-
if (!quiet)
|
|
582
|
-
ui.success(`Deployed: ${fw}`);
|
|
583
|
-
}
|
|
584
|
-
else {
|
|
585
|
-
deploymentFailures.push(fw);
|
|
586
|
-
if (!quiet)
|
|
587
|
-
ui.warn(`Deploy issue: ${fw} (exit ${useResult.exitCode})`);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
else {
|
|
592
|
-
if (!quiet) {
|
|
593
|
-
if (frameworks.length === 0)
|
|
594
|
-
ui.dim(' No installed frameworks or addons');
|
|
595
|
-
for (const fw of frameworks) {
|
|
596
|
-
ui.dim(` Would re-deploy: ${fw}`);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
}
|
|
560
|
+
deploymentFailures.push(...await refreshDeclaredBundles(ctx, refreshConfig, frameworks, provider, {
|
|
561
|
+
handler: activeUseHandler, frameworkRoot, dryRun, quiet, forceDeploy, modelDeployArgs,
|
|
562
|
+
}));
|
|
600
563
|
// Runtime updates can change the corpus even when there are no recorded
|
|
601
564
|
// deployments. Refresh both discovery representations, independently of use.
|
|
602
565
|
if (!dryRun) {
|
|
@@ -6,6 +6,7 @@ import { resolveProjectAiwgDir } from '../../config/project-artifacts.js';
|
|
|
6
6
|
import { removeClaudeAttribution } from '../../extensions/claude-hooks-installer.js';
|
|
7
7
|
import { planDeploymentRemoval } from '../../providers/deployment-removal.js';
|
|
8
8
|
import { applyRemovalTransaction } from '../../providers/removal-transaction.js';
|
|
9
|
+
import { refreshRemainingFlueModules } from './remove-flue-modules.js';
|
|
9
10
|
function counts(decisions) {
|
|
10
11
|
const result = { agents: 0, commands: 0, skills: 0, rules: 0 };
|
|
11
12
|
for (const item of decisions) {
|
|
@@ -22,7 +23,7 @@ function counts(decisions) {
|
|
|
22
23
|
}
|
|
23
24
|
return result;
|
|
24
25
|
}
|
|
25
|
-
const summary = (value) => `${value.agents} agents, ${value.commands} commands, ${value.rules} rules, ${value.skills} skills`;
|
|
26
|
+
const summary = (value) => `${value.agents ?? 0} agents, ${value.commands ?? 0} commands, ${value.rules ?? 0} rules, ${value.skills ?? 0} skills`;
|
|
26
27
|
export async function removeBundledDeployment(project, id, owner, config, providers, opts) {
|
|
27
28
|
const entry = config.installed[id];
|
|
28
29
|
const configBefore = JSON.stringify(config);
|
|
@@ -31,7 +32,7 @@ export async function removeBundledDeployment(project, id, owner, config, provid
|
|
|
31
32
|
let removed = 0, modern = false;
|
|
32
33
|
try {
|
|
33
34
|
for (const provider of providers) {
|
|
34
|
-
const plan = planDeploymentRemoval(project, provider, owner, providers.length === Object.keys(entry.deployedTo).length);
|
|
35
|
+
const plan = planDeploymentRemoval(project, provider, owner, opts.includeProject ?? providers.length === Object.keys(entry.deployedTo).length, opts.preserveRoots);
|
|
35
36
|
modern ||= !plan.legacy;
|
|
36
37
|
lines.push(` Provider ${provider}:`);
|
|
37
38
|
lines.push(` Receipt inventory: ${summary(counts(plan.decisions))}; ${plan.recorded.length} owned file record(s).`);
|
|
@@ -62,12 +63,12 @@ export async function removeBundledDeployment(project, id, owner, config, provid
|
|
|
62
63
|
const residual = counts(retained);
|
|
63
64
|
let unverifiable = 0;
|
|
64
65
|
for (const kind of Object.keys(residual)) {
|
|
65
|
-
const gap = Math.max(0, entry.deployedTo[provider][kind] - inventory[kind]);
|
|
66
|
+
const gap = Math.max(0, (entry.deployedTo[provider][kind] ?? 0) - inventory[kind]);
|
|
66
67
|
residual[kind] += gap;
|
|
67
68
|
unverifiable += gap;
|
|
68
69
|
}
|
|
69
70
|
if (retained.length || unverifiable) {
|
|
70
|
-
entry.deployedTo[provider] = residual;
|
|
71
|
+
entry.deployedTo[provider] = { ...residual, ...(entry.deployedTo[provider].copy === undefined ? {} : { copy: entry.deployedTo[provider].copy }) };
|
|
71
72
|
if (unverifiable)
|
|
72
73
|
lines.push(` Retained ${unverifiable} unverifiable historical artifact count(s); no ownership inferred.`);
|
|
73
74
|
lines.push(` Partial removal: ${retained.length} owned file record(s) retained; deployedTo counts reconciled.`);
|
|
@@ -123,6 +124,8 @@ export async function removeBundledDeployment(project, id, owner, config, provid
|
|
|
123
124
|
catch { /* Nonempty directories preserve operator files and remaining receipts. */ }
|
|
124
125
|
}
|
|
125
126
|
}
|
|
127
|
+
if (!opts.dryRun && !opts.keepRegistry && providers.includes('flue'))
|
|
128
|
+
await refreshRemainingFlueModules(project, config);
|
|
126
129
|
lines.push(`${opts.dryRun ? 'Would remove' : 'Removed'} ${removed} unchanged recorded file(s); operator files preserved.`);
|
|
127
130
|
return { exitCode: 0, message: lines.join('\n') };
|
|
128
131
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Regenerate shared Flue app modules after a bundle's files are removed.
|
|
2
|
+
import { getFrameworkRoot } from '../../channel/manager.mjs';
|
|
3
|
+
import { REGISTRY_ID_TO_USE_NAME } from '../../config/framework-aliases.js';
|
|
4
|
+
import { bundleCopyArgs } from './bundle-deployment-mode.js';
|
|
5
|
+
import { withInstalledSelection } from '../../config/installed-selection.js';
|
|
6
|
+
export async function refreshRemainingFlueModules(project, config) {
|
|
7
|
+
const id = Object.keys(config.installed).find(id => config.installed[id].deployedTo.flue?.skills !== undefined);
|
|
8
|
+
if (!id)
|
|
9
|
+
return;
|
|
10
|
+
const { useHandler } = await import('./use.js');
|
|
11
|
+
const name = REGISTRY_ID_TO_USE_NAME[id] ?? id;
|
|
12
|
+
const frameworkRoot = await getFrameworkRoot();
|
|
13
|
+
const result = await withInstalledSelection(project, config.installed, () => useHandler.execute({
|
|
14
|
+
cwd: project, frameworkRoot, args: [name, '--provider', 'flue', '--target', project, '--yes', '--json', ...bundleCopyArgs(config.installed, id, 'flue')], rawArgs: ['use', name],
|
|
15
|
+
}));
|
|
16
|
+
if (result.exitCode)
|
|
17
|
+
throw new Error(`Flue module regeneration failed: ${result.message || name}`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=remove-flue-modules.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { frameworkRegistryId } from '../../config/framework-aliases.js';
|
|
2
|
+
import { bundleDeploymentHistory } from './bundle-deployment-mode.js';
|
|
3
|
+
import { refreshRemainingFlueModules } from './remove-flue-modules.js';
|
|
4
|
+
import { removeBundledDeployment } from './remove-bundled.js';
|
|
5
|
+
export async function removeHistoricalBundle(project, id, provider, config, dryRun) {
|
|
6
|
+
const owner = frameworkRegistryId(id);
|
|
7
|
+
const history = bundleDeploymentHistory(project);
|
|
8
|
+
const providers = Object.keys(history).filter(p => (!provider || p === provider) && history[p][owner]);
|
|
9
|
+
if (!providers.length)
|
|
10
|
+
return undefined;
|
|
11
|
+
const historical = structuredClone(config);
|
|
12
|
+
historical.installed[id] = { deployedTo: Object.fromEntries(providers.map(p => [p, {}])) };
|
|
13
|
+
const result = await removeBundledDeployment(project, id, owner, historical, providers, { dryRun, keepRegistry: true });
|
|
14
|
+
if (!dryRun && !result.exitCode && providers.includes('flue'))
|
|
15
|
+
await refreshRemainingFlueModules(project, config);
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=remove-historical-bundle.js.map
|
|
@@ -29,6 +29,7 @@ export const removeHandler = {
|
|
|
29
29
|
'Project-local removal reverts deployed artifacts using recorded hashes; bundle source is preserved.',
|
|
30
30
|
'',
|
|
31
31
|
'Options:',
|
|
32
|
+
' --declare Drop the provider declaration without removing files (requires --provider).',
|
|
32
33
|
' --dry-run List planned removals and preserved paths with reasons; write nothing.',
|
|
33
34
|
' --provider <p> Select one recorded provider deployment.',
|
|
34
35
|
' --keep-registry Keep project installed/deployedTo records after removal. By default,',
|
|
@@ -56,6 +57,8 @@ export const removeHandler = {
|
|
|
56
57
|
].join('\n') };
|
|
57
58
|
},
|
|
58
59
|
async execute(ctx) {
|
|
60
|
+
if (ctx.args.includes('--declare'))
|
|
61
|
+
return (await import('./bundle-declaration.js')).declareBundle(ctx, true);
|
|
59
62
|
// Explicit provider removal is separate from framework removal. The native
|
|
60
63
|
// adapter validates receipt hashes and preserves operator modifications.
|
|
61
64
|
const nativeRemovalProvider = parseRemoveProvider(ctx.args);
|
|
@@ -131,6 +134,11 @@ export const removeHandler = {
|
|
|
131
134
|
const projectDir = getProjectDir({ cwd: ctx.cwd }, ctx.args);
|
|
132
135
|
const config = await readAiwgConfig(projectDir);
|
|
133
136
|
const entry = config?.installed?.[positionalArg];
|
|
137
|
+
if (config && !entry) {
|
|
138
|
+
const result = await (await import('./remove-historical-bundle.js')).removeHistoricalBundle(projectDir, positionalArg, providerParse.provider, config, ctx.args.includes('--dry-run'));
|
|
139
|
+
if (result)
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
134
142
|
if (config && entry && entry.source !== 'project-local') {
|
|
135
143
|
const { resolveFrameworkDir } = await import('./use.js');
|
|
136
144
|
const { removeBundledDeployment } = await import('./remove-bundled.js');
|
|
@@ -18,6 +18,11 @@ import { writeSync } from 'node:fs';
|
|
|
18
18
|
// Embedded deployers use process-wide console/environment APIs. Serialize the
|
|
19
19
|
// complete invocation (including import), and restore them even after failure.
|
|
20
20
|
let deploymentQueue = Promise.resolve();
|
|
21
|
+
function reportFlueWarnings(message, sink = console) {
|
|
22
|
+
for (const line of message.split(/\r?\n/))
|
|
23
|
+
if (line.startsWith('Flue (experimental):'))
|
|
24
|
+
sink.warn(line);
|
|
25
|
+
}
|
|
21
26
|
/**
|
|
22
27
|
* Default script runner implementation
|
|
23
28
|
*
|
|
@@ -130,6 +135,9 @@ export class DefaultScriptRunner {
|
|
|
130
135
|
});
|
|
131
136
|
}
|
|
132
137
|
else {
|
|
138
|
+
if (options.capture && code === 0 && scriptPath === 'tools/agents/deploy-agents.mjs') {
|
|
139
|
+
reportFlueWarnings(Buffer.concat(capturedStderr).toString());
|
|
140
|
+
}
|
|
133
141
|
resolve({
|
|
134
142
|
exitCode: code ?? 0,
|
|
135
143
|
});
|
|
@@ -187,6 +195,8 @@ export class DefaultScriptRunner {
|
|
|
187
195
|
const exitCode = (await deployer.main(args, { capture: options.capture === true })) ?? 0;
|
|
188
196
|
const message = Buffer.concat(diagnostics).toString().trim()
|
|
189
197
|
|| (exitCode ? `Deployment script exited with code ${exitCode}: ${path.basename(fullPath)}` : '');
|
|
198
|
+
if (exitCode === 0 && options.capture)
|
|
199
|
+
reportFlueWarnings(message, previousConsole);
|
|
190
200
|
return exitCode || message ? { exitCode, message } : { exitCode };
|
|
191
201
|
}
|
|
192
202
|
catch (error) {
|
|
@@ -110,13 +110,13 @@ export async function formatUserScopeRegistry() {
|
|
|
110
110
|
const providers = Object.entries(entry.deployedTo);
|
|
111
111
|
for (const [provider, counts] of providers) {
|
|
112
112
|
const parts = [];
|
|
113
|
-
if (counts.agents > 0)
|
|
113
|
+
if ((counts.agents ?? 0) > 0)
|
|
114
114
|
parts.push(`${counts.agents} agents`);
|
|
115
|
-
if (counts.commands > 0)
|
|
115
|
+
if ((counts.commands ?? 0) > 0)
|
|
116
116
|
parts.push(`${counts.commands} commands`);
|
|
117
|
-
if (counts.skills > 0)
|
|
117
|
+
if ((counts.skills ?? 0) > 0)
|
|
118
118
|
parts.push(`${counts.skills} skills`);
|
|
119
|
-
if (counts.rules > 0)
|
|
119
|
+
if ((counts.rules ?? 0) > 0)
|
|
120
120
|
parts.push(`${counts.rules} rules`);
|
|
121
121
|
output += ` ${provider}: ${parts.length > 0 ? parts.join(', ') : '(empty)'}\n`;
|
|
122
122
|
}
|
|
@@ -4,6 +4,9 @@ import { updateInstallation } from '../../update/service.mjs';
|
|
|
4
4
|
import { useHandler as useFrameworkHandler } from './use.js';
|
|
5
5
|
import { projectAiwgPath } from '../../config/project-artifacts.js';
|
|
6
6
|
import { getConfigPath } from '../../config/aiwg-config.js';
|
|
7
|
+
import { bundleCopyArgs } from './bundle-deployment-mode.js';
|
|
8
|
+
import { bundleProviders, pruneUndeclaredBundles, pruneAfterScopedDeployments } from './bundle-reconciliation.js';
|
|
9
|
+
import { readAiwgConfig } from '../../config/aiwg-config.js';
|
|
7
10
|
import { withInstalledSelection } from '../../config/installed-selection.js';
|
|
8
11
|
import { REGISTRY_ID_TO_USE_NAME } from '../../config/framework-aliases.js';
|
|
9
12
|
/**
|
|
@@ -107,34 +110,41 @@ export const updateHandler = {
|
|
|
107
110
|
console.log(`Skipped legacy registry frameworks: ${skipped.map(item => item.id).join(', ')}`);
|
|
108
111
|
}
|
|
109
112
|
const installedFrameworks = deployAll ? ['all'] : [...new Set((configured ?? registry?.frameworks.map(item => item.id) ?? []).map(useName))];
|
|
113
|
+
let pruneFailures = !deployAll && installed !== undefined
|
|
114
|
+
? await pruneUndeclaredBundles(ctx.cwd, await readAiwgConfig(ctx.cwd), providerArgs[1], dryRun, ctx.frameworkRoot) : 0;
|
|
115
|
+
const deployments = installedFrameworks.flatMap(fw => installed === undefined || deployAll
|
|
116
|
+
? [{ fw, args: providerArgs }]
|
|
117
|
+
: bundleProviders(installed, fw, providerArgs[1]).map(provider => ({ fw, args: ['--provider', provider, ...bundleCopyArgs(installed, fw, provider)] })));
|
|
110
118
|
if (installedFrameworks.length === 0) {
|
|
111
119
|
console.log('No installed frameworks to re-deploy. Use aiwg use <framework> to install one.');
|
|
112
|
-
return { exitCode: 0 };
|
|
120
|
+
return { exitCode: pruneFailures ? 1 : 0 };
|
|
113
121
|
}
|
|
114
122
|
// Report what will be updated
|
|
115
123
|
console.log(`Installed frameworks: ${installedFrameworks.join(', ')}`);
|
|
116
124
|
console.log('');
|
|
117
125
|
if (dryRun) {
|
|
118
126
|
console.log('Dry run: Would re-deploy the following frameworks:');
|
|
119
|
-
for (const fw of
|
|
120
|
-
console.log(` - aiwg use ${[fw, ...
|
|
127
|
+
for (const { fw, args } of deployments) {
|
|
128
|
+
console.log(` - aiwg use ${[fw, ...args].join(' ')}`);
|
|
121
129
|
}
|
|
122
|
-
return { exitCode: 0 };
|
|
130
|
+
return { exitCode: pruneFailures ? 1 : 0 };
|
|
123
131
|
}
|
|
124
132
|
// Step 3: Re-deploy each installed framework
|
|
125
133
|
const results = [];
|
|
126
|
-
for (const fw of
|
|
134
|
+
for (const { fw, args } of deployments) {
|
|
127
135
|
console.log(`Re-deploying ${fw}...`);
|
|
128
136
|
const deploy = () => useFrameworkHandler.execute({
|
|
129
137
|
...ctx,
|
|
130
|
-
args: [fw, ...
|
|
138
|
+
args: [fw, ...args],
|
|
131
139
|
});
|
|
132
140
|
const result = await (deployAll ? deploy() : withInstalledSelection(ctx.cwd, installed, deploy));
|
|
133
141
|
results.push({ framework: fw, exitCode: result.exitCode });
|
|
134
142
|
if (result.exitCode !== 0) {
|
|
135
|
-
console.error(`Warning: Failed to re-deploy ${fw}`);
|
|
143
|
+
console.error(`Warning: Failed to re-deploy ${fw}: ${result.message || `exit ${result.exitCode}`}`);
|
|
136
144
|
}
|
|
137
145
|
}
|
|
146
|
+
if (!deployAll)
|
|
147
|
+
pruneFailures += await pruneAfterScopedDeployments(ctx.cwd, await readAiwgConfig(ctx.cwd), providerArgs[1], ctx.frameworkRoot);
|
|
138
148
|
// Step 4: Report summary
|
|
139
149
|
console.log('');
|
|
140
150
|
console.log('Update Summary:');
|
|
@@ -147,7 +157,7 @@ export const updateHandler = {
|
|
|
147
157
|
console.log('');
|
|
148
158
|
console.log(`Updated: ${succeeded.length}/${results.length}`);
|
|
149
159
|
return {
|
|
150
|
-
exitCode: failed.length > 0 ? 1 : 0,
|
|
160
|
+
exitCode: failed.length > 0 || pruneFailures ? 1 : 0,
|
|
151
161
|
message: failed.length > 0
|
|
152
162
|
? `Some frameworks failed to update: ${failed.map(f => f.framework).join(', ')}`
|
|
153
163
|
: `Successfully updated ${succeeded.length} framework(s)`,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Discover additive framework bundles once for deployment and reconciliation.
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Addons excluded from `aiwg use all`.
|
|
6
|
+
* aiwg-dev is contributor-only tooling — not for end users.
|
|
7
|
+
*/
|
|
8
|
+
export const USE_ALL_DISALLOW = new Set(['aiwg-dev']);
|
|
9
|
+
/**
|
|
10
|
+
* Whether an addon's manifest keeps it out of bulk deploys (#2641).
|
|
11
|
+
*
|
|
12
|
+
* `devOnly` marks contributor tooling; `explicitInstall` marks an addon that is
|
|
13
|
+
* deployed only when named, such as `aiwg use decision-engine`. Both match
|
|
14
|
+
* `discoverAddons()` in tools/agents/providers/base.mjs, which applies the same
|
|
15
|
+
* rule to framework-mode deploys.
|
|
16
|
+
*
|
|
17
|
+
* `autoInstall: false` is deliberately NOT an exclusion signal: most addons
|
|
18
|
+
* declare it (and the extension manifest schema defaults to it), so honoring
|
|
19
|
+
* it would drop most addons from `all` for existing users.
|
|
20
|
+
*/
|
|
21
|
+
async function isExplicitOnlyAddon(addonDir) {
|
|
22
|
+
try {
|
|
23
|
+
const manifest = JSON.parse(await fs.readFile(path.join(addonDir, 'manifest.json'), 'utf8'));
|
|
24
|
+
return manifest?.devOnly === true || manifest?.explicitInstall === true;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Discover all addon names from the filesystem, minus the disallow list and
|
|
32
|
+
* addons whose manifest restricts them to explicit installs.
|
|
33
|
+
*/
|
|
34
|
+
export async function getAllAddons(frameworkRoot) {
|
|
35
|
+
const addonsDir = path.join(frameworkRoot, 'agentic/code/addons');
|
|
36
|
+
const entries = await fs.readdir(addonsDir, { withFileTypes: true });
|
|
37
|
+
const candidates = entries.filter(e => e.isDirectory() && !USE_ALL_DISALLOW.has(e.name));
|
|
38
|
+
const excluded = await Promise.all(candidates.map(e => isExplicitOnlyAddon(path.join(addonsDir, e.name))));
|
|
39
|
+
return candidates.filter((_, index) => !excluded[index]).map(e => e.name);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extensions excluded from `aiwg use all` deployment.
|
|
43
|
+
* `api-adapter` is an OpenAPI spec, not a deployable artifact bundle.
|
|
44
|
+
*/
|
|
45
|
+
export const USE_ALL_EXTENSIONS_DISALLOW = new Set(['api-adapter']);
|
|
46
|
+
/**
|
|
47
|
+
* Discover all extension names from `agentic/code/extensions/*` (#1221).
|
|
48
|
+
*
|
|
49
|
+
* Extensions are addon-shaped bundles with their own `manifest.json`,
|
|
50
|
+
* `skills/`, `rules/`, and `templates/` directories. Only directories
|
|
51
|
+
* containing a `manifest.json` are considered deployable; bare directories
|
|
52
|
+
* (e.g. `api-adapter` which only ships an OpenAPI spec) are skipped.
|
|
53
|
+
*/
|
|
54
|
+
export async function getAllExtensions(frameworkRoot) {
|
|
55
|
+
const extensionsDir = path.join(frameworkRoot, 'agentic/code/extensions');
|
|
56
|
+
let entries;
|
|
57
|
+
try {
|
|
58
|
+
entries = await fs.readdir(extensionsDir, { withFileTypes: true });
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
const result = [];
|
|
64
|
+
for (const entry of entries) {
|
|
65
|
+
if (!entry.isDirectory())
|
|
66
|
+
continue;
|
|
67
|
+
if (USE_ALL_EXTENSIONS_DISALLOW.has(entry.name))
|
|
68
|
+
continue;
|
|
69
|
+
const manifestPath = path.join(extensionsDir, entry.name, 'manifest.json');
|
|
70
|
+
try {
|
|
71
|
+
await fs.access(manifestPath);
|
|
72
|
+
result.push(entry.name);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Directory without a manifest is not deployable as an extension.
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
/** The same provider and kernel gates govern use passes and expected receipt owners. */
|
|
82
|
+
export async function frameworkAdditiveBundles(frameworkRoot, provider, skipUtils = false, kernelOnly = false) {
|
|
83
|
+
const addons = skipUtils || provider === 'flue' ? [] : await getAllAddons(frameworkRoot);
|
|
84
|
+
const extensions = skipUtils || kernelOnly || provider === 'flue' ? [] : await getAllExtensions(frameworkRoot);
|
|
85
|
+
return { addons, extensions };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=use-additive-bundles.js.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { promises as fs } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
|
+
import { receiptIncludesOwner } from './use-owned-counts.js';
|
|
5
6
|
import { parseRuleFrontmatter } from '../../rules/activation.mjs';
|
|
6
7
|
export async function countDeployedBundleRules(bundlePath, target, deployPath, provider) {
|
|
7
8
|
if (!deployPath && !provider)
|
|
@@ -75,7 +76,10 @@ export async function countDeployedBundleFiles(bundlePath, subdir, target, deplo
|
|
|
75
76
|
for (const name of names) {
|
|
76
77
|
for (const extension of extensions) {
|
|
77
78
|
try {
|
|
78
|
-
|
|
79
|
+
const file = path.join(path.resolve(target, deployPath), path.basename(name, '.md') + extension);
|
|
80
|
+
await fs.access(file);
|
|
81
|
+
if (!await receiptIncludesOwner(file, new Set([path.basename(bundlePath)])))
|
|
82
|
+
continue;
|
|
79
83
|
count++;
|
|
80
84
|
break;
|
|
81
85
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Count only receipt-owned output in the bundle's recorded deployment scope.
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { frameworkRegistryId } from '../../config/framework-aliases.js';
|
|
5
|
+
import { getProviderArtifactPathStrings } from '../../providers/provider-definitions.js';
|
|
6
|
+
import { deployedSkillRoots } from '../../providers/deployed-skill-roots.js';
|
|
7
|
+
import { bundleDeploymentHistory, bundleDeploymentScope } from './bundle-deployment-mode.js';
|
|
8
|
+
import { expectedBundleOwners } from './bundle-reconciliation.js';
|
|
9
|
+
export async function receiptIncludesOwner(file, owners, mirrorRoot) {
|
|
10
|
+
try {
|
|
11
|
+
const receipt = JSON.parse(await fs.readFile(path.join(path.dirname(file), '.aiwg-manifest.json'), 'utf8'));
|
|
12
|
+
const record = receipt.managed?.[path.basename(file)];
|
|
13
|
+
if (record?.owners?.some((owner) => owners.has(frameworkRegistryId(owner))) === true)
|
|
14
|
+
return true;
|
|
15
|
+
// Every framework also projects these shared operator workflows. Keep this
|
|
16
|
+
// exception source- and kind-scoped so unrelated stale SDLC files stay out.
|
|
17
|
+
if (!mirrorRoot || record?.kind !== 'skill-command' || !record.owners?.includes('sdlc-complete'))
|
|
18
|
+
return false;
|
|
19
|
+
const name = path.basename(path.dirname(record.sourcePath || ''));
|
|
20
|
+
const source = path.join(mirrorRoot, 'agentic/code/frameworks/sdlc-complete/skills', name, 'SKILL.md');
|
|
21
|
+
const { shouldMirrorStandardCommandSkill } = await import('./use.js');
|
|
22
|
+
return shouldMirrorStandardCommandSkill(name) && record.sourcePath === source
|
|
23
|
+
&& await fs.stat(source).then(stat => stat.isFile()).catch(() => false);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export async function countRecordedFrameworkArtifacts(target, provider, id, root, args) {
|
|
30
|
+
const selected = { installed: { [id]: { deployedTo: { [provider]: bundleDeploymentScope(id, provider, args) } } } };
|
|
31
|
+
const owners = await expectedBundleOwners(selected, provider, root);
|
|
32
|
+
// Explicit bundles have their own records, even after undeclaration leaves edits.
|
|
33
|
+
for (const owner of Object.keys(bundleDeploymentHistory(target)[provider] ?? {})) {
|
|
34
|
+
if (owner !== frameworkRegistryId(id))
|
|
35
|
+
owners.delete(owner);
|
|
36
|
+
}
|
|
37
|
+
const paths = getProviderArtifactPathStrings(provider);
|
|
38
|
+
const countFiles = async (dir, skills = false, rules = false, sharedMirrors = false) => {
|
|
39
|
+
if (!dir)
|
|
40
|
+
return 0;
|
|
41
|
+
const destination = path.resolve(target, dir);
|
|
42
|
+
let entries;
|
|
43
|
+
try {
|
|
44
|
+
entries = await fs.readdir(destination);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
const owned = [];
|
|
50
|
+
for (const name of entries) {
|
|
51
|
+
const file = path.join(destination, name, ...(skills ? ['SKILL.md'] : []));
|
|
52
|
+
if (!skills && !name.endsWith('.md'))
|
|
53
|
+
continue;
|
|
54
|
+
if (await fs.stat(file).then(stat => stat.isFile()).catch(() => false) && await receiptIncludesOwner(file, owners, sharedMirrors ? root : undefined))
|
|
55
|
+
owned.push(name);
|
|
56
|
+
}
|
|
57
|
+
if (!rules)
|
|
58
|
+
return owned.length;
|
|
59
|
+
const indexes = owned.filter(name => name.endsWith('RULES-INDEX.md'));
|
|
60
|
+
if (!indexes.length)
|
|
61
|
+
return owned.length;
|
|
62
|
+
let count = 0;
|
|
63
|
+
for (const name of indexes) {
|
|
64
|
+
for (const match of (await fs.readFile(path.join(destination, name), 'utf8')).matchAll(/\((\d+) rules[^)]*\)/g))
|
|
65
|
+
count += Number(match[1]);
|
|
66
|
+
}
|
|
67
|
+
return count || owned.length;
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
agents: await countFiles(paths?.agents), commands: await countFiles(paths?.commands, false, false, !bundleDeploymentScope(id, provider, args).kernelOnly),
|
|
71
|
+
skills: (await Promise.all(deployedSkillRoots(target, provider).map(dir => countFiles(dir, true)))).reduce((a, b) => a + b, 0),
|
|
72
|
+
rules: await countFiles(paths?.rules, false, true),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=use-owned-counts.js.map
|