@aiwg/cli 2026.10.19 → 2026.11.1
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/flue/README.md +2 -1
- package/dist/src/artifacts/cli.js +3 -2
- package/dist/src/artifacts/discover-facets.js +2 -0
- package/dist/src/artifacts/discover-session-facets.js +14 -0
- package/dist/src/artifacts/fortemi-core-query-adapter.js +4 -4
- package/dist/src/artifacts/framework-capabilities.js +7 -3
- package/dist/src/artifacts/index-builder.js +2 -3
- package/dist/src/artifacts/query-engine-discover-output.js +3 -3
- package/dist/src/artifacts/query-engine-discover.js +61 -14
- package/dist/src/artifacts/query-engine-entries.js +52 -9
- package/dist/src/artifacts/query-engine-installation.js +27 -0
- package/dist/src/artifacts/query-engine-rules.js +1 -2
- package/dist/src/artifacts/query-engine-scoring.js +33 -31
- package/dist/src/artifacts/query-engine-show-card.js +6 -2
- package/dist/src/artifacts/query-engine-show.js +2 -2
- package/dist/src/artifacts/relations.js +17 -10
- 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/checkpoint.js +143 -0
- package/dist/src/cli/handlers/help.js +1 -0
- package/dist/src/cli/handlers/index.js +4 -2
- package/dist/src/cli/handlers/models-resource-sample.js +7 -3
- package/dist/src/cli/handlers/ralph-launcher.js +1 -1
- 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 +12 -1
- package/dist/src/cli/handlers/steward-signing.js +44 -0
- package/dist/src/cli/handlers/steward.js +5 -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-provider-results.js +17 -0
- package/dist/src/cli/handlers/use.js +53 -114
- package/dist/src/cli/router.js +12 -2
- package/dist/src/cli/services/deployment-verification.js +2 -1
- package/dist/src/cli/user-scope-mirror.js +3 -1
- package/dist/src/config/aiwg-config.js +15 -6
- package/dist/src/config/cli.js +1 -0
- package/dist/src/config/delivery-validation.js +21 -0
- package/dist/src/config/framework-aliases.js +14 -0
- package/dist/src/config/host-resource-report.d.mts +1 -1
- package/dist/src/config/host-resource-report.mjs +23 -4
- package/dist/src/config/host-resource-runtime.d.mts +8 -0
- package/dist/src/config/host-resource-runtime.mjs +67 -24
- package/dist/src/config/index-graph-overrides.js +4 -0
- package/dist/src/config/installed-selection.js +9 -1
- package/dist/src/config/installed-validation.js +35 -0
- package/dist/src/config/worker-attribution.d.mts +7 -0
- package/dist/src/config/worker-attribution.mjs +44 -0
- package/dist/src/delivery/git.js +62 -0
- package/dist/src/delivery/pr.js +149 -0
- package/dist/src/delivery/tracker.js +33 -0
- package/dist/src/discovery/interview.js +1 -1
- package/dist/src/extensions/claude-hooks-installer.js +1 -0
- package/dist/src/extensions/loader.js +2 -1
- package/dist/src/extensions/project-local-doctor.js +1 -1
- package/dist/src/extensions/project-local-remove.js +3 -3
- package/dist/src/issues/cli.js +12 -3
- package/dist/src/issues/external-cli.js +76 -0
- package/dist/src/issues/live.js +18 -1
- package/dist/src/issues/tracker-policy.js +17 -0
- 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/mcp/tools/worker-invoke.mjs +2 -1
- package/dist/src/mcp/tools/worker-stdin-runtime.mjs +12 -0
- package/dist/src/models/conductor-data-policy.d.mts +3 -2
- package/dist/src/models/conductor-data-policy.mjs +94 -5
- package/dist/src/models/worker-plan.js +3 -3
- package/dist/src/models/worker-selection-policy.js +2 -1
- package/dist/src/providers/deployment-lock.js +77 -0
- package/dist/src/providers/deployment-ownership.d.mts +12 -2
- package/dist/src/providers/deployment-ownership.mjs +127 -19
- package/dist/src/providers/deployment-preservation.d.mts +6 -0
- package/dist/src/providers/deployment-preservation.mjs +113 -0
- package/dist/src/providers/deployment-removal.js +4 -2
- package/dist/src/providers/flue-package-mode.js +19 -0
- package/dist/src/providers/provider-definitions.js +4 -0
- package/dist/src/providers/skill-ownership.mjs +1 -0
- package/dist/src/research/reference-match.js +4 -0
- package/dist/src/serve/worker-invocation-preparation.js +3 -1
- package/dist/src/serve/worker-invocation.js +2 -0
- package/dist/src/skills/run.js +5 -0
- package/dist/src/smiths/hook-bridge/codex-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/hermes-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +6 -0
- package/package.json +5 -2
- package/schemas/models/model-config-compatibility.v1.schema.json +4 -0
- package/tools/agents/deploy-agents.mjs +21 -1
- package/tools/agents/deploy-options.mjs +2 -0
- package/tools/agents/providers/base-contract.mjs +7 -1
- package/tools/agents/providers/base-inventory.mjs +41 -14
- 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/base.mjs +1 -1
- package/tools/agents/providers/claude.mjs +2 -1
- package/tools/agents/providers/codex.mjs +5 -1
- package/tools/agents/providers/conductor-data-guard.mjs +35 -11
- 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/muse-hooks.mjs +4 -0
- package/tools/agents/providers/muse-prompt-discovery.mjs +22 -0
- package/tools/agents/providers/provider-prepare-coordinator.mjs +15 -10
- package/tools/agents/providers/rule-delivery-surface.mjs +18 -1
- package/tools/agents/providers/rule-deployment-commit.mjs +24 -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 +10 -8
- package/tools/ralph-external/lib/worker-capture.mjs +157 -0
- package/tools/ralph-external/lib/worker-health.mjs +3 -0
- package/tools/ralph-external/lib/worker-invocation-processes.mjs +9 -6
- package/tools/ralph-external/lib/worker-launch-cli.mjs +10 -1
- package/tools/ralph-external/lib/worker-process-identity.mjs +30 -0
- package/tools/ralph-external/lib/worker-retry-evidence.mjs +87 -6
- package/tools/ralph-external/lib/worker-termination.mjs +56 -6
- package/tools/ralph-external/process-monitor.mjs +12 -18
- package/tools/ralph-external/session-launcher.mjs +43 -29
- 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 +59 -19
|
@@ -1,44 +1,57 @@
|
|
|
1
|
-
// Generate the
|
|
1
|
+
// Generate the selected Flue delegates from canonical agents and shared rule transforms.
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import {
|
|
5
|
+
import { camel, flueBundleInventory, selectedFlueBundles } from './flue-bundles.mjs';
|
|
6
|
+
import { generateFlueSkills } from './flue-skills.mjs';
|
|
6
7
|
import { parseFrontmatter } from './base-frontmatter.mjs';
|
|
7
8
|
import { injectBoundRules } from './base-contract.mjs';
|
|
8
9
|
import { claimRecordedFile } from './flue-project.mjs';
|
|
10
|
+
import { cloudflareTools } from './flue-cloudflare.mjs';
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
function specialists(bundles) {
|
|
13
|
+
return [...new Map(bundles.flatMap(bundle => (bundle.manifest.flue?.specialists || []).map(name =>
|
|
14
|
+
[name, { name, exportName: camel(name), file: `${name}.md`, root: bundle.root }]))).values()];
|
|
15
|
+
}
|
|
16
|
+
export const FLUE_SPECIALISTS = Object.freeze(specialists(flueBundleInventory({ srcRoot: fileURLToPath(new URL('../../../', import.meta.url)) }))
|
|
17
|
+
.map(({ root: _root, ...entry }) => Object.freeze(entry)));
|
|
14
18
|
|
|
15
19
|
export function generateFlueSpecialists(opts) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const definitions =
|
|
19
|
-
const logical = path.join(
|
|
20
|
+
const cloudflare = opts.flueTarget === 'cloudflare';
|
|
21
|
+
const selected = specialists(selectedFlueBundles(opts));
|
|
22
|
+
const definitions = selected.map(specialist => {
|
|
23
|
+
const logical = path.join(specialist.root, 'agents', specialist.file);
|
|
20
24
|
const file = opts.mapInputPath?.(logical) || logical;
|
|
21
25
|
const { body, metadata } = parseFrontmatter(injectBoundRules(fs.readFileSync(file, 'utf8'), file, opts));
|
|
26
|
+
if (opts.packageOutput) return `export function ${specialist.exportName}(options) {
|
|
27
|
+
return createSpecialist({ name: ${JSON.stringify(specialist.name)}, description: ${JSON.stringify(metadata.description || metadata.name)}, agent() { return ${JSON.stringify(body.trim())}; } }, options);
|
|
28
|
+
}`;
|
|
22
29
|
return `export const ${specialist.exportName} = defineSubagent({
|
|
23
30
|
name: ${JSON.stringify(specialist.name)},
|
|
24
31
|
description: ${JSON.stringify(metadata.description || metadata.name)},
|
|
25
32
|
agent() {
|
|
26
|
-
useTool(aiwg_discover);
|
|
33
|
+
${cloudflare ? '' : `useTool(aiwg_discover);
|
|
27
34
|
useTool(aiwg_show);
|
|
28
|
-
useTool(aiwg_artifact_write)
|
|
35
|
+
useTool(aiwg_artifact_write);`}
|
|
29
36
|
return ${JSON.stringify(body.trim())};
|
|
30
37
|
},
|
|
31
38
|
});`;
|
|
32
39
|
});
|
|
40
|
+
if (opts.packageOutput) {
|
|
41
|
+
const bundles = selectedFlueBundles(opts);
|
|
42
|
+
const groups = bundles.map(bundle => ({ name: `${camel(bundle.id === 'sdlc-complete' ? 'sdlc' : bundle.id)}Specialists`, members: specialists([bundle]) }));
|
|
43
|
+
if (opts.declarations) return `import type { SubagentDefinition, McpConnectionDefinition } from '@flue/runtime';\nimport type { SpecialistOptions } from './specialist-binding.js';\nexport type { SpecialistOptions } from './specialist-binding.js';\nexport declare function bindRemoteSpecialist(definition: SubagentDefinition, connection: McpConnectionDefinition): SubagentDefinition;\n${selected.map(s => `export declare function ${s.exportName}(options?: SpecialistOptions): SubagentDefinition;`).join('\n')}\n${groups.map(g => `export declare function ${g.name}(options?: SpecialistOptions): SubagentDefinition[];`).join('\n')}\n`;
|
|
44
|
+
return `import { createSpecialist } from './specialist-binding.js';\nexport { bindRemoteSpecialist } from './remote-specialist.js';\n${definitions.join('\n\n')}\n${groups.map(g => `export function ${g.name}(options) { return [${g.members.map(s => `${s.exportName}(options)`).join(', ')}]; }`).join('\n')}\n`;
|
|
45
|
+
}
|
|
33
46
|
return `// Curated AIWG delegates; regenerate from canonical sdlc-complete agents.
|
|
34
|
-
import { defineSubagent, useSubagent, useTool } from '@flue/runtime';
|
|
35
|
-
import { aiwg_discover, aiwg_show, aiwg_artifact_write } from './tools.ts';
|
|
47
|
+
import { defineSubagent, useSubagent${cloudflare ? '' : ', useTool'} } from '@flue/runtime';
|
|
48
|
+
import { ${cloudflare ? 'aiwgConnection, bindRemoteSpecialist' : 'aiwg_discover, aiwg_show, aiwg_artifact_write'} } from './tools.ts';
|
|
36
49
|
|
|
37
50
|
${definitions.join('\n\n')}
|
|
38
51
|
|
|
39
52
|
/** Trusted app options: omit pins to inherit the app model and effort. */
|
|
40
|
-
export function useAiwgSpecialists(pins: {
|
|
41
|
-
${
|
|
53
|
+
export function useAiwgSpecialists(pins: { ${selected.map(({ exportName }) => `${exportName}?: string`).join('; ')} } = {}) {
|
|
54
|
+
${selected.map(({ exportName }) => ` useSubagent(${cloudflare ? 'bindRemoteSpecialist(' : ''}pins.${exportName} === undefined ? ${exportName} : { ...${exportName}, model: pins.${exportName} }${cloudflare ? ', aiwgConnection())' : ''});`).join('\n')}
|
|
42
55
|
}
|
|
43
56
|
`;
|
|
44
57
|
}
|
|
@@ -49,7 +62,7 @@ export function deployFlueSpecialists(target, opts) {
|
|
|
49
62
|
const file = path.join(target, relative);
|
|
50
63
|
if (fs.lstatSync(file, { throwIfNoEntry: false })) {
|
|
51
64
|
if (!claimRecordedFile(target, file, opts)) {
|
|
52
|
-
console.warn(`Flue (experimental): keeping existing module ${opts.logicalOutputPath?.(file) || file}
|
|
65
|
+
console.warn(`Flue (experimental): keeping existing module ${opts.logicalOutputPath?.(file) || file}; remove this file manually and redeploy to generate it for the current target.`);
|
|
53
66
|
return;
|
|
54
67
|
}
|
|
55
68
|
}
|
|
@@ -59,6 +72,11 @@ export function deployFlueSpecialists(target, opts) {
|
|
|
59
72
|
}
|
|
60
73
|
};
|
|
61
74
|
const template = fileURLToPath(new URL('../../../agentic/code/providers/flue/templates/aiwg/tools.ts', import.meta.url));
|
|
62
|
-
|
|
75
|
+
if (opts.flueTarget === 'cloudflare' && !opts.fluePackage) {
|
|
76
|
+
for (const ext of ['js', 'd.ts']) write(`src/aiwg/remote-specialist.${ext}`, () =>
|
|
77
|
+
fs.readFileSync(new URL(`../../../packages/flue/remote-specialist.${ext}`, import.meta.url), 'utf8'));
|
|
78
|
+
}
|
|
79
|
+
write('src/aiwg/tools.ts', () => opts.flueTarget === 'cloudflare' ? cloudflareTools(opts) : opts.fluePackage ? "export * from '@aiwg/flue/tools/node';\n" : fs.readFileSync(opts.mapInputPath?.(template) || template, 'utf8'));
|
|
63
80
|
write('src/aiwg/specialists.ts', () => generateFlueSpecialists(opts));
|
|
81
|
+
write('src/aiwg/skills.ts', () => generateFlueSkills(target, opts));
|
|
64
82
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Validate the static skill contract shared by package builds and deployments.
|
|
2
|
+
import { parse } from 'yaml';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export function validateFlueSkill(content, file) {
|
|
5
|
+
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
6
|
+
let metadata;
|
|
7
|
+
try { metadata = frontmatter && parse(frontmatter[1]); }
|
|
8
|
+
catch (error) { throw new Error(`${file}: invalid Flue frontmatter: ${error.message}`); }
|
|
9
|
+
if (metadata?.name !== path.basename(path.dirname(file))) throw new Error(`${file}: Flue skill name must equal its directory`);
|
|
10
|
+
if (typeof metadata.description !== 'string' || metadata.description.length < 1 || metadata.description.length > 1024) {
|
|
11
|
+
throw new Error(`${file}: Flue skill description must contain 1-1024 characters`);
|
|
12
|
+
}
|
|
13
|
+
return metadata;
|
|
14
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Deploy the experimental Flue app target through shared skills and context owners.
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
4
|
-
import { collectFrameworkArtifacts,
|
|
4
|
+
import { collectFrameworkArtifacts, listSkillDirs, getAddonSkillDirs,
|
|
5
5
|
isKernelSkill, normalizeDeploymentMode, withRuleDeployment } from './base.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { deployFlueSkill } from './flue-skill-copy.mjs';
|
|
7
|
+
import { flueDeploymentFiles, deployFlueDatabase, detectFlueTarget, retireFlueTargetFiles } from './flue-project.mjs';
|
|
7
8
|
import { deployFlueSpecialists } from './flue-specialists.mjs';
|
|
8
9
|
export { FLUE_SPECIALISTS } from './flue-specialists.mjs';
|
|
9
10
|
const { generate } = await importImpl(import.meta.url, 'smiths/context-pipeline/generator.js');
|
|
@@ -22,13 +23,15 @@ export const deployCommands = () => 0;
|
|
|
22
23
|
export const deployRules = () => 0;
|
|
23
24
|
|
|
24
25
|
export function deploySkills(skillDirs, target, opts) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
if (opts.fluePackage) return { kernel: 0, standard: 0 };
|
|
27
|
+
const destination = path.join(target, kernelSkillsPath);
|
|
28
|
+
for (const dir of skillDirs) deployFlueSkill(dir, destination, opts);
|
|
29
|
+
return { kernel: skillDirs.length, standard: 0 };
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export async function postDeploy(target, opts) {
|
|
33
|
+
opts = { ...opts, flueTarget: detectFlueTarget(target, { warn: true }) };
|
|
34
|
+
retireFlueTargetFiles(target, opts);
|
|
32
35
|
deployFlueDatabase(target, opts);
|
|
33
36
|
deployFlueSpecialists(target, opts);
|
|
34
37
|
if (opts.contextFiles !== false) await generate({ provider: name, projectPath: target, sections: [], detectExistingFiles: true });
|
|
@@ -38,9 +41,10 @@ export async function deploy(opts) {
|
|
|
38
41
|
if (opts.userScope) throw new Error('Flue (experimental) supports project scope only.');
|
|
39
42
|
return withRuleDeployment({ ...opts, provider: name }, provider, async staged => {
|
|
40
43
|
const mode = normalizeDeploymentMode(staged.mode);
|
|
41
|
-
const
|
|
44
|
+
const invoked = listSkillDirs(path.join(staged.srcRoot, 'skills'));
|
|
45
|
+
const skills = [...invoked, ...(mode === 'all' ? getAddonSkillDirs(staged.srcRoot) : []),
|
|
42
46
|
...collectFrameworkArtifacts(staged.srcRoot, mode, { includeAgents: false, includeCommands: false, includeSkills: true, includeRules: false }).skills];
|
|
43
|
-
const count = deploySkills(skills, staged.target, staged);
|
|
47
|
+
const count = deploySkills(mode === 'all' && !invoked.length ? skills.filter(isKernelSkill) : skills, staged.target, staged);
|
|
44
48
|
await postDeploy(staged.target, staged);
|
|
45
49
|
return count.kernel;
|
|
46
50
|
});
|
|
@@ -81,6 +81,7 @@ function updateBundledManifest(kernelSkillNames, opts) {
|
|
|
81
81
|
* directories under ~/.hermes/
|
|
82
82
|
*/
|
|
83
83
|
function migrateLegacySkillPath(opts) {
|
|
84
|
+
if (opts.copyMode ?? opts.copyStandardSkills) return;
|
|
84
85
|
const { dryRun, quiet } = opts;
|
|
85
86
|
// Resolve through the same HERMES_HOME contract as every other path in
|
|
86
87
|
// this provider (env var first, platform default otherwise): with
|
|
@@ -54,6 +54,7 @@ import path from 'node:path';
|
|
|
54
54
|
import { randomUUID } from 'node:crypto';
|
|
55
55
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
56
56
|
import { stripJsonComments } from './base.mjs';
|
|
57
|
+
import { promptDiscoveryHook, deployPromptDiscovery } from './muse-prompt-discovery.mjs';
|
|
57
58
|
import { resolveMuseXdgSkillsDir, museXdgSkillsDirRemediation } from './muse-paths.mjs';
|
|
58
59
|
|
|
59
60
|
const { assertConfigDestination, writeConfigAtomic, writeConfigTransaction } = await importImpl(import.meta.url, 'mcp/config-file.mjs');
|
|
@@ -219,6 +220,7 @@ export const AIWG_MANAGED_HOOKS = [
|
|
|
219
220
|
'`aiwg refresh --dry-run --quiet --provider muse > /dev/null`), or run `aiwg use --provider muse --no-hooks` ' +
|
|
220
221
|
'to stop AIWG managing hooks for this project.',
|
|
221
222
|
},
|
|
223
|
+
promptDiscoveryHook,
|
|
222
224
|
];
|
|
223
225
|
|
|
224
226
|
/** Canonical group payloads keyed by hook id, for merge/prune identity. */
|
|
@@ -444,6 +446,8 @@ export function deployMuseHooks(targetDir, opts = {}) {
|
|
|
444
446
|
return { hooksPath, changed, plan, wrote: false };
|
|
445
447
|
}
|
|
446
448
|
|
|
449
|
+
assertMuseDirNotSymlink(path.dirname(hooksPath));
|
|
450
|
+
deployPromptDiscovery(targetDir);
|
|
447
451
|
if (!changed) {
|
|
448
452
|
log(`Muse hooks: ${hooksPath} already current; nothing to do.`);
|
|
449
453
|
return { hooksPath, changed: false, plan: [], wrote: false };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Deploy the shared prompt discovery hook for Muse's additionalContext contract.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
export const promptDiscoveryHook = {
|
|
7
|
+
id: 'aiwg-prompt-discovery',
|
|
8
|
+
event: 'UserPromptSubmit',
|
|
9
|
+
group: { matcher: '*', hooks: [{ type: 'command', command: 'node .muse/hooks/aiwg-prompt-discovery.cjs', timeout: 2 }] },
|
|
10
|
+
reason: 'Discover the top three AIWG capabilities and inject next steps on each substantive prompt; bounded and fail open.',
|
|
11
|
+
removal: 'Set AIWG_PROMPT_DISCOVERY=0, or remove this group from .muse/hooks.json.',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function deployPromptDiscovery(targetDir) {
|
|
15
|
+
const directory = path.join(targetDir, '.muse', 'hooks');
|
|
16
|
+
if (fs.existsSync(directory) && fs.lstatSync(directory).isSymbolicLink()) {
|
|
17
|
+
throw new Error('Refusing to deploy prompt discovery through a symlinked .muse/hooks directory.');
|
|
18
|
+
}
|
|
19
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
20
|
+
fs.copyFileSync(fileURLToPath(new URL('../../../agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs', import.meta.url)),
|
|
21
|
+
path.join(directory, 'aiwg-prompt-discovery.cjs'));
|
|
22
|
+
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from './rule-delivery.mjs';
|
|
16
16
|
|
|
17
17
|
const { trackTemporaryDirectory } = await importImpl(import.meta.url, 'utils/temporary-directory.js');
|
|
18
|
+
const { acquireProviderDeploymentLock } = await importImpl(import.meta.url, 'providers/deployment-lock.js');
|
|
18
19
|
const { signalChild } = await importImpl(import.meta.url, 'process/signal-child.mjs');
|
|
19
20
|
const DEFAULT_WORKER = fileURLToPath(new URL('./provider-prepare-worker.mjs', import.meta.url));
|
|
20
21
|
const CHECKOUT_NEEDS_TS_TRANSFORM = !fs.existsSync(fileURLToPath(new URL('../../../dist/src', import.meta.url)));
|
|
@@ -183,12 +184,16 @@ export async function prepareProviderDeployments({
|
|
|
183
184
|
const activeChildren = new Set();
|
|
184
185
|
let pool;
|
|
185
186
|
let poolDescriptor;
|
|
187
|
+
let releaseLock;
|
|
186
188
|
try {
|
|
189
|
+
// Workers stage only; retain the shared lease through ordered promotion
|
|
190
|
+
// and finalization so another project cannot invalidate their snapshots.
|
|
191
|
+
releaseLock = await acquireProviderDeploymentLock();
|
|
187
192
|
pool = transaction.createPool(srcRoot);
|
|
188
193
|
poolDescriptor = transaction.describePool(pool);
|
|
189
194
|
} catch (error) {
|
|
190
|
-
if (pool) transaction.disposePool(pool);
|
|
191
|
-
|
|
195
|
+
try { if (pool) transaction.disposePool(pool); removeSession(); }
|
|
196
|
+
finally { await releaseLock?.(); }
|
|
192
197
|
throw error;
|
|
193
198
|
}
|
|
194
199
|
const prepared = new Array(jobs.length);
|
|
@@ -209,10 +214,12 @@ export async function prepareProviderDeployments({
|
|
|
209
214
|
const cleanup = async () => {
|
|
210
215
|
if (closed) return;
|
|
211
216
|
closed = true;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
217
|
+
try {
|
|
218
|
+
await stopChildren();
|
|
219
|
+
for (const item of prepared) if (item?.plan && !item.committed) transaction.disposePlan(item.plan);
|
|
220
|
+
transaction.disposePool(pool);
|
|
221
|
+
removeSession();
|
|
222
|
+
} finally { await releaseLock(); }
|
|
216
223
|
};
|
|
217
224
|
const prepareOne = async (index, attempt = 0) => {
|
|
218
225
|
// Never start a worker once the session is closed: it would outlive
|
|
@@ -243,6 +250,7 @@ export async function prepareProviderDeployments({
|
|
|
243
250
|
}
|
|
244
251
|
return {
|
|
245
252
|
get providers() { return jobs.map(job => job.provider); },
|
|
253
|
+
run(work) { return releaseLock.run(work); },
|
|
246
254
|
async commit(index) {
|
|
247
255
|
if (closed) throw new Error('Provider preparation session is closed');
|
|
248
256
|
if (index !== nextCommit) throw new Error(`Provider plans must commit in order: expected ${nextCommit}, received ${index}`);
|
|
@@ -256,11 +264,8 @@ export async function prepareProviderDeployments({
|
|
|
256
264
|
report = transaction.commit(item.plan);
|
|
257
265
|
}
|
|
258
266
|
item.committed = true;
|
|
259
|
-
nextCommit++;
|
|
260
267
|
return report;
|
|
261
|
-
}
|
|
262
|
-
throw error;
|
|
263
|
-
}
|
|
268
|
+
} finally { nextCommit++; }
|
|
264
269
|
},
|
|
265
270
|
async dispose() { await cleanup(); },
|
|
266
271
|
};
|
|
@@ -19,6 +19,7 @@ import { inlineStartup, nativePathLoader, ruleDirectory } from './rule-projectio
|
|
|
19
19
|
export const { parseRuleFrontmatter, inferRuleActivation, readCoreBody, validateCoreSet, formatRuleFrontmatterError } = await importImpl(import.meta.url, 'rules/activation.mjs');
|
|
20
20
|
export const { resolveDeployVersion } = await importImpl(import.meta.url, 'providers/deploy-version.mjs');
|
|
21
21
|
export const { trackTemporaryDirectory } = await importImpl(import.meta.url, 'utils/temporary-directory.js');
|
|
22
|
+
const { outputDigest } = await importImpl(import.meta.url, 'providers/deployment-ownership.mjs');
|
|
22
23
|
export const { loadRulePinConfigs, installedRuleCapabilities, resolveRulePins } = await importImpl(import.meta.url, 'rules/pins.mjs');
|
|
23
24
|
export const { guardRulesInlineBudget } = await importImpl(import.meta.url, 'rules/inline-budget.mjs');
|
|
24
25
|
export const { userConfigFile } = await importImpl(import.meta.url, 'config/user-config-dir.mjs');
|
|
@@ -216,6 +217,21 @@ export function finishBindings(opts, provider) {
|
|
|
216
217
|
const name = skill ? path.basename(path.dirname(file)) : path.basename(file).replace(/\.(md|toml)$/, '');
|
|
217
218
|
const sidecarPath = path.join(skill ? path.dirname(file) : path.dirname(file), '.aiwg-manifest.json');
|
|
218
219
|
const sidecar = fs.existsSync(sidecarPath) ? JSON.parse(read(sidecarPath)) : null;
|
|
220
|
+
const record = sidecar?.managed?.[path.basename(file)];
|
|
221
|
+
const priorBytes = opts.ownershipBefore?.get(file);
|
|
222
|
+
const priorSidecar = opts.ownershipBefore?.get(sidecarPath);
|
|
223
|
+
const prior = priorSidecar && JSON.parse(priorSidecar.toString()).managed?.[path.basename(file)];
|
|
224
|
+
// Check the pre-deploy claim too: a helper may have rewritten its sidecar
|
|
225
|
+
// or overwritten an edit that preservation will restore after binding.
|
|
226
|
+
// Snapshot entries may be digests rather than bytes (#3846).
|
|
227
|
+
const contentDigest = `sha256:${contentHash(content)}`;
|
|
228
|
+
const editedBefore = prior && priorBytes && prior.hash !== outputDigest(priorBytes);
|
|
229
|
+
const emitted = opts.ownershipBefore && (!priorBytes || outputDigest(priorBytes) !== contentDigest);
|
|
230
|
+
const editedNow = (record || provider.name === 'flue') && record?.hash !== contentDigest;
|
|
231
|
+
if (editedBefore || !emitted && editedNow) {
|
|
232
|
+
console.warn(`${provider.name}: keeping operator-edited binding target ${opts.logicalOutputPath?.(file) || file}`);
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
219
235
|
// Wrapper source identity is ownership metadata. Preserve the legacy
|
|
220
236
|
// flow-only name lookup instead of selecting new skill binding targets.
|
|
221
237
|
const wrapper = !skill && sidecar?.managed?.[path.basename(file)]?.kind === 'skill-command';
|
|
@@ -268,7 +284,7 @@ export function finishBindings(opts, provider) {
|
|
|
268
284
|
/** Bindings annotate the selected deployment; they do not select standard skills
|
|
269
285
|
* (ADR lines 102–108). Flow projections follow the same opt-in and tier routing. */
|
|
270
286
|
export function projectBoundFlowSkills(opts, provider, selected) {
|
|
271
|
-
if (provider.name === 'flue') return; //
|
|
287
|
+
if (provider.name === 'flue') return; // Flue deploys authored bundle skills; command projections remain index-only.
|
|
272
288
|
opts.flowSkillSources = new Map();
|
|
273
289
|
if (opts.rulesOnly || opts.commandsOnly || !(opts.deploySkills || opts.skillsOnly)) return;
|
|
274
290
|
const kernel = path.isAbsolute(provider.kernelSkillsPath || '') ? opts.kernelSkillsPath
|
|
@@ -295,6 +311,7 @@ export function projectBoundFlowSkills(opts, provider, selected) {
|
|
|
295
311
|
const stale = receipt?.flowSource && (opts.copyStandardSkills !== true
|
|
296
312
|
|| !sources.has(receipt.flowSource) || root !== standard);
|
|
297
313
|
if (!legacy && !stale) continue;
|
|
314
|
+
if (opts.copyMode ?? opts.copyStandardSkills) continue;
|
|
298
315
|
fs.rmSync(file, { force: true });
|
|
299
316
|
if (receipt?.flowSource) {
|
|
300
317
|
fs.rmSync(receiptFile, { force: true });
|
|
@@ -3,6 +3,7 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
5
5
|
const { refreshSettingsDigests } = await importImpl(import.meta.url, 'providers/deployment-ownership.mjs');
|
|
6
|
+
const { withProviderDeploymentLock } = await importImpl(import.meta.url, 'providers/deployment-lock.js');
|
|
6
7
|
import {
|
|
7
8
|
contentHash,
|
|
8
9
|
deploySkillsWithKernelRouting,
|
|
@@ -102,11 +103,25 @@ export function commitRuleDeploymentPlan(plan) {
|
|
|
102
103
|
else fs.writeFileSync(path.join(from, rel), output);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
106
|
+
// A root file missing from the stage is removed only when the deploy retired it
|
|
107
|
+
// deliberately: the target receipt records it, it is unchanged since, and the
|
|
108
|
+
// staged receipt dropped the record. Copy mode never drops records, so never deletes.
|
|
109
|
+
const receiptOf = root => { try { return JSON.parse(fs.readFileSync(path.join(root, '.aiwg/.aiwg-manifest.json'), 'utf8')).managed || {}; } catch { return {}; } };
|
|
110
|
+
const recordedBefore = receiptOf(target), recordedAfter = receiptOf(stage);
|
|
111
|
+
const retired = name => {
|
|
112
|
+
const key = name.split(path.sep).join('/');
|
|
113
|
+
const record = recordedBefore[key];
|
|
114
|
+
if (!record || recordedAfter[key]) return false;
|
|
115
|
+
try { return record.hash === `sha256:${contentHash(fs.readFileSync(path.join(target, name)))}`; } catch { return false; }
|
|
116
|
+
};
|
|
105
117
|
for (const name of rootNames) if (fs.existsSync(path.join(stage, name))) {
|
|
106
118
|
const output = normalizeReceipt(path.join(stage, name), Buffer.from(normalize(read(path.join(stage, name))))).toString('utf8');
|
|
107
119
|
if (output === read(path.join(target, name))) continue;
|
|
108
120
|
const write = plan.contextWrites.includes(path.join(stage, name)) ? writeContextFileSync : put;
|
|
109
121
|
write(path.join(target, name), output);
|
|
122
|
+
} else if (plan.preimages.some(item => item.path === path.join(target, name) && item.state.kind !== 'missing')) {
|
|
123
|
+
if (retired(name)) fs.rmSync(path.join(target, name), { force: true });
|
|
124
|
+
else console.warn(`Keeping ${path.join(target, name)}: not a recorded, unchanged AIWG copy retired by this deploy.`);
|
|
110
125
|
}
|
|
111
126
|
return plan.report;
|
|
112
127
|
} finally {
|
|
@@ -116,6 +131,15 @@ export function commitRuleDeploymentPlan(plan) {
|
|
|
116
131
|
|
|
117
132
|
/** Stage and commit serially for existing provider callers. */
|
|
118
133
|
export async function deployWithRuleDelivery(original, provider, deploy) {
|
|
134
|
+
const shared = [...Object.values(provider.paths), provider.kernelSkillsPath].some(dir => dir && path.isAbsolute(dir))
|
|
135
|
+
|| (provider.name === 'codex' && (original.deployCommands || original.commandsOnly || original.deploySkills || original.skillsOnly));
|
|
136
|
+
if (shared && !original.ruleDelivery && !globalThis[PREPARATION_HOOK] && !original.dryRun && !original.previewReport) {
|
|
137
|
+
return withProviderDeploymentLock(() => deployWithRuleDeliveryUnlocked(original, provider, deploy));
|
|
138
|
+
}
|
|
139
|
+
return deployWithRuleDeliveryUnlocked(original, provider, deploy);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async function deployWithRuleDeliveryUnlocked(original, provider, deploy) {
|
|
119
143
|
// Kernel source passes share the same selected rule set. Deploy their
|
|
120
144
|
// skills directly; the final source projects rules and bindings across the
|
|
121
145
|
// complete destination. Full passes retain staging for bound flow skills
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
} from './rule-deployment-state.mjs';
|
|
47
47
|
import { inlineStartup, projectRules } from './rule-projection.mjs';
|
|
48
48
|
const { captureDeploymentOutputs, recordDeploymentOutputs } = await importImpl(import.meta.url, 'providers/deployment-ownership.mjs');
|
|
49
|
+
const { preserveDeploymentOutputs } = await importImpl(import.meta.url, 'providers/deployment-preservation.mjs');
|
|
49
50
|
import { retireInlineStartup } from './rule-startup.mjs';
|
|
50
51
|
|
|
51
52
|
/** Stage only provider/context output, never the user's source tree. On failure
|
|
@@ -339,6 +340,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
|
|
|
339
340
|
flueDatabaseFile: provider.name === 'flue' ? provider.deploymentFiles(target)[0] : undefined, kernelSkillsPath: kernel, deploymentHome: home, activeWorkspace, hermesLegacySkills, legacyCodexSkills, staging: true };
|
|
340
341
|
const ownershipRoots = [stage, ...mappings.map(mapping => mapping.to)];
|
|
341
342
|
const ownershipBefore = captureDeploymentOutputs(ownershipRoots);
|
|
343
|
+
opts.ownershipBefore = ownershipBefore;
|
|
342
344
|
if (!opts.deferRuleProjection && (opts.kernelOnly || opts.deployRules || opts.rulesOnly ||
|
|
343
345
|
(!opts.skillsOnly && !opts.commandsOnly && (inlineStartup[provider.name] || ['hermes', 'warp'].includes(provider.name))))) retireInlineStartup(opts, provider);
|
|
344
346
|
await deploySelectedSurface(opts, provider, deploy);
|
|
@@ -371,6 +373,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
|
|
|
371
373
|
if (opts.kernelOnly || opts.deployRules || opts.rulesOnly || (!opts.skillsOnly && !opts.commandsOnly && (inlineStartup[provider.name] || ['hermes', 'warp'].includes(provider.name)))) projectRules(opts, provider);
|
|
372
374
|
finishBindings(opts, provider);
|
|
373
375
|
}
|
|
376
|
+
preserveDeploymentOutputs(ownershipBefore, ownershipRoots, opts);
|
|
374
377
|
// Normalize all generated path wrappers before counting or promoting bytes.
|
|
375
378
|
const normalize = content => {
|
|
376
379
|
for (const mapping of [...mappings].sort((a, b) => b.to.length - a.to.length)) content = content.split(mapping.to).join(mapping.from);
|
|
@@ -427,6 +430,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
|
|
|
427
430
|
for (const name of rootNames) {
|
|
428
431
|
const file = path.join(stage, name);
|
|
429
432
|
if (fs.existsSync(file) && normalize(read(file)) !== read(path.join(target, name))) console.log(`[dry-run] Would write ${path.join(target, name)}`);
|
|
433
|
+
else if (!fs.existsSync(file) && fs.existsSync(path.join(target, name))) console.log(`[dry-run] Would remove ${path.join(target, name)}`);
|
|
430
434
|
}
|
|
431
435
|
console.log(`[dry-run] Planned ${provider.name} deployment: ${guarded.report.selected_bytes} startup bytes; no output promoted.`);
|
|
432
436
|
return { report: guarded.report, noop: true };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Retire skill copies using recorded hashes, with legacy marker support in index mode.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
5
|
+
export function removeSkillCopy(dir, opts = {}) {
|
|
6
|
+
const copyMode = opts.copyMode ?? opts.copyStandardSkills;
|
|
7
|
+
if (copyMode && !opts.tierMove) return false;
|
|
8
|
+
// A copy-mode tier move only replaces: the new-tier copy must already exist.
|
|
9
|
+
if (copyMode && opts.tierMove && !(opts.replacement && fs.existsSync(path.join(opts.replacement, 'SKILL.md')))) {
|
|
10
|
+
console.warn(`${opts.logicalOutputPath?.(dir) || dir}: kept (replacement copy missing)`);
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const keep = reason => {
|
|
14
|
+
console.warn(`${opts.logicalOutputPath?.(dir) || dir}: kept (${reason})`);
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
17
|
+
let receipt;
|
|
18
|
+
try { receipt = JSON.parse(fs.readFileSync(path.join(dir, '.aiwg-manifest.json'), 'utf8')); }
|
|
19
|
+
catch (error) {
|
|
20
|
+
// Only a missing receipt may use legacy ownership. An invalid receipt must
|
|
21
|
+
// not turn an edited copy into a marker-only deletion candidate.
|
|
22
|
+
if (error.code !== 'ENOENT') return keep('unverifiable ownership');
|
|
23
|
+
if (copyMode || !fs.existsSync(path.join(dir, '.aiwg-managed'))) return keep('unverifiable ownership');
|
|
24
|
+
if (!opts.dryRun) fs.rmSync(dir, { recursive: true, force: true });
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (!receipt?.managed?.['SKILL.md']?.hash) return keep('unverifiable ownership');
|
|
28
|
+
const walk = root => fs.readdirSync(root, { withFileTypes: true }).flatMap(entry => {
|
|
29
|
+
const file = path.join(root, entry.name);
|
|
30
|
+
return entry.isDirectory() ? walk(file) : [file];
|
|
31
|
+
});
|
|
32
|
+
const payload = walk(dir).filter(file => {
|
|
33
|
+
const name = path.relative(dir, file);
|
|
34
|
+
return name !== '.aiwg-manifest.json' && (name !== '.aiwg-managed' || receipt.managed[name]);
|
|
35
|
+
});
|
|
36
|
+
const safe = payload.length === Object.keys(receipt.managed).length && payload.every(file => {
|
|
37
|
+
const name = path.relative(dir, file);
|
|
38
|
+
return fs.lstatSync(file).isFile() && receipt.managed[name]?.hash === `sha256:${createHash('sha256').update(fs.readFileSync(file)).digest('hex')}`;
|
|
39
|
+
});
|
|
40
|
+
if (!safe) return keep('operator-edited or unrecorded files');
|
|
41
|
+
if (!opts.dryRun) {
|
|
42
|
+
if (opts.tierMove) for (const file of walk(dir)) {
|
|
43
|
+
opts.replacedSkillCopies?.add(path.resolve(file));
|
|
44
|
+
opts.replacedSkillCopies?.add(path.resolve(opts.logicalOutputPath?.(file) || file));
|
|
45
|
+
}
|
|
46
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Preserve projector-owned rules while pruning stale legacy flat artifacts. */
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { computeArtifactInventory, computeAllSkillNames, pruneStaleAiwgFiles, resolveAiwgRoot } from './base.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* After a deploy, prune AIWG-managed flat artifacts (agents/commands/rules)
|
|
@@ -12,10 +12,10 @@ import { computeAllArtifactBasenames, computeAllSkillNames, pruneStaleAiwgFiles,
|
|
|
12
12
|
* or `--source` under `<aiwgRoot>/agentic/code`). Project-local bundle
|
|
13
13
|
* deploys (`--source <bundle>`) are skipped so a bundle's just-deployed
|
|
14
14
|
* artifacts are never mistaken for stale framework files.
|
|
15
|
-
* - `pruneStaleAiwgFiles` itself only removes files
|
|
16
|
-
*
|
|
17
|
-
* stem
|
|
18
|
-
*
|
|
15
|
+
* - `pruneStaleAiwgFiles` itself only removes files whose AIWG
|
|
16
|
+
* receipt hash matches their bytes AND whose recorded owners no longer
|
|
17
|
+
* ship the stem. Without bundle identity, it uses the global source set.
|
|
18
|
+
* Any still-shipping recorded owner protects a shared path.
|
|
19
19
|
* - Aggregate-file paths (e.g. `AGENTS.md`) and unset paths are skipped.
|
|
20
20
|
*
|
|
21
21
|
* @param {object} provider loaded provider module
|
|
@@ -48,6 +48,7 @@ export function bulkInstallOwnsFlatArtifacts(target) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export function pruneStaleAiwgArtifacts(provider, target, srcRoot, opts, explicitSource) {
|
|
51
|
+
if (opts.copyMode ?? opts.copyStandardSkills) return;
|
|
51
52
|
if (opts.skillsOnly && !opts.kernelOnly) return; // skills run their own prune in the provider
|
|
52
53
|
|
|
53
54
|
const aiwgRoot = resolveAiwgRoot(srcRoot);
|
|
@@ -102,8 +103,8 @@ export function pruneStaleAiwgArtifacts(provider, target, srcRoot, opts, explici
|
|
|
102
103
|
if (!relPath) continue; // type not file-deployed by provider
|
|
103
104
|
if (relPath.endsWith('.md')) continue; // aggregate file (e.g. AGENTS.md)
|
|
104
105
|
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
106
|
+
const inventory = computeArtifactInventory(srcRoot, type);
|
|
107
|
+
if (!inventory) continue; // no global desired set → skip
|
|
107
108
|
|
|
108
109
|
const destDir = path.isAbsolute(relPath) ? relPath : path.join(target, relPath);
|
|
109
110
|
// Activation projection owns its complete selected rule set, including extensions.
|
|
@@ -112,7 +113,8 @@ export function pruneStaleAiwgArtifacts(provider, target, srcRoot, opts, explici
|
|
|
112
113
|
const receipt = path.join(destDir, '.aiwg-manifest.json');
|
|
113
114
|
if (fs.existsSync(receipt) && JSON.parse(fs.readFileSync(receipt, 'utf8')).delivery) continue;
|
|
114
115
|
}
|
|
115
|
-
const removed = pruneStaleAiwgFiles(destDir,
|
|
116
|
+
const removed = pruneStaleAiwgFiles(destDir, inventory.stems, {
|
|
117
|
+
ownerStems: inventory.ownerStems,
|
|
116
118
|
dryRun: opts.dryRun,
|
|
117
119
|
verbose: opts.verbose,
|
|
118
120
|
// Retire wrappers whose source skill no longer ships (#2511). Only the
|