tarsk 0.3.3 → 0.3.16
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/cli.d.ts +3 -0
- package/dist/cli.js +22 -0
- package/dist/index.js +3 -2
- package/dist/public/assets/{index-DJC-p914.js → index-CLr9LKtA.js} +1679 -1682
- package/dist/public/index.html +1 -1
- package/node_modules/@neovate/code/LICENSE +21 -0
- package/node_modules/@neovate/code/README.md +56 -0
- package/node_modules/@neovate/code/dist/cli.mjs +714 -716
- package/node_modules/@neovate/code/dist/index.d.ts +0 -373
- package/node_modules/@neovate/code/dist/index.mjs +790 -792
- package/node_modules/@neovate/code/package.json +138 -2
- package/node_modules/@neovate/code/vendor/ripgrep/COPYING +3 -0
- package/node_modules/@neovate/code/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/node_modules/@neovate/code/vendor/ripgrep/arm64-linux/rg +0 -0
- package/node_modules/@neovate/code/vendor/ripgrep/x64-darwin/rg +0 -0
- package/node_modules/@neovate/code/vendor/ripgrep/x64-linux/rg +0 -0
- package/node_modules/@neovate/code/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/package.json +2 -2
- package/dist/managers/ConversationManager.d.ts +0 -83
- package/dist/managers/ConversationManager.js +0 -129
- package/dist/managers/GitManager.d.ts +0 -133
- package/dist/managers/GitManager.js +0 -330
- package/dist/managers/MetadataManager.d.ts +0 -139
- package/dist/managers/MetadataManager.js +0 -309
- package/dist/managers/ModelManager.d.ts +0 -57
- package/dist/managers/ModelManager.js +0 -129
- package/dist/managers/NeovateExecutor.d.ts +0 -40
- package/dist/managers/NeovateExecutor.js +0 -138
- package/dist/managers/ProjectManager.d.ts +0 -162
- package/dist/managers/ProjectManager.js +0 -353
- package/dist/managers/ThreadManager.d.ts +0 -181
- package/dist/managers/ThreadManager.js +0 -325
- package/dist/model-info-openai.d.ts +0 -17
- package/dist/model-info-openai.js +0 -59
- package/dist/public/assets/index-B443aj9k.js +0 -8506
- package/dist/routes/chat-old.d.ts +0 -21
- package/dist/routes/chat-old.js +0 -251
- package/dist/routes/projects-old.d.ts +0 -20
- package/dist/routes/projects-old.js +0 -297
- package/dist/routes/threads-old.d.ts +0 -14
- package/dist/routes/threads-old.js +0 -393
- package/dist/utils/openai-pricing-scraper.d.ts +0 -17
- package/dist/utils/openai-pricing-scraper.js +0 -185
|
@@ -2,10 +2,146 @@
|
|
|
2
2
|
"name": "@neovate/code",
|
|
3
3
|
"version": "0.27.1",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"vendor"
|
|
8
|
+
],
|
|
5
9
|
"main": "./dist/index.mjs",
|
|
6
10
|
"types": "./dist/index.d.ts",
|
|
11
|
+
"source": "./src/index.ts",
|
|
7
12
|
"bin": {
|
|
8
13
|
"neovate": "./dist/cli.mjs"
|
|
9
14
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
15
|
+
"scripts": {
|
|
16
|
+
"dev": "bun ./src/cli.ts",
|
|
17
|
+
"format": "biome format .",
|
|
18
|
+
"build:type": "tsc --project tsconfig.json --emitDeclarationOnly --declarationDir dist-dts",
|
|
19
|
+
"build:cli": "bun build src/cli.ts --external react-devtools-core --minify --outfile dist/cli.mjs --target=node",
|
|
20
|
+
"build:index": "bun build src/index.ts --external react-devtools-core --minify --outfile dist/index.mjs --target=node",
|
|
21
|
+
"build:dts": "npm run build:type && api-extractor run --local --verbose",
|
|
22
|
+
"build:post": "bun scripts/post-build.ts",
|
|
23
|
+
"build": "rm -rf dist dist-dts && npm run build:cli && npm run build:index && npm run build:dts && npm run build:post",
|
|
24
|
+
"ci": "npm run typecheck && npm run format && npm run test && npm run build && npm run test:cli",
|
|
25
|
+
"detect-unused": "bun scripts/detect-unused.ts",
|
|
26
|
+
"extension:build": "pnpm --filter neovate-assistant build",
|
|
27
|
+
"extension:dev": "pnpm --filter neovate-assistant dev",
|
|
28
|
+
"extension:publish": "cd vscode-extension && npm run publish && cd ..",
|
|
29
|
+
"extension:package": "pnpm --filter neovate-assistant package",
|
|
30
|
+
"extension:bump": "pnpm --filter neovate-assistant bump",
|
|
31
|
+
"release": "npm run ci && bun scripts/release.ts",
|
|
32
|
+
"release:minor": "npm run ci && bun scripts/release.ts --minor",
|
|
33
|
+
"release:major": "npm run ci && bun scripts/release.ts --major",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:cli": "bun scripts/cli-integration-test.ts",
|
|
36
|
+
"test:watch": "vitest",
|
|
37
|
+
"test:e2e": "bun scripts/e2e.ts",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"prepare": "husky",
|
|
40
|
+
"ready": "bun scripts/ready.ts",
|
|
41
|
+
"update:ripgrep": "bun scripts/updateRipgrep.ts"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"cli",
|
|
45
|
+
"neovate",
|
|
46
|
+
"neo",
|
|
47
|
+
"ai",
|
|
48
|
+
"coding-agent",
|
|
49
|
+
"agent"
|
|
50
|
+
],
|
|
51
|
+
"authors": [
|
|
52
|
+
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
53
|
+
],
|
|
54
|
+
"homepage": "https://neovateai.dev",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/neovateai/neovate-code/"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/neovateai/neovate-code/issues"
|
|
61
|
+
},
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"description": "A coding agent to enhance your development workflow.",
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@agentclientprotocol/sdk": "^0.13.0",
|
|
66
|
+
"@ai-sdk/anthropic": "^3.0.35",
|
|
67
|
+
"@ai-sdk/google": "^3.0.20",
|
|
68
|
+
"@ai-sdk/mcp": "^1.0.18",
|
|
69
|
+
"@ai-sdk/openai": "^3.0.25",
|
|
70
|
+
"@ai-sdk/openai-compatible": "^2.0.26",
|
|
71
|
+
"@ai-sdk/provider": "^3.0.7",
|
|
72
|
+
"@biomejs/biome": "^2.3.13",
|
|
73
|
+
"@fastify/type-provider-typebox": "6.1.0",
|
|
74
|
+
"@microsoft/api-extractor": "^7.56.0",
|
|
75
|
+
"@modelcontextprotocol/inspector": "^0.19.0",
|
|
76
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
77
|
+
"@openrouter/ai-sdk-provider": "^2.1.1",
|
|
78
|
+
"@types/bun": "^1.3.8",
|
|
79
|
+
"@types/debug": "^4.1.12",
|
|
80
|
+
"@types/degit": "^2.8.6",
|
|
81
|
+
"@types/lodash-es": "^4.17.12",
|
|
82
|
+
"@types/marked-terminal": "^6.1.1",
|
|
83
|
+
"@types/node": "^25.1.0",
|
|
84
|
+
"@types/react": "^19.2.10",
|
|
85
|
+
"@types/resolve": "^1.20.6",
|
|
86
|
+
"@types/turndown": "^5.0.6",
|
|
87
|
+
"@types/ws": "^8.18.1",
|
|
88
|
+
"@types/yargs-parser": "^21.0.3",
|
|
89
|
+
"ai": "^6.0.67",
|
|
90
|
+
"chalk": "^5.5.0",
|
|
91
|
+
"chardet": "^2.1.1",
|
|
92
|
+
"cli-highlight": "^2.1.11",
|
|
93
|
+
"clipboardy": "^5.1.0",
|
|
94
|
+
"debug": "^4.4.3",
|
|
95
|
+
"defu": "^6.1.4",
|
|
96
|
+
"degit": "^2.8.4",
|
|
97
|
+
"diff": "^8.0.3",
|
|
98
|
+
"fastify": "^5.7.2",
|
|
99
|
+
"fastmcp": "^3.31.0",
|
|
100
|
+
"front-matter": "^4.0.2",
|
|
101
|
+
"glob": "^13.0.0",
|
|
102
|
+
"gpt-tokenizer": "^3.4.0",
|
|
103
|
+
"gradient-string": "^3.0.0",
|
|
104
|
+
"husky": "^9.1.7",
|
|
105
|
+
"ink": "^6.6.0",
|
|
106
|
+
"ink-select-input": "^6.2.0",
|
|
107
|
+
"ink-spinner": "^5.0.0",
|
|
108
|
+
"is-unicode-supported": "^2.1.0",
|
|
109
|
+
"jiti": "^2.6.1",
|
|
110
|
+
"jsonrepair": "^3.13.2",
|
|
111
|
+
"lint-staged": "^16.2.7",
|
|
112
|
+
"lodash-es": "^4.17.23",
|
|
113
|
+
"marked": "^17.0.1",
|
|
114
|
+
"marked-terminal": "^7.3.0",
|
|
115
|
+
"oauth-providers": "^1.0.5",
|
|
116
|
+
"open": "^11.0.0",
|
|
117
|
+
"pathe": "^2.0.3",
|
|
118
|
+
"picocolors": "^1.1.1",
|
|
119
|
+
"portfinder": "^1.0.38",
|
|
120
|
+
"react": "^19.2.4",
|
|
121
|
+
"resolve": "^1.22.11",
|
|
122
|
+
"spawn-rx": "^5.1.2",
|
|
123
|
+
"strip-ansi": "^7.1.0",
|
|
124
|
+
"tar": "^7.5.7",
|
|
125
|
+
"terminal-link": "^5.0.0",
|
|
126
|
+
"turndown": "^7.2.2",
|
|
127
|
+
"typescript": "^5.9.3",
|
|
128
|
+
"undici": "6.13.0",
|
|
129
|
+
"vitest": "^4.0.18",
|
|
130
|
+
"wrap-ansi": "^9.0.0",
|
|
131
|
+
"ws": "^8.19.0",
|
|
132
|
+
"yargs-parser": "22.0.0",
|
|
133
|
+
"zod": "^4.3.6",
|
|
134
|
+
"zustand": "^5.0.11"
|
|
135
|
+
},
|
|
136
|
+
"volta": {
|
|
137
|
+
"node": "22.11.0",
|
|
138
|
+
"pnpm": "10.13.1"
|
|
139
|
+
},
|
|
140
|
+
"packageManager": "pnpm@10.13.1",
|
|
141
|
+
"lint-staged": {
|
|
142
|
+
"*.{js,jsx,ts,tsx,json,css}": "biome format --write"
|
|
143
|
+
},
|
|
144
|
+
"publishConfig": {
|
|
145
|
+
"access": "public"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tarsk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.16",
|
|
4
4
|
"description": "CLI for Tarsk - Project Threads Manager",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"dev": "NODE_ENV=development tsx watch src/index.ts",
|
|
19
19
|
"build": "tsc",
|
|
20
|
-
"start": "node dist/index.js",
|
|
20
|
+
"start": "NODE_ENV=development node dist/index.js",
|
|
21
21
|
"lint": "eslint .",
|
|
22
22
|
"test": "vitest run"
|
|
23
23
|
},
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConversationManager handles conversation history storage and retrieval
|
|
3
|
-
*
|
|
4
|
-
* This manager is responsible for:
|
|
5
|
-
* - Storing request/response pairs in JSON format
|
|
6
|
-
* - Retrieving conversation history for a thread
|
|
7
|
-
* - Managing conversation persistence
|
|
8
|
-
*/
|
|
9
|
-
import { ConversationHistory, ConversationMessage, NeovateEvent, FileData } from '../types/models.js';
|
|
10
|
-
/**
|
|
11
|
-
* ConversationManager interface defines the contract for conversation operations
|
|
12
|
-
*/
|
|
13
|
-
export interface ConversationManager {
|
|
14
|
-
/**
|
|
15
|
-
* Starts a new conversation message (request captured)
|
|
16
|
-
* @param threadId - The thread ID
|
|
17
|
-
* @param threadPath - The absolute path to the thread directory
|
|
18
|
-
* @param message - The user's message
|
|
19
|
-
* @param model - The model being used
|
|
20
|
-
* @param attachments - Optional file attachments
|
|
21
|
-
* @param planMode - Optional plan mode flag
|
|
22
|
-
* @returns The message ID for this conversation
|
|
23
|
-
*/
|
|
24
|
-
startMessage(threadId: string, threadPath: string, message: string, model: string, attachments?: FileData[], planMode?: boolean): Promise<string>;
|
|
25
|
-
/**
|
|
26
|
-
* Completes a conversation message (response captured)
|
|
27
|
-
* @param threadPath - The absolute path to the thread directory
|
|
28
|
-
* @param messageId - The message ID to complete
|
|
29
|
-
* @param content - The complete response content
|
|
30
|
-
* @param events - All events captured during execution
|
|
31
|
-
*/
|
|
32
|
-
completeMessage(threadPath: string, messageId: string, content: string, events: NeovateEvent[]): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Gets the conversation history for a thread
|
|
35
|
-
* @param threadPath - The absolute path to the thread directory
|
|
36
|
-
* @returns The conversation history or null if not found
|
|
37
|
-
*/
|
|
38
|
-
getConversationHistory(threadPath: string): Promise<ConversationHistory | null>;
|
|
39
|
-
/**
|
|
40
|
-
* Gets the last N messages from conversation history
|
|
41
|
-
* @param threadPath - The absolute path to the thread directory
|
|
42
|
-
* @param count - Number of messages to retrieve (default: 1)
|
|
43
|
-
* @returns Array of conversation messages
|
|
44
|
-
*/
|
|
45
|
-
getLastMessages(threadPath: string, count?: number): Promise<ConversationMessage[]>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* ConversationManagerImpl provides the implementation for conversation operations
|
|
49
|
-
*/
|
|
50
|
-
export declare class ConversationManagerImpl implements ConversationManager {
|
|
51
|
-
private metadataDir;
|
|
52
|
-
/**
|
|
53
|
-
* Create a new ConversationManagerImpl
|
|
54
|
-
* @param rootFolder - Base directory where metadata will be stored
|
|
55
|
-
*/
|
|
56
|
-
constructor(rootFolder?: string);
|
|
57
|
-
/**
|
|
58
|
-
* Starts a new conversation message
|
|
59
|
-
*/
|
|
60
|
-
startMessage(threadId: string, threadPath: string, message: string, model: string, attachments?: FileData[], planMode?: boolean): Promise<string>;
|
|
61
|
-
/**
|
|
62
|
-
* Completes a conversation message
|
|
63
|
-
*/
|
|
64
|
-
completeMessage(threadPath: string, messageId: string, content: string, events: NeovateEvent[]): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* Gets the conversation history for a thread
|
|
67
|
-
*/
|
|
68
|
-
getConversationHistory(threadPath: string): Promise<ConversationHistory | null>;
|
|
69
|
-
/**
|
|
70
|
-
* Gets the last N messages from conversation history
|
|
71
|
-
*/
|
|
72
|
-
getLastMessages(threadPath: string, count?: number): Promise<ConversationMessage[]>;
|
|
73
|
-
/**
|
|
74
|
-
* Saves conversation history to file
|
|
75
|
-
*/
|
|
76
|
-
private saveConversationHistory;
|
|
77
|
-
/**
|
|
78
|
-
* Gets the file path for a thread's conversation history in the metadata folder
|
|
79
|
-
* Extracts threadId from threadPath and stores in .metadata/conversations/<threadId>/history.json
|
|
80
|
-
*/
|
|
81
|
-
private getConversationFilePath;
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=ConversationManager.d.ts.map
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConversationManager handles conversation history storage and retrieval
|
|
3
|
-
*
|
|
4
|
-
* This manager is responsible for:
|
|
5
|
-
* - Storing request/response pairs in JSON format
|
|
6
|
-
* - Retrieving conversation history for a thread
|
|
7
|
-
* - Managing conversation persistence
|
|
8
|
-
*/
|
|
9
|
-
import { promises as fs } from 'fs';
|
|
10
|
-
import { join, dirname } from 'path';
|
|
11
|
-
import { randomUUID } from 'crypto';
|
|
12
|
-
const CONVERSATION_FILE = 'conversation-history.json';
|
|
13
|
-
const METADATA_DIR = '.metadata';
|
|
14
|
-
/**
|
|
15
|
-
* ConversationManagerImpl provides the implementation for conversation operations
|
|
16
|
-
*/
|
|
17
|
-
export class ConversationManagerImpl {
|
|
18
|
-
metadataDir;
|
|
19
|
-
/**
|
|
20
|
-
* Create a new ConversationManagerImpl
|
|
21
|
-
* @param rootFolder - Base directory where metadata will be stored
|
|
22
|
-
*/
|
|
23
|
-
constructor(rootFolder = './projects') {
|
|
24
|
-
this.metadataDir = join(rootFolder, METADATA_DIR);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Starts a new conversation message
|
|
28
|
-
*/
|
|
29
|
-
async startMessage(threadId, threadPath, message, model, attachments, planMode) {
|
|
30
|
-
const messageId = randomUUID();
|
|
31
|
-
const timestamp = new Date().toISOString();
|
|
32
|
-
// Load existing history or create new
|
|
33
|
-
let history = await this.getConversationHistory(threadPath);
|
|
34
|
-
if (!history) {
|
|
35
|
-
history = {
|
|
36
|
-
threadId,
|
|
37
|
-
messages: [],
|
|
38
|
-
lastUpdated: timestamp,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
// Create incomplete message (will be completed later)
|
|
42
|
-
const incompleteMessage = {
|
|
43
|
-
id: messageId,
|
|
44
|
-
timestamp,
|
|
45
|
-
request: {
|
|
46
|
-
message,
|
|
47
|
-
model,
|
|
48
|
-
...(attachments && { attachments }),
|
|
49
|
-
...(planMode && { planMode }),
|
|
50
|
-
},
|
|
51
|
-
response: null,
|
|
52
|
-
};
|
|
53
|
-
history.messages.push(incompleteMessage);
|
|
54
|
-
history.lastUpdated = timestamp;
|
|
55
|
-
// Save to file
|
|
56
|
-
await this.saveConversationHistory(threadPath, history);
|
|
57
|
-
return messageId;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Completes a conversation message
|
|
61
|
-
*/
|
|
62
|
-
async completeMessage(threadPath, messageId, content, events) {
|
|
63
|
-
const history = await this.getConversationHistory(threadPath);
|
|
64
|
-
if (!history) {
|
|
65
|
-
throw new Error('Conversation history not found');
|
|
66
|
-
}
|
|
67
|
-
// Find the message to complete
|
|
68
|
-
const message = history.messages.find((m) => m.id === messageId);
|
|
69
|
-
if (!message) {
|
|
70
|
-
throw new Error(`Message ${messageId} not found in conversation history`);
|
|
71
|
-
}
|
|
72
|
-
// Complete the message with response data
|
|
73
|
-
message.response = {
|
|
74
|
-
content,
|
|
75
|
-
events,
|
|
76
|
-
completedAt: new Date().toISOString(),
|
|
77
|
-
};
|
|
78
|
-
history.lastUpdated = new Date().toISOString();
|
|
79
|
-
// Save to file
|
|
80
|
-
await this.saveConversationHistory(threadPath, history);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Gets the conversation history for a thread
|
|
84
|
-
*/
|
|
85
|
-
async getConversationHistory(threadPath) {
|
|
86
|
-
try {
|
|
87
|
-
const filePath = this.getConversationFilePath(threadPath);
|
|
88
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
89
|
-
return JSON.parse(content);
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
if (error instanceof Error && error.code === 'ENOENT') {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Gets the last N messages from conversation history
|
|
100
|
-
*/
|
|
101
|
-
async getLastMessages(threadPath, count = 1) {
|
|
102
|
-
const history = await this.getConversationHistory(threadPath);
|
|
103
|
-
if (!history || history.messages.length === 0) {
|
|
104
|
-
return [];
|
|
105
|
-
}
|
|
106
|
-
// Return last N messages
|
|
107
|
-
return history.messages.slice(-count);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Saves conversation history to file
|
|
111
|
-
*/
|
|
112
|
-
async saveConversationHistory(threadPath, history) {
|
|
113
|
-
const filePath = this.getConversationFilePath(threadPath);
|
|
114
|
-
// Ensure all parent directories exist
|
|
115
|
-
await fs.mkdir(dirname(filePath), { recursive: true });
|
|
116
|
-
await fs.writeFile(filePath, JSON.stringify(history, null, 2), 'utf-8');
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Gets the file path for a thread's conversation history in the metadata folder
|
|
120
|
-
* Extracts threadId from threadPath and stores in .metadata/conversations/<threadId>/history.json
|
|
121
|
-
*/
|
|
122
|
-
getConversationFilePath(threadPath) {
|
|
123
|
-
// Extract thread ID from path (last part of the path)
|
|
124
|
-
const threadId = threadPath.split(/[\\/]/).pop() || 'unknown';
|
|
125
|
-
const conversationsDir = join(this.metadataDir, 'conversations');
|
|
126
|
-
return join(conversationsDir, threadId, CONVERSATION_FILE);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=ConversationManager.js.map
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitManager handles git operations including URL validation and repository cloning
|
|
3
|
-
*
|
|
4
|
-
* This manager is responsible for:
|
|
5
|
-
* - Validating git URLs in various formats
|
|
6
|
-
* - Cloning repositories with streaming output
|
|
7
|
-
* - Handling git operation errors
|
|
8
|
-
*/
|
|
9
|
-
import { GitEvent } from '../types/models.js';
|
|
10
|
-
/**
|
|
11
|
-
* GitManager interface defines the contract for git operations
|
|
12
|
-
*/
|
|
13
|
-
export interface GitManager {
|
|
14
|
-
/**
|
|
15
|
-
* Validates a git URL format
|
|
16
|
-
* @param url - The git URL to validate
|
|
17
|
-
* @returns true if the URL is a valid git URL, false otherwise
|
|
18
|
-
*/
|
|
19
|
-
validateGitUrl(url: string): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Clones a git repository to the specified target path
|
|
22
|
-
* @param gitUrl - The git repository URL to clone
|
|
23
|
-
* @param targetPath - The local path where the repository should be cloned
|
|
24
|
-
* @yields GitEvent objects for stdout, stderr, complete, and error events
|
|
25
|
-
*/
|
|
26
|
-
cloneRepository(gitUrl: string, targetPath: string): AsyncGenerator<GitEvent>;
|
|
27
|
-
/**
|
|
28
|
-
* Sanitizes a branch name to ensure it only contains valid git branch characters
|
|
29
|
-
* Replaces spaces with dashes and removes invalid characters
|
|
30
|
-
* @param name - The branch name to sanitize
|
|
31
|
-
* @returns The sanitized branch name
|
|
32
|
-
*/
|
|
33
|
-
sanitizeBranchName(name: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* Checks if a branch exists in a git repository
|
|
36
|
-
* @param repoPath - The path to the git repository
|
|
37
|
-
* @param branchName - The branch name to check
|
|
38
|
-
* @returns true if the branch exists, false otherwise
|
|
39
|
-
*/
|
|
40
|
-
checkBranchExists(repoPath: string, branchName: string): Promise<boolean>;
|
|
41
|
-
/**
|
|
42
|
-
* Creates and checks out a new branch in a git repository
|
|
43
|
-
* @param repoPath - The path to the git repository
|
|
44
|
-
* @param branchName - The branch name to create
|
|
45
|
-
* @yields GitEvent objects for stdout, stderr, complete, and error events
|
|
46
|
-
*/
|
|
47
|
-
createAndCheckoutBranch(repoPath: string, branchName: string): AsyncGenerator<GitEvent>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* GitManagerImpl provides the implementation for git operations
|
|
51
|
-
*/
|
|
52
|
-
export declare class GitManagerImpl implements GitManager {
|
|
53
|
-
/**
|
|
54
|
-
* Regular expressions for validating different git URL formats
|
|
55
|
-
*/
|
|
56
|
-
private readonly gitUrlPatterns;
|
|
57
|
-
/**
|
|
58
|
-
* Validates a git URL against common git URL formats
|
|
59
|
-
*
|
|
60
|
-
* Supports the following formats:
|
|
61
|
-
* - HTTPS: https://github.com/user/repo.git
|
|
62
|
-
* - Git protocol: git://github.com/user/repo.git
|
|
63
|
-
* - SSH (git@): git@github.com:user/repo.git
|
|
64
|
-
* - SSH (ssh://): ssh://git@github.com/user/repo.git
|
|
65
|
-
*
|
|
66
|
-
* @param url - The URL to validate
|
|
67
|
-
* @returns true if the URL matches a valid git URL format, false otherwise
|
|
68
|
-
*
|
|
69
|
-
* Requirements: 7.1 - WHEN cloning a git repository, THE CLI SHALL validate the git URL format
|
|
70
|
-
*/
|
|
71
|
-
validateGitUrl(url: string): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Clones a git repository to the specified target path with streaming output
|
|
74
|
-
*
|
|
75
|
-
* This method:
|
|
76
|
-
* 1. Validates the git URL
|
|
77
|
-
* 2. Creates the target directory if needed
|
|
78
|
-
* 3. Spawns a git clone process
|
|
79
|
-
* 4. Streams stdout and stderr output
|
|
80
|
-
* 5. Handles completion and errors
|
|
81
|
-
*
|
|
82
|
-
* @param gitUrl - The git repository URL to clone
|
|
83
|
-
* @param targetPath - The local path where the repository should be cloned
|
|
84
|
-
* @yields GitEvent objects during the clone operation
|
|
85
|
-
*
|
|
86
|
-
* Requirements:
|
|
87
|
-
* - 1.1 - WHEN a user provides a git URL to create a new Project, THE CLI SHALL clone the repository
|
|
88
|
-
* - 1.3 - WHEN the clone operation executes, THE CLI SHALL stream the git clone output back to the App
|
|
89
|
-
* - 7.1 - WHEN cloning a git repository, THE CLI SHALL validate the git URL format
|
|
90
|
-
* - 7.2 - IF a git clone operation fails, THEN THE CLI SHALL return a descriptive error message
|
|
91
|
-
* - 7.3 - WHEN a clone operation is in progress, THE CLI SHALL stream git output to provide progress feedback
|
|
92
|
-
*/
|
|
93
|
-
cloneRepository(gitUrl: string, targetPath: string): AsyncGenerator<GitEvent>;
|
|
94
|
-
/**
|
|
95
|
-
* Sanitizes a branch name to ensure it only contains valid git branch characters
|
|
96
|
-
*
|
|
97
|
-
* This method:
|
|
98
|
-
* 1. Trims whitespace
|
|
99
|
-
* 2. Converts to lowercase
|
|
100
|
-
* 3. Replaces spaces with dashes
|
|
101
|
-
* 4. Removes invalid characters (only allows alphanumeric, dash, underscore, slash, dot)
|
|
102
|
-
* 5. Removes leading/trailing slashes and dots
|
|
103
|
-
* 6. Collapses multiple consecutive dashes into one
|
|
104
|
-
*
|
|
105
|
-
* @param name - The branch name to sanitize
|
|
106
|
-
* @returns The sanitized branch name (all lowercase)
|
|
107
|
-
*/
|
|
108
|
-
sanitizeBranchName(name: string): string;
|
|
109
|
-
/**
|
|
110
|
-
* Checks if a branch exists in a git repository
|
|
111
|
-
*
|
|
112
|
-
* Uses `git show-ref` to check for the branch without checking out
|
|
113
|
-
*
|
|
114
|
-
* @param repoPath - The path to the git repository
|
|
115
|
-
* @param branchName - The branch name to check
|
|
116
|
-
* @returns true if the branch exists, false otherwise
|
|
117
|
-
*/
|
|
118
|
-
checkBranchExists(repoPath: string, branchName: string): Promise<boolean>;
|
|
119
|
-
/**
|
|
120
|
-
* Creates and checks out a new branch in a git repository with streaming output
|
|
121
|
-
*
|
|
122
|
-
* This method:
|
|
123
|
-
* 1. Creates a new branch from the current HEAD
|
|
124
|
-
* 2. Checks out the new branch
|
|
125
|
-
* 3. Streams output during the operation
|
|
126
|
-
*
|
|
127
|
-
* @param repoPath - The path to the git repository
|
|
128
|
-
* @param branchName - The branch name to create
|
|
129
|
-
* @yields GitEvent objects during the branch creation
|
|
130
|
-
*/
|
|
131
|
-
createAndCheckoutBranch(repoPath: string, branchName: string): AsyncGenerator<GitEvent>;
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=GitManager.d.ts.map
|