@orchestrator-claude/definitions 3.5.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 (73) hide show
  1. package/agents/api-extractor.md +687 -0
  2. package/agents/business-rule-miner.md +754 -0
  3. package/agents/code-archaeologist.md +720 -0
  4. package/agents/docs-guardian.md +524 -0
  5. package/agents/implementer.md +512 -0
  6. package/agents/legacy-discoverer.md +583 -0
  7. package/agents/legacy-synthesizer.md +1101 -0
  8. package/agents/orchestrator.md +165 -0
  9. package/agents/planner.md +365 -0
  10. package/agents/researcher.md +447 -0
  11. package/agents/reviewer.md +514 -0
  12. package/agents/schema-extractor.md +781 -0
  13. package/agents/specifier.md +360 -0
  14. package/agents/task-generator.md +390 -0
  15. package/bin/orch-defs.js +2 -0
  16. package/dist/cli.d.ts +3 -0
  17. package/dist/cli.d.ts.map +1 -0
  18. package/dist/cli.js +172 -0
  19. package/dist/cli.js.map +1 -0
  20. package/dist/commands/DiffCommand.d.ts +13 -0
  21. package/dist/commands/DiffCommand.d.ts.map +1 -0
  22. package/dist/commands/DiffCommand.js +74 -0
  23. package/dist/commands/DiffCommand.js.map +1 -0
  24. package/dist/commands/SeedCommand.d.ts +19 -0
  25. package/dist/commands/SeedCommand.d.ts.map +1 -0
  26. package/dist/commands/SeedCommand.js +56 -0
  27. package/dist/commands/SeedCommand.js.map +1 -0
  28. package/dist/http/ApiClient.d.ts +50 -0
  29. package/dist/http/ApiClient.d.ts.map +1 -0
  30. package/dist/http/ApiClient.js +58 -0
  31. package/dist/http/ApiClient.js.map +1 -0
  32. package/dist/index.d.ts +12 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +11 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/manifest/ManifestLoader.d.ts +34 -0
  37. package/dist/manifest/ManifestLoader.d.ts.map +1 -0
  38. package/dist/manifest/ManifestLoader.js +110 -0
  39. package/dist/manifest/ManifestLoader.js.map +1 -0
  40. package/dist/manifest/types.d.ts +59 -0
  41. package/dist/manifest/types.d.ts.map +1 -0
  42. package/dist/manifest/types.js +5 -0
  43. package/dist/manifest/types.js.map +1 -0
  44. package/dist/scripts/generate-manifest.d.ts +10 -0
  45. package/dist/scripts/generate-manifest.d.ts.map +1 -0
  46. package/dist/scripts/generate-manifest.js +114 -0
  47. package/dist/scripts/generate-manifest.js.map +1 -0
  48. package/hooks/post-agent-artifact-relay.sh +157 -0
  49. package/hooks/post-artifact-generate.sh +39 -0
  50. package/hooks/post-implement-validate.sh +139 -0
  51. package/hooks/post-phase-checkpoint.sh +322 -0
  52. package/hooks/pre-agent-invoke.sh +34 -0
  53. package/hooks/pre-phase-advance.sh +40 -0
  54. package/hooks/track-agent-invocation.sh +241 -0
  55. package/kb/auth-strategies.md +742 -0
  56. package/kb/docs-constitution.md +310 -0
  57. package/kb/error-handling.md +555 -0
  58. package/kb/rest-conventions.md +458 -0
  59. package/kb/validation-patterns.md +589 -0
  60. package/manifest.json +314 -0
  61. package/package.json +65 -0
  62. package/skills/artifact-validator/SKILL.md +226 -0
  63. package/skills/docs-guardian/SKILL.md +230 -0
  64. package/skills/kb-lookup/SKILL.md +257 -0
  65. package/skills/phase-gate-evaluator/SKILL.md +274 -0
  66. package/skills/release/SKILL.md +239 -0
  67. package/skills/release/release.sh +491 -0
  68. package/skills/smoke-test/SKILL.md +195 -0
  69. package/skills/workflow-status/SKILL.md +322 -0
  70. package/workflows/bug-fix.json +74 -0
  71. package/workflows/feature-development.json +88 -0
  72. package/workflows/legacy-analysis.json +304 -0
  73. package/workflows/refactoring.json +74 -0
@@ -0,0 +1,40 @@
1
+ #!/bin/bash
2
+ # Pre-Phase Advance Hook
3
+ # Executado antes de avancar para proxima fase
4
+ # Avalia gate e cria checkpoint
5
+
6
+ set -e
7
+
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
10
+
11
+ # Recebe evento via stdin ou argumento
12
+ if [ -n "$1" ]; then
13
+ EVENT="$1"
14
+ else
15
+ EVENT=$(cat)
16
+ fi
17
+
18
+ # Verifica se temos o handler compilado
19
+ HANDLER="$PROJECT_ROOT/dist/hook.js"
20
+
21
+ if [ ! -f "$HANDLER" ]; then
22
+ echo '{"success": false, "error": "Hook handler not compiled. Run npm run build first."}' >&2
23
+ exit 1
24
+ fi
25
+
26
+ # Executa o handler TypeScript
27
+ echo "$EVENT" | node "$HANDLER" pre-phase-advance
28
+
29
+ EXIT_CODE=$?
30
+
31
+ # Exit code determina se fase pode avancar
32
+ # 0 = gate passou, pode avancar
33
+ # 1 = gate falhou, bloqueado
34
+ if [ $EXIT_CODE -eq 0 ]; then
35
+ echo "[pre-phase-advance] Gate passed, advancing phase" >&2
36
+ else
37
+ echo "[pre-phase-advance] Gate failed, phase advance blocked" >&2
38
+ fi
39
+
40
+ exit $EXIT_CODE
@@ -0,0 +1,241 @@
1
+ #!/bin/bash
2
+ # Track Agent Invocation Hook
3
+ # Registers agent invocations in orchestrator-index.json
4
+ #
5
+ # Usage (called by Claude Code hooks):
6
+ # track-agent-invocation.sh start (reads stdin JSON)
7
+ # track-agent-invocation.sh complete (reads stdin JSON)
8
+ #
9
+ # Claude Code passes JSON via stdin with structure:
10
+ # { "tool_name": "Task", "tool_input": { "subagent_type": "...", ... } }
11
+
12
+ set -e
13
+
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
16
+ INDEX_FILE="$PROJECT_ROOT/.orchestrator/orchestrator-index.json"
17
+ STATE_DIR="$PROJECT_ROOT/.orchestrator/.state"
18
+ INVOCATION_FILE="$STATE_DIR/current-invocation"
19
+ DEBUG_LOG="$STATE_DIR/hook-debug.log"
20
+
21
+ # Ensure state directory exists
22
+ mkdir -p "$STATE_DIR"
23
+
24
+ # Log rotation: max 1MB, keep 3 rotated copies
25
+ MAX_LOG_SIZE=1048576 # 1MB in bytes
26
+ if [ -f "$DEBUG_LOG" ]; then
27
+ LOG_SIZE=$(stat -f%z "$DEBUG_LOG" 2>/dev/null || stat -c%s "$DEBUG_LOG" 2>/dev/null || echo 0)
28
+ if [ "$LOG_SIZE" -gt "$MAX_LOG_SIZE" ]; then
29
+ [ -f "${DEBUG_LOG}.2" ] && mv "${DEBUG_LOG}.2" "${DEBUG_LOG}.3"
30
+ [ -f "${DEBUG_LOG}.1" ] && mv "${DEBUG_LOG}.1" "${DEBUG_LOG}.2"
31
+ mv "$DEBUG_LOG" "${DEBUG_LOG}.1"
32
+ fi
33
+ fi
34
+
35
+ ACTION="${1:-}"
36
+
37
+ # Read stdin into variable (Claude Code passes JSON via stdin)
38
+ STDIN_DATA=""
39
+ if [ ! -t 0 ]; then
40
+ STDIN_DATA=$(cat)
41
+ fi
42
+
43
+ case "$ACTION" in
44
+ start)
45
+ # Extract agent info from stdin JSON
46
+ # Structure: { "tool_name": "Task", "tool_input": { "subagent_type": "...", ... } }
47
+ if [ -n "$STDIN_DATA" ]; then
48
+ # Debug: log received data
49
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] START stdin: $STDIN_DATA" >> "$DEBUG_LOG"
50
+
51
+ AGENT_NAME=$(echo "$STDIN_DATA" | node -e "
52
+ let data = '';
53
+ process.stdin.on('data', chunk => data += chunk);
54
+ process.stdin.on('end', () => {
55
+ try {
56
+ const json = JSON.parse(data);
57
+ // Try different structures
58
+ const type = json.tool_input?.subagent_type
59
+ || json.subagent_type
60
+ || json.tool_input?.type
61
+ || 'unknown';
62
+ console.log(type);
63
+ } catch { console.log('unknown'); }
64
+ });
65
+ ")
66
+ PHASE=$(echo "$STDIN_DATA" | node -e "
67
+ let data = '';
68
+ process.stdin.on('data', chunk => data += chunk);
69
+ process.stdin.on('end', () => {
70
+ try {
71
+ const json = JSON.parse(data);
72
+ const type = json.tool_input?.subagent_type
73
+ || json.subagent_type
74
+ || json.tool_input?.type
75
+ || 'unknown';
76
+ const phaseMap = {
77
+ 'specifier': 'specify',
78
+ 'planner': 'plan',
79
+ 'task-generator': 'tasks',
80
+ 'implementer': 'implement',
81
+ 'researcher': 'research',
82
+ 'reviewer': 'review',
83
+ 'orchestrator': 'orchestrate'
84
+ };
85
+ console.log(phaseMap[type] || type);
86
+ } catch { console.log('unknown'); }
87
+ });
88
+ ")
89
+ elif [ -n "$CLAUDE_TOOL_INPUT" ]; then
90
+ # Fallback to environment variable
91
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] START env: $CLAUDE_TOOL_INPUT" >> "$DEBUG_LOG"
92
+
93
+ AGENT_NAME=$(echo "$CLAUDE_TOOL_INPUT" | node -e "
94
+ let data = '';
95
+ process.stdin.on('data', chunk => data += chunk);
96
+ process.stdin.on('end', () => {
97
+ try {
98
+ const json = JSON.parse(data);
99
+ const type = json.subagent_type || json.tool_input?.subagent_type || 'unknown';
100
+ console.log(type);
101
+ } catch { console.log('unknown'); }
102
+ });
103
+ ")
104
+ PHASE="unknown"
105
+ else
106
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] START no input received" >> "$DEBUG_LOG"
107
+ AGENT_NAME="unknown"
108
+ PHASE="unknown"
109
+ fi
110
+
111
+ # Generate invocation ID
112
+ INVOCATION_ID="inv-$(date +%s)-$(head -c 4 /dev/urandom | xxd -p)"
113
+ STARTED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
114
+
115
+ # Get workflow ID from index
116
+ WORKFLOW_ID=""
117
+ if [ -f "$INDEX_FILE" ]; then
118
+ WORKFLOW_ID=$(node -e "
119
+ const fs = require('fs');
120
+ try {
121
+ const idx = JSON.parse(fs.readFileSync('$INDEX_FILE', 'utf8'));
122
+ console.log(idx.activeWorkflow?.id || 'wf-standalone-' + Date.now());
123
+ } catch { console.log('wf-standalone-' + Date.now()); }
124
+ ")
125
+ fi
126
+
127
+ # Save invocation state
128
+ echo "$INVOCATION_ID" > "$INVOCATION_FILE"
129
+
130
+ # Update orchestrator-index.json
131
+ if [ -f "$INDEX_FILE" ]; then
132
+ node -e "
133
+ const fs = require('fs');
134
+ const indexPath = '$INDEX_FILE';
135
+ const idx = JSON.parse(fs.readFileSync(indexPath, 'utf8'));
136
+
137
+ if (!idx.agentInvocations) idx.agentInvocations = [];
138
+
139
+ idx.agentInvocations.push({
140
+ id: '$INVOCATION_ID',
141
+ agentName: '$AGENT_NAME',
142
+ phase: '$PHASE',
143
+ workflowId: '$WORKFLOW_ID',
144
+ startedAt: '$STARTED_AT',
145
+ completedAt: null,
146
+ status: 'running',
147
+ durationMs: 0
148
+ });
149
+
150
+ fs.writeFileSync(indexPath, JSON.stringify(idx, null, 2));
151
+ console.log(JSON.stringify({ invocationId: '$INVOCATION_ID', startedAt: '$STARTED_AT' }));
152
+ "
153
+ else
154
+ echo '{"invocationId": "'$INVOCATION_ID'", "startedAt": "'$STARTED_AT'", "warning": "No index file found"}'
155
+ fi
156
+ ;;
157
+
158
+ complete)
159
+ # Get invocation ID from state file
160
+ INVOCATION_ID=""
161
+ if [ -f "$INVOCATION_FILE" ]; then
162
+ INVOCATION_ID=$(cat "$INVOCATION_FILE")
163
+ fi
164
+
165
+ if [ -z "$INVOCATION_ID" ]; then
166
+ echo '{"success": false, "error": "No invocation ID found"}'
167
+ exit 0 # Don't fail the hook
168
+ fi
169
+
170
+ # Debug log
171
+ if [ -n "$STDIN_DATA" ]; then
172
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] COMPLETE stdin: $STDIN_DATA" >> "$DEBUG_LOG"
173
+ fi
174
+
175
+ # Determine status - default to success
176
+ STATUS="success"
177
+ SUMMARY="Completed"
178
+
179
+ COMPLETED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
180
+
181
+ # Update orchestrator-index.json
182
+ if [ -f "$INDEX_FILE" ]; then
183
+ node -e "
184
+ const fs = require('fs');
185
+ const indexPath = '$INDEX_FILE';
186
+ const idx = JSON.parse(fs.readFileSync(indexPath, 'utf8'));
187
+
188
+ const invocations = idx.agentInvocations || [];
189
+ const invIdx = invocations.findIndex(i => i.id === '$INVOCATION_ID');
190
+
191
+ if (invIdx === -1) {
192
+ console.log(JSON.stringify({ success: false, error: 'Invocation not found' }));
193
+ process.exit(0);
194
+ }
195
+
196
+ const inv = invocations[invIdx];
197
+ const startTime = new Date(inv.startedAt).getTime();
198
+ const endTime = new Date('$COMPLETED_AT').getTime();
199
+ const durationMs = endTime - startTime;
200
+
201
+ invocations[invIdx] = {
202
+ ...inv,
203
+ completedAt: '$COMPLETED_AT',
204
+ status: '$STATUS' === 'success' ? 'completed' : 'failed',
205
+ durationMs,
206
+ result: {
207
+ status: '$STATUS',
208
+ summary: '$SUMMARY'
209
+ }
210
+ };
211
+
212
+ idx.agentInvocations = invocations;
213
+
214
+ // Update statistics
215
+ if (idx.statistics) {
216
+ idx.statistics.totalInvocations = invocations.length;
217
+ idx.statistics.lastActivity = '$COMPLETED_AT';
218
+ }
219
+
220
+ fs.writeFileSync(indexPath, JSON.stringify(idx, null, 2));
221
+ console.log(JSON.stringify({ success: true, durationMs }));
222
+ "
223
+ else
224
+ echo '{"success": false, "error": "No index file found"}'
225
+ fi
226
+
227
+ # Clean up state file
228
+ rm -f "$INVOCATION_FILE"
229
+ ;;
230
+
231
+ *)
232
+ echo "Usage: $0 {start|complete}"
233
+ echo ""
234
+ echo "This script is called by Claude Code hooks."
235
+ echo "It reads JSON from stdin with structure:"
236
+ echo ' { "tool_name": "Task", "tool_input": { "subagent_type": "...", ... } }'
237
+ echo ""
238
+ echo "Debug log: $DEBUG_LOG"
239
+ exit 0
240
+ ;;
241
+ esac