daimon 0.4.3 → 0.5.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 (50) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/dist/cli.js +67 -58
  3. package/dist/dashboard/3rdpartylicenses.txt +461 -0
  4. package/dist/dashboard/browser/chunk-3TYCIBMV.js +1 -0
  5. package/dist/dashboard/browser/chunk-5UAN6ETO.js +1 -0
  6. package/dist/dashboard/browser/chunk-AEERNAF7.js +1 -0
  7. package/dist/dashboard/browser/chunk-AX3RJNG4.js +1 -0
  8. package/dist/dashboard/browser/chunk-BADBUP5C.js +3 -0
  9. package/dist/dashboard/browser/chunk-BF6RQFHS.js +2 -0
  10. package/dist/dashboard/browser/chunk-C65CUT7O.js +4 -0
  11. package/dist/dashboard/browser/chunk-CNIZYK4A.js +1 -0
  12. package/dist/dashboard/browser/chunk-D4BFRQ63.js +4 -0
  13. package/dist/dashboard/browser/chunk-E235WGFQ.js +3 -0
  14. package/dist/dashboard/browser/chunk-F2EDJ6FT.js +4 -0
  15. package/dist/dashboard/browser/chunk-HFAARBWL.js +1 -0
  16. package/dist/dashboard/browser/chunk-HFJ25UTJ.js +4 -0
  17. package/dist/dashboard/browser/chunk-JX3IOOXU.js +4 -0
  18. package/dist/dashboard/browser/chunk-LQNYSOSZ.js +1 -0
  19. package/dist/dashboard/browser/chunk-MBVVV35N.js +1 -0
  20. package/dist/dashboard/browser/chunk-NC2VPB4Y.js +2 -0
  21. package/dist/dashboard/browser/chunk-NXNVIINH.js +1 -0
  22. package/dist/dashboard/browser/chunk-Q7R63OUT.js +3 -0
  23. package/dist/dashboard/browser/chunk-QLKOKZDG.js +9 -0
  24. package/dist/dashboard/browser/chunk-QQSPJIPQ.js +1 -0
  25. package/dist/dashboard/browser/chunk-SCAIGUJL.js +6 -0
  26. package/dist/dashboard/browser/chunk-SLQ2WBUA.js +1 -0
  27. package/dist/dashboard/browser/chunk-TSB6OOH2.js +6 -0
  28. package/dist/dashboard/browser/chunk-WAN7TQQW.js +1 -0
  29. package/dist/dashboard/browser/chunk-WWUKM5OG.js +1 -0
  30. package/dist/dashboard/browser/chunk-ZVU34B5S.js +1 -0
  31. package/dist/dashboard/browser/chunk-ZYE3XQS4.js +2 -0
  32. package/dist/dashboard/browser/index.html +15 -0
  33. package/dist/dashboard/browser/main-Z6L5VPBT.js +4 -0
  34. package/dist/dashboard/browser/styles-SIPYJLMG.css +1 -0
  35. package/dist/dashboard/prerendered-routes.json +3 -0
  36. package/dist/main.js +49 -44
  37. package/dist/mcp.js +2 -2
  38. package/package.json +5 -4
  39. package/src/templates/claude/skill.md.tmpl +23 -31
  40. package/src/dashboard.html +0 -451
  41. package/src/templates/claude/commands/doctor.md.tmpl +0 -10
  42. package/src/templates/claude/commands/errors.md.tmpl +0 -10
  43. package/src/templates/claude/commands/logs.md.tmpl +0 -10
  44. package/src/templates/claude/commands/restart.md.tmpl +0 -10
  45. package/src/templates/claude/commands/start.md.tmpl +0 -12
  46. package/src/templates/claude/commands/status.md.tmpl +0 -10
  47. package/src/templates/claude/commands/stop.md.tmpl +0 -10
  48. package/src/templates/claude/commands/up.md.tmpl +0 -10
  49. package/src/templates/claude/commands/wait.md.tmpl +0 -10
  50. package/src/templates/claude/commands/why.md.tmpl +0 -10
package/CHANGELOG.md ADDED
@@ -0,0 +1,177 @@
1
+ # Changelog
2
+
3
+ All notable changes to Daimon are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/), and versions follow [SemVer](https://semver.org/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.5.0] — 2026-05-19
8
+
9
+ Strategic theme: **Claude path first. Dashboard second. Auto-heal everywhere.**
10
+
11
+ ### Added (M26)
12
+
13
+ - **F54 — Compact-by-default JSON.** `daimon list`, `daimon status`, and `daimon errors` (plus the matching HTTP endpoints and MCP tools) now return compact rows by default. A 10-app `daimon list` drops from ~74 lines to ~10. Compact list = `{name,status,port,health,errCount,lastChangeMs}`. Compact status = `{name,status,port,url,health,errCount,lastChangeMs,uptime,_meta:{format:"compact"}}`. Compact errors = `{file,line,col,code,message}`. `lastChangeMs` is derived from the existing event buffer.
14
+ - **F53/F63 — One skill replaces eleven.** `daimon claude install` writes a single `~/.claude/skills/daimon/SKILL.md` that documents every verb inline (~120 useful tokens). Per-command `daimon-*.md` files in `~/.claude/commands/` are removed on install (or renamed to `.bak` when the file's mtime indicates user edits since the manifest's `installed-at`). Removal/backup events are printed as one JSON line each (`{"removed":...}` / `{"warning":...}`) and recorded in the manifest.
15
+
16
+ ### Added (M27)
17
+
18
+ - **F55 — `daimon ensure` and `daimon ensure-up`.** One CLI/HTTP/MCP call replaces the canonical `list → status → start → wait → status` sequence. Idempotent on already-terminal apps. Honors `--until serving|healthy` and `--timeout`. `ensure-up <profile>` cascade-starts every app in the profile and waits for each to reach the target. On timeout the response is `{error:"timeout", state, _meta:{timedOut:true}}` and the CLI exits 2.
19
+ - **F56 — `daimon overview`.** Decision-ready snapshot in one call: totals (serving / error / stopped / total err / cpu / mem), `byStatus` map, `needsAttention` with the first parsed TS error per failing app, last 5 status transitions in the past 5 minutes. Filterable by `--workspace` and `--profile`. MCP `overview` is documented as the recommended first call in a session.
20
+ - **F62 — NDJSON `--stream`.** `daimon list --stream` and `daimon events --stream` emit one JSON object per line. The list stream is one-shot. The events stream is long-lived: historical events flush first, then each newly-recorded event arrives on its own line. 30-second newline keepalives keep the connection alive on quiet workspaces. The registry emits a new `event` signal for in-process subscribers.
21
+
22
+ ### Added (M28)
23
+
24
+ - **F58 — `daimon doctor --auto-fix [--dry-run]`.** Four rule-based, transparent repair routines that operate **only on daimon's own state** — never user source:
25
+ - `orphan-daemon` — daemon's recorded cwd/configPath differs from the current shell's cwd and a local `daimon.config.json` exists here; snapshot-handoff-shuts-down-respawn from the new cwd.
26
+ - `stale-lock` — lock file claims a pid that's dead; remove + spawn fresh.
27
+ - `missing-search-root` — cwd has nx/angular/vite/storybook markers but no configured searchRoot covers it; append (with `package.json` `name` as label when available) and trigger F39 soft-reload.
28
+ - `corrupt-history-db` — `quickCheck()` fails or open throws; rotate to `history.db.corrupt-<ts>` (and its `-wal` / `-shm` siblings) so a fresh DB is rebuilt on next start.
29
+ Each routine returns a paragraph describing what was wrong, what was done, and how to undo. Gated by `config.doctor.autoFix.permitted`.
30
+ - **F57 — Self-explaining discovery.** `daimon list --explain` (alias: `daimon why-empty`) wraps the response as `{ apps, _meta:{ searchRoots, scanned, rejected:{reason:count}, warnings, suggestion } }`. `discoverApps` now accepts an optional stats collector that gets bumped at every concrete skip (`searchRoot missing`, `no serve target`, `duplicate name`, `no project markers`, …). New HTTP endpoint `GET /api/discovery/explain` returns the same `_meta`. The non-`--explain` default still returns a bare array, preserving the M26 contract.
31
+ - **F59 — `daimon init --auto` + smoke test.** `daimon init --auto` writes a config without prompting (cwd auto-added as searchRoot, labeled from `package.json` `name` when present). All init paths now run a discovery smoke test after the post-init daemon restart and emit `{init:"ok", configPath, discovered:{apps, byKind}}`. When `apps === 0`, the response embeds the F57 `_meta` and a copy-pasteable suggestion.
32
+ - **F65 — HTTPS-cert tolerance on loopback.** Health probes against `127.0.0.1` / `::1` / `localhost` over HTTPS now always pass `rejectUnauthorized: false`, so Vite dev servers using mkcert or auto-generated self-signed certs no longer fail with `UNABLE_TO_VERIFY_LEAF_SIGNATURE`. Off-loopback hosts still get strict cert checks unless `healthProbe.rejectUnauthorized` is explicitly relaxed.
33
+
34
+ ### Added (M29) — Angular 20 dashboard
35
+
36
+ - **F60 — Sibling `dashboard/` workspace** (Angular 20 standalone, zoneless, Signals, Material 3). Components: root toolbar, apps-list (overview card + per-app cards), app-detail (status + errors + metrics chart), `daimon-api` typed HTTP store backed by signals with an NDJSON `/api/events?stream=ndjson` subscription.
37
+ - **Bundled SPA in the published tarball.** `dist/dashboard/browser/` ships in the published `daimon` npm package. Initial-route bundle: **426 KB raw / 111 KB transfer-gzip.** App-detail (chart.js): **211 KB raw / 63 KB transfer**, lazy-loaded. Errors panel: 23 KB raw lazy. The daemon serves the bundle at `/` with correct MIME types, 1h `cache-control` on hashed assets, SPA-fallback to `index.html` for non-API routes. Fonts (Roboto, Material Symbols Outlined) load from `fonts.gstatic.com`; this is an explicit project choice to keep the bundle slim, not telemetry. **Legacy `src/dashboard.html` is removed** — the Angular bundle is now the only dashboard the daemon serves.
38
+
39
+ ### Added (M30) — Dashboard polish
40
+
41
+ - **F64 — Per-app actions** (start / stop / restart / open) on each card and in the detail panel.
42
+ - **F67 — Workspace tones.** `workspace-tone.ts` derives a deterministic Material 3 surface-tonal color from each workspace label string (FNV-1a hash → oklch hue), used as a 4px top accent on each card.
43
+ - **F61 — Errors panel + real-time CPU/RAM charts.** `dm-errors-panel` aggregates dedup'd errors across every app with a `vscode://` link per file. `dm-metrics-chart` renders a chart.js line chart of CPU% + Mem MB over the last 5 minutes per app (5-second polling, last 60 samples). Chart.js is now a direct dep, lazy-loaded via the `app-detail` route so it never appears in the initial bundle.
44
+ - **F70 — Material motion polish.** Material 3 motion tokens (`--dm-motion-easing`, `--dm-motion-short/medium`) drive transitions on card hover (translate + elevation), route enter (fade-up), and card mount (fade + scale). `@media (prefers-reduced-motion: reduce)` collapses all animations to ~instant.
45
+ - **Theme toggle** (auto / light / dark) persisted in `localStorage`, applied via `color-scheme` on the document root.
46
+
47
+ ### Added (M32) — Dashboard final polish
48
+
49
+ - **Settings → Discovery** now renders `searchRoots` (Array&lt;{path,label}&gt;) as one editable row per entry instead of a useless `[object Object]` chip. New `path-objects` field kind in the form editor.
50
+ - **Doctor → System Overview** shows the live daemon version (`/api/overview` now returns `version`).
51
+ - **Errors page** auto-collapses the file column when no error in a group has a file path, replaces `(unknown)` with a dimmed `—`, and surfaces a one-line hint with a switch-to-group-by-app shortcut.
52
+ - **Events page** type-chips no longer wrap to two lines for long event kinds (`compile-regression`).
53
+ - **Material 3 density** set to `-2` and global overrides tighten slide-toggle, button-toggle, form-field, expansion-panel-header, and in-button icon sizes so the dashboard feels like a dev tool, not an app launcher.
54
+ - **Global `mat-icon` fontSet** defaults to `material-symbols-outlined`, fixing leftover icons that previously rendered their ligature name as text (`se Dry-run`, `bu Fix`).
55
+
56
+ ### Fixed (M32)
57
+
58
+ - **Error parser back-fills file paths.** Esbuild prints `path:line:col:` on the indented line *after* `✘ [ERROR] TSnnn: …`. The parser now matches that bare-location line and attaches it to the most-recent error entry that lacks a file. Errors emitted by the Angular esbuild plugin now click through to VS Code at the right line.
59
+ - **`/api/doctor/auto-fix` endpoint** added (was 404 from the dashboard despite the CLI command working).
60
+
61
+ ### Added (M31) — Polish CLI features
62
+
63
+ - **F66 — `daimon why-empty`** shipped early in M28 as an alias of `daimon list --explain`.
64
+ - **F68 — Agent token footprint in `daimon doctor`.** A new check prints `skill=120 tokens · daimon list (N apps) ≈ X compact / Y full · savings: ~Z%`. Deterministic from current app count, no remote calls.
65
+ - **F69 — `daimon export-config [--redacted]`.** Emits the active config to stdout. `--redacted` replaces `apiToken` with `"<redacted>"` and rewrites paths under `$HOME` to `~/...`. Intended for paste into GitHub issues.
66
+ - **`daimon discover [--dry-run]`** (sub-feature of F57). New CLI subcommand that returns the F57 `_meta` (searchRoots, scanned, rejected per folder, suggestion) without changing daemon state. Reuses `GET /api/discovery/explain`.
67
+
68
+ ### Changed (M26, breaking)
69
+
70
+ - `/api/apps` and `/api/apps/:name` now return the compact shape by default (see F54 above). Pass `?format=full` (HTTP) or `--full` (CLI) for the v0.4 verbose shape. **External automation that parsed `daimon list` or `daimon status` must add `--full` or migrate to the compact field names** (`errorCount` → `errCount`, `uptimeMs` → `uptime`, new `lastChangeMs`). The dashboard is unchanged because it now requests `?format=full` explicitly.
71
+ - `LockInfo` gained optional `cwd` and `configPath` fields so auto-fix can identify orphan daemons without poking `/proc`. Old daemons that wrote the v0.4 lock shape continue to work — the fields are optional.
72
+
73
+ ### Schema additions (all optional, safe defaults)
74
+
75
+ - `output: { format: "compact" | "full" (default "compact"), ndjson: false }`
76
+ - `doctor: { autoFix: { onInit: false, permitted: ["orphan-daemon","stale-lock","missing-search-root","corrupt-history-db"] } }`
77
+ - `dashboard: { theme: "auto" | "light" | "dark", density: "comfortable" | "compact" }`
78
+ - `AppSummary.lastChangeMs?` — milliseconds since the last status transition
79
+
80
+ ### Tarball budget
81
+
82
+ The original v0.5 plan capped the published tarball at **200 KB packed** — written before Angular 20 + Material 3 were measured. With the full v0.5 surface shipped (Angular SPA, chart.js for metrics, Material motion, M31 polish CLI), `daimon-0.5.0.tgz` lands at **332 KB packed / 1.1 MB unpacked / 28 files**. The new agreed budget is **2 MB packed** to leave headroom for future dashboard work. Initial-route gzip transfer stays at ~111 KB; chart.js sits in the lazy app-detail chunk and only loads when a user opens an app.
83
+
84
+ ### Deferred (v0.6+ or never)
85
+
86
+ - **Dashboard unit tests** — no Angular `*.spec.ts` files yet; the plan deferred them to M31 polish but they were not written this round.
87
+ - **Local-bundled fonts** — `fonts.gstatic.com` remains the source for Roboto + Material Symbols Outlined. Bundling locally would add ~150 KB raw to the initial chunk; the CDN approach is the explicit project choice.
88
+
89
+ ## [0.4.3] — 2026-05-18
90
+
91
+ ### Fixed
92
+ - `daimon init` now auto-restarts the daemon at the end so the new config is actually loaded. Previously, if a daemon was already running when init was invoked, the new `daimon.config.json` was silently ignored (the daemon's config path is locked at startup), causing `daimon list` to return `[]` immediately after init. State is preserved across the restart via the existing zero-downtime snapshot mechanism.
93
+
94
+ ## [0.4.2] — 2026-05-17
95
+
96
+ ### Changed (first npm publish)
97
+ - **License changed from MIT to PolyForm Noncommercial 1.0.0.** Free for personal, academic, and noncommercial-organization use; commercial use requires a separate license. The MIT-licensed history remains in git for anyone who obtained it before this change.
98
+ - **Renamed from `appman` to `daimon`.** Binary, package, environment variables (`APPMAN_*` → `DAIMON_*`), config file (`appman.config.json` → `daimon.config.json`), state directory (`~/.appman/` → `~/.daimon/`), and Claude integration paths (`~/.claude/skills/appman/` → `~/.claude/skills/daimon/`) all changed. No automated migration — first OSS release does not have prior public users.
99
+ - **Published builds are bundled and minified.** `npm i -g daimon` ships a single bundled+minified `.js` per entry point (cli / main / mcp). The TypeScript source remains in the GitHub repo for review.
100
+
101
+ ### Added (M25)
102
+ - Live log stream via Server-Sent Events on the dashboard
103
+ - `~/.daimon/secrets.json` with `${NAME}` substitution in `overrides.env`
104
+ - Zero-downtime daemon restart via state handoff
105
+ - Audit log of dashboard config edits at `~/.daimon/audit.log`
106
+ - Workspace presets surfaced in the dashboard config editor
107
+
108
+ ## [0.4.1] — 2026-05-17
109
+
110
+ ### Added (M24)
111
+ - `searchRoots[*].label` for workspace grouping (F44)
112
+ - `daimon init` — interactive config scaffolder (F45)
113
+ - `daimon daemon install-service` — emits Windows/macOS/Linux service artifacts (F46)
114
+ - Crash report dumps to `~/.daimon/crashes/<ts>.txt` on daemon fatal (F47)
115
+
116
+ ## [0.4.0] — 2026-05-17
117
+
118
+ ### Added (M20–M23)
119
+ - **Global install** via `npm i -g`. New `daimon` command on PATH (F37).
120
+ - **Auto-spawn daemon** on first CLI/MCP call; lock file at `~/.daimon/daemon.lock` (F38).
121
+ - `daimon daemon start|stop|status|restart|attach` family + `--detach` / `--headless` flags.
122
+ - `daimon daemon attach` — HTTP-client TUI against a detached daemon (F38b).
123
+ - `daimon claude install|update|uninstall|status` — Claude Code integration installer with selectable skill / slash commands / subagent artifacts (F41).
124
+ - `src/cliSurface.ts` — single source of truth for CLI usage, MCP tool descriptions, and Claude templates.
125
+ - Auto-update nudge when installed Claude artifacts are older than current daimon version (throttled to 24h, silence with `DAIMON_NO_CLAUDE_NUDGE=1`).
126
+ - Dashboard configuration editor — per-app overrides + global config (F39). Soft reload on save without killing running children.
127
+ - Optional `apiToken` for mutating endpoints (F43). Loopback bind unchanged.
128
+ - Errors panel in the dashboard with expandable per-app drawer, structured `file:line` deep-links, and copy-to-clipboard (F40).
129
+ - Configurable editor URL scheme (`vscode`, `vscode-insiders`, `cursor`, custom) (F42).
130
+
131
+ ## [0.3.0] — 2026-05-16
132
+
133
+ ### Added (M11–M19)
134
+ - **Dependency graph + cascade restart** via `config.depends` (F18). `daimon up <profile>` topologically orders starts and waits for each level to reach `healthy`.
135
+ - **SQLite event/compile/task history** at `~/.daimon/history.db` with 30-day retention (F19). New `daimon history <name>` and `daimon why <name>` queries.
136
+ - **`daimon run <app> <task>`** — non-serve actions (test/build/lint) with the same capture/dedupe infra (F20).
137
+ - Desktop notifications on app error / unhealthy / stale / regression (F21). Throttled per-app-per-minute. Audit log to `~/.daimon/notifications.log`.
138
+ - Stale detector — flags apps that are `serving` but silent while sources change (F22).
139
+ - `daimon snapshot <name>` — write a state bundle for bug reports (F23).
140
+ - Headless mode (`--headless` flag or `config.headless: true`) (F24).
141
+ - TUI live config edit (`e` key on a selected app) (F25).
142
+ - Bundle size readout in summary + dashboard (F26).
143
+ - Port-in-use diagnostics + `daimon free-port <port> [--force]` (F27).
144
+ - `daimon doctor` — config sanity checks (F28).
145
+ - Compile-time regression alarm (F29).
146
+ - `.env` file switcher per app (F30).
147
+ - `daimon clean <name> [--deep] [--yes]` — remove build artifacts (F31).
148
+ - Experimental: passive HTTP request log proxy (F32, off by default).
149
+ - Experimental: Prometheus exporter at `/metrics` (F33, off by default).
150
+ - Session record/replay (F34).
151
+ - VS Code companion extension (`daimon-vscode`, separate package) (F35).
152
+ - **Accurate health probe** — uses the URL the dev server announced, with HTTPS support, IPv6 brackets, 0.0.0.0 rewrite, fallback hosts, per-app overrides (F36). `summary.url` semantics changed: now reflects the resolved probe URL, not a synthetic loopback.
153
+
154
+ ## [0.2.0] — 2026-05-16
155
+
156
+ ### Added (M1–M10)
157
+ - `daimon wait <name> --until serving|healthy|stopped|error --timeout 60s` — blocking command for AI agents (F1).
158
+ - Diff-mode error queries: `--since 2m` and `--since-last --client <id>` (F2).
159
+ - Real HTTP health probe — separate `health` dimension from `status` (F3).
160
+ - `autoStart` config + `daimon up [<profile>]` / `daimon down` (F4).
161
+ - TUI `o` key opens app URL in default browser (F5).
162
+ - CPU / RAM per app via `pidusage` (F6).
163
+ - Structured TS error extraction (file, line, col, code) (F7).
164
+ - Full-screen log view in TUI with `/` search (F8).
165
+ - Persistent sticky ports across daemon restarts (F9).
166
+ - Per-app environment overrides (F10).
167
+ - Dashboard start/stop/restart buttons (F11).
168
+ - Crash auto-restart with exponential backoff (F12).
169
+ - Compile-time history sparkline in TUI and dashboard (F13).
170
+ - Project filtering by tag (F14).
171
+ - Disk log files with rotation (F15).
172
+ - MCP server for Claude Code (`daimon mcp`) (F16).
173
+ - Vite + Storybook discovery (F17).
174
+
175
+ ## [0.1.0] — 2026-05-16
176
+
177
+ Initial foundation. Foreground TUI, loopback HTTP API, JSON CLI, Nx + Angular workspace discovery, port auto-allocation, log dedup, error fingerprinting.