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,280 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { currentTimestamp } = require('./core.cjs');
|
|
6
|
+
|
|
7
|
+
// ─── STATE.md Parsing ────────────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Parse STATE.md into a structured object.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} planningDir - Absolute path to `.planning/legion/`
|
|
13
|
+
* @returns {object|null} Parsed state, or null if STATE.md doesn't exist
|
|
14
|
+
*/
|
|
15
|
+
function loadState(planningDir) {
|
|
16
|
+
const statePath = path.join(planningDir, 'STATE.md');
|
|
17
|
+
if (!fs.existsSync(statePath)) return null;
|
|
18
|
+
|
|
19
|
+
const raw = fs.readFileSync(statePath, 'utf8');
|
|
20
|
+
const state = {
|
|
21
|
+
project: {
|
|
22
|
+
domain: '',
|
|
23
|
+
lastActivity: '',
|
|
24
|
+
},
|
|
25
|
+
currentWork: {
|
|
26
|
+
pipeline: '',
|
|
27
|
+
stage: '',
|
|
28
|
+
input: '',
|
|
29
|
+
lastCompleted: '',
|
|
30
|
+
next: '',
|
|
31
|
+
},
|
|
32
|
+
taskHistory: [],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const lines = raw.split('\n');
|
|
36
|
+
let section = '';
|
|
37
|
+
|
|
38
|
+
for (let i = 0; i < lines.length; i++) {
|
|
39
|
+
const line = lines[i];
|
|
40
|
+
|
|
41
|
+
// Detect section headers
|
|
42
|
+
if (line.startsWith('## Project')) {
|
|
43
|
+
section = 'project';
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (line.startsWith('## Current Work')) {
|
|
47
|
+
section = 'currentWork';
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (line.startsWith('## Task History')) {
|
|
51
|
+
section = 'taskHistory';
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (section === 'project') {
|
|
56
|
+
const domainMatch = line.match(/^Domain:\s*(.+)$/);
|
|
57
|
+
if (domainMatch) state.project.domain = domainMatch[1].trim();
|
|
58
|
+
|
|
59
|
+
const activityMatch = line.match(/^Last activity:\s*(.+)$/);
|
|
60
|
+
if (activityMatch) state.project.lastActivity = activityMatch[1].trim();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (section === 'currentWork') {
|
|
64
|
+
const pipelineMatch = line.match(/^Pipeline:\s*(.+)$/);
|
|
65
|
+
if (pipelineMatch) state.currentWork.pipeline = pipelineMatch[1].trim();
|
|
66
|
+
|
|
67
|
+
const stageMatch = line.match(/^Stage:\s*(.+)$/);
|
|
68
|
+
if (stageMatch) state.currentWork.stage = stageMatch[1].trim();
|
|
69
|
+
|
|
70
|
+
const inputMatch = line.match(/^Input:\s*(.+)$/);
|
|
71
|
+
if (inputMatch) state.currentWork.input = inputMatch[1].trim();
|
|
72
|
+
|
|
73
|
+
const lastMatch = line.match(/^Last completed:\s*(.+)$/);
|
|
74
|
+
if (lastMatch) state.currentWork.lastCompleted = lastMatch[1].trim();
|
|
75
|
+
|
|
76
|
+
const nextMatch = line.match(/^Next:\s*(.+)$/);
|
|
77
|
+
if (nextMatch) state.currentWork.next = nextMatch[1].trim();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (section === 'taskHistory') {
|
|
81
|
+
// Parse table rows (skip header and separator lines)
|
|
82
|
+
const rowMatch = line.match(/^\|\s*(\d+)\s*\|\s*(.+?)\s*\|\s*(.+?)\s*\|\s*(.+?)\s*\|\s*(.+?)\s*\|\s*(.+?)\s*\|$/);
|
|
83
|
+
if (rowMatch) {
|
|
84
|
+
state.taskHistory.push({
|
|
85
|
+
num: parseInt(rowMatch[1], 10),
|
|
86
|
+
type: rowMatch[2].trim(),
|
|
87
|
+
description: rowMatch[3].trim(),
|
|
88
|
+
date: rowMatch[4].trim(),
|
|
89
|
+
status: rowMatch[5].trim(),
|
|
90
|
+
artifact: rowMatch[6].trim(),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return state;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ─── STATE.md Serialization ──────────────────────────────────────────────────
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Write a structured state object back to STATE.md.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} planningDir - Absolute path to `.planning/legion/`
|
|
105
|
+
* @param {object} stateObj - State object (same shape as loadState output)
|
|
106
|
+
*/
|
|
107
|
+
function saveState(planningDir, stateObj) {
|
|
108
|
+
const statePath = path.join(planningDir, 'STATE.md');
|
|
109
|
+
|
|
110
|
+
const lines = [];
|
|
111
|
+
lines.push('# Legion State');
|
|
112
|
+
lines.push('');
|
|
113
|
+
lines.push('## Project');
|
|
114
|
+
lines.push(`Domain: ${stateObj.project.domain}`);
|
|
115
|
+
lines.push(`Last activity: ${stateObj.project.lastActivity}`);
|
|
116
|
+
lines.push('');
|
|
117
|
+
lines.push('## Current Work');
|
|
118
|
+
lines.push(`Pipeline: ${stateObj.currentWork.pipeline}`);
|
|
119
|
+
lines.push(`Stage: ${stateObj.currentWork.stage}`);
|
|
120
|
+
lines.push(`Input: ${stateObj.currentWork.input}`);
|
|
121
|
+
lines.push(`Last completed: ${stateObj.currentWork.lastCompleted}`);
|
|
122
|
+
lines.push(`Next: ${stateObj.currentWork.next}`);
|
|
123
|
+
lines.push('');
|
|
124
|
+
lines.push('## Task History');
|
|
125
|
+
lines.push('');
|
|
126
|
+
lines.push('| # | Type | Description | Date | Status | Artifact |');
|
|
127
|
+
lines.push('|---|------|-------------|------|--------|----------|');
|
|
128
|
+
|
|
129
|
+
if (stateObj.taskHistory && stateObj.taskHistory.length > 0) {
|
|
130
|
+
for (const task of stateObj.taskHistory) {
|
|
131
|
+
lines.push(`| ${task.num} | ${task.type} | ${task.description} | ${task.date} | ${task.status} | ${task.artifact} |`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
lines.push('');
|
|
136
|
+
|
|
137
|
+
if (!fs.existsSync(planningDir)) {
|
|
138
|
+
fs.mkdirSync(planningDir, { recursive: true });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
fs.writeFileSync(statePath, lines.join('\n'), 'utf8');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ─── Field Update ────────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Update a single field in STATE.md.
|
|
148
|
+
* Supports dot-notation for nested fields: "project.domain", "currentWork.stage", etc.
|
|
149
|
+
*
|
|
150
|
+
* @param {string} planningDir
|
|
151
|
+
* @param {string} field - Dot-notation field path
|
|
152
|
+
* @param {string} value - New value
|
|
153
|
+
*/
|
|
154
|
+
function updateField(planningDir, field, value) {
|
|
155
|
+
const state = loadState(planningDir);
|
|
156
|
+
if (!state) {
|
|
157
|
+
throw new Error('STATE.md not found in ' + planningDir);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const parts = field.split('.');
|
|
161
|
+
let target = state;
|
|
162
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
163
|
+
if (target[parts[i]] === undefined) {
|
|
164
|
+
throw new Error(`Unknown field path: ${field}`);
|
|
165
|
+
}
|
|
166
|
+
target = target[parts[i]];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const lastKey = parts[parts.length - 1];
|
|
170
|
+
if (target[lastKey] === undefined) {
|
|
171
|
+
throw new Error(`Unknown field: ${field}`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
target[lastKey] = value;
|
|
175
|
+
saveState(planningDir, state);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// ─── Task Record ─────────────────────────────────────────────────────────────
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Append a new task record to the task history in STATE.md.
|
|
182
|
+
*
|
|
183
|
+
* @param {string} planningDir
|
|
184
|
+
* @param {object} record
|
|
185
|
+
* @param {string} record.type - Task type (architect, plan, execute, review)
|
|
186
|
+
* @param {string} record.description - Short description
|
|
187
|
+
* @param {string} record.status - Status (done, in-progress, blocked, pending)
|
|
188
|
+
* @param {string} [record.artifact] - Path to related artifact file
|
|
189
|
+
*/
|
|
190
|
+
function addTaskRecord(planningDir, record) {
|
|
191
|
+
const state = loadState(planningDir);
|
|
192
|
+
if (!state) {
|
|
193
|
+
throw new Error('STATE.md not found in ' + planningDir);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const nextNum = state.taskHistory.length > 0
|
|
197
|
+
? Math.max(...state.taskHistory.map(t => t.num)) + 1
|
|
198
|
+
: 1;
|
|
199
|
+
|
|
200
|
+
state.taskHistory.push({
|
|
201
|
+
num: nextNum,
|
|
202
|
+
type: record.type || 'unknown',
|
|
203
|
+
description: record.description || '',
|
|
204
|
+
date: currentTimestamp('date'),
|
|
205
|
+
status: record.status || 'pending',
|
|
206
|
+
artifact: record.artifact || '-',
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Update last activity
|
|
210
|
+
state.project.lastActivity = `${currentTimestamp('date')} \u2014 ${record.description}`;
|
|
211
|
+
|
|
212
|
+
saveState(planningDir, state);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ─── Current Work ────────────────────────────────────────────────────────────
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Update the "Current Work" section of STATE.md.
|
|
219
|
+
*
|
|
220
|
+
* @param {string} planningDir
|
|
221
|
+
* @param {object} work
|
|
222
|
+
* @param {string} [work.stage] - Current pipeline stage
|
|
223
|
+
* @param {string} [work.input] - Input artifact path
|
|
224
|
+
* @param {string} [work.next] - Next action slug
|
|
225
|
+
*/
|
|
226
|
+
function setCurrentWork(planningDir, work) {
|
|
227
|
+
const state = loadState(planningDir);
|
|
228
|
+
if (!state) {
|
|
229
|
+
throw new Error('STATE.md not found in ' + planningDir);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (work.stage !== undefined) state.currentWork.stage = work.stage;
|
|
233
|
+
if (work.input !== undefined) state.currentWork.input = work.input;
|
|
234
|
+
if (work.next !== undefined) state.currentWork.next = work.next;
|
|
235
|
+
|
|
236
|
+
saveState(planningDir, state);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ─── Initialization ──────────────────────────────────────────────────────────
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Create an initial STATE.md in the given planning directory.
|
|
243
|
+
*
|
|
244
|
+
* @param {string} planningDir
|
|
245
|
+
* @param {string} domain - Domain name (e.g. 'devops')
|
|
246
|
+
*/
|
|
247
|
+
function initState(planningDir, domain) {
|
|
248
|
+
if (!fs.existsSync(planningDir)) {
|
|
249
|
+
fs.mkdirSync(planningDir, { recursive: true });
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const state = {
|
|
253
|
+
project: {
|
|
254
|
+
domain: domain || 'devops',
|
|
255
|
+
lastActivity: `${currentTimestamp('date')} \u2014 initialized`,
|
|
256
|
+
},
|
|
257
|
+
currentWork: {
|
|
258
|
+
pipeline: 'architect -> plan -> execute -> review',
|
|
259
|
+
stage: 'architect',
|
|
260
|
+
input: '-',
|
|
261
|
+
lastCompleted: '-',
|
|
262
|
+
next: `/legion:${domain || 'devops'}:architect`,
|
|
263
|
+
},
|
|
264
|
+
taskHistory: [],
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
saveState(planningDir, state);
|
|
268
|
+
return state;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ─── Exports ─────────────────────────────────────────────────────────────────
|
|
272
|
+
|
|
273
|
+
module.exports = {
|
|
274
|
+
loadState,
|
|
275
|
+
saveState,
|
|
276
|
+
updateField,
|
|
277
|
+
addTaskRecord,
|
|
278
|
+
setCurrentWork,
|
|
279
|
+
initState,
|
|
280
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:devops:architect
|
|
3
|
+
description: "Design infrastructure architecture with devops-architect agent — creates architecture documents in .planning/legion/devops/"
|
|
4
|
+
argument-hint: "<architecture task description>"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- WebSearch
|
|
14
|
+
- WebFetch
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Legion DevOps Architect
|
|
18
|
+
|
|
19
|
+
Invoke the devops-architect agent to design infrastructure architecture.
|
|
20
|
+
|
|
21
|
+
## Execution
|
|
22
|
+
|
|
23
|
+
Follow the workflow at @~/.claude/legion/workflows/devops/architect.md
|
|
24
|
+
|
|
25
|
+
### Quick Reference
|
|
26
|
+
|
|
27
|
+
**Initialization**: @~/.claude/legion/workflows/core/init.md
|
|
28
|
+
**Context Loading**: @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
**Completion**: @~/.claude/legion/workflows/core/completion.md
|
|
30
|
+
|
|
31
|
+
### Agent Details
|
|
32
|
+
|
|
33
|
+
- **Agent**: devops-architect
|
|
34
|
+
- **subagent_type**: devops-architect
|
|
35
|
+
- **Model**: opus
|
|
36
|
+
- **Role**: Senior/Lead DevOps Architect — designs reliable, scalable, secure infrastructure
|
|
37
|
+
|
|
38
|
+
### Pipeline Position
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
[architect] → plan → execute → review
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
After completion, suggest: `/legion:devops:plan`
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:devops:build
|
|
3
|
+
description: "Scaffold project codebase and .codebase/ documentation with codebase-builder agent"
|
|
4
|
+
argument-hint: "[path-to-architecture]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- WebSearch
|
|
14
|
+
- WebFetch
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Legion DevOps Build
|
|
18
|
+
|
|
19
|
+
Invoke the codebase-builder agent to scaffold project structure and create .codebase/ documentation.
|
|
20
|
+
|
|
21
|
+
## Execution
|
|
22
|
+
|
|
23
|
+
Follow the workflow at @~/.claude/legion/workflows/devops/build.md
|
|
24
|
+
|
|
25
|
+
### Quick Reference
|
|
26
|
+
|
|
27
|
+
**Initialization**: @~/.claude/legion/workflows/core/init.md
|
|
28
|
+
**Context Loading**: @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
**Completion**: @~/.claude/legion/workflows/core/completion.md
|
|
30
|
+
|
|
31
|
+
### Agent Details
|
|
32
|
+
|
|
33
|
+
- **Agent**: codebase-builder
|
|
34
|
+
- **subagent_type**: codebase-builder
|
|
35
|
+
- **Model**: opus
|
|
36
|
+
- **Role**: Elite Codebase Builder — scaffolds complete project foundations
|
|
37
|
+
|
|
38
|
+
### Input
|
|
39
|
+
|
|
40
|
+
Optional architecture/plan input:
|
|
41
|
+
1. Check $ARGUMENTS for explicit path to architecture doc
|
|
42
|
+
2. Can also use latest architect + planner outputs from STATE.md
|
|
43
|
+
3. Can work without input — will inspect existing codebase and create .codebase/ docs
|
|
44
|
+
|
|
45
|
+
### Pipeline Position
|
|
46
|
+
|
|
47
|
+
Standalone command or first step for new projects:
|
|
48
|
+
```
|
|
49
|
+
[build] → architect → plan → execute → review
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
After completion, suggest: `/legion:devops:architect` if architecture needed
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:devops:cycle
|
|
3
|
+
description: "Full DevOps pipeline — architect → plan → execute → review with checkpoints between stages"
|
|
4
|
+
argument-hint: "<task description>"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- WebSearch
|
|
14
|
+
- WebFetch
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Legion DevOps Cycle
|
|
18
|
+
|
|
19
|
+
Run the complete DevOps pipeline in one command with approval checkpoints.
|
|
20
|
+
|
|
21
|
+
## Execution
|
|
22
|
+
|
|
23
|
+
Follow the workflow at @~/.claude/legion/workflows/devops/cycle.md
|
|
24
|
+
|
|
25
|
+
### Quick Reference
|
|
26
|
+
|
|
27
|
+
**Initialization**: @~/.claude/legion/workflows/core/init.md
|
|
28
|
+
**Context Loading**: @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
**Completion**: @~/.claude/legion/workflows/core/completion.md
|
|
30
|
+
**Agent Map**: @~/.claude/legion/references/devops/agent-map.md
|
|
31
|
+
|
|
32
|
+
### Pipeline Stages
|
|
33
|
+
|
|
34
|
+
| Stage | Agent | Model | Checkpoint |
|
|
35
|
+
|-------|-------|-------|------------|
|
|
36
|
+
| 1. Architect | devops-architect | opus | ✓ User approval required |
|
|
37
|
+
| 2. Plan | delivery-planner | sonnet | ✓ User approval required |
|
|
38
|
+
| 3. Execute | infra-executor | opus | — |
|
|
39
|
+
| 4. Review | devops-architect | sonnet | — |
|
|
40
|
+
|
|
41
|
+
### Checkpoints
|
|
42
|
+
|
|
43
|
+
After stages 1 (architect) and 2 (plan), the workflow pauses to show the output summary and asks the user to confirm before proceeding. User can:
|
|
44
|
+
- **Approve** — continue to next stage
|
|
45
|
+
- **Revise** — re-run the stage with feedback
|
|
46
|
+
- **Stop** — save progress and exit (resume with `/legion:resume`)
|
|
47
|
+
|
|
48
|
+
### Pipeline Flow
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
[architect] ──checkpoint──► [plan] ──checkpoint──► [execute] ──► [review]
|
|
52
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:devops:execute
|
|
3
|
+
description: "Execute infrastructure plan with infra-executor agent — implements tasks from delivery plan"
|
|
4
|
+
argument-hint: "[path-to-plan] [--task T1]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- WebSearch
|
|
14
|
+
- WebFetch
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Legion DevOps Execute
|
|
18
|
+
|
|
19
|
+
Invoke the infra-executor agent to implement infrastructure changes from a plan.
|
|
20
|
+
|
|
21
|
+
## Execution
|
|
22
|
+
|
|
23
|
+
Follow the workflow at @~/.claude/legion/workflows/devops/execute.md
|
|
24
|
+
|
|
25
|
+
### Quick Reference
|
|
26
|
+
|
|
27
|
+
**Initialization**: @~/.claude/legion/workflows/core/init.md
|
|
28
|
+
**Context Loading**: @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
**Completion**: @~/.claude/legion/workflows/core/completion.md
|
|
30
|
+
|
|
31
|
+
### Agent Details
|
|
32
|
+
|
|
33
|
+
- **Agent**: infra-executor
|
|
34
|
+
- **subagent_type**: infra-executor
|
|
35
|
+
- **Model**: opus
|
|
36
|
+
- **Role**: Elite Infrastructure Execution Specialist — implements plans with surgical precision
|
|
37
|
+
|
|
38
|
+
### Input
|
|
39
|
+
|
|
40
|
+
Requires plan output. Will:
|
|
41
|
+
1. Check $ARGUMENTS for explicit path to plan
|
|
42
|
+
2. If `--task T1` provided, execute only that specific task
|
|
43
|
+
3. If not provided, find latest plan artifact from STATE.md
|
|
44
|
+
4. If no plan found, warn and ask user
|
|
45
|
+
|
|
46
|
+
### Pipeline Position
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
architect → plan → [execute] → review
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
After completion, suggest: `/legion:devops:review`
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:devops:plan
|
|
3
|
+
description: "Decompose architecture into executable implementation plan with delivery-planner agent"
|
|
4
|
+
argument-hint: "[path-to-architect-output]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- WebSearch
|
|
14
|
+
- WebFetch
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Legion DevOps Plan
|
|
18
|
+
|
|
19
|
+
Invoke the delivery-planner agent to decompose an architecture into executable tasks.
|
|
20
|
+
|
|
21
|
+
## Execution
|
|
22
|
+
|
|
23
|
+
Follow the workflow at @~/.claude/legion/workflows/devops/plan.md
|
|
24
|
+
|
|
25
|
+
### Quick Reference
|
|
26
|
+
|
|
27
|
+
**Initialization**: @~/.claude/legion/workflows/core/init.md
|
|
28
|
+
**Context Loading**: @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
**Completion**: @~/.claude/legion/workflows/core/completion.md
|
|
30
|
+
|
|
31
|
+
### Agent Details
|
|
32
|
+
|
|
33
|
+
- **Agent**: delivery-planner
|
|
34
|
+
- **subagent_type**: delivery-planner
|
|
35
|
+
- **Model**: sonnet
|
|
36
|
+
- **Role**: Senior Delivery Planner — transforms architecture into phased implementation plans
|
|
37
|
+
|
|
38
|
+
### Input
|
|
39
|
+
|
|
40
|
+
Requires architect output. Will:
|
|
41
|
+
1. Check $ARGUMENTS for explicit path to architect output
|
|
42
|
+
2. If not provided, find latest architect artifact from STATE.md
|
|
43
|
+
3. If no architect output found, warn and ask user
|
|
44
|
+
|
|
45
|
+
### Pipeline Position
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
architect → [plan] → execute → review
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
After completion, suggest: `/legion:devops:execute`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:devops:quick
|
|
3
|
+
description: "Fast context-aware DevOps task execution — reads .codebase/, identifies work type, dispatches to the right agent (architect/planner/executor/builder)"
|
|
4
|
+
argument-hint: "<task description>"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- WebSearch
|
|
14
|
+
- WebFetch
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Legion DevOps Quick
|
|
18
|
+
|
|
19
|
+
Fast context-aware execution for DevOps tasks. Reads project context, classifies the task, and dispatches to the appropriate agent.
|
|
20
|
+
|
|
21
|
+
## Execution
|
|
22
|
+
|
|
23
|
+
Follow the workflow at @~/.claude/legion/workflows/devops/quick.md
|
|
24
|
+
|
|
25
|
+
### Quick Reference
|
|
26
|
+
|
|
27
|
+
**Initialization**: @~/.claude/legion/workflows/core/init.md
|
|
28
|
+
**Context Loading**: @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
**Completion**: @~/.claude/legion/workflows/core/completion.md
|
|
30
|
+
**Agent Map**: @~/.claude/legion/references/devops/agent-map.md
|
|
31
|
+
|
|
32
|
+
### Agent Routing
|
|
33
|
+
|
|
34
|
+
| Task Type | Agent | subagent_type | Model |
|
|
35
|
+
|-----------|-------|---------------|-------|
|
|
36
|
+
| Architecture/design | devops-architect | devops-architect | opus |
|
|
37
|
+
| Planning/decomposition | delivery-planner | delivery-planner | sonnet |
|
|
38
|
+
| Infrastructure execution | infra-executor | infra-executor | opus |
|
|
39
|
+
| Codebase scaffolding | codebase-builder | codebase-builder | opus |
|
|
40
|
+
|
|
41
|
+
### Key Rules
|
|
42
|
+
- ALWAYS read .codebase/ before starting work
|
|
43
|
+
- If task is unclear, ASK the user — don't guess
|
|
44
|
+
- Pass full context summary to the spawned agent
|
|
45
|
+
- Update STATE.md after completion
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:devops:review
|
|
3
|
+
description: "Review infrastructure architecture or executed changes against architectural intent"
|
|
4
|
+
argument-hint: "[path-to-review-target]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- WebSearch
|
|
14
|
+
- WebFetch
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Legion DevOps Review
|
|
18
|
+
|
|
19
|
+
Invoke the devops-architect agent in review mode to validate implemented changes.
|
|
20
|
+
|
|
21
|
+
## Execution
|
|
22
|
+
|
|
23
|
+
Follow the workflow at @~/.claude/legion/workflows/devops/review.md
|
|
24
|
+
|
|
25
|
+
### Quick Reference
|
|
26
|
+
|
|
27
|
+
**Initialization**: @~/.claude/legion/workflows/core/init.md
|
|
28
|
+
**Context Loading**: @~/.claude/legion/workflows/core/context-load.md
|
|
29
|
+
**Completion**: @~/.claude/legion/workflows/core/completion.md
|
|
30
|
+
|
|
31
|
+
### Agent Details
|
|
32
|
+
|
|
33
|
+
- **Agent**: devops-architect (in review mode)
|
|
34
|
+
- **subagent_type**: devops-architect
|
|
35
|
+
- **Model**: sonnet
|
|
36
|
+
- **Role**: Architecture Reviewer — validates changes against design intent
|
|
37
|
+
|
|
38
|
+
### Input
|
|
39
|
+
|
|
40
|
+
Review target resolution:
|
|
41
|
+
1. Check $ARGUMENTS for explicit path to review
|
|
42
|
+
2. If not provided, find latest execution artifact from STATE.md
|
|
43
|
+
3. Also loads original architect output for comparison
|
|
44
|
+
4. Can review arbitrary code/config when path provided
|
|
45
|
+
|
|
46
|
+
### Pipeline Position
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
architect → plan → execute → [review]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Pipeline terminal step. After completion, suggest next cycle or standalone tasks.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legion:resume
|
|
3
|
+
description: "Resume work from previous Legion session with full context restoration"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
- Bash
|
|
10
|
+
- Task
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Legion Resume
|
|
14
|
+
|
|
15
|
+
Restore context from a previous session and continue where you left off.
|
|
16
|
+
|
|
17
|
+
## Execution
|
|
18
|
+
|
|
19
|
+
Follow the workflow at @~/.claude/legion/workflows/resume.md
|
|
20
|
+
|
|
21
|
+
### Process
|
|
22
|
+
|
|
23
|
+
1. Run `node ~/.claude/legion/bin/legion-tools.cjs init resume`
|
|
24
|
+
2. Read `.planning/legion/STATE.md`
|
|
25
|
+
3. Read the latest session record from `.planning/legion/sessions/`
|
|
26
|
+
4. Load context: @~/.claude/legion/workflows/core/context-load.md
|
|
27
|
+
5. Determine where work stopped:
|
|
28
|
+
- Check `currentWork.stage` in STATE.md
|
|
29
|
+
- Find the latest artifact
|
|
30
|
+
- Identify incomplete pipeline stages
|
|
31
|
+
6. Display restoration summary:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
35
|
+
LEGION ► RESUME
|
|
36
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
37
|
+
|
|
38
|
+
◆ Restoring context...
|
|
39
|
+
|
|
40
|
+
✓ STATE.md loaded
|
|
41
|
+
✓ Last session: {date}
|
|
42
|
+
✓ Domain: {domain}
|
|
43
|
+
✓ Pipeline: {pipeline position}
|
|
44
|
+
✓ Last completed: {last task}
|
|
45
|
+
|
|
46
|
+
◆ Ready to continue.
|
|
47
|
+
|
|
48
|
+
► Next: /legion:devops:{next_action}
|
|
49
|
+
{description of what's next}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
7. Route to the appropriate next command based on pipeline position
|