@nanocollective/nanocoder 1.13.7 → 1.13.8
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/app/hooks/useChatHandler.d.ts.map +1 -1
- package/dist/app/hooks/useChatHandler.js +8 -2
- package/dist/app/hooks/useChatHandler.js.map +1 -1
- package/dist/components/user-input.d.ts.map +1 -1
- package/dist/components/user-input.js +27 -22
- package/dist/components/user-input.js.map +1 -1
- package/dist/components/user-message.d.ts.map +1 -1
- package/dist/components/user-message.js +0 -5
- package/dist/components/user-message.js.map +1 -1
- package/dist/hooks/useInputState.d.ts +10 -3
- package/dist/hooks/useInputState.d.ts.map +1 -1
- package/dist/hooks/useInputState.js +154 -15
- package/dist/hooks/useInputState.js.map +1 -1
- package/dist/hooks/useInputState.spec.d.ts +2 -0
- package/dist/hooks/useInputState.spec.d.ts.map +1 -0
- package/dist/hooks/useInputState.spec.js +163 -0
- package/dist/hooks/useInputState.spec.js.map +1 -0
- package/dist/hooks/useUIState.d.ts +0 -2
- package/dist/hooks/useUIState.d.ts.map +1 -1
- package/dist/hooks/useUIState.js +1 -11
- package/dist/hooks/useUIState.js.map +1 -1
- package/dist/integration/paste-roundtrip.spec.d.ts +2 -0
- package/dist/integration/paste-roundtrip.spec.d.ts.map +1 -0
- package/dist/integration/paste-roundtrip.spec.js +327 -0
- package/dist/integration/paste-roundtrip.spec.js.map +1 -0
- package/dist/prompt-history.d.ts +9 -3
- package/dist/prompt-history.d.ts.map +1 -1
- package/dist/prompt-history.js +56 -14
- package/dist/prompt-history.js.map +1 -1
- package/dist/types/hooks.d.ts +29 -0
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +10 -1
- package/dist/types/hooks.js.map +1 -1
- package/dist/utils/atomic-deletion.d.ts +17 -0
- package/dist/utils/atomic-deletion.d.ts.map +1 -0
- package/dist/utils/atomic-deletion.js +89 -0
- package/dist/utils/atomic-deletion.js.map +1 -0
- package/dist/utils/atomic-deletion.spec.d.ts +2 -0
- package/dist/utils/atomic-deletion.spec.d.ts.map +1 -0
- package/dist/utils/atomic-deletion.spec.js +153 -0
- package/dist/utils/atomic-deletion.spec.js.map +1 -0
- package/dist/utils/paste-detection.d.ts +36 -0
- package/dist/utils/paste-detection.d.ts.map +1 -0
- package/dist/utils/paste-detection.js +83 -0
- package/dist/utils/paste-detection.js.map +1 -0
- package/dist/utils/paste-utils.d.ts +3 -0
- package/dist/utils/paste-utils.d.ts.map +1 -0
- package/dist/utils/paste-utils.js +33 -0
- package/dist/utils/paste-utils.js.map +1 -0
- package/dist/utils/prompt-assembly.spec.d.ts +2 -0
- package/dist/utils/prompt-assembly.spec.d.ts.map +1 -0
- package/dist/utils/prompt-assembly.spec.js +80 -0
- package/dist/utils/prompt-assembly.spec.js.map +1 -0
- package/dist/utils/prompt-processor.d.ts +11 -0
- package/dist/utils/prompt-processor.d.ts.map +1 -1
- package/dist/utils/prompt-processor.js +57 -0
- package/dist/utils/prompt-processor.js.map +1 -1
- package/package.json +12 -7
- package/source/app/prompts/main-prompt.md +18 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PlaceholderType, } from '../types/hooks.js';
|
|
2
|
+
export function handlePaste(pastedText, currentDisplayValue, currentPlaceholderContent, detectionMethod) {
|
|
3
|
+
const THRESHOLD = 80; // characters
|
|
4
|
+
if (pastedText.length < THRESHOLD) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
// Generate simple incrementing ID based on existing paste placeholders
|
|
8
|
+
const existingPasteCount = Object.values(currentPlaceholderContent).filter(content => content.type === PlaceholderType.PASTE).length;
|
|
9
|
+
const pasteId = (existingPasteCount + 1).toString();
|
|
10
|
+
const placeholder = `[Paste #${pasteId}: ${pastedText.length} chars]`;
|
|
11
|
+
const pasteContent = {
|
|
12
|
+
type: PlaceholderType.PASTE,
|
|
13
|
+
displayText: placeholder,
|
|
14
|
+
content: pastedText,
|
|
15
|
+
originalSize: pastedText.length,
|
|
16
|
+
detectionMethod,
|
|
17
|
+
timestamp: Date.now(),
|
|
18
|
+
};
|
|
19
|
+
const newPlaceholderContent = {
|
|
20
|
+
...currentPlaceholderContent,
|
|
21
|
+
[pasteId]: pasteContent,
|
|
22
|
+
};
|
|
23
|
+
// For CLI paste detection, we need to replace the pasted text in the display value
|
|
24
|
+
// If the pasted text is at the end, replace it. Otherwise append the placeholder.
|
|
25
|
+
const newDisplayValue = currentDisplayValue.includes(pastedText)
|
|
26
|
+
? currentDisplayValue.replace(pastedText, placeholder)
|
|
27
|
+
: currentDisplayValue + placeholder;
|
|
28
|
+
return {
|
|
29
|
+
displayValue: newDisplayValue,
|
|
30
|
+
placeholderContent: newPlaceholderContent,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=paste-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste-utils.js","sourceRoot":"","sources":["../../source/utils/paste-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,eAAe,GACf,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,WAAW,CAC1B,UAAkB,EAClB,mBAA2B,EAC3B,yBAA6D,EAC7D,eAA+C;IAE/C,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,aAAa;IACnC,IAAI,UAAU,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,uEAAuE;IACvE,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,MAAM,CACzE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,KAAK,CACjD,CAAC,MAAM,CAAC;IACT,MAAM,OAAO,GAAG,CAAC,kBAAkB,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpD,MAAM,WAAW,GAAG,WAAW,OAAO,KAAK,UAAU,CAAC,MAAM,SAAS,CAAC;IAEtE,MAAM,YAAY,GAA4B;QAC7C,IAAI,EAAE,eAAe,CAAC,KAAK;QAC3B,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,UAAU;QACnB,YAAY,EAAE,UAAU,CAAC,MAAM;QAC/B,eAAe;QACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACrB,CAAC;IAEF,MAAM,qBAAqB,GAAG;QAC7B,GAAG,yBAAyB;QAC5B,CAAC,OAAO,CAAC,EAAE,YAAY;KACvB,CAAC;IAEF,mFAAmF;IACnF,kFAAkF;IAClF,MAAM,eAAe,GAAG,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/D,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC;QACtD,CAAC,CAAC,mBAAmB,GAAG,WAAW,CAAC;IAErC,OAAO;QACN,YAAY,EAAE,eAAe;QAC7B,kBAAkB,EAAE,qBAAqB;KACzC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-assembly.spec.d.ts","sourceRoot":"","sources":["../../source/utils/prompt-assembly.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { PlaceholderType } from '../types/hooks.js';
|
|
3
|
+
// Minimal implementation for testing - avoids complex dependencies
|
|
4
|
+
function assemblePrompt(inputState) {
|
|
5
|
+
let assembledPrompt = inputState.displayValue;
|
|
6
|
+
// Replace each placeholder with its full content
|
|
7
|
+
Object.entries(inputState.placeholderContent).forEach(([pasteId, placeholder]) => {
|
|
8
|
+
if (placeholder.type === 'paste') {
|
|
9
|
+
const placeholderPattern = `\\[Paste #${pasteId}: \\d+ chars\\]`;
|
|
10
|
+
const regex = new RegExp(placeholderPattern, 'g');
|
|
11
|
+
assembledPrompt = assembledPrompt.replace(regex, placeholder.content);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return assembledPrompt;
|
|
15
|
+
}
|
|
16
|
+
function extractPlaceholderIds(displayValue) {
|
|
17
|
+
const placeholderRegex = /\[Paste #(\d+): \d+ chars\]/g;
|
|
18
|
+
const matches = [];
|
|
19
|
+
let match;
|
|
20
|
+
while ((match = placeholderRegex.exec(displayValue)) !== null) {
|
|
21
|
+
matches.push(match[1]); // The captured paste ID
|
|
22
|
+
}
|
|
23
|
+
return matches;
|
|
24
|
+
}
|
|
25
|
+
// Tests for prompt assembly
|
|
26
|
+
test('assemblePrompt replaces single placeholder with content', t => {
|
|
27
|
+
const inputState = {
|
|
28
|
+
displayValue: 'Analyze this: [Paste #1640995200: 100 chars]',
|
|
29
|
+
placeholderContent: {
|
|
30
|
+
'1640995200': {
|
|
31
|
+
type: PlaceholderType.PASTE,
|
|
32
|
+
displayText: '[Paste #1640995200: 100 chars]',
|
|
33
|
+
content: 'function test() { return "hello world"; }',
|
|
34
|
+
originalSize: 100,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
const result = assemblePrompt(inputState);
|
|
39
|
+
t.is(result, 'Analyze this: function test() { return "hello world"; }');
|
|
40
|
+
});
|
|
41
|
+
test('assemblePrompt handles multiple placeholders', t => {
|
|
42
|
+
const inputState = {
|
|
43
|
+
displayValue: 'Compare [Paste #123: 50 chars] with [Paste #456: 30 chars]',
|
|
44
|
+
placeholderContent: {
|
|
45
|
+
'123': {
|
|
46
|
+
type: PlaceholderType.PASTE,
|
|
47
|
+
displayText: '[Paste #123: 50 chars]',
|
|
48
|
+
content: 'first code snippet',
|
|
49
|
+
originalSize: 50,
|
|
50
|
+
},
|
|
51
|
+
'456': {
|
|
52
|
+
type: PlaceholderType.PASTE,
|
|
53
|
+
displayText: '[Paste #456: 30 chars]',
|
|
54
|
+
content: 'second code snippet',
|
|
55
|
+
originalSize: 30,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
const result = assemblePrompt(inputState);
|
|
60
|
+
t.is(result, 'Compare first code snippet with second code snippet');
|
|
61
|
+
});
|
|
62
|
+
test('assemblePrompt handles no placeholders', t => {
|
|
63
|
+
const inputState = {
|
|
64
|
+
displayValue: 'Regular text without placeholders',
|
|
65
|
+
placeholderContent: {},
|
|
66
|
+
};
|
|
67
|
+
const result = assemblePrompt(inputState);
|
|
68
|
+
t.is(result, 'Regular text without placeholders');
|
|
69
|
+
});
|
|
70
|
+
test('extractPlaceholderIds finds all placeholder IDs', t => {
|
|
71
|
+
const displayValue = 'Text [Paste #123: 100 chars] more text [Paste #456: 200 chars]';
|
|
72
|
+
const result = extractPlaceholderIds(displayValue);
|
|
73
|
+
t.deepEqual(result, ['123', '456']);
|
|
74
|
+
});
|
|
75
|
+
test('extractPlaceholderIds returns empty for no placeholders', t => {
|
|
76
|
+
const displayValue = 'Regular text without placeholders';
|
|
77
|
+
const result = extractPlaceholderIds(displayValue);
|
|
78
|
+
t.deepEqual(result, []);
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=prompt-assembly.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-assembly.spec.js","sourceRoot":"","sources":["../../source/utils/prompt-assembly.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AAEvB,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,mEAAmE;AACnE,SAAS,cAAc,CAAC,UAAsB;IAC7C,IAAI,eAAe,GAAG,UAAU,CAAC,YAAY,CAAC;IAE9C,iDAAiD;IACjD,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,OAAO,CACpD,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,EAAE;QAC1B,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAClC,MAAM,kBAAkB,GAAG,aAAa,OAAO,iBAAiB,CAAC;YACjE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,kBAAk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AAE,EAAE;aACW;YAC5B,KAAK,EAAE;gBACN,IAAI,EAAE,eAAe,CAAC,KAAK;gBAC3B,WAAW,EAAE,wBAAwB;gBACrC,OAAO,EAAE,qBAAqB;gBAC9B,YAAY,EAAE,EAAE;aACW;SAC5B;KACD,CAAC;IAEF,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,qDAAqD,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,wCAAwC,EAAE,CAAC,CAAC,EAAE;IAClD,MAAM,UAAU,GAAe;QAC9B,YAAY,EAAE,mCAAmC;QACjD,kBAAkB,EAAE,EAAE;KACtB,CAAC;IAEF,MAAM,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,iDAAiD,EAAE,CAAC,CAAC,EAAE;IAC3D,MAAM,YAAY,GACjB,gEAAgE,CAAC;IAClE,MAAM,MAAM,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAEnD,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,yDAAyD,EAAE,CAAC,CAAC,EAAE;IACnE,MAAM,YAAY,GAAG,mCAAmC,CAAC;IACzD,MAAM,MAAM,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAEnD,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { Tool } from '../types/index.js';
|
|
2
|
+
import type { InputState } from '../types/hooks.js';
|
|
2
3
|
/**
|
|
3
4
|
* Process the main prompt template by injecting dynamic tool documentation and system info
|
|
4
5
|
*/
|
|
5
6
|
export declare function processPromptTemplate(tools: Tool[]): string;
|
|
7
|
+
/**
|
|
8
|
+
* Assemble the final prompt by replacing all placeholders with their full content
|
|
9
|
+
* This function is called before sending the prompt to the AI
|
|
10
|
+
*/
|
|
11
|
+
export declare function assemblePrompt(inputState: InputState): string;
|
|
12
|
+
/**
|
|
13
|
+
* Extract all placeholder IDs from a display value
|
|
14
|
+
* Useful for atomic deletion and validation
|
|
15
|
+
*/
|
|
16
|
+
export declare function extractPlaceholderIds(displayValue: string): string[];
|
|
6
17
|
//# sourceMappingURL=prompt-processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-processor.d.ts","sourceRoot":"","sources":["../../source/utils/prompt-processor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"prompt-processor.d.ts","sourceRoot":"","sources":["../../source/utils/prompt-processor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAqElD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CA8B3D;AAgGD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CA8C7D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAUpE"}
|
|
@@ -2,6 +2,7 @@ import { readFileSync, existsSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { platform, homedir, release } from 'os';
|
|
4
4
|
import { promptPath } from '../config/index.js';
|
|
5
|
+
import { PlaceholderType } from '../types/hooks.js';
|
|
5
6
|
/**
|
|
6
7
|
* Get the default shell for the current platform
|
|
7
8
|
*/
|
|
@@ -159,4 +160,60 @@ function formatToolDocumentation(tool) {
|
|
|
159
160
|
}
|
|
160
161
|
return doc;
|
|
161
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Assemble the final prompt by replacing all placeholders with their full content
|
|
165
|
+
* This function is called before sending the prompt to the AI
|
|
166
|
+
*/
|
|
167
|
+
export function assemblePrompt(inputState) {
|
|
168
|
+
let assembledPrompt = inputState.displayValue;
|
|
169
|
+
// Replace each placeholder with its full content
|
|
170
|
+
Object.entries(inputState.placeholderContent).forEach(([placeholderId, placeholderContent]) => {
|
|
171
|
+
// Each placeholder type can have its own replacement logic
|
|
172
|
+
let replacementContent = placeholderContent.content || '';
|
|
173
|
+
// Type-specific content assembly (extensible for future types)
|
|
174
|
+
switch (placeholderContent.type) {
|
|
175
|
+
case PlaceholderType.PASTE:
|
|
176
|
+
// For paste, use content directly
|
|
177
|
+
replacementContent = placeholderContent.content;
|
|
178
|
+
break;
|
|
179
|
+
case PlaceholderType.FILE:
|
|
180
|
+
// For file, could add file headers or other formatting
|
|
181
|
+
replacementContent = placeholderContent.content;
|
|
182
|
+
break;
|
|
183
|
+
default:
|
|
184
|
+
// TypeScript will ensure this is unreachable with proper enum usage
|
|
185
|
+
const _exhaustive = placeholderContent;
|
|
186
|
+
// Fallback for safety, though this should never be reached
|
|
187
|
+
replacementContent =
|
|
188
|
+
placeholderContent.displayText ||
|
|
189
|
+
placeholderContent.content ||
|
|
190
|
+
'';
|
|
191
|
+
}
|
|
192
|
+
// Use the displayText to find and replace the placeholder
|
|
193
|
+
const displayText = placeholderContent.displayText;
|
|
194
|
+
if (displayText) {
|
|
195
|
+
assembledPrompt = assembledPrompt.replace(displayText, replacementContent);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// Fallback for legacy paste format
|
|
199
|
+
const placeholderPattern = `\\[Paste #${placeholderId}: \\d+ chars\\]`;
|
|
200
|
+
const regex = new RegExp(placeholderPattern, 'g');
|
|
201
|
+
assembledPrompt = assembledPrompt.replace(regex, replacementContent);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return assembledPrompt;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Extract all placeholder IDs from a display value
|
|
208
|
+
* Useful for atomic deletion and validation
|
|
209
|
+
*/
|
|
210
|
+
export function extractPlaceholderIds(displayValue) {
|
|
211
|
+
const placeholderRegex = /\[Paste #(\d+): \d+ chars\]/g;
|
|
212
|
+
const matches = [];
|
|
213
|
+
let match;
|
|
214
|
+
while ((match = placeholderRegex.exec(displayValue)) !== null) {
|
|
215
|
+
matches.push(match[1]); // The captured paste ID
|
|
216
|
+
}
|
|
217
|
+
return matches;
|
|
218
|
+
}
|
|
162
219
|
//# sourceMappingURL=prompt-processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-processor.js","sourceRoot":"","sources":["../../source/utils/prompt-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,IAAI,CAAC;AAC5C,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"prompt-processor.js","sourceRoot":"","sources":["../../source/utils/prompt-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,IAAI,CAAC;AAC5C,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,SAAS,eAAe;IACvB,MAAM,QAAQ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AC;QACN,CAAC;QAED,0DAA0D;QAC1D,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC;QACnD,IAAI,WAAW,EAAE,CAAC;YACjB,eAAe,GAAG,eAAe,CAAC,OAAO,CACxC,WAAW,EACX,kBAAkB,CAClB,CAAC;QACH,CAAC;aAAM,CAAC;YACP,mCAAmC;YACnC,MAAM,kBAAkB,GAAG,aAAa,aAAa,iBAAiB,CAAC;YACvE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;YAClD,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;QACtE,CAAC;IACF,CAAC,CACD,CAAC;IAEF,OAAO,eAAe,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAoB;IACzD,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;IACxD,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,IAAI,KAAK,CAAC;IAEV,OAAO,CAAC,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB;IACjD,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanocollective/nanocoder",
|
|
3
3
|
"main": "dist/cli.js",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.8",
|
|
5
5
|
"description": "A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"cli",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"build": "tsc && tsc-alias && chmod +x dist/cli.js",
|
|
35
35
|
"dev": "tsc --watch",
|
|
36
36
|
"start": "node dist/cli.js",
|
|
37
|
-
"test": "prettier --check . &&
|
|
37
|
+
"test:all": "prettier --check . && ava",
|
|
38
|
+
"format": "prettier --write .",
|
|
38
39
|
"prepublishOnly": "npm run build"
|
|
39
40
|
},
|
|
40
41
|
"files": [
|
|
@@ -68,13 +69,14 @@
|
|
|
68
69
|
"undici": "^7.16.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
72
|
+
"@ava/typescript": "^6.0.0",
|
|
71
73
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
72
74
|
"@types/ink-text-input": "^2.0.5",
|
|
73
75
|
"@types/marked-terminal": "^6.1.1",
|
|
74
76
|
"@types/node": "^24.3.0",
|
|
75
77
|
"@types/react": "^19.0.0",
|
|
76
78
|
"@vdemedes/prettier-config": "^2.0.1",
|
|
77
|
-
"ava": "^
|
|
79
|
+
"ava": "^6.4.1",
|
|
78
80
|
"chalk": "^5.2.0",
|
|
79
81
|
"eslint-config-xo-react": "^0.27.0",
|
|
80
82
|
"eslint-plugin-react": "^7.32.2",
|
|
@@ -83,16 +85,19 @@
|
|
|
83
85
|
"prettier": "^2.8.7",
|
|
84
86
|
"ts-node": "^10.9.1",
|
|
85
87
|
"tsc-alias": "^1.8.16",
|
|
88
|
+
"tsx": "^4.20.6",
|
|
86
89
|
"typescript": "^5.0.3",
|
|
87
90
|
"xo": "^0.53.1"
|
|
88
91
|
},
|
|
89
92
|
"ava": {
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
+
"typescript": {
|
|
94
|
+
"rewritePaths": {
|
|
95
|
+
"source/": "dist/"
|
|
96
|
+
},
|
|
97
|
+
"compile": false
|
|
93
98
|
},
|
|
94
99
|
"nodeArguments": [
|
|
95
|
-
"--
|
|
100
|
+
"--import=tsx"
|
|
96
101
|
]
|
|
97
102
|
},
|
|
98
103
|
"xo": {
|
|
@@ -155,11 +155,13 @@ You have access to different tools for working with files. Understanding their r
|
|
|
155
155
|
**Purpose**: Read the contents of a file at the specified path with line numbers.
|
|
156
156
|
|
|
157
157
|
**When to Use**:
|
|
158
|
+
|
|
158
159
|
- When you need to examine file contents you don't already know
|
|
159
160
|
- To analyze code, review text files, or extract information
|
|
160
161
|
- Before making edits to understand current state and get line numbers
|
|
161
162
|
|
|
162
163
|
**Important**:
|
|
164
|
+
|
|
163
165
|
- NEVER use terminal commands (cat, head, tail) to read files
|
|
164
166
|
- Always use read_file to ensure content is properly preserved in context
|
|
165
167
|
- Returns content with line numbers in format ` 1: line content` for precise editing
|
|
@@ -170,6 +172,7 @@ You have access to different tools for working with files. Understanding their r
|
|
|
170
172
|
**Purpose**: Read multiple files at once efficiently.
|
|
171
173
|
|
|
172
174
|
**When to Use**:
|
|
175
|
+
|
|
173
176
|
- When you need to examine several related files
|
|
174
177
|
- To understand context across multiple files before making changes
|
|
175
178
|
- More efficient than multiple read_file calls
|
|
@@ -179,11 +182,13 @@ You have access to different tools for working with files. Understanding their r
|
|
|
179
182
|
**Purpose**: Create a new file with specified content.
|
|
180
183
|
|
|
181
184
|
**When to Use**:
|
|
185
|
+
|
|
182
186
|
- Creating new source code files
|
|
183
187
|
- Scaffolding new project files
|
|
184
188
|
- Adding new configuration files
|
|
185
189
|
|
|
186
190
|
**Important**:
|
|
191
|
+
|
|
187
192
|
- When creating new projects, organize files within a dedicated project directory unless specified otherwise
|
|
188
193
|
- Parent directories do not need to exist - the tool will create them automatically
|
|
189
194
|
- Structure projects logically following best practices for the project type
|
|
@@ -198,11 +203,13 @@ Nanocoder uses line-based editing tools that work with the line numbers from rea
|
|
|
198
203
|
**Purpose**: Insert new lines at a specific line number in a file.
|
|
199
204
|
|
|
200
205
|
**When to Use**:
|
|
206
|
+
|
|
201
207
|
- Adding new code or content at a specific location
|
|
202
208
|
- Inserting imports, function definitions, or configuration entries
|
|
203
209
|
- Adding content before or after existing lines
|
|
204
210
|
|
|
205
211
|
**How to Use**:
|
|
212
|
+
|
|
206
213
|
- First use read_file to get line numbers
|
|
207
214
|
- Specify the line_number where content should be inserted
|
|
208
215
|
- Provide the content to insert (can contain multiple lines with \n)
|
|
@@ -212,12 +219,14 @@ Nanocoder uses line-based editing tools that work with the line numbers from rea
|
|
|
212
219
|
**Purpose**: Replace a range of lines with new content.
|
|
213
220
|
|
|
214
221
|
**When to Use**:
|
|
222
|
+
|
|
215
223
|
- Modifying existing code or content
|
|
216
224
|
- Updating function implementations
|
|
217
225
|
- Changing configuration values
|
|
218
226
|
- Refactoring code blocks
|
|
219
227
|
|
|
220
228
|
**How to Use**:
|
|
229
|
+
|
|
221
230
|
- First use read_file to identify the line range
|
|
222
231
|
- Specify start_line and end_line (inclusive)
|
|
223
232
|
- Provide the new content (can be empty to delete the lines)
|
|
@@ -227,11 +236,13 @@ Nanocoder uses line-based editing tools that work with the line numbers from rea
|
|
|
227
236
|
**Purpose**: Delete a range of lines from a file.
|
|
228
237
|
|
|
229
238
|
**When to Use**:
|
|
239
|
+
|
|
230
240
|
- Removing code blocks
|
|
231
241
|
- Deleting unused imports or functions
|
|
232
242
|
- Cleaning up configuration files
|
|
233
243
|
|
|
234
244
|
**How to Use**:
|
|
245
|
+
|
|
235
246
|
- First use read_file to identify the line range
|
|
236
247
|
- Specify start_line and end_line (inclusive)
|
|
237
248
|
- Lines will be removed from the file
|
|
@@ -249,6 +260,7 @@ Nanocoder uses line-based editing tools that work with the line numbers from rea
|
|
|
249
260
|
## Auto-formatting Awareness
|
|
250
261
|
|
|
251
262
|
**Critical**: After using any file editing tool, the user's editor may automatically format the file. This can modify:
|
|
263
|
+
|
|
252
264
|
- Line breaks (single lines into multiple lines)
|
|
253
265
|
- Indentation (spaces vs tabs, 2 vs 4 spaces)
|
|
254
266
|
- Quote style (single vs double quotes)
|
|
@@ -264,19 +276,23 @@ Nanocoder uses line-based editing tools that work with the line numbers from rea
|
|
|
264
276
|
**Always use read_file first** to get line numbers before editing.
|
|
265
277
|
|
|
266
278
|
**Use insert_lines** when:
|
|
279
|
+
|
|
267
280
|
- Adding new content without removing existing content
|
|
268
281
|
- Inserting at the beginning, middle, or end of a file
|
|
269
282
|
|
|
270
283
|
**Use replace_lines** when:
|
|
284
|
+
|
|
271
285
|
- Modifying existing content
|
|
272
286
|
- Replacing one or more lines with new content
|
|
273
287
|
- Updating implementations or values
|
|
274
288
|
|
|
275
289
|
**Use delete_lines** when:
|
|
290
|
+
|
|
276
291
|
- Removing content without adding anything back
|
|
277
292
|
- Cleaning up unused code
|
|
278
293
|
|
|
279
294
|
**Use create_file** when:
|
|
295
|
+
|
|
280
296
|
- Creating new files that don't exist yet
|
|
281
297
|
- File creation will fail if file already exists
|
|
282
298
|
|
|
@@ -513,7 +529,9 @@ RULES AND CONSTRAINTS
|
|
|
513
529
|
SYSTEM INFORMATION
|
|
514
530
|
|
|
515
531
|
<!-- DYNAMIC_SYSTEM_INFO_START -->
|
|
532
|
+
|
|
516
533
|
System information will be dynamically inserted here.
|
|
534
|
+
|
|
517
535
|
<!-- DYNAMIC_SYSTEM_INFO_END -->
|
|
518
536
|
|
|
519
537
|
====
|