@orchestrator-claude/cli 3.15.1 → 3.17.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/base/CLAUDE.md.hbs +9 -13
- package/dist/templates/base/claude/hooks/gate-guardian.sh +26 -21
- package/dist/templates/base/claude/hooks/orch-helpers.sh +9 -7
- package/package.json +1 -1
- package/templates/base/CLAUDE.md.hbs +9 -13
- package/templates/base/claude/hooks/gate-guardian.sh +26 -21
- package/templates/base/claude/hooks/orch-helpers.sh +9 -7
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,8 +8,9 @@ Orchestration is enforced by **deterministic hooks** — you do not need to memo
|
|
|
8
8
|
## Critical Rules
|
|
9
9
|
|
|
10
10
|
1. **NEVER implement features directly** — always use the orchestrator workflow
|
|
11
|
-
2. **NEVER
|
|
12
|
-
3. **
|
|
11
|
+
2. **NEVER bump versions manually** — always use `/release patch|minor|major`
|
|
12
|
+
3. **NEVER edit `.orchestrator/orchestrator-index.json`** — state is in PostgreSQL
|
|
13
|
+
4. **Access artifacts via MCP tools** (`artifactStore`, `artifactRetrieve`), not filesystem paths
|
|
13
14
|
|
|
14
15
|
## How to Start a Workflow
|
|
15
16
|
|
|
@@ -34,8 +35,10 @@ Workflow types: `feature_development`, `bug_fix`, `refactoring`, `emergency_debu
|
|
|
34
35
|
|------|---------|-------------|
|
|
35
36
|
| `ping-pong-enforcer` | After every Agent call | Calls `getNextAction` and injects result |
|
|
36
37
|
| `gate-guardian` | Before `advancePhase` | Evaluates gate, blocks if it fails |
|
|
37
|
-
| `dangling-workflow-guard` | On session Stop | Warns and completes dangling workflows |
|
|
38
38
|
| `workflow-guard` | Before Write/Edit on src/ | Blocks code writes without an active workflow |
|
|
39
|
+
| `dangling-workflow-guard` | On session Stop | Warns and completes dangling workflows |
|
|
40
|
+
| `session-orchestrator` | On session Start | Injects workflow status context |
|
|
41
|
+
| `prompt-orchestrator` | On user prompt Submit | Injects workflow status context |
|
|
39
42
|
|
|
40
43
|
You do NOT need to manually call `getNextAction` after agents or `evaluateGate` before advancing — hooks do this deterministically.
|
|
41
44
|
|
|
@@ -51,16 +54,9 @@ Use skills for phase-specific guidance:
|
|
|
51
54
|
| `/project-conventions` | Project patterns and gotchas |
|
|
52
55
|
| `/checkpoint-protocol` | When to create checkpoints |
|
|
53
56
|
| `/kb-lookup` | Search project knowledge base |
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
When creating agents, skills, or hooks, write to BOTH filesystem and PostgreSQL:
|
|
58
|
-
|
|
59
|
-
- **Agent**: Write `.claude/agents/{slug}.md` + `createAgentDefinition` MCP tool
|
|
60
|
-
- **Skill**: Write `.claude/skills/{slug}/SKILL.md` + `createSkillDefinition` MCP tool
|
|
61
|
-
- **Hook**: Write `.claude/hooks/{slug}.sh` + `createHook` MCP tool
|
|
62
|
-
|
|
63
|
-
Built-in definitions are seeded on `orchestrator init` (idempotent).
|
|
57
|
+
| `/release` | Execute official releases via CI/CD |
|
|
58
|
+
| `/smoke-test` | Run API smoke tests |
|
|
59
|
+
| `/docs-guardian` | Analyze documentation compliance |
|
|
64
60
|
|
|
65
61
|
## Quality Rules
|
|
66
62
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# gate-guardian.sh — ADR-013 Phase 5 Hook (JSON Structured Output)
|
|
3
3
|
# Trigger: PreToolUse on mcp__orchestrator-tools__advancePhase
|
|
4
|
-
# Purpose:
|
|
4
|
+
# Purpose: Guard IMPLEMENT phase advance (requires human approval). ALLOWs all other phases.
|
|
5
|
+
# Note: POST /gate/evaluate endpoint removed (TD-127). Phase transitions are now handled
|
|
6
|
+
# atomically by setPendingAction() via the ping-pong-enforcer hook.
|
|
5
7
|
#
|
|
6
8
|
# Output: JSON with permissionDecision (deny/allow) + additionalContext
|
|
7
9
|
# Exit 0 with JSON = structured decision
|
|
@@ -22,6 +24,25 @@ TARGET_PHASE=$(orch_json_field "$STDIN_DATA" "tool_input.targetPhase")
|
|
|
22
24
|
|
|
23
25
|
orch_log "GATE-GUARDIAN: workflow=$WORKFLOW_ID targetPhase=$TARGET_PHASE"
|
|
24
26
|
|
|
27
|
+
# ADR-013 Phase 6: Check workflow mode before gate evaluation
|
|
28
|
+
# quick and interactive modes skip gate evaluation entirely
|
|
29
|
+
if [ -n "$WORKFLOW_ID" ]; then
|
|
30
|
+
MODE=$(orch_get_workflow_mode "$WORKFLOW_ID" 2>/dev/null) || MODE=""
|
|
31
|
+
orch_log "GATE-GUARDIAN: workflow=$WORKFLOW_ID mode=${MODE:-legacy}"
|
|
32
|
+
|
|
33
|
+
if [ "$MODE" = "quick" ]; then
|
|
34
|
+
orch_log "GATE-GUARDIAN: ALLOW (quick mode skips gate evaluation)"
|
|
35
|
+
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' allowed: quick mode skips gate evaluation.\"}}"
|
|
36
|
+
exit 0
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
if [ "$MODE" = "interactive" ]; then
|
|
40
|
+
orch_log "GATE-GUARDIAN: ALLOW (interactive mode skips gate evaluation, artifact gates not required)"
|
|
41
|
+
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' allowed: interactive mode skips artifact gate evaluation.\"}}"
|
|
42
|
+
exit 0
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
|
|
25
46
|
# FAIL-CLOSED: if we can't parse input, DENY
|
|
26
47
|
if [ -z "$WORKFLOW_ID" ] || [ -z "$TARGET_PHASE" ]; then
|
|
27
48
|
orch_log "GATE-GUARDIAN: DENY (could not parse input)"
|
|
@@ -56,24 +77,8 @@ if [ "$TARGET_LOWER" = "implement" ]; then
|
|
|
56
77
|
fi
|
|
57
78
|
fi
|
|
58
79
|
|
|
59
|
-
#
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Gate Guardian: Gate evaluation failed for phase '${TARGET_PHASE}'.\",\"additionalContext\":\"Required artifacts may be missing. Complete the current phase before advancing.\"}}"
|
|
64
|
-
exit 0
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
PASSED=$(orch_json_field "$GATE_RESULT" "passed")
|
|
68
|
-
|
|
69
|
-
if [ "$PASSED" = "true" ]; then
|
|
70
|
-
orch_log "GATE-GUARDIAN: ALLOW (gate passed for $TARGET_PHASE)"
|
|
71
|
-
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' passed.\"}}"
|
|
72
|
-
exit 0
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
# Gate failed
|
|
76
|
-
REASONS=$(orch_json_field "$GATE_RESULT" "reasons")
|
|
77
|
-
orch_log "GATE-GUARDIAN: DENY (gate failed: $REASONS)"
|
|
78
|
-
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Gate Guardian: Gate to '${TARGET_PHASE}' did not pass.\",\"additionalContext\":\"Reasons: ${REASONS}. Complete current phase requirements before advancing.\"}}"
|
|
80
|
+
# Non-IMPLEMENT phases: ALLOW directly.
|
|
81
|
+
# Phase transitions are handled atomically by setPendingAction() via ping-pong-enforcer.
|
|
82
|
+
orch_log "GATE-GUARDIAN: ALLOW (non-IMPLEMENT phase, no gate evaluation required)"
|
|
83
|
+
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' allowed.\"}}"
|
|
79
84
|
exit 0
|
|
@@ -100,18 +100,20 @@ orch_get_next_action() {
|
|
|
100
100
|
-H "X-Project-ID: $PROJECT_ID" 2>/dev/null
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
#
|
|
104
|
-
|
|
103
|
+
# ADR-013 Phase 6: Get the mode of a workflow (quick/standard/full/interactive)
|
|
104
|
+
# Returns the mode string, or empty string for legacy workflows (mode=null)
|
|
105
|
+
# Returns exit code 1 on network/auth error
|
|
106
|
+
orch_get_workflow_mode() {
|
|
105
107
|
local workflow_id="$1"
|
|
106
|
-
local target_phase="$2"
|
|
107
108
|
local token
|
|
108
109
|
token=$(orch_get_token) || return 1
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
local resp
|
|
112
|
+
resp=$(curl -sf --max-time 3 "${API_URL}/api/v1/workflows/${workflow_id}/status" \
|
|
112
113
|
-H "Authorization: Bearer $token" \
|
|
113
|
-
-H "X-Project-ID: $PROJECT_ID"
|
|
114
|
-
|
|
114
|
+
-H "X-Project-ID: $PROJECT_ID" 2>/dev/null) || return 1
|
|
115
|
+
|
|
116
|
+
orch_json_field "$resp" "mode"
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
# Extract a field from JSON string using node
|
package/package.json
CHANGED
|
@@ -8,8 +8,9 @@ Orchestration is enforced by **deterministic hooks** — you do not need to memo
|
|
|
8
8
|
## Critical Rules
|
|
9
9
|
|
|
10
10
|
1. **NEVER implement features directly** — always use the orchestrator workflow
|
|
11
|
-
2. **NEVER
|
|
12
|
-
3. **
|
|
11
|
+
2. **NEVER bump versions manually** — always use `/release patch|minor|major`
|
|
12
|
+
3. **NEVER edit `.orchestrator/orchestrator-index.json`** — state is in PostgreSQL
|
|
13
|
+
4. **Access artifacts via MCP tools** (`artifactStore`, `artifactRetrieve`), not filesystem paths
|
|
13
14
|
|
|
14
15
|
## How to Start a Workflow
|
|
15
16
|
|
|
@@ -34,8 +35,10 @@ Workflow types: `feature_development`, `bug_fix`, `refactoring`, `emergency_debu
|
|
|
34
35
|
|------|---------|-------------|
|
|
35
36
|
| `ping-pong-enforcer` | After every Agent call | Calls `getNextAction` and injects result |
|
|
36
37
|
| `gate-guardian` | Before `advancePhase` | Evaluates gate, blocks if it fails |
|
|
37
|
-
| `dangling-workflow-guard` | On session Stop | Warns and completes dangling workflows |
|
|
38
38
|
| `workflow-guard` | Before Write/Edit on src/ | Blocks code writes without an active workflow |
|
|
39
|
+
| `dangling-workflow-guard` | On session Stop | Warns and completes dangling workflows |
|
|
40
|
+
| `session-orchestrator` | On session Start | Injects workflow status context |
|
|
41
|
+
| `prompt-orchestrator` | On user prompt Submit | Injects workflow status context |
|
|
39
42
|
|
|
40
43
|
You do NOT need to manually call `getNextAction` after agents or `evaluateGate` before advancing — hooks do this deterministically.
|
|
41
44
|
|
|
@@ -51,16 +54,9 @@ Use skills for phase-specific guidance:
|
|
|
51
54
|
| `/project-conventions` | Project patterns and gotchas |
|
|
52
55
|
| `/checkpoint-protocol` | When to create checkpoints |
|
|
53
56
|
| `/kb-lookup` | Search project knowledge base |
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
When creating agents, skills, or hooks, write to BOTH filesystem and PostgreSQL:
|
|
58
|
-
|
|
59
|
-
- **Agent**: Write `.claude/agents/{slug}.md` + `createAgentDefinition` MCP tool
|
|
60
|
-
- **Skill**: Write `.claude/skills/{slug}/SKILL.md` + `createSkillDefinition` MCP tool
|
|
61
|
-
- **Hook**: Write `.claude/hooks/{slug}.sh` + `createHook` MCP tool
|
|
62
|
-
|
|
63
|
-
Built-in definitions are seeded on `orchestrator init` (idempotent).
|
|
57
|
+
| `/release` | Execute official releases via CI/CD |
|
|
58
|
+
| `/smoke-test` | Run API smoke tests |
|
|
59
|
+
| `/docs-guardian` | Analyze documentation compliance |
|
|
64
60
|
|
|
65
61
|
## Quality Rules
|
|
66
62
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# gate-guardian.sh — ADR-013 Phase 5 Hook (JSON Structured Output)
|
|
3
3
|
# Trigger: PreToolUse on mcp__orchestrator-tools__advancePhase
|
|
4
|
-
# Purpose:
|
|
4
|
+
# Purpose: Guard IMPLEMENT phase advance (requires human approval). ALLOWs all other phases.
|
|
5
|
+
# Note: POST /gate/evaluate endpoint removed (TD-127). Phase transitions are now handled
|
|
6
|
+
# atomically by setPendingAction() via the ping-pong-enforcer hook.
|
|
5
7
|
#
|
|
6
8
|
# Output: JSON with permissionDecision (deny/allow) + additionalContext
|
|
7
9
|
# Exit 0 with JSON = structured decision
|
|
@@ -22,6 +24,25 @@ TARGET_PHASE=$(orch_json_field "$STDIN_DATA" "tool_input.targetPhase")
|
|
|
22
24
|
|
|
23
25
|
orch_log "GATE-GUARDIAN: workflow=$WORKFLOW_ID targetPhase=$TARGET_PHASE"
|
|
24
26
|
|
|
27
|
+
# ADR-013 Phase 6: Check workflow mode before gate evaluation
|
|
28
|
+
# quick and interactive modes skip gate evaluation entirely
|
|
29
|
+
if [ -n "$WORKFLOW_ID" ]; then
|
|
30
|
+
MODE=$(orch_get_workflow_mode "$WORKFLOW_ID" 2>/dev/null) || MODE=""
|
|
31
|
+
orch_log "GATE-GUARDIAN: workflow=$WORKFLOW_ID mode=${MODE:-legacy}"
|
|
32
|
+
|
|
33
|
+
if [ "$MODE" = "quick" ]; then
|
|
34
|
+
orch_log "GATE-GUARDIAN: ALLOW (quick mode skips gate evaluation)"
|
|
35
|
+
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' allowed: quick mode skips gate evaluation.\"}}"
|
|
36
|
+
exit 0
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
if [ "$MODE" = "interactive" ]; then
|
|
40
|
+
orch_log "GATE-GUARDIAN: ALLOW (interactive mode skips gate evaluation, artifact gates not required)"
|
|
41
|
+
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' allowed: interactive mode skips artifact gate evaluation.\"}}"
|
|
42
|
+
exit 0
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
|
|
25
46
|
# FAIL-CLOSED: if we can't parse input, DENY
|
|
26
47
|
if [ -z "$WORKFLOW_ID" ] || [ -z "$TARGET_PHASE" ]; then
|
|
27
48
|
orch_log "GATE-GUARDIAN: DENY (could not parse input)"
|
|
@@ -56,24 +77,8 @@ if [ "$TARGET_LOWER" = "implement" ]; then
|
|
|
56
77
|
fi
|
|
57
78
|
fi
|
|
58
79
|
|
|
59
|
-
#
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Gate Guardian: Gate evaluation failed for phase '${TARGET_PHASE}'.\",\"additionalContext\":\"Required artifacts may be missing. Complete the current phase before advancing.\"}}"
|
|
64
|
-
exit 0
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
PASSED=$(orch_json_field "$GATE_RESULT" "passed")
|
|
68
|
-
|
|
69
|
-
if [ "$PASSED" = "true" ]; then
|
|
70
|
-
orch_log "GATE-GUARDIAN: ALLOW (gate passed for $TARGET_PHASE)"
|
|
71
|
-
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' passed.\"}}"
|
|
72
|
-
exit 0
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
# Gate failed
|
|
76
|
-
REASONS=$(orch_json_field "$GATE_RESULT" "reasons")
|
|
77
|
-
orch_log "GATE-GUARDIAN: DENY (gate failed: $REASONS)"
|
|
78
|
-
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Gate Guardian: Gate to '${TARGET_PHASE}' did not pass.\",\"additionalContext\":\"Reasons: ${REASONS}. Complete current phase requirements before advancing.\"}}"
|
|
80
|
+
# Non-IMPLEMENT phases: ALLOW directly.
|
|
81
|
+
# Phase transitions are handled atomically by setPendingAction() via ping-pong-enforcer.
|
|
82
|
+
orch_log "GATE-GUARDIAN: ALLOW (non-IMPLEMENT phase, no gate evaluation required)"
|
|
83
|
+
echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"additionalContext\":\"Gate to '${TARGET_PHASE}' allowed.\"}}"
|
|
79
84
|
exit 0
|
|
@@ -100,18 +100,20 @@ orch_get_next_action() {
|
|
|
100
100
|
-H "X-Project-ID: $PROJECT_ID" 2>/dev/null
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
#
|
|
104
|
-
|
|
103
|
+
# ADR-013 Phase 6: Get the mode of a workflow (quick/standard/full/interactive)
|
|
104
|
+
# Returns the mode string, or empty string for legacy workflows (mode=null)
|
|
105
|
+
# Returns exit code 1 on network/auth error
|
|
106
|
+
orch_get_workflow_mode() {
|
|
105
107
|
local workflow_id="$1"
|
|
106
|
-
local target_phase="$2"
|
|
107
108
|
local token
|
|
108
109
|
token=$(orch_get_token) || return 1
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
local resp
|
|
112
|
+
resp=$(curl -sf --max-time 3 "${API_URL}/api/v1/workflows/${workflow_id}/status" \
|
|
112
113
|
-H "Authorization: Bearer $token" \
|
|
113
|
-
-H "X-Project-ID: $PROJECT_ID"
|
|
114
|
-
|
|
114
|
+
-H "X-Project-ID: $PROJECT_ID" 2>/dev/null) || return 1
|
|
115
|
+
|
|
116
|
+
orch_json_field "$resp" "mode"
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
# Extract a field from JSON string using node
|