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/health/checks.js
DELETED
|
@@ -1,636 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from '../utils/subprocess.js';
|
|
2
|
-
import { existsSync, readFileSync } from 'fs';
|
|
3
|
-
import { join, sep } from 'path';
|
|
4
|
-
import { homedir, platform as osPlatform, arch as osArch } from 'os';
|
|
5
|
-
import { VERSION } from '../generated/version.js';
|
|
6
|
-
import { getCredentials } from '../auth/store.js';
|
|
7
|
-
import { ApiClient } from '../api/client.js';
|
|
8
|
-
import { detectAgents, getAdapterBySlug } from '../agents/detect.js';
|
|
9
|
-
import { httpFetch } from '../utils/http.js';
|
|
10
|
-
import { probeGit, parseGitVersion } from '../git/preflight.js';
|
|
11
|
-
import { lookupCredentialHelper, helperBinaryStatus } from '../git/credentials.js';
|
|
12
|
-
import { getDeploySummary } from '../deploy/deploy-state.js';
|
|
13
|
-
// First-party distribution endpoints. Defaults match the plan, can be
|
|
14
|
-
// overridden via RUNWORK_DOWNLOAD_BASE_URL for staging or debugging.
|
|
15
|
-
const BASE_URL = process.env.RUNWORK_DOWNLOAD_BASE_URL || 'https://runwork.ai';
|
|
16
|
-
const LATEST_JSON_URL = `${BASE_URL}/cli/latest.json`;
|
|
17
|
-
function detectPlatform() {
|
|
18
|
-
const rawOs = osPlatform();
|
|
19
|
-
const rawArch = osArch();
|
|
20
|
-
const os = rawOs === 'darwin' ? 'darwin' : rawOs === 'linux' ? 'linux' : rawOs === 'win32' ? 'windows' : null;
|
|
21
|
-
const arch = rawArch === 'x64' ? 'x64' : rawArch === 'arm64' ? 'arm64' : null;
|
|
22
|
-
return {
|
|
23
|
-
os,
|
|
24
|
-
arch,
|
|
25
|
-
key: os && arch ? `${os}-${arch}` : null,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
async function fetchReleaseManifest() {
|
|
29
|
-
try {
|
|
30
|
-
const response = await httpFetch(LATEST_JSON_URL, { cache: 'no-store' });
|
|
31
|
-
if (!response.ok)
|
|
32
|
-
return null;
|
|
33
|
-
return await response.json();
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export function buildContext() {
|
|
40
|
-
const credentials = getCredentials();
|
|
41
|
-
const client = credentials ? new ApiClient(credentials) : null;
|
|
42
|
-
let config = null;
|
|
43
|
-
const configPath = join(process.cwd(), '.runwork.json');
|
|
44
|
-
if (existsSync(configPath)) {
|
|
45
|
-
try {
|
|
46
|
-
config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
// will be reported as a failure in checkProjectConfig
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return { credentials, client, config, cwd: process.cwd() };
|
|
53
|
-
}
|
|
54
|
-
// ── 1. System dependencies ───────────────────────────────────────────
|
|
55
|
-
export async function checkSystemDeps() {
|
|
56
|
-
// Delegate to probeGit() so doctor agrees with the preflight gate used by
|
|
57
|
-
// `runwork clone`/`init`/`dev`. probeGit also has Windows fallback paths
|
|
58
|
-
// (`where.exe`, canonical install dirs) that the previous bare execFileSync
|
|
59
|
-
// missed when Bun's standalone-binary spawn lookup failed despite git
|
|
60
|
-
// being installed.
|
|
61
|
-
const probe = probeGit();
|
|
62
|
-
if (!probe.installed) {
|
|
63
|
-
const detail = probe.error?.message ? ` (${probe.error.message})` : '';
|
|
64
|
-
return {
|
|
65
|
-
name: 'system-deps',
|
|
66
|
-
status: 'fail',
|
|
67
|
-
message: `git not found in PATH${detail}`,
|
|
68
|
-
fix: 'Install git: https://git-scm.com/downloads',
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
const version = parseGitVersion(probe.version) ?? 'unknown';
|
|
72
|
-
// Show how we found it on Windows fallback paths so the user can see
|
|
73
|
-
// whether their PATH is wired up or we needed a rescue.
|
|
74
|
-
const sourceSuffix = probe.source === 'where' ? ` (resolved via where.exe at ${probe.path})`
|
|
75
|
-
: probe.source === 'registry' ? ` (resolved via Git for Windows registry at ${probe.path})`
|
|
76
|
-
: probe.source === 'canonical' ? ` (resolved via canonical install path ${probe.path})`
|
|
77
|
-
: '';
|
|
78
|
-
if (version !== 'unknown') {
|
|
79
|
-
const [major, minor] = version.split('.').map(Number);
|
|
80
|
-
if (major < 2 || (major === 2 && minor < 20)) {
|
|
81
|
-
return {
|
|
82
|
-
name: 'system-deps',
|
|
83
|
-
status: 'warn',
|
|
84
|
-
message: `git ${version} (old -- consider upgrading)${sourceSuffix}`,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return { name: 'system-deps', status: 'pass', message: `git ${version}${sourceSuffix}` };
|
|
89
|
-
}
|
|
90
|
-
// ── 2. CLI version ───────────────────────────────────────────────────
|
|
91
|
-
export async function checkCliVersion() {
|
|
92
|
-
const manifest = await fetchReleaseManifest();
|
|
93
|
-
if (!manifest) {
|
|
94
|
-
return {
|
|
95
|
-
name: 'cli-version',
|
|
96
|
-
status: 'skip',
|
|
97
|
-
message: `${VERSION} (${LATEST_JSON_URL} unreachable)`,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const latest = manifest.version?.replace(/^v/, '') || null;
|
|
101
|
-
if (!latest) {
|
|
102
|
-
return { name: 'cli-version', status: 'skip', message: `${VERSION} (could not parse latest)` };
|
|
103
|
-
}
|
|
104
|
-
if (latest === VERSION) {
|
|
105
|
-
return { name: 'cli-version', status: 'pass', message: `${VERSION} (latest)` };
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
name: 'cli-version',
|
|
109
|
-
status: 'warn',
|
|
110
|
-
message: `${VERSION} (${latest} available)`,
|
|
111
|
-
fix: 'runwork upgrade',
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
// ── 2a. CLI artifact reachability for this host ──────────────────────
|
|
115
|
-
export async function checkCliArtifactReachable() {
|
|
116
|
-
const platform = detectPlatform();
|
|
117
|
-
if (!platform.key) {
|
|
118
|
-
return {
|
|
119
|
-
name: 'cli-artifact',
|
|
120
|
-
status: 'skip',
|
|
121
|
-
message: `unsupported host (${osPlatform()}/${osArch()})`,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
const manifest = await fetchReleaseManifest();
|
|
125
|
-
if (!manifest) {
|
|
126
|
-
return {
|
|
127
|
-
name: 'cli-artifact',
|
|
128
|
-
status: 'fail',
|
|
129
|
-
message: `${LATEST_JSON_URL} unreachable`,
|
|
130
|
-
fix: 'check network / outbound access to runwork.ai',
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
const entry = manifest.artifacts?.[platform.key];
|
|
134
|
-
if (!entry?.path) {
|
|
135
|
-
return {
|
|
136
|
-
name: 'cli-artifact',
|
|
137
|
-
status: 'fail',
|
|
138
|
-
message: `manifest has no artifact for ${platform.key}`,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
const artifactUrl = `${BASE_URL}${entry.path}`;
|
|
142
|
-
try {
|
|
143
|
-
const response = await httpFetch(artifactUrl, { method: 'HEAD' });
|
|
144
|
-
if (!response.ok) {
|
|
145
|
-
return {
|
|
146
|
-
name: 'cli-artifact',
|
|
147
|
-
status: 'fail',
|
|
148
|
-
message: `${artifactUrl} returned HTTP ${response.status}`,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
return { name: 'cli-artifact', status: 'pass', message: `${platform.key} reachable` };
|
|
152
|
-
}
|
|
153
|
-
catch (err) {
|
|
154
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
155
|
-
return {
|
|
156
|
-
name: 'cli-artifact',
|
|
157
|
-
status: 'fail',
|
|
158
|
-
message: `${artifactUrl} unreachable: ${msg}`,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
// ── 2b. Canonical install location ───────────────────────────────────
|
|
163
|
-
export async function checkCliInstallLocation() {
|
|
164
|
-
const isWindows = osPlatform() === 'win32';
|
|
165
|
-
const home = homedir();
|
|
166
|
-
const canonicalDir = join(home, '.runwork', 'bin');
|
|
167
|
-
const canonicalBinary = isWindows
|
|
168
|
-
? join(canonicalDir, 'runwork.exe')
|
|
169
|
-
: join(canonicalDir, 'runwork');
|
|
170
|
-
// process.execPath points at the running binary in a compiled bun binary;
|
|
171
|
-
// in npm/node mode it points at node, so also consider argv[1].
|
|
172
|
-
const candidates = [process.execPath, process.argv[1] || ''].filter(Boolean);
|
|
173
|
-
const runsFromCanonical = candidates.some((p) => normalizePath(p) === normalizePath(canonicalBinary));
|
|
174
|
-
if (runsFromCanonical) {
|
|
175
|
-
return {
|
|
176
|
-
name: 'cli-install-location',
|
|
177
|
-
status: 'pass',
|
|
178
|
-
message: `canonical (${canonicalBinary})`,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
// Second best: canonical binary exists but the user is running a different copy.
|
|
182
|
-
if (existsSync(canonicalBinary)) {
|
|
183
|
-
return {
|
|
184
|
-
name: 'cli-install-location',
|
|
185
|
-
status: 'warn',
|
|
186
|
-
message: `running from ${candidates[0] || '(unknown)'}, canonical binary also exists at ${canonicalBinary}`,
|
|
187
|
-
fix: `use the canonical binary by ensuring ${canonicalDir} comes first on PATH, or uninstall the duplicate`,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
// Third case: no canonical binary. That is normal for a system-managed install (brew, npm, etc).
|
|
191
|
-
return {
|
|
192
|
-
name: 'cli-install-location',
|
|
193
|
-
status: 'warn',
|
|
194
|
-
message: `not at canonical location (running from ${candidates[0] || '(unknown)'})`,
|
|
195
|
-
fix: `reinstall with the first-party installer to unify with the desktop app: curl -fsSL ${BASE_URL}/install.sh | sh`,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function normalizePath(p) {
|
|
199
|
-
// Collapse trailing separators and case-normalise on Windows.
|
|
200
|
-
const trimmed = p.replace(new RegExp(`[${sep === '\\' ? '\\\\' : sep}]+$`), '');
|
|
201
|
-
return osPlatform() === 'win32' ? trimmed.toLowerCase() : trimmed;
|
|
202
|
-
}
|
|
203
|
-
// ── 3 & 4. Authentication + Network (combined) ──────────────────────
|
|
204
|
-
export async function checkAuthAndNetwork(ctx) {
|
|
205
|
-
if (!ctx.credentials) {
|
|
206
|
-
return {
|
|
207
|
-
auth: { name: 'auth', status: 'fail', message: 'not logged in', fix: 'runwork login' },
|
|
208
|
-
network: { name: 'network', status: 'skip', message: 'skipped (no credentials)' },
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
const start = Date.now();
|
|
212
|
-
try {
|
|
213
|
-
const workspaces = await ctx.client.listWorkspaces();
|
|
214
|
-
const elapsed = Date.now() - start;
|
|
215
|
-
const email = ctx.credentials.email || 'authenticated';
|
|
216
|
-
const wsCount = workspaces.length;
|
|
217
|
-
const auth = {
|
|
218
|
-
name: 'auth',
|
|
219
|
-
status: 'pass',
|
|
220
|
-
message: `${email} (${wsCount} workspace${wsCount !== 1 ? 's' : ''})`,
|
|
221
|
-
};
|
|
222
|
-
const network = elapsed > 3000
|
|
223
|
-
? { name: 'network', status: 'warn', message: `API reachable (${elapsed}ms -- slow)` }
|
|
224
|
-
: { name: 'network', status: 'pass', message: `API reachable (${elapsed}ms)` };
|
|
225
|
-
return { auth, network };
|
|
226
|
-
}
|
|
227
|
-
catch (err) {
|
|
228
|
-
const elapsed = Date.now() - start;
|
|
229
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
230
|
-
// Distinguish auth error from network error
|
|
231
|
-
if (message.includes('401') || message.includes('403') || message.includes('Unauthorized')) {
|
|
232
|
-
return {
|
|
233
|
-
auth: { name: 'auth', status: 'fail', message: 'token rejected by server', fix: 'runwork login' },
|
|
234
|
-
network: { name: 'network', status: 'pass', message: `API reachable (${elapsed}ms)` },
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
return {
|
|
238
|
-
auth: { name: 'auth', status: 'skip', message: 'could not verify (network error)' },
|
|
239
|
-
network: { name: 'network', status: 'fail', message: `API unreachable: ${message}` },
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
// ── 4a. Git credential helper registration ──────────────────────────
|
|
244
|
-
/**
|
|
245
|
-
* Verify that git's credential helper for the runwork origin is registered
|
|
246
|
-
* and that the binary it points at exists on disk. Catches the very common
|
|
247
|
-
* "logged in with an older CLI before configureGitCredentials shipped"
|
|
248
|
-
* state, where the user has credentials but git falls back to the system
|
|
249
|
-
* credential manager (Git Credential Manager popup on Windows, etc.) when
|
|
250
|
-
* trying to clone or push -- producing confusing UX with no obvious fix.
|
|
251
|
-
*
|
|
252
|
-
* The check is scoped to the *user's* logged-in baseUrl when available, so
|
|
253
|
-
* it doesn't false-fail on staging deployments that point at a different
|
|
254
|
-
* origin.
|
|
255
|
-
*/
|
|
256
|
-
export async function checkGitCredentialHelper(ctx) {
|
|
257
|
-
if (!ctx.credentials) {
|
|
258
|
-
return {
|
|
259
|
-
name: 'git-credential-helper',
|
|
260
|
-
status: 'skip',
|
|
261
|
-
message: 'skipped (not logged in)',
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
// Make sure git itself is callable before we try to read its config --
|
|
265
|
-
// probeGit() prepends the resolved git directory to PATH for us when it
|
|
266
|
-
// resolves via fallback, so this also smooths the way for the
|
|
267
|
-
// execFileSync('git', ...) call below.
|
|
268
|
-
const git = probeGit();
|
|
269
|
-
if (!git.installed) {
|
|
270
|
-
return {
|
|
271
|
-
name: 'git-credential-helper',
|
|
272
|
-
status: 'skip',
|
|
273
|
-
message: 'skipped (git not installed)',
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
let origin;
|
|
277
|
-
try {
|
|
278
|
-
origin = new URL(ctx.credentials.baseUrl).origin;
|
|
279
|
-
}
|
|
280
|
-
catch {
|
|
281
|
-
return {
|
|
282
|
-
name: 'git-credential-helper',
|
|
283
|
-
status: 'fail',
|
|
284
|
-
message: `cannot parse baseUrl from credentials: ${ctx.credentials.baseUrl}`,
|
|
285
|
-
fix: 'runwork login',
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
// The scoped lookup (get-regexp + origin match) is shared with the
|
|
289
|
-
// lazy-ensure path in git/credentials.ts so the two can't drift. We only
|
|
290
|
-
// need to map its result onto doctor's richer status messages here.
|
|
291
|
-
const lookup = lookupCredentialHelper(origin);
|
|
292
|
-
if (lookup.status === 'none') {
|
|
293
|
-
return {
|
|
294
|
-
name: 'git-credential-helper',
|
|
295
|
-
status: 'fail',
|
|
296
|
-
message: `no credential helper registered for ${origin}`,
|
|
297
|
-
fix: 'runwork doctor --fix',
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
if (lookup.status === 'unscoped') {
|
|
301
|
-
return {
|
|
302
|
-
name: 'git-credential-helper',
|
|
303
|
-
status: 'fail',
|
|
304
|
-
message: `no credential helper registered for ${origin} (found ${lookup.otherCount} other runwork helper entries)`,
|
|
305
|
-
fix: 'runwork doctor --fix',
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
// Helper values starting with `!` are shell commands. Common shapes:
|
|
309
|
-
// `!runwork git-credential-helper` (PATH-relative)
|
|
310
|
-
// `!"/abs/path/to/runwork" git-credential-helper` (post-Pass-2 hardening, POSIX)
|
|
311
|
-
// `!"C:/.../runwork.exe" git-credential-helper` (post-Pass-2 hardening, Windows)
|
|
312
|
-
// helperBinaryStatus() validates only absolute-path entries on disk; it
|
|
313
|
-
// trusts PATH-relative entries to resolve at git-invocation time.
|
|
314
|
-
const binary = helperBinaryStatus(lookup.value);
|
|
315
|
-
if (!binary.ok && binary.path) {
|
|
316
|
-
return {
|
|
317
|
-
name: 'git-credential-helper',
|
|
318
|
-
status: 'fail',
|
|
319
|
-
message: `helper registered but binary not found at ${binary.path}`,
|
|
320
|
-
fix: 'runwork doctor --fix (re-registers with the current binary path)',
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
return {
|
|
324
|
-
name: 'git-credential-helper',
|
|
325
|
-
status: 'pass',
|
|
326
|
-
message: `registered for ${origin}`,
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
// ── 5. Project config ────────────────────────────────────────────────
|
|
330
|
-
export async function checkProjectConfig(ctx) {
|
|
331
|
-
const configPath = join(ctx.cwd, '.runwork.json');
|
|
332
|
-
if (!existsSync(configPath)) {
|
|
333
|
-
// Outside project dir -- check default workspace
|
|
334
|
-
if (!ctx.credentials) {
|
|
335
|
-
return { name: 'project-config', status: 'skip', message: 'no project (not logged in)' };
|
|
336
|
-
}
|
|
337
|
-
if (ctx.credentials.defaultWorkspaceId) {
|
|
338
|
-
const wsName = ctx.credentials.defaultWorkspaceName || ctx.credentials.defaultWorkspaceId;
|
|
339
|
-
return { name: 'project-config', status: 'pass', message: `no project dir (default workspace: ${wsName})` };
|
|
340
|
-
}
|
|
341
|
-
return {
|
|
342
|
-
name: 'project-config',
|
|
343
|
-
status: 'warn',
|
|
344
|
-
message: 'no project dir, no default workspace',
|
|
345
|
-
fix: 'runwork init <name> or runwork clone <app>',
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
// Inside project dir
|
|
349
|
-
if (!ctx.config) {
|
|
350
|
-
return {
|
|
351
|
-
name: 'project-config',
|
|
352
|
-
status: 'fail',
|
|
353
|
-
message: '.runwork.json is malformed',
|
|
354
|
-
fix: 'delete and re-run runwork init or runwork clone',
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
if (!ctx.config.workspaceId || !ctx.config.appId) {
|
|
358
|
-
return {
|
|
359
|
-
name: 'project-config',
|
|
360
|
-
status: 'fail',
|
|
361
|
-
message: '.runwork.json missing workspaceId or appId',
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
const wsName = ctx.config.workspaceName || ctx.config.workspaceId;
|
|
365
|
-
const appName = ctx.config.appName || ctx.config.appId;
|
|
366
|
-
return { name: 'project-config', status: 'pass', message: `${appName} (ws: ${wsName})` };
|
|
367
|
-
}
|
|
368
|
-
// ── 6. App exists on server ──────────────────────────────────────────
|
|
369
|
-
export async function checkAppExists(ctx) {
|
|
370
|
-
if (!ctx.config?.appId || !ctx.client) {
|
|
371
|
-
return { name: 'app-exists', status: 'skip', message: 'skipped (no project or no auth)' };
|
|
372
|
-
}
|
|
373
|
-
try {
|
|
374
|
-
const app = await ctx.client.getApp(ctx.config.appId);
|
|
375
|
-
if (app) {
|
|
376
|
-
return { name: 'app-exists', status: 'pass', message: 'confirmed on server' };
|
|
377
|
-
}
|
|
378
|
-
return {
|
|
379
|
-
name: 'app-exists',
|
|
380
|
-
status: 'fail',
|
|
381
|
-
message: `app ${ctx.config.appId} not found on server`,
|
|
382
|
-
fix: 'app may have been deleted -- re-create with runwork init',
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
catch {
|
|
386
|
-
return {
|
|
387
|
-
name: 'app-exists',
|
|
388
|
-
status: 'fail',
|
|
389
|
-
message: `app ${ctx.config.appId} not found on server`,
|
|
390
|
-
fix: 'app may have been deleted -- re-create with runwork init',
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
// ── 7. Git remote ────────────────────────────────────────────────────
|
|
395
|
-
export async function checkGitRemote(ctx) {
|
|
396
|
-
if (!ctx.config) {
|
|
397
|
-
return { name: 'git-remote', status: 'skip', message: 'skipped (no project)' };
|
|
398
|
-
}
|
|
399
|
-
// Check if we're in a git repo
|
|
400
|
-
if (!existsSync(join(ctx.cwd, '.git'))) {
|
|
401
|
-
return {
|
|
402
|
-
name: 'git-remote',
|
|
403
|
-
status: 'fail',
|
|
404
|
-
message: 'not a git repository',
|
|
405
|
-
fix: 'git init',
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
try {
|
|
409
|
-
const remoteUrl = execFileSync('git', ['remote', 'get-url', 'runwork'], {
|
|
410
|
-
cwd: ctx.cwd,
|
|
411
|
-
stdio: 'pipe',
|
|
412
|
-
}).toString().trim();
|
|
413
|
-
// Check if URL looks right (should contain workspace and app IDs)
|
|
414
|
-
if (ctx.config.workspaceId && !remoteUrl.includes(ctx.config.workspaceId)) {
|
|
415
|
-
return {
|
|
416
|
-
name: 'git-remote',
|
|
417
|
-
status: 'warn',
|
|
418
|
-
message: `remote "runwork" URL may be stale: ${remoteUrl}`,
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
return { name: 'git-remote', status: 'pass', message: `remote configured` };
|
|
422
|
-
}
|
|
423
|
-
catch {
|
|
424
|
-
const baseUrl = ctx.credentials?.baseUrl || 'https://runwork.ai';
|
|
425
|
-
const expectedUrl = `${baseUrl}/git/${ctx.config.workspaceId}/${ctx.config.appId}`;
|
|
426
|
-
return {
|
|
427
|
-
name: 'git-remote',
|
|
428
|
-
status: 'fail',
|
|
429
|
-
message: 'remote "runwork" not configured',
|
|
430
|
-
fix: `runwork doctor --fix (or: git remote add runwork ${expectedUrl})`,
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
// ── 7a. Deploy freshness ─────────────────────────────────────────────
|
|
435
|
-
/**
|
|
436
|
-
* Compare the current local HEAD against the last deploy recorded from this
|
|
437
|
-
* machine (`.runwork/last-deploy.json`). Surfaces "you have undeployed
|
|
438
|
-
* commits" so a deploy can be verified at a glance (friction log #8). Silent
|
|
439
|
-
* (skip) outside a project or before the first local deploy.
|
|
440
|
-
*/
|
|
441
|
-
export async function checkDeployFreshness(ctx) {
|
|
442
|
-
if (!ctx.config) {
|
|
443
|
-
return { name: 'deploy-freshness', status: 'skip', message: 'skipped (no project)' };
|
|
444
|
-
}
|
|
445
|
-
const summary = getDeploySummary(ctx.cwd);
|
|
446
|
-
if (!summary.deployedShortSha) {
|
|
447
|
-
return { name: 'deploy-freshness', status: 'skip', message: 'no deploy recorded from this machine' };
|
|
448
|
-
}
|
|
449
|
-
if (summary.inSync === true) {
|
|
450
|
-
return { name: 'deploy-freshness', status: 'pass', message: `local HEAD matches last deploy (${summary.deployedShortSha})` };
|
|
451
|
-
}
|
|
452
|
-
if (summary.inSync === false) {
|
|
453
|
-
return {
|
|
454
|
-
name: 'deploy-freshness',
|
|
455
|
-
status: 'warn',
|
|
456
|
-
message: `local (${summary.localShortSha}) has commits not in the last deploy (${summary.deployedShortSha})`,
|
|
457
|
-
fix: 'runwork deploy',
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
return { name: 'deploy-freshness', status: 'skip', message: 'local HEAD unknown' };
|
|
461
|
-
}
|
|
462
|
-
// ── 8. Agent setup ───────────────────────────────────────────────────
|
|
463
|
-
function loadSetupState() {
|
|
464
|
-
// Try project-level first, then user-level
|
|
465
|
-
const projectPath = join(process.cwd(), '.runwork', 'setup.json');
|
|
466
|
-
const userPath = join(homedir(), '.runwork', 'setup.json');
|
|
467
|
-
for (const p of [projectPath, userPath]) {
|
|
468
|
-
if (existsSync(p)) {
|
|
469
|
-
try {
|
|
470
|
-
return JSON.parse(readFileSync(p, 'utf-8'));
|
|
471
|
-
}
|
|
472
|
-
catch {
|
|
473
|
-
continue;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
return null;
|
|
478
|
-
}
|
|
479
|
-
export async function checkAgentSetup() {
|
|
480
|
-
const state = loadSetupState();
|
|
481
|
-
if (!state) {
|
|
482
|
-
return {
|
|
483
|
-
name: 'agent-setup',
|
|
484
|
-
status: 'fail',
|
|
485
|
-
message: 'setup has never been run',
|
|
486
|
-
fix: 'runwork setup',
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
const details = [];
|
|
490
|
-
let worstStatus = 'pass';
|
|
491
|
-
const upgrade = (s) => {
|
|
492
|
-
if (s === 'fail' || (s === 'warn' && worstStatus === 'pass'))
|
|
493
|
-
worstStatus = s;
|
|
494
|
-
};
|
|
495
|
-
// Sub-check: sync freshness
|
|
496
|
-
const syncAge = Date.now() - new Date(state.lastSyncAt).getTime();
|
|
497
|
-
const syncDays = Math.floor(syncAge / (1000 * 60 * 60 * 24));
|
|
498
|
-
if (syncDays > 30) {
|
|
499
|
-
details.push(`last synced ${syncDays} days ago (stale)`);
|
|
500
|
-
upgrade('fail');
|
|
501
|
-
}
|
|
502
|
-
else if (syncDays > 7) {
|
|
503
|
-
details.push(`last synced ${syncDays} days ago`);
|
|
504
|
-
upgrade('warn');
|
|
505
|
-
}
|
|
506
|
-
else {
|
|
507
|
-
details.push(`last synced ${syncDays === 0 ? 'today' : `${syncDays}d ago`}`);
|
|
508
|
-
}
|
|
509
|
-
// Sub-check: configured agents still detected
|
|
510
|
-
const detected = await detectAgents();
|
|
511
|
-
const detectedSlugs = new Set(detected.map(a => a.slug));
|
|
512
|
-
const missingAgents = state.configuredAgents.filter(s => !detectedSlugs.has(s));
|
|
513
|
-
if (missingAgents.length > 0) {
|
|
514
|
-
details.push(`${missingAgents.length} agent(s) no longer detected: ${missingAgents.join(', ')}`);
|
|
515
|
-
upgrade('warn');
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
details.push(`${state.configuredAgents.length} agent(s) configured`);
|
|
519
|
-
}
|
|
520
|
-
// Sub-check: MCP servers present in agent configs
|
|
521
|
-
// We check the first configured agent that supports MCP
|
|
522
|
-
let mcpChecked = false;
|
|
523
|
-
for (const slug of state.configuredAgents) {
|
|
524
|
-
const adapter = getAdapterBySlug(slug);
|
|
525
|
-
if (!adapter || !adapter.supportsMcpScope('user'))
|
|
526
|
-
continue;
|
|
527
|
-
// Check if MCP config file exists and contains our entries
|
|
528
|
-
const mcpConfigPath = getMcpConfigPath(slug, 'user');
|
|
529
|
-
if (mcpConfigPath && existsSync(mcpConfigPath)) {
|
|
530
|
-
try {
|
|
531
|
-
const content = readFileSync(mcpConfigPath, 'utf-8');
|
|
532
|
-
const missingMcp = state.mcpServers.filter(name => !content.includes(name));
|
|
533
|
-
if (missingMcp.length > 0) {
|
|
534
|
-
details.push(`${missingMcp.length} MCP server(s) missing from ${slug} config`);
|
|
535
|
-
upgrade('warn');
|
|
536
|
-
}
|
|
537
|
-
else {
|
|
538
|
-
details.push(`${state.mcpServers.length} MCP server(s) configured`);
|
|
539
|
-
}
|
|
540
|
-
mcpChecked = true;
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
catch {
|
|
544
|
-
// can't read config, skip
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
if (!mcpChecked && state.mcpServers.length > 0) {
|
|
549
|
-
details.push('could not verify MCP servers');
|
|
550
|
-
upgrade('warn');
|
|
551
|
-
}
|
|
552
|
-
// Sub-check: skills present
|
|
553
|
-
let skillsChecked = false;
|
|
554
|
-
for (const slug of state.configuredAgents) {
|
|
555
|
-
const skillsDir = getSkillsDir(slug, 'user');
|
|
556
|
-
if (!skillsDir)
|
|
557
|
-
continue;
|
|
558
|
-
const missingSkills = state.skills.filter(name => {
|
|
559
|
-
const skillPath = join(skillsDir, name, 'SKILL.md');
|
|
560
|
-
return !existsSync(skillPath);
|
|
561
|
-
});
|
|
562
|
-
if (missingSkills.length > 0) {
|
|
563
|
-
details.push(`${missingSkills.length} skill(s) missing from ${slug}`);
|
|
564
|
-
upgrade('warn');
|
|
565
|
-
}
|
|
566
|
-
else if (state.skills.length > 0) {
|
|
567
|
-
details.push(`${state.skills.length} skill(s) installed`);
|
|
568
|
-
}
|
|
569
|
-
skillsChecked = true;
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
if (!skillsChecked && state.skills.length > 0) {
|
|
573
|
-
details.push('could not verify skills');
|
|
574
|
-
upgrade('warn');
|
|
575
|
-
}
|
|
576
|
-
// Build summary message
|
|
577
|
-
const summary = worstStatus === 'pass'
|
|
578
|
-
? details[0]
|
|
579
|
-
: details.filter(d => !d.startsWith(`${state.configuredAgents.length} agent`) &&
|
|
580
|
-
!d.startsWith(`${state.mcpServers.length} MCP`) &&
|
|
581
|
-
!d.startsWith(`${state.skills.length} skill`)).join('; ') || details[0];
|
|
582
|
-
return {
|
|
583
|
-
name: 'agent-setup',
|
|
584
|
-
status: worstStatus,
|
|
585
|
-
message: summary,
|
|
586
|
-
details,
|
|
587
|
-
...(worstStatus !== 'pass' ? { fix: 'runwork sync' } : {}),
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
// ── Helpers for agent config paths ───────────────────────────────────
|
|
591
|
-
function getMcpConfigPath(slug, scope) {
|
|
592
|
-
const home = homedir();
|
|
593
|
-
switch (slug) {
|
|
594
|
-
case 'claude-code':
|
|
595
|
-
return scope === 'project'
|
|
596
|
-
? join(process.cwd(), '.mcp.json')
|
|
597
|
-
: join(home, '.claude', 'settings.json');
|
|
598
|
-
case 'cursor':
|
|
599
|
-
return scope === 'project'
|
|
600
|
-
? join(process.cwd(), '.cursor', 'mcp.json')
|
|
601
|
-
: join(home, '.cursor', 'mcp.json');
|
|
602
|
-
case 'windsurf':
|
|
603
|
-
return scope === 'project'
|
|
604
|
-
? join(process.cwd(), '.windsurf', 'mcp.json')
|
|
605
|
-
: join(home, '.windsurf', 'mcp.json');
|
|
606
|
-
case 'codex':
|
|
607
|
-
return scope === 'user'
|
|
608
|
-
? join(home, '.codex', 'mcp.json')
|
|
609
|
-
: null;
|
|
610
|
-
case 'gemini':
|
|
611
|
-
return scope === 'user'
|
|
612
|
-
? join(home, '.gemini', 'settings.json')
|
|
613
|
-
: null;
|
|
614
|
-
default:
|
|
615
|
-
return null;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
function getSkillsDir(slug, scope) {
|
|
619
|
-
const home = homedir();
|
|
620
|
-
switch (slug) {
|
|
621
|
-
case 'claude-code':
|
|
622
|
-
return scope === 'project'
|
|
623
|
-
? join(process.cwd(), '.claude', 'skills')
|
|
624
|
-
: join(home, '.claude', 'skills');
|
|
625
|
-
case 'codex':
|
|
626
|
-
return scope === 'project'
|
|
627
|
-
? join(process.cwd(), '.codex', 'skills')
|
|
628
|
-
: join(home, '.codex', 'skills');
|
|
629
|
-
case 'gemini':
|
|
630
|
-
return scope === 'project'
|
|
631
|
-
? join(process.cwd(), '.gemini', 'skills')
|
|
632
|
-
: join(home, '.gemini', 'skills');
|
|
633
|
-
default:
|
|
634
|
-
return null;
|
|
635
|
-
}
|
|
636
|
-
}
|
package/dist/health/fix.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { DoctorContext } from './checks.js';
|
|
2
|
-
/** Check names `runwork doctor --fix` knows how to auto-remediate. */
|
|
3
|
-
export declare const FIXABLE_CHECKS: readonly string[];
|
|
4
|
-
export interface FixOutcome {
|
|
5
|
-
/** The check name this outcome corresponds to. */
|
|
6
|
-
name: string;
|
|
7
|
-
/** Whether a remediation was actually applied (false = couldn't, with a reason). */
|
|
8
|
-
applied: boolean;
|
|
9
|
-
/** Human-readable description of what was done, or why it couldn't be. */
|
|
10
|
-
message: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Apply auto-remediations for the failing checks doctor knows how to fix.
|
|
14
|
-
* Only acts on `failingNames` that are in FIXABLE_CHECKS; everything else is
|
|
15
|
-
* left for the user (with the `fix` hint each check already carries).
|
|
16
|
-
*
|
|
17
|
-
* - git-credential-helper -> register the runwork git helper for the logged-in
|
|
18
|
-
* origin (the B1 ensure-path), so headless-auth'd sessions can use git.
|
|
19
|
-
* - git-remote -> point the `runwork` remote at the app's canonical URL (the
|
|
20
|
-
* B2 ensure-path), using the correct `/api/git/...` URL from the API client.
|
|
21
|
-
*/
|
|
22
|
-
export declare function applyDoctorFixes(ctx: DoctorContext, failingNames: string[]): Promise<FixOutcome[]>;
|