kspec 1.0.16 → 1.0.18
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/README.md +128 -108
- package/package.json +1 -1
- package/src/index.js +321 -6
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/kspec)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
Spec-driven development workflow for Kiro CLI with verification at every step.
|
|
6
|
+
Spec-driven development workflow for Kiro CLI with context management, verification at every step, and Jira integration.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -17,14 +17,45 @@ npm install -g kspec
|
|
|
17
17
|
kspec init # Interactive setup
|
|
18
18
|
kspec analyse # Analyse codebase
|
|
19
19
|
kspec spec "User Auth API" # Create specification
|
|
20
|
-
kspec verify-spec # Verify spec is complete
|
|
21
20
|
kspec tasks # Generate tasks
|
|
22
|
-
kspec verify-tasks # Verify tasks cover spec
|
|
23
21
|
kspec build # Execute with TDD
|
|
24
22
|
kspec verify # Verify implementation
|
|
25
23
|
kspec done # Complete & harvest memory
|
|
26
24
|
```
|
|
27
25
|
|
|
26
|
+
## Two Ways to Use kspec
|
|
27
|
+
|
|
28
|
+
### 1. CLI Mode (Outside kiro-cli)
|
|
29
|
+
|
|
30
|
+
Run kspec commands from your terminal:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
kspec init
|
|
34
|
+
kspec spec "User Authentication"
|
|
35
|
+
kspec tasks
|
|
36
|
+
kspec build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Agent Mode (Inside kiro-cli) — Recommended
|
|
40
|
+
|
|
41
|
+
Stay inside your kiro-cli session and switch between specialized agents:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
$ kiro-cli
|
|
45
|
+
|
|
46
|
+
> /agent swap kspec-spec
|
|
47
|
+
> Build a todo app with categories
|
|
48
|
+
(agent creates spec.md, spec-lite.md, updates context)
|
|
49
|
+
|
|
50
|
+
> /agent swap kspec-tasks
|
|
51
|
+
(reads CONTEXT.md → knows current spec → generates tasks)
|
|
52
|
+
|
|
53
|
+
> /agent swap kspec-build
|
|
54
|
+
(reads CONTEXT.md → continues from current task)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This approach solves the **context loss problem** — agents read `.kspec/CONTEXT.md` automatically to restore state after context compression.
|
|
58
|
+
|
|
28
59
|
## Workflow
|
|
29
60
|
|
|
30
61
|
```
|
|
@@ -44,166 +75,155 @@ init → analyse → spec → verify-spec → tasks → verify-tasks → build
|
|
|
44
75
|
| `kspec build` | Execute tasks with TDD |
|
|
45
76
|
| `kspec verify` | Verify implementation matches spec |
|
|
46
77
|
| `kspec done` | Complete spec, harvest memory |
|
|
78
|
+
| `kspec context` | View/refresh context file |
|
|
47
79
|
| `kspec review` | Code review |
|
|
48
80
|
| `kspec list` | List all specs |
|
|
49
81
|
| `kspec status` | Current status |
|
|
82
|
+
| `kspec agents` | List available agents |
|
|
83
|
+
| `kspec update` | Check for updates |
|
|
50
84
|
| `kspec help` | Show help |
|
|
51
|
-
|
|
52
|
-
|
|
85
|
+
|
|
86
|
+
### Jira Integration (requires Atlassian MCP)
|
|
87
|
+
|
|
88
|
+
| Command | Description |
|
|
89
|
+
|---------|-------------|
|
|
90
|
+
| `kspec spec --jira PROJ-123,PROJ-456 "Feature"` | Create spec from Jira issues |
|
|
91
|
+
| `kspec sync-jira` | Create Jira issue from spec |
|
|
92
|
+
| `kspec sync-jira --update PROJ-123` | Update existing Jira issue |
|
|
93
|
+
| `kspec jira-subtasks` | Create Jira subtasks from tasks.md |
|
|
94
|
+
| `kspec jira-subtasks PROJ-123` | Create subtasks under specific issue |
|
|
95
|
+
|
|
96
|
+
## Context Management
|
|
97
|
+
|
|
98
|
+
kspec maintains context that survives AI context compression:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
.kspec/CONTEXT.md (auto-generated)
|
|
102
|
+
├── Current Spec: 2026-01-24-user-auth
|
|
103
|
+
├── Task: 3/12 - Implement JWT validation
|
|
104
|
+
├── Requirements Summary (from spec-lite)
|
|
105
|
+
├── Decisions & Learnings
|
|
106
|
+
└── Jira Links (if integrated)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Agents read CONTEXT.md first, automatically restoring state after context compression.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
kspec context # View and refresh context manually
|
|
113
|
+
```
|
|
53
114
|
|
|
54
115
|
## Agents & Shortcuts
|
|
55
116
|
|
|
56
117
|
| Agent | Shortcut | Purpose |
|
|
57
118
|
|-------|----------|---------|
|
|
58
|
-
| kspec-analyse | Ctrl+A | Analyse codebase |
|
|
59
|
-
| kspec-spec | Ctrl+S | Create specifications |
|
|
60
|
-
| kspec-tasks | Ctrl+T | Generate tasks |
|
|
61
|
-
| kspec-build | Ctrl+B | Execute with TDD |
|
|
62
|
-
| kspec-verify | Ctrl+V | Verify spec/tasks/impl |
|
|
63
|
-
| kspec-review | Ctrl+R | Code review |
|
|
119
|
+
| kspec-analyse | Ctrl+Shift+A | Analyse codebase |
|
|
120
|
+
| kspec-spec | Ctrl+Shift+S | Create specifications |
|
|
121
|
+
| kspec-tasks | Ctrl+Shift+T | Generate tasks |
|
|
122
|
+
| kspec-build | Ctrl+Shift+B | Execute with TDD |
|
|
123
|
+
| kspec-verify | Ctrl+Shift+V | Verify spec/tasks/impl |
|
|
124
|
+
| kspec-review | Ctrl+Shift+R | Code review |
|
|
125
|
+
| kspec-jira | Ctrl+Shift+J | Jira integration |
|
|
126
|
+
|
|
127
|
+
Switch agents in kiro-cli: `/agent swap kspec-build` or use keyboard shortcuts.
|
|
64
128
|
|
|
65
129
|
## Structure
|
|
66
130
|
|
|
67
131
|
```
|
|
68
132
|
.kspec/
|
|
69
133
|
├── config.json # User preferences
|
|
134
|
+
├── .current # Current active spec path
|
|
135
|
+
├── CONTEXT.md # Auto-generated context for agents
|
|
70
136
|
├── memory.md # Project learnings
|
|
71
137
|
└── specs/
|
|
72
138
|
└── 2026-01-22-feature/
|
|
73
139
|
├── spec.md # Full specification
|
|
74
140
|
├── spec-lite.md # Concise (for context compression)
|
|
75
141
|
├── tasks.md # Implementation tasks
|
|
76
|
-
|
|
142
|
+
├── memory.md # Feature learnings
|
|
143
|
+
└── jira-links.json # Jira issue links (if integrated)
|
|
77
144
|
|
|
78
145
|
.kiro/
|
|
79
|
-
|
|
146
|
+
├── steering/ # Project rules (Kiro native)
|
|
147
|
+
└── agents/ # kspec-generated agents
|
|
80
148
|
```
|
|
81
149
|
|
|
82
|
-
##
|
|
83
|
-
|
|
84
|
-
Set during `kspec init`:
|
|
85
|
-
|
|
86
|
-
- **Date format**: YYYY-MM-DD, DD-MM-YYYY, or MM-DD-YYYY
|
|
87
|
-
- **Auto-execute**: ask (default), auto, or dry-run
|
|
88
|
-
|
|
89
|
-
## Integration with Kiro IDE
|
|
90
|
-
|
|
91
|
-
kspec and Kiro IDE work seamlessly together, combining structured workflow automation with interactive development assistance.
|
|
150
|
+
## Jira Integration
|
|
92
151
|
|
|
93
|
-
|
|
152
|
+
Bridge the gap between BAs/PMs and developers by integrating with Jira via Atlassian MCP.
|
|
94
153
|
|
|
95
|
-
|
|
96
|
-
- Structured spec creation and task generation
|
|
97
|
-
- Automated analysis and verification steps
|
|
98
|
-
- TDD workflow enforcement
|
|
99
|
-
- Project memory harvesting
|
|
154
|
+
### Pull Requirements from Jira
|
|
100
155
|
|
|
101
|
-
**Kiro IDE provides:**
|
|
102
|
-
- Interactive implementation assistance
|
|
103
|
-
- Real-time code help and debugging
|
|
104
|
-
- Native spec workflow support
|
|
105
|
-
- Advanced AI-powered development tools
|
|
106
|
-
|
|
107
|
-
### Usage Patterns
|
|
108
|
-
|
|
109
|
-
#### Pattern 1: kspec-Driven Development
|
|
110
156
|
```bash
|
|
111
|
-
|
|
112
|
-
kspec init
|
|
113
|
-
kspec analyse
|
|
114
|
-
kspec spec "User Authentication API"
|
|
115
|
-
kspec tasks
|
|
116
|
-
|
|
117
|
-
# Switch to Kiro IDE for implementation
|
|
118
|
-
# Reference spec files: #File .kspec/specs/2026-01-22-user-auth/spec.md
|
|
119
|
-
# Implement tasks interactively with AI assistance
|
|
120
|
-
|
|
121
|
-
# Return to kspec for verification
|
|
122
|
-
kspec verify
|
|
123
|
-
kspec done
|
|
157
|
+
kspec spec --jira PROJ-123,PROJ-456 "User Authentication"
|
|
124
158
|
```
|
|
125
159
|
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
# Use Kiro's built-in spec workflow
|
|
129
|
-
# Create specs using Kiro IDE's native tools
|
|
160
|
+
This fetches issue details, extracts acceptance criteria, and creates a unified spec with source attribution.
|
|
130
161
|
|
|
131
|
-
|
|
132
|
-
kspec analyse # Update steering docs
|
|
133
|
-
kspec review # Code review
|
|
134
|
-
kspec verify # Verify implementation
|
|
135
|
-
```
|
|
162
|
+
### Push Specs to Jira
|
|
136
163
|
|
|
137
|
-
#### Pattern 3: Hybrid Approach
|
|
138
164
|
```bash
|
|
139
|
-
kspec
|
|
140
|
-
|
|
141
|
-
kspec tasks # Generate tasks
|
|
142
|
-
# Implement tasks in Kiro IDE with AI assistance
|
|
143
|
-
kspec verify # Final verification
|
|
165
|
+
kspec sync-jira # Create new issue
|
|
166
|
+
kspec sync-jira --update PROJ-789 # Update existing issue
|
|
144
167
|
```
|
|
145
168
|
|
|
146
|
-
|
|
169
|
+
Create or update Jira issues with spec content for BA/PM review.
|
|
147
170
|
|
|
148
|
-
|
|
171
|
+
### Create Subtasks
|
|
149
172
|
|
|
173
|
+
```bash
|
|
174
|
+
kspec jira-subtasks PROJ-789
|
|
150
175
|
```
|
|
151
|
-
.kiro/
|
|
152
|
-
├── steering/ # Shared project context
|
|
153
|
-
│ ├── product.md # Used by both kspec and Kiro
|
|
154
|
-
│ ├── tech.md # Technology standards
|
|
155
|
-
│ └── testing.md # Testing approach
|
|
156
|
-
└── agents/ # kspec-generated agents (usable in Kiro)
|
|
157
176
|
|
|
158
|
-
.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
177
|
+
Generate Jira subtasks from tasks.md for progress tracking.
|
|
178
|
+
|
|
179
|
+
### Prerequisites
|
|
180
|
+
|
|
181
|
+
Configure Atlassian MCP in `~/.kiro/mcp.json`:
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"mcpServers": {
|
|
186
|
+
"atlassian": {
|
|
187
|
+
"command": "npx",
|
|
188
|
+
"args": ["-y", "@anthropic/mcp-atlassian"],
|
|
189
|
+
"env": {
|
|
190
|
+
"ATLASSIAN_HOST": "https://your-domain.atlassian.net",
|
|
191
|
+
"ATLASSIAN_EMAIL": "your-email@example.com",
|
|
192
|
+
"ATLASSIAN_API_TOKEN": "your-api-token"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
165
197
|
```
|
|
166
198
|
|
|
167
|
-
|
|
199
|
+
Get your API token: https://id.atlassian.com/manage-profile/security/api-tokens
|
|
168
200
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
#File .kspec/specs/user-auth/spec.md # Full specification
|
|
173
|
-
#File .kspec/specs/user-auth/tasks.md # Task list
|
|
174
|
-
#Folder .kspec/specs/user-auth # Entire spec folder
|
|
175
|
-
#Folder .kiro/steering # Project context
|
|
176
|
-
```
|
|
201
|
+
## Configuration
|
|
177
202
|
|
|
178
|
-
|
|
203
|
+
Set during `kspec init`:
|
|
179
204
|
|
|
180
|
-
|
|
205
|
+
- **Date format**: YYYY-MM-DD, DD-MM-YYYY, or MM-DD-YYYY
|
|
206
|
+
- **Auto-execute**: ask (default), auto, or dry-run
|
|
181
207
|
|
|
182
|
-
|
|
183
|
-
- **kspec-spec** (Ctrl+S): Specification creation
|
|
184
|
-
- **kspec-tasks** (Ctrl+T): Task generation
|
|
185
|
-
- **kspec-build** (Ctrl+B): TDD implementation
|
|
186
|
-
- **kspec-verify** (Ctrl+V): Verification
|
|
187
|
-
- **kspec-review** (Ctrl+R): Code review
|
|
208
|
+
## Auto-Updates
|
|
188
209
|
|
|
189
|
-
|
|
210
|
+
kspec checks for updates automatically (cached for 24 hours). Check manually:
|
|
190
211
|
|
|
191
|
-
|
|
212
|
+
```bash
|
|
213
|
+
kspec update
|
|
214
|
+
```
|
|
192
215
|
|
|
193
|
-
|
|
194
|
-
2. **Use Kiro IDE** for interactive implementation and debugging
|
|
195
|
-
3. **Reference kspec files** in Kiro chat for context
|
|
196
|
-
4. **Leverage steering docs** updated by kspec analysis
|
|
197
|
-
5. **Use kspec agents** within Kiro for specialized workflows
|
|
198
|
-
6. **Verify with kspec** to ensure completeness
|
|
216
|
+
Or check when viewing version:
|
|
199
217
|
|
|
200
|
-
|
|
218
|
+
```bash
|
|
219
|
+
kspec --version
|
|
220
|
+
```
|
|
201
221
|
|
|
202
222
|
## Requirements
|
|
203
223
|
|
|
204
224
|
- Node.js >= 18
|
|
205
225
|
- Kiro CLI or Amazon Q CLI
|
|
206
|
-
-
|
|
226
|
+
- Atlassian MCP (optional, for Jira integration)
|
|
207
227
|
|
|
208
228
|
## License
|
|
209
229
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const STEERING_DIR = '.kiro/steering';
|
|
|
9
9
|
const AGENTS_DIR = '.kiro/agents';
|
|
10
10
|
const CONFIG_FILE = path.join(KSPEC_DIR, 'config.json');
|
|
11
11
|
const UPDATE_CHECK_FILE = path.join(os.homedir(), '.kspec-update-check');
|
|
12
|
+
const KIRO_MCP_CONFIG = path.join(os.homedir(), '.kiro', 'mcp.json');
|
|
12
13
|
|
|
13
14
|
// Default config
|
|
14
15
|
const defaultConfig = {
|
|
@@ -92,6 +93,67 @@ async function checkForUpdates() {
|
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
// MCP Integration Detection
|
|
97
|
+
function getMcpConfig() {
|
|
98
|
+
try {
|
|
99
|
+
if (fs.existsSync(KIRO_MCP_CONFIG)) {
|
|
100
|
+
return JSON.parse(fs.readFileSync(KIRO_MCP_CONFIG, 'utf8'));
|
|
101
|
+
}
|
|
102
|
+
} catch {}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function hasAtlassianMcp() {
|
|
107
|
+
const mcpConfig = getMcpConfig();
|
|
108
|
+
if (!mcpConfig || !mcpConfig.mcpServers) return false;
|
|
109
|
+
|
|
110
|
+
// Check for atlassian or jira MCP server
|
|
111
|
+
const serverNames = Object.keys(mcpConfig.mcpServers);
|
|
112
|
+
return serverNames.some(name =>
|
|
113
|
+
name.toLowerCase().includes('atlassian') ||
|
|
114
|
+
name.toLowerCase().includes('jira')
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function getAtlassianMcpName() {
|
|
119
|
+
const mcpConfig = getMcpConfig();
|
|
120
|
+
if (!mcpConfig || !mcpConfig.mcpServers) return null;
|
|
121
|
+
|
|
122
|
+
const serverNames = Object.keys(mcpConfig.mcpServers);
|
|
123
|
+
return serverNames.find(name =>
|
|
124
|
+
name.toLowerCase().includes('atlassian') ||
|
|
125
|
+
name.toLowerCase().includes('jira')
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function requireAtlassianMcp() {
|
|
130
|
+
if (!hasAtlassianMcp()) {
|
|
131
|
+
die(`Atlassian MCP not configured.
|
|
132
|
+
|
|
133
|
+
To use Jira integration, you need to:
|
|
134
|
+
1. Install the Atlassian MCP server
|
|
135
|
+
2. Configure it in ~/.kiro/mcp.json
|
|
136
|
+
|
|
137
|
+
Example ~/.kiro/mcp.json:
|
|
138
|
+
{
|
|
139
|
+
"mcpServers": {
|
|
140
|
+
"atlassian": {
|
|
141
|
+
"command": "npx",
|
|
142
|
+
"args": ["-y", "@anthropic/mcp-atlassian"],
|
|
143
|
+
"env": {
|
|
144
|
+
"ATLASSIAN_HOST": "https://your-domain.atlassian.net",
|
|
145
|
+
"ATLASSIAN_EMAIL": "your-email@example.com",
|
|
146
|
+
"ATLASSIAN_API_TOKEN": "your-api-token"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
Get your API token: https://id.atlassian.com/manage-profile/security/api-tokens`);
|
|
153
|
+
}
|
|
154
|
+
return getAtlassianMcpName();
|
|
155
|
+
}
|
|
156
|
+
|
|
95
157
|
// Helpers
|
|
96
158
|
function log(msg) { console.log(`[kspec] ${msg}`); }
|
|
97
159
|
function die(msg) { console.error(`Error: ${msg}`); process.exit(1); }
|
|
@@ -283,6 +345,15 @@ No active spec. Run: \`kspec spec "Feature Name"\`
|
|
|
283
345
|
memory = fs.readFileSync(memoryFile, 'utf8');
|
|
284
346
|
}
|
|
285
347
|
|
|
348
|
+
// Read Jira links if exists
|
|
349
|
+
const jiraLinksFile = path.join(current, 'jira-links.json');
|
|
350
|
+
let jiraLinks = null;
|
|
351
|
+
if (fs.existsSync(jiraLinksFile)) {
|
|
352
|
+
try {
|
|
353
|
+
jiraLinks = JSON.parse(fs.readFileSync(jiraLinksFile, 'utf8'));
|
|
354
|
+
} catch {}
|
|
355
|
+
}
|
|
356
|
+
|
|
286
357
|
// Build context
|
|
287
358
|
let content = `# kspec Context
|
|
288
359
|
> Auto-generated. Always read this first after context compression.
|
|
@@ -319,6 +390,24 @@ ${memory}
|
|
|
319
390
|
`;
|
|
320
391
|
}
|
|
321
392
|
|
|
393
|
+
if (jiraLinks) {
|
|
394
|
+
content += `## Jira Links
|
|
395
|
+
`;
|
|
396
|
+
if (jiraLinks.sourceIssues && jiraLinks.sourceIssues.length > 0) {
|
|
397
|
+
content += `- Source Issues: ${jiraLinks.sourceIssues.join(', ')}
|
|
398
|
+
`;
|
|
399
|
+
}
|
|
400
|
+
if (jiraLinks.specIssue) {
|
|
401
|
+
content += `- Spec Issue: ${jiraLinks.specIssue}
|
|
402
|
+
`;
|
|
403
|
+
}
|
|
404
|
+
if (jiraLinks.subtasks && jiraLinks.subtasks.length > 0) {
|
|
405
|
+
content += `- Subtasks: ${jiraLinks.subtasks.join(', ')}
|
|
406
|
+
`;
|
|
407
|
+
}
|
|
408
|
+
content += '\n';
|
|
409
|
+
}
|
|
410
|
+
|
|
322
411
|
content += `## Quick Commands
|
|
323
412
|
- \`kspec build\` - Continue building tasks
|
|
324
413
|
- \`kspec verify\` - Verify implementation
|
|
@@ -567,6 +656,59 @@ Your job:
|
|
|
567
656
|
Output: APPROVE / REQUEST_CHANGES with specific issues.`,
|
|
568
657
|
keyboardShortcut: 'ctrl+shift+r',
|
|
569
658
|
welcomeMessage: 'Ready to review. What should I look at?'
|
|
659
|
+
},
|
|
660
|
+
|
|
661
|
+
'kspec-jira.json': {
|
|
662
|
+
name: 'kspec-jira',
|
|
663
|
+
description: 'Jira integration for specs',
|
|
664
|
+
model: 'claude-sonnet-4',
|
|
665
|
+
tools: ['read', 'write', 'mcp'],
|
|
666
|
+
allowedTools: ['read', 'write', 'mcp'],
|
|
667
|
+
resources: [
|
|
668
|
+
'file://.kspec/CONTEXT.md',
|
|
669
|
+
'file://.kiro/steering/**/*.md',
|
|
670
|
+
'file://.kspec/**/*.md'
|
|
671
|
+
],
|
|
672
|
+
prompt: `You are the kspec Jira integration agent.
|
|
673
|
+
|
|
674
|
+
PREREQUISITE: This agent requires Atlassian MCP to be configured.
|
|
675
|
+
If MCP calls fail, inform the user to configure Atlassian MCP first.
|
|
676
|
+
|
|
677
|
+
CAPABILITIES:
|
|
678
|
+
|
|
679
|
+
1. PULL FROM JIRA (when user provides issue keys):
|
|
680
|
+
- Use MCP to fetch Jira issue details
|
|
681
|
+
- Extract: summary, description, acceptance criteria, comments
|
|
682
|
+
- For multiple issues, consolidate into unified requirements
|
|
683
|
+
- Create spec.md with proper attribution to source issues
|
|
684
|
+
- Include Jira links in spec for traceability
|
|
685
|
+
|
|
686
|
+
2. SYNC TO JIRA (when user asks to sync/push):
|
|
687
|
+
- Create new "Technical Specification" issue in Jira
|
|
688
|
+
- Or update existing issue with spec content
|
|
689
|
+
- Link to source stories
|
|
690
|
+
- Add comment requesting BA review
|
|
691
|
+
- Set appropriate labels (kspec, technical-spec)
|
|
692
|
+
|
|
693
|
+
3. CREATE SUBTASKS (when user asks after tasks.md exists):
|
|
694
|
+
- Read tasks.md from current spec
|
|
695
|
+
- Create Jira sub-tasks for each task
|
|
696
|
+
- Link to parent spec issue
|
|
697
|
+
- Include task details and acceptance criteria
|
|
698
|
+
|
|
699
|
+
WORKFLOW:
|
|
700
|
+
1. Read .kspec/CONTEXT.md for current spec state
|
|
701
|
+
2. Identify what user wants (pull/sync/subtasks)
|
|
702
|
+
3. Use Atlassian MCP for Jira operations
|
|
703
|
+
4. Update .kspec/CONTEXT.md with Jira links
|
|
704
|
+
5. Report what was created/updated
|
|
705
|
+
|
|
706
|
+
IMPORTANT:
|
|
707
|
+
- Always include Jira issue links in spec.md
|
|
708
|
+
- Add "Source: JIRA-XXX" attribution for pulled requirements
|
|
709
|
+
- Update CONTEXT.md with linked Jira issues`,
|
|
710
|
+
keyboardShortcut: 'ctrl+shift+j',
|
|
711
|
+
welcomeMessage: 'Jira integration ready. Provide issue keys to pull, or say "sync" to push spec to Jira.'
|
|
570
712
|
}
|
|
571
713
|
};
|
|
572
714
|
|
|
@@ -635,16 +777,62 @@ Update steering docs as needed.`, 'kspec-analyse');
|
|
|
635
777
|
},
|
|
636
778
|
|
|
637
779
|
async spec(args) {
|
|
780
|
+
// Parse --jira flag
|
|
781
|
+
const jiraIndex = args.findIndex(a => a === '--jira' || a.startsWith('--jira='));
|
|
782
|
+
let jiraIssues = null;
|
|
783
|
+
|
|
784
|
+
if (jiraIndex !== -1) {
|
|
785
|
+
// Check prerequisite
|
|
786
|
+
requireAtlassianMcp();
|
|
787
|
+
|
|
788
|
+
if (args[jiraIndex].startsWith('--jira=')) {
|
|
789
|
+
jiraIssues = args[jiraIndex].split('=')[1];
|
|
790
|
+
args.splice(jiraIndex, 1);
|
|
791
|
+
} else if (args[jiraIndex + 1] && !args[jiraIndex + 1].startsWith('-')) {
|
|
792
|
+
jiraIssues = args[jiraIndex + 1];
|
|
793
|
+
args.splice(jiraIndex, 2);
|
|
794
|
+
} else {
|
|
795
|
+
die('Usage: kspec spec --jira PROJ-123,PROJ-124 "Feature Name"');
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
638
799
|
const feature = args.join(' ');
|
|
639
|
-
if (!feature) die('Usage: kspec spec "Feature Name"');
|
|
800
|
+
if (!feature && !jiraIssues) die('Usage: kspec spec "Feature Name" [--jira ISSUE-123,ISSUE-456]');
|
|
640
801
|
|
|
641
802
|
const date = formatDate(config.dateFormat || 'YYYY-MM-DD');
|
|
642
|
-
const
|
|
803
|
+
const featureName = feature || `jira-${jiraIssues.split(',')[0].toLowerCase()}`;
|
|
804
|
+
const folder = path.join(getSpecsDir(), `${date}-${slugify(featureName)}`);
|
|
643
805
|
ensureDir(folder);
|
|
644
806
|
setCurrentSpec(folder);
|
|
645
807
|
|
|
646
808
|
log(`Spec folder: ${folder}`);
|
|
647
|
-
|
|
809
|
+
|
|
810
|
+
if (jiraIssues) {
|
|
811
|
+
// Jira-driven spec creation
|
|
812
|
+
log(`Pulling requirements from Jira: ${jiraIssues}`);
|
|
813
|
+
await chat(`Create specification from Jira issues: ${jiraIssues}
|
|
814
|
+
|
|
815
|
+
Folder: ${folder}
|
|
816
|
+
|
|
817
|
+
WORKFLOW:
|
|
818
|
+
1. Use Atlassian MCP to fetch each Jira issue: ${jiraIssues}
|
|
819
|
+
2. Extract from each issue:
|
|
820
|
+
- Summary and description
|
|
821
|
+
- Acceptance criteria
|
|
822
|
+
- Comments (for context)
|
|
823
|
+
- Linked issues
|
|
824
|
+
3. Consolidate into unified spec.md with:
|
|
825
|
+
- Problem/Context (from issue descriptions)
|
|
826
|
+
- Requirements (from acceptance criteria)
|
|
827
|
+
- Source attribution: "Source: JIRA-XXX" for each requirement
|
|
828
|
+
- Links to original issues
|
|
829
|
+
4. Create spec-lite.md (<500 words, key requirements only)
|
|
830
|
+
5. Save Jira issue keys to ${folder}/jira-links.json
|
|
831
|
+
|
|
832
|
+
IMPORTANT: Include Jira links for traceability.`, 'kspec-jira');
|
|
833
|
+
} else {
|
|
834
|
+
// Standard spec creation
|
|
835
|
+
await chat(`Create specification for: ${feature}
|
|
648
836
|
|
|
649
837
|
Folder: ${folder}
|
|
650
838
|
|
|
@@ -653,6 +841,7 @@ Folder: ${folder}
|
|
|
653
841
|
3. IMMEDIATELY create ${folder}/spec-lite.md (concise version, <500 words)
|
|
654
842
|
|
|
655
843
|
spec-lite.md is critical - it's loaded after context compression.`, 'kspec-spec');
|
|
844
|
+
}
|
|
656
845
|
},
|
|
657
846
|
|
|
658
847
|
async 'verify-spec'(args) {
|
|
@@ -670,6 +859,120 @@ Read the codebase to check implementability.
|
|
|
670
859
|
Report: PASS/FAIL with specific issues.`, 'kspec-verify');
|
|
671
860
|
},
|
|
672
861
|
|
|
862
|
+
async 'sync-jira'(args) {
|
|
863
|
+
// Check prerequisite
|
|
864
|
+
requireAtlassianMcp();
|
|
865
|
+
|
|
866
|
+
const folder = getOrSelectSpec();
|
|
867
|
+
|
|
868
|
+
// Parse flags
|
|
869
|
+
const createFlag = args.includes('--create');
|
|
870
|
+
const updateIndex = args.findIndex(a => a === '--update' || a.startsWith('--update='));
|
|
871
|
+
let updateIssue = null;
|
|
872
|
+
|
|
873
|
+
if (updateIndex !== -1) {
|
|
874
|
+
if (args[updateIndex].startsWith('--update=')) {
|
|
875
|
+
updateIssue = args[updateIndex].split('=')[1];
|
|
876
|
+
} else if (args[updateIndex + 1] && !args[updateIndex + 1].startsWith('-')) {
|
|
877
|
+
updateIssue = args[updateIndex + 1];
|
|
878
|
+
} else {
|
|
879
|
+
die('Usage: kspec sync-jira --update PROJ-123');
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
if (!createFlag && !updateIssue) {
|
|
884
|
+
// Default to create
|
|
885
|
+
log('No flag specified, will create new Jira issue');
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
log(`Syncing spec to Jira: ${folder}`);
|
|
889
|
+
|
|
890
|
+
if (updateIssue) {
|
|
891
|
+
await chat(`Update existing Jira issue with specification.
|
|
892
|
+
|
|
893
|
+
Spec folder: ${folder}
|
|
894
|
+
Target issue: ${updateIssue}
|
|
895
|
+
|
|
896
|
+
WORKFLOW:
|
|
897
|
+
1. Read ${folder}/spec.md
|
|
898
|
+
2. Use Atlassian MCP to update ${updateIssue}:
|
|
899
|
+
- Update description with spec content (or add as comment)
|
|
900
|
+
- Add label: kspec-spec
|
|
901
|
+
- Add comment: "Technical specification updated via kspec"
|
|
902
|
+
3. Update ${folder}/jira-links.json with the issue key
|
|
903
|
+
4. Update .kspec/CONTEXT.md with Jira link
|
|
904
|
+
|
|
905
|
+
Report the updated issue URL.`, 'kspec-jira');
|
|
906
|
+
} else {
|
|
907
|
+
await chat(`Create new Jira issue from specification.
|
|
908
|
+
|
|
909
|
+
Spec folder: ${folder}
|
|
910
|
+
|
|
911
|
+
WORKFLOW:
|
|
912
|
+
1. Read ${folder}/spec.md and ${folder}/spec-lite.md
|
|
913
|
+
2. Check ${folder}/jira-links.json for source issues to link
|
|
914
|
+
3. Use Atlassian MCP to create new issue:
|
|
915
|
+
- Type: Task or Story (based on project settings)
|
|
916
|
+
- Summary: Extract from spec title
|
|
917
|
+
- Description: Include spec-lite.md content
|
|
918
|
+
- Labels: kspec-spec, technical-specification
|
|
919
|
+
- Link to source issues if any
|
|
920
|
+
4. Add comment requesting BA/PM review
|
|
921
|
+
5. Save new issue key to ${folder}/jira-links.json
|
|
922
|
+
6. Update .kspec/CONTEXT.md with new Jira link
|
|
923
|
+
|
|
924
|
+
Report the created issue URL.`, 'kspec-jira');
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
|
|
928
|
+
async 'jira-subtasks'(args) {
|
|
929
|
+
// Check prerequisite
|
|
930
|
+
requireAtlassianMcp();
|
|
931
|
+
|
|
932
|
+
const folder = getOrSelectSpec();
|
|
933
|
+
const tasksFile = path.join(folder, 'tasks.md');
|
|
934
|
+
|
|
935
|
+
if (!fs.existsSync(tasksFile)) {
|
|
936
|
+
die(`No tasks.md found in ${folder}. Run 'kspec tasks' first.`);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// Check for parent issue
|
|
940
|
+
const jiraLinksFile = path.join(folder, 'jira-links.json');
|
|
941
|
+
let parentIssue = args[0];
|
|
942
|
+
|
|
943
|
+
if (!parentIssue && fs.existsSync(jiraLinksFile)) {
|
|
944
|
+
try {
|
|
945
|
+
const links = JSON.parse(fs.readFileSync(jiraLinksFile, 'utf8'));
|
|
946
|
+
parentIssue = links.specIssue || links.sourceIssues?.[0];
|
|
947
|
+
} catch {}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
if (!parentIssue) {
|
|
951
|
+
die(`No parent issue specified. Usage: kspec jira-subtasks PROJ-123
|
|
952
|
+
Or run 'kspec sync-jira' first to create a spec issue.`);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
log(`Creating Jira subtasks from: ${folder}`);
|
|
956
|
+
|
|
957
|
+
await chat(`Create Jira subtasks from tasks.md.
|
|
958
|
+
|
|
959
|
+
Spec folder: ${folder}
|
|
960
|
+
Parent issue: ${parentIssue}
|
|
961
|
+
Tasks file: ${tasksFile}
|
|
962
|
+
|
|
963
|
+
WORKFLOW:
|
|
964
|
+
1. Read ${tasksFile}
|
|
965
|
+
2. For each uncompleted task (- [ ]):
|
|
966
|
+
- Use Atlassian MCP to create subtask under ${parentIssue}
|
|
967
|
+
- Summary: Task description
|
|
968
|
+
- Description: Include any details, file paths mentioned
|
|
969
|
+
- Labels: kspec-task
|
|
970
|
+
3. Save created subtask keys to ${folder}/jira-links.json
|
|
971
|
+
4. Update .kspec/CONTEXT.md with subtask links
|
|
972
|
+
|
|
973
|
+
Report created subtasks with their URLs.`, 'kspec-jira');
|
|
974
|
+
},
|
|
975
|
+
|
|
673
976
|
async tasks(args) {
|
|
674
977
|
const folder = getOrSelectSpec(args.join(' '));
|
|
675
978
|
log(`Generating tasks: ${folder}`);
|
|
@@ -863,14 +1166,15 @@ Output: APPROVE or REQUEST_CHANGES with specifics.`, 'kspec-review');
|
|
|
863
1166
|
console.log(`
|
|
864
1167
|
kspec Agents
|
|
865
1168
|
|
|
866
|
-
Agent Shortcut
|
|
867
|
-
|
|
1169
|
+
Agent Shortcut Purpose
|
|
1170
|
+
─────────────────────────────────────────────────────────
|
|
868
1171
|
kspec-analyse Ctrl+Shift+A Analyse codebase, update steering
|
|
869
1172
|
kspec-spec Ctrl+Shift+S Create specifications
|
|
870
1173
|
kspec-tasks Ctrl+Shift+T Generate tasks from spec
|
|
871
1174
|
kspec-build Ctrl+Shift+B Execute tasks with TDD
|
|
872
1175
|
kspec-verify Ctrl+Shift+V Verify spec/tasks/implementation
|
|
873
1176
|
kspec-review Ctrl+Shift+R Code review
|
|
1177
|
+
kspec-jira Ctrl+Shift+J Jira integration (requires Atlassian MCP)
|
|
874
1178
|
|
|
875
1179
|
Switch: /agent swap or use keyboard shortcuts
|
|
876
1180
|
`);
|
|
@@ -930,6 +1234,16 @@ Inside kiro-cli (recommended):
|
|
|
930
1234
|
|
|
931
1235
|
Agents read .kspec/CONTEXT.md automatically for state.
|
|
932
1236
|
|
|
1237
|
+
Jira Integration (requires Atlassian MCP):
|
|
1238
|
+
kspec spec --jira PROJ-123,PROJ-456 "Feature"
|
|
1239
|
+
Create spec from Jira issues
|
|
1240
|
+
kspec sync-jira Create/update Jira issue from spec
|
|
1241
|
+
kspec sync-jira --update PROJ-123
|
|
1242
|
+
Update existing Jira issue
|
|
1243
|
+
kspec jira-subtasks Create Jira subtasks from tasks.md
|
|
1244
|
+
kspec jira-subtasks PROJ-123
|
|
1245
|
+
Create subtasks under specific issue
|
|
1246
|
+
|
|
933
1247
|
Other:
|
|
934
1248
|
kspec context Refresh/view context file
|
|
935
1249
|
kspec review [target] Code review
|
|
@@ -942,6 +1256,7 @@ Other:
|
|
|
942
1256
|
Examples:
|
|
943
1257
|
kspec init # First time setup
|
|
944
1258
|
kspec spec "User Auth" # CLI mode
|
|
1259
|
+
kspec spec --jira PROJ-123 "Auth" # From Jira story
|
|
945
1260
|
kiro-cli --agent kspec-spec # Direct agent mode
|
|
946
1261
|
`);
|
|
947
1262
|
}
|
|
@@ -972,4 +1287,4 @@ async function run(args) {
|
|
|
972
1287
|
}
|
|
973
1288
|
}
|
|
974
1289
|
|
|
975
|
-
module.exports = { run, commands, loadConfig, detectCli, requireCli, agentTemplates, getTaskStats, refreshContext, getCurrentTask, checkForUpdates, compareVersions };
|
|
1290
|
+
module.exports = { run, commands, loadConfig, detectCli, requireCli, agentTemplates, getTaskStats, refreshContext, getCurrentTask, checkForUpdates, compareVersions, hasAtlassianMcp, getMcpConfig };
|