@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.
Files changed (67) hide show
  1. package/README.md +1 -0
  2. package/dist/src/cli/handlers/bundle-declaration.js +55 -0
  3. package/dist/src/cli/handlers/bundle-deployment-mode.js +71 -0
  4. package/dist/src/cli/handlers/bundle-hash-prune.js +37 -0
  5. package/dist/src/cli/handlers/bundle-reconciliation.js +140 -0
  6. package/dist/src/cli/handlers/refresh-bundles.js +35 -0
  7. package/dist/src/cli/handlers/refresh-rule-inventory.js +10 -0
  8. package/dist/src/cli/handlers/refresh.js +15 -52
  9. package/dist/src/cli/handlers/remove-bundled.js +7 -4
  10. package/dist/src/cli/handlers/remove-flue-modules.js +19 -0
  11. package/dist/src/cli/handlers/remove-historical-bundle.js +18 -0
  12. package/dist/src/cli/handlers/remove.js +8 -0
  13. package/dist/src/cli/handlers/script-runner.js +10 -0
  14. package/dist/src/cli/handlers/subcommands-list-format.js +4 -4
  15. package/dist/src/cli/handlers/update.js +18 -8
  16. package/dist/src/cli/handlers/use-additive-bundles.js +87 -0
  17. package/dist/src/cli/handlers/use-bundle-counts.js +5 -1
  18. package/dist/src/cli/handlers/use-owned-counts.js +75 -0
  19. package/dist/src/cli/handlers/use.js +44 -99
  20. package/dist/src/cli/services/deployment-verification.js +2 -1
  21. package/dist/src/config/aiwg-config.js +10 -5
  22. package/dist/src/config/framework-aliases.js +14 -0
  23. package/dist/src/config/installed-selection.js +9 -1
  24. package/dist/src/config/installed-validation.js +35 -0
  25. package/dist/src/extensions/project-local-doctor.js +1 -1
  26. package/dist/src/extensions/project-local-remove.js +3 -3
  27. package/dist/src/mcp/cli.mjs +12 -7
  28. package/dist/src/mcp/helpers.mjs +5 -1
  29. package/dist/src/mcp/http-options.mjs +101 -0
  30. package/dist/src/mcp/http-tools.mjs +51 -0
  31. package/dist/src/mcp/http-transport.mjs +201 -0
  32. package/dist/src/mcp/server.mjs +9 -7
  33. package/dist/src/mcp/tool-context.mjs +25 -0
  34. package/dist/src/mcp/tools/orchestration.mjs +2 -1
  35. package/dist/src/providers/deployment-ownership.mjs +15 -1
  36. package/dist/src/providers/deployment-preservation.d.mts +5 -0
  37. package/dist/src/providers/deployment-preservation.mjs +110 -0
  38. package/dist/src/providers/deployment-removal.js +4 -2
  39. package/dist/src/providers/flue-package-mode.js +19 -0
  40. package/dist/src/providers/skill-ownership.mjs +1 -0
  41. package/dist/src/research/reference-match.js +4 -0
  42. package/package.json +2 -1
  43. package/tools/agents/deploy-agents.mjs +6 -1
  44. package/tools/agents/deploy-options.mjs +2 -0
  45. package/tools/agents/providers/base-inventory.mjs +6 -1
  46. package/tools/agents/providers/base-kernel-skills.mjs +9 -5
  47. package/tools/agents/providers/base-migrations.mjs +1 -0
  48. package/tools/agents/providers/base-skill-copy.mjs +9 -1
  49. package/tools/agents/providers/claude.mjs +2 -1
  50. package/tools/agents/providers/codex.mjs +5 -1
  51. package/tools/agents/providers/flue-bundles.mjs +42 -0
  52. package/tools/agents/providers/flue-cloudflare.mjs +20 -0
  53. package/tools/agents/providers/flue-project.mjs +45 -6
  54. package/tools/agents/providers/flue-skill-copy.mjs +25 -0
  55. package/tools/agents/providers/flue-skills.mjs +45 -0
  56. package/tools/agents/providers/flue-specialists.mjs +36 -18
  57. package/tools/agents/providers/flue-validation.mjs +14 -0
  58. package/tools/agents/providers/flue.mjs +12 -8
  59. package/tools/agents/providers/hermes-skill-lifecycle.mjs +1 -0
  60. package/tools/agents/providers/rule-delivery-surface.mjs +15 -1
  61. package/tools/agents/providers/rule-deployment-commit.mjs +14 -0
  62. package/tools/agents/providers/rule-deployment-prepare.mjs +4 -0
  63. package/tools/agents/providers/skill-copy-prune.mjs +49 -0
  64. package/tools/agents/providers/stale-artifact-prune.mjs +1 -0
  65. package/tools/skills/codex-skill-metadata.mjs +22 -0
  66. package/tools/skills/deploy-skills-codex.mjs +8 -7
  67. package/vscode-extension/schemas/aiwg.config.v1.json +44 -19
@@ -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 installedFrameworks) {
120
- console.log(` - aiwg use ${[fw, ...providerArgs].join(' ')}`);
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 installedFrameworks) {
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, ...providerArgs],
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
- await fs.access(path.join(path.resolve(target, deployPath), path.basename(name, '.md') + extension));
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
@@ -34,6 +34,11 @@ import { getLogger } from '../log.js';
34
34
  import { installCockpit } from './cockpit.js';
35
35
  import { initHandler } from './init.js';
36
36
  import { selectAddonProfile } from './use-addon-profile.js';
37
+ import { deploymentEditWarnings } from '../../providers/deployment-preservation.mjs';
38
+ import { permitsBundleDeployment } from '../../config/installed-selection.js';
39
+ import { bundleDeploymentScope, recordBundleDeployment, copyCleanupArgs, projectLocalDeploymentContext, projectLocalCopyMode } from './bundle-deployment-mode.js';
40
+ import { frameworkAdditiveBundles, getAllAddons, getAllExtensions } from './use-additive-bundles.js';
41
+ export { getAllAddons, getAllExtensions, USE_ALL_DISALLOW, USE_ALL_EXTENSIONS_DISALLOW } from './use-additive-bundles.js';
37
42
  import { checkCollisions, formatCollisionReport, hasBlockingCollisions, } from '../../smiths/skillsmith/collision-detector.js';
38
43
  import { discoverProjectLocalBundles, } from '../../extensions/project-local-discovery.js';
39
44
  import { PROJECT_LOCAL_TYPE_TO_DIR } from '../../extensions/project-local-paths.js';
@@ -64,6 +69,7 @@ const PREPARABLE_BUILTIN_PROVIDERS = new Set(['claude', 'codex', 'cursor', 'herm
64
69
  // Distinct from agentsmith (which creates subagent personas).
65
70
  import { generate as generateContextFiles, discoverDeployedArtifacts, } from '../../smiths/context-pipeline/index.js';
66
71
  import { verifyModelWrapperDeployment } from '../../models/wrapper-deployment.js';
72
+ import { countRecordedFrameworkArtifacts, receiptIncludesOwner } from './use-owned-counts.js';
67
73
  import { countDeployedBundleFiles, countDeployedBundleRules } from './use-bundle-counts.js';
68
74
  import { reconcileDeployedSkillAssets } from './use-skill-assets.js';
69
75
  import { aggregateUseDeploymentResult, buildDryRunUseResult, renderUseDeploymentResult, verifyProviderDeployment, } from '../services/deployment-verification.js';
@@ -263,32 +269,6 @@ const FRAMEWORK_DIR_MAP = {
263
269
  export function resolveFrameworkDir(framework) {
264
270
  return FRAMEWORK_DIR_MAP[framework];
265
271
  }
266
- /**
267
- * Addons excluded from `aiwg use all`.
268
- * aiwg-dev is contributor-only tooling — not for end users.
269
- */
270
- export const USE_ALL_DISALLOW = new Set(['aiwg-dev']);
271
- /**
272
- * Whether an addon's manifest keeps it out of bulk deploys (#2641).
273
- *
274
- * `devOnly` marks contributor tooling; `explicitInstall` marks an addon that is
275
- * deployed only when named, such as `aiwg use decision-engine`. Both match
276
- * `discoverAddons()` in tools/agents/providers/base.mjs, which applies the same
277
- * rule to framework-mode deploys.
278
- *
279
- * `autoInstall: false` is deliberately NOT an exclusion signal: most addons
280
- * declare it (and the extension manifest schema defaults to it), so honoring
281
- * it would drop most addons from `all` for existing users.
282
- */
283
- async function isExplicitOnlyAddon(addonDir) {
284
- try {
285
- const manifest = JSON.parse(await fs.readFile(path.join(addonDir, 'manifest.json'), 'utf8'));
286
- return manifest?.devOnly === true || manifest?.explicitInstall === true;
287
- }
288
- catch {
289
- return false;
290
- }
291
- }
292
272
  /** Full-framework setup requires the corpus omitted by the lightweight CLI. */
293
273
  async function bundledSetupPrerequisiteMessage(frameworkRoot) {
294
274
  let packageName;
@@ -319,57 +299,6 @@ async function bundledSetupPrerequisiteMessage(frameworkRoot) {
319
299
  '@aiwg/cli can still query signed web resources and deploy external project-local bundles.',
320
300
  ].join('\n');
321
301
  }
322
- /**
323
- * Discover all addon names from the filesystem, minus the disallow list and
324
- * addons whose manifest restricts them to explicit installs.
325
- */
326
- export async function getAllAddons(frameworkRoot) {
327
- const addonsDir = path.join(frameworkRoot, 'agentic/code/addons');
328
- const entries = await fs.readdir(addonsDir, { withFileTypes: true });
329
- const candidates = entries.filter(e => e.isDirectory() && !USE_ALL_DISALLOW.has(e.name));
330
- const excluded = await Promise.all(candidates.map(e => isExplicitOnlyAddon(path.join(addonsDir, e.name))));
331
- return candidates.filter((_, index) => !excluded[index]).map(e => e.name);
332
- }
333
- /**
334
- * Extensions excluded from `aiwg use all` deployment.
335
- * `api-adapter` is an OpenAPI spec, not a deployable artifact bundle.
336
- */
337
- export const USE_ALL_EXTENSIONS_DISALLOW = new Set(['api-adapter']);
338
- /**
339
- * Discover all extension names from `agentic/code/extensions/*` (#1221).
340
- *
341
- * Extensions are addon-shaped bundles with their own `manifest.json`,
342
- * `skills/`, `rules/`, and `templates/` directories. Only directories
343
- * containing a `manifest.json` are considered deployable; bare directories
344
- * (e.g. `api-adapter` which only ships an OpenAPI spec) are skipped.
345
- */
346
- export async function getAllExtensions(frameworkRoot) {
347
- const extensionsDir = path.join(frameworkRoot, 'agentic/code/extensions');
348
- let entries;
349
- try {
350
- entries = await fs.readdir(extensionsDir, { withFileTypes: true });
351
- }
352
- catch {
353
- return [];
354
- }
355
- const result = [];
356
- for (const entry of entries) {
357
- if (!entry.isDirectory())
358
- continue;
359
- if (USE_ALL_EXTENSIONS_DISALLOW.has(entry.name))
360
- continue;
361
- const manifestPath = path.join(extensionsDir, entry.name, 'manifest.json');
362
- try {
363
- await fs.access(manifestPath);
364
- result.push(entry.name);
365
- }
366
- catch {
367
- // Directory without a manifest is not deployable as an extension.
368
- continue;
369
- }
370
- }
371
- return result;
372
- }
373
302
  /**
374
303
  * Resolve extension source path from its name.
375
304
  */
@@ -558,7 +487,7 @@ const MIRRORED_KERNEL_COMMAND_SKILLS = new Set([
558
487
  'use',
559
488
  'steward',
560
489
  ]);
561
- function shouldMirrorStandardCommandSkill(skillName) {
490
+ export function shouldMirrorStandardCommandSkill(skillName) {
562
491
  return skillName.startsWith('flow-') || MIRRORED_STANDARD_COMMAND_SKILLS.has(skillName);
563
492
  }
564
493
  function shouldMirrorKernelCommandSkill(skillName) {
@@ -1073,7 +1002,8 @@ async function countDeployedBundleSkills(bundlePath, target, provider) {
1073
1002
  let found = false;
1074
1003
  for (const dir of uniqueCandidateDirs) {
1075
1004
  for (const name of names) {
1076
- if (!(await fileExists(path.join(dir, name, 'SKILL.md'))))
1005
+ if (!(await fileExists(path.join(dir, name, 'SKILL.md')))
1006
+ || !await receiptIncludesOwner(path.join(dir, name, 'SKILL.md'), new Set([path.basename(bundlePath)])))
1077
1007
  continue;
1078
1008
  count++;
1079
1009
  found = true;
@@ -1164,7 +1094,7 @@ async function deployOneProjectLocalBundle(opts) {
1164
1094
  // graph. Without --copy-all, the bundle's rules deploy but its skills
1165
1095
  // never reach <provider>/.aiwg/skills/, leaving them invisible to
1166
1096
  // both the platform and the index.
1167
- '--copy-all',
1097
+ '--copy-all', ...copyCleanupArgs(ctx.args),
1168
1098
  // That copy-all is the deployer's doing, not the operator's, so the
1169
1099
  // provider's startup listing cap still applies; overflow lands on the
1170
1100
  // standard tier instead of over the cap (#2561).
@@ -1257,8 +1187,8 @@ async function deployProjectLocalBundles(opts) {
1257
1187
  }
1258
1188
  const targetBundles = onlyBundleId
1259
1189
  ? discovery.bundles.filter(b => b.id === onlyBundleId)
1260
- : discovery.bundles.filter(b => b.type !== 'provider');
1261
- if (targetBundles.length === 0) {
1190
+ : discovery.bundles.filter(b => b.type !== 'provider' && permitsBundleDeployment(projectDir, b.id, provider));
1191
+ if (targetBundles.length === 0 && discovery.bundles.length === 0) {
1262
1192
  if (!onlyBundleId) {
1263
1193
  const { hasProjectQuickref, deployProjectQuickref } = await import('../../extensions/project-quickref.js');
1264
1194
  try {
@@ -1328,7 +1258,7 @@ async function deployProjectLocalBundles(opts) {
1328
1258
  }
1329
1259
  }
1330
1260
  const result = await deployOneProjectLocalBundle({
1331
- bundle, ctx, frameworkRoot, provider, target, dryRun, verbose, quiet, modelArgs,
1261
+ bundle, ctx: await projectLocalDeploymentContext(ctx, projectDir, bundle.id, provider, Boolean(onlyBundleId)), frameworkRoot, provider, target, dryRun, verbose, quiet, modelArgs,
1332
1262
  });
1333
1263
  if (result.exitCode !== 0) {
1334
1264
  failed++;
@@ -1376,10 +1306,12 @@ async function deployProjectLocalBundles(opts) {
1376
1306
  localPath: bundle.localPath,
1377
1307
  localType: bundle.type,
1378
1308
  manifestVersion: bundle.manifest.manifestVersion,
1309
+ copy: projectLocalCopyMode(config, bundle.id, provider, ctx.args, Boolean(onlyBundleId)),
1379
1310
  artifactHashes,
1380
1311
  deployedArtifactHashes,
1381
1312
  });
1382
1313
  await writeAiwgConfig(projectDir, updated);
1314
+ await recordBundleDeployment(projectDir, bundle.id, provider, updated.installed[bundle.id].deployedTo[provider].copy ? ['--copy-all'] : [], frameworkRoot);
1383
1315
  }
1384
1316
  catch (err) {
1385
1317
  // Non-fatal: deploy already succeeded
@@ -1390,7 +1322,7 @@ async function deployProjectLocalBundles(opts) {
1390
1322
  // Automatic reconciliation (also used by refresh/upgrade) must restore the
1391
1323
  // project search cache for existing bundles, just as a named local install
1392
1324
  // does. Named installs refresh once after all selected providers finish.
1393
- if (deployed > 0 && !dryRun && !onlyBundleId) {
1325
+ if (discovery.bundles.length > 0 && !dryRun && !onlyBundleId) {
1394
1326
  try {
1395
1327
  await rebuildExternalBundleIndex(projectDir, 'project', verbose);
1396
1328
  }
@@ -1459,7 +1391,7 @@ for (const flag of [...MODEL_DEPLOY_VALUE_FLAGS, '--reasoning', '--coding', '--e
1459
1391
  USE_FLAGS_WITH_VALUES.add(flag);
1460
1392
  }
1461
1393
  const USE_BOOLEAN_FLAGS = new Set([
1462
- '--force', '--copy-all', '--copy-standard-skills', '--dry-run', '--verbose', '-v', '--quiet', '-q',
1394
+ '--package', '--force', '--copy-all', '--copy-standard-skills', '--dry-run', '--verbose', '-v', '--quiet', '-q',
1463
1395
  '--json', '--no-project-local', '--no-context-files', '--no-workspace-md',
1464
1396
  '--no-aiwg-md', '--no-agents-md', '--force-context-files', '--global', '--user',
1465
1397
  '--no-utils', '--ci-hooks-enabled', '--skip-conflicts', '--no-harness-agents',
@@ -1467,7 +1399,7 @@ const USE_BOOLEAN_FLAGS = new Set([
1467
1399
  '--allow-over-budget', '--no-hooks', '--no-attribution', '--enable-cross-provider-hooks',
1468
1400
  '--skip-commands-migration', '--listing-budget', '--mcp', '--as-agents-md',
1469
1401
  '--create-agents-md', '--commands-only', '--skills-only', '--rules-only',
1470
- '--save', '--save-user', '--help', '-h',
1402
+ '--declare', '--save', '--save-user', '--help', '-h',
1471
1403
  ]);
1472
1404
  export function validateUseOptions(args, preparedCapabilities = new Set()) {
1473
1405
  for (let i = 0; i < args.length; i++) {
@@ -2334,6 +2266,7 @@ Additional options:
2334
2266
  --providers <a,b> Providers for global bootstrap
2335
2267
  --prefix <dir> Alias for --target
2336
2268
  --global, --user Install to user scope
2269
+ --package Flue: import skills from @aiwg/flue; persist across update/refresh
2337
2270
  --copy-standard-skills Alias for --copy-all (also restores the full surface)
2338
2271
  --profile <name> Select workspace profile (implicit target: all)
2339
2272
  --workspace-signals Show the workspace signal plan
@@ -2345,6 +2278,7 @@ Additional options:
2345
2278
  --filter <glob>, --filter-role <role>
2346
2279
  Filter deployed agents
2347
2280
  --save, --save-user Persist model selection
2281
+ --declare Declare a bundle for --provider without deploying (project scope)
2348
2282
  --no-utils Skip additive addon and extension passes
2349
2283
  --no-workspace-md, --no-aiwg-md, --no-agents-md
2350
2284
  Suppress individual context files
@@ -2385,6 +2319,8 @@ export class UseHandler {
2385
2319
  return { exitCode: 0, message: USE_HELP, rawOutput: true };
2386
2320
  }
2387
2321
  async execute(ctx) {
2322
+ if (ctx.args.includes('--declare'))
2323
+ return (await import('./bundle-declaration.js')).declareBundle(ctx);
2388
2324
  let resourceCredentials = useDeployment?.resourceCredentials;
2389
2325
  try {
2390
2326
  if (!resourceCredentials) {
@@ -2543,6 +2479,11 @@ export class UseHandler {
2543
2479
  console.error = originalConsole.error;
2544
2480
  }
2545
2481
  }
2482
+ if (coreResult.exitCode === 0 && !dryRun)
2483
+ for (const provider of providers) {
2484
+ for (const warning of deploymentEditWarnings(projectDir, provider))
2485
+ originalConsole.warn(warning);
2486
+ }
2546
2487
  let result;
2547
2488
  if (dryRun && coreResult.exitCode === 0) {
2548
2489
  result = buildDryRunUseResult({
@@ -3216,7 +3157,9 @@ export class UseHandler {
3216
3157
  // project. Unlike a full framework deploy, its standard skills cannot be
3217
3158
  // left index-only: the user asked to install this specific bundle and
3218
3159
  // its supporting scripts must travel with the skill directory.
3219
- addonBaseArgs.push('--copy-all');
3160
+ addonBaseArgs.push('--copy-all', ...copyCleanupArgs(remainingArgs));
3161
+ if (provider === 'flue' && remainingArgs.includes('--package'))
3162
+ addonBaseArgs.push('--package');
3220
3163
  addonBaseArgs.push(...modelDeployArgs);
3221
3164
  if (provider)
3222
3165
  addonBaseArgs.push('--provider', provider);
@@ -3231,7 +3174,7 @@ export class UseHandler {
3231
3174
  addonBaseArgs.push('--dry-run');
3232
3175
  if (remainingArgs.includes('--force'))
3233
3176
  addonBaseArgs.push('--force');
3234
- const activationOrder = isAddon
3177
+ const activationOrder = isAddon && provider !== 'flue'
3235
3178
  ? await resolveRequiredAddonActivationOrder(frameworkRoot, framework)
3236
3179
  : [framework];
3237
3180
  const requiredAddons = activationOrder.slice(0, -1);
@@ -3368,8 +3311,11 @@ export class UseHandler {
3368
3311
  source: 'bundled',
3369
3312
  manifestHash: await hashManifest(manifestPath),
3370
3313
  asPrimary: Boolean(explicitAddonProvider),
3314
+ package: provider === 'flue' ? remainingArgs.includes('--package') : undefined,
3315
+ copy: remainingArgs.includes('--copy-all') || remainingArgs.includes('--copy-standard-skills'),
3371
3316
  });
3372
3317
  await writeAiwgConfig(projectDir, updated);
3318
+ await recordBundleDeployment(projectDir, framework, provider, remainingArgs, frameworkRoot);
3373
3319
  config = updated;
3374
3320
  }
3375
3321
  catch (error) {
@@ -3574,8 +3520,7 @@ export class UseHandler {
3574
3520
  && !remainingArgs.includes('--copy-standard-skills');
3575
3521
  if (bulkKernelOnly)
3576
3522
  providerDeployArgs.push('--kernel-only');
3577
- const allAddons = skipUtils || provider === 'flue' ? [] : await getAllAddons(frameworkRoot);
3578
- const allExtensions = skipUtils || bulkKernelOnly || provider === 'flue' ? [] : await getAllExtensions(frameworkRoot);
3523
+ const { addons: allAddons, extensions: allExtensions } = await frameworkAdditiveBundles(frameworkRoot, provider, skipUtils, bulkKernelOnly);
3579
3524
  const mainIncludesAddons = mainDeploymentIncludesAddons(provider, mode, providerDeployArgs);
3580
3525
  // OMP's extension sources share the root transaction and binding scan.
3581
3526
  // Their CLI contributions are still registered below in source order.
@@ -3812,7 +3757,7 @@ export class UseHandler {
3812
3757
  // Deploy project-local bundles (#1035). Auto-runs after upstream addons unless
3813
3758
  // --no-project-local. Idempotent — overwrites prior deploys. Skipped under
3814
3759
  // --dry-run-disabled scenarios for safety; --dry-run is honored and logged.
3815
- if (!skipProjectLocal) {
3760
+ if (!skipProjectLocal && provider !== 'flue') {
3816
3761
  const plResult = await deployProjectLocalBundles({
3817
3762
  ctx,
3818
3763
  frameworkRoot,
@@ -3984,7 +3929,7 @@ export class UseHandler {
3984
3929
  if (!prebuilt && await fs.access(path.join(aiwgRootForIndex, 'prebuilt', 'framework-relations', 'manifest.json')).then(() => true).catch(() => false)) {
3985
3930
  const { selectPrebuiltRelations } = await import('../../artifacts/relations.js');
3986
3931
  const reason = selectPrebuiltRelations(aiwgRootForIndex).reason ?? 'packaged search index is missing, stale, or does not match the source';
3987
- ui.dim(` Packaged index unavailable: ${reason}.`);
3932
+ ui.dim(verbose ? ` Packaged index unavailable: ${reason}.` : ' Packaged index unavailable; rebuilding capability index.');
3988
3933
  }
3989
3934
  ui.dim(' Indexing operational assets for agent-side lookup.');
3990
3935
  const indexStart = Date.now();
@@ -4018,7 +3963,8 @@ export class UseHandler {
4018
3963
  // registry record written below (#621) reflects the real deploy even on
4019
3964
  // a verbose run — the prior `if (quiet)` guard left the record
4020
3965
  // `{agents: 0, commands: 0, skills: 0, rules: 0}` on `-v` runs.
4021
- const counts = await countDeployedArtifacts(target, paths, provider);
3966
+ const counts = dryRun ? await countDeployedArtifacts(target, paths, provider)
3967
+ : await countRecordedFrameworkArtifacts(target, provider, framework, frameworkRoot, remainingArgs);
4022
3968
  // Deploy CI workflow files when --ci-hooks-enabled is set (#661)
4023
3969
  if (ciHooksEnabled) {
4024
3970
  await deployCiHooks({ frameworkRoot, framework, target, dryRun });
@@ -4204,18 +4150,17 @@ export class UseHandler {
4204
4150
  if (!frameworkManifestPath)
4205
4151
  throw new Error('no manifest for general/writing mode');
4206
4152
  const mHash = await hashManifest(frameworkManifestPath);
4207
- const updatedConfig = updateInstalled(config, framework, provider, {
4208
- agents: counts.agents,
4209
- commands: counts.commands,
4210
- skills: counts.skills,
4211
- rules: counts.rules,
4212
- }, {
4153
+ const updatedConfig = updateInstalled(config, framework, provider, counts, {
4213
4154
  version: versionInfo.version,
4214
4155
  source: 'bundled',
4215
4156
  manifestHash: mHash,
4216
4157
  asPrimary: Boolean(explicitProvider),
4158
+ package: provider === 'flue' ? remainingArgs.includes('--package') : undefined,
4159
+ copy: remainingArgs.includes('--copy-all') || remainingArgs.includes('--copy-standard-skills'),
4160
+ ...bundleDeploymentScope(framework, provider, remainingArgs),
4217
4161
  });
4218
4162
  await writeAiwgConfig(projectDir, updatedConfig);
4163
+ await recordBundleDeployment(projectDir, framework, provider, remainingArgs, frameworkRoot);
4219
4164
  }
4220
4165
  catch {
4221
4166
  // Non-fatal: config tracking failure must not block deployment
@@ -8,6 +8,7 @@ import { inspectInstallation } from '../../installation/manager.mjs';
8
8
  import { getPackageRoot } from '../../channel/manager.mjs';
9
9
  import { getProviderDefinition, normalizeProviderDefinitionId, resolveProviderPathValue, } from '../../providers/provider-definitions.js';
10
10
  import { resolveGrokbotSkillsDir } from '../../providers/grokbot-paths.js';
11
+ import { hasFluePackageDeployment } from '../../providers/flue-package-mode.js';
11
12
  import { resolveGrokHome } from '../../providers/grok-build-paths.js';
12
13
  import { runGrokInspect } from '../../providers/grok-build-inspect.js';
13
14
  import { diagnoseIntegratedProviderTransformationReceipt } from '../../providers/transformation-receipt-integration.js';
@@ -433,7 +434,7 @@ export async function verifyProviderDeployment(options) {
433
434
  if (kernelPath && kernelPath !== resolvedSkillsPath)
434
435
  counts.skills += kernelCount;
435
436
  const artifactTotal = Object.values(counts).reduce((sum, value) => sum + value, 0);
436
- if (artifactTotal === 0) {
437
+ if (artifactTotal === 0 && !(normalized === 'flue' && await hasFluePackageDeployment(options.projectRoot))) {
437
438
  // Bridge-only providers (e.g. grokbot project scope without skills env)
438
439
  // intentionally have null native artifact dirs and land AGENTS.md instead.
439
440
  const bridgeName = definition.paths.configFile || definition.paths.contextFiles?.contextFile;
@@ -1,3 +1,4 @@
1
+ import { validateInstalled } from './installed-validation.js';
1
2
  import { preserveInstalledSelection } from './installed-selection.js';
2
3
  import { validateHitlPolicy } from '../policy/hitl-validation.js';
3
4
  import { normalizeAiwgConfigCandidate } from './config-normalization.js';
@@ -1157,6 +1158,9 @@ export function updateInstalled(config, name, provider, counts, opts) {
1157
1158
  throw new Error(`updateInstalled: source 'project-local' requires localPath and localType (got ${JSON.stringify({ localPath: opts.localPath, localType: opts.localType })})`);
1158
1159
  }
1159
1160
  }
1161
+ validateInstalled({ [name]: { version: opts.version, source: opts.source, installedAt: new Date().toISOString(),
1162
+ deployedTo: { [provider]: { agents: counts.agents, commands: counts.commands, skills: counts.skills, rules: counts.rules,
1163
+ copy: opts.copy, package: opts.package, skipUtils: opts.skipUtils, kernelOnly: opts.kernelOnly } } } });
1160
1164
  const existing = config.installed[name] ?? {
1161
1165
  version: opts.version,
1162
1166
  source: opts.source,
@@ -1167,7 +1171,8 @@ export function updateInstalled(config, name, provider, counts, opts) {
1167
1171
  existing.version = opts.version;
1168
1172
  existing.source = opts.source;
1169
1173
  existing.installedAt = new Date().toISOString();
1170
- existing.deployedTo[provider] = counts;
1174
+ existing.deployedTo[provider] = { ...counts, ...(opts.package === undefined ? {} : { package: opts.package }), ...(opts.copy === undefined ? {} : { copy: opts.copy }),
1175
+ ...(opts.skipUtils === undefined ? {} : { skipUtils: opts.skipUtils }), ...(opts.kernelOnly === undefined ? {} : { kernelOnly: opts.kernelOnly }) };
1171
1176
  if (opts.manifestHash)
1172
1177
  existing.manifestHash = opts.manifestHash;
1173
1178
  if (opts.source === 'project-local') {
@@ -1208,10 +1213,10 @@ export function getDeploymentSummary(config, provider) {
1208
1213
  const counts = entry.deployedTo[targetProvider];
1209
1214
  if (!counts)
1210
1215
  continue;
1211
- totals.agents += counts.agents;
1212
- totals.commands += counts.commands;
1213
- totals.skills += counts.skills;
1214
- totals.rules += counts.rules;
1216
+ totals.agents += counts.agents ?? 0;
1217
+ totals.commands += counts.commands ?? 0;
1218
+ totals.skills += counts.skills ?? 0;
1219
+ totals.rules += counts.rules ?? 0;
1215
1220
  }
1216
1221
  return totals;
1217
1222
  }
@@ -8,5 +8,19 @@ export const REGISTRY_ID_TO_USE_NAME = {
8
8
  'media-curator': 'media-curator',
9
9
  'research-complete': 'research',
10
10
  'forensics-complete': 'forensics',
11
+ dfir: 'forensics',
12
+ 'ops-complete': 'ops',
13
+ 'validation-complete': 'validation',
11
14
  };
15
+ // Reverse aliases without letting a secondary alias (dfir) replace the canonical ID.
16
+ const USE_NAME_TO_REGISTRY_ID = {
17
+ ...Object.fromEntries(Object.entries(REGISTRY_ID_TO_USE_NAME).reverse().map(([id, alias]) => [alias, id])),
18
+ general: 'writing-quality',
19
+ writing: 'writing-quality',
20
+ };
21
+ /** Resolve a use name or legacy alias to its canonical bundle directory. */
22
+ export function frameworkRegistryId(name) {
23
+ const useName = REGISTRY_ID_TO_USE_NAME[name] ?? name;
24
+ return USE_NAME_TO_REGISTRY_ID[useName] ?? name;
25
+ }
12
26
  //# sourceMappingURL=framework-aliases.js.map