@telepat/snoopy 0.1.13 → 0.1.15
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 +70 -215
- package/README.zh-CN.md +137 -0
- package/dist/src/agent/install.d.ts +18 -0
- package/dist/src/agent/install.js +488 -0
- package/dist/src/cli/commands/feedback.d.ts +18 -0
- package/dist/src/cli/commands/feedback.js +276 -0
- package/dist/src/cli/commands/prompt.d.ts +6 -0
- package/dist/src/cli/commands/prompt.js +92 -0
- package/dist/src/cli/commands/promptEditor.d.ts +1 -0
- package/dist/src/cli/commands/promptEditor.js +17 -0
- package/dist/src/cli/flows/jobAddFlow.js +1 -1
- package/dist/src/cli/index.js +86 -1
- package/dist/src/mcp/helpers.d.ts +46 -0
- package/dist/src/mcp/helpers.js +506 -0
- package/dist/src/mcp/server.d.ts +1 -0
- package/dist/src/mcp/server.js +299 -0
- package/dist/src/mcp/tools.d.ts +90 -0
- package/dist/src/mcp/tools.js +106 -0
- package/dist/src/services/db/migrations/002_feedback_fields.d.ts +7 -0
- package/dist/src/services/db/migrations/002_feedback_fields.js +22 -0
- package/dist/src/services/db/migrations/index.js +2 -1
- package/dist/src/services/db/repositories/jobsRepo.d.ts +2 -0
- package/dist/src/services/db/repositories/jobsRepo.js +15 -0
- package/dist/src/services/db/repositories/scanItemsRepo.d.ts +17 -0
- package/dist/src/services/db/repositories/scanItemsRepo.js +197 -2
- package/dist/src/services/feedback/consolidationService.d.ts +28 -0
- package/dist/src/services/feedback/consolidationService.js +124 -0
- package/dist/src/services/openrouter/client.d.ts +23 -0
- package/dist/src/services/openrouter/client.js +67 -0
- package/dist/src/types/settings.d.ts +1 -1
- package/dist/src/types/settings.js +1 -1
- package/dist/src/ui/components/MultilinePrompt.d.ts +10 -0
- package/dist/src/ui/components/MultilinePrompt.js +87 -0
- package/dist/src/ui/components/multilinePromptModel.d.ts +25 -0
- package/dist/src/ui/components/multilinePromptModel.js +76 -0
- package/package.json +4 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface CursorPosition {
|
|
2
|
+
line: number;
|
|
3
|
+
column: number;
|
|
4
|
+
}
|
|
5
|
+
export interface VerticalMoveResult {
|
|
6
|
+
nextOffset: number;
|
|
7
|
+
preferredColumn: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function splitLines(value: string): string[];
|
|
10
|
+
export declare function offsetToCursor(value: string, offset: number): CursorPosition;
|
|
11
|
+
export declare function cursorToOffset(value: string, position: CursorPosition): number;
|
|
12
|
+
export declare function moveCursorHorizontal(value: string, offset: number, delta: -1 | 1): number;
|
|
13
|
+
export declare function moveCursorVertical(value: string, offset: number, direction: -1 | 1, preferredColumn?: number): VerticalMoveResult;
|
|
14
|
+
export declare function insertAtOffset(value: string, offset: number, inserted: string): {
|
|
15
|
+
value: string;
|
|
16
|
+
offset: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function backspaceAtOffset(value: string, offset: number): {
|
|
19
|
+
value: string;
|
|
20
|
+
offset: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function deleteAtOffset(value: string, offset: number): {
|
|
23
|
+
value: string;
|
|
24
|
+
offset: number;
|
|
25
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export function splitLines(value) {
|
|
2
|
+
const lines = value.split('\n');
|
|
3
|
+
return lines.length > 0 ? lines : [''];
|
|
4
|
+
}
|
|
5
|
+
export function offsetToCursor(value, offset) {
|
|
6
|
+
const safeOffset = Math.max(0, Math.min(offset, value.length));
|
|
7
|
+
let line = 0;
|
|
8
|
+
let column = 0;
|
|
9
|
+
for (let index = 0; index < safeOffset; index += 1) {
|
|
10
|
+
if (value[index] === '\n') {
|
|
11
|
+
line += 1;
|
|
12
|
+
column = 0;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
column += 1;
|
|
16
|
+
}
|
|
17
|
+
return { line, column };
|
|
18
|
+
}
|
|
19
|
+
export function cursorToOffset(value, position) {
|
|
20
|
+
const lines = splitLines(value);
|
|
21
|
+
const safeLine = Math.max(0, Math.min(position.line, lines.length - 1));
|
|
22
|
+
const lineLength = lines[safeLine]?.length ?? 0;
|
|
23
|
+
const safeColumn = Math.max(0, Math.min(position.column, lineLength));
|
|
24
|
+
let offset = 0;
|
|
25
|
+
for (let index = 0; index < safeLine; index += 1) {
|
|
26
|
+
offset += (lines[index]?.length ?? 0) + 1;
|
|
27
|
+
}
|
|
28
|
+
return offset + safeColumn;
|
|
29
|
+
}
|
|
30
|
+
export function moveCursorHorizontal(value, offset, delta) {
|
|
31
|
+
if (delta < 0) {
|
|
32
|
+
return Math.max(0, offset - 1);
|
|
33
|
+
}
|
|
34
|
+
return Math.min(value.length, offset + 1);
|
|
35
|
+
}
|
|
36
|
+
export function moveCursorVertical(value, offset, direction, preferredColumn) {
|
|
37
|
+
const cursor = offsetToCursor(value, offset);
|
|
38
|
+
const lines = splitLines(value);
|
|
39
|
+
const nextLine = Math.max(0, Math.min(lines.length - 1, cursor.line + direction));
|
|
40
|
+
const targetColumn = preferredColumn ?? cursor.column;
|
|
41
|
+
const maxColumn = lines[nextLine]?.length ?? 0;
|
|
42
|
+
const nextColumn = Math.max(0, Math.min(targetColumn, maxColumn));
|
|
43
|
+
return {
|
|
44
|
+
nextOffset: cursorToOffset(value, { line: nextLine, column: nextColumn }),
|
|
45
|
+
preferredColumn: targetColumn,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function insertAtOffset(value, offset, inserted) {
|
|
49
|
+
const safeOffset = Math.max(0, Math.min(offset, value.length));
|
|
50
|
+
const nextValue = `${value.slice(0, safeOffset)}${inserted}${value.slice(safeOffset)}`;
|
|
51
|
+
return {
|
|
52
|
+
value: nextValue,
|
|
53
|
+
offset: safeOffset + inserted.length,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function backspaceAtOffset(value, offset) {
|
|
57
|
+
const safeOffset = Math.max(0, Math.min(offset, value.length));
|
|
58
|
+
if (safeOffset === 0) {
|
|
59
|
+
return { value, offset: safeOffset };
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
value: `${value.slice(0, safeOffset - 1)}${value.slice(safeOffset)}`,
|
|
63
|
+
offset: safeOffset - 1,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export function deleteAtOffset(value, offset) {
|
|
67
|
+
const safeOffset = Math.max(0, Math.min(offset, value.length));
|
|
68
|
+
if (safeOffset >= value.length) {
|
|
69
|
+
return { value, offset: safeOffset };
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
value: `${value.slice(0, safeOffset)}${value.slice(safeOffset + 1)}`,
|
|
73
|
+
offset: safeOffset,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=multilinePromptModel.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telepat/snoopy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Snoopy CLI for Reddit conversation monitoring jobs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"docs:build": "npm --prefix website run build",
|
|
25
25
|
"docs:serve": "npm --prefix website run serve",
|
|
26
26
|
"docs:deploy": "npm --prefix website run deploy",
|
|
27
|
+
"docs:write-translations": "npm --prefix website run write-translations",
|
|
27
28
|
"e2e:smoke": "tsx src/scripts/e2eSmoke.ts",
|
|
28
29
|
"e2e:fresh": "tsx tests/e2e/freshInstall.ts",
|
|
29
30
|
"e2e:upgrade": "tsx tests/e2e/upgrade.ts",
|
|
@@ -53,9 +54,11 @@
|
|
|
53
54
|
"license": "ISC",
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@inkjs/ui": "^2.0.0",
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
56
58
|
"better-sqlite3": "^12.8.0",
|
|
57
59
|
"commander": "^14.0.3",
|
|
58
60
|
"ink": "^6.8.0",
|
|
61
|
+
"jest-diff": "^29.7.0",
|
|
59
62
|
"keytar": "^7.9.0",
|
|
60
63
|
"node-cron": "^4.2.1",
|
|
61
64
|
"node-notifier": "^10.0.1",
|