prizmkit 1.1.197 → 1.1.199
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/bin/create-prizmkit.js +1 -5
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/claude/settings-adapter.js +3 -8
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +65 -8
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +52 -9
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +188 -22
- package/bundled/skills/_metadata.json +1 -1
- package/package.json +1 -1
- package/src/config.js +16 -33
- package/src/index.js +1 -4
- package/src/manifest.js +2 -3
- package/src/prompts.js +0 -13
- package/src/scaffold.js +8 -15
- package/src/upgrade.js +6 -11
package/bin/create-prizmkit.js
CHANGED
|
@@ -51,8 +51,6 @@ program
|
|
|
51
51
|
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, antigravity, comma-separated list, or all')
|
|
52
52
|
.option('--runtime <runtime>', 'Runtime assets: python or auto; unix/windows are accepted as legacy aliases for python')
|
|
53
53
|
.option('--skills <suite>', '[deprecated] Ignored; PrizmKit now always installs the full core skill suite')
|
|
54
|
-
.option('--pipeline', 'Install dev-pipeline (default: true)')
|
|
55
|
-
.option('--no-pipeline', 'Disable dev-pipeline')
|
|
56
54
|
.option('--ai-cli <command>', 'AI CLI executable command (e.g. cbc, claude, codex, pi, agent, agy)')
|
|
57
55
|
.option('--headless-prompt-arg <arg>', 'Prompt injection argv token for a custom AI CLI (e.g. -p or -i)')
|
|
58
56
|
.option('--headless-extra-args <args>', 'Additional headless argv tokens for a custom AI CLI')
|
|
@@ -101,15 +99,13 @@ program
|
|
|
101
99
|
|
|
102
100
|
program
|
|
103
101
|
.command('config [directory]')
|
|
104
|
-
.description('Reconfigure existing PrizmKit installation (change platform, AI CLI
|
|
102
|
+
.description('Reconfigure existing PrizmKit installation (change platform, AI CLI)')
|
|
105
103
|
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, antigravity, comma-separated list, or all')
|
|
106
104
|
.option('--runtime <runtime>', 'Runtime assets: python or auto; unix/windows are accepted as legacy aliases for python')
|
|
107
105
|
.option('--skills <suite>', '[deprecated] Ignored; PrizmKit now always installs the full core skill suite')
|
|
108
106
|
.option('--ai-cli <command>', 'AI CLI executable command (e.g. cbc, claude, codex, pi, agent, agy)')
|
|
109
107
|
.option('--headless-prompt-arg <arg>', 'Prompt injection argv token for a custom AI CLI (e.g. -p or -i)')
|
|
110
108
|
.option('--headless-extra-args <args>', 'Additional headless argv tokens for a custom AI CLI')
|
|
111
|
-
.option('--pipeline', 'Enable dev-pipeline')
|
|
112
|
-
.option('--no-pipeline', 'Disable dev-pipeline')
|
|
113
109
|
.option('--non-interactive', 'Skip interactive prompts')
|
|
114
110
|
.option('--dry-run', 'Show what would change without applying')
|
|
115
111
|
.action(async (directory = '.', options) => {
|
package/bundled/VERSION.json
CHANGED
|
@@ -10,7 +10,7 @@ import path from 'path';
|
|
|
10
10
|
/**
|
|
11
11
|
* Generate Claude Code settings.json for a PrizmKit-enabled project.
|
|
12
12
|
* @param {string} targetRoot - Target project root
|
|
13
|
-
* @param {Object} options - { hooks: boolean
|
|
13
|
+
* @param {Object} options - { hooks: boolean }
|
|
14
14
|
*/
|
|
15
15
|
export async function generateSettings(targetRoot, options = {}) {
|
|
16
16
|
const settingsPath = path.join(targetRoot, '.claude', 'settings.json');
|
|
@@ -62,15 +62,10 @@ export async function generateSettings(targetRoot, options = {}) {
|
|
|
62
62
|
'Bash(./*)',
|
|
63
63
|
'Bash(bash *)',
|
|
64
64
|
'Bash(sh *)',
|
|
65
|
+
'Bash(./.prizmkit/dev-pipeline/*)',
|
|
66
|
+
'Bash(python3 .prizmkit/dev-pipeline/*)',
|
|
65
67
|
];
|
|
66
68
|
|
|
67
|
-
if (options.pipeline) {
|
|
68
|
-
prizmkitPermissions.push(
|
|
69
|
-
'Bash(./.prizmkit/dev-pipeline/*)',
|
|
70
|
-
'Bash(python3 .prizmkit/dev-pipeline/*)',
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
69
|
// Merge without duplicates
|
|
75
70
|
for (const perm of prizmkitPermissions) {
|
|
76
71
|
if (!existing.permissions.allow.includes(perm)) {
|
|
@@ -295,21 +295,43 @@ def _wip_pathspecs(paths: Sequence[str] | None) -> tuple[str, ...]:
|
|
|
295
295
|
return _literal_pathspecs(paths) if paths is not None else (".",)
|
|
296
296
|
|
|
297
297
|
|
|
298
|
+
def partition_addable_paths(
|
|
299
|
+
add_paths: Sequence[str],
|
|
300
|
+
indexed_result: GitCommandResult,
|
|
301
|
+
) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
302
|
+
"""Split addable paths into tracked index entries and untracked paths."""
|
|
303
|
+
indexed_paths = {path for path in indexed_result.stdout.split("\0") if path}
|
|
304
|
+
tracked = tuple(path for path in add_paths if path in indexed_paths)
|
|
305
|
+
untracked = tuple(path for path in add_paths if path not in indexed_paths)
|
|
306
|
+
return tracked, untracked
|
|
307
|
+
|
|
308
|
+
|
|
298
309
|
def branch_save_wip_plan(
|
|
299
310
|
context: BranchContext,
|
|
300
311
|
*,
|
|
301
312
|
commit_paths: Sequence[str] | None = None,
|
|
302
313
|
add_paths: Sequence[str] | None = None,
|
|
314
|
+
tracked_add_paths: Sequence[str] | None = None,
|
|
303
315
|
) -> GitCommandPlan:
|
|
304
316
|
"""Plan WIP preservation that fails when task state cannot be committed."""
|
|
305
317
|
commit_pathspecs = _wip_pathspecs(commit_paths)
|
|
306
|
-
add_pathspecs = _wip_pathspecs(add_paths if add_paths is not None else commit_paths)
|
|
307
318
|
commands = [
|
|
308
319
|
_git("rev-parse", "--abbrev-ref", "HEAD", description="verify current branch"),
|
|
309
320
|
_git("ls-files", "-u", description="require no unmerged paths before WIP commit"),
|
|
310
321
|
]
|
|
311
|
-
if
|
|
312
|
-
|
|
322
|
+
if tracked_add_paths is None:
|
|
323
|
+
add_pathspecs = _wip_pathspecs(add_paths if add_paths is not None else commit_paths)
|
|
324
|
+
if add_pathspecs:
|
|
325
|
+
commands.append(_git("add", "-A", "--", *add_pathspecs, description="stage Git-visible work"))
|
|
326
|
+
else:
|
|
327
|
+
if tracked_add_paths:
|
|
328
|
+
commands.append(
|
|
329
|
+
_git("add", "-u", "--", *_literal_pathspecs(tracked_add_paths), description="stage tracked Git-visible work")
|
|
330
|
+
)
|
|
331
|
+
if add_paths:
|
|
332
|
+
commands.append(
|
|
333
|
+
_git("add", "-A", "--", *_literal_pathspecs(add_paths), description="stage untracked Git-visible work")
|
|
334
|
+
)
|
|
313
335
|
commands.extend(
|
|
314
336
|
(
|
|
315
337
|
_git(
|
|
@@ -343,18 +365,41 @@ def branch_ensure_return_plan(
|
|
|
343
365
|
*,
|
|
344
366
|
commit_paths: Sequence[str] | None = None,
|
|
345
367
|
add_paths: Sequence[str] | None = None,
|
|
368
|
+
tracked_add_paths: Sequence[str] | None = None,
|
|
346
369
|
) -> GitCommandPlan:
|
|
347
370
|
"""Plan a fail-closed WIP commit followed by a clean base return."""
|
|
348
371
|
commit_pathspecs = _wip_pathspecs(commit_paths)
|
|
349
|
-
add_pathspecs = _wip_pathspecs(add_paths if add_paths is not None else commit_paths)
|
|
350
372
|
commands = [
|
|
351
373
|
_git("rebase", "--abort", allow_failure=True, description="abort in-progress rebase"),
|
|
352
374
|
_git("rev-parse", "--abbrev-ref", "HEAD", description="detect current branch"),
|
|
353
375
|
_git("ls-files", "-u", description="require no unmerged paths before WIP commit"),
|
|
354
376
|
_git("status", "--porcelain", "--", ".", *HIDDEN_TOOL_WORKTREE_EXCLUDES, description="detect WIP before checkout"),
|
|
355
377
|
]
|
|
356
|
-
if
|
|
357
|
-
|
|
378
|
+
if tracked_add_paths is None:
|
|
379
|
+
add_pathspecs = _wip_pathspecs(add_paths if add_paths is not None else commit_paths)
|
|
380
|
+
if add_pathspecs:
|
|
381
|
+
commands.append(_git("add", "-A", "--", *add_pathspecs, description="stage Git-visible WIP before checkout"))
|
|
382
|
+
else:
|
|
383
|
+
if tracked_add_paths:
|
|
384
|
+
commands.append(
|
|
385
|
+
_git(
|
|
386
|
+
"add",
|
|
387
|
+
"-u",
|
|
388
|
+
"--",
|
|
389
|
+
*_literal_pathspecs(tracked_add_paths),
|
|
390
|
+
description="stage tracked Git-visible WIP before checkout",
|
|
391
|
+
)
|
|
392
|
+
)
|
|
393
|
+
if add_paths:
|
|
394
|
+
commands.append(
|
|
395
|
+
_git(
|
|
396
|
+
"add",
|
|
397
|
+
"-A",
|
|
398
|
+
"--",
|
|
399
|
+
*_literal_pathspecs(add_paths),
|
|
400
|
+
description="stage untracked Git-visible WIP before checkout",
|
|
401
|
+
)
|
|
402
|
+
)
|
|
358
403
|
commands.extend(
|
|
359
404
|
(
|
|
360
405
|
_git(
|
|
@@ -543,9 +588,15 @@ def branch_save_wip(project_root: Path, working_branch: str) -> GitPlanResult:
|
|
|
543
588
|
add_paths, indexed = addable_task_paths(project_root, paths)
|
|
544
589
|
if indexed.return_code != 0:
|
|
545
590
|
return _status_failure_plan(default_plan.name, indexed, "resolve task-visible WIP paths")
|
|
591
|
+
tracked_add, untracked_add = partition_addable_paths(add_paths, indexed)
|
|
546
592
|
return run_git_plan(
|
|
547
593
|
project_root,
|
|
548
|
-
branch_save_wip_plan(
|
|
594
|
+
branch_save_wip_plan(
|
|
595
|
+
context,
|
|
596
|
+
commit_paths=paths,
|
|
597
|
+
add_paths=untracked_add,
|
|
598
|
+
tracked_add_paths=tracked_add,
|
|
599
|
+
),
|
|
549
600
|
)
|
|
550
601
|
|
|
551
602
|
|
|
@@ -767,9 +818,15 @@ def branch_ensure_return(project_root: Path, base_branch: str, working_branch: s
|
|
|
767
818
|
add_paths, indexed = addable_task_paths(project_root, paths)
|
|
768
819
|
if indexed.return_code != 0:
|
|
769
820
|
return _status_failure_plan("branch_ensure_return", indexed, "resolve task-visible WIP paths before base return")
|
|
821
|
+
tracked_add, untracked_add = partition_addable_paths(add_paths, indexed)
|
|
770
822
|
return run_git_plan(
|
|
771
823
|
project_root,
|
|
772
|
-
branch_ensure_return_plan(
|
|
824
|
+
branch_ensure_return_plan(
|
|
825
|
+
context,
|
|
826
|
+
commit_paths=paths,
|
|
827
|
+
add_paths=untracked_add,
|
|
828
|
+
tracked_add_paths=tracked_add,
|
|
829
|
+
),
|
|
773
830
|
)
|
|
774
831
|
|
|
775
832
|
|
|
@@ -19,6 +19,7 @@ from .gitops import (
|
|
|
19
19
|
addable_task_paths,
|
|
20
20
|
literal_pathspecs,
|
|
21
21
|
parse_status_record_paths,
|
|
22
|
+
partition_addable_paths,
|
|
22
23
|
run_git_command,
|
|
23
24
|
visible_task_paths,
|
|
24
25
|
)
|
|
@@ -182,6 +183,43 @@ def _changed_paths_in(project_root: Path, paths: Sequence[str]) -> tuple[str, ..
|
|
|
182
183
|
return parse_status_record_paths(result.stdout)
|
|
183
184
|
|
|
184
185
|
|
|
186
|
+
def _stage_exact_paths(
|
|
187
|
+
project_root: Path,
|
|
188
|
+
paths: Sequence[str],
|
|
189
|
+
*,
|
|
190
|
+
add_paths: Sequence[str] | None = None,
|
|
191
|
+
indexed_result: GitCommandResult | None = None,
|
|
192
|
+
) -> GitCommandResult | None:
|
|
193
|
+
"""Stage tracked entries via ``git add -u`` and untracked entries via ``git add -A``.
|
|
194
|
+
|
|
195
|
+
Passing an already-tracked path under an ignored parent directory to ``git add -A``
|
|
196
|
+
causes Git to exit 1 with an ignored-file hint; using ``add -u`` for indexed paths
|
|
197
|
+
avoids false staging failures while keeping untracked ignored paths excluded.
|
|
198
|
+
"""
|
|
199
|
+
if add_paths is None or indexed_result is None:
|
|
200
|
+
add_paths, indexed_result = addable_task_paths(project_root, paths)
|
|
201
|
+
if indexed_result.return_code != 0:
|
|
202
|
+
return indexed_result
|
|
203
|
+
if not add_paths:
|
|
204
|
+
return None
|
|
205
|
+
tracked_paths, untracked_paths = partition_addable_paths(add_paths, indexed_result)
|
|
206
|
+
if tracked_paths:
|
|
207
|
+
tracked_add = run_git_command(
|
|
208
|
+
project_root,
|
|
209
|
+
("add", "-u", "--", *literal_pathspecs(tracked_paths)),
|
|
210
|
+
)
|
|
211
|
+
if tracked_add.return_code != 0:
|
|
212
|
+
return tracked_add
|
|
213
|
+
if untracked_paths:
|
|
214
|
+
untracked_add = run_git_command(
|
|
215
|
+
project_root,
|
|
216
|
+
("add", "-A", "--", *literal_pathspecs(untracked_paths)),
|
|
217
|
+
)
|
|
218
|
+
if untracked_add.return_code != 0:
|
|
219
|
+
return untracked_add
|
|
220
|
+
return None
|
|
221
|
+
|
|
222
|
+
|
|
185
223
|
def commit_bookkeeping_changes(
|
|
186
224
|
project_root: Path,
|
|
187
225
|
family: RunnerFamily,
|
|
@@ -197,10 +235,10 @@ def commit_bookkeeping_changes(
|
|
|
197
235
|
)
|
|
198
236
|
if not paths:
|
|
199
237
|
return BookkeepingResult(attempted=False, committed=False)
|
|
238
|
+
stage_failure = _stage_exact_paths(project_root, paths)
|
|
239
|
+
if stage_failure is not None:
|
|
240
|
+
return BookkeepingResult(attempted=True, committed=False, result=stage_failure)
|
|
200
241
|
pathspecs = literal_pathspecs(paths)
|
|
201
|
-
add = run_git_command(project_root, ("add", "-A", "--", *pathspecs))
|
|
202
|
-
if add.return_code != 0:
|
|
203
|
-
return BookkeepingResult(attempted=True, committed=False, result=add)
|
|
204
242
|
result = run_git_command(project_root, ("commit", "--no-verify", "-m", message, "--", *pathspecs))
|
|
205
243
|
return BookkeepingResult(attempted=True, committed=result.return_code == 0, result=result)
|
|
206
244
|
|
|
@@ -279,9 +317,14 @@ def _commit_visible_task_paths(project_root: Path, commit_message_args: tuple[st
|
|
|
279
317
|
if indexed_result.return_code != 0:
|
|
280
318
|
return BookkeepingResult(attempted=True, committed=False, result=indexed_result)
|
|
281
319
|
if add_paths:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
320
|
+
stage_failure = _stage_exact_paths(
|
|
321
|
+
project_root,
|
|
322
|
+
paths,
|
|
323
|
+
add_paths=add_paths,
|
|
324
|
+
indexed_result=indexed_result,
|
|
325
|
+
)
|
|
326
|
+
if stage_failure is not None:
|
|
327
|
+
return BookkeepingResult(attempted=True, committed=False, result=stage_failure)
|
|
285
328
|
result = run_git_command(
|
|
286
329
|
project_root,
|
|
287
330
|
("commit", "--no-verify", *commit_message_args, "--", *literal_pathspecs(paths)),
|
|
@@ -394,10 +437,10 @@ def sync_terminal_failure_bookkeeping_to_base(
|
|
|
394
437
|
changed = _changed_paths_in(project_root, git_candidates)
|
|
395
438
|
if not changed:
|
|
396
439
|
return BookkeepingResult(attempted=False, committed=False)
|
|
440
|
+
stage_failure = _stage_exact_paths(project_root, changed)
|
|
441
|
+
if stage_failure is not None:
|
|
442
|
+
return BookkeepingResult(attempted=True, committed=False, result=stage_failure)
|
|
397
443
|
pathspecs = literal_pathspecs(changed)
|
|
398
|
-
add = run_git_command(project_root, ("add", "-A", "--", *pathspecs))
|
|
399
|
-
if add.return_code != 0:
|
|
400
|
-
return BookkeepingResult(attempted=True, committed=False, result=add)
|
|
401
444
|
commit = run_git_command(
|
|
402
445
|
project_root,
|
|
403
446
|
("commit", "--no-verify", "-m", f"chore({item_id}): record {family.kind} status {status}", "--", *pathspecs),
|
|
@@ -10,7 +10,7 @@ import sys
|
|
|
10
10
|
import tempfile
|
|
11
11
|
import threading
|
|
12
12
|
import time
|
|
13
|
-
from collections.abc import Iterator, Mapping
|
|
13
|
+
from collections.abc import Iterator, Mapping, Sequence
|
|
14
14
|
from contextlib import contextmanager
|
|
15
15
|
from pathlib import Path
|
|
16
16
|
|
|
@@ -286,6 +286,62 @@ def _emit_warning(message: str) -> None:
|
|
|
286
286
|
_emit_info(message, level="WARN")
|
|
287
287
|
|
|
288
288
|
|
|
289
|
+
def _emit_bookkeeping_failure(label: str, item_id: str, result_obj) -> None:
|
|
290
|
+
"""Emit structured Git failure diagnostics without altering flow control."""
|
|
291
|
+
git_result = getattr(result_obj, "result", None)
|
|
292
|
+
if git_result is None:
|
|
293
|
+
return
|
|
294
|
+
args = " ".join(str(arg) for arg in getattr(git_result, "args", ())) or "(unknown)"
|
|
295
|
+
return_code = getattr(git_result, "return_code", None)
|
|
296
|
+
_emit_warning(f"{label} failed for {item_id} (git {args}, exit={return_code})")
|
|
297
|
+
detail = str(getattr(git_result, "stderr", "") or getattr(git_result, "stdout", "")).strip()
|
|
298
|
+
for line in detail.splitlines()[:3]:
|
|
299
|
+
text = line.strip()
|
|
300
|
+
if text:
|
|
301
|
+
_emit_warning(f" {text[:300]}")
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def _load_item_metadata_from_list(list_path: Path, family: RunnerFamily, item_id: str) -> dict[str, object]:
|
|
305
|
+
"""Read title/description metadata for one item from its plan list when available."""
|
|
306
|
+
if not item_id or not list_path.is_file():
|
|
307
|
+
return {}
|
|
308
|
+
try:
|
|
309
|
+
payload = json.loads(list_path.read_text(encoding="utf-8"))
|
|
310
|
+
except (OSError, ValueError, TypeError):
|
|
311
|
+
return {}
|
|
312
|
+
if not isinstance(payload, Mapping):
|
|
313
|
+
return {}
|
|
314
|
+
items = payload.get(family.list_key)
|
|
315
|
+
if not isinstance(items, list):
|
|
316
|
+
return {}
|
|
317
|
+
for entry in items:
|
|
318
|
+
if not isinstance(entry, Mapping) or str(entry.get("id") or "") != item_id:
|
|
319
|
+
continue
|
|
320
|
+
loaded: dict[str, object] = {}
|
|
321
|
+
for key in ("title", "description"):
|
|
322
|
+
value = entry.get(key)
|
|
323
|
+
if isinstance(value, str) and value.strip():
|
|
324
|
+
loaded[key] = value
|
|
325
|
+
return loaded
|
|
326
|
+
return {}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def _enrich_item_metadata(
|
|
330
|
+
metadata: Mapping[str, object] | None,
|
|
331
|
+
list_path: Path,
|
|
332
|
+
family: RunnerFamily,
|
|
333
|
+
item_id: str,
|
|
334
|
+
) -> dict[str, object]:
|
|
335
|
+
"""Ensure item metadata includes title/description when the caller omitted them."""
|
|
336
|
+
enriched = dict(metadata or {})
|
|
337
|
+
if enriched.get("title") and enriched.get("description"):
|
|
338
|
+
return enriched
|
|
339
|
+
for key, value in _load_item_metadata_from_list(list_path, family, item_id).items():
|
|
340
|
+
if not enriched.get(key):
|
|
341
|
+
enriched[key] = value
|
|
342
|
+
return enriched
|
|
343
|
+
|
|
344
|
+
|
|
289
345
|
def _family_label(family: RunnerFamily) -> str:
|
|
290
346
|
return {"feature": "Feature", "bugfix": "Bug"}.get(family.kind, family.kind.title())
|
|
291
347
|
|
|
@@ -648,7 +704,8 @@ def _preview_item(
|
|
|
648
704
|
if not config.ai_client.command:
|
|
649
705
|
raise RuntimeError("No supported AI CLI command was found")
|
|
650
706
|
_validate_effort_config(config)
|
|
651
|
-
|
|
707
|
+
enriched_initial = _enrich_item_metadata(initial_metadata, invocation.list_path, family, item_id)
|
|
708
|
+
metadata = _with_recovery_metadata(family, item_id, enriched_initial)
|
|
652
709
|
retry_count = int(metadata.get("retry_count") or 0)
|
|
653
710
|
session_id = f"{item_id}-dry-run"
|
|
654
711
|
_emit_item_header(family, invocation, item_id, metadata, paths)
|
|
@@ -712,7 +769,8 @@ def _process_item_locked(
|
|
|
712
769
|
checkout = load_task_checkout(family.state_dir, family.task_type, item_id)
|
|
713
770
|
if checkout is not None and checkout.is_completed:
|
|
714
771
|
raise RuntimeError(f"Task {item_id} is completed; run explicit reset or clean before rerunning")
|
|
715
|
-
|
|
772
|
+
enriched_initial = _enrich_item_metadata(initial_metadata, invocation.list_path, family, item_id)
|
|
773
|
+
metadata = _with_recovery_metadata(family, item_id, enriched_initial, checkout)
|
|
716
774
|
base_branch = _resolve_base_branch(paths.project_root, metadata, active_branch, family, item_id)
|
|
717
775
|
branch_name = _resolve_working_branch(family, item_id, metadata, env, active_branch, paths.project_root)
|
|
718
776
|
branch_context = BranchContext(base_branch, branch_name, paths.project_root)
|
|
@@ -903,16 +961,20 @@ def _process_item_locked(
|
|
|
903
961
|
base_branch,
|
|
904
962
|
recovered_session_id,
|
|
905
963
|
session_paths,
|
|
964
|
+
artifact_path=recovery_artifact,
|
|
965
|
+
metadata=metadata,
|
|
906
966
|
)
|
|
907
967
|
start = start_item(status_family, status_invocation, item_id, status_root)
|
|
908
968
|
if not start.ok:
|
|
909
969
|
raise RuntimeError(start.text)
|
|
910
|
-
commit_pre_branch_bookkeeping(
|
|
970
|
+
pre_bookkeeping = commit_pre_branch_bookkeeping(
|
|
911
971
|
status_root,
|
|
912
972
|
status_family,
|
|
913
973
|
item_id,
|
|
914
974
|
**_bookkeeping_list_kwargs(status_family, status_invocation),
|
|
915
975
|
)
|
|
976
|
+
if getattr(pre_bookkeeping, "attempted", False) and not getattr(pre_bookkeeping, "ok", True):
|
|
977
|
+
_emit_bookkeeping_failure("pre-branch bookkeeping", item_id, pre_bookkeeping)
|
|
916
978
|
|
|
917
979
|
previous_fingerprint = metadata.get("last_progress_fingerprint")
|
|
918
980
|
previous_no_progress_count = int(metadata.get("no_progress_count") or 0)
|
|
@@ -1135,6 +1197,8 @@ def _process_item_locked(
|
|
|
1135
1197
|
session_id,
|
|
1136
1198
|
session_paths,
|
|
1137
1199
|
classification_fatal_error_code=classification.fatal_error_code,
|
|
1200
|
+
artifact_path=prompt.artifact_path,
|
|
1201
|
+
metadata=metadata,
|
|
1138
1202
|
)
|
|
1139
1203
|
if accepted_with_warning and completed_status == "completed":
|
|
1140
1204
|
reason = classification.reason or "no_semantic_completion"
|
|
@@ -1371,6 +1435,9 @@ def _finalize_recovered_success(
|
|
|
1371
1435
|
base_branch: str,
|
|
1372
1436
|
session_id: str,
|
|
1373
1437
|
session_paths: SessionPaths,
|
|
1438
|
+
*,
|
|
1439
|
+
artifact_path: Path | None = None,
|
|
1440
|
+
metadata: Mapping[str, object] | None = None,
|
|
1374
1441
|
) -> str:
|
|
1375
1442
|
update = update_item(
|
|
1376
1443
|
status_family,
|
|
@@ -1400,6 +1467,8 @@ def _finalize_recovered_success(
|
|
|
1400
1467
|
session_id,
|
|
1401
1468
|
session_paths,
|
|
1402
1469
|
classification_fatal_error_code="",
|
|
1470
|
+
artifact_path=artifact_path,
|
|
1471
|
+
metadata=metadata,
|
|
1403
1472
|
)
|
|
1404
1473
|
|
|
1405
1474
|
|
|
@@ -1410,8 +1479,15 @@ def _patch_completion_notes_if_present(
|
|
|
1410
1479
|
status_family: RunnerFamily,
|
|
1411
1480
|
status_invocation: RunnerInvocation,
|
|
1412
1481
|
item_id: str,
|
|
1482
|
+
*,
|
|
1483
|
+
artifact_path: Path | None = None,
|
|
1484
|
+
metadata: Mapping[str, object] | None = None,
|
|
1413
1485
|
) -> None:
|
|
1414
|
-
|
|
1486
|
+
resolved_artifact_dir = artifact_path
|
|
1487
|
+
if resolved_artifact_dir is None:
|
|
1488
|
+
resolved_metadata = _enrich_item_metadata(metadata, status_invocation.list_path, status_family, item_id)
|
|
1489
|
+
resolved_artifact_dir = _artifact_path_for_item(execution_root, status_family, item_id, resolved_metadata)
|
|
1490
|
+
summary_file = resolved_artifact_dir / "completion-summary.json"
|
|
1415
1491
|
pipeline_root = getattr(paths, "pipeline_root", None)
|
|
1416
1492
|
if pipeline_root is None or not summary_file.is_file() or not status_invocation.list_path.is_file():
|
|
1417
1493
|
return
|
|
@@ -1456,6 +1532,34 @@ def _patch_completion_notes_if_present(
|
|
|
1456
1532
|
_emit_info(f"Checked completion-summary.json for {item_id}; no non-empty completion notes patched")
|
|
1457
1533
|
|
|
1458
1534
|
|
|
1535
|
+
def _resolve_post_merge_artifact_dir(
|
|
1536
|
+
project_root: Path,
|
|
1537
|
+
execution_root: Path,
|
|
1538
|
+
status_family: RunnerFamily,
|
|
1539
|
+
status_invocation: RunnerInvocation,
|
|
1540
|
+
item_id: str,
|
|
1541
|
+
artifact_path: Path | None,
|
|
1542
|
+
metadata: Mapping[str, object] | None,
|
|
1543
|
+
) -> Path:
|
|
1544
|
+
if artifact_path is not None:
|
|
1545
|
+
if execution_root != project_root:
|
|
1546
|
+
try:
|
|
1547
|
+
rel = artifact_path.resolve().relative_to(execution_root.resolve())
|
|
1548
|
+
project_candidate = project_root / rel
|
|
1549
|
+
if (project_candidate / "retrospective-result.json").is_file():
|
|
1550
|
+
return project_candidate
|
|
1551
|
+
except (OSError, ValueError):
|
|
1552
|
+
pass
|
|
1553
|
+
return artifact_path
|
|
1554
|
+
resolved_metadata = _enrich_item_metadata(metadata, status_invocation.list_path, status_family, item_id)
|
|
1555
|
+
artifact_dir = _artifact_path_for_item(project_root, status_family, item_id, resolved_metadata)
|
|
1556
|
+
if not (artifact_dir / "retrospective-result.json").is_file() and execution_root != project_root:
|
|
1557
|
+
fallback_dir = _artifact_path_for_item(execution_root, status_family, item_id, resolved_metadata)
|
|
1558
|
+
if (fallback_dir / "retrospective-result.json").is_file():
|
|
1559
|
+
return fallback_dir
|
|
1560
|
+
return artifact_dir
|
|
1561
|
+
|
|
1562
|
+
|
|
1459
1563
|
def _complete_success_merge(
|
|
1460
1564
|
family: RunnerFamily,
|
|
1461
1565
|
item_id: str,
|
|
@@ -1472,6 +1576,8 @@ def _complete_success_merge(
|
|
|
1472
1576
|
session_paths: SessionPaths,
|
|
1473
1577
|
*,
|
|
1474
1578
|
classification_fatal_error_code: str = "",
|
|
1579
|
+
artifact_path: Path | None = None,
|
|
1580
|
+
metadata: Mapping[str, object] | None = None,
|
|
1475
1581
|
) -> str:
|
|
1476
1582
|
env = _runner_env_for_paths(paths)
|
|
1477
1583
|
if new_status == "completed":
|
|
@@ -1482,6 +1588,8 @@ def _complete_success_merge(
|
|
|
1482
1588
|
status_family,
|
|
1483
1589
|
status_invocation,
|
|
1484
1590
|
item_id,
|
|
1591
|
+
artifact_path=artifact_path,
|
|
1592
|
+
metadata=metadata,
|
|
1485
1593
|
)
|
|
1486
1594
|
final_bookkeeping = commit_final_bookkeeping(
|
|
1487
1595
|
status_root,
|
|
@@ -1491,9 +1599,21 @@ def _complete_success_merge(
|
|
|
1491
1599
|
**_bookkeeping_list_kwargs(status_family, status_invocation),
|
|
1492
1600
|
)
|
|
1493
1601
|
task_commit = commit_task_branch_changes(execution_root, family, item_id, new_status)
|
|
1494
|
-
|
|
1602
|
+
final_bookkeeping_ok = getattr(final_bookkeeping, "ok", True)
|
|
1603
|
+
task_commit_ok = getattr(task_commit, "ok", True)
|
|
1604
|
+
finalization_committed = final_bookkeeping_ok and task_commit_ok
|
|
1495
1605
|
if not finalization_committed:
|
|
1496
1606
|
_emit_warning(f"Task finalization commit failed for {item_id}; merge was not attempted and the task checkout remains active")
|
|
1607
|
+
if not final_bookkeeping_ok:
|
|
1608
|
+
_emit_bookkeeping_failure("final bookkeeping", item_id, final_bookkeeping)
|
|
1609
|
+
if not task_commit_ok:
|
|
1610
|
+
_emit_bookkeeping_failure("task branch finalization", item_id, task_commit)
|
|
1611
|
+
if not final_bookkeeping_ok and not task_commit_ok:
|
|
1612
|
+
failure_reason = "finalization_commit_failed"
|
|
1613
|
+
elif not final_bookkeeping_ok:
|
|
1614
|
+
failure_reason = "finalization_bookkeeping_commit_failed"
|
|
1615
|
+
else:
|
|
1616
|
+
failure_reason = "finalization_task_commit_failed"
|
|
1497
1617
|
_write_session_status(
|
|
1498
1618
|
session_paths,
|
|
1499
1619
|
status="commit_missing",
|
|
@@ -1502,7 +1622,7 @@ def _complete_success_merge(
|
|
|
1502
1622
|
task_type=family.task_type,
|
|
1503
1623
|
base_branch=base_branch,
|
|
1504
1624
|
active_dev_branch=branch_name,
|
|
1505
|
-
reason=
|
|
1625
|
+
reason=failure_reason,
|
|
1506
1626
|
fatal_error_code=classification_fatal_error_code,
|
|
1507
1627
|
)
|
|
1508
1628
|
update = update_item(
|
|
@@ -1520,14 +1640,18 @@ def _complete_success_merge(
|
|
|
1520
1640
|
raise RuntimeError(update.text)
|
|
1521
1641
|
_emit_update_summary(family, item_id, update)
|
|
1522
1642
|
commit_missing_status = _status_from_update(update)
|
|
1523
|
-
commit_final_bookkeeping(
|
|
1643
|
+
fallback_bookkeeping = commit_final_bookkeeping(
|
|
1524
1644
|
status_root,
|
|
1525
1645
|
status_family,
|
|
1526
1646
|
item_id,
|
|
1527
1647
|
commit_missing_status,
|
|
1528
1648
|
**_bookkeeping_list_kwargs(status_family, status_invocation),
|
|
1529
1649
|
)
|
|
1530
|
-
|
|
1650
|
+
if getattr(fallback_bookkeeping, "attempted", False) and not getattr(fallback_bookkeeping, "ok", True):
|
|
1651
|
+
_emit_bookkeeping_failure("commit_missing bookkeeping", item_id, fallback_bookkeeping)
|
|
1652
|
+
wip = _save_failure_wip(execution_root, family, item_id, commit_missing_status)
|
|
1653
|
+
if getattr(wip, "attempted", False) and not getattr(wip, "ok", True):
|
|
1654
|
+
_emit_bookkeeping_failure("commit_missing WIP preservation", item_id, wip)
|
|
1531
1655
|
return commit_missing_status
|
|
1532
1656
|
|
|
1533
1657
|
_emit_info(f"Merging {branch_name} into {base_branch}...")
|
|
@@ -1549,12 +1673,22 @@ def _complete_success_merge(
|
|
|
1549
1673
|
raise RuntimeError(f"Task {item_id} checkout identity disappeared before completion")
|
|
1550
1674
|
complete_task_checkout_locked(family.state_dir, checkout)
|
|
1551
1675
|
_emit_success(f"Merged {branch_name} into {base_branch}")
|
|
1552
|
-
artifact_dir =
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1676
|
+
artifact_dir = _resolve_post_merge_artifact_dir(
|
|
1677
|
+
paths.project_root,
|
|
1678
|
+
execution_root,
|
|
1679
|
+
status_family,
|
|
1680
|
+
status_invocation,
|
|
1681
|
+
item_id,
|
|
1682
|
+
artifact_path,
|
|
1683
|
+
metadata,
|
|
1684
|
+
)
|
|
1685
|
+
_emit_pending_rule_proposals_for_item(
|
|
1686
|
+
family,
|
|
1687
|
+
item_id,
|
|
1688
|
+
artifact_dir,
|
|
1689
|
+
paths.project_root,
|
|
1690
|
+
metadata=metadata,
|
|
1691
|
+
)
|
|
1558
1692
|
return new_status
|
|
1559
1693
|
abort_in_progress_git_operation(paths.project_root)
|
|
1560
1694
|
_emit_warning(
|
|
@@ -1761,6 +1895,37 @@ def _latest_session_id(state_dir: Path, item_id: str) -> str:
|
|
|
1761
1895
|
return sorted(sessions)[-1] if sessions else ""
|
|
1762
1896
|
|
|
1763
1897
|
|
|
1898
|
+
def _spec_match_rank(candidate: Path, item_id: str, index: int) -> tuple[int, int, int, int]:
|
|
1899
|
+
"""Rank same-prefix spec directories so active v1 checkpoints beat legacy siblings."""
|
|
1900
|
+
checkpoint = candidate / "workflow-checkpoint.json"
|
|
1901
|
+
if not checkpoint.is_file():
|
|
1902
|
+
return (0, 0, 0, -index)
|
|
1903
|
+
try:
|
|
1904
|
+
data = json.loads(checkpoint.read_text(encoding="utf-8"))
|
|
1905
|
+
except (OSError, ValueError, TypeError):
|
|
1906
|
+
return (0, 0, 0, -index)
|
|
1907
|
+
if not isinstance(data, Mapping):
|
|
1908
|
+
return (0, 0, 0, -index)
|
|
1909
|
+
matches_item = int(str(data.get("item_id") or "") == item_id)
|
|
1910
|
+
has_active_v1 = int(
|
|
1911
|
+
bool(matches_item)
|
|
1912
|
+
and isinstance(data.get("feature_state"), Mapping)
|
|
1913
|
+
and bool(data.get("feature_state"))
|
|
1914
|
+
)
|
|
1915
|
+
try:
|
|
1916
|
+
mtime_ns = checkpoint.stat().st_mtime_ns if matches_item else 0
|
|
1917
|
+
except OSError:
|
|
1918
|
+
mtime_ns = 0
|
|
1919
|
+
return (has_active_v1, matches_item, mtime_ns, -index)
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
def _select_best_spec_match(matches: Sequence[Path], item_id: str) -> Path:
|
|
1923
|
+
return max(
|
|
1924
|
+
enumerate(matches),
|
|
1925
|
+
key=lambda pair: _spec_match_rank(pair[1], item_id, pair[0]),
|
|
1926
|
+
)[1]
|
|
1927
|
+
|
|
1928
|
+
|
|
1764
1929
|
def _artifact_path_for_item(project_root: Path, family: RunnerFamily, item_id: str, metadata: dict[str, object]) -> Path:
|
|
1765
1930
|
if family.kind == "feature":
|
|
1766
1931
|
title = str(metadata.get("title") or "")
|
|
@@ -1773,7 +1938,7 @@ def _artifact_path_for_item(project_root: Path, family: RunnerFamily, item_id: s
|
|
|
1773
1938
|
except OSError:
|
|
1774
1939
|
matches = []
|
|
1775
1940
|
if matches:
|
|
1776
|
-
return matches
|
|
1941
|
+
return _select_best_spec_match(matches, item_id)
|
|
1777
1942
|
return project_root / ".prizmkit" / family.artifact_root_name / item_id
|
|
1778
1943
|
|
|
1779
1944
|
|
|
@@ -1782,18 +1947,19 @@ def _emit_pending_rule_proposals_for_item(
|
|
|
1782
1947
|
item_id: str,
|
|
1783
1948
|
artifact_dir: Path | None,
|
|
1784
1949
|
project_root: Path,
|
|
1950
|
+
metadata: Mapping[str, object] | None = None,
|
|
1785
1951
|
) -> list[dict[str, str]]:
|
|
1786
1952
|
"""Log RULES_PROPOSED entries from retrospective-result.json on completion."""
|
|
1787
1953
|
candidate_dirs: list[Path] = []
|
|
1788
1954
|
if artifact_dir is not None:
|
|
1789
1955
|
candidate_dirs.append(artifact_dir)
|
|
1790
|
-
|
|
1791
|
-
|
|
1956
|
+
else:
|
|
1957
|
+
resolved_dir = _artifact_path_for_item(project_root, family, item_id, dict(metadata or {}))
|
|
1792
1958
|
candidate_dirs.append(resolved_dir)
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1959
|
+
if family.kind == "feature":
|
|
1960
|
+
exact_dir = project_root / ".prizmkit" / "specs" / item_id
|
|
1961
|
+
if exact_dir not in candidate_dirs:
|
|
1962
|
+
candidate_dirs.append(exact_dir)
|
|
1797
1963
|
|
|
1798
1964
|
result_file = next(
|
|
1799
1965
|
(candidate / "retrospective-result.json" for candidate in candidate_dirs if (candidate / "retrospective-result.json").is_file()),
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* PrizmKit Config Command
|
|
3
3
|
*
|
|
4
4
|
* Reconfigure an existing PrizmKit installation without a full reinstall.
|
|
5
|
-
* Supports changing platform
|
|
5
|
+
* Supports changing platform and AI CLI.
|
|
6
6
|
*
|
|
7
7
|
* Flow: READ manifest → PROMPT user → COMPUTE DIFF → DISPLAY SUMMARY → EXECUTE
|
|
8
8
|
*
|
|
@@ -43,13 +43,11 @@ import {
|
|
|
43
43
|
removeSkillFiles,
|
|
44
44
|
removeAgentFiles,
|
|
45
45
|
removeRuleFiles,
|
|
46
|
-
removePipelineFiles,
|
|
47
46
|
} from './upgrade.js';
|
|
48
47
|
import { detectPlatform } from './detect-platform.js';
|
|
49
48
|
import {
|
|
50
49
|
selectPlatform,
|
|
51
50
|
selectAiCliLaunch,
|
|
52
|
-
confirmPipeline,
|
|
53
51
|
confirmAction,
|
|
54
52
|
} from './prompts.js';
|
|
55
53
|
import { canonicalizePlatformSelection, isKnownPlatform, platformLabel, privateProjectMemoryFile, projectMemoryFile, resolvePayloadPlatforms, uniquePlatforms, unknownPlatformMessage } from './platforms.js';
|
|
@@ -536,7 +534,6 @@ export async function runConfig(directory, options = {}) {
|
|
|
536
534
|
runtime: normalizedManifestRuntime,
|
|
537
535
|
suite: rawManifestSuite,
|
|
538
536
|
rules: rawManifestRules,
|
|
539
|
-
pipeline: oldManifest.options?.pipeline ?? true,
|
|
540
537
|
aiCli: userConfig.ai_cli || oldManifest.options?.aiCli || '',
|
|
541
538
|
aiCliLaunch: storedAiCliLaunch(userConfig),
|
|
542
539
|
};
|
|
@@ -554,7 +551,6 @@ export async function runConfig(directory, options = {}) {
|
|
|
554
551
|
console.log(` 平台: ${chalk.cyan(platformLabel(currentConfig.platform))}`);
|
|
555
552
|
console.log(` 运行时: ${chalk.cyan(runtimeLabel(currentConfig.runtime))}`);
|
|
556
553
|
console.log(` AI CLI: ${currentConfig.aiCli ? chalk.cyan(currentConfig.aiCli) : chalk.gray('(未设置)')}`);
|
|
557
|
-
console.log(` 流水线: ${currentConfig.pipeline ? chalk.green('启用') : chalk.gray('禁用')}`);
|
|
558
554
|
console.log('');
|
|
559
555
|
|
|
560
556
|
// ── Phase 2: PROMPT for new config ───────────────────────────────────────
|
|
@@ -575,10 +571,9 @@ export async function runConfig(directory, options = {}) {
|
|
|
575
571
|
&& options.runtime === undefined
|
|
576
572
|
&& options.aiCli === undefined
|
|
577
573
|
&& options.headlessPromptArg === undefined
|
|
578
|
-
&& options.headlessExtraArgs === undefined
|
|
579
|
-
&& options.pipeline === undefined) {
|
|
574
|
+
&& options.headlessExtraArgs === undefined) {
|
|
580
575
|
console.log(chalk.yellow(' ⚠ 非交互式模式下未指定任何变更。'));
|
|
581
|
-
console.log(chalk.gray(' 使用 --platform, --runtime, --ai-cli, --headless-prompt-arg, --headless-extra-args
|
|
576
|
+
console.log(chalk.gray(' 使用 --platform, --runtime, --ai-cli, --headless-prompt-arg, --headless-extra-args'));
|
|
582
577
|
return;
|
|
583
578
|
}
|
|
584
579
|
|
|
@@ -593,12 +588,11 @@ export async function runConfig(directory, options = {}) {
|
|
|
593
588
|
runtime: optionRuntime || currentConfig.runtime,
|
|
594
589
|
suite: targetSuite,
|
|
595
590
|
rules: targetRules,
|
|
596
|
-
pipeline: options.pipeline !== undefined ? options.pipeline : currentConfig.pipeline,
|
|
597
591
|
aiCli: aiCliLaunchValue.aiCli,
|
|
598
592
|
aiCliLaunch: aiCliLaunchValue.aiCliLaunch,
|
|
599
593
|
};
|
|
600
594
|
} else {
|
|
601
|
-
// Interactive: platform
|
|
595
|
+
// Interactive: platform and AI CLI only
|
|
602
596
|
const detected = detectPlatform();
|
|
603
597
|
|
|
604
598
|
try {
|
|
@@ -607,14 +601,12 @@ export async function runConfig(directory, options = {}) {
|
|
|
607
601
|
const newRuntime = optionRuntime || currentConfig.runtime;
|
|
608
602
|
const newPlatform = await selectPlatform(currentConfig.platform, detected);
|
|
609
603
|
const aiCliSelection = await selectAiCliLaunch(currentConfig.aiCli, detected, currentConfig.aiCliLaunch);
|
|
610
|
-
const newPipeline = await confirmPipeline(currentConfig.pipeline);
|
|
611
604
|
|
|
612
605
|
newConfig = {
|
|
613
606
|
platform: newPlatform,
|
|
614
607
|
runtime: newRuntime,
|
|
615
608
|
suite: targetSuite,
|
|
616
609
|
rules: targetRules,
|
|
617
|
-
pipeline: newPipeline,
|
|
618
610
|
aiCli: aiCliSelection.aiCli,
|
|
619
611
|
aiCliLaunch: aiCliSelection.aiCliLaunch,
|
|
620
612
|
};
|
|
@@ -657,9 +649,6 @@ export async function runConfig(directory, options = {}) {
|
|
|
657
649
|
if (rulesManifestNeedsNormalization) {
|
|
658
650
|
changes.push(`规则: ${currentConfig.rules} → 全部内置规则`);
|
|
659
651
|
}
|
|
660
|
-
if (newConfig.pipeline !== currentConfig.pipeline) {
|
|
661
|
-
changes.push(`流水线: ${currentConfig.pipeline ? '启用' : '禁用'} → ${newConfig.pipeline ? '启用' : '禁用'}`);
|
|
662
|
-
}
|
|
663
652
|
|
|
664
653
|
// ── Phase 4: DISPLAY SUMMARY + CONFIRM ───────────────────────────────────
|
|
665
654
|
|
|
@@ -713,7 +702,7 @@ export async function runConfig(directory, options = {}) {
|
|
|
713
702
|
const newSkillList = await resolveSkillList();
|
|
714
703
|
const rulesMeta = await loadRulesMetadata();
|
|
715
704
|
const newRuleFiles = resolveRuleNamesForRuntime(rulesMeta, newConfig.runtime).map(name => `${name}.md`);
|
|
716
|
-
const newPipelineFiles =
|
|
705
|
+
const newPipelineFiles = resolvePipelineFileList(newConfig.runtime);
|
|
717
706
|
|
|
718
707
|
// 5a. Migrate project memory before removing dropped platforms
|
|
719
708
|
for (const p of platformsToRemove) {
|
|
@@ -785,22 +774,17 @@ export async function runConfig(directory, options = {}) {
|
|
|
785
774
|
await installBuiltinRules(projectRoot, false, newConfig.runtime);
|
|
786
775
|
}
|
|
787
776
|
|
|
788
|
-
// 5e. Pipeline
|
|
789
|
-
if (newConfig.
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
await
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
if (oldPipelineFiles.length) {
|
|
800
|
-
await removePipelineFiles(projectRoot, oldPipelineFiles, false);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
} else if (newConfig.pipeline) {
|
|
777
|
+
// 5e. Pipeline
|
|
778
|
+
if (newConfig.runtime !== currentConfig.runtime
|
|
779
|
+
|| runtimeManifestNeedsNormalization
|
|
780
|
+
|| runtimeOptionNeedsNormalization
|
|
781
|
+
|| !await fs.pathExists(path.join(projectRoot, '.prizmkit', 'dev-pipeline', 'cli.py'))) {
|
|
782
|
+
console.log(chalk.blue('\n 安装 Pipeline:'));
|
|
783
|
+
await installPipeline(projectRoot, false, {
|
|
784
|
+
runtime: newConfig.runtime,
|
|
785
|
+
previousRuntime: currentConfig.runtime,
|
|
786
|
+
});
|
|
787
|
+
} else {
|
|
804
788
|
const staleManagedPipelineFiles = await findStaleManagedPipelineFiles(projectRoot, newConfig.runtime);
|
|
805
789
|
if (staleManagedPipelineFiles.length) {
|
|
806
790
|
console.log(chalk.blue('\n 移除过期 Pipeline 框架文件:'));
|
|
@@ -867,6 +851,5 @@ export async function runConfig(directory, options = {}) {
|
|
|
867
851
|
console.log(chalk.gray(` 平台: ${platformLabel(newConfig.platform)}`));
|
|
868
852
|
console.log(chalk.gray(` 运行时: ${runtimeLabel(newConfig.runtime)}`));
|
|
869
853
|
console.log(chalk.gray(` AI CLI: ${newConfig.aiCli || '(未设置)'}`));
|
|
870
|
-
console.log(chalk.gray(` 流水线: ${newConfig.pipeline ? '启用' : '禁用'}`));
|
|
871
854
|
console.log('');
|
|
872
855
|
}
|
package/src/index.js
CHANGED
|
@@ -68,7 +68,6 @@ export async function runScaffold(directory, options = {}) {
|
|
|
68
68
|
|
|
69
69
|
// 兼容旧 --skills 参数:输出弃用警告并始终归一为 core
|
|
70
70
|
const skillSuite = normalizeSkillSuite(options.skills, { warn: true, warnOnCore: true });
|
|
71
|
-
const pipeline = options.pipeline !== false;
|
|
72
71
|
|
|
73
72
|
// === 非交互式模式 ===
|
|
74
73
|
if (options.nonInteractive) {
|
|
@@ -80,7 +79,6 @@ export async function runScaffold(directory, options = {}) {
|
|
|
80
79
|
platform: options.platform,
|
|
81
80
|
runtime: normalizeRuntime(options.runtime),
|
|
82
81
|
skills: skillSuite,
|
|
83
|
-
pipeline,
|
|
84
82
|
aiCli: options.aiCli || '',
|
|
85
83
|
aiCliLaunch: resolveAiCliLaunchSelection(options.aiCli || '', {
|
|
86
84
|
headlessPromptArg: options.headlessPromptArg,
|
|
@@ -114,7 +112,7 @@ export async function runScaffold(directory, options = {}) {
|
|
|
114
112
|
console.log(` 运行时: ${chalk.cyan(runtimeLabel(runtime))}`);
|
|
115
113
|
console.log(` 平台: ${chalk.cyan(selectedPlatformLabel)}`);
|
|
116
114
|
console.log(` 技能: ${chalk.cyan(`Core (${coreSkillCount} 个)`)}`);
|
|
117
|
-
console.log(` 流水线: ${
|
|
115
|
+
console.log(` 流水线: ${chalk.cyan('dev-pipeline')}`);
|
|
118
116
|
console.log(` 规则: ${chalk.cyan(`全部内置规则 (${ruleCount} 条)`)}`);
|
|
119
117
|
if (aiCli) console.log(` AI CLI: ${chalk.cyan(aiCli)}`);
|
|
120
118
|
console.log(` 目标目录: ${projectRoot}`);
|
|
@@ -131,7 +129,6 @@ export async function runScaffold(directory, options = {}) {
|
|
|
131
129
|
platform,
|
|
132
130
|
runtime,
|
|
133
131
|
skills: skillSuite,
|
|
134
|
-
pipeline,
|
|
135
132
|
aiCli: aiCli || '',
|
|
136
133
|
aiCliLaunch,
|
|
137
134
|
projectRoot,
|
package/src/manifest.js
CHANGED
|
@@ -18,7 +18,7 @@ const MANIFEST_FIELDS = new Set([
|
|
|
18
18
|
'version', 'installedAt', 'updatedAt', 'platform', 'runtime', 'suite',
|
|
19
19
|
'options', 'files',
|
|
20
20
|
]);
|
|
21
|
-
const MANIFEST_OPTION_FIELDS = new Set(['
|
|
21
|
+
const MANIFEST_OPTION_FIELDS = new Set(['rules', 'aiCli']);
|
|
22
22
|
const MANIFEST_FILE_FIELDS = new Set([
|
|
23
23
|
'skills', 'rules', 'pipeline', 'payloadPlatforms', 'memory',
|
|
24
24
|
]);
|
|
@@ -138,7 +138,7 @@ export async function writeManifest(projectRoot, data) {
|
|
|
138
138
|
* @param {string} params.suite - skill suite name
|
|
139
139
|
* @param {string[]} params.skills - resolved skill name list
|
|
140
140
|
* @param {string[]} params.rules - rule file names (e.g. ['prizm-documentation.md'])
|
|
141
|
-
* @param {string[]} params.pipeline - pipeline file relative paths
|
|
141
|
+
* @param {string[]} params.pipeline - pipeline file relative paths
|
|
142
142
|
* @param {string} [params.aiCli] - AI CLI command
|
|
143
143
|
* @param {string} [params.rulesPreset] - rules preset name
|
|
144
144
|
* @param {string[]} [params.payloadPlatforms] - concrete platform payloads installed for platform + aiCli
|
|
@@ -168,7 +168,6 @@ export function buildManifest({
|
|
|
168
168
|
runtime: normalizeRuntime(runtime),
|
|
169
169
|
suite,
|
|
170
170
|
options: {
|
|
171
|
-
pipeline: Array.isArray(pipeline) ? pipeline.length > 0 : Boolean(pipeline),
|
|
172
171
|
rules: rulesPreset || 'recommended',
|
|
173
172
|
aiCli: aiCli || '',
|
|
174
173
|
},
|
package/src/prompts.js
CHANGED
|
@@ -205,19 +205,6 @@ export async function selectAiCliLaunch(currentCommand, detected = {}, currentLa
|
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
/**
|
|
209
|
-
* Confirm pipeline setting.
|
|
210
|
-
* @param {boolean} currentValue - current pipeline value
|
|
211
|
-
* @returns {Promise<boolean>}
|
|
212
|
-
*/
|
|
213
|
-
export async function confirmPipeline(currentValue = true) {
|
|
214
|
-
const pipeline = await confirmPrompt({
|
|
215
|
-
message: '安装自动化流水线 (dev-pipeline)?',
|
|
216
|
-
default: currentValue,
|
|
217
|
-
});
|
|
218
|
-
return pipeline;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
208
|
/**
|
|
222
209
|
* Confirm an interactive install or config action.
|
|
223
210
|
* @param {string} message - prompt message
|
package/src/scaffold.js
CHANGED
|
@@ -1519,7 +1519,7 @@ export async function installGitignore(projectRoot, options = {}, dryRun) {
|
|
|
1519
1519
|
// ============================================================
|
|
1520
1520
|
|
|
1521
1521
|
const SCAFFOLD_CONFIG_FIELDS = new Set([
|
|
1522
|
-
'platform', 'runtime', 'skills', '
|
|
1522
|
+
'platform', 'runtime', 'skills', 'aiCli', 'aiCliLaunch',
|
|
1523
1523
|
'projectRoot', 'dryRun',
|
|
1524
1524
|
]);
|
|
1525
1525
|
|
|
@@ -1529,7 +1529,6 @@ const SCAFFOLD_CONFIG_FIELDS = new Set([
|
|
|
1529
1529
|
* @param {string} config.platform - 'codebuddy' | 'claude' | 'codex' | 'pi' | 'cursor' | 'antigravity' | 'all' | comma-separated subset
|
|
1530
1530
|
* @param {string} [config.runtime] - 'python' (legacy aliases accepted: 'unix' | 'windows')
|
|
1531
1531
|
* @param {string} [config.skills] - sole supported suite is 'core' (legacy values warn and normalize to 'core')
|
|
1532
|
-
* @param {boolean} config.pipeline - 是否安装 dev-pipeline
|
|
1533
1532
|
* @param {string} [config.aiCli] - AI CLI 可执行命令(写入 .prizmkit/config.json)
|
|
1534
1533
|
* @param {string} config.projectRoot - 目标项目根目录
|
|
1535
1534
|
* @param {boolean} config.dryRun - 是否为预览模式
|
|
@@ -1544,7 +1543,7 @@ export async function scaffold(config) {
|
|
|
1544
1543
|
if (unknownFields.length) {
|
|
1545
1544
|
throw new TypeError(`scaffold config has unknown fields: ${unknownFields.join(', ')}`);
|
|
1546
1545
|
}
|
|
1547
|
-
const { platform, skills,
|
|
1546
|
+
const { platform, skills, aiCli, aiCliLaunch, projectRoot, dryRun } = config;
|
|
1548
1547
|
const normalizedSuite = normalizeSkillSuite(skills, { warn: true, warnOnCore: false });
|
|
1549
1548
|
const runtime = normalizeRuntime(config.runtime);
|
|
1550
1549
|
const launchSelection = resolveAiCliLaunchSelection(aiCli || '', {
|
|
@@ -1608,12 +1607,9 @@ export async function scaffold(config) {
|
|
|
1608
1607
|
});
|
|
1609
1608
|
|
|
1610
1609
|
// 6. Pipeline
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
installedPipelineFiles = await installPipeline(projectRoot, dryRun, { runtime }) || [];
|
|
1615
|
-
console.log('');
|
|
1616
|
-
}
|
|
1610
|
+
console.log(chalk.blue(' 自动化流水线:'));
|
|
1611
|
+
const installedPipelineFiles = await installPipeline(projectRoot, dryRun, { runtime }) || [];
|
|
1612
|
+
console.log('');
|
|
1617
1613
|
|
|
1618
1614
|
// 7. .gitignore
|
|
1619
1615
|
console.log(chalk.blue(' 项目配置:'));
|
|
@@ -1717,11 +1713,8 @@ export async function scaffold(config) {
|
|
|
1717
1713
|
? '输入 "/prizmkit-init"'
|
|
1718
1714
|
: '说 "/prizmkit-init"';
|
|
1719
1715
|
console.log(` 3. ${chalk.cyan(initInstruction)} ${chalk.gray('# 初始化项目上下文')}`);
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
console.log(` 4. ${chalk.cyan('说 "规划一个应用"')} ${chalk.gray('# 生成 feature-list.json')}`);
|
|
1723
|
-
console.log(` 5. ${chalk.cyan('说 "启动流水线"')} ${chalk.gray('# 开始自动开发')}`);
|
|
1724
|
-
}
|
|
1716
|
+
console.log(` 4. ${chalk.cyan('说 "规划一个应用"')} ${chalk.gray('# 生成 feature-list.json')}`);
|
|
1717
|
+
console.log(` 5. ${chalk.cyan('说 "启动流水线"')} ${chalk.gray('# 开始自动开发')}`);
|
|
1725
1718
|
|
|
1726
1719
|
console.log('');
|
|
1727
1720
|
|
|
@@ -1733,7 +1726,7 @@ export async function scaffold(config) {
|
|
|
1733
1726
|
console.log(chalk.gray(` AI CLI 载荷平台: ${payloadPlatforms.map(platformLabel).join(' + ')}`));
|
|
1734
1727
|
}
|
|
1735
1728
|
console.log(chalk.gray(` 运行时: ${runtimeLabel(runtime)}`));
|
|
1736
|
-
console.log(chalk.gray(` 流水线:
|
|
1729
|
+
console.log(chalk.gray(` 流水线: 已安装`));
|
|
1737
1730
|
console.log(chalk.gray(` 规则: 全部内置规则`));
|
|
1738
1731
|
if (resolvedAiCli) console.log(chalk.gray(` AI CLI: ${resolvedAiCli}`));
|
|
1739
1732
|
console.log('');
|
package/src/upgrade.js
CHANGED
|
@@ -339,7 +339,6 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
339
339
|
// 3. Resolve new skill list and built-in rules (migrating legacy minimal suites/presets)
|
|
340
340
|
const suite = 'core';
|
|
341
341
|
const runtime = normalizeRuntime(oldManifest?.runtime);
|
|
342
|
-
const pipeline = oldManifest?.options?.pipeline ?? true;
|
|
343
342
|
const rulesPreset = 'recommended';
|
|
344
343
|
const aiCli = userConfig.ai_cli || oldManifest?.options?.aiCli || '';
|
|
345
344
|
|
|
@@ -389,7 +388,7 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
389
388
|
const newRuleFiles = resolveRuleNamesForRuntime(rulesMeta, runtime).map(name => `${name}.md`);
|
|
390
389
|
|
|
391
390
|
// Resolve pipeline file list from source (for manifest diff)
|
|
392
|
-
const newPipelineFiles =
|
|
391
|
+
const newPipelineFiles = resolvePipelineFileList(runtime);
|
|
393
392
|
|
|
394
393
|
const payloadPlatforms = resolvePayloadPlatforms(platform, aiCli);
|
|
395
394
|
|
|
@@ -414,10 +413,8 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
414
413
|
|
|
415
414
|
const diff = oldManifest ? diffManifest(oldManifest, newManifest) : { skills: { added: [], removed: [] }, rules: { added: [], removed: [] }, pipeline: { added: [], removed: [] } };
|
|
416
415
|
const removedPipelineSet = new Set(diff.pipeline.removed);
|
|
417
|
-
const staleManagedPipelineFiles =
|
|
418
|
-
|
|
419
|
-
.filter(file => !removedPipelineSet.has(file))
|
|
420
|
-
: [];
|
|
416
|
+
const staleManagedPipelineFiles = (await findStaleManagedPipelineFiles(projectRoot, runtime))
|
|
417
|
+
.filter(file => !removedPipelineSet.has(file));
|
|
421
418
|
|
|
422
419
|
// 5. Display upgrade summary
|
|
423
420
|
const oldVersion = oldManifest?.version || 'unknown';
|
|
@@ -511,11 +508,9 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
511
508
|
console.log('');
|
|
512
509
|
|
|
513
510
|
// Pipeline (with forceOverwrite)
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
console.log('');
|
|
518
|
-
}
|
|
511
|
+
console.log(chalk.blue(' Pipeline:'));
|
|
512
|
+
await installPipeline(projectRoot, dryRun, { forceOverwrite: true, runtime });
|
|
513
|
+
console.log('');
|
|
519
514
|
|
|
520
515
|
// Git hook
|
|
521
516
|
console.log(chalk.blue(' Git Hook:'));
|