@sudocode-ai/cli 0.1.18-dev.0 → 0.1.19

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 (67) hide show
  1. package/README.md +1299 -0
  2. package/dist/auth/claude.d.ts +19 -0
  3. package/dist/auth/claude.d.ts.map +1 -0
  4. package/dist/auth/claude.js +179 -0
  5. package/dist/auth/claude.js.map +1 -0
  6. package/dist/auth/clear.d.ts +17 -0
  7. package/dist/auth/clear.d.ts.map +1 -0
  8. package/dist/auth/clear.js +68 -0
  9. package/dist/auth/clear.js.map +1 -0
  10. package/dist/auth/credentials.d.ts +93 -0
  11. package/dist/auth/credentials.d.ts.map +1 -0
  12. package/dist/auth/credentials.js +255 -0
  13. package/dist/auth/credentials.js.map +1 -0
  14. package/dist/auth/index.d.ts +13 -0
  15. package/dist/auth/index.d.ts.map +1 -0
  16. package/dist/auth/index.js +19 -0
  17. package/dist/auth/index.js.map +1 -0
  18. package/dist/auth/status.d.ts +17 -0
  19. package/dist/auth/status.d.ts.map +1 -0
  20. package/dist/auth/status.js +132 -0
  21. package/dist/auth/status.js.map +1 -0
  22. package/dist/cli/auth-commands.d.ts +34 -0
  23. package/dist/cli/auth-commands.d.ts.map +1 -0
  24. package/dist/cli/auth-commands.js +28 -0
  25. package/dist/cli/auth-commands.js.map +1 -0
  26. package/dist/cli/remote-commands.d.ts +59 -0
  27. package/dist/cli/remote-commands.d.ts.map +1 -0
  28. package/dist/cli/remote-commands.js +391 -0
  29. package/dist/cli/remote-commands.js.map +1 -0
  30. package/dist/cli/update-commands.d.ts.map +1 -1
  31. package/dist/cli/update-commands.js +56 -0
  32. package/dist/cli/update-commands.js.map +1 -1
  33. package/dist/cli.js +130 -0
  34. package/dist/cli.js.map +1 -1
  35. package/dist/db.d.ts +1 -1
  36. package/dist/db.d.ts.map +1 -1
  37. package/dist/db.js +2 -2
  38. package/dist/db.js.map +1 -1
  39. package/dist/remote/claude-auth.d.ts +65 -0
  40. package/dist/remote/claude-auth.d.ts.map +1 -0
  41. package/dist/remote/claude-auth.js +100 -0
  42. package/dist/remote/claude-auth.js.map +1 -0
  43. package/dist/remote/config.d.ts +83 -0
  44. package/dist/remote/config.d.ts.map +1 -0
  45. package/dist/remote/config.js +266 -0
  46. package/dist/remote/config.js.map +1 -0
  47. package/dist/remote/errors.d.ts +18 -0
  48. package/dist/remote/errors.d.ts.map +1 -0
  49. package/dist/remote/errors.js +27 -0
  50. package/dist/remote/errors.js.map +1 -0
  51. package/dist/remote/git-context.d.ts +51 -0
  52. package/dist/remote/git-context.d.ts.map +1 -0
  53. package/dist/remote/git-context.js +107 -0
  54. package/dist/remote/git-context.js.map +1 -0
  55. package/dist/remote/spawn-service.d.ts +86 -0
  56. package/dist/remote/spawn-service.d.ts.map +1 -0
  57. package/dist/remote/spawn-service.js +248 -0
  58. package/dist/remote/spawn-service.js.map +1 -0
  59. package/dist/remote/types.d.ts +82 -0
  60. package/dist/remote/types.d.ts.map +1 -0
  61. package/dist/remote/types.js +5 -0
  62. package/dist/remote/types.js.map +1 -0
  63. package/package.json +4 -7
  64. package/dist/better-sqlite3-loader.d.ts +0 -9
  65. package/dist/better-sqlite3-loader.d.ts.map +0 -1
  66. package/dist/better-sqlite3-loader.js +0 -24
  67. package/dist/better-sqlite3-loader.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/remote/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,gBAAgB;IAChB,mBAAmB;IACnB,cAAc;IACd,mBAAmB;IACnB,SAAS;IACT,UAAU;IACV,WAAW;CACH,CAAC;AAEX;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,YAAY,OAAe;QACzB,KAAK,CAAC,O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AC;QACJ,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAE,CAAC;IACrC,CAAC;IAQD,mBAAmB,CAAC,QAAgC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAElD,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC9B,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC;QAC9D,CAAC;aAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YAChC,+DAA+D;YAC/D,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE,CAAC;QAC9B,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAE,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Error handling for remote deployment
3
+ *
4
+ * STUB: This is a placeholder implementation.
5
+ * Full implementation will be done in a separate issue.
6
+ */
7
+ /**
8
+ * Configuration error class
9
+ */
10
+ export declare class ConfigurationError extends Error {
11
+ field?: string | undefined;
12
+ constructor(message: string, field?: string | undefined);
13
+ }
14
+ /**
15
+ * Format error message for display
16
+ */
17
+ export declare function formatErrorMessage(error: unknown): string;
18
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/remote/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IACP,KAAK,CAAC,EAAE,MAAM;gBAAtC,OAAO,EAAE,MAAM,EAAS,KAAK,CAAC,EAAE,MAAM,YAAA;CAInD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKzD"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Error handling for remote deployment
3
+ *
4
+ * STUB: This is a placeholder implementation.
5
+ * Full implementation will be done in a separate issue.
6
+ */
7
+ /**
8
+ * Configuration error class
9
+ */
10
+ export class ConfigurationError extends Error {
11
+ field;
12
+ constructor(message, field) {
13
+ super(message);
14
+ this.field = field;
15
+ this.name = 'ConfigurationError';
16
+ }
17
+ }
18
+ /**
19
+ * Format error message for display
20
+ */
21
+ export function formatErrorMessage(error) {
22
+ if (error instanceof Error) {
23
+ return error.message;
24
+ }
25
+ return String(error);
26
+ }
27
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/remote/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACP;IAApC,YAAY,OAAe,EAAS,KAAc;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,UAAK,GAAL,KAAK,CAAS;QAEhD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Git repository context
3
+ */
4
+ export interface GitContext {
5
+ owner: string;
6
+ repo: string;
7
+ branch: string;
8
+ }
9
+ /**
10
+ * Options for context detection
11
+ */
12
+ export interface GitContextOptions {
13
+ owner?: string;
14
+ repo?: string;
15
+ branch?: string;
16
+ remote?: string;
17
+ }
18
+ /**
19
+ * Service to detect git repository context from local git configuration
20
+ */
21
+ export declare class GitContextDetector {
22
+ /**
23
+ * Check if current directory is in a git repository
24
+ */
25
+ isGitRepository(): boolean;
26
+ /**
27
+ * Get current branch name
28
+ */
29
+ getCurrentBranch(): string;
30
+ /**
31
+ * Get remote URL for specified remote (defaults to 'origin')
32
+ */
33
+ getRemoteUrl(remote?: string): string;
34
+ /**
35
+ * Parse owner and repo from git remote URL
36
+ * Supports both HTTPS and SSH formats:
37
+ * - https://github.com/owner/repo.git
38
+ * - git@github.com:owner/repo.git
39
+ */
40
+ parseRemote(remote: string): {
41
+ owner: string;
42
+ repo: string;
43
+ };
44
+ /**
45
+ * Detect full git context with optional overrides
46
+ * @param options - Optional overrides for owner, repo, branch, or remote name
47
+ * @returns GitContext with owner, repo, and branch
48
+ */
49
+ detectContext(options?: GitContextOptions): GitContext;
50
+ }
51
+ //# sourceMappingURL=git-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-context.d.ts","sourceRoot":"","sources":["../../src/remote/git-context.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,eAAe,IAAI,OAAO;IAS1B;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAY1B;;OAEG;IACH,YAAY,CAAC,MAAM,GAAE,MAAiB,GAAG,MAAM;IAY/C;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAsB5D;;;;OAIG;IACH,aAAa,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU;CAiC3D"}
@@ -0,0 +1,107 @@
1
+ import { execSync } from 'child_process';
2
+ /**
3
+ * Service to detect git repository context from local git configuration
4
+ */
5
+ export class GitContextDetector {
6
+ /**
7
+ * Check if current directory is in a git repository
8
+ */
9
+ isGitRepository() {
10
+ try {
11
+ execSync('git rev-parse --git-dir', { stdio: 'pipe', encoding: 'utf-8' });
12
+ return true;
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
18
+ /**
19
+ * Get current branch name
20
+ */
21
+ getCurrentBranch() {
22
+ try {
23
+ const branch = execSync('git rev-parse --abbrev-ref HEAD', {
24
+ stdio: 'pipe',
25
+ encoding: 'utf-8',
26
+ }).trim();
27
+ return branch;
28
+ }
29
+ catch (error) {
30
+ throw new Error('Failed to get current branch: not in a git repository');
31
+ }
32
+ }
33
+ /**
34
+ * Get remote URL for specified remote (defaults to 'origin')
35
+ */
36
+ getRemoteUrl(remote = 'origin') {
37
+ try {
38
+ const url = execSync(`git remote get-url ${remote}`, {
39
+ stdio: 'pipe',
40
+ encoding: 'utf-8',
41
+ }).trim();
42
+ return url;
43
+ }
44
+ catch (error) {
45
+ throw new Error(`Failed to get remote URL for '${remote}'`);
46
+ }
47
+ }
48
+ /**
49
+ * Parse owner and repo from git remote URL
50
+ * Supports both HTTPS and SSH formats:
51
+ * - https://github.com/owner/repo.git
52
+ * - git@github.com:owner/repo.git
53
+ */
54
+ parseRemote(remote) {
55
+ // HTTPS format: https://github.com/owner/repo.git
56
+ const httpsMatch = remote.match(/https?:\/\/[^/]+\/([^/]+)\/([^/]+?)(\.git)?$/);
57
+ if (httpsMatch) {
58
+ return {
59
+ owner: httpsMatch[1],
60
+ repo: httpsMatch[2],
61
+ };
62
+ }
63
+ // SSH format: git@github.com:owner/repo.git
64
+ const sshMatch = remote.match(/git@[^:]+:([^/]+)\/([^/]+?)(\.git)?$/);
65
+ if (sshMatch) {
66
+ return {
67
+ owner: sshMatch[1],
68
+ repo: sshMatch[2],
69
+ };
70
+ }
71
+ throw new Error(`Unable to parse git remote URL: ${remote}`);
72
+ }
73
+ /**
74
+ * Detect full git context with optional overrides
75
+ * @param options - Optional overrides for owner, repo, branch, or remote name
76
+ * @returns GitContext with owner, repo, and branch
77
+ */
78
+ detectContext(options = {}) {
79
+ // Check if in git repository
80
+ if (!this.isGitRepository()) {
81
+ throw new Error('Not in a git repository');
82
+ }
83
+ // Get branch (with override)
84
+ const branch = options.branch ?? this.getCurrentBranch();
85
+ // If owner and repo are both provided, use them
86
+ if (options.owner && options.repo) {
87
+ return {
88
+ owner: options.owner,
89
+ repo: options.repo,
90
+ branch,
91
+ };
92
+ }
93
+ // Get remote URL and parse it
94
+ const remoteName = options.remote ?? 'origin';
95
+ const remoteUrl = this.getRemoteUrl(remoteName);
96
+ const { owner: detectedOwner, repo: detectedRepo } = this.parseRemote(remoteUrl);
97
+ // Use overrides if provided, otherwise use detected values
98
+ const owner = options.owner ?? detectedOwner;
99
+ const repo = options.repo ?? detectedRepo;
100
+ return {
101
+ owner,
102
+ repo,
103
+ branch,
104
+ };
105
+ }
106
+ }
107
+ //# sourceMappingURL=git-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-context.js","sourceRoot":"","sources":["../../src/remote/git-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAqBzC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;OAEG;IACH,eAAe;QACb,IAAI,CAAC;YACH,QAAQ,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YAC1E,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,IAAI,CAAC;YACH,MAAM,M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,CAAC,UAA6B,EAAE;QAC3C,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QAED,6BAA6B;QAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAEzD,gDAAgD;QAChD,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAClC,OAAO;gBACL,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM;aACP,CAAC;QACJ,CAAC;QAED,8BAA8B;QAC9B,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAChD,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEjF,2DAA2D;QAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC;QAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,YAAY,CAAC;QAE1C,OAAO;YACL,KAAK;YACL,IAAI;YACJ,MAAM;SACP,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * RemoteSpawnService - Main service for remote deployments
3
+ *
4
+ * Coordinates the full deployment workflow:
5
+ * 1. Check GitHub CLI authentication
6
+ * 2. Detect git context
7
+ * 3. Ensure Claude authentication
8
+ * 4. Load and merge configuration
9
+ * 5. Create sudopod provider
10
+ * 6. Execute deployment with progress indicator
11
+ */
12
+ import type { SpawnOptions } from './types.js';
13
+ export type { DeploymentInfo } from './types.js';
14
+ export type { SpawnOptions } from './types.js';
15
+ import type { DeploymentInfo } from './types.js';
16
+ /**
17
+ * Main service for remote deployments
18
+ */
19
+ export declare class RemoteSpawnService {
20
+ private sudocodeDir;
21
+ private configManager;
22
+ private gitDetector;
23
+ private authIntegration;
24
+ constructor(sudocodeDir: string);
25
+ /**
26
+ * Open a URL in the default browser (platform-agnostic)
27
+ * Fire and forget - doesn't block or throw errors
28
+ */
29
+ private openBrowser;
30
+ /**
31
+ * Spawn to a remote provider
32
+ *
33
+ * @param options Spawn options with optional overrides
34
+ * @returns Deployment information
35
+ * @throws Error if deployment fails or prerequisites are not met
36
+ */
37
+ spawn(options: SpawnOptions & {
38
+ provider?: 'codespaces' | 'coder';
39
+ }): Promise<DeploymentInfo>;
40
+ /**
41
+ * List all deployments for a provider
42
+ *
43
+ * @param provider Provider name ('codespaces' or 'coder')
44
+ * @returns List of deployments
45
+ * @throws Error if provider not supported or listing fails
46
+ */
47
+ list(provider: 'codespaces' | 'coder'): Promise<DeploymentInfo[]>;
48
+ /**
49
+ * Get status of a specific deployment
50
+ *
51
+ * @param provider Provider name ('codespaces' or 'coder')
52
+ * @param id Deployment ID
53
+ * @returns Deployment information
54
+ * @throws Error if deployment not found
55
+ */
56
+ status(provider: 'codespaces' | 'coder', id: string): Promise<DeploymentInfo>;
57
+ /**
58
+ * Stop and delete a deployment
59
+ *
60
+ * @param provider Provider name ('codespaces' or 'coder')
61
+ * @param id Deployment ID
62
+ * @throws Error if deployment not found or stop fails
63
+ */
64
+ stop(provider: 'codespaces' | 'coder', id: string): Promise<void>;
65
+ /**
66
+ * Validate provider is supported
67
+ *
68
+ * @param provider Provider name to validate
69
+ * @throws Error if provider not supported
70
+ */
71
+ private validateProvider;
72
+ /**
73
+ * Check if GitHub CLI is authenticated
74
+ *
75
+ * @throws Error if not authenticated
76
+ */
77
+ private checkGitHubAuth;
78
+ /**
79
+ * Load sudopod SDK dynamically
80
+ *
81
+ * @returns sudopod module
82
+ * @throws Error if sudopod is not installed
83
+ */
84
+ private loadSud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/**
2
+ * RemoteSpawnService - Main service for remote deployments
3
+ *
4
+ * Coordinates the full deployment workflow:
5
+ * 1. Check GitHub CLI authentication
6
+ * 2. Detect git context
7
+ * 3. Ensure Claude authentication
8
+ * 4. Load and merge configuration
9
+ * 5. Create sudopod provider
10
+ * 6. Execute deployment with progress indicator
11
+ */
12
+ import { execSync, exec } from 'child_process';
13
+ import chalk from 'chalk';
14
+ import { GitContextDetector } from './git-context.js';
15
+ import { SpawnConfigManager } from './config.js';
16
+ import { ClaudeAuthIntegration } from './claude-auth.js';
17
+ /**
18
+ * Main service for remote deployments
19
+ */
20
+ export class RemoteSpawnService {
21
+ sudocodeDir;
22
+ configManager;
23
+ gitDetector;
24
+ authIntegration;
25
+ constructor(sudocodeDir) {
26
+ this.sudocodeDir = sudocodeDir;
27
+ this.configManager = new SpawnConfigManager(sudocodeDir);
28
+ this.gitDetector = new GitContextDetector();
29
+ this.authIntegration = new ClaudeAuthIntegration();
30
+ }
31
+ /**
32
+ * Open a URL in the default browser (platform-agnostic)
33
+ * Fire and forget - doesn't block or throw errors
34
+ */
35
+ openBrowser(url) {
36
+ const platform = process.platform;
37
+ let command;
38
+ if (platform === 'darwin') {
39
+ command = `open "${url}"`;
40
+ }
41
+ else if (platform === 'win32') {
42
+ command = `start "" "${url}"`;
43
+ }
44
+ else {
45
+ // Linux and other Unix-like systems
46
+ command = `xdg-open "${url}"`;
47
+ }
48
+ // Fire and forget - don't block on browser open
49
+ exec(command, (error) => {
50
+ if (error) {
51
+ // Silently fail - browser open is nice-to-have, not critical
52
+ console.log(chalk.gray(` (Could not auto-open browser: ${error.message})`));
53
+ }
54
+ });
55
+ }
56
+ /**
57
+ * Spawn to a remote provider
58
+ *
59
+ * @param options Spawn options with optional overrides
60
+ * @returns Deployment information
61
+ * @throws Error if deployment fails or prerequisites are not met
62
+ */
63
+ async spawn(options) {
64
+ // 1. Check GitHub CLI authentication
65
+ console.log(chalk.blue('Checking GitHub authentication...'));
66
+ this.checkGitHubAuth();
67
+ console.log(chalk.green('✓ GitHub authenticated\n'));
68
+ // 2. Detect git context
69
+ console.log(chalk.blue('Detecting git context...'));
70
+ const gitContext = this.gitDetector.detectContext({
71
+ owner: options.owner,
72
+ repo: options.repo,
73
+ branch: options.branch,
74
+ remote: options.remote,
75
+ });
76
+ console.log(chalk.green(`✓ Detected: ${gitContext.owner}/${gitContext.repo} (${gitContext.branch})\n`));
77
+ // 3. Ensure Claude authentication
78
+ console.log(chalk.blue('Checking Claude authentication...'));
79
+ const claudeToken = await this.authIntegration.ensureAuthenticated();
80
+ if (!claudeToken) {
81
+ throw new Error('Claude authentication failed - no token available');
82
+ }
83
+ console.log(chalk.green('✓ Claude authenticated'));
84
+ console.log(chalk.gray(` Token length: ${claudeToken.length} characters\n`));
85
+ // 4. Load and merge configuration
86
+ const providerConfig = this.configManager.getProviderConfig('codespaces');
87
+ // Use defaults if provider config doesn't exist
88
+ const defaults = SpawnConfigManager.getDefaults().providers.codespaces;
89
+ const config = providerConfig || defaults;
90
+ const spawnConfig = {
91
+ git: {
92
+ owner: gitContext.owner,
93
+ repo: gitContext.repo,
94
+ branch: gitContext.branch,
95
+ },
96
+ server: {
97
+ port: options.port ?? config.port,
98
+ idleTimeout: options.idleTimeout ?? config.idleTimeout,
99
+ keepAliveHours: options.keepAliveHours ?? config.keepAliveHours,
100
+ },
101
+ providerOptions: {
102
+ machine: options.machine ?? config.machine,
103
+ retentionPeriod: options.retentionPeriod ?? config.retentionPeriod,
104
+ },
105
+ dev: options.dev ?? false,
106
+ agents: {
107
+ install: ['claude'],
108
+ },
109
+ models: {
110
+ claudeLtt: claudeToken,
111
+ },
112
+ sudocode: {
113
+ mode: options.dev ? 'local' : 'npm',
114
+ version: 'latest',
115
+ },
116
+ };
117
+ // 5. Create sudopod provider
118
+ const sudopod = await this.loadSudopod();
119
+ const provider = sudopod.createProvider({ type: 'codespaces' });
120
+ // 6. Execute deployment with progress indicator
121
+ console.log(chalk.blue('Spawning to GitHub Codespaces...'));
122
+ // Simple progress dots (no external dependency)
123
+ const progressInterval = setInterval(() => {
124
+ process.stdout.write('.');
125
+ }, 500);
126
+ try {
127
+ const deployment = await provider.deploy(spawnConfig);
128
+ clearInterval(progressInterval);
129
+ console.log(); // New line after dots
130
+ console.log(chalk.green('✓ Spawn complete'));
131
+ // Open browsers (unless noOpen option is set)
132
+ const noOpen = options.noOpen;
133
+ if (!noOpen) {
134
+ if (deployment.urls?.workspace) {
135
+ console.log(chalk.gray('Opening codespace in browser...'));
136
+ this.openBrowser(deployment.urls.workspace);
137
+ }
138
+ // Wait 5 seconds before opening Sudocode UI to give codespace time to initialize
139
+ if (deployment.urls?.sudocode) {
140
+ console.log(chalk.gray('Opening Sudocode UI in 5 seconds...\n'));
141
+ setTimeout(() => {
142
+ this.openBrowser(deployment.urls.sudocode);
143
+ }, 5000);
144
+ }
145
+ }
146
+ return deployment;
147
+ }
148
+ catch (error) {
149
+ clearInterval(progressInterval);
150
+ console.log(); // New line after dots
151
+ console.log(chalk.red('✗ Spawn failed'));
152
+ throw error;
153
+ }
154
+ }
155
+ /**
156
+ * List all deployments for a provider
157
+ *
158
+ * @param provider Provider name ('codespaces' or 'coder')
159
+ * @returns List of deployments
160
+ * @throws Error if provider not supported or listing fails
161
+ */
162
+ async list(provider) {
163
+ this.validateProvider(provider);
164
+ const sudopod = await this.loadSudopod();
165
+ const providerInstance = sudopod.createProvider({ type: provider });
166
+ return await providerInstance.list();
167
+ }
168
+ /**
169
+ * Get status of a specific deployment
170
+ *
171
+ * @param provider Provider name ('codespaces' or 'coder')
172
+ * @param id Deployment ID
173
+ * @returns Deployment information
174
+ * @throws Error if deployment not found
175
+ */
176
+ async status(provider, id) {
177
+ this.validateProvider(provider);
178
+ const sudopod = await this.loadSudopod();
179
+ const providerInstance = sudopod.createProvider({ type: provider });
180
+ // sudopod.getStatus() returns just the status string, not full deployment info
181
+ // So we need to list all deployments and find the one we're looking for
182
+ const deployments = await providerInstance.list();
183
+ const deployment = deployments.find((d) => d.id === id || d.name === id);
184
+ if (!deployment) {
185
+ throw new Error(`Deployment not found: ${id}`);
186
+ }
187
+ return deployment;
188
+ }
189
+ /**
190
+ * Stop and delete a deployment
191
+ *
192
+ * @param provider Provider name ('codespaces' or 'coder')
193
+ * @param id Deployment ID
194
+ * @throws Error if deployment not found or stop fails
195
+ */
196
+ async stop(provider, id) {
197
+ this.validateProvider(provider);
198
+ const sudopod = await this.loadSudopod();
199
+ const providerInstance = sudopod.createProvider({ type: provider });
200
+ await providerInstance.stop(id);
201
+ }
202
+ /**
203
+ * Validate provider is supported
204
+ *
205
+ * @param provider Provider name to validate
206
+ * @throws Error if provider not supported
207
+ */
208
+ validateProvider(provider) {
209
+ const supported = ['codespaces', 'coder'];
210
+ if (!supported.includes(provider)) {
211
+ throw new Error(`Unknown provider '${provider}'.\nSupported providers: ${supported.join(', ')}`);
212
+ }
213
+ if (provider === 'coder') {
214
+ throw new Error("Provider 'coder' is not yet supported.\nCurrently supported: codespaces");
215
+ }
216
+ }
217
+ /**
218
+ * Check if GitHub CLI is authenticated
219
+ *
220
+ * @throws Error if not authenticated
221
+ */
222
+ checkGitHubAuth() {
223
+ try {
224
+ execSync('gh auth status', { stdio: 'ignore' });
225
+ }
226
+ catch {
227
+ throw new Error('GitHub CLI is not authenticated.\nRun: gh auth login');
228
+ }
229
+ }
230
+ /**
231
+ * Load sudopod SDK dynamically
232
+ *
233
+ * @returns sudopod module
234
+ * @throws Error if sudopod is not installed
235
+ */
236
+ async loadSudopod() {
237
+ try {
238
+ const sudopod = await import('sudopod');
239
+ return sudopod;
240
+ }
241
+ catch (error) {
242
+ throw new Error('sudopod SDK is not installed.\n' +
243
+ 'Install it with: npm install sudopod\n' +
244
+ 'Or install globally: npm install -g sudopod');
245
+ }
246
+ }
247
+ }
248
+ //# sourceMappingURL=spawn-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-service.js","sourceRoot":"","sources":["../../src/remote/spawn-service.ts"],"names":[],"mappings":"AAAA;;;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}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Shared types for remote deployment system
3
+ */
4
+ /**
5
+ * Options for spawning a remote deployment
6
+ */
7
+ export interface SpawnOptions {
8
+ /** Git repository owner */
9
+ owner?: string;
10
+ /** Git repository name */
11
+ repo?: string;
12
+ /** Branch to deploy */
13
+ branch?: string;
14
+ /** Server port */
15
+ port?: number;
16
+ /** Machine type/size */
17
+ machine?: string;
18
+ /** Idle timeout in minutes */
19
+ idleTimeout?: number;
20
+ /** Keep-alive duration in hours */
21
+ keepAliveHours?: number;
22
+ /** Retention period in days */
23
+ retentionPeriod?: number;
24
+ /** Git remote name (default: 'origin') */
25
+ remote?: string;
26
+ /** Development mode - use local sudocode packages instead of npm */
27
+ dev?: boolean;
28
+ /** Don't open browser automatically after deployment */
29
+ noOpen?: boolean;
30
+ }
31
+ /**
32
+ * Git context information
33
+ */
34
+ export interface GitInfo {
35
+ owner: string;
36
+ repo: string;
37
+ branch: string;
38
+ }
39
+ /**
40
+ * Server configuration
41
+ */
42
+ export interface ServerConfig {
43
+ port: number;
44
+ idleTimeout: number;
45
+ keepAliveHours: number;
46
+ }
47
+ /**
48
+ * Provider-specific options
49
+ */
50
+ export interface ProviderOptions {
51
+ machine: string;
52
+ retentionPeriod: number;
53
+ }
54
+ /**
55
+ * Deployment URLs
56
+ */
57
+ export interface DeploymentUrls {
58
+ workspace: string;
59
+ sudocode: string;
60
+ ssh: string;
61
+ }
62
+ /**
63
+ * Information about a deployment
64
+ */
65
+ export interface DeploymentInfo {
66
+ id: string;
67
+ name: string;
68
+ provider: 'codespaces' | 'coder';
69
+ git: GitInfo;
70
+ status: DeploymentStatus;
71
+ createdAt: string;
72
+ urls: DeploymentUrls;
73
+ keepAliveHours: number;
74
+ idleTimeout: number;
75
+ machine?: string;
76
+ retentionPeriod?: number;
77
+ }
78
+ /**
79
+ * Deployment status
80
+ */
81
+ export type DeploymentStatus = 'running' | 'stopped' | 'starting' | 'stopping' | 'provisioning' | 'failed';
82
+ //# sourceMappingURL=types.d.ts.map