spets 0.1.56 → 0.1.58

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 (2) hide show
  1. package/dist/index.js +102 -44
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -264,51 +264,57 @@ async function listPlugins() {
264
264
  function getClaudeSkillContent() {
265
265
  return `# Spets Workflow Executor
266
266
 
267
- Orchestrator-controlled workflow. Execute commands, parse JSON response, run \`onComplete\`.
267
+ Orchestrator-controlled workflow. Execute immediately.
268
268
 
269
- ## Constraints
270
-
271
- - NO EnterPlanMode, TaskCreate/TaskUpdate, subprocess spawning
272
- - Execute immediately - no planning
273
-
274
- ## Execution Loop
269
+ ## Start
275
270
 
271
+ Run this command with the user's task description:
276
272
  \`\`\`bash
277
273
  npx spets orchestrate init "$ARGUMENTS"
278
274
  \`\`\`
279
275
 
280
- Loop until \`type: "complete"\` or \`type: "error"\`:
276
+ ## Main Loop
277
+
278
+ Repeat until \`type\` is \`"complete"\` or \`"error"\`:
279
+
280
+ 1. Parse the JSON response
281
+ 2. Execute the action for this \`type\`
282
+ 3. Run the shell command in \`response.onComplete\`, piping JSON via stdin
283
+ 4. Use the new JSON response, go to step 1
281
284
 
282
- 1. Parse JSON response
283
- 2. Execute action based on \`type\` and \`phase\`/\`checkpoint\`
284
- 3. Run the \`onComplete\` command from response
285
- 4. Parse next response \u2192 repeat
285
+ ## How to Run onComplete
286
+
287
+ The \`onComplete\` field contains a complete shell command. Pipe your JSON result via stdin:
288
+
289
+ \`\`\`bash
290
+ echo '<your_json>' | npx spets orchestrate explore-done task-id-123
291
+ \`\`\`
286
292
 
287
- ## Actions
293
+ ## Actions by Type
288
294
 
289
295
  ### type: "phase"
290
296
 
291
297
  | phase | Action |
292
298
  |-------|--------|
293
- | explore | Follow \`response.prompt\` \u2192 run \`onComplete\` with JSON result |
294
- | clarify | Follow \`response.prompt\` \u2192 run \`onComplete\` with questions JSON |
295
- | execute | Follow \`response.prompt\` \u2192 write to \`context.output\` \u2192 run \`onComplete\` |
296
- | verify | Follow \`response.prompt\` \u2192 run \`onComplete\` with verify JSON |
299
+ | explore | Follow \`prompt\`, pipe explore JSON to \`onComplete\` |
300
+ | clarify | Follow \`prompt\`, pipe questions JSON to \`onComplete\` |
301
+ | execute | Follow \`prompt\`, write to \`context.output\`, run \`onComplete\` |
302
+ | verify | Follow \`prompt\`, pipe verify JSON to \`onComplete\` |
297
303
 
298
304
  ### type: "checkpoint"
299
305
 
300
306
  | checkpoint | Action |
301
307
  |------------|--------|
302
- | clarify | AskUserQuestion for each \`response.questions\` \u2192 run \`onComplete\` with answers |
303
- | approve | Read \`specPath\`, summarize, AskUserQuestion (Approve/Revise/Reject/Stop) \u2192 run matching \`onComplete\` |
308
+ | clarify | Use AskUserQuestion for each item in \`questions\`, pipe answers JSON to \`onComplete\` |
309
+ | approve | Read \`specPath\`, summarize, use AskUserQuestion (Approve/Revise/Reject/Stop), run \`onComplete[choice]\` |
304
310
 
305
311
  ### type: "complete"
306
312
 
307
- Print message and stop.
313
+ Print \`message\` and stop.
308
314
 
309
315
  ### type: "error"
310
316
 
311
- Print error and stop.
317
+ Print \`error\` and stop.
312
318
 
313
319
  ---
314
320
 
@@ -324,46 +330,57 @@ description: SDD workflow executor - orchestrator-controlled spec-driven develop
324
330
 
325
331
  # Spets Workflow Executor
326
332
 
327
- Orchestrator-controlled workflow. Execute commands, parse JSON response, run \`onComplete\`.
333
+ Orchestrator-controlled workflow.
328
334
 
329
- ## Execution Loop
335
+ ## Start
330
336
 
337
+ Run this command with the user's task description:
331
338
  \`\`\`bash
332
- npx spets orchestrate init "$ARGUMENTS"
339
+ npx spets orchestrate init "user's task description here"
333
340
  \`\`\`
334
341
 
335
- Loop until \`type: "complete"\` or \`type: "error"\`:
342
+ ## Main Loop
343
+
344
+ Repeat until \`type\` is \`"complete"\` or \`"error"\`:
345
+
346
+ 1. Parse the JSON response
347
+ 2. Execute the action for this \`type\`
348
+ 3. Run the shell command in \`response.onComplete\`, piping JSON via stdin
349
+ 4. Use the new JSON response, go to step 1
350
+
351
+ ## How to Run onComplete
336
352
 
337
- 1. Parse JSON response
338
- 2. Execute action based on \`type\` and \`phase\`/\`checkpoint\`
339
- 3. Run the \`onComplete\` command from response
340
- 4. Parse next response \u2192 repeat
353
+ The \`onComplete\` field contains a complete shell command. Pipe your JSON result via stdin:
354
+
355
+ \`\`\`bash
356
+ echo '<your_json>' | npx spets orchestrate explore-done task-id-123
357
+ \`\`\`
341
358
 
342
- ## Actions
359
+ ## Actions by Type
343
360
 
344
361
  ### type: "phase"
345
362
 
346
363
  | phase | Action |
347
364
  |-------|--------|
348
- | explore | Follow \`response.prompt\` \u2192 run \`onComplete\` with JSON result |
349
- | clarify | Follow \`response.prompt\` \u2192 run \`onComplete\` with questions JSON |
350
- | execute | Follow \`response.prompt\` \u2192 write to \`context.output\` \u2192 run \`onComplete\` |
351
- | verify | Follow \`response.prompt\` \u2192 run \`onComplete\` with verify JSON |
365
+ | explore | Follow \`prompt\`, pipe explore JSON to \`onComplete\` |
366
+ | clarify | Follow \`prompt\`, pipe questions JSON to \`onComplete\` |
367
+ | execute | Follow \`prompt\`, write to \`context.output\`, run \`onComplete\` |
368
+ | verify | Follow \`prompt\`, pipe verify JSON to \`onComplete\` |
352
369
 
353
370
  ### type: "checkpoint"
354
371
 
355
372
  | checkpoint | Action |
356
373
  |------------|--------|
357
- | clarify | Ask user each \`response.questions\` \u2192 run \`onComplete\` with answers |
358
- | approve | Read \`specPath\`, summarize, ask user (Approve/Revise/Reject/Stop) \u2192 run matching \`onComplete\` |
374
+ | clarify | Ask user each question in \`questions\`, pipe answers JSON to \`onComplete\` |
375
+ | approve | Read \`specPath\`, summarize, ask user (Approve/Revise/Reject/Stop), run \`onComplete[choice]\` |
359
376
 
360
377
  ### type: "complete"
361
378
 
362
- Print message and stop.
379
+ Print \`message\` and stop.
363
380
 
364
381
  ### type: "error"
365
382
 
366
- Print error and stop.
383
+ Print \`error\` and stop.
367
384
 
368
385
  ---
369
386
 
@@ -4142,6 +4159,31 @@ function outputError(error) {
4142
4159
  console.log(JSON.stringify({ type: "error", error }, null, 2));
4143
4160
  process.exit(1);
4144
4161
  }
4162
+ async function readStdin() {
4163
+ if (process.stdin.isTTY) {
4164
+ return void 0;
4165
+ }
4166
+ return new Promise((resolve) => {
4167
+ let data = "";
4168
+ const timeout = setTimeout(() => {
4169
+ process.stdin.removeAllListeners();
4170
+ resolve(void 0);
4171
+ }, 100);
4172
+ process.stdin.setEncoding("utf8");
4173
+ process.stdin.on("data", (chunk) => {
4174
+ data += chunk;
4175
+ });
4176
+ process.stdin.on("end", () => {
4177
+ clearTimeout(timeout);
4178
+ resolve(data.trim() || void 0);
4179
+ });
4180
+ process.stdin.on("error", () => {
4181
+ clearTimeout(timeout);
4182
+ resolve(void 0);
4183
+ });
4184
+ process.stdin.resume();
4185
+ });
4186
+ }
4145
4187
  async function orchestrateCommand(action, args) {
4146
4188
  try {
4147
4189
  const orchestrator = new Orchestrator();
@@ -4158,11 +4200,14 @@ async function orchestrateCommand(action, args) {
4158
4200
  }
4159
4201
  case "explore-done": {
4160
4202
  const taskId = args[0];
4161
- const exploreJson = args[1];
4203
+ let exploreJson = args[1];
4162
4204
  if (!taskId) {
4163
4205
  outputError("Task ID is required for explore-done");
4164
4206
  return;
4165
4207
  }
4208
+ if (!exploreJson) {
4209
+ exploreJson = await readStdin();
4210
+ }
4166
4211
  let exploreOutput = {
4167
4212
  summary: "",
4168
4213
  relevantFiles: [],
@@ -4183,11 +4228,14 @@ async function orchestrateCommand(action, args) {
4183
4228
  }
4184
4229
  case "clarify-done": {
4185
4230
  const taskId = args[0];
4186
- const questionsJson = args[1];
4231
+ let questionsJson = args[1];
4187
4232
  if (!taskId) {
4188
4233
  outputError("Task ID is required for clarify-done");
4189
4234
  return;
4190
4235
  }
4236
+ if (!questionsJson) {
4237
+ questionsJson = await readStdin();
4238
+ }
4191
4239
  let questions = [];
4192
4240
  if (questionsJson) {
4193
4241
  try {
@@ -4213,11 +4261,14 @@ async function orchestrateCommand(action, args) {
4213
4261
  }
4214
4262
  case "verify-done": {
4215
4263
  const taskId = args[0];
4216
- const verifyJson = args[1];
4264
+ let verifyJson = args[1];
4217
4265
  if (!taskId) {
4218
4266
  outputError("Task ID is required for verify-done");
4219
4267
  return;
4220
4268
  }
4269
+ if (!verifyJson) {
4270
+ verifyJson = await readStdin();
4271
+ }
4221
4272
  let verifyOutput = {
4222
4273
  passed: false,
4223
4274
  score: {
@@ -4243,9 +4294,16 @@ async function orchestrateCommand(action, args) {
4243
4294
  }
4244
4295
  case "clarified": {
4245
4296
  const taskId = args[0];
4246
- const answersJson = args[1];
4247
- if (!taskId || !answersJson) {
4248
- outputError("Task ID and answers JSON are required for clarified");
4297
+ let answersJson = args[1];
4298
+ if (!taskId) {
4299
+ outputError("Task ID is required for clarified");
4300
+ return;
4301
+ }
4302
+ if (!answersJson) {
4303
+ answersJson = await readStdin();
4304
+ }
4305
+ if (!answersJson) {
4306
+ outputError("Answers JSON is required for clarified (via argument or stdin)");
4249
4307
  return;
4250
4308
  }
4251
4309
  let answers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spets",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "description": "Spec Driven Development Execution Framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",