@hienlh/ppm 0.12.11 → 0.13.0

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 (64) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +11 -0
  3. package/assets/skills/ppm/SKILL.md +74 -0
  4. package/assets/skills/ppm/references/cli-reference.md +728 -0
  5. package/assets/skills/ppm/references/common-tasks.md +139 -0
  6. package/assets/skills/ppm/references/http-api.md +204 -0
  7. package/bun.lock +2062 -0
  8. package/bunfig.toml +2 -0
  9. package/dist/web/assets/{audio-preview-DnQmf9fu.js → audio-preview-J5neETTY.js} +1 -1
  10. package/dist/web/assets/chat-tab-sVHRa1Fz.js +12 -0
  11. package/dist/web/assets/{code-editor-B-lU1fz3.js → code-editor-tMfcFaQ5.js} +2 -2
  12. package/dist/web/assets/{conflict-editor-BYzf3LuW.js → conflict-editor-FydCxWTC.js} +1 -1
  13. package/dist/web/assets/{database-viewer-DjvnIn8p.js → database-viewer-Celi1puH.js} +1 -1
  14. package/dist/web/assets/diff-viewer-NgDJLTk9.js +4 -0
  15. package/dist/web/assets/{extension-webview-4xMREn_x.js → extension-webview-xWAdCj3q.js} +1 -1
  16. package/dist/web/assets/{image-preview-CkS2PVdQ.js → image-preview-C6bFkdZD.js} +1 -1
  17. package/dist/web/assets/index-BMhiElt6.css +2 -0
  18. package/dist/web/assets/{index-FGlF8IWZ.js → index-DtbAoxyy.js} +2 -2
  19. package/dist/web/assets/{markdown-renderer-Bj2B05Km.js → markdown-renderer-BAnnk1pI.js} +1 -1
  20. package/dist/web/assets/{pdf-preview-CCyw5cuH.js → pdf-preview-BNuFTSOL.js} +1 -1
  21. package/dist/web/assets/{port-forwarding-tab-Cebb5Eix.js → port-forwarding-tab-BbDlGxAs.js} +1 -1
  22. package/dist/web/assets/{postgres-viewer-BrOiliEv.js → postgres-viewer-Cman1YRO.js} +1 -1
  23. package/dist/web/assets/{settings-tab-D0XjupJm.js → settings-tab-n5X_Dbu4.js} +1 -1
  24. package/dist/web/assets/{sqlite-viewer-OEVq_-Po.js → sqlite-viewer-D6JT11uu.js} +1 -1
  25. package/dist/web/assets/{terminal-tab-MjmJaQyA.js → terminal-tab-B4kMthYo.js} +1 -1
  26. package/dist/web/assets/{video-preview-B819qvlp.js → video-preview-BftQOOzF.js} +1 -1
  27. package/dist/web/index.html +2 -2
  28. package/dist/web/sw.js +1 -1
  29. package/docs/project-changelog.md +15 -1
  30. package/package.json +3 -3
  31. package/scripts/generate-ppm-skill.ts +23 -0
  32. package/scripts/lib/generate-cli-reference.ts +81 -0
  33. package/scripts/lib/generate-common-tasks.ts +14 -0
  34. package/scripts/lib/generate-http-api.ts +145 -0
  35. package/scripts/lib/generate-skill-md.ts +28 -0
  36. package/scripts/lib/write-output.ts +17 -0
  37. package/src/cli/commands/export-cmd.ts +85 -0
  38. package/src/index.ts +167 -153
  39. package/src/providers/claude-agent-sdk.ts +1 -135
  40. package/src/server/index.ts +2 -1
  41. package/src/server/routes/chat.ts +18 -0
  42. package/src/server/routes/git.ts +16 -0
  43. package/src/services/git.service.ts +34 -0
  44. package/src/services/jsonl-transcript-parser.ts +216 -0
  45. package/src/services/skill-export/backup-existing.ts +33 -0
  46. package/src/services/skill-export/copy-bundled-skill.ts +36 -0
  47. package/src/services/skill-export/generate-db-schema.ts +66 -0
  48. package/src/services/skill-export/index.ts +6 -0
  49. package/src/services/skill-export/resolve-assets-dir.ts +31 -0
  50. package/src/services/skill-export/resolve-target-dir.ts +17 -0
  51. package/src/services/supervisor.ts +2 -1
  52. package/src/web/components/chat/chat-tab.tsx +6 -1
  53. package/src/web/components/chat/message-list.tsx +101 -9
  54. package/src/web/components/chat/pre-compact-button.tsx +50 -0
  55. package/src/web/components/editor/diff-viewer.tsx +21 -5
  56. package/src/web/hooks/use-chat.ts +37 -1
  57. package/src/web/lib/flatten-expansions.ts +36 -0
  58. package/templates/skill/SKILL.md.tmpl +74 -0
  59. package/templates/skill/common-tasks.md +139 -0
  60. package/assets/skills/ppm-guide/SKILL.md +0 -61
  61. package/dist/web/assets/chat-tab-Cf6T3mGO.js +0 -12
  62. package/dist/web/assets/diff-viewer-CP2jcR5J.js +0 -4
  63. package/dist/web/assets/index-BTjuH4fn.css +0 -2
  64. package/scripts/generate-ppm-guide.ts +0 -92
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.13.0] - 2026-04-21
4
+
5
+ ### Added
6
+ - **`ppm export skill`**: Install a Claude Code skill at `~/.claude/skills/ppm/` so external AI agents can control PPM via its CLI, HTTP API, and SQLite config DB. Flags: `--install`, `--scope user|project`, `--output <dir>`, `--format claude-code`. Generates `SKILL.md` + `references/{cli-reference,http-api,db-schema,common-tasks}.md`. CLI/HTTP references are auto-generated at build time by walking the Commander tree and scanning Hono route files. DB schema is generated at install time from the user's `~/.ppm/ppm.db` (opened readonly). Re-install is safe: existing files are renamed to `<name>.bak-<YYYYMMDDHHmm>` before overwrite. Preview mode (no `--install`/`--output`) writes the merged `SKILL.md` to stdout.
7
+ - **`buildProgram()` export in `src/index.ts`**: Module now exports the assembled Commander tree without parsing argv, enabling build-time introspection for auto-generated docs. Runtime behavior preserved via `import.meta.main` guard.
8
+
9
+ ### Changed
10
+ - **Generator rename**: `scripts/generate-ppm-guide.ts` → `scripts/generate-ppm-skill.ts` (plus `scripts/lib/` modules). Output moved from `assets/skills/ppm-guide/` → `assets/skills/ppm/`. `npm` scripts: `generate:guide` → `generate:skill`; `prepublishOnly` updated.
11
+
12
+ ## [0.12.12] - 2026-04-21
13
+
14
+ ### Fixed
15
+ - **Login broken when using `--share` without profile**: The `--share` flag was positionally parsed as a DB profile name in both supervisor and server child, causing them to read `ppm.--share.db` (with a random auto-generated token) instead of `ppm.db`. Users saw perpetual "Unauthorized" on login despite entering the correct token
16
+
17
+ ### Added
18
+ - **Expand compacted conversation**: When Claude compacts context and references a JSONL transcript (`read the full transcript at: ...`), the chat now shows a "Load previous conversation" button. Clicking fetches pre-compact messages via `GET /chat/pre-compact-messages?jsonlPath=...` and **prepends them into the main message list above the compact card** (natural Messenger-style UX) — scroll up to view history, and nested compact summaries in loaded history show their own button for recursive expansion. Expansions are ephemeral (reset on session switch). Extracted shared JSONL parsing into `src/services/jsonl-transcript-parser.ts`. Path validated strictly under `~/.claude/` (symlink-resolved realpath) with a 50MB size guard
19
+ - **Full-content diff endpoint**: `GET /git/file-full-diff?file=&ref=` returns original (ref) and modified (working tree) file contents for Monaco DiffEditor
20
+
3
21
  ## [0.12.11] - 2026-04-21
4
22
 
5
23
  ### Fixed
package/README.md CHANGED
@@ -128,6 +128,17 @@ bunx @hienlh/ppm init -y \
128
128
 
129
129
  Once running, the Cloudflare public URL is printed to stdout — parse it to share with users.
130
130
 
131
+ ## Use with Claude Code
132
+
133
+ Install the PPM skill so Claude Code (and other compatible AI agents) can control PPM via its CLI, HTTP API, and SQLite config DB:
134
+
135
+ ```bash
136
+ ppm export skill --install
137
+ # Installs to ~/.claude/skills/ppm/ (use --scope project for per-project install).
138
+ ```
139
+
140
+ Then in Claude Code: `/ppm list my projects` → Claude invokes `ppm projects list` automatically. Re-run any time to refresh (existing files are backed up with a `.bak-<timestamp>` suffix). Requires PPM v0.13.0+.
141
+
131
142
  ## Requirements
132
143
 
133
144
  - **Bun** v1.3.6+ ([install](https://bun.sh))
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: ppm
3
+ description: Control PPM (Project & Process Manager) via its CLI, HTTP API, and SQLite config database. Use when the user wants to manage PPM projects, query database connections, start/stop the PPM server, view logs, or read/write PPM config.
4
+ ---
5
+
6
+ # PPM Skill
7
+
8
+ PPM is a local-first web IDE + project manager. This skill describes how to control PPM from the terminal, over HTTP, and by inspecting its SQLite config database.
9
+
10
+ ## Quick Reference
11
+
12
+ | What | Where |
13
+ |---|---|
14
+ | CLI binary | `ppm` |
15
+ | Default server | `http://localhost:8080` |
16
+ | Config DB (prod) | `~/.ppm/ppm.db` (SQLite) |
17
+ | Config DB (dev) | `~/.ppm/ppm.dev.db` (port 8081) |
18
+ | Skill root (user) | `~/.claude/skills/` |
19
+ | Skill root (project) | `<project>/.claude/skills/` |
20
+
21
+ ## When to Use This Skill
22
+
23
+ Invoke when the user asks to:
24
+ - Start, stop, restart, or check the PPM server
25
+ - Manage registered projects (`projects list/add/remove`)
26
+ - Manage database connections stored in PPM config (`db list/add/test/query`)
27
+ - Get or set PPM config values (`config get/set`)
28
+ - View PPM logs, status, or report a bug
29
+ - Install, upgrade, or inspect bundled skills / extensions
30
+ - Control the PPM daemon autostart registration
31
+
32
+ ## Top Tasks
33
+
34
+ 1. **Check if PPM is running** → `ppm status`
35
+ 2. **Start server** → `ppm start` (use `--port <n>` to override, `--profile dev` for dev DB)
36
+ 3. **List projects** → `ppm projects list`
37
+ 4. **Add project** → `ppm projects add <path>`
38
+ 5. **List DB connections** → `ppm db list`
39
+ 6. **Query a saved DB connection** → `ppm db query <connection-name> "<sql>"`
40
+ 7. **Read config** → `ppm config get <key>` (e.g. `port`, `auth.enabled`)
41
+ 8. **Tail logs** → `ppm logs --tail 100` or `ppm logs -f` to follow
42
+ 9. **Upgrade PPM** → `ppm upgrade` (or `--check` to only check)
43
+ 10. **Open in browser** → `ppm open`
44
+
45
+ ## Rules of Thumb
46
+
47
+ - Always run `ppm status` before assuming the server is up.
48
+ - Commands exit non-zero on failure and print to stderr. Capture both streams.
49
+ - Listing commands accept `--json` for structured output; prefer JSON when parsing.
50
+ - The config DB is **SQLite**. You may open `~/.ppm/ppm.db` read-only for inspection — see [references/db-schema.md](references/db-schema.md).
51
+ - Do NOT edit the config DB directly while the server is running; use `ppm config set` or the HTTP API.
52
+
53
+ ## Links
54
+
55
+ - Complete CLI options, every subcommand → [references/cli-reference.md](references/cli-reference.md)
56
+ - HTTP API routes (25+) → [references/http-api.md](references/http-api.md)
57
+ - Config DB schema (runtime-generated from user's DB) → [references/db-schema.md](references/db-schema.md)
58
+ - Worked recipes for common tasks → [references/common-tasks.md](references/common-tasks.md)
59
+
60
+ ## Error Handling
61
+
62
+ - Server not running → `ppm status` exits non-zero; start with `ppm start`.
63
+ - Port conflict → `ppm config set port <n>` then `ppm restart`.
64
+ - Missing config DB → `ppm init` creates defaults.
65
+ - Upgrade failure → re-run `ppm upgrade` or `npm i -g @hienlh/ppm@latest`.
66
+
67
+ ## Scope Boundaries
68
+
69
+ This skill covers the `ppm` CLI, its HTTP API, and its config DB. It does **not** cover:
70
+ - Projects managed by PPM (those are user code, outside skill scope).
71
+ - Third-party extensions (inspect via `ppm ext list`).
72
+ - The Claude Agent SDK internals (separate skill).
73
+
74
+ <!-- Generated for PPM v0.13.0 at build time. Re-run `ppm export skill --install` to refresh. -->