@rbbtsn0w/adg 0.6.0-beta.3 → 0.6.0-beta.5
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 +0 -1
- package/dist/src/sources.js +1 -1
- package/dist/src/telemetry.js +28 -21
- package/dist/vendor/skills/src/cli.js +6 -1
- package/dist/vendor/skills/src/update.js +29 -4
- package/package.json +1 -1
- package/vendor/skills/src/cli.ts +6 -1
- package/vendor/skills/src/update.ts +32 -4
package/dist/bin/adg.js
CHANGED
|
@@ -104,7 +104,6 @@ async function main(argv) {
|
|
|
104
104
|
let status = 0;
|
|
105
105
|
try {
|
|
106
106
|
span.setAttribute("process.executable.name", "adg");
|
|
107
|
-
span.setAttribute("process.executable.path", process.argv[1] || process.execPath);
|
|
108
107
|
span.setAttribute("process.pid", process.pid);
|
|
109
108
|
span.setAttribute("process.command_args", sanitizeArgs(["adg", ...argv]));
|
|
110
109
|
// Check for an available update (reads local cache; schedules a background
|
package/dist/src/sources.js
CHANGED
|
@@ -90,7 +90,7 @@ export function cloneGitHub(src, dest, opts = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
return dest;
|
|
92
92
|
}
|
|
93
|
-
const defaultGitRunner = (args) => {
|
|
93
|
+
export const defaultGitRunner = (args) => {
|
|
94
94
|
const tracer = getTracer();
|
|
95
95
|
return tracer.startActiveSpan("git", { kind: SpanKind.CLIENT }, (span) => {
|
|
96
96
|
try {
|
package/dist/src/telemetry.js
CHANGED
|
@@ -50,32 +50,39 @@ export async function shutdownTelemetry() {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Unconditionally redact any non-empty string passed to it.
|
|
55
|
+
* Telemetry consumers need the command skeleton (subcommands + flags),
|
|
56
|
+
* not path details. Returning a fixed placeholder eliminates all
|
|
57
|
+
* path-related privacy edge cases.
|
|
58
|
+
*/
|
|
59
|
+
export function sanitizePath(path) {
|
|
60
|
+
if (!path)
|
|
61
|
+
return "";
|
|
62
|
+
return "[PATH]";
|
|
63
|
+
}
|
|
53
64
|
export function sanitizeArgs(args) {
|
|
54
65
|
return args.map((arg) => {
|
|
55
|
-
if (arg.startsWith("
|
|
56
|
-
arg.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
arg.startsWith("
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (arg.includes("@") && (arg.startsWith("http://") || arg.startsWith("https://"))) {
|
|
64
|
-
try {
|
|
65
|
-
const url = new URL(arg);
|
|
66
|
-
if (url.username) {
|
|
67
|
-
url.username = "[REDACTED]";
|
|
68
|
-
}
|
|
69
|
-
if (url.password) {
|
|
70
|
-
url.password = "[REDACTED]";
|
|
71
|
-
}
|
|
72
|
-
return url.toString();
|
|
66
|
+
if (arg.startsWith("-")) {
|
|
67
|
+
const eqIndex = arg.indexOf("=");
|
|
68
|
+
if (eqIndex !== -1) {
|
|
69
|
+
return `${arg.slice(0, eqIndex)}=[VALUE]`;
|
|
70
|
+
}
|
|
71
|
+
if (arg.startsWith("--") && /^--[a-zA-Z0-9-]+$/.test(arg)) {
|
|
72
|
+
return arg;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
return
|
|
74
|
+
if (/^-[a-zA-Z0-9]$/.test(arg)) {
|
|
75
|
+
return arg;
|
|
76
76
|
}
|
|
77
|
+
if (/^-[a-zA-Z0-9]/.test(arg)) {
|
|
78
|
+
return `${arg.slice(0, 2)}[VALUE]`;
|
|
79
|
+
}
|
|
80
|
+
return "[VALUE]";
|
|
81
|
+
}
|
|
82
|
+
if (/^[a-z]+(-[a-z]+)*$/.test(arg) || /^[0-9]+$/.test(arg)) {
|
|
83
|
+
return arg;
|
|
77
84
|
}
|
|
78
|
-
return
|
|
85
|
+
return "[VALUE]";
|
|
79
86
|
});
|
|
80
87
|
}
|
|
81
88
|
/** Record a privacy-safe event without allowing telemetry to affect CLI behavior. */
|
|
@@ -341,4 +341,9 @@ async function main() {
|
|
|
341
341
|
console.log(`Run ${BOLD}skills --help${RESET} for usage.`);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
main()
|
|
344
|
+
main()
|
|
345
|
+
.catch((error) => {
|
|
346
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
347
|
+
process.exitCode = 1;
|
|
348
|
+
})
|
|
349
|
+
.finally(() => flushTelemetry().then(() => process.exit(process.exitCode ?? 0)));
|
|
@@ -24,9 +24,31 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
24
24
|
* our actual TS entry, run via Node's type-stripping (Node >= 22.6), exactly how
|
|
25
25
|
* `adg skills` launches the CLI. See vendor/skills/PROVENANCE.md.
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export function resolveSelfCliEntry(moduleDir = __dirname, exists = existsSync) {
|
|
28
|
+
const sourceEntry = join(moduleDir, '../../../bin/adg.ts');
|
|
29
|
+
if (exists(sourceEntry))
|
|
30
|
+
return sourceEntry;
|
|
31
|
+
return join(moduleDir, '../../../bin/adg.js');
|
|
32
|
+
}
|
|
33
|
+
const SELF_CLI_ENTRY = resolveSelfCliEntry();
|
|
34
|
+
function recordSelfCliEntrypointMissing() {
|
|
35
|
+
const tracer = getTracer();
|
|
36
|
+
const span = tracer.startSpan("adg", { kind: SpanKind.CLIENT });
|
|
37
|
+
try {
|
|
38
|
+
span.setAttribute("process.executable.name", "adg");
|
|
39
|
+
span.setAttribute("process.command_args", ["adg", "skills", "add"]);
|
|
40
|
+
span.setAttribute("process.exit.code", -1);
|
|
41
|
+
span.setAttribute("error.type", "CLI_ENTRYPOINT_NOT_FOUND");
|
|
42
|
+
span.recordException(new Error("CLI entrypoint not found"));
|
|
43
|
+
span.setStatus({
|
|
44
|
+
code: SpanStatusCode.ERROR,
|
|
45
|
+
message: "CLI entrypoint not found",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
span.end();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
30
52
|
const RESET = '\x1b[0m';
|
|
31
53
|
const BOLD = '\x1b[1m';
|
|
32
54
|
const DIM = '\x1b[38;5;102m';
|
|
@@ -400,13 +422,14 @@ export async function updateGlobalSkills(options = {}) {
|
|
|
400
422
|
console.log(`${TEXT}Updating ${safeName}...${RESET}`);
|
|
401
423
|
const installUrl = buildUpdateInstallSource(update.entry);
|
|
402
424
|
const cliEntry = SELF_CLI_ENTRY;
|
|
425
|
+
const args = ['skills', 'add', installUrl, '-g', '-y'];
|
|
403
426
|
if (!existsSync(cliEntry)) {
|
|
404
427
|
failCount++;
|
|
428
|
+
recordSelfCliEntrypointMissing();
|
|
405
429
|
console.log(` ${DIM}✗ Failed to update ${safeName}: CLI entrypoint not found at ${cliEntry}${RESET}`);
|
|
406
430
|
continue;
|
|
407
431
|
}
|
|
408
432
|
const tracer = getTracer();
|
|
409
|
-
const args = ['skills', 'add', installUrl, '-g', '-y'];
|
|
410
433
|
const result = tracer.startActiveSpan("adg", { kind: SpanKind.CLIENT }, (span) => {
|
|
411
434
|
try {
|
|
412
435
|
span.setAttribute("process.executable.name", "adg");
|
|
@@ -508,6 +531,7 @@ export async function updateProjectSkills(options = {}) {
|
|
|
508
531
|
const localLock = await readLocalLock();
|
|
509
532
|
const cliEntry = SELF_CLI_ENTRY;
|
|
510
533
|
if (!existsSync(cliEntry)) {
|
|
534
|
+
recordSelfCliEntrypointMissing();
|
|
511
535
|
console.log(`${DIM}✗ CLI entrypoint not found at ${cliEntry}${RESET}`);
|
|
512
536
|
return { successCount, failCount: updatable.length, foundCount: projectSkills.length };
|
|
513
537
|
}
|
|
@@ -652,6 +676,7 @@ export async function runUpdate(args = []) {
|
|
|
652
676
|
}
|
|
653
677
|
if (totalFail > 0) {
|
|
654
678
|
console.log(`${DIM}Failed to update ${totalFail} skill(s)${RESET}`);
|
|
679
|
+
process.exitCode = 1;
|
|
655
680
|
}
|
|
656
681
|
track({
|
|
657
682
|
event: 'update',
|
package/package.json
CHANGED
package/vendor/skills/src/cli.ts
CHANGED
|
@@ -388,4 +388,9 @@ async function main(): Promise<void> {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
main()
|
|
391
|
+
main()
|
|
392
|
+
.catch((error) => {
|
|
393
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
394
|
+
process.exitCode = 1;
|
|
395
|
+
})
|
|
396
|
+
.finally(() => flushTelemetry().then(() => process.exit(process.exitCode ?? 0)));
|
|
@@ -32,9 +32,34 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
32
32
|
* our actual TS entry, run via Node's type-stripping (Node >= 22.6), exactly how
|
|
33
33
|
* `adg skills` launches the CLI. See vendor/skills/PROVENANCE.md.
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
:
|
|
35
|
+
export function resolveSelfCliEntry(
|
|
36
|
+
moduleDir: string = __dirname,
|
|
37
|
+
exists: (path: string) => boolean = existsSync
|
|
38
|
+
): string {
|
|
39
|
+
const sourceEntry = join(moduleDir, '../../../bin/adg.ts');
|
|
40
|
+
if (exists(sourceEntry)) return sourceEntry;
|
|
41
|
+
return join(moduleDir, '../../../bin/adg.js');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const SELF_CLI_ENTRY = resolveSelfCliEntry();
|
|
45
|
+
|
|
46
|
+
function recordSelfCliEntrypointMissing(): void {
|
|
47
|
+
const tracer = getTracer();
|
|
48
|
+
const span = tracer.startSpan("adg", { kind: SpanKind.CLIENT });
|
|
49
|
+
try {
|
|
50
|
+
span.setAttribute("process.executable.name", "adg");
|
|
51
|
+
span.setAttribute("process.command_args", ["adg", "skills", "add"]);
|
|
52
|
+
span.setAttribute("process.exit.code", -1);
|
|
53
|
+
span.setAttribute("error.type", "CLI_ENTRYPOINT_NOT_FOUND");
|
|
54
|
+
span.recordException(new Error("CLI entrypoint not found"));
|
|
55
|
+
span.setStatus({
|
|
56
|
+
code: SpanStatusCode.ERROR,
|
|
57
|
+
message: "CLI entrypoint not found",
|
|
58
|
+
});
|
|
59
|
+
} finally {
|
|
60
|
+
span.end();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
38
63
|
|
|
39
64
|
const RESET = '\x1b[0m';
|
|
40
65
|
const BOLD = '\x1b[1m';
|
|
@@ -507,15 +532,16 @@ export async function updateGlobalSkills(
|
|
|
507
532
|
const installUrl = buildUpdateInstallSource(update.entry);
|
|
508
533
|
|
|
509
534
|
const cliEntry = SELF_CLI_ENTRY;
|
|
535
|
+
const args = ['skills', 'add', installUrl, '-g', '-y'];
|
|
510
536
|
if (!existsSync(cliEntry)) {
|
|
511
537
|
failCount++;
|
|
538
|
+
recordSelfCliEntrypointMissing();
|
|
512
539
|
console.log(
|
|
513
540
|
` ${DIM}✗ Failed to update ${safeName}: CLI entrypoint not found at ${cliEntry}${RESET}`
|
|
514
541
|
);
|
|
515
542
|
continue;
|
|
516
543
|
}
|
|
517
544
|
const tracer = getTracer();
|
|
518
|
-
const args = ['skills', 'add', installUrl, '-g', '-y'];
|
|
519
545
|
const result = tracer.startActiveSpan("adg", { kind: SpanKind.CLIENT }, (span) => {
|
|
520
546
|
try {
|
|
521
547
|
span.setAttribute("process.executable.name", "adg");
|
|
@@ -635,6 +661,7 @@ export async function updateProjectSkills(
|
|
|
635
661
|
const cliEntry = SELF_CLI_ENTRY;
|
|
636
662
|
|
|
637
663
|
if (!existsSync(cliEntry)) {
|
|
664
|
+
recordSelfCliEntrypointMissing();
|
|
638
665
|
console.log(`${DIM}✗ CLI entrypoint not found at ${cliEntry}${RESET}`);
|
|
639
666
|
return { successCount, failCount: updatable.length, foundCount: projectSkills.length };
|
|
640
667
|
}
|
|
@@ -807,6 +834,7 @@ export async function runUpdate(args: string[] = []): Promise<void> {
|
|
|
807
834
|
}
|
|
808
835
|
if (totalFail > 0) {
|
|
809
836
|
console.log(`${DIM}Failed to update ${totalFail} skill(s)${RESET}`);
|
|
837
|
+
process.exitCode = 1;
|
|
810
838
|
}
|
|
811
839
|
|
|
812
840
|
track({
|