grov 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/LICENSE +190 -0
- package/README.md +211 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +106 -0
- package/dist/commands/capture.d.ts +6 -0
- package/dist/commands/capture.js +324 -0
- package/dist/commands/drift-test.d.ts +7 -0
- package/dist/commands/drift-test.js +177 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +27 -0
- package/dist/commands/inject.d.ts +5 -0
- package/dist/commands/inject.js +88 -0
- package/dist/commands/prompt-inject.d.ts +4 -0
- package/dist/commands/prompt-inject.js +451 -0
- package/dist/commands/status.d.ts +5 -0
- package/dist/commands/status.js +51 -0
- package/dist/commands/unregister.d.ts +1 -0
- package/dist/commands/unregister.js +22 -0
- package/dist/lib/anchor-extractor.d.ts +30 -0
- package/dist/lib/anchor-extractor.js +296 -0
- package/dist/lib/correction-builder.d.ts +10 -0
- package/dist/lib/correction-builder.js +226 -0
- package/dist/lib/debug.d.ts +24 -0
- package/dist/lib/debug.js +34 -0
- package/dist/lib/drift-checker.d.ts +66 -0
- package/dist/lib/drift-checker.js +341 -0
- package/dist/lib/hooks.d.ts +27 -0
- package/dist/lib/hooks.js +258 -0
- package/dist/lib/jsonl-parser.d.ts +87 -0
- package/dist/lib/jsonl-parser.js +281 -0
- package/dist/lib/llm-extractor.d.ts +50 -0
- package/dist/lib/llm-extractor.js +408 -0
- package/dist/lib/session-parser.d.ts +44 -0
- package/dist/lib/session-parser.js +256 -0
- package/dist/lib/store.d.ts +248 -0
- package/dist/lib/store.js +793 -0
- package/dist/lib/utils.d.ts +31 -0
- package/dist/lib/utils.js +76 -0
- package/package.json +67 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility functions for Grov CLI.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Truncate a string to a maximum length, adding ellipsis if truncated.
|
|
6
|
+
*/
|
|
7
|
+
export declare function truncate(str: string, maxLength: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Capitalize the first letter of a string.
|
|
10
|
+
*/
|
|
11
|
+
export declare function capitalize(str: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Deduplicate items in an array by a key function.
|
|
14
|
+
*/
|
|
15
|
+
export declare function dedupeBy<T>(items: T[], keyFn: (item: T) => string): T[];
|
|
16
|
+
/**
|
|
17
|
+
* Format a date as a relative time string (e.g., "2 hours ago").
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatRelativeTime(date: Date | string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Safely extract a substring from a string.
|
|
22
|
+
*/
|
|
23
|
+
export declare function safeSubstring(str: string, start: number, end?: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Check if a value is a non-empty string.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isNonEmptyString(value: unknown): value is string;
|
|
28
|
+
/**
|
|
29
|
+
* Sleep for a specified number of milliseconds.
|
|
30
|
+
*/
|
|
31
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility functions for Grov CLI.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Truncate a string to a maximum length, adding ellipsis if truncated.
|
|
6
|
+
*/
|
|
7
|
+
export function truncate(str, maxLength) {
|
|
8
|
+
if (str.length <= maxLength)
|
|
9
|
+
return str;
|
|
10
|
+
return str.substring(0, maxLength - 3) + '...';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Capitalize the first letter of a string.
|
|
14
|
+
*/
|
|
15
|
+
export function capitalize(str) {
|
|
16
|
+
if (!str)
|
|
17
|
+
return str;
|
|
18
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Deduplicate items in an array by a key function.
|
|
22
|
+
*/
|
|
23
|
+
export function dedupeBy(items, keyFn) {
|
|
24
|
+
const seen = new Set();
|
|
25
|
+
return items.filter(item => {
|
|
26
|
+
const key = keyFn(item);
|
|
27
|
+
if (seen.has(key))
|
|
28
|
+
return false;
|
|
29
|
+
seen.add(key);
|
|
30
|
+
return true;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Format a date as a relative time string (e.g., "2 hours ago").
|
|
35
|
+
*/
|
|
36
|
+
export function formatRelativeTime(date) {
|
|
37
|
+
const now = new Date();
|
|
38
|
+
const then = typeof date === 'string' ? new Date(date) : date;
|
|
39
|
+
const diffMs = now.getTime() - then.getTime();
|
|
40
|
+
const diffSeconds = Math.floor(diffMs / 1000);
|
|
41
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
42
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
43
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
44
|
+
if (diffDays > 0) {
|
|
45
|
+
return diffDays === 1 ? '1 day ago' : `${diffDays} days ago`;
|
|
46
|
+
}
|
|
47
|
+
if (diffHours > 0) {
|
|
48
|
+
return diffHours === 1 ? '1 hour ago' : `${diffHours} hours ago`;
|
|
49
|
+
}
|
|
50
|
+
if (diffMinutes > 0) {
|
|
51
|
+
return diffMinutes === 1 ? '1 minute ago' : `${diffMinutes} minutes ago`;
|
|
52
|
+
}
|
|
53
|
+
return 'just now';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Safely extract a substring from a string.
|
|
57
|
+
*/
|
|
58
|
+
export function safeSubstring(str, start, end) {
|
|
59
|
+
if (!str)
|
|
60
|
+
return '';
|
|
61
|
+
const safeStart = Math.max(0, Math.min(start, str.length));
|
|
62
|
+
const safeEnd = end !== undefined ? Math.min(end, str.length) : str.length;
|
|
63
|
+
return str.substring(safeStart, safeEnd);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if a value is a non-empty string.
|
|
67
|
+
*/
|
|
68
|
+
export function isNonEmptyString(value) {
|
|
69
|
+
return typeof value === 'string' && value.length > 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sleep for a specified number of milliseconds.
|
|
73
|
+
*/
|
|
74
|
+
export function sleep(ms) {
|
|
75
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
76
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "grov",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Collective AI memory for Claude Code - captures reasoning from sessions and injects context into future sessions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/cli.js",
|
|
7
|
+
"types": "dist/cli.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"grov": "dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**/*.js",
|
|
13
|
+
"dist/**/*.d.ts",
|
|
14
|
+
"!dist/**/*.test.js",
|
|
15
|
+
"!dist/**/*.test.d.ts",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"dev": "tsc --watch",
|
|
22
|
+
"start": "node dist/cli.js",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"prepublishOnly": "npm run build && npm test"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"claude",
|
|
29
|
+
"claude-code",
|
|
30
|
+
"anthropic",
|
|
31
|
+
"ai",
|
|
32
|
+
"memory",
|
|
33
|
+
"reasoning",
|
|
34
|
+
"context",
|
|
35
|
+
"llm",
|
|
36
|
+
"developer-tools",
|
|
37
|
+
"cli"
|
|
38
|
+
],
|
|
39
|
+
"author": "Tony <github.com/TonyStef>",
|
|
40
|
+
"license": "Apache-2.0",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/TonyStef/Grov.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/TonyStef/Grov/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://grov.dev",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@anthropic-ai/sdk": "^0.32.1",
|
|
51
|
+
"better-sqlite3": "^11.6.0",
|
|
52
|
+
"commander": "^12.1.0",
|
|
53
|
+
"debug": "^4.4.3",
|
|
54
|
+
"dotenv": "^16.4.5",
|
|
55
|
+
"openai": "^4.70.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/better-sqlite3": "^7.6.11",
|
|
59
|
+
"@types/debug": "^4.1.12",
|
|
60
|
+
"@types/node": "^22.10.0",
|
|
61
|
+
"typescript": "^5.7.2",
|
|
62
|
+
"vitest": "^2.1.9"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=18.0.0"
|
|
66
|
+
}
|
|
67
|
+
}
|