@popoverai/dotrequirements 0.24.3 → 0.25.0

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 (30) hide show
  1. package/README.md +7 -8
  2. package/dist/codebase-to-spec/dispatch.d.ts +60 -14
  3. package/dist/codebase-to-spec/dispatch.js +381 -15
  4. package/dist/codebase-to-spec/pack.d.ts +7 -0
  5. package/dist/codebase-to-spec/pack.js +29 -8
  6. package/dist/codebase-to-spec/prompts/editor.d.ts +1 -1
  7. package/dist/codebase-to-spec/prompts/editor.js +1 -1
  8. package/dist/codebase-to-spec/prompts/specifier.d.ts +1 -1
  9. package/dist/codebase-to-spec/prompts/specifier.js +3 -2
  10. package/dist/codebase-to-spec/schemas.d.ts +153 -0
  11. package/dist/codebase-to-spec/schemas.js +111 -0
  12. package/dist/codebase-to-spec/skill-install.d.ts +28 -25
  13. package/dist/codebase-to-spec/skill-install.js +31 -83
  14. package/dist/commands/codebase-to-spec/dispatch-context.d.ts +2 -5
  15. package/dist/commands/codebase-to-spec/dispatch-context.js +2 -5
  16. package/dist/commands/codebase-to-spec/dispatch-editor.d.ts +0 -1
  17. package/dist/commands/codebase-to-spec/dispatch-editor.js +0 -1
  18. package/dist/commands/codebase-to-spec/dispatch-planner.d.ts +0 -1
  19. package/dist/commands/codebase-to-spec/dispatch-planner.js +0 -1
  20. package/dist/commands/codebase-to-spec/dispatch-spec.d.ts +3 -6
  21. package/dist/commands/codebase-to-spec/dispatch-spec.js +3 -6
  22. package/dist/commands/codebase-to-spec/index.js +3 -2
  23. package/dist/commands/codebase-to-spec/pack.d.ts +5 -0
  24. package/dist/commands/codebase-to-spec/pack.js +6 -3
  25. package/dist/commands/codebase-to-spec/skill-install.js +2 -9
  26. package/dist/templates/agents/cts-worker.md +3 -3
  27. package/dist/templates/skills/codebase-to-spec/SKILL.md +44 -168
  28. package/dist/templates/workflows/specify-codebase.js +372 -0
  29. package/package.json +2 -2
  30. package/dist/templates/hooks/cts-worker-persona.sh +0 -76
@@ -1,76 +0,0 @@
1
- #!/bin/bash
2
- # PreToolUse hook for Task(subagent_type=cts-worker) dispatches.
3
- # Composes the worker's first-turn prompt by calling
4
- # `dotrequirements cts dispatch-context <dispatch-id>` and emits the
5
- # result via `updatedInput.prompt`.
6
- #
7
- # The orchestrator's convention: the original Task prompt MUST include
8
- # the verbatim token `dispatch-id=<id>` so the hook can extract it.
9
- #
10
- # Bundled with the codebase-to-spec skill (CTSO-CLI-1).
11
- #
12
- # CLI resolution order:
13
- # 1. DOTREQUIREMENTS_CLI env var (explicit override)
14
- # 2. If running inside the dotrequirements monorepo itself
15
- # ($CLAUDE_PROJECT_DIR/packages/cli/dist/cli.js exists), use that
16
- # local build. Lets dotrequirements developers use the orchestrator
17
- # against any worktree without a global install.
18
- # 3. `dotrequirements` from PATH (the canonical end-user setup).
19
-
20
- INPUT=$(cat)
21
- SUBAGENT_TYPE=$(echo "$INPUT" | jq -r '.tool_input.subagent_type // ""')
22
-
23
- # Self-filter: only act on cts-worker dispatches.
24
- if [[ "$SUBAGENT_TYPE" != "cts-worker" ]]; then
25
- exit 0
26
- fi
27
-
28
- ORIGINAL_PROMPT=$(echo "$INPUT" | jq -r '.tool_input.prompt // ""')
29
-
30
- # Extract dispatch-id token from the original prompt.
31
- DISPATCH_ID=$(echo "$ORIGINAL_PROMPT" | grep -oE 'dispatch-id=[a-zA-Z0-9_-]+' | head -1 | sed 's/dispatch-id=//')
32
-
33
- if [[ -z "$DISPATCH_ID" ]]; then
34
- # No dispatch-id in the prompt — let it through unmodified.
35
- exit 0
36
- fi
37
-
38
- # Resolve the CLI invocation (see header for order).
39
- if [[ -n "${DOTREQUIREMENTS_CLI:-}" ]]; then
40
- CLI="$DOTREQUIREMENTS_CLI"
41
- elif [[ -n "${CLAUDE_PROJECT_DIR:-}" && -f "$CLAUDE_PROJECT_DIR/packages/cli/dist/cli.js" ]]; then
42
- CLI="node $CLAUDE_PROJECT_DIR/packages/cli/dist/cli.js"
43
- else
44
- CLI="dotrequirements"
45
- fi
46
-
47
- # Compose the dispatch context. CLI returns JSON like {"prompt": "..."}.
48
- COMPOSED=$($CLI cts dispatch-context "$DISPATCH_ID" 2>/dev/null)
49
- COMPOSE_STATUS=$?
50
-
51
- if [[ $COMPOSE_STATUS -ne 0 || -z "$COMPOSED" ]]; then
52
- # CLI call failed — let the dispatch through unmodified so the
53
- # worker's failure is legible.
54
- exit 0
55
- fi
56
-
57
- PROMPT=$(echo "$COMPOSED" | jq -r '.prompt // ""')
58
-
59
- if [[ -z "$PROMPT" ]]; then
60
- exit 0
61
- fi
62
-
63
- # Emit updatedInput so the worker subagent sees the composed prompt
64
- # as its first-turn input. (Field name is `updatedInput`, not
65
- # `modifiedInput` — verified by spike work; see working doc.)
66
- jq -nc --arg p "$PROMPT" '{
67
- hookSpecificOutput: {
68
- hookEventName: "PreToolUse",
69
- permissionDecision: "allow",
70
- updatedInput: {
71
- prompt: $p
72
- }
73
- }
74
- }'
75
-
76
- exit 0