@aiwg/cli 2026.7.19 → 2026.7.21

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 (88) hide show
  1. package/README.md +397 -385
  2. package/dist/src/api/index.d.ts +1 -0
  3. package/dist/src/api/index.js +1 -0
  4. package/dist/src/artifacts/browser-export.js +7 -0
  5. package/dist/src/artifacts/citation-parser.js +96 -35
  6. package/dist/src/artifacts/cli.js +59 -5
  7. package/dist/src/artifacts/discover-facets.js +15 -0
  8. package/dist/src/artifacts/discovery-eval.js +290 -0
  9. package/dist/src/artifacts/fortemi-core-query-adapter.js +1 -1
  10. package/dist/src/artifacts/fortemi-shard-export.js +1 -1
  11. package/dist/src/artifacts/index-builder.js +54 -17
  12. package/dist/src/artifacts/query-engine.js +10 -6
  13. package/dist/src/artifacts/state-transfer.js +27 -0
  14. package/dist/src/artifacts/stats.js +8 -0
  15. package/dist/src/cli/cli-extension-loader.js +73 -0
  16. package/dist/src/cli/handlers/help.js +2 -1
  17. package/dist/src/cli/handlers/index.js +6 -2
  18. package/dist/src/cli/handlers/resource-versions.js +247 -0
  19. package/dist/src/cli/handlers/sessions.js +966 -0
  20. package/dist/src/cli/handlers/skill-lint.js +49 -45
  21. package/dist/src/cli/handlers/subcommands.js +55 -3
  22. package/dist/src/cli/handlers/use.js +154 -59
  23. package/dist/src/cli/handlers/utilities.js +49 -34
  24. package/dist/src/cli/skill-usage.js +146 -24
  25. package/dist/src/config/cli.js +13 -9
  26. package/dist/src/config/project-artifacts-runtime.mjs +68 -0
  27. package/dist/src/config/project-artifacts.js +1 -68
  28. package/dist/src/extensions/commands/definitions.js +65 -2
  29. package/dist/src/extensions/manifest.js +29 -0
  30. package/dist/src/extensions/project-local-discovery.js +86 -2
  31. package/dist/src/extensions/project-local-remove.js +52 -56
  32. package/dist/src/extensions/shadow-resolver.js +3 -1
  33. package/dist/src/plugins/standalone-packager.js +143 -0
  34. package/dist/src/resources/cache-cleanup.js +67 -0
  35. package/dist/src/resources/doctor.js +107 -0
  36. package/dist/src/resources/lockfile.js +125 -0
  37. package/dist/src/resources/resolver.js +133 -0
  38. package/dist/src/resources/web-release.d.ts +8 -0
  39. package/dist/src/resources/web-release.js +159 -1
  40. package/dist/src/sessions/adapters/claude.js +357 -0
  41. package/dist/src/sessions/adapters/codex.js +521 -0
  42. package/dist/src/sessions/adapters/copilot.js +226 -0
  43. package/dist/src/sessions/adapters/cursor.js +372 -0
  44. package/dist/src/sessions/adapters/factory.js +345 -0
  45. package/dist/src/sessions/adapters/generic.js +225 -0
  46. package/dist/src/sessions/adapters/hermes.js +341 -0
  47. package/dist/src/sessions/adapters/openclaw.js +381 -0
  48. package/dist/src/sessions/adapters/opencode.js +454 -0
  49. package/dist/src/sessions/adapters/openhuman.js +315 -0
  50. package/dist/src/sessions/adapters/warp.js +160 -0
  51. package/dist/src/sessions/adapters/windsurf.js +212 -0
  52. package/dist/src/sessions/candidates.js +210 -0
  53. package/dist/src/sessions/contracts.js +310 -0
  54. package/dist/src/sessions/discovery.js +51 -0
  55. package/dist/src/sessions/fixtures.js +12 -0
  56. package/dist/src/sessions/importer.js +315 -0
  57. package/dist/src/sessions/index.js +25 -0
  58. package/dist/src/sessions/knowledge-shard.js +61 -0
  59. package/dist/src/sessions/optional-backends.js +238 -0
  60. package/dist/src/sessions/policy.js +192 -0
  61. package/dist/src/sessions/ports.js +2 -0
  62. package/dist/src/sessions/promotion.js +367 -0
  63. package/dist/src/sessions/readers.js +176 -0
  64. package/dist/src/sessions/repository.js +1551 -0
  65. package/dist/src/skills/adapters/agent-skills.js +59 -0
  66. package/dist/src/skills/adapters/local.js +19 -1
  67. package/dist/src/skills/agent-skills.js +249 -0
  68. package/dist/src/skills/cli.js +463 -7
  69. package/dist/src/skills/deployer.js +554 -0
  70. package/dist/src/skills/doctor.js +105 -0
  71. package/dist/src/skills/exporter.js +382 -0
  72. package/dist/src/skills/importer.js +921 -0
  73. package/dist/src/skills/registry.js +19 -0
  74. package/dist/src/skills/validator.js +323 -0
  75. package/dist/src/smiths/context-pipeline/aiwg-md.js +5 -1
  76. package/dist/src/smiths/context-pipeline/claude-hook.js +21 -1
  77. package/dist/src/smiths/context-pipeline/finalization.js +5 -3
  78. package/dist/src/smiths/context-pipeline/generator.js +4 -1
  79. package/dist/src/smiths/context-pipeline/parallelism-section.js +34 -1
  80. package/dist/src/smiths/context-pipeline/workspace-context.js +15 -3
  81. package/dist/src/smiths/mcpsmith/example.js +3 -1
  82. package/dist/src/smiths/mcpsmith/generator.js +3 -1
  83. package/dist/src/smiths/toolsmith/runtime-discovery.mjs +2 -1
  84. package/dist/src/storage/cli.js +3 -2
  85. package/dist/src/storage/subsystem-cli.js +7 -2
  86. package/dist/src/update/notifier.mjs +1 -1
  87. package/dist/src/update/service.mjs +123 -0
  88. package/package.json +3 -2
@@ -20,6 +20,7 @@
20
20
  */
21
21
  import { getLoadedConfig, resolveStorage } from './index.js';
22
22
  import { resolveSubsystemRootRuntime } from './config.js';
23
+ import { projectAiwgPath, resolveProjectAiwgDir } from '../config/project-artifacts.js';
23
24
  export async function runSubsystemCli(subsystem, args, opts = {}) {
24
25
  const subcommand = args[0];
25
26
  const subArgs = args.slice(1);
@@ -177,6 +178,9 @@ async function readStdin() {
177
178
  return Buffer.concat(chunks).toString('utf-8');
178
179
  }
179
180
  function printUsage(subsystem, display) {
181
+ const projectRoot = process.cwd();
182
+ const subsystemPath = projectAiwgPath(projectRoot, subsystem);
183
+ const configPath = projectAiwgPath(projectRoot, 'storage.config');
180
184
  console.log(`Usage: aiwg ${display} <subcommand>
181
185
 
182
186
  Subcommands:
@@ -195,7 +199,8 @@ Examples:
195
199
  echo "# page" | aiwg ${display} put some/page.md
196
200
  echo '{"event":"x"}' | aiwg ${display} append-log some/log.jsonl
197
201
 
198
- The ${display} subsystem persists at .aiwg/${subsystem}/ on the default fs backend.
199
- Configure .aiwg/storage.config to redirect (#934).`);
202
+ The ${display} subsystem persists at ${subsystemPath} on the default fs backend
203
+ (artifact root: ${resolveProjectAiwgDir(projectRoot)}).
204
+ Configure ${configPath} to redirect (#934).`);
200
205
  }
201
206
  //# sourceMappingURL=subsystem-cli.js.map
@@ -218,7 +218,7 @@ export function maybePrintNotice() {
218
218
  const cache = readCache();
219
219
  if (!cache?.hasUpdate || !cache.current || !cache.latest) return;
220
220
  // One-line, non-intrusive. Users who want to update run `aiwg update`.
221
- const msg = `aiwg: update available ${cache.current} → ${cache.latest} (run: npm install -g aiwg)`;
221
+ const msg = `aiwg: update available ${cache.current} → ${cache.latest} (run: aiwg update)`;
222
222
  process.stderr.write(`\n${msg}\n`);
223
223
  }
224
224
 
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Install-aware AIWG update service.
3
+ *
4
+ * This is the single package-update primitive shared by `aiwg update` and
5
+ * `aiwg refresh`. It deliberately keeps provider/framework redeployment in
6
+ * the calling handlers.
7
+ */
8
+
9
+ import { execFileSync } from 'node:child_process';
10
+ import { existsSync, readFileSync } from 'node:fs';
11
+ import path from 'node:path';
12
+ import { getPackageRoot, loadConfig } from '../channel/manager.mjs';
13
+
14
+ const VALID_MODES = new Set(['npm', 'web', 'source']);
15
+
16
+ function readPackageName(packageRoot) {
17
+ try {
18
+ return JSON.parse(readFileSync(path.join(packageRoot, 'package.json'), 'utf8')).name;
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+
24
+ export async function detectInstallMode(options = {}) {
25
+ const packageRoot = options.packageRoot ?? getPackageRoot();
26
+ const override = options.env?.AIWG_INSTALL_MODE ?? process.env.AIWG_INSTALL_MODE;
27
+ if (override) {
28
+ if (!VALID_MODES.has(override)) {
29
+ throw new Error(`AIWG_INSTALL_MODE must be one of: ${[...VALID_MODES].join(', ')}`);
30
+ }
31
+ return { mode: override, packageRoot, packageName: readPackageName(packageRoot) };
32
+ }
33
+
34
+ const config = options.config ?? await loadConfig();
35
+ const packageName = readPackageName(packageRoot);
36
+ if (packageName === '@aiwg/cli') return { mode: 'web', packageRoot, packageName };
37
+ if (config.devMode || config.channel === 'edge' || existsSync(path.join(packageRoot, '.git'))) {
38
+ return { mode: 'source', packageRoot, packageName };
39
+ }
40
+ return { mode: 'npm', packageRoot, packageName };
41
+ }
42
+
43
+ function npmTag(channel) {
44
+ if (channel === 'next') return 'next';
45
+ if (channel === 'nightly') return 'nightly';
46
+ return 'latest';
47
+ }
48
+
49
+ /**
50
+ * Update the active distribution.
51
+ *
52
+ * `web` means the lightweight CLI's signed resource distribution. Its
53
+ * resources resolve the selected signed channel on demand; it must not replace
54
+ * itself with the full global npm package. `source` is intentionally manual.
55
+ */
56
+ export async function updateInstallation(options = {}) {
57
+ const config = options.config ?? await loadConfig();
58
+ const detected = await detectInstallMode({ ...options, config });
59
+ const channel = options.channel ?? config.channel ?? 'stable';
60
+ const dryRun = options.dryRun === true;
61
+ const offline = options.offline === true;
62
+
63
+ if (detected.mode === 'web') {
64
+ if (offline) {
65
+ return {
66
+ ...detected,
67
+ channel,
68
+ status: 'unsupported-offline',
69
+ changed: false,
70
+ message: 'Web-backed AIWG cannot refresh signed resources while offline; verified cached resources remain available.',
71
+ };
72
+ }
73
+ if (dryRun) {
74
+ return {
75
+ ...detected,
76
+ channel,
77
+ status: 'dry-run',
78
+ changed: false,
79
+ message: `Would refresh the verified signed '${channel}' web resource release; no global package install would be attempted.`,
80
+ };
81
+ }
82
+ const refreshWebResources = options.refreshWebResources ?? (async (selector) => {
83
+ const { resolveWebRelease } = await import('../resources/web-release.js');
84
+ return resolveWebRelease({ selector });
85
+ });
86
+ const release = await refreshWebResources(channel);
87
+ return {
88
+ ...detected,
89
+ channel,
90
+ version: release.version,
91
+ status: 'updated',
92
+ changed: true,
93
+ message: `Refreshed the verified signed '${channel}' web resource release${release.version ? ` (${release.version})` : ''}; no global package install was attempted.`,
94
+ };
95
+ }
96
+
97
+ if (detected.mode === 'source') {
98
+ return {
99
+ ...detected,
100
+ channel,
101
+ status: 'manual',
102
+ changed: false,
103
+ message: `Source checkout detected at ${detected.packageRoot}. Update it with 'git pull --ff-only', then run 'npm ci && npm run build'; AIWG will not overwrite it with npm.`,
104
+ };
105
+ }
106
+
107
+ const tag = npmTag(channel);
108
+ const command = ['install', '--global', `aiwg@${tag}`];
109
+ if (!dryRun) {
110
+ const execute = options.execute ?? ((file, args) => execFileSync(file, args, { stdio: 'inherit' }));
111
+ execute('npm', command);
112
+ }
113
+ return {
114
+ ...detected,
115
+ channel,
116
+ status: dryRun ? 'dry-run' : 'updated',
117
+ changed: !dryRun,
118
+ command: `npm ${command.join(' ')}`,
119
+ message: dryRun
120
+ ? `Would update the full AIWG npm distribution on the '${tag}' channel.`
121
+ : `Updated the full AIWG npm distribution on the '${tag}' channel.`,
122
+ };
123
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwg/cli",
3
- "version": "2026.7.19",
3
+ "version": "2026.7.21",
4
4
  "description": "Lightweight AIWG CLI for signed, versioned web-backed resources.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "node": ">=20.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@fortemi/core": "2026.7.11",
59
+ "@fortemi/core": "2026.7.14",
60
60
  "@modelcontextprotocol/sdk": "^1.24.0",
61
61
  "chalk": "^4.1.2",
62
62
  "chokidar": "^3.6.0",
@@ -66,6 +66,7 @@
66
66
  "js-yaml": "^4.1.0",
67
67
  "listr2": "^8.2.5",
68
68
  "ora": "^5.4.1",
69
+ "semver": "^7.8.5",
69
70
  "yaml": "^2.8.1",
70
71
  "zod": "^3.25.0"
71
72
  },