locadex 0.0.2-alpha.6 → 0.1.0-alpha.1

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.
Files changed (120) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +71 -11
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/i18n.d.ts +1 -2
  5. package/dist/commands/i18n.d.ts.map +1 -1
  6. package/dist/commands/i18n.js +5 -256
  7. package/dist/commands/i18n.js.map +1 -1
  8. package/dist/commands/setup.d.ts +1 -1
  9. package/dist/commands/setup.d.ts.map +1 -1
  10. package/dist/commands/setup.js +5 -142
  11. package/dist/commands/setup.js.map +1 -1
  12. package/dist/logging/console.d.ts +4 -4
  13. package/dist/logging/console.d.ts.map +1 -1
  14. package/dist/logging/console.js +13 -13
  15. package/dist/logging/console.js.map +1 -1
  16. package/dist/logging/logger.d.ts +4 -2
  17. package/dist/logging/logger.d.ts.map +1 -1
  18. package/dist/logging/logger.js +33 -7
  19. package/dist/logging/logger.js.map +1 -1
  20. package/dist/mcp/getDocs.d.ts.map +1 -1
  21. package/dist/mcp/getDocs.js +2 -3
  22. package/dist/mcp/getDocs.js.map +1 -1
  23. package/dist/mcp/getPort.d.ts +2 -0
  24. package/dist/mcp/getPort.d.ts.map +1 -0
  25. package/dist/mcp/getPort.js +25 -0
  26. package/dist/mcp/getPort.js.map +1 -0
  27. package/dist/mcp/tools/docs.d.ts.map +1 -1
  28. package/dist/mcp/tools/docs.js +9 -2
  29. package/dist/mcp/tools/docs.js.map +1 -1
  30. package/dist/mcp/tools/guides.d.ts.map +1 -1
  31. package/dist/mcp/tools/guides.js +5 -2
  32. package/dist/mcp/tools/guides.js.map +1 -1
  33. package/dist/mcp-sse.d.ts.map +1 -1
  34. package/dist/mcp-sse.js +10 -28
  35. package/dist/mcp-sse.js.map +1 -1
  36. package/dist/tasks/i18n.d.ts +2 -0
  37. package/dist/tasks/i18n.d.ts.map +1 -0
  38. package/dist/tasks/i18n.js +336 -0
  39. package/dist/tasks/i18n.js.map +1 -0
  40. package/dist/tasks/setup.d.ts +2 -0
  41. package/dist/tasks/setup.d.ts.map +1 -0
  42. package/dist/tasks/setup.js +161 -0
  43. package/dist/tasks/setup.js.map +1 -0
  44. package/dist/telemetry.d.ts +1 -3
  45. package/dist/telemetry.d.ts.map +1 -1
  46. package/dist/telemetry.js +27 -25
  47. package/dist/telemetry.js.map +1 -1
  48. package/dist/types/cli.d.ts +9 -0
  49. package/dist/types/cli.d.ts.map +1 -1
  50. package/dist/types/cli.js +2 -2
  51. package/dist/types/cli.js.map +1 -1
  52. package/dist/utils/claudeCode.d.ts +7 -2
  53. package/dist/utils/claudeCode.d.ts.map +1 -1
  54. package/dist/utils/claudeCode.js +50 -31
  55. package/dist/utils/claudeCode.js.map +1 -1
  56. package/dist/utils/config.d.ts +10 -0
  57. package/dist/utils/config.d.ts.map +1 -0
  58. package/dist/utils/config.js +66 -0
  59. package/dist/utils/config.js.map +1 -0
  60. package/dist/utils/dag/createDag.d.ts +1 -1
  61. package/dist/utils/dag/createDag.d.ts.map +1 -1
  62. package/dist/utils/dag/createDag.js +4 -41
  63. package/dist/utils/dag/createDag.js.map +1 -1
  64. package/dist/utils/{getFiles.d.ts → dag/getFiles.d.ts} +2 -3
  65. package/dist/utils/dag/getFiles.d.ts.map +1 -0
  66. package/dist/utils/{getFiles.js → dag/getFiles.js} +24 -15
  67. package/dist/utils/dag/getFiles.js.map +1 -0
  68. package/dist/utils/dag/matchFiles.d.ts +2 -0
  69. package/dist/utils/dag/matchFiles.d.ts.map +1 -0
  70. package/dist/utils/dag/matchFiles.js +40 -0
  71. package/dist/utils/dag/matchFiles.js.map +1 -0
  72. package/dist/utils/locadexManager.d.ts +71 -0
  73. package/dist/utils/locadexManager.d.ts.map +1 -0
  74. package/dist/utils/locadexManager.js +256 -0
  75. package/dist/utils/locadexManager.js.map +1 -0
  76. package/dist/utils/lockfile.d.ts +18 -0
  77. package/dist/utils/lockfile.d.ts.map +1 -0
  78. package/dist/utils/lockfile.js +111 -0
  79. package/dist/utils/lockfile.js.map +1 -0
  80. package/dist/utils/packages/installPackage.d.ts +2 -0
  81. package/dist/utils/packages/installPackage.d.ts.map +1 -0
  82. package/dist/utils/packages/installPackage.js +22 -0
  83. package/dist/utils/packages/installPackage.js.map +1 -0
  84. package/dist/utils/session.d.ts +2 -0
  85. package/dist/utils/session.d.ts.map +1 -0
  86. package/dist/utils/session.js +12 -0
  87. package/dist/utils/session.js.map +1 -0
  88. package/dist/utils/shared.d.ts +2 -1
  89. package/dist/utils/shared.d.ts.map +1 -1
  90. package/dist/utils/shared.js +37 -14
  91. package/dist/utils/shared.js.map +1 -1
  92. package/dist/utils/shutdown.d.ts +20 -0
  93. package/dist/utils/shutdown.d.ts.map +1 -0
  94. package/dist/utils/shutdown.js +63 -0
  95. package/dist/utils/shutdown.js.map +1 -0
  96. package/dist/utils/stats.d.ts +13 -0
  97. package/dist/utils/stats.d.ts.map +1 -1
  98. package/dist/utils/stats.js +55 -2
  99. package/dist/utils/stats.js.map +1 -1
  100. package/package.json +2 -5
  101. package/.locadex-mcp-stdio.json +0 -9
  102. package/.locadex-mcp.json +0 -8
  103. package/dist/utils/agentManager.d.ts +0 -34
  104. package/dist/utils/agentManager.d.ts.map +0 -1
  105. package/dist/utils/agentManager.js +0 -123
  106. package/dist/utils/agentManager.js.map +0 -1
  107. package/dist/utils/debugLogger.d.ts +0 -3
  108. package/dist/utils/debugLogger.d.ts.map +0 -1
  109. package/dist/utils/debugLogger.js +0 -36
  110. package/dist/utils/debugLogger.js.map +0 -1
  111. package/dist/utils/getFiles.d.ts.map +0 -1
  112. package/dist/utils/getFiles.js.map +0 -1
  113. package/dist/utils/mcpConfig.d.ts +0 -10
  114. package/dist/utils/mcpConfig.d.ts.map +0 -1
  115. package/dist/utils/mcpConfig.js +0 -13
  116. package/dist/utils/mcpConfig.js.map +0 -1
  117. package/dist/utils/validateConfig.d.ts +0 -2
  118. package/dist/utils/validateConfig.d.ts.map +0 -1
  119. package/dist/utils/validateConfig.js +0 -12
  120. package/dist/utils/validateConfig.js.map +0 -1
@@ -0,0 +1,40 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d7f04102-24fc-5f58-985d-f0f23b8d105f")}catch(e){}}();
3
+ import { logger } from '../../logging/logger.js';
4
+ import * as path from 'node:path';
5
+ import fg from 'fast-glob';
6
+ import { DAG_IGNORED_EXTENSIONS, DAG_IGNORED_FILES, DAG_IGNORED_PATTERNS, } from '../shared.js';
7
+ export function findSourceFiles(globPatterns, allowedExtensions, cwd = process.cwd()) {
8
+ const allFiles = [];
9
+ for (const pattern of globPatterns) {
10
+ try {
11
+ const matchedFiles = fg.sync(pattern, {
12
+ cwd,
13
+ absolute: true,
14
+ onlyFiles: true,
15
+ ignore: DAG_IGNORED_PATTERNS,
16
+ });
17
+ allFiles.push(...matchedFiles);
18
+ }
19
+ catch (error) {
20
+ logger.debugMessage(`Failed to process glob pattern "${pattern}": ${error}`);
21
+ }
22
+ }
23
+ // Remove duplicates
24
+ const uniqueFiles = Array.from(new Set(allFiles));
25
+ // Filter by extensions and apply blacklists
26
+ const filteredFiles = uniqueFiles.filter((file) => {
27
+ const filename = path.basename(file);
28
+ const ext = path.extname(file);
29
+ const hasBlacklistedExtension = DAG_IGNORED_EXTENSIONS.some((blacklistedExt) => filename.endsWith(blacklistedExt));
30
+ // Skip blacklisted extensions and files
31
+ if (hasBlacklistedExtension || DAG_IGNORED_FILES.includes(filename)) {
32
+ return false;
33
+ }
34
+ // Apply extension filter
35
+ return allowedExtensions.includes(ext);
36
+ });
37
+ return filteredFiles;
38
+ }
39
+ //# sourceMappingURL=matchFiles.js.map
40
+ //# debugId=d7f04102-24fc-5f58-985d-f0f23b8d105f
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchFiles.js","sources":["utils/dag/matchFiles.ts"],"sourceRoot":"/","sourcesContent":["import { logger } from '../../logging/logger.js';\nimport * as path from 'node:path';\nimport fg from 'fast-glob';\nimport {\n DAG_IGNORED_EXTENSIONS,\n DAG_IGNORED_FILES,\n DAG_IGNORED_PATTERNS,\n} from '../shared.js';\n\nexport function findSourceFiles(\n globPatterns: string[],\n allowedExtensions: string[],\n cwd: string = process.cwd()\n): string[] {\n const allFiles: string[] = [];\n\n for (const pattern of globPatterns) {\n try {\n const matchedFiles = fg.sync(pattern, {\n cwd,\n absolute: true,\n onlyFiles: true,\n ignore: DAG_IGNORED_PATTERNS,\n });\n\n allFiles.push(...matchedFiles);\n } catch (error) {\n logger.debugMessage(\n `Failed to process glob pattern \"${pattern}\": ${error}`\n );\n }\n }\n\n // Remove duplicates\n const uniqueFiles = Array.from(new Set(allFiles));\n\n // Filter by extensions and apply blacklists\n const filteredFiles = uniqueFiles.filter((file) => {\n const filename = path.basename(file);\n const ext = path.extname(file);\n\n const hasBlacklistedExtension = DAG_IGNORED_EXTENSIONS.some(\n (blacklistedExt) => filename.endsWith(blacklistedExt)\n );\n\n // Skip blacklisted extensions and files\n if (hasBlacklistedExtension || DAG_IGNORED_FILES.includes(filename)) {\n return false;\n }\n\n // Apply extension filter\n return allowedExtensions.includes(ext);\n });\n\n return filteredFiles;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,MAAM,UAAU,eAAe,CAC7B,YAAsB,EACtB,iBAA2B,EAC3B,MAAc,OAAO,CAAC,GAAG,EAAE;IAE3B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MA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
+ import { AgentStats } from './stats.js';
3
+ import { CliOptions, LocadexConfig } from '../types/cli.js';
4
+ export interface LocadexRunMetadata {
5
+ createdAt: string;
6
+ locadexVersion: string;
7
+ workingDirectory: string;
8
+ projectName: string;
9
+ transport: 'sse' | 'stdio';
10
+ tempDirectory: string;
11
+ nodeVersion: string;
12
+ platform: string;
13
+ arch: string;
14
+ logFile: string;
15
+ batchSize: number;
16
+ maxConcurrency: number;
17
+ [key: string]: any;
18
+ }
19
+ export declare class LocadexManager {
20
+ private static instance;
21
+ private mcpProcess;
22
+ private mcpTransport;
23
+ private mcpConfigPath;
24
+ private filesStateFilePath;
25
+ private metadataFilePath;
26
+ private lockFilePath;
27
+ private workingDir;
28
+ private locadexDirectory;
29
+ private apiKey?;
30
+ private maxConcurrency;
31
+ private batchSize;
32
+ private agentPool;
33
+ private agentMutex;
34
+ private config;
35
+ stats: AgentStats;
36
+ logFile: string;
37
+ private constructor();
38
+ startMcpServer(): Promise<void>;
39
+ static getInstance(): LocadexManager;
40
+ static initialize(params: {
41
+ mcpTransport: 'sse' | 'stdio';
42
+ apiKey?: string;
43
+ metadata: Partial<LocadexRunMetadata>;
44
+ cliOptions: CliOptions;
45
+ options: Partial<LocadexConfig>;
46
+ }): void;
47
+ static reset(): void;
48
+ createSingleAgent(id: string): ClaudeCodeRunner;
49
+ createAgentPool(): void;
50
+ getAvailableAgent(): Promise<{
51
+ id: string;
52
+ agent: ClaudeCodeRunner;
53
+ sessionId?: string;
54
+ } | null>;
55
+ markAgentFree(agentId: string): void;
56
+ getAgentPool(): Map<string, {
57
+ agent: ClaudeCodeRunner;
58
+ sessionId?: string;
59
+ busy: boolean;
60
+ }>;
61
+ cleanupAgents(): void;
62
+ getFilesStateFilePath(): string;
63
+ getMetadataFilePath(): string;
64
+ getMaxConcurrency(): number;
65
+ getBatchSize(): number;
66
+ getConfig(): LocadexConfig;
67
+ getLockFilePath(): string;
68
+ cleanup(): void;
69
+ getWorkingDir(): string;
70
+ }
71
+ //#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undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bb7c0ee1-f264-5d56-b315-179d269584e2")}catch(e){}}();
3
+ import { ClaudeCodeRunner, killAllClaudeProcesses } from './claudeCode.js';
4
+ import { fromPackageRoot } from './getPaths.js';
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import { logger } from '../logging/logger.js';
8
+ import { addToGitIgnore } from './fs/writeFiles.js';
9
+ import { spawn } from 'node:child_process';
10
+ import { setTimeout } from 'node:timers';
11
+ import { AgentStats } from './stats.js';
12
+ import { findAvailablePort } from '../mcp/getPort.js';
13
+ import { createConfig, getConfig } from './config.js';
14
+ import { gracefulShutdown, exit } from './shutdown.js';
15
+ import { LOCKFILE_NAME } from './lockfile.js';
16
+ const mcpStdioConfig = {
17
+ mcpServers: {
18
+ locadex: {
19
+ command: 'npx',
20
+ args: ['locadex-mcp'],
21
+ env: {},
22
+ },
23
+ },
24
+ };
25
+ const mcpSseConfig = {
26
+ mcpServers: {
27
+ locadex: {
28
+ type: 'sse',
29
+ url: 'http://localhost:8888/sse',
30
+ },
31
+ },
32
+ };
33
+ export class LocadexManager {
34
+ static instance;
35
+ mcpProcess;
36
+ mcpTransport;
37
+ mcpConfigPath;
38
+ filesStateFilePath;
39
+ metadataFilePath;
40
+ lockFilePath;
41
+ workingDir;
42
+ locadexDirectory;
43
+ apiKey;
44
+ maxConcurrency;
45
+ batchSize;
46
+ agentPool;
47
+ agentMutex = Promise.resolve();
48
+ config;
49
+ stats;
50
+ logFile;
51
+ constructor(params) {
52
+ this.apiKey = params.apiKey || process.env.ANTHROPIC_API_KEY;
53
+ this.agentPool = new Map();
54
+ this.stats = new AgentStats();
55
+ this.mcpTransport = params.mcpTransport;
56
+ const cwd = process.cwd();
57
+ this.locadexDirectory = path.resolve(cwd, '.locadex');
58
+ this.workingDir = path.resolve(this.locadexDirectory, 'runs', Date.now().toString());
59
+ fs.mkdirSync(this.workingDir, { recursive: true });
60
+ this.config = getConfig(this.locadexDirectory, params.options);
61
+ createConfig(this.locadexDirectory, {
62
+ batchSize: this.config.batchSize,
63
+ maxConcurrency: this.config.maxConcurrency,
64
+ matchingFiles: this.config.matchingFiles,
65
+ matchingExtensions: this.config.matchingExtensions,
66
+ });
67
+ addToGitIgnore(cwd, '.locadex/runs');
68
+ this.maxConcurrency = this.config.maxConcurrency;
69
+ this.batchSize = this.config.batchSize;
70
+ this.mcpConfigPath = path.resolve(this.workingDir, 'mcp.json');
71
+ this.filesStateFilePath = path.resolve(this.workingDir, 'files-state.json');
72
+ this.metadataFilePath = path.resolve(this.workingDir, 'metadata.json');
73
+ this.logFile = path.resolve(this.workingDir, 'log.txt');
74
+ this.lockFilePath = path.resolve(this.locadexDirectory, LOCKFILE_NAME);
75
+ // Create files-state.json
76
+ const filesState = [];
77
+ fs.writeFileSync(this.filesStateFilePath, JSON.stringify(filesState, null, 2));
78
+ // Create metadata.json
79
+ const metadata = {
80
+ createdAt: new Date().toISOString(),
81
+ locadexVersion: JSON.parse(fs.readFileSync(fromPackageRoot('package.json'), 'utf8')).version,
82
+ workingDirectory: cwd,
83
+ projectName: path.basename(cwd),
84
+ transport: params.mcpTransport,
85
+ tempDirectory: this.workingDir,
86
+ nodeVersion: process.version,
87
+ platform: process.platform,
88
+ arch: process.arch,
89
+ logFile: this.logFile,
90
+ batchSize: this.config.batchSize,
91
+ maxConcurrency: this.config.maxConcurrency,
92
+ ...params.metadata,
93
+ };
94
+ fs.writeFileSync(this.metadataFilePath, JSON.stringify(metadata, null, 2));
95
+ // Register cleanup with graceful shutdown
96
+ gracefulShutdown.addHandler({
97
+ name: 'locadex-manager-cleanup',
98
+ handler: () => this.cleanup(),
99
+ timeout: 5000,
100
+ });
101
+ }
102
+ async startMcpServer() {
103
+ if (this.mcpTransport === 'stdio') {
104
+ mcpStdioConfig.mcpServers.locadex.env = {
105
+ LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,
106
+ LOCADEX_LOG_FILE_PATH: this.logFile,
107
+ };
108
+ fs.writeFileSync(this.mcpConfigPath, JSON.stringify(mcpStdioConfig, null, 2));
109
+ }
110
+ else {
111
+ // First, search for an available port
112
+ const port = await findAvailablePort(8888);
113
+ mcpSseConfig.mcpServers.locadex.url = `http://localhost:${port}/sse`;
114
+ fs.writeFileSync(this.mcpConfigPath, JSON.stringify(mcpSseConfig, null, 2));
115
+ this.mcpProcess = spawn('node', [fromPackageRoot('dist/mcp-sse.js')], {
116
+ env: {
117
+ ...process.env,
118
+ LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,
119
+ LOCADEX_VERBOSE: logger.verbose ? 'true' : 'false',
120
+ LOCADEX_DEBUG: logger.debug ? 'true' : 'false',
121
+ LOCADEX_LOG_FILE_PATH: this.logFile,
122
+ PORT: port.toString(),
123
+ },
124
+ stdio: 'inherit',
125
+ });
126
+ this.mcpProcess.on('error', async (error) => {
127
+ logger.error(`MCP server failed to start: ${error.message}`);
128
+ await exit(1);
129
+ });
130
+ this.mcpProcess.on('exit', async (code, signal) => {
131
+ if (code !== 0 && code !== null) {
132
+ logger.error(`MCP server exited with code ${code}`);
133
+ await exit(code);
134
+ }
135
+ if (signal) {
136
+ logger.error(`MCP server was killed with signal ${signal}`);
137
+ await exit(1);
138
+ }
139
+ });
140
+ }
141
+ }
142
+ static getInstance() {
143
+ if (!LocadexManager.instance) {
144
+ throw new Error('LocadexManager not initialized');
145
+ }
146
+ return LocadexManager.instance;
147
+ }
148
+ static initialize(params) {
149
+ if (!LocadexManager.instance) {
150
+ LocadexManager.instance = new LocadexManager(params);
151
+ logger.initialize(params.cliOptions, LocadexManager.instance.logFile);
152
+ logger.debugMessage(`Locadex loaded with config: ${JSON.stringify(LocadexManager.instance.config, null, 2)}`);
153
+ LocadexManager.instance.startMcpServer();
154
+ }
155
+ }
156
+ static reset() {
157
+ if (LocadexManager.instance) {
158
+ LocadexManager.instance.cleanup();
159
+ LocadexManager.instance = undefined;
160
+ }
161
+ }
162
+ createSingleAgent(id) {
163
+ return new ClaudeCodeRunner(this, {
164
+ apiKey: this.apiKey,
165
+ mcpConfig: this.mcpConfigPath,
166
+ id,
167
+ });
168
+ }
169
+ createAgentPool() {
170
+ if (this.agentPool.size === 0) {
171
+ for (let i = 0; i < this.maxConcurrency; i++) {
172
+ const agentId = `claude_task_agent_${i + 1}`;
173
+ this.agentPool.set(agentId, {
174
+ agent: this.createSingleAgent(agentId),
175
+ sessionId: undefined,
176
+ busy: false,
177
+ });
178
+ }
179
+ }
180
+ }
181
+ async getAvailableAgent() {
182
+ return new Promise((resolve) => {
183
+ this.agentMutex = this.agentMutex.then(() => {
184
+ for (const [id, agentData] of this.agentPool) {
185
+ if (!agentData.busy) {
186
+ agentData.busy = true;
187
+ resolve({
188
+ id,
189
+ agent: agentData.agent,
190
+ sessionId: agentData.sessionId,
191
+ });
192
+ return;
193
+ }
194
+ }
195
+ resolve(null);
196
+ });
197
+ });
198
+ }
199
+ markAgentFree(agentId) {
200
+ const agentData = this.agentPool.get(agentId);
201
+ if (agentData) {
202
+ agentData.busy = false;
203
+ }
204
+ }
205
+ getAgentPool() {
206
+ return this.agentPool;
207
+ }
208
+ cleanupAgents() {
209
+ logger.debugMessage('Cleaning up all Claude Code agents and processes');
210
+ // Mark all agents as free
211
+ for (const agentData of this.agentPool.values()) {
212
+ agentData.busy = false;
213
+ }
214
+ // Kill all active Claude Code processes
215
+ killAllClaudeProcesses();
216
+ // Clear the agent pool
217
+ this.agentPool.clear();
218
+ }
219
+ getFilesStateFilePath() {
220
+ return this.filesStateFilePath;
221
+ }
222
+ getMetadataFilePath() {
223
+ return this.metadataFilePath;
224
+ }
225
+ getMaxConcurrency() {
226
+ return this.maxConcurrency;
227
+ }
228
+ getBatchSize() {
229
+ return this.batchSize;
230
+ }
231
+ getConfig() {
232
+ return this.config;
233
+ }
234
+ getLockFilePath() {
235
+ return this.lockFilePath;
236
+ }
237
+ cleanup() {
238
+ // Clean up agents first (if not already done)
239
+ this.cleanupAgents();
240
+ // Clean up MCP process
241
+ if (this.mcpProcess && !this.mcpProcess.killed) {
242
+ logger.debugMessage('Killing MCP process');
243
+ this.mcpProcess.kill('SIGTERM');
244
+ setTimeout(() => {
245
+ if (this.mcpProcess && !this.mcpProcess.killed) {
246
+ this.mcpProcess.kill('SIGKILL');
247
+ }
248
+ }, 1000);
249
+ }
250
+ }
251
+ getWorkingDir() {
252
+ return this.workingDir;
253
+ }
254
+ }
255
+ //# sourceMappingURL=locadexManager.js.map
256
+ //# debugId=bb7c0ee1-f264-5d56-b315-179d269584e2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locadexManager.js","sources":["utils/locadexManager.ts"],"sourceRoot":"/","sourcesContent":["import { ClaudeCodeRunner, killAllClaudeProcesses } from './claudeCode.js';\nimport { fromPackageRoot } from './getPaths.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { FileEntry } from './dag/getFiles.js';\nimport { logger } from '../logging/logger.js';\nimport { addToGitIgnore } from './fs/writeFiles.js';\nimport { spawn } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { setTimeout } from 'node:timers';\nimport { AgentStats } from './stats.js';\nimport { CliOptions, LocadexConfig } from '../types/cli.js';\nimport { findAvailablePort } from '../mcp/getPort.js';\nimport { createConfig, getConfig } from './config.js';\nimport { gracefulShutdown, exit } from './shutdown.js';\nimport { LOCKFILE_NAME } from './lockfile.js';\n\nexport interface LocadexRunMetadata {\n createdAt: string;\n locadexVersion: string;\n workingDirectory: string;\n projectName: string;\n transport: 'sse' | 'stdio';\n tempDirectory: string;\n nodeVersion: string;\n platform: string;\n arch: string;\n logFile: string;\n batchSize: number;\n maxConcurrency: number;\n [key: string]: any;\n}\n\nconst mcpStdioConfig = {\n mcpServers: {\n locadex: {\n command: 'npx',\n args: ['locadex-mcp'],\n env: {},\n },\n },\n};\nconst mcpSseConfig = {\n mcpServers: {\n locadex: {\n type: 'sse',\n url: 'http://localhost:8888/sse',\n },\n },\n};\n\nexport class LocadexManager {\n private static instance: LocadexManager | undefined;\n private mcpProcess: ChildProcess | undefined;\n private mcpTransport: 'sse' | 'stdio';\n private mcpConfigPath: string;\n private filesStateFilePath: string;\n private metadataFilePath: string;\n private lockFilePath: string;\n private workingDir: string;\n private locadexDirectory: string;\n private apiKey?: string;\n private maxConcurrency: number;\n private batchSize: number;\n private agentPool: Map<\n string,\n { agent: ClaudeCodeRunner; sessionId?: string; busy: boolean }\n >;\n private agentMutex = Promise.resolve();\n private config: LocadexConfig;\n stats: AgentStats;\n logFile: string;\n\n private constructor(params: {\n mcpTransport: 'sse' | 'stdio';\n apiKey?: string;\n metadata: Partial<LocadexRunMetadata>;\n options: Partial<LocadexConfig>;\n }) {\n this.apiKey = params.apiKey || process.env.ANTHROPIC_API_KEY;\n this.agentPool = new Map();\n this.stats = new AgentStats();\n this.mcpTransport = params.mcpTransport;\n\n const cwd = process.cwd();\n this.locadexDirectory = path.resolve(cwd, '.locadex');\n this.workingDir = path.resolve(\n this.locadexDirectory,\n 'runs',\n Date.now().toString()\n );\n fs.mkdirSync(this.workingDir, { recursive: true });\n\n this.config = getConfig(this.locadexDirectory, params.options);\n\n createConfig(this.locadexDirectory, {\n batchSize: this.config.batchSize,\n maxConcurrency: this.config.maxConcurrency,\n matchingFiles: this.config.matchingFiles,\n matchingExtensions: this.config.matchingExtensions,\n });\n\n addToGitIgnore(cwd, '.locadex/runs');\n\n this.maxConcurrency = this.config.maxConcurrency;\n this.batchSize = this.config.batchSize;\n this.mcpConfigPath = path.resolve(this.workingDir, 'mcp.json');\n this.filesStateFilePath = path.resolve(this.workingDir, 'files-state.json');\n this.metadataFilePath = path.resolve(this.workingDir, 'metadata.json');\n this.logFile = path.resolve(this.workingDir, 'log.txt');\n this.lockFilePath = path.resolve(this.locadexDirectory, LOCKFILE_NAME);\n\n // Create files-state.json\n const filesState: FileEntry[] = [];\n fs.writeFileSync(\n this.filesStateFilePath,\n JSON.stringify(filesState, null, 2)\n );\n\n // Create metadata.json\n const metadata: LocadexRunMetadata = {\n createdAt: new Date().toISOString(),\n locadexVersion: JSON.parse(\n fs.readFileSync(fromPackageRoot('package.json'), 'utf8')\n ).version,\n workingDirectory: cwd,\n projectName: path.basename(cwd),\n transport: params.mcpTransport,\n tempDirectory: this.workingDir,\n nodeVersion: process.version,\n platform: process.platform,\n arch: process.arch,\n logFile: this.logFile,\n batchSize: this.config.batchSize,\n maxConcurrency: this.config.maxConcurrency,\n ...params.metadata,\n };\n fs.writeFileSync(this.metadataFilePath, JSON.stringify(metadata, null, 2));\n\n // Register cleanup with graceful shutdown\n gracefulShutdown.addHandler({\n name: 'locadex-manager-cleanup',\n handler: () => this.cleanup(),\n timeout: 5000,\n });\n }\n\n async startMcpServer() {\n if (this.mcpTransport === 'stdio') {\n mcpStdioConfig.mcpServers.locadex.env = {\n LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,\n LOCADEX_LOG_FILE_PATH: this.logFile,\n };\n fs.writeFileSync(\n this.mcpConfigPath,\n JSON.stringify(mcpStdioConfig, null, 2)\n );\n } else {\n // First, search for an available port\n const port = await findAvailablePort(8888);\n mcpSseConfig.mcpServers.locadex.url = `http://localhost:${port}/sse`;\n fs.writeFileSync(\n this.mcpConfigPath,\n JSON.stringify(mcpSseConfig, null, 2)\n );\n\n this.mcpProcess = spawn('node', [fromPackageRoot('dist/mcp-sse.js')], {\n env: {\n ...process.env,\n LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,\n LOCADEX_VERBOSE: logger.verbose ? 'true' : 'false',\n LOCADEX_DEBUG: logger.debug ? 'true' : 'false',\n LOCADEX_LOG_FILE_PATH: this.logFile,\n PORT: port.toString(),\n },\n stdio: 'inherit',\n });\n\n this.mcpProcess.on('error', async (error) => {\n logger.error(`MCP server failed to start: ${error.message}`);\n await exit(1);\n });\n\n this.mcpProcess.on('exit', async (code, signal) => {\n if (code !== 0 && code !== null) {\n logger.error(`MCP server exited with code ${code}`);\n await exit(code as 0 | 1);\n }\n if (signal) {\n logger.error(`MCP server was killed with signal ${signal}`);\n await exit(1);\n }\n });\n }\n }\n\n static getInstance(): LocadexManager {\n if (!LocadexManager.instance) {\n throw new Error('LocadexManager not initialized');\n }\n return LocadexManager.instance;\n }\n\n static initialize(params: {\n mcpTransport: 'sse' | 'stdio';\n apiKey?: string;\n metadata: Partial<LocadexRunMetadata>;\n cliOptions: CliOptions;\n options: Partial<LocadexConfig>;\n }): void {\n if (!LocadexManager.instance) {\n LocadexManager.instance = new LocadexManager(params);\n logger.initialize(params.cliOptions, LocadexManager.instance.logFile);\n\n logger.debugMessage(\n `Locadex loaded with config: ${JSON.stringify(\n LocadexManager.instance.config,\n null,\n 2\n )}`\n );\n LocadexManager.instance.startMcpServer();\n }\n }\n\n static reset(): void {\n if (LocadexManager.instance) {\n LocadexManager.instance.cleanup();\n LocadexManager.instance = undefined;\n }\n }\n\n createSingleAgent(id: string): ClaudeCodeRunner {\n return new ClaudeCodeRunner(this, {\n apiKey: this.apiKey,\n mcpConfig: this.mcpConfigPath,\n id,\n });\n }\n\n createAgentPool(): void {\n if (this.agentPool.size === 0) {\n for (let i = 0; i < this.maxConcurrency; i++) {\n const agentId = `claude_task_agent_${i + 1}`;\n this.agentPool.set(agentId, {\n agent: this.createSingleAgent(agentId),\n sessionId: undefined,\n busy: false,\n });\n }\n }\n }\n\n async getAvailableAgent(): Promise<{\n id: string;\n agent: ClaudeCodeRunner;\n sessionId?: string;\n } | null> {\n return new Promise((resolve) => {\n this.agentMutex = this.agentMutex.then(() => {\n for (const [id, agentData] of this.agentPool) {\n if (!agentData.busy) {\n agentData.busy = true;\n resolve({\n id,\n agent: agentData.agent,\n sessionId: agentData.sessionId,\n });\n return;\n }\n }\n resolve(null);\n });\n });\n }\n\n markAgentFree(agentId: string): void {\n const agentData = this.agentPool.get(agentId);\n if (agentData) {\n agentData.busy = false;\n }\n }\n\n getAgentPool(): Map<\n string,\n { agent: ClaudeCodeRunner; sessionId?: string; busy: boolean }\n > {\n return this.agentPool;\n }\n\n cleanupAgents(): void {\n logger.debugMessage('Cleaning up all Claude Code agents and processes');\n\n // Mark all agents as free\n for (const agentData of this.agentPool.values()) {\n agentData.busy = false;\n }\n\n // Kill all active Claude Code processes\n killAllClaudeProcesses();\n\n // Clear the agent pool\n this.agentPool.clear();\n }\n\n getFilesStateFilePath(): string {\n return this.filesStateFilePath;\n }\n getMetadataFilePath(): string {\n return this.metadataFilePath;\n }\n getMaxConcurrency(): number {\n return this.maxConcurrency;\n }\n getBatchSize(): number {\n return this.batchSize;\n }\n getConfig(): LocadexConfig {\n return this.config;\n }\n\n getLockFilePath(): string {\n return this.lockFilePath;\n }\n\n cleanup(): void {\n // Clean up agents first (if not already done)\n this.cleanupAgents();\n\n // Clean up MCP process\n if (this.mcpProcess && !this.mcpProcess.killed) {\n logger.debugMessage('Killing MCP process');\n this.mcpProcess.kill('SIGTERM');\n setTimeout(() => {\n if (this.mcpProcess && !this.mcpProcess.killed) {\n this.mcpProcess.kill('SIGKILL');\n }\n }, 1000);\n }\n }\n\n getWorkingDir(): string {\n return this.workingDir;\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,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B,uBAAuB;QACvB,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC/C,MAAM,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAChC,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;oBAC/C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF","debug_id":"bb7c0ee1-f264-5d56-b315-179d269584e2"}
@@ -0,0 +1,18 @@
1
+ export declare const LOCKFILE_VERSION = "1.0.0";
2
+ export declare const LOCKFILE_NAME = "locadex-lock.json";
3
+ export interface LockfileEntry {
4
+ path: string;
5
+ lastModified: number;
6
+ }
7
+ export interface Lockfile {
8
+ checksums: Record<string, LockfileEntry>;
9
+ version: string;
10
+ updatedAt: string;
11
+ }
12
+ export declare function calculateFileHash(filePath: string): string;
13
+ export declare function loadLockfile(lockfilePath: string): Lockfile;
14
+ export declare function saveLockfile(lockfilePath: string, lockfile: Lockfile): void;
15
+ export declare function getChangedFiles(files: string[], lockfilePath: string): string[];
16
+ export declare function updateLockfile(files: string[], lockfilePath: string): void;
17
+ export declare function cleanupLockfile(allCurrentFiles: string[], lockfilePath: string): void;
18
+ //# sourceMappingURL=lockfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockfile.d.ts","sourceRoot":"/","sources":["utils/lockfile.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAoB3D;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAO3E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,EAAE,CA2BV;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAqB1E;AAED,wBAAgB,eAAe,CAC7B,eAAe,EAAE,MAAM,EAAE,EACzB,YAAY,EAAE,MAAM,GACnB,IAAI,CA2BN"}
@@ -0,0 +1,111 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7233a21e-332f-5d17-8e64-dc2f3e253ed1")}catch(e){}}();
3
+ import crypto from 'node:crypto';
4
+ import fs from 'node:fs';
5
+ import path from 'node:path';
6
+ import { logger } from '../logging/logger.js';
7
+ export const LOCKFILE_VERSION = '1.0.0';
8
+ export const LOCKFILE_NAME = 'locadex-lock.json';
9
+ export function calculateFileHash(filePath) {
10
+ try {
11
+ const content = fs.readFileSync(filePath, 'utf8');
12
+ return crypto.createHash('md5').update(content).digest('hex');
13
+ }
14
+ catch (error) {
15
+ logger.debugMessage(`Failed to calculate hash for ${filePath}: ${error}`);
16
+ return '';
17
+ }
18
+ }
19
+ export function loadLockfile(lockfilePath) {
20
+ try {
21
+ if (!fs.existsSync(lockfilePath)) {
22
+ return {
23
+ checksums: {},
24
+ version: '1.0.0',
25
+ updatedAt: new Date().toISOString(),
26
+ };
27
+ }
28
+ const content = fs.readFileSync(lockfilePath, 'utf8');
29
+ return JSON.parse(content);
30
+ }
31
+ catch (error) {
32
+ logger.debugMessage(`Failed to load lockfile ${lockfilePath}: ${error}`);
33
+ return {
34
+ checksums: {},
35
+ version: '1.0.0',
36
+ updatedAt: new Date().toISOString(),
37
+ };
38
+ }
39
+ }
40
+ export function saveLockfile(lockfilePath, lockfile) {
41
+ try {
42
+ lockfile.updatedAt = new Date().toISOString();
43
+ fs.writeFileSync(lockfilePath, JSON.stringify(lockfile, null, 2));
44
+ }
45
+ catch (error) {
46
+ logger.debugMessage(`Failed to save lockfile ${lockfilePath}: ${error}`);
47
+ }
48
+ }
49
+ export function getChangedFiles(files, lockfilePath) {
50
+ const lockfile = loadLockfile(lockfilePath);
51
+ const changedFiles = [];
52
+ for (const filePath of files) {
53
+ const currentHash = calculateFileHash(filePath);
54
+ if (!currentHash) {
55
+ // Skip files that can't be hashed (likely don't exist or can't be read)
56
+ continue;
57
+ }
58
+ // Check if this content hash exists in the lockfile
59
+ const lockfileEntry = lockfile.checksums[currentHash];
60
+ if (!lockfileEntry) {
61
+ // Content hash not found, this is new or changed content
62
+ changedFiles.push(filePath);
63
+ }
64
+ // If hash exists, content hasn't changed regardless of file path
65
+ }
66
+ logger.debugMessage(`Found ${changedFiles.length} changed files out of ${files.length} total files`);
67
+ return changedFiles;
68
+ }
69
+ export function updateLockfile(files, lockfilePath) {
70
+ const lockfile = loadLockfile(lockfilePath);
71
+ for (const filePath of files) {
72
+ const relativePath = path.relative(process.cwd(), filePath);
73
+ const currentHash = calculateFileHash(filePath);
74
+ if (!currentHash) {
75
+ continue;
76
+ }
77
+ const stats = fs.statSync(filePath);
78
+ // Use hash as key, store current path and metadata
79
+ lockfile.checksums[currentHash] = {
80
+ path: relativePath,
81
+ lastModified: stats.mtime.getTime(),
82
+ };
83
+ }
84
+ saveLockfile(lockfilePath, lockfile);
85
+ logger.debugMessage(`Updated lockfile with ${files.length} files`);
86
+ }
87
+ export function cleanupLockfile(allCurrentFiles, lockfilePath) {
88
+ const lockfile = loadLockfile(lockfilePath);
89
+ const currentHashes = new Set();
90
+ // Calculate hashes for all current files
91
+ for (const filePath of allCurrentFiles) {
92
+ const hash = calculateFileHash(filePath);
93
+ if (hash) {
94
+ currentHashes.add(hash);
95
+ }
96
+ }
97
+ // Remove entries for content that no longer exists
98
+ let removedCount = 0;
99
+ for (const hash in lockfile.checksums) {
100
+ if (!currentHashes.has(hash)) {
101
+ delete lockfile.checksums[hash];
102
+ removedCount++;
103
+ }
104
+ }
105
+ if (removedCount > 0) {
106
+ saveLockfile(lockfilePath, lockfile);
107
+ logger.debugMessage(`Cleaned up ${removedCount} stale entries from lockfile`);
108
+ }
109
+ }
110
+ //# sourceMappingURL=lockfile.js.map
111
+ //# debugId=7233a21e-332f-5d17-8e64-dc2f3e253ed1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockfile.js","sources":["utils/lockfile.ts"],"sourceRoot":"/","sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { logger } from '../logging/logger.js';\n\nexport const LOCKFILE_VERSION = '1.0.0';\nexport const LOCKFILE_NAME = 'locadex-lock.json';\n\nexport interface LockfileEntry {\n path: string;\n lastModified: number;\n}\n\nexport interface Lockfile {\n checksums: Record<string, LockfileEntry>; // checksum -> entry mapping\n version: string;\n updatedAt: string;\n}\n\nexport function calculateFileHash(filePath: string): string {\n try {\n const content = fs.readFileSync(filePath, 'utf8');\n return crypto.createHash('md5').update(content).digest('hex');\n } catch (error) {\n logger.debugMessage(`Failed to calculate hash for ${filePath}: ${error}`);\n return '';\n }\n}\n\nexport function loadLockfile(lockfilePath: string): Lockfile {\n try {\n if (!fs.existsSync(lockfilePath)) {\n return {\n checksums: {},\n version: '1.0.0',\n updatedAt: new Date().toISOString(),\n };\n }\n\n const content = fs.readFileSync(lockfilePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n logger.debugMessage(`Failed to load lockfile ${lockfilePath}: ${error}`);\n return {\n checksums: {},\n version: '1.0.0',\n updatedAt: new Date().toISOString(),\n };\n }\n}\n\nexport function saveLockfile(lockfilePath: string, lockfile: Lockfile): void {\n try {\n lockfile.updatedAt = new Date().toISOString();\n fs.writeFileSync(lockfilePath, JSON.stringify(lockfile, null, 2));\n } catch (error) {\n logger.debugMessage(`Failed to save lockfile ${lockfilePath}: ${error}`);\n }\n}\n\nexport function getChangedFiles(\n files: string[],\n lockfilePath: string\n): string[] {\n const lockfile = loadLockfile(lockfilePath);\n const changedFiles: string[] = [];\n\n for (const filePath of files) {\n const currentHash = calculateFileHash(filePath);\n\n if (!currentHash) {\n // Skip files that can't be hashed (likely don't exist or can't be read)\n continue;\n }\n\n // Check if this content hash exists in the lockfile\n const lockfileEntry = lockfile.checksums[currentHash];\n\n if (!lockfileEntry) {\n // Content hash not found, this is new or changed content\n changedFiles.push(filePath);\n }\n // If hash exists, content hasn't changed regardless of file path\n }\n\n logger.debugMessage(\n `Found ${changedFiles.length} changed files out of ${files.length} total files`\n );\n\n return changedFiles;\n}\n\nexport function updateLockfile(files: string[], lockfilePath: string): void {\n const lockfile = loadLockfile(lockfilePath);\n\n for (const filePath of files) {\n const relativePath = path.relative(process.cwd(), filePath);\n const currentHash = calculateFileHash(filePath);\n\n if (!currentHash) {\n continue;\n }\n\n const stats = fs.statSync(filePath);\n // Use hash as key, store current path and metadata\n lockfile.checksums[currentHash] = {\n path: relativePath,\n lastModified: stats.mtime.getTime(),\n };\n }\n\n saveLockfile(lockfilePath, lockfile);\n logger.debugMessage(`Updated lockfile with ${files.length} files`);\n}\n\nexport function cleanupLockfile(\n allCurrentFiles: string[],\n lockfilePath: string\n): void {\n const lockfile = loadLockfile(lockfilePath);\n const currentHashes = new Set<string>();\n\n // Calculate hashes for all current files\n for (const filePath of allCurrentFiles) {\n const hash = calculateFileHash(filePath);\n if (hash) {\n currentHashes.add(hash);\n }\n }\n\n // Remove entries for content that no longer exists\n let removedCount = 0;\n for (const hash in lockfile.checksums) {\n if (!currentHashes.has(hash)) {\n delete lockfile.checksums[hash];\n removedCount++;\n }\n }\n\n if (removedCount > 0) {\n saveLockfile(lockfilePath, lockfile);\n logger.debugMessage(\n `Cleaned up ${removedCount} stale entries from lockfile`\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAajD,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,YAAY,CAAC,gCAAgC,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,YAAoB;IAC/C,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACjC,OAAO;gBACL,SAAS,EAAE,EAAE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U,CAAC;IAExC,yCAAyC;IACzC,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,IAAI,EAAE,CAAC;YACT,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,mDAAmD;IACnD,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChC,YAAY,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrB,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACrC,MAAM,CAAC,YAAY,CACjB,cAAc,YAAY,8BAA8B,CACzD,CAAC;IACJ,CAAC;AACH,CAAC","debug_id":"7233a21e-332f-5d17-8e64-dc2f3e253ed1"}
@@ -0,0 +1,2 @@
1
+ export declare function installClaudeCode(): Promise<void>;
2
+ //# sourceMappingURL=installPackage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installPackage.d.ts","sourceRoot":"/","sources":["utils/packages/installPackage.ts"],"names":[],"mappings":"AAOA,wBAAsB,iBAAiB,kBAatC"}
@@ -0,0 +1,22 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="75413bc7-b5cf-5d3f-9312-61ec8ff3b80c")}catch(e){}}();
3
+ import { getPackageInfo } from 'gtx-cli/utils/packageInfo';
4
+ import { createSpinner } from '../../logging/console.js';
5
+ import chalk from 'chalk/index.js';
6
+ import { installPackageGlobal } from 'gtx-cli/utils/installPackage';
7
+ import { logger } from '../../logging/logger.js';
8
+ import { CLAUDE_CODE_VERSION } from '../shared.js';
9
+ export async function installClaudeCode() {
10
+ const claudeCodeInfo = await getPackageInfo('@anthropic-ai/claude-code');
11
+ if (!claudeCodeInfo) {
12
+ const spinner = createSpinner();
13
+ spinner.start('Installing claude-code...');
14
+ await installPackageGlobal('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);
15
+ spinner.stop(chalk.green('Installed claude-code.'));
16
+ }
17
+ else {
18
+ logger.step(`claude-code is already installed: v${claudeCodeInfo.version}`);
19
+ }
20
+ }
21
+ //# sourceMappingURL=installPackage.js.map
22
+ //# debugId=75413bc7-b5cf-5d3f-9312-61ec8ff3b80c
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installPackage.js","sources":["utils/packages/installPackage.ts"],"sourceRoot":"/","sourcesContent":["import { getPackageInfo } from 'gtx-cli/utils/packageInfo';\nimport { createSpinner } from '../../logging/console.js';\nimport chalk from 'chalk/index.js';\nimport { installPackageGlobal } from 'gtx-cli/utils/installPackage';\nimport { logger } from '../../logging/logger.js';\nimport { CLAUDE_CODE_VERSION } from '../shared.js';\n\nexport async function installClaudeCode() {\n const claudeCodeInfo = await getPackageInfo('@anthropic-ai/claude-code');\n if (!claudeCodeInfo) {\n const spinner = createSpinner();\n spinner.start('Installing claude-code...');\n await installPackageGlobal(\n '@anthropic-ai/claude-code',\n CLAUDE_CODE_VERSION\n );\n spinner.stop(chalk.green('Installed claude-code.'));\n } else {\n logger.step(`claude-code is already installed: v${claudeCodeInfo.version}`);\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC,2BAA2B,CAAC,CAAC;IACzE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC3C,MAAM,oBAAoB,CACxB,2BAA2B,EAC3B,mBAAmB,CACpB,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,sCAAsC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC","debug_id":"75413bc7-b5cf-5d3f-9312-61ec8ff3b80c"}
@@ -0,0 +1,2 @@
1
+ export declare function getSessionId(): string;
2
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"/","sources":["utils/session.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI,MAAM,CAKrC"}
@@ -0,0 +1,12 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1cd0c442-1dd2-510f-a16c-b7ccf0366d8b")}catch(e){}}();
3
+ import { randomUUID } from 'node:crypto';
4
+ let _sessionId = null;
5
+ export function getSessionId() {
6
+ if (!_sessionId) {
7
+ _sessionId = randomUUID();
8
+ }
9
+ return _sessionId;
10
+ }
11
+ //# sourceMappingURL=session.js.map
12
+ //# debugId=1cd0c442-1dd2-510f-a16c-b7ccf0366d8b
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sources":["utils/session.ts"],"sourceRoot":"/","sourcesContent":["import { randomUUID } from 'node:crypto';\n\nlet _sessionId: string | null = null;\n\nexport function getSessionId(): string {\n if (!_sessionId) {\n _sessionId = randomUUID();\n }\n return _sessionId;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,IAAI,UAAU,GAAkB,IAAI,CAAC;AAErC,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,UAAU,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","debug_id":"1cd0c442-1dd2-510f-a16c-b7ccf0366d8b"}
@@ -1,4 +1,5 @@
1
- export declare const EXCLUDED_DIRS: string[];
2
1
  export declare const DAG_IGNORED_FILES: string[];
2
+ export declare const DAG_IGNORED_PATTERNS: string[];
3
3
  export declare const DAG_IGNORED_EXTENSIONS: string[];
4
+ export declare const CLAUDE_CODE_VERSION = "1.0.16";
4
5
  //# sourceMappingURL=shared.d.ts.map