legion-cc 0.1.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/LICENSE +21 -0
- package/README.md +269 -0
- package/VERSION +1 -0
- package/agents/legion-orchestrator.md +95 -0
- package/bin/install.js +898 -0
- package/bin/legion-tools.cjs +421 -0
- package/bin/lib/config.cjs +141 -0
- package/bin/lib/core.cjs +216 -0
- package/bin/lib/domain.cjs +107 -0
- package/bin/lib/init.cjs +184 -0
- package/bin/lib/session.cjs +140 -0
- package/bin/lib/state.cjs +280 -0
- package/commands/legion/devops/architect.md +44 -0
- package/commands/legion/devops/build.md +52 -0
- package/commands/legion/devops/cycle.md +52 -0
- package/commands/legion/devops/execute.md +52 -0
- package/commands/legion/devops/plan.md +51 -0
- package/commands/legion/devops/quick.md +45 -0
- package/commands/legion/devops/review.md +52 -0
- package/commands/legion/resume.md +52 -0
- package/commands/legion/status.md +53 -0
- package/hooks/legion-context-monitor.js +180 -0
- package/hooks/legion-statusline.js +191 -0
- package/package.json +48 -0
- package/references/agent-routing.md +64 -0
- package/references/devops/agent-map.md +61 -0
- package/references/devops/pipeline-patterns.md +87 -0
- package/references/domain-registry.md +63 -0
- package/references/ui-brand.md +102 -0
- package/templates/config.json +25 -0
- package/templates/devops/architect-output.md +28 -0
- package/templates/devops/execution-report.md +23 -0
- package/templates/devops/plan-output.md +33 -0
- package/templates/devops/review-checklist.md +35 -0
- package/templates/session.md +17 -0
- package/templates/state.md +17 -0
- package/templates/task-record.md +19 -0
- package/workflows/core/completion.md +70 -0
- package/workflows/core/context-load.md +57 -0
- package/workflows/core/init.md +52 -0
- package/workflows/devops/architect.md +91 -0
- package/workflows/devops/build.md +92 -0
- package/workflows/devops/cycle.md +237 -0
- package/workflows/devops/execute.md +118 -0
- package/workflows/devops/plan.md +108 -0
- package/workflows/devops/quick.md +107 -0
- package/workflows/devops/review.md +112 -0
- package/workflows/resume.md +88 -0
- package/workflows/status.md +72 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Legion DevOps — Build Workflow
|
|
2
|
+
|
|
3
|
+
Invoke the codebase-builder agent to scaffold project structure and create .codebase/ documentation.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
- None required — can work standalone by inspecting existing codebase
|
|
7
|
+
- Optionally accepts architect/planner output for guided scaffolding
|
|
8
|
+
|
|
9
|
+
## Workflow
|
|
10
|
+
|
|
11
|
+
### Step 1: Initialize
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
node ~/.claude/legion/bin/legion-tools.cjs init devops-build $ARGUMENTS
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Display banner:
|
|
18
|
+
```
|
|
19
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
|
+
LEGION ► DEVOPS ► BUILD
|
|
21
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Step 2: Load Context
|
|
25
|
+
|
|
26
|
+
Follow @~/.claude/legion/workflows/core/context-load.md
|
|
27
|
+
|
|
28
|
+
Note: .codebase/ may not exist yet — that's often WHY this command is being run.
|
|
29
|
+
|
|
30
|
+
### Step 3: Find Optional Input
|
|
31
|
+
|
|
32
|
+
Check for optional architecture/plan input:
|
|
33
|
+
1. **From $ARGUMENTS**: If a file path is provided, read it
|
|
34
|
+
2. **From STATE.md**: Find latest architect or plan artifacts
|
|
35
|
+
3. **No input**: Proceed without — builder will inspect existing codebase
|
|
36
|
+
|
|
37
|
+
### Step 4: Spawn Builder Agent
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Task(
|
|
41
|
+
prompt="<legion_context>
|
|
42
|
+
You are being invoked by Legion DevOps Build workflow.
|
|
43
|
+
|
|
44
|
+
## Project Context
|
|
45
|
+
{existing context if any — may be empty for new projects}
|
|
46
|
+
|
|
47
|
+
## Architecture/Plan Input
|
|
48
|
+
{content of architect/plan output if available, or 'None — inspect the existing codebase and create .codebase/ documentation'}
|
|
49
|
+
|
|
50
|
+
## Build Task
|
|
51
|
+
{$ARGUMENTS if provided, or 'Inspect the existing project, scaffold any missing structure, and create comprehensive .codebase/ documentation'}
|
|
52
|
+
|
|
53
|
+
## Instructions
|
|
54
|
+
- Read and follow your full agent instructions from ~/.claude/agents/codebase-builder.md
|
|
55
|
+
- Use MCP tools for ALL operations (mandatory)
|
|
56
|
+
- Inspect the existing project THOROUGHLY before creating anything
|
|
57
|
+
- Create the full .codebase/ documentation suite
|
|
58
|
+
- If this is an existing project, do NOT recreate existing structure — document and extend
|
|
59
|
+
- If unsure about anything, say 'я не знаю'
|
|
60
|
+
- Report results using your standard 8-section output format
|
|
61
|
+
</legion_context>",
|
|
62
|
+
subagent_type="codebase-builder",
|
|
63
|
+
model="opus",
|
|
64
|
+
description="Build: {project name or task}"
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 5: Process Results
|
|
69
|
+
|
|
70
|
+
Capture what was created/documented.
|
|
71
|
+
|
|
72
|
+
### Step 6: Complete
|
|
73
|
+
|
|
74
|
+
Follow @~/.claude/legion/workflows/core/completion.md
|
|
75
|
+
|
|
76
|
+
- Save artifact as `{NNN}-build-{slug}.md`
|
|
77
|
+
- Update STATE.md
|
|
78
|
+
- Display completion:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
82
|
+
✓ COMPLETE — BUILD: {description}
|
|
83
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
84
|
+
|
|
85
|
+
Artifact: .planning/legion/devops/{NNN}-build-{slug}.md
|
|
86
|
+
Created: {list of files/dirs created}
|
|
87
|
+
|
|
88
|
+
───────────────────────────────────────────────
|
|
89
|
+
► Next: /legion:devops:architect
|
|
90
|
+
Design the architecture for this project
|
|
91
|
+
───────────────────────────────────────────────
|
|
92
|
+
```
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Legion DevOps — Full Cycle Workflow
|
|
2
|
+
|
|
3
|
+
Run the complete DevOps pipeline: architect → plan → execute → review.
|
|
4
|
+
Includes approval checkpoints between stages.
|
|
5
|
+
|
|
6
|
+
## Prerequisites
|
|
7
|
+
- Task description provided via $ARGUMENTS
|
|
8
|
+
|
|
9
|
+
## Workflow
|
|
10
|
+
|
|
11
|
+
### Step 1: Initialize
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
node ~/.claude/legion/bin/legion-tools.cjs init devops-cycle $ARGUMENTS
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Display banner:
|
|
18
|
+
```
|
|
19
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
|
+
LEGION ► DEVOPS ► FULL CYCLE
|
|
21
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
22
|
+
|
|
23
|
+
Pipeline: [architect] → [plan] → [execute] → [review]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Step 2: Load Context
|
|
27
|
+
|
|
28
|
+
Follow @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
|
|
30
|
+
### Step 3: Phase 1 — ARCHITECT
|
|
31
|
+
|
|
32
|
+
Display:
|
|
33
|
+
```
|
|
34
|
+
◆ Phase 1/4 — ARCHITECT
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Spawn devops-architect agent via Task tool:
|
|
38
|
+
```
|
|
39
|
+
Task(
|
|
40
|
+
prompt="<legion_context>
|
|
41
|
+
You are being invoked by Legion DevOps Cycle workflow — Phase 1: Architecture.
|
|
42
|
+
|
|
43
|
+
## Project Context
|
|
44
|
+
{compiled context from .codebase/ and .planning/}
|
|
45
|
+
|
|
46
|
+
## Architecture Task
|
|
47
|
+
{$ARGUMENTS}
|
|
48
|
+
|
|
49
|
+
## Instructions
|
|
50
|
+
- Follow your full agent instructions from ~/.claude/agents/devops-architect.md
|
|
51
|
+
- Use MCP tools for ALL operations
|
|
52
|
+
- Produce a complete, actionable architecture document
|
|
53
|
+
- If unsure, say 'я не знаю'
|
|
54
|
+
- Report using your standard 9-section format
|
|
55
|
+
</legion_context>",
|
|
56
|
+
subagent_type="devops-architect",
|
|
57
|
+
model="opus",
|
|
58
|
+
description="Cycle/Architect: {task}"
|
|
59
|
+
)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Save output to `{NNN}-architect-{slug}.md`
|
|
63
|
+
|
|
64
|
+
#### Checkpoint 1
|
|
65
|
+
|
|
66
|
+
Display architecture summary to the user:
|
|
67
|
+
```
|
|
68
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
69
|
+
✓ Phase 1/4 — ARCHITECT complete
|
|
70
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
71
|
+
|
|
72
|
+
{Brief architecture summary — key decisions, proposed changes}
|
|
73
|
+
|
|
74
|
+
Artifact: .planning/legion/devops/{NNN}-architect-{slug}.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Ask the user:
|
|
78
|
+
- **Approve** → continue to Phase 2
|
|
79
|
+
- **Revise** → re-run architect with feedback
|
|
80
|
+
- **Stop** → save state and exit (resume with /legion:resume)
|
|
81
|
+
|
|
82
|
+
### Step 4: Phase 2 — PLAN
|
|
83
|
+
|
|
84
|
+
Display:
|
|
85
|
+
```
|
|
86
|
+
◆ Phase 2/4 — PLAN
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Spawn delivery-planner agent via Task tool:
|
|
90
|
+
```
|
|
91
|
+
Task(
|
|
92
|
+
prompt="<legion_context>
|
|
93
|
+
You are being invoked by Legion DevOps Cycle workflow — Phase 2: Planning.
|
|
94
|
+
|
|
95
|
+
## Project Context
|
|
96
|
+
{compiled context}
|
|
97
|
+
|
|
98
|
+
## Architecture Input
|
|
99
|
+
{FULL architect output from Phase 1}
|
|
100
|
+
|
|
101
|
+
## Planning Task
|
|
102
|
+
Decompose the architecture into a phased, executable implementation plan.
|
|
103
|
+
|
|
104
|
+
## Instructions
|
|
105
|
+
- Follow your full agent instructions from ~/.claude/agents/delivery-planner.md
|
|
106
|
+
- Use MCP tools for ALL operations
|
|
107
|
+
- Each task needs: ID, name, purpose, scope, inputs, actions, outputs, owner, dependencies, risks, validation, rollback, completion criteria
|
|
108
|
+
- If unsure, say 'я не знаю'
|
|
109
|
+
</legion_context>",
|
|
110
|
+
subagent_type="delivery-planner",
|
|
111
|
+
model="sonnet",
|
|
112
|
+
description="Cycle/Plan: {task}"
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Save output to `{NNN+1}-plan-{slug}.md`
|
|
117
|
+
|
|
118
|
+
#### Checkpoint 2
|
|
119
|
+
|
|
120
|
+
Display plan summary:
|
|
121
|
+
```
|
|
122
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
123
|
+
✓ Phase 2/4 — PLAN complete
|
|
124
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
125
|
+
|
|
126
|
+
{Brief plan summary — N phases, M tasks, key milestones}
|
|
127
|
+
|
|
128
|
+
Artifact: .planning/legion/devops/{NNN+1}-plan-{slug}.md
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Ask the user: Approve / Revise / Stop
|
|
132
|
+
|
|
133
|
+
### Step 5: Phase 3 — EXECUTE
|
|
134
|
+
|
|
135
|
+
Display:
|
|
136
|
+
```
|
|
137
|
+
◆ Phase 3/4 — EXECUTE
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Spawn infra-executor agent via Task tool:
|
|
141
|
+
```
|
|
142
|
+
Task(
|
|
143
|
+
prompt="<legion_context>
|
|
144
|
+
You are being invoked by Legion DevOps Cycle workflow — Phase 3: Execution.
|
|
145
|
+
|
|
146
|
+
## Project Context
|
|
147
|
+
{compiled context}
|
|
148
|
+
|
|
149
|
+
## Architecture Reference
|
|
150
|
+
{Summary of architect output}
|
|
151
|
+
|
|
152
|
+
## Implementation Plan
|
|
153
|
+
{FULL plan output from Phase 2}
|
|
154
|
+
|
|
155
|
+
## Execution Task
|
|
156
|
+
Execute the plan following the defined phases and task order.
|
|
157
|
+
|
|
158
|
+
## Instructions
|
|
159
|
+
- Follow your full agent instructions from ~/.claude/agents/infra-executor.md
|
|
160
|
+
- Use MCP tools for ALL operations
|
|
161
|
+
- Follow the plan precisely
|
|
162
|
+
- Validate after every step
|
|
163
|
+
- NEVER use `make apply` or `terraform apply`
|
|
164
|
+
- If unsure, say 'я не знаю'
|
|
165
|
+
</legion_context>",
|
|
166
|
+
subagent_type="infra-executor",
|
|
167
|
+
model="opus",
|
|
168
|
+
description="Cycle/Execute: {task}"
|
|
169
|
+
)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Save output to `{NNN+2}-execution-{slug}.md`
|
|
173
|
+
|
|
174
|
+
### Step 6: Phase 4 — REVIEW
|
|
175
|
+
|
|
176
|
+
Display:
|
|
177
|
+
```
|
|
178
|
+
◆ Phase 4/4 — REVIEW
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Spawn devops-architect in review mode:
|
|
182
|
+
```
|
|
183
|
+
Task(
|
|
184
|
+
prompt="<legion_context>
|
|
185
|
+
You are being invoked by Legion DevOps Cycle workflow — Phase 4: Review.
|
|
186
|
+
REVIEW MODE — validate what was built.
|
|
187
|
+
|
|
188
|
+
## Project Context
|
|
189
|
+
{compiled context}
|
|
190
|
+
|
|
191
|
+
## Original Architecture
|
|
192
|
+
{Architect output from Phase 1}
|
|
193
|
+
|
|
194
|
+
## Execution Report
|
|
195
|
+
{Executor output from Phase 3}
|
|
196
|
+
|
|
197
|
+
## Review Task
|
|
198
|
+
Review the executed changes against the original architecture. Check alignment, security, best practices, naming conventions, tags, secrets handling.
|
|
199
|
+
|
|
200
|
+
## Instructions
|
|
201
|
+
- Follow your full agent instructions from ~/.claude/agents/devops-architect.md
|
|
202
|
+
- This is a REVIEW — produce a review report
|
|
203
|
+
- Classify findings: CRITICAL / WARNING / INFO / OK
|
|
204
|
+
- If unsure, say 'я не знаю'
|
|
205
|
+
</legion_context>",
|
|
206
|
+
subagent_type="devops-architect",
|
|
207
|
+
model="sonnet",
|
|
208
|
+
description="Cycle/Review: {task}"
|
|
209
|
+
)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Save output to `{NNN+3}-review-{slug}.md`
|
|
213
|
+
|
|
214
|
+
### Step 7: Complete Cycle
|
|
215
|
+
|
|
216
|
+
Update STATE.md with all 4 task records.
|
|
217
|
+
|
|
218
|
+
Display final summary:
|
|
219
|
+
```
|
|
220
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
221
|
+
✓ FULL CYCLE COMPLETE
|
|
222
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
223
|
+
|
|
224
|
+
✓ Phase 1 — Architect: {description}
|
|
225
|
+
✓ Phase 2 — Plan: {N phases, M tasks}
|
|
226
|
+
✓ Phase 3 — Execute: {status}
|
|
227
|
+
✓ Phase 4 — Review: {N findings}
|
|
228
|
+
|
|
229
|
+
Artifacts:
|
|
230
|
+
.planning/legion/devops/{NNN}-architect-{slug}.md
|
|
231
|
+
.planning/legion/devops/{NNN+1}-plan-{slug}.md
|
|
232
|
+
.planning/legion/devops/{NNN+2}-execution-{slug}.md
|
|
233
|
+
.planning/legion/devops/{NNN+3}-review-{slug}.md
|
|
234
|
+
|
|
235
|
+
Ready for new tasks:
|
|
236
|
+
/legion:devops:quick <next task>
|
|
237
|
+
```
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Legion DevOps — Execute Workflow
|
|
2
|
+
|
|
3
|
+
Invoke the infra-executor agent to implement tasks from a delivery plan.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
- Plan output must exist (from /legion:devops:plan or provided via $ARGUMENTS)
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
### Step 1: Initialize
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node ~/.claude/legion/bin/legion-tools.cjs init devops-execute $ARGUMENTS
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Display banner:
|
|
17
|
+
```
|
|
18
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
LEGION ► DEVOPS ► EXECUTE
|
|
20
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step 2: Load Context
|
|
24
|
+
|
|
25
|
+
Follow @~/.claude/legion/workflows/core/context-load.md
|
|
26
|
+
|
|
27
|
+
### Step 3: Find Plan
|
|
28
|
+
|
|
29
|
+
Resolve the plan input:
|
|
30
|
+
|
|
31
|
+
1. **From $ARGUMENTS**: If a file path is provided, use it
|
|
32
|
+
2. **--task T1**: If task flag provided, extract task ID for targeted execution
|
|
33
|
+
3. **From STATE.md**: Find latest `*-plan-*.md` artifact
|
|
34
|
+
4. **From glob**: Search `.planning/legion/devops/*-plan-*.md`
|
|
35
|
+
|
|
36
|
+
If no plan found:
|
|
37
|
+
```
|
|
38
|
+
⚠ No plan found.
|
|
39
|
+
|
|
40
|
+
To create a plan first, run:
|
|
41
|
+
/legion:devops:plan
|
|
42
|
+
|
|
43
|
+
Or provide a path:
|
|
44
|
+
/legion:devops:execute /path/to/plan.md
|
|
45
|
+
```
|
|
46
|
+
STOP — do not proceed without input.
|
|
47
|
+
|
|
48
|
+
Read the plan fully. Also find and read the corresponding architect output (referenced in the plan or the previous artifact).
|
|
49
|
+
|
|
50
|
+
### Step 4: Spawn Executor Agent
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Task(
|
|
54
|
+
prompt="<legion_context>
|
|
55
|
+
You are being invoked by Legion DevOps Execute workflow.
|
|
56
|
+
|
|
57
|
+
## Project Context
|
|
58
|
+
{compiled context summary from .codebase/ and .planning/}
|
|
59
|
+
|
|
60
|
+
## Architecture Reference
|
|
61
|
+
{Summary or path to architect output that this plan implements}
|
|
62
|
+
|
|
63
|
+
## Implementation Plan
|
|
64
|
+
{FULL content of the plan document}
|
|
65
|
+
|
|
66
|
+
## Execution Scope
|
|
67
|
+
{If --task T1 specified: 'Execute ONLY task T1: {task description}'}
|
|
68
|
+
{If no specific task: 'Execute the plan from the beginning, following the defined phases and task order'}
|
|
69
|
+
|
|
70
|
+
## Current State
|
|
71
|
+
{STATE.md summary}
|
|
72
|
+
|
|
73
|
+
## Instructions
|
|
74
|
+
- Read and follow your full agent instructions from ~/.claude/agents/infra-executor.md
|
|
75
|
+
- Use MCP tools for ALL operations (mandatory)
|
|
76
|
+
- Read .planning/codebase/ documentation BEFORE making changes
|
|
77
|
+
- Follow the plan precisely — do not improvise
|
|
78
|
+
- Validate after every meaningful step
|
|
79
|
+
- If unsure about anything, say 'я не знаю'
|
|
80
|
+
- Report results using your standard 7-section output format
|
|
81
|
+
- NEVER use `make apply` or `terraform apply`
|
|
82
|
+
</legion_context>",
|
|
83
|
+
subagent_type="infra-executor",
|
|
84
|
+
model="opus",
|
|
85
|
+
description="Execute: {task or plan description}"
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Step 5: Process Results
|
|
90
|
+
|
|
91
|
+
Capture the executor's output. Check the reported status:
|
|
92
|
+
- **DONE** — all tasks completed successfully
|
|
93
|
+
- **PARTIAL** — some tasks completed, record which ones
|
|
94
|
+
- **BLOCKED** — execution blocked, record reason
|
|
95
|
+
|
|
96
|
+
### Step 6: Complete
|
|
97
|
+
|
|
98
|
+
Follow @~/.claude/legion/workflows/core/completion.md
|
|
99
|
+
|
|
100
|
+
- Save artifact as `{NNN}-execution-{slug}.md`
|
|
101
|
+
- Update STATE.md: stage → "review", next → "/legion:devops:review"
|
|
102
|
+
- If PARTIAL: keep stage as "execute", note remaining tasks
|
|
103
|
+
- Display completion:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
107
|
+
✓ COMPLETE — EXECUTE: {description}
|
|
108
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
109
|
+
|
|
110
|
+
Artifact: .planning/legion/devops/{NNN}-execution-{slug}.md
|
|
111
|
+
Status: {DONE|PARTIAL|BLOCKED}
|
|
112
|
+
Tasks: {N completed / M total}
|
|
113
|
+
|
|
114
|
+
───────────────────────────────────────────────
|
|
115
|
+
► Next: /legion:devops:review
|
|
116
|
+
Review the executed changes
|
|
117
|
+
───────────────────────────────────────────────
|
|
118
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Legion DevOps — Plan Workflow
|
|
2
|
+
|
|
3
|
+
Invoke the delivery-planner agent to decompose architecture into an executable implementation plan.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
- Architect output must exist (from /legion:devops:architect or provided via $ARGUMENTS)
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
### Step 1: Initialize
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node ~/.claude/legion/bin/legion-tools.cjs init devops-plan $ARGUMENTS
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Display banner:
|
|
17
|
+
```
|
|
18
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
LEGION ► DEVOPS ► PLAN
|
|
20
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step 2: Load Context
|
|
24
|
+
|
|
25
|
+
Follow @~/.claude/legion/workflows/core/context-load.md
|
|
26
|
+
|
|
27
|
+
### Step 3: Find Architect Output
|
|
28
|
+
|
|
29
|
+
Resolve the input for planning:
|
|
30
|
+
|
|
31
|
+
1. **From $ARGUMENTS**: If a file path is provided, use it directly
|
|
32
|
+
2. **From STATE.md**: Find the latest `*-architect-*.md` artifact in `.planning/legion/devops/`
|
|
33
|
+
3. **From glob**: Search `.planning/legion/devops/*-architect-*.md` and use the most recent
|
|
34
|
+
|
|
35
|
+
If no architect output found:
|
|
36
|
+
```
|
|
37
|
+
⚠ No architect output found.
|
|
38
|
+
|
|
39
|
+
To create architecture first, run:
|
|
40
|
+
/legion:devops:architect <task description>
|
|
41
|
+
|
|
42
|
+
Or provide a path to an existing architecture document:
|
|
43
|
+
/legion:devops:plan /path/to/architecture.md
|
|
44
|
+
```
|
|
45
|
+
STOP here — do not proceed without input.
|
|
46
|
+
|
|
47
|
+
Read the architect output fully. It will be passed to the planner.
|
|
48
|
+
|
|
49
|
+
### Step 4: Spawn Planner Agent
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Task(
|
|
53
|
+
prompt="<legion_context>
|
|
54
|
+
You are being invoked by Legion DevOps Plan workflow.
|
|
55
|
+
|
|
56
|
+
## Project Context
|
|
57
|
+
{compiled context summary from .codebase/ and .planning/}
|
|
58
|
+
|
|
59
|
+
## Architecture Input
|
|
60
|
+
{FULL content of the architect output document}
|
|
61
|
+
|
|
62
|
+
## Current State
|
|
63
|
+
{STATE.md summary}
|
|
64
|
+
|
|
65
|
+
## Planning Task
|
|
66
|
+
Decompose the architecture above into a phased, executable implementation plan.
|
|
67
|
+
{Additional instructions from $ARGUMENTS if any}
|
|
68
|
+
|
|
69
|
+
## Instructions
|
|
70
|
+
- Read and follow your full agent instructions from ~/.claude/agents/delivery-planner.md
|
|
71
|
+
- Use MCP tools for ALL operations (mandatory)
|
|
72
|
+
- Inspect the actual codebase BEFORE finalizing the plan
|
|
73
|
+
- Read .planning/codebase/ documentation if available
|
|
74
|
+
- If unsure about anything, say 'я не знаю'
|
|
75
|
+
- Report results using your standard 8-section output format
|
|
76
|
+
- Each task must have: ID, name, purpose, scope, inputs, actions, outputs, owner, dependencies, risks, validation, rollback, completion criteria
|
|
77
|
+
</legion_context>",
|
|
78
|
+
subagent_type="delivery-planner",
|
|
79
|
+
model="sonnet",
|
|
80
|
+
description="Plan: {short description from architect output}"
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Step 5: Process Results
|
|
85
|
+
|
|
86
|
+
Capture the planner's output.
|
|
87
|
+
|
|
88
|
+
### Step 6: Complete
|
|
89
|
+
|
|
90
|
+
Follow @~/.claude/legion/workflows/core/completion.md
|
|
91
|
+
|
|
92
|
+
- Save artifact as `{NNN}-plan-{slug}.md`
|
|
93
|
+
- Update STATE.md: stage → "execute", next → "/legion:devops:execute"
|
|
94
|
+
- Display completion:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
98
|
+
✓ COMPLETE — PLAN: {description}
|
|
99
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
100
|
+
|
|
101
|
+
Artifact: .planning/legion/devops/{NNN}-plan-{slug}.md
|
|
102
|
+
Tasks: {N tasks across M phases}
|
|
103
|
+
|
|
104
|
+
───────────────────────────────────────────────
|
|
105
|
+
► Next: /legion:devops:execute
|
|
106
|
+
Execute the implementation plan
|
|
107
|
+
───────────────────────────────────────────────
|
|
108
|
+
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Legion DevOps — Quick Execution Workflow
|
|
2
|
+
|
|
3
|
+
Fast, context-aware task execution. Reads project documentation, classifies the task, and dispatches to the appropriate DevOps agent.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
- Task description provided via $ARGUMENTS
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
### Step 1: Initialize
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
node ~/.claude/legion/bin/legion-tools.cjs init devops-quick $ARGUMENTS
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Parse the JSON output. Display the Legion banner:
|
|
17
|
+
```
|
|
18
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
19
|
+
LEGION ► DEVOPS ► QUICK
|
|
20
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step 2: Load Context
|
|
24
|
+
|
|
25
|
+
Follow @~/.claude/legion/workflows/core/context-load.md
|
|
26
|
+
|
|
27
|
+
Read ALL available .codebase/ and .planning/codebase/ files. This step is MANDATORY — the whole point of /quick is context-aware execution.
|
|
28
|
+
|
|
29
|
+
Report what was loaded:
|
|
30
|
+
```
|
|
31
|
+
◆ Loading context...
|
|
32
|
+
|
|
33
|
+
✓ .codebase/architecture.md (loaded)
|
|
34
|
+
✓ .codebase/project-structure.md (loaded)
|
|
35
|
+
✓ .codebase/code-style.md (loaded)
|
|
36
|
+
✓ .codebase/stack.md (loaded)
|
|
37
|
+
✓ .planning/codebase/ARCHITECTURE.md (loaded)
|
|
38
|
+
✓ STATE.md (loaded — stage: plan)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 3: Classify Task
|
|
42
|
+
|
|
43
|
+
Analyze the task description from $ARGUMENTS and classify it:
|
|
44
|
+
|
|
45
|
+
| Pattern | Classification | Agent |
|
|
46
|
+
|---------|---------------|-------|
|
|
47
|
+
| Design, architect, propose, evaluate options, migration strategy, DR plan, HA design | **architecture** | devops-architect |
|
|
48
|
+
| Plan, decompose, break down, create tasks, implementation plan, phased rollout | **planning** | delivery-planner |
|
|
49
|
+
| Implement, create resource, add module, write terraform, fix config, update pipeline, change infra | **execution** | infra-executor |
|
|
50
|
+
| Scaffold, create project, init codebase, setup structure, create .codebase/ docs | **build** | codebase-builder |
|
|
51
|
+
| Review, audit, check, validate architecture, security review | **review** | devops-architect (review mode) |
|
|
52
|
+
|
|
53
|
+
If the task doesn't clearly match:
|
|
54
|
+
- Look for keywords and context clues
|
|
55
|
+
- If still unclear, ASK the user: "This task could be handled by [agent1] or [agent2]. Which approach do you prefer?"
|
|
56
|
+
- NEVER guess — routing to the wrong agent wastes context
|
|
57
|
+
|
|
58
|
+
### Step 4: Spawn Agent
|
|
59
|
+
|
|
60
|
+
Based on classification, spawn the appropriate agent via Task tool:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Task(
|
|
64
|
+
prompt="<legion_context>
|
|
65
|
+
You are being invoked by Legion DevOps Quick workflow.
|
|
66
|
+
|
|
67
|
+
## Project Context
|
|
68
|
+
{compiled context summary from .codebase/ and .planning/}
|
|
69
|
+
|
|
70
|
+
## Current State
|
|
71
|
+
{STATE.md summary — current pipeline position, last completed task}
|
|
72
|
+
|
|
73
|
+
## Task
|
|
74
|
+
{$ARGUMENTS — the user's task description}
|
|
75
|
+
|
|
76
|
+
## Instructions
|
|
77
|
+
- Read and follow your full agent instructions
|
|
78
|
+
- Use MCP tools for all operations (mandatory)
|
|
79
|
+
- If unsure about anything, say 'я не знаю'
|
|
80
|
+
- Report results using your standard output format
|
|
81
|
+
</legion_context>",
|
|
82
|
+
subagent_type="{agent_name}",
|
|
83
|
+
model="{model}",
|
|
84
|
+
description="Quick: {short task description}"
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Agent routing table:
|
|
89
|
+
| Classification | subagent_type | model |
|
|
90
|
+
|---------------|---------------|-------|
|
|
91
|
+
| architecture | devops-architect | opus |
|
|
92
|
+
| planning | delivery-planner | sonnet |
|
|
93
|
+
| execution | infra-executor | opus |
|
|
94
|
+
| build | codebase-builder | opus |
|
|
95
|
+
| review | devops-architect | sonnet |
|
|
96
|
+
|
|
97
|
+
### Step 5: Process Results
|
|
98
|
+
|
|
99
|
+
Capture the agent's output.
|
|
100
|
+
|
|
101
|
+
### Step 6: Complete
|
|
102
|
+
|
|
103
|
+
Follow @~/.claude/legion/workflows/core/completion.md
|
|
104
|
+
|
|
105
|
+
- Save artifact as `{NNN}-quick-{slug}.md`
|
|
106
|
+
- Update STATE.md
|
|
107
|
+
- Display completion with next action suggestion
|