rovecode 0.3.3 → 0.4.0-beta.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/CHANGELOG.md +512 -0
- package/README.md +33 -48
- package/bin/rovecode.js +24 -0
- package/dist/cli/app-dybnr56b.js +2 -0
- package/dist/cli/ask-user-p8hq4xgj.js +2 -0
- package/dist/cli/auth-login-ewpgw5sm.js +2 -0
- package/dist/cli/auth-m8p9grty.js +2 -0
- package/dist/cli/bench-xv3ypwev.js +9 -0
- package/dist/cli/catalog-737wb2s0.js +2 -0
- package/dist/cli/cli-arhg40m0.js +2 -0
- package/dist/cli/client-cf2pxx8q.js +2 -0
- package/dist/cli/commands-3p7e4xxs.js +2 -0
- package/dist/cli/connect-3q93d7cb.js +2 -0
- package/dist/cli/context-cmd-eqxmxhzq.js +2 -0
- package/dist/cli/context-report-hbw9zfes.js +2 -0
- package/dist/cli/count-remote-mby98cd0.js +2 -0
- package/dist/cli/design-122y0axd.js +2 -0
- package/dist/cli/dispatch-b4egzvvh.js +2 -0
- package/dist/cli/doctor-x4jkv72e.js +3 -0
- package/dist/cli/executor-ftvg6tsy.js +2 -0
- package/dist/cli/export-pdgdhkch.js +2 -0
- package/dist/cli/files-cez9a96p.js +2 -0
- package/dist/cli/gauntlet-r3xxaszc.js +2 -0
- package/dist/cli/gauntlet-runner-r515m7kk.js +10 -0
- package/dist/cli/gauntlet-wave3-bnkjk2v2.js +5 -0
- package/dist/cli/gauntlet-wave4-acs9s60q.js +14 -0
- package/dist/cli/hashline-ewg5hbe3.js +2 -0
- package/dist/cli/http-n0kehsk8.js +5 -0
- package/dist/cli/index-z5qt1s76.js +2 -0
- package/dist/cli/install-80mp63kx.js +2 -0
- package/dist/cli/loop-12twjcat.js +2 -0
- package/dist/cli/main-01pv9206.js +4 -0
- package/dist/cli/main-0jys2ccn.js +3 -0
- package/dist/cli/main-1ztz6fkj.js +10 -0
- package/dist/cli/main-23q7cmww.js +9 -0
- package/dist/cli/main-2rzbexn2.js +3 -0
- package/dist/cli/main-2wyax8k9.js +9 -0
- package/dist/cli/main-2yeveeve.js +6 -0
- package/dist/cli/main-2z3dek0b.js +3 -0
- package/dist/cli/main-2zgsknth.js +3 -0
- package/dist/cli/main-45ejth3a.js +4 -0
- package/dist/cli/main-45rn3trk.js +22 -0
- package/dist/cli/main-4p4e2w7x.js +4 -0
- package/dist/cli/main-4y0tnfpa.js +16 -0
- package/dist/cli/main-5py0rkmc.js +4 -0
- package/dist/cli/main-6dtqmbt6.js +7 -0
- package/dist/cli/main-6h9x282m.js +4 -0
- package/dist/cli/main-6vjeds42.js +3 -0
- package/dist/cli/main-78gq4bt9.js +6 -0
- package/dist/cli/main-7jd5vh3x.js +4 -0
- package/dist/cli/main-7kt6r53y.js +4 -0
- package/dist/cli/main-8c1tbazx.js +58 -0
- package/dist/cli/main-9a9rnh47.js +19 -0
- package/dist/cli/main-9ht36z12.js +3 -0
- package/dist/cli/main-a2yfvcy9.js +7 -0
- package/dist/cli/main-a3f51n0x.js +5 -0
- package/dist/cli/main-b8zq261k.js +3 -0
- package/dist/cli/main-bxtvnf6d.js +13 -0
- package/dist/cli/main-edxc3yzt.js +4 -0
- package/dist/cli/main-evgz4mp5.js +21 -0
- package/dist/cli/main-f33fc5je.js +9 -0
- package/dist/cli/main-fvnpq46y.js +12 -0
- package/dist/cli/main-gbbty4d4.js +3 -0
- package/dist/cli/main-gth53dnt.js +25 -0
- package/dist/cli/main-hqbz10aw.js +9 -0
- package/dist/cli/main-hrrvcfan.js +38 -0
- package/dist/cli/main-hzwtsb2m.js +5 -0
- package/dist/cli/main-j7ttv0sd.js +34 -0
- package/dist/cli/main-jak598k9.js +5 -0
- package/dist/cli/main-kba6zeyd.js +6 -0
- package/dist/cli/main-kwwsz6rq.js +3 -0
- package/dist/cli/main-m8vm17zq.js +3 -0
- package/dist/cli/main-mg4f96e1.js +3 -0
- package/dist/cli/main-mg9b20ac.js +18 -0
- package/dist/cli/main-mgb9ccnx.js +3 -0
- package/dist/cli/main-mjt2p7aj.js +3 -0
- package/dist/cli/main-n6qrdbmy.js +3 -0
- package/dist/cli/main-na7wse0x.js +5 -0
- package/dist/cli/main-nqveez48.js +4 -0
- package/dist/cli/main-ntqef02r.js +10 -0
- package/dist/cli/main-nvc3yjay.js +136 -0
- package/dist/cli/main-p0cfn6nr.js +16 -0
- package/dist/cli/main-qj2djy17.js +19 -0
- package/dist/cli/main-qsevpgsv.js +3 -0
- package/dist/cli/main-qvarybsp.js +3 -0
- package/dist/cli/main-rebtt91r.js +5 -0
- package/dist/cli/main-rpg7h8mb.js +3 -0
- package/dist/cli/main-rsy72qmw.js +15 -0
- package/dist/cli/main-rvetps99.js +18 -0
- package/dist/cli/main-s4bb0jav.js +3 -0
- package/dist/cli/main-s9v8k74e.js +3 -0
- package/dist/cli/main-tjvwmscs.js +3 -0
- package/dist/cli/main-tkgarpjj.js +4 -0
- package/dist/cli/main-v8y60bb2.js +3 -0
- package/dist/cli/main-vhrrq337.js +3 -0
- package/dist/cli/main-vp2dfb7s.js +4 -0
- package/dist/cli/main-vqbr22sz.js +8 -0
- package/dist/cli/main-vxnwe5xx.js +18 -0
- package/dist/cli/main-wgph00xf.js +5 -0
- package/dist/cli/main-wk2csfnj.js +5 -0
- package/dist/cli/main-wm997zjx.js +3 -0
- package/dist/cli/main-wpkyraxh.js +3 -0
- package/dist/cli/main-wqt32p5x.js +4 -0
- package/dist/cli/main-x9ct6y1a.js +3 -0
- package/dist/cli/main-xfekqh9m.js +7 -0
- package/dist/cli/main-xt9zc3n6.js +7 -0
- package/dist/cli/main-xx2z3zh5.js +4 -0
- package/dist/cli/main-y5c82rxr.js +3 -0
- package/dist/cli/main-yrjt2sqt.js +14 -0
- package/dist/cli/main-ys6zj3yr.js +3 -0
- package/dist/cli/main-ywbxshqc.js +8 -0
- package/dist/cli/main-z13755t8.js +25 -0
- package/dist/cli/main-zc7pyrbj.js +4 -0
- package/dist/cli/main.js +279 -0
- package/dist/cli/market-cmd-bm5xvn9f.js +5 -0
- package/dist/cli/mcp-login-bthtfpt7.js +2 -0
- package/dist/cli/mcp-market-cmd-mbeshfyd.js +2 -0
- package/dist/cli/notify-54v5z9dz.js +2 -0
- package/dist/cli/oauth-g5gme95c.js +2 -0
- package/dist/cli/output-satndjap.js +16 -0
- package/dist/cli/profiles-sfhpbq3m.js +2 -0
- package/dist/cli/provider-config-hv3xtdt4.js +2 -0
- package/dist/cli/provider-kwzq6g84.js +2 -0
- package/dist/cli/registry-fh0hdnyn.js +2 -0
- package/dist/cli/registry-y1y8e94r.js +2 -0
- package/dist/cli/repl-t4z03mqq.js +11 -0
- package/dist/cli/resume-fqt4chg8.js +2 -0
- package/dist/cli/run-flags-rysbag9t.js +2 -0
- package/dist/cli/runtime-j19fjbsa.js +2 -0
- package/dist/cli/sandbox-config-g4qxd7y5.js +2 -0
- package/dist/cli/server-r0b6bksk.js +5 -0
- package/dist/cli/session-arg-txmn5g4x.js +2 -0
- package/dist/cli/session-ed250d9j.js +2 -0
- package/dist/cli/sessions-cmd-adw7svfn.js +7 -0
- package/dist/cli/settings-y9rzcqx8.js +2 -0
- package/dist/cli/setup-jmbr11j0.js +2 -0
- package/dist/cli/sextant-smoke-tcth0vea.js +5 -0
- package/dist/cli/skills-cmd-zbdy99v6.js +2 -0
- package/dist/cli/smoke-1bg937kx.js +8 -0
- package/dist/cli/start-chat-p01cdks3.js +12 -0
- package/dist/cli/stream-4wmyaypz.js +2 -0
- package/dist/cli/task-eg4s093s.js +2 -0
- package/dist/cli/tasks-12v9rr9k.js +2 -0
- package/dist/cli/thinking-a5ngvqyh.js +2 -0
- package/dist/cli/todo-1wxpcecx.js +2 -0
- package/dist/cli/tools-2ftsya7w.js +2 -0
- package/dist/cli/tools-x1tj4fxm.js +2 -0
- package/dist/cli/trust-cmd-hccxehzb.js +2 -0
- package/dist/cli/update-check-ygt3vd7m.js +2 -0
- package/dist/cli/update-cmd-v23qhr8c.js +2 -0
- package/dist/cli/voice-g1gtck92.js +2 -0
- package/dist/cli/webfetch-0nnrjgb5.js +2 -0
- package/dist/cli/websearch-f0vr2p7d.js +2 -0
- package/dist/cli/workspace-9rq1w4ta.js +2 -0
- package/dist/lib/index.js +62 -0
- package/dist/lib/models-index.json +1 -0
- package/dist/lib/plugins.js +6 -0
- package/dist/lib/providers.js +17 -0
- package/dist/lib/public-api.js +20 -0
- package/dist/rovecode.exe +4 -0
- package/package.json +83 -72
- package/bin/rovecode.ts +0 -21
- package/src/acp/server.ts +0 -374
- package/src/cli/auth-login.ts +0 -122
- package/src/cli/connect.ts +0 -244
- package/src/cli/context-cmd.ts +0 -199
- package/src/cli/dispatch.ts +0 -82
- package/src/cli/doctor.ts +0 -362
- package/src/cli/export.ts +0 -276
- package/src/cli/help.ts +0 -293
- package/src/cli/is-tui-invocation.ts +0 -8
- package/src/cli/main.ts +0 -583
- package/src/cli/market-cmd.ts +0 -658
- package/src/cli/mcp-login.ts +0 -141
- package/src/cli/mcp-market-cmd.ts +0 -302
- package/src/cli/output.ts +0 -382
- package/src/cli/repl.ts +0 -250
- package/src/cli/repomap-root.ts +0 -14
- package/src/cli/resume.ts +0 -57
- package/src/cli/run-flags.ts +0 -43
- package/src/cli/run-limits.ts +0 -78
- package/src/cli/runtime.ts +0 -931
- package/src/cli/session-arg.ts +0 -30
- package/src/cli/sessions-cmd.ts +0 -145
- package/src/cli/setup.ts +0 -153
- package/src/cli/skills-cmd.ts +0 -194
- package/src/cli/start-chat.ts +0 -65
- package/src/cli/trust-cmd.ts +0 -52
- package/src/coding/bash.ts +0 -148
- package/src/coding/checkpoints.ts +0 -327
- package/src/coding/diff.ts +0 -138
- package/src/coding/files.ts +0 -341
- package/src/coding/hashline.ts +0 -274
- package/src/coding/lsp-gate.ts +0 -254
- package/src/coding/lsp-servers.ts +0 -147
- package/src/coding/lsp.ts +0 -283
- package/src/coding/repomap-cache.ts +0 -99
- package/src/coding/repomap-files.ts +0 -192
- package/src/coding/repomap.ts +0 -481
- package/src/core/agents.ts +0 -255
- package/src/core/compaction.ts +0 -259
- package/src/core/config.ts +0 -289
- package/src/core/context-report.ts +0 -228
- package/src/core/context.ts +0 -60
- package/src/core/count-remote.ts +0 -107
- package/src/core/execpolicy-rules.ts +0 -196
- package/src/core/execpolicy.ts +0 -385
- package/src/core/executor.ts +0 -454
- package/src/core/guardrails.ts +0 -400
- package/src/core/hooks.ts +0 -411
- package/src/core/images.ts +0 -230
- package/src/core/intro.ts +0 -266
- package/src/core/loop.ts +0 -567
- package/src/core/modes.ts +0 -372
- package/src/core/orchestrator.ts +0 -245
- package/src/core/proc-group.ts +0 -48
- package/src/core/project-trust.ts +0 -98
- package/src/core/reflection.ts +0 -165
- package/src/core/sandbox-config.ts +0 -186
- package/src/core/session-id.ts +0 -24
- package/src/core/session-images.ts +0 -73
- package/src/core/session-ops.ts +0 -183
- package/src/core/session-text.ts +0 -29
- package/src/core/session.ts +0 -469
- package/src/core/settings.ts +0 -170
- package/src/core/tasks.ts +0 -646
- package/src/core/token-scale.ts +0 -108
- package/src/core/tools.ts +0 -309
- package/src/core/trust.ts +0 -104
- package/src/core/types.ts +0 -330
- package/src/core/update-check.ts +0 -171
- package/src/core/usage.ts +0 -204
- package/src/core/validate.ts +0 -121
- package/src/core/verify-gate.ts +0 -159
- package/src/core/verify.ts +0 -236
- package/src/core/voice.ts +0 -158
- package/src/core/win-job.ts +0 -183
- package/src/core/workspace.ts +0 -184
- package/src/design/audit.ts +0 -797
- package/src/design/direction.ts +0 -190
- package/src/design/rules.ts +0 -157
- package/src/eval/bench.ts +0 -150
- package/src/eval/gauntlet-runner.ts +0 -215
- package/src/eval/gauntlet-support.ts +0 -84
- package/src/eval/gauntlet-wave3.ts +0 -269
- package/src/eval/gauntlet-wave4.ts +0 -217
- package/src/eval/gauntlet.ts +0 -253
- package/src/index.ts +0 -17
- package/src/lanes/agy.ts +0 -95
- package/src/lanes/approval.ts +0 -24
- package/src/lanes/claude.ts +0 -129
- package/src/lanes/codex.ts +0 -127
- package/src/lanes/events.ts +0 -130
- package/src/lanes/job.ts +0 -142
- package/src/lanes/opencode.ts +0 -122
- package/src/lanes/process.ts +0 -184
- package/src/lanes/progress.ts +0 -183
- package/src/lanes/registry.ts +0 -178
- package/src/lanes/runner.ts +0 -124
- package/src/lanes/types.ts +0 -112
- package/src/market/catalogs/mcp-docs.json +0 -111
- package/src/market/catalogs/plugins.json +0 -111
- package/src/market/catalogs/skills.json +0 -478
- package/src/market/clone.ts +0 -72
- package/src/market/context-cost.ts +0 -121
- package/src/market/digest.ts +0 -106
- package/src/market/index.ts +0 -22
- package/src/market/install.ts +0 -578
- package/src/market/manifest.ts +0 -187
- package/src/market/prereq.ts +0 -145
- package/src/market/registry.ts +0 -363
- package/src/market/resolve.ts +0 -111
- package/src/market/types.ts +0 -236
- package/src/market/validate.ts +0 -227
- package/src/mcp/client.ts +0 -449
- package/src/mcp/config.ts +0 -252
- package/src/mcp/local-package.ts +0 -211
- package/src/mcp/market-catalog.ts +0 -84
- package/src/mcp/market-install.ts +0 -289
- package/src/mcp/market.ts +0 -362
- package/src/mcp/oauth.ts +0 -251
- package/src/mcp/prompts-resources.ts +0 -249
- package/src/mcp/shared.ts +0 -149
- package/src/mcp/status.ts +0 -67
- package/src/mcp/tools.ts +0 -275
- package/src/mcp/transport.ts +0 -122
- package/src/mcp/trust.ts +0 -25
- package/src/memory/blocks.ts +0 -278
- package/src/memory/recall.ts +0 -355
- package/src/memory/scope.ts +0 -182
- package/src/memory/store.ts +0 -105
- package/src/memory/tools.ts +0 -99
- package/src/plugins/cli.ts +0 -119
- package/src/plugins/discover.ts +0 -108
- package/src/plugins/index.ts +0 -50
- package/src/plugins/install.ts +0 -184
- package/src/plugins/load.ts +0 -124
- package/src/plugins/manifest.ts +0 -92
- package/src/plugins/state.ts +0 -83
- package/src/providers/auth.ts +0 -408
- package/src/providers/cache.ts +0 -223
- package/src/providers/catalog-local.ts +0 -160
- package/src/providers/catalog.ts +0 -421
- package/src/providers/middleware-context.ts +0 -86
- package/src/providers/middleware.ts +0 -373
- package/src/providers/model-list.ts +0 -23
- package/src/providers/oauth/common.ts +0 -105
- package/src/providers/oauth/device-code.ts +0 -107
- package/src/providers/oauth/github-copilot.ts +0 -146
- package/src/providers/oauth/loopback.ts +0 -158
- package/src/providers/oauth/openai.ts +0 -163
- package/src/providers/oauth/openrouter.ts +0 -89
- package/src/providers/oauth/pkce.ts +0 -45
- package/src/providers/oauth/registry.ts +0 -39
- package/src/providers/oauth/seam.ts +0 -89
- package/src/providers/profile-glm53.ts +0 -111
- package/src/providers/profile-sonnet5-persona.ts +0 -65
- package/src/providers/profile-sonnet5-voice.ts +0 -23
- package/src/providers/profiles.ts +0 -156
- package/src/providers/provider-config.ts +0 -311
- package/src/providers/registry.ts +0 -333
- package/src/providers/responses.ts +0 -209
- package/src/providers/retry.ts +0 -234
- package/src/providers/router.ts +0 -294
- package/src/providers/sse.ts +0 -26
- package/src/providers/stream-errors.ts +0 -117
- package/src/providers/stream.ts +0 -566
- package/src/providers/thinking.ts +0 -189
- package/src/providers/wire-messages.ts +0 -129
- package/src/providers/wire-responses.ts +0 -79
- package/src/providers/wire-select.ts +0 -53
- package/src/server/http.ts +0 -291
- package/src/server/openapi.ts +0 -246
- package/src/sextant/card-hits.ts +0 -102
- package/src/sextant/card-keys.ts +0 -55
- package/src/sextant/context-source.ts +0 -157
- package/src/sextant/crew-cards.ts +0 -350
- package/src/sextant/draw-agents.ts +0 -273
- package/src/sextant/draw-code.ts +0 -388
- package/src/sextant/draw-context.ts +0 -222
- package/src/sextant/draw-frame.ts +0 -164
- package/src/sextant/draw-market.ts +0 -573
- package/src/sextant/draw-messages.ts +0 -386
- package/src/sextant/draw-pet.ts +0 -230
- package/src/sextant/draw-plan.ts +0 -187
- package/src/sextant/draw-tabs.ts +0 -85
- package/src/sextant/draw-util.ts +0 -65
- package/src/sextant/draw-wizard.ts +0 -378
- package/src/sextant/engine.ts +0 -230
- package/src/sextant/frame-hits.ts +0 -25
- package/src/sextant/frame.ts +0 -101
- package/src/sextant/git-status.ts +0 -197
- package/src/sextant/grid.ts +0 -59
- package/src/sextant/input.ts +0 -119
- package/src/sextant/keys.ts +0 -521
- package/src/sextant/layout.ts +0 -86
- package/src/sextant/local-commands.ts +0 -169
- package/src/sextant/market-source.ts +0 -287
- package/src/sextant/mentions.ts +0 -200
- package/src/sextant/message-hits.ts +0 -26
- package/src/sextant/model.ts +0 -387
- package/src/sextant/overlays.ts +0 -456
- package/src/sextant/panel-hits.ts +0 -38
- package/src/sextant/pet.ts +0 -399
- package/src/sextant/screen.ts +0 -324
- package/src/sextant/scroll-hits.ts +0 -66
- package/src/sextant/scrollbar.ts +0 -82
- package/src/sextant/sextant-bridge.ts +0 -174
- package/src/sextant/sextant-cards.ts +0 -142
- package/src/sextant/sextant-diff-base.ts +0 -63
- package/src/sextant/sextant-files.ts +0 -154
- package/src/sextant/sextant-frame-loop.ts +0 -335
- package/src/sextant/sextant-renderer.ts +0 -574
- package/src/sextant/sextant-repo.ts +0 -140
- package/src/sextant/theme.ts +0 -66
- package/src/sextant/tool-rows.ts +0 -189
- package/src/sextant/types.ts +0 -493
- package/src/skills/index.ts +0 -387
- package/src/skills/pack.ts +0 -220
- package/src/skills/spec.ts +0 -162
- package/src/skills/tools.ts +0 -69
- package/src/skills/versioned.ts +0 -227
- package/src/telemetry/otel-export.ts +0 -122
- package/src/telemetry/otel-lanes.ts +0 -89
- package/src/telemetry/otel-logs.ts +0 -131
- package/src/telemetry/otel-metrics.ts +0 -136
- package/src/telemetry/otel.ts +0 -397
- package/src/telemetry/otlp.ts +0 -76
- package/src/tools/ask-user.ts +0 -156
- package/src/tools/bash-bg.ts +0 -94
- package/src/tools/bash-jobs.ts +0 -237
- package/src/tools/design.ts +0 -151
- package/src/tools/evalcell.ts +0 -338
- package/src/tools/html-text.ts +0 -139
- package/src/tools/provider.ts +0 -149
- package/src/tools/task.ts +0 -250
- package/src/tools/todo.ts +0 -320
- package/src/tools/webfetch.ts +0 -332
- package/src/tools/websearch.ts +0 -359
- package/src/tui/agents-cmd.ts +0 -41
- package/src/tui/app.ts +0 -749
- package/src/tui/attach.ts +0 -127
- package/src/tui/boot-notes.ts +0 -41
- package/src/tui/builtin-prompts.ts +0 -59
- package/src/tui/checkpoints-cmd.ts +0 -70
- package/src/tui/clipboard-image.ts +0 -81
- package/src/tui/clipboard.ts +0 -78
- package/src/tui/commands.ts +0 -283
- package/src/tui/config-view.ts +0 -53
- package/src/tui/context-cmds.ts +0 -282
- package/src/tui/cost.ts +0 -108
- package/src/tui/crash-guard.ts +0 -173
- package/src/tui/focus-terminal.ts +0 -34
- package/src/tui/git-cmds.ts +0 -273
- package/src/tui/git-plain.ts +0 -58
- package/src/tui/info-cmd.ts +0 -150
- package/src/tui/input-plain.ts +0 -76
- package/src/tui/mcp-cmd.ts +0 -128
- package/src/tui/memory-note.ts +0 -77
- package/src/tui/modes-cmd.ts +0 -45
- package/src/tui/notify-seq.ts +0 -100
- package/src/tui/notify.ts +0 -318
- package/src/tui/overlays.ts +0 -97
- package/src/tui/pi-renderer.ts +0 -428
- package/src/tui/providers-cmd.ts +0 -377
- package/src/tui/reasoning-view.ts +0 -56
- package/src/tui/renderer.ts +0 -128
- package/src/tui/replay-marker.ts +0 -29
- package/src/tui/session-cmd.ts +0 -148
- package/src/tui/session-manage.ts +0 -95
- package/src/tui/sextant-attach.ts +0 -102
- package/src/tui/sextant-io.ts +0 -202
- package/src/tui/sextant-smoke.ts +0 -110
- package/src/tui/shell-cmd.ts +0 -158
- package/src/tui/smoke.ts +0 -72
- package/src/tui/staged-terminal.ts +0 -50
- package/src/tui/startup.ts +0 -12
- package/src/tui/theme.ts +0 -59
- package/src/tui/todo-label.ts +0 -7
- package/src/tui/trust-card.ts +0 -107
- package/src/tui/tui-commands.ts +0 -87
- package/tsconfig.json +0 -30
- package/vendor/pi-tui/LICENSE +0 -21
- package/vendor/pi-tui/PATCHES.md +0 -12
- package/vendor/pi-tui/PROVENANCE.md +0 -12
- package/vendor/pi-tui/README.upstream.md +0 -854
- package/vendor/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/vendor/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/vendor/pi-tui/src/alt-screen-search.ts +0 -158
- package/vendor/pi-tui/src/autocomplete.ts +0 -827
- package/vendor/pi-tui/src/components/alt-screen-flash.ts +0 -52
- package/vendor/pi-tui/src/components/box.ts +0 -138
- package/vendor/pi-tui/src/components/cancellable-loader.ts +0 -41
- package/vendor/pi-tui/src/components/editor.ts +0 -2364
- package/vendor/pi-tui/src/components/h-stack.ts +0 -45
- package/vendor/pi-tui/src/components/image.ts +0 -128
- package/vendor/pi-tui/src/components/input.ts +0 -448
- package/vendor/pi-tui/src/components/loader.ts +0 -93
- package/vendor/pi-tui/src/components/markdown.ts +0 -1016
- package/vendor/pi-tui/src/components/scroll-view.ts +0 -217
- package/vendor/pi-tui/src/components/select-list.ts +0 -230
- package/vendor/pi-tui/src/components/settings-list.ts +0 -277
- package/vendor/pi-tui/src/components/spacer.ts +0 -29
- package/vendor/pi-tui/src/components/stack.ts +0 -155
- package/vendor/pi-tui/src/components/text.ts +0 -108
- package/vendor/pi-tui/src/components/truncated-text.ts +0 -66
- package/vendor/pi-tui/src/components/v-stack.ts +0 -34
- package/vendor/pi-tui/src/editor-component.ts +0 -75
- package/vendor/pi-tui/src/fuzzy.ts +0 -138
- package/vendor/pi-tui/src/index.ts +0 -149
- package/vendor/pi-tui/src/keybindings.ts +0 -321
- package/vendor/pi-tui/src/keys.ts +0 -1402
- package/vendor/pi-tui/src/kill-ring.ts +0 -47
- package/vendor/pi-tui/src/latex.ts +0 -1381
- package/vendor/pi-tui/src/layout-node.ts +0 -52
- package/vendor/pi-tui/src/layout.ts +0 -411
- package/vendor/pi-tui/src/native-modifiers.ts +0 -60
- package/vendor/pi-tui/src/native-module-path.ts +0 -32
- package/vendor/pi-tui/src/stdin-buffer.ts +0 -445
- package/vendor/pi-tui/src/terminal-colors.ts +0 -74
- package/vendor/pi-tui/src/terminal-image.ts +0 -701
- package/vendor/pi-tui/src/terminal.ts +0 -554
- package/vendor/pi-tui/src/tui-alt-screen.ts +0 -1379
- package/vendor/pi-tui/src/tui-main-screen.ts +0 -655
- package/vendor/pi-tui/src/tui.ts +0 -1264
- package/vendor/pi-tui/src/undo-stack.ts +0 -29
- package/vendor/pi-tui/src/utils.ts +0 -1327
- package/vendor/pi-tui/src/word-navigation.ts +0 -118
- package/vendor/pi-tui/test/test-themes.ts +0 -39
- package/vendor/pi-tui/test/virtual-terminal.ts +0 -219
- /package/{src/providers → dist/cli}/models-index.json +0 -0
package/src/market/install.ts
DELETED
|
@@ -1,578 +0,0 @@
|
|
|
1
|
-
/** One install entry, three kinds, one order of events — plan, show, ask, write.
|
|
2
|
-
*
|
|
3
|
-
* The MCP market established the order and it is the whole point of this module: the human sees the exact
|
|
4
|
-
* command, folder or file list BEFORE anything lands, and the write happens only after a yes. A skill, a
|
|
5
|
-
* plugin and an MCP server say different things in that preview ("copies one file, runs nothing" vs
|
|
6
|
-
* "copies a folder whose code rovecode will run"), so the sentences differ per kind — but a caller only
|
|
7
|
-
* ever calls `planInstall` then `runInstall`, and neither can be skipped by a new kind arriving later.
|
|
8
|
-
*
|
|
9
|
-
* Delegation, not reimplementation: MCP goes through mcp/market-install.ts (planner, `${NAME}` filling,
|
|
10
|
-
* trust-recording write), plugins through plugins/install.ts (shallow clone, manifest validation, project
|
|
11
|
-
* trust). Only skills are written here, because "copy files into a folder" had no installer yet.
|
|
12
|
-
*
|
|
13
|
-
* Project scope is the trusted scope: a project MCP file or plugin folder installed through this path is
|
|
14
|
-
* recorded as trusted, because the human just approved the exact content. Skills are files, never code —
|
|
15
|
-
* they carry no trust gate, and the preview says so. */
|
|
16
|
-
|
|
17
|
-
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
18
|
-
import { tmpdir } from "node:os";
|
|
19
|
-
import { dirname, join, sep, resolve as resolvePath } from "node:path";
|
|
20
|
-
import { describePlan, fillPlan, namesWritten, planInstall as planMcp, removeServer, unfilledPending, writeServer, type InstallPlan as McpPlan } from "../mcp/market-install.ts";
|
|
21
|
-
import { mcpConfigFiles, parseConfigFile } from "../mcp/config.ts";
|
|
22
|
-
import { mcpTrustStatus } from "../mcp/trust.ts";
|
|
23
|
-
import { addPlugin, cloneKey, removePlugin, scopeRoot, type CopyTree, type Spawn } from "../plugins/install.ts";
|
|
24
|
-
import { discoverPlugins } from "../plugins/discover.ts";
|
|
25
|
-
import { checkPrereq, prereqLine, prereqOf, type PrereqEnv } from "./prereq.ts";
|
|
26
|
-
import { installLocalPackage, localLaunch } from "../mcp/local-package.ts";
|
|
27
|
-
import { buildRecord, forgetInstall, recordInstall } from "./manifest.ts";
|
|
28
|
-
import { cloneAtRef, type ResolvedBy } from "./clone.ts";
|
|
29
|
-
import { contextCostLines, contextCostOf } from "./context-cost.ts";
|
|
30
|
-
import { digestOf } from "./digest.ts";
|
|
31
|
-
import type { InstalledState, InstallOutcome, InstallPlanView, MarketItem, MarketRow, MarketScope } from "./types.ts";
|
|
32
|
-
|
|
33
|
-
export interface PlanOptions {
|
|
34
|
-
scope: MarketScope;
|
|
35
|
-
cwd: string;
|
|
36
|
-
home: string;
|
|
37
|
-
/** which of an MCP entry's install forms (default the first) */
|
|
38
|
-
pick?: number;
|
|
39
|
-
/** override the installed name */
|
|
40
|
-
as?: string;
|
|
41
|
-
/** PATH lookup for the prerequisite line — tests inject; production reads the real environment */
|
|
42
|
-
prereqEnv?: PrereqEnv;
|
|
43
|
-
/** pin a git source to a branch, tag or commit (`--ref`). clone.ts tells the three apart by asking git
|
|
44
|
-
* rather than by looking at the string, and records which one answered. */
|
|
45
|
-
ref?: string;
|
|
46
|
-
/** the model the plan is being drawn for, so the token estimate can be scaled to its tokenizer. Left
|
|
47
|
-
* undefined when nothing is configured — an unscaled number that says so beats one scaled to a model
|
|
48
|
-
* the person is not running. */
|
|
49
|
-
model?: { provider: string; model: string };
|
|
50
|
-
/** MCP only: install the npx package ONCE and launch it with node (mcp/local-package.ts). True after the
|
|
51
|
-
* human said yes to the offer (or passed --local); false or undefined writes today's npx line. Never
|
|
52
|
-
* decided here — the surfaces ask, this only carries the answer. */
|
|
53
|
-
local?: boolean;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface RunDeps {
|
|
57
|
-
/** how `git clone` runs — tests inject one that never touches the network */
|
|
58
|
-
spawn?: Spawn;
|
|
59
|
-
/** replace something already installed under that name */
|
|
60
|
-
force?: boolean;
|
|
61
|
-
/** no network, for real: an install whose source has to be fetched is refused rather than quietly
|
|
62
|
-
* cloning. `--offline` used to stop only the registry lookup, so `install --offline` still went to the
|
|
63
|
-
* network and succeeded — a flag that says "skips the network entirely" has to mean it. */
|
|
64
|
-
offline?: boolean;
|
|
65
|
-
/** Clones made during THIS command, shared with plugins/install.ts (same map, same `cloneKey`). Three
|
|
66
|
-
* plugins out of one monorepo become one clone. The CACHE owns every directory in it, so whoever
|
|
67
|
-
* created the map must call `disposeCloneCache` in a finally — otherwise the clones outlive the
|
|
68
|
-
* command in the temp directory. */
|
|
69
|
-
cloneCache?: Map<string, string>;
|
|
70
|
-
/** the copy step. Real installs leave it alone; a test injects one that fails part way through, which is
|
|
71
|
-
* the only way to observe that the staging directory actually protects the previous install. */
|
|
72
|
-
copy?: CopyTree;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** The names an item may be installed under. `--as` is human input reaching a path join, so it is checked
|
|
76
|
-
* like one: `--as "../../../head-pwned"` wrote a skill outside ROVECODE_HOME entirely, `--as ""` targeted
|
|
77
|
-
* the skills root itself, and `--as "C:/x"` produced a raw ENOENT. Only a plain slug is a name. */
|
|
78
|
-
const INSTALL_NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/i;
|
|
79
|
-
export function validInstallName(name: string): boolean {
|
|
80
|
-
return INSTALL_NAME.test(name) && name !== "." && name !== "..";
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** The prerequisite row, or nothing. Deliberately `requires`, not `needs`: `needs` was already spoken for
|
|
84
|
-
* by "this install needs an argument from YOU", and one word doing two jobs in the same paragraph is how a
|
|
85
|
-
* plan stops being read. `requires` is about the machine, `fill in` is about the human.
|
|
86
|
-
*
|
|
87
|
-
* Placed right under `runs`/`connects`/`source`, because both answer the same question — what is going to
|
|
88
|
-
* be executed or fetched — while `writes` and `fill in` are about what happens to the disk. It never
|
|
89
|
-
* blocks: some people install the tool next, and a warning is not a gate. */
|
|
90
|
-
function requiresLine(item: MarketItem, opts: PlanOptions): string[] {
|
|
91
|
-
// install-once runs npm now and node at every start — those are the programs to look for, not npx
|
|
92
|
-
if (opts.local === true && item.install.kind === "mcp") {
|
|
93
|
-
const both = ["npm", "node"].map((p) => prereqLine(checkPrereq(p, opts.prereqEnv))).filter((l): l is string => l !== undefined);
|
|
94
|
-
return both.length === 0 ? [] : [` requires ${both.join(" · ")}`];
|
|
95
|
-
}
|
|
96
|
-
const line = prereqLine(prereqOf(item, opts.prereqEnv));
|
|
97
|
-
return line === undefined ? [] : [` requires ${line}`];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** describePlan's own pending rows say the same thing the market's `fill in` says, one line later and
|
|
101
|
-
* without the file path. Drop them here rather than change describePlan, which `rovecode mcp add` still
|
|
102
|
-
* uses and where there is no `fill in` to duplicate. */
|
|
103
|
-
const PENDING_ROW = /^ {2}needs {6}/;
|
|
104
|
-
|
|
105
|
-
/** How many skills this machine already has, for the "past 50 the index leaves the prompt" warning.
|
|
106
|
-
*
|
|
107
|
-
* Counted from the two folders the market installs into. That UNDERCOUNTS: a plugin can contribute skills
|
|
108
|
-
* too, and those are not visible without loading the plugin. Undercounting is the safe direction — it can
|
|
109
|
-
* only make the warning silent, never make it wrong — and a warning that fires with a made-up number is
|
|
110
|
-
* worth less than no warning at all. */
|
|
111
|
-
function installedSkillCount(cwd: string, home: string): number {
|
|
112
|
-
let n = 0;
|
|
113
|
-
for (const root of [join(home, "skills"), join(cwd, ".rovecode", "skills")]) {
|
|
114
|
-
if (!existsSync(root)) continue;
|
|
115
|
-
try {
|
|
116
|
-
for (const name of readdirSync(root)) if (existsSync(join(root, name, "SKILL.md"))) n += 1;
|
|
117
|
-
} catch { /* unreadable folder: count what we could */ }
|
|
118
|
-
}
|
|
119
|
-
return n;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/** What this adds to every prompt, and what it adds only when the model opens it. Two numbers rather than
|
|
123
|
-
* one because a skill's index line and its body differ by roughly thirty times — a single "per turn"
|
|
124
|
-
* figure would overstate an unopened skill by that much. */
|
|
125
|
-
function contextLines(item: MarketItem, opts: PlanOptions): string[] {
|
|
126
|
-
const installed = installedSkillCount(opts.cwd, opts.home);
|
|
127
|
-
const cost = contextCostOf(item, { installedSkills: installed, ...(opts.model ? { model: opts.model } : {}) });
|
|
128
|
-
const lines = contextCostLines(cost);
|
|
129
|
-
return lines.length === 0 ? [] : lines.map((l, i) => (i === 0 ? ` context ${l}` : ` ${l}`));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** put the requires row directly after the line that says what will run or be fetched */
|
|
133
|
-
function withRequires(lines: string[], item: MarketItem, opts: PlanOptions): string[] {
|
|
134
|
-
const requires = [...requiresLine(item, opts), ...contextLines(item, opts)];
|
|
135
|
-
if (requires.length === 0) return lines;
|
|
136
|
-
// `runs`/`connects` first when there is one — that is the line the requirement belongs to. `source` is
|
|
137
|
-
// only the fallback, for a skill or plugin whose plan has no launch line at all.
|
|
138
|
-
const at = lines.findIndex((l) => /^ {2}(runs|connects) {3,}/.test(l));
|
|
139
|
-
const anchor = at >= 0 ? at : lines.findIndex((l) => /^ {2}source {3,}/.test(l));
|
|
140
|
-
return anchor < 0 ? [...lines, ...requires] : [...lines.slice(0, anchor + 1), ...requires, ...lines.slice(anchor + 1)];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/** where a skill of this id lives under a scope */
|
|
144
|
-
export function skillDir(id: string, opts: { scope: MarketScope; cwd: string; home: string }): string {
|
|
145
|
-
const root = opts.scope === "project" ? join(opts.cwd, ".rovecode", "skills") : join(opts.home, "skills");
|
|
146
|
-
const dir = join(root, id);
|
|
147
|
-
// belt and braces: even a name that slipped past the check cannot land outside the skills root
|
|
148
|
-
if (!resolvePath(dir).startsWith(resolvePath(root) + sep)) throw new Error(`"${id}" is not a usable skill name`);
|
|
149
|
-
return dir;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// ---------------------------------------------------------------- planning (writes nothing)
|
|
153
|
-
|
|
154
|
-
/** The publisher's own status, said before anything else in the preview.
|
|
155
|
-
*
|
|
156
|
-
* First line, not a row among the rows: `requires` and `context` describe what an install COSTS, and
|
|
157
|
-
* someone reading those has already decided they want the thing. "The publisher stopped maintaining
|
|
158
|
-
* this" is a reason not to want it, so it goes above the decision rather than inside it.
|
|
159
|
-
*
|
|
160
|
-
* It never blocks. An archived skill is still a working skill, plenty of people install one on purpose,
|
|
161
|
-
* and a market that refuses is a market that gets worked around. The wording is deliberately the flag's
|
|
162
|
-
* own: GitHub says `archived`, so we say "archived on GitHub" — "abandoned" is a judgement about someone
|
|
163
|
-
* else's work that nobody upstream made and we are in no position to make for them. */
|
|
164
|
-
function statusLines(item: MarketItem): string[] {
|
|
165
|
-
const status = item.status;
|
|
166
|
-
if (status === undefined || status === "") return [];
|
|
167
|
-
const said =
|
|
168
|
-
status === "archived" ? "archived on GitHub — the publisher has stopped maintaining it"
|
|
169
|
-
: status === "deprecated" ? "marked deprecated by its publisher"
|
|
170
|
-
: `marked "${status}" by its publisher`;
|
|
171
|
-
return [` ! ${said}. It still installs; nothing here is blocked.`];
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/** the whole preview for one item: the publisher's status first, then what the install does */
|
|
175
|
-
function previewFor(lines: string[], item: MarketItem, opts: PlanOptions): string[] {
|
|
176
|
-
return [...statusLines(item), ...withRequires(lines, item, opts)];
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function planInstall(item: MarketItem, opts: PlanOptions): InstallPlanView | { error: string } {
|
|
180
|
-
const { install } = item;
|
|
181
|
-
// checked BEFORE any path is built from it, for every kind
|
|
182
|
-
// `--ref` is only wired through the skill cloner. Accepting it for a plugin and ignoring it would be
|
|
183
|
-
// the exact failure this feature exists to prevent: the human believes they pinned, and something else
|
|
184
|
-
// is installed. Refuse until plugins/install.ts takes a ref.
|
|
185
|
-
if (opts.ref !== undefined && item.install.kind === "plugin") {
|
|
186
|
-
return { error: `--ref is not wired for plugins yet — it would be accepted and ignored, which is worse than not having it` };
|
|
187
|
-
}
|
|
188
|
-
if (opts.ref !== undefined && item.install.kind === "mcp") {
|
|
189
|
-
return { error: `--ref applies to something that is cloned; an MCP entry is a config line, and its package version belongs in the entry itself` };
|
|
190
|
-
}
|
|
191
|
-
if (opts.as !== undefined && !validInstallName(opts.as)) {
|
|
192
|
-
return { error: `"${opts.as}" is not a usable name — letters, digits, dot, dash and underscore only, and it must not be a path` };
|
|
193
|
-
}
|
|
194
|
-
if (install.kind === "mcp") {
|
|
195
|
-
const inner = planMcp(install.entry, {
|
|
196
|
-
scope: opts.scope, cwd: opts.cwd, home: opts.home,
|
|
197
|
-
...(opts.pick !== undefined ? { pick: opts.pick } : {}), ...(opts.as !== undefined ? { name: opts.as } : {}),
|
|
198
|
-
...(opts.local !== undefined ? { local: opts.local } : {}),
|
|
199
|
-
});
|
|
200
|
-
if ("error" in inner) return inner;
|
|
201
|
-
const view: InstallPlanView = {
|
|
202
|
-
item, target: inner.file, scope: opts.scope,
|
|
203
|
-
preview: [
|
|
204
|
-
...previewFor(describePlan(inner, opts.scope === "project" ? "env" : "prompt").filter((l) => !PENDING_ROW.test(l)), item, opts),
|
|
205
|
-
...(item.planNote ?? []),
|
|
206
|
-
],
|
|
207
|
-
asks: inner.asks.map((a) => ({ ...a })), pending: [...inner.pending],
|
|
208
|
-
};
|
|
209
|
-
const existing = existingMcpNames(opts.cwd, opts.home, opts.scope);
|
|
210
|
-
if (existing.includes(inner.name)) view.replaces = `${inner.name} in ${inner.file}`;
|
|
211
|
-
return view;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const id = opts.as ?? item.id;
|
|
215
|
-
if (install.kind === "plugin") {
|
|
216
|
-
// `--as` cannot be honoured here and must not be accepted silently: addPlugin writes under the name in
|
|
217
|
-
// the plugin's own manifest, so a rename would put the folder somewhere the preview did not say.
|
|
218
|
-
if (opts.as !== undefined) return { error: `--as does not apply to a plugin: it installs under the name in its own manifest` };
|
|
219
|
-
const dir = join(scopeRoot(opts.scope, opts.cwd, opts.home), item.id);
|
|
220
|
-
const preview = [
|
|
221
|
-
`${item.title}${item.version ? ` ${item.version}` : ""}`,
|
|
222
|
-
` kind plugin — a folder of CODE that rovecode loads and RUNS in this process`,
|
|
223
|
-
` source ${install.git ? `git clone --depth 1 ${install.source}` : `copy of the folder ${install.source}`}${install.subfolder ? ` (subfolder ${install.subfolder})` : ""}`,
|
|
224
|
-
` publisher ${item.publisher}`,
|
|
225
|
-
...(item.license ? [` licence ${item.license}`] : []),
|
|
226
|
-
...(item.repository ? [` repo ${item.repository}`] : []),
|
|
227
|
-
` writes ${dir}${install.git ? " (the folder is named by the plugin's manifest; this is the expected name)" : ""}`,
|
|
228
|
-
opts.scope === "project"
|
|
229
|
-
? ` trust installed into this repo — approving here records this exact content as trusted on this machine`
|
|
230
|
-
: ` trust user scope (~/.rovecode/plugins): loaded in every project you open`,
|
|
231
|
-
` a plugin can add tools, hooks, commands, skills and MCP servers. Install one only from a publisher you trust.`,
|
|
232
|
-
...(item.planNote ?? []),
|
|
233
|
-
];
|
|
234
|
-
return { item, target: dir, scope: opts.scope, preview: previewFor(preview, item, opts), asks: item.env.map((e) => ({ ...e })), pending: [],
|
|
235
|
-
...(existsSync(dir) ? { replaces: dir } : {}) };
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const dir = skillDir(id, opts);
|
|
239
|
-
const fileList = install.files ?? [];
|
|
240
|
-
// a skill IS a folder with a SKILL.md — without one nothing would ever find it again: installedState
|
|
241
|
-
// looks for exactly that file, so it would install and then read as "not installed" forever
|
|
242
|
-
if (install.source === undefined && !fileList.some((f) => f.path.replace(/\\/g, "/").toLowerCase() === "skill.md")) {
|
|
243
|
-
return { error: `${item.id} carries no SKILL.md — a skill is a folder with a SKILL.md, and rovecode would never see this one` };
|
|
244
|
-
}
|
|
245
|
-
const preview = [
|
|
246
|
-
`${item.title}${item.version ? ` ${item.version}` : ""}`,
|
|
247
|
-
` kind skill — instructions the model reads. Files only: nothing here is executed on install.`,
|
|
248
|
-
install.source
|
|
249
|
-
? ` source git clone --depth 1 ${install.source.git}${install.source.subfolder ? ` (subfolder ${install.source.subfolder})` : ""}`
|
|
250
|
-
: ` source ${fileList.length} file${fileList.length === 1 ? "" : "s"} from rovecode's catalog`,
|
|
251
|
-
` publisher ${item.publisher}`,
|
|
252
|
-
...(item.license ? [` licence ${item.license}`] : []),
|
|
253
|
-
...(item.repository ? [` repo ${item.repository}`] : []),
|
|
254
|
-
` writes ${dir}`,
|
|
255
|
-
...fileList.slice(0, 8).map((f) => ` ${f.path}`),
|
|
256
|
-
...(fileList.length > 8 ? [` … and ${fileList.length - 8} more`] : []),
|
|
257
|
-
...(item.planNote ?? []),
|
|
258
|
-
];
|
|
259
|
-
return { item, target: dir, scope: opts.scope, preview: previewFor(preview, item, opts), asks: item.env.map((e) => ({ ...e })), pending: [],
|
|
260
|
-
...(existsSync(dir) ? { replaces: dir } : {}) };
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// ---------------------------------------------------------------- writing (only after a yes)
|
|
264
|
-
|
|
265
|
-
export async function runInstall(plan: InstallPlanView, answers: Record<string, string>, opts: PlanOptions, deps: RunDeps = {}): Promise<InstallOutcome> {
|
|
266
|
-
const { item } = plan;
|
|
267
|
-
const { install } = item;
|
|
268
|
-
try {
|
|
269
|
-
if (install.kind === "mcp") {
|
|
270
|
-
const inner = planMcp(install.entry, {
|
|
271
|
-
scope: opts.scope, cwd: opts.cwd, home: opts.home,
|
|
272
|
-
...(opts.pick !== undefined ? { pick: opts.pick } : {}), ...(opts.as !== undefined ? { name: opts.as } : {}),
|
|
273
|
-
...(opts.local !== undefined ? { local: opts.local } : {}),
|
|
274
|
-
});
|
|
275
|
-
if ("error" in inner) return { ok: false, error: inner.error };
|
|
276
|
-
// install-once (mcp/local-package.ts): npm runs FIRST, and only its success reaches mcp.json. A failed
|
|
277
|
-
// npm leaves the file as it was — no half-entry pointing at a bin that never arrived — and says why.
|
|
278
|
-
let launch: { command: string; args: string[] } | undefined;
|
|
279
|
-
let pkg: NonNullable<Extract<InstallOutcome, { ok: true }>["package"]> | undefined;
|
|
280
|
-
if (inner.local) {
|
|
281
|
-
if (deps.offline === true) return { ok: false, error: `--offline: installing ${inner.local.pkg.spec} once means npm fetching it now; drop --local to write the npx line, which fetches at launch instead` };
|
|
282
|
-
const r = await installLocalPackage(inner.local.pkg, inner.local.prefix, deps.spawn ? { spawn: deps.spawn } : {});
|
|
283
|
-
if (!r.ok) return { ok: false, error: r.error };
|
|
284
|
-
launch = localLaunch(r.pkg, inner.local.pkg.rest);
|
|
285
|
-
pkg = { name: r.pkg.name, version: r.pkg.version, prefix: inner.local.prefix, bin: r.pkg.bin,
|
|
286
|
-
...(r.pkg.integrity !== undefined ? { integrity: r.pkg.integrity } : {}),
|
|
287
|
-
...(r.pkg.missing.length > 0 ? { missing: r.pkg.missing } : {}) };
|
|
288
|
-
}
|
|
289
|
-
const raw = fillPlan(inner, answers, launch);
|
|
290
|
-
const written = writeServer(inner.file, inner.name, raw, {
|
|
291
|
-
...(deps.force === true ? { replace: true } : {}),
|
|
292
|
-
...(opts.scope === "project" ? { trustHome: opts.home } : {}),
|
|
293
|
-
});
|
|
294
|
-
recordInstall(buildRecord(item, { scope: opts.scope, target: inner.file, ...(pkg ? { package: { ...pkg, missing: pkg.missing ?? [] } } : {}) }),
|
|
295
|
-
{ cwd: opts.cwd, home: opts.home, stillInstalled: recordStillInstalled(opts.cwd, opts.home) });
|
|
296
|
-
// The same closing line `rovecode mcp add` prints (cli/mcp-market-cmd.ts), for the same two reasons: an
|
|
297
|
-
// entry still carrying a placeholder is skipped by the loader, so "restart rovecode" would send the
|
|
298
|
-
// person to a restart that changes nothing; and the placeholder is the one thing they must go and
|
|
299
|
-
// edit, so it is named here, not left for them to discover in a skipped-server warning later.
|
|
300
|
-
const fillIn = unfilledPending(inner, raw);
|
|
301
|
-
return {
|
|
302
|
-
ok: true, item, target: inner.file, scope: opts.scope, envNames: namesWritten(inner, raw),
|
|
303
|
-
...(written.trusted !== undefined ? { trusted: written.trusted } : {}),
|
|
304
|
-
...(pkg ? { package: pkg } : {}),
|
|
305
|
-
...(fillIn.length ? { fillIn } : {}),
|
|
306
|
-
next: fillIn.length
|
|
307
|
-
? `fill in before use: ${fillIn.join(", ")} — edit the args in ${inner.file}; until then this server is skipped`
|
|
308
|
-
: "restart rovecode to connect — MCP servers are read once per process (a session that installs from /market connects it on the spot)",
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (deps.offline === true && needsNetwork(install)) {
|
|
313
|
-
return { ok: false, error: `--offline: ${item.id} would have to be fetched (${sourceOf(install)}) and nothing local can stand in for it` };
|
|
314
|
-
}
|
|
315
|
-
if (install.kind === "plugin") {
|
|
316
|
-
// a monorepo plugin lives in plugins/<name>; plugins/install.ts validates the subfolder again
|
|
317
|
-
const r = await addPlugin(install.source, {
|
|
318
|
-
cwd: opts.cwd, home: opts.home, scope: opts.scope,
|
|
319
|
-
...(deps.force === true ? { force: true } : {}), ...(deps.spawn ? { spawn: deps.spawn } : {}),
|
|
320
|
-
...(install.subfolder !== undefined ? { subfolder: install.subfolder } : {}),
|
|
321
|
-
...(deps.cloneCache !== undefined ? { cloneCache: deps.cloneCache } : {}),
|
|
322
|
-
});
|
|
323
|
-
if (!r.ok) return { ok: false, error: r.error };
|
|
324
|
-
recordInstall(buildRecord(item, { scope: opts.scope, target: r.dir,
|
|
325
|
-
...(() => { const d = digestOf(r.dir); return d ? { digest: d } : {}; })(),
|
|
326
|
-
...(install.git ? { git: { source: install.source } } : {}) }),
|
|
327
|
-
{ cwd: opts.cwd, home: opts.home, stillInstalled: recordStillInstalled(opts.cwd, opts.home) });
|
|
328
|
-
return {
|
|
329
|
-
ok: true, item, target: r.dir, scope: opts.scope, envNames: item.env.filter((e) => e.required).map((e) => e.name),
|
|
330
|
-
...(opts.scope === "project" ? { trusted: true } : {}),
|
|
331
|
-
next: "restart rovecode — plugins are loaded once at startup",
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
const dir = plan.target;
|
|
336
|
-
if (existsSync(dir) && deps.force !== true) return { ok: false, error: `${dir} already exists (use --force to replace)` };
|
|
337
|
-
let clonedSha: string | undefined;
|
|
338
|
-
let clonedBy: ResolvedBy | undefined;
|
|
339
|
-
if (install.source) {
|
|
340
|
-
const r = await cloneSkill(install.source, dir, deps, opts.ref);
|
|
341
|
-
if (!r.ok) return { ok: false, error: r.error };
|
|
342
|
-
clonedSha = r.sha;
|
|
343
|
-
clonedBy = r.resolvedBy;
|
|
344
|
-
} else {
|
|
345
|
-
// Build the whole thing beside the target and swap at the end. Writing in place meant deleting the
|
|
346
|
-
// installed copy FIRST and then failing half way through the loop — the caller saw a clean
|
|
347
|
-
// {ok:false} while the previous version was already gone and a partial one sat in its place.
|
|
348
|
-
mkdirSync(dirname(dir), { recursive: true }); // the scope's skills/ folder may not exist yet
|
|
349
|
-
const staging = mkdtempSync(join(dirname(dir), `.rovecode-skill-${item.id}-`));
|
|
350
|
-
try {
|
|
351
|
-
for (const f of install.files ?? []) {
|
|
352
|
-
const dest = join(staging, f.path);
|
|
353
|
-
// checked BEFORE anything is removed, not after — the catalog reader is the first lock, this the second
|
|
354
|
-
if (!resolvePath(dest).startsWith(resolvePath(staging) + sep) ) return { ok: false, error: `${f.path} escapes the skill's folder` };
|
|
355
|
-
mkdirSync(dirname(dest), { recursive: true });
|
|
356
|
-
writeFileSync(dest, f.text);
|
|
357
|
-
}
|
|
358
|
-
if (existsSync(dir)) rmSync(dir, { recursive: true, force: true });
|
|
359
|
-
renameSync(staging, dir);
|
|
360
|
-
} finally {
|
|
361
|
-
rmSync(staging, { recursive: true, force: true }); // no-op once it has been renamed into place
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
recordInstall(buildRecord(item, { scope: opts.scope, target: dir,
|
|
365
|
-
...(() => { const d = digestOf(dir); return d ? { digest: d } : {}; })(),
|
|
366
|
-
...(install.source ? { git: { source: install.source.git,
|
|
367
|
-
...(clonedSha !== undefined ? { sha: clonedSha } : {}),
|
|
368
|
-
...(opts.ref !== undefined ? { ref: opts.ref } : {}),
|
|
369
|
-
...(clonedBy !== undefined ? { resolvedBy: clonedBy } : {}) } } : {}) }),
|
|
370
|
-
{ cwd: opts.cwd, home: opts.home, stillInstalled: recordStillInstalled(opts.cwd, opts.home) });
|
|
371
|
-
return {
|
|
372
|
-
ok: true, item, target: dir, scope: opts.scope, envNames: [],
|
|
373
|
-
next: "restart rovecode — skills are indexed at startup",
|
|
374
|
-
};
|
|
375
|
-
} catch (e) {
|
|
376
|
-
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/** Is what this record describes still on disk? Used to prune orphans on every write — a record whose
|
|
381
|
-
* thing was deleted by hand is ignored anyway, and dropping it keeps the file from growing forever.
|
|
382
|
-
* Asked through `installedState`, so it answers the same question `list` does rather than a second
|
|
383
|
-
* approximation of it (an MCP record's target is the shared mcp.json, which exists whether or not the
|
|
384
|
-
* entry inside it does — `existsSync` would be wrong here). */
|
|
385
|
-
function recordStillInstalled(cwd: string, home: string) {
|
|
386
|
-
return (r: { kind: MarketItem["kind"]; id: string; scope: MarketScope }): boolean =>
|
|
387
|
-
installedState({ kind: r.kind, id: r.id } as MarketItem, cwd, home, r.scope) !== undefined;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/** The commit a clone is sitting on, read from the git directory rather than from stdout — `Spawn` gives
|
|
391
|
-
* us an exit code and stderr, not stdout, and adding a channel to that seam for one string is not worth
|
|
392
|
-
* it. Undefined when it cannot be read; provenance is best-effort. */
|
|
393
|
-
function readSha(clone: string): string | undefined {
|
|
394
|
-
try {
|
|
395
|
-
const head = readFileSync(join(clone, ".git", "HEAD"), "utf8").trim();
|
|
396
|
-
const ref = /^ref:\s*(.+)$/.exec(head)?.[1];
|
|
397
|
-
if (ref === undefined) return /^[0-9a-f]{40}$/i.test(head) ? head : undefined;
|
|
398
|
-
const direct = join(clone, ".git", ...ref.split("/"));
|
|
399
|
-
if (existsSync(direct)) { const v = readFileSync(direct, "utf8").trim(); return /^[0-9a-f]{40}$/i.test(v) ? v : undefined; }
|
|
400
|
-
const packed = join(clone, ".git", "packed-refs");
|
|
401
|
-
if (!existsSync(packed)) return undefined;
|
|
402
|
-
for (const line of readFileSync(packed, "utf8").split("\n")) {
|
|
403
|
-
const m = /^([0-9a-f]{40})\s+(.+)$/i.exec(line.trim());
|
|
404
|
-
if (m && m[2] === ref) return m[1]!;
|
|
405
|
-
}
|
|
406
|
-
return undefined;
|
|
407
|
-
} catch { return undefined; }
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/** does installing this reach the network? A catalog's literal files and a local folder do not. */
|
|
411
|
-
export function needsNetwork(install: MarketItem["install"]): boolean {
|
|
412
|
-
if (install.kind === "plugin") return install.git;
|
|
413
|
-
if (install.kind === "skill") return install.source !== undefined;
|
|
414
|
-
return false; // an MCP install writes a config entry; the server is fetched when it launches, not now
|
|
415
|
-
}
|
|
416
|
-
function sourceOf(install: MarketItem["install"]): string {
|
|
417
|
-
if (install.kind === "plugin") return install.source;
|
|
418
|
-
if (install.kind === "skill") return install.source?.git ?? "its catalog files";
|
|
419
|
-
return "an mcp.json entry";
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/** true for a symbolic link (never throws: an unreadable entry is not copied either) */
|
|
423
|
-
function isLink(p: string): boolean {
|
|
424
|
-
try { return lstatSync(p).isSymbolicLink(); } catch { return true; }
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
async function cloneSkill(source: { git: string; subfolder?: string }, dir: string, deps: RunDeps, ref?: string): Promise<{ ok: true; sha?: string; resolvedBy?: ResolvedBy } | { ok: false; error: string }> {
|
|
428
|
-
let resolvedBy: ResolvedBy | undefined;
|
|
429
|
-
const spawn: Spawn = deps.spawn ?? (async (cmd, cwd) => {
|
|
430
|
-
const p = Bun.spawn(cmd, { cwd, stdout: "ignore", stderr: "pipe", stdin: "ignore" });
|
|
431
|
-
return { code: await p.exited, stderr: await new Response(p.stderr).text() };
|
|
432
|
-
});
|
|
433
|
-
const copy: CopyTree = deps.copy ?? ((from, to, filter) => cpSync(from, to, { recursive: true, filter }));
|
|
434
|
-
|
|
435
|
-
// The same key and the same map as plugins/install.ts: a skill and a plugin out of one repository, or
|
|
436
|
-
// three skills out of one, are cloned once. Clone straight INTO the temp directory (`… <url> .`) so the
|
|
437
|
-
// cached value is the clone itself — a cache disposer should never have to take dirname() of what it was
|
|
438
|
-
// given and remove a directory nobody handed it.
|
|
439
|
-
const key = cloneKey(source.git, ref);
|
|
440
|
-
let owned: string | null = null;
|
|
441
|
-
|
|
442
|
-
// the clone itself is INSIDE the try: `spawn` does not only return a non-zero code, it can throw
|
|
443
|
-
// outright — no git on PATH is an ENOENT, not an exit status — and a temp directory created one line
|
|
444
|
-
// earlier would otherwise be left behind on the one failure a user is most likely to hit.
|
|
445
|
-
try {
|
|
446
|
-
const cached = deps.cloneCache?.get(key);
|
|
447
|
-
let clone: string;
|
|
448
|
-
if (cached !== undefined) {
|
|
449
|
-
clone = cached;
|
|
450
|
-
} else {
|
|
451
|
-
owned = mkdtempSync(join(tmpdir(), "rovecode-skill-"));
|
|
452
|
-
const r = await cloneAtRef(spawn, source.git, owned, ref);
|
|
453
|
-
if (!r.ok) return { ok: false, error: r.error }; // the finally clears `owned`
|
|
454
|
-
resolvedBy = r.resolvedBy;
|
|
455
|
-
clone = owned;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const from = source.subfolder ? join(clone, source.subfolder) : clone;
|
|
459
|
-
if (!resolvePath(from).startsWith(resolvePath(clone))) return { ok: false, error: `subfolder escapes the clone` };
|
|
460
|
-
if (!existsSync(join(from, "SKILL.md"))) return { ok: false, error: `no SKILL.md in ${source.subfolder ?? "the repository root"} — a skill is a folder with a SKILL.md` };
|
|
461
|
-
// built beside the target and swapped in, never written over the top: `rmSync` then `cpSync` means a
|
|
462
|
-
// failure half way through (full disk, a locked file on Windows, the process killed during
|
|
463
|
-
// `update --all`) has already destroyed the working copy and leaves a partial tree in its place.
|
|
464
|
-
// The catalog-files path below learned this the hard way; this is the same fix for the clone path.
|
|
465
|
-
mkdirSync(dirname(dir), { recursive: true });
|
|
466
|
-
const staging = mkdtempSync(join(dirname(dir), `.rovecode-clone-`));
|
|
467
|
-
try {
|
|
468
|
-
copy(from, staging, (p) => !/(?:^|[\\/])\.git(?:[\\/]|$)/.test(p) && !isLink(p));
|
|
469
|
-
if (existsSync(dir)) rmSync(dir, { recursive: true, force: true });
|
|
470
|
-
renameSync(staging, dir);
|
|
471
|
-
} finally {
|
|
472
|
-
rmSync(staging, { recursive: true, force: true }); // a no-op once it has been renamed into place
|
|
473
|
-
}
|
|
474
|
-
// the commit this actually resolved to, for the record. Best effort: a clone whose HEAD cannot be
|
|
475
|
-
// read still installed fine, and a made-up sha would be worse than none.
|
|
476
|
-
const head = await spawn(["git", "rev-parse", "HEAD"], clone).catch(() => ({ code: 1, stderr: "" }));
|
|
477
|
-
const sha = head.code === 0 ? readSha(clone) : undefined;
|
|
478
|
-
if (owned !== null && deps.cloneCache !== undefined) { deps.cloneCache.set(key, owned); owned = null; } // ownership moves to the cache
|
|
479
|
-
return { ok: true, ...(sha !== undefined ? { sha } : {}), ...(resolvedBy !== undefined ? { resolvedBy } : {}) };
|
|
480
|
-
} finally {
|
|
481
|
-
if (owned !== null) rmSync(owned, { recursive: true, force: true });
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// ---------------------------------------------------------------- what is installed here
|
|
486
|
-
|
|
487
|
-
function existingMcpNames(cwd: string, home: string, scope: MarketScope): string[] {
|
|
488
|
-
const files = mcpConfigFiles(cwd, home);
|
|
489
|
-
const file = scope === "project" ? files.project : files.user;
|
|
490
|
-
if (file === undefined || !existsSync(file)) return [];
|
|
491
|
-
const anySet = new Proxy({}, { get: () => "set" }) as Record<string, string>;
|
|
492
|
-
return parseConfigFile(file, [], anySet).map((s) => s.name);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/** Local truth for one item: is it on disk, where, and does the version differ from the catalog's. */
|
|
496
|
-
export function installedState(item: MarketItem, cwd: string, home: string, only?: MarketScope): InstalledState | undefined {
|
|
497
|
-
const scopes: readonly MarketScope[] = only ? [only] : ["project", "user"];
|
|
498
|
-
if (item.kind === "mcp") {
|
|
499
|
-
const files = mcpConfigFiles(cwd, home);
|
|
500
|
-
const byScope: Record<MarketScope, string | undefined> = { project: files.project, user: files.user };
|
|
501
|
-
for (const scope of scopes) {
|
|
502
|
-
const file = byScope[scope];
|
|
503
|
-
if (file === undefined || !existsSync(file)) continue;
|
|
504
|
-
const anySet = new Proxy({}, { get: () => "set" }) as Record<string, string>;
|
|
505
|
-
const hit = parseConfigFile(file, [], anySet).find((s) => s.name === item.id);
|
|
506
|
-
if (hit) {
|
|
507
|
-
const state: InstalledState = { path: file, scope };
|
|
508
|
-
if (scope === "project") state.trusted = mcpTrustStatus(home, file) === "trusted";
|
|
509
|
-
return state;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
return undefined;
|
|
513
|
-
}
|
|
514
|
-
if (item.kind === "plugin") {
|
|
515
|
-
const found = discoverPlugins(cwd, { home }).plugins.find((p) => p.name === item.id && (only === undefined || p.scope === only));
|
|
516
|
-
if (!found) return undefined;
|
|
517
|
-
const state: InstalledState = { path: found.dir, scope: found.scope };
|
|
518
|
-
const version = found.manifest?.version;
|
|
519
|
-
if (version !== undefined) {
|
|
520
|
-
state.version = version;
|
|
521
|
-
if (item.version !== undefined && item.version !== version) state.updateAvailable = true;
|
|
522
|
-
}
|
|
523
|
-
if (found.scope === "project") state.trusted = found.status !== "untrusted";
|
|
524
|
-
return state;
|
|
525
|
-
}
|
|
526
|
-
for (const scope of scopes) {
|
|
527
|
-
const dir = skillDir(item.id, { scope, cwd, home });
|
|
528
|
-
if (!existsSync(join(dir, "SKILL.md"))) continue;
|
|
529
|
-
const state: InstalledState = { path: dir, scope };
|
|
530
|
-
const version = skillVersion(join(dir, "SKILL.md"));
|
|
531
|
-
if (version !== undefined) {
|
|
532
|
-
state.version = version;
|
|
533
|
-
if (item.version !== undefined && item.version !== version) state.updateAvailable = true;
|
|
534
|
-
}
|
|
535
|
-
return state;
|
|
536
|
-
}
|
|
537
|
-
return undefined;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
function skillVersion(file: string): string | undefined {
|
|
541
|
-
try {
|
|
542
|
-
const head = readFileSync(file, "utf8").slice(0, 2000);
|
|
543
|
-
return /^version:\s*(.+)$/m.exec(head)?.[1]?.trim().slice(0, 64);
|
|
544
|
-
} catch { return undefined; }
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/** Attach local state to every item — what a UI renders. */
|
|
548
|
-
export function withInstalled(items: readonly MarketItem[], cwd: string, home: string): MarketRow[] {
|
|
549
|
-
return items.map((item) => {
|
|
550
|
-
const installed = installedState(item, cwd, home);
|
|
551
|
-
return installed ? { ...item, installed } : { ...item };
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/** `market remove <kind:id>` — undo an install, whichever kind it is. */
|
|
556
|
-
export function removeItem(item: MarketItem, cwd: string, home: string, scope?: MarketScope): { ok: true; path: string } | { ok: false; error: string } {
|
|
557
|
-
const state = installedState(item, cwd, home, scope);
|
|
558
|
-
if (state === undefined) return { ok: false, error: `${item.kind} "${item.id}" is not installed here${scope ? ` in ${scope} scope` : ""}` };
|
|
559
|
-
if (item.kind === "mcp") {
|
|
560
|
-
// `trustHome` is not optional bookkeeping: removeServer re-records the file's trust after the edit, and
|
|
561
|
-
// without it every OTHER server in a project file silently drops to "not approved" for having changed.
|
|
562
|
-
const ok = removeServer(state.path, item.id, { trustHome: home });
|
|
563
|
-
if (ok) forgetInstall(item.kind, item.id, state.scope, { cwd, home });
|
|
564
|
-
return ok ? { ok: true, path: state.path } : { ok: false, error: `no server "${item.id}" in ${state.path}` };
|
|
565
|
-
}
|
|
566
|
-
if (item.kind === "plugin") {
|
|
567
|
-
// through the plugin remover, which also drops the folder's trust entry — a plain rmSync leaves a
|
|
568
|
-
// recorded digest pointing at a directory that no longer exists, and the next install is compared to it
|
|
569
|
-
const r = removePlugin(item.id, { cwd, home, scope: state.scope });
|
|
570
|
-
if (r.ok) forgetInstall(item.kind, item.id, state.scope, { cwd, home });
|
|
571
|
-
return r.ok ? { ok: true, path: r.dir } : { ok: false, error: r.error };
|
|
572
|
-
}
|
|
573
|
-
rmSync(state.path, { recursive: true, force: true });
|
|
574
|
-
forgetInstall(item.kind, item.id, state.scope, { cwd, home });
|
|
575
|
-
return { ok: true, path: state.path };
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
export type { McpPlan };
|