@lesliechan721/aw 0.1.0-beta.7 → 0.1.0-beta.8

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 (237) hide show
  1. package/dist/authoring/scripts/init-plugin.mjs +4 -33
  2. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  3. package/dist/authoring/scripts/lib/plugin-version-check.mjs +1 -1
  4. package/dist/authoring/scripts/plugin-status.mjs +8 -11
  5. package/dist/authoring/scripts/plugin-status.mjs.map +1 -1
  6. package/dist/authoring/scripts/remove-plugin.mjs +1 -0
  7. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  8. package/dist/authoring/scripts/validate-plugin.mjs +104 -54
  9. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  10. package/dist/scripts/codex-eval-app-server.d.ts +2 -0
  11. package/dist/scripts/codex-eval-app-server.js +107 -1
  12. package/dist/scripts/codex-eval-app-server.js.map +1 -1
  13. package/dist/scripts/eval-plugin-skills.js +5 -2
  14. package/dist/scripts/eval-plugin-skills.js.map +1 -1
  15. package/dist/scripts/plugin-eval-contract.d.ts +5 -1
  16. package/dist/scripts/plugin-eval-contract.js +54 -4
  17. package/dist/scripts/plugin-eval-contract.js.map +1 -1
  18. package/dist/scripts/plugin-staging.d.ts +6 -7
  19. package/dist/scripts/plugin-staging.js +11 -23
  20. package/dist/scripts/plugin-staging.js.map +1 -1
  21. package/dist/scripts/test-plugin-scripts.js +2 -33
  22. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  23. package/dist/src/adapters/helpers.js +2 -2
  24. package/dist/src/adapters/helpers.js.map +1 -1
  25. package/dist/src/authoring/workspace-commands.d.ts +17 -2
  26. package/dist/src/authoring/workspace-commands.js +21 -4
  27. package/dist/src/authoring/workspace-commands.js.map +1 -1
  28. package/dist/src/commands/aw-capabilities.d.ts +78 -0
  29. package/dist/src/commands/aw-capabilities.js +259 -0
  30. package/dist/src/commands/aw-capabilities.js.map +1 -0
  31. package/dist/src/commands/catalog-context.d.ts +52 -0
  32. package/dist/src/commands/catalog-context.js +156 -0
  33. package/dist/src/commands/catalog-context.js.map +1 -0
  34. package/dist/src/commands/catalog-dev-source.d.ts +112 -0
  35. package/dist/src/commands/catalog-dev-source.js +481 -0
  36. package/dist/src/commands/catalog-dev-source.js.map +1 -0
  37. package/dist/src/commands/catalog-generation.d.ts +26 -0
  38. package/dist/src/commands/catalog-generation.js +14 -0
  39. package/dist/src/commands/catalog-generation.js.map +1 -0
  40. package/dist/src/commands/catalog-publication-inspection.d.ts +1 -1
  41. package/dist/src/commands/catalog-publication-inspection.js +4 -5
  42. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  43. package/dist/src/commands/catalog-publication-target.d.ts +17 -0
  44. package/dist/src/commands/catalog-publication-target.js +60 -0
  45. package/dist/src/commands/catalog-publication-target.js.map +1 -0
  46. package/dist/src/commands/catalog-publish.d.ts +8 -1
  47. package/dist/src/commands/catalog-publish.js +25 -2
  48. package/dist/src/commands/catalog-publish.js.map +1 -1
  49. package/dist/src/commands/catalog-source.d.ts +23 -1
  50. package/dist/src/commands/catalog-source.js +126 -40
  51. package/dist/src/commands/catalog-source.js.map +1 -1
  52. package/dist/src/commands/catalog-status.d.ts +18 -2
  53. package/dist/src/commands/catalog-status.js +122 -18
  54. package/dist/src/commands/catalog-status.js.map +1 -1
  55. package/dist/src/commands/init.js +1 -1
  56. package/dist/src/commands/init.js.map +1 -1
  57. package/dist/src/commands/offline-cleanup-evidence.d.ts +23 -0
  58. package/dist/src/commands/offline-cleanup-evidence.js +38 -0
  59. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -0
  60. package/dist/src/commands/options.d.ts +1 -0
  61. package/dist/src/commands/options.js +1 -0
  62. package/dist/src/commands/options.js.map +1 -1
  63. package/dist/src/commands/plugin-capabilities.js +1 -1
  64. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  65. package/dist/src/commands/rebuild-command.d.ts +19 -7
  66. package/dist/src/commands/rebuild-command.js +415 -205
  67. package/dist/src/commands/rebuild-command.js.map +1 -1
  68. package/dist/src/commands/rebuild-integration.d.ts +10 -3
  69. package/dist/src/commands/rebuild-integration.js +71 -76
  70. package/dist/src/commands/rebuild-integration.js.map +1 -1
  71. package/dist/src/commands/rebuild-operations.d.ts +0 -8
  72. package/dist/src/commands/rebuild-operations.js +17 -115
  73. package/dist/src/commands/rebuild-operations.js.map +1 -1
  74. package/dist/src/commands/runtime.js +21 -34
  75. package/dist/src/commands/runtime.js.map +1 -1
  76. package/dist/src/commands/{status-v4.d.ts → status-v5.d.ts} +67 -21
  77. package/dist/src/commands/{status-v4.js → status-v5.js} +260 -30
  78. package/dist/src/commands/status-v5.js.map +1 -0
  79. package/dist/src/commands/wizard.d.ts +2 -2
  80. package/dist/src/commands/wizard.js +2 -2
  81. package/dist/src/commands/wizard.js.map +1 -1
  82. package/dist/src/commands/write-commands.js +73 -17
  83. package/dist/src/commands/write-commands.js.map +1 -1
  84. package/dist/src/constants.d.ts +6 -1
  85. package/dist/src/constants.js +6 -1
  86. package/dist/src/constants.js.map +1 -1
  87. package/dist/src/generators/local-plugin.js +57 -3
  88. package/dist/src/generators/local-plugin.js.map +1 -1
  89. package/dist/src/index.d.ts +4 -1
  90. package/dist/src/index.js +562 -85
  91. package/dist/src/index.js.map +1 -1
  92. package/dist/src/output/model.d.ts +1 -34
  93. package/dist/src/output/model.js +1 -144
  94. package/dist/src/output/model.js.map +1 -1
  95. package/dist/src/output/rebuild-progress.js +0 -3
  96. package/dist/src/output/rebuild-progress.js.map +1 -1
  97. package/dist/src/portable/commands.d.ts +4 -0
  98. package/dist/src/portable/commands.js +61 -4
  99. package/dist/src/portable/commands.js.map +1 -1
  100. package/dist/src/portable/materializer.d.ts +3 -0
  101. package/dist/src/portable/materializer.js +61 -10
  102. package/dist/src/portable/materializer.js.map +1 -1
  103. package/dist/src/tui/catalog-generation.d.ts +56 -0
  104. package/dist/src/tui/catalog-generation.js +244 -0
  105. package/dist/src/tui/catalog-generation.js.map +1 -0
  106. package/dist/src/tui/console-app-v4.d.ts +1 -1
  107. package/dist/src/tui/console-app-v4.js +446 -126
  108. package/dist/src/tui/console-app-v4.js.map +1 -1
  109. package/dist/src/tui/controller-runtime.d.ts +8 -2
  110. package/dist/src/tui/controller-runtime.js +606 -92
  111. package/dist/src/tui/controller-runtime.js.map +1 -1
  112. package/dist/src/tui/controller.d.ts +71 -6
  113. package/dist/src/tui/controller.js +377 -83
  114. package/dist/src/tui/controller.js.map +1 -1
  115. package/dist/src/tui/index.d.ts +1 -0
  116. package/dist/src/tui/index.js +1 -0
  117. package/dist/src/tui/index.js.map +1 -1
  118. package/dist/src/tui/input-display.d.ts +8 -0
  119. package/dist/src/tui/input-display.js +36 -0
  120. package/dist/src/tui/input-display.js.map +1 -0
  121. package/dist/src/tui/model.d.ts +27 -7
  122. package/dist/src/tui/model.js +273 -65
  123. package/dist/src/tui/model.js.map +1 -1
  124. package/dist/src/tui/router.d.ts +26 -0
  125. package/dist/src/tui/router.js.map +1 -1
  126. package/dist/src/tui/source-ref-presets.d.ts +3 -0
  127. package/dist/src/tui/source-ref-presets.js +11 -0
  128. package/dist/src/tui/source-ref-presets.js.map +1 -0
  129. package/dist/src/tui/views.js +31 -3
  130. package/dist/src/tui/views.js.map +1 -1
  131. package/dist/src/types.d.ts +90 -6
  132. package/dist/src/types.js.map +1 -1
  133. package/dist/src/utils/agent-version.d.ts +3 -0
  134. package/dist/src/utils/agent-version.js +13 -5
  135. package/dist/src/utils/agent-version.js.map +1 -1
  136. package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
  137. package/dist/src/utils/aw-home-mutation-lock.js +32 -4
  138. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  139. package/dist/src/utils/bundle-integrity.d.ts +0 -1
  140. package/dist/src/utils/bundle-integrity.js +0 -25
  141. package/dist/src/utils/bundle-integrity.js.map +1 -1
  142. package/dist/src/utils/bundle-layout.js +8 -6
  143. package/dist/src/utils/bundle-layout.js.map +1 -1
  144. package/dist/src/utils/catalog-digests.js +13 -2
  145. package/dist/src/utils/catalog-digests.js.map +1 -1
  146. package/dist/src/utils/catalog-generation-error.d.ts +12 -0
  147. package/dist/src/utils/catalog-generation-error.js +16 -0
  148. package/dist/src/utils/catalog-generation-error.js.map +1 -0
  149. package/dist/src/utils/catalog-generation-resolver.d.ts +13 -0
  150. package/dist/src/utils/catalog-generation-resolver.js +129 -0
  151. package/dist/src/utils/catalog-generation-resolver.js.map +1 -0
  152. package/dist/src/utils/catalog-generation-service.d.ts +52 -0
  153. package/dist/src/utils/catalog-generation-service.js +620 -0
  154. package/dist/src/utils/catalog-generation-service.js.map +1 -0
  155. package/dist/src/utils/catalog-generation-state.d.ts +13 -0
  156. package/dist/src/utils/catalog-generation-state.js +201 -0
  157. package/dist/src/utils/catalog-generation-state.js.map +1 -0
  158. package/dist/src/utils/catalog-generation-store.d.ts +44 -0
  159. package/dist/src/utils/catalog-generation-store.js +387 -0
  160. package/dist/src/utils/catalog-generation-store.js.map +1 -0
  161. package/dist/src/utils/catalog-manifest-v5.d.ts +5 -0
  162. package/dist/src/utils/{catalog-manifest-v4.js → catalog-manifest-v5.js} +39 -35
  163. package/dist/src/utils/{catalog-manifest-v4.js.map → catalog-manifest-v5.js.map} +1 -1
  164. package/dist/src/utils/catalog-operation-context.d.ts +28 -0
  165. package/dist/src/utils/catalog-operation-context.js +242 -0
  166. package/dist/src/utils/catalog-operation-context.js.map +1 -0
  167. package/dist/src/utils/catalog-public-error.d.ts +7 -3
  168. package/dist/src/utils/catalog-public-error.js +20 -4
  169. package/dist/src/utils/catalog-public-error.js.map +1 -1
  170. package/dist/src/utils/catalog-snapshot.d.ts +5 -3
  171. package/dist/src/utils/catalog-snapshot.js +11 -3
  172. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  173. package/dist/src/utils/catalog-source-cache.d.ts +1 -1
  174. package/dist/src/utils/catalog-source-cache.js +37 -12
  175. package/dist/src/utils/catalog-source-cache.js.map +1 -1
  176. package/dist/src/utils/catalog-source-identity.d.ts +1 -0
  177. package/dist/src/utils/catalog-source-identity.js +21 -2
  178. package/dist/src/utils/catalog-source-identity.js.map +1 -1
  179. package/dist/src/utils/catalog-sources.d.ts +1 -0
  180. package/dist/src/utils/catalog-sources.js +30 -11
  181. package/dist/src/utils/catalog-sources.js.map +1 -1
  182. package/dist/src/utils/codex-config.js +4 -4
  183. package/dist/src/utils/codex-config.js.map +1 -1
  184. package/dist/src/utils/codex-manager.d.ts +33 -0
  185. package/dist/src/utils/codex-manager.js +656 -0
  186. package/dist/src/utils/codex-manager.js.map +1 -0
  187. package/dist/src/utils/codex-skill-staging.d.ts +2 -0
  188. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  189. package/dist/src/utils/dynamic-skill-tree.d.ts +4 -0
  190. package/dist/src/utils/dynamic-skill-tree.js +35 -5
  191. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  192. package/dist/src/utils/git-catalog-provider.js +10 -25
  193. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  194. package/dist/src/utils/lifecycle-active-store.d.ts +0 -28
  195. package/dist/src/utils/lifecycle-active-store.js +35 -247
  196. package/dist/src/utils/lifecycle-active-store.js.map +1 -1
  197. package/dist/src/utils/multi-source-catalog.d.ts +3 -0
  198. package/dist/src/utils/multi-source-catalog.js +120 -10
  199. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  200. package/dist/src/utils/native-cli.d.ts +15 -6
  201. package/dist/src/utils/native-cli.js +31 -39
  202. package/dist/src/utils/native-cli.js.map +1 -1
  203. package/dist/src/utils/orphan-marketplace-cleanup.js +0 -3
  204. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  205. package/dist/src/utils/ownership.d.ts +10 -1
  206. package/dist/src/utils/ownership.js +52 -24
  207. package/dist/src/utils/ownership.js.map +1 -1
  208. package/dist/src/utils/path-catalog-provider.js +12 -8
  209. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  210. package/dist/src/utils/plugin-config-write.js +18 -35
  211. package/dist/src/utils/plugin-config-write.js.map +1 -1
  212. package/dist/src/utils/plugin-config.d.ts +1 -12
  213. package/dist/src/utils/plugin-config.js +107 -226
  214. package/dist/src/utils/plugin-config.js.map +1 -1
  215. package/dist/src/utils/plugin-scripts.d.ts +1 -1
  216. package/dist/src/utils/plugin-scripts.js +1 -1
  217. package/dist/src/utils/plugin-scripts.js.map +1 -1
  218. package/dist/src/utils/state-paths.js +7 -2
  219. package/dist/src/utils/state-paths.js.map +1 -1
  220. package/dist/src/utils/target-eligibility.d.ts +7 -2
  221. package/dist/src/utils/target-eligibility.js +6 -3
  222. package/dist/src/utils/target-eligibility.js.map +1 -1
  223. package/package.json +4 -3
  224. package/dist/authoring/scripts/check-plugin-versions.d.mts +0 -2
  225. package/dist/authoring/scripts/check-plugin-versions.mjs +0 -5
  226. package/dist/authoring/scripts/check-plugin-versions.mjs.map +0 -1
  227. package/dist/src/commands/status-v4.js.map +0 -1
  228. package/dist/src/commands/status.d.ts +0 -93
  229. package/dist/src/commands/status.js +0 -442
  230. package/dist/src/commands/status.js.map +0 -1
  231. package/dist/src/utils/active-marketplace-runtime-lock.d.ts +0 -12
  232. package/dist/src/utils/active-marketplace-runtime-lock.js +0 -133
  233. package/dist/src/utils/active-marketplace-runtime-lock.js.map +0 -1
  234. package/dist/src/utils/catalog-manifest-v3.d.ts +0 -2
  235. package/dist/src/utils/catalog-manifest-v3.js +0 -3
  236. package/dist/src/utils/catalog-manifest-v3.js.map +0 -1
  237. package/dist/src/utils/catalog-manifest-v4.d.ts +0 -5
@@ -0,0 +1,259 @@
1
+ import crypto from 'node:crypto';
2
+ import path from 'node:path';
3
+ import { readCatalogWorkspace, resolveCatalogWorkspaceRoot, } from '@lesliechan721/aw-plugin-core';
4
+ import { checkAwCapabilitySupport, createAwPluginRequirementsReceipt, computeAwCapabilitySetDigest, getPluginCoreVersion, parseAwPluginRequirementsReceipt, resolvePluginRequirements, normalizeAwCapabilities, } from '@lesliechan721/aw-plugin-core/manifest';
5
+ import fs from 'fs-extra';
6
+ import { CLI_RESERVED_IMPORTS, readPluginManifest } from '../utils/manifest.js';
7
+ export const IMPLEMENTED_AW_CAPABILITIES = [
8
+ 'aw.plugin-manifest.v2',
9
+ 'aw.plugin-skills.v1',
10
+ 'aw.plugin-build-config.v1',
11
+ 'aw.plugin-config.v1',
12
+ 'aw.plugin-lifecycle.v1',
13
+ 'aw.dynamic-artifacts.v2',
14
+ 'aw.portable-skills.v1',
15
+ 'aw.runtime-imports.v1',
16
+ 'aw.skill-validation.v1',
17
+ 'aw.plugin-authoring.v1',
18
+ 'aw.catalog-authoring.v1',
19
+ 'aw.catalog-context.v1',
20
+ 'aw.catalog-source.v2',
21
+ 'aw.catalog-dev-source.v1',
22
+ 'aw.catalog-publication.v1',
23
+ 'aw.catalog-snapshot.v5',
24
+ 'aw.self-check.v1',
25
+ ];
26
+ export class AwCapabilityUnsupportedError extends Error {
27
+ code = 'awCapabilityUnsupported';
28
+ plugin;
29
+ missingCapabilities;
30
+ availableCapabilities;
31
+ constructor(plugin, missingCapabilities) {
32
+ const missing = [...missingCapabilities];
33
+ super(`Plugin "${plugin}" requires unsupported AW capabilities: ${missing.join(', ')}.`);
34
+ this.name = 'AwCapabilityUnsupportedError';
35
+ this.plugin = plugin;
36
+ this.missingCapabilities = missing;
37
+ this.availableCapabilities = [...IMPLEMENTED_AW_CAPABILITIES].sort();
38
+ }
39
+ }
40
+ export function describeCurrentAw(awVersion) {
41
+ const capabilities = [...IMPLEMENTED_AW_CAPABILITIES].sort();
42
+ return {
43
+ schemaVersion: 1,
44
+ command: 'self:describe',
45
+ awVersion,
46
+ coreVersion: getPluginCoreVersion(),
47
+ capabilities,
48
+ capabilitySetDigest: computeAwCapabilitySetDigest(capabilities),
49
+ };
50
+ }
51
+ async function startDirectory(from) {
52
+ const resolved = path.resolve(from);
53
+ const stats = await fs.stat(resolved);
54
+ return stats.isDirectory() ? resolved : path.dirname(resolved);
55
+ }
56
+ async function candidateExists(filePath) {
57
+ try {
58
+ const stats = await fs.lstat(filePath);
59
+ if (!stats.isFile())
60
+ throw new Error(`Invalid AW plugin requirements candidate: expected a regular file at ${filePath}.`);
61
+ return true;
62
+ }
63
+ catch (error) {
64
+ if (error.code === 'ENOENT')
65
+ return false;
66
+ throw error;
67
+ }
68
+ }
69
+ async function requirementsFromManifest(pluginRoot) {
70
+ let plugin;
71
+ try {
72
+ plugin = await readPluginManifest(pluginRoot, { mode: 'bundle' });
73
+ }
74
+ catch (bundleError) {
75
+ try {
76
+ plugin = await readPluginManifest(pluginRoot, { mode: 'source' });
77
+ }
78
+ catch {
79
+ throw bundleError;
80
+ }
81
+ }
82
+ const resolution = await resolvePluginRequirements({
83
+ pluginRoot,
84
+ manifest: plugin.manifest,
85
+ implementedCapabilities: IMPLEMENTED_AW_CAPABILITIES,
86
+ });
87
+ return {
88
+ source: { kind: 'manifest', path: plugin.manifestPath },
89
+ plugin: { name: plugin.manifest.name, version: plugin.manifest.version },
90
+ requiredCapabilities: resolution.effective,
91
+ capabilitySetDigest: resolution.capabilitySetDigest,
92
+ resolution,
93
+ };
94
+ }
95
+ export async function discoverAwPluginRequirements(from) {
96
+ let current = await startDirectory(from);
97
+ while (true) {
98
+ const receiptPath = path.join(current, 'aw-plugin-requirements.json');
99
+ if (await candidateExists(receiptPath)) {
100
+ const receipt = parseAwPluginRequirementsReceipt(await fs.readJson(receiptPath));
101
+ return {
102
+ source: { kind: 'receipt', path: receiptPath },
103
+ plugin: receipt.plugin,
104
+ requiredCapabilities: receipt.requiredCapabilities,
105
+ capabilitySetDigest: receipt.digest,
106
+ };
107
+ }
108
+ const manifestPath = path.join(current, '.agents-plugin', 'plugin.json');
109
+ if (await candidateExists(manifestPath))
110
+ return requirementsFromManifest(current);
111
+ const parent = path.dirname(current);
112
+ if (parent === current)
113
+ break;
114
+ current = parent;
115
+ }
116
+ throw new Error('No aw-plugin-requirements.json or .agents-plugin/plugin.json was found.');
117
+ }
118
+ export async function checkCurrentAw(options) {
119
+ try {
120
+ const discovered = await discoverAwPluginRequirements(options.from);
121
+ const support = checkAwCapabilitySupport(discovered.requiredCapabilities, IMPLEMENTED_AW_CAPABILITIES);
122
+ const observations = discovered.resolution?.observations ?? [];
123
+ const hasBlockingObservation = observations.some((observation) => observation.blocking);
124
+ return {
125
+ schemaVersion: 1,
126
+ command: 'self:check',
127
+ ok: support.supported && !hasBlockingObservation,
128
+ awVersion: options.awVersion,
129
+ coreVersion: getPluginCoreVersion(),
130
+ source: discovered.source,
131
+ plugin: discovered.plugin,
132
+ requiredCapabilities: discovered.requiredCapabilities,
133
+ capabilitySetDigest: discovered.capabilitySetDigest,
134
+ missingCapabilities: support.missing,
135
+ observations,
136
+ ...(hasBlockingObservation ? {
137
+ error: 'Plugin requirements contain an unmapped AW CLI command literal.',
138
+ } : {}),
139
+ };
140
+ }
141
+ catch (error) {
142
+ return {
143
+ schemaVersion: 1,
144
+ command: 'self:check',
145
+ ok: false,
146
+ awVersion: options.awVersion,
147
+ coreVersion: getPluginCoreVersion(),
148
+ source: null,
149
+ plugin: null,
150
+ requiredCapabilities: [],
151
+ capabilitySetDigest: null,
152
+ missingCapabilities: [],
153
+ observations: [],
154
+ error: error instanceof Error ? error.message : String(error),
155
+ };
156
+ }
157
+ }
158
+ async function resolveCanonicalPluginRequirementsTarget(options) {
159
+ const requestedPluginRoot = path.resolve(options.cwd, options.pluginDirectory);
160
+ const workspaceResolution = await resolveCatalogWorkspaceRoot({
161
+ cwd: requestedPluginRoot,
162
+ ...(options.workspaceRoot === undefined
163
+ ? {}
164
+ : { explicitRoot: path.resolve(options.cwd, options.workspaceRoot) }),
165
+ mode: 'existing',
166
+ });
167
+ const workspace = await readCatalogWorkspace(workspaceResolution.workspaceRoot, {
168
+ reservedImports: CLI_RESERVED_IMPORTS,
169
+ });
170
+ const stat = await fs.lstat(requestedPluginRoot).catch((error) => {
171
+ if (error.code === 'ENOENT')
172
+ return null;
173
+ throw error;
174
+ });
175
+ if (!stat?.isDirectory() || stat.isSymbolicLink()) {
176
+ throw new Error(`Plugin directory must be a regular non-symbolic-link directory: ${requestedPluginRoot}`);
177
+ }
178
+ const canonicalPluginRoot = await fs.realpath(requestedPluginRoot);
179
+ const plugin = workspace.plugins.find((entry) => entry.rootDir === canonicalPluginRoot);
180
+ const expectedPluginRoot = plugin
181
+ ? path.join(workspace.workspaceRoot, 'plugins', plugin.manifest.name)
182
+ : null;
183
+ if (!plugin
184
+ || expectedPluginRoot !== canonicalPluginRoot) {
185
+ throw new Error(`Plugin directory is not a canonical plugin in this Catalog Workspace: ${requestedPluginRoot}`);
186
+ }
187
+ return {
188
+ plugin,
189
+ workspaceRoot: workspace.workspaceRoot,
190
+ workspaceRootResolvedFrom: workspaceResolution.workspaceRootResolvedFrom,
191
+ };
192
+ }
193
+ async function writeJsonAtomic(filePath, value) {
194
+ const temporaryPath = path.join(path.dirname(filePath), `.${path.basename(filePath)}.${crypto.randomUUID()}.tmp`);
195
+ await fs.writeFile(temporaryPath, `${JSON.stringify(value, null, 2)}\n`, { flag: 'wx' });
196
+ try {
197
+ await fs.rename(temporaryPath, filePath);
198
+ }
199
+ catch (error) {
200
+ await fs.remove(temporaryPath);
201
+ throw error;
202
+ }
203
+ }
204
+ export async function inspectPluginRequirements(options) {
205
+ if (options.add !== undefined && options.remove !== undefined) {
206
+ throw new Error('Use exactly one of --add or --remove.');
207
+ }
208
+ const target = await resolveCanonicalPluginRequirementsTarget(options);
209
+ const pluginRoot = target.plugin.rootDir;
210
+ let plugin = target.plugin;
211
+ let mutation;
212
+ const action = options.add === undefined
213
+ ? (options.remove === undefined ? undefined : 'remove')
214
+ : 'add';
215
+ const capability = options.add ?? options.remove;
216
+ const initialResolution = await resolvePluginRequirements({
217
+ pluginRoot,
218
+ manifest: plugin.manifest,
219
+ implementedCapabilities: IMPLEMENTED_AW_CAPABILITIES,
220
+ });
221
+ if (action && capability) {
222
+ const normalizedCapability = normalizeAwCapabilities([capability], `--${action}`)[0];
223
+ if (initialResolution.observations.some((observation) => observation.blocking)) {
224
+ throw new Error('Cannot mutate plugin requirements while an unmapped AW CLI command literal is present.');
225
+ }
226
+ const before = normalizeAwCapabilities(plugin.manifest.requires?.aw.capabilities ?? []);
227
+ const after = action === 'add'
228
+ ? normalizeAwCapabilities([...before, normalizedCapability])
229
+ : before.filter((value) => value !== normalizedCapability);
230
+ const changed = before.length !== after.length;
231
+ if (changed) {
232
+ const raw = await fs.readJson(plugin.manifestPath);
233
+ raw.requires = { aw: { capabilities: after } };
234
+ await writeJsonAtomic(plugin.manifestPath, raw);
235
+ plugin = await readPluginManifest(pluginRoot, { mode: 'source' });
236
+ }
237
+ mutation = { action, capability: normalizedCapability, changed };
238
+ }
239
+ const resolution = mutation?.changed
240
+ ? await resolvePluginRequirements({
241
+ pluginRoot,
242
+ manifest: plugin.manifest,
243
+ implementedCapabilities: IMPLEMENTED_AW_CAPABILITIES,
244
+ })
245
+ : initialResolution;
246
+ return {
247
+ command: 'plugin:requirements',
248
+ plugin: { name: plugin.manifest.name, version: plugin.manifest.version },
249
+ pluginDirectory: pluginRoot,
250
+ workspaceRoot: target.workspaceRoot,
251
+ workspaceRootResolvedFrom: target.workspaceRootResolvedFrom,
252
+ ...(mutation ? { mutation } : {}),
253
+ ...resolution,
254
+ };
255
+ }
256
+ export function createRequirementsReceipt(plugin, requiredCapabilities) {
257
+ return createAwPluginRequirementsReceipt(plugin, requiredCapabilities);
258
+ }
259
+ //# sourceMappingURL=aw-capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aw-capabilities.js","sourceRoot":"","sources":["../../../src/commands/aw-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAG5B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,4BAA4B,EAC5B,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QAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACxE,eAAe,EAAE,UAAU;QAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,yBAAyB,EAAE,MAAM,CAAC,yBAAyB;QAC3D,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,GAAG,UAAU;KACd,CAAA;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,MAAyC,EACzC,oBAA8B;IAE9B,OAAO,iCAAiC,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;AACxE,CAAC"}
@@ -0,0 +1,52 @@
1
+ export declare function getCatalogContext(options: {
2
+ cwd: string;
3
+ workspaceRoot?: string;
4
+ remote?: string;
5
+ branch?: string;
6
+ env: NodeJS.ProcessEnv;
7
+ awVersion: string;
8
+ capabilities: readonly string[];
9
+ }): Promise<{
10
+ schemaVersion: number;
11
+ command: string;
12
+ toolchain: {
13
+ awVersion: string;
14
+ coreVersion: string;
15
+ capabilities: string[];
16
+ digest: string;
17
+ };
18
+ workspace: {
19
+ found: boolean;
20
+ root: string | null;
21
+ identity: string | null;
22
+ resolvedFrom: import("@lesliechan721/aw-plugin-core").CatalogWorkspaceResolvedFrom | null;
23
+ };
24
+ initialization: {
25
+ suggestedRoot: string | null;
26
+ resolvedFrom: import("@lesliechan721/aw-plugin-core").CatalogWorkspaceResolvedFrom | null;
27
+ };
28
+ git: {
29
+ repositoryRoot: string | null;
30
+ sourceHead: string | null;
31
+ clean: boolean | null;
32
+ remotes: string[];
33
+ };
34
+ publication: {
35
+ remote: string | null;
36
+ remoteResolvedFrom: import("./catalog-publication-target.js").CatalogRemoteResolvedFrom;
37
+ branch: string;
38
+ branchResolvedFrom: import("./catalog-publication-target.js").CatalogBranchResolvedFrom;
39
+ ambiguous: boolean;
40
+ };
41
+ developmentSource: {
42
+ snapshotPath: string;
43
+ suggestedSourceId: string;
44
+ existingSourceId: string | null;
45
+ active: boolean;
46
+ };
47
+ issues: {
48
+ code: string;
49
+ message: string;
50
+ blocking: boolean;
51
+ }[];
52
+ }>;
@@ -0,0 +1,156 @@
1
+ import { execFile } from 'node:child_process';
2
+ import crypto from 'node:crypto';
3
+ import path from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ import { getPluginCoreVersion, readCatalogWorkspace, resolveCatalogWorkspaceRoot, } from '@lesliechan721/aw-plugin-core';
6
+ import { resolveCatalogPublicationTarget } from './catalog-publication-target.js';
7
+ import { suggestedCatalogDevSourceId } from './catalog-dev-source.js';
8
+ import { sanitizedGitEnvironment } from './catalog-publication-inspection.js';
9
+ import { CLI_RESERVED_IMPORTS } from '../utils/manifest.js';
10
+ import { readCatalogSourcesConfigSnapshot } from '../utils/catalog-sources.js';
11
+ const execFileAsync = promisify(execFile);
12
+ function digest(value) {
13
+ return `sha256:${crypto.createHash('sha256').update(JSON.stringify(value)).digest('hex')}`;
14
+ }
15
+ async function git(cwd, args, env) {
16
+ try {
17
+ return (await execFileAsync('git', args, {
18
+ cwd,
19
+ env: { ...sanitizedGitEnvironment(env), GIT_OPTIONAL_LOCKS: '0' },
20
+ encoding: 'utf8',
21
+ })).stdout.trim();
22
+ }
23
+ catch {
24
+ return null;
25
+ }
26
+ }
27
+ export async function getCatalogContext(options) {
28
+ const issues = [];
29
+ let existing = null;
30
+ let initialization = null;
31
+ let workspaceIdentity = null;
32
+ try {
33
+ existing = await resolveCatalogWorkspaceRoot({
34
+ cwd: options.cwd,
35
+ ...(options.workspaceRoot === undefined ? {} : { explicitRoot: options.workspaceRoot }),
36
+ mode: 'existing',
37
+ });
38
+ workspaceIdentity = (await readCatalogWorkspace(existing.workspaceRoot, {
39
+ reservedImports: CLI_RESERVED_IMPORTS,
40
+ })).workspaceIdentity;
41
+ }
42
+ catch (error) {
43
+ const message = error instanceof Error ? error.message : String(error);
44
+ const blocking = !message.startsWith('Catalog Workspace marker not found from:');
45
+ issues.push({
46
+ code: blocking ? 'workspaceInvalid' : 'workspaceUnavailable',
47
+ message,
48
+ blocking,
49
+ });
50
+ }
51
+ try {
52
+ initialization = await resolveCatalogWorkspaceRoot({
53
+ cwd: options.cwd,
54
+ ...(options.workspaceRoot === undefined ? {} : { explicitRoot: options.workspaceRoot }),
55
+ mode: 'initialize',
56
+ });
57
+ }
58
+ catch (error) {
59
+ if (!issues.some((issue) => issue.blocking)) {
60
+ issues.push({
61
+ code: 'workspaceInvalid',
62
+ message: error instanceof Error ? error.message : String(error),
63
+ blocking: true,
64
+ });
65
+ }
66
+ }
67
+ const inspectionRoot = existing?.workspaceRoot ?? initialization?.workspaceRoot ?? path.resolve(options.cwd);
68
+ const target = await resolveCatalogPublicationTarget({
69
+ workspaceRoot: inspectionRoot,
70
+ remote: options.remote,
71
+ branch: options.branch,
72
+ env: options.env,
73
+ });
74
+ const repositoryRoot = target.repositoryRoot;
75
+ const sourceHead = repositoryRoot ? await git(repositoryRoot, ['rev-parse', '--verify', 'HEAD'], options.env) : null;
76
+ const status = repositoryRoot
77
+ ? await git(repositoryRoot, ['status', '--porcelain=v1', '--untracked-files=all', '--ignore-submodules=none'], options.env)
78
+ : null;
79
+ const remotesText = repositoryRoot ? await git(repositoryRoot, ['remote'], options.env) : null;
80
+ const remotes = remotesText ? remotesText.split('\n').filter(Boolean).sort() : [];
81
+ const capabilities = [...options.capabilities].sort();
82
+ let suggestedSourceId = suggestedCatalogDevSourceId(inspectionRoot);
83
+ let existingSourceId = null;
84
+ let active = false;
85
+ if (workspaceIdentity !== null) {
86
+ try {
87
+ const sourceConfig = await readCatalogSourcesConfigSnapshot(options.env);
88
+ const owned = sourceConfig.config.sources.filter((source) => source.type === 'path'
89
+ && source.managedBy?.kind === 'catalog-workspace'
90
+ && source.managedBy.workspaceIdentity === workspaceIdentity);
91
+ if (owned.length > 1) {
92
+ issues.push({
93
+ code: 'managedSourceAmbiguous',
94
+ message: `Catalog Workspace owns multiple development sources: ${owned.map((source) => source.id).join(', ')}.`,
95
+ blocking: true,
96
+ });
97
+ }
98
+ else if (owned.length === 1) {
99
+ existingSourceId = owned[0].id;
100
+ active = owned[0].path === path.join(inspectionRoot, '.aw', 'catalog');
101
+ suggestedSourceId = owned[0].id;
102
+ }
103
+ else {
104
+ suggestedSourceId = suggestedCatalogDevSourceId(inspectionRoot, workspaceIdentity, sourceConfig.config.sources.map((source) => source.id));
105
+ }
106
+ }
107
+ catch (error) {
108
+ issues.push({
109
+ code: 'sourceConfigInvalid',
110
+ message: error instanceof Error ? error.message : String(error),
111
+ blocking: true,
112
+ });
113
+ }
114
+ }
115
+ return {
116
+ schemaVersion: 1,
117
+ command: 'catalog:context',
118
+ toolchain: {
119
+ awVersion: options.awVersion,
120
+ coreVersion: getPluginCoreVersion(),
121
+ capabilities,
122
+ digest: digest({ awVersion: options.awVersion, coreVersion: getPluginCoreVersion(), capabilities }),
123
+ },
124
+ workspace: {
125
+ found: existing !== null && workspaceIdentity !== null,
126
+ root: existing?.workspaceRoot ?? null,
127
+ identity: workspaceIdentity,
128
+ resolvedFrom: existing?.workspaceRootResolvedFrom ?? null,
129
+ },
130
+ initialization: {
131
+ suggestedRoot: initialization?.workspaceRoot ?? null,
132
+ resolvedFrom: initialization?.workspaceRootResolvedFrom ?? null,
133
+ },
134
+ git: {
135
+ repositoryRoot,
136
+ sourceHead,
137
+ clean: status === null ? null : status === '',
138
+ remotes,
139
+ },
140
+ publication: {
141
+ remote: target.remote,
142
+ remoteResolvedFrom: target.remoteResolvedFrom,
143
+ branch: target.branch,
144
+ branchResolvedFrom: target.branchResolvedFrom,
145
+ ambiguous: target.ambiguous,
146
+ },
147
+ developmentSource: {
148
+ snapshotPath: path.join(inspectionRoot, '.aw', 'catalog'),
149
+ suggestedSourceId,
150
+ existingSourceId,
151
+ active,
152
+ },
153
+ issues,
154
+ };
155
+ }
156
+ //# sourceMappingURL=catalog-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,aAAa,IAAI,IAAI;YACrC,QAAQ,EAAE,iBAAiB;YAC3B,YAAY,EAAE,QAAQ,EAAE,yBAAyB,IAAI,IAAI;SAC1D;QACD,cAAc,EAAE;YACd,aAAa,EAAE,cAAc,EAAE,aAAa,IAAI,IAAI;YACpD,YAAY,EAAE,cAAc,EAAE,yBAAyB,IAAI,IAAI;SAChE;QACD,GAAG,EAAE;YACH,cAAc;YACd,UAAU;YACV,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE;YAC7C,OAAO;SACR;QACD,WAAW,EAAE;YACX,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;YAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;YAC7C,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B;QACD,iBAAiB,EAAE;YACjB,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,SAAS,CAAC;YACzD,iBAAiB;YACjB,gBAAgB;YAChB,MAAM;SACP;QACD,MAAM;KACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,112 @@
1
+ import { type CatalogSourceCommandRuntime } from './catalog-source.js';
2
+ type Issue = {
3
+ code: string;
4
+ message: string;
5
+ blocking: boolean;
6
+ };
7
+ export interface CatalogDevActivateReceipt {
8
+ receiptSchemaVersion: 1;
9
+ command: 'catalog:dev:activate';
10
+ ok: boolean;
11
+ state: 'completed' | 'partial';
12
+ workspaceIdentity: string | null;
13
+ snapshot: {
14
+ path: string;
15
+ action: 'reused' | 'built';
16
+ digest: string | null;
17
+ };
18
+ source: {
19
+ id: string;
20
+ action: 'added' | 'updated' | 'reused';
21
+ primary: boolean;
22
+ };
23
+ recovery: string[];
24
+ errors: Array<{
25
+ code: string;
26
+ message: string;
27
+ }>;
28
+ }
29
+ export interface CatalogDevStatusReceipt {
30
+ receiptSchemaVersion: 1;
31
+ command: 'catalog:dev:status';
32
+ ok: boolean;
33
+ workspaceIdentity: string | null;
34
+ workspaceRoot: string;
35
+ snapshot: {
36
+ path: string;
37
+ state: 'absent' | 'current' | 'stale' | 'invalid';
38
+ valid: boolean;
39
+ digest: string | null;
40
+ };
41
+ source: {
42
+ exists: boolean;
43
+ id: string | null;
44
+ pathMatches: boolean | null;
45
+ primary: boolean | null;
46
+ };
47
+ cache: {
48
+ state: 'not-applicable' | 'absent' | 'current' | 'last-good';
49
+ validatedAt: string | null;
50
+ snapshotDigest: string | null;
51
+ };
52
+ issues: Issue[];
53
+ }
54
+ export interface CatalogDevDeactivateReceipt {
55
+ receiptSchemaVersion: 1;
56
+ command: 'catalog:dev:deactivate';
57
+ ok: boolean;
58
+ state: 'completed' | 'partial';
59
+ workspaceIdentity: string | null;
60
+ snapshotPath: string;
61
+ source: {
62
+ id: string | null;
63
+ action: 'removed' | 'absent' | 'retained';
64
+ previousPrimary: boolean;
65
+ };
66
+ replacementPrimarySourceId: string | null;
67
+ recovery: string[];
68
+ errors: Array<{
69
+ code: string;
70
+ message: string;
71
+ }>;
72
+ }
73
+ export type CatalogDevSourceRuntime = {
74
+ sourceRuntime?: CatalogSourceCommandRuntime;
75
+ };
76
+ export declare function suggestedCatalogDevSourceId(workspaceRoot: string, workspaceIdentity?: string, occupiedSourceIds?: readonly string[]): string;
77
+ export type CatalogDevCommand = 'activate' | 'status' | 'deactivate';
78
+ export declare function createCatalogDevFailureReceipt(options: {
79
+ command: CatalogDevCommand;
80
+ cwd: string;
81
+ workspaceRoot?: string;
82
+ sourceId?: string;
83
+ code: string;
84
+ message: string;
85
+ }): CatalogDevActivateReceipt | CatalogDevStatusReceipt | CatalogDevDeactivateReceipt;
86
+ export declare function catalogDevSourceError(error: unknown, fallbackCode?: string): {
87
+ code: string;
88
+ message: string;
89
+ };
90
+ export declare function activateCatalogDevSource(options: {
91
+ cwd: string;
92
+ workspaceRoot?: string;
93
+ sourceId?: string;
94
+ primary?: boolean;
95
+ forceBuild?: boolean;
96
+ cliVersion: string;
97
+ env: NodeJS.ProcessEnv;
98
+ runtime?: CatalogDevSourceRuntime;
99
+ }): Promise<CatalogDevActivateReceipt>;
100
+ export declare function getCatalogDevSourceStatus(options: {
101
+ cwd: string;
102
+ workspaceRoot?: string;
103
+ cliVersion: string;
104
+ env: NodeJS.ProcessEnv;
105
+ }): Promise<CatalogDevStatusReceipt>;
106
+ export declare function deactivateCatalogDevSource(options: {
107
+ cwd: string;
108
+ workspaceRoot?: string;
109
+ env: NodeJS.ProcessEnv;
110
+ runtime?: CatalogDevSourceRuntime;
111
+ }): Promise<CatalogDevDeactivateReceipt>;
112
+ export {};