ai-sdlc 0.1.0-alpha.1
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 +847 -0
- package/dist/agents/implementation.d.ts +11 -0
- package/dist/agents/implementation.d.ts.map +1 -0
- package/dist/agents/implementation.js +123 -0
- package/dist/agents/implementation.js.map +1 -0
- package/dist/agents/index.d.ts +7 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +8 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/planning.d.ts +9 -0
- package/dist/agents/planning.d.ts.map +1 -0
- package/dist/agents/planning.js +84 -0
- package/dist/agents/planning.js.map +1 -0
- package/dist/agents/refinement.d.ts +10 -0
- package/dist/agents/refinement.d.ts.map +1 -0
- package/dist/agents/refinement.js +98 -0
- package/dist/agents/refinement.js.map +1 -0
- package/dist/agents/research.d.ts +16 -0
- package/dist/agents/research.d.ts.map +1 -0
- package/dist/agents/research.js +141 -0
- package/dist/agents/research.js.map +1 -0
- package/dist/agents/review.d.ts +24 -0
- package/dist/agents/review.d.ts.map +1 -0
- package/dist/agents/review.js +740 -0
- package/dist/agents/review.js.map +1 -0
- package/dist/agents/rework.d.ts +17 -0
- package/dist/agents/rework.d.ts.map +1 -0
- package/dist/agents/rework.js +139 -0
- package/dist/agents/rework.js.map +1 -0
- package/dist/agents/state-assessor.d.ts +21 -0
- package/dist/agents/state-assessor.d.ts.map +1 -0
- package/dist/agents/state-assessor.js +29 -0
- package/dist/agents/state-assessor.js.map +1 -0
- package/dist/cli/commands.d.ts +87 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +1183 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/formatting.d.ts +68 -0
- package/dist/cli/formatting.d.ts.map +1 -0
- package/dist/cli/formatting.js +194 -0
- package/dist/cli/formatting.js.map +1 -0
- package/dist/cli/runner.d.ts +57 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +272 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/story-utils.d.ts +19 -0
- package/dist/cli/story-utils.d.ts.map +1 -0
- package/dist/cli/story-utils.js +44 -0
- package/dist/cli/story-utils.js.map +1 -0
- package/dist/cli/table-renderer.d.ts +22 -0
- package/dist/cli/table-renderer.d.ts.map +1 -0
- package/dist/cli/table-renderer.js +159 -0
- package/dist/cli/table-renderer.js.map +1 -0
- package/dist/core/auth.d.ts +39 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js +128 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/client.d.ts +73 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +140 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/config.d.ts +48 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +330 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/kanban.d.ts +34 -0
- package/dist/core/kanban.d.ts.map +1 -0
- package/dist/core/kanban.js +253 -0
- package/dist/core/kanban.js.map +1 -0
- package/dist/core/story.d.ts +91 -0
- package/dist/core/story.d.ts.map +1 -0
- package/dist/core/story.js +349 -0
- package/dist/core/story.js.map +1 -0
- package/dist/core/theme.d.ts +17 -0
- package/dist/core/theme.d.ts.map +1 -0
- package/dist/core/theme.js +136 -0
- package/dist/core/theme.js.map +1 -0
- package/dist/core/workflow-state.d.ts +56 -0
- package/dist/core/workflow-state.d.ts.map +1 -0
- package/dist/core/workflow-state.js +162 -0
- package/dist/core/workflow-state.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +103 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +228 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +38 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/workflow-state.d.ts +54 -0
- package/dist/types/workflow-state.d.ts.map +1 -0
- package/dist/types/workflow-state.js +5 -0
- package/dist/types/workflow-state.js.map +1 -0
- package/package.json +71 -0
- package/templates/story.md +35 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
import { getSdlcRoot, loadConfig, isStageGateEnabled } from '../core/config.js';
|
|
3
|
+
import { assessState, kanbanExists } from '../core/kanban.js';
|
|
4
|
+
import { parseStory, resetRPIVCycle, markStoryComplete, moveStory, isAtMaxRetries } from '../core/story.js';
|
|
5
|
+
import { ReviewDecision } from '../types/index.js';
|
|
6
|
+
import { runRefinementAgent } from '../agents/refinement.js';
|
|
7
|
+
import { runResearchAgent } from '../agents/research.js';
|
|
8
|
+
import { runPlanningAgent } from '../agents/planning.js';
|
|
9
|
+
import { runImplementationAgent } from '../agents/implementation.js';
|
|
10
|
+
import { runReviewAgent, createPullRequest } from '../agents/review.js';
|
|
11
|
+
import { runReworkAgent, packageReworkContext } from '../agents/rework.js';
|
|
12
|
+
import { getThemedChalk } from '../core/theme.js';
|
|
13
|
+
/**
|
|
14
|
+
* Workflow Runner
|
|
15
|
+
*
|
|
16
|
+
* Orchestrates the execution of the SDLC workflow, processing actions
|
|
17
|
+
* according to priority and respecting stage gates.
|
|
18
|
+
*/
|
|
19
|
+
export class WorkflowRunner {
|
|
20
|
+
sdlcRoot;
|
|
21
|
+
options;
|
|
22
|
+
constructor(options = {}) {
|
|
23
|
+
this.sdlcRoot = getSdlcRoot();
|
|
24
|
+
this.options = options;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Run the workflow
|
|
28
|
+
*/
|
|
29
|
+
async run() {
|
|
30
|
+
const config = loadConfig();
|
|
31
|
+
const c = getThemedChalk(config);
|
|
32
|
+
if (!kanbanExists(this.sdlcRoot)) {
|
|
33
|
+
console.log(c.warning('agentic-sdlc not initialized. Run `agentic-sdlc init` first.'));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const assessment = assessState(this.sdlcRoot);
|
|
37
|
+
if (assessment.recommendedActions.length === 0) {
|
|
38
|
+
console.log(c.success('No pending actions. Board is up to date!'));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (this.options.dryRun) {
|
|
42
|
+
this.showDryRun(assessment);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await this.processActions(assessment);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Show what would be done in dry run mode
|
|
49
|
+
*/
|
|
50
|
+
showDryRun(assessment) {
|
|
51
|
+
const config = loadConfig();
|
|
52
|
+
const c = getThemedChalk(config);
|
|
53
|
+
console.log(c.info('Dry run - would execute:'));
|
|
54
|
+
const actionsToShow = this.options.auto
|
|
55
|
+
? assessment.recommendedActions
|
|
56
|
+
: [assessment.recommendedActions[0]];
|
|
57
|
+
for (const action of actionsToShow) {
|
|
58
|
+
console.log(` ${this.formatAction(action)}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Process actions according to mode
|
|
63
|
+
*/
|
|
64
|
+
async processActions(assessment) {
|
|
65
|
+
if (this.options.auto) {
|
|
66
|
+
await this.runAutoMode(assessment);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
await this.runSingleAction(assessment.recommendedActions[0]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Run all actions until completion
|
|
74
|
+
*/
|
|
75
|
+
async runAutoMode(initialAssessment) {
|
|
76
|
+
const config = loadConfig();
|
|
77
|
+
const c = getThemedChalk(config);
|
|
78
|
+
let assessment = initialAssessment;
|
|
79
|
+
let actionsProcessed = 0;
|
|
80
|
+
const maxActions = 100; // Safety limit
|
|
81
|
+
while (assessment.recommendedActions.length > 0 && actionsProcessed < maxActions) {
|
|
82
|
+
const action = assessment.recommendedActions[0];
|
|
83
|
+
// Check stage gates
|
|
84
|
+
if (await this.checkStageGate(action)) {
|
|
85
|
+
console.log(c.warning(`Stage gate requires approval for: ${this.formatAction(action)}`));
|
|
86
|
+
console.log(c.dim('Run without --auto to process with approval prompts.'));
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
await this.runSingleAction(action);
|
|
90
|
+
actionsProcessed++;
|
|
91
|
+
// Re-assess after each action
|
|
92
|
+
assessment = assessState(this.sdlcRoot);
|
|
93
|
+
}
|
|
94
|
+
if (actionsProcessed >= maxActions) {
|
|
95
|
+
console.log(c.warning(`\nReached maximum actions limit (${maxActions}). Stopping.`));
|
|
96
|
+
}
|
|
97
|
+
else if (assessment.recommendedActions.length === 0) {
|
|
98
|
+
console.log(c.success('\nAll actions completed!'));
|
|
99
|
+
}
|
|
100
|
+
console.log(c.dim(`\nProcessed ${actionsProcessed} action(s).`));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Run a single action
|
|
104
|
+
*/
|
|
105
|
+
async runSingleAction(action) {
|
|
106
|
+
const config = loadConfig();
|
|
107
|
+
const c = getThemedChalk(config);
|
|
108
|
+
const spinner = ora(this.formatAction(action)).start();
|
|
109
|
+
try {
|
|
110
|
+
const result = await this.executeAction(action);
|
|
111
|
+
if (result.success) {
|
|
112
|
+
spinner.succeed(c.success(this.formatAction(action)));
|
|
113
|
+
if (this.options.verbose && result.changesMade.length > 0) {
|
|
114
|
+
for (const change of result.changesMade) {
|
|
115
|
+
console.log(c.dim(` → ${change}`));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
spinner.fail(c.error(`Failed: ${this.formatAction(action)}`));
|
|
121
|
+
if (result.error) {
|
|
122
|
+
console.log(c.error(` Error: ${result.error}`));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
spinner.fail(c.error(`Failed: ${this.formatAction(action)}`));
|
|
128
|
+
console.error(error);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Execute a specific action
|
|
133
|
+
*/
|
|
134
|
+
async executeAction(action) {
|
|
135
|
+
const config = loadConfig();
|
|
136
|
+
switch (action.type) {
|
|
137
|
+
case 'refine':
|
|
138
|
+
return runRefinementAgent(action.storyPath, this.sdlcRoot);
|
|
139
|
+
case 'research':
|
|
140
|
+
return runResearchAgent(action.storyPath, this.sdlcRoot);
|
|
141
|
+
case 'plan':
|
|
142
|
+
return runPlanningAgent(action.storyPath, this.sdlcRoot);
|
|
143
|
+
case 'implement':
|
|
144
|
+
return runImplementationAgent(action.storyPath, this.sdlcRoot);
|
|
145
|
+
case 'review': {
|
|
146
|
+
const reviewResult = await runReviewAgent(action.storyPath, this.sdlcRoot);
|
|
147
|
+
// Handle review decision (auto-complete or restart RPIV)
|
|
148
|
+
if (reviewResult.success) {
|
|
149
|
+
await this.handleReviewDecision(action.storyPath, reviewResult);
|
|
150
|
+
}
|
|
151
|
+
return reviewResult;
|
|
152
|
+
}
|
|
153
|
+
case 'rework': {
|
|
154
|
+
// Get rework context from action
|
|
155
|
+
const reworkContext = action.context;
|
|
156
|
+
if (!reworkContext || !reworkContext.targetPhase) {
|
|
157
|
+
throw new Error('Rework action missing required context (targetPhase)');
|
|
158
|
+
}
|
|
159
|
+
// Run rework agent to prepare the story for refinement
|
|
160
|
+
const reworkResult = await runReworkAgent(action.storyPath, this.sdlcRoot, reworkContext);
|
|
161
|
+
// If rework setup succeeded, automatically trigger the target phase agent
|
|
162
|
+
if (reworkResult.success) {
|
|
163
|
+
const c = getThemedChalk(config);
|
|
164
|
+
console.log(c.info(`\n ↳ Triggering ${reworkContext.targetPhase} agent for refinement...`));
|
|
165
|
+
// Package the review feedback as context for the agent
|
|
166
|
+
const story = parseStory(action.storyPath);
|
|
167
|
+
const agentReworkContext = packageReworkContext(story, reworkContext.reviewFeedback);
|
|
168
|
+
// Execute the appropriate agent based on target phase, passing the rework context
|
|
169
|
+
switch (reworkContext.targetPhase) {
|
|
170
|
+
case 'research':
|
|
171
|
+
return runResearchAgent(action.storyPath, this.sdlcRoot, { reworkContext: agentReworkContext });
|
|
172
|
+
case 'plan':
|
|
173
|
+
return runPlanningAgent(action.storyPath, this.sdlcRoot, { reworkContext: agentReworkContext });
|
|
174
|
+
case 'implement':
|
|
175
|
+
return runImplementationAgent(action.storyPath, this.sdlcRoot, { reworkContext: agentReworkContext });
|
|
176
|
+
default:
|
|
177
|
+
throw new Error(`Unknown target phase: ${reworkContext.targetPhase}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return reworkResult;
|
|
181
|
+
}
|
|
182
|
+
case 'create_pr':
|
|
183
|
+
return createPullRequest(action.storyPath, this.sdlcRoot);
|
|
184
|
+
default:
|
|
185
|
+
throw new Error(`Unknown action type: ${action.type}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Handle review decision - auto-complete on approval, restart RPIV on rejection
|
|
190
|
+
*/
|
|
191
|
+
async handleReviewDecision(storyPath, reviewResult) {
|
|
192
|
+
const config = loadConfig();
|
|
193
|
+
const c = getThemedChalk(config);
|
|
194
|
+
let story = parseStory(storyPath);
|
|
195
|
+
if (reviewResult.decision === ReviewDecision.APPROVED) {
|
|
196
|
+
// Auto-complete on approval
|
|
197
|
+
if (config.reviewConfig.autoCompleteOnApproval) {
|
|
198
|
+
console.log(c.success(`\n✅ Review approved! Auto-completing story "${story.frontmatter.title}"`));
|
|
199
|
+
markStoryComplete(story);
|
|
200
|
+
// Move to done if in in-progress
|
|
201
|
+
if (story.frontmatter.status === 'in-progress') {
|
|
202
|
+
story = moveStory(story, 'done', this.sdlcRoot);
|
|
203
|
+
console.log(c.success(`Moved story to done/`));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else if (reviewResult.decision === ReviewDecision.REJECTED) {
|
|
208
|
+
// Auto-restart RPIV cycle on rejection
|
|
209
|
+
if (config.reviewConfig.autoRestartOnRejection) {
|
|
210
|
+
// Reload story to get latest state
|
|
211
|
+
story = parseStory(storyPath);
|
|
212
|
+
// Check if at max retries
|
|
213
|
+
if (isAtMaxRetries(story, config)) {
|
|
214
|
+
const retryCount = story.frontmatter.retry_count || 0;
|
|
215
|
+
console.log(c.error(`\n⚠️ Story "${story.frontmatter.title}" has reached max retries (${retryCount})`));
|
|
216
|
+
console.log(c.warning('Manual intervention required. Use appropriate commands to reset or fix the story.'));
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
// Reset RPIV cycle
|
|
220
|
+
const retryCount = (story.frontmatter.retry_count || 0) + 1;
|
|
221
|
+
const maxRetries = story.frontmatter.max_retries ?? config.reviewConfig.maxRetries;
|
|
222
|
+
const maxRetriesDisplay = Number.isFinite(maxRetries) ? maxRetries : '∞';
|
|
223
|
+
console.log(c.warning(`\n🔄 Review rejected. Restarting RPIV cycle (attempt ${retryCount}/${maxRetriesDisplay})`));
|
|
224
|
+
console.log(c.dim(`Reason: ${reviewResult.feedback.substring(0, 200)}...`));
|
|
225
|
+
resetRPIVCycle(story, reviewResult.feedback);
|
|
226
|
+
console.log(c.info('RPIV cycle reset. Planning phase will restart on next run.'));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else if (reviewResult.decision === ReviewDecision.FAILED) {
|
|
230
|
+
// Review agent failed - don't increment retry count
|
|
231
|
+
console.log(c.error(`\n❌ Review process failed: ${reviewResult.error}`));
|
|
232
|
+
console.log(c.warning('This does not count as a retry attempt. You can retry manually.'));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Check if a stage gate requires approval
|
|
237
|
+
*/
|
|
238
|
+
async checkStageGate(action) {
|
|
239
|
+
if (action.type === 'implement' && isStageGateEnabled('requireApprovalBeforeImplementation')) {
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
if (action.type === 'create_pr' && isStageGateEnabled('requireApprovalBeforePR')) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Format an action for display
|
|
249
|
+
*/
|
|
250
|
+
formatAction(action) {
|
|
251
|
+
const actionVerbs = {
|
|
252
|
+
refine: 'Refining',
|
|
253
|
+
research: 'Researching',
|
|
254
|
+
plan: 'Planning',
|
|
255
|
+
implement: 'Implementing',
|
|
256
|
+
review: 'Reviewing',
|
|
257
|
+
rework: 'Reworking',
|
|
258
|
+
create_pr: 'Creating PR for',
|
|
259
|
+
move_to_done: 'Moving to done',
|
|
260
|
+
};
|
|
261
|
+
const storySlug = action.storyPath.split('/').pop()?.replace('.md', '') || action.storyId;
|
|
262
|
+
return `${actionVerbs[action.type]} "${storySlug}"`;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Create and run the workflow
|
|
267
|
+
*/
|
|
268
|
+
export async function runWorkflow(options = {}) {
|
|
269
|
+
const runner = new WorkflowRunner(options);
|
|
270
|
+
await runner.run();
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAyC,cAAc,EAAiB,MAAM,mBAAmB,CAAC;AACzG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAA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ACf,CAAC;IAED;;OAEG;IACK,YAAY,CAAC,MAAc;QACjC,MAAM,WAAW,GAAmC;YAClD,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,aAAa;YACvB,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,cAAc;YACzB,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,WAAW;YACnB,SAAS,EAAE,iBAAiB;YAC5B,YAAY,EAAE,gBAAgB;SAC/B,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;QAC1F,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,GAAG,CAAC;IACtD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,UAAsB,EAAE;IACxD,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Story, ThemeColors } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get story flags for display
|
|
4
|
+
* Shows which workflow phases are complete
|
|
5
|
+
*
|
|
6
|
+
* @param story - The story to get flags for
|
|
7
|
+
* @param c - Themed chalk instance
|
|
8
|
+
* @returns Formatted flags string (e.g., "[RPIV!]")
|
|
9
|
+
*/
|
|
10
|
+
export declare function getStoryFlags(story: Story, c: ThemeColors): string;
|
|
11
|
+
/**
|
|
12
|
+
* Format status with appropriate color
|
|
13
|
+
*
|
|
14
|
+
* @param status - Status string (backlog, ready, in-progress, done)
|
|
15
|
+
* @param c - Themed chalk instance
|
|
16
|
+
* @returns Colored status string
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatStatus(status: string, c: ThemeColors): string;
|
|
19
|
+
//# sourceMappingURL=story-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story-utils.d.ts","sourceRoot":"","sources":["../../src/cli/story-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,GAAG,MAAM,CAUlE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG,MAAM,CAanE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get story flags for display
|
|
3
|
+
* Shows which workflow phases are complete
|
|
4
|
+
*
|
|
5
|
+
* @param story - The story to get flags for
|
|
6
|
+
* @param c - Themed chalk instance
|
|
7
|
+
* @returns Formatted flags string (e.g., "[RPIV!]")
|
|
8
|
+
*/
|
|
9
|
+
export function getStoryFlags(story, c) {
|
|
10
|
+
const flags = [];
|
|
11
|
+
if (story.frontmatter.research_complete)
|
|
12
|
+
flags.push('R');
|
|
13
|
+
if (story.frontmatter.plan_complete)
|
|
14
|
+
flags.push('P');
|
|
15
|
+
if (story.frontmatter.implementation_complete)
|
|
16
|
+
flags.push('I');
|
|
17
|
+
if (story.frontmatter.reviews_complete)
|
|
18
|
+
flags.push('V');
|
|
19
|
+
if (story.frontmatter.last_error)
|
|
20
|
+
flags.push('!');
|
|
21
|
+
return flags.length > 0 ? `[${flags.join('')}]` : '';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Format status with appropriate color
|
|
25
|
+
*
|
|
26
|
+
* @param status - Status string (backlog, ready, in-progress, done)
|
|
27
|
+
* @param c - Themed chalk instance
|
|
28
|
+
* @returns Colored status string
|
|
29
|
+
*/
|
|
30
|
+
export function formatStatus(status, c) {
|
|
31
|
+
switch (status) {
|
|
32
|
+
case 'backlog':
|
|
33
|
+
return c.backlog(status);
|
|
34
|
+
case 'ready':
|
|
35
|
+
return c.ready(status);
|
|
36
|
+
case 'in-progress':
|
|
37
|
+
return c.inProgress(status);
|
|
38
|
+
case 'done':
|
|
39
|
+
return c.done(status);
|
|
40
|
+
default:
|
|
41
|
+
return status;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=story-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story-utils.js","sourceRoot":"","sources":["../../src/cli/story-utils.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAY,EAAE,CAAc;IACxD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,KAAK,CAAC,WAAW,CAAC,iBAAiB;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,IAAI,KAAK,CAAC,WAAW,CAAC,aAAa;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrD,IAAI,KAAK,CAAC,WAAW,CAAC,uBAAuB;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,WAAW,CAAC,gBAAgB;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,KAAK,CAAC,WAAW,CAAC,UAAU;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAElD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,CAAc;IACzD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,OAAO;YACV,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9B,KAAK,MAAM;YACT,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Story } from '../types/index.js';
|
|
2
|
+
import { ThemeColors } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Render stories as a formatted table
|
|
5
|
+
* Includes error handling to prevent crashes from malformed data
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderStoryTable(stories: Story[], themedChalk: ThemeColors): string;
|
|
8
|
+
/**
|
|
9
|
+
* Render stories in compact view for narrow terminals
|
|
10
|
+
* Uses responsive separator width and sanitized input
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderCompactView(stories: Story[], themedChalk: ThemeColors): string;
|
|
13
|
+
/**
|
|
14
|
+
* Export the shouldUseCompactView function for use in commands
|
|
15
|
+
*/
|
|
16
|
+
export declare function shouldUseCompactView(terminalWidth?: number): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Main render function that chooses between table and compact view
|
|
19
|
+
* Optionally shows a hint when using compact view (can be disabled with env var)
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderStories(stories: Story[], themedChalk: ThemeColors): string;
|
|
22
|
+
//# sourceMappingURL=table-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-renderer.d.ts","sourceRoot":"","sources":["../../src/cli/table-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqEhD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM,CA4CnF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM,CAqCpF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAGpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM,CAahF"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import Table from 'cli-table3';
|
|
2
|
+
import { truncateText, formatLabels, getTerminalWidth, shouldUseCompactView as shouldUseCompact, getColumnWidths, sanitizeInput, } from './formatting.js';
|
|
3
|
+
import { getStoryFlags, formatStatus } from './story-utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create table configuration with themed colors
|
|
6
|
+
*/
|
|
7
|
+
function createTableConfig(themedChalk) {
|
|
8
|
+
return {
|
|
9
|
+
head: ['Story ID', 'Title', 'Status', 'Labels', 'Flags'],
|
|
10
|
+
style: {
|
|
11
|
+
head: [], // We'll apply colors manually
|
|
12
|
+
border: [], // Use default Unicode borders
|
|
13
|
+
compact: false,
|
|
14
|
+
},
|
|
15
|
+
chars: {
|
|
16
|
+
'top': '─',
|
|
17
|
+
'top-mid': '┬',
|
|
18
|
+
'top-left': '┌',
|
|
19
|
+
'top-right': '┐',
|
|
20
|
+
'bottom': '─',
|
|
21
|
+
'bottom-mid': '┴',
|
|
22
|
+
'bottom-left': '└',
|
|
23
|
+
'bottom-right': '┘',
|
|
24
|
+
'left': '│',
|
|
25
|
+
'left-mid': '├',
|
|
26
|
+
'mid': '─',
|
|
27
|
+
'mid-mid': '┼',
|
|
28
|
+
'right': '│',
|
|
29
|
+
'right-mid': '┤',
|
|
30
|
+
'middle': '│'
|
|
31
|
+
},
|
|
32
|
+
colWidths: [], // Will be set dynamically
|
|
33
|
+
wordWrap: false, // We handle truncation manually
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Format a story row for table display
|
|
38
|
+
* Sanitizes all user input to prevent security issues
|
|
39
|
+
*/
|
|
40
|
+
function formatStoryRow(story, columnWidths, themedChalk) {
|
|
41
|
+
// Sanitize and handle missing/empty values
|
|
42
|
+
const id = sanitizeInput(story.frontmatter.id || '(no ID)');
|
|
43
|
+
const title = sanitizeInput(story.frontmatter.title || '(No title)');
|
|
44
|
+
const status = formatStatus(story.frontmatter.status, themedChalk);
|
|
45
|
+
const labels = formatLabels(story.frontmatter.labels || [], columnWidths.labels - 2); // -2 for padding
|
|
46
|
+
const flags = getStoryFlags(story, themedChalk);
|
|
47
|
+
// Truncate title based on column width
|
|
48
|
+
const truncatedTitle = truncateText(title, columnWidths.title - 2); // -2 for padding
|
|
49
|
+
return [
|
|
50
|
+
id,
|
|
51
|
+
truncatedTitle,
|
|
52
|
+
status,
|
|
53
|
+
labels,
|
|
54
|
+
flags,
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Render stories as a formatted table
|
|
59
|
+
* Includes error handling to prevent crashes from malformed data
|
|
60
|
+
*/
|
|
61
|
+
export function renderStoryTable(stories, themedChalk) {
|
|
62
|
+
if (stories.length === 0) {
|
|
63
|
+
return themedChalk.dim(' (empty)');
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const termWidth = getTerminalWidth();
|
|
67
|
+
const columnWidths = getColumnWidths(termWidth);
|
|
68
|
+
// Create table with configuration
|
|
69
|
+
const config = createTableConfig(themedChalk);
|
|
70
|
+
// Set column widths
|
|
71
|
+
config.colWidths = [
|
|
72
|
+
columnWidths.id,
|
|
73
|
+
columnWidths.title,
|
|
74
|
+
columnWidths.status,
|
|
75
|
+
columnWidths.labels,
|
|
76
|
+
columnWidths.flags,
|
|
77
|
+
];
|
|
78
|
+
// Apply theme colors to headers
|
|
79
|
+
if (config.head) {
|
|
80
|
+
config.head = config.head.map((header) => themedChalk.bold(themedChalk.info(header)));
|
|
81
|
+
}
|
|
82
|
+
const table = new Table(config);
|
|
83
|
+
// Add story rows with error handling for each story
|
|
84
|
+
for (const story of stories) {
|
|
85
|
+
try {
|
|
86
|
+
const row = formatStoryRow(story, columnWidths, themedChalk);
|
|
87
|
+
table.push(row);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
// Log error but continue rendering other stories
|
|
91
|
+
console.error(themedChalk.error('Error rendering story, skipping...'));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return table.toString();
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
// Fallback to error message if table rendering fails completely
|
|
98
|
+
return themedChalk.error('Error rendering stories. Please check story data format.');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Render stories in compact view for narrow terminals
|
|
103
|
+
* Uses responsive separator width and sanitized input
|
|
104
|
+
*/
|
|
105
|
+
export function renderCompactView(stories, themedChalk) {
|
|
106
|
+
if (stories.length === 0) {
|
|
107
|
+
return themedChalk.dim(' (empty)');
|
|
108
|
+
}
|
|
109
|
+
const lines = [];
|
|
110
|
+
const termWidth = getTerminalWidth();
|
|
111
|
+
const separatorWidth = Math.min(60, termWidth - 4);
|
|
112
|
+
const separator = themedChalk.dim('─'.repeat(separatorWidth));
|
|
113
|
+
for (const story of stories) {
|
|
114
|
+
// Sanitize all user input (use || to handle empty strings as well)
|
|
115
|
+
const id = sanitizeInput(story.frontmatter.id || '(no ID)');
|
|
116
|
+
const title = sanitizeInput(story.frontmatter.title || '(No title)');
|
|
117
|
+
const status = formatStatus(story.frontmatter.status, themedChalk);
|
|
118
|
+
const labels = formatLabels(story.frontmatter.labels || [], 40);
|
|
119
|
+
const flags = getStoryFlags(story, themedChalk);
|
|
120
|
+
// Truncate title for compact view
|
|
121
|
+
const truncatedTitle = truncateText(title, 60);
|
|
122
|
+
// Format compact display
|
|
123
|
+
lines.push(`${themedChalk.dim('ID:')} ${id} ${themedChalk.dim('|')} ${themedChalk.dim('Status:')} ${status}`);
|
|
124
|
+
lines.push(`${themedChalk.dim('Title:')} ${truncatedTitle}`);
|
|
125
|
+
if (labels || flags) {
|
|
126
|
+
const labelPart = labels ? `${themedChalk.dim('Labels:')} ${labels}` : '';
|
|
127
|
+
const flagPart = flags ? `${themedChalk.dim('Flags:')} ${flags}` : '';
|
|
128
|
+
const divider = labelPart && flagPart ? ` ${themedChalk.dim('|')} ` : '';
|
|
129
|
+
lines.push(labelPart + divider + flagPart);
|
|
130
|
+
}
|
|
131
|
+
lines.push(separator);
|
|
132
|
+
}
|
|
133
|
+
// Indent all lines for consistency with status output
|
|
134
|
+
return lines.map(line => ` ${line}`).join('\n');
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Export the shouldUseCompactView function for use in commands
|
|
138
|
+
*/
|
|
139
|
+
export function shouldUseCompactView(terminalWidth) {
|
|
140
|
+
const width = terminalWidth ?? getTerminalWidth();
|
|
141
|
+
return shouldUseCompact(width);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Main render function that chooses between table and compact view
|
|
145
|
+
* Optionally shows a hint when using compact view (can be disabled with env var)
|
|
146
|
+
*/
|
|
147
|
+
export function renderStories(stories, themedChalk) {
|
|
148
|
+
const termWidth = getTerminalWidth();
|
|
149
|
+
if (shouldUseCompact(termWidth)) {
|
|
150
|
+
// Optional: Add subtle hint about compact view (can be disabled with env var)
|
|
151
|
+
const showHint = process.env.AGENTIC_SDLC_NO_HINTS !== '1';
|
|
152
|
+
const hint = showHint
|
|
153
|
+
? themedChalk.dim(` (Compact view: terminal width ${termWidth} < 100 cols)\n\n`)
|
|
154
|
+
: '';
|
|
155
|
+
return hint + renderCompactView(stories, themedChalk);
|
|
156
|
+
}
|
|
157
|
+
return renderStoryTable(stories, themedChalk);
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=table-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-renderer.js","sourceRoot":"","sources":["../../src/cli/table-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAI/B,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,IAAI,gBAAgB,EACxC,eAAe,EACf,aAAa,GAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;GAEG;AACH,SAAS,iBAAiB,CAAC,WAAwB;IACjD,OAAO;QACL,IAAI,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC;QACxD,KAAK,EAAE;YACL,IAAI,EAAE,EAAE,EAAE,8BAA8B;YACxC,MAAM,EAAE,EAAE,EAAE,8BAA8B;YAC1C,OAAO,EAAE,KAAK;SACf;QACD,KAAK,EAAE;YACL,KAAK,EAAE,GAAG;YACV,SAAS,EAAE,GAAG;YACd,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,GAAG;YAChB,QAAQ,EAAE,GAAG;YACb,YAAY,EAAE,GAAG;YACjB,aAAa,EAAE,GAAG;YAClB,cAAc,EAAE,GAAG;YACnB,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,GAAG;YACf,KAAK,EAAE,GAAG;YACV,SAAS,EAAE,GAAG;YACd,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,GAAG;YAChB,QAAQ,EAAE,GAAG;SACd;QACD,SAAS,EAAE,EAAE,EAAE,0BAA0B;QACzC,QAAQ,EAAE,KAAK,EAAE,gCAAgC;KAClD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,KAAY,EAAE,YAA0B,EAAE,WAAwB;IACxF,2CAA2C;IAC3C,M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+
export type CredentialType = 'api_key' | 'oauth_token' | 'none';
|
|
2
|
+
/**
|
|
3
|
+
* Get API key/token from various sources in order of preference:
|
|
4
|
+
* 1. ANTHROPIC_API_KEY environment variable (direct API key)
|
|
5
|
+
* 2. CLAUDE_CODE_OAUTH_TOKEN environment variable (OAuth token)
|
|
6
|
+
* 3. macOS Keychain (Claude Code credentials)
|
|
7
|
+
*/
|
|
8
|
+
export declare function getApiKey(): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Check if the API key is an OAuth token
|
|
11
|
+
*/
|
|
12
|
+
export declare function isOAuthToken(key: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Check if the API key is a direct API key
|
|
15
|
+
*/
|
|
16
|
+
export declare function isDirectApiKey(key: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the credential type for a given key
|
|
19
|
+
*/
|
|
20
|
+
export declare function getCredentialType(key: string | null): CredentialType;
|
|
21
|
+
/**
|
|
22
|
+
* Configure environment variables for the Agent SDK based on credential type.
|
|
23
|
+
* The Agent SDK uses:
|
|
24
|
+
* - ANTHROPIC_API_KEY for direct API keys
|
|
25
|
+
* - CLAUDE_CODE_OAUTH_TOKEN for OAuth tokens
|
|
26
|
+
*/
|
|
27
|
+
export declare function configureAgentSdkAuth(): {
|
|
28
|
+
configured: boolean;
|
|
29
|
+
type: CredentialType;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Check if API key is available from any source
|
|
33
|
+
*/
|
|
34
|
+
export declare function hasApiKey(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Get the source of the API key (for display purposes)
|
|
37
|
+
*/
|
|
38
|
+
export declare function getApiKeySource(): 'env' | 'keychain' | 'none';
|
|
39
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,aAAa,GAAG,MAAM,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,IAAI,CAmBzC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,cAAc,CAIpE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,cAAc,CAAA;CAAE,CAoBrF;AA0CD;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,KAAK,GAAG,UAAU,GAAG,MAAM,CAa7D"}
|