codeep 1.3.42 → 2.0.1

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.
Files changed (60) hide show
  1. package/README.md +208 -0
  2. package/dist/acp/commands.js +770 -7
  3. package/dist/acp/protocol.d.ts +11 -2
  4. package/dist/acp/server.js +179 -11
  5. package/dist/acp/session.d.ts +3 -0
  6. package/dist/acp/session.js +5 -0
  7. package/dist/api/index.js +39 -6
  8. package/dist/config/index.d.ts +13 -0
  9. package/dist/config/index.js +45 -0
  10. package/dist/config/providers.js +76 -1
  11. package/dist/renderer/App.d.ts +12 -0
  12. package/dist/renderer/App.js +109 -4
  13. package/dist/renderer/agentExecution.js +5 -0
  14. package/dist/renderer/commands.js +638 -2
  15. package/dist/renderer/components/Help.js +28 -0
  16. package/dist/renderer/components/Login.d.ts +1 -0
  17. package/dist/renderer/components/Login.js +24 -9
  18. package/dist/renderer/handlers.d.ts +11 -1
  19. package/dist/renderer/handlers.js +30 -0
  20. package/dist/renderer/main.js +73 -0
  21. package/dist/utils/agent.d.ts +17 -0
  22. package/dist/utils/agent.js +91 -7
  23. package/dist/utils/agentChat.d.ts +10 -2
  24. package/dist/utils/agentChat.js +48 -9
  25. package/dist/utils/agentStream.js +6 -2
  26. package/dist/utils/checkpoints.d.ts +93 -0
  27. package/dist/utils/checkpoints.js +205 -0
  28. package/dist/utils/context.d.ts +24 -0
  29. package/dist/utils/context.js +57 -0
  30. package/dist/utils/customCommands.d.ts +62 -0
  31. package/dist/utils/customCommands.js +201 -0
  32. package/dist/utils/hooks.d.ts +97 -0
  33. package/dist/utils/hooks.js +223 -0
  34. package/dist/utils/mcpClient.d.ts +229 -0
  35. package/dist/utils/mcpClient.js +497 -0
  36. package/dist/utils/mcpConfig.d.ts +55 -0
  37. package/dist/utils/mcpConfig.js +177 -0
  38. package/dist/utils/mcpMarketplace.d.ts +49 -0
  39. package/dist/utils/mcpMarketplace.js +175 -0
  40. package/dist/utils/mcpRegistry.d.ts +129 -0
  41. package/dist/utils/mcpRegistry.js +427 -0
  42. package/dist/utils/mcpSamplingBridge.d.ts +32 -0
  43. package/dist/utils/mcpSamplingBridge.js +88 -0
  44. package/dist/utils/mcpStreamableHttp.d.ts +65 -0
  45. package/dist/utils/mcpStreamableHttp.js +207 -0
  46. package/dist/utils/openrouterPrefs.d.ts +36 -0
  47. package/dist/utils/openrouterPrefs.js +83 -0
  48. package/dist/utils/skillBundles.d.ts +84 -0
  49. package/dist/utils/skillBundles.js +257 -0
  50. package/dist/utils/skillBundlesCloud.d.ts +69 -0
  51. package/dist/utils/skillBundlesCloud.js +202 -0
  52. package/dist/utils/tokenTracker.d.ts +14 -2
  53. package/dist/utils/tokenTracker.js +59 -41
  54. package/dist/utils/toolExecution.d.ts +17 -1
  55. package/dist/utils/toolExecution.js +184 -6
  56. package/dist/utils/tools.d.ts +22 -6
  57. package/dist/utils/tools.js +83 -8
  58. package/package.json +3 -2
  59. package/bin/codeep-macos-arm64 +0 -0
  60. package/bin/codeep-macos-x64 +0 -0
package/README.md CHANGED
@@ -23,6 +23,28 @@
23
23
  <a href="https://github.com/VladoIvankovic/Codeep"><img src="https://img.shields.io/github/stars/VladoIvankovic/Codeep?style=social" alt="GitHub stars"></a>
24
24
  </p>
25
25
 
26
+ ## Upgrading from 1.x to 2.0
27
+
28
+ Most users **do not need to do anything** — `npm install -g codeep@latest`
29
+ picks up the new version and everything carries over (config, saved
30
+ profiles, project memory, MCP servers, skill bundles).
31
+
32
+ Two breaking changes only affect a small audience:
33
+
34
+ 1. **MCP `clientInfo` version bumped from `1.4.0` → `2.0.0`.** If you
35
+ maintain a custom MCP server that allowlists Codeep by version
36
+ string, update your check.
37
+ 2. **`McpServer` protocol shape** in ACP now has `command?`, `args?`,
38
+ `url?`, `headers?` (transport-agnostic for stdio + Streamable HTTP).
39
+ The old required-`command` shape is still accepted — parser handles
40
+ both — but new clients should emit the optional shape.
41
+
42
+ See [CHANGELOG.md](CHANGELOG.md#200--2026-05-18) for the full list of
43
+ additions (full MCP support, OpenRouter provider with authoritative
44
+ per-call cost, Claude-Code-compatible skill bundles + web marketplace,
45
+ custom slash commands, lifecycle hooks, checkpoints, `/cost`,
46
+ `/compact`, and more).
47
+
26
48
  ## Features
27
49
 
28
50
  ### Multi-Provider Support
@@ -33,6 +55,7 @@
33
55
  - **Google AI** — Gemini 3.1 Pro Preview, Gemini 3 Flash Preview, Gemini 2.5 Pro, Gemini 2.5 Flash
34
56
  - **MiniMax** — MiniMax M2.7, M2.5, M2.1, M2 — Coding Plan & pay-per-use API (international & China)
35
57
  - **Ollama** — Run any model locally or on a remote server, no API key required. Models are fetched dynamically from your Ollama instance.
58
+ - **OpenRouter** — One key, 100+ models from Anthropic, OpenAI, Google, Meta, Mistral, DeepSeek, Qwen, xAI and more. Per-call cost reported directly by OpenRouter (matches their dashboard exactly). Use `openrouter/auto` to let OpenRouter pick the best model. Tune routing with `/openrouter prefer|ignore|fallbacks|privacy`.
36
59
  - Switch between providers with `/provider`
37
60
  - Configure different API keys per provider
38
61
  - Both OpenAI-compatible and Anthropic API protocols supported
@@ -52,6 +75,11 @@ When started in a project directory, Codeep automatically:
52
75
  - **Rename sessions** - Give meaningful names with `/rename`
53
76
  - **Search history** - Find past conversations with `/search`
54
77
  - **Export** - Save to Markdown, JSON, or plain text
78
+ - `/cost` - Per-session token usage and estimated cost (per provider/model)
79
+ - `/compact [keepN]` - AI-summarize older messages to free up context (keeps last N, default 4)
80
+ - `/checkpoint [name]` - Snapshot the current session (conversation + provider/model + agent-touched files + git HEAD)
81
+ - `/checkpoints` - List saved checkpoints for this workspace
82
+ - `/rewind <id>` - Restore a checkpoint; file rollback is handled via git (hint printed after rewind)
55
83
 
56
84
  ### Git Integration
57
85
  - `/diff` - Review unstaged changes with AI assistance
@@ -318,6 +346,186 @@ Custom skill example (`~/.codeep/skills/my-workflow.json`):
318
346
  }
319
347
  ```
320
348
 
349
+ ### MCP (Model Context Protocol)
350
+ Full spec coverage in 2.0.0 — stdio and Streamable HTTP transports,
351
+ tools / resources / prompts / sampling, capability negotiation with
352
+ `roots`, auto-restart on crash, mid-run catalog refresh.
353
+
354
+ **Three ways to wire MCP servers** (all merge; project > global > ACP wins last):
355
+
356
+ 1. **Project config** — `.codeep/mcp_servers.json` (committed with the repo)
357
+ 2. **Global config** — `~/.codeep/mcp_servers.json` (per machine)
358
+ 3. **ACP client config** — Zed / Claude Desktop pass `mcpServers` on `session/new`
359
+
360
+ Two transports per entry, mutually exclusive:
361
+
362
+ ```json
363
+ {
364
+ "mcpServers": {
365
+ "fs": { "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/path"] },
366
+ "remote": { "url": "https://mcp.example.com/", "headers": { "Authorization": "Bearer …" } }
367
+ }
368
+ }
369
+ ```
370
+
371
+ Manage interactively from any Codeep client:
372
+
373
+ ```bash
374
+ /mcp # list connected servers + tools + spawn errors
375
+ /mcp browse # 12 curated servers (filesystem, github, postgres, …)
376
+ /mcp browse <id> # details + env-var hints for one entry
377
+ /mcp install <id> [extra args] # wires it into project config + spawns
378
+ /mcp add <name> <command> [args]
379
+ /mcp remove <name>
380
+ /mcp reload # re-read config after a manual edit
381
+ /mcp resources # list resources servers expose
382
+ /mcp read <uri> # fetch one resource's contents
383
+ /mcp prompts # list prompt templates
384
+ /mcp prompt <server> <name> key=val
385
+ ```
386
+
387
+ Resources and prompts also surface as **virtual tools** the agent can
388
+ call natively — `<server>__resource_list`, `<server>__resource_read`,
389
+ `<server>__prompt_list`, `<server>__prompt_get`. No need to type
390
+ `/mcp read` yourself; the model decides when to fetch.
391
+
392
+ If a server opts into the `sampling` capability, Codeep hosts LLM
393
+ completions on its behalf — routes through your active provider. If it
394
+ opts into `roots/list`, we expose the current workspace folder.
395
+
396
+ In the VS Code extension, the same operations are available from the
397
+ command palette (no JSON editing required):
398
+
399
+ - **Codeep: Add MCP Server…** — wizard that writes to project or global config
400
+ - **Codeep: Remove MCP Server…** — quick-pick from both scopes
401
+ - **Codeep: Open MCP Servers Config** — opens the JSON file directly
402
+
403
+ Each server is spawned as a child process; its tools are surfaced under
404
+ `<server>__<tool>`. MCP tool definitions are automatically injected into
405
+ the agent's tool catalog on each iteration, so the model picks them
406
+ alongside built-ins without you having to mention them by name.
407
+
408
+ Lifecycle is per-session: servers are torn down when the session is
409
+ deleted or the CLI exits (SIGTERM/SIGINT). The VS Code extension and the
410
+ direct `codeep` CLI both read the same config files, so a server you
411
+ configure once is available everywhere.
412
+
413
+ A server that crashes is auto-restarted (up to 3 times in a 60 s window,
414
+ with exponential backoff). Persistent failures are reported in `/mcp` so
415
+ you don't have to hunt through stderr. The `roots` capability is
416
+ advertised in the MCP handshake, so filesystem-shaped servers can
417
+ scope their reads to the current workspace.
418
+
419
+ Hooks apply to MCP tools too: `pre_tool_call` can block a `<server>__<tool>`
420
+ call, and `on_error` fires when it fails. See **Lifecycle Hooks** below.
421
+
422
+ ### Lifecycle Hooks
423
+ Drop executable shell scripts in `.codeep/hooks/<event>.sh` and Codeep runs them at
424
+ the relevant moment during a session. Generalises what `agentAutoCommit` and
425
+ `agentAutoVerify` do — anything those can do, a `post_edit` hook can do too.
426
+
427
+ | Event | When | Blocking? |
428
+ |---|---|---|
429
+ | `pre_tool_call` | Before every agent tool call (including MCP `<server>__<tool>`) | **Yes** — non-zero exit blocks the call |
430
+ | `post_edit` | After `write_file` / `edit_file` succeeds (built-in only) | No (advisory: auto-format / auto-lint) |
431
+ | `on_error` | When any tool call fails (built-in or MCP) | No (logging / alerting) |
432
+ | `pre_commit` | Before the `/commit` skill stages anything | **Yes** — non-zero exit blocks the commit |
433
+
434
+ `pre_tool_call` and `on_error` apply uniformly to built-in tools (`read_file`,
435
+ `execute_command`, …) and MCP tools (`fs__read_file`, `gh__create_issue`, …).
436
+ A policy script can therefore allow-list or deny MCP calls just like any
437
+ other agent action.
438
+
439
+ Each hook receives `CODEEP_HOOK_EVENT`, `CODEEP_WORKSPACE`, `CODEEP_SESSION_ID`,
440
+ plus event-specific extras (`CODEEP_HOOK_TOOL`, `CODEEP_HOOK_PARAMS`, `CODEEP_HOOK_FILE`).
441
+
442
+ Example — auto-format on edit (`.codeep/hooks/post_edit.sh`):
443
+
444
+ ```bash
445
+ #!/bin/bash
446
+ prettier --write "$CODEEP_HOOK_FILE" 2>/dev/null
447
+ ```
448
+
449
+ Run `/hooks` to see which hooks are installed in the current workspace. Hooks
450
+ trigger a security banner on session start since they're arbitrary shell that
451
+ runs whenever an agent tool fires.
452
+
453
+ ### Skill Bundles (new in 2.0)
454
+ Beyond the built-in skills and custom slash commands, Codeep now supports
455
+ **structured skill bundles** — directory-based capability packs the agent
456
+ discovers and invokes on its own.
457
+
458
+ A bundle is a directory `.codeep/skills/<name>/SKILL.md` (project-scoped)
459
+ or `~/.codeep/skills/<name>/SKILL.md` (global). The file is Markdown with
460
+ a YAML frontmatter header — the format is a **superset of Claude Code
461
+ skills**, so existing skills drop in unchanged:
462
+
463
+ ```markdown
464
+ ---
465
+ name: deploy-staging
466
+ description: Deploy the current branch to staging via npm scripts.
467
+ triggers: [deploy, ship, release]
468
+ # Optional Codeep-specific extensions:
469
+ codeep-min-version: 2.0.0
470
+ codeep-requires-mcp: [postgres]
471
+ allowed-tools: [read_file, write_file, execute_command]
472
+ version: 0.1.0
473
+ ---
474
+
475
+ # deploy-staging
476
+
477
+ Run the test suite, build, then `npm run deploy:staging`. If the build
478
+ fails, surface the error and stop — don't deploy a broken build.
479
+ ```
480
+
481
+ The agent gets the bundle catalog injected into its system prompt on
482
+ every iteration and can invoke any bundle via the `invoke_skill` tool:
483
+
484
+ - `/skills bundles` — list installed bundles
485
+ - `/skills create-bundle <name>` — scaffold a new project skill
486
+ - `/skills show <name>` — print the SKILL.md
487
+ - `/skills browse [query]` — search the public marketplace
488
+ - `/skills install <owner>/<slug>` — pull from marketplace
489
+ - `/skills publish <name> [--public]` — share to codeep.dev
490
+ - `/skills unpublish <owner>/<slug>` — remove your published skill
491
+
492
+ **Web marketplace:** publish skills to [codeep.dev/skills](https://codeep.dev/skills)
493
+ as public (browseable by anyone) or private (only you). Manage your published
494
+ skills at `/dashboard/skills`. From the VS Code extension, use the
495
+ **Codeep: Browse Skill Bundles…** / **Codeep: Create Skill Bundle…** /
496
+ **Codeep: Open Skills Folder** commands.
497
+
498
+ ### Custom Slash Commands
499
+ Drop a Markdown file in `.codeep/commands/<name>.md` (project-scoped) or
500
+ `~/.codeep/commands/<name>.md` (global, all projects) and Codeep exposes it
501
+ as `/<name>` — in the TUI, Zed, and the VS Code extension. The body becomes
502
+ the user prompt; the agent handles it normally.
503
+
504
+ Example — `.codeep/commands/sec-review.md`:
505
+
506
+ ```markdown
507
+ ---
508
+ description: Security review of a file
509
+ aliases: [sec, secrev]
510
+ ---
511
+
512
+ Please perform a thorough security review of {{args}}. Look for:
513
+ - AuthN/AuthZ bypasses, SQL/NoSQL injection, XSS, CSRF
514
+ - Path traversal, insecure deserialization
515
+ - Hardcoded secrets, race conditions
516
+
517
+ Report findings ordered by severity.
518
+ ```
519
+
520
+ Then call it as `/sec-review src/api/login.ts` (or `/sec` via the alias).
521
+
522
+ **Placeholders** (Claude Code-compatible):
523
+ - `{{args}}` and `$ARGUMENTS` — full args string
524
+ - `{{arg1}}`, `{{arg2}}` … — positional args
525
+
526
+ **Discovery:** `/commands` lists all available templates. Project files shadow
527
+ global files with the same name. Aliases also work for autocomplete.
528
+
321
529
  ### Project Intelligence (`/init`, `/scan`)
322
530
 
323
531
  Initialize a project and scan it once to cache deep analysis for faster AI responses: