@christang/keel 5.144.0 → 5.146.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/.claude-plugin/plugin.json +1 -1
- package/assets/bootstrap/AGENTS.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/scripts/validate_plugin.py +182 -2
- package/src/core/chat/notice.js +41 -4
- package/src/core/gates.js +9 -4
- package/src/core/shift.js +17 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.146.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.146.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.146.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.146.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.146.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -49,8 +49,8 @@ REQUIRED_SCRIPTS = [
|
|
|
49
49
|
"scripts/validate_plugin.py",
|
|
50
50
|
]
|
|
51
51
|
|
|
52
|
-
PACKAGE_VERSION = "5.
|
|
53
|
-
PROTOCOL_VERSION = "5.
|
|
52
|
+
PACKAGE_VERSION = "5.146.0"
|
|
53
|
+
PROTOCOL_VERSION = "5.146.0"
|
|
54
54
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
55
55
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
56
56
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -6373,6 +6373,91 @@ def validate_shift_keeps_transcripts_scenario() -> int:
|
|
|
6373
6373
|
return 0
|
|
6374
6374
|
|
|
6375
6375
|
|
|
6376
|
+
def validate_shift_keeps_found_transcripts_scenario() -> int:
|
|
6377
|
+
"""Issue #361: a transcript `history` finds but never recorded is kept too.
|
|
6378
|
+
|
|
6379
|
+
Transcripts from before segments were recorded (#304) are listed
|
|
6380
|
+
`(found)`; the hook copied only recorded segments, and `history` read a
|
|
6381
|
+
copy only through a segment record, so the oldest conversations were the
|
|
6382
|
+
ones left unkept.
|
|
6383
|
+
"""
|
|
6384
|
+
label = "shift-keeps-found-transcripts:"
|
|
6385
|
+
with tempfile.TemporaryDirectory(prefix="keel-shift-361-") as raw:
|
|
6386
|
+
base = Path(raw)
|
|
6387
|
+
rtl, verify, env, _ = shift_scratch(base)
|
|
6388
|
+
kept_dir = mailbox_common_dir(rtl) / "keel-chat" / "shift" / "transcripts" / "verify"
|
|
6389
|
+
roles = json.loads((mailbox_common_dir(rtl) / "keel-chat" / "roles.json").read_text(encoding="utf-8"))
|
|
6390
|
+
bound = next(path for path, role in roles.items() if role == "verify")
|
|
6391
|
+
project = base / "claude-config" / "projects" / re.sub(r"[^A-Za-z0-9]", "-", bound)
|
|
6392
|
+
project.mkdir(parents=True)
|
|
6393
|
+
env = {**env, "CLAUDE_CONFIG_DIR": str(base / "claude-config")}
|
|
6394
|
+
|
|
6395
|
+
def transcript(name: str, opening: str, said: str) -> Path:
|
|
6396
|
+
path = project / f"{name}.jsonl"
|
|
6397
|
+
path.write_text("\n".join(json.dumps(record) for record in (
|
|
6398
|
+
{"type": "user", "timestamp": "2026-10-02T01:00:00.000Z", "cwd": bound, "message": {"role": "user", "content": opening}},
|
|
6399
|
+
{"type": "assistant", "timestamp": "2026-10-02T01:00:05.000Z", "cwd": bound,
|
|
6400
|
+
"message": {"role": "assistant", "content": [{"type": "text", "text": said}]}},
|
|
6401
|
+
)) + "\n", encoding="utf-8")
|
|
6402
|
+
return path
|
|
6403
|
+
|
|
6404
|
+
def hook(path: Path) -> None:
|
|
6405
|
+
for event, name in (("session-start", "SessionStart"), ("user-prompt-submit", "UserPromptSubmit")):
|
|
6406
|
+
subprocess.run(
|
|
6407
|
+
["node", str(ROOT / "bin" / "keel.js"), "chat", "hook", event],
|
|
6408
|
+
cwd=verify, env=env, text=True, capture_output=True, check=False,
|
|
6409
|
+
input=json.dumps({"cwd": str(verify), "hook_event_name": name, "session_id": "s1",
|
|
6410
|
+
"prompt": "go", "source": "startup", "transcript_path": str(path)}),
|
|
6411
|
+
)
|
|
6412
|
+
|
|
6413
|
+
old = transcript("old", "start the shift", "The ECC syndrome table was settled on day one.")
|
|
6414
|
+
scheduled = transcript("patrol", '<scheduled-task name="patrol">run', "patrol ran")
|
|
6415
|
+
listed = run_keel(verify, "shift", "history", "verify", env=env)
|
|
6416
|
+
if "(found)" not in next((l for l in listed.stdout.splitlines() if "old.jsonl" in l), ""):
|
|
6417
|
+
report(f"{label} the unrecorded transcript is not listed as found: {listed.stdout!r} {listed.stderr!r}")
|
|
6418
|
+
return 1
|
|
6419
|
+
hook(transcript("a", "carry on", "first recorded shift"))
|
|
6420
|
+
hook(transcript("b", "carry on", "second recorded shift"))
|
|
6421
|
+
kept_old = kept_dir / "old.jsonl.gz"
|
|
6422
|
+
if not kept_old.is_file():
|
|
6423
|
+
report(f"{label} a segment change left the found transcript unkept: "
|
|
6424
|
+
f"{sorted(p.name for p in kept_dir.glob('*')) if kept_dir.exists() else 'no directory'}")
|
|
6425
|
+
return 1
|
|
6426
|
+
if gzip.decompress(kept_old.read_bytes()) != old.read_bytes():
|
|
6427
|
+
report(f"{label} the found transcript's copy is not its bytes.")
|
|
6428
|
+
return 1
|
|
6429
|
+
if (kept_dir / "patrol.jsonl.gz").exists():
|
|
6430
|
+
report(f"{label} a scheduled run's transcript was kept as the role's conversation.")
|
|
6431
|
+
return 1
|
|
6432
|
+
if (kept_dir / "b.jsonl.gz").exists():
|
|
6433
|
+
report(f"{label} the current transcript was copied while it is still being written.")
|
|
6434
|
+
return 1
|
|
6435
|
+
|
|
6436
|
+
old.unlink()
|
|
6437
|
+
listed = run_keel(verify, "shift", "history", "verify", env=env)
|
|
6438
|
+
line = next((l for l in listed.stdout.splitlines() if "old.jsonl" in l), "")
|
|
6439
|
+
if "(missing)" in line:
|
|
6440
|
+
report(f"{label} the found transcript, deleted but kept, is listed missing: {listed.stdout!r}")
|
|
6441
|
+
return 1
|
|
6442
|
+
if "(kept)" not in line:
|
|
6443
|
+
report(f"{label} the found transcript, deleted but kept, is not listed (kept): {listed.stdout!r}")
|
|
6444
|
+
return 1
|
|
6445
|
+
found = run_keel(verify, "shift", "history", "verify", "--grep", "syndrome table", env=env)
|
|
6446
|
+
if "syndrome table" not in found.stdout:
|
|
6447
|
+
report(f"{label} --grep does not search the found transcript's copy: {found.stdout!r} {found.stderr!r}")
|
|
6448
|
+
return 1
|
|
6449
|
+
hook(transcript("c", "carry on", "third recorded shift"))
|
|
6450
|
+
listed = run_keel(verify, "shift", "history", "verify", env=env)
|
|
6451
|
+
if sum(1 for l in listed.stdout.splitlines() if "old.jsonl" in l) != 1:
|
|
6452
|
+
report(f"{label} another segment change did not leave the kept found transcript listed once: {listed.stdout!r}")
|
|
6453
|
+
return 1
|
|
6454
|
+
if "shift-keeps-found-transcripts" not in {name for name, _ in SCENARIOS}:
|
|
6455
|
+
report(f"{label} scenario is not registered.")
|
|
6456
|
+
return 1
|
|
6457
|
+
report("shift-keeps-found-transcripts scenario passed.")
|
|
6458
|
+
return 0
|
|
6459
|
+
|
|
6460
|
+
|
|
6376
6461
|
def validate_shift_history_scenario() -> int:
|
|
6377
6462
|
"""Issue #304: a cleared shift's conversation stays findable.
|
|
6378
6463
|
|
|
@@ -39067,6 +39152,96 @@ def validate_a_claim_names_what_would_falsify_it_scenario() -> int:
|
|
|
39067
39152
|
return 0
|
|
39068
39153
|
|
|
39069
39154
|
|
|
39155
|
+
def validate_a_listed_marker_opens_its_clause_scenario() -> int:
|
|
39156
|
+
"""Issue #362: a disposition written as a sub-list item was read as prose.
|
|
39157
|
+
|
|
39158
|
+
A `Findings` value whose marker sits on its own `- ` line under the label
|
|
39159
|
+
reached the marker scan as a line break, indentation and `- `; the opening
|
|
39160
|
+
rule allowed only indentation after a break, so `Resolved here: M1` read as
|
|
39161
|
+
a mid-sentence mention and the entry was refused `finding-owner`, while the
|
|
39162
|
+
same text on the label's own line passed.
|
|
39163
|
+
"""
|
|
39164
|
+
label = "a-listed-marker-opens-its-clause"
|
|
39165
|
+
|
|
39166
|
+
def findings_task(findings: list[str]) -> str:
|
|
39167
|
+
return "\n".join(
|
|
39168
|
+
[
|
|
39169
|
+
"- [x] 1.1 Findings probe",
|
|
39170
|
+
" - Owner: claude",
|
|
39171
|
+
" - Mode: implementation",
|
|
39172
|
+
" - Covers:",
|
|
39173
|
+
" - E1: the task proves its own behavior",
|
|
39174
|
+
" - Read:",
|
|
39175
|
+
" - README.md",
|
|
39176
|
+
" - Touch:",
|
|
39177
|
+
" - src/example.js",
|
|
39178
|
+
" - Verify:",
|
|
39179
|
+
" - Strategy: vertical-tdd",
|
|
39180
|
+
" - M1: node test.js asserts the public behavior",
|
|
39181
|
+
" - Evidence:",
|
|
39182
|
+
" - Contract: pending",
|
|
39183
|
+
" - M1: pass. node test.js reported the behavior.",
|
|
39184
|
+
" - M1.red: fail. the behavior did not exist.",
|
|
39185
|
+
" - M1.green: pass.",
|
|
39186
|
+
" - Review:",
|
|
39187
|
+
" - Status: pass",
|
|
39188
|
+
" - Acceptance check: the behavior is proven.",
|
|
39189
|
+
" - Scope check: only Touch changed.",
|
|
39190
|
+
" - Findings:",
|
|
39191
|
+
*[f" - {item}" for item in findings],
|
|
39192
|
+
" - Blocker: none",
|
|
39193
|
+
" - Reauthorizations: none",
|
|
39194
|
+
]
|
|
39195
|
+
)
|
|
39196
|
+
|
|
39197
|
+
with tempfile.TemporaryDirectory(prefix="keel-listed-marker-") as raw:
|
|
39198
|
+
root = Path(raw)
|
|
39199
|
+
|
|
39200
|
+
def complete(name: str, *findings: str) -> dict:
|
|
39201
|
+
repo = root / name
|
|
39202
|
+
write_gate_fixture(repo, tasks=findings_task(list(findings)))
|
|
39203
|
+
write_text(repo / "flow/Makefile", "all:\n")
|
|
39204
|
+
run_keel(repo, "gate", "task-start", "--change", "demo", "--task", "1.1", "--record", "--json")
|
|
39205
|
+
done = run_keel(repo, "gate", "task-complete", "--change", "demo", "--task", "1.1", "--json")
|
|
39206
|
+
try:
|
|
39207
|
+
return json.loads(done.stdout)
|
|
39208
|
+
except json.JSONDecodeError:
|
|
39209
|
+
return {"status": "unparsed", "problems": [{"message": done.stdout[:400]}]}
|
|
39210
|
+
|
|
39211
|
+
# The forms #362 reported refused, each as a sub-list item.
|
|
39212
|
+
for name, items in (
|
|
39213
|
+
("check", ["Resolved here: M1"]),
|
|
39214
|
+
("path", ["Resolved here: flow/Makefile"]),
|
|
39215
|
+
("path-then-cjk-sentence", ["Resolved here: flow/Makefile。规则已改为按点名运行。"]),
|
|
39216
|
+
("two-items", ["Resolved here: M1", "Discard reason: out of scope."]),
|
|
39217
|
+
):
|
|
39218
|
+
payload = complete(name, *items)
|
|
39219
|
+
if payload.get("status") != "pass":
|
|
39220
|
+
report(f"{label}: a sub-list {items!r} is not read as a disposition ({name}); "
|
|
39221
|
+
f"{problem_codes(payload)!r} {problem_text(payload)!r}.")
|
|
39222
|
+
return 1
|
|
39223
|
+
|
|
39224
|
+
# The control: a listed claim is held to the evidence rule, not waved through.
|
|
39225
|
+
payload = complete("unknown-check", "Resolved here: M9")
|
|
39226
|
+
if "M9" not in problem_text(payload):
|
|
39227
|
+
report(f"{label}: a sub-list `Resolved here: M9` naming an undeclared check was not refused "
|
|
39228
|
+
f"for that check; {problem_codes(payload)!r} {problem_text(payload)!r}.")
|
|
39229
|
+
return 1
|
|
39230
|
+
|
|
39231
|
+
# A negation on a listed line is still a negation (#144).
|
|
39232
|
+
payload = complete("negated", "Not resolved here: a different module. Durable owner: https://example.com/issues/1")
|
|
39233
|
+
if payload.get("status") != "pass":
|
|
39234
|
+
report(f"{label}: a listed negation was refused; "
|
|
39235
|
+
f"{problem_codes(payload)!r} {problem_text(payload)!r}.")
|
|
39236
|
+
return 1
|
|
39237
|
+
|
|
39238
|
+
if "a-listed-marker-opens-its-clause" not in {name for name, _ in SCENARIOS}:
|
|
39239
|
+
report(f"{label}: scenario is not registered.")
|
|
39240
|
+
return 1
|
|
39241
|
+
report(f"{label} scenario passed.")
|
|
39242
|
+
return 0
|
|
39243
|
+
|
|
39244
|
+
|
|
39070
39245
|
def validate_a_negation_is_not_a_marker_scenario() -> int:
|
|
39071
39246
|
"""Issue #144: `Not resolved here:` was read as `Resolved here:`.
|
|
39072
39247
|
|
|
@@ -41445,6 +41620,7 @@ SCENARIOS: tuple = (
|
|
|
41445
41620
|
("owner-language-after-tools", validate_owner_language_after_tools_scenario),
|
|
41446
41621
|
("shift-history", validate_shift_history_scenario),
|
|
41447
41622
|
("shift-keeps-transcripts", validate_shift_keeps_transcripts_scenario),
|
|
41623
|
+
("shift-keeps-found-transcripts", validate_shift_keeps_found_transcripts_scenario),
|
|
41448
41624
|
("role-drift", validate_role_drift_scenario),
|
|
41449
41625
|
("host-run-session", validate_host_run_session_scenario),
|
|
41450
41626
|
("shift-without-role", validate_shift_without_role_scenario),
|
|
@@ -41610,6 +41786,10 @@ SCENARIOS: tuple = (
|
|
|
41610
41786
|
"a-negation-is-not-a-marker",
|
|
41611
41787
|
validate_a_negation_is_not_a_marker_scenario,
|
|
41612
41788
|
),
|
|
41789
|
+
(
|
|
41790
|
+
"a-listed-marker-opens-its-clause",
|
|
41791
|
+
validate_a_listed_marker_opens_its_clause_scenario,
|
|
41792
|
+
),
|
|
41613
41793
|
(
|
|
41614
41794
|
"an-equivalence-claim-names-its-base",
|
|
41615
41795
|
validate_an_equivalence_claim_names_its_base_scenario,
|
package/src/core/chat/notice.js
CHANGED
|
@@ -268,6 +268,13 @@ function keptFile(where, role, transcript) {
|
|
|
268
268
|
// copy. The host deletes transcripts after its cleanup period (30 days by
|
|
269
269
|
// default for Claude), so the copy is what keeps a shift's conversation. The
|
|
270
270
|
// current segment is left alone: it is still being written.
|
|
271
|
+
function writeKept(target, transcript) {
|
|
272
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
273
|
+
const temporary = `${target}.${process.pid}.tmp`;
|
|
274
|
+
fs.writeFileSync(temporary, zlib.gzipSync(fs.readFileSync(transcript)));
|
|
275
|
+
fs.renameSync(temporary, target);
|
|
276
|
+
}
|
|
277
|
+
|
|
271
278
|
function keepEnded(where, role, segments) {
|
|
272
279
|
for (const segment of segments) {
|
|
273
280
|
if (!segment.ended || !segment.transcript) continue;
|
|
@@ -276,16 +283,45 @@ function keepEnded(where, role, segments) {
|
|
|
276
283
|
const target = keptFile(where, role, segment.transcript);
|
|
277
284
|
const kept = segment.kept_from;
|
|
278
285
|
if (fs.existsSync(target) && kept && kept.size === source.size && kept.mtime === source.mtimeMs) continue;
|
|
279
|
-
|
|
280
|
-
const temporary = `${target}.${process.pid}.tmp`;
|
|
281
|
-
fs.writeFileSync(temporary, zlib.gzipSync(fs.readFileSync(segment.transcript)));
|
|
282
|
-
fs.renameSync(temporary, target);
|
|
286
|
+
writeKept(target, segment.transcript);
|
|
283
287
|
segment.kept = target;
|
|
284
288
|
segment.kept_from = { size: source.size, mtime: source.mtimeMs };
|
|
285
289
|
} catch {
|
|
286
290
|
// The host's file may already be gone; a copy is a convenience.
|
|
287
291
|
}
|
|
288
292
|
}
|
|
293
|
+
keepFound(where, role, segments);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// The transcripts `history` finds for the role but no record names — those
|
|
297
|
+
// from before segments were recorded (#304) — are kept too, and recorded,
|
|
298
|
+
// still marked found, so `history` lists them once the host's file is gone
|
|
299
|
+
// and later changes refresh their copy like any other ended segment (#361).
|
|
300
|
+
// Each is read once, when it is first recorded.
|
|
301
|
+
function keepFound(where, role, segments) {
|
|
302
|
+
const recorded = new Set(segments.map((segment) => segment.transcript));
|
|
303
|
+
let found = [];
|
|
304
|
+
try {
|
|
305
|
+
found = require("../shift").foundTranscripts(where, role, (transcript) => !recorded.has(transcript));
|
|
306
|
+
} catch {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const added = [];
|
|
310
|
+
for (const segment of found) {
|
|
311
|
+
if (recorded.has(segment.transcript)) continue;
|
|
312
|
+
recorded.add(segment.transcript);
|
|
313
|
+
try {
|
|
314
|
+
const source = fs.statSync(segment.transcript);
|
|
315
|
+
const target = keptFile(where, role, segment.transcript);
|
|
316
|
+
// A copy at least as new as the transcript, such as one made by hand, is kept as it is.
|
|
317
|
+
if (!fs.existsSync(target) || fs.statSync(target).mtimeMs < source.mtimeMs) writeKept(target, segment.transcript);
|
|
318
|
+
added.push({ ...segment, kept: target, kept_from: { size: source.size, mtime: source.mtimeMs } });
|
|
319
|
+
} catch {
|
|
320
|
+
// As for a recorded segment, a copy is a convenience.
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// The current segment stays last: `recordSegment` reads it there.
|
|
324
|
+
segments.splice(Math.max(segments.length - 1, 0), 0, ...added);
|
|
289
325
|
}
|
|
290
326
|
|
|
291
327
|
function recordSegment(where, role, transcript) {
|
|
@@ -485,6 +521,7 @@ module.exports = {
|
|
|
485
521
|
wakeStep,
|
|
486
522
|
check,
|
|
487
523
|
bridgeLine,
|
|
524
|
+
keptFile,
|
|
488
525
|
hook,
|
|
489
526
|
noticeText,
|
|
490
527
|
presenceFile,
|
package/src/core/gates.js
CHANGED
|
@@ -1039,8 +1039,8 @@ function transientOwnerMessage(candidate) {
|
|
|
1039
1039
|
// global because each resolved claim owes its own evidence; checking only the
|
|
1040
1040
|
// first would let a second one assert itself for free.
|
|
1041
1041
|
// A marker is a disposition only where it OPENS its clause: the start of the
|
|
1042
|
-
// value, a line break, or sentence-ending punctuation may precede it,
|
|
1043
|
-
// may not. `Not resolved here:` contains the marker and means its opposite, and a
|
|
1042
|
+
// value, a line break, or sentence-ending punctuation may precede it, each
|
|
1043
|
+
// optionally followed by a list item's bullet, and a word may not. `Not resolved here:` contains the marker and means its opposite, and a
|
|
1044
1044
|
// `\b` boundary sat happily at the space inside it — the negation was read as a
|
|
1045
1045
|
// resolution claim and the next word, `it`, as its evidence, so a dismissal was
|
|
1046
1046
|
// read as a repair and then refused for lacking repair evidence (issue #144).
|
|
@@ -1050,7 +1050,12 @@ function transientOwnerMessage(candidate) {
|
|
|
1050
1050
|
// Written as a lookbehind so the captures keep reading from the same offsets —
|
|
1051
1051
|
// every rule here is positional, and a rule that shortened the text would move
|
|
1052
1052
|
// what they read.
|
|
1053
|
-
|
|
1053
|
+
//
|
|
1054
|
+
// A Findings written as a sub-list reaches this scan as a line break, the
|
|
1055
|
+
// item's indentation and its bullet, so the bullet is an opening too: without
|
|
1056
|
+
// it `- Resolved here: M1` read as a mid-sentence mention and was refused for
|
|
1057
|
+
// carrying no disposition, while the same text on the label's line passed (#362).
|
|
1058
|
+
const CLAUSE_OPENING = "(?<=^|[\\n.;:!?\u2014\u2013])[ \\t]*(?:[-*+][ \\t]+)?";
|
|
1054
1059
|
|
|
1055
1060
|
const RESOLVED_HERE = new RegExp(
|
|
1056
1061
|
`${CLAUSE_OPENING}resolved here\\s*:[ \\t]*(\\S*)`,
|
|
@@ -1684,7 +1689,7 @@ function completionChecks(repo, task, contract = null, changeVerify = null, chan
|
|
|
1684
1689
|
+ (mentionsUnopenedMarker(scannable)
|
|
1685
1690
|
? " A marker counts only where it opens its clause — after the "
|
|
1686
1691
|
+ "start of the value, a line break, or sentence-ending "
|
|
1687
|
-
+ "punctuation. This text mentions one mid-sentence, so it was "
|
|
1692
|
+
+ "punctuation, or the bullet of a list item. This text mentions one mid-sentence, so it was "
|
|
1688
1693
|
+ "read as prose; move it to the start of its own clause, or "
|
|
1689
1694
|
+ "keep it as prose and add the disposition separately."
|
|
1690
1695
|
: "")
|
package/src/core/shift.js
CHANGED
|
@@ -707,7 +707,8 @@ function grepTranscript(file, needle, limit = 3) {
|
|
|
707
707
|
|
|
708
708
|
// Transcripts Claude already keeps for a worktree (#304 D6, F5): its project
|
|
709
709
|
// directory is the cwd with every non-alphanumeric character turned into `-`.
|
|
710
|
-
|
|
710
|
+
// `wanted` is asked before a file is read, so a caller can skip the parse.
|
|
711
|
+
function claudeTranscripts(worktree, wanted = () => true) {
|
|
711
712
|
const config = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude");
|
|
712
713
|
const found = [];
|
|
713
714
|
for (const cwd of new Set([worktree, realpath(worktree)])) {
|
|
@@ -715,6 +716,7 @@ function claudeTranscripts(worktree) {
|
|
|
715
716
|
for (const name of safeList(dir)) {
|
|
716
717
|
if (!name.endsWith(".jsonl")) continue;
|
|
717
718
|
const file = path.join(dir, name);
|
|
719
|
+
if (!wanted(file)) continue;
|
|
718
720
|
let first = null;
|
|
719
721
|
let last = null;
|
|
720
722
|
let opening = null;
|
|
@@ -741,6 +743,13 @@ function claudeTranscripts(worktree) {
|
|
|
741
743
|
return found;
|
|
742
744
|
}
|
|
743
745
|
|
|
746
|
+
// The Claude transcripts of every worktree bound to `role`, scheduled runs left out.
|
|
747
|
+
function foundTranscripts(where, role, wanted) {
|
|
748
|
+
const bound = Object.entries(store.readJsonFile(path.join(where.root, "roles.json")))
|
|
749
|
+
.filter(([, name]) => name === role).map(([worktree]) => worktree);
|
|
750
|
+
return bound.flatMap((worktree) => claudeTranscripts(worktree, wanted));
|
|
751
|
+
}
|
|
752
|
+
|
|
744
753
|
function history(where, named, grep) {
|
|
745
754
|
const role = named || store.currentRole(where);
|
|
746
755
|
if (!role) throw new ShiftError("keel shift history needs a role: name it, or run it in a worktree bound to one.");
|
|
@@ -749,9 +758,11 @@ function history(where, named, grep) {
|
|
|
749
758
|
const stored = fs.existsSync(file) ? store.readJsonFile(file).segments : [];
|
|
750
759
|
const recorded = Array.isArray(stored) ? stored : [];
|
|
751
760
|
const known = new Set(recorded.map((segment) => segment.transcript));
|
|
752
|
-
const
|
|
753
|
-
|
|
754
|
-
|
|
761
|
+
const earlier = foundTranscripts(where, role).filter((segment) => !known.has(segment.transcript));
|
|
762
|
+
const { keptFile } = require("./chat/notice");
|
|
763
|
+
// A found segment has no record to name its copy, so the kept path is looked at directly (#361).
|
|
764
|
+
const keptCopy = (segment) => [segment.kept, keptFile(where, role, segment.transcript)]
|
|
765
|
+
.find((file) => file && fs.existsSync(file)) || null;
|
|
755
766
|
const seen = new Set();
|
|
756
767
|
// Newest first; the sort is stable, so segments recorded in the same second keep their order.
|
|
757
768
|
const segments = [...recorded.slice().reverse(), ...earlier]
|
|
@@ -760,7 +771,7 @@ function history(where, named, grep) {
|
|
|
760
771
|
.map((segment) => ({
|
|
761
772
|
...segment,
|
|
762
773
|
exists: fs.existsSync(segment.transcript),
|
|
763
|
-
kept:
|
|
774
|
+
kept: keptCopy(segment),
|
|
764
775
|
}));
|
|
765
776
|
const notes = safeList(path.join(shiftDir(where), "history"))
|
|
766
777
|
.filter((name) => name.startsWith(`${role}-`) && name.endsWith(".md"))
|
|
@@ -1021,4 +1032,4 @@ function waitingFor(repo) {
|
|
|
1021
1032
|
}
|
|
1022
1033
|
|
|
1023
1034
|
module.exports = {
|
|
1024
|
-
desktopProcess, check, describe, runShift, shiftStatus: status, waitingFor };
|
|
1035
|
+
desktopProcess, foundTranscripts, check, describe, runShift, shiftStatus: status, waitingFor };
|