daimon 0.4.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/LICENSE ADDED
@@ -0,0 +1,131 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Yosi Azulay (FlyCoTech) (https://flycotech.com)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the software
97
+ not covered by your licenses, your licenses can nonetheless
98
+ continue if you come into full compliance with these terms,
99
+ and take practical steps to correct past violations, within
100
+ 32 days of receiving notice. Otherwise, all your licenses
101
+ end immediately.
102
+
103
+ ## No Liability
104
+
105
+ ***As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be liable
107
+ to you for any damages arising out of these terms or the use
108
+ or nature of the software, under any kind of legal claim.***
109
+
110
+ ## Definitions
111
+
112
+ The **licensor** is the individual or entity offering these
113
+ terms, and the **software** is the software the licensor makes
114
+ available under these terms.
115
+
116
+ **You** refers to the individual or entity agreeing to these
117
+ terms.
118
+
119
+ **Your company** is any legal entity, sole proprietorship,
120
+ or other kind of organization that you work for, plus all
121
+ organizations that have control over, are under the control of,
122
+ or are under common control with that organization. **Control**
123
+ means ownership of substantially all the assets of an entity,
124
+ or the power to direct its management and policies by vote,
125
+ contract, or otherwise. Control can be direct or indirect.
126
+
127
+ **Your licenses** are all the licenses granted to you for the
128
+ software under these terms.
129
+
130
+ **Use** means anything you do with the software requiring one
131
+ of your licenses.
package/README.md ADDED
@@ -0,0 +1,196 @@
1
+ # Daimon
2
+
3
+ A local manager for Angular / Nx / Vite / Storybook dev servers. One daemon owns all your `serve` processes, auto-assigns ports, dedup'd error captures, exposes a loopback HTTP API + JSON CLI + MCP server. Built so you and Claude Code can both query app state without parsing thousands of log lines.
4
+
5
+ Loopback only. Single user. No cloud. No telemetry.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i -g daimon
11
+ ```
12
+
13
+ After install, `daimon` is on your PATH globally.
14
+
15
+ ## Quick start
16
+
17
+ ```bash
18
+ daimon init # interactive scaffolder; writes ./daimon.config.json or ~/.daimon/config.json
19
+ daimon list # auto-spawns the daemon on first call
20
+ daimon daemon status
21
+ ```
22
+
23
+ Config lookup order:
24
+
25
+ 1. `./daimon.config.json` (cwd)
26
+ 2. `~/.daimon/config.json`
27
+
28
+ If neither exists, the first call to `daimon` creates a stub and exits — edit `searchRoots` to point at your workspace and try again.
29
+
30
+ ## Config (minimal)
31
+
32
+ ```jsonc
33
+ {
34
+ "searchRoots": ["D:\\code\\my-nx-workspace"],
35
+ "portRange": [4200, 4299],
36
+ "apiPort": 4999,
37
+
38
+ "autoStart": ["web-admin"],
39
+ "profiles": { "fullstack": ["web-admin", "api"] },
40
+ "depends": { "web-admin": ["api"] },
41
+
42
+ "healthProbe": { "enabled": true, "intervalMs": 30000, "path": "/" },
43
+
44
+ "overrides": {
45
+ "web-admin": {
46
+ "port": 4250,
47
+ "command": "npx nx serve web-admin --configuration=dev",
48
+ "env": { "API_BASE": "http://localhost:3000" }
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ All sections except `searchRoots` are optional with safe defaults. See `daimon.config.example.json` for every field.
55
+
56
+ ## Daemon lifecycle
57
+
58
+ ```bash
59
+ daimon daemon start [--detach] [--headless] # foreground TUI by default
60
+ daimon daemon status # { running, pid, port, uptime, version }
61
+ daimon daemon stop
62
+ daimon daemon restart # state-handoff: serving apps come back on the same ports
63
+ daimon daemon attach # HTTP-client TUI against a running detached daemon
64
+ daimon daemon install-service # emits service unit for Windows (nssm) / macOS (launchd) / Linux (systemd)
65
+ ```
66
+
67
+ The daemon auto-spawns on the first `daimon` call that needs it. To suppress: `DAIMON_NO_SPAWN=1` or `--no-spawn`. To target a non-default daemon: `DAIMON_PORT=5000`.
68
+
69
+ ## CLI
70
+
71
+ ```bash
72
+ daimon list [--tag <name>] [--workspace <label>]
73
+ daimon status <name>
74
+ daimon errors <name> [--since 2m] [--since-last] [--client <id>] [--structured]
75
+ daimon events [--since 1h] [--app <name>]
76
+ daimon wait <name> [--until serving|healthy|stopped|error] [--timeout 60s]
77
+ daimon logs <name> [--tail N] [--since 30s]
78
+ daimon start <name> [--with-deps]
79
+ daimon stop <name>
80
+ daimon restart <name>
81
+ daimon up [<profile>] # topological start; waits for each level to reach healthy
82
+ daimon down [<profile>]
83
+ daimon history <name> # uptime%, restart count, compile p50/p95, top errors
84
+ daimon why <name> # last transition + 5 preceding events (great for "what just broke")
85
+ daimon tasks <name> # discovered non-serve tasks
86
+ daimon run <name> <task> [--watch] [-- args...]
87
+ daimon snapshot <name> # bundle state for bug reports
88
+ daimon env <name> [--use <file>] # env-file switcher
89
+ daimon clean <name> [--deep] [--yes]
90
+ daimon record / replay
91
+ daimon doctor # config sanity checks; does not need the daemon
92
+ daimon free-port <port> [--force]
93
+ daimon init # interactive config scaffolder
94
+ ```
95
+
96
+ All CLI commands print compact JSON on stdout. Errors are compact JSON on stderr with non-zero exit. Exit codes: `0` success, `1` generic error, `2` timeout (used by `daimon wait`).
97
+
98
+ ## HTTP API
99
+
100
+ Bound to `127.0.0.1:<apiPort>` only. The dashboard at `/` lets you inspect state, restart apps, expand error drawers, and (in v0.4) edit configuration.
101
+
102
+ ```
103
+ GET /api/apps
104
+ GET /api/apps/:name
105
+ GET /api/apps/:name/errors[?since=2m]
106
+ GET /api/apps/:name/errors/since-last?client=<id>
107
+ GET /api/apps/:name/logs?tail=N&since=30s
108
+ GET /api/apps/:name/logs/stream # Server-Sent Events
109
+ GET /api/apps/:name/wait?until=serving&timeout=60
110
+ GET /api/events?since=5m&app=<name>
111
+ GET /api/history/{events,compile-times,tasks,summary/:name,why/:name}
112
+ GET /api/config # current config (env redacted)
113
+ POST /api/apps/:name/(start|stop|restart|snapshot|clean|run/:task)
114
+ PATCH /api/config # If-Match: <etag>; 412 on conflict
115
+ POST /api/config/reload # soft reload — no running children killed
116
+ POST /api/shutdown
117
+ ```
118
+
119
+ If `config.apiToken` is set, mutating endpoints require `Authorization: Bearer <token>`. Read endpoints stay open.
120
+
121
+ ## Claude Code integration
122
+
123
+ ```bash
124
+ daimon claude install --all
125
+ # or pick: --skill, --commands, --agent
126
+ # or interactive: daimon claude install
127
+ ```
128
+
129
+ Three selectable artifacts:
130
+
131
+ - **Skill** at `~/.claude/skills/daimon/SKILL.md` — comprehensive how-to and recipes.
132
+ - **Slash commands** at `~/.claude/commands/daimon-{status,start,stop,restart,errors,logs,up,doctor,why,wait}.md`.
133
+ - **Subagent** at `~/.claude/agents/daimon-runner.md` — specialized dev-loop orchestrator.
134
+
135
+ Templates are rendered from a single source of truth (`src/cliSurface.ts`), so they cannot drift from the actual command surface.
136
+
137
+ Daimon stamps the current version into the artifact frontmatter. When you upgrade daimon, the next CLI call nudges you (once per 24h) to run `daimon claude update`. Silence with `DAIMON_NO_CLAUDE_NUDGE=1`.
138
+
139
+ ```bash
140
+ daimon claude status # what's installed and at which version
141
+ daimon claude update # refresh based on the install manifest
142
+ daimon claude uninstall [--all|--skill|--commands|--agent]
143
+ ```
144
+
145
+ For raw MCP use (without slash commands or a subagent):
146
+
147
+ ```bash
148
+ claude mcp add daimon -- daimon mcp
149
+ ```
150
+
151
+ The MCP server exposes: `list_apps`, `get_status`, `get_errors`, `get_logs`, `start_app`, `stop_app`, `restart_app`, `wait_for_app`.
152
+
153
+ ## State files (in `~/.daimon/`)
154
+
155
+ - `config.json` — your config (above)
156
+ - `daemon.lock` — `{ pid, apiPort, version, startedAt, headless }`
157
+ - `state.json` — sticky port assignments
158
+ - `cursors.json` — per-client error cursors for `--since-last`
159
+ - `history.db` — SQLite of events, compile times, task runs
160
+ - `logs/<name>.log[.N]` — when `logs.enabled` is true
161
+ - `snapshots/<name>-<ts>.json` — `daimon snapshot` output
162
+ - `notifications.log` — desktop notification audit
163
+ - `crashes/<ts>.txt` — daemon fatal dumps
164
+ - `audit.log` — dashboard config edits
165
+ - `secrets.json` — `${NAME}` substitutions for `overrides.env`
166
+ - `sessions/<ts>.jsonl` — `daimon record` output
167
+
168
+ ## Migrating from v0.3 (when it was `appman`)
169
+
170
+ - Binary renamed: `appman` → `daimon`. `npm start` is no longer the way; use `npm i -g daimon` then `daimon daemon start`.
171
+ - Environment variables: `APPMAN_PORT` → `DAIMON_PORT`, `APPMAN_NO_SPAWN` → `DAIMON_NO_SPAWN`, `APPMAN_TOKEN` → `DAIMON_TOKEN`, `APPMAN_NO_CLAUDE_NUDGE` → `DAIMON_NO_CLAUDE_NUDGE`.
172
+ - Config file: `appman.config.json` → `daimon.config.json` (filename change only; schema is preserved).
173
+ - State directory: `~/.appman/` → `~/.daimon/`. If you had v0.3 state, move it: `mv ~/.appman ~/.daimon`.
174
+ - Claude artifacts: `~/.claude/skills/appman/`, `~/.claude/commands/appman-*.md`, `~/.claude/agents/appman-runner.md` → run `daimon claude install --all` after upgrading to write the new paths. Delete the old appman-named files manually if desired.
175
+
176
+ ## Migrating from v0.2 (`summary.url` semantics)
177
+
178
+ The `summary.url` field returned by the API was synthetic `http://127.0.0.1:<port>` in v0.2. From v0.3 onwards it is the **resolved probe URL** — `overrides.<name>.url` overrides win, then `healthProbe.scheme`/`host`, then the URL the dev server announced (`Local: …`), then a fallback host. Field name unchanged; value is more accurate (HTTPS, IPv6, custom paths all preserved).
179
+
180
+ ## Tests
181
+
182
+ ```bash
183
+ npm test
184
+ ```
185
+
186
+ Four small `node:test` files cover dependency-graph math, bundle parsing, notifier throttling, and compile-time regression. No vitest dependency.
187
+
188
+ ## License
189
+
190
+ **[PolyForm Noncommercial 1.0.0](https://polyformproject.org/licenses/noncommercial/1.0.0)** — see `LICENSE`.
191
+
192
+ - Free for personal, hobby, academic, and other noncommercial use
193
+ - Free for charities, schools, government, and other noncommercial organizations
194
+ - **Not licensed for commercial use** (use by or for a for-profit business)
195
+
196
+ For a commercial license, contact yosi@flycotech.com.