bytarch-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.genie-cli/config.json +7 -0
- package/.genie-cli/plan.json +10 -0
- package/bin/bytarch-cli.js +3 -0
- package/dist/commands/apply.d.ts +9 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +118 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/config.d.ts +14 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +189 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/edit.d.ts +8 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +152 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +89 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/plan.d.ts +10 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +173 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/review.d.ts +13 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +240 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/status.d.ts +9 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +122 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/fs/patcher.d.ts +19 -0
- package/dist/fs/patcher.d.ts.map +1 -0
- package/dist/fs/patcher.js +210 -0
- package/dist/fs/patcher.js.map +1 -0
- package/dist/fs/safe-readwrite.d.ts +20 -0
- package/dist/fs/safe-readwrite.d.ts.map +1 -0
- package/dist/fs/safe-readwrite.js +146 -0
- package/dist/fs/safe-readwrite.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/provider/bytarch.d.ts +26 -0
- package/dist/provider/bytarch.d.ts.map +1 -0
- package/dist/provider/bytarch.js +54 -0
- package/dist/provider/bytarch.js.map +1 -0
- package/dist/provider/evaluation.d.ts +5 -0
- package/dist/provider/evaluation.d.ts.map +1 -0
- package/dist/provider/evaluation.js +40 -0
- package/dist/provider/evaluation.js.map +1 -0
- package/dist/provider/prompts.d.ts +4 -0
- package/dist/provider/prompts.d.ts.map +1 -0
- package/dist/provider/prompts.js +61 -0
- package/dist/provider/prompts.js.map +1 -0
- package/dist/ui/prompts.d.ts +43 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +122 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/workspace/config.d.ts +19 -0
- package/dist/workspace/config.d.ts.map +1 -0
- package/dist/workspace/config.js +102 -0
- package/dist/workspace/config.js.map +1 -0
- package/dist/workspace/edits.d.ts +24 -0
- package/dist/workspace/edits.d.ts.map +1 -0
- package/dist/workspace/edits.js +119 -0
- package/dist/workspace/edits.js.map +1 -0
- package/dist/workspace/plan.d.ts +29 -0
- package/dist/workspace/plan.d.ts.map +1 -0
- package/dist/workspace/plan.js +101 -0
- package/dist/workspace/plan.js.map +1 -0
- package/package.json +52 -0
- package/src/commands/apply.ts +91 -0
- package/src/commands/config.ts +194 -0
- package/src/commands/edit.ts +133 -0
- package/src/commands/init.ts +62 -0
- package/src/commands/plan.ts +163 -0
- package/src/commands/review.ts +242 -0
- package/src/commands/status.ts +101 -0
- package/src/fs/patcher.ts +188 -0
- package/src/fs/safe-readwrite.ts +141 -0
- package/src/index.ts +123 -0
- package/src/provider/bytarch.ts +75 -0
- package/src/provider/evaluation.ts +39 -0
- package/src/provider/prompts.ts +59 -0
- package/src/ui/prompts.ts +163 -0
- package/src/workspace/config.ts +86 -0
- package/src/workspace/edits.ts +106 -0
- package/src/workspace/plan.ts +92 -0
- package/tsconfig.json +36 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const init_1 = require("./commands/init");
|
|
10
|
+
const plan_1 = require("./commands/plan");
|
|
11
|
+
const edit_1 = require("./commands/edit");
|
|
12
|
+
const review_1 = require("./commands/review");
|
|
13
|
+
const apply_1 = require("./commands/apply");
|
|
14
|
+
const status_1 = require("./commands/status");
|
|
15
|
+
const config_1 = require("./commands/config");
|
|
16
|
+
const program = new commander_1.Command();
|
|
17
|
+
program
|
|
18
|
+
.name('bytarch-cli')
|
|
19
|
+
.description('AI-powered CLI for project planning and code editing using BYTARCH')
|
|
20
|
+
.version('0.1.0');
|
|
21
|
+
program
|
|
22
|
+
.command('init')
|
|
23
|
+
.description('Initialize a .genie-cli workspace')
|
|
24
|
+
.option('-f, --force', 'Force initialization even if workspace already exists')
|
|
25
|
+
.action(async (options) => {
|
|
26
|
+
try {
|
|
27
|
+
await init_1.InitCommand.execute(options);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
program
|
|
35
|
+
.command('plan')
|
|
36
|
+
.description('Generate a project plan using AI')
|
|
37
|
+
.argument('[description]', 'Project description or goal')
|
|
38
|
+
.option('-c, --context <file>', 'Provide additional context from a file')
|
|
39
|
+
.option('-a, --analyze', 'Analyze current repository before planning')
|
|
40
|
+
.action(async (description, options) => {
|
|
41
|
+
try {
|
|
42
|
+
await plan_1.PlanCommand.execute(description, options);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
program
|
|
50
|
+
.command('edit')
|
|
51
|
+
.description('Propose edits to a file using AI')
|
|
52
|
+
.argument('<path>', 'File path to edit')
|
|
53
|
+
.argument('[request]', 'Description of changes to make')
|
|
54
|
+
.option('-d, --description <desc>', 'Description of the changes')
|
|
55
|
+
.action(async (filePath, request, options) => {
|
|
56
|
+
try {
|
|
57
|
+
await edit_1.EditCommand.execute(filePath, request, options);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
program
|
|
65
|
+
.command('review')
|
|
66
|
+
.description('Review and manage pending edits and plan')
|
|
67
|
+
.option('-p, --plan', 'Show only plan items')
|
|
68
|
+
.option('-e, --edits', 'Show only pending edits')
|
|
69
|
+
.action(async (options) => {
|
|
70
|
+
try {
|
|
71
|
+
await review_1.ReviewCommand.execute(options);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
program
|
|
79
|
+
.command('apply')
|
|
80
|
+
.description('Apply accepted edits (dry-run by default)')
|
|
81
|
+
.option('-f, --force', 'Apply edits without confirmation (use with caution)')
|
|
82
|
+
.option('-d, --dry-run', 'Show what would be applied without making changes')
|
|
83
|
+
.option('-i, --ids <ids>', 'Apply only specific edit IDs (comma-separated)')
|
|
84
|
+
.action(async (options) => {
|
|
85
|
+
try {
|
|
86
|
+
await apply_1.ApplyCommand.execute(options);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
program
|
|
94
|
+
.command('status')
|
|
95
|
+
.description('Show workspace and plan status')
|
|
96
|
+
.option('-v, --verbose', 'Show detailed information')
|
|
97
|
+
.action(async (options) => {
|
|
98
|
+
try {
|
|
99
|
+
await status_1.StatusCommand.execute(options);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
program
|
|
107
|
+
.command('config')
|
|
108
|
+
.description('Manage configuration')
|
|
109
|
+
.option('-s, --set <key=value>', 'Set configuration value')
|
|
110
|
+
.option('-g, --get <key>', 'Get configuration value')
|
|
111
|
+
.option('-l, --list', 'List all configuration')
|
|
112
|
+
.option('--set-api-key <key>', 'Set BYTARCH API key')
|
|
113
|
+
.action(async (options) => {
|
|
114
|
+
try {
|
|
115
|
+
await config_1.ConfigCommand.execute(options);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
program.parse();
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AAEpC,kDAA0B;AAE1B,0CAA8C;AAC9C,0CAA8C;AAC9C,0CAA8C;AAC9C,8CAAkD;AAClD,4CAAgD;AAChD,8CAAkD;AAClD,8CAAkD;AAElD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,oEAAoE,CAAC;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MAAM,CAAC,uBAAuB,EAAE,yBAAyB,CAAC;KAC1D,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;KACpD,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAAC;KAC9C,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;KACpD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,IAAI,CAAC;QACH,MAAM,sBAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAC7F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface ChatMessage {
|
|
2
|
+
role: 'system' | 'user' | 'assistant';
|
|
3
|
+
content: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BytarchResponse {
|
|
6
|
+
choices: Array<{
|
|
7
|
+
message: {
|
|
8
|
+
role: string;
|
|
9
|
+
content: string;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
usage?: {
|
|
13
|
+
prompt_tokens: number;
|
|
14
|
+
completion_tokens: number;
|
|
15
|
+
total_tokens: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare class BytarchProvider {
|
|
19
|
+
private endpoint;
|
|
20
|
+
private model;
|
|
21
|
+
private apiKey;
|
|
22
|
+
constructor(endpoint: string, model: string, apiKey: string);
|
|
23
|
+
chat(messages: ChatMessage[]): Promise<string>;
|
|
24
|
+
updateConfig(endpoint: string, model: string, apiKey: string): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=bytarch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytarch.d.ts","sourceRoot":"","sources":["../../src/provider/bytarch.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;QACb,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC,CAAC;IACH,KAAK,CAAC,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;gBAEX,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAMrD,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAuCpD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAKpE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BytarchProvider = void 0;
|
|
4
|
+
class BytarchProvider {
|
|
5
|
+
endpoint;
|
|
6
|
+
model;
|
|
7
|
+
apiKey;
|
|
8
|
+
constructor(endpoint, model, apiKey) {
|
|
9
|
+
this.endpoint = endpoint;
|
|
10
|
+
this.model = model;
|
|
11
|
+
this.apiKey = apiKey;
|
|
12
|
+
}
|
|
13
|
+
async chat(messages) {
|
|
14
|
+
if (!this.apiKey) {
|
|
15
|
+
throw new Error('BYTARCH API key is required. Set BYTARCH_API_KEY environment variable or configure in .genie-cli/config.json');
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const response = await fetch(this.endpoint, {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: {
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
'Authorization': `Bearer ${this.apiKey}`
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify({
|
|
25
|
+
model: this.model,
|
|
26
|
+
messages,
|
|
27
|
+
stream: false
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const errorText = await response.text();
|
|
32
|
+
throw new Error(`BYTARCH API request failed (${response.status}): ${errorText}`);
|
|
33
|
+
}
|
|
34
|
+
const data = (await response.json());
|
|
35
|
+
if (!data.choices || data.choices.length === 0) {
|
|
36
|
+
throw new Error('No response from BYTARCH API');
|
|
37
|
+
}
|
|
38
|
+
return data.choices[0].message.content;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof Error) {
|
|
42
|
+
throw new Error(`BYTARCH provider error: ${error.message}`);
|
|
43
|
+
}
|
|
44
|
+
throw new Error('Unknown BYTARCH provider error');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
updateConfig(endpoint, model, apiKey) {
|
|
48
|
+
this.endpoint = endpoint;
|
|
49
|
+
this.model = model;
|
|
50
|
+
this.apiKey = apiKey;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.BytarchProvider = BytarchProvider;
|
|
54
|
+
//# sourceMappingURL=bytarch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytarch.js","sourceRoot":"","sources":["../../src/provider/bytarch.ts"],"names":[],"mappings":";;;AAmBA,MAAa,eAAe;IAClB,QAAQ,CAAS;IACjB,KAAK,CAA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C;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,YAAY,CAAC,QAAgB,EAAE,KAAa,EAAE,MAAc;QAC1D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAvDD,0CAuDC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isValidPlanResponse(data: any): boolean;
|
|
2
|
+
export declare function isValidEditResponse(data: any): boolean;
|
|
3
|
+
export declare function extractJsonFromResponse(content: string): any;
|
|
4
|
+
export declare function sanitizePath(path: string): string;
|
|
5
|
+
//# sourceMappingURL=evaluation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../src/provider/evaluation.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAUtD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAUtD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAU5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidPlanResponse = isValidPlanResponse;
|
|
4
|
+
exports.isValidEditResponse = isValidEditResponse;
|
|
5
|
+
exports.extractJsonFromResponse = extractJsonFromResponse;
|
|
6
|
+
exports.sanitizePath = sanitizePath;
|
|
7
|
+
function isValidPlanResponse(data) {
|
|
8
|
+
if (!data || typeof data !== 'object')
|
|
9
|
+
return false;
|
|
10
|
+
return (typeof data.id === 'string' &&
|
|
11
|
+
typeof data.title === 'string' &&
|
|
12
|
+
typeof data.description === 'string' &&
|
|
13
|
+
Array.isArray(data.items) &&
|
|
14
|
+
typeof data.rationale === 'string');
|
|
15
|
+
}
|
|
16
|
+
function isValidEditResponse(data) {
|
|
17
|
+
if (!data || typeof data !== 'object')
|
|
18
|
+
return false;
|
|
19
|
+
return (typeof data.id === 'string' &&
|
|
20
|
+
typeof data.path === 'string' &&
|
|
21
|
+
typeof data.description === 'string' &&
|
|
22
|
+
typeof data.rationale === 'string' &&
|
|
23
|
+
typeof data.patch === 'string');
|
|
24
|
+
}
|
|
25
|
+
function extractJsonFromResponse(content) {
|
|
26
|
+
try {
|
|
27
|
+
const jsonMatch = content.match(/\{[\s\S]*\}/);
|
|
28
|
+
if (!jsonMatch) {
|
|
29
|
+
throw new Error('No JSON found in response');
|
|
30
|
+
}
|
|
31
|
+
return JSON.parse(jsonMatch[0]);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
throw new Error(`Failed to parse JSON from AI response: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function sanitizePath(path) {
|
|
38
|
+
return path.replace(/\./g, '').replace(/^\//, '');
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=evaluation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../src/provider/evaluation.ts"],"names":[],"mappings":";;AAAA,kDAUC;AAED,kDAUC;AAED,0DAUC;AAED,oCAEC;AAtCD,SAAgB,mBAAmB,CAAC,IAAS;IAC3C,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;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C,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const PLAN_PROMPT = "You are an expert software architect and developer. Given a project description or repository context, generate an actionable plan for implementing the project.\n\nYour response should be a JSON object with the following structure:\n{\n \"id\": \"plan-id\",\n \"title\": \"Project title\",\n \"description\": \"Brief description of the project\",\n \"items\": [\n {\n \"id\": \"task-id\",\n \"title\": \"Task title\",\n \"description\": \"Detailed description of what needs to be done\",\n \"status\": \"pending\",\n \"rationale\": \"Why this task is necessary\",\n \"files\": [\"file1.js\", \"file2.ts\"] // files that will be created/modified\n }\n ],\n \"rationale\": \"Overall rationale for the plan\"\n}\n\nFocus on:\n1. Breaking down the project into manageable tasks\n2. Identifying files that need to be created or modified\n3. Providing clear rationale for each task\n4. Using realistic estimates for task complexity\n\nBe specific about file paths and implementations needed.";
|
|
2
|
+
export declare const EDIT_PROMPT = "You are an expert software developer. Given a file path and a request for changes, generate a unified diff patch for the requested edits.\n\nYour response should be a JSON object with the following structure:\n{\n \"id\": \"patch-id\",\n \"path\": \"path/to/file.js\",\n \"description\": \"Brief description of the changes\",\n \"rationale\": \"Why these changes are necessary\",\n \"patch\": \"--- a/path/to/file.js\\n+++ b/path/to/file.js\\n@@ -1,3 +1,5 @@\\n existing content\\n+new content\\n-more content\"\n}\n\nGuidelines:\n1. Generate valid unified diff format\n2. Be precise about line numbers\n3. Include context lines in the diff\n4. Explain the reasoning for changes\n5. If the file doesn't exist, create a new file patch\n\nAlways include the full unified diff in the \"patch\" field.";
|
|
3
|
+
export declare const ANALYSIS_PROMPT = "You are an expert code reviewer. Analyze the current repository structure and provide insights for project planning.\n\nFocus on:\n1. Current project structure and architecture\n2. Existing technologies and frameworks used\n3. Areas that need improvement or new features\n4. Dependencies and package management\n5. Testing setup and coverage\n6. Documentation status\n\nProvide a concise summary that would help in generating an effective project plan.";
|
|
4
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/provider/prompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,wgCA0BiC,CAAC;AAE1D,eAAO,MAAM,WAAW,uyBAkBmC,CAAC;AAE5D,eAAO,MAAM,eAAe,ycAUuD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ANALYSIS_PROMPT = exports.EDIT_PROMPT = exports.PLAN_PROMPT = void 0;
|
|
4
|
+
exports.PLAN_PROMPT = `You are an expert software architect and developer. Given a project description or repository context, generate an actionable plan for implementing the project.
|
|
5
|
+
|
|
6
|
+
Your response should be a JSON object with the following structure:
|
|
7
|
+
{
|
|
8
|
+
"id": "plan-id",
|
|
9
|
+
"title": "Project title",
|
|
10
|
+
"description": "Brief description of the project",
|
|
11
|
+
"items": [
|
|
12
|
+
{
|
|
13
|
+
"id": "task-id",
|
|
14
|
+
"title": "Task title",
|
|
15
|
+
"description": "Detailed description of what needs to be done",
|
|
16
|
+
"status": "pending",
|
|
17
|
+
"rationale": "Why this task is necessary",
|
|
18
|
+
"files": ["file1.js", "file2.ts"] // files that will be created/modified
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"rationale": "Overall rationale for the plan"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Focus on:
|
|
25
|
+
1. Breaking down the project into manageable tasks
|
|
26
|
+
2. Identifying files that need to be created or modified
|
|
27
|
+
3. Providing clear rationale for each task
|
|
28
|
+
4. Using realistic estimates for task complexity
|
|
29
|
+
|
|
30
|
+
Be specific about file paths and implementations needed.`;
|
|
31
|
+
exports.EDIT_PROMPT = `You are an expert software developer. Given a file path and a request for changes, generate a unified diff patch for the requested edits.
|
|
32
|
+
|
|
33
|
+
Your response should be a JSON object with the following structure:
|
|
34
|
+
{
|
|
35
|
+
"id": "patch-id",
|
|
36
|
+
"path": "path/to/file.js",
|
|
37
|
+
"description": "Brief description of the changes",
|
|
38
|
+
"rationale": "Why these changes are necessary",
|
|
39
|
+
"patch": "--- a/path/to/file.js\\n+++ b/path/to/file.js\\n@@ -1,3 +1,5 @@\\n existing content\\n+new content\\n-more content"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Guidelines:
|
|
43
|
+
1. Generate valid unified diff format
|
|
44
|
+
2. Be precise about line numbers
|
|
45
|
+
3. Include context lines in the diff
|
|
46
|
+
4. Explain the reasoning for changes
|
|
47
|
+
5. If the file doesn't exist, create a new file patch
|
|
48
|
+
|
|
49
|
+
Always include the full unified diff in the "patch" field.`;
|
|
50
|
+
exports.ANALYSIS_PROMPT = `You are an expert code reviewer. Analyze the current repository structure and provide insights for project planning.
|
|
51
|
+
|
|
52
|
+
Focus on:
|
|
53
|
+
1. Current project structure and architecture
|
|
54
|
+
2. Existing technologies and frameworks used
|
|
55
|
+
3. Areas that need improvement or new features
|
|
56
|
+
4. Dependencies and package management
|
|
57
|
+
5. Testing setup and coverage
|
|
58
|
+
6. Documentation status
|
|
59
|
+
|
|
60
|
+
Provide a concise summary that would help in generating an effective project plan.`;
|
|
61
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/provider/prompts.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;yDA0B8B,CAAC;AAE7C,QAAA,WAAW,GAAG;;;;;;;;;;;;;;;;;;2DAkBgC,CAAC;AAE/C,QAAA,eAAe,GAAG;;;;;;;;;;mFAUoD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface ConfirmOptions {
|
|
2
|
+
message: string;
|
|
3
|
+
default?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface SelectOptions {
|
|
6
|
+
message: string;
|
|
7
|
+
choices: Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
value: any;
|
|
10
|
+
short?: string;
|
|
11
|
+
}>;
|
|
12
|
+
default?: any;
|
|
13
|
+
}
|
|
14
|
+
export interface InputOptions {
|
|
15
|
+
message: string;
|
|
16
|
+
default?: string;
|
|
17
|
+
validate?: (input: string) => boolean | string;
|
|
18
|
+
}
|
|
19
|
+
export interface MultiSelectOptions {
|
|
20
|
+
message: string;
|
|
21
|
+
choices: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
value: any;
|
|
24
|
+
checked?: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export declare class UI {
|
|
28
|
+
static success(message: string): void;
|
|
29
|
+
static error(message: string): void;
|
|
30
|
+
static warning(message: string): void;
|
|
31
|
+
static info(message: string): void;
|
|
32
|
+
static header(message: string): void;
|
|
33
|
+
static confirm(options: ConfirmOptions): Promise<boolean>;
|
|
34
|
+
static select(options: SelectOptions): Promise<any>;
|
|
35
|
+
static input(options: InputOptions): Promise<string>;
|
|
36
|
+
static multiSelect(options: MultiSelectOptions): Promise<any[]>;
|
|
37
|
+
static table(headers: string[], rows: string[][]): void;
|
|
38
|
+
static list(items: string[], bullet?: string): void;
|
|
39
|
+
static divider(char?: string, length?: number): void;
|
|
40
|
+
static highlight(text: string, color?: 'green' | 'yellow' | 'red' | 'blue' | 'cyan'): void;
|
|
41
|
+
static progress(current: number, total: number, message?: string): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/ui/prompts.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAA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AAE,GAAG,IAAI;IAiBvD,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAY,GAAG,IAAI;IAIxD,MAAM,CAAC,OAAO,CAAC,IAAI,GAAE,MAAY,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI;IAI7D,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,MAAe,GAAG,IAAI;IAWlG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAW,GAAG,IAAI;CAY5E"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UI = void 0;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
class UI {
|
|
10
|
+
static success(message) {
|
|
11
|
+
console.log(chalk_1.default.green('✓'), message);
|
|
12
|
+
}
|
|
13
|
+
static error(message) {
|
|
14
|
+
console.error(chalk_1.default.red('✗'), message);
|
|
15
|
+
}
|
|
16
|
+
static warning(message) {
|
|
17
|
+
console.warn(chalk_1.default.yellow('⚠'), message);
|
|
18
|
+
}
|
|
19
|
+
static info(message) {
|
|
20
|
+
console.log(chalk_1.default.blue('ℹ'), message);
|
|
21
|
+
}
|
|
22
|
+
static header(message) {
|
|
23
|
+
console.log(chalk_1.default.bold.cyan(message));
|
|
24
|
+
}
|
|
25
|
+
static async confirm(options) {
|
|
26
|
+
const { message, default: defaultValue = false } = options;
|
|
27
|
+
const answers = await inquirer_1.default.prompt([
|
|
28
|
+
{
|
|
29
|
+
type: 'confirm',
|
|
30
|
+
name: 'confirmed',
|
|
31
|
+
message,
|
|
32
|
+
default: defaultValue
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
35
|
+
return answers.confirmed;
|
|
36
|
+
}
|
|
37
|
+
static async select(options) {
|
|
38
|
+
const { message, choices, default: defaultValue } = options;
|
|
39
|
+
const answers = await inquirer_1.default.prompt([
|
|
40
|
+
{
|
|
41
|
+
type: 'list',
|
|
42
|
+
name: 'selected',
|
|
43
|
+
message,
|
|
44
|
+
choices,
|
|
45
|
+
default: defaultValue
|
|
46
|
+
}
|
|
47
|
+
]);
|
|
48
|
+
return answers.selected;
|
|
49
|
+
}
|
|
50
|
+
static async input(options) {
|
|
51
|
+
const { message, default: defaultValue, validate } = options;
|
|
52
|
+
const answers = await inquirer_1.default.prompt([
|
|
53
|
+
{
|
|
54
|
+
type: 'input',
|
|
55
|
+
name: 'input',
|
|
56
|
+
message,
|
|
57
|
+
default: defaultValue,
|
|
58
|
+
validate: validate ? (input) => {
|
|
59
|
+
const result = validate(input);
|
|
60
|
+
if (typeof result === 'boolean') {
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
return result || true;
|
|
64
|
+
} : undefined
|
|
65
|
+
}
|
|
66
|
+
]);
|
|
67
|
+
return answers.input;
|
|
68
|
+
}
|
|
69
|
+
static async multiSelect(options) {
|
|
70
|
+
const { message, choices } = options;
|
|
71
|
+
const answers = await inquirer_1.default.prompt([
|
|
72
|
+
{
|
|
73
|
+
type: 'checkbox',
|
|
74
|
+
name: 'selected',
|
|
75
|
+
message,
|
|
76
|
+
choices
|
|
77
|
+
}
|
|
78
|
+
]);
|
|
79
|
+
return answers.selected;
|
|
80
|
+
}
|
|
81
|
+
static table(headers, rows) {
|
|
82
|
+
const columnWidths = headers.map((header, index) => {
|
|
83
|
+
const maxRowWidth = Math.max(...rows.map(row => row[index]?.length || 0));
|
|
84
|
+
return Math.max(header.length, maxRowWidth);
|
|
85
|
+
});
|
|
86
|
+
const formatRow = (row) => {
|
|
87
|
+
return row.map((cell, index) => cell.padEnd(columnWidths[index])).join(' | ');
|
|
88
|
+
};
|
|
89
|
+
const separator = columnWidths.map(width => '-'.repeat(width)).join('-+-');
|
|
90
|
+
console.log(formatRow(headers));
|
|
91
|
+
console.log(separator);
|
|
92
|
+
rows.forEach(row => console.log(formatRow(row)));
|
|
93
|
+
}
|
|
94
|
+
static list(items, bullet = '•') {
|
|
95
|
+
items.forEach(item => console.log(`${bullet} ${item}`));
|
|
96
|
+
}
|
|
97
|
+
static divider(char = '-', length = 50) {
|
|
98
|
+
console.log(char.repeat(length));
|
|
99
|
+
}
|
|
100
|
+
static highlight(text, color = 'cyan') {
|
|
101
|
+
const colors = {
|
|
102
|
+
green: chalk_1.default.green,
|
|
103
|
+
yellow: chalk_1.default.yellow,
|
|
104
|
+
red: chalk_1.default.red,
|
|
105
|
+
blue: chalk_1.default.blue,
|
|
106
|
+
cyan: chalk_1.default.cyan
|
|
107
|
+
};
|
|
108
|
+
console.log(colors[color](text));
|
|
109
|
+
}
|
|
110
|
+
static progress(current, total, message = '') {
|
|
111
|
+
const percentage = Math.round((current / total) * 100);
|
|
112
|
+
const barLength = 30;
|
|
113
|
+
const filledLength = Math.round((barLength * current) / total);
|
|
114
|
+
const bar = '█'.repeat(filledLength) + '-'.repeat(barLength - filledLength);
|
|
115
|
+
process.stdout.write(`\\r[${bar}] ${percentage}% ${message}`);
|
|
116
|
+
if (current === total) {
|
|
117
|
+
process.stdout.write('\\n');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.UI = UI;
|
|
122
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/ui/prompts.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,kDAA0B;AAwB1B,MAAa,EAAE;IACb,MAAM,CAAC,OAAO,CAA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;
|
|
7
|
+
}
|
|
8
|
+
export declare class ConfigManager {
|
|
9
|
+
private workspacePath;
|
|
10
|
+
private configPath;
|
|
11
|
+
constructor(workspacePath: string);
|
|
12
|
+
loadConfig(): Promise<Config>;
|
|
13
|
+
saveConfig(config: Config): Promise<void>;
|
|
14
|
+
updateConfig(updates: Partial<Config>): Promise<Config>;
|
|
15
|
+
getApiKey(config: Config): string;
|
|
16
|
+
private mergeWithEnv;
|
|
17
|
+
private createDefaultConfig;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/workspace/config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,UAAU,CAAS;gBAEf,aAAa,EAAE,MAAM;IAK3B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAa7B,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAO7D,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAajC,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,mBAAmB;CAS5B"}
|