@aiwg/cli 2026.10.19 → 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/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/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 +44 -99
- package/dist/src/cli/services/deployment-verification.js +2 -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/providers/deployment-ownership.mjs +15 -1
- 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 +4 -2
- package/dist/src/providers/flue-package-mode.js +19 -0
- package/dist/src/providers/skill-ownership.mjs +1 -0
- package/dist/src/research/reference-match.js +4 -0
- package/package.json +2 -1
- package/tools/agents/deploy-agents.mjs +6 -1
- package/tools/agents/deploy-options.mjs +2 -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 +45 -6
- 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 +36 -18
- package/tools/agents/providers/flue-validation.mjs +14 -0
- package/tools/agents/providers/flue.mjs +12 -8
- package/tools/agents/providers/hermes-skill-lifecycle.mjs +1 -0
- package/tools/agents/providers/rule-delivery-surface.mjs +15 -1
- package/tools/agents/providers/rule-deployment-commit.mjs +14 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +4 -0
- package/tools/agents/providers/skill-copy-prune.mjs +49 -0
- package/tools/agents/providers/stale-artifact-prune.mjs +1 -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
package/README.md
CHANGED
|
@@ -225,6 +225,7 @@ AIWG publishes three packages in exact CalVer lockstep:
|
|
|
225
225
|
| `@aiwg/cli` | Agentic runtimes, web-connected sessions, CI, and lightweight global use | Signed release host by default | `npm i -g @aiwg/cli` |
|
|
226
226
|
| `aiwg` | Full local operation, framework deployment, authoring, offline-first projects | Bundled local corpus by default; web mode optional | `npm i -g aiwg` |
|
|
227
227
|
| `@aiwg/cockpit` | Optional local control plane and operator UI | Installed separately or through the full CLI | `npm i -g @aiwg/cockpit` |
|
|
228
|
+
| `@aiwg/flue` | Flue app skills, specialists and MCP helpers | Installed in a Flue app | `npm install @aiwg/flue` |
|
|
228
229
|
|
|
229
230
|
Choose `@aiwg/cli` when AIWG skills and agents need a small, globally available
|
|
230
231
|
execution layer and can obtain resources from the signed web release. Choose
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Edit bundle intent without touching provider payloads.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { emptyConfig, getProjectDir, readAiwgConfig, writeAiwgConfig, ensureProviderListed } from '../../config/aiwg-config.js';
|
|
5
|
+
import { getFrameworkRoot } from '../../channel/manager.mjs';
|
|
6
|
+
import { REGISTRY_ID_TO_USE_NAME } from '../../config/framework-aliases.js';
|
|
7
|
+
import { getProviderArtifactPathStrings } from '../../providers/provider-definitions.js';
|
|
8
|
+
import { firstRemovePositional, parseRemoveProvider } from './remove-options.js';
|
|
9
|
+
import { validateInstalled } from '../../config/installed-validation.js';
|
|
10
|
+
export async function declareBundle(ctx, remove = false) {
|
|
11
|
+
try {
|
|
12
|
+
const id = firstRemovePositional(ctx.args);
|
|
13
|
+
const { provider, error } = parseRemoveProvider(ctx.args);
|
|
14
|
+
if (!id || !provider || error)
|
|
15
|
+
return { exitCode: 2, message: error || '--declare requires a bundle and explicit --provider.' };
|
|
16
|
+
if (ctx.args.includes('--user') || ctx.args.includes('--global') || ctx.args[ctx.args.indexOf('--scope') + 1] === 'user') {
|
|
17
|
+
return { exitCode: 2, message: '--declare supports project scope only.' };
|
|
18
|
+
}
|
|
19
|
+
if (!getProviderArtifactPathStrings(provider))
|
|
20
|
+
return { exitCode: 2, message: `Unknown provider '${provider}'.` };
|
|
21
|
+
const project = getProjectDir(ctx, ctx.args);
|
|
22
|
+
const config = await readAiwgConfig(project) ?? emptyConfig([provider]);
|
|
23
|
+
const name = REGISTRY_ID_TO_USE_NAME[id] ?? id;
|
|
24
|
+
if (!remove && name !== 'all') {
|
|
25
|
+
const root = ctx.frameworkRoot || await getFrameworkRoot();
|
|
26
|
+
const exists = ['frameworks', 'addons', 'extensions'].some(group => fs.existsSync(path.join(root, 'agentic/code', group, id, 'manifest.json')) ||
|
|
27
|
+
Object.entries(REGISTRY_ID_TO_USE_NAME).some(([dir, alias]) => alias === name && fs.existsSync(path.join(root, 'agentic/code', group, dir, 'manifest.json'))) ||
|
|
28
|
+
fs.existsSync(path.join(project, '.aiwg', group, id, 'manifest.json')));
|
|
29
|
+
if (!exists)
|
|
30
|
+
return { exitCode: 2, message: `Unknown bundle '${id}'.` };
|
|
31
|
+
}
|
|
32
|
+
const key = Object.keys(config.installed).find(key => (REGISTRY_ID_TO_USE_NAME[key] ?? key) === name) ?? name;
|
|
33
|
+
if (remove) {
|
|
34
|
+
delete config.installed[key]?.deployedTo[provider];
|
|
35
|
+
if (config.installed[key] && !Object.keys(config.installed[key].deployedTo).length)
|
|
36
|
+
delete config.installed[key];
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
config.installed[key] ??= { deployedTo: {} };
|
|
40
|
+
config.installed[key].deployedTo[provider] = ctx.args.includes('--copy-all') || ctx.args.includes('--copy-standard-skills') ? { copy: true } : {};
|
|
41
|
+
if (provider === 'flue' && ctx.args.includes('--package'))
|
|
42
|
+
config.installed[key].deployedTo[provider].package = true;
|
|
43
|
+
validateInstalled({ [key]: { deployedTo: { [provider]: config.installed[key].deployedTo[provider] } } });
|
|
44
|
+
ensureProviderListed(config, provider);
|
|
45
|
+
}
|
|
46
|
+
const dryRun = ctx.args.includes('--dry-run');
|
|
47
|
+
if (!dryRun)
|
|
48
|
+
await writeAiwgConfig(project, config);
|
|
49
|
+
return { exitCode: 0, message: `${dryRun ? 'Would ' : ''}${remove ? 'Undeclared' : 'Declared'} ${name} for ${provider}.` };
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return { exitCode: 1, message: String(error) };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=bundle-declaration.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Retain per-provider deployment intent in the existing project ownership receipt.
|
|
2
|
+
import { writeContextFileSync } from '../../smiths/context-pipeline/context-file-safety.js';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { readAiwgConfig } from '../../config/aiwg-config.js';
|
|
6
|
+
import { frameworkRegistryId } from '../../config/framework-aliases.js';
|
|
7
|
+
const receiptPath = (project) => path.join(project, '.aiwg/.aiwg-manifest.json');
|
|
8
|
+
export function bundleDeploymentHistory(project) {
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(fs.readFileSync(receiptPath(project), 'utf8')).bundleDeployments ?? {};
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error.code === 'ENOENT')
|
|
14
|
+
return {};
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function bundleCopyArgs(installed, id, provider) {
|
|
19
|
+
const entry = Object.entries(installed).find(([key]) => frameworkRegistryId(key) === frameworkRegistryId(id))?.[1];
|
|
20
|
+
const flags = entry?.deployedTo[provider];
|
|
21
|
+
return [...(flags?.copy === true ? ['--copy-all'] : []), ...(flags?.skipUtils === true ? ['--no-utils'] : []),
|
|
22
|
+
...(provider === 'flue' && flags?.package === true ? ['--package'] : [])];
|
|
23
|
+
}
|
|
24
|
+
export async function recordBundleDeployment(project, id, provider, args, frameworkRoot) {
|
|
25
|
+
const { expectedBundleOwners } = await import('./bundle-reconciliation.js');
|
|
26
|
+
const { getFrameworkRoot } = await import('../../channel/manager.mjs');
|
|
27
|
+
const flags = bundleDeploymentScope(id, provider, args);
|
|
28
|
+
const selected = { installed: { [id]: { deployedTo: { [provider]: flags } } } };
|
|
29
|
+
const produces = [...await expectedBundleOwners(selected, provider, frameworkRoot ?? await getFrameworkRoot())].sort();
|
|
30
|
+
const file = receiptPath(project);
|
|
31
|
+
const receipt = fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, 'utf8')) : { scope: 'project', managed: {} };
|
|
32
|
+
receipt.bundleDeployments ??= {};
|
|
33
|
+
receipt.bundleDeployments[provider] ??= {};
|
|
34
|
+
receipt.bundleDeployments[provider][frameworkRegistryId(id)] = { copy: args.includes('--copy-all') || args.includes('--copy-standard-skills'), ...flags, ...(provider === 'flue' ? { package: args.includes('--package') } : {}), produces };
|
|
35
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
36
|
+
writeContextFileSync(file, `${JSON.stringify(receipt, null, 2)}\n`);
|
|
37
|
+
}
|
|
38
|
+
// Once index-mode removal completes, later additive passes own any new surface.
|
|
39
|
+
export function markBundleReconciled(project, id, provider) {
|
|
40
|
+
const file = receiptPath(project);
|
|
41
|
+
if (!fs.existsSync(file))
|
|
42
|
+
return;
|
|
43
|
+
const receipt = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
44
|
+
if (!receipt.bundleDeployments?.[provider]?.[frameworkRegistryId(id)])
|
|
45
|
+
return;
|
|
46
|
+
receipt.bundleDeployments[provider][frameworkRegistryId(id)].reconciled = true;
|
|
47
|
+
writeContextFileSync(file, `${JSON.stringify(receipt, null, 2)}\n`);
|
|
48
|
+
}
|
|
49
|
+
// Local/support bundles copy physically in index mode too; only operator flags prohibit cleanup.
|
|
50
|
+
export function copyCleanupArgs(args) {
|
|
51
|
+
return args.includes('--copy-all') || args.includes('--copy-standard-skills') ? [] : ['--index-mode'];
|
|
52
|
+
}
|
|
53
|
+
// Framework passes retain a separately declared local bundle's provider mode.
|
|
54
|
+
export async function projectLocalDeploymentContext(ctx, project, id, provider, explicit) {
|
|
55
|
+
if (explicit)
|
|
56
|
+
return ctx;
|
|
57
|
+
const installed = (await readAiwgConfig(project))?.installed;
|
|
58
|
+
if (!installed?.[id]?.deployedTo[provider])
|
|
59
|
+
return ctx;
|
|
60
|
+
return { ...ctx, args: [...ctx.args.filter(arg => !['--copy-all', '--copy-standard-skills'].includes(arg)), ...bundleCopyArgs(installed, id, provider)] };
|
|
61
|
+
}
|
|
62
|
+
export function projectLocalCopyMode(config, id, provider, args, explicit) {
|
|
63
|
+
const requested = args.includes('--copy-all') || args.includes('--copy-standard-skills');
|
|
64
|
+
return explicit ? requested : config.installed[id]?.deployedTo[provider]?.copy ?? requested;
|
|
65
|
+
}
|
|
66
|
+
// Match the effective framework gates used by the deployment pass.
|
|
67
|
+
export function bundleDeploymentScope(id, provider, args) {
|
|
68
|
+
return { skipUtils: args.includes('--no-utils'), kernelOnly: id === 'all' && !['pi', 'omp'].includes(provider)
|
|
69
|
+
&& !args.includes('--copy-all') && !args.includes('--copy-standard-skills') };
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=bundle-deployment-mode.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Reuse project-local removal when historical provider hashes outlive its declaration.
|
|
2
|
+
import { frameworkRegistryId } from '../../config/framework-aliases.js';
|
|
3
|
+
import { bundleDeploymentHistory } from './bundle-deployment-mode.js';
|
|
4
|
+
import { getProviderArtifactPathStrings } from '../../providers/provider-definitions.js';
|
|
5
|
+
import { deployedSkillRoots } from '../../providers/deployed-skill-roots.js';
|
|
6
|
+
import { removeProjectLocalBundle } from '../../extensions/project-local-remove.js';
|
|
7
|
+
export async function pruneUndeclaredHashes(project, config, requested, dryRun) {
|
|
8
|
+
const handled = new Set();
|
|
9
|
+
for (const [id, entry] of Object.entries(config.installed)) {
|
|
10
|
+
if (entry.source !== 'project-local')
|
|
11
|
+
continue;
|
|
12
|
+
const historicalProviders = new Set([...Object.keys(entry.deployedArtifactHashes ?? {}), ...(Object.keys(entry.artifactHashes ?? {}).length ? config.providers ?? [] : [])]);
|
|
13
|
+
for (const provider of historicalProviders) {
|
|
14
|
+
if (!getProviderArtifactPathStrings(provider))
|
|
15
|
+
continue;
|
|
16
|
+
if (entry.deployedTo[provider] || requested && !requested.split(',').includes(provider))
|
|
17
|
+
continue;
|
|
18
|
+
const mode = bundleDeploymentHistory(project)[provider]?.[frameworkRegistryId(id)];
|
|
19
|
+
if (mode?.copy || mode?.package) {
|
|
20
|
+
console.log(`${id} for ${provider}: kept (${mode?.copy ? 'copy' : 'package'} mode); run \`aiwg remove ${id}\` to delete`);
|
|
21
|
+
handled.add(`${provider}:${id}`);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const others = Object.keys(entry.deployedTo).filter(other => other !== provider);
|
|
25
|
+
const preserveRoots = deployedSkillRoots(project, provider).filter(root => others.some(other => deployedSkillRoots(project, other).includes(root)));
|
|
26
|
+
const historical = structuredClone(config);
|
|
27
|
+
historical.installed[id].deployedTo[provider] = {};
|
|
28
|
+
console.log(`${dryRun ? 'Would remove' : 'Removing'} ${id} for ${provider} (recorded hashes)`);
|
|
29
|
+
const result = await removeProjectLocalBundle(historical, project, id, { provider, dryRun, keepRegistry: true, preserveRoots });
|
|
30
|
+
for (const outcome of result.outcomes)
|
|
31
|
+
console.log(` ${outcome.deployedAbsPath}: ${outcome.message}`);
|
|
32
|
+
handled.add(`${provider}:${id}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return handled;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=bundle-hash-prune.js.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Reconcile provider bundle declarations through the existing receipt removal path.
|
|
2
|
+
import { providerCopyMode } from '../../providers/deployment-preservation.mjs';
|
|
3
|
+
import { bundleDeploymentHistory, markBundleReconciled } from './bundle-deployment-mode.js';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { readAiwgConfig } from '../../config/aiwg-config.js';
|
|
7
|
+
import { REGISTRY_ID_TO_USE_NAME, frameworkRegistryId } from '../../config/framework-aliases.js';
|
|
8
|
+
import { getProviderArtifactPathStrings, PROVIDER_IDS } from '../../providers/provider-definitions.js';
|
|
9
|
+
import { deployedSkillRoots } from '../../providers/deployed-skill-roots.js';
|
|
10
|
+
import { pruneUndeclaredHashes } from './bundle-hash-prune.js';
|
|
11
|
+
import { removeBundledDeployment } from './remove-bundled.js';
|
|
12
|
+
import { frameworkAdditiveBundles } from './use-additive-bundles.js';
|
|
13
|
+
import { getFrameworkRoot } from '../../channel/manager.mjs';
|
|
14
|
+
export const bundleUseName = (id) => REGISTRY_ID_TO_USE_NAME[id] ?? id;
|
|
15
|
+
export function bundleProviders(installed, id, requested) {
|
|
16
|
+
const entry = Object.entries(installed).find(([key]) => frameworkRegistryId(key) === frameworkRegistryId(id))?.[1];
|
|
17
|
+
return Object.keys(entry?.deployedTo ?? {}).filter(provider => !requested || requested.split(',').includes(provider));
|
|
18
|
+
}
|
|
19
|
+
export async function expectedBundleOwners(config, provider, frameworkRoot) {
|
|
20
|
+
const selected = Object.keys(config.installed).filter(id => bundleProviders(config.installed, id, provider).length);
|
|
21
|
+
const expected = new Set(selected.map(frameworkRegistryId));
|
|
22
|
+
for (const id of selected) {
|
|
23
|
+
if (!(id === 'all' || fs.existsSync(path.join(frameworkRoot, 'agentic/code/frameworks', frameworkRegistryId(id), 'manifest.json'))
|
|
24
|
+
|| ['writing', 'general'].includes(id)))
|
|
25
|
+
continue;
|
|
26
|
+
const flags = config.installed[id].deployedTo[provider];
|
|
27
|
+
if (id === 'all' && provider !== 'flue' && (flags.skipUtils !== undefined || flags.kernelOnly !== undefined)) {
|
|
28
|
+
expected.delete('all');
|
|
29
|
+
for (const name of fs.readdirSync(path.join(frameworkRoot, 'agentic/code/frameworks'))) {
|
|
30
|
+
if (fs.existsSync(path.join(frameworkRoot, 'agentic/code/frameworks', name, 'manifest.json')))
|
|
31
|
+
expected.add(frameworkRegistryId(name));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Unknown history must retain the broader additive surface.
|
|
35
|
+
const { addons, extensions } = await frameworkAdditiveBundles(frameworkRoot, provider, flags.skipUtils === true, flags.kernelOnly === true);
|
|
36
|
+
for (const owner of [...addons, ...extensions])
|
|
37
|
+
expected.add(frameworkRegistryId(owner));
|
|
38
|
+
}
|
|
39
|
+
if (provider !== 'flue')
|
|
40
|
+
for (const id of selected) {
|
|
41
|
+
const addon = frameworkRegistryId(id);
|
|
42
|
+
if (!fs.existsSync(path.join(frameworkRoot, 'agentic/code/addons', addon, 'manifest.json')))
|
|
43
|
+
continue;
|
|
44
|
+
const { resolveRequiredAddonActivationOrder } = await import('./use.js');
|
|
45
|
+
for (const owner of await resolveRequiredAddonActivationOrder(frameworkRoot, addon))
|
|
46
|
+
expected.add(frameworkRegistryId(owner));
|
|
47
|
+
}
|
|
48
|
+
return expected;
|
|
49
|
+
}
|
|
50
|
+
function receiptOwners(project, provider) {
|
|
51
|
+
const owners = new Set();
|
|
52
|
+
const visit = (file) => {
|
|
53
|
+
const stat = fs.lstatSync(file, { throwIfNoEntry: false });
|
|
54
|
+
if (!stat || stat.isSymbolicLink())
|
|
55
|
+
return;
|
|
56
|
+
if (stat.isDirectory()) {
|
|
57
|
+
for (const name of fs.readdirSync(file))
|
|
58
|
+
visit(path.join(file, name));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (path.basename(file) !== '.aiwg-manifest.json')
|
|
62
|
+
return;
|
|
63
|
+
const receipt = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
64
|
+
for (const record of Object.values(receipt.managed ?? {})) {
|
|
65
|
+
for (const owner of record.owners ?? (record.frameworkSlug ? [record.frameworkSlug] : []))
|
|
66
|
+
owners.add(owner);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const paths = Object.values(getProviderArtifactPathStrings(provider) ?? {}).filter(Boolean);
|
|
70
|
+
// Never follow provider home paths during project reconciliation.
|
|
71
|
+
const roots = paths.filter(dir => !path.isAbsolute(dir) && !dir.startsWith('~')).map(dir => path.join(project, dir.split(/[\\/]/)[0]));
|
|
72
|
+
for (const root of new Set([...roots, ...deployedSkillRoots(project, provider).filter(dir => dir.startsWith(`${project}${path.sep}`))]))
|
|
73
|
+
visit(root);
|
|
74
|
+
// Flue's generated app modules live in the project-scoped receipt.
|
|
75
|
+
if (provider === 'flue')
|
|
76
|
+
visit(path.join(project, '.aiwg/.aiwg-manifest.json'));
|
|
77
|
+
return owners;
|
|
78
|
+
}
|
|
79
|
+
export async function pruneUndeclaredBundles(project, config, requested, dryRun = false, frameworkRoot) {
|
|
80
|
+
if (!config)
|
|
81
|
+
return 0;
|
|
82
|
+
if (requested?.split(',').some(provider => !getProviderArtifactPathStrings(provider))) {
|
|
83
|
+
console.error(`Cannot reconcile unknown provider: ${requested}`);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
const history = bundleDeploymentHistory(project);
|
|
87
|
+
const hashPruned = await pruneUndeclaredHashes(project, config, requested, dryRun);
|
|
88
|
+
let failures = 0;
|
|
89
|
+
const knownProviders = [...new Set([...Object.keys(history), ...(config.providers ?? []), ...Object.values(config.installed).flatMap(entry => Object.keys(entry.deployedTo ?? {})),
|
|
90
|
+
...PROVIDER_IDS.filter(provider => fs.existsSync(path.join(project, `.${provider}`)))])];
|
|
91
|
+
const providers = requested ? requested.split(',') : knownProviders;
|
|
92
|
+
const root = frameworkRoot ?? await getFrameworkRoot();
|
|
93
|
+
const expected = new Map();
|
|
94
|
+
for (const provider of new Set([...knownProviders, ...providers])) {
|
|
95
|
+
if (getProviderArtifactPathStrings(provider))
|
|
96
|
+
expected.set(provider, await expectedBundleOwners(config, provider, root));
|
|
97
|
+
}
|
|
98
|
+
for (const provider of providers) {
|
|
99
|
+
for (const owner of Object.keys(history[provider] ?? {})) {
|
|
100
|
+
if (!history[provider][owner].reconciled && !bundleProviders(config.installed, owner, provider).length)
|
|
101
|
+
expected.get(provider)?.delete(owner);
|
|
102
|
+
}
|
|
103
|
+
if (!getProviderArtifactPathStrings(provider))
|
|
104
|
+
continue;
|
|
105
|
+
const selected = expected.get(provider);
|
|
106
|
+
for (const owner of receiptOwners(project, provider)) {
|
|
107
|
+
if (hashPruned.has(`${provider}:${owner}`) || (selected.has('all') && provider !== 'flue') || selected.has(frameworkRegistryId(owner)))
|
|
108
|
+
continue;
|
|
109
|
+
const implicit = !history[provider]?.[frameworkRegistryId(owner)] && Object.values(history[provider] ?? {}).some(entry => entry.produces?.includes(frameworkRegistryId(owner)) || entry.produces?.includes('*'));
|
|
110
|
+
if (implicit)
|
|
111
|
+
continue;
|
|
112
|
+
if (providerCopyMode(project, provider, owner, config)) {
|
|
113
|
+
console.log(`${bundleUseName(owner)} for ${provider}: kept (copy mode); run \`aiwg remove ${bundleUseName(owner)}\` to delete`);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const otherProviders = [...expected].filter(([other, owners]) => other !== provider
|
|
117
|
+
&& (history[other]?.[frameworkRegistryId(owner)]?.copy || history[other]?.[frameworkRegistryId(owner)]?.package || owners.has(frameworkRegistryId(owner)) || other !== 'flue' && owners.has('all'))).map(([other]) => other);
|
|
118
|
+
const sharedRoots = deployedSkillRoots(project, provider).filter(root => otherProviders.some(other => deployedSkillRoots(project, other).includes(root)));
|
|
119
|
+
console.log(`${dryRun ? 'Would remove' : 'Removing'} ${bundleUseName(owner)} for ${provider}`);
|
|
120
|
+
// A temporary historical record supplies context for the public per-bundle
|
|
121
|
+
// remover. --keep-registry leaves the operator's declaration byte-for-byte.
|
|
122
|
+
const historical = structuredClone(config);
|
|
123
|
+
historical.installed[owner] = { deployedTo: { [provider]: { agents: 0, commands: 0, skills: 0, rules: 0 } } };
|
|
124
|
+
const result = await removeBundledDeployment(project, owner, owner, historical, [provider], { dryRun, keepRegistry: true, preserveRoots: sharedRoots, includeProject: !otherProviders.length });
|
|
125
|
+
if (result.message)
|
|
126
|
+
console.log(result.message);
|
|
127
|
+
if (result.exitCode)
|
|
128
|
+
failures++;
|
|
129
|
+
else if (!dryRun)
|
|
130
|
+
markBundleReconciled(project, owner, provider);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return failures;
|
|
134
|
+
}
|
|
135
|
+
// Root collectors can recreate additive copies; enforce a recorded restricted scope last.
|
|
136
|
+
export async function pruneAfterScopedDeployments(project, config, requested, frameworkRoot) {
|
|
137
|
+
const restricted = Object.values(config?.installed ?? {}).some(entry => Object.entries(entry.deployedTo).some(([provider, flags]) => (!requested || requested.split(',').includes(provider)) && (flags.skipUtils === true || flags.kernelOnly === true)));
|
|
138
|
+
return restricted ? pruneUndeclaredBundles(project, await readAiwgConfig(project), requested, false, frameworkRoot) : 0;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=bundle-reconciliation.js.map
|
|
@@ -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
|
}
|