erosolar-cli 1.7.408 → 1.7.410
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/dist/capabilities/askUserCapability.d.ts.map +1 -1
- package/dist/capabilities/askUserCapability.js +10 -64
- package/dist/capabilities/askUserCapability.js.map +1 -1
- package/dist/core/claudeCodeFeatures.d.ts +1 -2
- package/dist/core/claudeCodeFeatures.d.ts.map +1 -1
- package/dist/core/claudeCodeFeatures.js +1 -2
- package/dist/core/claudeCodeFeatures.js.map +1 -1
- package/dist/headless/headlessApp.d.ts.map +1 -1
- package/dist/headless/headlessApp.js +22 -6
- package/dist/headless/headlessApp.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +0 -1
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +3 -37
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/updateManager.d.ts +1 -8
- package/dist/shell/updateManager.d.ts.map +1 -1
- package/dist/shell/updateManager.js +2 -20
- package/dist/shell/updateManager.js.map +1 -1
- package/dist/tools/interactionTools.d.ts.map +1 -1
- package/dist/tools/interactionTools.js +15 -82
- package/dist/tools/interactionTools.js.map +1 -1
- package/dist/tools/learnTools.js +25 -81
- package/dist/tools/learnTools.js.map +1 -1
- package/dist/ui/ShellUIAdapter.d.ts +10 -1
- package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
- package/dist/ui/ShellUIAdapter.js +41 -6
- package/dist/ui/ShellUIAdapter.js.map +1 -1
- package/dist/ui/display.d.ts +1 -1
- package/dist/ui/display.js +1 -1
- package/dist/ui/unified/index.d.ts +0 -1
- package/dist/ui/unified/index.d.ts.map +1 -1
- package/dist/ui/unified/index.js +0 -1
- package/dist/ui/unified/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
export declare function isUpdateInProgress(): boolean;
|
|
2
|
-
export
|
|
3
|
-
currentVersion: string;
|
|
4
|
-
latestVersion: string;
|
|
5
|
-
}
|
|
6
|
-
export interface UpdatePromptOptions {
|
|
7
|
-
prompt?: (context: UpdatePromptContext) => Promise<boolean>;
|
|
8
|
-
}
|
|
9
|
-
export declare function maybeOfferCliUpdate(currentVersion: string, options?: UpdatePromptOptions): Promise<boolean>;
|
|
2
|
+
export declare function maybeOfferCliUpdate(currentVersion: string): Promise<boolean>;
|
|
10
3
|
//# sourceMappingURL=updateManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateManager.d.ts","sourceRoot":"","sources":["../../src/shell/updateManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateManager.d.ts","sourceRoot":"","sources":["../../src/shell/updateManager.ts"],"names":[],"mappings":"AAaA,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,wBAAsB,mBAAmB,CACvC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC,CA2ClB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { stdin as input, stdout as output } from 'node:process';
|
|
3
|
-
import { createInterface } from 'node:readline/promises';
|
|
4
3
|
import { display } from '../ui/display.js';
|
|
5
4
|
const PACKAGE_NAME = 'erosolar-cli';
|
|
6
5
|
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
@@ -12,7 +11,7 @@ let updateInProgress = false;
|
|
|
12
11
|
export function isUpdateInProgress() {
|
|
13
12
|
return updateInProgress;
|
|
14
13
|
}
|
|
15
|
-
export async function maybeOfferCliUpdate(currentVersion
|
|
14
|
+
export async function maybeOfferCliUpdate(currentVersion) {
|
|
16
15
|
try {
|
|
17
16
|
const latestVersion = await fetchLatestVersion();
|
|
18
17
|
if (!latestVersion) {
|
|
@@ -30,13 +29,7 @@ export async function maybeOfferCliUpdate(currentVersion, options = {}) {
|
|
|
30
29
|
display.showInfo(`Run "npm install -g ${PACKAGE_NAME}@latest" when you're ready to upgrade.`);
|
|
31
30
|
return true;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
? options.prompt({ currentVersion, latestVersion })
|
|
35
|
-
: promptForUpdate());
|
|
36
|
-
if (!shouldUpdate) {
|
|
37
|
-
display.showInfo(`Continuing with ${currentVersion}. You can upgrade later via "npm install -g ${PACKAGE_NAME}@latest".`);
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
32
|
+
display.showInfo(`Auto-updating to ${PACKAGE_NAME}@${latestVersion}...`);
|
|
40
33
|
updateInProgress = true;
|
|
41
34
|
const success = await installLatestVersion(latestVersion);
|
|
42
35
|
if (success) {
|
|
@@ -97,17 +90,6 @@ function normalizeVersion(value) {
|
|
|
97
90
|
.map((segment) => Number.parseInt(segment, 10))
|
|
98
91
|
.filter((segment) => Number.isFinite(segment) && segment >= 0);
|
|
99
92
|
}
|
|
100
|
-
async function promptForUpdate() {
|
|
101
|
-
const prompt = createInterface({ input, output });
|
|
102
|
-
try {
|
|
103
|
-
const answer = await prompt.question('Update now? (Y/n): ');
|
|
104
|
-
const normalized = answer.trim().toLowerCase();
|
|
105
|
-
return normalized === '' || normalized === 'y' || normalized === 'yes';
|
|
106
|
-
}
|
|
107
|
-
finally {
|
|
108
|
-
prompt.close();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
93
|
async function installLatestVersion(version) {
|
|
112
94
|
const binary = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
113
95
|
return new Promise((resolve) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateManager.js","sourceRoot":"","sources":["../../src/shell/updateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"updateManager.js","sourceRoot":"","sources":["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AC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;IAChE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,+DAA+D;QAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,YAAY,IAAI,OAAO,EAAE,CAAC,EAAE;YAC9F,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionTools.d.ts","sourceRoot":"","sources":["../../src/tools/interactionTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"interactionTools.d.ts","sourceRoot":"","sources":["../../src/tools/interactionTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAgHzD"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as readline from 'node:readline';
|
|
2
1
|
export function createInteractionTools() {
|
|
3
2
|
return [
|
|
4
3
|
{
|
|
@@ -78,92 +77,26 @@ Usage notes:
|
|
|
78
77
|
}
|
|
79
78
|
return output;
|
|
80
79
|
}
|
|
81
|
-
//
|
|
82
|
-
const rl = readline.createInterface({
|
|
83
|
-
input: process.stdin,
|
|
84
|
-
output: process.stdout,
|
|
85
|
-
});
|
|
80
|
+
// Legacy readline flow removed to avoid terminal redraw; default to first option(s).
|
|
86
81
|
const userAnswers = {};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
continue;
|
|
92
|
-
console.log(`\n[${q.header}] ${q.question}`);
|
|
93
|
-
console.log('');
|
|
94
|
-
q.options.forEach((opt, idx) => {
|
|
95
|
-
console.log(` ${idx + 1}. ${opt.label}`);
|
|
96
|
-
console.log(` ${opt.description}`);
|
|
97
|
-
});
|
|
98
|
-
console.log(` ${q.options.length + 1}. Other (custom input)`);
|
|
99
|
-
console.log('');
|
|
100
|
-
const answer = await new Promise((resolve) => {
|
|
101
|
-
rl.question(q.multiSelect
|
|
102
|
-
? `Select options (comma-separated numbers, e.g., "1,3"): `
|
|
103
|
-
: `Select an option (1-${q.options.length + 1}): `, (input) => {
|
|
104
|
-
resolve(input.trim());
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
if (q.multiSelect) {
|
|
108
|
-
// Handle multi-select
|
|
109
|
-
const selections = answer
|
|
110
|
-
.split(',')
|
|
111
|
-
.map((s) => s.trim())
|
|
112
|
-
.filter((s) => s.length > 0);
|
|
113
|
-
const selectedOptions = [];
|
|
114
|
-
for (const sel of selections) {
|
|
115
|
-
const idx = parseInt(sel, 10);
|
|
116
|
-
if (idx >= 1 && idx <= q.options.length) {
|
|
117
|
-
const option = q.options[idx - 1];
|
|
118
|
-
if (option) {
|
|
119
|
-
selectedOptions.push(option.label);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else if (idx === q.options.length + 1) {
|
|
123
|
-
const customAnswer = await new Promise((resolve) => {
|
|
124
|
-
rl.question('Enter custom value: ', (input) => {
|
|
125
|
-
resolve(input.trim());
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
selectedOptions.push(customAnswer);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
userAnswers[q.header] = selectedOptions.join(', ');
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
// Handle single select
|
|
135
|
-
const idx = parseInt(answer, 10);
|
|
136
|
-
if (idx >= 1 && idx <= q.options.length) {
|
|
137
|
-
const option = q.options[idx - 1];
|
|
138
|
-
if (option) {
|
|
139
|
-
userAnswers[q.header] = option.label;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
userAnswers[q.header] = 'Invalid selection';
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else if (idx === q.options.length + 1) {
|
|
146
|
-
const customAnswer = await new Promise((resolve) => {
|
|
147
|
-
rl.question('Enter custom value: ', (input) => {
|
|
148
|
-
resolve(input.trim());
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
userAnswers[q.header] = customAnswer;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
userAnswers[q.header] = 'Invalid selection';
|
|
155
|
-
}
|
|
156
|
-
}
|
|
82
|
+
for (const q of questions) {
|
|
83
|
+
if (!q || !Array.isArray(q.options) || q.options.length === 0) {
|
|
84
|
+
userAnswers[q?.header ?? 'Question'] = 'No options provided';
|
|
85
|
+
continue;
|
|
157
86
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
87
|
+
const [first] = q.options;
|
|
88
|
+
if (q.multiSelect) {
|
|
89
|
+
userAnswers[q.header] = first ? first.label : 'No selection';
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
userAnswers[q.header] = first?.label ?? 'No selection';
|
|
161
93
|
}
|
|
162
|
-
return output;
|
|
163
94
|
}
|
|
164
|
-
|
|
165
|
-
|
|
95
|
+
let output = '\n📋 User Responses:\n\n';
|
|
96
|
+
for (const [key, value] of Object.entries(userAnswers)) {
|
|
97
|
+
output += `${key}: ${value}\n`;
|
|
166
98
|
}
|
|
99
|
+
return output;
|
|
167
100
|
},
|
|
168
101
|
},
|
|
169
102
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionTools.js","sourceRoot":"","sources":["../../src/tools/interactionTools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactionTools.js","sourceRoot":"","sources":["../../src/tools/interactionTools.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL;YACE,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE;;;;;;;;gFAQ6D;YAC1E,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,WAAW,EAAE,2CAA2C;wBACxD,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,QAAQ,EAAE;oCACR,IAAI,EAAE,QAAQ;oCACd,WAAW,EACT,yPAAyP;iCAC5P;gCACD,MAAM,EAAE;oCACN,IAAI,EAAE,QAAQ;oCACd,WAAW,EACT,0GAA0G;iCAC7G;gCACD,OAAO,EAAE;oCACP,IAAI,EAAE,OAAO;oCACb,WAAW,EACT,sOAAsO;oCACxO,KAAK,EAAE;wCACL,IAAI,EAAE,QAAQ;wCACd,UAAU,EAAE;4CACV,KAAK,EAAE;gDACL,IAAI,EAAE,QAAQ;gDACd,WAAW,EACT,oIAAoI;6CACvI;4CACD,WAAW,EAAE;gDACX,IAAI,EAAE,QAAQ;gDACd,WAAW,EACT,qIAAqI;6CACxI;yCACF;wCACD,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC;wCAClC,oBAAoB,EAAE,KAAK;qCAC5B;iCACF;gCACD,WAAW,EAAE;oCACX,IAAI,EAAE,SAAS;oCACf,WAAW,EACT,4HAA4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AG,CAAC,CAAC,OAAO,CAAC;oBAC1B,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;wBAClB,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC;oBAC/D,CAAC;yBAAM,CAAC;wBACN,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,KAAK,IAAI,cAAc,CAAC;oBACzD,CAAC;gBACH,CAAC;gBAED,IAAI,MAAM,GAAG,0BAA0B,CAAC;gBACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;oBACvD,MAAM,IAAI,GAAG,GAAG,KAAK,KAAK,IAAI,CAAC;gBACjC,CAAC;gBAED,OAAO,MAAM,CAAC;YAChB,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/learnTools.js
CHANGED
|
@@ -1555,108 +1555,52 @@ function collectAllFiles(dir, maxDepth, depth = 0) {
|
|
|
1555
1555
|
// =====================================================
|
|
1556
1556
|
function formatCodebaseAnalysis(analysis) {
|
|
1557
1557
|
const output = [];
|
|
1558
|
-
//
|
|
1559
|
-
output.push(
|
|
1558
|
+
// Concise summary format
|
|
1559
|
+
output.push(`Analyzed ${analysis.rootDir}: ${analysis.totalFiles} files, ${analysis.totalDirectories} directories`);
|
|
1560
1560
|
output.push('');
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
output.push(
|
|
1564
|
-
|
|
1565
|
-
output.push(
|
|
1566
|
-
output.push('✓ Dependency analysis');
|
|
1567
|
-
output.push('✓ Entry point identification');
|
|
1568
|
-
output.push('✓ Component and layer mapping');
|
|
1569
|
-
output.push('');
|
|
1570
|
-
// Overview
|
|
1571
|
-
output.push('## Overview');
|
|
1572
|
-
output.push(`- Total files analyzed: ${analysis.totalFiles}`);
|
|
1573
|
-
output.push(`- Total directories scanned: ${analysis.totalDirectories}`);
|
|
1574
|
-
output.push(`- Patterns detected: ${analysis.patterns.length}`);
|
|
1575
|
-
output.push(`- Config files found: ${analysis.configFiles.length}`);
|
|
1576
|
-
output.push('');
|
|
1577
|
-
// Languages
|
|
1578
|
-
output.push('## Languages');
|
|
1579
|
-
for (const lang of analysis.languages.slice(0, 10)) {
|
|
1580
|
-
output.push(`- ${lang.language}: ${lang.fileCount} files (${lang.percentage.toFixed(1)}%)`);
|
|
1581
|
-
}
|
|
1582
|
-
output.push('');
|
|
1583
|
-
// Architecture
|
|
1584
|
-
output.push('## Architecture');
|
|
1585
|
-
output.push(`- Type: ${analysis.architecture.type}`);
|
|
1561
|
+
// Languages (top 5 only)
|
|
1562
|
+
const topLangs = analysis.languages.slice(0, 5).map(l => `${l.language} (${l.fileCount})`).join(', ');
|
|
1563
|
+
output.push(`Languages: ${topLangs}`);
|
|
1564
|
+
// Architecture summary
|
|
1565
|
+
output.push(`Architecture: ${analysis.architecture.type}`);
|
|
1586
1566
|
if (analysis.architecture.layers.length > 0) {
|
|
1587
|
-
output.push(
|
|
1567
|
+
output.push(`Layers: ${analysis.architecture.layers.join(', ')}`);
|
|
1588
1568
|
}
|
|
1589
|
-
|
|
1590
|
-
output.push('- Data Flow:');
|
|
1591
|
-
for (const flow of analysis.architecture.dataFlow) {
|
|
1592
|
-
output.push(` - ${flow}`);
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
output.push('');
|
|
1596
|
-
// Detected Patterns
|
|
1569
|
+
// Patterns (top 3 only)
|
|
1597
1570
|
if (analysis.patterns.length > 0) {
|
|
1598
|
-
output.push('## Detected Patterns');
|
|
1599
|
-
for (const pattern of analysis.patterns) {
|
|
1600
|
-
output.push(`- **${pattern.name}** (${pattern.confidence} confidence)`);
|
|
1601
|
-
output.push(` ${pattern.description}`);
|
|
1602
|
-
}
|
|
1603
1571
|
output.push('');
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
output.push('## Key Components');
|
|
1608
|
-
for (const comp of analysis.architecture.components.slice(0, 15)) {
|
|
1609
|
-
output.push(`- **${comp.name}** (${comp.type}): ${comp.path}`);
|
|
1610
|
-
if (comp.responsibilities.length > 0) {
|
|
1611
|
-
output.push(` Responsibilities: ${comp.responsibilities.join(', ')}`);
|
|
1612
|
-
}
|
|
1572
|
+
output.push('Key Patterns:');
|
|
1573
|
+
for (const pattern of analysis.patterns.slice(0, 3)) {
|
|
1574
|
+
output.push(`- ${pattern.name}: ${pattern.description}`);
|
|
1613
1575
|
}
|
|
1614
|
-
output.push('');
|
|
1615
1576
|
}
|
|
1616
|
-
// Entry
|
|
1577
|
+
// Entry points
|
|
1617
1578
|
if (analysis.entryPoints.length > 0) {
|
|
1618
|
-
output.push('## Entry Points');
|
|
1619
|
-
for (const entry of analysis.entryPoints) {
|
|
1620
|
-
output.push(`- ${entry}`);
|
|
1621
|
-
}
|
|
1622
1579
|
output.push('');
|
|
1580
|
+
output.push(`Entry: ${analysis.entryPoints.slice(0, 3).join(', ')}`);
|
|
1623
1581
|
}
|
|
1624
|
-
//
|
|
1582
|
+
// Config files (top 5 only)
|
|
1625
1583
|
if (analysis.configFiles.length > 0) {
|
|
1626
|
-
output.push('## Configuration Files');
|
|
1627
|
-
for (const config of analysis.configFiles.slice(0, 10)) {
|
|
1628
|
-
output.push(`- **${config.name}** (${config.type}): ${config.purpose}`);
|
|
1629
|
-
}
|
|
1630
1584
|
output.push('');
|
|
1585
|
+
output.push('Config: ' + analysis.configFiles.slice(0, 5).map(c => c.name).join(', '));
|
|
1631
1586
|
}
|
|
1632
|
-
//
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
if (analysis.dependencies.dependencies.length > 0) {
|
|
1637
|
-
output.push(`- Dependencies: ${analysis.dependencies.dependencies.slice(0, 10).join(', ')}${analysis.dependencies.dependencies.length > 10 ? '...' : ''}`);
|
|
1638
|
-
}
|
|
1639
|
-
if (analysis.dependencies.devDependencies.length > 0) {
|
|
1640
|
-
output.push(`- Dev Dependencies: ${analysis.dependencies.devDependencies.slice(0, 10).join(', ')}${analysis.dependencies.devDependencies.length > 10 ? '...' : ''}`);
|
|
1641
|
-
}
|
|
1642
|
-
output.push('');
|
|
1643
|
-
}
|
|
1644
|
-
// Directory Structure (simplified)
|
|
1645
|
-
output.push('## Directory Structure');
|
|
1646
|
-
output.push(formatDirectoryTree(analysis.structure, 0, 3));
|
|
1587
|
+
// Directory tree (max depth 2, max 10 items per level)
|
|
1588
|
+
output.push('');
|
|
1589
|
+
output.push('Structure:');
|
|
1590
|
+
output.push(formatDirectoryTree(analysis.structure, 0, 2, 10));
|
|
1647
1591
|
return output.join('\n');
|
|
1648
1592
|
}
|
|
1649
|
-
function formatDirectoryTree(node, depth, maxDepth) {
|
|
1593
|
+
function formatDirectoryTree(node, depth, maxDepth, maxItems = 10) {
|
|
1650
1594
|
const indent = ' '.repeat(depth);
|
|
1651
1595
|
const lines = [];
|
|
1652
1596
|
if (node.type === 'directory') {
|
|
1653
1597
|
lines.push(`${indent}${node.name}/`);
|
|
1654
1598
|
if (node.children && depth < maxDepth) {
|
|
1655
|
-
for (const child of node.children.slice(0,
|
|
1656
|
-
lines.push(formatDirectoryTree(child, depth + 1, maxDepth));
|
|
1599
|
+
for (const child of node.children.slice(0, maxItems)) {
|
|
1600
|
+
lines.push(formatDirectoryTree(child, depth + 1, maxDepth, maxItems));
|
|
1657
1601
|
}
|
|
1658
|
-
if (node.children.length >
|
|
1659
|
-
lines.push(`${indent} ... (${node.children.length -
|
|
1602
|
+
if (node.children.length > maxItems) {
|
|
1603
|
+
lines.push(`${indent} ... (${node.children.length - maxItems} more)`);
|
|
1660
1604
|
}
|
|
1661
1605
|
}
|
|
1662
1606
|
}
|