astragentic 1.0.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.
@@ -0,0 +1,200 @@
1
+ ---
2
+ description: "Create or update domain specification"
3
+ argument-hint: "<domain>"
4
+ allowed-tools: ["Read", "Write", "Edit", "Glob"]
5
+ ---
6
+
7
+ Creates or updates a business requirements specification for a domain.
8
+
9
+ ## Activation
10
+
11
+ 1. LOAD engine rules from `@_astraler/engine.md`
12
+ 2. Parse domain name from arguments
13
+ 3. Check prerequisites
14
+ 4. Create or update spec
15
+
16
+ ## Prerequisites
17
+
18
+ - `.astraler-docs/01-context/product.md` exists
19
+ - Domain is within project scope
20
+
21
+ ## Reads
22
+
23
+ - `.astraler-docs/01-context/product.md` (priorities, constraints)
24
+ - `.astraler-docs/02-spec/domains/{domain}.md` (if updating)
25
+ - User-provided requirements
26
+
27
+ ## Writes
28
+
29
+ - `.astraler-docs/02-spec/domains/{domain}.md`
30
+
31
+ ## Mermaid Diagram Requirements
32
+
33
+ Every spec MUST include these diagrams:
34
+
35
+ | Diagram Type | Section | Purpose |
36
+ |--------------|---------|---------|
37
+ | `sequenceDiagram` | Flows | Show actor interactions step-by-step |
38
+ | `stateDiagram-v2` | Flows | Show entity state transitions |
39
+ | `erDiagram` | Data Requirements | Show entity relationships |
40
+
41
+ **Optional but recommended:**
42
+ - `flowchart` for decision trees in complex flows
43
+ - `pie` for priority distribution visualization
44
+
45
+ ## Spec Structure
46
+
47
+ ```markdown
48
+ ---
49
+ doc: {domain}-spec
50
+ domain: {domain}
51
+ status: Draft
52
+ owner: astra-ba
53
+ version: v1.0
54
+ change-id: CHG-INIT
55
+ last-updated: {YYYY-MM-DD}
56
+ ---
57
+
58
+ # {Domain} Specification
59
+
60
+ ## Purpose
61
+ Why this domain exists.
62
+
63
+ ## Actors
64
+
65
+ | Actor | Type | Description |
66
+ |-------|------|-------------|
67
+ | {name} | {Primary/System} | {role} |
68
+
69
+ ## Flows
70
+
71
+ ### Flow 1: {Flow Name}
72
+
73
+ ```mermaid
74
+ sequenceDiagram
75
+ participant A as Actor
76
+ participant S as System
77
+ A->>S: Action
78
+ S-->>A: Response
79
+ ```
80
+
81
+ **Preconditions:** {list}
82
+
83
+ **Steps:**
84
+ 1. Step one
85
+ 2. Step two
86
+
87
+ **Postconditions:** {list}
88
+
89
+ ### State Transitions
90
+
91
+ ```mermaid
92
+ stateDiagram-v2
93
+ [*] --> State1
94
+ State1 --> State2: trigger
95
+ State2 --> [*]
96
+ ```
97
+
98
+ ## Business Rules
99
+
100
+ | ID | Rule | Applies To | Enforcement |
101
+ |----|------|------------|-------------|
102
+ | BR-01 | {description} | {flow/entity} | {how enforced} |
103
+
104
+ ## Edge Cases
105
+
106
+ | ID | Condition | Response | HTTP Code |
107
+ |----|-----------|----------|-----------|
108
+ | EC-01 | {condition} | {error message} | {code} |
109
+
110
+ ## Data Requirements
111
+
112
+ ```mermaid
113
+ erDiagram
114
+ ENTITY1 ||--o{ ENTITY2 : contains
115
+ ENTITY1 {
116
+ uuid id PK
117
+ string name
118
+ }
119
+ ENTITY2 {
120
+ uuid id PK
121
+ uuid entity1_id FK
122
+ }
123
+ ```
124
+
125
+ | Entity | Description | Key Fields |
126
+ |--------|-------------|------------|
127
+ | {Entity} | {purpose} | {fields} |
128
+
129
+ ## Success Criteria
130
+ - [ ] Criterion 1
131
+ - [ ] Criterion 2
132
+ ```
133
+
134
+ ## Update Mode
135
+
136
+ If spec exists and is `Approved`:
137
+ - Require CHG reference
138
+ - Bump version appropriately
139
+
140
+ If spec exists and is `Draft`:
141
+ - Edit directly
142
+ - Note changes made
143
+
144
+ ## Execution Pattern (Checkpoints)
145
+
146
+ Generate spec in sections with save-after-each pattern:
147
+
148
+ ```
149
+ 1. Generate Purpose + Actors
150
+ → Save to file
151
+ → Present: "Purpose and Actors defined. [c] Continue | [e] Edit | [q] Quit"
152
+
153
+ 2. Generate Flows (with sequenceDiagram, stateDiagram-v2)
154
+ → Save to file
155
+ → Present each diagram for review (see Interactive Diagram Review)
156
+ → Confirm: [c] Continue | [e] Edit
157
+
158
+ 3. Generate Business Rules + Edge Cases
159
+ → Save to file
160
+ → Confirm: [c] Continue | [e] Edit
161
+
162
+ 4. Generate Data Requirements (with erDiagram)
163
+ → Save to file
164
+ → Present diagram for review
165
+ → Confirm: [c] Continue | [e] Edit
166
+
167
+ 5. Generate Success Criteria
168
+ → Save to file
169
+ → Present complete spec for final review
170
+ ```
171
+
172
+ This prevents losing work and enables iterative refinement.
173
+
174
+ ## Interactive Diagram Review
175
+
176
+ After generating each required Mermaid diagram, present for validation:
177
+
178
+ ```markdown
179
+ ## Sequence Diagram: {Flow Name}
180
+
181
+ ```mermaid
182
+ sequenceDiagram
183
+ participant A as Actor
184
+ participant S as System
185
+ A->>S: Action
186
+ S-->>A: Response
187
+ ```
188
+
189
+ **Does this accurately represent the flow?**
190
+ [y] Yes, continue | [e] Edit this diagram | [s] Skip (will flag in verify)
191
+ ```
192
+
193
+ Repeat for each diagram type:
194
+ - `sequenceDiagram` for each flow
195
+ - `stateDiagram-v2` for state transitions
196
+ - `erDiagram` for data relationships
197
+
198
+ ## Output
199
+
200
+ Confirm spec created/updated with summary of content and diagrams included.
@@ -0,0 +1,86 @@
1
+ ---
2
+ description: "Start Astra: detect project state and launch appropriate workflow"
3
+ argument-hint: "[--scan]"
4
+ allowed-tools: ["Read", "Write", "Edit", "Glob", "Grep"]
5
+ ---
6
+
7
+ Entry point for Astra. Detects whether this is a greenfield or brownfield situation.
8
+
9
+ ## Activation
10
+
11
+ 1. LOAD engine rules from `@_astraler/engine.md`
12
+ 2. Detect project state (see below)
13
+ 3. Load and execute appropriate workflow
14
+
15
+ ## Detection Logic
16
+
17
+ ```
18
+ Check .astraler-docs/ exists?
19
+ ├── No → Check for existing codebase (src/, app/, lib/)
20
+ │ ├── Yes (or --scan flag) → BROWNFIELD
21
+ │ └── No → GREENFIELD
22
+ └── Yes → Check for 02-spec/domains/ content
23
+ ├── Empty → GREENFIELD (continue from distill)
24
+ └── Has content → Already initialized, suggest specific command
25
+ ```
26
+
27
+ ## Greenfield Path
28
+
29
+ Load `@_astraler/workflows/greenfield.md` and execute:
30
+ 1. Ingest raw materials
31
+ 2. Brainstorm requirements
32
+ 3. Distill into product.md
33
+ 4. Design each domain
34
+
35
+ ## Brownfield Path
36
+
37
+ Load `@_astraler/workflows/brownfield.md` and execute:
38
+ 1. Scan codebase structure
39
+ 2. Sketch draft documentation
40
+ 3. Validate with human
41
+ 4. Normalize to standard format
42
+
43
+ ## Bootstrap
44
+
45
+ If `.astraler-docs/` doesn't exist, create the full structure:
46
+
47
+ ```
48
+ .astraler-docs/
49
+ ├── _index.md
50
+ ├── 01-context/
51
+ │ ├── _index.md
52
+ │ ├── product.md
53
+ │ ├── constraints.md
54
+ │ ├── assumptions.md
55
+ │ └── glossary.md
56
+ ├── 02-spec/
57
+ │ ├── _index.md
58
+ │ ├── core/
59
+ │ │ ├── overview.md
60
+ │ │ ├── flows.md
61
+ │ │ └── rules.md
62
+ │ └── domains/
63
+ ├── 03-arch/
64
+ │ ├── _index.md # Navigation only
65
+ │ ├── overview.md # System architecture, tech stack
66
+ │ ├── data-schema.md # Global database schema
67
+ │ ├── decisions.md
68
+ │ ├── standards.md
69
+ │ └── domains/
70
+ ├── 04-tasks/
71
+ │ ├── _index.md
72
+ │ ├── milestones.md
73
+ │ ├── domains/
74
+ │ └── sprints/
75
+ ├── 05-changes/
76
+ │ ├── _index.md
77
+ │ ├── changelog.md
78
+ │ └── impact/
79
+ └── ai/
80
+ ├── guardrails.md
81
+ └── quality_gates.md
82
+ ```
83
+
84
+ ## Output
85
+
86
+ Report which workflow was selected and current phase.
@@ -0,0 +1,135 @@
1
+ ---
2
+ description: "Show project status and suggest next action"
3
+ argument-hint: "[domain]"
4
+ allowed-tools: ["Read", "Glob"]
5
+ ---
6
+
7
+ Read-only status check for project state and guidance on next steps.
8
+
9
+ ## Activation
10
+
11
+ 1. LOAD engine rules from `@_astraler/engine.md`
12
+ 2. Check if `.astraler-docs/` exists
13
+ 3. Analyze artifact states
14
+ 4. Suggest next action
15
+
16
+ ## Detection Logic
17
+
18
+ ```
19
+ Check .astraler-docs/ exists?
20
+ ├── No → Suggest: /astra:start
21
+ └── Yes → Analyze artifacts
22
+ ├── No specs → Phase: Context (run /astra:spec)
23
+ ├── Specs but no arch → Phase: Design (run /astra:arch)
24
+ ├── Arch but no tasks → Phase: Planning (run /astra:plan)
25
+ ├── Tasks exist → Phase: Implementation
26
+ └── Check for pending CHGs
27
+ ```
28
+
29
+ ## Artifact Analysis
30
+
31
+ For each domain found in `02-spec/domains/`:
32
+ 1. Check spec exists and status (Draft/Approved)
33
+ 2. Check arch exists and status
34
+ 3. Check tasks exist and status
35
+ 4. Count task states (TODO/DOING/DONE/BLOCKED)
36
+
37
+ ## Status Indicators
38
+
39
+ | Symbol | Meaning |
40
+ |--------|---------|
41
+ | `✅` | Approved |
42
+ | `📝` | Draft |
43
+ | `⚠️` | Needs attention (stale, missing refs) |
44
+ | `⬜` | Missing |
45
+ | `🔄` | In progress (DOING tasks) |
46
+
47
+ ## Output Format
48
+
49
+ ```markdown
50
+ # Astra Project Status
51
+
52
+ **Project:** {from 01-context/product.md title or folder name}
53
+ **Phase:** {Context | Design | Planning | Implementation | Maintenance}
54
+ **Last activity:** {most recent file modification date}
55
+
56
+ ---
57
+
58
+ ## Artifact Matrix
59
+
60
+ | Domain | Spec | Arch | Tasks | Progress |
61
+ |--------|------|------|-------|----------|
62
+ | {domain} | {status} | {status} | {status} | {n/m done} |
63
+
64
+ ---
65
+
66
+ ## Task Summary
67
+
68
+ | Status | Count |
69
+ |--------|-------|
70
+ | TODO | {n} |
71
+ | DOING | {n} |
72
+ | DONE | {n} |
73
+ | BLOCKED | {n} |
74
+
75
+ ---
76
+
77
+ ## Pending Changes
78
+
79
+ | CHG ID | Title | Status |
80
+ |--------|-------|--------|
81
+ | {id} | {title} | {Open/Applied} |
82
+
83
+ ---
84
+
85
+ ## Suggested Next Action
86
+
87
+ → `{command}` — {reason}
88
+
89
+ **Alternative actions:**
90
+ - `{command}` — {reason}
91
+ - `{command}` — {reason}
92
+ ```
93
+
94
+ ## Phase Determination
95
+
96
+ | Condition | Phase | Primary Action |
97
+ |-----------|-------|----------------|
98
+ | No `.astraler-docs/` | Not initialized | `/astra:start` |
99
+ | No `01-context/product.md` | Context | `/astra:start` |
100
+ | No specs in `02-spec/domains/` | Context | `/astra:spec <domain>` |
101
+ | Specs exist, no arch | Design | `/astra:arch <domain>` |
102
+ | Arch exists, no tasks | Planning | `/astra:plan <domain>` |
103
+ | Tasks exist, some TODO | Implementation | `/astra:build <domain>` |
104
+ | All tasks DONE | Maintenance | `/astra:verify` |
105
+ | Open CHG records | Change in progress | `/astra:change` (continue) |
106
+
107
+ ## Domain-Specific View
108
+
109
+ If domain argument provided:
110
+
111
+ ```markdown
112
+ # {Domain} Status
113
+
114
+ **Spec:** {path} — {status}
115
+ **Arch:** {path} — {status}
116
+ **Tasks:** {path} — {n} total
117
+
118
+ ## Task Breakdown
119
+
120
+ | ID | Title | Status | Deps |
121
+ |----|-------|--------|------|
122
+ | TSK-{domain}-001 | {title} | {status} | {deps} |
123
+
124
+ ## Blockers
125
+
126
+ - {list any BLOCKED tasks with reason}
127
+
128
+ ## Next Action
129
+
130
+ → `{specific command for this domain}`
131
+ ```
132
+
133
+ ## No Modifications
134
+
135
+ This command is READ-ONLY. It analyzes but does not change files.
@@ -0,0 +1,139 @@
1
+ ---
2
+ description: "Verify documentation consistency and quality"
3
+ argument-hint: "[domain|--all]"
4
+ allowed-tools: ["Read", "Glob", "Grep"]
5
+ ---
6
+
7
+ Read-only verification of documentation consistency.
8
+
9
+ ## Activation
10
+
11
+ 1. LOAD engine rules from `@_astraler/engine.md`
12
+ 2. Parse scope (domain or --all)
13
+ 3. Run verification checks
14
+ 4. Report findings
15
+
16
+ ## Scope
17
+
18
+ | Input | Checks |
19
+ |-------|--------|
20
+ | `order` | Single domain |
21
+ | `--all` | All domains |
22
+ | (none) | All domains |
23
+
24
+ ## Paths Checked
25
+
26
+ - `.astraler-docs/01-context/` - Context files
27
+ - `.astraler-docs/02-spec/domains/` - Domain specs
28
+ - `.astraler-docs/03-arch/domains/` - Domain architectures
29
+ - `.astraler-docs/04-tasks/domains/` - Domain tasks
30
+ - `.astraler-docs/05-changes/impact/` - Change records
31
+
32
+ ## Checks Performed
33
+
34
+ ### 1. Spec ↔ Arch Consistency
35
+ - Every spec flow has arch support
36
+ - Every spec actor appears in arch
37
+ - No orphaned arch components
38
+ - Paths: `02-spec/domains/{domain}.md` ↔ `03-arch/domains/{domain}.arch.md`
39
+
40
+ ### 2. Arch ↔ Tasks Traceability
41
+ - Every arch component has tasks
42
+ - Every arch contract has tasks
43
+ - No orphaned tasks
44
+ - Paths: `03-arch/domains/{domain}.arch.md` ↔ `04-tasks/domains/{domain}.tasks.md`
45
+
46
+ ### 3. Task Quality
47
+ - Has spec reference (valid path)
48
+ - Has arch reference (valid path)
49
+ - Has testable acceptance criteria
50
+ - Status is valid
51
+
52
+ ### 4. Change Discipline
53
+ - Approved docs not edited without CHG
54
+ - CHG records are complete
55
+ - Version numbers consistent
56
+ - Check: `05-changes/impact/` records
57
+
58
+ ### 5. Cross-Domain
59
+ - Shared dependencies documented
60
+ - No circular domain dependencies
61
+ - ADRs referenced where needed
62
+ - Check: `03-arch/decisions.md`
63
+
64
+ ### 6. Mermaid Diagram Compliance
65
+
66
+ Verify required diagrams exist in each document type:
67
+
68
+ **Specs (`02-spec/domains/*.md`):**
69
+ - [ ] Has `sequenceDiagram` in Flows section
70
+ - [ ] Has `stateDiagram-v2` for state transitions
71
+ - [ ] Has `erDiagram` in Data Requirements
72
+
73
+ **Architecture (`03-arch/domains/*.arch.md`):**
74
+ - [ ] Has `flowchart` in Overview
75
+ - [ ] Has `classDiagram` in Components
76
+ - [ ] Has `sequenceDiagram` in Contracts
77
+ - [ ] Has `erDiagram` in Data Models
78
+ - [ ] Has `stateDiagram-v2` in State Machine (if applicable)
79
+
80
+ **Tasks (`04-tasks/domains/*.tasks.md`):**
81
+ - [ ] Has `pie` chart in Summary
82
+ - [ ] Has `flowchart` in Dependency Graph
83
+
84
+ **Change Records (`05-changes/impact/CHG-*.md`):**
85
+ - [ ] Has `flowchart` in Impact Analysis
86
+
87
+ ## Finding Categories
88
+
89
+ | Category | Meaning | Action |
90
+ |----------|---------|--------|
91
+ | **Blocker** | Must fix before proceeding | Stop |
92
+ | **Warning** | Should fix, can continue | Note |
93
+ | **Info** | Suggestion only | Optional |
94
+
95
+ ## Output
96
+
97
+ ```markdown
98
+ ## Verification Report
99
+
100
+ **Scope:** {domain|all}
101
+ **Date:** {YYYY-MM-DD}
102
+
103
+ ### Summary
104
+
105
+ | Category | Count |
106
+ |----------|-------|
107
+ | Blockers | {n} |
108
+ | Warnings | {n} |
109
+ | Info | {n} |
110
+
111
+ ### Blockers
112
+
113
+ - {finding with location and fix suggestion}
114
+
115
+ ### Warnings
116
+
117
+ - {finding with location}
118
+
119
+ ### Info
120
+
121
+ - {finding}
122
+
123
+ ### Diagram Compliance
124
+
125
+ | Document | Required Diagrams | Found | Missing |
126
+ |----------|-------------------|-------|---------|
127
+ | 02-spec/domains/{domain}.md | 3 | {n} | {list} |
128
+ | 03-arch/domains/{domain}.arch.md | 5 | {n} | {list} |
129
+ | 04-tasks/domains/{domain}.tasks.md | 2 | {n} | {list} |
130
+
131
+ ---
132
+
133
+ **Result:** {PASS|BLOCKED|PASS_WITH_WARNINGS}
134
+ ```
135
+
136
+ ## No Modifications
137
+
138
+ This command is READ-ONLY. It reports but does not fix issues.
139
+ To fix: use `/astra:spec`, `/astra:arch`, `/astra:plan`, or `/astra:change`.
package/bin/cli.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { execSync } = require('child_process');
6
+
7
+ // Command line arguments
8
+ const args = process.argv.slice(2);
9
+ const command = args[0];
10
+
11
+ if (command !== 'install') {
12
+ console.log('Usage: npx astragentic install');
13
+ process.exit(0);
14
+ }
15
+
16
+ const assetsDir = path.join(__dirname, '../assets');
17
+ const targetDir = process.cwd();
18
+
19
+ console.log('🚀 Starting Astragentic installation...');
20
+
21
+ // Helper to copy directory
22
+ function copyDir(src, dest) {
23
+ if (!fs.existsSync(src)) {
24
+ console.error(`❌ Source directory not found: ${src}`);
25
+ return;
26
+ }
27
+
28
+ // Use cp -r for simplicity on Unix-like systems (Mac/Linux)
29
+ // For Windows compatibility, a more complex recursive fs function would be needed.
30
+ // Given the user is on Mac, this is acceptable for now, but we can wrap it in try-catch.
31
+ try {
32
+ // Check if dest exists
33
+ if (!fs.existsSync(dest)) {
34
+ fs.mkdirSync(dest, { recursive: true });
35
+ }
36
+
37
+ // Using cp -R to copy contents
38
+ // We want content of src to go into dest.
39
+ // If we do cp -R src dest, we might get dest/src.
40
+ // We want src/* -> dest/
41
+
42
+ // Better approach: recursive copy with fs
43
+ copyRecursiveSync(src, dest);
44
+ console.log(`✅ Installed to: ${dest}`);
45
+ } catch (err) {
46
+ console.error(`❌ Error copying to ${dest}:`, err.message);
47
+ }
48
+ }
49
+
50
+ function copyRecursiveSync(src, dest) {
51
+ const exists = fs.existsSync(src);
52
+ const stats = exists && fs.statSync(src);
53
+ const isDirectory = exists && stats.isDirectory();
54
+ if (isDirectory) {
55
+ if (!fs.existsSync(dest)) {
56
+ fs.mkdirSync(dest);
57
+ }
58
+ fs.readdirSync(src).forEach(function(childItemName) {
59
+ copyRecursiveSync(path.join(src, childItemName),
60
+ path.join(dest, childItemName));
61
+ });
62
+ } else {
63
+ fs.copyFileSync(src, dest);
64
+ }
65
+ }
66
+
67
+ // 1. Install .claude
68
+ const claudeSource = path.join(assetsDir, 'claude-code');
69
+ const claudeDest = path.join(targetDir, '.claude');
70
+
71
+ console.log('📦 Installing .claude configuration...');
72
+ copyDir(claudeSource, claudeDest);
73
+
74
+ // 2. Install _astraler
75
+ const astralerSource = path.join(assetsDir, '_astraler');
76
+ const astralerDest = path.join(targetDir, '_astraler');
77
+
78
+ console.log('📦 Installing _astraler resources...');
79
+ copyDir(astralerSource, astralerDest);
80
+
81
+ console.log('🎉 Astragentic installation complete!');
82
+ console.log('👉 You can now run "claude" to start the agent.');
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "astragentic",
3
+ "version": "1.0.0",
4
+ "description": "Installer for Astragentic devkit",
5
+ "bin": {
6
+ "astragentic": "./bin/cli.js"
7
+ },
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "author": "Astraler Team",
12
+ "license": "ISC",
13
+ "dependencies": {}
14
+ }