kerpeten 0.0.0-stage → 0.2.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 LibirSoft
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 CHANGED
@@ -1,3 +1,127 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/KerpetenSH/kerpeten/master/.github/assets/logo.png" alt="Kerpeten logo" width="128">
3
+ </p>
4
+ <h1 align="center">Kerpeten</h1>
5
+ <p align="center"><b>AI code review in your terminal, where a second model checks every finding.</b></p>
6
+ <p align="center">
7
+ <a href="https://www.npmjs.com/package/kerpeten"><img alt="npm" src="https://img.shields.io/npm/v/kerpeten?style=flat-square"></a>
8
+ <a href="https://github.com/KerpetenSH/kerpeten/actions/workflows/release.yml"><img alt="ci" src="https://img.shields.io/github/actions/workflow/status/KerpetenSH/kerpeten/release.yml?branch=master&style=flat-square&label=ci"></a>
9
+ <a href="https://github.com/KerpetenSH/kerpeten/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/npm/l/kerpeten?style=flat-square"></a>
10
+ </p>
2
11
 
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.
12
+ Kerpeten reads the change on your branch and lets a reviewer model look for defects in it. Then a judge model takes each finding on its own and tries to refute it against the code. What you get is a list of findings, each with a verdict, a score and a note on how to fix it.
13
+
14
+ - **Two models, not one.** The reviewer finds, the judge doubts. A finding the judge refutes gets a score of 0, so a wrong guess does not look like a real defect.
15
+ - **Read-only.** The models can read and search the files of your repository, and nothing else. They cannot change a file or run a command.
16
+ - **Your models.** Anthropic, OpenAI, OpenRouter, or your ChatGPT plan instead of an API key. The reviewer and the judge can be different models.
17
+ - **Your rules.** A change that breaks a rule written in your `AGENTS.md` or `CLAUDE.md` is a finding too.
18
+ - **No silent fallback.** A missing key stops the review with a clear error. When a limit ends the review early or a long input is cut, Kerpeten reports it. It never switches to another model on its own.
19
+
20
+ > **Status:** Kerpeten is at an early stage. Today it reviews on your machine and prints the findings. It does not post the review to a merge request yet.
21
+
22
+ ## What a review looks like
23
+
24
+ Two of the four findings of a real run on a small test repository. The comments were written in Turkish and are translated here.
25
+
26
+ ```text
27
+ review: 524f2b14fb27..69435fefd9f2, 2 changed files, prompt reviewer v4
28
+ findings: 4
29
+ - src/flows/partialRefund.ts:10-10 [bug] The handling fee is not rounded down to whole cents.
30
+ verdict verified, priority P1, nature critical, fix_effort easy, score 70, action inline
31
+ For a request of 100 cents the 1.5% fee is taken as 1.5 cents instead of being rounded down to 1 cent. The flow returns 98.5 cents instead of 99.
32
+ fix Round the handling fee down to whole cents before you take it from the refund.
33
+ rationale A request of 100 cents passes the check for a positive amount, and the fee of 1.5 cents is taken without rounding, so the flow returns 98.5 cents instead of 99.
34
+ evidence src/flows/partialRefund.ts:10: The percentage is stored without rounding, so it can be a part of a cent.
35
+ evidence src/flows/partialRefund.ts:12: The fee is taken from the requested amount as it is.
36
+ evidence AGENTS.md:6: Money must be a whole number of cents.
37
+ - src/flows/partialRefund.ts:6-6 [convention] The id of the partial refund flow is not in snake_case.
38
+ verdict verified, priority P2, nature critical, fix_effort easy, score 45, action summary
39
+ The `id` of the new flow is `partialRefund`; the project rule says that flow ids are written in snake_case.
40
+ fix Change the `id` to `partial_refund`.
41
+ rationale `AGENTS.md` says that the ids of the flows under `src/flows/` are in snake_case; the `id` of the new flow is `partialRefund`, which is camelCase.
42
+ evidence AGENTS.md:5: The `id` fields of the flows under `src/flows/` must be in snake_case.
43
+ evidence src/flows/partialRefund.ts:6: The `id` of the new flow is `partialRefund`, in camelCase.
44
+ ```
45
+
46
+ ## Quick start
47
+
48
+ 1. Install Kerpeten:
49
+
50
+ ```sh
51
+ npm install -g kerpeten
52
+ ```
53
+
54
+ It also needs [ripgrep](https://github.com/BurntSushi/ripgrep) (`rg`) on your `PATH`; the models search your code with it.
55
+
56
+ 2. Run `kerpeten init` inside the repository you want to review:
57
+
58
+ ```sh
59
+ cd /path/to/your-repository
60
+ kerpeten init
61
+ ```
62
+
63
+ It asks for the provider and the model of the reviewer and of the judge and for the language of the review comments. Then it writes `.kerpeten.yml` to the root of the repository and tells what is still missing: ripgrep, a key or a sign-in.
64
+
65
+ 3. Give Kerpeten the key of your provider, or sign in with `kerpeten auth login` when you chose your ChatGPT plan:
66
+
67
+ ```sh
68
+ export ANTHROPIC_API_KEY="<your key>"
69
+ ```
70
+
71
+ Put your key in place of `<your key>`.
72
+
73
+ 4. Commit your work, then run the review from inside the repository:
74
+
75
+ ```sh
76
+ kerpeten review --dry-run
77
+ ```
78
+
79
+ The review covers the commits of your branch that are not on the default branch of `origin`. `--base <branch or commit>` picks another base. `--mr <n>` reviews GitHub pull request `n` or GitLab merge request `n` of the project the `origin` remote names, with its title and description, read through the GitHub CLI (`gh`) or the GitLab CLI (`glab`).
80
+
81
+ ## Models
82
+
83
+ | `provider` | What it needs |
84
+ | --- | --- |
85
+ | `anthropic` | `ANTHROPIC_API_KEY` |
86
+ | `openai` | `OPENAI_API_KEY` |
87
+ | `openrouter` | `OPENROUTER_API_KEY` |
88
+ | `chatgpt` | A sign-in with `kerpeten auth login`; the requests count against your ChatGPT plan |
89
+
90
+ Another endpoint that speaks the API of one of these providers works too, with `base_url` and `api_key_env`. [Configuration](https://kerpeten.sh/docs/configuration/) tells how.
91
+
92
+ ## How it works
93
+
94
+ 1. **Change.** Kerpeten takes the diff between the base and `HEAD`.
95
+ 2. **Reviewer.** The reviewer model reads the diff and the rule files, looks into the repository with its read-only tools and reports findings. Each one names a file, lines, a category, the evidence and a fix.
96
+ 3. **Filter.** Findings that point to a file or to lines that do not exist are dropped.
97
+ 4. **Judge.** Each finding goes to the judge model in its own call. The judge checks it against the code and labels it: `verified`, `unverified` or `refuted`, with a priority, a nature and the effort of the fix.
98
+ 5. **Scorer.** The labels become a score from 0 to 100. The score decides what a posted review would do with the finding: a comment on its line, a line in the summary, or nothing.
99
+ 6. **Comment plan.** For a pull request or merge request, Kerpeten decides what it would write: which findings become comments on lines of the diff, which go to the one summary comment and which are already written; nothing is posted yet.
100
+
101
+ ## Commands
102
+
103
+ | Command | What it does |
104
+ | --- | --- |
105
+ | `kerpeten init` | Asks for the models and the comment language, writes `.kerpeten.yml` and checks the setup |
106
+ | `kerpeten review --dry-run [--base <rev>] [--mr <n>] [--context-file <path>] [--extra-context <path or ->] [--json]` | Reviews the change and prints the findings |
107
+ | `kerpeten auth login \| logout \| status [--models]` | Signs in with ChatGPT for models with `provider: chatgpt` |
108
+ | `kerpeten self-check` | Checks the build without the network |
109
+ | `kerpeten capabilities` | Lists what the build can reach (git, the file system, other processes) with the permission each one needs, the permission groups, and the harnesses with the permissions they list |
110
+
111
+ ## Platforms
112
+
113
+ The npm package brings a ready binary for Linux (x64 and arm64, glibc) and for macOS (arm64). npm picks the one for your machine; Node.js 18 or later is needed only for the small launcher that starts it. There is no build yet for Windows, for Intel Macs or for a musl Linux such as Alpine: on those the `kerpeten` command stops with an error that says so.
114
+
115
+ ## Documentation
116
+
117
+ The docs are at [kerpeten.sh/docs](https://kerpeten.sh/docs/); they live in the [website repository](https://github.com/KerpetenSH/website).
118
+
119
+ - [Configuration](https://kerpeten.sh/docs/configuration/): models, keys, other endpoints, the comment language, limits and thresholds
120
+ - [Reviewing](https://kerpeten.sh/docs/reviewing/): what is reviewed, extra context, rule files, the judge and the output
121
+ - [ChatGPT plan](https://kerpeten.sh/docs/chatgpt-plan/): the sign-in and how plan usage behaves
122
+ - [Development](https://kerpeten.sh/docs/development/): running from source, the checks and the builds
123
+ - [Releasing](https://github.com/KerpetenSH/kerpeten/blob/master/RELEASING.md): how a version gets to npm
124
+
125
+ ## License
126
+
127
+ MIT, see [LICENSE](https://github.com/KerpetenSH/kerpeten/blob/master/LICENSE). Written by LibirSoft.
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawnSync } = require("node:child_process");
5
+
6
+ const BINARY = "bin/kerpeten";
7
+ const NAME_PREFIX = "kerpeten-";
8
+
9
+ function usesMusl(platform, readReport) {
10
+ if (platform !== "linux") return false;
11
+
12
+ return readReport()?.header?.glibcVersionRuntime === undefined;
13
+ }
14
+
15
+ function resolveBinary(names, platform, arch, musl, resolve) {
16
+ const target = `${platform}-${arch}`;
17
+ const name = names.find((candidate) => candidate.endsWith(`/${NAME_PREFIX}${target}`));
18
+
19
+ if (name === undefined) {
20
+ const builds = names.map((candidate) => candidate.slice(candidate.lastIndexOf(NAME_PREFIX) + NAME_PREFIX.length));
21
+
22
+ return { ok: false, error: `there is no build for ${target}; the builds are ${builds.join(", ")}` };
23
+ }
24
+
25
+ if (musl) {
26
+ return { ok: false, error: "this Linux uses musl libc, as Alpine does; the builds need glibc" };
27
+ }
28
+
29
+ try {
30
+ return { ok: true, path: resolve(`${name}/${BINARY}`) };
31
+ } catch {
32
+ return {
33
+ ok: false,
34
+ error: `the package ${name} is not installed; it is an optional dependency, so install kerpeten again without --omit=optional`,
35
+ };
36
+ }
37
+ }
38
+
39
+ function main() {
40
+ const names = Object.keys(require("../package.json").optionalDependencies);
41
+ const musl = usesMusl(process.platform, () => process.report.getReport());
42
+ const binary = resolveBinary(names, process.platform, process.arch, musl, require.resolve);
43
+
44
+ if (!binary.ok) {
45
+ console.error(`kerpeten: ${binary.error}`);
46
+ process.exit(1);
47
+ }
48
+
49
+ const result = spawnSync(binary.path, process.argv.slice(2), { stdio: "inherit" });
50
+
51
+ if (result.error !== undefined) {
52
+ console.error(`kerpeten: cannot start ${binary.path}: ${result.error.message}`);
53
+ process.exit(1);
54
+ }
55
+
56
+ if (result.signal !== null) {
57
+ process.exitCode = 1;
58
+ process.kill(process.pid, result.signal);
59
+
60
+ return;
61
+ }
62
+
63
+ process.exit(result.status ?? 1);
64
+ }
65
+
66
+ if (require.main === module) main();
67
+
68
+ module.exports = { resolveBinary, usesMusl };
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "kerpeten",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "A code review CLI: a reviewer model finds defects in a change, a judge model checks each finding.",
5
+ "license": "MIT",
6
+ "author": "LibirSoft",
7
+ "homepage": "https://github.com/KerpetenSH/kerpeten",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/KerpetenSH/kerpeten.git"
11
+ },
12
+ "keywords": [
13
+ "code-review",
14
+ "cli",
15
+ "ai",
16
+ "review"
17
+ ],
18
+ "bin": {
19
+ "kerpeten": "bin/kerpeten.cjs"
20
+ },
21
+ "files": [
22
+ "bin"
23
+ ],
24
+ "engines": {
25
+ "node": ">=18"
26
+ },
27
+ "optionalDependencies": {
28
+ "@kerpetensh/kerpeten-linux-x64": "0.2.0",
29
+ "@kerpetensh/kerpeten-linux-arm64": "0.2.0",
30
+ "@kerpetensh/kerpeten-darwin-arm64": "0.2.0"
31
+ }
32
+ }