@aihq/harness 0.2.0-rc.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 +201 -0
- package/README.md +302 -0
- package/dist/chunk-S7XFTZJW.js +25876 -0
- package/dist/chunk-S7XFTZJW.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +706 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# aih — Enterprise AI Bootstrapping Harness
|
|
2
|
+
|
|
3
|
+
[](https://github.com/samartomar/ai-harness/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/samartomar/ai-harness/actions/workflows/codeql.yml)
|
|
5
|
+
[](https://scorecard.dev/viewer/?uri=github.com/samartomar/ai-harness)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](package.json)
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="docs/assets/aih-overview.svg" alt="aih — extract corporate trust, self-heal the runtime, tune the workstation, bootstrap a governed repo, and run AI coding safely behind any proxy" width="100%">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
A cross-platform CLI that prepares developer workstations and repositories for
|
|
14
|
+
**safe, governed AI-assisted coding behind a corporate proxy**. It extracts
|
|
15
|
+
corporate trust, tunes local inference, hardens repos with guardrails, wires up
|
|
16
|
+
MCP / observability / sandboxing, and lays down a tool-agnostic context
|
|
17
|
+
architecture — all from one command surface.
|
|
18
|
+
|
|
19
|
+
> Turns the architectural blueprint *"Enterprise DevSecOps AI Bootstrapping:
|
|
20
|
+
> Cryptographic Trust, Local Performance Optimization, and Unified Observability"*
|
|
21
|
+
> into a real, tested product.
|
|
22
|
+
|
|
23
|
+
## Design posture
|
|
24
|
+
|
|
25
|
+
- **Dry-run by default.** `aih <cmd>` computes and prints a plan; nothing is
|
|
26
|
+
written until you add `--apply`. Add `--verify` to run read-only checks.
|
|
27
|
+
- **Never mutates a remote system.** Every unit of work is a local `write`, a
|
|
28
|
+
local `exec` (icacls/chmod/junction…), a read-only `probe`, or a `doc` (the
|
|
29
|
+
exact commands for cloud setup — SSO, gateways, Langfuse, MDM — emitted for a
|
|
30
|
+
human, never executed). There is no code path that provisions cloud infra, so
|
|
31
|
+
an automated run cannot "fake" it.
|
|
32
|
+
- **Idempotent & non-destructive.** Shell-profile edits live in marked managed
|
|
33
|
+
blocks; JSON configs are deep-merged (your keys survive); every overwrite is
|
|
34
|
+
backed up to `*.aih.bak` and rolls back as a transaction on failure.
|
|
35
|
+
- **Cross-platform.** Windows and Linux are verified on real metal (Windows:
|
|
36
|
+
PowerShell/icacls/junctions; Linux: real `/proc`, `/etc/ssl/certs`, `chmod`,
|
|
37
|
+
`ln -sfn`, smoke-tested in a Hyper-V Ubuntu VM). macOS is implemented and
|
|
38
|
+
fixture-tested. All OS calls go through an injectable runner.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install # deps
|
|
44
|
+
npm run build # → dist/cli.js (bin: aih)
|
|
45
|
+
node dist/cli.js --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Command surface
|
|
49
|
+
|
|
50
|
+
| Command | What it does |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `aih certs` | Extract the corporate root CA from the OS trust store, lock it down, and propagate trust to npm/pip/cargo/conda. |
|
|
53
|
+
| `aih heal` | Diagnose **and repair** the broken runtime `certs` assumes works — corporate TLS trust, npm, PATH, and MCP pre-flight — generically for any TLS-intercepting proxy (`--ca-pattern`/`AIH_CA_PATTERN`, never hardcoded). Diagnoses by default (exits non-zero when broken) and repairs under `--apply`; the npm self-heal is emitted as an operator-run script (never executed) and the only mutation is a local Windows registry write to persist the CA for GUI-launched apps (Claude/Kiro), so the harness never contacts a remote. `--scope certs,npm,path,mcp,all`. |
|
|
54
|
+
| `aih hardware` | Profile CPU/RAM/GPU; compute memory/thread/parallel limits + quantization; emit tuned Ollama/llama.cpp settings. |
|
|
55
|
+
| `aih vdi` | Detect VDI (Citrix/WorkSpaces/RES/RDP) and redirect caches + SQLite to local scratch (junction on Windows). |
|
|
56
|
+
| `aih profile` | Recursively detect the repo's stack and synthesize Cursor stack rules (`.cursor/rules/*.mdc`). Root bootloaders are owned by `bootstrap-ai`. |
|
|
57
|
+
| `aih ecc` | Install [affaan-m/ECC](https://github.com/affaan-m/ECC) (skills, instincts, memory, security, research-first) for the selected CLIs, scoped to the detected stack: Claude plugin path, `ecc-install` for codex/cursor/zed/opencode, `consult` advisor otherwise. |
|
|
58
|
+
| `aih superpowers` | Install [obra/Superpowers](https://github.com/obra/Superpowers) (brainstorm → plan → TDD → subagent-review skills) for the selected CLIs. |
|
|
59
|
+
| `aih scaffold` | Create the canonical context dir (`--context-dir`, default `ai-coding`) — INDEX/SKILL skeleton, an agent **`SETUP-TASKS.md`** playbook (fill context + guardrails from the code), a write-once `project-guardrails.md`, a secret deny-list, and a pre-commit hook. (Bootloaders are `bootstrap-ai`'s job.) |
|
|
60
|
+
| `aih guardrails` | Generate `.gitleaks.toml`, `.pre-commit-config.yaml`, and a CI license gate that blocks AGPL/strong-copyleft. |
|
|
61
|
+
| `aih secrets` | Scan for plaintext `.env*`/`secrets/` and write agent deny rules + vault-injection guidance. `--verify` is the **secret-scan CI gate** (exit 1 when plaintext secrets exist); `--sarif <file>` emits one error-level result per path for GitHub code-scanning. |
|
|
62
|
+
| `aih mcp` | Generate the MCP server config **for the targeted CLIs** (`--cli`/`--all-tools`, default claude): Claude/Cursor/Kiro/Kimi get their correct project file written (`.mcp.json`, `.cursor/mcp.json`, …); Codex (TOML), Copilot, OpenCode, Zed, and global-config tools get exact per-tool guidance instead of a file aih would get wrong. Scopes: local/project/remote. For locked-down orgs, `--mode offline` (vendored local-command servers) or `--mode none` (no MCP + a CLI-tool fallback) plus a `managed-mcp.json` admin template. |
|
|
63
|
+
| `aih sandbox` | Generate a devcontainer + managed sandbox settings (egress allowlist, `failIfUnavailable`). |
|
|
64
|
+
| `aih telemetry` | Inject OpenTelemetry env, a redacting Bindplane collector, and an analytics fetcher (usage + skills endpoints → `{ usage_report, skills }`). |
|
|
65
|
+
| `aih report` | Read-only analytics digest. Local: a dev console — agent **context footprint** (token bloat) plus a **per-turn load-group** panel (the heaviest single tool's always-loaded bootloaders — what one tool actually pays per turn, not the union sum; `--gate --token-budget <n>` exits non-zero in CI when it's exceeded). The footprint is **gitignore-honoring** (counts only tracked/untracked-not-ignored source, never generated per-CLI copies — `--all-files` to override; `--since <ref>` narrows to files changed in a PR), **repo & branch status** (current branch, ahead/behind vs main, dirty; `--team` adds in-progress team branches via a `gh` → `git ls-remote` → last-fetched ladder that degrades gracefully when gh/network is blocked), repo config presence, local AI-CLI tooling saturation, and **trends** (unicode sparklines of commits/LOC/adoption/branches over recorded history — see `aih track`). Org (`--org <export.json>`): top skills, tokens by type, **cache savings** (net-of-write estimate), and accept/reject from a saved Admin-API export. Body prints verbatim; `--json` carries structured data; `--format md\|html` writes a static artifact under `--apply`. **`--v9`** opts into the developer-console HTML dashboard with LIVE / PREVIEW / EMPTY panel honesty, machine-relative ECC inventory, usage-by-CLI, heavy lifters, dormant ECC skills, MCP parity, remediation wins, and no-cost local usage analytics; legacy and `--v4` remain opt-in/unchanged. **`--open`** builds the self-contained HTML dashboard and launches it in your browser (implies html + apply); **`--refresh <sec>`** keeps it live — opens once, then regenerates every `<sec>`s while the page auto-reloads (Ctrl+C to stop). Dark by default with a light toggle; fonts are embedded so it works fully offline. Network-free by default; `--team` is the lone opt-in network call. |
|
|
66
|
+
| `aih track` | Record one metrics sample (commits 7d, LOC delta, adoption score, branch count, tracked files) to `.aih/history.jsonl` — the time-series behind `aih report` trends. Read-only git/filesystem; dry-run previews, `--apply` appends (idempotent per commit). Wire into a commit / agent-stop hook so history accumulates — e.g. Kiro's `metrics-on-stop` hook (`aih bootstrap-ai --cli kiro`) runs `aih track --apply` automatically. |
|
|
67
|
+
| `aih usage` | Install the **multi-tool usage-capture** layer → `.aih/usage.jsonl` (rendered by `aih report` and `aih report --v9`). The **universal floor** is a git `post-commit` hook that records commit activity for **any** tool (it keys off the commit, not the agent). The per-tool **skill/MCP** layer wires in via each CLI's verified local hook (Claude/Codex/Cursor/Gemini/Kiro/…); skills aggregate by source (ECC/canon/user), and `--rollup <repo,repo>` aggregates local logs across repos on demand. Usage is local activity counts only — **no cost, no prompts, no arguments**, machine-local and gitignored. |
|
|
68
|
+
| `aih crispy` | Run the CRISPY context-engineering stage machine (deterministic, gate-ordered). |
|
|
69
|
+
| `aih bootstrap` | Orchestrate the workstation 4-phase rollout (certs → hardware/vdi → telemetry). |
|
|
70
|
+
| `aih bootstrap-ai` | Emit + verify the repo's Layer-2 `ai-coding/` canon: `RULE_ROUTER.md`, per-CLI adapters, and root bootloaders (tool preamble + a regenerated shared block). `--verify` is the drift gate **and a weak-model-safety lint of the generated canon** — every `#[[file:…]]`/backtick reference must resolve and no leftover `<insert>`/`TODO` scaffolding ships (a dangling reference fails the gate; soft-imperative/taste-word prose is advisory). |
|
|
71
|
+
| `aih init` | Initialize a repo: profile + superpowers + bootstrap-ai + scaffold + secrets + guardrails + mcp + sandbox in one pass (one writer per file). ECC is a separate gated network step — run `aih ecc` when ready (it points at ECC's own installer). |
|
|
72
|
+
| `aih workspace` | Scaffold a **multi-repo** workspace (parent-only): cross-repo architecture map (write-once) + per-repo discipline, a VS Code `.code-workspace`, combined graph/filesystem MCP spanning every child repo, and a `.aih-workspace.json` marker. |
|
|
73
|
+
| `aih doctor` | Fail-closed verification of the workstation/repo configuration (+ workspace mode: validates each child repo). Includes a **canon markdown lint** (read-only) over the scaffolded `ai-coding/` tree. |
|
|
74
|
+
| `aih status` | Read-only inventory of what the harness has configured. |
|
|
75
|
+
|
|
76
|
+
Global flags: `--apply`, `--verify`, `--json`, `--support-out <dir>`, `--no-log`, `--context-dir <dir>`, `--root <dir>`, `--cli <list>`, `--all-tools`.
|
|
77
|
+
Settings also read from `AIH_*` env vars (`AIH_APPLY`, `AIH_CONTEXT_DIR`, `AIH_LOG`, …).
|
|
78
|
+
|
|
79
|
+
### Dashboard
|
|
80
|
+
|
|
81
|
+
`aih report --open` builds a **self-contained, offline** HTML dashboard (dark by default with a
|
|
82
|
+
light toggle; fonts embedded) — context footprint + a KPI strip, an adoption ring, output-velocity
|
|
83
|
+
and code-quality panels, and trend sparklines from recorded history (`aih track`). Add `--v9` for
|
|
84
|
+
the newer developer-console dashboard: every panel is explicitly LIVE, PREVIEW, or EMPTY, so demo
|
|
85
|
+
data never reads as real. When the report derives findings (see [Support tickets](#support-tickets)),
|
|
86
|
+
a **Suggested actions** section leads with copy-to-clipboard tickets. Add `--demo` for showcase data,
|
|
87
|
+
or `--refresh <sec>` to keep it live.
|
|
88
|
+
|
|
89
|
+

|
|
90
|
+
|
|
91
|
+
### Targeting CLIs
|
|
92
|
+
|
|
93
|
+
`aih ecc`, `aih superpowers`, and `aih bootstrap-ai` only touch the agent CLIs you actually use.
|
|
94
|
+
Pass `--cli` with a comma-separated list, `--all-tools` for every supported CLI, or `--detect` to
|
|
95
|
+
auto-target the CLIs found on this machine; the default is `claude`. Supported:
|
|
96
|
+
`claude, codex, cursor, antigravity, gemini, copilot, windsurf, opencode, zed, kimi, kiro`.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
aih bootstrap-ai --cli claude # writes CLAUDE.md (the default target, auto-loaded)
|
|
100
|
+
aih ecc --cli claude,codex # ECC for Claude (plugin) + Codex (ecc-install)
|
|
101
|
+
aih superpowers --cli antigravity # agy plugin install … (runs under --apply)
|
|
102
|
+
aih bootstrap-ai --cli kiro # Kiro: .kiro/steering/00-canon.md (inclusion: always)
|
|
103
|
+
aih bootstrap-ai --detect # target only the CLIs installed here
|
|
104
|
+
aih init . --all-tools # bootstrap a repo for every CLI at once
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Each CLI gets its native entry: **Claude → `CLAUDE.md`** (the default target, auto-loaded),
|
|
108
|
+
Codex/OpenCode/Zed/Kimi/Antigravity → `AGENTS.md`, Gemini → `GEMINI.md`, Cursor →
|
|
109
|
+
`.cursor/rules/*.mdc`, Windsurf → `.windsurfrules`, Copilot → `.github/copilot-instructions.md`,
|
|
110
|
+
Kiro → `.kiro/steering/00-canon.md` (`inclusion: always`, with a `#[[file:…/RULE_ROUTER.md]]`
|
|
111
|
+
live-reference). For a tool aih doesn't target yet, `<context-dir>/adapters/other-tools.md`
|
|
112
|
+
documents how to point it at `RULE_ROUTER.md`.
|
|
113
|
+
|
|
114
|
+
**Per-tool depth (Kiro example).** Claude reuses your `~/.claude` baseline, so its entry is just
|
|
115
|
+
`CLAUDE.md`. Tools that can't read `~/.claude` get fuller native content instead — Kiro is the
|
|
116
|
+
deepest case (schemas verified against [Kiro's docs](https://kiro.dev/docs/steering/) and ECC's
|
|
117
|
+
real `.kiro/` tree):
|
|
118
|
+
|
|
119
|
+
- `aih bootstrap-ai --cli kiro` → `.kiro/steering/agent-tools.md` (stack-aware CLI usage) +
|
|
120
|
+
stack-aware `.kiro/hooks/*.kiro.hook` files (`aih-secret-scan-on-create`, `aih-tests-on-edit`,
|
|
121
|
+
`aih-quality-gate` running the repo's real lint/test) in Kiro's real hook schema.
|
|
122
|
+
- `aih ecc --cli kiro` → runs ECC's **native** `.kiro/install.sh` (copies ECC's agents/skills/
|
|
123
|
+
steering/hooks into `.kiro/`) when a local ECC checkout is found (`--ecc-path <dir>`, or
|
|
124
|
+
`~/.claude/ecc`, `~/ECC`); otherwise documents the `git clone` + install.
|
|
125
|
+
- `aih superpowers --cli kiro` → `.kiro/steering/superpowers-methodology.md` (the
|
|
126
|
+
brainstorm → plan → TDD → review routing, since Kiro can't load `~/.claude/superpowers`).
|
|
127
|
+
|
|
128
|
+
**Detection** (`--detect`) targets runnable CLI binaries on PATH. Config dirs (`~/.claude`,
|
|
129
|
+
`~/.codex`, `~/.gemini`, `~/.cursor`, `~/.kiro`, …) are still reported as config-only traces, but
|
|
130
|
+
they are advisory and may be stale; they do not drive setup unless you explicitly type the CLI with
|
|
131
|
+
`--cli` or `--all-tools`. Precedence: `--all-tools` > `--cli` > `--detect` > committed marker >
|
|
132
|
+
runnable CLIs > default `claude`. When `--detect` finds no runnable CLI it defaults to `claude` and
|
|
133
|
+
says so. **In an interactive terminal, `--detect` shows the runnable list and any config-only traces
|
|
134
|
+
before asking you to confirm or edit it** (press Enter to accept, or type a comma-separated list to
|
|
135
|
+
add/remove tools) before anything installs — pass `--yes` (or run non-interactively / piped /
|
|
136
|
+
`--json`) to skip the prompt and use the runnable list as-is. `aih doctor` reports runnable vs
|
|
137
|
+
config-only CLIs, and `aih bootstrap-ai --verify` adds a per-CLI **"installed"** confirm step (pass =
|
|
138
|
+
runnable binary on PATH, skip = config-only/not here yet, bootloader still written) alongside the
|
|
139
|
+
drift gate.
|
|
140
|
+
|
|
141
|
+
**Canon directory name.** Every generated file and reference adopts `--context-dir <name>` — use any
|
|
142
|
+
name you like; the default is the visible `ai-coding/`:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
aih init # → ai-coding/ (default, visible)
|
|
146
|
+
aih init --context-dir my-canon # → my-canon/ (any name; everything adapts)
|
|
147
|
+
aih init --context-dir .ai-context # → hidden, the old default
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Shell-runnable installs (`ecc-install`, `agy`/`copilot plugin install`) execute under `--apply`;
|
|
151
|
+
in-tool slash-command installs (Claude/Codex/Kimi plugins) are emitted as exact commands to run
|
|
152
|
+
inside the tool. ECC and Superpowers are complementary — ECC supplies stack-aware rules, agents,
|
|
153
|
+
and memory; Superpowers supplies the disciplined agent loop that uses them.
|
|
154
|
+
|
|
155
|
+
### Layered AI canon (`bootstrap-ai`)
|
|
156
|
+
|
|
157
|
+
The harness models the same two-layer setup used in the reference repos (eicp / ai-os / syntegris):
|
|
158
|
+
|
|
159
|
+
- **Layer 1 — user baseline:** ECC + Superpowers, installed per CLI by `aih ecc` / `aih superpowers`.
|
|
160
|
+
- **Layer 2 — repo canon:** the committed `ai-coding/` (or `--context-dir`) tree — `RULE_ROUTER.md`
|
|
161
|
+
(stack-aware routing entry point), `adapters/<cli>.md` (per-tool wiring notes), `REGENERATION.md`,
|
|
162
|
+
and the root **bootloaders** (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, Cursor/Windsurf/Copilot).
|
|
163
|
+
|
|
164
|
+
`aih bootstrap-ai` generates and verifies Layer 2. Each bootloader is hand-editable tool-specific
|
|
165
|
+
content **plus one marker-delimited shared block** that `bootstrap-ai` regenerates idempotently —
|
|
166
|
+
your edits outside the markers survive (merged in, with an `.aih.bak` backup). `aih bootstrap-ai --verify`
|
|
167
|
+
is the **drift gate**: it fails if the router is missing or a bootloader's block has been hand-edited
|
|
168
|
+
away from the canonical source — wire it into CI to keep every tool's entry point in sync.
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
aih bootstrap-ai --all-tools --apply # lay down RULE_ROUTER + adapters + bootloaders for every CLI
|
|
172
|
+
aih bootstrap-ai --verify # CI drift gate (no writes; exit 1 on drift)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Precedence: **Layer 2 wins** on conflict — repo canon overrides the generic baseline. Run
|
|
176
|
+
`aih scaffold` for the context dir (`INDEX/architecture/conventions`) the router points at.
|
|
177
|
+
|
|
178
|
+
### Multi-repo workspaces
|
|
179
|
+
|
|
180
|
+
Most orgs split a product across **separate repos** (a UI repo and a backend repo in one git org). An
|
|
181
|
+
agent editing the UI then has no view into the backend — no cross-repo blast radius. `aih workspace`
|
|
182
|
+
bridges that gap from the **parent folder** that holds the repos:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
aih workspace ./my-org --apply # auto-detects child repos (*/.git); or --repos ui,backend
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
It writes, at the parent (it does **not** touch the child repos — run `aih init` in each):
|
|
189
|
+
|
|
190
|
+
- `<context-dir>/cross-repo-architecture.md` — per-repo responsibilities + a **cross-repo feature map**
|
|
191
|
+
(UI column · backend column · the contract). **Write-once** — aih seeds it from your repo list, then
|
|
192
|
+
you own it; re-running never overwrites it.
|
|
193
|
+
- `<context-dir>/repo-discipline.md` — load a repo's own canon before editing it.
|
|
194
|
+
- `CLAUDE.md` + `AGENTS.md` — thin workspace bootloaders pointing at the cross-repo canon.
|
|
195
|
+
- `<name>.code-workspace` — opens every repo in one VS Code window.
|
|
196
|
+
- `.mcp.json` — combined **code-review graph + filesystem MCP** spanning every child repo path, so an
|
|
197
|
+
agent at the workspace root can reason about cross-repo blast radius before editing a child repo.
|
|
198
|
+
- `.aih-workspace.json` — marker that puts `aih doctor` into **workspace mode** (validates each child
|
|
199
|
+
repo is scaffolded).
|
|
200
|
+
|
|
201
|
+
### Support tickets
|
|
202
|
+
|
|
203
|
+
Any verifying command (`aih doctor`, `aih heal`, `aih bootstrap-ai --verify`, `aih secrets --verify`, …)
|
|
204
|
+
turns a failed or skipped check that carries a `Check.code` into a **ticket-ready, tool-neutral support
|
|
205
|
+
template** — so a developer blocked by corporate environment config (untrusted CA, broken npm, blocked
|
|
206
|
+
registry) can escalate without hand-writing the ask. `aih report` also derives its own **advisory**
|
|
207
|
+
findings from the analytics panels (per-turn context **over budget**, incomplete **adoption** in an
|
|
208
|
+
initialised repo) as developer self-fix notes — they never fail the run (a bare `aih report` still exits
|
|
209
|
+
0; only `--gate` makes the budget a CI gate). Templates render in three registers, keyed off who fixes
|
|
210
|
+
the issue:
|
|
211
|
+
|
|
212
|
+
- **External escalation** — an external-audience check that **failed**; the fix is a system change owned
|
|
213
|
+
by IT, security, or the dev-platform team (untrusted corporate CA, broken package manager, unreachable
|
|
214
|
+
registry). Blocking failures lead with `[<project>] Blocking setup issue — …`.
|
|
215
|
+
- **External improvement request** — an external-audience check that **skipped**: a non-blocking
|
|
216
|
+
configuration gap that degrades the setup without blocking it.
|
|
217
|
+
- **Developer self-fix note** — a developer-audience finding the developer resolves directly (install
|
|
218
|
+
git, `aih mcp --apply`); terse, runnable, and the only register that may name `aih`.
|
|
219
|
+
|
|
220
|
+
By default the terminal prints one `[copy] …` label per template under a **Support templates:** heading.
|
|
221
|
+
Add **`--support-out <dir>`** to write each full ticket to a repo-contained `<dir>/<code>.md` file (you
|
|
222
|
+
named the path — that's the consent, same as `--sarif <file>`). **`--json`** carries the data under a
|
|
223
|
+
top-level `support: { findings, templates }` key. Support output is **suppressed when streaming SARIF**
|
|
224
|
+
(`--sarif -`) so stdout stays a clean code-scanning artifact.
|
|
225
|
+
|
|
226
|
+
**External tickets are tool-neutral by contract** — they never name aih or its commands; they describe
|
|
227
|
+
the failed *internal configuration* the recipient must fix at the system level. Each follows the
|
|
228
|
+
structure **Summary → Impact → Issue → Observed evidence → Environment → Requested fix → Acceptance
|
|
229
|
+
criteria**, and every escalation ends with a security work-around guard (keep TLS verification and secret
|
|
230
|
+
controls enabled; don't change project code). Evidence, affected area, and acceptance criteria are canned
|
|
231
|
+
per code — never guessed — with the live check detail riding along as evidence (redacted: home-dir
|
|
232
|
+
scrubbed, secret-aware argv masking).
|
|
233
|
+
|
|
234
|
+
**Project context (`SETUP.md`).** A project can shape the tickets with opt-in HTML-comment markers in
|
|
235
|
+
`SETUP.md`, `docs/SETUP.md`, or `.aih/SETUP.md` (first found wins):
|
|
236
|
+
|
|
237
|
+
- `<!-- support:why -->…<!-- /support:why -->` — *why a correct environment matters for this project*,
|
|
238
|
+
woven into the ticket's Impact / "Why this helps" section. Falls back to the first paragraph under a
|
|
239
|
+
`## Why` / `## Overview` / `## Purpose` / `## Background` / `## About` heading, so existing setup files
|
|
240
|
+
contribute without edits.
|
|
241
|
+
- `<!-- support:routing -->…<!-- /support:routing -->` — real routing metadata (assignment group, ticket
|
|
242
|
+
prefix) rendered verbatim in the Environment block. **Never invented** — shown only when you provide it.
|
|
243
|
+
- `<!-- support:language -->…<!-- /support:language -->` — an instruction to adapt the message to the
|
|
244
|
+
org's corporate language, surfaced as a **terminal note** to the author, never embedded in the ticket
|
|
245
|
+
body (which stays clean to paste).
|
|
246
|
+
|
|
247
|
+
### Run ledger
|
|
248
|
+
|
|
249
|
+
Every `aih` invocation appends one structured row to **`.aih/runs/YYYY-MM.jsonl`** (UTC, month-sharded,
|
|
250
|
+
append-only) — a "what happened" diagnostics trail: run id, capability, redacted argv, status (`success` /
|
|
251
|
+
`failed` / `partial` / `error`), exit code, mode (apply/verify/json/sarif), platform, write tally, and
|
|
252
|
+
verification + support counts. It's distinct from `.aih/history.jsonl` (the per-commit metrics behind
|
|
253
|
+
`aih report` trends). Logging is **on only after the repo is initialised** (a committed `.aih-config.json`
|
|
254
|
+
marker exists) and never fails a command; opt out with **`--no-log`** or **`AIH_LOG=0`**. Like all of
|
|
255
|
+
`.aih/`, the ledger is gitignored local diagnostics — never committed.
|
|
256
|
+
|
|
257
|
+
### Examples
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
aih doctor --json # what's configured? (read-only)
|
|
261
|
+
aih init . --apply # bootstrap the current repo
|
|
262
|
+
aih certs --ca-pattern Zscaler --apply --verify
|
|
263
|
+
aih hardware # preview the tuned inference env block
|
|
264
|
+
AIH_CONTEXT_DIR=ai-coding aih scaffold --apply
|
|
265
|
+
aih doctor --support-out .aih/tickets # write IT/support tickets for failing checks (kept local)
|
|
266
|
+
aih report --v9 --apply --out .aih/reports/local-v9.html
|
|
267
|
+
aih usage --apply --cli claude,codex,gemini
|
|
268
|
+
aih usage --rollup ../repo-a,../repo-b
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Releases & roadmap
|
|
272
|
+
|
|
273
|
+
- **Roadmap** — [ROADMAP.md](ROADMAP.md), tracked as
|
|
274
|
+
[GitHub Milestones](https://github.com/samartomar/ai-harness/milestones).
|
|
275
|
+
- **Changelog** — [CHANGELOG.md](CHANGELOG.md); tagged builds on
|
|
276
|
+
[Releases](https://github.com/samartomar/ai-harness/releases).
|
|
277
|
+
- **Versioning & support** — [VERSIONING.md](VERSIONING.md). SemVer; while pre-1.0 only the
|
|
278
|
+
latest minor receives fixes.
|
|
279
|
+
- **Supply chain** — every release publishes via npm **Trusted Publishing** with build
|
|
280
|
+
**provenance** and ships an **SPDX SBOM** + **SHA256 checksum** on the GitHub Release.
|
|
281
|
+
Verify an install with `npm audit signatures`. The first npm publish is tracked in
|
|
282
|
+
[#37](https://github.com/samartomar/ai-harness/issues/37); until then, install from source
|
|
283
|
+
(above).
|
|
284
|
+
- **Support** — [SUPPORT.md](SUPPORT.md) · **Security** — [SECURITY.md](SECURITY.md)
|
|
285
|
+
(private reporting) · **Contributing** — [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
286
|
+
|
|
287
|
+
## Development
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
npm test # vitest
|
|
291
|
+
npm run typecheck # tsc --noEmit
|
|
292
|
+
npm run lint # biome
|
|
293
|
+
npm run build # tsup → dist/
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Stack: TypeScript (ESM) · commander · zod · vitest · biome · tsup. See
|
|
297
|
+
[`.github/AGENT_TASKS.md`](.github/AGENT_TASKS.md) for architecture, the
|
|
298
|
+
contributor/agent workflow, and delegatable tasks.
|
|
299
|
+
|
|
300
|
+
## License
|
|
301
|
+
|
|
302
|
+
[Apache-2.0](LICENSE).
|