@christang/keel 5.110.0 → 5.111.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/README.md +4 -0
- 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/plugins/keel/scripts/session-start.js +7 -0
- package/scripts/validate_plugin.py +52 -2
- package/src/core/context.js +15 -0
- package/src/core/worktrees.js +18 -4
package/README.md
CHANGED
|
@@ -688,6 +688,10 @@ or, with no owner named, when another worktree's branch has commits touching it
|
|
|
688
688
|
branch and yours has none. Only committed history counts; uncommitted files never decide it. `keel
|
|
689
689
|
context --change <name>` still selects any change by name.
|
|
690
690
|
|
|
691
|
+
When nothing is selected, `keel context` and the session note also point at what the branch was
|
|
692
|
+
last working on (#278): up to five issues its commits beyond the default branch reference, newest
|
|
693
|
+
first — `recently referenced: #162, #182`. It is read from Git, and it selects nothing.
|
|
694
|
+
|
|
691
695
|
A session that never owns a change — review, verification, a coordinator — can be declared
|
|
692
696
|
read-only by its chat role (#246):
|
|
693
697
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.111.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.111.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.111.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.111.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",
|
|
@@ -653,6 +653,13 @@ function main() {
|
|
|
653
653
|
lines.push(`- ${drift}`);
|
|
654
654
|
human.splice(human.length - 1, 0, drift[0].toUpperCase() + drift.slice(1));
|
|
655
655
|
}
|
|
656
|
+
// What the branch was last working on, when idle (#278).
|
|
657
|
+
if (context.recent && Array.isArray(context.recent.issues) && context.recent.issues.length) {
|
|
658
|
+
lines.push(
|
|
659
|
+
`- recently referenced: ${context.recent.issues.map((n) => `#${n}`).join(", ")} `
|
|
660
|
+
+ `(commits in ${context.recent.range}; a pointer, not a selection).`
|
|
661
|
+
);
|
|
662
|
+
}
|
|
656
663
|
// The role other sessions address this one by (#245).
|
|
657
664
|
if (context.role) {
|
|
658
665
|
lines.push(`- chat role: ${context.role} (other sessions address this one by it).`);
|
|
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
|
|
|
47
47
|
"scripts/validate_plugin.py",
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
PACKAGE_VERSION = "5.
|
|
51
|
-
PROTOCOL_VERSION = "5.
|
|
50
|
+
PACKAGE_VERSION = "5.111.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.111.0"
|
|
52
52
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
53
53
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
54
54
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -8879,6 +8879,55 @@ def validate_session_role_identity_scenario() -> int:
|
|
|
8879
8879
|
return 0
|
|
8880
8880
|
|
|
8881
8881
|
|
|
8882
|
+
def validate_idle_recent_issues_scenario() -> int:
|
|
8883
|
+
"""Issue #278: an idle result points at the issues the branch referenced.
|
|
8884
|
+
|
|
8885
|
+
From Git alone, newest first and without repeats, in a separate field the
|
|
8886
|
+
session projection prints; nothing on the default branch.
|
|
8887
|
+
"""
|
|
8888
|
+
label = "idle-recent-issues:"
|
|
8889
|
+
with tempfile.TemporaryDirectory(prefix="keel-idle-recent-") as raw:
|
|
8890
|
+
base = Path(raw)
|
|
8891
|
+
repo = mailbox_repository(base / "repo")
|
|
8892
|
+
write_text(repo / "openspec/specs/.keep", "")
|
|
8893
|
+
subprocess.run(["git", "add", "-A"], cwd=repo, check=True, capture_output=True)
|
|
8894
|
+
subprocess.run(["git", "commit", "-q", "-m", "openspec"], cwd=repo, check=True, capture_output=True)
|
|
8895
|
+
work = chat_worktree(repo, base / "work")
|
|
8896
|
+
for message in ("fix the lock lease (#162)", "context per worktree, #182", "follow-up for #162"):
|
|
8897
|
+
subprocess.run(["git", "commit", "-q", "--allow-empty", "-m", message], cwd=work, check=True, capture_output=True)
|
|
8898
|
+
|
|
8899
|
+
def look(cwd: Path) -> tuple[dict, str]:
|
|
8900
|
+
context = json.loads(run_keel(cwd, "context", "--json").stdout)
|
|
8901
|
+
session = run_session_start_hook(
|
|
8902
|
+
cwd, {"hook_event_name": "SessionStart", "source": "compact", "cwd": str(cwd)},
|
|
8903
|
+
keel_cli=f'node "{ROOT / "bin" / "keel.js"}"',
|
|
8904
|
+
)
|
|
8905
|
+
return context, session_start_context(session) or ""
|
|
8906
|
+
|
|
8907
|
+
on_main, main_note = look(repo)
|
|
8908
|
+
context, note = look(work)
|
|
8909
|
+
if context.get("status") != "idle":
|
|
8910
|
+
report(f"{label} the worktree is {context.get('status')!r}, not idle.")
|
|
8911
|
+
return 1
|
|
8912
|
+
if (context.get("recent") or {}).get("issues") != [162, 182]:
|
|
8913
|
+
report(f"{label} recent is {context.get('recent')!r}, not issues [162, 182].")
|
|
8914
|
+
return 1
|
|
8915
|
+
if context.get("reasons") != on_main.get("reasons"):
|
|
8916
|
+
report(f"{label} recent issues changed the reasons: {context.get('reasons')!r}")
|
|
8917
|
+
return 1
|
|
8918
|
+
if "recently referenced: #162, #182" not in note:
|
|
8919
|
+
report(f"{label} the projection does not print the recent issues: {note!r}")
|
|
8920
|
+
return 1
|
|
8921
|
+
if "recent" in on_main:
|
|
8922
|
+
report(f"{label} the default branch carries recent: {on_main.get('recent')!r}")
|
|
8923
|
+
return 1
|
|
8924
|
+
if "recently referenced" in main_note:
|
|
8925
|
+
report(f"{label} the default branch's projection prints recent issues: {main_note!r}")
|
|
8926
|
+
return 1
|
|
8927
|
+
report("idle-recent-issues scenario passed.")
|
|
8928
|
+
return 0
|
|
8929
|
+
|
|
8930
|
+
|
|
8882
8931
|
def validate_read_only_role_scenario() -> int:
|
|
8883
8932
|
"""Issue #246: a role listed in `read_only_roles:` infers nothing.
|
|
8884
8933
|
|
|
@@ -38526,6 +38575,7 @@ SCENARIOS: tuple = (
|
|
|
38526
38575
|
("stateless-continuity", validate_stateless_continuity_scenario),
|
|
38527
38576
|
("context-per-worktree", validate_context_per_worktree_scenario),
|
|
38528
38577
|
("read-only-role", validate_read_only_role_scenario),
|
|
38578
|
+
("idle-recent-issues", validate_idle_recent_issues_scenario),
|
|
38529
38579
|
("session-role-identity", validate_session_role_identity_scenario),
|
|
38530
38580
|
("core-gates", validate_core_gates_scenario),
|
|
38531
38581
|
("scope-rename-attribution", validate_scope_rename_attribution_scenario),
|
package/src/core/context.js
CHANGED
|
@@ -812,6 +812,21 @@ function resolveContext(repo, options) {
|
|
|
812
812
|
// by role, and Keel cannot see the host's session title. A worktree with no
|
|
813
813
|
// role while others here have one is reminded; a repository that uses no
|
|
814
814
|
// roles hears nothing.
|
|
815
|
+
// An idle session gets a pointer at what its branch was working on (#278):
|
|
816
|
+
// Git alone, a separate field, never a reason or a selection.
|
|
817
|
+
if (context.status === "idle") {
|
|
818
|
+
try {
|
|
819
|
+
const { branchIssues, defaultBranch } = require("./worktrees");
|
|
820
|
+
const base = defaultBranch(repo);
|
|
821
|
+
const branch = gitOutput(repo, ["symbolic-ref", "--short", "-q", "HEAD"]);
|
|
822
|
+
// `origin/main` and `main` are the same default branch here.
|
|
823
|
+
const onDefault = base && branch && base.replace(/^[^/]+\//, "") === branch;
|
|
824
|
+
const issues = base && branch && branch !== base && !onDefault ? branchIssues(repo, base, 5) : [];
|
|
825
|
+
if (issues.length) context.recent = { issues, range: `${base}..${branch}` };
|
|
826
|
+
} catch {
|
|
827
|
+
// A pointer that cannot be read is simply absent.
|
|
828
|
+
}
|
|
829
|
+
}
|
|
815
830
|
context.role = null;
|
|
816
831
|
try {
|
|
817
832
|
const store = require("./chat/store");
|
package/src/core/worktrees.js
CHANGED
|
@@ -53,6 +53,22 @@ function defaultBranch(repo) {
|
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// The issues a branch's commits beyond `base` reference as `#<n>`, newest
|
|
57
|
+
// commit first and without repeats (#278 D1); `limit` caps the list.
|
|
58
|
+
function branchIssues(cwd, base, limit = Infinity) {
|
|
59
|
+
if (!base) return [];
|
|
60
|
+
const log = git(cwd, ["log", "--format=%s%n%b%x00", `${base}..HEAD`, "--"], true);
|
|
61
|
+
if (!log) return [];
|
|
62
|
+
const seen = [];
|
|
63
|
+
for (const message of log.split("\0")) {
|
|
64
|
+
for (const match of message.matchAll(/#(\d+)/g)) {
|
|
65
|
+
const number = Number(match[1]);
|
|
66
|
+
if (Number.isSafeInteger(number) && number > 0 && !seen.includes(number)) seen.push(number);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return seen.slice(0, limit);
|
|
70
|
+
}
|
|
71
|
+
|
|
56
72
|
function readIssues(file) {
|
|
57
73
|
if (file === null) return null;
|
|
58
74
|
try {
|
|
@@ -94,9 +110,7 @@ function inspect(where, row, base, roles, times) {
|
|
|
94
110
|
const dirty = git(row.path, ["status", "--porcelain"]).split("\n").filter(Boolean).length;
|
|
95
111
|
const bound = roles[fs.realpathSync(row.path)];
|
|
96
112
|
const role = typeof bound === "string" && new RegExp(store.NAME_PATTERN_TEXT).test(bound) ? bound : null;
|
|
97
|
-
const
|
|
98
|
-
const issues = [...new Set([...subjects.matchAll(/#(\d+)/g)].map((match) => Number(match[1])))]
|
|
99
|
-
.filter((number) => Number.isSafeInteger(number) && number > 0).sort((a, b) => a - b);
|
|
113
|
+
const issues = head ? branchIssues(row.path, base).sort((a, b) => a - b) : [];
|
|
100
114
|
const result = {
|
|
101
115
|
...row, head, missing: false, upstream, ahead, behind, lastCommit, dirty,
|
|
102
116
|
role, presence: role ? notice.presenceOf(where, role) : null, issues,
|
|
@@ -163,4 +177,4 @@ function runWorktrees(argv) {
|
|
|
163
177
|
}
|
|
164
178
|
}
|
|
165
179
|
|
|
166
|
-
module.exports = { WorktreesError, runWorktrees };
|
|
180
|
+
module.exports = { WorktreesError, runWorktrees, branchIssues, defaultBranch };
|