harnessme 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 Silvano
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,125 @@
1
+ # HarnessME
2
+
3
+ HarnessME analyzes a repository and turns its real structure and conventions into shared instructions for AI coding agents. It generates `AGENTS.md` and provider-specific files, detects drift, identifies high-impact files from change frequency and import fan-in, and gates invasive changes to critical paths.
4
+
5
+ It is a local, scriptable CLI: no account, dashboard, or hosted service required.
6
+
7
+ ## Install
8
+
9
+ Requires Node.js 20.19 or newer on Windows, macOS, or Linux.
10
+
11
+ ```bash
12
+ npm install --global harnessme
13
+ harnessme --version
14
+ ```
15
+
16
+ For model-assisted generation, install and sign in to at least one supported framework CLI: Codex, Claude Code, or Cursor. Use `--deterministic` when you want a fully local run without model inference.
17
+
18
+ For a one-off run:
19
+
20
+ ```bash
21
+ npx harnessme init --provider codex
22
+ ```
23
+
24
+ ## Use
25
+
26
+ Initialize HarnessME from the root of an existing repository:
27
+
28
+ ```bash
29
+ harnessme init --provider codex --critical-approvers alice,bob
30
+ harnessme hooks install
31
+ ```
32
+
33
+ The `--provider` value selects the model runtime used for inference; it does not limit generated files. By default HarnessME writes integrations for every supported agent framework. Use `--targets codex,claude-code` only when you intentionally want a smaller output set.
34
+
35
+ This creates the facts store in `.harnessme/`, a generated `AGENTS.md`, provider files, CODEOWNERS, CI configuration, and a cross-platform Lefthook configuration. The second command activates the local Git gate on macOS, Linux, or Windows.
36
+
37
+ ## How the harness is created
38
+
39
+ When `harnessme init` runs, it:
40
+
41
+ 1. Scans C#, Java, Go, Rust, Ruby, PHP, C, C++, JavaScript, TypeScript, TSX, Python, Bash, PowerShell, CSS, and INI files using bundled syntax-tree grammars.
42
+ 2. Reads package metadata, formatter and linter settings, type configuration, contribution documentation, and Git history.
43
+ 3. Detects the stack, repository structure, coding conventions, error-handling and object-design patterns, import hubs, and frequently changed files.
44
+ 4. Stores those findings in `.harnessme/facts/`. Every inferred convention includes a repository-relative file and line citation.
45
+ 5. Marks high-impact files as critical when their change-frequency or import fan-in score crosses the configured thresholds. These rules are written to `.harnessme/critical-paths.yaml` for review and adjustment.
46
+ 6. Compiles the validated facts, project directives, architecture, and critical-path rules into `AGENTS.md` and the selected provider files.
47
+ 7. Generates the governance backstops: `.harnessme/CRITICAL.md`, CODEOWNERS, a Claude Code hook when selected, Lefthook configuration, and a GitHub Actions workflow.
48
+
49
+ Existing unmanaged `AGENTS.md` instructions are preserved as project directives instead of being discarded. Application source files are analyzed but not rewritten.
50
+
51
+ ### Framework model inference and fallback
52
+
53
+ Model-assisted analysis reuses the authentication and default model from Codex, Claude Code, or Cursor. Choose the inference runtime with `--provider`; `auto` uses the first installed supported CLI:
54
+
55
+ ```text
56
+ harnessme init --provider auto
57
+ ```
58
+
59
+ Select one explicitly or override its configured model when needed:
60
+
61
+ ```text
62
+ harnessme init --provider cursor --model your-model
63
+ ```
64
+
65
+ Supported inference runtimes are `codex`, `claude-code`, and `cursor`. HarnessME runs them non-interactively in an isolated temporary directory containing only redacted analysis input—not the repository—and asks for structured, evidence-cited facts. The model enriches deterministic analysis for supported languages and provides fallback analysis for missing grammars. It does not directly write `AGENTS.md` or governance files; HarnessME validates and renders those deterministically.
66
+
67
+ An OpenAI-compatible endpoint, including a local Ollama server, remains available when no framework CLI is suitable:
68
+
69
+ ```text
70
+ harnessme init --provider http --ai-endpoint http://localhost:11434/v1/chat/completions --model qwen2.5-coder:7b
71
+ ```
72
+
73
+ For an authenticated endpoint, add `--ai-api-key-env AI_API_KEY`. Model inference examines text-like source files within configured size limits. Secret-like lines are redacted before inference. Proposed facts must pass schema validation, local file-and-line citation checks, and a separate model-verification pass before entering the facts store. Use `--deterministic` to disable model inference for offline or privacy-sensitive runs.
74
+
75
+ Keep the harness current:
76
+
77
+ ```bash
78
+ harnessme scan # report differences without writing
79
+ harnessme validate # verify pending notes from AGENTS.md
80
+ harnessme sync # regenerate provider files
81
+ harnessme check --ci # fail when facts have drifted
82
+ ```
83
+
84
+ Add a project policy that cannot be inferred from source code:
85
+
86
+ ```bash
87
+ harnessme directive add "Use OAuth2 for authentication"
88
+ ```
89
+
90
+ Protect a critical area:
91
+
92
+ ```bash
93
+ harnessme critical add "src/payments/**" --reason "money movement" --approvers "alice,bob"
94
+ harnessme critical draft "src/payments/refund.ts" --summary "support partial refunds"
95
+ # A listed human reviewer reviews the record and staged code, then:
96
+ harnessme critical approve <record.md> --approver alice
97
+ git add .harnessme/critical-log/<record.md> .harnessme/CRITICAL.md
98
+ ```
99
+
100
+ For registered paths, generated agent instructions require explicit developer confirmation before editing. Claude Code receives a native permission prompt; the Git hook and CI reject commits unless an approved record matches the exact staged/committed content and ships with the updated critical index. CODEOWNERS remains the authoritative team-review control on GitHub.
101
+
102
+ Use `harnessme providers list` to see inference providers and `harnessme targets list` to see generated integration targets. Every command accepts `--root <path>` for automation and monorepos.
103
+
104
+ ## Behind the scenes
105
+
106
+ - `web-tree-sitter` and VS Code WASM grammars for deterministic multi-language analysis
107
+ - `zod` for validating the version-controlled facts store
108
+ - `Ruler` for distributing instructions to agent-specific formats
109
+ - `js-yaml`, TOML, and frontmatter parsing for project configuration and critical-change records
110
+ - Git history for hotspot detection and git-native critical-path checks
111
+ - Import-graph fan-in and AST patterns for core-module and architecture detection
112
+ - Authenticated Codex, Claude Code, or Cursor CLI sessions for optional model-assisted harness inference
113
+ - Claude Code hooks, Lefthook, GitHub Actions, and CODEOWNERS for governance backstops
114
+
115
+ ## Development
116
+
117
+ ```bash
118
+ npm install
119
+ npm run lint
120
+ npm test
121
+ ```
122
+
123
+ ## License
124
+
125
+ MIT