@sudocode-ai/local-server 0.1.7 → 0.1.9
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 +6 -0
- package/dist/errors/agent-errors.d.ts +43 -0
- package/dist/errors/agent-errors.d.ts.map +1 -0
- package/dist/errors/agent-errors.js +69 -0
- package/dist/errors/agent-errors.js.map +1 -0
- package/dist/execution/adapters/claude-adapter.d.ts +63 -0
- package/dist/execution/adapters/claude-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/claude-adapter.js +82 -0
- package/dist/execution/adapters/claude-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-adapter.d.ts +67 -0
- package/dist/execution/adapters/codex-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/codex-adapter.js +183 -0
- package/dist/execution/adapters/codex-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-config-builder.d.ts +30 -0
- package/dist/execution/adapters/codex-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/codex-config-builder.js +110 -0
- package/dist/execution/adapters/codex-config-builder.js.map +1 -0
- package/dist/execution/adapters/copilot-adapter.d.ts +94 -0
- package/dist/execution/adapters/copilot-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-adapter.js +163 -0
- package/dist/execution/adapters/copilot-adapter.js.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts +48 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.js +125 -0
- package/dist/execution/adapters/copilot-config-builder.js.map +1 -0
- package/dist/execution/adapters/cursor-adapter.d.ts +66 -0
- package/dist/execution/adapters/cursor-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-adapter.js +121 -0
- package/dist/execution/adapters/cursor-adapter.js.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts +29 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.js +49 -0
- package/dist/execution/adapters/cursor-config-builder.js.map +1 -0
- package/dist/execution/adapters/shared/config-presets.d.ts +102 -0
- package/dist/execution/adapters/shared/config-presets.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-presets.js +205 -0
- package/dist/execution/adapters/shared/config-presets.js.map +1 -0
- package/dist/execution/adapters/shared/config-utils.d.ts +95 -0
- package/dist/execution/adapters/shared/config-utils.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-utils.js +163 -0
- package/dist/execution/adapters/shared/config-utils.js.map +1 -0
- package/dist/execution/adapters/shared/index.d.ts +8 -0
- package/dist/execution/adapters/shared/index.d.ts.map +1 -0
- package/dist/execution/adapters/shared/index.js +8 -0
- package/dist/execution/adapters/shared/index.js.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts +153 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.js +652 -0
- package/dist/execution/executors/agent-executor-wrapper.js.map +1 -0
- package/dist/execution/executors/executor-factory.d.ts +95 -0
- package/dist/execution/executors/executor-factory.d.ts.map +1 -0
- package/dist/execution/executors/executor-factory.js +120 -0
- package/dist/execution/executors/executor-factory.js.map +1 -0
- package/dist/execution/output/ag-ui-adapter.d.ts +0 -2
- package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -1
- package/dist/execution/output/ag-ui-adapter.js +0 -2
- package/dist/execution/output/ag-ui-adapter.js.map +1 -1
- package/dist/execution/output/index.d.ts +0 -3
- package/dist/execution/output/index.d.ts.map +1 -1
- package/dist/execution/output/index.js +0 -2
- package/dist/execution/output/index.js.map +1 -1
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts +108 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts.map +1 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js +321 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js.map +1 -0
- package/dist/execution/process/builders/claude.d.ts +24 -57
- package/dist/execution/process/builders/claude.d.ts.map +1 -1
- package/dist/execution/process/builders/claude.js +153 -19
- package/dist/execution/process/builders/claude.js.map +1 -1
- package/dist/execution/transport/ipc-transport-manager.d.ts +74 -0
- package/dist/execution/transport/ipc-transport-manager.d.ts.map +1 -0
- package/dist/execution/transport/ipc-transport-manager.js +104 -0
- package/dist/execution/transport/ipc-transport-manager.js.map +1 -0
- package/dist/execution/transport/transport-manager.d.ts.map +1 -1
- package/dist/execution/transport/transport-manager.js +3 -0
- package/dist/execution/transport/transport-manager.js.map +1 -1
- package/dist/execution/worktree/conflict-detector.d.ts +85 -0
- package/dist/execution/worktree/conflict-detector.d.ts.map +1 -0
- package/dist/execution/worktree/conflict-detector.js +129 -0
- package/dist/execution/worktree/conflict-detector.js.map +1 -0
- package/dist/execution/worktree/git-cli.d.ts +9 -0
- package/dist/execution/worktree/git-cli.d.ts.map +1 -1
- package/dist/execution/worktree/git-cli.js +10 -0
- package/dist/execution/worktree/git-cli.js.map +1 -1
- package/dist/execution/worktree/git-sync-cli.d.ts +198 -0
- package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
- package/dist/execution/worktree/git-sync-cli.js +401 -0
- package/dist/execution/worktree/git-sync-cli.js.map +1 -0
- package/dist/execution/worktree/manager.d.ts +18 -0
- package/dist/execution/worktree/manager.d.ts.map +1 -1
- package/dist/execution/worktree/manager.js +9 -3
- package/dist/execution/worktree/manager.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +124 -229
- package/dist/index.js.map +1 -1
- package/dist/middleware/project-context.d.ts +37 -0
- package/dist/middleware/project-context.d.ts.map +1 -0
- package/dist/middleware/project-context.js +91 -0
- package/dist/middleware/project-context.js.map +1 -0
- package/dist/public/assets/index-DV9Tbujb.css +1 -0
- package/dist/public/assets/index-DcDX9-Ad.js +740 -0
- package/dist/public/assets/index-DcDX9-Ad.js.map +1 -0
- package/dist/public/assets/{react-vendor-ByUx1V_q.js → react-vendor-DiL5hC7l.js} +2 -2
- package/dist/public/assets/{react-vendor-ByUx1V_q.js.map → react-vendor-DiL5hC7l.js.map} +1 -1
- package/dist/public/assets/ui-vendor-B4WMPEfa.js +54 -0
- package/dist/public/assets/ui-vendor-B4WMPEfa.js.map +1 -0
- package/dist/public/index.html +4 -4
- package/dist/routes/agents.d.ts +3 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +62 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/routes/config.d.ts +3 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +25 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/editors.d.ts +15 -0
- package/dist/routes/editors.d.ts.map +1 -0
- package/dist/routes/editors.js +98 -0
- package/dist/routes/editors.js.map +1 -0
- package/dist/routes/executions-stream.d.ts +8 -5
- package/dist/routes/executions-stream.d.ts.map +1 -1
- package/dist/routes/executions-stream.js +10 -6
- package/dist/routes/executions-stream.js.map +1 -1
- package/dist/routes/executions.d.ts +6 -10
- package/dist/routes/executions.d.ts.map +1 -1
- package/dist/routes/executions.js +792 -37
- package/dist/routes/executions.js.map +1 -1
- package/dist/routes/feedback.d.ts +3 -2
- package/dist/routes/feedback.d.ts.map +1 -1
- package/dist/routes/feedback.js +12 -10
- package/dist/routes/feedback.js.map +1 -1
- package/dist/routes/files.d.ts +18 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/files.js +89 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/issues.d.ts +3 -2
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +19 -18
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/projects.d.ts +11 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +447 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/relationships.d.ts +3 -2
- package/dist/routes/relationships.d.ts.map +1 -1
- package/dist/routes/relationships.js +12 -10
- package/dist/routes/relationships.js.map +1 -1
- package/dist/routes/repo-info.d.ts +3 -0
- package/dist/routes/repo-info.d.ts.map +1 -0
- package/dist/routes/repo-info.js +203 -0
- package/dist/routes/repo-info.js.map +1 -0
- package/dist/routes/specs.d.ts +3 -2
- package/dist/routes/specs.d.ts.map +1 -1
- package/dist/routes/specs.js +19 -18
- package/dist/routes/specs.js.map +1 -1
- package/dist/routes/version.d.ts +3 -0
- package/dist/routes/version.d.ts.map +1 -0
- package/dist/routes/version.js +25 -0
- package/dist/routes/version.js.map +1 -0
- package/dist/services/agent-registry.d.ts +140 -0
- package/dist/services/agent-registry.d.ts.map +1 -0
- package/dist/services/agent-registry.js +272 -0
- package/dist/services/agent-registry.js.map +1 -0
- package/dist/services/editor-service.d.ts +57 -0
- package/dist/services/editor-service.d.ts.map +1 -0
- package/dist/services/editor-service.js +204 -0
- package/dist/services/editor-service.js.map +1 -0
- package/dist/services/execution-changes-service.d.ts +110 -0
- package/dist/services/execution-changes-service.d.ts.map +1 -0
- package/dist/services/execution-changes-service.js +700 -0
- package/dist/services/execution-changes-service.js.map +1 -0
- package/dist/services/execution-lifecycle.d.ts +1 -0
- package/dist/services/execution-lifecycle.d.ts.map +1 -1
- package/dist/services/execution-lifecycle.js +37 -7
- package/dist/services/execution-lifecycle.js.map +1 -1
- package/dist/services/execution-logs-store.d.ts +75 -0
- package/dist/services/execution-logs-store.d.ts.map +1 -1
- package/dist/services/execution-logs-store.js +142 -2
- package/dist/services/execution-logs-store.js.map +1 -1
- package/dist/services/execution-service.d.ts +82 -59
- package/dist/services/execution-service.d.ts.map +1 -1
- package/dist/services/execution-service.js +514 -469
- package/dist/services/execution-service.js.map +1 -1
- package/dist/services/execution-worker-pool.d.ts +116 -0
- package/dist/services/execution-worker-pool.d.ts.map +1 -0
- package/dist/services/execution-worker-pool.js +326 -0
- package/dist/services/execution-worker-pool.js.map +1 -0
- package/dist/services/executions.d.ts +3 -0
- package/dist/services/executions.d.ts.map +1 -1
- package/dist/services/executions.js +11 -17
- package/dist/services/executions.js.map +1 -1
- package/dist/services/export.d.ts +8 -2
- package/dist/services/export.d.ts.map +1 -1
- package/dist/services/export.js +29 -23
- package/dist/services/export.js.map +1 -1
- package/dist/services/file-search/git-ls-files-strategy.d.ts +72 -0
- package/dist/services/file-search/git-ls-files-strategy.d.ts.map +1 -0
- package/dist/services/file-search/git-ls-files-strategy.js +176 -0
- package/dist/services/file-search/git-ls-files-strategy.js.map +1 -0
- package/dist/services/file-search/index.d.ts +9 -0
- package/dist/services/file-search/index.d.ts.map +1 -0
- package/dist/services/file-search/index.js +10 -0
- package/dist/services/file-search/index.js.map +1 -0
- package/dist/services/file-search/registry.d.ts +97 -0
- package/dist/services/file-search/registry.d.ts.map +1 -0
- package/dist/services/file-search/registry.js +140 -0
- package/dist/services/file-search/registry.js.map +1 -0
- package/dist/services/file-search/strategy.d.ts +58 -0
- package/dist/services/file-search/strategy.d.ts.map +1 -0
- package/dist/services/file-search/strategy.js +8 -0
- package/dist/services/file-search/strategy.js.map +1 -0
- package/dist/services/project-context.d.ts +69 -0
- package/dist/services/project-context.d.ts.map +1 -0
- package/dist/services/project-context.js +113 -0
- package/dist/services/project-context.js.map +1 -0
- package/dist/services/project-manager.d.ts +95 -0
- package/dist/services/project-manager.d.ts.map +1 -0
- package/dist/services/project-manager.js +388 -0
- package/dist/services/project-manager.js.map +1 -0
- package/dist/services/project-registry.d.ts +98 -0
- package/dist/services/project-registry.d.ts.map +1 -0
- package/dist/services/project-registry.js +289 -0
- package/dist/services/project-registry.js.map +1 -0
- package/dist/services/prompt-resolver.d.ts +97 -0
- package/dist/services/prompt-resolver.d.ts.map +1 -0
- package/dist/services/prompt-resolver.js +377 -0
- package/dist/services/prompt-resolver.js.map +1 -0
- package/dist/services/repo-info.d.ts +12 -0
- package/dist/services/repo-info.d.ts.map +1 -1
- package/dist/services/repo-info.js +46 -0
- package/dist/services/repo-info.js.map +1 -1
- package/dist/services/version-service.d.ts +14 -0
- package/dist/services/version-service.d.ts.map +1 -0
- package/dist/services/version-service.js +57 -0
- package/dist/services/version-service.js.map +1 -0
- package/dist/services/watcher.d.ts +3 -4
- package/dist/services/watcher.d.ts.map +1 -1
- package/dist/services/watcher.js +18 -35
- package/dist/services/watcher.js.map +1 -1
- package/dist/services/websocket.d.ts +30 -16
- package/dist/services/websocket.d.ts.map +1 -1
- package/dist/services/websocket.js +102 -37
- package/dist/services/websocket.js.map +1 -1
- package/dist/services/worktree-sync-service.d.ts +326 -0
- package/dist/services/worktree-sync-service.d.ts.map +1 -0
- package/dist/services/worktree-sync-service.js +1091 -0
- package/dist/services/worktree-sync-service.js.map +1 -0
- package/dist/types/editor.d.ts +49 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/dist/types/editor.js +50 -0
- package/dist/types/editor.js.map +1 -0
- package/dist/types/project.d.ts +58 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/project.js +10 -0
- package/dist/types/project.js.map +1 -0
- package/dist/utils/executable-check.d.ts +36 -0
- package/dist/utils/executable-check.d.ts.map +1 -0
- package/dist/utils/executable-check.js +79 -0
- package/dist/utils/executable-check.js.map +1 -0
- package/dist/workers/execution-worker.d.ts +18 -0
- package/dist/workers/execution-worker.d.ts.map +1 -0
- package/dist/workers/execution-worker.js +340 -0
- package/dist/workers/execution-worker.js.map +1 -0
- package/dist/workers/worker-ipc.d.ts +84 -0
- package/dist/workers/worker-ipc.d.ts.map +1 -0
- package/dist/workers/worker-ipc.js +29 -0
- package/dist/workers/worker-ipc.js.map +1 -0
- package/package.json +6 -5
- package/dist/execution/output/ag-ui-integration.d.ts +0 -96
- package/dist/execution/output/ag-ui-integration.d.ts.map +0 -1
- package/dist/execution/output/ag-ui-integration.js +0 -96
- package/dist/execution/output/ag-ui-integration.js.map +0 -1
- package/dist/execution/output/claude-code-output-processor.d.ts +0 -321
- package/dist/execution/output/claude-code-output-processor.d.ts.map +0 -1
- package/dist/execution/output/claude-code-output-processor.js +0 -769
- package/dist/execution/output/claude-code-output-processor.js.map +0 -1
- package/dist/public/assets/index-B3SEMufD.js +0 -580
- package/dist/public/assets/index-B3SEMufD.js.map +0 -1
- package/dist/public/assets/index-D2YGL3gX.css +0 -1
- package/dist/public/assets/ui-vendor-CotR6bx9.js +0 -54
- package/dist/public/assets/ui-vendor-CotR6bx9.js.map +0 -1
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import * as crypto from 'crypto';
|
|
5
|
+
import { Ok, Err } from '../types/project.js';
|
|
6
|
+
function getDefaultConfig() {
|
|
7
|
+
return {
|
|
8
|
+
version: 1,
|
|
9
|
+
projects: {},
|
|
10
|
+
recentProjects: [],
|
|
11
|
+
settings: {
|
|
12
|
+
maxRecentProjects: 10,
|
|
13
|
+
autoOpenLastProject: false,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ProjectRegistry manages the persistent storage of registered projects.
|
|
19
|
+
*
|
|
20
|
+
* Configuration is stored at ~/.config/sudocode/projects.json and includes:
|
|
21
|
+
* - Registered projects with metadata
|
|
22
|
+
* - Recent projects list
|
|
23
|
+
* - User settings
|
|
24
|
+
*/
|
|
25
|
+
export class ProjectRegistry {
|
|
26
|
+
configPath;
|
|
27
|
+
config;
|
|
28
|
+
/**
|
|
29
|
+
* Create a new ProjectRegistry instance
|
|
30
|
+
* @param configPath - Optional custom config file path (defaults to ~/.config/sudocode/projects.json)
|
|
31
|
+
*/
|
|
32
|
+
constructor(configPath) {
|
|
33
|
+
this.configPath = configPath || this.getDefaultConfigPath();
|
|
34
|
+
this.config = getDefaultConfig();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the default config file path following XDG Base Directory specification
|
|
38
|
+
*/
|
|
39
|
+
getDefaultConfigPath() {
|
|
40
|
+
const configDir = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config', 'sudocode');
|
|
41
|
+
return path.join(configDir, 'projects.json');
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Load configuration from disk. Creates default config if file doesn't exist.
|
|
45
|
+
* @throws {Error} If config file is corrupted or unreadable
|
|
46
|
+
*/
|
|
47
|
+
async load() {
|
|
48
|
+
try {
|
|
49
|
+
// Ensure config directory exists
|
|
50
|
+
const configDir = path.dirname(this.configPath);
|
|
51
|
+
if (!fs.existsSync(configDir)) {
|
|
52
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
// Load existing config or create default
|
|
55
|
+
if (fs.existsSync(this.configPath)) {
|
|
56
|
+
const data = fs.readFileSync(this.configPath, 'utf-8');
|
|
57
|
+
try {
|
|
58
|
+
this.config = JSON.parse(data);
|
|
59
|
+
// Validate config structure
|
|
60
|
+
if (!this.config.version || !this.config.projects || !this.config.settings) {
|
|
61
|
+
throw new Error('Invalid config structure');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (parseError) {
|
|
65
|
+
// Config is corrupted, backup and create fresh
|
|
66
|
+
const backupPath = `${this.configPath}.backup.${Date.now()}`;
|
|
67
|
+
fs.copyFileSync(this.configPath, backupPath);
|
|
68
|
+
console.warn(`Corrupted config backed up to: ${backupPath}`);
|
|
69
|
+
this.config = getDefaultConfig();
|
|
70
|
+
await this.save();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// Create default config
|
|
75
|
+
await this.save();
|
|
76
|
+
}
|
|
77
|
+
return Ok(undefined);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error.code === 'EACCES') {
|
|
81
|
+
return Err({
|
|
82
|
+
type: 'PERMISSION_DENIED',
|
|
83
|
+
path: this.configPath,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return Err({
|
|
87
|
+
type: 'UNKNOWN',
|
|
88
|
+
message: error.message,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Save configuration to disk atomically (write to temp file, then rename)
|
|
94
|
+
*/
|
|
95
|
+
async save() {
|
|
96
|
+
try {
|
|
97
|
+
const tempPath = `${this.configPath}.tmp`;
|
|
98
|
+
const data = JSON.stringify(this.config, null, 2);
|
|
99
|
+
// Write to temp file
|
|
100
|
+
fs.writeFileSync(tempPath, data, 'utf-8');
|
|
101
|
+
// Atomic rename
|
|
102
|
+
fs.renameSync(tempPath, this.configPath);
|
|
103
|
+
return Ok(undefined);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (error.code === 'EACCES') {
|
|
107
|
+
return Err({
|
|
108
|
+
type: 'PERMISSION_DENIED',
|
|
109
|
+
path: this.configPath,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return Err({
|
|
113
|
+
type: 'UNKNOWN',
|
|
114
|
+
message: error.message,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Generate a deterministic, human-readable project ID from path
|
|
120
|
+
* Format: <repo-name>-<8-char-hash>
|
|
121
|
+
* Example: sudocode-a1b2c3d4
|
|
122
|
+
*/
|
|
123
|
+
generateProjectId(projectPath) {
|
|
124
|
+
// Extract repo name from path
|
|
125
|
+
const repoName = path.basename(projectPath);
|
|
126
|
+
// Create URL-safe version of repo name
|
|
127
|
+
const safeName = repoName
|
|
128
|
+
.toLowerCase()
|
|
129
|
+
.replace(/[^a-z0-9-]/g, '-')
|
|
130
|
+
.replace(/-+/g, '-')
|
|
131
|
+
.replace(/^-|-$/g, '') // Remove leading/trailing dashes
|
|
132
|
+
.slice(0, 32);
|
|
133
|
+
// Generate short hash for uniqueness
|
|
134
|
+
const hash = crypto
|
|
135
|
+
.createHash('sha256')
|
|
136
|
+
.update(projectPath)
|
|
137
|
+
.digest('hex')
|
|
138
|
+
.slice(0, 8);
|
|
139
|
+
return `${safeName}-${hash}`;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Register a new project or update existing one
|
|
143
|
+
* @param projectPath - Absolute path to project root directory
|
|
144
|
+
* @returns ProjectInfo for the registered project
|
|
145
|
+
*/
|
|
146
|
+
registerProject(projectPath) {
|
|
147
|
+
const projectId = this.generateProjectId(projectPath);
|
|
148
|
+
const sudocodeDir = path.join(projectPath, '.sudocode');
|
|
149
|
+
const now = new Date().toISOString();
|
|
150
|
+
// Check if project already exists
|
|
151
|
+
const existing = this.config.projects[projectId];
|
|
152
|
+
if (existing) {
|
|
153
|
+
// Update existing project
|
|
154
|
+
existing.lastOpenedAt = now;
|
|
155
|
+
this.addToRecent(projectId);
|
|
156
|
+
return existing;
|
|
157
|
+
}
|
|
158
|
+
// Create new project info
|
|
159
|
+
const projectInfo = {
|
|
160
|
+
id: projectId,
|
|
161
|
+
name: path.basename(projectPath),
|
|
162
|
+
path: projectPath,
|
|
163
|
+
sudocodeDir,
|
|
164
|
+
registeredAt: now,
|
|
165
|
+
lastOpenedAt: now,
|
|
166
|
+
favorite: false,
|
|
167
|
+
};
|
|
168
|
+
this.config.projects[projectId] = projectInfo;
|
|
169
|
+
this.addToRecent(projectId);
|
|
170
|
+
return projectInfo;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Unregister a project (remove from registry)
|
|
174
|
+
* @param projectId - Project ID to remove
|
|
175
|
+
* @returns true if project was removed, false if not found
|
|
176
|
+
*/
|
|
177
|
+
unregisterProject(projectId) {
|
|
178
|
+
if (!this.config.projects[projectId]) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
delete this.config.projects[projectId];
|
|
182
|
+
// Remove from recent projects
|
|
183
|
+
this.config.recentProjects = this.config.recentProjects.filter((id) => id !== projectId);
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get project info by ID
|
|
188
|
+
*/
|
|
189
|
+
getProject(projectId) {
|
|
190
|
+
return this.config.projects[projectId] || null;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get all registered projects
|
|
194
|
+
*/
|
|
195
|
+
getAllProjects() {
|
|
196
|
+
return Object.values(this.config.projects);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Update the lastOpenedAt timestamp for a project
|
|
200
|
+
*/
|
|
201
|
+
updateLastOpened(projectId) {
|
|
202
|
+
const project = this.config.projects[projectId];
|
|
203
|
+
if (project) {
|
|
204
|
+
project.lastOpenedAt = new Date().toISOString();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Add a project to the recent projects list
|
|
209
|
+
* Maintains the list at maxRecentProjects size with most recent first
|
|
210
|
+
*/
|
|
211
|
+
addToRecent(projectId) {
|
|
212
|
+
// Remove if already in list
|
|
213
|
+
this.config.recentProjects = this.config.recentProjects.filter((id) => id !== projectId);
|
|
214
|
+
// Add to front
|
|
215
|
+
this.config.recentProjects.unshift(projectId);
|
|
216
|
+
// Trim to max size
|
|
217
|
+
const maxRecent = this.config.settings.maxRecentProjects;
|
|
218
|
+
if (this.config.recentProjects.length > maxRecent) {
|
|
219
|
+
this.config.recentProjects = this.config.recentProjects.slice(0, maxRecent);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Get recent projects (ordered by most recent first)
|
|
224
|
+
*/
|
|
225
|
+
getRecentProjects() {
|
|
226
|
+
return this.config.recentProjects
|
|
227
|
+
.map((id) => this.config.projects[id])
|
|
228
|
+
.filter((p) => p !== undefined);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Update project metadata
|
|
232
|
+
* @param projectId - Project ID to update
|
|
233
|
+
* @param updates - Partial project info to update
|
|
234
|
+
* @returns true if project was updated, false if not found
|
|
235
|
+
*/
|
|
236
|
+
updateProject(projectId, updates) {
|
|
237
|
+
const project = this.config.projects[projectId];
|
|
238
|
+
if (!project) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
// Only allow updating name and favorite fields
|
|
242
|
+
if (updates.name !== undefined) {
|
|
243
|
+
project.name = updates.name;
|
|
244
|
+
}
|
|
245
|
+
if (updates.favorite !== undefined) {
|
|
246
|
+
project.favorite = updates.favorite;
|
|
247
|
+
}
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Toggle favorite status for a project
|
|
252
|
+
*/
|
|
253
|
+
toggleFavorite(projectId) {
|
|
254
|
+
const project = this.config.projects[projectId];
|
|
255
|
+
if (!project) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
project.favorite = !project.favorite;
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Get all favorite projects
|
|
263
|
+
*/
|
|
264
|
+
getFavoriteProjects() {
|
|
265
|
+
return Object.values(this.config.projects).filter((p) => p.favorite);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Update user settings
|
|
269
|
+
*/
|
|
270
|
+
updateSettings(settings) {
|
|
271
|
+
this.config.settings = {
|
|
272
|
+
...this.config.settings,
|
|
273
|
+
...settings,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get current settings
|
|
278
|
+
*/
|
|
279
|
+
getSettings() {
|
|
280
|
+
return { ...this.config.settings };
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get the config file path
|
|
284
|
+
*/
|
|
285
|
+
getConfigPath() {
|
|
286
|
+
return this.configPath;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=project-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-registry.js","sourceRoot":"","sources":["../../src/services/project-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,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H,mBAAmB;QACjB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACtE,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,QAA6C;QAC1D,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG;YACrB,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ;YACvB,GAAG,QAAQ;SACZ,CAAA;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;IACpC,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt resolver service
|
|
3
|
+
*
|
|
4
|
+
* Resolves entity references and file mentions in agent prompts:
|
|
5
|
+
* - Injects [[s-xxxxx]] or @s-xxxxx spec references with markdown content
|
|
6
|
+
* - Injects [[i-xxxxx]] or @i-xxxxx issue references with markdown content
|
|
7
|
+
* - Tracks @file mentions but leaves them for agent to handle
|
|
8
|
+
*/
|
|
9
|
+
import type Database from "better-sqlite3";
|
|
10
|
+
/**
|
|
11
|
+
* Reference types found in prompts
|
|
12
|
+
*/
|
|
13
|
+
export type ReferenceType = "spec" | "issue" | "file";
|
|
14
|
+
/**
|
|
15
|
+
* A reference found in a prompt
|
|
16
|
+
*/
|
|
17
|
+
export interface PromptReference {
|
|
18
|
+
type: ReferenceType;
|
|
19
|
+
id: string;
|
|
20
|
+
found: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Result of prompt resolution
|
|
25
|
+
*/
|
|
26
|
+
export interface PromptResolutionResult {
|
|
27
|
+
resolvedPrompt: string;
|
|
28
|
+
references: PromptReference[];
|
|
29
|
+
errors: string[];
|
|
30
|
+
/** IDs of entities that were expanded (for tracking in follow-ups) */
|
|
31
|
+
expandedEntityIds: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* PromptResolver service
|
|
35
|
+
*
|
|
36
|
+
* Extracts and resolves entity references in agent prompts
|
|
37
|
+
*/
|
|
38
|
+
export declare class PromptResolver {
|
|
39
|
+
private db;
|
|
40
|
+
constructor(db: Database.Database);
|
|
41
|
+
/**
|
|
42
|
+
* Resolve all references in a prompt
|
|
43
|
+
*
|
|
44
|
+
* @param prompt - The raw prompt with [[entity-id]], @entity-id, and @file references
|
|
45
|
+
* @param alreadyExpandedIds - Optional set of entity IDs that were already expanded in parent executions
|
|
46
|
+
* @param implicitIssueId - Optional issue ID to automatically include even if not mentioned in prompt (for issue-based executions)
|
|
47
|
+
* @returns Resolution result with resolved prompt, references, and errors
|
|
48
|
+
*/
|
|
49
|
+
resolve(prompt: string, alreadyExpandedIds?: Set<string>, implicitIssueId?: string): Promise<PromptResolutionResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Extract spec references from prompt
|
|
52
|
+
* Supports two patterns:
|
|
53
|
+
* - [[s-xxxxx]] (bracket syntax)
|
|
54
|
+
* - @s-xxxxx (@ mention syntax)
|
|
55
|
+
*/
|
|
56
|
+
private extractSpecReferences;
|
|
57
|
+
/**
|
|
58
|
+
* Extract issue references from prompt
|
|
59
|
+
* Supports two patterns:
|
|
60
|
+
* - [[i-xxxxx]] (bracket syntax)
|
|
61
|
+
* - @i-xxxxx (@ mention syntax)
|
|
62
|
+
*/
|
|
63
|
+
private extractIssueReferences;
|
|
64
|
+
/**
|
|
65
|
+
* Extract file mentions from prompt
|
|
66
|
+
* Pattern: @filepath (but not @s-xxxxx or @i-xxxxx)
|
|
67
|
+
*
|
|
68
|
+
* Note: File mentions are tracked but not resolved (agent handles them)
|
|
69
|
+
*/
|
|
70
|
+
private extractFileMentions;
|
|
71
|
+
/**
|
|
72
|
+
* Replace a reference with formatted content
|
|
73
|
+
* Handles both [[id]] and @id syntaxes
|
|
74
|
+
*/
|
|
75
|
+
private replaceReference;
|
|
76
|
+
/**
|
|
77
|
+
* Format spec - returns all information shown in CLI show command
|
|
78
|
+
*/
|
|
79
|
+
private formatSpec;
|
|
80
|
+
/**
|
|
81
|
+
* Format issue - returns all information shown in CLI show command
|
|
82
|
+
*/
|
|
83
|
+
private formatIssue;
|
|
84
|
+
/**
|
|
85
|
+
* Get tags for an entity
|
|
86
|
+
*/
|
|
87
|
+
private getTags;
|
|
88
|
+
/**
|
|
89
|
+
* Get outgoing relationships for an entity
|
|
90
|
+
*/
|
|
91
|
+
private getOutgoingRelationships;
|
|
92
|
+
/**
|
|
93
|
+
* Get incoming relationships for an entity
|
|
94
|
+
*/
|
|
95
|
+
private getIncomingRelationships;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=prompt-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-resolver.d.ts","sourceRoot":"","sources":["../../src/services/prompt-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,qBAAa,cAAc;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