runwork 0.15.0 → 0.15.2
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/dist/index.js +19272 -116
- package/package.json +4 -4
- package/dist/__tests__/curl-parser.test.d.ts +0 -1
- package/dist/__tests__/curl-parser.test.js +0 -250
- package/dist/__tests__/install-scripts.test.d.ts +0 -1
- package/dist/__tests__/install-scripts.test.js +0 -280
- package/dist/__tests__/types-manager.test.d.ts +0 -1
- package/dist/__tests__/types-manager.test.js +0 -89
- package/dist/agents/__tests__/chatgpt-registry.test.d.ts +0 -1
- package/dist/agents/__tests__/chatgpt-registry.test.js +0 -61
- package/dist/agents/__tests__/claude-code-managed-block.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-code-managed-block.test.js +0 -97
- package/dist/agents/__tests__/claude-code-plugin.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-code-plugin.test.js +0 -47
- package/dist/agents/__tests__/claude-code-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-code-stats.test.js +0 -390
- package/dist/agents/__tests__/claude-desktop-memory.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-memory.test.js +0 -154
- package/dist/agents/__tests__/claude-desktop-plugin-tree.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-plugin-tree.test.js +0 -161
- package/dist/agents/__tests__/claude-desktop-plugin.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-plugin.test.js +0 -117
- package/dist/agents/__tests__/claude-desktop-rpm.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-rpm.test.js +0 -126
- package/dist/agents/__tests__/claude-desktop-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-stats.test.js +0 -280
- package/dist/agents/__tests__/codex-instructions.test.d.ts +0 -1
- package/dist/agents/__tests__/codex-instructions.test.js +0 -57
- package/dist/agents/__tests__/codex-minimum-permissions.test.d.ts +0 -1
- package/dist/agents/__tests__/codex-minimum-permissions.test.js +0 -82
- package/dist/agents/__tests__/codex-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/codex-stats.test.js +0 -370
- package/dist/agents/__tests__/cursor-merge.test.d.ts +0 -1
- package/dist/agents/__tests__/cursor-merge.test.js +0 -66
- package/dist/agents/__tests__/cursor-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/cursor-stats.test.js +0 -183
- package/dist/agents/__tests__/defaults-merge.test.d.ts +0 -1
- package/dist/agents/__tests__/defaults-merge.test.js +0 -268
- package/dist/agents/__tests__/detection.test.d.ts +0 -1
- package/dist/agents/__tests__/detection.test.js +0 -89
- package/dist/agents/__tests__/graceful-degradation.test.d.ts +0 -1
- package/dist/agents/__tests__/graceful-degradation.test.js +0 -129
- package/dist/agents/__tests__/instruction-hint.test.d.ts +0 -1
- package/dist/agents/__tests__/instruction-hint.test.js +0 -69
- package/dist/agents/__tests__/intro-skill.test.d.ts +0 -1
- package/dist/agents/__tests__/intro-skill.test.js +0 -193
- package/dist/agents/__tests__/schema-validation.test.d.ts +0 -1
- package/dist/agents/__tests__/schema-validation.test.js +0 -212
- package/dist/agents/__tests__/skill-slug.test.d.ts +0 -1
- package/dist/agents/__tests__/skill-slug.test.js +0 -77
- package/dist/agents/claude-code.d.ts +0 -53
- package/dist/agents/claude-code.js +0 -754
- package/dist/agents/claude-desktop-plugin-tree.d.ts +0 -59
- package/dist/agents/claude-desktop-plugin-tree.js +0 -143
- package/dist/agents/claude-desktop.d.ts +0 -47
- package/dist/agents/claude-desktop.js +0 -684
- package/dist/agents/cline.d.ts +0 -15
- package/dist/agents/cline.js +0 -130
- package/dist/agents/codex.d.ts +0 -44
- package/dist/agents/codex.js +0 -453
- package/dist/agents/conversation-skills.d.ts +0 -18
- package/dist/agents/conversation-skills.js +0 -229
- package/dist/agents/cursor.d.ts +0 -48
- package/dist/agents/cursor.js +0 -324
- package/dist/agents/default-config.d.ts +0 -30
- package/dist/agents/default-config.js +0 -67
- package/dist/agents/defaults-merge.d.ts +0 -72
- package/dist/agents/defaults-merge.js +0 -131
- package/dist/agents/detect.d.ts +0 -4
- package/dist/agents/detect.js +0 -67
- package/dist/agents/detection.d.ts +0 -18
- package/dist/agents/detection.js +0 -94
- package/dist/agents/gemini.d.ts +0 -15
- package/dist/agents/gemini.js +0 -122
- package/dist/agents/generic-adapter.d.ts +0 -25
- package/dist/agents/generic-adapter.js +0 -151
- package/dist/agents/intro-skill.d.ts +0 -45
- package/dist/agents/intro-skill.js +0 -447
- package/dist/agents/registry-data.d.ts +0 -192
- package/dist/agents/registry-data.js +0 -669
- package/dist/agents/registry.d.ts +0 -13
- package/dist/agents/registry.js +0 -36
- package/dist/agents/runtime-detection.d.ts +0 -82
- package/dist/agents/runtime-detection.js +0 -271
- package/dist/agents/session-start-hook.d.ts +0 -37
- package/dist/agents/session-start-hook.js +0 -159
- package/dist/agents/types.d.ts +0 -171
- package/dist/agents/types.js +0 -75
- package/dist/agents/utils/instruction-hint.d.ts +0 -21
- package/dist/agents/utils/instruction-hint.js +0 -108
- package/dist/agents/utils/json-config.d.ts +0 -19
- package/dist/agents/utils/json-config.js +0 -69
- package/dist/agents/utils/toml-config.d.ts +0 -8
- package/dist/agents/utils/toml-config.js +0 -27
- package/dist/agents/windsurf.d.ts +0 -14
- package/dist/agents/windsurf.js +0 -102
- package/dist/api/__tests__/client.test.d.ts +0 -1
- package/dist/api/__tests__/client.test.js +0 -272
- package/dist/api/client.d.ts +0 -326
- package/dist/api/client.js +0 -427
- package/dist/auth/__tests__/login-flow.test.d.ts +0 -1
- package/dist/auth/__tests__/login-flow.test.js +0 -101
- package/dist/auth/__tests__/store.test.d.ts +0 -1
- package/dist/auth/__tests__/store.test.js +0 -132
- package/dist/auth/login-flow.d.ts +0 -26
- package/dist/auth/login-flow.js +0 -137
- package/dist/auth/store.d.ts +0 -5
- package/dist/auth/store.js +0 -62
- package/dist/commands/__tests__/clone-args.test.d.ts +0 -1
- package/dist/commands/__tests__/clone-args.test.js +0 -51
- package/dist/commands/__tests__/clone-source-result.test.d.ts +0 -1
- package/dist/commands/__tests__/clone-source-result.test.js +0 -45
- package/dist/commands/__tests__/info-merge.test.d.ts +0 -1
- package/dist/commands/__tests__/info-merge.test.js +0 -55
- package/dist/commands/__tests__/mcp-entries.test.d.ts +0 -1
- package/dist/commands/__tests__/mcp-entries.test.js +0 -48
- package/dist/commands/__tests__/setup-persona.test.d.ts +0 -1
- package/dist/commands/__tests__/setup-persona.test.js +0 -31
- package/dist/commands/__tests__/setup.test.d.ts +0 -1
- package/dist/commands/__tests__/setup.test.js +0 -81
- package/dist/commands/__tests__/sync-redetect.test.d.ts +0 -1
- package/dist/commands/__tests__/sync-redetect.test.js +0 -96
- package/dist/commands/__tests__/sync-telemetry.test.d.ts +0 -1
- package/dist/commands/__tests__/sync-telemetry.test.js +0 -281
- package/dist/commands/__tests__/upgrade.test.d.ts +0 -1
- package/dist/commands/__tests__/upgrade.test.js +0 -157
- package/dist/commands/agents.d.ts +0 -2
- package/dist/commands/agents.js +0 -160
- package/dist/commands/api-keys.d.ts +0 -2
- package/dist/commands/api-keys.js +0 -95
- package/dist/commands/apps.d.ts +0 -2
- package/dist/commands/apps.js +0 -82
- package/dist/commands/build-plugin.d.ts +0 -2
- package/dist/commands/build-plugin.js +0 -135
- package/dist/commands/clone.d.ts +0 -60
- package/dist/commands/clone.js +0 -271
- package/dist/commands/components.d.ts +0 -2
- package/dist/commands/components.js +0 -43
- package/dist/commands/deploy.d.ts +0 -2
- package/dist/commands/deploy.js +0 -279
- package/dist/commands/dev.d.ts +0 -11
- package/dist/commands/dev.js +0 -1011
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.js +0 -230
- package/dist/commands/endpoints.d.ts +0 -2
- package/dist/commands/endpoints.js +0 -189
- package/dist/commands/entities.d.ts +0 -2
- package/dist/commands/entities.js +0 -198
- package/dist/commands/files.d.ts +0 -2
- package/dist/commands/files.js +0 -193
- package/dist/commands/inbox.d.ts +0 -11
- package/dist/commands/inbox.js +0 -60
- package/dist/commands/info.d.ts +0 -178
- package/dist/commands/info.js +0 -455
- package/dist/commands/init.d.ts +0 -21
- package/dist/commands/init.js +0 -185
- package/dist/commands/integrations.d.ts +0 -2
- package/dist/commands/integrations.js +0 -233
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.js +0 -44
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.js +0 -13
- package/dist/commands/logs.d.ts +0 -2
- package/dist/commands/logs.js +0 -232
- package/dist/commands/mcp-entries.d.ts +0 -13
- package/dist/commands/mcp-entries.js +0 -26
- package/dist/commands/mcp.d.ts +0 -2
- package/dist/commands/mcp.js +0 -245
- package/dist/commands/open.d.ts +0 -2
- package/dist/commands/open.js +0 -53
- package/dist/commands/resume.d.ts +0 -2
- package/dist/commands/resume.js +0 -289
- package/dist/commands/save-convo.d.ts +0 -8
- package/dist/commands/save-convo.js +0 -20
- package/dist/commands/schedules.d.ts +0 -2
- package/dist/commands/schedules.js +0 -221
- package/dist/commands/setup.d.ts +0 -27
- package/dist/commands/setup.js +0 -177
- package/dist/commands/share-convo.d.ts +0 -24
- package/dist/commands/share-convo.js +0 -167
- package/dist/commands/skills.d.ts +0 -2
- package/dist/commands/skills.js +0 -352
- package/dist/commands/sync-telemetry.d.ts +0 -33
- package/dist/commands/sync-telemetry.js +0 -186
- package/dist/commands/sync.d.ts +0 -37
- package/dist/commands/sync.js +0 -702
- package/dist/commands/uninstall.d.ts +0 -2
- package/dist/commands/uninstall.js +0 -145
- package/dist/commands/upgrade.d.ts +0 -14
- package/dist/commands/upgrade.js +0 -217
- package/dist/commands/validate.d.ts +0 -2
- package/dist/commands/validate.js +0 -89
- package/dist/commands/welcome.d.ts +0 -1
- package/dist/commands/welcome.js +0 -86
- package/dist/commands/workflows.d.ts +0 -2
- package/dist/commands/workflows.js +0 -187
- package/dist/deploy/__tests__/deploy-state.test.d.ts +0 -1
- package/dist/deploy/__tests__/deploy-state.test.js +0 -80
- package/dist/deploy/__tests__/deploy-status.test.d.ts +0 -1
- package/dist/deploy/__tests__/deploy-status.test.js +0 -41
- package/dist/deploy/__tests__/detach-args.test.d.ts +0 -1
- package/dist/deploy/__tests__/detach-args.test.js +0 -30
- package/dist/deploy/deploy-state.d.ts +0 -36
- package/dist/deploy/deploy-state.js +0 -63
- package/dist/deploy/deploy-status.d.ts +0 -21
- package/dist/deploy/deploy-status.js +0 -36
- package/dist/deploy/detach.d.ts +0 -32
- package/dist/deploy/detach.js +0 -71
- package/dist/dev/__tests__/attach.test.d.ts +0 -1
- package/dist/dev/__tests__/attach.test.js +0 -296
- package/dist/dev/__tests__/detach.test.d.ts +0 -1
- package/dist/dev/__tests__/detach.test.js +0 -404
- package/dist/dev/__tests__/preview-url-poller.test.d.ts +0 -1
- package/dist/dev/__tests__/preview-url-poller.test.js +0 -149
- package/dist/dev/__tests__/session.test.d.ts +0 -1
- package/dist/dev/__tests__/session.test.js +0 -446
- package/dist/dev/__tests__/startup-sync.test.d.ts +0 -1
- package/dist/dev/__tests__/startup-sync.test.js +0 -32
- package/dist/dev/__tests__/stop.test.d.ts +0 -1
- package/dist/dev/__tests__/stop.test.js +0 -172
- package/dist/dev/attach.d.ts +0 -120
- package/dist/dev/attach.js +0 -269
- package/dist/dev/detach.d.ts +0 -187
- package/dist/dev/detach.js +0 -292
- package/dist/dev/preview-url-poller.d.ts +0 -35
- package/dist/dev/preview-url-poller.js +0 -50
- package/dist/dev/session.d.ts +0 -175
- package/dist/dev/session.js +0 -258
- package/dist/dev/startup-sync.d.ts +0 -23
- package/dist/dev/startup-sync.js +0 -14
- package/dist/dev/stop.d.ts +0 -52
- package/dist/dev/stop.js +0 -101
- package/dist/devtools/registry-data.d.ts +0 -46
- package/dist/devtools/registry-data.js +0 -40
- package/dist/generated/bundled-types.d.ts +0 -1
- package/dist/generated/bundled-types.js +0 -46
- package/dist/generated/version.d.ts +0 -1
- package/dist/generated/version.js +0 -2
- package/dist/git/__tests__/auto-commit.test.d.ts +0 -1
- package/dist/git/__tests__/auto-commit.test.js +0 -431
- package/dist/git/__tests__/classify-sync-error.test.d.ts +0 -1
- package/dist/git/__tests__/classify-sync-error.test.js +0 -57
- package/dist/git/__tests__/credential-helper-e2e.test.d.ts +0 -21
- package/dist/git/__tests__/credential-helper-e2e.test.js +0 -195
- package/dist/git/__tests__/credentials.test.d.ts +0 -1
- package/dist/git/__tests__/credentials.test.js +0 -141
- package/dist/git/__tests__/deploy-guard.test.d.ts +0 -1
- package/dist/git/__tests__/deploy-guard.test.js +0 -61
- package/dist/git/__tests__/ensure-git-credential-helper.test.d.ts +0 -1
- package/dist/git/__tests__/ensure-git-credential-helper.test.js +0 -133
- package/dist/git/__tests__/ensure-runwork-remote.test.d.ts +0 -1
- package/dist/git/__tests__/ensure-runwork-remote.test.js +0 -109
- package/dist/git/__tests__/identity.test.d.ts +0 -1
- package/dist/git/__tests__/identity.test.js +0 -146
- package/dist/git/__tests__/manifest.test.d.ts +0 -1
- package/dist/git/__tests__/manifest.test.js +0 -446
- package/dist/git/__tests__/preflight-resolution.test.d.ts +0 -1
- package/dist/git/__tests__/preflight-resolution.test.js +0 -366
- package/dist/git/__tests__/preflight.test.d.ts +0 -1
- package/dist/git/__tests__/preflight.test.js +0 -36
- package/dist/git/__tests__/repo-config.test.d.ts +0 -1
- package/dist/git/__tests__/repo-config.test.js +0 -26
- package/dist/git/__tests__/sync.test.d.ts +0 -1
- package/dist/git/__tests__/sync.test.js +0 -405
- package/dist/git/auto-commit.d.ts +0 -35
- package/dist/git/auto-commit.js +0 -293
- package/dist/git/classify-sync-error.d.ts +0 -21
- package/dist/git/classify-sync-error.js +0 -111
- package/dist/git/credentials.d.ts +0 -75
- package/dist/git/credentials.js +0 -164
- package/dist/git/critical-files.d.ts +0 -20
- package/dist/git/critical-files.js +0 -68
- package/dist/git/deploy-guard.d.ts +0 -53
- package/dist/git/deploy-guard.js +0 -78
- package/dist/git/identity.d.ts +0 -44
- package/dist/git/identity.js +0 -133
- package/dist/git/preflight.d.ts +0 -57
- package/dist/git/preflight.js +0 -276
- package/dist/git/remote.d.ts +0 -37
- package/dist/git/remote.js +0 -75
- package/dist/git/repo-config.d.ts +0 -8
- package/dist/git/repo-config.js +0 -29
- package/dist/git/sync.d.ts +0 -15
- package/dist/git/sync.js +0 -159
- package/dist/health/__tests__/checks.test.d.ts +0 -1
- package/dist/health/__tests__/checks.test.js +0 -357
- package/dist/health/__tests__/cli-distribution-checks.test.d.ts +0 -1
- package/dist/health/__tests__/cli-distribution-checks.test.js +0 -196
- package/dist/health/__tests__/fix.test.d.ts +0 -1
- package/dist/health/__tests__/fix.test.js +0 -72
- package/dist/health/__tests__/runner-filter.test.d.ts +0 -1
- package/dist/health/__tests__/runner-filter.test.js +0 -61
- package/dist/health/checks.d.ts +0 -42
- package/dist/health/checks.js +0 -636
- package/dist/health/fix.d.ts +0 -22
- package/dist/health/fix.js +0 -62
- package/dist/health/runner.d.ts +0 -8
- package/dist/health/runner.js +0 -47
- package/dist/health/types.d.ts +0 -12
- package/dist/health/types.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/logs/__tests__/tailer-format.test.d.ts +0 -1
- package/dist/logs/__tests__/tailer-format.test.js +0 -43
- package/dist/logs/tailer.d.ts +0 -17
- package/dist/logs/tailer.js +0 -217
- package/dist/sync/__tests__/change-detect.test.d.ts +0 -1
- package/dist/sync/__tests__/change-detect.test.js +0 -123
- package/dist/sync/__tests__/hash.test.d.ts +0 -1
- package/dist/sync/__tests__/hash.test.js +0 -18
- package/dist/sync/change-detect.d.ts +0 -19
- package/dist/sync/change-detect.js +0 -136
- package/dist/sync/conflict-ui.d.ts +0 -5
- package/dist/sync/conflict-ui.js +0 -78
- package/dist/sync/executor.d.ts +0 -23
- package/dist/sync/executor.js +0 -102
- package/dist/sync/hash.d.ts +0 -1
- package/dist/sync/hash.js +0 -4
- package/dist/sync/types.d.ts +0 -24
- package/dist/sync/types.js +0 -1
- package/dist/template/manifest.d.ts +0 -17
- package/dist/template/manifest.js +0 -145
- package/dist/tools/types.d.ts +0 -52
- package/dist/tools/types.js +0 -8
- package/dist/types-manager.d.ts +0 -1
- package/dist/types-manager.js +0 -35
- package/dist/types.d.ts +0 -349
- package/dist/types.js +0 -1
- package/dist/ui/__tests__/banner.test.d.ts +0 -1
- package/dist/ui/__tests__/banner.test.js +0 -98
- package/dist/ui/__tests__/colors.test.d.ts +0 -1
- package/dist/ui/__tests__/colors.test.js +0 -22
- package/dist/ui/__tests__/keyboard.test.d.ts +0 -1
- package/dist/ui/__tests__/keyboard.test.js +0 -34
- package/dist/ui/__tests__/status-line.test.d.ts +0 -1
- package/dist/ui/__tests__/status-line.test.js +0 -54
- package/dist/ui/banner.d.ts +0 -29
- package/dist/ui/banner.js +0 -153
- package/dist/ui/colors.d.ts +0 -4
- package/dist/ui/colors.js +0 -7
- package/dist/ui/keyboard.d.ts +0 -12
- package/dist/ui/keyboard.js +0 -61
- package/dist/ui/status-line.d.ts +0 -6
- package/dist/ui/status-line.js +0 -53
- package/dist/utils/__tests__/format-error.test.d.ts +0 -1
- package/dist/utils/__tests__/format-error.test.js +0 -43
- package/dist/utils/__tests__/help-json.test.d.ts +0 -1
- package/dist/utils/__tests__/help-json.test.js +0 -39
- package/dist/utils/__tests__/http.test.d.ts +0 -1
- package/dist/utils/__tests__/http.test.js +0 -381
- package/dist/utils/__tests__/ignore-matcher.test.d.ts +0 -1
- package/dist/utils/__tests__/ignore-matcher.test.js +0 -205
- package/dist/utils/__tests__/output.test.d.ts +0 -1
- package/dist/utils/__tests__/output.test.js +0 -38
- package/dist/utils/__tests__/prompt.test.d.ts +0 -1
- package/dist/utils/__tests__/prompt.test.js +0 -27
- package/dist/utils/__tests__/resolve.test.d.ts +0 -1
- package/dist/utils/__tests__/resolve.test.js +0 -95
- package/dist/utils/__tests__/sqlite.test.d.ts +0 -1
- package/dist/utils/__tests__/sqlite.test.js +0 -89
- package/dist/utils/agent-guidance.d.ts +0 -47
- package/dist/utils/agent-guidance.js +0 -128
- package/dist/utils/app-info.d.ts +0 -70
- package/dist/utils/app-info.js +0 -167
- package/dist/utils/curl-parser.d.ts +0 -12
- package/dist/utils/curl-parser.js +0 -162
- package/dist/utils/data-input.d.ts +0 -1
- package/dist/utils/data-input.js +0 -38
- package/dist/utils/format-error.d.ts +0 -10
- package/dist/utils/format-error.js +0 -38
- package/dist/utils/fs.d.ts +0 -5
- package/dist/utils/fs.js +0 -23
- package/dist/utils/help-json.d.ts +0 -70
- package/dist/utils/help-json.js +0 -88
- package/dist/utils/http.d.ts +0 -46
- package/dist/utils/http.js +0 -421
- package/dist/utils/ignore-matcher.d.ts +0 -47
- package/dist/utils/ignore-matcher.js +0 -132
- package/dist/utils/output.d.ts +0 -17
- package/dist/utils/output.js +0 -27
- package/dist/utils/prompt.d.ts +0 -5
- package/dist/utils/prompt.js +0 -42
- package/dist/utils/resolve.d.ts +0 -12
- package/dist/utils/resolve.js +0 -52
- package/dist/utils/setup-state.d.ts +0 -3
- package/dist/utils/setup-state.js +0 -19
- package/dist/utils/sqlite-adapter.d.ts +0 -48
- package/dist/utils/sqlite-adapter.js +0 -147
- package/dist/utils/sqlite.d.ts +0 -14
- package/dist/utils/sqlite.js +0 -14
- package/dist/utils/subprocess.d.ts +0 -19
- package/dist/utils/subprocess.js +0 -27
- package/dist/utils/which.d.ts +0 -14
- package/dist/utils/which.js +0 -47
- package/dist/utils/zip.d.ts +0 -7
- package/dist/utils/zip.js +0 -42
- package/dist/validate/__tests__/validate.test.d.ts +0 -1
- package/dist/validate/__tests__/validate.test.js +0 -42
- package/dist/validate/freshness.d.ts +0 -28
- package/dist/validate/freshness.js +0 -48
- package/dist/validate/preview.d.ts +0 -21
- package/dist/validate/preview.js +0 -39
- package/dist/workspace/resolve.d.ts +0 -19
- package/dist/workspace/resolve.js +0 -100
package/dist/commands/info.js
DELETED
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { readFileSync, existsSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { shouldOutputJson, jsonOut } from '../utils/output.js';
|
|
5
|
-
import { buildInfoGuide } from '../utils/agent-guidance.js';
|
|
6
|
-
import { fetchAppInfo } from '../utils/app-info.js';
|
|
7
|
-
import { bold, cyan, dim, green, yellow, gray } from '../ui/colors.js';
|
|
8
|
-
import { VERSION } from '../generated/version.js';
|
|
9
|
-
import { requireAuth } from '../auth/store.js';
|
|
10
|
-
import { ApiClient } from '../api/client.js';
|
|
11
|
-
import { resolveWorkspace } from '../workspace/resolve.js';
|
|
12
|
-
import { getSessionState } from '../dev/session.js';
|
|
13
|
-
import { getDeploySummary } from '../deploy/deploy-state.js';
|
|
14
|
-
function readLocalDevSession(appDir, appId) {
|
|
15
|
-
if (!appId)
|
|
16
|
-
return { state: 'none' };
|
|
17
|
-
const s = getSessionState(appDir, appId);
|
|
18
|
-
if (s.state === 'none')
|
|
19
|
-
return { state: 'none' };
|
|
20
|
-
if (s.state === 'stale')
|
|
21
|
-
return { state: 'stale', reason: s.reason, pid: s.file?.pid };
|
|
22
|
-
return {
|
|
23
|
-
state: 'alive',
|
|
24
|
-
pid: s.file.pid,
|
|
25
|
-
sessionId: s.file.sessionId,
|
|
26
|
-
previewUrl: s.file.previewUrl,
|
|
27
|
-
mode: s.file.mode,
|
|
28
|
-
startedAt: s.file.startedAt,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function tryReadConfig() {
|
|
32
|
-
if (!existsSync('.runwork.json'))
|
|
33
|
-
return null;
|
|
34
|
-
try {
|
|
35
|
-
return JSON.parse(readFileSync('.runwork.json', 'utf-8'));
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function readBlueprint(cwd) {
|
|
42
|
-
const blueprintPath = join(cwd, 'blueprint.json');
|
|
43
|
-
if (!existsSync(blueprintPath))
|
|
44
|
-
return null;
|
|
45
|
-
try {
|
|
46
|
-
return JSON.parse(readFileSync(blueprintPath, 'utf-8'));
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function mergeSources(blueprintItems, serverItems, getServerName, appId) {
|
|
53
|
-
const map = new Map();
|
|
54
|
-
// Skip nameless entries so we never store an `undefined` key. A bad
|
|
55
|
-
// blueprint or a partially-populated server-side row would otherwise
|
|
56
|
-
// produce a registry entry with `name === undefined`, which then crashes
|
|
57
|
-
// the human-readable printer at `a.name.padEnd(24)` and yields ugly
|
|
58
|
-
// `"undefined": ...` keys in JSON output.
|
|
59
|
-
for (const bp of blueprintItems) {
|
|
60
|
-
if (typeof bp.name !== 'string' || bp.name.length === 0)
|
|
61
|
-
continue;
|
|
62
|
-
map.set(bp.name, { sources: ['blueprint'], blueprintExtra: bp.extra });
|
|
63
|
-
}
|
|
64
|
-
for (const serverItem of serverItems) {
|
|
65
|
-
if (serverItem.appId !== appId)
|
|
66
|
-
continue;
|
|
67
|
-
const name = getServerName(serverItem);
|
|
68
|
-
if (typeof name !== 'string' || name.length === 0)
|
|
69
|
-
continue;
|
|
70
|
-
const mode = serverItem.deploymentMode;
|
|
71
|
-
const source = mode === 'production' ? 'production' : 'preview';
|
|
72
|
-
const existing = map.get(name);
|
|
73
|
-
if (existing) {
|
|
74
|
-
existing.sources.push(source);
|
|
75
|
-
existing.serverItem = serverItem;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
map.set(name, { sources: [source], serverItem: serverItem });
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return map;
|
|
82
|
-
}
|
|
83
|
-
function buildRegistries(blueprint, serverData, appId) {
|
|
84
|
-
// Entities
|
|
85
|
-
const bpEntities = (blueprint?.entities ?? []).map(e => ({
|
|
86
|
-
name: e.entityName,
|
|
87
|
-
extra: e.schema ? { schema: e.schema } : {},
|
|
88
|
-
}));
|
|
89
|
-
const entityMap = mergeSources(bpEntities, serverData?.entities ?? [], (e) => e.entityName, appId);
|
|
90
|
-
const entities = Array.from(entityMap.entries()).map(([name, v]) => ({
|
|
91
|
-
name,
|
|
92
|
-
sources: v.sources,
|
|
93
|
-
...(v.blueprintExtra?.schema ? { schema: v.blueprintExtra.schema } :
|
|
94
|
-
v.serverItem && 'schema' in v.serverItem && v.serverItem.schema ? { schema: v.serverItem.schema } : {}),
|
|
95
|
-
}));
|
|
96
|
-
// Scheduled jobs (blueprint may use either key)
|
|
97
|
-
const bpSchedules = (blueprint?.scheduledJobs ?? blueprint?.schedules ?? []).map(s => ({
|
|
98
|
-
name: s.name,
|
|
99
|
-
extra: { schedule: s.schedule, description: s.description },
|
|
100
|
-
}));
|
|
101
|
-
const scheduleMap = mergeSources(bpSchedules, serverData?.schedules ?? [], (s) => s.name, appId);
|
|
102
|
-
const scheduledJobs = Array.from(scheduleMap.entries()).map(([name, v]) => {
|
|
103
|
-
const serverItem = v.serverItem;
|
|
104
|
-
return {
|
|
105
|
-
name,
|
|
106
|
-
sources: v.sources,
|
|
107
|
-
schedule: v.blueprintExtra?.schedule ?? serverItem?.schedule,
|
|
108
|
-
description: v.blueprintExtra?.description ?? serverItem?.description,
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
// Workflows
|
|
112
|
-
const bpWorkflows = (blueprint?.workflows ?? []).map(w => ({
|
|
113
|
-
name: w.name,
|
|
114
|
-
extra: { description: w.description },
|
|
115
|
-
}));
|
|
116
|
-
const workflowMap = mergeSources(bpWorkflows, serverData?.workflows ?? [], (w) => w.name, appId);
|
|
117
|
-
const workflows = Array.from(workflowMap.entries()).map(([name, v]) => {
|
|
118
|
-
const serverItem = v.serverItem;
|
|
119
|
-
return {
|
|
120
|
-
name,
|
|
121
|
-
sources: v.sources,
|
|
122
|
-
description: v.blueprintExtra?.description ?? serverItem?.description,
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
// Agents
|
|
126
|
-
const bpAgents = (blueprint?.agents ?? []).map(a => ({
|
|
127
|
-
name: a.name,
|
|
128
|
-
extra: { type: a.type, description: a.description },
|
|
129
|
-
}));
|
|
130
|
-
const agentMap = mergeSources(bpAgents, serverData?.agents ?? [], (a) => a.name, appId);
|
|
131
|
-
const agents = Array.from(agentMap.entries()).map(([name, v]) => {
|
|
132
|
-
const serverItem = v.serverItem;
|
|
133
|
-
return {
|
|
134
|
-
name,
|
|
135
|
-
sources: v.sources,
|
|
136
|
-
type: v.blueprintExtra?.type ?? serverItem?.type,
|
|
137
|
-
description: v.blueprintExtra?.description ?? serverItem?.description,
|
|
138
|
-
};
|
|
139
|
-
});
|
|
140
|
-
// Public endpoints (blueprint may use either key)
|
|
141
|
-
const bpEndpoints = (blueprint?.publicEndpoints ?? blueprint?.endpoints ?? []).map(e => ({
|
|
142
|
-
name: `${e.method ?? 'ANY'} ${e.path}`,
|
|
143
|
-
extra: { path: e.path, method: e.method, description: e.description },
|
|
144
|
-
}));
|
|
145
|
-
const endpointMap = mergeSources(bpEndpoints, serverData?.endpoints ?? [], (e) => `${e.method ?? 'ANY'} ${e.path}`, appId);
|
|
146
|
-
const publicEndpoints = Array.from(endpointMap.entries()).map(([, v]) => {
|
|
147
|
-
const serverItem = v.serverItem;
|
|
148
|
-
return {
|
|
149
|
-
path: v.blueprintExtra?.path ?? serverItem?.path ?? '',
|
|
150
|
-
method: v.blueprintExtra?.method ?? serverItem?.method,
|
|
151
|
-
sources: v.sources,
|
|
152
|
-
description: v.blueprintExtra?.description ?? serverItem?.description,
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
// Components
|
|
156
|
-
const bpComponents = (blueprint?.components ?? []).map(c => ({
|
|
157
|
-
name: c.componentName,
|
|
158
|
-
extra: {},
|
|
159
|
-
}));
|
|
160
|
-
const componentMap = mergeSources(bpComponents, serverData?.components ?? [], (c) => c.componentName, appId);
|
|
161
|
-
const components = Array.from(componentMap.entries()).map(([name, v]) => ({
|
|
162
|
-
name,
|
|
163
|
-
sources: v.sources,
|
|
164
|
-
}));
|
|
165
|
-
// File storage
|
|
166
|
-
const bpHasStorage = blueprint
|
|
167
|
-
? typeof blueprint.fileStorage === 'boolean'
|
|
168
|
-
? blueprint.fileStorage
|
|
169
|
-
: typeof blueprint.fileStorage === 'object'
|
|
170
|
-
? (blueprint.fileStorage.enabled !== false)
|
|
171
|
-
: false
|
|
172
|
-
: false;
|
|
173
|
-
const serverStorages = (serverData?.fileStorages ?? []).filter(fs => fs.appId === appId);
|
|
174
|
-
const storageSources = [];
|
|
175
|
-
if (bpHasStorage)
|
|
176
|
-
storageSources.push('blueprint');
|
|
177
|
-
for (const ss of serverStorages) {
|
|
178
|
-
const mode = ss.deploymentMode;
|
|
179
|
-
if (mode === 'production')
|
|
180
|
-
storageSources.push('production');
|
|
181
|
-
else
|
|
182
|
-
storageSources.push('preview');
|
|
183
|
-
}
|
|
184
|
-
const fileStorage = {
|
|
185
|
-
enabled: bpHasStorage || serverStorages.length > 0,
|
|
186
|
-
sources: storageSources,
|
|
187
|
-
};
|
|
188
|
-
return { entities, workflows, scheduledJobs, agents, publicEndpoints, components, fileStorage };
|
|
189
|
-
}
|
|
190
|
-
function getCliCommands(command) {
|
|
191
|
-
const program = command.parent;
|
|
192
|
-
if (!program)
|
|
193
|
-
return [];
|
|
194
|
-
return program.commands
|
|
195
|
-
.filter(cmd => !cmd._hidden)
|
|
196
|
-
.map(cmd => {
|
|
197
|
-
const aliases = cmd.aliases();
|
|
198
|
-
const name = aliases.length > 0 ? `${cmd.name()}|${aliases.join('|')}` : cmd.name();
|
|
199
|
-
return { name, description: cmd.description() };
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Pad a possibly-missing string to a fixed width. Returns a visible
|
|
204
|
-
* placeholder when the value isn't a usable string so the human-readable
|
|
205
|
-
* printer can never crash on an unexpectedly-undefined field.
|
|
206
|
-
*/
|
|
207
|
-
function padName(value, width) {
|
|
208
|
-
if (typeof value === 'string' && value.length > 0)
|
|
209
|
-
return value.padEnd(width);
|
|
210
|
-
return '(unnamed)'.padEnd(width);
|
|
211
|
-
}
|
|
212
|
-
export function formatSources(sources) {
|
|
213
|
-
return sources
|
|
214
|
-
.map(s => {
|
|
215
|
-
if (s === 'blueprint')
|
|
216
|
-
return cyan(s);
|
|
217
|
-
if (s === 'preview')
|
|
218
|
-
return yellow(s);
|
|
219
|
-
if (s === 'production')
|
|
220
|
-
return green(s);
|
|
221
|
-
return s;
|
|
222
|
-
})
|
|
223
|
-
.join(dim(', '));
|
|
224
|
-
}
|
|
225
|
-
function printHumanOutput(data) {
|
|
226
|
-
console.log('');
|
|
227
|
-
const pad = (label) => label.padEnd(12);
|
|
228
|
-
const wsLabel = data.workspace.name && data.workspace.name !== data.workspace.id
|
|
229
|
-
? `${data.workspace.name} ${dim('(' + data.workspace.id + ')')}`
|
|
230
|
-
: data.workspace.id;
|
|
231
|
-
console.log(` ${dim(pad('Workspace:'))}${wsLabel}`);
|
|
232
|
-
if (data.app) {
|
|
233
|
-
console.log('');
|
|
234
|
-
console.log(bold('App Info'));
|
|
235
|
-
console.log('');
|
|
236
|
-
console.log(` ${dim(pad('App:'))}${bold(data.app.name)}`);
|
|
237
|
-
if (data.preview.url) {
|
|
238
|
-
console.log(` ${dim(pad('Preview:'))}${green(data.preview.url)} ${dim('(running)')}`);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
console.log(` ${dim(pad('Preview:'))}${dim('(not running)')}`);
|
|
242
|
-
}
|
|
243
|
-
if (data.production.url) {
|
|
244
|
-
console.log(` ${dim(pad('Production:'))}${green(data.production.url)} ${dim('(deployed)')}`);
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
console.log(` ${dim(pad('Production:'))}${dim('(not deployed)')}`);
|
|
248
|
-
}
|
|
249
|
-
if (data.deploy.deployedShortSha) {
|
|
250
|
-
const localPart = data.deploy.localShortSha ? `, local ${data.deploy.localShortSha}` : '';
|
|
251
|
-
const sync = data.deploy.inSync === true
|
|
252
|
-
? green('in sync')
|
|
253
|
-
: data.deploy.inSync === false
|
|
254
|
-
? yellow('local has undeployed commits')
|
|
255
|
-
: dim('unknown');
|
|
256
|
-
console.log(` ${dim(pad('Last deploy:'))}${data.deploy.deployedShortSha}${dim(localPart)} ${sync}`);
|
|
257
|
-
}
|
|
258
|
-
// Local dev session view: what's running on THIS machine, from the
|
|
259
|
-
// session file. This may disagree with the server's "preview"
|
|
260
|
-
// status above; that's diagnostic, not a bug.
|
|
261
|
-
const local = data.localDevSession;
|
|
262
|
-
if (local.state === 'alive') {
|
|
263
|
-
const startedSec = Math.round((Date.now() - local.startedAt) / 1000);
|
|
264
|
-
const ago = startedSec < 60 ? `${startedSec}s ago`
|
|
265
|
-
: startedSec < 3600 ? `${Math.floor(startedSec / 60)}m ago`
|
|
266
|
-
: `${Math.floor(startedSec / 3600)}h ago`;
|
|
267
|
-
console.log(` ${dim(pad('Dev session:'))}${green('running')} ${dim(`(PID ${local.pid}, ${local.mode}, started ${ago})`)}`);
|
|
268
|
-
}
|
|
269
|
-
else if (local.state === 'stale') {
|
|
270
|
-
console.log(` ${dim(pad('Dev session:'))}${yellow('stale')} ${dim(`(reason: ${local.reason}; run \`runwork dev stop\` to clean up)`)}`);
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
console.log(` ${dim(pad('Dev session:'))}${dim('(none on this machine)')}`);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
console.log('');
|
|
277
|
-
// Integrations
|
|
278
|
-
if (data.integrations === null) {
|
|
279
|
-
console.log(bold('Integrations:'));
|
|
280
|
-
console.log(` ${dim('(unavailable -- API error or not authenticated)')}`);
|
|
281
|
-
}
|
|
282
|
-
else if (data.integrations.length === 0) {
|
|
283
|
-
console.log(bold('Integrations:'));
|
|
284
|
-
console.log(` ${dim('(none connected)')}`);
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
console.log(bold('Integrations:'));
|
|
288
|
-
for (const int of data.integrations) {
|
|
289
|
-
const statusColor = int.status === 'connected' ? green : yellow;
|
|
290
|
-
console.log(` ${int.id.padEnd(20)} ${statusColor(int.status)}`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
console.log('');
|
|
294
|
-
// Registries
|
|
295
|
-
if (data.registries === null) {
|
|
296
|
-
// Skip entirely if unavailable
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
const reg = data.registries;
|
|
300
|
-
const hasAny = reg.entities.length > 0 || reg.workflows.length > 0 ||
|
|
301
|
-
reg.scheduledJobs.length > 0 || reg.agents.length > 0 ||
|
|
302
|
-
reg.publicEndpoints.length > 0 || reg.components.length > 0 ||
|
|
303
|
-
reg.fileStorage.enabled;
|
|
304
|
-
if (!hasAny) {
|
|
305
|
-
// No registries -- skip the section entirely
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
console.log(bold('Registries:'));
|
|
309
|
-
if (reg.entities.length > 0) {
|
|
310
|
-
console.log(` ${bold('Entities:')}`);
|
|
311
|
-
for (const e of reg.entities) {
|
|
312
|
-
console.log(` ${padName(e.name, 24)} ${formatSources(e.sources)}`);
|
|
313
|
-
}
|
|
314
|
-
console.log('');
|
|
315
|
-
}
|
|
316
|
-
if (reg.workflows.length > 0) {
|
|
317
|
-
console.log(` ${bold('Workflows:')}`);
|
|
318
|
-
for (const w of reg.workflows) {
|
|
319
|
-
const desc = w.description ? ` ${dim(w.description)}` : '';
|
|
320
|
-
console.log(` ${padName(w.name, 24)} ${formatSources(w.sources)}${desc}`);
|
|
321
|
-
}
|
|
322
|
-
console.log('');
|
|
323
|
-
}
|
|
324
|
-
if (reg.scheduledJobs.length > 0) {
|
|
325
|
-
console.log(` ${bold('Scheduled Jobs:')}`);
|
|
326
|
-
for (const s of reg.scheduledJobs) {
|
|
327
|
-
const schedule = s.schedule ? ` ${gray(s.schedule)}` : '';
|
|
328
|
-
console.log(` ${padName(s.name, 24)} ${formatSources(s.sources)}${schedule}`);
|
|
329
|
-
}
|
|
330
|
-
console.log('');
|
|
331
|
-
}
|
|
332
|
-
if (reg.agents.length > 0) {
|
|
333
|
-
console.log(` ${bold('Agents:')}`);
|
|
334
|
-
for (const a of reg.agents) {
|
|
335
|
-
const type = a.type ? ` ${dim(a.type)}` : '';
|
|
336
|
-
console.log(` ${padName(a.name, 24)} ${formatSources(a.sources)}${type}`);
|
|
337
|
-
}
|
|
338
|
-
console.log('');
|
|
339
|
-
}
|
|
340
|
-
if (reg.publicEndpoints.length > 0) {
|
|
341
|
-
console.log(` ${bold('Public Endpoints:')}`);
|
|
342
|
-
for (const e of reg.publicEndpoints) {
|
|
343
|
-
const label = e.method && e.path ? `${e.method} ${e.path}` : (e.path || '');
|
|
344
|
-
console.log(` ${padName(label, 24)} ${formatSources(e.sources)}`);
|
|
345
|
-
}
|
|
346
|
-
console.log('');
|
|
347
|
-
}
|
|
348
|
-
if (reg.components.length > 0) {
|
|
349
|
-
console.log(` ${bold('Components:')}`);
|
|
350
|
-
for (const c of reg.components) {
|
|
351
|
-
console.log(` ${padName(c.name, 24)} ${formatSources(c.sources)}`);
|
|
352
|
-
}
|
|
353
|
-
console.log('');
|
|
354
|
-
}
|
|
355
|
-
if (reg.fileStorage.enabled) {
|
|
356
|
-
console.log(` ${bold('File Storage:')} ${formatSources(reg.fileStorage.sources)}`);
|
|
357
|
-
console.log('');
|
|
358
|
-
}
|
|
359
|
-
} // end hasAny
|
|
360
|
-
}
|
|
361
|
-
// CLI commands
|
|
362
|
-
console.log(bold('CLI Commands:'));
|
|
363
|
-
for (const cmd of data.cli.commands) {
|
|
364
|
-
console.log(` ${cyan(('runwork ' + cmd.name).padEnd(36))} ${dim(cmd.description)}`);
|
|
365
|
-
}
|
|
366
|
-
console.log('');
|
|
367
|
-
console.log(dim(` CLI version: ${data.cli.version}`));
|
|
368
|
-
console.log('');
|
|
369
|
-
}
|
|
370
|
-
// Internal helpers exposed for unit tests; do not import from anywhere
|
|
371
|
-
// other than `__tests__/`.
|
|
372
|
-
export const __testing = { mergeSources, padName, buildRegistries };
|
|
373
|
-
export const infoCommand = new Command('info')
|
|
374
|
-
.description('Show app context, registries, and CLI reference (use --json for agent discovery)')
|
|
375
|
-
.action(async (_opts, command) => {
|
|
376
|
-
const asJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
377
|
-
const creds = requireAuth();
|
|
378
|
-
const client = new ApiClient(creds);
|
|
379
|
-
// Try to read project config, but don't require it
|
|
380
|
-
const config = tryReadConfig();
|
|
381
|
-
const blueprint = config ? readBlueprint(process.cwd()) : null;
|
|
382
|
-
// Resolve workspace: project config > --workspace > default > prompt
|
|
383
|
-
let workspaceId;
|
|
384
|
-
let workspaceName;
|
|
385
|
-
if (config) {
|
|
386
|
-
workspaceId = config.workspaceId;
|
|
387
|
-
workspaceName = config.workspaceName ?? config.workspaceId;
|
|
388
|
-
}
|
|
389
|
-
else {
|
|
390
|
-
const resolved = await resolveWorkspace(client, {});
|
|
391
|
-
workspaceId = resolved.workspaceId;
|
|
392
|
-
workspaceName = resolved.workspaceName || resolved.workspaceId;
|
|
393
|
-
}
|
|
394
|
-
const appId = config?.appId;
|
|
395
|
-
const appName = config?.appName;
|
|
396
|
-
// App-specific info (preview, dashboard, git remote, server registries)
|
|
397
|
-
const appInfo = appId ? await fetchAppInfo(client, {
|
|
398
|
-
appId,
|
|
399
|
-
appName: appName ?? '',
|
|
400
|
-
appSlug: appName ?? '',
|
|
401
|
-
workspaceId,
|
|
402
|
-
workspaceName,
|
|
403
|
-
baseUrl: creds.baseUrl || 'https://runwork.ai',
|
|
404
|
-
}) : null;
|
|
405
|
-
const preview = appInfo?.preview ?? { url: null, active: false };
|
|
406
|
-
// Integrations
|
|
407
|
-
let integrations = null;
|
|
408
|
-
try {
|
|
409
|
-
const raw = await client.listConnectedIntegrations(workspaceId);
|
|
410
|
-
integrations = raw.map(i => ({
|
|
411
|
-
id: i.canonicalId ?? i.integrationId,
|
|
412
|
-
status: i.status ?? 'connected',
|
|
413
|
-
}));
|
|
414
|
-
}
|
|
415
|
-
catch {
|
|
416
|
-
process.stderr.write('Warning: failed to fetch integrations\n');
|
|
417
|
-
}
|
|
418
|
-
// Workspace registries
|
|
419
|
-
let serverData = null;
|
|
420
|
-
try {
|
|
421
|
-
serverData = await client.getWorkspaceAll(workspaceId);
|
|
422
|
-
}
|
|
423
|
-
catch {
|
|
424
|
-
process.stderr.write('Warning: failed to fetch workspace registries\n');
|
|
425
|
-
}
|
|
426
|
-
const registries = buildRegistries(blueprint, serverData, appId ?? '');
|
|
427
|
-
const localDevSession = readLocalDevSession(process.cwd(), appId);
|
|
428
|
-
const output = {
|
|
429
|
-
app: appId ? {
|
|
430
|
-
id: appId,
|
|
431
|
-
name: appName ?? '',
|
|
432
|
-
slug: appName ?? '',
|
|
433
|
-
} : null,
|
|
434
|
-
workspace: {
|
|
435
|
-
id: workspaceId,
|
|
436
|
-
name: workspaceName,
|
|
437
|
-
},
|
|
438
|
-
preview,
|
|
439
|
-
localDevSession,
|
|
440
|
-
production: appInfo?.production ?? { url: null, deployed: false },
|
|
441
|
-
deploy: getDeploySummary(process.cwd()),
|
|
442
|
-
integrations,
|
|
443
|
-
registries,
|
|
444
|
-
cli: {
|
|
445
|
-
version: VERSION,
|
|
446
|
-
commands: getCliCommands(command),
|
|
447
|
-
},
|
|
448
|
-
};
|
|
449
|
-
if (asJson) {
|
|
450
|
-
jsonOut({ ...output, guide: buildInfoGuide() });
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
printHumanOutput(output);
|
|
454
|
-
}
|
|
455
|
-
});
|
package/dist/commands/init.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { ApiClient } from '../api/client.js';
|
|
3
|
-
import type { Credentials, WorkspaceInfo } from '../types.js';
|
|
4
|
-
export interface InitResult {
|
|
5
|
-
appId: string;
|
|
6
|
-
appName: string;
|
|
7
|
-
slug: string;
|
|
8
|
-
directory: string;
|
|
9
|
-
workspaceId: string;
|
|
10
|
-
workspaceName: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ExecInitOptions {
|
|
13
|
-
/** When true, create the app in cwd/<slug> instead of ~/.runwork/<slug>. */
|
|
14
|
-
here?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/** Default parent directory for new apps when --here is not passed. */
|
|
17
|
-
export declare const DEFAULT_APPS_DIR: string;
|
|
18
|
-
export declare function execInit(client: ApiClient, appName: string, workspace: WorkspaceInfo, options?: ExecInitOptions, creds?: Credentials | null): Promise<InitResult>;
|
|
19
|
-
/** Full create flow: prompt for name/workspace, init, and run agent wizard */
|
|
20
|
-
export declare function runCreateFlow(name?: string, workspaceFlag?: string, options?: ExecInitOptions): Promise<void>;
|
|
21
|
-
export declare const initCommand: Command;
|
package/dist/commands/init.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { execFileSync } from '../utils/subprocess.js';
|
|
3
|
-
import { writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
4
|
-
import { join, resolve } from 'path';
|
|
5
|
-
import { homedir } from 'os';
|
|
6
|
-
import { requireAuth } from '../auth/store.js';
|
|
7
|
-
import { ApiClient } from '../api/client.js';
|
|
8
|
-
import { ensureGitIdentity } from '../git/identity.js';
|
|
9
|
-
import { requireGit } from '../git/preflight.js';
|
|
10
|
-
import { formatError } from '../utils/format-error.js';
|
|
11
|
-
import { promptSelect, promptInput } from '../utils/prompt.js';
|
|
12
|
-
import { resolveWorkspace } from '../utils/resolve.js';
|
|
13
|
-
import { generateManifest, saveManifest } from '../template/manifest.js';
|
|
14
|
-
import { extractZip } from '../utils/zip.js';
|
|
15
|
-
import { removeNestedGitDirs } from '../utils/fs.js';
|
|
16
|
-
import { runAgentWizard } from '../ui/banner.js';
|
|
17
|
-
import { shouldOutputJson, jsonOut } from '../utils/output.js';
|
|
18
|
-
import { buildInitGuide, buildErrorResponse } from '../utils/agent-guidance.js';
|
|
19
|
-
/** Default parent directory for new apps when --here is not passed. */
|
|
20
|
-
export const DEFAULT_APPS_DIR = join(homedir(), '.runwork', 'apps');
|
|
21
|
-
export async function execInit(client, appName, workspace, options = {}, creds) {
|
|
22
|
-
const app = await client.initApp(workspace.id, appName);
|
|
23
|
-
const slug = app.slug || appName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
24
|
-
const parentDir = options.here ? process.cwd() : DEFAULT_APPS_DIR;
|
|
25
|
-
if (!options.here && !existsSync(parentDir)) {
|
|
26
|
-
mkdirSync(parentDir, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
const dir = join(parentDir, slug);
|
|
29
|
-
if (existsSync(dir)) {
|
|
30
|
-
console.error(`Directory "${dir}" already exists.`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
mkdirSync(dir, { recursive: true });
|
|
34
|
-
if (!options.here) {
|
|
35
|
-
console.log(`Creating app in ${dir}`);
|
|
36
|
-
console.log('(Pass --here to scaffold in the current directory instead.)');
|
|
37
|
-
}
|
|
38
|
-
// Download and extract skeleton template first
|
|
39
|
-
console.log('Downloading project template...');
|
|
40
|
-
try {
|
|
41
|
-
const zipData = await client.downloadSkeleton();
|
|
42
|
-
extractZip(zipData, dir);
|
|
43
|
-
removeNestedGitDirs(dir);
|
|
44
|
-
console.log('Project template extracted.');
|
|
45
|
-
// Generate template manifest for tracking user edits
|
|
46
|
-
const manifest = await generateManifest(dir);
|
|
47
|
-
await saveManifest(dir, manifest);
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
console.warn('Failed to download skeleton template. Starting with empty project.');
|
|
51
|
-
}
|
|
52
|
-
// Write .runwork.json AFTER template extraction so it doesn't get overwritten
|
|
53
|
-
const config = {
|
|
54
|
-
workspaceId: workspace.id,
|
|
55
|
-
workspaceName: workspace.name,
|
|
56
|
-
appId: app.id,
|
|
57
|
-
appName: app.name,
|
|
58
|
-
};
|
|
59
|
-
writeFileSync(join(dir, '.runwork.json'), JSON.stringify(config, null, 2));
|
|
60
|
-
// Initialize git. `stdio: 'pipe'` swallows git's stderr, so we have to
|
|
61
|
-
// print any failure ourselves -- otherwise this fails silently and the
|
|
62
|
-
// user is left with an empty directory and no clue what happened.
|
|
63
|
-
if (!existsSync(join(dir, '.git'))) {
|
|
64
|
-
try {
|
|
65
|
-
execFileSync('git', ['init'], { cwd: dir, stdio: 'pipe' });
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
console.error(`git init failed in ${dir}: ${formatError(err)}`);
|
|
69
|
-
throw err;
|
|
70
|
-
}
|
|
71
|
-
// Force the initial branch to `main` regardless of the user's
|
|
72
|
-
// `init.defaultBranch` config (older Git installs default to
|
|
73
|
-
// `master`). symbolic-ref works before any commits exist; `git
|
|
74
|
-
// branch -M main` would not.
|
|
75
|
-
try {
|
|
76
|
-
execFileSync('git', ['symbolic-ref', 'HEAD', 'refs/heads/main'], { cwd: dir, stdio: 'pipe' });
|
|
77
|
-
}
|
|
78
|
-
catch { /* best-effort: push uses HEAD:main so this is just cleanliness */ }
|
|
79
|
-
}
|
|
80
|
-
// Seed a local git identity so the initial commit cannot fail on machines
|
|
81
|
-
// (commonly fresh Windows installs) without `git config --global user.email`.
|
|
82
|
-
ensureGitIdentity(dir, creds);
|
|
83
|
-
// Add runwork remote
|
|
84
|
-
const remoteUrl = client.getGitRemoteUrl(workspace.id, app.id);
|
|
85
|
-
try {
|
|
86
|
-
execFileSync('git', ['remote', 'add', 'runwork', remoteUrl], { cwd: dir, stdio: 'pipe' });
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
execFileSync('git', ['remote', 'set-url', 'runwork', remoteUrl], { cwd: dir, stdio: 'pipe' });
|
|
90
|
-
}
|
|
91
|
-
// Create .gitignore if needed
|
|
92
|
-
if (!existsSync(join(dir, '.gitignore'))) {
|
|
93
|
-
writeFileSync(join(dir, '.gitignore'), 'node_modules/\n.runwork/\n.dev.vars\n');
|
|
94
|
-
}
|
|
95
|
-
// Initial commit: only track .runwork.json and .gitignore (not template files)
|
|
96
|
-
execFileSync('git', ['add', '--', '.runwork.json', '.gitignore'], { cwd: dir, stdio: 'pipe' });
|
|
97
|
-
try {
|
|
98
|
-
execFileSync('git', ['commit', '-m', 'Initialize app'], { cwd: dir, stdio: 'pipe' });
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
// Nothing to commit is fine
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
execFileSync('git', ['push', '-u', 'runwork', 'main'], { cwd: dir, stdio: 'pipe' });
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
console.error(`git push to runwork remote failed: ${formatError(err)}`);
|
|
108
|
-
throw err;
|
|
109
|
-
}
|
|
110
|
-
console.log(`\nApp "${app.name}" initialized in ${dir}`);
|
|
111
|
-
return {
|
|
112
|
-
appId: app.id,
|
|
113
|
-
appName: app.name,
|
|
114
|
-
slug,
|
|
115
|
-
directory: resolve(dir),
|
|
116
|
-
workspaceId: workspace.id,
|
|
117
|
-
workspaceName: workspace.name,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
/** Full create flow: prompt for name/workspace, init, and run agent wizard */
|
|
121
|
-
export async function runCreateFlow(name, workspaceFlag, options = {}) {
|
|
122
|
-
const useJson = shouldOutputJson(undefined);
|
|
123
|
-
requireGit('init');
|
|
124
|
-
const creds = requireAuth();
|
|
125
|
-
const client = new ApiClient(creds);
|
|
126
|
-
const appName = name || await promptInput('App name');
|
|
127
|
-
if (!appName) {
|
|
128
|
-
if (useJson) {
|
|
129
|
-
jsonOut(buildErrorResponse('init', 'App name is required.', 'No app name was provided.', ['Provide an app name as an argument: runwork init <name>']));
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
console.error('App name is required.');
|
|
133
|
-
process.exit(1);
|
|
134
|
-
}
|
|
135
|
-
let workspace;
|
|
136
|
-
if (workspaceFlag) {
|
|
137
|
-
workspace = await resolveWorkspace(client, workspaceFlag);
|
|
138
|
-
}
|
|
139
|
-
else if (creds.defaultWorkspaceId) {
|
|
140
|
-
// Auto-select default workspace from credentials (set during login/onboarding)
|
|
141
|
-
workspace = { id: creds.defaultWorkspaceId, name: creds.defaultWorkspaceName || creds.defaultWorkspaceId };
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
const workspaces = await client.listWorkspaces();
|
|
145
|
-
if (workspaces.length === 0) {
|
|
146
|
-
if (useJson) {
|
|
147
|
-
jsonOut(buildErrorResponse('init', 'No workspaces found.', 'The authenticated account has no workspaces.', ['Create a workspace at runwork.ai first.']));
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
console.error('No workspaces found. Create one at runwork.ai first.');
|
|
151
|
-
process.exit(1);
|
|
152
|
-
}
|
|
153
|
-
if (workspaces.length === 1) {
|
|
154
|
-
workspace = workspaces[0];
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
const workspaceChoice = await promptSelect('Select workspace:', workspaces.map(w => ({ label: w.name, value: w })));
|
|
158
|
-
workspace = workspaceChoice.value;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (!useJson) {
|
|
162
|
-
console.log(`Creating "${appName}" in workspace "${workspace.name}"...`);
|
|
163
|
-
}
|
|
164
|
-
const initResult = await execInit(client, appName, workspace, options, creds);
|
|
165
|
-
if (useJson) {
|
|
166
|
-
const response = {
|
|
167
|
-
success: true,
|
|
168
|
-
command: 'init',
|
|
169
|
-
result: initResult,
|
|
170
|
-
guide: buildInitGuide(initResult.appName, initResult.directory),
|
|
171
|
-
};
|
|
172
|
-
jsonOut(response);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
await runAgentWizard(initResult.directory);
|
|
176
|
-
}
|
|
177
|
-
export const initCommand = new Command('init')
|
|
178
|
-
.alias('create')
|
|
179
|
-
.description('Create a new Runwork app')
|
|
180
|
-
.argument('[name]', 'App name')
|
|
181
|
-
.option('--workspace <name-or-id>', 'Workspace name or ID (skips interactive selection)')
|
|
182
|
-
.option('--here', `Scaffold in the current directory instead of ${DEFAULT_APPS_DIR}/<slug>`)
|
|
183
|
-
.action(async (name, options) => {
|
|
184
|
-
await runCreateFlow(name, options?.workspace, { here: options?.here });
|
|
185
|
-
});
|