runwork 0.4.1 → 0.5.0

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 (95) hide show
  1. package/bundled-types/core-agent.d.ts +8 -0
  2. package/bundled-types/core-base-agent.d.ts +4 -0
  3. package/bundled-types/core-types.d.ts +101 -0
  4. package/bundled-types/core-workspace.d.ts +10 -0
  5. package/bundled-types/index.d.ts +2 -0
  6. package/bundled-types/shared/core-types.d.ts +101 -0
  7. package/bundled-types/shared/shared/core-types.d.ts +101 -0
  8. package/bundled-types/task-delegation/index.d.ts +50 -0
  9. package/bundled-types/task-delegation/sandbox-bridge.d.ts +88 -0
  10. package/bundled-types/task-delegation/session-manager.d.ts +86 -0
  11. package/bundled-types/task-delegation/stream-parser.d.ts +25 -0
  12. package/bundled-types/task-delegation/task-delegation/index.d.ts +30 -0
  13. package/bundled-types/task-delegation/task-delegation/sandbox-bridge.d.ts +88 -0
  14. package/bundled-types/task-delegation/task-delegation/session-manager.d.ts +86 -0
  15. package/bundled-types/task-delegation/task-delegation/stream-parser.d.ts +25 -0
  16. package/bundled-types/task-delegation/task-delegation/types.d.ts +165 -0
  17. package/bundled-types/task-delegation/types.d.ts +336 -0
  18. package/bundled-types/task-delegation.d.ts +2 -0
  19. package/dist/__tests__/curl-parser.test.d.ts +1 -0
  20. package/dist/__tests__/curl-parser.test.js +250 -0
  21. package/dist/__tests__/types-manager.test.js +22 -18
  22. package/dist/agents/claude-code.d.ts +10 -0
  23. package/dist/agents/claude-code.js +50 -0
  24. package/dist/agents/claude-desktop.d.ts +10 -0
  25. package/dist/agents/claude-desktop.js +141 -0
  26. package/dist/agents/codex.d.ts +10 -0
  27. package/dist/agents/codex.js +45 -0
  28. package/dist/agents/copilot-cli.d.ts +10 -0
  29. package/dist/agents/copilot-cli.js +46 -0
  30. package/dist/agents/copilot-vscode.d.ts +10 -0
  31. package/dist/agents/copilot-vscode.js +37 -0
  32. package/dist/agents/cursor.d.ts +10 -0
  33. package/dist/agents/cursor.js +55 -0
  34. package/dist/agents/detect.d.ts +4 -0
  35. package/dist/agents/detect.js +43 -0
  36. package/dist/agents/gemini.d.ts +10 -0
  37. package/dist/agents/gemini.js +47 -0
  38. package/dist/agents/types.d.ts +35 -0
  39. package/dist/agents/types.js +13 -0
  40. package/dist/agents/utils/json-config.d.ts +14 -0
  41. package/dist/agents/utils/json-config.js +42 -0
  42. package/dist/agents/utils/toml-config.d.ts +8 -0
  43. package/dist/agents/utils/toml-config.js +27 -0
  44. package/dist/agents/windsurf.d.ts +10 -0
  45. package/dist/agents/windsurf.js +50 -0
  46. package/dist/api/client.d.ts +97 -1
  47. package/dist/api/client.js +199 -0
  48. package/dist/auth/store.js +18 -0
  49. package/dist/commands/agents.d.ts +2 -0
  50. package/dist/commands/agents.js +160 -0
  51. package/dist/commands/api-keys.d.ts +2 -0
  52. package/dist/commands/api-keys.js +95 -0
  53. package/dist/commands/apps.d.ts +2 -0
  54. package/dist/commands/apps.js +82 -0
  55. package/dist/commands/components.d.ts +2 -0
  56. package/dist/commands/components.js +43 -0
  57. package/dist/commands/endpoints.d.ts +2 -0
  58. package/dist/commands/endpoints.js +188 -0
  59. package/dist/commands/entities.d.ts +2 -0
  60. package/dist/commands/entities.js +198 -0
  61. package/dist/commands/files.d.ts +2 -0
  62. package/dist/commands/files.js +192 -0
  63. package/dist/commands/info.d.ts +1 -0
  64. package/dist/commands/info.js +71 -127
  65. package/dist/commands/init.d.ts +2 -0
  66. package/dist/commands/init.js +10 -8
  67. package/dist/commands/integrations.js +105 -12
  68. package/dist/commands/mcp.d.ts +2 -0
  69. package/dist/commands/mcp.js +117 -0
  70. package/dist/commands/schedules.d.ts +2 -0
  71. package/dist/commands/schedules.js +221 -0
  72. package/dist/commands/setup.d.ts +2 -0
  73. package/dist/commands/setup.js +199 -0
  74. package/dist/commands/skills.d.ts +2 -0
  75. package/dist/commands/skills.js +134 -0
  76. package/dist/commands/sync.d.ts +2 -0
  77. package/dist/commands/sync.js +146 -0
  78. package/dist/commands/workflows.d.ts +2 -0
  79. package/dist/commands/workflows.js +187 -0
  80. package/dist/generated/bundled-types.js +35 -33
  81. package/dist/generated/version.d.ts +1 -1
  82. package/dist/generated/version.js +1 -1
  83. package/dist/index.js +26 -0
  84. package/dist/logs/tailer.js +41 -1
  85. package/dist/types.d.ts +204 -0
  86. package/dist/ui/banner.js +7 -6
  87. package/dist/utils/app-info.d.ts +66 -0
  88. package/dist/utils/app-info.js +150 -0
  89. package/dist/utils/curl-parser.d.ts +12 -0
  90. package/dist/utils/curl-parser.js +44 -0
  91. package/dist/utils/data-input.d.ts +1 -0
  92. package/dist/utils/data-input.js +38 -0
  93. package/dist/workspace/resolve.d.ts +19 -0
  94. package/dist/workspace/resolve.js +100 -0
  95. package/package.json +3 -2
@@ -0,0 +1,19 @@
1
+ import { ApiClient } from '../api/client.js';
2
+ interface ResolvedWorkspace {
3
+ workspaceId: string;
4
+ workspaceName: string;
5
+ source: 'flag' | 'project' | 'credentials' | 'prompt';
6
+ }
7
+ export declare function resolveWorkspace(client: ApiClient, options?: {
8
+ workspace?: string;
9
+ }): Promise<ResolvedWorkspace>;
10
+ export declare function hasProjectConfig(): boolean;
11
+ interface ResolvedApp {
12
+ appId: string;
13
+ appName: string;
14
+ source: 'flag' | 'project' | 'prompt';
15
+ }
16
+ export declare function resolveApp(client: ApiClient, workspaceId: string, options?: {
17
+ app?: string;
18
+ }): Promise<ResolvedApp>;
19
+ export {};
@@ -0,0 +1,100 @@
1
+ import { existsSync, readFileSync } from 'fs';
2
+ import { getCredentials, saveCredentials } from '../auth/store.js';
3
+ import { promptSelect } from '../utils/prompt.js';
4
+ export async function resolveWorkspace(client, options = {}) {
5
+ // 1. Explicit --workspace flag
6
+ if (options.workspace) {
7
+ return { workspaceId: options.workspace, workspaceName: '', source: 'flag' };
8
+ }
9
+ // 2. WORKSPACE_ID env var (set in sandbox agent sessions)
10
+ if (process.env.WORKSPACE_ID) {
11
+ return { workspaceId: process.env.WORKSPACE_ID, workspaceName: '', source: 'flag' };
12
+ }
13
+ // 3. .runwork.json in current directory
14
+ if (existsSync('.runwork.json')) {
15
+ try {
16
+ const config = JSON.parse(readFileSync('.runwork.json', 'utf-8'));
17
+ if (config.workspaceId) {
18
+ return {
19
+ workspaceId: config.workspaceId,
20
+ workspaceName: config.workspaceName || '',
21
+ source: 'project',
22
+ };
23
+ }
24
+ }
25
+ catch { /* ignore parse errors */ }
26
+ }
27
+ // 4. Default workspace in credentials
28
+ const creds = getCredentials();
29
+ if (creds?.defaultWorkspaceId) {
30
+ return {
31
+ workspaceId: creds.defaultWorkspaceId,
32
+ workspaceName: creds.defaultWorkspaceName || '',
33
+ source: 'credentials',
34
+ };
35
+ }
36
+ // 4. Interactive prompt
37
+ const workspaces = await client.listWorkspaces();
38
+ if (workspaces.length === 0) {
39
+ console.error('No workspaces found. Create one at https://runwork.ai');
40
+ process.exit(1);
41
+ }
42
+ if (workspaces.length === 1) {
43
+ const ws = workspaces[0];
44
+ saveDefaultWorkspace(ws.id, ws.name);
45
+ return { workspaceId: ws.id, workspaceName: ws.name, source: 'prompt' };
46
+ }
47
+ const choices = workspaces.map(ws => ({ label: ws.name, value: ws.id }));
48
+ const chosen = await promptSelect('Select a workspace:', choices);
49
+ const ws = workspaces.find(w => w.id === chosen.value);
50
+ saveDefaultWorkspace(ws.id, ws.name);
51
+ return { workspaceId: ws.id, workspaceName: ws.name, source: 'prompt' };
52
+ }
53
+ function saveDefaultWorkspace(workspaceId, workspaceName) {
54
+ const creds = getCredentials();
55
+ if (creds) {
56
+ saveCredentials({ ...creds, defaultWorkspaceId: workspaceId, defaultWorkspaceName: workspaceName });
57
+ }
58
+ }
59
+ export function hasProjectConfig() {
60
+ return existsSync('.runwork.json');
61
+ }
62
+ export async function resolveApp(client, workspaceId, options = {}) {
63
+ // 1. Explicit --app flag (could be name or ID)
64
+ if (options.app) {
65
+ const apps = await client.listApps(workspaceId);
66
+ const match = apps.find(a => a.id === options.app || a.name === options.app || a.slug === options.app);
67
+ if (!match) {
68
+ console.error(`App "${options.app}" not found in workspace.`);
69
+ process.exit(1);
70
+ }
71
+ return { appId: match.id, appName: match.name, source: 'flag' };
72
+ }
73
+ // 2. .runwork.json in current directory
74
+ if (existsSync('.runwork.json')) {
75
+ try {
76
+ const config = JSON.parse(readFileSync('.runwork.json', 'utf-8'));
77
+ if (config.appId) {
78
+ return { appId: config.appId, appName: config.appName || '', source: 'project' };
79
+ }
80
+ }
81
+ catch { /* ignore */ }
82
+ }
83
+ // 3. Interactive prompt (TTY only)
84
+ if (process.stdout.isTTY) {
85
+ const apps = await client.listApps(workspaceId);
86
+ if (apps.length === 0) {
87
+ console.error('No apps found in workspace.');
88
+ process.exit(1);
89
+ }
90
+ if (apps.length === 1) {
91
+ return { appId: apps[0].id, appName: apps[0].name, source: 'prompt' };
92
+ }
93
+ const choices = apps.map(a => ({ label: a.name, value: a.id }));
94
+ const chosen = await promptSelect('Select an app:', choices);
95
+ const app = apps.find(a => a.id === chosen.value);
96
+ return { appId: app.id, appName: app.name, source: 'prompt' };
97
+ }
98
+ console.error('App ID required. Use --app flag or run from a project directory with .runwork.json');
99
+ process.exit(1);
100
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runwork",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "CLI for Runwork: develop, preview, and deploy Runwork apps from your local machine.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Runwork <info@runwork.ai> (https://www.runwork.ai)",
@@ -27,7 +27,7 @@
27
27
  "runwork": "./bin/runwork.js"
28
28
  },
29
29
  "scripts": {
30
- "prebuild": "cd ../framework && bun run build && cd ../runwork-cli && mkdir -p bundled-types && cp ../framework/dist/*.d.ts bundled-types/ && bun run scripts/embed-types.ts",
30
+ "prebuild": "cd ../framework && bun run build && cd ../runwork-cli && mkdir -p bundled-types && cp ../framework/dist/*.d.ts bundled-types/ && cp -r ../framework/dist/shared bundled-types/shared 2>/dev/null; cp -r ../framework/dist/task-delegation bundled-types/task-delegation 2>/dev/null; bun run scripts/embed-types.ts",
31
31
  "build": "bun run prebuild && tsc",
32
32
  "build:binary": "bun run prebuild && bun build src/index.ts --compile --outfile dist/runwork",
33
33
  "build:binaries": "bun run scripts/build-binaries.ts",
@@ -44,6 +44,7 @@
44
44
  "@clack/prompts": "^1.1.0",
45
45
  "chokidar": "^4.0.0",
46
46
  "commander": "^13.0.0",
47
+ "curlconverter": "^4.12.0",
47
48
  "fflate": "^0.8.2",
48
49
  "open": "^10.0.0",
49
50
  "picocolors": "^1.1.1"