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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +269 -0
  3. package/VERSION +1 -0
  4. package/agents/legion-orchestrator.md +95 -0
  5. package/bin/install.js +898 -0
  6. package/bin/legion-tools.cjs +421 -0
  7. package/bin/lib/config.cjs +141 -0
  8. package/bin/lib/core.cjs +216 -0
  9. package/bin/lib/domain.cjs +107 -0
  10. package/bin/lib/init.cjs +184 -0
  11. package/bin/lib/session.cjs +140 -0
  12. package/bin/lib/state.cjs +280 -0
  13. package/commands/legion/devops/architect.md +44 -0
  14. package/commands/legion/devops/build.md +52 -0
  15. package/commands/legion/devops/cycle.md +52 -0
  16. package/commands/legion/devops/execute.md +52 -0
  17. package/commands/legion/devops/plan.md +51 -0
  18. package/commands/legion/devops/quick.md +45 -0
  19. package/commands/legion/devops/review.md +52 -0
  20. package/commands/legion/resume.md +52 -0
  21. package/commands/legion/status.md +53 -0
  22. package/hooks/legion-context-monitor.js +180 -0
  23. package/hooks/legion-statusline.js +191 -0
  24. package/package.json +48 -0
  25. package/references/agent-routing.md +64 -0
  26. package/references/devops/agent-map.md +61 -0
  27. package/references/devops/pipeline-patterns.md +87 -0
  28. package/references/domain-registry.md +63 -0
  29. package/references/ui-brand.md +102 -0
  30. package/templates/config.json +25 -0
  31. package/templates/devops/architect-output.md +28 -0
  32. package/templates/devops/execution-report.md +23 -0
  33. package/templates/devops/plan-output.md +33 -0
  34. package/templates/devops/review-checklist.md +35 -0
  35. package/templates/session.md +17 -0
  36. package/templates/state.md +17 -0
  37. package/templates/task-record.md +19 -0
  38. package/workflows/core/completion.md +70 -0
  39. package/workflows/core/context-load.md +57 -0
  40. package/workflows/core/init.md +52 -0
  41. package/workflows/devops/architect.md +91 -0
  42. package/workflows/devops/build.md +92 -0
  43. package/workflows/devops/cycle.md +237 -0
  44. package/workflows/devops/execute.md +118 -0
  45. package/workflows/devops/plan.md +108 -0
  46. package/workflows/devops/quick.md +107 -0
  47. package/workflows/devops/review.md +112 -0
  48. package/workflows/resume.md +88 -0
  49. package/workflows/status.md +72 -0
@@ -0,0 +1,112 @@
1
+ # Legion DevOps — Review Workflow
2
+
3
+ Invoke the devops-architect agent in review mode to validate changes against architectural intent.
4
+
5
+ ## Prerequisites
6
+ - Something to review: execution artifact, code changes, or explicit path
7
+
8
+ ## Workflow
9
+
10
+ ### Step 1: Initialize
11
+
12
+ ```bash
13
+ node ~/.claude/legion/bin/legion-tools.cjs init devops-review $ARGUMENTS
14
+ ```
15
+
16
+ Display banner:
17
+ ```
18
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
19
+ LEGION ► DEVOPS ► REVIEW
20
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
21
+ ```
22
+
23
+ ### Step 2: Load Context
24
+
25
+ Follow @~/.claude/legion/workflows/core/context-load.md
26
+
27
+ ### Step 3: Find Review Target
28
+
29
+ Resolve what to review:
30
+ 1. **From $ARGUMENTS**: If a path is provided, use it as the review target
31
+ 2. **From STATE.md**: Find the latest execution artifact
32
+ 3. **Also load**: The original architect output for comparison (if in a pipeline)
33
+
34
+ If nothing to review:
35
+ ```
36
+ ⚠ Nothing to review.
37
+
38
+ Provide a path to review:
39
+ /legion:devops:review /path/to/file-or-directory
40
+
41
+ Or run the execution step first:
42
+ /legion:devops:execute
43
+ ```
44
+
45
+ ### Step 4: Spawn Reviewer Agent
46
+
47
+ ```
48
+ Task(
49
+ prompt="<legion_context>
50
+ You are being invoked by Legion DevOps Review workflow.
51
+ You are operating in REVIEW MODE — your task is to REVIEW, not design.
52
+
53
+ ## Project Context
54
+ {compiled context summary from .codebase/ and .planning/}
55
+
56
+ ## Original Architecture (Reference)
57
+ {content of architect output if available — this is what was intended}
58
+
59
+ ## Review Target
60
+ {content or path of what was implemented/changed}
61
+
62
+ ## Current State
63
+ {STATE.md summary}
64
+
65
+ ## Review Task
66
+ {$ARGUMENTS instructions if any, or 'Review the executed changes against the original architectural intent. Check for:
67
+ - Alignment with architecture decisions
68
+ - Security issues or anti-patterns
69
+ - Missing validations or error handling
70
+ - Terraform best practices compliance
71
+ - Naming convention adherence
72
+ - Tag compliance
73
+ - Secret handling correctness'}
74
+
75
+ ## Instructions
76
+ - Read and follow your full agent instructions from ~/.claude/agents/devops-architect.md
77
+ - This is a REVIEW — produce a review report, not a new architecture
78
+ - Use MCP tools to inspect the actual state of the codebase
79
+ - Be specific: reference file paths, resource names, line numbers
80
+ - Classify findings: CRITICAL / WARNING / INFO / OK
81
+ - If unsure about anything, say 'я не знаю'
82
+ </legion_context>",
83
+ subagent_type="devops-architect",
84
+ model="sonnet",
85
+ description="Review: {review target description}"
86
+ )
87
+ ```
88
+
89
+ ### Step 5: Process Results
90
+
91
+ Capture the review report.
92
+
93
+ ### Step 6: Complete
94
+
95
+ Follow @~/.claude/legion/workflows/core/completion.md
96
+
97
+ - Save artifact as `{NNN}-review-{slug}.md`
98
+ - Update STATE.md — this is typically the pipeline terminal step
99
+ - Display completion:
100
+
101
+ ```
102
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
103
+ ✓ COMPLETE — REVIEW: {description}
104
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
105
+
106
+ Artifact: .planning/legion/devops/{NNN}-review-{slug}.md
107
+ Findings: {N critical, M warnings, K info}
108
+
109
+ Pipeline complete. Ready for new tasks:
110
+ /legion:devops:quick <new task>
111
+ /legion:devops:architect <new architecture>
112
+ ```
@@ -0,0 +1,88 @@
1
+ # Legion — Resume Workflow
2
+
3
+ Restore context from a previous session and continue where you left off.
4
+
5
+ ## Workflow
6
+
7
+ ### Step 1: Initialize
8
+
9
+ ```bash
10
+ node ~/.claude/legion/bin/legion-tools.cjs init resume
11
+ ```
12
+
13
+ Display banner:
14
+ ```
15
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16
+ LEGION ► RESUME
17
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
18
+ ```
19
+
20
+ ### Step 2: Load State
21
+
22
+ Read `.planning/legion/STATE.md`.
23
+
24
+ If no state found:
25
+ ```
26
+ ⚠ No Legion state found.
27
+
28
+ Nothing to resume. Start fresh:
29
+ /legion:devops:quick <task>
30
+ /legion:devops:architect <task>
31
+ ```
32
+ STOP here.
33
+
34
+ ### Step 3: Load Last Session
35
+
36
+ Read the latest session record from `.planning/legion/sessions/`.
37
+
38
+ ### Step 4: Load Full Context
39
+
40
+ Follow @~/.claude/legion/workflows/core/context-load.md
41
+
42
+ Read ALL context files to restore the working environment.
43
+
44
+ ### Step 5: Analyze Incomplete Work
45
+
46
+ From STATE.md, determine:
47
+ 1. What was the last completed task?
48
+ 2. What stage is the pipeline at?
49
+ 3. Are there any PARTIAL or BLOCKED tasks?
50
+ 4. What was the user doing when they stopped?
51
+
52
+ ### Step 6: Display Restoration
53
+
54
+ ```
55
+ ◆ Restoring context...
56
+
57
+ ✓ STATE.md loaded
58
+ ✓ Last session: {date}
59
+ ✓ Domain: {domain}
60
+ ✓ Pipeline: {pipeline position with marker}
61
+ ✓ Last completed: {last task type} — {description}
62
+ ✓ Context loaded: {N} .codebase/ docs, {M} artifacts
63
+
64
+ ◆ Ready to continue.
65
+ ```
66
+
67
+ ### Step 7: Route to Next Action
68
+
69
+ Based on state analysis:
70
+
71
+ | Situation | Action |
72
+ |-----------|--------|
73
+ | Pipeline has next stage | Suggest `/legion:devops:{next_stage}` |
74
+ | Execution was PARTIAL | Suggest `/legion:devops:execute --task {next_task}` |
75
+ | Execution was BLOCKED | Display blocker, suggest resolution |
76
+ | Pipeline complete | Suggest `/legion:devops:quick <new task>` |
77
+
78
+ Display:
79
+ ```
80
+ ───────────────────────────────────────────────
81
+ ► Next: /legion:devops:{action}
82
+ {description of what's next}
83
+
84
+ Also available:
85
+ - /legion:status — view full state
86
+ - /legion:devops:quick <task> — start a new task
87
+ ───────────────────────────────────────────────
88
+ ```
@@ -0,0 +1,72 @@
1
+ # Legion — Status Workflow
2
+
3
+ Display current Legion state across all domains and route to next action.
4
+
5
+ ## Workflow
6
+
7
+ ### Step 1: Detect State
8
+
9
+ Run:
10
+ ```bash
11
+ node ~/.claude/legion/bin/legion-tools.cjs status
12
+ ```
13
+
14
+ If the command fails or returns empty, check manually:
15
+ 1. Look for `.planning/legion/STATE.md` in current directory (walk up)
16
+ 2. If not found, display "no Legion state" message
17
+
18
+ ### Step 2: Display Status
19
+
20
+ #### If STATE.md exists:
21
+
22
+ ```
23
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
24
+ LEGION ► STATUS
25
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
26
+
27
+ Domain: {domain}
28
+ Stage: {current stage}
29
+ Pipeline: {pipeline with current position marked}
30
+ Last: {last completed task description}
31
+ Next: {suggested next command}
32
+
33
+ ─── Task History ───────────────────────────────
34
+
35
+ | # | Type | Description | Date | Status |
36
+ |---|------|-------------|------|--------|
37
+ {task history rows}
38
+
39
+ ─── Session ────────────────────────────────────
40
+
41
+ Last active: {date and time}
42
+ Artifacts: {count} in .planning/legion/{domain}/
43
+ ```
44
+
45
+ #### If no STATE.md found:
46
+
47
+ ```
48
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
+ LEGION ► STATUS
50
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
+
52
+ ○ No Legion state found in this project.
53
+
54
+ To get started:
55
+ /legion:devops:quick <task> — Fast task execution with context
56
+ /legion:devops:build — Scaffold project and create .codebase/ docs
57
+ /legion:devops:architect <task> — Start with architecture design
58
+ ```
59
+
60
+ ### Step 3: Route
61
+
62
+ Based on current state, suggest the most appropriate next action.
63
+
64
+ Pipeline routing:
65
+ | Current Stage | Suggested Next |
66
+ |--------------|----------------|
67
+ | architect (done) | `/legion:devops:plan` |
68
+ | plan (done) | `/legion:devops:execute` |
69
+ | execute (done) | `/legion:devops:review` |
70
+ | review (done) | `/legion:devops:quick <new task>` |
71
+ | any (in-progress) | `/legion:resume` |
72
+ | no state | `/legion:devops:quick` or `/legion:devops:build` |