spets 0.2.7 → 0.2.9

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 (3) hide show
  1. package/README.md +9 -0
  2. package/dist/index.js +37 -21
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -140,6 +140,15 @@ agent: gemini # or claude, codex
140
140
  - Gemini CLI (`gemini` command)
141
141
  - Codex CLI (`codex` command)
142
142
 
143
+ ## Troubleshooting: `npm EPERM` with `npx`
144
+
145
+ If `npx spets ...` fails with permission errors like `~/.npm/_logs`, run with a project-local npm cache:
146
+
147
+ ```bash
148
+ NPM_CONFIG_CACHE=.spets/.npm-cache npm_config_cache=.spets/.npm-cache npx --yes spets init
149
+ NPM_CONFIG_CACHE=.spets/.npm-cache npm_config_cache=.spets/.npm-cache npx --yes spets plugin install codex
150
+ ```
151
+
143
152
  ## License
144
153
 
145
154
  MIT
package/dist/index.js CHANGED
@@ -365,6 +365,7 @@ function formatDocStatus(status) {
365
365
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, rmSync, readdirSync } from "fs";
366
366
  import { join as join2 } from "path";
367
367
  import { homedir } from "os";
368
+ var INSTALLED_SPETS_CMD = "spets";
368
369
  async function pluginCommand(action, name) {
369
370
  switch (action) {
370
371
  case "install":
@@ -588,11 +589,11 @@ You execute spets workflow commands. Follow orchestrator instructions exactly.
588
589
 
589
590
  IF \`$ARGUMENTS\` starts with "resume":
590
591
  Extract optional task ID from arguments (e.g. "resume abc-123" or "resume --task abc-123")
591
- RUN \`npx spets orchestrate resume <taskId>\` (omit taskId if none provided)
592
+ RUN \`${INSTALLED_SPETS_CMD} orchestrate resume <taskId>\` (omit taskId if none provided)
592
593
  ELSE IF \`$ARGUMENTS\` starts with "list":
593
- RUN \`npx spets orchestrate list\`
594
+ RUN \`${INSTALLED_SPETS_CMD} orchestrate list\`
594
595
  ELSE:
595
- RUN \`npx spets orchestrate init "$ARGUMENTS"\`
596
+ RUN \`${INSTALLED_SPETS_CMD} orchestrate init "$ARGUMENTS"\`
596
597
 
597
598
  ## Loop
598
599
 
@@ -630,11 +631,11 @@ You execute spets workflow commands. Follow orchestrator instructions exactly.
630
631
 
631
632
  IF \`$ARGUMENTS\` starts with "resume":
632
633
  Extract optional task ID from arguments (e.g. "resume abc-123" or "resume --task abc-123")
633
- RUN \`npx spets orchestrate resume <taskId>\` (omit taskId if none provided)
634
+ RUN \`node dist/index.js orchestrate resume <taskId> || ${INSTALLED_SPETS_CMD} orchestrate resume <taskId>\` (omit taskId if none provided)
634
635
  ELSE IF \`$ARGUMENTS\` starts with "list":
635
- RUN \`npx spets orchestrate list\`
636
+ RUN \`node dist/index.js orchestrate list || ${INSTALLED_SPETS_CMD} orchestrate list\`
636
637
  ELSE:
637
- RUN \`npx spets orchestrate init "$ARGUMENTS"\`
638
+ RUN \`node dist/index.js orchestrate init "$ARGUMENTS" || ${INSTALLED_SPETS_CMD} orchestrate init "$ARGUMENTS"\`
638
639
 
639
640
  ## Loop
640
641
 
@@ -672,11 +673,11 @@ You execute spets workflow commands. Follow orchestrator instructions exactly.
672
673
 
673
674
  IF \`$ARGUMENTS\` starts with "resume":
674
675
  Extract optional task ID from arguments (e.g. "resume abc-123" or "resume --task abc-123")
675
- RUN \`npx spets orchestrate resume <taskId>\` (omit taskId if none provided)
676
+ RUN \`${INSTALLED_SPETS_CMD} orchestrate resume <taskId>\` (omit taskId if none provided)
676
677
  ELSE IF \`$ARGUMENTS\` starts with "list":
677
- RUN \`npx spets orchestrate list\`
678
+ RUN \`${INSTALLED_SPETS_CMD} orchestrate list\`
678
679
  ELSE:
679
- RUN \`npx spets orchestrate init "$ARGUMENTS"\`
680
+ RUN \`${INSTALLED_SPETS_CMD} orchestrate init "$ARGUMENTS"\`
680
681
 
681
682
  ## Loop
682
683
 
@@ -1496,10 +1497,25 @@ function checkpointApprove(specPath, cmds) {
1496
1497
  }
1497
1498
  var PRINT_MESSAGE_AND_STOP = "Print the message. Stop.";
1498
1499
  var PRINT_ERROR_AND_STOP = "Print the error. Stop.";
1499
- var LIST_TASKS = "Show tasks to user. Ask which to resume. Run:\n npx spets orchestrate resume <selectedTaskId>";
1500
+ var LIST_TASKS = "Show tasks to user. Ask which to resume. Run:\n spets orchestrate resume <selectedTaskId>";
1500
1501
  var LIST_EMPTY = "No resumable tasks found. Show this to the user. Stop.";
1501
1502
 
1502
1503
  // src/orchestrator/responses.ts
1504
+ function getOrchestrateCommandPrefix() {
1505
+ const override = process.env.SPETS_ORCHESTRATE_CMD?.trim();
1506
+ if (override) {
1507
+ return override;
1508
+ }
1509
+ const entryScript = process.argv[1];
1510
+ if (entryScript && existsSync10(entryScript)) {
1511
+ const escapedPath = entryScript.includes(" ") ? `"${entryScript.replace(/"/g, '\\"')}"` : entryScript;
1512
+ return `node ${escapedPath} orchestrate`;
1513
+ }
1514
+ return "spets orchestrate";
1515
+ }
1516
+ function buildOrchestrateCommand(args) {
1517
+ return `${getOrchestrateCommandPrefix()} ${args}`;
1518
+ }
1503
1519
  function buildPhaseExploreResponse(cwd, state) {
1504
1520
  const steps = getSteps(cwd);
1505
1521
  const outputPath = getOutputPath(cwd);
@@ -1520,7 +1536,7 @@ function buildPhaseExploreResponse(cwd, state) {
1520
1536
  previousOutput,
1521
1537
  cwd
1522
1538
  });
1523
- const onComplete = `npx spets orchestrate explore-done ${state.taskId}`;
1539
+ const onComplete = buildOrchestrateCommand(`explore-done ${state.taskId}`);
1524
1540
  return {
1525
1541
  type: "phase",
1526
1542
  phase: "explore",
@@ -1549,7 +1565,7 @@ function buildPhaseClarifyResponse(cwd, state) {
1549
1565
  // Legacy support
1550
1566
  cwd
1551
1567
  });
1552
- const onComplete = `npx spets orchestrate clarify-done ${state.taskId}`;
1568
+ const onComplete = buildOrchestrateCommand(`clarify-done ${state.taskId}`);
1553
1569
  return {
1554
1570
  type: "phase",
1555
1571
  phase: "clarify",
@@ -1605,7 +1621,7 @@ ${issues}`;
1605
1621
  verifyFeedback,
1606
1622
  cwd
1607
1623
  });
1608
- const onComplete = `npx spets orchestrate execute-done ${state.taskId}`;
1624
+ const onComplete = buildOrchestrateCommand(`execute-done ${state.taskId}`);
1609
1625
  const outputFile = join9(outputPath, state.taskId, `${state.currentStep}.md`);
1610
1626
  return {
1611
1627
  type: "phase",
@@ -1645,7 +1661,7 @@ function buildPhaseVerifyResponse(cwd, state) {
1645
1661
  loadedKnowledge: state.loadedKnowledge?.map((k) => ({ filename: k.filename, content: k.content })),
1646
1662
  cwd
1647
1663
  });
1648
- const onComplete = `npx spets orchestrate verify-done ${state.taskId}`;
1664
+ const onComplete = buildOrchestrateCommand(`verify-done ${state.taskId}`);
1649
1665
  return {
1650
1666
  type: "phase",
1651
1667
  phase: "verify",
@@ -1675,7 +1691,7 @@ function buildPhaseKnowledgeResponse(cwd, state) {
1675
1691
  guide,
1676
1692
  cwd
1677
1693
  });
1678
- const onComplete = `npx spets orchestrate knowledge-extract-done ${state.taskId}`;
1694
+ const onComplete = buildOrchestrateCommand(`knowledge-extract-done ${state.taskId}`);
1679
1695
  return {
1680
1696
  type: "phase",
1681
1697
  phase: "knowledge",
@@ -1693,7 +1709,7 @@ function buildPhaseKnowledgeResponse(cwd, state) {
1693
1709
  };
1694
1710
  }
1695
1711
  function buildCheckpointClarifyResponse(state) {
1696
- const onComplete = `npx spets orchestrate clarified ${state.taskId}`;
1712
+ const onComplete = buildOrchestrateCommand(`clarified ${state.taskId}`);
1697
1713
  return {
1698
1714
  type: "checkpoint",
1699
1715
  checkpoint: "clarify",
@@ -1708,10 +1724,10 @@ function buildCheckpointApproveResponse(cwd, state) {
1708
1724
  const outputPath = getOutputPath(cwd);
1709
1725
  const specPath = join9(outputPath, state.taskId, `${state.currentStep}.md`);
1710
1726
  const cmds = {
1711
- approve: `npx spets orchestrate approve ${state.taskId}`,
1712
- revise: `npx spets orchestrate revise ${state.taskId} '<feedback>'`,
1713
- reject: `npx spets orchestrate reject ${state.taskId}`,
1714
- stop: `npx spets orchestrate stop ${state.taskId}`
1727
+ approve: buildOrchestrateCommand(`approve ${state.taskId}`),
1728
+ revise: buildOrchestrateCommand(`revise ${state.taskId} '<feedback>'`),
1729
+ reject: buildOrchestrateCommand(`reject ${state.taskId}`),
1730
+ stop: buildOrchestrateCommand(`stop ${state.taskId}`)
1715
1731
  };
1716
1732
  return {
1717
1733
  type: "checkpoint",
@@ -1738,7 +1754,7 @@ function buildCompleteResponse(cwd, state, status) {
1738
1754
  }
1739
1755
  const messages = {
1740
1756
  completed: "Workflow completed successfully",
1741
- stopped: `Workflow stopped. Resume with: spets orchestrate resume ${state.taskId}`,
1757
+ stopped: `Workflow stopped. Resume with: ${buildOrchestrateCommand(`resume ${state.taskId}`)}`,
1742
1758
  rejected: "Workflow rejected"
1743
1759
  };
1744
1760
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spets",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Spec Driven Development Execution Framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",