nimi-code 0.0.0-stage → 1.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/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "nimi-code",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Minimal coding agent: a language model with controlled access to your files, shell, and git.",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Harsh16gupta/nimi.git"
10
+ },
11
+ "keywords": [
12
+ "ai",
13
+ "agent",
14
+ "coding-agent",
15
+ "cli",
16
+ "anthropic",
17
+ "openai"
18
+ ],
19
+ "homepage": "https://github.com/Harsh16gupta/nimi#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/Harsh16gupta/nimi/issues"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "engines": {
27
+ "node": ">=22"
28
+ },
29
+ "files": [
30
+ "bin/",
31
+ "dist/",
32
+ "readme.md",
33
+ "LICENSE"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsup",
37
+ "prepublishOnly": "npm run build",
38
+ "check": "biome lint src && npx tsc --noEmit",
39
+ "test:tools": "vitest run test/tools.test.ts",
40
+ "test": "vitest run"
41
+ },
42
+ "type": "module",
43
+ "dependencies": {
44
+ "@anthropic-ai/sdk": "^0.131.0",
45
+ "dotenv": "^18.0.5",
46
+ "ink": "^8.0.0",
47
+ "ink-spinner": "^5.0.0",
48
+ "ink-text-input": "^6.0.0",
49
+ "openai": "^7.25.0",
50
+ "react": "^19.3.1"
51
+ },
52
+ "devDependencies": {
53
+ "@biomejs/biome": "^2.6.6",
54
+ "@types/node": "^26.6.3",
55
+ "@types/react": "^19.3.0",
56
+ "tsup": "^9.0.0",
57
+ "tsx": "^4.23.15",
58
+ "typescript": "^7.0.2",
59
+ "vitest": "^5.1.0"
60
+ },
61
+ "bin": {
62
+ "nimi": "./bin/nimi.js"
63
+ },
64
+ "packageManager": "npm@11.20.0"
65
+ }
package/readme.md ADDED
@@ -0,0 +1,187 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/nimi-logo-dark.png">
4
+ <img alt="Nimi" src="docs/assets/nimi-logo-light.png" width="480">
5
+ </picture>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <strong>A lightweight, open-source terminal coding-agent harness. Every step, inspectable.</strong>
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/nimi-code"><img alt="npm version" src="https://img.shields.io/npm/v/nimi-code?style=flat-square"></a>
14
+ <a href="LICENSE"><img alt="license" src="https://img.shields.io/npm/l/nimi-code?style=flat-square"></a>
15
+ </p>
16
+
17
+ # nimi
18
+
19
+ Nimi points a language model at your codebase and gives it controlled access to your files, shell, and git — read, search, write, edit, run commands — until the job is done. Read-only tools run freely; anything that mutates pauses at an explicit permission gate. Every run is recorded as a JSONL trace you can replay, and a browser playground visualizes a sample run step by step.
20
+
21
+ What Nimi is **not**: not a model, not a subscription, not a hosted platform. You bring your own provider key, run everything on your own machine, and can fork the whole thing (ISC licensed).
22
+
23
+ ## Quickstart
24
+
25
+ Requires **Node 22+** and one provider key.
26
+
27
+ ```bash
28
+ npm install -g nimi-code
29
+ export META_API_KEY=... # or ANTHROPIC_API_KEY, GROQ_API_KEY, DEEPSEEK_API_KEY, OPENAI_API_KEY
30
+ cd /path/to/your/project
31
+ nimi "list the typescript files under src"
32
+ ```
33
+
34
+ That's it — Nimi opens an interactive session in your terminal. Give it a task in plain language.
35
+
36
+ ## Usage
37
+
38
+ | Mode | Command | Behavior |
39
+ |---|---|---|
40
+ | Interactive (default) | `nimi "task"` | Full terminal UI with streaming output |
41
+ | Classic REPL | `nimi --classic "task"` | Plain readline loop, compact result previews |
42
+ | One-shot | `nimi --print "task"` | Runs once, streams to stdout, exits (scriptable) |
43
+ | Pipe | `echo ... \| nimi -p` | Prompt from stdin, no TTY needed |
44
+
45
+ ### Flags
46
+
47
+ ```
48
+ nimi [message] interactive (default)
49
+ nimi --classic [message] plain REPL
50
+ nimi --print [message] one-shot, streams to stdout
51
+ echo ... | nimi -p prompt from pipe
52
+
53
+ -p, --prompt <text> prompt to send
54
+ -z, --provider <id> anthropic, anthropic-openai, groq, meta (default), deepseek, openai
55
+ --model <id> override the provider's default model
56
+ --session <id> resume a session (--list-sessions to list)
57
+ --context-limit <n> override context window
58
+ --trace <path> write a JSONL showcase trace (print mode)
59
+ --classic --print --yolo
60
+ -v, --version -h, --help
61
+ ```
62
+
63
+ ### Slash commands (interactive mode)
64
+
65
+ `/model` `/tools` `/sessions` `/session` `/compact` `/context` `/clear` `/help` `/quit` — bare `clear`, `quit`, `exit`, and `q` work too.
66
+
67
+ Examples:
68
+
69
+ ```bash
70
+ nimi -p "explain this codebase" --provider deepseek
71
+ nimi "find all TODOs and write them to NOTES.md"
72
+ nimi --session abc123 "continue where we left off"
73
+ nimi --list-sessions
74
+ ```
75
+
76
+ ## Tools & permissions
77
+
78
+ Read-only tools run without asking. Mutating tools pause at a gate: `[y]es` / `[a]lways` / `[n]o` — `always` is remembered per tool for the session. Piped/non-TTY runs auto-allow (pass `--yolo` explicitly to skip prompts in a terminal).
79
+
80
+ | Runs freely (read-only) | Asks first (mutating) |
81
+ |---|---|
82
+ | `read`, `ls`, `find`, `grep` | `write`, `edit`, `bash` |
83
+ | `git_status`, `git_log`, `git_diff` | `git_add`, `git_commit`, `git_branch`, `git_checkout`, `git_reset` |
84
+
85
+ Denying a tool doesn't crash the run — the model gets an error result (`User denied <name>…`) and decides what to do next.
86
+
87
+ ## Providers
88
+
89
+ Nimi is provider-agnostic over OpenAI-compatible APIs. The default provider is `meta`.
90
+
91
+ | Provider (`-z`) | Key | Default model |
92
+ |---|---|---|
93
+ | `anthropic` | `ANTHROPIC_API_KEY` | `claude-sonnet-5` |
94
+ | `anthropic-openai` | `ANTHROPIC_API_KEY` | `claude-sonnet-5` (OpenAI-compatible endpoint) |
95
+ | `groq` | `GROQ_API_KEY` | `qwen/qwen3.8-27b` |
96
+ | `meta` (default) | `META_API_KEY` | `muse-spark-1.3-contributor` |
97
+ | `deepseek` | `DEEPSEEK_API_KEY` | `deepseek-flash` |
98
+ | `openai` | `OPENAI_API_KEY` | `gpt-4o-mini` |
99
+
100
+ Override the model per run with `--model <id>`, per environment with `NIMI_MODEL`, or switch mid-session with `/model`.
101
+
102
+ ## Config, sessions, context
103
+
104
+ Settings cascade (each level wins over the previous):
105
+
106
+ `~/.nimi/settings.json` → `.nimi/settings.json` (project) → `NIMI_PROVIDER` / `NIMI_MODEL` → CLI flags
107
+
108
+ Sessions persist per project in `.nimi/sessions/` — resume with `--session <id>`, list with `--list-sessions`. On startup Nimi also loads project context from `AGENTS.md`, `CLAUDE.md`, `.context`, and `.nimi/context.md` when present.
109
+
110
+ ## Traces
111
+
112
+ Every run can be recorded as JSONL — one line per event and message snapshot — and resumed or inspected later:
113
+
114
+ ```bash
115
+ nimi --print -p "find all TODOs" --trace demo/samples/showcase.jsonl
116
+ ```
117
+
118
+ The trace is the same artifact the web playground replays below: events fold into turns, tool calls, permission decisions, and terminal output.
119
+
120
+ ## Web playground (local)
121
+
122
+ `demo/` is a static Vite + React app that replays the bundled sample trace — a trace viewer and explainer, not a live agent. No API key needed.
123
+
124
+ ```bash
125
+ cd demo
126
+ npm install
127
+ npm run dev # → http://localhost:5173
128
+ ```
129
+
130
+ - **Home** explains the harness; **Playground** (`#/playground`) is the workbench: Dataflow/Streaming graph, step inspector (Overview, Events, Context, Source, plus raw payload/stdout), timeline scrubber, keyboard shortcuts (`space` play, `←/→` step), and URL-addressable playback state.
131
+ - The **sample selector** replays four lenses over the same trace (full run, denied-permission branch, Classic view, TUI view). **Allow/Deny only switches the replay branch** — it controls no live machine.
132
+ - Production build: `npm run build` → `demo/dist/` (gitignored), deployable to any static host.
133
+
134
+ ## Architecture
135
+
136
+ ```
137
+ prompt → parseArgs → settings → system prompt + tool catalog → runAgent()
138
+ → provider.stream() → assistant reply → permission gate → tool.execute()
139
+ → tool result → … → session file (.nimi/sessions/<id>.jsonl) + optional --trace JSONL
140
+ ```
141
+
142
+ <picture>
143
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/architecture-dark.svg">
144
+ <img alt="Nimi architecture map: shell and entry, config, session, agent loop, provider, tools, permissions, renderer" src="docs/assets/architecture-light.svg">
145
+ </picture>
146
+
147
+ Generated from the same graph data as the playground (`demo/src/data/architecture.js`). Regenerate with `node scripts/export-architecture-svg.mjs`.
148
+
149
+ ### Repo layout
150
+
151
+ | Path | Contents |
152
+ |---|---|
153
+ | `bin/` | `nimi` executable entry |
154
+ | `src/main.tsx` | CLI entry, mode router, trace wiring |
155
+ | `src/agent.ts` | Agent loop (`runAgent`) |
156
+ | `src/cli/` | Flag parser |
157
+ | `src/config/` | Settings cascade, system prompt |
158
+ | `src/providers/` | Anthropic + OpenAI-compatible providers, default models |
159
+ | `src/tools/` | Read/write/shell/git tool implementations |
160
+ | `src/permissions.ts` | `y/a/n` permission gate |
161
+ | `src/session/` | JSONL session store |
162
+ | `src/trace/` | JSONL trace recorder |
163
+ | `src/modes/` `src/tui/` | Classic REPL and Ink terminal UI |
164
+ | `demo/` | Static web playground (sample trace replay) |
165
+ | `test/` | Offline tool tests |
166
+ | `docs/assets/` | README logo and architecture diagram |
167
+
168
+ ## Development
169
+
170
+ ```bash
171
+ npm install
172
+ cp .env.example .env # add one provider key
173
+ npm run build # build with tsup
174
+ node bin/nimi.js "hello"
175
+
176
+ npm run check # biome lint + tsc typecheck
177
+ npm test # offline tool tests (vitest)
178
+ npm run test:tools
179
+ ```
180
+
181
+ ## Contributing
182
+
183
+ Issues and pull requests are welcome. Run `npm run check` and `npm test` before submitting. See `AGENTS.md` for repo conventions (Astryx workflow for `demo/`, tokens, required checks).
184
+
185
+ ## License
186
+
187
+ [ISC](LICENSE) — do what you want, keep the copyright notice.
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.