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
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { requireAuth } from '../auth/store.js';
|
|
3
|
-
import { ApiClient } from '../api/client.js';
|
|
4
|
-
import { resolveWorkspace, resolveApp } from '../workspace/resolve.js';
|
|
5
|
-
import { shouldOutputJson, jsonOut } from '../utils/output.js';
|
|
6
|
-
function truncate(text, max) {
|
|
7
|
-
if (!text)
|
|
8
|
-
return '';
|
|
9
|
-
const first = text.split('\n')[0];
|
|
10
|
-
if (first.length <= max)
|
|
11
|
-
return first;
|
|
12
|
-
return first.slice(0, max - 3) + '...';
|
|
13
|
-
}
|
|
14
|
-
const listCommand = new Command('list')
|
|
15
|
-
.description('List scheduled jobs in the workspace')
|
|
16
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
17
|
-
.option('--app <name|id>', 'Filter by app name or ID')
|
|
18
|
-
.action(async (opts, command) => {
|
|
19
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
20
|
-
const credentials = requireAuth();
|
|
21
|
-
const client = new ApiClient(credentials);
|
|
22
|
-
const { workspaceId, workspaceName } = await resolveWorkspace(client, opts);
|
|
23
|
-
try {
|
|
24
|
-
let schedules = await client.listSchedules(workspaceId);
|
|
25
|
-
if (opts.app) {
|
|
26
|
-
const { appId } = await resolveApp(client, workspaceId, opts);
|
|
27
|
-
schedules = schedules.filter(s => s.appId === appId);
|
|
28
|
-
}
|
|
29
|
-
if (useJson) {
|
|
30
|
-
jsonOut({ schedules });
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (schedules.length === 0) {
|
|
34
|
-
console.log('No scheduled jobs found in this workspace.');
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
console.log(`\nWorkspace: ${workspaceName || workspaceId}\n`);
|
|
38
|
-
console.log(' ' +
|
|
39
|
-
'Name'.padEnd(24) +
|
|
40
|
-
'App'.padEnd(20) +
|
|
41
|
-
'Schedule'.padEnd(18) +
|
|
42
|
-
'Status'.padEnd(12) +
|
|
43
|
-
'Description');
|
|
44
|
-
console.log(' ' + '-'.repeat(90));
|
|
45
|
-
for (const s of schedules) {
|
|
46
|
-
const mode = s.deploymentMode ? ` (${s.deploymentMode})` : '';
|
|
47
|
-
const status = s.status ? s.status + mode : mode.trim() || '-';
|
|
48
|
-
console.log(' ' +
|
|
49
|
-
s.name.padEnd(24) +
|
|
50
|
-
(s.appName || s.appId).slice(0, 18).padEnd(20) +
|
|
51
|
-
(s.schedule || '-').padEnd(18) +
|
|
52
|
-
status.padEnd(12) +
|
|
53
|
-
truncate(s.description, 40));
|
|
54
|
-
}
|
|
55
|
-
console.log('');
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
console.error('Failed to list schedules:', err instanceof Error ? err.message : err);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
const triggerCommand = new Command('trigger')
|
|
63
|
-
.description('Manually trigger a scheduled job')
|
|
64
|
-
.argument('<name>', 'Schedule name')
|
|
65
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
66
|
-
.option('--app <name|id>', 'App name or ID')
|
|
67
|
-
.option('--preview', 'Trigger in preview (sandbox) mode instead of production')
|
|
68
|
-
.action(async (name, opts, command) => {
|
|
69
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
70
|
-
const credentials = requireAuth();
|
|
71
|
-
const client = new ApiClient(credentials);
|
|
72
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
73
|
-
const { appId, appName } = await resolveApp(client, workspaceId, opts);
|
|
74
|
-
const deploymentMode = opts.preview ? 'preview' : 'production';
|
|
75
|
-
try {
|
|
76
|
-
const result = await client.triggerSchedule(workspaceId, {
|
|
77
|
-
scheduleName: name,
|
|
78
|
-
appId,
|
|
79
|
-
deploymentMode,
|
|
80
|
-
});
|
|
81
|
-
if (useJson) {
|
|
82
|
-
jsonOut({ result, scheduleName: name, appId, appName, deploymentMode });
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
console.log(`Triggered schedule "${name}" on app "${appName}" (${deploymentMode}).`);
|
|
86
|
-
if (result.message) {
|
|
87
|
-
console.log(result.message);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
console.error('Failed to trigger schedule:', err instanceof Error ? err.message : err);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const historyCommand = new Command('history')
|
|
96
|
-
.description('Show execution history for scheduled jobs in an app')
|
|
97
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
98
|
-
.option('--app <name|id>', 'App name or ID (required)')
|
|
99
|
-
.action(async (opts, command) => {
|
|
100
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
101
|
-
const credentials = requireAuth();
|
|
102
|
-
const client = new ApiClient(credentials);
|
|
103
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
104
|
-
const { appId, appName } = await resolveApp(client, workspaceId, opts);
|
|
105
|
-
try {
|
|
106
|
-
const data = await client.getScheduleHistory(workspaceId, appId);
|
|
107
|
-
if (useJson) {
|
|
108
|
-
jsonOut({ history: data.history, appId, appName });
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (!data.history || data.history.length === 0) {
|
|
112
|
-
console.log(`No schedule history found for app "${appName}".`);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
console.log(`\nSchedule history for app: ${appName}\n`);
|
|
116
|
-
console.log(' ' +
|
|
117
|
-
'Schedule'.padEnd(24) +
|
|
118
|
-
'Executed At'.padEnd(26) +
|
|
119
|
-
'Status'.padEnd(12) +
|
|
120
|
-
'Duration');
|
|
121
|
-
console.log(' ' + '-'.repeat(72));
|
|
122
|
-
for (const entry of data.history) {
|
|
123
|
-
const duration = entry.durationMs != null ? `${entry.durationMs}ms` : '-';
|
|
124
|
-
console.log(' ' +
|
|
125
|
-
entry.scheduleName.padEnd(24) +
|
|
126
|
-
entry.executedAt.padEnd(26) +
|
|
127
|
-
entry.status.padEnd(12) +
|
|
128
|
-
duration);
|
|
129
|
-
if (entry.error) {
|
|
130
|
-
console.log(` Error: ${entry.error}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
console.log('');
|
|
134
|
-
}
|
|
135
|
-
catch (err) {
|
|
136
|
-
console.error('Failed to get schedule history:', err instanceof Error ? err.message : err);
|
|
137
|
-
process.exit(1);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
const statusCommand = new Command('status')
|
|
141
|
-
.description('Show runtime status of scheduled jobs for an app')
|
|
142
|
-
.argument('<name>', 'Schedule name')
|
|
143
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
144
|
-
.option('--app <name|id>', 'App name or ID (required)')
|
|
145
|
-
.action(async (name, opts, command) => {
|
|
146
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
147
|
-
const credentials = requireAuth();
|
|
148
|
-
const client = new ApiClient(credentials);
|
|
149
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
150
|
-
const { appId, appName } = await resolveApp(client, workspaceId, opts);
|
|
151
|
-
try {
|
|
152
|
-
const data = await client.getScheduleStatus(workspaceId, appId);
|
|
153
|
-
if (useJson) {
|
|
154
|
-
jsonOut({ status: data, scheduleName: name, appId, appName });
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
console.log(`\nSchedule "${name}" status for app "${appName}":\n`);
|
|
158
|
-
console.log(JSON.stringify(data, null, 2));
|
|
159
|
-
console.log('');
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
console.error('Failed to get schedule status:', err instanceof Error ? err.message : err);
|
|
163
|
-
process.exit(1);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
const pauseCommand = new Command('pause')
|
|
167
|
-
.description('Pause a scheduled job')
|
|
168
|
-
.argument('<name>', 'Schedule name')
|
|
169
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
170
|
-
.option('--app <name|id>', 'App name or ID (required)')
|
|
171
|
-
.action(async (name, opts, command) => {
|
|
172
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
173
|
-
const credentials = requireAuth();
|
|
174
|
-
const client = new ApiClient(credentials);
|
|
175
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
176
|
-
const { appId, appName } = await resolveApp(client, workspaceId, opts);
|
|
177
|
-
try {
|
|
178
|
-
await client.pauseSchedule(workspaceId, name, appId);
|
|
179
|
-
if (useJson) {
|
|
180
|
-
jsonOut({ success: true, scheduleName: name, appId, appName, action: 'paused' });
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
console.log(`Schedule "${name}" paused for app "${appName}".`);
|
|
184
|
-
}
|
|
185
|
-
catch (err) {
|
|
186
|
-
console.error('Failed to pause schedule:', err instanceof Error ? err.message : err);
|
|
187
|
-
process.exit(1);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
const resumeCommand = new Command('resume')
|
|
191
|
-
.description('Resume a paused scheduled job')
|
|
192
|
-
.argument('<name>', 'Schedule name')
|
|
193
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
194
|
-
.option('--app <name|id>', 'App name or ID (required)')
|
|
195
|
-
.action(async (name, opts, command) => {
|
|
196
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
197
|
-
const credentials = requireAuth();
|
|
198
|
-
const client = new ApiClient(credentials);
|
|
199
|
-
const { workspaceId } = await resolveWorkspace(client, opts);
|
|
200
|
-
const { appId, appName } = await resolveApp(client, workspaceId, opts);
|
|
201
|
-
try {
|
|
202
|
-
await client.resumeSchedule(workspaceId, name, appId);
|
|
203
|
-
if (useJson) {
|
|
204
|
-
jsonOut({ success: true, scheduleName: name, appId, appName, action: 'resumed' });
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
console.log(`Schedule "${name}" resumed for app "${appName}".`);
|
|
208
|
-
}
|
|
209
|
-
catch (err) {
|
|
210
|
-
console.error('Failed to resume schedule:', err instanceof Error ? err.message : err);
|
|
211
|
-
process.exit(1);
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
export const schedulesCommand = new Command('schedules')
|
|
215
|
-
.description('Manage workspace scheduled jobs')
|
|
216
|
-
.addCommand(listCommand)
|
|
217
|
-
.addCommand(triggerCommand)
|
|
218
|
-
.addCommand(historyCommand)
|
|
219
|
-
.addCommand(statusCommand)
|
|
220
|
-
.addCommand(pauseCommand)
|
|
221
|
-
.addCommand(resumeCommand);
|
package/dist/commands/setup.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { ApiClient } from '../api/client.js';
|
|
3
|
-
import type { SetupState } from '../types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Resolve the persona to persist in setup.json. Prefers the `--persona` flag
|
|
6
|
-
* (passed by the desktop onboarding flow); otherwise preserves any persona
|
|
7
|
-
* already on disk so re-running `setup` without the flag does not wipe it.
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolvePersona(flag: string | undefined, existing: SetupState['persona']): SetupState['persona'];
|
|
10
|
-
/**
|
|
11
|
-
* Resolve the workspace for `setup` and persist it as the default in credentials.
|
|
12
|
-
*
|
|
13
|
-
* `setup` is the canonical "configure this machine for this workspace" command, so
|
|
14
|
-
* the choice should stick across subsequent commands (including the desktop app,
|
|
15
|
-
* which reads `defaultWorkspaceId` to pick the initial workspace on the Workspace tab).
|
|
16
|
-
*
|
|
17
|
-
* When `--workspace <id>` is passed, the id is validated against the user's accessible
|
|
18
|
-
* workspaces and the command exits with a non-zero code if it isn't found.
|
|
19
|
-
*/
|
|
20
|
-
export declare function resolveAndPersistWorkspace(client: ApiClient, opts: {
|
|
21
|
-
workspace?: string;
|
|
22
|
-
}): Promise<{
|
|
23
|
-
workspaceId: string;
|
|
24
|
-
workspaceName: string;
|
|
25
|
-
workspaceSlug?: string;
|
|
26
|
-
}>;
|
|
27
|
-
export declare const setupCommand: Command;
|
package/dist/commands/setup.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { writeFileSync, mkdirSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { homedir } from 'os';
|
|
5
|
-
import { requireAuth, getCredentials, saveCredentials } from '../auth/store.js';
|
|
6
|
-
import { ApiClient } from '../api/client.js';
|
|
7
|
-
import { resolveWorkspace, hasProjectConfig } from '../workspace/resolve.js';
|
|
8
|
-
import { promptSelect, promptConfirm } from '../utils/prompt.js';
|
|
9
|
-
import { detectAgents, printNoAgentsMessage } from '../agents/detect.js';
|
|
10
|
-
import { syncFromState } from './sync.js';
|
|
11
|
-
import { loadSetupState } from '../utils/setup-state.js';
|
|
12
|
-
const PERSONA_LABELS = {
|
|
13
|
-
1: 'everyday',
|
|
14
|
-
2: 'curious',
|
|
15
|
-
3: 'engineer',
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Resolve the persona to persist in setup.json. Prefers the `--persona` flag
|
|
19
|
-
* (passed by the desktop onboarding flow); otherwise preserves any persona
|
|
20
|
-
* already on disk so re-running `setup` without the flag does not wipe it.
|
|
21
|
-
*/
|
|
22
|
-
export function resolvePersona(flag, existing) {
|
|
23
|
-
if (flag) {
|
|
24
|
-
const level = Number(flag);
|
|
25
|
-
if (level === 1 || level === 2 || level === 3) {
|
|
26
|
-
return { level, label: PERSONA_LABELS[level] };
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return existing;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Resolve the workspace for `setup` and persist it as the default in credentials.
|
|
33
|
-
*
|
|
34
|
-
* `setup` is the canonical "configure this machine for this workspace" command, so
|
|
35
|
-
* the choice should stick across subsequent commands (including the desktop app,
|
|
36
|
-
* which reads `defaultWorkspaceId` to pick the initial workspace on the Workspace tab).
|
|
37
|
-
*
|
|
38
|
-
* When `--workspace <id>` is passed, the id is validated against the user's accessible
|
|
39
|
-
* workspaces and the command exits with a non-zero code if it isn't found.
|
|
40
|
-
*/
|
|
41
|
-
export async function resolveAndPersistWorkspace(client, opts) {
|
|
42
|
-
const resolved = await resolveWorkspace(client, opts);
|
|
43
|
-
const { workspaceId } = resolved;
|
|
44
|
-
let allWorkspaces = [];
|
|
45
|
-
try {
|
|
46
|
-
allWorkspaces = await client.listWorkspaces();
|
|
47
|
-
}
|
|
48
|
-
catch { /* best-effort */ }
|
|
49
|
-
const workspaceMeta = allWorkspaces.find(w => w.id === workspaceId);
|
|
50
|
-
if (opts.workspace && allWorkspaces.length > 0 && !workspaceMeta) {
|
|
51
|
-
console.error(`Workspace "${opts.workspace}" not found or not accessible.`);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
const workspaceName = resolved.workspaceName || workspaceMeta?.name || '';
|
|
55
|
-
const workspaceSlug = workspaceMeta?.slug;
|
|
56
|
-
const freshCreds = getCredentials();
|
|
57
|
-
if (freshCreds) {
|
|
58
|
-
saveCredentials({
|
|
59
|
-
...freshCreds,
|
|
60
|
-
defaultWorkspaceId: workspaceId,
|
|
61
|
-
defaultWorkspaceName: workspaceName,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return { workspaceId, workspaceName, workspaceSlug };
|
|
65
|
-
}
|
|
66
|
-
export const setupCommand = new Command('setup')
|
|
67
|
-
.description('Configure local AI agents with workspace skills and MCP servers')
|
|
68
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
69
|
-
.option('--agent <slug>', 'Only configure a specific agent (e.g. claude-code, cursor)')
|
|
70
|
-
.option('--dry-run', 'Show what would be configured without writing files')
|
|
71
|
-
.option('-y, --yes', 'Skip all prompts, configure all detected agents with user scope')
|
|
72
|
-
.option('--persona <level>', 'Technical-level persona for agent instructions (1=everyday, 2=curious, 3=engineer)')
|
|
73
|
-
.action(async (opts) => {
|
|
74
|
-
const credentials = requireAuth();
|
|
75
|
-
const client = new ApiClient(credentials);
|
|
76
|
-
// 1. Resolve workspace + persist as default
|
|
77
|
-
const { workspaceId, workspaceName, workspaceSlug } = await resolveAndPersistWorkspace(client, opts);
|
|
78
|
-
console.log(`\nWorkspace: ${workspaceName || workspaceId}\n`);
|
|
79
|
-
// 2. Detect agents
|
|
80
|
-
let agents = await detectAgents();
|
|
81
|
-
if (agents.length === 0) {
|
|
82
|
-
printNoAgentsMessage();
|
|
83
|
-
process.exit(0);
|
|
84
|
-
}
|
|
85
|
-
// Filter by --agent flag
|
|
86
|
-
if (opts.agent) {
|
|
87
|
-
agents = agents.filter(a => a.slug === opts.agent);
|
|
88
|
-
if (agents.length === 0) {
|
|
89
|
-
console.error(`Agent "${opts.agent}" not detected on this machine.`);
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else if (opts.yes) {
|
|
94
|
-
// Non-interactive: configure all detected agents
|
|
95
|
-
console.log('Detected agents:');
|
|
96
|
-
for (const a of agents) {
|
|
97
|
-
console.log(` - ${a.name}`);
|
|
98
|
-
}
|
|
99
|
-
console.log('\nConfiguring all agents (--yes).\n');
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
// Show detected agents and confirm
|
|
103
|
-
console.log('Detected agents:');
|
|
104
|
-
for (const a of agents) {
|
|
105
|
-
console.log(` - ${a.name}`);
|
|
106
|
-
}
|
|
107
|
-
console.log('');
|
|
108
|
-
const configureAll = await promptConfirm(`Configure all ${agents.length} agents?`);
|
|
109
|
-
if (!configureAll) {
|
|
110
|
-
const kept = [];
|
|
111
|
-
for (const a of agents) {
|
|
112
|
-
const include = await promptConfirm(` Include ${a.name}?`);
|
|
113
|
-
if (include)
|
|
114
|
-
kept.push(a);
|
|
115
|
-
}
|
|
116
|
-
agents = kept;
|
|
117
|
-
if (agents.length === 0) {
|
|
118
|
-
console.log('No agents selected.');
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// 3. Determine scope
|
|
124
|
-
let scope = 'user';
|
|
125
|
-
if (hasProjectConfig() && !opts.yes) {
|
|
126
|
-
const scopeChoices = [
|
|
127
|
-
{ label: 'This project only', value: 'project' },
|
|
128
|
-
{ label: 'Your user (global)', value: 'user' },
|
|
129
|
-
{ label: 'Both', value: 'both' },
|
|
130
|
-
];
|
|
131
|
-
const chosen = await promptSelect('Configure for:', scopeChoices);
|
|
132
|
-
scope = chosen.value;
|
|
133
|
-
}
|
|
134
|
-
// 5. Save setup state (minimal, sync populates the rest).
|
|
135
|
-
// `lastDetectedAt` is stamped now so the immediate post-setup sync
|
|
136
|
-
// doesn't waste time re-running detection that just ran.
|
|
137
|
-
const state = {
|
|
138
|
-
workspaceId,
|
|
139
|
-
workspaceName: workspaceName || '',
|
|
140
|
-
workspaceSlug: workspaceSlug || undefined,
|
|
141
|
-
configuredAgents: agents.map(a => a.slug),
|
|
142
|
-
scope,
|
|
143
|
-
lastSyncAt: '',
|
|
144
|
-
mcpServers: [],
|
|
145
|
-
skills: [],
|
|
146
|
-
skillHashes: {},
|
|
147
|
-
lastDetectedAt: new Date().toISOString(),
|
|
148
|
-
persona: resolvePersona(opts.persona, loadSetupState()?.persona),
|
|
149
|
-
};
|
|
150
|
-
const scopes = scope === 'both' ? ['project', 'user'] : [scope];
|
|
151
|
-
for (const s of scopes) {
|
|
152
|
-
const dir = s === 'project' ? '.runwork' : join(homedir(), '.runwork');
|
|
153
|
-
mkdirSync(dir, { recursive: true });
|
|
154
|
-
writeFileSync(join(dir, 'setup.json'), JSON.stringify(state, null, 2));
|
|
155
|
-
}
|
|
156
|
-
if (opts.dryRun) {
|
|
157
|
-
console.log('\n[Dry run] Saved setup state. Would sync:\n');
|
|
158
|
-
console.log(` Agents: ${agents.map(a => a.name).join(', ')}`);
|
|
159
|
-
console.log(` Scope: ${scope}`);
|
|
160
|
-
console.log('\nRe-run without --dry-run to sync workspace data.');
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
// 6. Delegate all write operations to sync
|
|
164
|
-
console.log('\nSyncing workspace data...\n');
|
|
165
|
-
for (const s of scopes) {
|
|
166
|
-
const statePath = s === 'project'
|
|
167
|
-
? join(process.cwd(), '.runwork', 'setup.json')
|
|
168
|
-
: join(homedir(), '.runwork', 'setup.json');
|
|
169
|
-
await syncFromState(state, statePath, credentials, {
|
|
170
|
-
dryRun: false,
|
|
171
|
-
pullOnly: true,
|
|
172
|
-
yes: true,
|
|
173
|
-
prefer: 'remote',
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
console.log('\nSetup complete. Run `runwork sync` anytime to refresh.');
|
|
177
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
* `runwork share-convo` - share the current AI conversation with a teammate.
|
|
4
|
-
*
|
|
5
|
-
* Typically invoked by the `share-conversation` skill from inside an AI agent.
|
|
6
|
-
* The skill is responsible for emitting the markdown transcript and metadata;
|
|
7
|
-
* this command does the upload, host-agent detection, and native-bundle pickup.
|
|
8
|
-
*/
|
|
9
|
-
interface ShareConvoOptions {
|
|
10
|
-
to?: string[];
|
|
11
|
-
transcriptFile?: string;
|
|
12
|
-
nativeFile?: string;
|
|
13
|
-
sourceAgent?: string;
|
|
14
|
-
title?: string;
|
|
15
|
-
note?: string;
|
|
16
|
-
personal?: boolean;
|
|
17
|
-
ttlDays?: string;
|
|
18
|
-
metadataJson?: string;
|
|
19
|
-
metadataFile?: string;
|
|
20
|
-
workspace?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function runShareConvo(opts: ShareConvoOptions, command: Command, isPersonalAlias?: boolean): Promise<void>;
|
|
23
|
-
export declare const shareConvoCommand: Command;
|
|
24
|
-
export {};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { readFileSync, existsSync } from 'fs';
|
|
3
|
-
import { createHash } from 'crypto';
|
|
4
|
-
import { requireAuth } from '../auth/store.js';
|
|
5
|
-
import { ApiClient } from '../api/client.js';
|
|
6
|
-
import { resolveWorkspace } from '../workspace/resolve.js';
|
|
7
|
-
import { shouldOutputJson, jsonOut } from '../utils/output.js';
|
|
8
|
-
import { detectCurrentAgent } from '../agents/runtime-detection.js';
|
|
9
|
-
function nativeBundleFormatForAgent(slug) {
|
|
10
|
-
if (slug === 'claude-code' || slug === 'claude-desktop')
|
|
11
|
-
return 'claude-jsonl';
|
|
12
|
-
if (slug === 'codex' || slug === 'codex-app')
|
|
13
|
-
return 'codex-rollout';
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
function sha256Hex(content) {
|
|
17
|
-
return createHash('sha256').update(content, 'utf8').digest('hex');
|
|
18
|
-
}
|
|
19
|
-
function utf8ByteLength(content) {
|
|
20
|
-
return Buffer.byteLength(content, 'utf8');
|
|
21
|
-
}
|
|
22
|
-
export async function runShareConvo(opts, command, isPersonalAlias = false) {
|
|
23
|
-
const useJson = shouldOutputJson(command.optsWithGlobals().json);
|
|
24
|
-
if (!opts.transcriptFile) {
|
|
25
|
-
console.error('Error: --transcript-file is required. Pass the path to the LLM-emitted markdown transcript.');
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
if (!existsSync(opts.transcriptFile)) {
|
|
29
|
-
console.error(`Error: transcript file does not exist: ${opts.transcriptFile}`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
if (!opts.title) {
|
|
33
|
-
console.error('Error: --title is required.');
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
const isPersonal = isPersonalAlias || !!opts.personal || (!opts.to || opts.to.length === 0);
|
|
37
|
-
const recipients = opts.to ?? [];
|
|
38
|
-
if (!isPersonal && recipients.length === 0) {
|
|
39
|
-
console.error('Error: at least one --to <email> is required (or use --personal to save for yourself)');
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
if (isPersonal && recipients.length > 0) {
|
|
43
|
-
console.error('Error: --personal and --to cannot be combined; personal shares are self-only');
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
const credentials = requireAuth();
|
|
47
|
-
const client = new ApiClient(credentials);
|
|
48
|
-
const { workspaceId } = await resolveWorkspace(client, { workspace: opts.workspace });
|
|
49
|
-
// Read transcript bundle (always required)
|
|
50
|
-
const transcriptContent = readFileSync(opts.transcriptFile, 'utf8');
|
|
51
|
-
const bundles = [
|
|
52
|
-
{
|
|
53
|
-
format: 'transcript',
|
|
54
|
-
content: transcriptContent,
|
|
55
|
-
sizeBytes: utf8ByteLength(transcriptContent),
|
|
56
|
-
sha256: sha256Hex(transcriptContent),
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
// Detect host agent (for source tagging and native bundle pickup)
|
|
60
|
-
const detected = detectCurrentAgent();
|
|
61
|
-
const sourceAgent = opts.sourceAgent ?? detected?.slug ?? 'generic';
|
|
62
|
-
// Resolve native bundle - explicit --native-file wins, else use detection
|
|
63
|
-
let nativeFilePath = null;
|
|
64
|
-
if (opts.nativeFile) {
|
|
65
|
-
if (!existsSync(opts.nativeFile)) {
|
|
66
|
-
console.error(`Error: --native-file path does not exist: ${opts.nativeFile}`);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
nativeFilePath = opts.nativeFile;
|
|
70
|
-
}
|
|
71
|
-
else if (detected?.sessionFilePath && existsSync(detected.sessionFilePath)) {
|
|
72
|
-
nativeFilePath = detected.sessionFilePath;
|
|
73
|
-
}
|
|
74
|
-
if (nativeFilePath) {
|
|
75
|
-
const nativeFormat = nativeBundleFormatForAgent(sourceAgent);
|
|
76
|
-
if (nativeFormat) {
|
|
77
|
-
try {
|
|
78
|
-
const content = readFileSync(nativeFilePath, 'utf8');
|
|
79
|
-
bundles.push({
|
|
80
|
-
format: nativeFormat,
|
|
81
|
-
content,
|
|
82
|
-
sizeBytes: utf8ByteLength(content),
|
|
83
|
-
sha256: sha256Hex(content),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
console.error(`Warning: could not read native file ${nativeFilePath}: ${err instanceof Error ? err.message : err}`);
|
|
88
|
-
console.error('Continuing with transcript-only bundle.');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// Metadata - merge --metadata-json and --metadata-file
|
|
93
|
-
let metadata = {};
|
|
94
|
-
if (opts.metadataFile) {
|
|
95
|
-
try {
|
|
96
|
-
metadata = JSON.parse(readFileSync(opts.metadataFile, 'utf8'));
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
console.error(`Error: --metadata-file is not valid JSON: ${err instanceof Error ? err.message : err}`);
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (opts.metadataJson) {
|
|
104
|
-
try {
|
|
105
|
-
metadata = { ...metadata, ...JSON.parse(opts.metadataJson) };
|
|
106
|
-
}
|
|
107
|
-
catch (err) {
|
|
108
|
-
console.error(`Error: --metadata-json is not valid JSON: ${err instanceof Error ? err.message : err}`);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Augment metadata with detected host info if not already provided
|
|
113
|
-
if (detected && !metadata.sourceSessionId) {
|
|
114
|
-
metadata.sourceSessionId = detected.sessionId;
|
|
115
|
-
}
|
|
116
|
-
if (!metadata.os) {
|
|
117
|
-
metadata.os = process.platform === 'darwin' ? 'macos' : process.platform === 'win32' ? 'windows' : 'linux';
|
|
118
|
-
}
|
|
119
|
-
const ttlDays = opts.ttlDays ? parseInt(opts.ttlDays, 10) : undefined;
|
|
120
|
-
try {
|
|
121
|
-
const result = await client.createSharedConversation(workspaceId, {
|
|
122
|
-
recipients: isPersonal ? [] : recipients,
|
|
123
|
-
isPersonal,
|
|
124
|
-
sourceAgent,
|
|
125
|
-
title: opts.title,
|
|
126
|
-
note: opts.note,
|
|
127
|
-
bundles,
|
|
128
|
-
metadata,
|
|
129
|
-
ttlDays: ttlDays && Number.isFinite(ttlDays) ? ttlDays : undefined,
|
|
130
|
-
});
|
|
131
|
-
if (useJson) {
|
|
132
|
-
jsonOut(result);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (isPersonal) {
|
|
136
|
-
console.log(`Saved conversation: ${result.share.title}`);
|
|
137
|
-
console.log(`Share ID: ${result.share.id}`);
|
|
138
|
-
console.log(`Expires: ${result.share.expiresAt}`);
|
|
139
|
-
console.log(`\nResume with: runwork resume ${result.share.id}`);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
console.log(`Shared with ${result.sharedCount} member${result.sharedCount === 1 ? '' : 's'}` +
|
|
143
|
-
(result.invitedCount > 0 ? ` and invited ${result.invitedCount} new user${result.invitedCount === 1 ? '' : 's'}` : '') + '.');
|
|
144
|
-
console.log(`Share ID: ${result.share.id}`);
|
|
145
|
-
if (result.skipped.length > 0) {
|
|
146
|
-
console.log(`\nSkipped: ${result.skipped.map(s => `${s.identifier} (${s.reason})`).join(', ')}`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
catch (err) {
|
|
151
|
-
console.error(`Failed to share conversation: ${err instanceof Error ? err.message : err}`);
|
|
152
|
-
process.exit(1);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
export const shareConvoCommand = new Command('share-convo')
|
|
156
|
-
.description('Share the current AI conversation with a teammate')
|
|
157
|
-
.option('--to <email>', 'Recipient email (repeatable)', (value, prev = []) => [...prev, value], [])
|
|
158
|
-
.option('--transcript-file <path>', 'Path to the LLM-emitted markdown transcript (required)')
|
|
159
|
-
.option('--native-file <path>', 'Path to the native session file (optional; auto-detected from env vars otherwise)')
|
|
160
|
-
.option('--source-agent <slug>', 'Override host-agent detection (e.g. claude-code, codex, claude-desktop)')
|
|
161
|
-
.option('--title <string>', 'Short title for the conversation (required)')
|
|
162
|
-
.option('--note <string>', 'Optional personal note to recipients')
|
|
163
|
-
.option('--ttl-days <n>', 'Days until expiration (1-30, default 7)')
|
|
164
|
-
.option('--metadata-json <json>', 'Inline JSON object with workMode, openQuestions, suggestedNextStep, etc.')
|
|
165
|
-
.option('--metadata-file <path>', 'Path to a JSON file with the same metadata fields')
|
|
166
|
-
.option('--workspace <id>', 'Workspace ID')
|
|
167
|
-
.action((opts, command) => runShareConvo(opts, command, false));
|