@a5c-ai/babysitter-sdk 0.0.170-staging.e67b79d3 → 0.0.170-staging.ff24b07d
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/cli/commands/hookRun.d.ts +2 -0
- package/dist/cli/commands/hookRun.d.ts.map +1 -1
- package/dist/cli/commands/hookRun.js +58 -19
- package/dist/cli/commands/runIterate.d.ts +9 -0
- package/dist/cli/commands/runIterate.d.ts.map +1 -1
- package/dist/cli/commands/runIterate.js +25 -0
- package/dist/cli/commands/skill.d.ts +79 -5
- package/dist/cli/commands/skill.d.ts.map +1 -1
- package/dist/cli/commands/skill.js +439 -63
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +226 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hookRun.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hookRun.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+EH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"hookRun.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hookRun.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+EH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAggBD,wBAAsB,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiD7E"}
|
|
@@ -131,7 +131,10 @@ function countPendingByKind(records) {
|
|
|
131
131
|
return Object.fromEntries(Array.from(counts.entries()).sort(([a], [b]) => a.localeCompare(b)));
|
|
132
132
|
}
|
|
133
133
|
// ---------------------------------------------------------------------------
|
|
134
|
-
// handleHookRunStop —
|
|
134
|
+
// handleHookRunStop — Claude Code "SessionEnd" hook handler
|
|
135
|
+
//
|
|
136
|
+
// Claude Code-specific: reads {session_id, transcript_path} from stdin,
|
|
137
|
+
// outputs {decision: "approve"|"block", reason?, systemMessage?, instructions?}
|
|
135
138
|
// ---------------------------------------------------------------------------
|
|
136
139
|
async function handleHookRunStop(args) {
|
|
137
140
|
const { verbose } = args;
|
|
@@ -149,7 +152,7 @@ async function handleHookRunStop(args) {
|
|
|
149
152
|
process.stderr.write(`[hook:run stop] stdin read error: ${msg}\n`);
|
|
150
153
|
}
|
|
151
154
|
// Allow exit on error
|
|
152
|
-
process.stdout.write('{"decision":"
|
|
155
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
153
156
|
return 0;
|
|
154
157
|
}
|
|
155
158
|
const hookInput = parseHookInput(rawInput);
|
|
@@ -161,39 +164,44 @@ async function handleHookRunStop(args) {
|
|
|
161
164
|
if (verbose) {
|
|
162
165
|
process.stderr.write("[hook:run stop] No session ID in hook input\n");
|
|
163
166
|
}
|
|
164
|
-
process.stdout.write('{"decision":"
|
|
167
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
165
168
|
return 0;
|
|
166
169
|
}
|
|
167
170
|
log.setContext("session", sessionId);
|
|
171
|
+
log.info(`Session ID: ${sessionId}`);
|
|
168
172
|
// 2. Resolve pluginRoot and stateDir
|
|
169
173
|
const pluginRoot = args.pluginRoot || process.env.CLAUDE_PLUGIN_ROOT || "";
|
|
170
174
|
const stateDir = args.stateDir ||
|
|
171
175
|
(pluginRoot ? path.join(pluginRoot, "skills", "babysit", "state") : "");
|
|
172
176
|
if (!stateDir) {
|
|
177
|
+
log.warn("Cannot determine state directory — allowing exit");
|
|
173
178
|
if (verbose) {
|
|
174
179
|
process.stderr.write("[hook:run stop] Cannot determine state directory\n");
|
|
175
180
|
}
|
|
176
|
-
process.stdout.write('{"decision":"
|
|
181
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
177
182
|
return 0;
|
|
178
183
|
}
|
|
179
184
|
const runsDir = args.runsDir || ".a5c/runs";
|
|
180
185
|
// 3. Check iteration (replaces session:check-iteration CLI call)
|
|
181
186
|
const filePath = (0, session_1.getSessionFilePath)(stateDir, sessionId);
|
|
187
|
+
log.info(`Checking session at: ${filePath}`);
|
|
182
188
|
let sessionFile;
|
|
183
189
|
try {
|
|
184
190
|
if (!(await (0, session_1.sessionFileExists)(filePath))) {
|
|
185
191
|
// No active loop
|
|
192
|
+
log.info("No active loop found — allowing exit");
|
|
186
193
|
if (verbose) {
|
|
187
194
|
process.stderr.write(`[hook:run stop] No active loop found for session ${sessionId}\n`);
|
|
188
195
|
}
|
|
189
|
-
process.stdout.write('{"decision":"
|
|
196
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
190
197
|
return 0;
|
|
191
198
|
}
|
|
192
199
|
sessionFile = await (0, session_1.readSessionFile)(filePath);
|
|
193
200
|
}
|
|
194
201
|
catch {
|
|
195
202
|
// Cannot read session — allow exit
|
|
196
|
-
|
|
203
|
+
log.warn("Session file read error — allowing exit");
|
|
204
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
197
205
|
return 0;
|
|
198
206
|
}
|
|
199
207
|
const { state } = sessionFile;
|
|
@@ -204,7 +212,7 @@ async function handleHookRunStop(args) {
|
|
|
204
212
|
process.stderr.write(`[hook:run stop] Max iterations (${state.maxIterations}) reached\n`);
|
|
205
213
|
}
|
|
206
214
|
await cleanupSession(filePath);
|
|
207
|
-
process.stdout.write('{"decision":"
|
|
215
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
208
216
|
return 0;
|
|
209
217
|
}
|
|
210
218
|
// Check iteration timing (runaway loop detection)
|
|
@@ -218,7 +226,7 @@ async function handleHookRunStop(args) {
|
|
|
218
226
|
process.stderr.write(`[hook:run stop] Iteration too fast (avg ${avg}s)\n`);
|
|
219
227
|
}
|
|
220
228
|
await cleanupSession(filePath);
|
|
221
|
-
process.stdout.write('{"decision":"
|
|
229
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
222
230
|
return 0;
|
|
223
231
|
}
|
|
224
232
|
// shouldContinue=true at this point
|
|
@@ -251,7 +259,7 @@ async function handleHookRunStop(args) {
|
|
|
251
259
|
process.stderr.write(`[hook:run stop] Transcript parse error: ${resolvedTranscript}\n`);
|
|
252
260
|
}
|
|
253
261
|
await cleanupSession(filePath);
|
|
254
|
-
process.stdout.write('{"decision":"
|
|
262
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
255
263
|
return 0;
|
|
256
264
|
}
|
|
257
265
|
}
|
|
@@ -260,7 +268,7 @@ async function handleHookRunStop(args) {
|
|
|
260
268
|
process.stderr.write(`[hook:run stop] Transcript not found: ${resolvedTranscript}\n`);
|
|
261
269
|
}
|
|
262
270
|
await cleanupSession(filePath);
|
|
263
|
-
process.stdout.write('{"decision":"
|
|
271
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
264
272
|
return 0;
|
|
265
273
|
}
|
|
266
274
|
}
|
|
@@ -269,7 +277,17 @@ async function handleHookRunStop(args) {
|
|
|
269
277
|
process.stderr.write("[hook:run stop] No assistant text content found in transcript\n");
|
|
270
278
|
}
|
|
271
279
|
await cleanupSession(filePath);
|
|
272
|
-
process.stdout.write('{"decision":"
|
|
280
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
281
|
+
return 0;
|
|
282
|
+
}
|
|
283
|
+
// 4b. If no run is associated, there's nothing to iterate on — allow exit
|
|
284
|
+
if (!runId) {
|
|
285
|
+
log.info("No run associated with session — allowing exit");
|
|
286
|
+
if (verbose) {
|
|
287
|
+
process.stderr.write(`[hook:run stop] No run associated with session ${sessionId} — allowing exit\n`);
|
|
288
|
+
}
|
|
289
|
+
await cleanupSession(filePath);
|
|
290
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
273
291
|
return 0;
|
|
274
292
|
}
|
|
275
293
|
// 5. If runId is present, get run status
|
|
@@ -319,7 +337,7 @@ async function handleHookRunStop(args) {
|
|
|
319
337
|
process.stderr.write(`[hook:run stop] Run state is empty for ${runId}; run may be misconfigured\n`);
|
|
320
338
|
}
|
|
321
339
|
await cleanupSession(filePath);
|
|
322
|
-
process.stdout.write('{"decision":"
|
|
340
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
323
341
|
return 0;
|
|
324
342
|
}
|
|
325
343
|
}
|
|
@@ -333,7 +351,7 @@ async function handleHookRunStop(args) {
|
|
|
333
351
|
process.stderr.write(`[hook:run stop] Valid promise tag detected - run complete\n`);
|
|
334
352
|
}
|
|
335
353
|
await cleanupSession(filePath);
|
|
336
|
-
process.stdout.write('{"decision":"
|
|
354
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
337
355
|
return 0;
|
|
338
356
|
}
|
|
339
357
|
// 7. Not complete → continue loop
|
|
@@ -342,7 +360,7 @@ async function handleHookRunStop(args) {
|
|
|
342
360
|
process.stderr.write(`[hook:run stop] State file corrupted - no prompt text\n`);
|
|
343
361
|
}
|
|
344
362
|
await cleanupSession(filePath);
|
|
345
|
-
process.stdout.write('{"decision":"
|
|
363
|
+
process.stdout.write('{"decision":"approve"}\n');
|
|
346
364
|
return 0;
|
|
347
365
|
}
|
|
348
366
|
const nextIteration = iteration + 1;
|
|
@@ -412,7 +430,10 @@ async function handleHookRunStop(args) {
|
|
|
412
430
|
return 0;
|
|
413
431
|
}
|
|
414
432
|
// ---------------------------------------------------------------------------
|
|
415
|
-
// handleHookRunSessionStart —
|
|
433
|
+
// handleHookRunSessionStart — Claude Code "SessionStart" hook handler
|
|
434
|
+
//
|
|
435
|
+
// Claude Code-specific: reads {session_id} from stdin,
|
|
436
|
+
// writes session ID to CLAUDE_ENV_FILE if set, outputs {}
|
|
416
437
|
// ---------------------------------------------------------------------------
|
|
417
438
|
async function handleHookRunSessionStart(args) {
|
|
418
439
|
const { verbose } = args;
|
|
@@ -425,6 +446,13 @@ async function handleHookRunSessionStart(args) {
|
|
|
425
446
|
process.stdout.write("{}\n");
|
|
426
447
|
return 0;
|
|
427
448
|
}
|
|
449
|
+
finally {
|
|
450
|
+
// Unref stdin so it doesn't keep the event loop alive.
|
|
451
|
+
// The session-start handler is short-lived and doesn't need stdin after this.
|
|
452
|
+
// (The stop handler is unaffected — its shell script pipes from a temp file
|
|
453
|
+
// which reaches EOF naturally, so the event loop drains without unref.)
|
|
454
|
+
process.stdin.unref();
|
|
455
|
+
}
|
|
428
456
|
const hookInput = parseHookInput(rawInput);
|
|
429
457
|
const sessionId = safeStr(hookInput, "session_id");
|
|
430
458
|
if (!sessionId) {
|
|
@@ -465,11 +493,9 @@ async function cleanupSession(filePath) {
|
|
|
465
493
|
// ---------------------------------------------------------------------------
|
|
466
494
|
// Main dispatcher
|
|
467
495
|
// ---------------------------------------------------------------------------
|
|
496
|
+
const SUPPORTED_HARNESSES = ["claude-code"];
|
|
468
497
|
async function handleHookRun(args) {
|
|
469
|
-
const { hookType, json } = args;
|
|
470
|
-
// Early diagnostic log — helps verify CLI dispatch reaches this handler
|
|
471
|
-
const dispatchLog = createHookLogger("babysitter-stop-hook");
|
|
472
|
-
dispatchLog.info(`handleHookRun dispatching hookType=${hookType || "(empty)"}`);
|
|
498
|
+
const { hookType, harness, json } = args;
|
|
473
499
|
if (!hookType) {
|
|
474
500
|
const error = {
|
|
475
501
|
error: "MISSING_HOOK_TYPE",
|
|
@@ -483,6 +509,19 @@ async function handleHookRun(args) {
|
|
|
483
509
|
}
|
|
484
510
|
return 1;
|
|
485
511
|
}
|
|
512
|
+
if (!SUPPORTED_HARNESSES.includes(harness)) {
|
|
513
|
+
const error = {
|
|
514
|
+
error: "UNSUPPORTED_HARNESS",
|
|
515
|
+
message: `Unsupported harness: "${harness}". Supported: ${SUPPORTED_HARNESSES.join(", ")}`,
|
|
516
|
+
};
|
|
517
|
+
if (json) {
|
|
518
|
+
process.stderr.write(JSON.stringify(error) + "\n");
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
process.stderr.write(`Error: ${error.message}\n`);
|
|
522
|
+
}
|
|
523
|
+
return 1;
|
|
524
|
+
}
|
|
486
525
|
switch (hookType) {
|
|
487
526
|
case "stop":
|
|
488
527
|
return await handleHookRunStop(args);
|
|
@@ -15,6 +15,7 @@ export interface RunIterateOptions {
|
|
|
15
15
|
iteration?: number;
|
|
16
16
|
verbose?: boolean;
|
|
17
17
|
json?: boolean;
|
|
18
|
+
pluginRoot?: string;
|
|
18
19
|
}
|
|
19
20
|
export interface RunIterateResult {
|
|
20
21
|
iteration: number;
|
|
@@ -30,6 +31,14 @@ export interface RunIterateResult {
|
|
|
30
31
|
runId: string;
|
|
31
32
|
processId: string;
|
|
32
33
|
hookStatus?: string;
|
|
34
|
+
discoveredSkills?: Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
file?: string;
|
|
37
|
+
}>;
|
|
38
|
+
discoveredAgents?: Array<{
|
|
39
|
+
name: string;
|
|
40
|
+
file?: string;
|
|
41
|
+
}>;
|
|
33
42
|
};
|
|
34
43
|
}
|
|
35
44
|
export declare function runIterate(options: RunIterateOptions): Promise<RunIterateResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runIterate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/runIterate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"runIterate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/runIterate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,gBAAgB,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC1D,gBAAgB,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC3D,CAAC;CACH;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2KtF"}
|
|
@@ -52,6 +52,7 @@ const stateCache_1 = require("../../runtime/replay/stateCache");
|
|
|
52
52
|
const runtime_1 = require("../../runtime/hooks/runtime");
|
|
53
53
|
const orchestrateIteration_1 = require("../../runtime/orchestrateIteration");
|
|
54
54
|
const completionProof_1 = require("../completionProof");
|
|
55
|
+
const skill_1 = require("./skill");
|
|
55
56
|
async function runIterate(options) {
|
|
56
57
|
const { runDir, verbose } = options;
|
|
57
58
|
// Read run metadata
|
|
@@ -172,6 +173,30 @@ async function runIterate(options) {
|
|
|
172
173
|
hookStatus: hookResult.executedHooks?.length > 0 ? "executed" : "none",
|
|
173
174
|
},
|
|
174
175
|
};
|
|
176
|
+
// Discover available skills and agents
|
|
177
|
+
// Try process-driven discovery first (reads @skill/@agent markers from process file)
|
|
178
|
+
const pluginRoot = options.pluginRoot;
|
|
179
|
+
if (pluginRoot && result.metadata) {
|
|
180
|
+
try {
|
|
181
|
+
const processFilePath = metadata.entrypoint?.importPath ?? metadata.processPath;
|
|
182
|
+
const processDiscovery = processFilePath
|
|
183
|
+
? (0, skill_1.discoverFromProcessFile)({ processFilePath, pluginRoot })
|
|
184
|
+
: null;
|
|
185
|
+
if (processDiscovery) {
|
|
186
|
+
result.metadata.discoveredSkills = processDiscovery.skills;
|
|
187
|
+
result.metadata.discoveredAgents = processDiscovery.agents;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
// Fallback to generic scan
|
|
191
|
+
const discoverResult = await (0, skill_1.discoverSkillsInternal)({ pluginRoot, runId });
|
|
192
|
+
result.metadata.discoveredSkills = discoverResult.skills.map(s => ({ name: s.name, file: s.file }));
|
|
193
|
+
result.metadata.discoveredAgents = discoverResult.agents.map(a => ({ name: a.name, file: a.file }));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// Non-fatal
|
|
198
|
+
}
|
|
199
|
+
}
|
|
175
200
|
return result;
|
|
176
201
|
}
|
|
177
202
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Skill discovery CLI commands.
|
|
2
|
+
* Skill, agent, and process discovery CLI commands.
|
|
3
3
|
* Replaces bash logic from skill-context-resolver.sh and skill-discovery.sh
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -15,6 +15,7 @@ export interface SkillCommandArgs {
|
|
|
15
15
|
runsDir?: string;
|
|
16
16
|
includeRemote?: boolean;
|
|
17
17
|
summaryOnly?: boolean;
|
|
18
|
+
processPath?: string;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Discovered skill metadata.
|
|
@@ -28,16 +29,87 @@ export interface SkillMetadata {
|
|
|
28
29
|
url?: string;
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* Discovered agent metadata.
|
|
33
|
+
*/
|
|
34
|
+
export interface AgentMetadata {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
role?: string;
|
|
38
|
+
category: string;
|
|
39
|
+
source: 'local' | 'local-plugin' | 'remote';
|
|
40
|
+
file?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Discovered process metadata.
|
|
44
|
+
*/
|
|
45
|
+
export interface ProcessMetadata {
|
|
46
|
+
name: string;
|
|
47
|
+
category: string;
|
|
48
|
+
source: 'library' | 'repo';
|
|
49
|
+
file: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A single @skill or @agent marker parsed from a process file JSDoc header.
|
|
53
|
+
*/
|
|
54
|
+
export interface ProcessMarker {
|
|
55
|
+
type: 'skill' | 'agent';
|
|
56
|
+
name: string;
|
|
57
|
+
relativePath?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Result of parsing all @skill/@agent markers from a process file.
|
|
61
|
+
*/
|
|
62
|
+
export interface ProcessMarkersResult {
|
|
63
|
+
skills: ProcessMarker[];
|
|
64
|
+
agents: ProcessMarker[];
|
|
65
|
+
hasMarkers: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Result of resolving process markers to full metadata.
|
|
69
|
+
*/
|
|
70
|
+
export interface ProcessDiscoveryResult {
|
|
71
|
+
skills: Array<{
|
|
72
|
+
name: string;
|
|
73
|
+
file?: string;
|
|
74
|
+
}>;
|
|
75
|
+
agents: Array<{
|
|
76
|
+
name: string;
|
|
77
|
+
file?: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Parse @skill and @agent markers from a process file's JSDoc header.
|
|
82
|
+
*
|
|
83
|
+
* Expected format in the JSDoc block:
|
|
84
|
+
* @skill <name> <relative-path-to-SKILL.md>
|
|
85
|
+
* @agent <name> <relative-path-to-AGENT.md>
|
|
86
|
+
*
|
|
87
|
+
* Paths are relative to the plugin's process root:
|
|
88
|
+
* pluginRoot/skills/babysit/process/
|
|
89
|
+
*/
|
|
90
|
+
export declare function parseProcessFileMarkers(filePath: string): ProcessMarkersResult;
|
|
91
|
+
/**
|
|
92
|
+
* Discover skills and agents from @skill/@agent markers in a process file.
|
|
93
|
+
*
|
|
94
|
+
* Returns null if no markers are found (caller should fall back to generic scan).
|
|
95
|
+
*/
|
|
96
|
+
export declare function discoverFromProcessFile(options: {
|
|
97
|
+
processFilePath: string;
|
|
98
|
+
pluginRoot: string;
|
|
99
|
+
}): ProcessDiscoveryResult | null;
|
|
100
|
+
/**
|
|
101
|
+
* Result from internal discovery.
|
|
32
102
|
*/
|
|
33
103
|
export interface DiscoverSkillsResult {
|
|
34
104
|
skills: SkillMetadata[];
|
|
105
|
+
agents: AgentMetadata[];
|
|
106
|
+
processes?: ProcessMetadata[];
|
|
35
107
|
summary: string;
|
|
36
108
|
cached: boolean;
|
|
37
109
|
}
|
|
38
110
|
/**
|
|
39
|
-
* Internal
|
|
40
|
-
* (e.g. session:iteration-message).
|
|
111
|
+
* Internal discovery logic, extracted for reuse by other CLI commands
|
|
112
|
+
* (e.g. session:iteration-message, hookRun stop handler).
|
|
41
113
|
*
|
|
42
114
|
* Returns a structured result instead of writing to stdout.
|
|
43
115
|
*/
|
|
@@ -47,10 +119,12 @@ export declare function discoverSkillsInternal(options: {
|
|
|
47
119
|
cacheTtl?: number;
|
|
48
120
|
runsDir?: string;
|
|
49
121
|
includeRemote?: boolean;
|
|
122
|
+
processPath?: string;
|
|
123
|
+
includeProcesses?: boolean;
|
|
50
124
|
}): Promise<DiscoverSkillsResult>;
|
|
51
125
|
/**
|
|
52
126
|
* Handle skill:discover command.
|
|
53
|
-
* Scans for available skills in plugin and repo directories.
|
|
127
|
+
* Scans for available skills, agents, and processes in plugin and repo directories.
|
|
54
128
|
* Thin wrapper around discoverSkillsInternal that handles CLI I/O.
|
|
55
129
|
*/
|
|
56
130
|
export declare function handleSkillDiscover(args: SkillCommandArgs): Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/skill.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/skill.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OA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