runwork 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19272 -116
- package/package.json +4 -4
- package/dist/__tests__/curl-parser.test.d.ts +0 -1
- package/dist/__tests__/curl-parser.test.js +0 -250
- package/dist/__tests__/install-scripts.test.d.ts +0 -1
- package/dist/__tests__/install-scripts.test.js +0 -280
- package/dist/__tests__/types-manager.test.d.ts +0 -1
- package/dist/__tests__/types-manager.test.js +0 -89
- package/dist/agents/__tests__/chatgpt-registry.test.d.ts +0 -1
- package/dist/agents/__tests__/chatgpt-registry.test.js +0 -61
- package/dist/agents/__tests__/claude-code-managed-block.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-code-managed-block.test.js +0 -97
- package/dist/agents/__tests__/claude-code-plugin.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-code-plugin.test.js +0 -47
- package/dist/agents/__tests__/claude-code-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-code-stats.test.js +0 -390
- package/dist/agents/__tests__/claude-desktop-memory.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-memory.test.js +0 -154
- package/dist/agents/__tests__/claude-desktop-plugin-tree.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-plugin-tree.test.js +0 -161
- package/dist/agents/__tests__/claude-desktop-plugin.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-plugin.test.js +0 -117
- package/dist/agents/__tests__/claude-desktop-rpm.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-rpm.test.js +0 -126
- package/dist/agents/__tests__/claude-desktop-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/claude-desktop-stats.test.js +0 -280
- package/dist/agents/__tests__/codex-instructions.test.d.ts +0 -1
- package/dist/agents/__tests__/codex-instructions.test.js +0 -57
- package/dist/agents/__tests__/codex-minimum-permissions.test.d.ts +0 -1
- package/dist/agents/__tests__/codex-minimum-permissions.test.js +0 -82
- package/dist/agents/__tests__/codex-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/codex-stats.test.js +0 -370
- package/dist/agents/__tests__/cursor-merge.test.d.ts +0 -1
- package/dist/agents/__tests__/cursor-merge.test.js +0 -66
- package/dist/agents/__tests__/cursor-stats.test.d.ts +0 -1
- package/dist/agents/__tests__/cursor-stats.test.js +0 -183
- package/dist/agents/__tests__/defaults-merge.test.d.ts +0 -1
- package/dist/agents/__tests__/defaults-merge.test.js +0 -268
- package/dist/agents/__tests__/detection.test.d.ts +0 -1
- package/dist/agents/__tests__/detection.test.js +0 -89
- package/dist/agents/__tests__/graceful-degradation.test.d.ts +0 -1
- package/dist/agents/__tests__/graceful-degradation.test.js +0 -129
- package/dist/agents/__tests__/instruction-hint.test.d.ts +0 -1
- package/dist/agents/__tests__/instruction-hint.test.js +0 -69
- package/dist/agents/__tests__/intro-skill.test.d.ts +0 -1
- package/dist/agents/__tests__/intro-skill.test.js +0 -193
- package/dist/agents/__tests__/schema-validation.test.d.ts +0 -1
- package/dist/agents/__tests__/schema-validation.test.js +0 -212
- package/dist/agents/__tests__/skill-slug.test.d.ts +0 -1
- package/dist/agents/__tests__/skill-slug.test.js +0 -77
- package/dist/agents/claude-code.d.ts +0 -53
- package/dist/agents/claude-code.js +0 -754
- package/dist/agents/claude-desktop-plugin-tree.d.ts +0 -59
- package/dist/agents/claude-desktop-plugin-tree.js +0 -143
- package/dist/agents/claude-desktop.d.ts +0 -47
- package/dist/agents/claude-desktop.js +0 -684
- package/dist/agents/cline.d.ts +0 -15
- package/dist/agents/cline.js +0 -130
- package/dist/agents/codex.d.ts +0 -44
- package/dist/agents/codex.js +0 -453
- package/dist/agents/conversation-skills.d.ts +0 -18
- package/dist/agents/conversation-skills.js +0 -229
- package/dist/agents/cursor.d.ts +0 -48
- package/dist/agents/cursor.js +0 -324
- package/dist/agents/default-config.d.ts +0 -30
- package/dist/agents/default-config.js +0 -67
- package/dist/agents/defaults-merge.d.ts +0 -72
- package/dist/agents/defaults-merge.js +0 -131
- package/dist/agents/detect.d.ts +0 -4
- package/dist/agents/detect.js +0 -67
- package/dist/agents/detection.d.ts +0 -18
- package/dist/agents/detection.js +0 -94
- package/dist/agents/gemini.d.ts +0 -15
- package/dist/agents/gemini.js +0 -122
- package/dist/agents/generic-adapter.d.ts +0 -25
- package/dist/agents/generic-adapter.js +0 -151
- package/dist/agents/intro-skill.d.ts +0 -45
- package/dist/agents/intro-skill.js +0 -447
- package/dist/agents/registry-data.d.ts +0 -192
- package/dist/agents/registry-data.js +0 -669
- package/dist/agents/registry.d.ts +0 -13
- package/dist/agents/registry.js +0 -36
- package/dist/agents/runtime-detection.d.ts +0 -82
- package/dist/agents/runtime-detection.js +0 -271
- package/dist/agents/session-start-hook.d.ts +0 -37
- package/dist/agents/session-start-hook.js +0 -159
- package/dist/agents/types.d.ts +0 -171
- package/dist/agents/types.js +0 -75
- package/dist/agents/utils/instruction-hint.d.ts +0 -21
- package/dist/agents/utils/instruction-hint.js +0 -108
- package/dist/agents/utils/json-config.d.ts +0 -19
- package/dist/agents/utils/json-config.js +0 -69
- package/dist/agents/utils/toml-config.d.ts +0 -8
- package/dist/agents/utils/toml-config.js +0 -27
- package/dist/agents/windsurf.d.ts +0 -14
- package/dist/agents/windsurf.js +0 -102
- package/dist/api/__tests__/client.test.d.ts +0 -1
- package/dist/api/__tests__/client.test.js +0 -272
- package/dist/api/client.d.ts +0 -326
- package/dist/api/client.js +0 -427
- package/dist/auth/__tests__/login-flow.test.d.ts +0 -1
- package/dist/auth/__tests__/login-flow.test.js +0 -101
- package/dist/auth/__tests__/store.test.d.ts +0 -1
- package/dist/auth/__tests__/store.test.js +0 -132
- package/dist/auth/login-flow.d.ts +0 -26
- package/dist/auth/login-flow.js +0 -137
- package/dist/auth/store.d.ts +0 -5
- package/dist/auth/store.js +0 -62
- package/dist/commands/__tests__/clone-args.test.d.ts +0 -1
- package/dist/commands/__tests__/clone-args.test.js +0 -51
- package/dist/commands/__tests__/clone-source-result.test.d.ts +0 -1
- package/dist/commands/__tests__/clone-source-result.test.js +0 -45
- package/dist/commands/__tests__/info-merge.test.d.ts +0 -1
- package/dist/commands/__tests__/info-merge.test.js +0 -55
- package/dist/commands/__tests__/mcp-entries.test.d.ts +0 -1
- package/dist/commands/__tests__/mcp-entries.test.js +0 -48
- package/dist/commands/__tests__/setup-persona.test.d.ts +0 -1
- package/dist/commands/__tests__/setup-persona.test.js +0 -31
- package/dist/commands/__tests__/setup.test.d.ts +0 -1
- package/dist/commands/__tests__/setup.test.js +0 -81
- package/dist/commands/__tests__/sync-redetect.test.d.ts +0 -1
- package/dist/commands/__tests__/sync-redetect.test.js +0 -96
- package/dist/commands/__tests__/sync-telemetry.test.d.ts +0 -1
- package/dist/commands/__tests__/sync-telemetry.test.js +0 -281
- package/dist/commands/__tests__/upgrade.test.d.ts +0 -1
- package/dist/commands/__tests__/upgrade.test.js +0 -157
- package/dist/commands/agents.d.ts +0 -2
- package/dist/commands/agents.js +0 -160
- package/dist/commands/api-keys.d.ts +0 -2
- package/dist/commands/api-keys.js +0 -95
- package/dist/commands/apps.d.ts +0 -2
- package/dist/commands/apps.js +0 -82
- package/dist/commands/build-plugin.d.ts +0 -2
- package/dist/commands/build-plugin.js +0 -135
- package/dist/commands/clone.d.ts +0 -60
- package/dist/commands/clone.js +0 -271
- package/dist/commands/components.d.ts +0 -2
- package/dist/commands/components.js +0 -43
- package/dist/commands/deploy.d.ts +0 -2
- package/dist/commands/deploy.js +0 -279
- package/dist/commands/dev.d.ts +0 -11
- package/dist/commands/dev.js +0 -1011
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.js +0 -230
- package/dist/commands/endpoints.d.ts +0 -2
- package/dist/commands/endpoints.js +0 -189
- package/dist/commands/entities.d.ts +0 -2
- package/dist/commands/entities.js +0 -198
- package/dist/commands/files.d.ts +0 -2
- package/dist/commands/files.js +0 -193
- package/dist/commands/inbox.d.ts +0 -11
- package/dist/commands/inbox.js +0 -60
- package/dist/commands/info.d.ts +0 -178
- package/dist/commands/info.js +0 -455
- package/dist/commands/init.d.ts +0 -21
- package/dist/commands/init.js +0 -185
- package/dist/commands/integrations.d.ts +0 -2
- package/dist/commands/integrations.js +0 -233
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.js +0 -44
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.js +0 -13
- package/dist/commands/logs.d.ts +0 -2
- package/dist/commands/logs.js +0 -232
- package/dist/commands/mcp-entries.d.ts +0 -13
- package/dist/commands/mcp-entries.js +0 -26
- package/dist/commands/mcp.d.ts +0 -2
- package/dist/commands/mcp.js +0 -245
- package/dist/commands/open.d.ts +0 -2
- package/dist/commands/open.js +0 -53
- package/dist/commands/resume.d.ts +0 -2
- package/dist/commands/resume.js +0 -289
- package/dist/commands/save-convo.d.ts +0 -8
- package/dist/commands/save-convo.js +0 -20
- package/dist/commands/schedules.d.ts +0 -2
- package/dist/commands/schedules.js +0 -221
- package/dist/commands/setup.d.ts +0 -27
- package/dist/commands/setup.js +0 -177
- package/dist/commands/share-convo.d.ts +0 -24
- package/dist/commands/share-convo.js +0 -167
- package/dist/commands/skills.d.ts +0 -2
- package/dist/commands/skills.js +0 -352
- package/dist/commands/sync-telemetry.d.ts +0 -33
- package/dist/commands/sync-telemetry.js +0 -186
- package/dist/commands/sync.d.ts +0 -37
- package/dist/commands/sync.js +0 -702
- package/dist/commands/uninstall.d.ts +0 -2
- package/dist/commands/uninstall.js +0 -145
- package/dist/commands/upgrade.d.ts +0 -14
- package/dist/commands/upgrade.js +0 -217
- package/dist/commands/validate.d.ts +0 -2
- package/dist/commands/validate.js +0 -89
- package/dist/commands/welcome.d.ts +0 -1
- package/dist/commands/welcome.js +0 -86
- package/dist/commands/workflows.d.ts +0 -2
- package/dist/commands/workflows.js +0 -187
- package/dist/deploy/__tests__/deploy-state.test.d.ts +0 -1
- package/dist/deploy/__tests__/deploy-state.test.js +0 -80
- package/dist/deploy/__tests__/deploy-status.test.d.ts +0 -1
- package/dist/deploy/__tests__/deploy-status.test.js +0 -41
- package/dist/deploy/__tests__/detach-args.test.d.ts +0 -1
- package/dist/deploy/__tests__/detach-args.test.js +0 -30
- package/dist/deploy/deploy-state.d.ts +0 -36
- package/dist/deploy/deploy-state.js +0 -63
- package/dist/deploy/deploy-status.d.ts +0 -21
- package/dist/deploy/deploy-status.js +0 -36
- package/dist/deploy/detach.d.ts +0 -32
- package/dist/deploy/detach.js +0 -71
- package/dist/dev/__tests__/attach.test.d.ts +0 -1
- package/dist/dev/__tests__/attach.test.js +0 -296
- package/dist/dev/__tests__/detach.test.d.ts +0 -1
- package/dist/dev/__tests__/detach.test.js +0 -404
- package/dist/dev/__tests__/preview-url-poller.test.d.ts +0 -1
- package/dist/dev/__tests__/preview-url-poller.test.js +0 -149
- package/dist/dev/__tests__/session.test.d.ts +0 -1
- package/dist/dev/__tests__/session.test.js +0 -446
- package/dist/dev/__tests__/startup-sync.test.d.ts +0 -1
- package/dist/dev/__tests__/startup-sync.test.js +0 -32
- package/dist/dev/__tests__/stop.test.d.ts +0 -1
- package/dist/dev/__tests__/stop.test.js +0 -172
- package/dist/dev/attach.d.ts +0 -120
- package/dist/dev/attach.js +0 -269
- package/dist/dev/detach.d.ts +0 -187
- package/dist/dev/detach.js +0 -292
- package/dist/dev/preview-url-poller.d.ts +0 -35
- package/dist/dev/preview-url-poller.js +0 -50
- package/dist/dev/session.d.ts +0 -175
- package/dist/dev/session.js +0 -258
- package/dist/dev/startup-sync.d.ts +0 -23
- package/dist/dev/startup-sync.js +0 -14
- package/dist/dev/stop.d.ts +0 -52
- package/dist/dev/stop.js +0 -101
- package/dist/devtools/registry-data.d.ts +0 -46
- package/dist/devtools/registry-data.js +0 -40
- package/dist/generated/bundled-types.d.ts +0 -1
- package/dist/generated/bundled-types.js +0 -46
- package/dist/generated/version.d.ts +0 -1
- package/dist/generated/version.js +0 -2
- package/dist/git/__tests__/auto-commit.test.d.ts +0 -1
- package/dist/git/__tests__/auto-commit.test.js +0 -431
- package/dist/git/__tests__/classify-sync-error.test.d.ts +0 -1
- package/dist/git/__tests__/classify-sync-error.test.js +0 -57
- package/dist/git/__tests__/credential-helper-e2e.test.d.ts +0 -21
- package/dist/git/__tests__/credential-helper-e2e.test.js +0 -195
- package/dist/git/__tests__/credentials.test.d.ts +0 -1
- package/dist/git/__tests__/credentials.test.js +0 -141
- package/dist/git/__tests__/deploy-guard.test.d.ts +0 -1
- package/dist/git/__tests__/deploy-guard.test.js +0 -61
- package/dist/git/__tests__/ensure-git-credential-helper.test.d.ts +0 -1
- package/dist/git/__tests__/ensure-git-credential-helper.test.js +0 -133
- package/dist/git/__tests__/ensure-runwork-remote.test.d.ts +0 -1
- package/dist/git/__tests__/ensure-runwork-remote.test.js +0 -109
- package/dist/git/__tests__/identity.test.d.ts +0 -1
- package/dist/git/__tests__/identity.test.js +0 -146
- package/dist/git/__tests__/manifest.test.d.ts +0 -1
- package/dist/git/__tests__/manifest.test.js +0 -446
- package/dist/git/__tests__/preflight-resolution.test.d.ts +0 -1
- package/dist/git/__tests__/preflight-resolution.test.js +0 -366
- package/dist/git/__tests__/preflight.test.d.ts +0 -1
- package/dist/git/__tests__/preflight.test.js +0 -36
- package/dist/git/__tests__/repo-config.test.d.ts +0 -1
- package/dist/git/__tests__/repo-config.test.js +0 -26
- package/dist/git/__tests__/sync.test.d.ts +0 -1
- package/dist/git/__tests__/sync.test.js +0 -405
- package/dist/git/auto-commit.d.ts +0 -35
- package/dist/git/auto-commit.js +0 -293
- package/dist/git/classify-sync-error.d.ts +0 -21
- package/dist/git/classify-sync-error.js +0 -111
- package/dist/git/credentials.d.ts +0 -75
- package/dist/git/credentials.js +0 -164
- package/dist/git/critical-files.d.ts +0 -20
- package/dist/git/critical-files.js +0 -68
- package/dist/git/deploy-guard.d.ts +0 -53
- package/dist/git/deploy-guard.js +0 -78
- package/dist/git/identity.d.ts +0 -44
- package/dist/git/identity.js +0 -133
- package/dist/git/preflight.d.ts +0 -57
- package/dist/git/preflight.js +0 -276
- package/dist/git/remote.d.ts +0 -37
- package/dist/git/remote.js +0 -75
- package/dist/git/repo-config.d.ts +0 -8
- package/dist/git/repo-config.js +0 -29
- package/dist/git/sync.d.ts +0 -15
- package/dist/git/sync.js +0 -159
- package/dist/health/__tests__/checks.test.d.ts +0 -1
- package/dist/health/__tests__/checks.test.js +0 -357
- package/dist/health/__tests__/cli-distribution-checks.test.d.ts +0 -1
- package/dist/health/__tests__/cli-distribution-checks.test.js +0 -196
- package/dist/health/__tests__/fix.test.d.ts +0 -1
- package/dist/health/__tests__/fix.test.js +0 -72
- package/dist/health/__tests__/runner-filter.test.d.ts +0 -1
- package/dist/health/__tests__/runner-filter.test.js +0 -61
- package/dist/health/checks.d.ts +0 -42
- package/dist/health/checks.js +0 -636
- package/dist/health/fix.d.ts +0 -22
- package/dist/health/fix.js +0 -62
- package/dist/health/runner.d.ts +0 -8
- package/dist/health/runner.js +0 -47
- package/dist/health/types.d.ts +0 -12
- package/dist/health/types.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/logs/__tests__/tailer-format.test.d.ts +0 -1
- package/dist/logs/__tests__/tailer-format.test.js +0 -43
- package/dist/logs/tailer.d.ts +0 -17
- package/dist/logs/tailer.js +0 -217
- package/dist/sync/__tests__/change-detect.test.d.ts +0 -1
- package/dist/sync/__tests__/change-detect.test.js +0 -123
- package/dist/sync/__tests__/hash.test.d.ts +0 -1
- package/dist/sync/__tests__/hash.test.js +0 -18
- package/dist/sync/change-detect.d.ts +0 -19
- package/dist/sync/change-detect.js +0 -136
- package/dist/sync/conflict-ui.d.ts +0 -5
- package/dist/sync/conflict-ui.js +0 -78
- package/dist/sync/executor.d.ts +0 -23
- package/dist/sync/executor.js +0 -102
- package/dist/sync/hash.d.ts +0 -1
- package/dist/sync/hash.js +0 -4
- package/dist/sync/types.d.ts +0 -24
- package/dist/sync/types.js +0 -1
- package/dist/template/manifest.d.ts +0 -17
- package/dist/template/manifest.js +0 -145
- package/dist/tools/types.d.ts +0 -52
- package/dist/tools/types.js +0 -8
- package/dist/types-manager.d.ts +0 -1
- package/dist/types-manager.js +0 -35
- package/dist/types.d.ts +0 -349
- package/dist/types.js +0 -1
- package/dist/ui/__tests__/banner.test.d.ts +0 -1
- package/dist/ui/__tests__/banner.test.js +0 -98
- package/dist/ui/__tests__/colors.test.d.ts +0 -1
- package/dist/ui/__tests__/colors.test.js +0 -22
- package/dist/ui/__tests__/keyboard.test.d.ts +0 -1
- package/dist/ui/__tests__/keyboard.test.js +0 -34
- package/dist/ui/__tests__/status-line.test.d.ts +0 -1
- package/dist/ui/__tests__/status-line.test.js +0 -54
- package/dist/ui/banner.d.ts +0 -29
- package/dist/ui/banner.js +0 -153
- package/dist/ui/colors.d.ts +0 -4
- package/dist/ui/colors.js +0 -7
- package/dist/ui/keyboard.d.ts +0 -12
- package/dist/ui/keyboard.js +0 -61
- package/dist/ui/status-line.d.ts +0 -6
- package/dist/ui/status-line.js +0 -53
- package/dist/utils/__tests__/format-error.test.d.ts +0 -1
- package/dist/utils/__tests__/format-error.test.js +0 -43
- package/dist/utils/__tests__/help-json.test.d.ts +0 -1
- package/dist/utils/__tests__/help-json.test.js +0 -39
- package/dist/utils/__tests__/http.test.d.ts +0 -1
- package/dist/utils/__tests__/http.test.js +0 -381
- package/dist/utils/__tests__/ignore-matcher.test.d.ts +0 -1
- package/dist/utils/__tests__/ignore-matcher.test.js +0 -205
- package/dist/utils/__tests__/output.test.d.ts +0 -1
- package/dist/utils/__tests__/output.test.js +0 -38
- package/dist/utils/__tests__/prompt.test.d.ts +0 -1
- package/dist/utils/__tests__/prompt.test.js +0 -27
- package/dist/utils/__tests__/resolve.test.d.ts +0 -1
- package/dist/utils/__tests__/resolve.test.js +0 -95
- package/dist/utils/__tests__/sqlite.test.d.ts +0 -1
- package/dist/utils/__tests__/sqlite.test.js +0 -89
- package/dist/utils/agent-guidance.d.ts +0 -47
- package/dist/utils/agent-guidance.js +0 -128
- package/dist/utils/app-info.d.ts +0 -70
- package/dist/utils/app-info.js +0 -167
- package/dist/utils/curl-parser.d.ts +0 -12
- package/dist/utils/curl-parser.js +0 -162
- package/dist/utils/data-input.d.ts +0 -1
- package/dist/utils/data-input.js +0 -38
- package/dist/utils/format-error.d.ts +0 -10
- package/dist/utils/format-error.js +0 -38
- package/dist/utils/fs.d.ts +0 -5
- package/dist/utils/fs.js +0 -23
- package/dist/utils/help-json.d.ts +0 -70
- package/dist/utils/help-json.js +0 -88
- package/dist/utils/http.d.ts +0 -46
- package/dist/utils/http.js +0 -421
- package/dist/utils/ignore-matcher.d.ts +0 -47
- package/dist/utils/ignore-matcher.js +0 -132
- package/dist/utils/output.d.ts +0 -17
- package/dist/utils/output.js +0 -27
- package/dist/utils/prompt.d.ts +0 -5
- package/dist/utils/prompt.js +0 -42
- package/dist/utils/resolve.d.ts +0 -12
- package/dist/utils/resolve.js +0 -52
- package/dist/utils/setup-state.d.ts +0 -3
- package/dist/utils/setup-state.js +0 -19
- package/dist/utils/sqlite-adapter.d.ts +0 -48
- package/dist/utils/sqlite-adapter.js +0 -147
- package/dist/utils/sqlite.d.ts +0 -14
- package/dist/utils/sqlite.js +0 -14
- package/dist/utils/subprocess.d.ts +0 -19
- package/dist/utils/subprocess.js +0 -27
- package/dist/utils/which.d.ts +0 -14
- package/dist/utils/which.js +0 -47
- package/dist/utils/zip.d.ts +0 -7
- package/dist/utils/zip.js +0 -42
- package/dist/validate/__tests__/validate.test.d.ts +0 -1
- package/dist/validate/__tests__/validate.test.js +0 -42
- package/dist/validate/freshness.d.ts +0 -28
- package/dist/validate/freshness.js +0 -48
- package/dist/validate/preview.d.ts +0 -21
- package/dist/validate/preview.js +0 -39
- package/dist/workspace/resolve.d.ts +0 -19
- package/dist/workspace/resolve.js +0 -100
package/dist/health/fix.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { ensureGitCredentialHelper } from '../git/credentials.js';
|
|
4
|
-
import { ensureRunworkRemote } from '../git/remote.js';
|
|
5
|
-
/** Check names `runwork doctor --fix` knows how to auto-remediate. */
|
|
6
|
-
export const FIXABLE_CHECKS = ['git-credential-helper', 'git-remote'];
|
|
7
|
-
/**
|
|
8
|
-
* Apply auto-remediations for the failing checks doctor knows how to fix.
|
|
9
|
-
* Only acts on `failingNames` that are in FIXABLE_CHECKS; everything else is
|
|
10
|
-
* left for the user (with the `fix` hint each check already carries).
|
|
11
|
-
*
|
|
12
|
-
* - git-credential-helper -> register the runwork git helper for the logged-in
|
|
13
|
-
* origin (the B1 ensure-path), so headless-auth'd sessions can use git.
|
|
14
|
-
* - git-remote -> point the `runwork` remote at the app's canonical URL (the
|
|
15
|
-
* B2 ensure-path), using the correct `/api/git/...` URL from the API client.
|
|
16
|
-
*/
|
|
17
|
-
export async function applyDoctorFixes(ctx, failingNames) {
|
|
18
|
-
const failing = new Set(failingNames);
|
|
19
|
-
const outcomes = [];
|
|
20
|
-
if (failing.has('git-credential-helper')) {
|
|
21
|
-
if (ctx.credentials?.baseUrl) {
|
|
22
|
-
await ensureGitCredentialHelper(ctx.credentials.baseUrl);
|
|
23
|
-
outcomes.push({
|
|
24
|
-
name: 'git-credential-helper',
|
|
25
|
-
applied: true,
|
|
26
|
-
message: 'registered the runwork git credential helper',
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
outcomes.push({
|
|
31
|
-
name: 'git-credential-helper',
|
|
32
|
-
applied: false,
|
|
33
|
-
message: 'not logged in -- run `runwork login` first',
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (failing.has('git-remote')) {
|
|
38
|
-
if (!ctx.config || !ctx.client) {
|
|
39
|
-
outcomes.push({
|
|
40
|
-
name: 'git-remote',
|
|
41
|
-
applied: false,
|
|
42
|
-
message: 'no project config -- run inside an app directory',
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
else if (!existsSync(join(ctx.cwd, '.git'))) {
|
|
46
|
-
outcomes.push({
|
|
47
|
-
name: 'git-remote',
|
|
48
|
-
applied: false,
|
|
49
|
-
message: 'not a git repository -- run `git init` first',
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
ensureRunworkRemote(ctx.cwd, ctx.client.getGitRemoteUrl(ctx.config.workspaceId, ctx.config.appId));
|
|
54
|
-
outcomes.push({
|
|
55
|
-
name: 'git-remote',
|
|
56
|
-
applied: true,
|
|
57
|
-
message: 'configured the `runwork` remote at the canonical URL',
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return outcomes;
|
|
62
|
-
}
|
package/dist/health/runner.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { DoctorReport } from './types.js';
|
|
2
|
-
/** Every check name doctor knows about, in run order. Used to validate `--check`. */
|
|
3
|
-
export declare const ALL_CHECK_NAMES: readonly string[];
|
|
4
|
-
export interface RunChecksOptions {
|
|
5
|
-
/** When set, run only the named checks (skips unrelated work like network). */
|
|
6
|
-
only?: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare function runAllChecks(options?: RunChecksOptions): Promise<DoctorReport>;
|
package/dist/health/runner.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { buildContext, checkSystemDeps, checkCliVersion, checkCliArtifactReachable, checkCliInstallLocation, checkAuthAndNetwork, checkGitCredentialHelper, checkProjectConfig, checkAppExists, checkGitRemote, checkDeployFreshness, checkAgentSetup, } from './checks.js';
|
|
2
|
-
const CHECK_RUNNERS = [
|
|
3
|
-
{ names: ['system-deps'], run: async () => [await checkSystemDeps()] },
|
|
4
|
-
{ names: ['cli-version'], run: async () => [await checkCliVersion()] },
|
|
5
|
-
{ names: ['cli-artifact'], run: async () => [await checkCliArtifactReachable()] },
|
|
6
|
-
{ names: ['cli-install-location'], run: async () => [await checkCliInstallLocation()] },
|
|
7
|
-
// Auth + Network come from one combined call (network reuses the auth probe).
|
|
8
|
-
{
|
|
9
|
-
names: ['auth', 'network'],
|
|
10
|
-
run: async (ctx) => {
|
|
11
|
-
const { auth, network } = await checkAuthAndNetwork(ctx);
|
|
12
|
-
return [auth, network];
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
// Catches "logged in but git auth not wired up" -- on Windows this surfaces
|
|
16
|
-
// as a Git Credential Manager popup mid-clone with no obvious cause.
|
|
17
|
-
{ names: ['git-credential-helper'], run: async (ctx) => [await checkGitCredentialHelper(ctx)] },
|
|
18
|
-
{ names: ['project-config'], run: async (ctx) => [await checkProjectConfig(ctx)] },
|
|
19
|
-
{ names: ['app-exists'], run: async (ctx) => [await checkAppExists(ctx)] },
|
|
20
|
-
{ names: ['git-remote'], run: async (ctx) => [await checkGitRemote(ctx)] },
|
|
21
|
-
{ names: ['deploy-freshness'], run: async (ctx) => [await checkDeployFreshness(ctx)] },
|
|
22
|
-
{ names: ['agent-setup'], run: async () => [await checkAgentSetup()] },
|
|
23
|
-
];
|
|
24
|
-
/** Every check name doctor knows about, in run order. Used to validate `--check`. */
|
|
25
|
-
export const ALL_CHECK_NAMES = CHECK_RUNNERS.flatMap(r => r.names);
|
|
26
|
-
export async function runAllChecks(options) {
|
|
27
|
-
const ctx = buildContext();
|
|
28
|
-
const only = options?.only && options.only.length ? new Set(options.only) : null;
|
|
29
|
-
const checks = [];
|
|
30
|
-
for (const runner of CHECK_RUNNERS) {
|
|
31
|
-
// Skip a runner entirely unless at least one of its names was requested.
|
|
32
|
-
if (only && !runner.names.some(n => only.has(n)))
|
|
33
|
-
continue;
|
|
34
|
-
const results = await runner.run(ctx);
|
|
35
|
-
for (const result of results) {
|
|
36
|
-
// For multi-result runners (auth+network), include only the requested
|
|
37
|
-
// names when scoped -- e.g. `--check auth` shouldn't print network.
|
|
38
|
-
if (only && !only.has(result.name))
|
|
39
|
-
continue;
|
|
40
|
-
checks.push(result);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const hasFailure = checks.some(c => c.status === 'fail');
|
|
44
|
-
const hasWarning = checks.some(c => c.status === 'warn');
|
|
45
|
-
const status = hasFailure ? 'fail' : hasWarning ? 'warn' : 'pass';
|
|
46
|
-
return { status, checks };
|
|
47
|
-
}
|
package/dist/health/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type CheckStatus = 'pass' | 'warn' | 'fail' | 'skip';
|
|
2
|
-
export interface CheckResult {
|
|
3
|
-
name: string;
|
|
4
|
-
status: CheckStatus;
|
|
5
|
-
message: string;
|
|
6
|
-
fix?: string;
|
|
7
|
-
details?: string[];
|
|
8
|
-
}
|
|
9
|
-
export interface DoctorReport {
|
|
10
|
-
status: CheckStatus;
|
|
11
|
-
checks: CheckResult[];
|
|
12
|
-
}
|
package/dist/health/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { formatLogLine, formatRelativeTime } from '../tailer.js';
|
|
3
|
-
import { stripAnsi } from '../../ui/colors.js';
|
|
4
|
-
describe('formatLogLine', () => {
|
|
5
|
-
it('formats RUNTIME lines with timestamp and tag', () => {
|
|
6
|
-
const line = formatLogLine('RUNTIME', 'Server started on port 8787');
|
|
7
|
-
const plain = stripAnsi(line);
|
|
8
|
-
expect(plain).toMatch(/\d{2}:\d{2}:\d{2}/);
|
|
9
|
-
expect(plain).toContain('RUNTIME');
|
|
10
|
-
expect(plain).toContain('Server started on port 8787');
|
|
11
|
-
});
|
|
12
|
-
it('formats ERROR lines', () => {
|
|
13
|
-
const line = formatLogLine('ERROR', 'Something broke');
|
|
14
|
-
const plain = stripAnsi(line);
|
|
15
|
-
expect(plain).toContain('ERROR');
|
|
16
|
-
});
|
|
17
|
-
it('formats EVENT lines', () => {
|
|
18
|
-
const line = formatLogLine('EVENT', 'workflow_completed: done');
|
|
19
|
-
const plain = stripAnsi(line);
|
|
20
|
-
expect(plain).toContain('EVENT');
|
|
21
|
-
});
|
|
22
|
-
it('indents log lines with 2 spaces', () => {
|
|
23
|
-
const line = formatLogLine('RUNTIME', 'test');
|
|
24
|
-
expect(line.startsWith(' ')).toBe(true);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
describe('formatRelativeTime', () => {
|
|
28
|
-
it('returns "now" for future timestamps', () => {
|
|
29
|
-
const future = new Date(Date.now() + 10000).toISOString();
|
|
30
|
-
expect(formatRelativeTime(future)).toBe('now');
|
|
31
|
-
});
|
|
32
|
-
it('returns seconds for recent events', () => {
|
|
33
|
-
const recent = new Date(Date.now() - 5000).toISOString();
|
|
34
|
-
expect(formatRelativeTime(recent)).toMatch(/\ds ago/);
|
|
35
|
-
});
|
|
36
|
-
it('returns minutes for older events', () => {
|
|
37
|
-
const older = new Date(Date.now() - 120000).toISOString();
|
|
38
|
-
expect(formatRelativeTime(older)).toMatch(/\dm ago/);
|
|
39
|
-
});
|
|
40
|
-
it('returns absolute time when no timestamp given', () => {
|
|
41
|
-
expect(formatRelativeTime()).toMatch(/\d{2}:\d{2}:\d{2}/);
|
|
42
|
-
});
|
|
43
|
-
});
|
package/dist/logs/tailer.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ApiClient } from '../api/client.js';
|
|
2
|
-
interface TailerOptions {
|
|
3
|
-
appId: string;
|
|
4
|
-
client: ApiClient;
|
|
5
|
-
projectDir: string;
|
|
6
|
-
toTerminal: boolean;
|
|
7
|
-
toFile: boolean;
|
|
8
|
-
intervalMs?: number;
|
|
9
|
-
getFilter?: () => 'all' | 'events' | 'runtime';
|
|
10
|
-
useJson?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function formatLogLine(tag: string, line: string): string;
|
|
13
|
-
export declare function formatRelativeTime(eventTimestamp?: string): string;
|
|
14
|
-
export declare function startLogTailer(options: TailerOptions): {
|
|
15
|
-
stop: () => void;
|
|
16
|
-
};
|
|
17
|
-
export {};
|
package/dist/logs/tailer.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { appendFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
3
|
-
import { bold, red, yellow, cyan, gray, dim } from '../ui/colors.js';
|
|
4
|
-
import { stripAnsi } from '../ui/colors.js';
|
|
5
|
-
const LOG_FILE = '.runwork/logs.txt';
|
|
6
|
-
function formatTime() {
|
|
7
|
-
const now = new Date();
|
|
8
|
-
return [
|
|
9
|
-
String(now.getHours()).padStart(2, '0'),
|
|
10
|
-
String(now.getMinutes()).padStart(2, '0'),
|
|
11
|
-
String(now.getSeconds()).padStart(2, '0'),
|
|
12
|
-
].join(':');
|
|
13
|
-
}
|
|
14
|
-
export function formatLogLine(tag, line) {
|
|
15
|
-
const time = gray(formatTime());
|
|
16
|
-
let tagFormatted;
|
|
17
|
-
switch (tag) {
|
|
18
|
-
case 'ERROR':
|
|
19
|
-
tagFormatted = bold(red('ERROR '));
|
|
20
|
-
break;
|
|
21
|
-
case 'EVENT':
|
|
22
|
-
tagFormatted = yellow('EVENT ');
|
|
23
|
-
break;
|
|
24
|
-
case 'RUNTIME':
|
|
25
|
-
tagFormatted = cyan('RUNTIME');
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
tagFormatted = dim(tag.padEnd(7));
|
|
29
|
-
}
|
|
30
|
-
return ` ${time} ${tagFormatted} ${line}`;
|
|
31
|
-
}
|
|
32
|
-
export function formatRelativeTime(eventTimestamp) {
|
|
33
|
-
if (!eventTimestamp)
|
|
34
|
-
return formatTime();
|
|
35
|
-
const diff = Date.now() - new Date(eventTimestamp).getTime();
|
|
36
|
-
if (diff < 0)
|
|
37
|
-
return 'now';
|
|
38
|
-
if (diff < 60_000)
|
|
39
|
-
return `${Math.floor(diff / 1000)}s ago`;
|
|
40
|
-
if (diff < 3_600_000)
|
|
41
|
-
return `${Math.floor(diff / 60_000)}m ago`;
|
|
42
|
-
return formatTime();
|
|
43
|
-
}
|
|
44
|
-
export function startLogTailer(options) {
|
|
45
|
-
const { appId, client, projectDir, toTerminal, toFile, intervalMs = 5000, } = options;
|
|
46
|
-
const logFilePath = join(projectDir, LOG_FILE);
|
|
47
|
-
// Ensure .runwork/ directory exists and truncate log file with header
|
|
48
|
-
if (toFile) {
|
|
49
|
-
mkdirSync(dirname(logFilePath), { recursive: true });
|
|
50
|
-
writeFileSync(logFilePath, `# Runwork dev logs - started ${new Date().toISOString()}\n\n`, 'utf-8');
|
|
51
|
-
}
|
|
52
|
-
let lastStdoutLength = 0;
|
|
53
|
-
let lastStderrLength = 0;
|
|
54
|
-
let seenEventIds = new Set();
|
|
55
|
-
let stopped = false;
|
|
56
|
-
let timer;
|
|
57
|
-
let consecutiveEmptyPolls = 0;
|
|
58
|
-
let paused = false;
|
|
59
|
-
const PAUSE_THRESHOLD = 60; // ~5 minutes at 5s interval
|
|
60
|
-
function writeLineFiltered(line, tag, jsonData) {
|
|
61
|
-
// Always write to file (stripped of ANSI codes)
|
|
62
|
-
if (toFile) {
|
|
63
|
-
try {
|
|
64
|
-
appendFileSync(logFilePath, stripAnsi(line) + '\n', 'utf-8');
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
// Silently ignore file write errors
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (!toTerminal)
|
|
71
|
-
return;
|
|
72
|
-
// JSON mode: emit NDJSON line
|
|
73
|
-
if (options.useJson && jsonData) {
|
|
74
|
-
process.stdout.write(JSON.stringify(jsonData) + '\n');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
// Human mode: apply filter and print colored line
|
|
78
|
-
const filter = options.getFilter?.() || 'all';
|
|
79
|
-
if (filter === 'events' && tag !== 'EVENT')
|
|
80
|
-
return;
|
|
81
|
-
if (filter === 'runtime' && tag !== 'RUNTIME' && tag !== 'ERROR')
|
|
82
|
-
return;
|
|
83
|
-
console.log(line);
|
|
84
|
-
}
|
|
85
|
-
async function poll() {
|
|
86
|
-
if (stopped)
|
|
87
|
-
return;
|
|
88
|
-
const prevStdoutLength = lastStdoutLength;
|
|
89
|
-
const prevStderrLength = lastStderrLength;
|
|
90
|
-
try {
|
|
91
|
-
// Poll preview logs (stdout/stderr)
|
|
92
|
-
const logs = await client.getPreviewLogs(appId);
|
|
93
|
-
// Reset detection: if buffer shrank (sandbox restart), reset cursor
|
|
94
|
-
if (logs.stdout && logs.stdout.length < lastStdoutLength) {
|
|
95
|
-
lastStdoutLength = 0;
|
|
96
|
-
}
|
|
97
|
-
if (logs.stderr && logs.stderr.length < lastStderrLength) {
|
|
98
|
-
lastStderrLength = 0;
|
|
99
|
-
}
|
|
100
|
-
if (logs.stdout && logs.stdout.length > lastStdoutLength) {
|
|
101
|
-
const newContent = logs.stdout.slice(lastStdoutLength);
|
|
102
|
-
const lines = newContent.split('\n').filter(Boolean);
|
|
103
|
-
for (const line of lines) {
|
|
104
|
-
writeLineFiltered(formatLogLine('RUNTIME', line), 'RUNTIME', {
|
|
105
|
-
event: 'log', type: 'runtime', message: line, timestamp: new Date().toISOString(),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
lastStdoutLength = logs.stdout.length;
|
|
109
|
-
}
|
|
110
|
-
if (logs.stderr && logs.stderr.length > lastStderrLength) {
|
|
111
|
-
const newContent = logs.stderr.slice(lastStderrLength);
|
|
112
|
-
const lines = newContent.split('\n').filter(Boolean);
|
|
113
|
-
for (const line of lines) {
|
|
114
|
-
writeLineFiltered(formatLogLine('ERROR', line), 'ERROR', {
|
|
115
|
-
event: 'log', type: 'error', message: line, timestamp: new Date().toISOString(),
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
lastStderrLength = logs.stderr.length;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
// Silently ignore - sandbox may not be ready yet
|
|
123
|
-
}
|
|
124
|
-
let hadNewEvents = false;
|
|
125
|
-
try {
|
|
126
|
-
// Poll app events
|
|
127
|
-
const eventOptions = { limit: 20 };
|
|
128
|
-
// We don't use `before` for pagination here; instead we filter by timestamp
|
|
129
|
-
const result = await client.getAppEvents(appId, eventOptions);
|
|
130
|
-
if (result.events && result.events.length > 0) {
|
|
131
|
-
// Events are returned newest-first; process in chronological order
|
|
132
|
-
const sorted = [...result.events].sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
133
|
-
for (const event of sorted) {
|
|
134
|
-
// Skip events we've already seen by ID
|
|
135
|
-
if (seenEventIds.has(event.id)) {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
let detail = event.summary || event.content || event.type;
|
|
139
|
-
// Include structured metadata when available
|
|
140
|
-
if (event.metadata) {
|
|
141
|
-
const meta = event.metadata;
|
|
142
|
-
if (meta.statusCode) {
|
|
143
|
-
detail += ` (status: ${meta.statusCode})`;
|
|
144
|
-
}
|
|
145
|
-
if (meta.error) {
|
|
146
|
-
detail += ` - ${meta.error}`;
|
|
147
|
-
}
|
|
148
|
-
if (meta.path) {
|
|
149
|
-
detail += ` [${meta.path}]`;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
const relTime = gray(formatRelativeTime(event.timestamp));
|
|
153
|
-
writeLineFiltered(` ${relTime} ${yellow('EVENT ')} ${event.type}: ${detail}`, 'EVENT', {
|
|
154
|
-
event: 'log', type: 'event', eventType: event.type, detail, metadata: event.metadata || {}, timestamp: event.timestamp,
|
|
155
|
-
});
|
|
156
|
-
hadNewEvents = true;
|
|
157
|
-
seenEventIds.add(event.id);
|
|
158
|
-
}
|
|
159
|
-
// Cap the set size to prevent unbounded growth (keep last 200 IDs)
|
|
160
|
-
if (seenEventIds.size > 200) {
|
|
161
|
-
const ids = Array.from(seenEventIds);
|
|
162
|
-
seenEventIds = new Set(ids.slice(ids.length - 200));
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
catch {
|
|
167
|
-
// Silently ignore - events endpoint may not be available
|
|
168
|
-
}
|
|
169
|
-
const hadNewLogs = lastStdoutLength > prevStdoutLength ||
|
|
170
|
-
lastStderrLength > prevStderrLength;
|
|
171
|
-
if (hadNewLogs || hadNewEvents) {
|
|
172
|
-
consecutiveEmptyPolls = 0;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
consecutiveEmptyPolls++;
|
|
176
|
-
}
|
|
177
|
-
if (consecutiveEmptyPolls >= PAUSE_THRESHOLD && !paused) {
|
|
178
|
-
paused = true;
|
|
179
|
-
if (toTerminal) {
|
|
180
|
-
console.log(formatLogLine('INFO', dim('No new output for 5 minutes. Polling paused. Press Enter to resume.')));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (!stopped && !paused) {
|
|
184
|
-
timer = setTimeout(poll, intervalMs);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// Initial poll after a short delay to let sandbox start
|
|
188
|
-
timer = setTimeout(poll, 2000);
|
|
189
|
-
let stdinHandler;
|
|
190
|
-
if (toTerminal && process.stdin.isTTY) {
|
|
191
|
-
process.stdin.resume();
|
|
192
|
-
stdinHandler = () => {
|
|
193
|
-
if (paused && !stopped) {
|
|
194
|
-
paused = false;
|
|
195
|
-
consecutiveEmptyPolls = 0;
|
|
196
|
-
console.log(formatLogLine('INFO', 'Polling resumed.'));
|
|
197
|
-
timer = setTimeout(poll, 0);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
process.stdin.on('data', stdinHandler);
|
|
201
|
-
}
|
|
202
|
-
return {
|
|
203
|
-
stop() {
|
|
204
|
-
stopped = true;
|
|
205
|
-
if (timer) {
|
|
206
|
-
clearTimeout(timer);
|
|
207
|
-
timer = undefined;
|
|
208
|
-
}
|
|
209
|
-
if (toTerminal && process.stdin.isTTY) {
|
|
210
|
-
if (stdinHandler) {
|
|
211
|
-
process.stdin.off('data', stdinHandler);
|
|
212
|
-
}
|
|
213
|
-
process.stdin.pause();
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { computeSyncPlan } from '../change-detect.js';
|
|
3
|
-
import { contentHash } from '../hash.js';
|
|
4
|
-
// Helper to build a stored state entry
|
|
5
|
-
function stored(localContent, remoteContent, source = 'external', remoteId, appId) {
|
|
6
|
-
return {
|
|
7
|
-
localHash: contentHash(localContent),
|
|
8
|
-
remoteHash: contentHash(remoteContent),
|
|
9
|
-
source,
|
|
10
|
-
remoteId,
|
|
11
|
-
appId,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
describe('computeSyncPlan', () => {
|
|
15
|
-
it('skips when nothing changed', () => {
|
|
16
|
-
const content = 'skill content unchanged';
|
|
17
|
-
const plan = computeSyncPlan({
|
|
18
|
-
storedHashes: { 'my-skill': stored(content, content) },
|
|
19
|
-
localSkills: [{ name: 'my-skill', content }],
|
|
20
|
-
remoteSkills: [{ name: 'my-skill', content, source: 'external' }],
|
|
21
|
-
});
|
|
22
|
-
expect(plan.skips).toHaveLength(1);
|
|
23
|
-
expect(plan.skips[0].name).toBe('my-skill');
|
|
24
|
-
expect(plan.pulls).toHaveLength(0);
|
|
25
|
-
expect(plan.pushes).toHaveLength(0);
|
|
26
|
-
expect(plan.conflicts).toHaveLength(0);
|
|
27
|
-
expect(plan.deletions).toHaveLength(0);
|
|
28
|
-
});
|
|
29
|
-
it('pulls when remote changed but local did not', () => {
|
|
30
|
-
const original = 'original content';
|
|
31
|
-
const remoteNew = 'remote updated content';
|
|
32
|
-
const plan = computeSyncPlan({
|
|
33
|
-
storedHashes: { 'my-skill': stored(original, original) },
|
|
34
|
-
localSkills: [{ name: 'my-skill', content: original }],
|
|
35
|
-
remoteSkills: [{ name: 'my-skill', content: remoteNew, source: 'external' }],
|
|
36
|
-
});
|
|
37
|
-
expect(plan.pulls).toHaveLength(1);
|
|
38
|
-
expect(plan.pulls[0].name).toBe('my-skill');
|
|
39
|
-
expect(plan.pulls[0].action).toBe('pull');
|
|
40
|
-
expect(plan.pulls[0].remoteContent).toBe(remoteNew);
|
|
41
|
-
expect(plan.pushes).toHaveLength(0);
|
|
42
|
-
expect(plan.conflicts).toHaveLength(0);
|
|
43
|
-
});
|
|
44
|
-
it('pushes when local changed but remote did not (external skill)', () => {
|
|
45
|
-
const original = 'original content';
|
|
46
|
-
const localNew = 'locally updated content';
|
|
47
|
-
const plan = computeSyncPlan({
|
|
48
|
-
storedHashes: { 'my-skill': stored(original, original, 'external') },
|
|
49
|
-
localSkills: [{ name: 'my-skill', content: localNew }],
|
|
50
|
-
remoteSkills: [{ name: 'my-skill', content: original, source: 'external' }],
|
|
51
|
-
});
|
|
52
|
-
expect(plan.pushes).toHaveLength(1);
|
|
53
|
-
expect(plan.pushes[0].name).toBe('my-skill');
|
|
54
|
-
expect(plan.pushes[0].action).toBe('push');
|
|
55
|
-
expect(plan.pushes[0].localContent).toBe(localNew);
|
|
56
|
-
expect(plan.pulls).toHaveLength(0);
|
|
57
|
-
expect(plan.conflicts).toHaveLength(0);
|
|
58
|
-
});
|
|
59
|
-
it('conflicts when both changed (external skill)', () => {
|
|
60
|
-
const original = 'original content';
|
|
61
|
-
const localNew = 'locally updated content';
|
|
62
|
-
const remoteNew = 'remotely updated content';
|
|
63
|
-
const plan = computeSyncPlan({
|
|
64
|
-
storedHashes: { 'my-skill': stored(original, original, 'external') },
|
|
65
|
-
localSkills: [{ name: 'my-skill', content: localNew }],
|
|
66
|
-
remoteSkills: [{ name: 'my-skill', content: remoteNew, source: 'external' }],
|
|
67
|
-
});
|
|
68
|
-
expect(plan.conflicts).toHaveLength(1);
|
|
69
|
-
expect(plan.conflicts[0].name).toBe('my-skill');
|
|
70
|
-
expect(plan.conflicts[0].action).toBe('conflict');
|
|
71
|
-
expect(plan.conflicts[0].localContent).toBe(localNew);
|
|
72
|
-
expect(plan.conflicts[0].remoteContent).toBe(remoteNew);
|
|
73
|
-
expect(plan.pulls).toHaveLength(0);
|
|
74
|
-
expect(plan.pushes).toHaveLength(0);
|
|
75
|
-
});
|
|
76
|
-
it('detects new remote skill (not in stored state)', () => {
|
|
77
|
-
const content = 'brand new remote skill';
|
|
78
|
-
const plan = computeSyncPlan({
|
|
79
|
-
storedHashes: {},
|
|
80
|
-
localSkills: [],
|
|
81
|
-
remoteSkills: [{ name: 'new-skill', content, source: 'external', remoteId: 'abc123' }],
|
|
82
|
-
});
|
|
83
|
-
expect(plan.pulls).toHaveLength(1);
|
|
84
|
-
expect(plan.pulls[0].name).toBe('new-skill');
|
|
85
|
-
expect(plan.pulls[0].action).toBe('new-remote');
|
|
86
|
-
expect(plan.pulls[0].remoteContent).toBe(content);
|
|
87
|
-
expect(plan.pulls[0].remoteId).toBe('abc123');
|
|
88
|
-
expect(plan.pushes).toHaveLength(0);
|
|
89
|
-
expect(plan.conflicts).toHaveLength(0);
|
|
90
|
-
expect(plan.deletions).toHaveLength(0);
|
|
91
|
-
});
|
|
92
|
-
it('detects deleted remote skill (in stored state, not on workspace)', () => {
|
|
93
|
-
const content = 'was here before';
|
|
94
|
-
const plan = computeSyncPlan({
|
|
95
|
-
storedHashes: { 'gone-skill': stored(content, content, 'external', 'remote-id-1') },
|
|
96
|
-
localSkills: [{ name: 'gone-skill', content }],
|
|
97
|
-
remoteSkills: [],
|
|
98
|
-
});
|
|
99
|
-
expect(plan.deletions).toHaveLength(1);
|
|
100
|
-
expect(plan.deletions[0].name).toBe('gone-skill');
|
|
101
|
-
expect(plan.deletions[0].action).toBe('deleted-remote');
|
|
102
|
-
expect(plan.pulls).toHaveLength(0);
|
|
103
|
-
expect(plan.pushes).toHaveLength(0);
|
|
104
|
-
expect(plan.conflicts).toHaveLength(0);
|
|
105
|
-
});
|
|
106
|
-
it('never pushes app skills — local edit on app skill results in pull/overwrite', () => {
|
|
107
|
-
const original = 'app skill original';
|
|
108
|
-
const localNew = 'user edited the app skill locally';
|
|
109
|
-
const appId = 'app-xyz';
|
|
110
|
-
const plan = computeSyncPlan({
|
|
111
|
-
storedHashes: { 'app-skill': stored(original, original, 'app', undefined, appId) },
|
|
112
|
-
localSkills: [{ name: 'app-skill', content: localNew }],
|
|
113
|
-
remoteSkills: [{ name: 'app-skill', content: original, source: 'app', appId }],
|
|
114
|
-
});
|
|
115
|
-
expect(plan.pushes).toHaveLength(0);
|
|
116
|
-
expect(plan.conflicts).toHaveLength(0);
|
|
117
|
-
expect(plan.pulls).toHaveLength(1);
|
|
118
|
-
expect(plan.pulls[0].name).toBe('app-skill');
|
|
119
|
-
expect(plan.pulls[0].action).toBe('pull');
|
|
120
|
-
expect(plan.pulls[0].remoteContent).toBe(original);
|
|
121
|
-
expect(plan.pulls[0].source).toBe('app');
|
|
122
|
-
});
|
|
123
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { contentHash } from '../hash.js';
|
|
3
|
-
describe('contentHash', () => {
|
|
4
|
-
it('returns sha256-prefixed hash', () => {
|
|
5
|
-
const hash = contentHash('hello world');
|
|
6
|
-
expect(hash).toMatch(/^sha256:[a-f0-9]{64}$/);
|
|
7
|
-
});
|
|
8
|
-
it('returns same hash for same content', () => {
|
|
9
|
-
expect(contentHash('test')).toBe(contentHash('test'));
|
|
10
|
-
});
|
|
11
|
-
it('returns different hash for different content', () => {
|
|
12
|
-
expect(contentHash('a')).not.toBe(contentHash('b'));
|
|
13
|
-
});
|
|
14
|
-
it('handles empty string', () => {
|
|
15
|
-
const hash = contentHash('');
|
|
16
|
-
expect(hash).toMatch(/^sha256:[a-f0-9]{64}$/);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { SkillHashState, SyncPlan } from './types.js';
|
|
2
|
-
interface LocalSkill {
|
|
3
|
-
name: string;
|
|
4
|
-
content: string;
|
|
5
|
-
}
|
|
6
|
-
interface RemoteSkill {
|
|
7
|
-
name: string;
|
|
8
|
-
content: string;
|
|
9
|
-
source: 'external' | 'app';
|
|
10
|
-
remoteId?: string;
|
|
11
|
-
appId?: string;
|
|
12
|
-
}
|
|
13
|
-
interface ComputeSyncInput {
|
|
14
|
-
storedHashes: Record<string, SkillHashState>;
|
|
15
|
-
localSkills: LocalSkill[];
|
|
16
|
-
remoteSkills: RemoteSkill[];
|
|
17
|
-
}
|
|
18
|
-
export declare function computeSyncPlan(input: ComputeSyncInput): SyncPlan;
|
|
19
|
-
export {};
|