@khalilgharbaoui/opencode-claude-code-plugin 0.4.13 → 0.4.15
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/README.md +18 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -321,11 +321,28 @@ Set `permissionMode: "plan"` to forward `--permission-mode plan` to Claude. The
|
|
|
321
321
|
|
|
322
322
|
## Debug logging
|
|
323
323
|
|
|
324
|
+
Two independent knobs:
|
|
325
|
+
|
|
324
326
|
```bash
|
|
327
|
+
# Verbose logging to stderr (opencode surfaces stderr as UI warnings):
|
|
325
328
|
DEBUG=opencode-claude-code opencode
|
|
329
|
+
|
|
330
|
+
# Persistent file log (default: OFF — file is not created at all):
|
|
331
|
+
OPENCODE_CLAUDE_CODE_LOG_FILE=1 opencode
|
|
332
|
+
|
|
333
|
+
# Both:
|
|
334
|
+
DEBUG=opencode-claude-code OPENCODE_CLAUDE_CODE_LOG_FILE=1 opencode
|
|
326
335
|
```
|
|
327
336
|
|
|
328
|
-
|
|
337
|
+
When `OPENCODE_CLAUDE_CODE_LOG_FILE` is set to any truthy value (`1`,
|
|
338
|
+
`true`, `yes`, `on`), the plugin writes NOTICE/WARN/ERROR (plus INFO and
|
|
339
|
+
DEBUG when `DEBUG=opencode-claude-code` is also set) to
|
|
340
|
+
`~/.local/share/opencode-claude-code/plugin.log` with 5MB rotation. Override
|
|
341
|
+
the directory with `OPENCODE_CLAUDE_CODE_LOG_DIR=/custom/path`.
|
|
342
|
+
|
|
343
|
+
Default is off so the plugin doesn't accrete a log file on every user's
|
|
344
|
+
disk. Opt in when you need to inspect auto-continue decisions, broker
|
|
345
|
+
state, or other plugin internals.
|
|
329
346
|
|
|
330
347
|
## Known limitations
|
|
331
348
|
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,13 @@ var DEBUG = process.env.DEBUG?.includes("opencode-claude-code") ?? false;
|
|
|
9
9
|
var LOG_DIR = process.env.OPENCODE_CLAUDE_CODE_LOG_DIR ?? join(homedir(), ".local", "share", "opencode-claude-code");
|
|
10
10
|
var LOG_FILE = join(LOG_DIR, "plugin.log");
|
|
11
11
|
var MAX_LOG_BYTES = 5 * 1024 * 1024;
|
|
12
|
+
function isTruthyEnv(v) {
|
|
13
|
+
if (v == null) return false;
|
|
14
|
+
const s = v.toLowerCase().trim();
|
|
15
|
+
if (s === "") return false;
|
|
16
|
+
return s !== "0" && s !== "false" && s !== "no" && s !== "off";
|
|
17
|
+
}
|
|
18
|
+
var LOG_FILE_ENABLED = isTruthyEnv(process.env.OPENCODE_CLAUDE_CODE_LOG_FILE);
|
|
12
19
|
var fileLoggingDisabled = false;
|
|
13
20
|
function rotateIfNeeded() {
|
|
14
21
|
try {
|
|
@@ -20,6 +27,7 @@ function rotateIfNeeded() {
|
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
function writeToFile(line) {
|
|
30
|
+
if (!LOG_FILE_ENABLED) return;
|
|
23
31
|
if (fileLoggingDisabled) return;
|
|
24
32
|
try {
|
|
25
33
|
mkdirSync(dirname(LOG_FILE), { recursive: true });
|
|
@@ -1563,9 +1571,15 @@ function looksLikeBlocker(text) {
|
|
|
1563
1571
|
}
|
|
1564
1572
|
function looksLikeFinalAnswer(text) {
|
|
1565
1573
|
const normalized = normalizeVisibleText(text).toLowerCase();
|
|
1566
|
-
if (normalized.length < 30) return false;
|
|
1567
1574
|
if (looksLikeQuestion(normalized) || looksLikeBlocker(normalized)) return false;
|
|
1568
|
-
|
|
1575
|
+
if (/\b(we'?re done|we are done|all done|all set)\b/.test(normalized)) {
|
|
1576
|
+
return true;
|
|
1577
|
+
}
|
|
1578
|
+
if (normalized.length < 30) return false;
|
|
1579
|
+
return /\b(done|completed|fixed|implemented|verified|published|released|sent|delivered|updated|shipped|deployed|merged|tagged|live|pinned)\b/.test(normalized) || // v0.4.15: also accept present-tense "tests pass" / "checks pass".
|
|
1580
|
+
// Real fire 03:31 ended in "78/78 tests pass" — past-tense-only regex
|
|
1581
|
+
// missed it.
|
|
1582
|
+
/\b(checks?|tests?) (?:pass|passes|passed)\b/.test(normalized) || /\b(summary|what changed|verification)\b/.test(normalized);
|
|
1569
1583
|
}
|
|
1570
1584
|
function continuationSignature(snapshot) {
|
|
1571
1585
|
const text = normalizeVisibleText(snapshot.text).slice(-500);
|