@nomai/nomai 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nomai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # nomai
2
+
3
+ Installer CLI for **Nomai** — skills, commands, and hooks for AI coding
4
+ harnesses (Claude Code first; Codex, Cursor, Gemini CLI, ... later).
5
+
6
+ ```
7
+ npx @nomai/nomai install
8
+ ```
9
+
10
+ An interactive wizard (built on [@clack/prompts](https://github.com/bombshell-dev/clack))
11
+ detects which harnesses you use, asks whether to install per-project or
12
+ globally, then downloads the Nomai payload from this repo and installs it.
13
+
14
+ ## Commands
15
+
16
+ | Command | What it does |
17
+ | --- | --- |
18
+ | `npx @nomai/nomai install` | Wizard: pick harnesses + scope, then install |
19
+ | `npx @nomai/nomai update` | Re-apply the latest payload to existing installs (never prompts) |
20
+ | `npx @nomai/nomai status [--json]` | Show detection/install/drift state per harness × scope (never prompts) |
21
+ | `npx @nomai/nomai uninstall` | Remove exactly the files Nomai installed |
22
+
23
+ Useful flags (all commands): `--harness <id>` (repeatable), `--scope project|global`,
24
+ `--dir <path>`. Install/update also take `--source <path|owner/repo#ref>` (payload
25
+ override), `--dry-run`, `--force`, and `-y/--yes` for CI. Non-interactive sessions
26
+ (pipes, CI, AI agents) exit with code 2 unless `--yes` is passed — the CLI never
27
+ hangs on a prompt.
28
+
29
+ ## How it works
30
+
31
+ - The npm package is a single bundled `dist/cli.js` with **zero runtime
32
+ dependencies** (`@clack/prompts`, `commander`, and `@vercel/detect-agent` are
33
+ inlined at build time).
34
+ - The installable payload lives in [`payload/`](payload/README.md) in this repo
35
+ and is downloaded at install time as a GitHub tarball — pushing to `main`
36
+ ships payload updates without an npm release.
37
+ - Every install writes a `nomai-manifest.json` receipt (file list + sha256)
38
+ into the harness config dir. That receipt makes installs idempotent, updates
39
+ orphan-safe, and uninstalls surgical: Nomai only ever deletes files it wrote,
40
+ keeps files you modified (unless `--force`), and never removes the harness
41
+ dir itself.
42
+
43
+ ## Development
44
+
45
+ ```
46
+ npm install
47
+ npm run dev -- install --dry-run --source . # run the CLI from source
48
+ npm test # vitest
49
+ npm run typecheck # tsc --noEmit
50
+ npm run build # tsdown → dist/
51
+ ```
52
+
53
+ `--source .` points the installer at your local checkout instead of GitHub.
54
+ Without it, the payload comes from
55
+ [A-MCode/nomai-installer](https://github.com/A-MCode/nomai-installer) at `main`
56
+ (`DEFAULT_SOURCE` in `src/core/payload.ts`).
57
+
58
+ ## Adding a harness
59
+
60
+ 1. Create `src/harnesses/<id>.ts`:
61
+
62
+ ```ts
63
+ import { defineHarness } from "./define.js";
64
+
65
+ export const codex = defineHarness({
66
+ id: "codex",
67
+ displayName: "Codex CLI",
68
+ configDirName: ".agents",
69
+ });
70
+ ```
71
+
72
+ 2. Register it in `src/harnesses/index.ts` (one line).
73
+ 3. Optionally add `payload/<id>/` for harness-specific files.
74
+
75
+ Defaults cover detection (config dir exists at project/global scope), install
76
+ location, and file copying. Override `transformPayload` for per-harness
77
+ compilation, or `install`/`uninstall`/`status` wholesale for harnesses that
78
+ need custom mechanics (e.g. merging hooks into a `settings.json`).
79
+
80
+ ## Architecture
81
+
82
+ ```
83
+ src/
84
+ ├── cli.ts # bin entry: commander program (install/update/status/uninstall)
85
+ ├── index.ts # public API for programmatic use
86
+ ├── commands/ # one file per subcommand + shared flag/context helpers
87
+ ├── wizard/ # the @clack/prompts install wizard (flag-bypassable)
88
+ ├── core/
89
+ │ ├── types.ts # HarnessAdapter contract + all shared types
90
+ │ ├── registry.ts # harness lookup
91
+ │ ├── detect.ts # which harnesses does this user have?
92
+ │ ├── payload.ts # payload sources: GitHub tarball / local path
93
+ │ ├── installer.ts # generic engine — the only module that writes to disk
94
+ │ └── manifest.ts # install receipts (idempotency, updates, clean uninstall)
95
+ ├── harnesses/ # defineHarness() factory + one adapter per harness
96
+ └── test-utils/ # temp-dir fixtures for tests
97
+ payload/ # the installable content (fetched from GitHub, not npm)
98
+ ```