archicore 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/README.md +530 -0
- package/dist/analyzers/dead-code.d.ts +95 -0
- package/dist/analyzers/dead-code.js +327 -0
- package/dist/analyzers/duplication.d.ts +90 -0
- package/dist/analyzers/duplication.js +344 -0
- package/dist/analyzers/security.d.ts +79 -0
- package/dist/analyzers/security.js +484 -0
- package/dist/architecture/index.d.ts +35 -0
- package/dist/architecture/index.js +249 -0
- package/dist/cli/commands/analyzers.d.ts +6 -0
- package/dist/cli/commands/analyzers.js +431 -0
- package/dist/cli/commands/export.d.ts +6 -0
- package/dist/cli/commands/export.js +78 -0
- package/dist/cli/commands/index.d.ts +8 -0
- package/dist/cli/commands/index.js +8 -0
- package/dist/cli/commands/init.d.ts +26 -0
- package/dist/cli/commands/init.js +140 -0
- package/dist/cli/commands/interactive.d.ts +7 -0
- package/dist/cli/commands/interactive.js +522 -0
- package/dist/cli/commands/projects.d.ts +6 -0
- package/dist/cli/commands/projects.js +249 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +7 -0
- package/dist/cli/ui/box.d.ts +17 -0
- package/dist/cli/ui/box.js +62 -0
- package/dist/cli/ui/colors.d.ts +49 -0
- package/dist/cli/ui/colors.js +86 -0
- package/dist/cli/ui/index.d.ts +9 -0
- package/dist/cli/ui/index.js +9 -0
- package/dist/cli/ui/prompt.d.ts +34 -0
- package/dist/cli/ui/prompt.js +122 -0
- package/dist/cli/ui/spinner.d.ts +29 -0
- package/dist/cli/ui/spinner.js +80 -0
- package/dist/cli/ui/table.d.ts +33 -0
- package/dist/cli/ui/table.js +84 -0
- package/dist/cli/utils/config.d.ts +23 -0
- package/dist/cli/utils/config.js +73 -0
- package/dist/cli/utils/index.d.ts +6 -0
- package/dist/cli/utils/index.js +6 -0
- package/dist/cli/utils/session.d.ts +27 -0
- package/dist/cli/utils/session.js +117 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +295 -0
- package/dist/code-index/ast-parser.d.ts +16 -0
- package/dist/code-index/ast-parser.js +330 -0
- package/dist/code-index/dependency-graph.d.ts +16 -0
- package/dist/code-index/dependency-graph.js +161 -0
- package/dist/code-index/index.d.ts +44 -0
- package/dist/code-index/index.js +124 -0
- package/dist/code-index/symbol-extractor.d.ts +13 -0
- package/dist/code-index/symbol-extractor.js +150 -0
- package/dist/export/index.d.ts +92 -0
- package/dist/export/index.js +676 -0
- package/dist/github/github-service.d.ts +146 -0
- package/dist/github/github-service.js +609 -0
- package/dist/impact-engine/index.d.ts +25 -0
- package/dist/impact-engine/index.js +284 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +149 -0
- package/dist/metrics/index.d.ts +136 -0
- package/dist/metrics/index.js +525 -0
- package/dist/orchestrator/deepseek-optimizer.d.ts +67 -0
- package/dist/orchestrator/deepseek-optimizer.js +320 -0
- package/dist/orchestrator/index.d.ts +34 -0
- package/dist/orchestrator/index.js +305 -0
- package/dist/pr-guardian/index.d.ts +143 -0
- package/dist/pr-guardian/index.js +553 -0
- package/dist/refactoring/index.d.ts +108 -0
- package/dist/refactoring/index.js +580 -0
- package/dist/rules-engine/index.d.ts +129 -0
- package/dist/rules-engine/index.js +482 -0
- package/dist/semantic-memory/embedding-service.d.ts +24 -0
- package/dist/semantic-memory/embedding-service.js +120 -0
- package/dist/semantic-memory/index.d.ts +45 -0
- package/dist/semantic-memory/index.js +206 -0
- package/dist/semantic-memory/vector-store.d.ts +27 -0
- package/dist/semantic-memory/vector-store.js +166 -0
- package/dist/server/index.d.ts +28 -0
- package/dist/server/index.js +141 -0
- package/dist/server/middleware/api-auth.d.ts +43 -0
- package/dist/server/middleware/api-auth.js +256 -0
- package/dist/server/routes/admin.d.ts +5 -0
- package/dist/server/routes/admin.js +123 -0
- package/dist/server/routes/api.d.ts +7 -0
- package/dist/server/routes/api.js +362 -0
- package/dist/server/routes/auth.d.ts +16 -0
- package/dist/server/routes/auth.js +191 -0
- package/dist/server/routes/developer.d.ts +8 -0
- package/dist/server/routes/developer.js +439 -0
- package/dist/server/routes/github.d.ts +7 -0
- package/dist/server/routes/github.js +495 -0
- package/dist/server/routes/upload.d.ts +7 -0
- package/dist/server/routes/upload.js +196 -0
- package/dist/server/services/api-key-service.d.ts +81 -0
- package/dist/server/services/api-key-service.js +281 -0
- package/dist/server/services/auth-service.d.ts +40 -0
- package/dist/server/services/auth-service.js +315 -0
- package/dist/server/services/project-service.d.ts +123 -0
- package/dist/server/services/project-service.js +533 -0
- package/dist/server/services/token-service.d.ts +107 -0
- package/dist/server/services/token-service.js +416 -0
- package/dist/server/services/upload-service.d.ts +93 -0
- package/dist/server/services/upload-service.js +464 -0
- package/dist/types/api.d.ts +188 -0
- package/dist/types/api.js +86 -0
- package/dist/types/github.d.ts +335 -0
- package/dist/types/github.js +5 -0
- package/dist/types/index.d.ts +265 -0
- package/dist/types/index.js +32 -0
- package/dist/types/user.d.ts +69 -0
- package/dist/types/user.js +42 -0
- package/dist/utils/file-utils.d.ts +20 -0
- package/dist/utils/file-utils.js +163 -0
- package/dist/utils/logger.d.ts +17 -0
- package/dist/utils/logger.js +41 -0
- package/dist/watcher/index.d.ts +125 -0
- package/dist/watcher/index.js +397 -0
- package/package.json +71 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArchiCore CLI - Projects Commands
|
|
3
|
+
*/
|
|
4
|
+
import { loadConfig, setActiveProject, clearActiveProject } from '../utils/config.js';
|
|
5
|
+
import { fetchProjects, selectProject, checkServerConnection, initSession, getSession } from '../utils/session.js';
|
|
6
|
+
import { colors, projectsTable, createSpinner, printSuccess, printError, printKeyValue, printSection, simpleTable, header } from '../ui/index.js';
|
|
7
|
+
export function registerProjectsCommand(program) {
|
|
8
|
+
const projects = program
|
|
9
|
+
.command('projects')
|
|
10
|
+
.description('Manage ArchiCore projects');
|
|
11
|
+
// List projects
|
|
12
|
+
projects
|
|
13
|
+
.command('list')
|
|
14
|
+
.alias('ls')
|
|
15
|
+
.description('List all projects')
|
|
16
|
+
.action(async () => {
|
|
17
|
+
const spinner = createSpinner('Fetching projects...').start();
|
|
18
|
+
try {
|
|
19
|
+
const connected = await checkServerConnection();
|
|
20
|
+
if (!connected) {
|
|
21
|
+
spinner.fail('Cannot connect to ArchiCore server');
|
|
22
|
+
printError('Make sure the server is running: npm run server');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const projectsList = await fetchProjects();
|
|
26
|
+
spinner.succeed(`Found ${projectsList.length} projects`);
|
|
27
|
+
if (projectsList.length === 0) {
|
|
28
|
+
console.log();
|
|
29
|
+
console.log(colors.muted(' No projects found. Create one with:'));
|
|
30
|
+
console.log(colors.secondary(' archicore projects create <path>'));
|
|
31
|
+
console.log();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const config = await loadConfig();
|
|
35
|
+
console.log();
|
|
36
|
+
console.log(projectsTable(projectsList));
|
|
37
|
+
console.log();
|
|
38
|
+
if (config.activeProjectId) {
|
|
39
|
+
const active = projectsList.find(p => p.id === config.activeProjectId);
|
|
40
|
+
if (active) {
|
|
41
|
+
console.log(colors.muted(' Active project: ') + colors.primary(active.name));
|
|
42
|
+
console.log();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
spinner.fail('Failed to fetch projects');
|
|
48
|
+
printError(String(error));
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
// Create project
|
|
53
|
+
projects
|
|
54
|
+
.command('create <path>')
|
|
55
|
+
.description('Create or connect a project')
|
|
56
|
+
.option('-n, --name <name>', 'Project name')
|
|
57
|
+
.option('--index', 'Index project after creation', false)
|
|
58
|
+
.action(async (path, options) => {
|
|
59
|
+
const spinner = createSpinner('Creating project...').start();
|
|
60
|
+
try {
|
|
61
|
+
const config = await loadConfig();
|
|
62
|
+
const response = await fetch(`${config.serverUrl}/api/projects`, {
|
|
63
|
+
method: 'POST',
|
|
64
|
+
headers: { 'Content-Type': 'application/json' },
|
|
65
|
+
body: JSON.stringify({
|
|
66
|
+
name: options.name || path.split('/').pop() || path.split('\\').pop(),
|
|
67
|
+
path: path,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
const error = await response.json();
|
|
72
|
+
throw new Error(error.error || 'Failed to create project');
|
|
73
|
+
}
|
|
74
|
+
const data = await response.json();
|
|
75
|
+
spinner.succeed('Project created');
|
|
76
|
+
console.log();
|
|
77
|
+
printKeyValue('ID', data.id);
|
|
78
|
+
printKeyValue('Name', data.name);
|
|
79
|
+
printKeyValue('Path', path);
|
|
80
|
+
console.log();
|
|
81
|
+
// Set as active project
|
|
82
|
+
await setActiveProject(data.id, path);
|
|
83
|
+
printSuccess('Set as active project');
|
|
84
|
+
// Index if requested
|
|
85
|
+
if (options.index) {
|
|
86
|
+
console.log();
|
|
87
|
+
const indexSpinner = createSpinner('Indexing project...').start();
|
|
88
|
+
const indexResponse = await fetch(`${config.serverUrl}/api/projects/${data.id}/index`, {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
});
|
|
91
|
+
if (indexResponse.ok) {
|
|
92
|
+
indexSpinner.succeed('Project indexed');
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
indexSpinner.fail('Failed to index project');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
spinner.fail('Failed to create project');
|
|
101
|
+
printError(String(error));
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
// Delete project
|
|
106
|
+
projects
|
|
107
|
+
.command('delete <id>')
|
|
108
|
+
.alias('rm')
|
|
109
|
+
.description('Delete a project')
|
|
110
|
+
.option('-f, --force', 'Skip confirmation')
|
|
111
|
+
.action(async (id, _options) => {
|
|
112
|
+
const spinner = createSpinner('Deleting project...').start();
|
|
113
|
+
try {
|
|
114
|
+
const config = await loadConfig();
|
|
115
|
+
const response = await fetch(`${config.serverUrl}/api/projects/${id}`, {
|
|
116
|
+
method: 'DELETE',
|
|
117
|
+
});
|
|
118
|
+
if (!response.ok) {
|
|
119
|
+
const error = await response.json();
|
|
120
|
+
throw new Error(error.error || 'Failed to delete project');
|
|
121
|
+
}
|
|
122
|
+
spinner.succeed('Project deleted');
|
|
123
|
+
// Clear active project if it was deleted
|
|
124
|
+
if (config.activeProjectId === id) {
|
|
125
|
+
await clearActiveProject();
|
|
126
|
+
console.log(colors.muted(' Active project cleared'));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
spinner.fail('Failed to delete project');
|
|
131
|
+
printError(String(error));
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
// Select project
|
|
136
|
+
projects
|
|
137
|
+
.command('select <id>')
|
|
138
|
+
.alias('use')
|
|
139
|
+
.description('Select active project')
|
|
140
|
+
.action(async (id) => {
|
|
141
|
+
const spinner = createSpinner('Selecting project...').start();
|
|
142
|
+
try {
|
|
143
|
+
const project = await selectProject(id);
|
|
144
|
+
if (!project) {
|
|
145
|
+
spinner.fail('Project not found');
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
spinner.succeed(`Selected project: ${project.name}`);
|
|
149
|
+
console.log();
|
|
150
|
+
printKeyValue('ID', project.id);
|
|
151
|
+
printKeyValue('Name', project.name);
|
|
152
|
+
printKeyValue('Path', project.path);
|
|
153
|
+
printKeyValue('Status', project.status);
|
|
154
|
+
if (project.files)
|
|
155
|
+
printKeyValue('Files', String(project.files));
|
|
156
|
+
if (project.symbols)
|
|
157
|
+
printKeyValue('Symbols', String(project.symbols));
|
|
158
|
+
console.log();
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
spinner.fail('Failed to select project');
|
|
162
|
+
printError(String(error));
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
// Project status
|
|
167
|
+
projects
|
|
168
|
+
.command('status [id]')
|
|
169
|
+
.description('Show project status')
|
|
170
|
+
.action(async (id) => {
|
|
171
|
+
const spinner = createSpinner('Fetching status...').start();
|
|
172
|
+
try {
|
|
173
|
+
await initSession();
|
|
174
|
+
getSession(); // Initialize session state
|
|
175
|
+
const config = await loadConfig();
|
|
176
|
+
const projectId = id || config.activeProjectId;
|
|
177
|
+
if (!projectId) {
|
|
178
|
+
spinner.fail('No project specified');
|
|
179
|
+
printError('Use "archicore projects select <id>" or specify project ID');
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
const response = await fetch(`${config.serverUrl}/api/projects/${projectId}`);
|
|
183
|
+
if (!response.ok) {
|
|
184
|
+
spinner.fail('Project not found');
|
|
185
|
+
process.exit(1);
|
|
186
|
+
}
|
|
187
|
+
const data = await response.json();
|
|
188
|
+
spinner.succeed('Project status');
|
|
189
|
+
console.log();
|
|
190
|
+
console.log(header(data.name, data.path));
|
|
191
|
+
printSection('Statistics');
|
|
192
|
+
const stats = [
|
|
193
|
+
['Status', data.status || 'unknown'],
|
|
194
|
+
['Files', String(data.statistics?.codeIndex?.totalFiles || 0)],
|
|
195
|
+
['Symbols', String(data.statistics?.codeIndex?.totalSymbols || 0)],
|
|
196
|
+
['Nodes', String(data.statistics?.codeIndex?.totalNodes || 0)],
|
|
197
|
+
['Edges', String(data.statistics?.codeIndex?.totalEdges || 0)],
|
|
198
|
+
];
|
|
199
|
+
console.log(simpleTable(stats));
|
|
200
|
+
if (data.statistics?.codeIndex?.symbolsByKind) {
|
|
201
|
+
printSection('Symbols by Kind');
|
|
202
|
+
const kinds = Object.entries(data.statistics.codeIndex.symbolsByKind)
|
|
203
|
+
.map(([k, v]) => [k, String(v)]);
|
|
204
|
+
console.log(simpleTable(kinds));
|
|
205
|
+
}
|
|
206
|
+
console.log();
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
spinner.fail('Failed to fetch status');
|
|
210
|
+
printError(String(error));
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
// Index project
|
|
215
|
+
projects
|
|
216
|
+
.command('index [id]')
|
|
217
|
+
.description('Index or re-index project')
|
|
218
|
+
.action(async (id) => {
|
|
219
|
+
const spinner = createSpinner('Indexing project...').start();
|
|
220
|
+
try {
|
|
221
|
+
const config = await loadConfig();
|
|
222
|
+
const projectId = id || config.activeProjectId;
|
|
223
|
+
if (!projectId) {
|
|
224
|
+
spinner.fail('No project specified');
|
|
225
|
+
printError('Use "archicore projects select <id>" or specify project ID');
|
|
226
|
+
process.exit(1);
|
|
227
|
+
}
|
|
228
|
+
const response = await fetch(`${config.serverUrl}/api/projects/${projectId}/index`, {
|
|
229
|
+
method: 'POST',
|
|
230
|
+
});
|
|
231
|
+
if (!response.ok) {
|
|
232
|
+
const error = await response.json();
|
|
233
|
+
throw new Error(error.error || 'Failed to index project');
|
|
234
|
+
}
|
|
235
|
+
const data = await response.json();
|
|
236
|
+
spinner.succeed('Project indexed');
|
|
237
|
+
console.log();
|
|
238
|
+
printKeyValue('Files', String(data.statistics?.totalFiles || 0));
|
|
239
|
+
printKeyValue('Symbols', String(data.statistics?.totalSymbols || 0));
|
|
240
|
+
console.log();
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
spinner.fail('Failed to index project');
|
|
244
|
+
printError(String(error));
|
|
245
|
+
process.exit(1);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=projects.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArchiCore CLI Box Components
|
|
3
|
+
*/
|
|
4
|
+
export interface BoxOptions {
|
|
5
|
+
title?: string;
|
|
6
|
+
padding?: number;
|
|
7
|
+
borderColor?: string;
|
|
8
|
+
borderStyle?: 'single' | 'double' | 'round' | 'bold' | 'singleDouble' | 'doubleSingle' | 'classic';
|
|
9
|
+
}
|
|
10
|
+
export declare function box(content: string, options?: BoxOptions): string;
|
|
11
|
+
export declare function header(title: string, subtitle?: string): string;
|
|
12
|
+
export declare function errorBox(message: string, title?: string): string;
|
|
13
|
+
export declare function successBox(message: string, title?: string): string;
|
|
14
|
+
export declare function warningBox(message: string, title?: string): string;
|
|
15
|
+
export declare function infoBox(message: string, title?: string): string;
|
|
16
|
+
export declare function resultBox(content: string, title?: string): string;
|
|
17
|
+
//# sourceMappingURL=box.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArchiCore CLI Box Components
|
|
3
|
+
*/
|
|
4
|
+
import boxen from 'boxen';
|
|
5
|
+
import { colors } from './colors.js';
|
|
6
|
+
export function box(content, options = {}) {
|
|
7
|
+
const boxenOptions = {
|
|
8
|
+
padding: options.padding ?? 1,
|
|
9
|
+
borderColor: options.borderColor ?? '#7C3AED',
|
|
10
|
+
borderStyle: options.borderStyle ?? 'round',
|
|
11
|
+
title: options.title,
|
|
12
|
+
titleAlignment: 'center',
|
|
13
|
+
};
|
|
14
|
+
return boxen(content, boxenOptions);
|
|
15
|
+
}
|
|
16
|
+
export function header(title, subtitle) {
|
|
17
|
+
const content = subtitle
|
|
18
|
+
? `${colors.brand(title)}\n${colors.muted(subtitle)}`
|
|
19
|
+
: colors.brand(title);
|
|
20
|
+
return box(content, {
|
|
21
|
+
borderColor: '#7C3AED',
|
|
22
|
+
borderStyle: 'round',
|
|
23
|
+
padding: 1,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function errorBox(message, title = 'Error') {
|
|
27
|
+
return box(colors.error(message), {
|
|
28
|
+
title: colors.error.bold(title),
|
|
29
|
+
borderColor: '#EF4444',
|
|
30
|
+
borderStyle: 'round',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function successBox(message, title = 'Success') {
|
|
34
|
+
return box(colors.success(message), {
|
|
35
|
+
title: colors.success.bold(title),
|
|
36
|
+
borderColor: '#10B981',
|
|
37
|
+
borderStyle: 'round',
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function warningBox(message, title = 'Warning') {
|
|
41
|
+
return box(colors.warning(message), {
|
|
42
|
+
title: colors.warning.bold(title),
|
|
43
|
+
borderColor: '#F59E0B',
|
|
44
|
+
borderStyle: 'round',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export function infoBox(message, title = 'Info') {
|
|
48
|
+
return box(colors.info(message), {
|
|
49
|
+
title: colors.info.bold(title),
|
|
50
|
+
borderColor: '#3B82F6',
|
|
51
|
+
borderStyle: 'round',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export function resultBox(content, title) {
|
|
55
|
+
return box(content, {
|
|
56
|
+
title,
|
|
57
|
+
borderColor: '#6B7280',
|
|
58
|
+
borderStyle: 'single',
|
|
59
|
+
padding: 1,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=box.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArchiCore CLI Color Scheme
|
|
3
|
+
*/
|
|
4
|
+
export declare const colors: {
|
|
5
|
+
primary: import("chalk").ChalkInstance;
|
|
6
|
+
secondary: import("chalk").ChalkInstance;
|
|
7
|
+
accent: import("chalk").ChalkInstance;
|
|
8
|
+
success: import("chalk").ChalkInstance;
|
|
9
|
+
warning: import("chalk").ChalkInstance;
|
|
10
|
+
error: import("chalk").ChalkInstance;
|
|
11
|
+
info: import("chalk").ChalkInstance;
|
|
12
|
+
dim: import("chalk").ChalkInstance;
|
|
13
|
+
muted: import("chalk").ChalkInstance;
|
|
14
|
+
highlight: import("chalk").ChalkInstance;
|
|
15
|
+
critical: import("chalk").ChalkInstance;
|
|
16
|
+
high: import("chalk").ChalkInstance;
|
|
17
|
+
medium: import("chalk").ChalkInstance;
|
|
18
|
+
low: import("chalk").ChalkInstance;
|
|
19
|
+
brand: import("chalk").ChalkInstance;
|
|
20
|
+
link: import("chalk").ChalkInstance;
|
|
21
|
+
code: import("chalk").ChalkInstance;
|
|
22
|
+
};
|
|
23
|
+
export declare const icons: {
|
|
24
|
+
success: string;
|
|
25
|
+
error: string;
|
|
26
|
+
warning: string;
|
|
27
|
+
info: string;
|
|
28
|
+
arrow: string;
|
|
29
|
+
bullet: string;
|
|
30
|
+
dash: string;
|
|
31
|
+
spinner: string[];
|
|
32
|
+
progress: string;
|
|
33
|
+
empty: string;
|
|
34
|
+
folder: string;
|
|
35
|
+
file: string;
|
|
36
|
+
code: string;
|
|
37
|
+
graph: string;
|
|
38
|
+
search: string;
|
|
39
|
+
gear: string;
|
|
40
|
+
lightning: string;
|
|
41
|
+
lock: string;
|
|
42
|
+
severityCritical: string;
|
|
43
|
+
severityHigh: string;
|
|
44
|
+
severityMedium: string;
|
|
45
|
+
severityLow: string;
|
|
46
|
+
};
|
|
47
|
+
export declare function formatImpactLevel(level: string): string;
|
|
48
|
+
export declare function formatSeverity(severity: string): string;
|
|
49
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArchiCore CLI Color Scheme
|
|
3
|
+
*/
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
export const colors = {
|
|
6
|
+
// Primary colors
|
|
7
|
+
primary: chalk.hex('#7C3AED'), // Purple
|
|
8
|
+
secondary: chalk.hex('#06B6D4'), // Cyan
|
|
9
|
+
accent: chalk.hex('#F59E0B'), // Amber
|
|
10
|
+
// Status colors
|
|
11
|
+
success: chalk.hex('#10B981'), // Green
|
|
12
|
+
warning: chalk.hex('#F59E0B'), // Amber
|
|
13
|
+
error: chalk.hex('#EF4444'), // Red
|
|
14
|
+
info: chalk.hex('#3B82F6'), // Blue
|
|
15
|
+
// Text colors
|
|
16
|
+
dim: chalk.gray,
|
|
17
|
+
muted: chalk.hex('#6B7280'),
|
|
18
|
+
highlight: chalk.bold.white,
|
|
19
|
+
// Impact levels
|
|
20
|
+
critical: chalk.hex('#DC2626'), // Red
|
|
21
|
+
high: chalk.hex('#EA580C'), // Orange
|
|
22
|
+
medium: chalk.hex('#CA8A04'), // Yellow
|
|
23
|
+
low: chalk.hex('#16A34A'), // Green
|
|
24
|
+
// Special
|
|
25
|
+
brand: chalk.hex('#7C3AED').bold,
|
|
26
|
+
link: chalk.hex('#3B82F6').underline,
|
|
27
|
+
code: chalk.hex('#F472B6'), // Pink
|
|
28
|
+
};
|
|
29
|
+
export const icons = {
|
|
30
|
+
// Status
|
|
31
|
+
success: '\u2713', // checkmark
|
|
32
|
+
error: '\u2717', // x
|
|
33
|
+
warning: '\u26A0', // warning triangle
|
|
34
|
+
info: '\u2139', // info
|
|
35
|
+
// Actions
|
|
36
|
+
arrow: '\u276F', // >
|
|
37
|
+
bullet: '\u2022', // bullet
|
|
38
|
+
dash: '\u2500', // horizontal line
|
|
39
|
+
// Progress
|
|
40
|
+
spinner: ['\u25DC', '\u25DD', '\u25DE', '\u25DF'],
|
|
41
|
+
progress: '\u25CF', // filled circle
|
|
42
|
+
empty: '\u25CB', // empty circle
|
|
43
|
+
// Objects
|
|
44
|
+
folder: '\uD83D\uDCC1', // folder emoji
|
|
45
|
+
file: '\uD83D\uDCC4', // file emoji
|
|
46
|
+
code: '\uD83D\uDCBB', // laptop emoji
|
|
47
|
+
graph: '\uD83D\uDCCA', // chart emoji
|
|
48
|
+
search: '\uD83D\uDD0D', // magnifying glass
|
|
49
|
+
gear: '\u2699', // gear
|
|
50
|
+
lightning: '\u26A1', // lightning
|
|
51
|
+
lock: '\uD83D\uDD12', // lock
|
|
52
|
+
// Severity
|
|
53
|
+
severityCritical: '\uD83D\uDD34', // red circle
|
|
54
|
+
severityHigh: '\uD83D\uDFE0', // orange circle
|
|
55
|
+
severityMedium: '\uD83D\uDFE1', // yellow circle
|
|
56
|
+
severityLow: '\uD83D\uDFE2', // green circle
|
|
57
|
+
};
|
|
58
|
+
export function formatImpactLevel(level) {
|
|
59
|
+
switch (level) {
|
|
60
|
+
case 'critical':
|
|
61
|
+
return colors.critical(`${icons.severityCritical} CRITICAL`);
|
|
62
|
+
case 'high':
|
|
63
|
+
return colors.high(`${icons.severityHigh} HIGH`);
|
|
64
|
+
case 'medium':
|
|
65
|
+
return colors.medium(`${icons.severityMedium} MEDIUM`);
|
|
66
|
+
case 'low':
|
|
67
|
+
return colors.low(`${icons.severityLow} LOW`);
|
|
68
|
+
default:
|
|
69
|
+
return colors.muted(level);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function formatSeverity(severity) {
|
|
73
|
+
switch (severity.toLowerCase()) {
|
|
74
|
+
case 'critical':
|
|
75
|
+
return colors.critical.bold(severity.toUpperCase());
|
|
76
|
+
case 'high':
|
|
77
|
+
return colors.high.bold(severity.toUpperCase());
|
|
78
|
+
case 'medium':
|
|
79
|
+
return colors.medium(severity.toUpperCase());
|
|
80
|
+
case 'low':
|
|
81
|
+
return colors.low(severity.toUpperCase());
|
|
82
|
+
default:
|
|
83
|
+
return colors.muted(severity);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArchiCore CLI Prompt Components
|
|
3
|
+
*/
|
|
4
|
+
export interface PromptOptions {
|
|
5
|
+
message?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class Prompt {
|
|
9
|
+
private rl;
|
|
10
|
+
private history;
|
|
11
|
+
constructor();
|
|
12
|
+
ask(question: string): Promise<string>;
|
|
13
|
+
confirm(question: string, defaultValue?: boolean): Promise<boolean>;
|
|
14
|
+
select<T extends string>(question: string, options: Array<{
|
|
15
|
+
value: T;
|
|
16
|
+
label: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
}>): Promise<T>;
|
|
19
|
+
close(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function createPrompt(): Prompt;
|
|
22
|
+
export declare function printPrompt(_prefix?: string): void;
|
|
23
|
+
export declare function printWelcome(): void;
|
|
24
|
+
export declare function printHelp(): void;
|
|
25
|
+
export declare function printGoodbye(): void;
|
|
26
|
+
export declare function printDivider(): void;
|
|
27
|
+
export declare function printSection(title: string): void;
|
|
28
|
+
export declare function printKeyValue(key: string, value: string): void;
|
|
29
|
+
export declare function printBullet(text: string, indent?: number): void;
|
|
30
|
+
export declare function printSuccess(message: string): void;
|
|
31
|
+
export declare function printError(message: string): void;
|
|
32
|
+
export declare function printWarning(message: string): void;
|
|
33
|
+
export declare function printInfo(message: string): void;
|
|
34
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArchiCore CLI Prompt Components
|
|
3
|
+
*/
|
|
4
|
+
import * as readline from 'readline';
|
|
5
|
+
import { colors, icons } from './colors.js';
|
|
6
|
+
export class Prompt {
|
|
7
|
+
rl;
|
|
8
|
+
history = [];
|
|
9
|
+
constructor() {
|
|
10
|
+
this.rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
terminal: true,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async ask(question) {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
this.rl.question(colors.primary(question + ' '), (answer) => {
|
|
19
|
+
if (answer.trim()) {
|
|
20
|
+
this.history.push(answer.trim());
|
|
21
|
+
}
|
|
22
|
+
resolve(answer.trim());
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async confirm(question, defaultValue = false) {
|
|
27
|
+
const hint = defaultValue ? '[Y/n]' : '[y/N]';
|
|
28
|
+
const answer = await this.ask(`${question} ${colors.muted(hint)}`);
|
|
29
|
+
if (!answer)
|
|
30
|
+
return defaultValue;
|
|
31
|
+
return answer.toLowerCase().startsWith('y');
|
|
32
|
+
}
|
|
33
|
+
async select(question, options) {
|
|
34
|
+
console.log(colors.primary(question));
|
|
35
|
+
console.log();
|
|
36
|
+
options.forEach((opt, index) => {
|
|
37
|
+
const num = colors.secondary(` ${index + 1}.`);
|
|
38
|
+
const label = colors.highlight(opt.label);
|
|
39
|
+
const desc = opt.description ? colors.muted(` - ${opt.description}`) : '';
|
|
40
|
+
console.log(`${num} ${label}${desc}`);
|
|
41
|
+
});
|
|
42
|
+
console.log();
|
|
43
|
+
const answer = await this.ask('Enter number:');
|
|
44
|
+
const index = parseInt(answer) - 1;
|
|
45
|
+
if (index >= 0 && index < options.length) {
|
|
46
|
+
return options[index].value;
|
|
47
|
+
}
|
|
48
|
+
console.log(colors.error('Invalid selection, please try again.'));
|
|
49
|
+
return this.select(question, options);
|
|
50
|
+
}
|
|
51
|
+
close() {
|
|
52
|
+
this.rl.close();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function createPrompt() {
|
|
56
|
+
return new Prompt();
|
|
57
|
+
}
|
|
58
|
+
export function printPrompt(_prefix = 'archicore') {
|
|
59
|
+
process.stdout.write(colors.primary(`${icons.arrow} `));
|
|
60
|
+
}
|
|
61
|
+
export function printWelcome() {
|
|
62
|
+
console.log();
|
|
63
|
+
console.log(colors.brand(' ArchiCore') + colors.muted(' v0.1.0'));
|
|
64
|
+
console.log(colors.muted(' AI Software Architect'));
|
|
65
|
+
console.log();
|
|
66
|
+
}
|
|
67
|
+
export function printHelp() {
|
|
68
|
+
console.log();
|
|
69
|
+
console.log(colors.primary.bold(' Commands:'));
|
|
70
|
+
console.log();
|
|
71
|
+
const commands = [
|
|
72
|
+
['/index', 'Index current project'],
|
|
73
|
+
['/analyze [desc]', 'Run impact analysis'],
|
|
74
|
+
['/search <query>', 'Semantic code search'],
|
|
75
|
+
['/dead-code', 'Find dead code'],
|
|
76
|
+
['/security', 'Security analysis'],
|
|
77
|
+
['/metrics', 'Code metrics'],
|
|
78
|
+
['/export [format]', 'Export (json/html/md)'],
|
|
79
|
+
['/status', 'Show current status'],
|
|
80
|
+
['/clear', 'Clear screen'],
|
|
81
|
+
['/help', 'Show this help'],
|
|
82
|
+
['/exit', 'Exit ArchiCore'],
|
|
83
|
+
];
|
|
84
|
+
for (const [cmd, desc] of commands) {
|
|
85
|
+
console.log(` ${colors.secondary(cmd.padEnd(22))} ${colors.muted(desc)}`);
|
|
86
|
+
}
|
|
87
|
+
console.log();
|
|
88
|
+
console.log(colors.muted(' Or just ask a question about your code!'));
|
|
89
|
+
console.log();
|
|
90
|
+
}
|
|
91
|
+
export function printGoodbye() {
|
|
92
|
+
console.log();
|
|
93
|
+
console.log(colors.muted(' Goodbye! ') + colors.primary(icons.lightning));
|
|
94
|
+
console.log();
|
|
95
|
+
}
|
|
96
|
+
export function printDivider() {
|
|
97
|
+
console.log(colors.dim('\u2500'.repeat(60)));
|
|
98
|
+
}
|
|
99
|
+
export function printSection(title) {
|
|
100
|
+
console.log();
|
|
101
|
+
console.log(colors.primary.bold(` ${title}`));
|
|
102
|
+
console.log();
|
|
103
|
+
}
|
|
104
|
+
export function printKeyValue(key, value) {
|
|
105
|
+
console.log(` ${colors.muted(key + ':')} ${colors.highlight(value)}`);
|
|
106
|
+
}
|
|
107
|
+
export function printBullet(text, indent = 2) {
|
|
108
|
+
console.log(' '.repeat(indent) + colors.secondary(icons.bullet) + ' ' + text);
|
|
109
|
+
}
|
|
110
|
+
export function printSuccess(message) {
|
|
111
|
+
console.log(colors.success(` ${icons.success} ${message}`));
|
|
112
|
+
}
|
|
113
|
+
export function printError(message) {
|
|
114
|
+
console.log(colors.error(` ${icons.error} ${message}`));
|
|
115
|
+
}
|
|
116
|
+
export function printWarning(message) {
|
|
117
|
+
console.log(colors.warning(` ${icons.warning} ${message}`));
|
|
118
|
+
}
|
|
119
|
+
export function printInfo(message) {
|
|
120
|
+
console.log(colors.info(` ${icons.info} ${message}`));
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=prompt.js.map
|