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/doctor.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { shouldOutputJson, jsonOut } from '../utils/output.js';
|
|
3
|
-
import { bold, dim, green, yellow, cyan, red } from '../ui/colors.js';
|
|
4
|
-
import { runAllChecks, ALL_CHECK_NAMES } from '../health/runner.js';
|
|
5
|
-
import { buildContext } from '../health/checks.js';
|
|
6
|
-
import { applyDoctorFixes } from '../health/fix.js';
|
|
7
|
-
import { detectCurrentAgent } from '../agents/runtime-detection.js';
|
|
8
|
-
/**
|
|
9
|
-
* Env vars worth surfacing in --verbose for AI agents debugging their own
|
|
10
|
-
* environment. Filtered to known-safe runtime signals; never includes
|
|
11
|
-
* credentials, tokens, or anything matching common secret patterns.
|
|
12
|
-
*/
|
|
13
|
-
const VERBOSE_ENV_ALLOWLIST = [
|
|
14
|
-
// Claude Code
|
|
15
|
-
'CLAUDECODE',
|
|
16
|
-
'CLAUDE_CODE_ENTRYPOINT',
|
|
17
|
-
'CLAUDE_CODE_SESSION_ID',
|
|
18
|
-
'CLAUDE_CODE_EXECPATH',
|
|
19
|
-
'CLAUDE_EFFORT',
|
|
20
|
-
// Codex
|
|
21
|
-
'CODEX_CI',
|
|
22
|
-
'CODEX_THREAD_ID',
|
|
23
|
-
'CODEX_SANDBOX',
|
|
24
|
-
'CODEX_SANDBOX_NETWORK_DISABLED',
|
|
25
|
-
// Generic shell context
|
|
26
|
-
'PWD',
|
|
27
|
-
'SHELL',
|
|
28
|
-
'TERM',
|
|
29
|
-
'LANG',
|
|
30
|
-
// CI markers
|
|
31
|
-
'CI',
|
|
32
|
-
'GITHUB_ACTIONS',
|
|
33
|
-
];
|
|
34
|
-
function collectVerboseInfo() {
|
|
35
|
-
const env = {};
|
|
36
|
-
for (const key of VERBOSE_ENV_ALLOWLIST) {
|
|
37
|
-
if (process.env[key] !== undefined) {
|
|
38
|
-
env[key] = process.env[key];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const detected = detectCurrentAgent();
|
|
42
|
-
return {
|
|
43
|
-
hostAgent: detected ?? null,
|
|
44
|
-
env,
|
|
45
|
-
runtime: {
|
|
46
|
-
platform: process.platform,
|
|
47
|
-
arch: process.arch,
|
|
48
|
-
nodeVersion: process.version,
|
|
49
|
-
cwd: process.cwd(),
|
|
50
|
-
pid: process.pid,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function printVerboseBlock(info) {
|
|
55
|
-
console.log('');
|
|
56
|
-
console.log(bold('Verbose runtime info'));
|
|
57
|
-
console.log('');
|
|
58
|
-
const detected = info.hostAgent;
|
|
59
|
-
if (detected) {
|
|
60
|
-
console.log(` ${green('[detected]')} Host agent: ${detected.slug}`);
|
|
61
|
-
if (detected.sessionId)
|
|
62
|
-
console.log(` sessionId: ${detected.sessionId}`);
|
|
63
|
-
if (detected.sessionFilePath)
|
|
64
|
-
console.log(` sessionFilePath: ${detected.sessionFilePath}`);
|
|
65
|
-
console.log(` source: ${detected.source}`);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
console.log(` ${dim('[none]')} No host agent detected (not running inside a known AI agent)`);
|
|
69
|
-
}
|
|
70
|
-
console.log('');
|
|
71
|
-
console.log(bold('Env vars (allowlisted)'));
|
|
72
|
-
const envEntries = Object.entries(info.env);
|
|
73
|
-
if (envEntries.length === 0) {
|
|
74
|
-
console.log(` ${dim('(none set)')}`);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
for (const [k, v] of envEntries) {
|
|
78
|
-
console.log(` ${k.padEnd(38)} ${v}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
console.log('');
|
|
82
|
-
console.log(bold('Runtime'));
|
|
83
|
-
const r = info.runtime;
|
|
84
|
-
for (const [k, v] of Object.entries(r)) {
|
|
85
|
-
console.log(` ${k.padEnd(38)} ${v}`);
|
|
86
|
-
}
|
|
87
|
-
console.log('');
|
|
88
|
-
}
|
|
89
|
-
const STATUS_LABELS = {
|
|
90
|
-
pass: green('[pass]'),
|
|
91
|
-
warn: yellow('[warn]'),
|
|
92
|
-
fail: bold('[FAIL]'),
|
|
93
|
-
skip: dim('[skip]'),
|
|
94
|
-
};
|
|
95
|
-
const CHECK_LABELS = {
|
|
96
|
-
'system-deps': 'System dependencies',
|
|
97
|
-
'cli-version': 'CLI version',
|
|
98
|
-
'auth': 'Authentication',
|
|
99
|
-
'network': 'Network',
|
|
100
|
-
'project-config': 'Project config',
|
|
101
|
-
'app-exists': 'App exists',
|
|
102
|
-
'git-remote': 'Git remote',
|
|
103
|
-
'deploy-freshness': 'Deploy freshness',
|
|
104
|
-
'agent-setup': 'Agent setup',
|
|
105
|
-
};
|
|
106
|
-
function printHumanReport(report) {
|
|
107
|
-
console.log('');
|
|
108
|
-
console.log(bold('runwork doctor'));
|
|
109
|
-
console.log('');
|
|
110
|
-
for (const check of report.checks) {
|
|
111
|
-
const status = STATUS_LABELS[check.status] || check.status;
|
|
112
|
-
const label = (CHECK_LABELS[check.name] || check.name).padEnd(22);
|
|
113
|
-
console.log(` ${status} ${label} ${dim(check.message)}`);
|
|
114
|
-
if (check.details && check.details.length > 1) {
|
|
115
|
-
for (const detail of check.details) {
|
|
116
|
-
console.log(` ${dim('- ' + detail)}`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// Summary
|
|
121
|
-
const failures = report.checks.filter(c => c.status === 'fail');
|
|
122
|
-
const warnings = report.checks.filter(c => c.status === 'warn');
|
|
123
|
-
console.log('');
|
|
124
|
-
if (failures.length > 0) {
|
|
125
|
-
console.log(` ${failures.length} issue${failures.length !== 1 ? 's' : ''} found:`);
|
|
126
|
-
for (const f of failures) {
|
|
127
|
-
const label = CHECK_LABELS[f.name] || f.name;
|
|
128
|
-
if (f.fix) {
|
|
129
|
-
console.log(` - ${label}: ${cyan(f.fix)}`);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
console.log(` - ${label}: ${f.message}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (warnings.length > 0 && failures.length === 0) {
|
|
137
|
-
console.log(` ${warnings.length} warning${warnings.length !== 1 ? 's' : ''}:`);
|
|
138
|
-
for (const w of warnings) {
|
|
139
|
-
const label = CHECK_LABELS[w.name] || w.name;
|
|
140
|
-
if (w.fix) {
|
|
141
|
-
console.log(` - ${label}: ${cyan(w.fix)}`);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
console.log(` - ${label}: ${w.message}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (failures.length === 0 && warnings.length === 0) {
|
|
149
|
-
console.log(` ${green('All checks passed.')}`);
|
|
150
|
-
}
|
|
151
|
-
console.log('');
|
|
152
|
-
}
|
|
153
|
-
function printFixOutcomes(outcomes) {
|
|
154
|
-
console.log('');
|
|
155
|
-
console.log(bold('Applying fixes'));
|
|
156
|
-
if (outcomes.length === 0) {
|
|
157
|
-
console.log(` ${dim('Nothing to fix (no auto-remediable failures).')}`);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
for (const o of outcomes) {
|
|
161
|
-
const marker = o.applied ? green('[fixed]') : yellow('[skip]');
|
|
162
|
-
console.log(` ${marker} ${o.name}: ${dim(o.message)}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/** Parse and validate `--check a,b,c` against the known check names. */
|
|
166
|
-
function parseCheckNames(raw) {
|
|
167
|
-
const requested = raw.split(',').map(s => s.trim()).filter(Boolean);
|
|
168
|
-
const known = new Set(ALL_CHECK_NAMES);
|
|
169
|
-
const only = requested.filter(n => known.has(n));
|
|
170
|
-
const unknown = requested.filter(n => !known.has(n));
|
|
171
|
-
return { only, unknown };
|
|
172
|
-
}
|
|
173
|
-
export const doctorCommand = new Command('doctor')
|
|
174
|
-
.description('Check system health: auth, network, project config, agent setup')
|
|
175
|
-
.option('-v, --verbose', 'Include host-agent detection results, runtime info, and allowlisted env vars (useful for AI agents debugging their own environment)')
|
|
176
|
-
.option('--check <names>', `Run only the named checks (comma-separated). Available: ${ALL_CHECK_NAMES.join(', ')}`)
|
|
177
|
-
.option('--fix', 'Auto-remediate fixable failures (git credential helper, runwork remote), then re-check')
|
|
178
|
-
.action(async (opts, command) => {
|
|
179
|
-
const asJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
180
|
-
// Resolve `--check` scope (if any) up front so both fix and report honor it.
|
|
181
|
-
let only;
|
|
182
|
-
if (opts.check) {
|
|
183
|
-
const parsed = parseCheckNames(opts.check);
|
|
184
|
-
if (parsed.unknown.length > 0) {
|
|
185
|
-
const msg = `Unknown check(s): ${parsed.unknown.join(', ')}. Available: ${ALL_CHECK_NAMES.join(', ')}`;
|
|
186
|
-
if (asJson) {
|
|
187
|
-
jsonOut({ success: false, command: 'doctor', error: msg });
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
console.error(red(msg));
|
|
191
|
-
}
|
|
192
|
-
process.exit(1);
|
|
193
|
-
}
|
|
194
|
-
only = parsed.only;
|
|
195
|
-
}
|
|
196
|
-
// --- Fix flow: report, remediate fixable failures, re-check ---
|
|
197
|
-
if (opts.fix) {
|
|
198
|
-
const before = await runAllChecks({ only });
|
|
199
|
-
const failingNames = before.checks.filter(c => c.status === 'fail').map(c => c.name);
|
|
200
|
-
const ctx = buildContext();
|
|
201
|
-
const outcomes = await applyDoctorFixes(ctx, failingNames);
|
|
202
|
-
const after = await runAllChecks({ only });
|
|
203
|
-
if (asJson) {
|
|
204
|
-
jsonOut({ success: after.status !== 'fail', command: 'doctor', fixes: outcomes, report: after });
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
printFixOutcomes(outcomes);
|
|
208
|
-
printHumanReport(after);
|
|
209
|
-
}
|
|
210
|
-
if (after.checks.some(c => c.status === 'fail')) {
|
|
211
|
-
process.exit(1);
|
|
212
|
-
}
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
// --- Normal (optionally scoped) report ---
|
|
216
|
-
const report = await runAllChecks({ only });
|
|
217
|
-
const verboseInfo = opts.verbose ? collectVerboseInfo() : null;
|
|
218
|
-
if (asJson) {
|
|
219
|
-
jsonOut(verboseInfo ? { ...report, verbose: verboseInfo } : report);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
printHumanReport(report);
|
|
223
|
-
if (verboseInfo) {
|
|
224
|
-
printVerboseBlock(verboseInfo);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (report.checks.some(c => c.status === 'fail')) {
|
|
228
|
-
process.exit(1);
|
|
229
|
-
}
|
|
230
|
-
});
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { requireAuth } from '../auth/store.js';
|
|
3
|
-
import { ApiClient } from '../api/client.js';
|
|
4
|
-
import { resolveWorkspace } from '../workspace/resolve.js';
|
|
5
|
-
import { shouldOutputJson, jsonOut } from '../utils/output.js';
|
|
6
|
-
import { httpFetch } from '../utils/http.js';
|
|
7
|
-
function truncate(text, max) {
|
|
8
|
-
if (!text)
|
|
9
|
-
return '';
|
|
10
|
-
const first = text.split('\n')[0];
|
|
11
|
-
if (first.length <= max)
|
|
12
|
-
return first;
|
|
13
|
-
return first.slice(0, max - 3) + '...';
|
|
14
|
-
}
|
|
15
|
-
const listCommand = new Command('list')
|
|
16
|
-
.description('List workspace public endpoints')
|
|
17
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
18
|
-
.option('--app <name>', 'Filter by app name or ID')
|
|
19
|
-
.action(async (opts, command) => {
|
|
20
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
21
|
-
const credentials = requireAuth();
|
|
22
|
-
const client = new ApiClient(credentials);
|
|
23
|
-
const { workspaceId, workspaceName } = await resolveWorkspace(client, opts);
|
|
24
|
-
try {
|
|
25
|
-
let endpoints = await client.listEndpoints(workspaceId);
|
|
26
|
-
if (opts.app) {
|
|
27
|
-
endpoints = endpoints.filter(e => e.appId === opts.app || e.appName === opts.app);
|
|
28
|
-
}
|
|
29
|
-
if (useJson) {
|
|
30
|
-
jsonOut({ endpoints });
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (endpoints.length === 0) {
|
|
34
|
-
console.log('No endpoints found in this workspace.');
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
console.log(`\nWorkspace: ${workspaceName || workspaceId}\n`);
|
|
38
|
-
console.log(` ${'METHOD'.padEnd(8)} ${'PATH'.padEnd(36)} ${'APP'.padEnd(20)} ${'AUTH'.padEnd(10)} DESCRIPTION`);
|
|
39
|
-
console.log(' ' + '-'.repeat(90));
|
|
40
|
-
for (const e of endpoints) {
|
|
41
|
-
const method = e.method.toUpperCase().padEnd(8);
|
|
42
|
-
const path = e.endpointPath.padEnd(36);
|
|
43
|
-
const app = (e.appName || e.appId).padEnd(20);
|
|
44
|
-
const auth = (e.auth || '').padEnd(10);
|
|
45
|
-
const desc = truncate(e.description, 40);
|
|
46
|
-
const mode = e.deploymentMode ? ` [${e.deploymentMode}]` : '';
|
|
47
|
-
console.log(` ${method} ${path} ${app} ${auth} ${desc}${mode}`);
|
|
48
|
-
}
|
|
49
|
-
console.log('');
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
console.error('Failed to list endpoints:', err instanceof Error ? err.message : err);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
const callCommand = new Command('call')
|
|
57
|
-
.description('Call a workspace endpoint directly')
|
|
58
|
-
.argument('<method>', 'HTTP method (GET, POST, PUT, DELETE, etc.)')
|
|
59
|
-
.argument('<path>', 'Endpoint path (e.g. /my-endpoint)')
|
|
60
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
61
|
-
.option('--app <name>', 'App name or ID (narrows endpoint lookup)')
|
|
62
|
-
.option('--body <json>', 'Request body as JSON string')
|
|
63
|
-
.option('--header <header>', 'Request header (format: "Key: Value", repeatable)', (val, prev) => [...prev, val], [])
|
|
64
|
-
.option('--query <string>', 'Query string to append to the URL (e.g. "foo=bar&baz=1")')
|
|
65
|
-
.option('--api-key <key>', 'API key for Authorization: Bearer header')
|
|
66
|
-
.action(async (method, path, opts, command) => {
|
|
67
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
68
|
-
const credentials = requireAuth();
|
|
69
|
-
const client = new ApiClient(credentials);
|
|
70
|
-
const { workspaceId, workspaceName } = await resolveWorkspace(client, opts);
|
|
71
|
-
try {
|
|
72
|
-
let endpoints = await client.listEndpoints(workspaceId);
|
|
73
|
-
if (opts.app) {
|
|
74
|
-
endpoints = endpoints.filter(e => e.appId === opts.app || e.appName === opts.app);
|
|
75
|
-
}
|
|
76
|
-
const targetMethod = method.toUpperCase();
|
|
77
|
-
const endpoint = endpoints.find(e => e.method.toUpperCase() === targetMethod && e.endpointPath === path);
|
|
78
|
-
if (!endpoint) {
|
|
79
|
-
console.error(`Endpoint not found: ${targetMethod} ${path}`);
|
|
80
|
-
if (endpoints.length > 0) {
|
|
81
|
-
console.error('\nAvailable endpoints:');
|
|
82
|
-
for (const e of endpoints) {
|
|
83
|
-
console.error(` ${e.method.toUpperCase().padEnd(8)} ${e.endpointPath} (${e.appName || e.appId})`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
console.error('No endpoints registered in this workspace.');
|
|
88
|
-
}
|
|
89
|
-
process.exit(1);
|
|
90
|
-
}
|
|
91
|
-
const appInfo = await client.getApp(endpoint.appId);
|
|
92
|
-
const appSlug = appInfo.slug;
|
|
93
|
-
// Build URL: https://{workspaceName}.runwork.ai/{appSlug}/endpoints{path}
|
|
94
|
-
if (!workspaceName) {
|
|
95
|
-
console.error('Could not determine workspace name. Provide --workspace with a named workspace.');
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
const baseUrl = `https://${workspaceName}.runwork.ai`;
|
|
99
|
-
let url = `${baseUrl}/${appSlug}/endpoints${path}`;
|
|
100
|
-
if (opts.query) {
|
|
101
|
-
url = `${url}?${opts.query}`;
|
|
102
|
-
}
|
|
103
|
-
// Build headers
|
|
104
|
-
const headers = {};
|
|
105
|
-
if (opts.apiKey) {
|
|
106
|
-
headers['Authorization'] = `Bearer ${opts.apiKey}`;
|
|
107
|
-
}
|
|
108
|
-
for (const h of opts.header) {
|
|
109
|
-
const colonIndex = h.indexOf(':');
|
|
110
|
-
if (colonIndex === -1) {
|
|
111
|
-
console.error(`Invalid header format "${h}" — expected "Key: Value"`);
|
|
112
|
-
process.exit(1);
|
|
113
|
-
}
|
|
114
|
-
const key = h.slice(0, colonIndex).trim();
|
|
115
|
-
const value = h.slice(colonIndex + 1).trim();
|
|
116
|
-
headers[key] = value;
|
|
117
|
-
}
|
|
118
|
-
// Parse body
|
|
119
|
-
let body;
|
|
120
|
-
if (opts.body) {
|
|
121
|
-
try {
|
|
122
|
-
// Validate it's valid JSON then re-serialize for consistency
|
|
123
|
-
const parsed = JSON.parse(opts.body);
|
|
124
|
-
body = JSON.stringify(parsed);
|
|
125
|
-
if (!headers['Content-Type']) {
|
|
126
|
-
headers['Content-Type'] = 'application/json';
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
catch {
|
|
130
|
-
console.error('Failed to parse --body as JSON. Provide a valid JSON string.');
|
|
131
|
-
process.exit(1);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (useJson) {
|
|
135
|
-
// Let the caller know what we're calling before making the request
|
|
136
|
-
process.stderr.write(JSON.stringify({ calling: { method: targetMethod, url } }) + '\n');
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
console.log(`\n${targetMethod} ${url}\n`);
|
|
140
|
-
}
|
|
141
|
-
const response = await httpFetch(url, {
|
|
142
|
-
method: targetMethod,
|
|
143
|
-
headers,
|
|
144
|
-
body,
|
|
145
|
-
});
|
|
146
|
-
const contentType = response.headers.get('content-type') || '';
|
|
147
|
-
const responseText = await response.text();
|
|
148
|
-
if (useJson) {
|
|
149
|
-
let responseBody = responseText;
|
|
150
|
-
if (contentType.includes('application/json')) {
|
|
151
|
-
try {
|
|
152
|
-
responseBody = JSON.parse(responseText);
|
|
153
|
-
}
|
|
154
|
-
catch {
|
|
155
|
-
// leave as string
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
jsonOut({
|
|
159
|
-
status: response.status,
|
|
160
|
-
statusText: response.statusText,
|
|
161
|
-
headers: Object.fromEntries(response.headers.entries()),
|
|
162
|
-
body: responseBody,
|
|
163
|
-
});
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
console.log(`Status: ${response.status} ${response.statusText}\n`);
|
|
167
|
-
if (contentType.includes('application/json')) {
|
|
168
|
-
try {
|
|
169
|
-
const parsed = JSON.parse(responseText);
|
|
170
|
-
console.log(JSON.stringify(parsed, null, 2));
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
173
|
-
console.log(responseText);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
console.log(responseText);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch (err) {
|
|
181
|
-
console.error('Failed to call endpoint:', err instanceof Error ? err.message : err);
|
|
182
|
-
process.exit(1);
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
export const endpointsCommand = new Command('endpoints')
|
|
186
|
-
.alias('routes')
|
|
187
|
-
.description('Manage and call workspace endpoints')
|
|
188
|
-
.addCommand(listCommand)
|
|
189
|
-
.addCommand(callCommand);
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { requireAuth } from '../auth/store.js';
|
|
3
|
-
import { ApiClient } from '../api/client.js';
|
|
4
|
-
import { resolveWorkspace } from '../workspace/resolve.js';
|
|
5
|
-
import { shouldOutputJson, jsonOut } from '../utils/output.js';
|
|
6
|
-
import { promptConfirm } from '../utils/prompt.js';
|
|
7
|
-
import { parseDataInput } from '../utils/data-input.js';
|
|
8
|
-
const listCommand = new Command('list')
|
|
9
|
-
.description('List entities registered in the workspace')
|
|
10
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
11
|
-
.option('--app <id>', 'Filter by app name or ID')
|
|
12
|
-
.option('--preview', 'Show preview-mode entities only')
|
|
13
|
-
.action(async (opts, command) => {
|
|
14
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
15
|
-
const credentials = requireAuth();
|
|
16
|
-
const client = new ApiClient(credentials);
|
|
17
|
-
const { workspaceId, workspaceName } = await resolveWorkspace(client, opts);
|
|
18
|
-
try {
|
|
19
|
-
let entities = await client.listEntities(workspaceId);
|
|
20
|
-
if (opts.app) {
|
|
21
|
-
entities = entities.filter(e => e.appId === opts.app || e.appName === opts.app);
|
|
22
|
-
}
|
|
23
|
-
if (opts.preview) {
|
|
24
|
-
entities = entities.filter(e => e.deploymentMode === 'preview');
|
|
25
|
-
}
|
|
26
|
-
if (useJson) {
|
|
27
|
-
jsonOut({ entities });
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (entities.length === 0) {
|
|
31
|
-
console.log('No entities found in this workspace.');
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
console.log(`\nWorkspace: ${workspaceName || workspaceId}\n`);
|
|
35
|
-
console.log(` ${'Entity'.padEnd(28)} ${'App'.padEnd(24)} ${'Mode'.padEnd(12)}`);
|
|
36
|
-
console.log(' ' + '-'.repeat(66));
|
|
37
|
-
for (const e of entities) {
|
|
38
|
-
console.log(` ${e.entityName.padEnd(28)} ${e.appName.padEnd(24)} ${(e.deploymentMode ?? '').padEnd(12)}`);
|
|
39
|
-
}
|
|
40
|
-
console.log('');
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
console.error('Failed to list entities:', err instanceof Error ? err.message : err);
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
const recordsCommand = new Command('records')
|
|
48
|
-
.description('List records for an entity')
|
|
49
|
-
.argument('<entity>', 'Entity name')
|
|
50
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
51
|
-
.option('--limit <n>', 'Number of records to return', '20')
|
|
52
|
-
.option('--cursor <cursor>', 'Pagination cursor')
|
|
53
|
-
.option('--preview', 'Query preview-mode data')
|
|
54
|
-
.action(async (entity, opts, command) => {
|
|
55
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
56
|
-
const credentials = requireAuth();
|
|
57
|
-
const client = new ApiClient(credentials);
|
|
58
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
59
|
-
try {
|
|
60
|
-
const result = await client.listEntityRecords(workspaceId, entity, {
|
|
61
|
-
limit: parseInt(opts.limit, 10),
|
|
62
|
-
cursor: opts.cursor,
|
|
63
|
-
deploymentMode: opts.preview ? 'preview' : undefined,
|
|
64
|
-
});
|
|
65
|
-
if (useJson) {
|
|
66
|
-
jsonOut(result);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (result.items.length === 0) {
|
|
70
|
-
console.log(`No records found for entity "${entity}".`);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
console.log(`\nEntity: ${entity} (${result.items.length} record(s))\n`);
|
|
74
|
-
console.log(JSON.stringify(result.items, null, 2));
|
|
75
|
-
if (result.next) {
|
|
76
|
-
console.log(`\nNext cursor: ${result.next}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
console.error('Failed to list entity records:', err instanceof Error ? err.message : err);
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
const getCommand = new Command('get')
|
|
85
|
-
.description('Get a single entity record by ID')
|
|
86
|
-
.argument('<entity>', 'Entity name')
|
|
87
|
-
.argument('<id>', 'Record ID')
|
|
88
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
89
|
-
.action(async (entity, id, opts, command) => {
|
|
90
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
91
|
-
const credentials = requireAuth();
|
|
92
|
-
const client = new ApiClient(credentials);
|
|
93
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
94
|
-
try {
|
|
95
|
-
const result = await client.getEntityRecord(workspaceId, entity, id);
|
|
96
|
-
if (useJson) {
|
|
97
|
-
jsonOut(result);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
console.log(JSON.stringify(result.item, null, 2));
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
console.error('Failed to get entity record:', err instanceof Error ? err.message : err);
|
|
104
|
-
process.exit(1);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
const createCommand = new Command('create')
|
|
108
|
-
.description('Create a new entity record')
|
|
109
|
-
.argument('<entity>', 'Entity name')
|
|
110
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
111
|
-
.option('--data <json>', 'Record data as JSON string, @file.json, or pipe via stdin')
|
|
112
|
-
.option('--preview', 'Create in preview-mode data store')
|
|
113
|
-
.action(async (entity, opts, command) => {
|
|
114
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
115
|
-
const credentials = requireAuth();
|
|
116
|
-
const client = new ApiClient(credentials);
|
|
117
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
118
|
-
try {
|
|
119
|
-
const data = await parseDataInput(opts.data);
|
|
120
|
-
const result = await client.createEntityRecord(workspaceId, entity, data);
|
|
121
|
-
if (useJson) {
|
|
122
|
-
jsonOut(result);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
console.log('Record created:');
|
|
126
|
-
console.log(JSON.stringify(result.item, null, 2));
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
console.error('Failed to create entity record:', err instanceof Error ? err.message : err);
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
const updateCommand = new Command('update')
|
|
134
|
-
.description('Update an existing entity record')
|
|
135
|
-
.argument('<entity>', 'Entity name')
|
|
136
|
-
.argument('<id>', 'Record ID')
|
|
137
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
138
|
-
.option('--data <json>', 'Record data as JSON string, @file.json, or pipe via stdin')
|
|
139
|
-
.action(async (entity, id, opts, command) => {
|
|
140
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
141
|
-
const credentials = requireAuth();
|
|
142
|
-
const client = new ApiClient(credentials);
|
|
143
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
144
|
-
try {
|
|
145
|
-
const data = await parseDataInput(opts.data);
|
|
146
|
-
const result = await client.updateEntityRecord(workspaceId, entity, id, data);
|
|
147
|
-
if (useJson) {
|
|
148
|
-
jsonOut(result);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
console.log('Record updated:');
|
|
152
|
-
console.log(JSON.stringify(result.item, null, 2));
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
console.error('Failed to update entity record:', err instanceof Error ? err.message : err);
|
|
156
|
-
process.exit(1);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
const deleteCommand = new Command('delete')
|
|
160
|
-
.description('Delete an entity record')
|
|
161
|
-
.argument('<entity>', 'Entity name')
|
|
162
|
-
.argument('<id>', 'Record ID')
|
|
163
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
164
|
-
.option('--yes', 'Skip confirmation prompt')
|
|
165
|
-
.action(async (entity, id, opts, command) => {
|
|
166
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
167
|
-
const credentials = requireAuth();
|
|
168
|
-
const client = new ApiClient(credentials);
|
|
169
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
170
|
-
try {
|
|
171
|
-
if (!opts.yes) {
|
|
172
|
-
const confirmed = await promptConfirm(`Delete record "${id}" from entity "${entity}"? This cannot be undone.`);
|
|
173
|
-
if (!confirmed) {
|
|
174
|
-
console.log('Cancelled.');
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
const result = await client.deleteEntityRecord(workspaceId, entity, id);
|
|
179
|
-
if (useJson) {
|
|
180
|
-
jsonOut(result);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
console.log(`Record "${id}" deleted from entity "${entity}".`);
|
|
184
|
-
}
|
|
185
|
-
catch (err) {
|
|
186
|
-
console.error('Failed to delete entity record:', err instanceof Error ? err.message : err);
|
|
187
|
-
process.exit(1);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
export const entitiesCommand = new Command('entities')
|
|
191
|
-
.alias('data')
|
|
192
|
-
.description('Manage workspace entity data')
|
|
193
|
-
.addCommand(listCommand)
|
|
194
|
-
.addCommand(recordsCommand)
|
|
195
|
-
.addCommand(getCommand)
|
|
196
|
-
.addCommand(createCommand)
|
|
197
|
-
.addCommand(updateCommand)
|
|
198
|
-
.addCommand(deleteCommand);
|
package/dist/commands/files.d.ts
DELETED