@rbbtsn0w/adg 0.7.1-beta.5 → 0.7.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/adg.js +60 -25
- package/dist/src/agents/base.js +3 -39
- package/dist/src/cli/handlers.js +48 -20
- package/dist/src/command-outcome.js +15 -0
- package/dist/src/sources.js +1 -2
- package/dist/src/subprocess.js +3 -8
- package/dist/src/telemetry.js +132 -34
- package/dist/vendor/skills/src/telemetry.js +22 -47
- package/dist/vendor/skills/src/update.js +0 -1
- package/docs/agents/antigravity.md +3 -1
- package/package.json +1 -1
- package/vendor/skills/PROVENANCE.md +1 -0
package/dist/bin/adg.js
CHANGED
|
@@ -5,11 +5,13 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import { selfUpdateCommand, parseSelfUpdateArgs, SELF_UPDATE_USAGE, selfUpdateSpawnOptions } from "../src/self-update.js";
|
|
6
6
|
import { checkForUpdate, formatUpdateNotice } from "../src/update-check.js";
|
|
7
7
|
import { ui } from "../src/render/ui.js";
|
|
8
|
-
import { TOP_USAGE, fail } from "../src/cli/index.js";
|
|
8
|
+
import { TARGET_ALIASES, TOP_USAGE, fail } from "../src/cli/index.js";
|
|
9
|
+
import { ADAPTER_TARGETS } from "../src/adapters/index.js";
|
|
9
10
|
import { runPlugins } from "../src/cli/handlers.js";
|
|
10
11
|
import { getTracer, shutdownTelemetry, sanitizeArgs } from "../src/telemetry.js";
|
|
11
12
|
import { SpanKind, SpanStatusCode, propagation, context } from "@opentelemetry/api";
|
|
12
13
|
import { runSubprocessSync } from "../src/subprocess.js";
|
|
14
|
+
import { commandOutcome } from "../src/command-outcome.js";
|
|
13
15
|
// ---------------------------------------------------------------------------
|
|
14
16
|
// `adg` entry point: thin wire-up only.
|
|
15
17
|
//
|
|
@@ -33,6 +35,14 @@ import { runSubprocessSync } from "../src/subprocess.js";
|
|
|
33
35
|
export function skillsChildArgv(entry, args, execArgv = process.execArgv) {
|
|
34
36
|
return [...execArgv, entry, ...args];
|
|
35
37
|
}
|
|
38
|
+
export function telemetryCommandTarget(target) {
|
|
39
|
+
if (target === "all")
|
|
40
|
+
return target;
|
|
41
|
+
const canonical = target === undefined ? undefined : TARGET_ALIASES[target] ?? target;
|
|
42
|
+
return canonical !== undefined && ADAPTER_TARGETS.includes(canonical)
|
|
43
|
+
? canonical
|
|
44
|
+
: "none";
|
|
45
|
+
}
|
|
36
46
|
function runSkills(verb, rest) {
|
|
37
47
|
const self = fileURLToPath(import.meta.url);
|
|
38
48
|
const here = dirname(self);
|
|
@@ -55,21 +65,27 @@ function runSkills(verb, rest) {
|
|
|
55
65
|
...envCarrier,
|
|
56
66
|
},
|
|
57
67
|
});
|
|
58
|
-
|
|
68
|
+
const exitCode = r.status ?? 1;
|
|
69
|
+
return exitCode === 0
|
|
70
|
+
? commandOutcome("success")
|
|
71
|
+
: { ...commandOutcome("failure", "dependency"), exitCode };
|
|
59
72
|
}
|
|
60
73
|
function runSelfUpdate(args) {
|
|
61
74
|
const options = parseSelfUpdateArgs(args);
|
|
62
75
|
if (options.help) {
|
|
63
76
|
console.log(SELF_UPDATE_USAGE);
|
|
64
|
-
return
|
|
77
|
+
return commandOutcome("success");
|
|
65
78
|
}
|
|
66
79
|
const command = selfUpdateCommand(options.beta);
|
|
67
80
|
const r = runSubprocessSync(command.command, command.args, selfUpdateSpawnOptions());
|
|
68
81
|
if (r.error) {
|
|
69
82
|
console.error(r.error.message);
|
|
70
|
-
return
|
|
83
|
+
return commandOutcome("failure", "dependency");
|
|
71
84
|
}
|
|
72
|
-
|
|
85
|
+
const exitCode = r.status ?? 1;
|
|
86
|
+
return exitCode === 0
|
|
87
|
+
? commandOutcome("success")
|
|
88
|
+
: { ...commandOutcome("failure", "dependency"), exitCode };
|
|
73
89
|
}
|
|
74
90
|
/**
|
|
75
91
|
* Read the package version from package.json.
|
|
@@ -102,11 +118,25 @@ async function main(argv) {
|
|
|
102
118
|
}
|
|
103
119
|
const tracer = getTracer();
|
|
104
120
|
return await tracer.startActiveSpan("adg", { kind: SpanKind.INTERNAL }, async (span) => {
|
|
105
|
-
let
|
|
121
|
+
let outcome = commandOutcome("success");
|
|
106
122
|
try {
|
|
107
123
|
span.setAttribute("process.executable.name", "adg");
|
|
108
124
|
span.setAttribute("process.pid", process.pid);
|
|
109
125
|
span.setAttribute("process.command_args", sanitizeArgs(["adg", ...argv]));
|
|
126
|
+
const scope = rest.includes("--global") && rest.includes("--project")
|
|
127
|
+
? "both"
|
|
128
|
+
: rest.includes("--global")
|
|
129
|
+
? "global"
|
|
130
|
+
: rest.includes("--project")
|
|
131
|
+
? "project"
|
|
132
|
+
: rest.some((arg) => arg === "--dir" || arg.startsWith("--dir="))
|
|
133
|
+
? "adhoc"
|
|
134
|
+
: "none";
|
|
135
|
+
const targetIndex = rest.findIndex((arg) => arg === "--target");
|
|
136
|
+
const targetValue = targetIndex >= 0 ? rest[targetIndex + 1] : rest.find((arg) => arg.startsWith("--target="))?.slice(9);
|
|
137
|
+
const target = telemetryCommandTarget(targetValue);
|
|
138
|
+
span.setAttribute("adg.command.scope", scope);
|
|
139
|
+
span.setAttribute("adg.command.target", target);
|
|
110
140
|
// Check for an available update (reads local cache; schedules a background
|
|
111
141
|
// network refresh when the cache is stale — the refresh uses an unreffed
|
|
112
142
|
// socket so it cannot delay process exit).
|
|
@@ -119,45 +149,50 @@ async function main(argv) {
|
|
|
119
149
|
switch (domain) {
|
|
120
150
|
case "plugins":
|
|
121
151
|
case "plugin": // tolerated alias
|
|
122
|
-
span.setAttribute("domain", "plugins");
|
|
152
|
+
span.setAttribute("adg.command.domain", "plugins");
|
|
123
153
|
if (verb)
|
|
124
|
-
span.setAttribute("verb", verb);
|
|
125
|
-
await runPlugins(verb, rest);
|
|
154
|
+
span.setAttribute("adg.command.verb", verb);
|
|
155
|
+
outcome = await runPlugins(verb, rest);
|
|
126
156
|
break;
|
|
127
157
|
case "skills":
|
|
128
158
|
case "skill":
|
|
129
|
-
span.setAttribute("domain", "skills");
|
|
159
|
+
span.setAttribute("adg.command.domain", "skills");
|
|
130
160
|
if (verb)
|
|
131
|
-
span.setAttribute("verb", verb);
|
|
132
|
-
|
|
161
|
+
span.setAttribute("adg.command.verb", verb);
|
|
162
|
+
outcome = runSkills(verb, rest);
|
|
133
163
|
break;
|
|
134
164
|
case "update":
|
|
135
|
-
span.setAttribute("domain", "update");
|
|
165
|
+
span.setAttribute("adg.command.domain", "update");
|
|
136
166
|
if (verb)
|
|
137
|
-
span.setAttribute("verb", verb);
|
|
138
|
-
|
|
167
|
+
span.setAttribute("adg.command.verb", verb);
|
|
168
|
+
outcome = runSelfUpdate([verb, ...rest].filter((x) => x !== undefined));
|
|
139
169
|
break;
|
|
140
170
|
default:
|
|
141
171
|
fail(`unknown domain: ${domain} (expected \`plugins\`, \`skills\`, or \`update\`)`);
|
|
142
172
|
}
|
|
143
|
-
span.setAttribute("
|
|
144
|
-
|
|
145
|
-
|
|
173
|
+
span.setAttribute("adg.command.outcome", outcome.kind);
|
|
174
|
+
span.setAttribute("process.exit.code", outcome.exitCode);
|
|
175
|
+
if (outcome.exitCode !== 0) {
|
|
176
|
+
span.setAttribute("error.type", `EXIT_CODE_${outcome.exitCode}`);
|
|
177
|
+
span.setAttribute("error.category", outcome.errorCategory ?? "internal");
|
|
178
|
+
span.setAttribute("error.expected", outcome.errorCategory === "user");
|
|
146
179
|
span.setStatus({
|
|
147
180
|
code: SpanStatusCode.ERROR,
|
|
148
|
-
message:
|
|
181
|
+
message: "CLI exited with a non-zero status",
|
|
149
182
|
});
|
|
150
183
|
}
|
|
151
|
-
return
|
|
184
|
+
return outcome.exitCode;
|
|
152
185
|
}
|
|
153
186
|
catch (error) {
|
|
154
|
-
|
|
155
|
-
span.setAttribute("
|
|
156
|
-
span.setAttribute("
|
|
157
|
-
span.
|
|
187
|
+
outcome = commandOutcome("failure", "internal");
|
|
188
|
+
span.setAttribute("adg.command.outcome", outcome.kind);
|
|
189
|
+
span.setAttribute("process.exit.code", outcome.exitCode);
|
|
190
|
+
span.setAttribute("error.type", error instanceof Error ? error.name : "_OTHER");
|
|
191
|
+
span.setAttribute("error.category", outcome.errorCategory);
|
|
192
|
+
span.setAttribute("error.expected", false);
|
|
158
193
|
span.setStatus({
|
|
159
194
|
code: SpanStatusCode.ERROR,
|
|
160
|
-
message:
|
|
195
|
+
message: "CLI command failed",
|
|
161
196
|
});
|
|
162
197
|
throw error;
|
|
163
198
|
}
|
package/dist/src/agents/base.js
CHANGED
|
@@ -11,28 +11,6 @@ import { runSubprocessSync } from "../subprocess.js";
|
|
|
11
11
|
export function skippedResult(agent) {
|
|
12
12
|
return { agent, affected: [], skipped: true };
|
|
13
13
|
}
|
|
14
|
-
function clipText(value, max = 512) {
|
|
15
|
-
return value.length <= max ? value : `${value.slice(0, max - 1)}…`;
|
|
16
|
-
}
|
|
17
|
-
function redactFailureText(value) {
|
|
18
|
-
return value
|
|
19
|
-
.replace(/\b(?:github_pat_[A-Za-z0-9_]+|gh[pousr]_[A-Za-z0-9]+)\b/gu, "[REDACTED_TOKEN]")
|
|
20
|
-
.replace(/\b(Authorization\s*:\s*Bearer\s+)[^\s,;]+/giu, "$1[REDACTED_TOKEN]");
|
|
21
|
-
}
|
|
22
|
-
function summarizeFailure(r) {
|
|
23
|
-
const stderr = r.stderr?.trim();
|
|
24
|
-
if (stderr)
|
|
25
|
-
return { stream: "stderr", text: clipText(redactFailureText(stderr)) };
|
|
26
|
-
const stdout = r.stdout?.trim();
|
|
27
|
-
if (stdout)
|
|
28
|
-
return { stream: "stdout", text: clipText(redactFailureText(stdout)) };
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
function recordFailureExcerpt(span, summary) {
|
|
32
|
-
if (!summary)
|
|
33
|
-
return;
|
|
34
|
-
span.setAttribute(summary.stream === "stderr" ? "cli.stderr_excerpt" : "cli.stdout_excerpt", summary.text);
|
|
35
|
-
}
|
|
36
14
|
/**
|
|
37
15
|
* Record CLI process telemetry in one place so success/failure semantics stay
|
|
38
16
|
* consistent across every agent wrapper.
|
|
@@ -44,33 +22,21 @@ export function annotateCliRun(span, bin, args, r) {
|
|
|
44
22
|
if (r.status !== null) {
|
|
45
23
|
span.setAttribute("process.exit.code", r.status);
|
|
46
24
|
if (r.status !== 0) {
|
|
47
|
-
const summary = summarizeFailure(r);
|
|
48
|
-
const command = sanitizeArgs([bin, ...args]).join(" ");
|
|
49
|
-
const message = summary ? `${command} exited with status ${r.status}: ${summary.text}` : `${command} exited with status ${r.status}`;
|
|
50
25
|
span.setAttribute("error.type", `EXIT_CODE_${r.status}`);
|
|
51
|
-
span.setAttribute("exception.slug", "cli-nonzero-exit");
|
|
52
|
-
recordFailureExcerpt(span, summary);
|
|
53
|
-
span.recordException(new Error(message));
|
|
54
26
|
span.setStatus({
|
|
55
27
|
code: SpanStatusCode.ERROR,
|
|
56
|
-
message
|
|
28
|
+
message: `CLI process exited with status ${r.status}`,
|
|
57
29
|
});
|
|
58
30
|
}
|
|
59
31
|
return;
|
|
60
32
|
}
|
|
61
33
|
if (r.signal) {
|
|
62
|
-
const summary = summarizeFailure(r);
|
|
63
|
-
const command = sanitizeArgs([bin, ...args]).join(" ");
|
|
64
|
-
const message = summary ? `${command} terminated by signal ${r.signal}: ${summary.text}` : `${command} terminated by signal ${r.signal}`;
|
|
65
34
|
span.setAttribute("process.exit.code", -1);
|
|
66
35
|
span.setAttribute("process.exit.signal", r.signal);
|
|
67
36
|
span.setAttribute("error.type", `SIGNAL_${r.signal}`);
|
|
68
|
-
span.setAttribute("exception.slug", "cli-signal-exit");
|
|
69
|
-
recordFailureExcerpt(span, summary);
|
|
70
|
-
span.recordException(new Error(message));
|
|
71
37
|
span.setStatus({
|
|
72
38
|
code: SpanStatusCode.ERROR,
|
|
73
|
-
message
|
|
39
|
+
message: `CLI process terminated by signal ${r.signal}`,
|
|
74
40
|
});
|
|
75
41
|
return;
|
|
76
42
|
}
|
|
@@ -78,11 +44,9 @@ export function annotateCliRun(span, bin, args, r) {
|
|
|
78
44
|
const errCode = r.error.code;
|
|
79
45
|
span.setAttribute("process.exit.code", -1);
|
|
80
46
|
span.setAttribute("error.type", (typeof errCode === "string" || typeof errCode === "number" ? String(errCode) : null) || r.error.name || "SpawnError");
|
|
81
|
-
span.setAttribute("exception.slug", "cli-spawn-failure");
|
|
82
|
-
span.recordException(r.error);
|
|
83
47
|
span.setStatus({
|
|
84
48
|
code: SpanStatusCode.ERROR,
|
|
85
|
-
message:
|
|
49
|
+
message: "CLI process failed to start",
|
|
86
50
|
});
|
|
87
51
|
}
|
|
88
52
|
}
|
package/dist/src/cli/handlers.js
CHANGED
|
@@ -21,6 +21,15 @@ import { ui } from "../render/ui.js";
|
|
|
21
21
|
import { renderAgentReport, renderMarketplaceList, renderUpdateReport, } from "../render/plugins.js";
|
|
22
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
23
|
import { handleCorePluginVerb } from "./core-plugin-handlers.js";
|
|
24
|
+
import { commandOutcome } from "../command-outcome.js";
|
|
25
|
+
export function updateResultCounts(result) {
|
|
26
|
+
const failedRemote = result.remote.filter((source) => source.failed !== undefined).length;
|
|
27
|
+
return {
|
|
28
|
+
succeeded: result.remote.length - failedRemote +
|
|
29
|
+
result.local.results.length,
|
|
30
|
+
failed: failedRemote + result.local.missing.length,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
24
33
|
/**
|
|
25
34
|
* Resolve which scope(s) `plugins update` should refresh, mirroring
|
|
26
35
|
* `adg skills update`: an explicit --dir is a single ad-hoc location; otherwise
|
|
@@ -146,26 +155,32 @@ export async function runPlugins(rawVerb, rest) {
|
|
|
146
155
|
// `adg plugins` (no verb) or an explicit help request → the L1 overview.
|
|
147
156
|
if (rawVerb === undefined || rawVerb === "-h" || rawVerb === "--help" || rawVerb === "help") {
|
|
148
157
|
console.log(renderPluginsHelp());
|
|
149
|
-
return;
|
|
158
|
+
return commandOutcome("success");
|
|
150
159
|
}
|
|
151
160
|
const verb = PLUGIN_ALIASES[rawVerb] ?? rawVerb;
|
|
152
161
|
const cmd = PLUGIN_COMMANDS[verb];
|
|
153
162
|
if (!cmd) {
|
|
154
163
|
console.error(`${ui.err("error:")} unknown plugins subcommand: ${rawVerb}\n`);
|
|
155
164
|
console.error(renderPluginsHelp());
|
|
156
|
-
|
|
165
|
+
fail(`unknown plugins subcommand: ${rawVerb}`);
|
|
157
166
|
}
|
|
158
167
|
// `adg plugins <verb> -h` → just this command's help. (marketplace handles
|
|
159
168
|
// its own sub-help, so let it through.)
|
|
160
169
|
if (!cmd.delegated && wantsHelp(rest)) {
|
|
161
170
|
console.log(renderVerbHelp(verb));
|
|
162
|
-
return;
|
|
171
|
+
return commandOutcome("success");
|
|
163
172
|
}
|
|
164
|
-
if (verb === "marketplace")
|
|
173
|
+
if (verb === "marketplace") {
|
|
165
174
|
return runMarketplace(rest);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
}
|
|
176
|
+
if (verb === "cache") {
|
|
177
|
+
await runCache(rest);
|
|
178
|
+
return commandOutcome("success");
|
|
179
|
+
}
|
|
180
|
+
if (verb === "update")
|
|
181
|
+
return handleUpdate(rest, cmd);
|
|
182
|
+
await runPluginsVerb(verb, rest, cmd);
|
|
183
|
+
return commandOutcome("success");
|
|
169
184
|
}
|
|
170
185
|
async function handleAdd(rest, cmd) {
|
|
171
186
|
const { values, positionals } = parseVerb("add", cmd.flags, rest);
|
|
@@ -277,6 +292,8 @@ async function handleSync(rest, cmd) {
|
|
|
277
292
|
async function handleUpdate(rest, cmd) {
|
|
278
293
|
const { values, positionals } = parseVerb("update", cmd.flags, rest);
|
|
279
294
|
const source = positionals[0];
|
|
295
|
+
let succeeded = 0;
|
|
296
|
+
let failed = 0;
|
|
280
297
|
for (const sc of await resolveUpdateScopes(values)) {
|
|
281
298
|
if (sc.heading)
|
|
282
299
|
console.log(`${ui.name(sc.heading)}`);
|
|
@@ -290,11 +307,18 @@ async function handleUpdate(rest, cmd) {
|
|
|
290
307
|
scope: { label: sc.label, globalDir: globalPluginsDir() },
|
|
291
308
|
});
|
|
292
309
|
printUpdateReport(result);
|
|
310
|
+
const counts = updateResultCounts(result);
|
|
311
|
+
succeeded += counts.succeeded;
|
|
312
|
+
failed += counts.failed;
|
|
293
313
|
}
|
|
294
314
|
catch (err) {
|
|
295
315
|
console.error(`${ui.err("error:")} ${err instanceof Error ? err.message : String(err)}`);
|
|
316
|
+
failed += 1;
|
|
296
317
|
}
|
|
297
318
|
}
|
|
319
|
+
if (failed === 0)
|
|
320
|
+
return commandOutcome("success");
|
|
321
|
+
return commandOutcome(succeeded > 0 ? "partial" : "failure", "dependency");
|
|
298
322
|
}
|
|
299
323
|
async function runPluginsVerb(verb, rest, cmd) {
|
|
300
324
|
if (await handleCorePluginVerb(verb, rest, cmd))
|
|
@@ -356,10 +380,8 @@ async function runPluginsVerb(verb, rest, cmd) {
|
|
|
356
380
|
await handleSync(rest, cmd);
|
|
357
381
|
return;
|
|
358
382
|
}
|
|
359
|
-
case "update":
|
|
360
|
-
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
383
|
+
case "update":
|
|
384
|
+
throw new Error("plugins update must be routed by runPlugins");
|
|
363
385
|
case "remove": {
|
|
364
386
|
const { values, positionals } = parseVerb(verb, cmd.flags, rest);
|
|
365
387
|
const name = positionals[0];
|
|
@@ -420,7 +442,7 @@ async function runMarketplace(args) {
|
|
|
420
442
|
// `marketplace <sub> -h` → the marketplace help (it documents every sub + flags).
|
|
421
443
|
if (sub !== undefined && wantsHelp(rest)) {
|
|
422
444
|
console.log(MARKETPLACE_USAGE);
|
|
423
|
-
return;
|
|
445
|
+
return commandOutcome("success");
|
|
424
446
|
}
|
|
425
447
|
switch (sub) {
|
|
426
448
|
case undefined:
|
|
@@ -428,7 +450,7 @@ async function runMarketplace(args) {
|
|
|
428
450
|
case "--help":
|
|
429
451
|
case "help":
|
|
430
452
|
console.log(MARKETPLACE_USAGE);
|
|
431
|
-
return;
|
|
453
|
+
return commandOutcome("success");
|
|
432
454
|
case "list": {
|
|
433
455
|
const { values } = parseVerb("marketplace", ["verbose", ...SCOPE], rest);
|
|
434
456
|
const dir = resolveScopeDir(values);
|
|
@@ -437,7 +459,7 @@ async function runMarketplace(args) {
|
|
|
437
459
|
const byName = values.verbose ? new Map(listPlugins(dir).map((p) => [p.name, p])) : undefined;
|
|
438
460
|
for (const line of renderMarketplaceList(groups, byName))
|
|
439
461
|
console.log(line);
|
|
440
|
-
return;
|
|
462
|
+
return commandOutcome("success");
|
|
441
463
|
}
|
|
442
464
|
case "upgrade": {
|
|
443
465
|
// Deprecated: a thin alias for `adg plugins update`. It runs the exact same
|
|
@@ -449,6 +471,8 @@ async function runMarketplace(args) {
|
|
|
449
471
|
// (project/global/both, with the home==global trap guard) so the deprecated
|
|
450
472
|
// alias can't drift from the verb it aliases. `--target` narrows the runtimes.
|
|
451
473
|
const targets = values.target !== undefined ? resolveTargets(values.target) : undefined;
|
|
474
|
+
let succeeded = 0;
|
|
475
|
+
let failed = 0;
|
|
452
476
|
for (const sc of await resolveUpdateScopes(values)) {
|
|
453
477
|
if (sc.heading)
|
|
454
478
|
console.log(`${ui.name(sc.heading)}`);
|
|
@@ -465,12 +489,18 @@ async function runMarketplace(args) {
|
|
|
465
489
|
targets,
|
|
466
490
|
});
|
|
467
491
|
printUpdateReport(result);
|
|
492
|
+
const counts = updateResultCounts(result);
|
|
493
|
+
succeeded += counts.succeeded;
|
|
494
|
+
failed += counts.failed;
|
|
468
495
|
}
|
|
469
496
|
catch (err) {
|
|
470
497
|
console.error(`${ui.err("error:")} ${err instanceof Error ? err.message : String(err)}`);
|
|
498
|
+
failed += 1;
|
|
471
499
|
}
|
|
472
500
|
}
|
|
473
|
-
|
|
501
|
+
if (failed === 0)
|
|
502
|
+
return commandOutcome("success");
|
|
503
|
+
return commandOutcome(succeeded > 0 ? "partial" : "failure", "dependency");
|
|
474
504
|
}
|
|
475
505
|
case "remove":
|
|
476
506
|
case "rm": {
|
|
@@ -488,7 +518,7 @@ async function runMarketplace(args) {
|
|
|
488
518
|
deactivate: true,
|
|
489
519
|
});
|
|
490
520
|
console.log(`${ui.ok("removed")} ${res.removed.length} plugin(s) from ${ui.name(res.source)}: ${res.removed.join(", ")}`);
|
|
491
|
-
return;
|
|
521
|
+
return commandOutcome("success");
|
|
492
522
|
}
|
|
493
523
|
case "sync": {
|
|
494
524
|
const { values, positionals } = parseVerb("marketplace", ["target", ...SCOPE], rest);
|
|
@@ -512,12 +542,10 @@ async function runMarketplace(args) {
|
|
|
512
542
|
printCliUnavailableNote(target, `manifests were regenerated, but nothing was re-synced in ${target}.`);
|
|
513
543
|
}
|
|
514
544
|
}
|
|
515
|
-
return;
|
|
545
|
+
return commandOutcome("success");
|
|
516
546
|
}
|
|
517
547
|
default: {
|
|
518
|
-
|
|
519
|
-
console.error(MARKETPLACE_USAGE);
|
|
520
|
-
process.exit(1);
|
|
548
|
+
fail(`unknown marketplace subcommand: ${sub}`);
|
|
521
549
|
}
|
|
522
550
|
}
|
|
523
551
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function commandOutcome(kind, errorCategory) {
|
|
2
|
+
const exitCode = kind === "success" ? 0 : kind === "cancelled" ? 130 : 1;
|
|
3
|
+
return errorCategory === undefined ? { kind, exitCode } : { kind, exitCode, errorCategory };
|
|
4
|
+
}
|
|
5
|
+
export function mergeCommandOutcomes(outcomes) {
|
|
6
|
+
if (outcomes.length === 0 || outcomes.every((outcome) => outcome.kind === "success")) {
|
|
7
|
+
return commandOutcome("success");
|
|
8
|
+
}
|
|
9
|
+
if (outcomes.every((outcome) => outcome.kind === "cancelled")) {
|
|
10
|
+
return commandOutcome("cancelled");
|
|
11
|
+
}
|
|
12
|
+
const partiallySuccessful = outcomes.some((outcome) => outcome.kind === "success" || outcome.kind === "partial");
|
|
13
|
+
const category = outcomes.find((outcome) => outcome.errorCategory)?.errorCategory;
|
|
14
|
+
return commandOutcome(partiallySuccessful ? "partial" : "failure", category);
|
|
15
|
+
}
|
package/dist/src/sources.js
CHANGED
|
@@ -143,10 +143,9 @@ export function runGit(args, captureOutput = false) {
|
|
|
143
143
|
span.setAttribute("process.pid", error.pid);
|
|
144
144
|
}
|
|
145
145
|
span.setAttribute("error.type", gitErrorType(error, exitCode));
|
|
146
|
-
span.recordException(error);
|
|
147
146
|
span.setStatus({
|
|
148
147
|
code: SpanStatusCode.ERROR,
|
|
149
|
-
message:
|
|
148
|
+
message: "Git subprocess failed",
|
|
150
149
|
});
|
|
151
150
|
throw error;
|
|
152
151
|
}
|
package/dist/src/subprocess.js
CHANGED
|
@@ -12,28 +12,23 @@ export function annotateSubprocess(span, executableName, args, result) {
|
|
|
12
12
|
span.setAttribute("process.exit.code", result.status);
|
|
13
13
|
if (result.status !== 0) {
|
|
14
14
|
const errorType = `EXIT_CODE_${result.status}`;
|
|
15
|
-
const error = new Error(`${executableName} exited with status ${result.status}`);
|
|
16
15
|
span.setAttribute("error.type", errorType);
|
|
17
|
-
span.
|
|
18
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
16
|
+
span.setStatus({ code: SpanStatusCode.ERROR, message: `Subprocess exited with status ${result.status}` });
|
|
19
17
|
}
|
|
20
18
|
return;
|
|
21
19
|
}
|
|
22
20
|
span.setAttribute("process.exit.code", -1);
|
|
23
21
|
if (result.signal) {
|
|
24
22
|
const errorType = `SIGNAL_${result.signal}`;
|
|
25
|
-
const error = new Error(`${executableName} terminated by signal ${result.signal}`);
|
|
26
23
|
span.setAttribute("error.type", errorType);
|
|
27
24
|
span.setAttribute("process.exit.signal", result.signal);
|
|
28
|
-
span.
|
|
29
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
25
|
+
span.setStatus({ code: SpanStatusCode.ERROR, message: `Subprocess terminated by signal ${result.signal}` });
|
|
30
26
|
return;
|
|
31
27
|
}
|
|
32
28
|
if (result.error) {
|
|
33
29
|
const code = result.error.code;
|
|
34
30
|
span.setAttribute("error.type", code ?? result.error.name ?? "SpawnError");
|
|
35
|
-
span.
|
|
36
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: result.error.message });
|
|
31
|
+
span.setStatus({ code: SpanStatusCode.ERROR, message: "Subprocess failed to start" });
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
export function runSubprocessSync(command, args, options = {}) {
|
package/dist/src/telemetry.js
CHANGED
|
@@ -1,53 +1,153 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
2
2
|
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
3
3
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
4
4
|
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
5
5
|
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
6
6
|
import * as opentelemetry from "@opentelemetry/api";
|
|
7
7
|
import {} from "@opentelemetry/api";
|
|
8
|
-
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
9
11
|
export function normalizeTraceEndpoint(endpoint) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
try {
|
|
13
|
+
const url = new URL(endpoint);
|
|
14
|
+
const path = url.pathname.replace(/\/+$/, "");
|
|
15
|
+
url.pathname = path.endsWith("/v1/traces")
|
|
16
|
+
? path
|
|
17
|
+
: `${path}/v1/traces`;
|
|
18
|
+
return url.toString();
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
const normalized = endpoint.replace(/\/+$/, "");
|
|
22
|
+
return normalized.endsWith("/v1/traces") ? normalized : `${normalized}/v1/traces`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DEFAULT_TRACE_ENDPOINT = "https://telemetry-gateway.hamiltonsnow.workers.dev/v1/traces";
|
|
26
|
+
const GATEWAY_ORIGINS = new Set([
|
|
27
|
+
"https://telemetry-gateway-development.hamiltonsnow.workers.dev",
|
|
28
|
+
"https://telemetry-gateway-staging.hamiltonsnow.workers.dev",
|
|
29
|
+
"https://telemetry-gateway.hamiltonsnow.workers.dev",
|
|
30
|
+
]);
|
|
31
|
+
const GATEWAY_PROFILE = "anonymous-client-v1";
|
|
32
|
+
const OTLP_HEADER_ENV_KEYS = [
|
|
33
|
+
"OTEL_EXPORTER_OTLP_HEADERS",
|
|
34
|
+
"OTEL_EXPORTER_OTLP_TRACES_HEADERS",
|
|
35
|
+
];
|
|
36
|
+
function gatewayHeaders(endpoint) {
|
|
37
|
+
try {
|
|
38
|
+
return GATEWAY_ORIGINS.has(new URL(endpoint).origin)
|
|
39
|
+
? { "otel-gateway-profile": GATEWAY_PROFILE }
|
|
40
|
+
: {};
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function withoutAmbientOtlpHeaders(operation) {
|
|
47
|
+
const previous = OTLP_HEADER_ENV_KEYS.map((key) => ({
|
|
48
|
+
key,
|
|
49
|
+
present: Object.prototype.hasOwnProperty.call(process.env, key),
|
|
50
|
+
value: process.env[key],
|
|
51
|
+
}));
|
|
52
|
+
for (const { key } of previous)
|
|
53
|
+
delete process.env[key];
|
|
54
|
+
try {
|
|
55
|
+
return operation();
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
for (const { key, present, value } of previous) {
|
|
59
|
+
if (present && value !== undefined)
|
|
60
|
+
process.env[key] = value;
|
|
61
|
+
else
|
|
62
|
+
delete process.env[key];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function defaultTelemetryConfig(env) {
|
|
67
|
+
const explicitTraceEndpoint = env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;
|
|
68
|
+
const explicitBaseEndpoint = env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
|
69
|
+
return {
|
|
70
|
+
enabled: env.OTEL_SDK_DISABLED?.toLowerCase() !== "true" &&
|
|
71
|
+
!env.DISABLE_TELEMETRY &&
|
|
72
|
+
!env.DO_NOT_TRACK &&
|
|
73
|
+
!env.NODE_TEST_CONTEXT,
|
|
74
|
+
traceEndpoint: explicitTraceEndpoint ??
|
|
75
|
+
(explicitBaseEndpoint ? normalizeTraceEndpoint(explicitBaseEndpoint) : DEFAULT_TRACE_ENDPOINT),
|
|
76
|
+
headers: gatewayHeaders(explicitTraceEndpoint ??
|
|
77
|
+
(explicitBaseEndpoint ? normalizeTraceEndpoint(explicitBaseEndpoint) : DEFAULT_TRACE_ENDPOINT)),
|
|
78
|
+
batch: {
|
|
79
|
+
maxQueueSize: 256,
|
|
80
|
+
maxExportBatchSize: 64,
|
|
81
|
+
scheduledDelayMillis: 100,
|
|
82
|
+
exportTimeoutMillis: 1000,
|
|
83
|
+
},
|
|
84
|
+
exporterTimeoutMillis: 1000,
|
|
85
|
+
shutdownTimeoutMillis: 1500,
|
|
86
|
+
};
|
|
12
87
|
}
|
|
13
|
-
const TELEMETRY_URL = process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||
|
|
14
|
-
(baseEndpoint
|
|
15
|
-
? normalizeTraceEndpoint(baseEndpoint)
|
|
16
|
-
: "https://telemetry-gateway.hamiltonsnow.workers.dev/v1/traces");
|
|
17
88
|
function isEnabled() {
|
|
18
|
-
return (
|
|
19
|
-
!process.env.DO_NOT_TRACK &&
|
|
20
|
-
!process.env.NODE_TEST_CONTEXT);
|
|
89
|
+
return defaultTelemetryConfig(process.env).enabled;
|
|
21
90
|
}
|
|
22
91
|
let provider = null;
|
|
23
92
|
let activeTracer = null;
|
|
93
|
+
function serviceVersion() {
|
|
94
|
+
try {
|
|
95
|
+
const self = fileURLToPath(import.meta.url);
|
|
96
|
+
const root = self.endsWith(".ts") ? join(dirname(self), "..") : join(dirname(self), "..", "..");
|
|
97
|
+
return JSON.parse(readFileSync(join(root, "package.json"), "utf8")).version;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return "unknown";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
24
103
|
export function getTracer() {
|
|
25
104
|
if (!isEnabled()) {
|
|
26
105
|
return opentelemetry.trace.getTracer("adg-noop");
|
|
27
106
|
}
|
|
28
107
|
if (!activeTracer) {
|
|
29
|
-
const
|
|
30
|
-
|
|
108
|
+
const config = defaultTelemetryConfig(process.env);
|
|
109
|
+
const createExporter = () => new OTLPTraceExporter({
|
|
110
|
+
url: config.traceEndpoint,
|
|
111
|
+
headers: config.headers,
|
|
112
|
+
timeoutMillis: config.exporterTimeoutMillis,
|
|
31
113
|
});
|
|
114
|
+
// The Node exporter merges ambient OTLP header env vars even when explicit
|
|
115
|
+
// headers are supplied. Suppress them only for the managed gateway so a
|
|
116
|
+
// local vendor credential cannot ride along with the admission profile.
|
|
117
|
+
const exporter = Object.keys(config.headers).length > 0
|
|
118
|
+
? withoutAmbientOtlpHeaders(createExporter)
|
|
119
|
+
: createExporter();
|
|
32
120
|
provider = new NodeTracerProvider({
|
|
33
121
|
resource: resourceFromAttributes({
|
|
34
122
|
[SemanticResourceAttributes.SERVICE_NAME]: "adg",
|
|
123
|
+
[SemanticResourceAttributes.SERVICE_NAMESPACE]: "com.rbbtsn0w",
|
|
124
|
+
[SemanticResourceAttributes.SERVICE_VERSION]: serviceVersion(),
|
|
35
125
|
}),
|
|
36
|
-
spanProcessors: [new
|
|
126
|
+
spanProcessors: [new BatchSpanProcessor(exporter, config.batch)],
|
|
37
127
|
});
|
|
38
128
|
provider.register();
|
|
39
129
|
activeTracer = opentelemetry.trace.getTracer("adg");
|
|
40
130
|
}
|
|
41
131
|
return activeTracer;
|
|
42
132
|
}
|
|
43
|
-
export async function shutdownTelemetry() {
|
|
133
|
+
export async function shutdownTelemetry(timeoutMillis = defaultTelemetryConfig(process.env).shutdownTimeoutMillis) {
|
|
44
134
|
if (provider) {
|
|
135
|
+
let timeout;
|
|
45
136
|
try {
|
|
46
|
-
await
|
|
137
|
+
await Promise.race([
|
|
138
|
+
provider.shutdown(),
|
|
139
|
+
new Promise((resolve) => {
|
|
140
|
+
timeout = setTimeout(resolve, timeoutMillis);
|
|
141
|
+
}),
|
|
142
|
+
]);
|
|
47
143
|
}
|
|
48
144
|
catch {
|
|
49
145
|
// Silently fail - telemetry should never break CLI exit
|
|
50
146
|
}
|
|
147
|
+
finally {
|
|
148
|
+
if (timeout !== undefined)
|
|
149
|
+
clearTimeout(timeout);
|
|
150
|
+
}
|
|
51
151
|
}
|
|
52
152
|
}
|
|
53
153
|
/**
|
|
@@ -62,28 +162,26 @@ export function sanitizePath(path) {
|
|
|
62
162
|
return "[PATH]";
|
|
63
163
|
}
|
|
64
164
|
export function sanitizeArgs(args) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
165
|
+
const [executableName, ...rest] = args;
|
|
166
|
+
const safePositionals = executableName === "adg"
|
|
167
|
+
? new Set(["plugin", "plugins", "skill", "skills", "update", "add", "remove", "sync", "list", "status", "inspect", "validate", "migrate", "cache", "marketplace", "link", "unlink", "enable", "disable", "import-skills"])
|
|
168
|
+
: executableName === "git"
|
|
169
|
+
? new Set(["clone", "fetch", "pull", "rev-parse", "ls-remote", "show", "init", "add", "commit"])
|
|
170
|
+
: executableName === "npm"
|
|
171
|
+
? new Set(["install", "update", "exec"])
|
|
172
|
+
: new Set();
|
|
173
|
+
return [executableName ?? "", ...rest.map((arg, index) => {
|
|
174
|
+
if (arg.startsWith("-")) {
|
|
175
|
+
return arg.includes("=") ? "[FLAG]=[VALUE]" : "[FLAG]";
|
|
73
176
|
}
|
|
74
|
-
|
|
177
|
+
const positionIsStructural = (executableName === "adg" && index <= 1) ||
|
|
178
|
+
(executableName === "git" && index === 0) ||
|
|
179
|
+
(executableName === "npm" && index === 0);
|
|
180
|
+
if (positionIsStructural && safePositionals.has(arg)) {
|
|
75
181
|
return arg;
|
|
76
182
|
}
|
|
77
|
-
if (/^-[a-zA-Z0-9]/.test(arg)) {
|
|
78
|
-
return `${arg.slice(0, 2)}[VALUE]`;
|
|
79
|
-
}
|
|
80
183
|
return "[VALUE]";
|
|
81
|
-
}
|
|
82
|
-
if (/^[a-z]+(-[a-z]+)*$/.test(arg) || /^[0-9]+$/.test(arg)) {
|
|
83
|
-
return arg;
|
|
84
|
-
}
|
|
85
|
-
return "[VALUE]";
|
|
86
|
-
});
|
|
184
|
+
})];
|
|
87
185
|
}
|
|
88
186
|
/** Record a privacy-safe event without allowing telemetry to affect CLI behavior. */
|
|
89
187
|
export function recordTelemetryEvent(name, attributes, span = opentelemetry.trace.getActiveSpan()) {
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
2
|
-
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
3
|
-
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
4
|
-
import { resourceFromAttributes } from "@opentelemetry/resources";
|
|
5
|
-
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
6
|
-
import * as opentelemetry from "@opentelemetry/api";
|
|
7
1
|
import { propagation, ROOT_CONTEXT } from "@opentelemetry/api";
|
|
8
2
|
import { readFileSync, existsSync } from "node:fs";
|
|
9
3
|
import { dirname, join } from "node:path";
|
|
10
4
|
import { fileURLToPath } from "node:url";
|
|
11
|
-
|
|
12
|
-
function normalizeTraceEndpoint(endpoint) {
|
|
13
|
-
const normalized = endpoint.replace(/\/$/, "");
|
|
14
|
-
return normalized.endsWith("/v1/traces") ? normalized : `${normalized}/v1/traces`;
|
|
15
|
-
}
|
|
16
|
-
const TELEMETRY_URL = process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||
|
|
17
|
-
(baseEndpoint
|
|
18
|
-
? normalizeTraceEndpoint(baseEndpoint)
|
|
19
|
-
: "https://telemetry-gateway.hamiltonsnow.workers.dev/v1/traces");
|
|
5
|
+
import { getTracer as getAdgTracer, shutdownTelemetry } from "../../../src/telemetry.js";
|
|
20
6
|
const AUDIT_URL = "https://add-skill.vercel.sh/audit";
|
|
21
|
-
let provider = null;
|
|
22
|
-
let activeTracer = null;
|
|
23
7
|
let detectedAgentName = null;
|
|
24
8
|
export function setDetectedAgent(agentName) {
|
|
25
9
|
detectedAgentName = agentName;
|
|
@@ -84,23 +68,7 @@ export async function fetchAuditData(source, skillSlugs, timeoutMs = 3000) {
|
|
|
84
68
|
}
|
|
85
69
|
}
|
|
86
70
|
export function getTracer() {
|
|
87
|
-
|
|
88
|
-
return opentelemetry.trace.getTracer("adg-noop");
|
|
89
|
-
}
|
|
90
|
-
if (!activeTracer) {
|
|
91
|
-
const exporter = new OTLPTraceExporter({
|
|
92
|
-
url: TELEMETRY_URL,
|
|
93
|
-
});
|
|
94
|
-
provider = new NodeTracerProvider({
|
|
95
|
-
resource: resourceFromAttributes({
|
|
96
|
-
[SemanticResourceAttributes.SERVICE_NAME]: "adg",
|
|
97
|
-
}),
|
|
98
|
-
spanProcessors: [new SimpleSpanProcessor(exporter)],
|
|
99
|
-
});
|
|
100
|
-
provider.register();
|
|
101
|
-
activeTracer = opentelemetry.trace.getTracer("adg");
|
|
102
|
-
}
|
|
103
|
-
return activeTracer;
|
|
71
|
+
return getAdgTracer();
|
|
104
72
|
}
|
|
105
73
|
export function track(data) {
|
|
106
74
|
if (!isEnabled())
|
|
@@ -117,15 +85,25 @@ export function track(data) {
|
|
|
117
85
|
if (isCI()) {
|
|
118
86
|
span.setAttribute("ci", true);
|
|
119
87
|
}
|
|
120
|
-
if (detectedAgentName)
|
|
121
|
-
span.setAttribute("
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
88
|
+
if (detectedAgentName)
|
|
89
|
+
span.setAttribute("adg.command.target", detectedAgentName);
|
|
90
|
+
span.setAttribute("adg.skills.operation", data.event);
|
|
91
|
+
if ("sourceType" in data && data.sourceType)
|
|
92
|
+
span.setAttribute("adg.source.type", data.sourceType);
|
|
93
|
+
if ("global" in data)
|
|
94
|
+
span.setAttribute("adg.command.scope", data.global === "1" ? "global" : "project");
|
|
95
|
+
if ("scope" in data && data.scope)
|
|
96
|
+
span.setAttribute("adg.command.scope", data.scope);
|
|
97
|
+
if ("skillCount" in data)
|
|
98
|
+
span.setAttribute("adg.skills.count", Number(data.skillCount));
|
|
99
|
+
if ("successCount" in data)
|
|
100
|
+
span.setAttribute("adg.skills.success_count", Number(data.successCount));
|
|
101
|
+
if ("failCount" in data)
|
|
102
|
+
span.setAttribute("adg.skills.failed_count", Number(data.failCount));
|
|
103
|
+
if ("resultCount" in data)
|
|
104
|
+
span.setAttribute("adg.skills.result_count", Number(data.resultCount));
|
|
105
|
+
if ("interactive" in data)
|
|
106
|
+
span.setAttribute("adg.command.interactive", data.interactive === "1");
|
|
129
107
|
span.end();
|
|
130
108
|
}
|
|
131
109
|
catch {
|
|
@@ -133,8 +111,5 @@ export function track(data) {
|
|
|
133
111
|
}
|
|
134
112
|
}
|
|
135
113
|
export async function flushTelemetry(timeoutMs = 5000) {
|
|
136
|
-
|
|
137
|
-
const timeout = new Promise((resolve) => setTimeout(resolve, timeoutMs));
|
|
138
|
-
await Promise.race([provider.shutdown(), timeout]);
|
|
139
|
-
}
|
|
114
|
+
await shutdownTelemetry(Math.min(timeoutMs, 1500));
|
|
140
115
|
}
|
|
@@ -39,7 +39,6 @@ function recordSelfCliEntrypointMissing() {
|
|
|
39
39
|
span.setAttribute("process.command_args", ["adg", "skills", "add"]);
|
|
40
40
|
span.setAttribute("process.exit.code", -1);
|
|
41
41
|
span.setAttribute("error.type", "CLI_ENTRYPOINT_NOT_FOUND");
|
|
42
|
-
span.recordException(new Error("CLI entrypoint not found"));
|
|
43
42
|
span.setStatus({
|
|
44
43
|
code: SpanStatusCode.ERROR,
|
|
45
44
|
message: "CLI entrypoint not found",
|
|
@@ -82,7 +82,9 @@ plugin root. The ADG adapter materializes files at these conventional locations.
|
|
|
82
82
|
- **Authentication boundary**: The adapter passes through explicitly authored
|
|
83
83
|
native `oauth` configuration, but never synthesizes OAuth client credentials or
|
|
84
84
|
overrides Dynamic Client Registration. Compatibility workarounds belong in the
|
|
85
|
-
authored MCP transport (for example, a stdio bridge)
|
|
85
|
+
authored MCP transport (for example, a stdio bridge). Provider-specific OAuth
|
|
86
|
+
metadata, such as an explicit scope required by that bridge, must also remain
|
|
87
|
+
in its authored arguments rather than being inferred by ADG.
|
|
86
88
|
|
|
87
89
|
---
|
|
88
90
|
|
package/package.json
CHANGED
|
@@ -73,6 +73,7 @@ re-vendoring. Each is marked inline with an `ADG patch:` comment.
|
|
|
73
73
|
| `src/update.ts` → `updateGlobalSkills` | Track `failedSources`; stop printing "All global skills are up to date" when a source could not be checked | The swallowed private-repo failure used to be masked by a false "up to date". Now surfaced, with a hint to set `GITHUB_TOKEN` / `gh auth login`, and counted in `failCount`. |
|
|
74
74
|
| `src/update.ts` → `SELF_CLI_ENTRY` (both global + project update paths) | Re-invoke ADG binary `bin/adg.ts` / `bin/adg.js` instead of `cli.ts` / `cli.js` | Unifies execution under the main ADG product logic (`adg skills add`), keeping telemetry and wrapper context active. |
|
|
75
75
|
| `src/telemetry.ts` → `getTracer` | SERVICE_NAME `"adg-skills"` $\rightarrow$ `"adg"`, plus `domain: "skills"` span attribute and export `getTracer` | Unifies the telemetry tracking under the single complete `adg` product service name while keeping domain categorization, and allows `update.ts` to wrap subprocesses in CLIENT spans. |
|
|
76
|
+
| `src/telemetry.ts` → shared provider and bounded attributes | Reuse ADG's root tracer/provider and replace raw source, skill, agent-list, and query fields with bounded type/count/scope dimensions | Prevent duplicate SDK shutdown paths and keep vendored skills telemetry inside ADG's privacy contract. |
|
|
76
77
|
| `src/git.ts` → `createGitClient` | Add `unsafe: { allowUnsafeFilter: true }` to `simpleGit(...)` | simple-git ≥3.36 blocks `filter.*.smudge/clean` configs (RCE vector) and fails **every** clone with "Configuring filter.smudge is not permitted without enabling allowUnsafeFilter". The configs here set the LFS filter to EMPTY (disabling it), so opting in is safe and matches their intent. |
|
|
77
78
|
| `src/git.ts` → `import simpleGit from 'simple-git'` | Default → named import `import { simpleGit } from 'simple-git'` | The default import is not callable under ADG's strict root tsconfig (NodeNext + verbatimModuleSyntax, no esModuleInterop); the named export is. Needed for `git.ts` to typecheck when a test imports it (e.g. via `use.ts`). |
|
|
78
79
|
| `src/git.ts` → `createGitClient` env | Pass env via `.env({...})` instead of as a `simpleGit(...)` constructor option | **Latent runtime bug**: simple-git's factory only reads `baseDir`/`maxConcurrentProcesses`/`config`/`trimmed`/plugins from the options object and silently drops `env`, so `GIT_TERMINAL_PROMPT`/`GIT_LFS_SKIP_SMUDGE`/`GIT_SSH_COMMAND` never reached the spawned git (it inherited the full parent env). `.env(object)` is the documented API and sets the executor env actually used at spawn. |
|