airlok 0.2.2 → 0.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to airlok. The format follows Keep a Changelog; versions follow SemVer.
4
4
 
5
+ ## [0.3.0] - 2026-09-11
6
+
7
+ ### Added
8
+
9
+ - Context injection (#5). The system prompt carries a block with the working directory, OS, shell, git branch, status and last five commits, a gitignore-aware file tree, and project instructions from `AIRLOK.md` (or `CLAUDE.md` / `AGENTS.md`) plus `~/.config/airlok/AIRLOK.md`. `[context] max_bytes` caps it; `airlok context` prints it after redaction.
10
+ - Tools `glob`, `grep`, and `list_dir`, read-only and never prompting; `read_file` paging with `offset` and `limit` and binary refusal; tool results over 50 KiB are cut with a paging hint (#5).
11
+ - Markdown rendering in the terminal with highlighted code, buffered per block; plain output when stdout is not a terminal or `NO_COLOR` is set; dimmed, collapsing tool-call lines (#5).
12
+ - Confirmation prompt `[y]es / [n]o / [a]ll / [q]uit` with a one-time hint; `q` aborts the run with a non-zero exit (#5).
13
+
14
+ ### Changed
15
+
16
+ - `edit_file` takes `old` and `new` and reports the match count when it cannot apply (#5).
17
+ - The system prompt tells the model to search with grep and glob before reading files and to prefer `edit_file` over `write_file` for existing files (#5).
18
+
5
19
  ## [0.2.2] - 2026-09-11
6
20
 
7
21
  ### Fixed
package/README.md CHANGED
@@ -22,9 +22,42 @@ airlok --provider openai --model gpt-5.5 "..." # override the provider and model
22
22
  airlok --show-redactions "..." # list what was redacted (kind and length only)
23
23
  airlok config init # write a commented config to the user path
24
24
  airlok config show # print the effective config and the key source
25
+ airlok context # print the context block sent with the system prompt, after redaction
25
26
  ```
26
27
 
27
- Every `write_file` and `edit_file` call shows a unified diff and asks `Apply? [y/N/a]`. Every `bash` call that is not on the allow list shows the command and asks `Run? [y/N/a]`. `a` approves the rest of that kind for the run. A rejection is sent back to the model so it can adapt. Prompts are read from the terminal, not stdin, so piped input still works; without a terminal, pass `--yes` or turn the confirmations off in the config.
28
+ Every `write_file` and `edit_file` call shows a unified diff and asks `Apply? [y]es / [n]o / [a]ll / [q]uit`. Every `bash` call that is not on the allow list shows the command and asks the same way. `y` applies this one, `n` sends a rejection back to the model so it can adapt, `a` approves the rest of that kind for the run, and `q` aborts the run with a non-zero exit. Prompts are read from the terminal, not stdin, so piped input still works; without a terminal, pass `--yes` or turn the confirmations off in the config.
29
+
30
+ Model output is rendered as markdown (headings, emphasis, lists, tables, highlighted code) when stdout is a terminal; set `NO_COLOR` or redirect stdout for plain text. Runs of read-only tool calls collapse to one `reading N files...` line; `-v` shows every call.
31
+
32
+ ## Tools
33
+
34
+ | Tool | Asks? | What it does |
35
+ |---|---|---|
36
+ | `read_file(path, offset?, limit?)` | no | Read a text file, optionally a window of lines. Binary files are refused. |
37
+ | `glob(pattern, path?)` | no | List files matching a glob, gitignore-aware, at most 500. |
38
+ | `grep(pattern, path?, include?)` | no | Regex search returning `file:line:text`, gitignore-aware, at most 200 lines. |
39
+ | `list_dir(path)` | no | Entries with type and size. |
40
+ | `edit_file(path, old, new)` | diff | Replace `old` with `new`; `old` must occur exactly once, otherwise the model is told how many matches there were. |
41
+ | `write_file(path, content)` | diff | Create or overwrite a file. |
42
+ | `bash(command)` | unless allow-listed | Run a shell command in the working directory. |
43
+
44
+ Tool results over 50 KiB are cut with a marker telling the model to page with `read_file`'s `offset` and `limit`.
45
+
46
+ ## Context and AIRLOK.md
47
+
48
+ Every run starts with a context block in the system prompt: the working directory, OS and shell, the git branch with `git status --short` and the last five commit subjects, a gitignore-aware file tree (four levels, at most 200 entries), and project instructions. Instructions come from `AIRLOK.md` in the repository root, or `CLAUDE.md` or `AGENTS.md` if there is no `AIRLOK.md`, followed by `~/.config/airlok/AIRLOK.md`. The block goes through the redactor like everything else, and `airlok context` prints exactly what would be sent.
49
+
50
+ A short `AIRLOK.md`:
51
+
52
+ ```markdown
53
+ # airlok instructions
54
+
55
+ - Run `cargo test --workspace` before saying a change is done.
56
+ - Never touch files under `vendor/`.
57
+ - Commit messages: imperative subject, no trailing period.
58
+ ```
59
+
60
+ `[context] max_bytes` (default 32768) caps the block; the tree is cut to top-level directories first, then the instructions are truncated.
28
61
 
29
62
  ## Configuration
30
63
 
@@ -50,6 +83,9 @@ confirm_writes = true # show a diff and ask before write_file / edit_file
50
83
  confirm_bash = true # ask before running a command that is not allow-listed
51
84
  bash_allowlist = ["git status", "git diff", "ls", "cat", "pwd", "find", "grep", "rg", "cargo check", "cargo test", "cargo build"]
52
85
  bash_denylist = ["rm -rf", "git push --force", "sudo"]
86
+
87
+ [context]
88
+ max_bytes = 32768 # cap on the context block; tree is cut first, then instructions
53
89
  ```
54
90
 
55
91
  For openai, `base_url` falls back to the `OPENAI_BASE_URL` environment variable when the config does not set it.
@@ -19,7 +19,7 @@
19
19
  "hasInstallScript": true,
20
20
  "license": "MIT OR Apache-2.0",
21
21
  "name": "airlok",
22
- "version": "0.2.2"
22
+ "version": "0.3.0"
23
23
  },
24
24
  "node_modules/detect-libc": {
25
25
  "engines": {
@@ -48,5 +48,5 @@
48
48
  }
49
49
  },
50
50
  "requires": true,
51
- "version": "0.2.2"
51
+ "version": "0.3.0"
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "artifactDownloadUrls": [
3
- "https://github.com/airlok-dev/airlok/releases/download/v0.2.2"
3
+ "https://github.com/airlok-dev/airlok/releases/download/v0.3.0"
4
4
  ],
5
5
  "bin": {
6
6
  "airlok": "run-airlok.js"
@@ -60,7 +60,7 @@
60
60
  "zipExt": ".tar.xz"
61
61
  }
62
62
  },
63
- "version": "0.2.2",
63
+ "version": "0.3.0",
64
64
  "volta": {
65
65
  "node": "18.14.1",
66
66
  "npm": "9.5.0"