prizmkit 1.1.160 → 1.1.162
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/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/README.md +3 -1
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +9 -6
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +63 -4
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +268 -110
- package/bundled/dev-pipeline/scripts/update-bug-status.py +8 -4
- package/bundled/dev-pipeline/scripts/update-feature-status.py +10 -6
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +8 -4
- package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +2 -2
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +9 -15
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +8 -5
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +4 -2
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +4 -2
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +221 -6
- package/bundled/dev-pipeline/tests/test_runtime_commit.py +308 -67
- package/bundled/dev-pipeline/tests/test_unified_cli.py +172 -4
- package/bundled/rules/prizm/prizm-commit-workflow.md +12 -5
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +5 -5
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +4 -5
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +4 -6
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +1 -4
- package/bundled/skills/prizmkit-committer/SKILL.md +47 -63
- package/bundled/skills/prizmkit-test/SKILL.md +2 -2
- package/bundled/skills/prizmkit-test/references/test-coverage-model.md +1 -1
- package/bundled/skills/prizmkit-workflow/SKILL.md +4 -6
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +10 -8
- package/package.json +1 -1
|
@@ -9,17 +9,15 @@ import subprocess
|
|
|
9
9
|
import tempfile
|
|
10
10
|
from dataclasses import dataclass
|
|
11
11
|
from pathlib import Path, PurePosixPath
|
|
12
|
-
from typing import Mapping
|
|
12
|
+
from typing import Mapping
|
|
13
13
|
|
|
14
14
|
from .checkpoint_state import (
|
|
15
15
|
load_checkpoint_state,
|
|
16
16
|
semantic_state_key,
|
|
17
17
|
validate_checkpoint_data,
|
|
18
18
|
)
|
|
19
|
-
from .gitops import HIDDEN_TOOL_WORKTREE_EXCLUDES
|
|
20
|
-
|
|
21
19
|
REQUEST_FILENAME = "runtime-commit-request.json"
|
|
22
|
-
REQUEST_SCHEMA_VERSION =
|
|
20
|
+
REQUEST_SCHEMA_VERSION = 2
|
|
23
21
|
_HEX_COMMIT = re.compile(r"^[0-9a-fA-F]{40,64}$")
|
|
24
22
|
_FORBIDDEN_EXACT_PATHS = {
|
|
25
23
|
".claude/settings.local.json",
|
|
@@ -37,8 +35,6 @@ _SENSITIVE_NAMES = {
|
|
|
37
35
|
"secrets.json",
|
|
38
36
|
}
|
|
39
37
|
_SENSITIVE_SUFFIXES = {".pem", ".p12", ".pfx"}
|
|
40
|
-
_SUPPORT_ROOT_FILES = {"agents.md", "skills-lock.json"}
|
|
41
|
-
_SUPPORT_ROOT_DIRS = {".claude", ".codebuddy", ".codex", ".agents", ".pi"}
|
|
42
38
|
|
|
43
39
|
|
|
44
40
|
@dataclass(frozen=True)
|
|
@@ -48,7 +44,6 @@ class RuntimeCommitRequest:
|
|
|
48
44
|
artifact_dir: str
|
|
49
45
|
base_head: str
|
|
50
46
|
commit_message: str
|
|
51
|
-
intended_paths: tuple[str, ...]
|
|
52
47
|
runtime_commit_hash: str = ""
|
|
53
48
|
|
|
54
49
|
|
|
@@ -120,17 +115,37 @@ def finalize_runtime_commit(
|
|
|
120
115
|
return RuntimeCommitResult("failed", "premature_runtime_commit_hash")
|
|
121
116
|
if state.semantic_complete:
|
|
122
117
|
return RuntimeCommitResult("failed", "completed_checkpoint_without_commit")
|
|
123
|
-
|
|
118
|
+
unmerged = _git(root, "ls-files", "-u")
|
|
119
|
+
if unmerged.return_code != 0:
|
|
120
|
+
return RuntimeCommitResult("failed", "git_unmerged_state_unavailable")
|
|
121
|
+
if unmerged.stdout.strip():
|
|
122
|
+
return RuntimeCommitResult("failed", "unresolved_merge_state")
|
|
123
|
+
changed, status_error = _workspace_changed_paths(
|
|
124
124
|
root,
|
|
125
|
-
artifact_dir=artifact,
|
|
126
125
|
checkpoint_path=checkpoint,
|
|
127
126
|
request_path=request_path,
|
|
128
127
|
)
|
|
129
128
|
if status_error:
|
|
130
129
|
return RuntimeCommitResult("failed", status_error)
|
|
131
|
-
if
|
|
132
|
-
return RuntimeCommitResult("failed", "
|
|
133
|
-
|
|
130
|
+
if not changed:
|
|
131
|
+
return RuntimeCommitResult("failed", "empty_workspace_change")
|
|
132
|
+
unsafe = next((path for path in changed if _sensitive_commit_path(path)), "")
|
|
133
|
+
if unsafe:
|
|
134
|
+
return RuntimeCommitResult("failed", "sensitive_workspace_path")
|
|
135
|
+
bookkeeping_staged = _staged_bookkeeping_paths(
|
|
136
|
+
root,
|
|
137
|
+
checkpoint_path=checkpoint,
|
|
138
|
+
request_path=request_path,
|
|
139
|
+
)
|
|
140
|
+
if bookkeeping_staged is None:
|
|
141
|
+
return RuntimeCommitResult("failed", "git_staged_set_unavailable")
|
|
142
|
+
if bookkeeping_staged:
|
|
143
|
+
return RuntimeCommitResult("failed", "runtime_bookkeeping_staged")
|
|
144
|
+
staged = _stage_workspace(
|
|
145
|
+
root,
|
|
146
|
+
checkpoint_path=checkpoint,
|
|
147
|
+
request_path=request_path,
|
|
148
|
+
)
|
|
134
149
|
if staged.return_code != 0:
|
|
135
150
|
return RuntimeCommitResult("failed", "git_stage_failed")
|
|
136
151
|
staged_paths = _git(
|
|
@@ -139,10 +154,19 @@ def finalize_runtime_commit(
|
|
|
139
154
|
if staged_paths.return_code != 0:
|
|
140
155
|
return RuntimeCommitResult("failed", "git_staged_set_unavailable")
|
|
141
156
|
staged_set = {path for path in staged_paths.stdout.split("\0") if path}
|
|
142
|
-
if staged_set != set(
|
|
143
|
-
return RuntimeCommitResult("failed", "
|
|
157
|
+
if staged_set != set(changed):
|
|
158
|
+
return RuntimeCommitResult("failed", "staged_workspace_mismatch")
|
|
144
159
|
if not staged_set:
|
|
145
160
|
return RuntimeCommitResult("failed", "empty_staged_change")
|
|
161
|
+
unstaged_candidates = _workspace_has_unstaged_candidates(
|
|
162
|
+
root,
|
|
163
|
+
checkpoint_path=checkpoint,
|
|
164
|
+
request_path=request_path,
|
|
165
|
+
)
|
|
166
|
+
if unstaged_candidates is None:
|
|
167
|
+
return RuntimeCommitResult("failed", "git_workspace_verification_failed")
|
|
168
|
+
if unstaged_candidates:
|
|
169
|
+
return RuntimeCommitResult("failed", "workspace_changed_during_staging")
|
|
146
170
|
committed = _git(
|
|
147
171
|
root,
|
|
148
172
|
"-c", "core.hooksPath=/dev/null",
|
|
@@ -190,6 +214,129 @@ def finalize_runtime_commit(
|
|
|
190
214
|
return RuntimeCommitResult("committed", "runtime_commit_completed", head, recovered)
|
|
191
215
|
|
|
192
216
|
|
|
217
|
+
def finalize_accepted_workspace_commit(
|
|
218
|
+
project_root: Path,
|
|
219
|
+
*,
|
|
220
|
+
artifact_dir: Path,
|
|
221
|
+
checkpoint_path: Path,
|
|
222
|
+
base_head: str,
|
|
223
|
+
commit_message: str,
|
|
224
|
+
) -> RuntimeCommitResult:
|
|
225
|
+
"""Safely commit complete task output accepted without semantic completion.
|
|
226
|
+
|
|
227
|
+
The raw checkpoint remains incomplete diagnostic evidence. Only its exact
|
|
228
|
+
causal checkpoint/request paths are excluded from the accepted snapshot.
|
|
229
|
+
Any post-base commit is rejected so the Python Runtime remains the sole
|
|
230
|
+
automated commit owner for this degraded path.
|
|
231
|
+
"""
|
|
232
|
+
try:
|
|
233
|
+
root = project_root.resolve()
|
|
234
|
+
artifact = artifact_dir.resolve()
|
|
235
|
+
checkpoint = checkpoint_path.resolve()
|
|
236
|
+
except (OSError, RuntimeError):
|
|
237
|
+
return RuntimeCommitResult("failed", "unsafe_artifact_identity")
|
|
238
|
+
if not _within(artifact, root) or not _within(checkpoint, artifact):
|
|
239
|
+
return RuntimeCommitResult("failed", "unsafe_artifact_identity")
|
|
240
|
+
|
|
241
|
+
request_path = artifact / REQUEST_FILENAME
|
|
242
|
+
current_head = _git(root, "rev-parse", "HEAD")
|
|
243
|
+
base = _git(root, "rev-parse", base_head)
|
|
244
|
+
if current_head.return_code != 0 or base.return_code != 0:
|
|
245
|
+
return RuntimeCommitResult("failed", "git_head_unavailable")
|
|
246
|
+
head = current_head.stdout.strip()
|
|
247
|
+
resolved_base = base.stdout.strip()
|
|
248
|
+
# The Python Runtime remains the sole automated commit owner. A HEAD change
|
|
249
|
+
# after the session base could hide sensitive content in intermediate commit
|
|
250
|
+
# history even when the final tree diff looks safe, so fail closed instead of
|
|
251
|
+
# adopting or merging provider-created commits on this degraded path.
|
|
252
|
+
if head != resolved_base:
|
|
253
|
+
return RuntimeCommitResult("failed", "unexpected_existing_commit")
|
|
254
|
+
|
|
255
|
+
unmerged = _git(root, "ls-files", "-u")
|
|
256
|
+
if unmerged.return_code != 0:
|
|
257
|
+
return RuntimeCommitResult("failed", "git_unmerged_state_unavailable")
|
|
258
|
+
if unmerged.stdout.strip():
|
|
259
|
+
return RuntimeCommitResult("failed", "unresolved_merge_state")
|
|
260
|
+
|
|
261
|
+
changed, status_error = _workspace_changed_paths(
|
|
262
|
+
root,
|
|
263
|
+
checkpoint_path=checkpoint,
|
|
264
|
+
request_path=request_path,
|
|
265
|
+
)
|
|
266
|
+
if status_error:
|
|
267
|
+
return RuntimeCommitResult("failed", status_error)
|
|
268
|
+
if any(_sensitive_commit_path(path) for path in changed):
|
|
269
|
+
return RuntimeCommitResult("failed", "sensitive_workspace_path")
|
|
270
|
+
bookkeeping_staged = _staged_bookkeeping_paths(
|
|
271
|
+
root,
|
|
272
|
+
checkpoint_path=checkpoint,
|
|
273
|
+
request_path=request_path,
|
|
274
|
+
)
|
|
275
|
+
if bookkeeping_staged is None:
|
|
276
|
+
return RuntimeCommitResult("failed", "git_staged_set_unavailable")
|
|
277
|
+
if bookkeeping_staged:
|
|
278
|
+
return RuntimeCommitResult("failed", "runtime_bookkeeping_staged")
|
|
279
|
+
if not changed:
|
|
280
|
+
return RuntimeCommitResult(
|
|
281
|
+
"not_needed",
|
|
282
|
+
"accepted_workspace_clean",
|
|
283
|
+
head,
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
staged = _stage_workspace(
|
|
287
|
+
root,
|
|
288
|
+
checkpoint_path=checkpoint,
|
|
289
|
+
request_path=request_path,
|
|
290
|
+
)
|
|
291
|
+
if staged.return_code != 0:
|
|
292
|
+
return RuntimeCommitResult("failed", "git_stage_failed")
|
|
293
|
+
staged_paths = _git(
|
|
294
|
+
root, "diff", "--cached", "--name-only", "--no-renames", "-z",
|
|
295
|
+
)
|
|
296
|
+
if staged_paths.return_code != 0:
|
|
297
|
+
return RuntimeCommitResult("failed", "git_staged_set_unavailable")
|
|
298
|
+
staged_set = {path for path in staged_paths.stdout.split("\0") if path}
|
|
299
|
+
if staged_set != set(changed):
|
|
300
|
+
return RuntimeCommitResult("failed", "staged_workspace_mismatch")
|
|
301
|
+
unstaged_candidates = _workspace_has_unstaged_candidates(
|
|
302
|
+
root,
|
|
303
|
+
checkpoint_path=checkpoint,
|
|
304
|
+
request_path=request_path,
|
|
305
|
+
)
|
|
306
|
+
if unstaged_candidates is None:
|
|
307
|
+
return RuntimeCommitResult("failed", "git_workspace_verification_failed")
|
|
308
|
+
if unstaged_candidates:
|
|
309
|
+
return RuntimeCommitResult("failed", "workspace_changed_during_staging")
|
|
310
|
+
|
|
311
|
+
committed = _git(
|
|
312
|
+
root,
|
|
313
|
+
"-c", "core.hooksPath=/dev/null",
|
|
314
|
+
"-c", "commit.gpgSign=false",
|
|
315
|
+
"commit", "-m", commit_message,
|
|
316
|
+
)
|
|
317
|
+
if committed.return_code != 0:
|
|
318
|
+
return RuntimeCommitResult("failed", "git_commit_failed")
|
|
319
|
+
new_head_result = _git(root, "rev-parse", "HEAD")
|
|
320
|
+
if new_head_result.return_code != 0:
|
|
321
|
+
return RuntimeCommitResult("failed", "commit_identity_unavailable")
|
|
322
|
+
new_head = new_head_result.stdout.strip()
|
|
323
|
+
parents = _git(root, "show", "-s", "--format=%P", new_head)
|
|
324
|
+
subject = _git(root, "show", "-s", "--format=%s", new_head)
|
|
325
|
+
committed_paths = _git(
|
|
326
|
+
root,
|
|
327
|
+
"diff-tree", "--no-commit-id", "--name-only", "--no-renames", "-r", "-z", new_head,
|
|
328
|
+
)
|
|
329
|
+
if any(result.return_code != 0 for result in (parents, subject, committed_paths)):
|
|
330
|
+
return RuntimeCommitResult("failed", "git_commit_content_mismatch", new_head)
|
|
331
|
+
if not (
|
|
332
|
+
parents.stdout.strip().split() == [head]
|
|
333
|
+
and subject.stdout.strip() == commit_message
|
|
334
|
+
and {path for path in committed_paths.stdout.split("\0") if path} == staged_set
|
|
335
|
+
):
|
|
336
|
+
return RuntimeCommitResult("failed", "git_commit_content_mismatch", new_head)
|
|
337
|
+
return RuntimeCommitResult("committed", "accepted_workspace_committed", new_head)
|
|
338
|
+
|
|
339
|
+
|
|
193
340
|
def _load_request(
|
|
194
341
|
request_path: Path,
|
|
195
342
|
project_root: Path,
|
|
@@ -204,7 +351,7 @@ def _load_request(
|
|
|
204
351
|
if not isinstance(raw, Mapping) or raw.get("schema_version") != REQUEST_SCHEMA_VERSION:
|
|
205
352
|
return None, "commit_request_invalid_schema"
|
|
206
353
|
required_keys = {
|
|
207
|
-
"schema_version", "artifact_dir", "base_head", "commit_message",
|
|
354
|
+
"schema_version", "artifact_dir", "base_head", "commit_message",
|
|
208
355
|
}
|
|
209
356
|
allowed_keys = required_keys | {"runtime_commit_hash"}
|
|
210
357
|
if not required_keys.issubset(raw) or not set(raw).issubset(allowed_keys):
|
|
@@ -223,18 +370,6 @@ def _load_request(
|
|
|
223
370
|
if not message or "\n" in message or len(message) > 240:
|
|
224
371
|
return None, "commit_request_message_invalid"
|
|
225
372
|
|
|
226
|
-
raw_paths = raw.get("intended_paths")
|
|
227
|
-
if not isinstance(raw_paths, list) or not raw_paths:
|
|
228
|
-
return None, "commit_request_paths_invalid"
|
|
229
|
-
intended: list[str] = []
|
|
230
|
-
for value in raw_paths:
|
|
231
|
-
relative = _safe_relative_path(value)
|
|
232
|
-
if relative is None or _forbidden_commit_path(relative, expected_artifact):
|
|
233
|
-
return None, "commit_request_path_unsafe"
|
|
234
|
-
intended.append(relative)
|
|
235
|
-
if len(intended) != len(set(intended)):
|
|
236
|
-
return None, "commit_request_paths_duplicate"
|
|
237
|
-
|
|
238
373
|
runtime_commit_hash = str(raw.get("runtime_commit_hash") or "").strip()
|
|
239
374
|
if runtime_commit_hash and not _HEX_COMMIT.fullmatch(runtime_commit_hash):
|
|
240
375
|
return None, "runtime_commit_hash_invalid"
|
|
@@ -243,45 +378,25 @@ def _load_request(
|
|
|
243
378
|
artifact_dir=expected_artifact,
|
|
244
379
|
base_head=base_head.lower(),
|
|
245
380
|
commit_message=message,
|
|
246
|
-
intended_paths=tuple(intended),
|
|
247
381
|
runtime_commit_hash=runtime_commit_hash.lower(),
|
|
248
382
|
), ""
|
|
249
383
|
|
|
250
384
|
|
|
251
|
-
def
|
|
252
|
-
text = str(value or "").strip().replace("\\", "/")
|
|
253
|
-
if not text or text.startswith("/") or re.match(r"^[A-Za-z]:/", text):
|
|
254
|
-
return None
|
|
255
|
-
path = PurePosixPath(text)
|
|
256
|
-
if path.is_absolute() or any(part in {"", ".", ".."} for part in path.parts):
|
|
257
|
-
return None
|
|
258
|
-
return path.as_posix()
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
def _forbidden_commit_path(path: str, artifact_dir: str) -> bool:
|
|
385
|
+
def _sensitive_commit_path(path: str) -> bool:
|
|
262
386
|
lower = path.lower()
|
|
263
387
|
name = PurePosixPath(lower).name
|
|
264
388
|
if lower in _FORBIDDEN_EXACT_PATHS:
|
|
265
389
|
return True
|
|
266
390
|
if lower == ".git" or lower.startswith(".git/"):
|
|
267
391
|
return True
|
|
268
|
-
if _known_support_path(lower):
|
|
269
|
-
return True
|
|
270
|
-
artifact_prefix = artifact_dir.lower().rstrip("/") + "/"
|
|
271
|
-
if lower in {
|
|
272
|
-
artifact_prefix + REQUEST_FILENAME,
|
|
273
|
-
artifact_prefix + "workflow-checkpoint.json",
|
|
274
|
-
}:
|
|
275
|
-
return True
|
|
276
392
|
if name in _SENSITIVE_NAMES or (name.startswith(".env.") and name != ".env.example"):
|
|
277
393
|
return True
|
|
278
394
|
return PurePosixPath(lower).suffix in _SENSITIVE_SUFFIXES
|
|
279
395
|
|
|
280
396
|
|
|
281
|
-
def
|
|
397
|
+
def _workspace_changed_paths(
|
|
282
398
|
project_root: Path,
|
|
283
399
|
*,
|
|
284
|
-
artifact_dir: Path,
|
|
285
400
|
checkpoint_path: Path,
|
|
286
401
|
request_path: Path,
|
|
287
402
|
) -> tuple[tuple[str, ...], str]:
|
|
@@ -293,56 +408,31 @@ def _task_visible_changed_paths(
|
|
|
293
408
|
"--untracked-files=all",
|
|
294
409
|
"--",
|
|
295
410
|
".",
|
|
296
|
-
*HIDDEN_TOOL_WORKTREE_EXCLUDES,
|
|
297
411
|
)
|
|
298
412
|
if result.return_code != 0:
|
|
299
413
|
return (), "git_status_failed"
|
|
300
|
-
local_paths =
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
continue
|
|
310
|
-
visible.append(path)
|
|
414
|
+
local_paths = _runtime_bookkeeping_paths(
|
|
415
|
+
project_root,
|
|
416
|
+
checkpoint_path=checkpoint_path,
|
|
417
|
+
request_path=request_path,
|
|
418
|
+
)
|
|
419
|
+
visible = [
|
|
420
|
+
path for path in _status_record_paths(result.stdout)
|
|
421
|
+
if path not in local_paths
|
|
422
|
+
]
|
|
311
423
|
return tuple(dict.fromkeys(visible)), ""
|
|
312
424
|
|
|
313
425
|
|
|
314
|
-
def
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
return True
|
|
325
|
-
if (
|
|
326
|
-
len(parts) >= 2
|
|
327
|
-
and parts[0].startswith(".")
|
|
328
|
-
and parts[1] in {"worktree", "worktrees"}
|
|
329
|
-
):
|
|
330
|
-
return True
|
|
331
|
-
if lower_path in {".prizmkit/manifest.json"}:
|
|
332
|
-
return True
|
|
333
|
-
if any(
|
|
334
|
-
lower_path == prefix or lower_path.startswith(prefix + "/")
|
|
335
|
-
for prefix in (
|
|
336
|
-
".prizmkit/dev-pipeline",
|
|
337
|
-
".prizmkit/state",
|
|
338
|
-
".prizmkit/scripts",
|
|
339
|
-
)
|
|
340
|
-
):
|
|
341
|
-
return True
|
|
342
|
-
return (
|
|
343
|
-
lower_path.startswith(".prizmkit/specs/")
|
|
344
|
-
and path.name in {REQUEST_FILENAME, "workflow-checkpoint.json"}
|
|
345
|
-
)
|
|
426
|
+
def _runtime_bookkeeping_paths(
|
|
427
|
+
project_root: Path,
|
|
428
|
+
*,
|
|
429
|
+
checkpoint_path: Path,
|
|
430
|
+
request_path: Path,
|
|
431
|
+
) -> set[str]:
|
|
432
|
+
return {
|
|
433
|
+
checkpoint_path.relative_to(project_root).as_posix(),
|
|
434
|
+
request_path.relative_to(project_root).as_posix(),
|
|
435
|
+
}
|
|
346
436
|
|
|
347
437
|
|
|
348
438
|
def _status_record_paths(stdout: str) -> tuple[str, ...]:
|
|
@@ -363,22 +453,85 @@ def _status_record_paths(stdout: str) -> tuple[str, ...]:
|
|
|
363
453
|
return tuple(dict.fromkeys(path for path in changed if path))
|
|
364
454
|
|
|
365
455
|
|
|
366
|
-
def
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
456
|
+
def _staged_bookkeeping_paths(
|
|
457
|
+
project_root: Path,
|
|
458
|
+
*,
|
|
459
|
+
checkpoint_path: Path,
|
|
460
|
+
request_path: Path,
|
|
461
|
+
) -> tuple[str, ...] | None:
|
|
462
|
+
staged = _git(
|
|
463
|
+
project_root,
|
|
464
|
+
"diff",
|
|
465
|
+
"--cached",
|
|
466
|
+
"--name-only",
|
|
467
|
+
"--no-renames",
|
|
468
|
+
"-z",
|
|
469
|
+
)
|
|
470
|
+
if staged.return_code != 0:
|
|
471
|
+
return None
|
|
472
|
+
local_paths = _runtime_bookkeeping_paths(
|
|
473
|
+
project_root,
|
|
474
|
+
checkpoint_path=checkpoint_path,
|
|
475
|
+
request_path=request_path,
|
|
476
|
+
)
|
|
477
|
+
return tuple(
|
|
478
|
+
path for path in staged.stdout.split("\0")
|
|
479
|
+
if path and path in local_paths
|
|
480
|
+
)
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def _stage_workspace(
|
|
484
|
+
project_root: Path,
|
|
485
|
+
*,
|
|
486
|
+
checkpoint_path: Path,
|
|
487
|
+
request_path: Path,
|
|
488
|
+
) -> _GitResult:
|
|
489
|
+
staged = _git(project_root, "add", "-A", "--", ".")
|
|
490
|
+
if staged.return_code != 0:
|
|
491
|
+
return staged
|
|
492
|
+
local_pathspecs = [
|
|
493
|
+
f":(top,literal){path}"
|
|
494
|
+
for path in sorted(
|
|
495
|
+
_runtime_bookkeeping_paths(
|
|
496
|
+
project_root,
|
|
497
|
+
checkpoint_path=checkpoint_path,
|
|
498
|
+
request_path=request_path,
|
|
499
|
+
)
|
|
500
|
+
)
|
|
501
|
+
]
|
|
502
|
+
return _git(project_root, "reset", "-q", "HEAD", "--", *local_pathspecs)
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
def _workspace_has_unstaged_candidates(
|
|
506
|
+
project_root: Path,
|
|
507
|
+
*,
|
|
508
|
+
checkpoint_path: Path,
|
|
509
|
+
request_path: Path,
|
|
510
|
+
) -> bool | None:
|
|
511
|
+
local_paths = _runtime_bookkeeping_paths(
|
|
512
|
+
project_root,
|
|
513
|
+
checkpoint_path=checkpoint_path,
|
|
514
|
+
request_path=request_path,
|
|
515
|
+
)
|
|
516
|
+
unstaged = _git(project_root, "diff", "--name-only", "--no-renames", "-z")
|
|
517
|
+
untracked = _git(
|
|
518
|
+
project_root,
|
|
519
|
+
"ls-files",
|
|
520
|
+
"--others",
|
|
521
|
+
"--exclude-standard",
|
|
522
|
+
"-z",
|
|
523
|
+
"--",
|
|
524
|
+
".",
|
|
525
|
+
)
|
|
526
|
+
if unstaged.return_code != 0 or untracked.return_code != 0:
|
|
527
|
+
return None
|
|
528
|
+
candidates = {
|
|
529
|
+
path
|
|
530
|
+
for output in (unstaged.stdout, untracked.stdout)
|
|
531
|
+
for path in output.split("\0")
|
|
532
|
+
if path and path not in local_paths
|
|
533
|
+
}
|
|
534
|
+
return bool(candidates)
|
|
382
535
|
|
|
383
536
|
|
|
384
537
|
def _matches_prepared_commit(project_root: Path, request: RuntimeCommitRequest, head: str) -> bool:
|
|
@@ -392,12 +545,17 @@ def _matches_prepared_commit(project_root: Path, request: RuntimeCommitRequest,
|
|
|
392
545
|
return False
|
|
393
546
|
parent_list = parents.stdout.strip().split()
|
|
394
547
|
changed = {path for path in paths.stdout.split("\0") if path}
|
|
548
|
+
artifact_prefix = request.artifact_dir.rstrip("/") + "/"
|
|
549
|
+
causal_bookkeeping = {
|
|
550
|
+
artifact_prefix + REQUEST_FILENAME,
|
|
551
|
+
artifact_prefix + "workflow-checkpoint.json",
|
|
552
|
+
}
|
|
395
553
|
return (
|
|
396
554
|
len(parent_list) == 1
|
|
397
555
|
and parent_list[0].lower() == request.base_head.lower()
|
|
398
556
|
and subject.stdout.strip() == request.commit_message
|
|
399
557
|
and bool(changed)
|
|
400
|
-
and changed
|
|
558
|
+
and changed.isdisjoint(causal_bookkeeping)
|
|
401
559
|
)
|
|
402
560
|
|
|
403
561
|
|
|
@@ -770,10 +770,14 @@ def action_update(args, bug_list_path, state_dir):
|
|
|
770
770
|
bs["last_session_id"] = session_id
|
|
771
771
|
|
|
772
772
|
bs["updated_at"] = now_iso()
|
|
773
|
-
#
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
773
|
+
# Completed tasks are terminal even when their accepted checkpoint evidence
|
|
774
|
+
# remains incomplete; only non-completed outcomes expose a resume cursor.
|
|
775
|
+
if new_status == "completed":
|
|
776
|
+
bs["resume_from_phase"] = None
|
|
777
|
+
else:
|
|
778
|
+
_sync_checkpoint_phase(
|
|
779
|
+
args.project_root or _default_project_root(), bug_id, bs,
|
|
780
|
+
)
|
|
777
781
|
|
|
778
782
|
err = save_bug_status(state_dir, bug_id, bs)
|
|
779
783
|
if err:
|
|
@@ -1102,12 +1102,16 @@ def action_update(args, feature_list_path, state_dir):
|
|
|
1102
1102
|
fs["last_session_id"] = session_id
|
|
1103
1103
|
|
|
1104
1104
|
fs["updated_at"] = now_iso()
|
|
1105
|
-
#
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1105
|
+
# Completed tasks are terminal even when their accepted checkpoint evidence
|
|
1106
|
+
# remains incomplete; only non-completed outcomes expose a resume cursor.
|
|
1107
|
+
if new_status == "completed":
|
|
1108
|
+
fs["resume_from_phase"] = None
|
|
1109
|
+
else:
|
|
1110
|
+
_sync_checkpoint_phase(
|
|
1111
|
+
args.project_root or _default_project_root(),
|
|
1112
|
+
_get_feature_slug(feature_list_path, feature_id) or feature_id,
|
|
1113
|
+
fs,
|
|
1114
|
+
)
|
|
1111
1115
|
|
|
1112
1116
|
err = save_feature_status(state_dir, feature_id, fs)
|
|
1113
1117
|
if err:
|
|
@@ -675,10 +675,14 @@ def action_update(args, refactor_list_path, state_dir):
|
|
|
675
675
|
rs["last_session_id"] = session_id
|
|
676
676
|
|
|
677
677
|
rs["updated_at"] = now_iso()
|
|
678
|
-
#
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
678
|
+
# Completed tasks are terminal even when their accepted checkpoint evidence
|
|
679
|
+
# remains incomplete; only non-completed outcomes expose a resume cursor.
|
|
680
|
+
if new_status == "completed":
|
|
681
|
+
rs["resume_from_phase"] = None
|
|
682
|
+
else:
|
|
683
|
+
_sync_checkpoint_phase(
|
|
684
|
+
args.project_root or _default_project_root(), refactor_id, rs,
|
|
685
|
+
)
|
|
682
686
|
|
|
683
687
|
err = save_refactor_status(state_dir, refactor_id, rs)
|
|
684
688
|
if err:
|
|
@@ -38,7 +38,7 @@ Complete the feature in headless non-interactive mode using the active atomic sk
|
|
|
38
38
|
5. Invoke `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. Validate its report/result pair. For `TEST_NEEDS_FIXES`, classify the concrete correction into an allowed `repair_scope`; unknown/unsafe scope blocks, while a safe in-budget route re-enters Implement and requires fresh Review, configured verification, and Test. Do not duplicate the Skill's internal repair loop.
|
|
39
39
|
6. Write `completion-summary.json` before retrospective and commit preparation.
|
|
40
40
|
7. Invoke `/prizmkit-retrospective` with the exact artifact root, non-`.prizmkit/` `change_paths`, and `change_summary`; validate `outcome=RETRO_COMPLETE`.
|
|
41
|
-
8. Before commit preparation,
|
|
41
|
+
8. Before commit preparation, validate the complete Git-visible workspace regardless of when or where each correct change originated. Final Review/Test authority must cover every behavior-affecting visible change; ignored paths remain local, while merge conflicts, Secrets, sensitive content, stale evidence, and known incorrect or unverifiable content block. After validating every required artifact, invoke `/prizmkit-committer operation=prepare-runtime-commit artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/ evidence_paths=<exact paths> request_path=.prizmkit/specs/{{FEATURE_SLUG}}/runtime-commit-request.json`. Require a schema-v2 pathless request and `COMMIT_REQUEST_READY`; this session then records `COMMIT_PENDING` and stops. The Python runtime re-enumerates and commits the complete non-ignored workspace with only exact causal request/checkpoint bookkeeping omitted.
|
|
42
42
|
|
|
43
43
|
## Failure Capture
|
|
44
44
|
|
|
@@ -448,9 +448,9 @@ Invoke `/prizmkit-retrospective` with the exact artifact root, exact non-`.prizm
|
|
|
448
448
|
|
|
449
449
|
**6c. Runtime commit preparation**
|
|
450
450
|
|
|
451
|
-
Before commit preparation,
|
|
451
|
+
Before commit preparation, validate the complete Git-visible workspace regardless of when or where each correct change originated. Code Review and Test authority must cover every behavior-affecting visible change. Ignored paths remain naturally absent; merge conflicts, Secrets, sensitive content, stale evidence, and known incorrect or unverifiable content block. Never force-add or change/interpret project ignore policy.
|
|
452
452
|
|
|
453
|
-
After this injected session validates every required artifact, invoke `/prizmkit-committer operation=prepare-runtime-commit artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/ evidence_paths=<exact paths>
|
|
453
|
+
After this injected session validates every required artifact, invoke `/prizmkit-committer operation=prepare-runtime-commit artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/ evidence_paths=<exact paths> request_path=.prizmkit/specs/{{FEATURE_SLUG}}/runtime-commit-request.json`. Require a schema-v2 pathless request and `COMMIT_REQUEST_READY`; this session records `COMMIT_PENDING` and stops. The Python runtime re-enumerates and commits the complete non-ignored workspace, omitting only exact causal request/checkpoint bookkeeping, then verifies the local commit and finalizes checkpoint `COMMITTED`.
|
|
454
454
|
|
|
455
455
|
## Critical Paths
|
|
456
456
|
|
|
@@ -245,7 +245,7 @@ Invoke `/prizmkit-retrospective` with the exact artifact root, exact non-`.prizm
|
|
|
245
245
|
|
|
246
246
|
**c. Runtime commit preparation**
|
|
247
247
|
|
|
248
|
-
After this injected session validates every required artifact, invoke `/prizmkit-committer operation=prepare-runtime-commit artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/ evidence_paths=<exact paths>
|
|
248
|
+
After this injected session validates every required artifact and confirms final Review/Test authority covers the complete behavior-affecting Git-visible workspace, invoke `/prizmkit-committer operation=prepare-runtime-commit artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/ evidence_paths=<exact paths> request_path=.prizmkit/bugfix/{{BUG_ID}}/runtime-commit-request.json`. Require a schema-v2 pathless request and `COMMIT_REQUEST_READY`; this session records `COMMIT_PENDING` and stops. Ignored files remain local. The Python runtime re-enumerates and commits the complete non-ignored workspace with only exact causal request/checkpoint bookkeeping omitted, verifies the local commit, finalizes checkpoint `COMMITTED`, and controls any later publication.
|
|
249
249
|
|
|
250
250
|
---
|
|
251
251
|
|
|
@@ -210,7 +210,7 @@ Write `.prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json` for downstrea
|
|
|
210
210
|
|
|
211
211
|
Complete `refactor-report` and `completion-summary` before retrospective. Then invoke `/prizmkit-retrospective` with the exact artifact root, exact non-`.prizmkit/` `change_paths`, and a concise `change_summary`. Validate `outcome=RETRO_COMPLETE`; do not stage or commit.
|
|
212
212
|
|
|
213
|
-
After this injected session validates every required artifact, invoke `/prizmkit-committer operation=prepare-runtime-commit artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/ evidence_paths=<exact paths>
|
|
213
|
+
After this injected session validates every required artifact and confirms final Review/Test authority covers the complete behavior-affecting Git-visible workspace, invoke `/prizmkit-committer operation=prepare-runtime-commit artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/ evidence_paths=<exact paths> request_path=.prizmkit/refactor/{{REFACTOR_ID}}/runtime-commit-request.json`. Require a schema-v2 pathless request and `COMMIT_REQUEST_READY`; this session records `COMMIT_PENDING` and stops. Ignored files remain local. The Python runtime re-enumerates and commits the complete non-ignored workspace with only exact causal request/checkpoint bookkeeping omitted, verifies the local commit, finalizes checkpoint `COMMITTED`, and controls any later publication.
|
|
214
214
|
|
|
215
215
|
---
|
|
216
216
|
|