@zhijiewang/openharness 2.16.0 → 2.18.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/README.md +52 -24
- package/README.zh-CN.md +785 -0
- package/dist/commands/hooks-report.d.ts +7 -0
- package/dist/commands/hooks-report.js +29 -0
- package/dist/commands/info.d.ts +1 -1
- package/dist/commands/info.js +7 -1
- package/dist/harness/config.d.ts +21 -1
- package/dist/harness/config.js +57 -35
- package/dist/harness/hooks.d.ts +2 -1
- package/dist/harness/hooks.js +1 -1
- package/dist/harness/language.d.ts +8 -0
- package/dist/harness/language.js +13 -0
- package/dist/main.js +107 -10
- package/dist/mcp/loader.d.ts +7 -0
- package/dist/mcp/loader.js +18 -0
- package/dist/outputStyles/index.d.ts +30 -0
- package/dist/outputStyles/index.js +89 -0
- package/dist/tools/ListMcpResourcesTool/index.d.ts +23 -0
- package/dist/tools/ListMcpResourcesTool/index.js +53 -0
- package/dist/tools/MemoryTool/index.d.ts +2 -2
- package/dist/tools/ReadMcpResourceTool/index.d.ts +20 -0
- package/dist/tools/ReadMcpResourceTool/index.js +51 -0
- package/dist/tools.js +4 -0
- package/dist/utils/json-schema.d.ts +24 -0
- package/dist/utils/json-schema.js +110 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,8 @@ AI coding agent in your terminal. Works with any LLM -- free local models or clo
|
|
|
23
23
|
|
|
24
24
|
[](https://www.npmjs.com/package/@zhijiewang/openharness) [](https://www.npmjs.com/package/@zhijiewang/openharness) [](LICENSE)     [](https://github.com/zhijiewong/openharness) [](https://github.com/zhijiewong/openharness/issues) [](https://github.com/zhijiewong/openharness/pulls)
|
|
25
25
|
|
|
26
|
+
**English** | [简体中文](README.zh-CN.md)
|
|
27
|
+
|
|
26
28
|
---
|
|
27
29
|
|
|
28
30
|
## Table of Contents
|
|
@@ -30,7 +32,7 @@ AI coding agent in your terminal. Works with any LLM -- free local models or clo
|
|
|
30
32
|
- [Quick Start](#quick-start)
|
|
31
33
|
- [Why OpenHarness?](#why-openharness)
|
|
32
34
|
- [Terminal UI](#terminal-ui)
|
|
33
|
-
- [Tools (
|
|
35
|
+
- [Tools (37)](#tools-37)
|
|
34
36
|
- [Slash Commands (33)](#slash-commands-33)
|
|
35
37
|
- [Permission Modes](#permission-modes)
|
|
36
38
|
- [Hooks](#hooks)
|
|
@@ -57,7 +59,7 @@ oh
|
|
|
57
59
|
|
|
58
60
|
That's it. OpenHarness auto-detects Ollama and starts chatting. No API key needed.
|
|
59
61
|
|
|
60
|
-
**Python SDK:** there's also an official Python SDK for driving `oh` from Python programs (notebooks, batch scripts, ML pipelines). Install with `pip install openharness` after the npm install, then `from openharness import query`. See [`python/README.md`](python/README.md).
|
|
62
|
+
**Python SDK:** there's also an official Python SDK for driving `oh` from Python programs (notebooks, batch scripts, ML pipelines). Install with `pip install openharness-sdk` after the npm install (the PyPI distribution is `openharness-sdk` because the unqualified name is taken), then `from openharness import query`. See [`python/README.md`](python/README.md).
|
|
61
63
|
|
|
62
64
|
```bash
|
|
63
65
|
oh init # interactive setup wizard (provider + cybergotchi)
|
|
@@ -82,26 +84,6 @@ Ctrl+O # flush transcript to scrollback for revie
|
|
|
82
84
|
|
|
83
85
|
Most AI coding agents are locked to one provider or cost $20+/month. OpenHarness works with any LLM -- run it free with Ollama on your own machine, or connect to any cloud API. Every AI edit is git-committed and reversible with `/undo`.
|
|
84
86
|
|
|
85
|
-
| | OpenHarness | Claude Code | Aider | OpenCode |
|
|
86
|
-
|---|---|---|---|---|
|
|
87
|
-
| Any LLM | Yes (Ollama, OpenAI, Anthropic, OpenRouter, any OpenAI-compatible) | Anthropic only | Yes | Yes |
|
|
88
|
-
| Free local models | Ollama native | No | Yes | Yes |
|
|
89
|
-
| Tools | 41 with permission gates | 43+ | File-focused | 20+ |
|
|
90
|
-
| Permission modes | 7 (ask, trust, deny, acceptEdits, plan, auto, bypass) | 7 | Basic | Basic |
|
|
91
|
-
| Git integration | Auto-commit + /undo + /rewind checkpoints | Yes | Deep git | Basic |
|
|
92
|
-
| Slash commands | 42+ built-in | 80+ | Some | Some |
|
|
93
|
-
| Headless/CI mode | `oh -p "prompt"` or `oh run --json` | Yes | Yes | Yes |
|
|
94
|
-
| GitHub Action | Built-in PR review action | Yes | No | No |
|
|
95
|
-
| Agent roles | 6 specializations (reviewer, tester, debugger...) | Yes | No | No |
|
|
96
|
-
| Vim mode | hjkl, w/b/e, 0/$, x, d, i/a/I/A/o | Full vim | No | No |
|
|
97
|
-
| Prompt caching | Anthropic cache_control | Yes | No | No |
|
|
98
|
-
| Bash security | AST-based command analysis | AST analysis | No | No |
|
|
99
|
-
| Companion | Cybergotchi virtual pet | Basic | No | No |
|
|
100
|
-
| Terminal UI | Sequential renderer (Ink pattern) | React + Ink | Basic | BubbleTea |
|
|
101
|
-
| Language | TypeScript | TypeScript | Python | Go |
|
|
102
|
-
| License | MIT | Proprietary | Apache 2.0 | MIT |
|
|
103
|
-
| Price | Free (BYOK) | $20+/month | Free (BYOK) | Free (BYOK) |
|
|
104
|
-
|
|
105
87
|
## Terminal UI
|
|
106
88
|
|
|
107
89
|
OpenHarness features a sequential terminal renderer inspired by Ink/Claude Code's default mode. Completed messages flush to native scrollback (scrollable), while the live area (streaming, spinner, input) rewrites in-place using relative cursor movement.
|
|
@@ -160,7 +142,7 @@ statusLineFormat: '{model} │ {tokens} │ {cost} │ {ctx}'
|
|
|
160
142
|
|
|
161
143
|
Available variables: `{model}`, `{tokens}` (input↑ output↓), `{cost}` ($X.XXXX), `{ctx}` (context usage bar). Empty sections are automatically collapsed.
|
|
162
144
|
|
|
163
|
-
## Tools (
|
|
145
|
+
## Tools (37)
|
|
164
146
|
|
|
165
147
|
| Tool | Risk | Description |
|
|
166
148
|
|------|------|-------------|
|
|
@@ -204,6 +186,9 @@ Available variables: `{model}`, `{tokens}` (input↑ output↓), `{cost}` ($X.XX
|
|
|
204
186
|
| Memory | low | Save/list/search persistent memories |
|
|
205
187
|
| Skill | low | Invoke a skill from .oh/skills/ |
|
|
206
188
|
| ToolSearch | low | Find tools by description |
|
|
189
|
+
| **MCP** | | |
|
|
190
|
+
| ListMcpResources | low | List resources from connected MCP servers |
|
|
191
|
+
| ReadMcpResource | low | Read a specific MCP resource by URI |
|
|
207
192
|
| **Git Worktrees** | | |
|
|
208
193
|
| EnterWorktree | medium | Create isolated git worktree |
|
|
209
194
|
| ExitWorktree | medium | Remove a git worktree |
|
|
@@ -245,6 +230,8 @@ Type these during a chat session. Aliases: `/q` exit, `/h` help, `/c` commit, `/
|
|
|
245
230
|
| `/files` | List files in context |
|
|
246
231
|
| `/model <name>` | Switch model mid-session |
|
|
247
232
|
| `/memory` | View and search memories |
|
|
233
|
+
| `/doctor` | Run diagnostic health checks |
|
|
234
|
+
| `/hooks` | List loaded hooks grouped by event |
|
|
248
235
|
|
|
249
236
|
**Settings:**
|
|
250
237
|
| Command | Description |
|
|
@@ -517,6 +504,24 @@ cat error.log | oh run "what's wrong here?"
|
|
|
517
504
|
git diff | oh run "review these changes"
|
|
518
505
|
```
|
|
519
506
|
|
|
507
|
+
### Structured output with `--json-schema`
|
|
508
|
+
|
|
509
|
+
Constrain the model's output to a JSON Schema. Useful for CI scripts that
|
|
510
|
+
parse model output programmatically without regex heuristics:
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
oh -p "output {\"ok\": true, \"count\": 3} as JSON" \
|
|
514
|
+
--trust \
|
|
515
|
+
--json-schema '{"type":"object","properties":{"ok":{"type":"boolean"},"count":{"type":"integer"}},"required":["ok","count"]}'
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
Behavior:
|
|
519
|
+
- stdout: the validated JSON (single line), only when it passes the schema.
|
|
520
|
+
- stderr: structured errors on failure, plus the raw model output for debugging.
|
|
521
|
+
- Exit codes: **0** valid, **2** malformed schema, **3** model output was not JSON, **4** JSON didn't match the schema.
|
|
522
|
+
|
|
523
|
+
Supported keywords: `type`, `properties`, `required`, `items`, `enum`. For richer validation, pipe the output through a dedicated validator.
|
|
524
|
+
|
|
520
525
|
### GitHub Action for PR Review
|
|
521
526
|
|
|
522
527
|
OpenHarness includes a built-in GitHub Action for automated code review:
|
|
@@ -608,6 +613,8 @@ provider: ollama
|
|
|
608
613
|
model: llama3
|
|
609
614
|
permissionMode: ask
|
|
610
615
|
theme: dark
|
|
616
|
+
language: zh-CN # optional — respond in this language (code stays as-is)
|
|
617
|
+
outputStyle: default # optional — "default", "explanatory", "learning", or a custom name
|
|
611
618
|
```
|
|
612
619
|
|
|
613
620
|
Then per-project configs only need what's different:
|
|
@@ -617,6 +624,27 @@ Then per-project configs only need what's different:
|
|
|
617
624
|
model: codellama # override just the model
|
|
618
625
|
```
|
|
619
626
|
|
|
627
|
+
### Output Styles
|
|
628
|
+
|
|
629
|
+
Swap the agent's personality without touching its core instructions. Built-ins:
|
|
630
|
+
|
|
631
|
+
- **`default`** — standard software engineering assistant (no preface)
|
|
632
|
+
- **`explanatory`** — adds an `## Insights` section after each task explaining *why* the agent made its choices
|
|
633
|
+
- **`learning`** — leaves 1–3 `TODO(human)` markers at strategic points so you write the instructive parts yourself
|
|
634
|
+
|
|
635
|
+
Create your own styles as markdown files with YAML frontmatter. Save to `.oh/output-styles/<name>.md` (project) or `~/.oh/output-styles/<name>.md` (user). Project shadows user shadows built-in.
|
|
636
|
+
|
|
637
|
+
````markdown
|
|
638
|
+
---
|
|
639
|
+
name: code-review
|
|
640
|
+
description: Focused code review mode
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
Review rigorously. For every function, ask: is the logic correct, is error handling complete, are there edge cases ignored?
|
|
644
|
+
````
|
|
645
|
+
|
|
646
|
+
Activate with `outputStyle: code-review` in `.oh/config.yaml`.
|
|
647
|
+
|
|
620
648
|
## Project Rules
|
|
621
649
|
|
|
622
650
|
Create `.oh/RULES.md` in any repo (or run `oh init`):
|
|
@@ -706,7 +734,7 @@ Yes. Use `oh -p "prompt" --auto` for headless execution, or the built-in GitHub
|
|
|
706
734
|
Yes. OpenHarness is language-agnostic — it reads, writes, and executes code in any language. Syntax highlighting covers 20+ languages.
|
|
707
735
|
|
|
708
736
|
**How does it compare to Claude Code?**
|
|
709
|
-
~95% feature parity for CLI use cases. Main advantage: works with ANY LLM (not just Anthropic). See
|
|
737
|
+
~95% feature parity for CLI use cases. Main advantage: works with ANY LLM (not just Anthropic) and is MIT-licensed. See [Why OpenHarness?](#why-openharness) above.
|
|
710
738
|
|
|
711
739
|
## Install
|
|
712
740
|
|