claude-code-smart-fork 1.0.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/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +317 -0
- package/README.zh-CN.md +45 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +351 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/__tests__/embedding.test.d.ts +2 -0
- package/dist/core/__tests__/embedding.test.d.ts.map +1 -0
- package/dist/core/__tests__/embedding.test.js +90 -0
- package/dist/core/__tests__/embedding.test.js.map +1 -0
- package/dist/core/config.d.ts +19 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +105 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/embedding.d.ts +28 -0
- package/dist/core/embedding.d.ts.map +1 -0
- package/dist/core/embedding.js +137 -0
- package/dist/core/embedding.js.map +1 -0
- package/dist/core/fork-detector.d.ts +38 -0
- package/dist/core/fork-detector.d.ts.map +1 -0
- package/dist/core/fork-detector.js +234 -0
- package/dist/core/fork-detector.js.map +1 -0
- package/dist/core/session-manager.d.ts +77 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +525 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/vector-store.d.ts +47 -0
- package/dist/core/vector-store.d.ts.map +1 -0
- package/dist/core/vector-store.js +204 -0
- package/dist/core/vector-store.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/claude-code.d.ts +53 -0
- package/dist/integrations/claude-code.d.ts.map +1 -0
- package/dist/integrations/claude-code.js +277 -0
- package/dist/integrations/claude-code.js.map +1 -0
- package/dist/types/index.d.ts +106 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart Forking System - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
export interface Session {
|
|
5
|
+
id: string;
|
|
6
|
+
projectPath: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
createdAt: number;
|
|
9
|
+
updatedAt: number;
|
|
10
|
+
messages: SessionMessage[];
|
|
11
|
+
summary?: string;
|
|
12
|
+
tags: string[];
|
|
13
|
+
embedding?: number[];
|
|
14
|
+
/**
|
|
15
|
+
* Complete conversation history including both user questions and assistant responses
|
|
16
|
+
*/
|
|
17
|
+
conversationHistory?: ConversationTurn[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents a single turn in the conversation (user + assistant)
|
|
21
|
+
*/
|
|
22
|
+
export interface ConversationTurn {
|
|
23
|
+
id: string;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
userMessage: {
|
|
26
|
+
content: string;
|
|
27
|
+
metadata?: {
|
|
28
|
+
files?: string[];
|
|
29
|
+
images?: string[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
assistantMessage?: {
|
|
33
|
+
content: string;
|
|
34
|
+
toolCalls?: ToolCall[];
|
|
35
|
+
metadata?: {
|
|
36
|
+
model?: string;
|
|
37
|
+
tokensUsed?: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface ToolCall {
|
|
42
|
+
id: string;
|
|
43
|
+
type: 'read_file' | 'edit_file' | 'bash' | 'search' | string;
|
|
44
|
+
parameters: Record<string, any>;
|
|
45
|
+
result?: any;
|
|
46
|
+
}
|
|
47
|
+
export interface SessionMessage {
|
|
48
|
+
id: string;
|
|
49
|
+
role: 'user' | 'assistant';
|
|
50
|
+
content: string;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
metadata?: {
|
|
53
|
+
codeBlocks?: string[];
|
|
54
|
+
filePaths?: string[];
|
|
55
|
+
commands?: string[];
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface SessionIndex {
|
|
59
|
+
id: string;
|
|
60
|
+
projectPath: string;
|
|
61
|
+
projectName: string;
|
|
62
|
+
createdAt: number;
|
|
63
|
+
updatedAt: number;
|
|
64
|
+
messageCount: number;
|
|
65
|
+
summary: string;
|
|
66
|
+
tags: string[];
|
|
67
|
+
keyTopics: string[];
|
|
68
|
+
embedding: number[];
|
|
69
|
+
}
|
|
70
|
+
export interface SearchQuery {
|
|
71
|
+
text: string;
|
|
72
|
+
projectPath?: string;
|
|
73
|
+
limit?: number;
|
|
74
|
+
threshold?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface SearchResult {
|
|
77
|
+
session: SessionIndex;
|
|
78
|
+
score: number;
|
|
79
|
+
matchedMessage?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ForkContext {
|
|
82
|
+
sourceSessionId: string;
|
|
83
|
+
targetSessionId: string;
|
|
84
|
+
preservedContext: {
|
|
85
|
+
files: string[];
|
|
86
|
+
environment: Record<string, string>;
|
|
87
|
+
gitBranch?: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export interface Config {
|
|
91
|
+
vectorStore: {
|
|
92
|
+
provider: 'chroma' | 'pinecone' | 'local';
|
|
93
|
+
dimension: number;
|
|
94
|
+
collectionName: string;
|
|
95
|
+
};
|
|
96
|
+
embedding: {
|
|
97
|
+
provider: 'openai' | 'local' | 'ollama';
|
|
98
|
+
model: string;
|
|
99
|
+
dimension: number;
|
|
100
|
+
};
|
|
101
|
+
storage: {
|
|
102
|
+
sessionsDir: string;
|
|
103
|
+
indexPath: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACtB,EAA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ACxB,CAAC;IACF,SAAS,EAAE;QACT,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;QACxC,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-code-smart-fork",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Smart session forking for Claude Code - find and resume relevant historical sessions across projects",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"smart-fork": "dist/index.js",
|
|
9
|
+
"cc-fork": "dist/index.js",
|
|
10
|
+
"fork-detect": "dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/**/*",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.md",
|
|
16
|
+
"CHANGELOG.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"start": "node dist/index.js",
|
|
22
|
+
"test": "jest",
|
|
23
|
+
"test:watch": "jest --watch",
|
|
24
|
+
"test:coverage": "jest --coverage",
|
|
25
|
+
"lint": "eslint src/**/*.ts",
|
|
26
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
27
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
28
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
29
|
+
"clean": "rimraf dist",
|
|
30
|
+
"prebuild": "npm run clean",
|
|
31
|
+
"prepublishOnly": "npm run build && npm test",
|
|
32
|
+
"prepare": "npm run build",
|
|
33
|
+
"postinstall": "node scripts/install.js"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"claude-code",
|
|
37
|
+
"claude",
|
|
38
|
+
"fork",
|
|
39
|
+
"session",
|
|
40
|
+
"search",
|
|
41
|
+
"vector",
|
|
42
|
+
"semantic-search",
|
|
43
|
+
"ai",
|
|
44
|
+
"cli"
|
|
45
|
+
],
|
|
46
|
+
"author": "fjibj",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/fjibj/claude-code-smart-fork.git"
|
|
51
|
+
},
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/fjibj/claude-code-smart-fork/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://github.com/fjibj/claude-code-smart-fork#readme",
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"chalk": "^4.1.2",
|
|
58
|
+
"commander": "^12.1.0",
|
|
59
|
+
"uuid": "^9.0.1"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/jest": "^29.5.14",
|
|
63
|
+
"@types/node": "^22.10.2",
|
|
64
|
+
"@types/uuid": "^10.0.0",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
66
|
+
"@typescript-eslint/parser": "^8.18.2",
|
|
67
|
+
"eslint": "^8.57.0",
|
|
68
|
+
"eslint-config-prettier": "^9.1.0",
|
|
69
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
70
|
+
"jest": "^29.7.0",
|
|
71
|
+
"prettier": "^3.4.2",
|
|
72
|
+
"rimraf": "^6.0.1",
|
|
73
|
+
"ts-jest": "^29.2.5",
|
|
74
|
+
"typescript": "^5.7.2"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=16.0.0"
|
|
78
|
+
}
|
|
79
|
+
}
|