@rbbtsn0w/adg 0.6.0-beta.9 → 0.7.0-beta.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.
Files changed (50) hide show
  1. package/README.md +10 -7
  2. package/dist/bin/adg.js +4 -3
  3. package/dist/src/agents/base.js +2 -1
  4. package/dist/src/cli/core-plugin-handlers.js +97 -0
  5. package/dist/src/cli/handlers.js +4 -82
  6. package/dist/src/manifest.js +56 -3
  7. package/dist/src/subprocess.js +53 -0
  8. package/dist/vendor/skills/src/add.js +0 -15
  9. package/dist/vendor/skills/src/git-tree.js +4 -4
  10. package/dist/vendor/skills/src/skill-lock.js +4 -3
  11. package/dist/vendor/skills/src/update.js +9 -73
  12. package/dist/vendor/skills/src/use.js +28 -4
  13. package/docs/branching-and-release.md +52 -0
  14. package/package.json +11 -2
  15. package/schemas/adg-plugin.schema.json +1 -0
  16. package/vendor/skills/PROVENANCE.md +2 -0
  17. package/vendor/skills/package.json +0 -144
  18. package/vendor/skills/src/add.ts +0 -2213
  19. package/vendor/skills/src/agents.ts +0 -811
  20. package/vendor/skills/src/blob.ts +0 -588
  21. package/vendor/skills/src/cli.ts +0 -396
  22. package/vendor/skills/src/constants.ts +0 -3
  23. package/vendor/skills/src/detect-agent.ts +0 -62
  24. package/vendor/skills/src/find.ts +0 -419
  25. package/vendor/skills/src/frontmatter.ts +0 -16
  26. package/vendor/skills/src/git-tree.ts +0 -36
  27. package/vendor/skills/src/git.ts +0 -277
  28. package/vendor/skills/src/install.ts +0 -91
  29. package/vendor/skills/src/installer.ts +0 -1307
  30. package/vendor/skills/src/list.ts +0 -231
  31. package/vendor/skills/src/local-lock.ts +0 -189
  32. package/vendor/skills/src/plugin-manifest.ts +0 -183
  33. package/vendor/skills/src/prompts/search-multiselect.ts +0 -387
  34. package/vendor/skills/src/providers/index.ts +0 -14
  35. package/vendor/skills/src/providers/registry.ts +0 -51
  36. package/vendor/skills/src/providers/types.ts +0 -97
  37. package/vendor/skills/src/providers/wellknown.ts +0 -812
  38. package/vendor/skills/src/remove.ts +0 -335
  39. package/vendor/skills/src/sanitize.ts +0 -65
  40. package/vendor/skills/src/self-cli.ts +0 -20
  41. package/vendor/skills/src/skill-lock.ts +0 -329
  42. package/vendor/skills/src/skills.ts +0 -316
  43. package/vendor/skills/src/source-parser.ts +0 -449
  44. package/vendor/skills/src/sync.ts +0 -478
  45. package/vendor/skills/src/telemetry.ts +0 -226
  46. package/vendor/skills/src/test-utils.ts +0 -73
  47. package/vendor/skills/src/types.ts +0 -129
  48. package/vendor/skills/src/update-source.ts +0 -90
  49. package/vendor/skills/src/update.ts +0 -849
  50. package/vendor/skills/src/use.ts +0 -682
package/README.md CHANGED
@@ -423,7 +423,7 @@ private discovery path:
423
423
  # Developing from source
424
424
 
425
425
  For working on the CLI itself, or testing a plugin before release. The CLI runs
426
- directly on **Node ≥ 22.6** via native TypeScript type-stripping — **no build
426
+ directly on **Node ≥ 22.18** via native TypeScript type-stripping — **no build
427
427
  step**.
428
428
 
429
429
  ```bash
@@ -435,8 +435,11 @@ node bin/adg.ts --help
435
435
  node bin/adg.ts plugins validate plugins/asc
436
436
 
437
437
  # quality gates
438
- npm test # node --test (76 cases)
438
+ npm test # node --test
439
439
  npm run typecheck # tsc --noEmit
440
+ npm run check:docs # internal Markdown links
441
+ npm run build
442
+ npm run check:package-smoke # install and exercise the packed CLI
440
443
  ```
441
444
 
442
445
  Debugging tips:
@@ -448,11 +451,11 @@ Debugging tips:
448
451
  node bin/adg.ts plugins add ./some/repo --dir /tmp/adg-store
449
452
  node bin/adg.ts plugins list --dir /tmp/adg-store
450
453
  ```
451
- - **Refreshing reference artifacts:** the `plugins/.plugin-lock.json` and
452
- `plugins/marketplace.json` are generated. Re-sync the lock hashes from disk with
453
- `node bin/adg.ts plugins update --dir plugins`.
454
- - **Inspect generated manifests** under each plugin's `.claude-plugin/` and
455
- `.codex-plugin/` to confirm adaptation output.
454
+ - **Refreshing scratch artifacts:** `.plugin-lock.json` and `marketplace.json`
455
+ inside your chosen `--dir` store are generated. Re-sync that store with
456
+ `node bin/adg.ts plugins update --dir /tmp/adg-store`.
457
+ - **Inspect generated manifests** inside the scratch store to confirm adaptation
458
+ output without relying on ignored repository-local artifacts.
456
459
  - GitHub clone/sparse logic is injectable (`gitRunner`) and covered offline by
457
460
  the test suite; live network clones are exercised by `import owner/repo`.
458
461
 
package/dist/bin/adg.js CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { spawnSync } from "node:child_process";
3
2
  import { readFileSync, realpathSync } from "node:fs";
4
3
  import { dirname, join, resolve } from "node:path";
5
4
  import { fileURLToPath } from "node:url";
@@ -10,6 +9,7 @@ import { TOP_USAGE, fail } from "../src/cli/index.js";
10
9
  import { runPlugins } from "../src/cli/handlers.js";
11
10
  import { getTracer, shutdownTelemetry, sanitizeArgs } from "../src/telemetry.js";
12
11
  import { SpanKind, SpanStatusCode, propagation, context } from "@opentelemetry/api";
12
+ import { runSubprocessSync } from "../src/subprocess.js";
13
13
  // ---------------------------------------------------------------------------
14
14
  // `adg` entry point: thin wire-up only.
15
15
  //
@@ -47,7 +47,8 @@ function runSkills(verb, rest) {
47
47
  // Inject current active OpenTelemetry context into environment variables
48
48
  const envCarrier = {};
49
49
  propagation.inject(context.active(), envCarrier);
50
- const r = spawnSync(process.execPath, skillsChildArgv(entry, args), {
50
+ const childArgs = skillsChildArgv(entry, args);
51
+ const r = runSubprocessSync(process.execPath, childArgs, {
51
52
  stdio: "inherit",
52
53
  env: {
53
54
  ...process.env,
@@ -63,7 +64,7 @@ function runSelfUpdate(args) {
63
64
  return 0;
64
65
  }
65
66
  const command = selfUpdateCommand(options.beta);
66
- const r = spawnSync(command.command, command.args, selfUpdateSpawnOptions());
67
+ const r = runSubprocessSync(command.command, command.args, selfUpdateSpawnOptions());
67
68
  if (r.error) {
68
69
  console.error(r.error.message);
69
70
  return 1;
@@ -1,6 +1,7 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
3
3
  import { getTracer, sanitizeArgs } from "../telemetry.js";
4
+ import { runSubprocessSync } from "../subprocess.js";
4
5
  /**
5
6
  * The canonical "CLI absent, so nothing was touched" lifecycle result. Every
6
7
  * agent's activate/deactivate guard returns this shape; centralizing it keeps
@@ -99,7 +100,7 @@ export function makeCli(bin, opts) {
99
100
  // so importing an agent module never spawns a subprocess.
100
101
  let probed;
101
102
  return {
102
- available: () => (probed ??= spawnSync(bin, opts.probeArgs, { stdio: "ignore" }).status === 0),
103
+ available: () => (probed ??= runSubprocessSync(bin, opts.probeArgs, { stdio: "ignore" }).status === 0),
103
104
  run: (args) => {
104
105
  const tracer = getTracer();
105
106
  return tracer.startActiveSpan(bin, { kind: SpanKind.CLIENT }, (span) => {
@@ -0,0 +1,97 @@
1
+ import { resolve } from "node:path";
2
+ import { adaptPlugin } from "../commands/adapt.js";
3
+ import { initScaffold } from "../commands/init.js";
4
+ import { inspectSource } from "../commands/inspect.js";
5
+ import { listPlugins } from "../commands/list.js";
6
+ import { pluginStatus } from "../commands/status.js";
7
+ import { validatePlugin } from "../commands/validate.js";
8
+ import { ui } from "../render/ui.js";
9
+ import { pluginsListJson, pluginsStatusJson, printJson } from "../render/json.js";
10
+ import { renderPluginList, renderStatus } from "../render/plugins.js";
11
+ import { fail, parseVerb, resolveScopeDir, resolveTargets, scopeOf, } from "./index.js";
12
+ const CORE_PLUGIN_VERBS = new Set(["init", "adapt", "validate", "inspect", "list", "status"]);
13
+ export async function handleCorePluginVerb(verb, rest, cmd) {
14
+ if (!CORE_PLUGIN_VERBS.has(verb))
15
+ return false;
16
+ switch (verb) {
17
+ case "init": {
18
+ const { values, positionals } = parseVerb(verb, cmd.flags, rest);
19
+ const name = positionals[0];
20
+ if (!name)
21
+ fail("plugins init requires a <name>");
22
+ const dir = values.dir ? resolve(values.dir) : resolve(process.cwd(), "plugins");
23
+ const type = (values.type ?? "plugin");
24
+ if (type !== "plugin" && type !== "marketplace" && type !== "all") {
25
+ fail(`invalid --type "${values.type}" (expected plugin|marketplace|all)`);
26
+ }
27
+ const res = initScaffold({
28
+ name,
29
+ dir,
30
+ type,
31
+ description: values.description,
32
+ author: values.author,
33
+ skill: values.skill?.[0],
34
+ });
35
+ console.log(`${ui.ok(`created ${type}`)} at ${ui.name(res.pluginDir)}`);
36
+ for (const file of res.created)
37
+ console.log(ui.meta(` + ${file}`));
38
+ return true;
39
+ }
40
+ case "adapt": {
41
+ const { values, positionals } = parseVerb(verb, cmd.flags, rest);
42
+ const pluginDir = resolve(positionals[0] ?? process.cwd());
43
+ for (const result of adaptPlugin(pluginDir, resolveTargets(values.target))) {
44
+ console.log(`${ui.ok("adapted")} ${ui.name(result.target)} ${ui.meta(`-> ${result.file}`)}`);
45
+ }
46
+ return true;
47
+ }
48
+ case "validate": {
49
+ const { positionals } = parseVerb(verb, cmd.flags, rest);
50
+ const pluginDir = resolve(positionals[0] ?? process.cwd());
51
+ const result = validatePlugin(pluginDir);
52
+ if (result.ok) {
53
+ console.log(`${ui.ok("ok:")} ${ui.name(pluginDir)} is a valid ADG plugin`);
54
+ }
55
+ else {
56
+ console.error(`${ui.err("invalid:")} ${ui.name(pluginDir)}`);
57
+ for (const issue of result.issues)
58
+ console.error(ui.warn(` - ${issue}`));
59
+ process.exit(1);
60
+ }
61
+ return true;
62
+ }
63
+ case "inspect": {
64
+ const { values, positionals } = parseVerb(verb, cmd.flags, rest);
65
+ const result = await inspectSource({ spec: positionals[0] ?? process.cwd(), ref: values.ref });
66
+ if (values.json)
67
+ console.log(JSON.stringify(result, null, 2));
68
+ else
69
+ console.log(`${ui.ok("inspected")} ${ui.name(result.manifest.name)} ${ui.meta(`[${result.kind}] ${result.components.join(", ") || "no components"}`)}`);
70
+ return true;
71
+ }
72
+ case "list": {
73
+ const { values } = parseVerb(verb, cmd.flags, rest);
74
+ const pluginsDir = resolveScopeDir(values);
75
+ const plugins = listPlugins(pluginsDir);
76
+ if (values.json)
77
+ printJson(pluginsListJson(plugins, pluginsDir));
78
+ else
79
+ for (const line of renderPluginList(plugins, pluginsDir, { verbose: values.verbose }))
80
+ console.log(line);
81
+ return true;
82
+ }
83
+ case "status": {
84
+ const { values } = parseVerb(verb, cmd.flags, rest);
85
+ const targets = resolveTargets(values.target);
86
+ const pluginsDir = resolveScopeDir(values);
87
+ const scope = scopeOf(values);
88
+ const statuses = pluginStatus({ pluginsDir, scope, targets });
89
+ if (values.json)
90
+ printJson(pluginsStatusJson(statuses, pluginsDir, scope, targets));
91
+ else
92
+ for (const line of renderStatus(statuses))
93
+ console.log(line);
94
+ return true;
95
+ }
96
+ }
97
+ }
@@ -1,21 +1,16 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { resolve } from "node:path";
3
- import { adaptPlugin } from "../commands/adapt.js";
4
3
  import { addPlugins } from "../commands/install.js";
5
- import { validatePlugin } from "../commands/validate.js";
6
4
  import { listPlugins } from "../commands/list.js";
7
5
  import { importSkills } from "../commands/import.js";
8
- import { inspectSource } from "../commands/inspect.js";
9
6
  import { linkPlugins } from "../commands/link.js";
10
7
  import { unlinkPlugins } from "../commands/unlink.js";
11
8
  import { syncPlugins } from "../commands/sync.js";
12
9
  import { removePlugin } from "../commands/remove.js";
13
10
  import { disablePlugins, enablePlugins } from "../commands/state.js";
14
11
  import { migrateLayout } from "../commands/migrate.js";
15
- import { pluginStatus } from "../commands/status.js";
16
12
  import { cleanPluginCache, pluginCacheStatus, prunePluginCache, restorePluginCache } from "../commands/cache.js";
17
13
  import { marketplaceList, marketplaceRemove, marketplaceSync, updatePlugins } from "../commands/marketplace.js";
18
- import { initScaffold } from "../commands/init.js";
19
14
  import { confirmFullInstall, selectComponentsInteractive } from "../commands/select-components.js";
20
15
  import { selectPluginsInteractive } from "../commands/select-plugins.js";
21
16
  import { selectTargetsInteractive } from "../commands/select-agents.js";
@@ -23,9 +18,9 @@ import { selectScopeInteractive, selectUpdateScopeInteractive } from "../command
23
18
  import { globalPluginsDir, projectPluginsDir, lockPath } from "../paths.js";
24
19
  import { getAgent } from "../agents/index.js";
25
20
  import { ui } from "../render/ui.js";
26
- import { renderAgentReport, renderMarketplaceList, renderPluginList, renderStatus, renderUpdateReport, } from "../render/plugins.js";
27
- import { pluginsListJson, pluginsStatusJson, printJson } from "../render/json.js";
21
+ import { renderAgentReport, renderMarketplaceList, renderUpdateReport, } from "../render/plugins.js";
28
22
  import { CACHE_USAGE, MARKETPLACE_USAGE, PLUGIN_ALIASES, PLUGIN_COMMANDS, SCOPE, fail, parseVerb, renderPluginsHelp, renderVerbHelp, requireSingleTarget, resolveComponents, resolveScopeDir, resolveTargets, scopeOf, wantsHelp, } from "./index.js";
23
+ import { handleCorePluginVerb } from "./core-plugin-handlers.js";
29
24
  /**
30
25
  * Resolve which scope(s) `plugins update` should refresh, mirroring
31
26
  * `adg skills update`: an explicit --dir is a single ad-hoc location; otherwise
@@ -302,55 +297,9 @@ async function handleUpdate(rest, cmd) {
302
297
  }
303
298
  }
304
299
  async function runPluginsVerb(verb, rest, cmd) {
300
+ if (await handleCorePluginVerb(verb, rest, cmd))
301
+ return;
305
302
  switch (verb) {
306
- case "init": {
307
- const { values, positionals } = parseVerb(verb, cmd.flags, rest);
308
- const name = positionals[0];
309
- if (!name)
310
- fail("plugins init requires a <name>");
311
- const dir = values.dir ? resolve(values.dir) : resolve(process.cwd(), "plugins");
312
- const type = (values.type ?? "plugin");
313
- if (type !== "plugin" && type !== "marketplace" && type !== "all") {
314
- fail(`invalid --type "${values.type}" (expected plugin|marketplace|all)`);
315
- }
316
- const res = initScaffold({ name, dir, type, description: values.description, author: values.author, skill: values.skill?.[0] });
317
- console.log(`${ui.ok(`created ${type}`)} at ${ui.name(res.pluginDir)}`);
318
- for (const f of res.created)
319
- console.log(ui.meta(` + ${f}`));
320
- return;
321
- }
322
- case "adapt": {
323
- const { values, positionals } = parseVerb(verb, cmd.flags, rest);
324
- const pluginDir = resolve(positionals[0] ?? process.cwd());
325
- for (const r of adaptPlugin(pluginDir, resolveTargets(values.target))) {
326
- console.log(`${ui.ok("adapted")} ${ui.name(r.target)} ${ui.meta(`-> ${r.file}`)}`);
327
- }
328
- return;
329
- }
330
- case "validate": {
331
- const { positionals } = parseVerb(verb, cmd.flags, rest);
332
- const pluginDir = resolve(positionals[0] ?? process.cwd());
333
- const res = validatePlugin(pluginDir);
334
- if (res.ok) {
335
- console.log(`${ui.ok("ok:")} ${ui.name(pluginDir)} is a valid ADG plugin`);
336
- }
337
- else {
338
- console.error(`${ui.err("invalid:")} ${ui.name(pluginDir)}`);
339
- for (const i of res.issues)
340
- console.error(ui.warn(` - ${i}`));
341
- process.exit(1);
342
- }
343
- return;
344
- }
345
- case "inspect": {
346
- const { values, positionals } = parseVerb(verb, cmd.flags, rest);
347
- const result = await inspectSource({ spec: positionals[0] ?? process.cwd(), ref: values.ref });
348
- if (values.json)
349
- console.log(JSON.stringify(result, null, 2));
350
- else
351
- console.log(`${ui.ok("inspected")} ${ui.name(result.manifest.name)} ${ui.meta(`[${result.kind}] ${result.components.join(", ") || "no components"}`)}`);
352
- return;
353
- }
354
303
  case "add": {
355
304
  await handleAdd(rest, cmd);
356
305
  return;
@@ -445,33 +394,6 @@ async function runPluginsVerb(verb, rest, cmd) {
445
394
  }
446
395
  return;
447
396
  }
448
- case "list": {
449
- const { values } = parseVerb(verb, cmd.flags, rest);
450
- const pluginsDir = resolveScopeDir(values);
451
- const plugins = listPlugins(pluginsDir);
452
- if (values.json) {
453
- printJson(pluginsListJson(plugins, pluginsDir));
454
- return;
455
- }
456
- for (const line of renderPluginList(plugins, pluginsDir, { verbose: values.verbose })) {
457
- console.log(line);
458
- }
459
- return;
460
- }
461
- case "status": {
462
- const { values } = parseVerb(verb, cmd.flags, rest);
463
- const targets = resolveTargets(values.target);
464
- const pluginsDir = resolveScopeDir(values);
465
- const scope = scopeOf(values);
466
- const statuses = pluginStatus({ pluginsDir, scope, targets });
467
- if (values.json) {
468
- printJson(pluginsStatusJson(statuses, pluginsDir, scope, targets));
469
- return;
470
- }
471
- for (const line of renderStatus(statuses))
472
- console.log(line);
473
- return;
474
- }
475
397
  case "migrate": {
476
398
  const { values } = parseVerb(verb, cmd.flags, rest);
477
399
  const sc = await resolveActionScope(values, "migrate");
@@ -25,6 +25,11 @@ export function findManifestFile(pluginDir) {
25
25
  }
26
26
  const NAME_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
27
27
  const SEMVER_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?$/;
28
+ const MANIFEST_FIELDS = new Set([
29
+ "schemaVersion", "name", "version", "description", "author", "license", "category",
30
+ "interface", "skills", "agents", "commands", "apps", "hooks", "mcpServers",
31
+ "dependencies", "selectionDependencies", "strict", "homepage", "changelog",
32
+ ]);
28
33
  export class ManifestError extends Error {
29
34
  issues;
30
35
  constructor(issues) {
@@ -98,6 +103,10 @@ export function collectIssues(raw) {
98
103
  return ["manifest must be a JSON object"];
99
104
  }
100
105
  const m = raw;
106
+ for (const key of Object.keys(m)) {
107
+ if (!MANIFEST_FIELDS.has(key))
108
+ issues.push(`unsupported manifest field: ${key}`);
109
+ }
101
110
  if (m.schemaVersion !== ADG_SCHEMA_VERSION) {
102
111
  issues.push(`schemaVersion must be "${ADG_SCHEMA_VERSION}"`);
103
112
  }
@@ -110,6 +119,34 @@ export function collectIssues(raw) {
110
119
  if (typeof m.description !== "string" || m.description.length === 0) {
111
120
  issues.push("description is required and must be a non-empty string");
112
121
  }
122
+ if (m.author !== undefined) {
123
+ if (!isRecord(m.author)) {
124
+ issues.push("author must be an object");
125
+ }
126
+ else {
127
+ for (const key of Object.keys(m.author)) {
128
+ if (!["name", "url", "email"].includes(key))
129
+ issues.push(`author contains unsupported field: ${key}`);
130
+ }
131
+ if (typeof m.author.name !== "string")
132
+ issues.push("author.name must be a string");
133
+ for (const key of ["url", "email"]) {
134
+ if (m.author[key] !== undefined && typeof m.author[key] !== "string")
135
+ issues.push(`author.${key} must be a string`);
136
+ }
137
+ }
138
+ }
139
+ if (m.interface !== undefined) {
140
+ if (!isRecord(m.interface)) {
141
+ issues.push("interface must be an object");
142
+ }
143
+ else {
144
+ for (const key of ["displayName", "shortDescription", "icon"]) {
145
+ if (m.interface[key] !== undefined && typeof m.interface[key] !== "string")
146
+ issues.push(`interface.${key} must be a string`);
147
+ }
148
+ }
149
+ }
113
150
  if (m.skills !== undefined && typeof m.skills !== "string" && !isStringArray(m.skills)) {
114
151
  issues.push("skills must be a string or an array of strings");
115
152
  }
@@ -139,11 +176,15 @@ export function collectIssues(raw) {
139
176
  }
140
177
  else {
141
178
  m.dependencies.forEach((dep, i) => {
142
- if (typeof dep !== "object" || dep === null) {
179
+ if (!isRecord(dep)) {
143
180
  issues.push(`dependencies[${i}] must be an object`);
144
181
  return;
145
182
  }
146
183
  const d = dep;
184
+ for (const key of Object.keys(d)) {
185
+ if (!["name", "version"].includes(key))
186
+ issues.push(`dependencies[${i}] contains unsupported field: ${key}`);
187
+ }
147
188
  if (typeof d.name !== "string")
148
189
  issues.push(`dependencies[${i}].name must be a string`);
149
190
  if (typeof d.version !== "string")
@@ -166,23 +207,35 @@ export function collectIssues(raw) {
166
207
  continue;
167
208
  }
168
209
  const requirement = rawRequirement;
210
+ for (const key of Object.keys(requirement)) {
211
+ if (!["components", "skills"].includes(key)) {
212
+ issues.push(`selectionDependencies.${component} contains unsupported field: ${key}`);
213
+ }
214
+ }
169
215
  if (requirement.components !== undefined && (!isStringArray(requirement.components)
170
216
  || requirement.components.some((value) => !COMPONENT_TYPES.includes(value)))) {
171
217
  issues.push(`selectionDependencies.${component}.components must contain supported component names`);
172
218
  }
219
+ else if (isStringArray(requirement.components) && new Set(requirement.components).size !== requirement.components.length) {
220
+ issues.push(`selectionDependencies.${component}.components must not contain duplicates`);
221
+ }
173
222
  if (requirement.skills !== undefined && !isStringArray(requirement.skills)) {
174
223
  issues.push(`selectionDependencies.${component}.skills must be an array of strings`);
175
224
  }
225
+ else if (isStringArray(requirement.skills) && new Set(requirement.skills).size !== requirement.skills.length) {
226
+ issues.push(`selectionDependencies.${component}.skills must not contain duplicates`);
227
+ }
176
228
  }
177
229
  }
178
230
  }
179
- // `adapters` is no longer part of the DSL. A stray one from an old manifest is
180
- // tolerated (ignored) rather than rejected — output paths are ADG-internal.
181
231
  return issues;
182
232
  }
183
233
  function isStringArray(v) {
184
234
  return Array.isArray(v) && v.every((x) => typeof x === "string");
185
235
  }
236
+ function isRecord(value) {
237
+ return typeof value === "object" && value !== null && !Array.isArray(value);
238
+ }
186
239
  function isSafeRelativePointer(value) {
187
240
  if (isAbsolute(value) || /^[A-Za-z]:/.test(value) || /^[/\\]{2}/.test(value))
188
241
  return false;
@@ -0,0 +1,53 @@
1
+ import { spawnSync, } from "node:child_process";
2
+ import { basename } from "node:path";
3
+ import { SpanKind, SpanStatusCode, } from "@opentelemetry/api";
4
+ import { getTracer, sanitizeArgs } from "./telemetry.js";
5
+ /** Apply the OTel CLI semantic convention without collecting process output. */
6
+ export function annotateSubprocess(span, executableName, args, result) {
7
+ span.setAttribute("process.executable.name", executableName);
8
+ span.setAttribute("process.command_args", sanitizeArgs([executableName, ...args]));
9
+ if (result.pid !== undefined)
10
+ span.setAttribute("process.pid", result.pid);
11
+ if (result.status !== null) {
12
+ span.setAttribute("process.exit.code", result.status);
13
+ if (result.status !== 0) {
14
+ const errorType = `EXIT_CODE_${result.status}`;
15
+ const error = new Error(`${executableName} exited with status ${result.status}`);
16
+ span.setAttribute("error.type", errorType);
17
+ span.recordException(error);
18
+ span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
19
+ }
20
+ return;
21
+ }
22
+ span.setAttribute("process.exit.code", -1);
23
+ if (result.signal) {
24
+ const errorType = `SIGNAL_${result.signal}`;
25
+ const error = new Error(`${executableName} terminated by signal ${result.signal}`);
26
+ span.setAttribute("error.type", errorType);
27
+ span.setAttribute("process.exit.signal", result.signal);
28
+ span.recordException(error);
29
+ span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
30
+ return;
31
+ }
32
+ if (result.error) {
33
+ const code = result.error.code;
34
+ span.setAttribute("error.type", code ?? result.error.name ?? "SpawnError");
35
+ span.recordException(result.error);
36
+ span.setStatus({ code: SpanStatusCode.ERROR, message: result.error.message });
37
+ }
38
+ }
39
+ export function runSubprocessSync(command, args, options = {}) {
40
+ const executableName = basename(command);
41
+ return getTracer().startActiveSpan(executableName, { kind: SpanKind.CLIENT }, (span) => {
42
+ try {
43
+ const result = (options.encoding
44
+ ? spawnSync(command, args, options)
45
+ : spawnSync(command, args, options));
46
+ annotateSubprocess(span, executableName, args, result);
47
+ return result;
48
+ }
49
+ finally {
50
+ span.end();
51
+ }
52
+ });
53
+ }
@@ -833,18 +833,6 @@ export async function runAdd(args, options = {}) {
833
833
  return Promise.resolve(null);
834
834
  return isRepoPrivate(ownerRepo.owner, ownerRepo.repo).catch(() => null);
835
835
  })();
836
- // Block openclaw sources unless explicitly opted in
837
- const sourceOwner = ownerRepoRaw?.split('/')[0]?.toLowerCase();
838
- if (sourceOwner === 'openclaw' && !options.dangerouslyAcceptOpenclawRisks) {
839
- console.log();
840
- p.log.warn(pc.yellow(pc.bold('⚠ OpenClaw skills are unverified community submissions.')));
841
- p.log.message(pc.yellow('This source contains user-submitted skills that have not been reviewed for safety or quality.'));
842
- p.log.message(pc.yellow('Skills run with full agent permissions and could be malicious.'));
843
- console.log();
844
- p.log.message(`If you understand the risks, re-run with:\n\n ${pc.cyan(`adg skills add ${source} --dangerously-accept-openclaw-risks`)}\n`);
845
- p.outro(pc.red('Installation blocked'));
846
- process.exit(1);
847
- }
848
836
  // Handle well-known skills from arbitrary URLs
849
837
  if (parsed.type === 'well-known') {
850
838
  await handleWellKnownSkills(source, parsed.url, options, spinner);
@@ -1810,9 +1798,6 @@ export function parseAddOptions(args) {
1810
1798
  else if (arg === '--copy') {
1811
1799
  options.copy = true;
1812
1800
  }
1813
- else if (arg === '--dangerously-accept-openclaw-risks') {
1814
- options.dangerouslyAcceptOpenclawRisks = true;
1815
- }
1816
1801
  else if (arg === '--subagent') {
1817
1802
  options.subagent = options.subagent || [];
1818
1803
  i++;
@@ -1,6 +1,4 @@
1
- import { execFile } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- const execFileAsync = promisify(execFile);
1
+ import { runSubprocessSync } from "../../../src/subprocess.js";
4
2
  /**
5
3
  * ADG-added file (see vendor/skills/PROVENANCE.md → Local patches).
6
4
  *
@@ -22,7 +20,9 @@ const execFileAsync = promisify(execFile);
22
20
  export async function gitTreeShaForFolder(repoDir, folder) {
23
21
  const spec = folder ? `HEAD:${folder}` : 'HEAD^{tree}';
24
22
  try {
25
- const { stdout } = await execFileAsync('git', ['-C', repoDir, 'rev-parse', spec]);
23
+ const { stdout, status } = runSubprocessSync('git', ['-C', repoDir, 'rev-parse', spec], { encoding: 'utf8' });
24
+ if (status !== 0)
25
+ return null;
26
26
  const sha = stdout.trim();
27
27
  return /^[0-9a-f]{40}$/.test(sha) ? sha : null;
28
28
  }
@@ -2,8 +2,8 @@ import { readFile, writeFile, mkdir } from 'fs/promises';
2
2
  import { join, dirname } from 'path';
3
3
  import { homedir } from 'os';
4
4
  import { createHash } from 'crypto';
5
- import { execSync } from 'child_process';
6
5
  import pc from 'picocolors';
6
+ import { runSubprocessSync } from "../../../src/subprocess.js";
7
7
  const AGENTS_DIR = '.agents';
8
8
  const LOCK_FILE = '.skill-lock.json';
9
9
  const CURRENT_VERSION = 3; // Bumped from 2 to 3 for folder hash support (GitHub tree SHA)
@@ -103,10 +103,11 @@ export function getGitHubToken() {
103
103
  _ghWarningShown = true;
104
104
  }
105
105
  try {
106
- const token = execSync('gh auth token', {
106
+ const result = runSubprocessSync('gh', ['auth', 'token'], {
107
107
  encoding: 'utf-8',
108
108
  stdio: ['pipe', 'pipe', 'pipe'],
109
- }).trim();
109
+ });
110
+ const token = result.status === 0 ? result.stdout.trim() : '';
110
111
  if (token) {
111
112
  return token;
112
113
  }