agent-hygiene-linter 1.0.1
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/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/README.md +157 -0
- package/dist/cli-CWkfHViv.d.ts +44 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +624 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +625 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
## [1.0.1](https://github.com/oleg-koval/agent-hygiene-linter/compare/v1.0.0...v1.0.1) (2026-06-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* exit cleanly on EPIPE when stdout is closed early ([80d31e3](https://github.com/oleg-koval/agent-hygiene-linter/commit/80d31e32a807c0815fd9624fc7e8e7cbdf1e59be))
|
|
7
|
+
|
|
8
|
+
# 1.0.0 (2026-06-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* disable release commit hooks in ci ([692de5d](https://github.com/oleg-koval/agent-hygiene-linter/commit/692de5d1fc8a6dc37f7dd9921dd18802b5c98dd0))
|
|
14
|
+
* disable release hooks in github actions ([f28cb64](https://github.com/oleg-koval/agent-hygiene-linter/commit/f28cb64ca1752ea9b4a4908051f372c6e82bb170))
|
|
15
|
+
* ignore generated changelog in prettier ([799586d](https://github.com/oleg-koval/agent-hygiene-linter/commit/799586d93f1bd819cce38d9dd5348f70fcdc6618))
|
|
16
|
+
* skip npm publish in release workflow ([32f9653](https://github.com/oleg-koval/agent-hygiene-linter/commit/32f9653ada672cd0945cf9839360136b19107abe))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **fix:** add --fix to scaffold missing agent-readiness files ([d9334c9](https://github.com/oleg-koval/agent-hygiene-linter/commit/d9334c9db33f4aeae262711eb8cbd9bf36f6f2c0))
|
|
22
|
+
* publish playbook runner docs ([77405dc](https://github.com/oleg-koval/agent-hygiene-linter/commit/77405dcb7665f336af6cb6e3f0bae5d4797db36d))
|
|
23
|
+
* regenerate readme icon ([f4897fe](https://github.com/oleg-koval/agent-hygiene-linter/commit/f4897fe7b57ef07feada777fb43c8be82a6f8e9b))
|
|
24
|
+
* release ai refactor playbook runner ([8e63675](https://github.com/oleg-koval/agent-hygiene-linter/commit/8e63675f7822a44784cdc18c70a7f1f16f6e375d))
|
|
25
|
+
|
|
26
|
+
# Changelog
|
|
27
|
+
|
|
28
|
+
All notable changes to this project are documented here.
|
|
29
|
+
|
|
30
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
31
|
+
semantic-release manages entries from git tags and commit messages.
|
|
32
|
+
|
|
33
|
+
## [1.1.0](https://github.com/oleg-koval/agent-hygiene-linter/compare/v1.0.2...v1.1.0) (2026-05-29)
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* cleaned up project branding; removed dead refactor-runner code
|
|
38
|
+
|
|
39
|
+
## [1.0.2](https://github.com/oleg-koval/agent-hygiene-linter/compare/v1.0.1...v1.0.2) (2026-05-29)
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* ignore generated changelog in prettier
|
|
44
|
+
|
|
45
|
+
## [1.0.1](https://github.com/oleg-koval/agent-hygiene-linter/compare/v1.0.0...v1.0.1) (2026-05-29)
|
|
46
|
+
|
|
47
|
+
### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* disable release hooks in github actions
|
|
50
|
+
|
|
51
|
+
## 1.0.0 (2026-05-29)
|
|
52
|
+
|
|
53
|
+
### Features
|
|
54
|
+
|
|
55
|
+
* initial release of agent-hygiene-linter — scores repo hygiene for agents and humans
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oleg Koval
|
|
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,157 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="./.github/workflows/ci.yml"><img src="https://github.com/oleg-koval/agent-hygiene-linter/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
3
|
+
<a href="https://github.com/oleg-koval/agent-hygiene-linter/releases"><img src="https://img.shields.io/github/v/release/oleg-koval/agent-hygiene-linter" alt="GitHub release"></a>
|
|
4
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/agent-hygiene-linter"><img src="https://img.shields.io/npm/v/agent-hygiene-linter" alt="npm version"></a>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<img src="./logo.svg" width="120" height="120" alt="Agent Hygiene Linter logo">
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<h1 align="center">agent-hygiene-linter</h1>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
Scan any repo and get a hygiene score in seconds<br>
|
|
16
|
+
<strong>README · AGENTS.md · docs · changelog · scripts · commit style — all in one pass</strong>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What it does
|
|
22
|
+
|
|
23
|
+
`agent-hygiene-linter` runs a quick structural audit of any repository and emits a score from 0–100 along with categorised findings: **good**, **warning**, or **fix now**.
|
|
24
|
+
|
|
25
|
+
It checks:
|
|
26
|
+
|
|
27
|
+
| Finding code | What it looks for |
|
|
28
|
+
| ---------------------------------------------------------------- | -------------------------------------------------- |
|
|
29
|
+
| `readme-present` / `readme-missing` | Top-level `README.md` |
|
|
30
|
+
| `agent-doc-present` / `agent-doc-missing` | `AGENTS.md` or `CLAUDE.md` |
|
|
31
|
+
| `docs-shape-present` / `docs-shape-missing` | At least one `.md` file under `docs/` |
|
|
32
|
+
| `changelog-present` / `changelog-missing` | `CHANGELOG.md` or `docs/changelog.md` |
|
|
33
|
+
| `package-scripts-good` / `package-scripts-missing` | Standard `build`, `test`, `lint`, `ci` npm scripts |
|
|
34
|
+
| `commit-style-good` / `commit-style-mixed` / `commit-style-weak` | Conventional Commits ratio over last 25 commits |
|
|
35
|
+
| `entrypoint-present` / `entrypoint-missing` | `src/index.ts`, `index.ts`, or `main.ts` |
|
|
36
|
+
|
|
37
|
+
**Scoring:** each `fix now` finding costs 18 points; each `warning` costs 8 points. Minimum score is 0.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g agent-hygiene-linter
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or run without installing:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx agent-hygiene-linter <path>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Scan the current directory (text output)
|
|
55
|
+
agent-hygiene-linter .
|
|
56
|
+
|
|
57
|
+
# Scan a specific repo
|
|
58
|
+
agent-hygiene-linter /path/to/your/repo
|
|
59
|
+
|
|
60
|
+
# Markdown report
|
|
61
|
+
agent-hygiene-linter . --format markdown
|
|
62
|
+
|
|
63
|
+
# JSON report (for CI pipelines / dashboards)
|
|
64
|
+
agent-hygiene-linter . --format json
|
|
65
|
+
|
|
66
|
+
# Save report to a file
|
|
67
|
+
agent-hygiene-linter . --format markdown --output hygiene-report.md
|
|
68
|
+
|
|
69
|
+
# Fail with exit code 1 if score is below threshold (default: 75)
|
|
70
|
+
agent-hygiene-linter . --min-score 80
|
|
71
|
+
|
|
72
|
+
# Auto-create the missing files it can generate safely, then re-scan
|
|
73
|
+
agent-hygiene-linter . --fix
|
|
74
|
+
|
|
75
|
+
# Preview what --fix would create without writing anything
|
|
76
|
+
agent-hygiene-linter . --fix --dry-run
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `--fix`
|
|
80
|
+
|
|
81
|
+
`--fix` closes the gaps it can close from the repo scan alone — it scaffolds any
|
|
82
|
+
missing `README.md`, `AGENTS.md`, `docs/README.md`, and `CHANGELOG.md` from
|
|
83
|
+
detected facts (package manager, scripts, entrypoint), then re-scans and prints
|
|
84
|
+
the new score. It is deterministic and offline (no LLM), it **never overwrites**
|
|
85
|
+
an existing file, and it is idempotent — a second run writes nothing. Everything
|
|
86
|
+
it cannot generate safely (package scripts, commit history, the entrypoint) stays
|
|
87
|
+
advisory in the report.
|
|
88
|
+
|
|
89
|
+
## Example output
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Agent hygiene score: 92/100
|
|
93
|
+
Repo: my-project
|
|
94
|
+
Path: /home/user/my-project
|
|
95
|
+
Good: 6 | Warning: 1 | Fix now: 0
|
|
96
|
+
|
|
97
|
+
[warning] Docs directory is thin
|
|
98
|
+
Add a small docs/ tree or module notes so the repo is easier to navigate.
|
|
99
|
+
[good] Agent instructions exist
|
|
100
|
+
Found repo-level instructions for agent onboarding.
|
|
101
|
+
[good] An obvious entrypoint exists
|
|
102
|
+
Found a clear code entrypoint for navigation.
|
|
103
|
+
[good] Changelog or release notes exist
|
|
104
|
+
The repo has a visible change log path for updates.
|
|
105
|
+
[good] Commit style is consistent
|
|
106
|
+
14 of 14 recent commits follow Conventional Commits.
|
|
107
|
+
[good] Package scripts are predictable
|
|
108
|
+
Found 4 of the expected build/test/lint/ci scripts.
|
|
109
|
+
[good] README exists
|
|
110
|
+
The repo has a top-level README for quick orientation.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## CI integration
|
|
114
|
+
|
|
115
|
+
Add a hygiene gate to your pipeline:
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
- name: Hygiene check
|
|
119
|
+
run: npx agent-hygiene-linter . --min-score 75
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Exit code `0` = score is at or above the threshold. Exit code `1` = below threshold.
|
|
123
|
+
|
|
124
|
+
## Programmatic API
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { scanRepository, renderTextReport } from "agent-hygiene-linter";
|
|
128
|
+
|
|
129
|
+
const report = await scanRepository("/path/to/repo");
|
|
130
|
+
console.log(renderTextReport(report));
|
|
131
|
+
// report.score, report.findings, report.counts
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## System requirements
|
|
135
|
+
|
|
136
|
+
- Node.js 20.10 or newer
|
|
137
|
+
|
|
138
|
+
## Contributing
|
|
139
|
+
|
|
140
|
+
Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening a PR.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT. See [LICENSE](./LICENSE).
|
|
145
|
+
|
|
146
|
+
## Author
|
|
147
|
+
|
|
148
|
+
Oleg Koval — [olegkoval.com](https://olegkoval.com)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
<p align="center">
|
|
153
|
+
<a href="https://oleg-koval.github.io/agent-hygiene-linter/">Website</a> ·
|
|
154
|
+
<a href="https://github.com/oleg-koval/agent-hygiene-linter">GitHub</a> ·
|
|
155
|
+
<a href="https://github.com/oleg-koval/agent-hygiene-linter/releases">Releases</a> ·
|
|
156
|
+
<a href="https://github.com/oleg-koval/agent-hygiene-linter/issues">Issues</a>
|
|
157
|
+
</p>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type HygieneBucket = "good" | "warning" | "fix now";
|
|
2
|
+
interface HygieneFinding {
|
|
3
|
+
code: string;
|
|
4
|
+
bucket: HygieneBucket;
|
|
5
|
+
title: string;
|
|
6
|
+
detail: string;
|
|
7
|
+
}
|
|
8
|
+
interface HygieneCounts {
|
|
9
|
+
good: number;
|
|
10
|
+
warning: number;
|
|
11
|
+
fixNow: number;
|
|
12
|
+
}
|
|
13
|
+
interface HygieneReport {
|
|
14
|
+
repoPath: string;
|
|
15
|
+
repoName: string;
|
|
16
|
+
scannedAt: string;
|
|
17
|
+
score: number;
|
|
18
|
+
counts: HygieneCounts;
|
|
19
|
+
findings: HygieneFinding[];
|
|
20
|
+
}
|
|
21
|
+
interface CliOptions {
|
|
22
|
+
repoPath: string;
|
|
23
|
+
format: "text" | "markdown" | "json";
|
|
24
|
+
outputPath?: string;
|
|
25
|
+
minScore: number;
|
|
26
|
+
fix: boolean;
|
|
27
|
+
dryRun: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface FixFacts {
|
|
30
|
+
repoName: string;
|
|
31
|
+
packageManager: string;
|
|
32
|
+
scripts: string[];
|
|
33
|
+
entrypoint: string | null;
|
|
34
|
+
}
|
|
35
|
+
interface FixResult {
|
|
36
|
+
before: HygieneReport;
|
|
37
|
+
after: HygieneReport;
|
|
38
|
+
planned: string[];
|
|
39
|
+
written: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare function parseCliArgs(argv: string[]): CliOptions;
|
|
43
|
+
|
|
44
|
+
export { type CliOptions as C, type FixResult as F, type HygieneFinding as H, type HygieneReport as a, type FixFacts as b, type HygieneBucket as c, type HygieneCounts as d, parseCliArgs as p };
|
package/dist/cli.d.ts
ADDED