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,95 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { resolveWorkspace, resolveApp } from '../resolve.js';
|
|
3
|
-
const mockWorkspaces = [
|
|
4
|
-
{ id: 'ws-1', name: 'Team Alpha' },
|
|
5
|
-
{ id: 'ws-2', name: 'Team Beta' },
|
|
6
|
-
];
|
|
7
|
-
const mockApps = [
|
|
8
|
-
{ id: 'app-1', name: 'My App', slug: 'my-app', workspaceId: 'ws-1', workspaceName: 'Team Alpha', gitRemoteUrl: '' },
|
|
9
|
-
{ id: 'app-2', name: 'Other App', slug: 'other-app', workspaceId: 'ws-2', workspaceName: 'Team Beta', gitRemoteUrl: '' },
|
|
10
|
-
];
|
|
11
|
-
function createMockClient(workspaces, apps) {
|
|
12
|
-
return {
|
|
13
|
-
listWorkspaces: vi.fn().mockResolvedValue(workspaces),
|
|
14
|
-
listApps: vi.fn().mockResolvedValue(apps),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
// Mock process.exit to throw instead of exiting
|
|
18
|
-
const mockExit = vi.spyOn(process, 'exit').mockImplementation(((code) => {
|
|
19
|
-
throw new Error(`process.exit(${code})`);
|
|
20
|
-
}));
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
vi.clearAllMocks();
|
|
23
|
-
vi.spyOn(console, 'error').mockImplementation(() => { });
|
|
24
|
-
});
|
|
25
|
-
describe('resolveWorkspace', () => {
|
|
26
|
-
it('resolves by exact ID', async () => {
|
|
27
|
-
const client = createMockClient(mockWorkspaces, []);
|
|
28
|
-
const ws = await resolveWorkspace(client, 'ws-1');
|
|
29
|
-
expect(ws).toEqual(mockWorkspaces[0]);
|
|
30
|
-
});
|
|
31
|
-
it('resolves by name (case-insensitive)', async () => {
|
|
32
|
-
const client = createMockClient(mockWorkspaces, []);
|
|
33
|
-
const ws = await resolveWorkspace(client, 'team beta');
|
|
34
|
-
expect(ws).toEqual(mockWorkspaces[1]);
|
|
35
|
-
});
|
|
36
|
-
it('prefers ID match over name match', async () => {
|
|
37
|
-
const workspaces = [
|
|
38
|
-
{ id: 'ws-1', name: 'ws-2' }, // name matches a different workspace's ID
|
|
39
|
-
{ id: 'ws-2', name: 'Other' },
|
|
40
|
-
];
|
|
41
|
-
const client = createMockClient(workspaces, []);
|
|
42
|
-
const ws = await resolveWorkspace(client, 'ws-2');
|
|
43
|
-
expect(ws.id).toBe('ws-2');
|
|
44
|
-
});
|
|
45
|
-
it('exits when no workspaces found', async () => {
|
|
46
|
-
const client = createMockClient([], []);
|
|
47
|
-
await expect(resolveWorkspace(client, 'any')).rejects.toThrow('process.exit(1)');
|
|
48
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('No workspaces found'));
|
|
49
|
-
});
|
|
50
|
-
it('exits when workspace not found', async () => {
|
|
51
|
-
const client = createMockClient(mockWorkspaces, []);
|
|
52
|
-
await expect(resolveWorkspace(client, 'nonexistent')).rejects.toThrow('process.exit(1)');
|
|
53
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('not found'));
|
|
54
|
-
});
|
|
55
|
-
it('exits on ambiguous name match', async () => {
|
|
56
|
-
const workspaces = [
|
|
57
|
-
{ id: 'ws-1', name: 'Team' },
|
|
58
|
-
{ id: 'ws-2', name: 'Team' },
|
|
59
|
-
];
|
|
60
|
-
const client = createMockClient(workspaces, []);
|
|
61
|
-
await expect(resolveWorkspace(client, 'Team')).rejects.toThrow('process.exit(1)');
|
|
62
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Ambiguous'));
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe('resolveApp', () => {
|
|
66
|
-
it('resolves by exact ID', async () => {
|
|
67
|
-
const client = createMockClient([], mockApps);
|
|
68
|
-
const app = await resolveApp(client, 'app-1');
|
|
69
|
-
expect(app).toEqual(mockApps[0]);
|
|
70
|
-
});
|
|
71
|
-
it('resolves by name (case-insensitive)', async () => {
|
|
72
|
-
const client = createMockClient([], mockApps);
|
|
73
|
-
const app = await resolveApp(client, 'my app');
|
|
74
|
-
expect(app).toEqual(mockApps[0]);
|
|
75
|
-
});
|
|
76
|
-
it('exits when no apps found', async () => {
|
|
77
|
-
const client = createMockClient([], []);
|
|
78
|
-
await expect(resolveApp(client, 'any')).rejects.toThrow('process.exit(1)');
|
|
79
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('No apps found'));
|
|
80
|
-
});
|
|
81
|
-
it('exits when app not found', async () => {
|
|
82
|
-
const client = createMockClient([], mockApps);
|
|
83
|
-
await expect(resolveApp(client, 'nonexistent')).rejects.toThrow('process.exit(1)');
|
|
84
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('not found'));
|
|
85
|
-
});
|
|
86
|
-
it('exits on ambiguous name match', async () => {
|
|
87
|
-
const apps = [
|
|
88
|
-
{ id: 'app-1', name: 'Dup', slug: 'dup-1', workspaceId: 'ws-1', workspaceName: 'WS', gitRemoteUrl: '' },
|
|
89
|
-
{ id: 'app-2', name: 'Dup', slug: 'dup-2', workspaceId: 'ws-1', workspaceName: 'WS', gitRemoteUrl: '' },
|
|
90
|
-
];
|
|
91
|
-
const client = createMockClient([], apps);
|
|
92
|
-
await expect(resolveApp(client, 'Dup')).rejects.toThrow('process.exit(1)');
|
|
93
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Ambiguous'));
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for the runtime SQLite adapter.
|
|
3
|
-
*
|
|
4
|
-
* The adapter picks bun:sqlite (compiled binary path) or node:sqlite
|
|
5
|
-
* (npx runwork@latest on Node >= 22.5) at module load time, and falls back
|
|
6
|
-
* to an "unavailable" path that returns empty string / null so SQLite-backed
|
|
7
|
-
* telemetry features degrade gracefully instead of breaking the CLI install.
|
|
8
|
-
*
|
|
9
|
-
* Vitest under the dev machine may run on Node 20 (no node:sqlite, no Bun
|
|
10
|
-
* global), so these tests gate fixture-database coverage on sqliteAvailable()
|
|
11
|
-
* and always assert the degradation contract.
|
|
12
|
-
*/
|
|
13
|
-
import { describe, it, expect } from 'vitest';
|
|
14
|
-
import { fileURLToPath } from 'node:url';
|
|
15
|
-
import { querySqlite, sqliteAvailable, sqliteFlavor, openWritableSqlite, } from '../sqlite.js';
|
|
16
|
-
const FIXTURE_DB = fileURLToPath(new URL('../../agents/__tests__/fixtures/codex/state.sqlite', import.meta.url));
|
|
17
|
-
const SQLITE_AVAILABLE = sqliteAvailable();
|
|
18
|
-
describe('sqlite adapter runtime detection', () => {
|
|
19
|
-
it('exposes a boolean sqliteAvailable flag', () => {
|
|
20
|
-
expect(typeof SQLITE_AVAILABLE).toBe('boolean');
|
|
21
|
-
});
|
|
22
|
-
it('reports bun, node, or null as the flavor', () => {
|
|
23
|
-
const flavor = sqliteFlavor();
|
|
24
|
-
expect(flavor === 'bun' || flavor === 'node' || flavor === null).toBe(true);
|
|
25
|
-
});
|
|
26
|
-
it('agrees: available iff flavor is non-null', () => {
|
|
27
|
-
expect(sqliteAvailable()).toBe(sqliteFlavor() !== null);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe('querySqlite unavailable-runtime contract', () => {
|
|
31
|
-
// These assertions must pass whether or not a SQLite runtime is available,
|
|
32
|
-
// because they only exercise the graceful-degradation path.
|
|
33
|
-
it('returns empty string for a nonexistent database path', () => {
|
|
34
|
-
expect(querySqlite('/nonexistent/path/that/does/not/exist.db', 'SELECT 1')).toBe('');
|
|
35
|
-
});
|
|
36
|
-
it('returns empty string for invalid SQL against a nonexistent path', () => {
|
|
37
|
-
expect(querySqlite('/nonexistent.db', 'INVALID SQL QUERY')).toBe('');
|
|
38
|
-
});
|
|
39
|
-
it('never throws even when asked for unreachable data', () => {
|
|
40
|
-
expect(() => querySqlite('/tmp/does-not-exist.db', 'SELECT 1')).not.toThrow();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
describe.runIf(SQLITE_AVAILABLE)('querySqlite against the fixture database', () => {
|
|
44
|
-
it('returns pipe-separated values for multi-column results', () => {
|
|
45
|
-
const result = querySqlite(FIXTURE_DB, "SELECT id, tokens_used FROM threads WHERE id = 'old-session'");
|
|
46
|
-
expect(result).toBe('old-session|50000');
|
|
47
|
-
});
|
|
48
|
-
it('returns newline-separated rows for multiple rows', () => {
|
|
49
|
-
const result = querySqlite(FIXTURE_DB, 'SELECT id, tokens_used FROM threads ORDER BY created_at');
|
|
50
|
-
const lines = result.split('\n');
|
|
51
|
-
expect(lines).toHaveLength(3);
|
|
52
|
-
expect(lines[0]).toContain('old-session');
|
|
53
|
-
expect(lines[1]).toContain('recent-session');
|
|
54
|
-
expect(lines[2]).toContain('newest-session');
|
|
55
|
-
});
|
|
56
|
-
it('returns a single-column single-row result without delimiters', () => {
|
|
57
|
-
const result = querySqlite(FIXTURE_DB, 'SELECT max(tokens_used) FROM threads');
|
|
58
|
-
expect(result).toBe('120000');
|
|
59
|
-
});
|
|
60
|
-
it('returns empty string on SQL error even when runtime is available', () => {
|
|
61
|
-
const result = querySqlite(FIXTURE_DB, 'INVALID SQL QUERY');
|
|
62
|
-
expect(result).toBe('');
|
|
63
|
-
});
|
|
64
|
-
it('returns empty string when the target table does not exist', () => {
|
|
65
|
-
const result = querySqlite(FIXTURE_DB, 'SELECT * FROM nonexistent_table');
|
|
66
|
-
expect(result).toBe('');
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
describe('openWritableSqlite unavailable-runtime contract', () => {
|
|
70
|
-
it('returns null for a missing database path', () => {
|
|
71
|
-
expect(openWritableSqlite('/nonexistent/writable/db.sqlite')).toBeNull();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe.runIf(SQLITE_AVAILABLE)('openWritableSqlite against the fixture database', () => {
|
|
75
|
-
it('opens the fixture database when it exists and can prepare SELECTs', () => {
|
|
76
|
-
const handle = openWritableSqlite(FIXTURE_DB);
|
|
77
|
-
expect(handle).not.toBeNull();
|
|
78
|
-
expect(handle?.flavor === 'bun' || handle?.flavor === 'node').toBe(true);
|
|
79
|
-
const row = handle.prepare("SELECT id FROM threads WHERE id = 'old-session'").get();
|
|
80
|
-
expect(row?.id).toBe('old-session');
|
|
81
|
-
handle.close();
|
|
82
|
-
});
|
|
83
|
-
it('close() tolerates double-close without throwing', () => {
|
|
84
|
-
const handle = openWritableSqlite(FIXTURE_DB);
|
|
85
|
-
expect(handle).not.toBeNull();
|
|
86
|
-
handle.close();
|
|
87
|
-
expect(() => handle.close()).not.toThrow();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized agent teaching content.
|
|
3
|
-
* All guidance strings and builder functions live here so when Runwork
|
|
4
|
-
* features change, one file updates.
|
|
5
|
-
*/
|
|
6
|
-
export interface AgentGuide {
|
|
7
|
-
context: string;
|
|
8
|
-
structure?: Record<string, string>;
|
|
9
|
-
nextSteps: string[];
|
|
10
|
-
tips?: string[];
|
|
11
|
-
learnMore?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface AgentError {
|
|
14
|
-
message: string;
|
|
15
|
-
diagnosis: string;
|
|
16
|
-
suggestions: string[];
|
|
17
|
-
}
|
|
18
|
-
export interface AgentResponse<T> {
|
|
19
|
-
success: boolean;
|
|
20
|
-
command: string;
|
|
21
|
-
result: T;
|
|
22
|
-
guide?: AgentGuide;
|
|
23
|
-
error?: AgentError;
|
|
24
|
-
/** Non-blocking advisory surfaced alongside a successful result. */
|
|
25
|
-
warning?: string;
|
|
26
|
-
}
|
|
27
|
-
/** Map of key template files and what they're for. */
|
|
28
|
-
export declare const APP_STRUCTURE: Record<string, string>;
|
|
29
|
-
/**
|
|
30
|
-
* The single most important workflow rule for AI agents working on a
|
|
31
|
-
* Runwork app. Repeated across multiple guides because it's the
|
|
32
|
-
* difference between a working dev cycle and a frustrating one.
|
|
33
|
-
*
|
|
34
|
-
* Rationale -- agents that don't follow this end up:
|
|
35
|
-
* 1. Editing files locally with no preview to verify against.
|
|
36
|
-
* 2. Hitting a single bulk-sync at dev startup that masks which
|
|
37
|
-
* change broke what (instead of incremental per-change syncs).
|
|
38
|
-
* 3. Risking sync conflicts when the local state has diverged from
|
|
39
|
-
* the remote in a way the auto-sync can't reconcile.
|
|
40
|
-
*/
|
|
41
|
-
export declare const DEV_FIRST_RULE = "CRITICAL: Always start `runwork dev --detach` BEFORE editing any code in this app. Dev establishes the live sync pipeline -- without it, changes do not flow to the preview, and the dev startup will batch-sync everything at once instead of giving you per-change feedback. To check whether dev is already running for this app, run `runwork info --json` and inspect `localDevSession.state` (alive / stale / none). If alive, just edit. If none or stale, run `runwork dev --detach --json` first, capture the preview URL from the `session_started` event, then proceed with edits.";
|
|
42
|
-
export declare function buildInitGuide(appName: string, dir: string): AgentGuide;
|
|
43
|
-
export declare function buildCloneGuide(appName: string, dir: string): AgentGuide;
|
|
44
|
-
export declare function buildDevSessionGuide(): AgentGuide;
|
|
45
|
-
export declare function buildDeployGuide(): AgentGuide;
|
|
46
|
-
export declare function buildInfoGuide(): AgentGuide;
|
|
47
|
-
export declare function buildErrorResponse(command: string, message: string, diagnosis: string, suggestions: string[]): AgentResponse<null>;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized agent teaching content.
|
|
3
|
-
* All guidance strings and builder functions live here so when Runwork
|
|
4
|
-
* features change, one file updates.
|
|
5
|
-
*/
|
|
6
|
-
/** Map of key template files and what they're for. */
|
|
7
|
-
export const APP_STRUCTURE = {
|
|
8
|
-
'worker/entities.ts': 'Define persistent data models. Extend Entity<State> for storage with CRUD.',
|
|
9
|
-
'worker/schedules.ts': 'Add background cron jobs. Standard 5-field cron syntax.',
|
|
10
|
-
'worker/workflows.ts': 'Multi-step durable processes. Use ctx.step.do() for retryable steps.',
|
|
11
|
-
'worker/routes.ts': 'Internal API endpoints the frontend calls. CRUD operations, search, filters.',
|
|
12
|
-
'worker/endpoints.ts': 'Public APIs for external access. Webhooks, third-party integrations.',
|
|
13
|
-
'worker/agents.ts': 'AI agents -- conversational (chat UI) or task (headless automation).',
|
|
14
|
-
'worker/integration-requirements.ts': 'Declare third-party service dependencies (Slack, GitHub, etc.).',
|
|
15
|
-
'worker/components.ts': 'Reusable UI components other workspace apps can embed.',
|
|
16
|
-
'shared/types.ts': 'TypeScript interfaces shared between frontend and backend.',
|
|
17
|
-
'src/pages/': 'Frontend React pages. Each file becomes a route.',
|
|
18
|
-
'blueprint.json': 'App feature registry. Update after adding entities, workflows, agents, etc.',
|
|
19
|
-
'CLAUDE.md': 'Complete framework documentation. Read this before editing anything.',
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* The single most important workflow rule for AI agents working on a
|
|
23
|
-
* Runwork app. Repeated across multiple guides because it's the
|
|
24
|
-
* difference between a working dev cycle and a frustrating one.
|
|
25
|
-
*
|
|
26
|
-
* Rationale -- agents that don't follow this end up:
|
|
27
|
-
* 1. Editing files locally with no preview to verify against.
|
|
28
|
-
* 2. Hitting a single bulk-sync at dev startup that masks which
|
|
29
|
-
* change broke what (instead of incremental per-change syncs).
|
|
30
|
-
* 3. Risking sync conflicts when the local state has diverged from
|
|
31
|
-
* the remote in a way the auto-sync can't reconcile.
|
|
32
|
-
*/
|
|
33
|
-
export const DEV_FIRST_RULE = 'CRITICAL: Always start `runwork dev --detach` BEFORE editing any code in this app. Dev establishes the live sync pipeline -- without it, changes do not flow to the preview, and the dev startup will batch-sync everything at once instead of giving you per-change feedback. To check whether dev is already running for this app, run `runwork info --json` and inspect `localDevSession.state` (alive / stale / none). If alive, just edit. If none or stale, run `runwork dev --detach --json` first, capture the preview URL from the `session_started` event, then proceed with edits.';
|
|
34
|
-
const COMMON_TIPS = [
|
|
35
|
-
DEV_FIRST_RULE,
|
|
36
|
-
'Read CLAUDE.md in the app directory first -- it has complete framework documentation with code examples.',
|
|
37
|
-
'You do NOT need to run git commands manually. runwork dev handles file syncing automatically. (git itself must be installed on the system -- see dependencies.)',
|
|
38
|
-
'Do NOT install external AI SDKs (openai, @anthropic-ai/sdk). Use @runworkai/framework/ai instead.',
|
|
39
|
-
'Every workflow MUST have a trigger (API endpoint, scheduled job, or UI button). Workflows without triggers are dead code.',
|
|
40
|
-
'Every conversational agent MUST have a frontend page to access it.',
|
|
41
|
-
'After adding entities, workflows, or agents, update blueprint.json with the new metadata.',
|
|
42
|
-
'Never guess integration IDs. Run: runwork integrations search <query>',
|
|
43
|
-
];
|
|
44
|
-
/**
|
|
45
|
-
* Required system dependencies for the Runwork CLI to function. The AI agent
|
|
46
|
-
* reading these guides should verify each is installed and install missing
|
|
47
|
-
* ones for the user using whatever method is appropriate for their platform.
|
|
48
|
-
*/
|
|
49
|
-
const SYSTEM_DEPENDENCIES_NOTE = 'System dependency: git must be installed on this machine. The CLI uses git internally to sync files between local and the workspace remote. Verify with: git --version. If missing, the AI agent reading this guide should install git for the user without prompting -- pick the method that fits the platform: macOS uses "brew install git" (or "xcode-select --install" if Homebrew is unavailable); Debian/Ubuntu uses "sudo apt-get update && sudo apt-get install -y git"; Fedora/RHEL uses "sudo dnf install -y git"; Arch uses "sudo pacman -S --noconfirm git"; Windows uses "winget install --id Git.Git -e" or "choco install git -y". After installing, re-verify with git --version before continuing.';
|
|
50
|
-
export function buildInitGuide(appName, dir) {
|
|
51
|
-
return {
|
|
52
|
-
context: 'Created a Runwork app -- a full-stack Cloudflare Workers application with built-in support for persistent data (entities), background jobs (schedules), multi-step durable processes (workflows), AI agents, public APIs, and third-party integrations. The app runs in a sandbox during development and deploys to Cloudflare Workers for production.',
|
|
53
|
-
structure: APP_STRUCTURE,
|
|
54
|
-
nextSteps: [
|
|
55
|
-
`cd ${dir}`,
|
|
56
|
-
'runwork dev --detach --json # FIRST: start the dev sandbox in the background; capture the preview URL from the session_started event',
|
|
57
|
-
'THEN edit files for your needs (see structure above) -- changes auto-sync to the preview',
|
|
58
|
-
'runwork deploy # deploy to production when ready',
|
|
59
|
-
],
|
|
60
|
-
tips: COMMON_TIPS,
|
|
61
|
-
learnMore: 'Read CLAUDE.md in the app directory for complete framework documentation with code examples.',
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export function buildCloneGuide(appName, dir) {
|
|
65
|
-
return {
|
|
66
|
-
context: 'Cloned an existing Runwork app. This app may already have entities, workflows, agents, and other features configured. Check the existing files before making changes.',
|
|
67
|
-
structure: APP_STRUCTURE,
|
|
68
|
-
nextSteps: [
|
|
69
|
-
`cd ${dir}`,
|
|
70
|
-
'runwork dev --detach --json # FIRST: start dev in the background, capture the preview URL',
|
|
71
|
-
'Review existing files to understand what is already built',
|
|
72
|
-
'THEN edit files for your needs -- changes auto-sync to the preview',
|
|
73
|
-
'runwork deploy # deploy to production when ready',
|
|
74
|
-
],
|
|
75
|
-
tips: [SYSTEM_DEPENDENCIES_NOTE, ...COMMON_TIPS],
|
|
76
|
-
learnMore: 'Read CLAUDE.md in the app directory for complete framework documentation.',
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export function buildDevSessionGuide() {
|
|
80
|
-
return {
|
|
81
|
-
context: 'Development server is running. Files are watched and synced to a sandbox automatically. Edit your code and changes will appear at the preview URL.',
|
|
82
|
-
nextSteps: [
|
|
83
|
-
'Edit files in the app directory -- changes sync automatically',
|
|
84
|
-
'Open the preview URL to see your app',
|
|
85
|
-
'Run runwork deploy in another terminal when ready for production',
|
|
86
|
-
],
|
|
87
|
-
tips: [
|
|
88
|
-
SYSTEM_DEPENDENCIES_NOTE,
|
|
89
|
-
'You in normal cases do NOT need to run git commands manually. The dev server handles all file syncing (it shells out to the system git binary, which must be installed).',
|
|
90
|
-
'If the preview seems stuck, try runwork dev again to restart the session.',
|
|
91
|
-
],
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
export function buildDeployGuide() {
|
|
95
|
-
return {
|
|
96
|
-
context: 'App deployed to production on Cloudflare Workers. The production URL is live and serving traffic. Registered resources (entities, schedules, workflows, agents) are active.',
|
|
97
|
-
nextSteps: [
|
|
98
|
-
'Verify the app at the production URL',
|
|
99
|
-
'Run runwork info to see all registered resources and their status',
|
|
100
|
-
'Share the production URL with users or integrate it into other systems',
|
|
101
|
-
],
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
export function buildInfoGuide() {
|
|
105
|
-
return {
|
|
106
|
-
context: 'This shows the current state of the app: what is deployed, what integrations are connected, and what resources (entities, workflows, agents, etc.) are registered. The `localDevSession` field tells you whether a dev session is already running on this machine -- check it BEFORE starting a new one.',
|
|
107
|
-
nextSteps: [
|
|
108
|
-
'If localDevSession.state == "alive": dev is already running. Use the URL in localDevSession.previewUrl and proceed with edits.',
|
|
109
|
-
'If localDevSession.state == "none" or "stale": run `runwork dev --detach --json` BEFORE editing any code. Capture the preview URL from the session_started event.',
|
|
110
|
-
'runwork deploy # deploy to production when ready',
|
|
111
|
-
],
|
|
112
|
-
tips: [
|
|
113
|
-
DEV_FIRST_RULE,
|
|
114
|
-
'Entities listed here are the data models available via Entity CRUD methods.',
|
|
115
|
-
'Workflows listed here can be triggered via their registered endpoints or schedules.',
|
|
116
|
-
'Agents listed here need frontend pages (conversational) or triggers (task) to be accessible.',
|
|
117
|
-
'Integrations with connected status are ready to use. Others need setup in workspace settings.',
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
export function buildErrorResponse(command, message, diagnosis, suggestions) {
|
|
122
|
-
return {
|
|
123
|
-
success: false,
|
|
124
|
-
command,
|
|
125
|
-
result: null,
|
|
126
|
-
error: { message, diagnosis, suggestions },
|
|
127
|
-
};
|
|
128
|
-
}
|
package/dist/utils/app-info.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ApiClient } from '../api/client.js';
|
|
2
|
-
import type { WorkspaceAllData } from '../types.js';
|
|
3
|
-
export interface AppInfoData {
|
|
4
|
-
app: {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
slug: string;
|
|
8
|
-
};
|
|
9
|
-
workspace: {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
};
|
|
13
|
-
preview: {
|
|
14
|
-
url: string | null;
|
|
15
|
-
active: boolean;
|
|
16
|
-
};
|
|
17
|
-
production: {
|
|
18
|
-
url: string | null;
|
|
19
|
-
deployed: boolean;
|
|
20
|
-
};
|
|
21
|
-
dashboardUrl: string;
|
|
22
|
-
gitRemoteUrl: string;
|
|
23
|
-
registries: AppRegistries | null;
|
|
24
|
-
}
|
|
25
|
-
export interface AppRegistries {
|
|
26
|
-
entities: Array<{
|
|
27
|
-
name: string;
|
|
28
|
-
deploymentMode?: string;
|
|
29
|
-
}>;
|
|
30
|
-
workflows: Array<{
|
|
31
|
-
name: string;
|
|
32
|
-
description?: string;
|
|
33
|
-
deploymentMode?: string;
|
|
34
|
-
}>;
|
|
35
|
-
scheduledJobs: Array<{
|
|
36
|
-
name: string;
|
|
37
|
-
schedule?: string;
|
|
38
|
-
deploymentMode?: string;
|
|
39
|
-
}>;
|
|
40
|
-
agents: Array<{
|
|
41
|
-
name: string;
|
|
42
|
-
type?: string;
|
|
43
|
-
description?: string;
|
|
44
|
-
deploymentMode?: string;
|
|
45
|
-
}>;
|
|
46
|
-
publicEndpoints: Array<{
|
|
47
|
-
path: string;
|
|
48
|
-
method?: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
deploymentMode?: string;
|
|
51
|
-
}>;
|
|
52
|
-
components: Array<{
|
|
53
|
-
name: string;
|
|
54
|
-
deploymentMode?: string;
|
|
55
|
-
}>;
|
|
56
|
-
fileStorage: boolean;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Fetch app-specific info from the API.
|
|
60
|
-
* Optionally accepts pre-fetched serverData to avoid duplicate getWorkspaceAll calls.
|
|
61
|
-
*/
|
|
62
|
-
export declare function fetchAppInfo(client: ApiClient, opts: {
|
|
63
|
-
appId: string;
|
|
64
|
-
appName: string;
|
|
65
|
-
appSlug: string;
|
|
66
|
-
workspaceId: string;
|
|
67
|
-
workspaceName: string;
|
|
68
|
-
baseUrl: string;
|
|
69
|
-
}, serverData?: WorkspaceAllData | null): Promise<AppInfoData>;
|
|
70
|
-
export declare function printAppInfo(data: AppInfoData): void;
|
package/dist/utils/app-info.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { bold, cyan, dim, green, gray } from '../ui/colors.js';
|
|
2
|
-
/**
|
|
3
|
-
* Fetch app-specific info from the API.
|
|
4
|
-
* Optionally accepts pre-fetched serverData to avoid duplicate getWorkspaceAll calls.
|
|
5
|
-
*/
|
|
6
|
-
export async function fetchAppInfo(client, opts, serverData) {
|
|
7
|
-
let preview = { url: null, active: false };
|
|
8
|
-
try {
|
|
9
|
-
const status = await client.getDevStatus(opts.appId);
|
|
10
|
-
if (status.previewUrl) {
|
|
11
|
-
preview = { url: status.previewUrl, active: true };
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
// No active dev session
|
|
16
|
-
}
|
|
17
|
-
let production = { url: null, deployed: false };
|
|
18
|
-
try {
|
|
19
|
-
const app = await client.getApp(opts.appId);
|
|
20
|
-
if (app.production) {
|
|
21
|
-
production = app.production;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
// App lookup failed; leave production unset
|
|
26
|
-
}
|
|
27
|
-
let registries = null;
|
|
28
|
-
const data = serverData !== undefined ? serverData : await fetchServerData(client, opts.workspaceId);
|
|
29
|
-
if (data) {
|
|
30
|
-
registries = filterRegistriesToApp(data, opts.appId);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
app: { id: opts.appId, name: opts.appName, slug: opts.appSlug },
|
|
34
|
-
workspace: { id: opts.workspaceId, name: opts.workspaceName },
|
|
35
|
-
preview,
|
|
36
|
-
production,
|
|
37
|
-
dashboardUrl: `${opts.baseUrl}/chat/${opts.appId}`,
|
|
38
|
-
gitRemoteUrl: client.getGitRemoteUrl(opts.workspaceId, opts.appId),
|
|
39
|
-
registries,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
async function fetchServerData(client, workspaceId) {
|
|
43
|
-
try {
|
|
44
|
-
return await client.getWorkspaceAll(workspaceId);
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function filterRegistriesToApp(data, appId) {
|
|
51
|
-
return {
|
|
52
|
-
entities: data.entities.filter(e => e.appId === appId).map(e => ({
|
|
53
|
-
name: e.entityName, deploymentMode: e.deploymentMode,
|
|
54
|
-
})),
|
|
55
|
-
workflows: data.workflows.filter(w => w.appId === appId).map(w => ({
|
|
56
|
-
name: w.name, description: w.description, deploymentMode: w.deploymentMode,
|
|
57
|
-
})),
|
|
58
|
-
scheduledJobs: data.schedules.filter(s => s.appId === appId).map(s => ({
|
|
59
|
-
name: s.name, schedule: s.schedule, deploymentMode: s.deploymentMode,
|
|
60
|
-
})),
|
|
61
|
-
agents: data.agents.filter(a => a.appId === appId).map(a => ({
|
|
62
|
-
name: a.name, type: a.type, description: a.description, deploymentMode: a.deploymentMode,
|
|
63
|
-
})),
|
|
64
|
-
publicEndpoints: data.endpoints.filter(e => e.appId === appId).map(e => ({
|
|
65
|
-
path: e.path, method: e.method, description: e.description, deploymentMode: e.deploymentMode,
|
|
66
|
-
})),
|
|
67
|
-
components: data.components.filter(c => c.appId === appId).map(c => ({
|
|
68
|
-
name: c.componentName, deploymentMode: c.deploymentMode,
|
|
69
|
-
})),
|
|
70
|
-
fileStorage: data.fileStorages.some(f => f.appId === appId),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function formatMode(mode) {
|
|
74
|
-
if (mode === 'production')
|
|
75
|
-
return green('prod');
|
|
76
|
-
if (mode === 'preview')
|
|
77
|
-
return dim('preview');
|
|
78
|
-
return '';
|
|
79
|
-
}
|
|
80
|
-
export function printAppInfo(data) {
|
|
81
|
-
const pad = (label) => label.padEnd(14);
|
|
82
|
-
console.log('');
|
|
83
|
-
console.log(bold('App'));
|
|
84
|
-
console.log('');
|
|
85
|
-
console.log(` ${dim(pad('Name:'))}${bold(data.app.name)}`);
|
|
86
|
-
console.log(` ${dim(pad('ID:'))}${data.app.id}`);
|
|
87
|
-
console.log(` ${dim(pad('Workspace:'))}${data.workspace.name || data.workspace.id}`);
|
|
88
|
-
console.log(` ${dim(pad('Dashboard:'))}${cyan(data.dashboardUrl)}`);
|
|
89
|
-
console.log(` ${dim(pad('Git Remote:'))}${data.gitRemoteUrl}`);
|
|
90
|
-
if (data.preview.url) {
|
|
91
|
-
console.log(` ${dim(pad('Preview:'))}${green(data.preview.url)} ${dim('(running)')}`);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
console.log(` ${dim(pad('Preview:'))}${dim('(not running)')}`);
|
|
95
|
-
}
|
|
96
|
-
if (data.production.url) {
|
|
97
|
-
console.log(` ${dim(pad('Production:'))}${green(data.production.url)} ${dim('(deployed)')}`);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
console.log(` ${dim(pad('Production:'))}${dim('(not deployed)')}`);
|
|
101
|
-
}
|
|
102
|
-
const reg = data.registries;
|
|
103
|
-
if (!reg) {
|
|
104
|
-
console.log('');
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const hasAny = reg.entities.length > 0 || reg.workflows.length > 0 ||
|
|
108
|
-
reg.scheduledJobs.length > 0 || reg.agents.length > 0 ||
|
|
109
|
-
reg.publicEndpoints.length > 0 || reg.components.length > 0 || reg.fileStorage;
|
|
110
|
-
if (!hasAny) {
|
|
111
|
-
console.log('');
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
console.log('');
|
|
115
|
-
console.log(bold('Registries'));
|
|
116
|
-
console.log('');
|
|
117
|
-
if (reg.entities.length > 0) {
|
|
118
|
-
console.log(` ${bold('Entities:')}`);
|
|
119
|
-
for (const e of reg.entities) {
|
|
120
|
-
console.log(` ${e.name.padEnd(24)} ${formatMode(e.deploymentMode)}`);
|
|
121
|
-
}
|
|
122
|
-
console.log('');
|
|
123
|
-
}
|
|
124
|
-
if (reg.workflows.length > 0) {
|
|
125
|
-
console.log(` ${bold('Workflows:')}`);
|
|
126
|
-
for (const w of reg.workflows) {
|
|
127
|
-
const desc = w.description ? ` ${dim(w.description)}` : '';
|
|
128
|
-
console.log(` ${w.name.padEnd(24)} ${formatMode(w.deploymentMode)}${desc}`);
|
|
129
|
-
}
|
|
130
|
-
console.log('');
|
|
131
|
-
}
|
|
132
|
-
if (reg.scheduledJobs.length > 0) {
|
|
133
|
-
console.log(` ${bold('Scheduled Jobs:')}`);
|
|
134
|
-
for (const s of reg.scheduledJobs) {
|
|
135
|
-
const schedule = s.schedule ? ` ${gray(s.schedule)}` : '';
|
|
136
|
-
console.log(` ${s.name.padEnd(24)} ${formatMode(s.deploymentMode)}${schedule}`);
|
|
137
|
-
}
|
|
138
|
-
console.log('');
|
|
139
|
-
}
|
|
140
|
-
if (reg.agents.length > 0) {
|
|
141
|
-
console.log(` ${bold('Agents:')}`);
|
|
142
|
-
for (const a of reg.agents) {
|
|
143
|
-
const type = a.type ? ` ${dim(a.type)}` : '';
|
|
144
|
-
console.log(` ${a.name.padEnd(24)} ${formatMode(a.deploymentMode)}${type}`);
|
|
145
|
-
}
|
|
146
|
-
console.log('');
|
|
147
|
-
}
|
|
148
|
-
if (reg.publicEndpoints.length > 0) {
|
|
149
|
-
console.log(` ${bold('Public Endpoints:')}`);
|
|
150
|
-
for (const e of reg.publicEndpoints) {
|
|
151
|
-
const label = e.method ? `${e.method} ${e.path}` : e.path;
|
|
152
|
-
console.log(` ${label.padEnd(24)} ${formatMode(e.deploymentMode)}`);
|
|
153
|
-
}
|
|
154
|
-
console.log('');
|
|
155
|
-
}
|
|
156
|
-
if (reg.components.length > 0) {
|
|
157
|
-
console.log(` ${bold('Components:')}`);
|
|
158
|
-
for (const c of reg.components) {
|
|
159
|
-
console.log(` ${c.name.padEnd(24)} ${formatMode(c.deploymentMode)}`);
|
|
160
|
-
}
|
|
161
|
-
console.log('');
|
|
162
|
-
}
|
|
163
|
-
if (reg.fileStorage) {
|
|
164
|
-
console.log(` ${bold('File Storage:')} ${green('enabled')}`);
|
|
165
|
-
console.log('');
|
|
166
|
-
}
|
|
167
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface ParsedRequest {
|
|
2
|
-
method: string;
|
|
3
|
-
path: string;
|
|
4
|
-
query?: string;
|
|
5
|
-
headers: Record<string, string>;
|
|
6
|
-
body?: unknown;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Parse a curl command string into a structured request.
|
|
10
|
-
* Pure JS implementation, no native dependencies.
|
|
11
|
-
*/
|
|
12
|
-
export declare function parseCurlToRequest(curlStr: string): Promise<ParsedRequest>;
|