aiag-cli 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.
- package/LICENSE +41 -0
- package/README.md +150 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +80 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/commit.d.ts +6 -0
- package/dist/commands/commit.d.ts.map +1 -0
- package/dist/commands/commit.js +90 -0
- package/dist/commands/commit.js.map +1 -0
- package/dist/commands/complete.d.ts +6 -0
- package/dist/commands/complete.d.ts.map +1 -0
- package/dist/commands/complete.js +73 -0
- package/dist/commands/complete.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +164 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/next.d.ts +7 -0
- package/dist/commands/next.d.ts.map +1 -0
- package/dist/commands/next.js +77 -0
- package/dist/commands/next.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +65 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +78 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/test.d.ts +7 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +170 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/agentSelection.d.ts +28 -0
- package/dist/utils/agentSelection.d.ts.map +1 -0
- package/dist/utils/agentSelection.js +66 -0
- package/dist/utils/agentSelection.js.map +1 -0
- package/dist/utils/featureList.d.ts +109 -0
- package/dist/utils/featureList.d.ts.map +1 -0
- package/dist/utils/featureList.js +465 -0
- package/dist/utils/featureList.js.map +1 -0
- package/dist/utils/output.d.ts +71 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +115 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/progress.d.ts +31 -0
- package/dist/utils/progress.d.ts.map +1 -0
- package/dist/utils/progress.js +165 -0
- package/dist/utils/progress.js.map +1 -0
- package/dist/utils/prompts.d.ts +50 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/prompts.js +111 -0
- package/dist/utils/prompts.js.map +1 -0
- package/package.json +56 -0
- package/templates/coding.md +142 -0
- package/templates/initializer.md +125 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output utilities for CLI
|
|
3
|
+
*/
|
|
4
|
+
export declare const colors: {
|
|
5
|
+
success: import("chalk").ChalkInstance;
|
|
6
|
+
error: import("chalk").ChalkInstance;
|
|
7
|
+
warning: import("chalk").ChalkInstance;
|
|
8
|
+
info: import("chalk").ChalkInstance;
|
|
9
|
+
dim: import("chalk").ChalkInstance;
|
|
10
|
+
bold: import("chalk").ChalkInstance;
|
|
11
|
+
};
|
|
12
|
+
export declare const icons: {
|
|
13
|
+
success: string;
|
|
14
|
+
error: string;
|
|
15
|
+
warning: string;
|
|
16
|
+
info: string;
|
|
17
|
+
arrow: string;
|
|
18
|
+
bullet: string;
|
|
19
|
+
checkbox: {
|
|
20
|
+
checked: string;
|
|
21
|
+
unchecked: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Create a progress bar string
|
|
26
|
+
*/
|
|
27
|
+
export declare function progressBar(percentage: number, width?: number, filled?: string, empty?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Format a feature for display
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatFeature(feature: {
|
|
32
|
+
id: string;
|
|
33
|
+
category: string;
|
|
34
|
+
priority: string;
|
|
35
|
+
description: string;
|
|
36
|
+
acceptanceCriteria: string[];
|
|
37
|
+
passes: boolean;
|
|
38
|
+
}): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get color for priority
|
|
41
|
+
*/
|
|
42
|
+
export declare function getPriorityColor(priority: string): (text: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Print a header
|
|
45
|
+
*/
|
|
46
|
+
export declare function printHeader(title: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Print a section
|
|
49
|
+
*/
|
|
50
|
+
export declare function printSection(title: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Print success message
|
|
53
|
+
*/
|
|
54
|
+
export declare function printSuccess(message: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Print error message
|
|
57
|
+
*/
|
|
58
|
+
export declare function printError(message: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Print warning message
|
|
61
|
+
*/
|
|
62
|
+
export declare function printWarning(message: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Print info message
|
|
65
|
+
*/
|
|
66
|
+
export declare function printInfo(message: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Print a key-value pair
|
|
69
|
+
*/
|
|
70
|
+
export declare function printKeyValue(key: string, value: string | number): void;
|
|
71
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;CAWjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAY,EACpB,KAAK,GAAE,MAAY,GAClB,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,MAAM,CAiBT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAa3E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAI/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEvE"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Output utilities for CLI
|
|
4
|
+
*/
|
|
5
|
+
export const colors = {
|
|
6
|
+
success: chalk.green,
|
|
7
|
+
error: chalk.red,
|
|
8
|
+
warning: chalk.yellow,
|
|
9
|
+
info: chalk.blue,
|
|
10
|
+
dim: chalk.dim,
|
|
11
|
+
bold: chalk.bold,
|
|
12
|
+
};
|
|
13
|
+
export const icons = {
|
|
14
|
+
success: chalk.green('✓'),
|
|
15
|
+
error: chalk.red('✗'),
|
|
16
|
+
warning: chalk.yellow('!'),
|
|
17
|
+
info: chalk.blue('ℹ'),
|
|
18
|
+
arrow: chalk.cyan('→'),
|
|
19
|
+
bullet: chalk.dim('•'),
|
|
20
|
+
checkbox: {
|
|
21
|
+
checked: chalk.green('[x]'),
|
|
22
|
+
unchecked: chalk.dim('[ ]'),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Create a progress bar string
|
|
27
|
+
*/
|
|
28
|
+
export function progressBar(percentage, width = 20, filled = '█', empty = '░') {
|
|
29
|
+
const filledCount = Math.round((percentage / 100) * width);
|
|
30
|
+
const emptyCount = width - filledCount;
|
|
31
|
+
const filledStr = colors.success(filled.repeat(filledCount));
|
|
32
|
+
const emptyStr = colors.dim(empty.repeat(emptyCount));
|
|
33
|
+
return `${filledStr}${emptyStr}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Format a feature for display
|
|
37
|
+
*/
|
|
38
|
+
export function formatFeature(feature) {
|
|
39
|
+
const statusIcon = feature.passes ? icons.success : icons.checkbox.unchecked;
|
|
40
|
+
const priorityColor = getPriorityColor(feature.priority);
|
|
41
|
+
const lines = [
|
|
42
|
+
`${statusIcon} ${colors.bold(feature.id)}: ${feature.description}`,
|
|
43
|
+
` ${colors.dim('Category:')} ${feature.category} ${colors.dim('Priority:')} ${priorityColor(feature.priority)}`,
|
|
44
|
+
];
|
|
45
|
+
if (feature.acceptanceCriteria.length > 0) {
|
|
46
|
+
lines.push(` ${colors.dim('Acceptance Criteria:')}`);
|
|
47
|
+
for (const criteria of feature.acceptanceCriteria) {
|
|
48
|
+
lines.push(` ${icons.bullet} ${criteria}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return lines.join('\n');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get color for priority
|
|
55
|
+
*/
|
|
56
|
+
export function getPriorityColor(priority) {
|
|
57
|
+
switch (priority) {
|
|
58
|
+
case 'critical':
|
|
59
|
+
return chalk.red;
|
|
60
|
+
case 'high':
|
|
61
|
+
return chalk.yellow;
|
|
62
|
+
case 'medium':
|
|
63
|
+
return chalk.blue;
|
|
64
|
+
case 'low':
|
|
65
|
+
return chalk.dim;
|
|
66
|
+
default:
|
|
67
|
+
return chalk.white;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Print a header
|
|
72
|
+
*/
|
|
73
|
+
export function printHeader(title) {
|
|
74
|
+
console.log('');
|
|
75
|
+
console.log(colors.bold(colors.info(title)));
|
|
76
|
+
console.log(colors.dim('─'.repeat(title.length + 4)));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Print a section
|
|
80
|
+
*/
|
|
81
|
+
export function printSection(title) {
|
|
82
|
+
console.log('');
|
|
83
|
+
console.log(colors.bold(title));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Print success message
|
|
87
|
+
*/
|
|
88
|
+
export function printSuccess(message) {
|
|
89
|
+
console.log(`${icons.success} ${message}`);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Print error message
|
|
93
|
+
*/
|
|
94
|
+
export function printError(message) {
|
|
95
|
+
console.log(`${icons.error} ${colors.error(message)}`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Print warning message
|
|
99
|
+
*/
|
|
100
|
+
export function printWarning(message) {
|
|
101
|
+
console.log(`${icons.warning} ${colors.warning(message)}`);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Print info message
|
|
105
|
+
*/
|
|
106
|
+
export function printInfo(message) {
|
|
107
|
+
console.log(`${icons.info} ${message}`);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Print a key-value pair
|
|
111
|
+
*/
|
|
112
|
+
export function printKeyValue(key, value) {
|
|
113
|
+
console.log(` ${colors.dim(key + ':')} ${value}`);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=output.js.map
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AK,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,KAAsB;IAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the path to progress.md
|
|
3
|
+
*/
|
|
4
|
+
export declare function getProgressPath(baseDir?: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Read progress.md content
|
|
7
|
+
*/
|
|
8
|
+
export declare function readProgress(baseDir?: string): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Get the last session from progress.md
|
|
11
|
+
*/
|
|
12
|
+
export declare function getLastSession(baseDir?: string): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Append a new session to progress.md
|
|
15
|
+
*/
|
|
16
|
+
export declare function appendSession(session: {
|
|
17
|
+
context: string[];
|
|
18
|
+
workDone: string[];
|
|
19
|
+
commits: string[];
|
|
20
|
+
nextSession: string[];
|
|
21
|
+
notes: string[];
|
|
22
|
+
}, baseDir?: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Update the "Last Updated" date in progress.md
|
|
25
|
+
*/
|
|
26
|
+
export declare function updateLastUpdated(baseDir?: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Create initial progress.md
|
|
29
|
+
*/
|
|
30
|
+
export declare function createProgress(projectName: string, description: string, baseDir?: string): boolean;
|
|
31
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/utils/progress.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,MAAsB,GAAG,MAAM,CAEvE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAa3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAe7E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE;IACP,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,EACD,OAAO,GAAE,MAAsB,GAC9B,OAAO,CAiDT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAoB1E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAsB,GAC9B,OAAO,CA+CT"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
const AIAG_DIR = '.aiag';
|
|
4
|
+
const PROGRESS_FILE = 'progress.md';
|
|
5
|
+
/**
|
|
6
|
+
* Get the path to progress.md
|
|
7
|
+
*/
|
|
8
|
+
export function getProgressPath(baseDir = process.cwd()) {
|
|
9
|
+
return path.join(baseDir, AIAG_DIR, PROGRESS_FILE);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Read progress.md content
|
|
13
|
+
*/
|
|
14
|
+
export function readProgress(baseDir = process.cwd()) {
|
|
15
|
+
const filePath = getProgressPath(baseDir);
|
|
16
|
+
if (!fs.existsSync(filePath)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error('Error reading progress.md:', error);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the last session from progress.md
|
|
29
|
+
*/
|
|
30
|
+
export function getLastSession(baseDir = process.cwd()) {
|
|
31
|
+
const content = readProgress(baseDir);
|
|
32
|
+
if (!content)
|
|
33
|
+
return null;
|
|
34
|
+
// Split by session markers
|
|
35
|
+
const sessions = content.split(/^---$/m);
|
|
36
|
+
// Find the first actual session (skip header)
|
|
37
|
+
for (const session of sessions) {
|
|
38
|
+
if (session.includes('## Session:')) {
|
|
39
|
+
return session.trim();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Append a new session to progress.md
|
|
46
|
+
*/
|
|
47
|
+
export function appendSession(session, baseDir = process.cwd()) {
|
|
48
|
+
const filePath = getProgressPath(baseDir);
|
|
49
|
+
if (!fs.existsSync(filePath)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
54
|
+
const timestamp = new Date().toISOString();
|
|
55
|
+
const newSession = `
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Session: ${timestamp}
|
|
59
|
+
|
|
60
|
+
### Context
|
|
61
|
+
${session.context.map((c) => `- ${c}`).join('\n')}
|
|
62
|
+
|
|
63
|
+
### Work Done
|
|
64
|
+
${session.workDone.map((w) => `- ${w}`).join('\n')}
|
|
65
|
+
|
|
66
|
+
### Commits
|
|
67
|
+
${session.commits.map((c) => `- ${c}`).join('\n')}
|
|
68
|
+
|
|
69
|
+
### Next Session
|
|
70
|
+
${session.nextSession.map((n) => `- ${n}`).join('\n')}
|
|
71
|
+
|
|
72
|
+
### Notes
|
|
73
|
+
${session.notes.length > 0 ? session.notes.map((n) => `- ${n}`).join('\n') : '- (none)'}
|
|
74
|
+
`;
|
|
75
|
+
// Find the position after the header section (after the first ---)
|
|
76
|
+
const headerEndIndex = content.indexOf('---');
|
|
77
|
+
if (headerEndIndex === -1) {
|
|
78
|
+
// No header found, append at the end
|
|
79
|
+
fs.writeFileSync(filePath, content + newSession, 'utf-8');
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// Insert after the header
|
|
83
|
+
const header = content.substring(0, headerEndIndex + 3);
|
|
84
|
+
const rest = content.substring(headerEndIndex + 3);
|
|
85
|
+
fs.writeFileSync(filePath, header + newSession + rest, 'utf-8');
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error('Error appending to progress.md:', error);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Update the "Last Updated" date in progress.md
|
|
96
|
+
*/
|
|
97
|
+
export function updateLastUpdated(baseDir = process.cwd()) {
|
|
98
|
+
const filePath = getProgressPath(baseDir);
|
|
99
|
+
if (!fs.existsSync(filePath)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
let content = fs.readFileSync(filePath, 'utf-8');
|
|
104
|
+
const today = new Date().toISOString().split('T')[0];
|
|
105
|
+
// Replace Last Updated line
|
|
106
|
+
content = content.replace(/\*\*Last Updated:\*\* .*/, `**Last Updated:** ${today}`);
|
|
107
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
console.error('Error updating progress.md:', error);
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Create initial progress.md
|
|
117
|
+
*/
|
|
118
|
+
export function createProgress(projectName, description, baseDir = process.cwd()) {
|
|
119
|
+
const filePath = getProgressPath(baseDir);
|
|
120
|
+
const today = new Date().toISOString().split('T')[0];
|
|
121
|
+
const content = `# AIAG Progress Log
|
|
122
|
+
|
|
123
|
+
## Project: ${projectName}
|
|
124
|
+
|
|
125
|
+
**Description:** ${description}
|
|
126
|
+
|
|
127
|
+
**Started:** ${today}
|
|
128
|
+
**Last Updated:** ${today}
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Session: ${new Date().toISOString()}
|
|
133
|
+
|
|
134
|
+
### Context
|
|
135
|
+
- Project initialized
|
|
136
|
+
- AIAG harness structure created
|
|
137
|
+
|
|
138
|
+
### Work Done
|
|
139
|
+
- [x] Created .aiag/ directory structure
|
|
140
|
+
- [x] Generated feature_list.json
|
|
141
|
+
- [x] Initialized progress.md
|
|
142
|
+
- [x] Created init.sh
|
|
143
|
+
|
|
144
|
+
### Commits
|
|
145
|
+
- (Initial setup)
|
|
146
|
+
|
|
147
|
+
### Next Session
|
|
148
|
+
- Start implementing features
|
|
149
|
+
- Run 'aiag next' to see first feature
|
|
150
|
+
|
|
151
|
+
### Notes
|
|
152
|
+
- Project ready for development
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
`;
|
|
156
|
+
try {
|
|
157
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error('Error creating progress.md:', error);
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/utils/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,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,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,WAAmB,EACnB,WAAmB,EACnB,UAAkB,OAAO,CAAC,GAAG,EAAE;IAE/B,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,MAAM,OAAO,GAAG;;cAEJ,WAAW;;mBAEN,WAAW;;eAEf,KAAK;oBACA,KAAK;;;;cAIX,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;CAuBrC,CAAC;IAEA,IAAI,CAAC;QACH,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface PromptOptions {
|
|
2
|
+
default?: string;
|
|
3
|
+
validate?: (input: string) => boolean | string;
|
|
4
|
+
}
|
|
5
|
+
export interface ConfirmOptions {
|
|
6
|
+
default?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface SelectOption {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ReadlineInterface {
|
|
13
|
+
question(query: string, callback: (answer: string) => void): void;
|
|
14
|
+
close(): void;
|
|
15
|
+
}
|
|
16
|
+
export type CreateInterfaceFn = () => ReadlineInterface;
|
|
17
|
+
/**
|
|
18
|
+
* Set custom readline factory for testing
|
|
19
|
+
*/
|
|
20
|
+
export declare function setReadlineFactory(factory: CreateInterfaceFn | null): void;
|
|
21
|
+
/**
|
|
22
|
+
* Ask a question and get user input
|
|
23
|
+
*/
|
|
24
|
+
export declare function prompt(question: string, options?: PromptOptions): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Ask for confirmation (yes/no)
|
|
27
|
+
*/
|
|
28
|
+
export declare function confirm(question: string, options?: ConfirmOptions): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Select from a list of options
|
|
31
|
+
*/
|
|
32
|
+
export declare function select(question: string, choices: SelectOption[]): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Project info prompts for init command
|
|
35
|
+
*/
|
|
36
|
+
export interface ProjectInfo {
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
description: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function promptProjectInfo(defaults?: Partial<ProjectInfo>): Promise<ProjectInfo>;
|
|
42
|
+
/**
|
|
43
|
+
* Confirmation prompt for complete command
|
|
44
|
+
*/
|
|
45
|
+
export declare function confirmComplete(featureId: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Check if running in interactive mode (TTY)
|
|
48
|
+
*/
|
|
49
|
+
export declare function isInteractive(): boolean;
|
|
50
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/utils/prompts.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAC;CAChD;A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 @@
|
|
|
1
|
+
import * as readline from 'readline';
|
|
2
|
+
// Default factory uses real readline
|
|
3
|
+
let createInterfaceFn = () => readline.createInterface({
|
|
4
|
+
input: process.stdin,
|
|
5
|
+
output: process.stdout,
|
|
6
|
+
});
|
|
7
|
+
/**
|
|
8
|
+
* Set custom readline factory for testing
|
|
9
|
+
*/
|
|
10
|
+
export function setReadlineFactory(factory) {
|
|
11
|
+
if (factory === null) {
|
|
12
|
+
createInterfaceFn = () => readline.createInterface({
|
|
13
|
+
input: process.stdin,
|
|
14
|
+
output: process.stdout,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
createInterfaceFn = factory;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Ask a question and get user input
|
|
23
|
+
*/
|
|
24
|
+
export async function prompt(question, options = {}) {
|
|
25
|
+
const rl = createInterfaceFn();
|
|
26
|
+
const defaultText = options.default ? ` (${options.default})` : '';
|
|
27
|
+
const fullQuestion = `${question}${defaultText}: `;
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
rl.question(fullQuestion, (answer) => {
|
|
30
|
+
rl.close();
|
|
31
|
+
const result = answer.trim() || options.default || '';
|
|
32
|
+
if (options.validate) {
|
|
33
|
+
const validation = options.validate(result);
|
|
34
|
+
if (validation !== true) {
|
|
35
|
+
const errorMessage = typeof validation === 'string' ? validation : 'Invalid input';
|
|
36
|
+
console.error(errorMessage);
|
|
37
|
+
resolve(prompt(question, options));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
resolve(result);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Ask for confirmation (yes/no)
|
|
47
|
+
*/
|
|
48
|
+
export async function confirm(question, options = {}) {
|
|
49
|
+
const defaultText = options.default === undefined ? '' : options.default ? ' (Y/n)' : ' (y/N)';
|
|
50
|
+
const fullQuestion = `${question}${defaultText}: `;
|
|
51
|
+
const rl = createInterfaceFn();
|
|
52
|
+
return new Promise((resolve) => {
|
|
53
|
+
rl.question(fullQuestion, (answer) => {
|
|
54
|
+
rl.close();
|
|
55
|
+
const trimmed = answer.trim().toLowerCase();
|
|
56
|
+
if (trimmed === '') {
|
|
57
|
+
resolve(options.default ?? false);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
resolve(trimmed === 'y' || trimmed === 'yes');
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Select from a list of options
|
|
66
|
+
*/
|
|
67
|
+
export async function select(question, choices) {
|
|
68
|
+
console.log(question);
|
|
69
|
+
choices.forEach((choice, index) => {
|
|
70
|
+
console.log(` ${index + 1}. ${choice.label}`);
|
|
71
|
+
});
|
|
72
|
+
const rl = createInterfaceFn();
|
|
73
|
+
return new Promise((resolve) => {
|
|
74
|
+
rl.question('Enter number: ', (answer) => {
|
|
75
|
+
rl.close();
|
|
76
|
+
const num = parseInt(answer.trim(), 10);
|
|
77
|
+
if (num >= 1 && num <= choices.length) {
|
|
78
|
+
resolve(choices[num - 1].value);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
console.error('Invalid selection. Please try again.');
|
|
82
|
+
resolve(select(question, choices));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export async function promptProjectInfo(defaults = {}) {
|
|
87
|
+
const name = await prompt('Project name', {
|
|
88
|
+
default: defaults.name,
|
|
89
|
+
validate: (input) => input.length > 0 || 'Project name is required',
|
|
90
|
+
});
|
|
91
|
+
const version = await prompt('Version', {
|
|
92
|
+
default: defaults.version || '1.0.0',
|
|
93
|
+
});
|
|
94
|
+
const description = await prompt('Description', {
|
|
95
|
+
default: defaults.description || '',
|
|
96
|
+
});
|
|
97
|
+
return { name, version, description };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Confirmation prompt for complete command
|
|
101
|
+
*/
|
|
102
|
+
export async function confirmComplete(featureId) {
|
|
103
|
+
return confirm(`Mark feature ${featureId} as complete?`, { default: true });
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Check if running in interactive mode (TTY)
|
|
107
|
+
*/
|
|
108
|
+
export function isInteractive() {
|
|
109
|
+
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/utils/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAwBrC,qCAAqC;AACrC,IAAI,iBAAiB,GAAsB,GAAG,EAAE,CAC9C,QAAQ,CAAC,eAAe,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CAAC;AAEL;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAiC;IAClE,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,iBAAiB,GAAG,GAAG,EAAE,CACvB,QAAQ,CAAC,eAAe,CAAC;YACvB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACP,CAAC;SAAM,CAAC;QACN,iBAAiB,GAAG,OAAO,CAAC;IAC9B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,QAAgB,EAAE,UAAyB,EAAE;IACxE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAE/B,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,MAAM,YAAY,GAAG,GAAG,QAAQ,GAAG,WAAW,IAAI,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AAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAWD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,WAAiC,EAAE;IACzE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE;QACxC,OAAO,EAAE,QAAQ,CAAC,IAAI;QACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,0BAA0B;KACpE,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE;QACtC,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,OAAO;KACrC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,aAAa,EAAE;QAC9C,OAAO,EAAE,QAAQ,CAAC,WAAW,IAAI,EAAE;KACpC,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,OAAO,OAAO,CAAC,gBAAgB,SAAS,eAAe,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;AACvE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aiag-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AI Agent Harness CLI - Long-running agent development tool based on Anthropic's approach",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"aiag": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"templates",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"start": "node dist/cli.js",
|
|
21
|
+
"prepublishOnly": "npm run build",
|
|
22
|
+
"test": "bun test"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ai",
|
|
26
|
+
"agent",
|
|
27
|
+
"cli",
|
|
28
|
+
"anthropic",
|
|
29
|
+
"claude",
|
|
30
|
+
"harness",
|
|
31
|
+
"long-running-agent",
|
|
32
|
+
"development-tool"
|
|
33
|
+
],
|
|
34
|
+
"author": "",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/gibanio/aiag-cli.git"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/gibanio/aiag-cli#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/gibanio/aiag-cli/issues"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"commander": "^11.1.0",
|
|
49
|
+
"chalk": "^5.3.0",
|
|
50
|
+
"ora": "^8.0.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^20.10.0",
|
|
54
|
+
"typescript": "^5.3.0"
|
|
55
|
+
}
|
|
56
|
+
}
|