opencodekit 0.18.10 → 0.18.11

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/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
18
18
 
19
19
  //#endregion
20
20
  //#region package.json
21
- var version = "0.18.10";
21
+ var version = "0.18.11";
22
22
 
23
23
  //#endregion
24
24
  //#region src/utils/errors.ts
@@ -306,6 +306,17 @@ For major tracked work:
306
306
  4. **EDIT** — Include 2-3 unique context lines before/after
307
307
  5. **CONFIRM** — Read back to verify edit succeeded
308
308
 
309
+ ### Write Tool Safety (Runtime Guard)
310
+
311
+ OpenCode enforces a **hard runtime check**: you must Read a file before Writing to it. This is not a prompt suggestion — it's a `FileTime.assert()` call that throws if no read timestamp exists for the file in the current session.
312
+
313
+ - **Existing files**: Always `Read` before `Write`. The Write tool will reject overwrites without a prior Read.
314
+ - **New files**: Write freely — the guard only fires for files that already exist.
315
+ - **Edit tool**: Same guard applies. Read first, then Edit.
316
+ - **Failure**: `"You must read file X before overwriting it. Use the Read tool first"`
317
+
318
+ **Rule**: Never use Write on an existing file without Reading it first in the same session. Prefer Edit for modifications; reserve Write for new file creation or full replacements after Read.
319
+
309
320
  ### File Size Guidance
310
321
 
311
322
  Files over ~500 lines become hard to maintain and review. Extract helpers, split modules, or refactor when approaching this threshold.
@@ -72,7 +72,7 @@ Implement requested work, verify with fresh evidence, and coordinate subagents o
72
72
  ### Scope Discipline
73
73
 
74
74
  - Stay in scope; no speculative refactors or bonus features
75
- - Read files before editing
75
+ - **Read files before editing or writing** — Write tool rejects overwrites without a prior Read (runtime guard)
76
76
  - Delegate when work is large, uncertain, or cross-domain
77
77
 
78
78
  ### Verification as Calibration
@@ -52,7 +52,7 @@ Execute clear, low-complexity coding tasks quickly (typically 1-3 files) and rep
52
52
 
53
53
  ## Rules
54
54
 
55
- - Read code before editing
55
+ - **Read before editing or writing** — Write/Edit tools reject changes to existing files without a prior Read (runtime guard)
56
56
  - Keep changes minimal and in-scope
57
57
  - Ask before irreversible actions (commit, push, destructive ops)
58
58
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencodekit",
3
- "version": "0.18.10",
3
+ "version": "0.18.11",
4
4
  "description": "CLI tool for bootstrapping and managing OpenCodeKit projects",
5
5
  "keywords": [
6
6
  "agents",