@sudocode-ai/local-server 0.1.14 → 0.1.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.
Files changed (74) hide show
  1. package/dist/execution/adapters/claude-adapter.d.ts.map +1 -1
  2. package/dist/execution/adapters/claude-adapter.js +1 -0
  3. package/dist/execution/adapters/claude-adapter.js.map +1 -1
  4. package/dist/execution/executors/agent-executor-wrapper.d.ts +1 -0
  5. package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -1
  6. package/dist/execution/executors/agent-executor-wrapper.js +2 -0
  7. package/dist/execution/executors/agent-executor-wrapper.js.map +1 -1
  8. package/dist/execution/process/builders/claude.d.ts.map +1 -1
  9. package/dist/execution/process/builders/claude.js +1 -0
  10. package/dist/execution/process/builders/claude.js.map +1 -1
  11. package/dist/execution/worktree/manager.d.ts +19 -0
  12. package/dist/execution/worktree/manager.d.ts.map +1 -1
  13. package/dist/execution/worktree/manager.js +50 -0
  14. package/dist/execution/worktree/manager.js.map +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +7 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/public/assets/index-D4AKx6EO.css +1 -0
  19. package/dist/public/assets/index-DorQqwGV.js +927 -0
  20. package/dist/public/assets/{index-3qSRtUlY.js.map → index-DorQqwGV.js.map} +1 -1
  21. package/dist/public/assets/{react-vendor-5f1Wq1qs.js → react-vendor-DoNwlLhy.js} +2 -2
  22. package/dist/public/assets/{react-vendor-5f1Wq1qs.js.map → react-vendor-DoNwlLhy.js.map} +1 -1
  23. package/dist/public/assets/{ui-vendor-BuU3mq4G.js → ui-vendor-DlxvBun1.js} +2 -2
  24. package/dist/public/assets/{ui-vendor-BuU3mq4G.js.map → ui-vendor-DlxvBun1.js.map} +1 -1
  25. package/dist/public/index.html +4 -4
  26. package/dist/routes/executions.d.ts.map +1 -1
  27. package/dist/routes/executions.js +89 -0
  28. package/dist/routes/executions.js.map +1 -1
  29. package/dist/routes/feedback.d.ts.map +1 -1
  30. package/dist/routes/feedback.js +5 -4
  31. package/dist/routes/feedback.js.map +1 -1
  32. package/dist/routes/import.d.ts +142 -0
  33. package/dist/routes/import.d.ts.map +1 -0
  34. package/dist/routes/import.js +896 -0
  35. package/dist/routes/import.js.map +1 -0
  36. package/dist/routes/issues.d.ts.map +1 -1
  37. package/dist/routes/issues.js +102 -0
  38. package/dist/routes/issues.js.map +1 -1
  39. package/dist/routes/plugins.d.ts +7 -0
  40. package/dist/routes/plugins.d.ts.map +1 -1
  41. package/dist/routes/plugins.js +110 -16
  42. package/dist/routes/plugins.js.map +1 -1
  43. package/dist/routes/projects.d.ts.map +1 -1
  44. package/dist/routes/projects.js +89 -0
  45. package/dist/routes/projects.js.map +1 -1
  46. package/dist/routes/specs.d.ts.map +1 -1
  47. package/dist/routes/specs.js +133 -5
  48. package/dist/routes/specs.js.map +1 -1
  49. package/dist/routes/update.d.ts +7 -0
  50. package/dist/routes/update.d.ts.map +1 -0
  51. package/dist/routes/update.js +194 -0
  52. package/dist/routes/update.js.map +1 -0
  53. package/dist/services/execution-changes-service.d.ts.map +1 -1
  54. package/dist/services/execution-changes-service.js +17 -7
  55. package/dist/services/execution-changes-service.js.map +1 -1
  56. package/dist/services/execution-service.d.ts +41 -0
  57. package/dist/services/execution-service.d.ts.map +1 -1
  58. package/dist/services/execution-service.js +312 -40
  59. package/dist/services/execution-service.js.map +1 -1
  60. package/dist/services/external-refresh-service.d.ts +104 -0
  61. package/dist/services/external-refresh-service.d.ts.map +1 -0
  62. package/dist/services/external-refresh-service.js +520 -0
  63. package/dist/services/external-refresh-service.js.map +1 -0
  64. package/dist/services/repo-info.d.ts +4 -0
  65. package/dist/services/repo-info.d.ts.map +1 -1
  66. package/dist/services/repo-info.js +42 -5
  67. package/dist/services/repo-info.js.map +1 -1
  68. package/dist/utils/execFileNoThrow.d.ts +43 -0
  69. package/dist/utils/execFileNoThrow.d.ts.map +1 -0
  70. package/dist/utils/execFileNoThrow.js +53 -0
  71. package/dist/utils/execFileNoThrow.js.map +1 -0
  72. package/package.json +6 -4
  73. package/dist/public/assets/index-3qSRtUlY.js +0 -844
  74. package/dist/public/assets/index-p0337DGd.css +0 -1
@@ -17,18 +17,53 @@ export async function getRepositoryInfo(repoPath) {
17
17
  if (!isValidRepo) {
18
18
  throw new Error("Not a git repository");
19
19
  }
20
- // Get repository name from git remote URL
20
+ // Get repository name and owner/repo from git remote URL
21
21
  let repoName = path.basename(repoPath); // Fallback to directory name
22
+ let ownerRepo;
23
+ let gitProvider;
22
24
  try {
23
25
  const remoteOutput = gitCli["execGit"]("git remote get-url origin", repoPath);
24
26
  const remoteUrl = remoteOutput.trim();
25
- // Extract repo name from various URL formats:
27
+ // Extract owner/repo from various URL formats:
26
28
  // - https://github.com/user/repo.git
27
29
  // - git@github.com:user/repo.git
28
30
  // - https://github.com/user/repo
29
- const match = remoteUrl.match(/\/([^\/]+?)(\.git)?$/);
30
- if (match && match[1]) {
31
- repoName = match[1];
31
+ // - https://gitlab.com/user/repo.git
32
+ // - git@gitlab.com:user/repo.git
33
+ // Detect provider from URL
34
+ if (remoteUrl.includes("github.com")) {
35
+ gitProvider = "github";
36
+ }
37
+ else if (remoteUrl.includes("gitlab.com")) {
38
+ gitProvider = "gitlab";
39
+ }
40
+ else if (remoteUrl.includes("bitbucket.org")) {
41
+ gitProvider = "bitbucket";
42
+ }
43
+ // Extract owner/repo - handle both HTTPS and SSH formats
44
+ let ownerRepoMatch;
45
+ if (remoteUrl.startsWith("git@")) {
46
+ // SSH format: git@github.com:owner/repo.git
47
+ ownerRepoMatch = remoteUrl.match(/:([^/]+\/[^/]+?)(\.git)?$/);
48
+ }
49
+ else {
50
+ // HTTPS format: https://github.com/owner/repo.git
51
+ ownerRepoMatch = remoteUrl.match(/(?:github\.com|gitlab\.com|bitbucket\.org)\/([^/]+\/[^/]+?)(\.git)?$/);
52
+ }
53
+ if (ownerRepoMatch && ownerRepoMatch[1]) {
54
+ ownerRepo = ownerRepoMatch[1];
55
+ // Extract repo name from owner/repo
56
+ const parts = ownerRepo.split("/");
57
+ if (parts.length === 2) {
58
+ repoName = parts[1];
59
+ }
60
+ }
61
+ else {
62
+ // Fallback: just extract repo name
63
+ const match = remoteUrl.match(/\/([^\/]+?)(\.git)?$/);
64
+ if (match && match[1]) {
65
+ repoName = match[1];
66
+ }
32
67
  }
33
68
  }
34
69
  catch (error) {
@@ -48,6 +83,8 @@ export async function getRepositoryInfo(repoPath) {
48
83
  name: repoName,
49
84
  branch,
50
85
  path: repoPath,
86
+ ownerRepo,
87
+ gitProvider,
51
88
  };
52
89
  }
53
90
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"repo-info.js","sourceRoot":"","sources":["../../src/services/repo-info.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAa1D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB;IAEhB,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAE5B,8CAA8C;IAC9C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IACvD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,0CAA0C;IAC1C,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,6BAA6B;IACrE,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CACpC,2BAA2B,EAC3B,QAAQ,CACT,CAAC;QACF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;QAEtC,8CAA8C;QAC9C,qCAAqC;QACrC,iCAAiC;QACjC,iCAAiC;QACjC,MAAM,KAAK,GA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QACjB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,qBAAqB;IACrB,IAAI,aAAa,GAAG,YAAY,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAC9B,iCAAiC,EACjC,QAAQ,CACT,CAAC;QACF,aAAa,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,yBAAyB;IACzB,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAC9B,wCAAwC,EACxC,QAAQ,CACT,CAAC;QACF,MAAM,UAAU,GAAG,MAAM;aACtB,IAAI,EAAE;aACN,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,4DAA4D;QAC5D,IAAI,aAAa,KAAK,YAAY,EAAE,CAAC;YACnC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Safe wrapper around execFile that returns result instead of throwing
3
+ *
4
+ * This utility provides a safe way to execute commands without throwing errors.
5
+ * It's particularly useful for detection operations where command failure
6
+ * indicates absence rather than error.
7
+ *
8
+ * @module utils/execFileNoThrow
9
+ */
10
+ /**
11
+ * Result of command execution
12
+ */
13
+ export interface ExecFileResult {
14
+ /** Standard output from command */
15
+ stdout: string;
16
+ /** Standard error from command */
17
+ stderr: string;
18
+ /** Exit status code (0 = success, non-zero = failure) */
19
+ status: number;
20
+ }
21
+ /**
22
+ * Execute a file/command safely without throwing errors
23
+ *
24
+ * Unlike the standard execFile which throws on non-zero exit codes,
25
+ * this function returns a result object indicating success/failure
26
+ * through the status code.
27
+ *
28
+ * @param file - Command to execute (e.g., 'which', 'where')
29
+ * @param args - Command arguments (e.g., ['sudocode-mcp'])
30
+ * @returns Result object with stdout, stderr, and status
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const result = await execFileNoThrow('which', ['sudocode-mcp']);
35
+ * if (result.status === 0) {
36
+ * console.log('Found:', result.stdout.trim());
37
+ * } else {
38
+ * console.log('Not found');
39
+ * }
40
+ * ```
41
+ */
42
+ export declare function execFileNoThrow(file: string, args?: string[]): Promise<ExecFileResult>;
43
+ //# sourceMappingURL=execFileNoThrow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execFileNoThrow.d.ts","sourceRoot":"","sources":["../../src/utils/execFileNoThrow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,cAAc,CAAC,CAiBzB"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Safe wrapper around execFile that returns result instead of throwing
3
+ *
4
+ * This utility provides a safe way to execute commands without throwing errors.
5
+ * It's particularly useful for detection operations where command failure
6
+ * indicates absence rather than error.
7
+ *
8
+ * @module utils/execFileNoThrow
9
+ */
10
+ import { execFile } from 'child_process';
11
+ import { promisify } from 'util';
12
+ const execFileAsync = promisify(execFile);
13
+ /**
14
+ * Execute a file/command safely without throwing errors
15
+ *
16
+ * Unlike the standard execFile which throws on non-zero exit codes,
17
+ * this function returns a result object indicating success/failure
18
+ * through the status code.
19
+ *
20
+ * @param file - Command to execute (e.g., 'which', 'where')
21
+ * @param args - Command arguments (e.g., ['sudocode-mcp'])
22
+ * @returns Result object with stdout, stderr, and status
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const result = await execFileNoThrow('which', ['sudocode-mcp']);
27
+ * if (result.status === 0) {
28
+ * console.log('Found:', result.stdout.trim());
29
+ * } else {
30
+ * console.log('Not found');
31
+ * }
32
+ * ```
33
+ */
34
+ export async function execFileNoThrow(file, args) {
35
+ try {
36
+ const { stdout, stderr } = await execFileAsync(file, args || []);
37
+ return {
38
+ stdout,
39
+ stderr,
40
+ status: 0,
41
+ };
42
+ }
43
+ catch (error) {
44
+ // execFile throws on non-zero exit codes
45
+ // Extract stdout/stderr from the error object if available
46
+ return {
47
+ stdout: error.stdout || '',
48
+ stderr: error.stderr || error.message || '',
49
+ status: error.code || 1,
50
+ };
51
+ }
52
+ }
53
+ //# sourceMappingURL=execFileNoThrow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execFileNoThrow.js","sourceRoot":"","sources":["../../src/utils/execFileNoThrow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAc1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAY,EACZ,IAAe;IAEf,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;QACjE,OAAO;YACL,MAAM;YACN,MAAM;YACN,MAAM,EAAE,CAAC;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,yCAAyC;QACzC,2DAA2D;QAC3D,OAAO;YACL,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;YAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE;YAC3C,MAAM,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;SACxB,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudocode-ai/local-server",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Local backend server for sudocode - provides REST API and WebSocket endpoints",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -42,11 +42,12 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@ag-ui/core": "^0.0.39",
45
+ "@iarna/toml": "^2.2.5",
45
46
  "@modelcontextprotocol/sdk": "^1.24.1",
46
- "@sudocode-ai/cli": "^0.1.14",
47
- "@sudocode-ai/types": "^0.1.14",
47
+ "@sudocode-ai/cli": "^0.1.16",
48
+ "@sudocode-ai/types": "^0.1.16",
48
49
  "@types/ws": "^8.18.1",
49
- "agent-execution-engine": "^0.0.15",
50
+ "agent-execution-engine": "^0.0.25",
50
51
  "async-mutex": "^0.5.0",
51
52
  "better-sqlite3": "^11.10.0",
52
53
  "cors": "^2.8.5",
@@ -61,6 +62,7 @@
61
62
  "@types/better-sqlite3": "^7.6.13",
62
63
  "@types/cors": "^2.8.17",
63
64
  "@types/express": "^4.17.21",
65
+ "@types/iarna__toml": "^2.0.5",
64
66
  "@types/node": "^20.11.19",
65
67
  "@types/supertest": "^6.0.3",
66
68
  "@types/which": "^3.0.4",