prizmkit 1.1.191 → 1.1.192
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/adapters/antigravity/skill-adapter.js +13 -4
- package/bundled/adapters/codex/skill-adapter.js +28 -8
- package/bundled/adapters/cursor/skill-adapter.js +13 -4
- package/bundled/adapters/pi/skill-adapter.js +28 -7
- package/bundled/dev-pipeline/.env.example +4 -12
- package/bundled/dev-pipeline/README.md +5 -10
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +3 -6
- package/bundled/dev-pipeline/prizmkit_runtime/atomic_io.py +48 -0
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +66 -23
- package/bundled/dev-pipeline/prizmkit_runtime/cli.py +10 -7
- package/bundled/dev-pipeline/prizmkit_runtime/commands.py +2 -21
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +24 -76
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +125 -67
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +77 -430
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +93 -49
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -3
- package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -6
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +36 -14
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +206 -151
- package/bundled/dev-pipeline/prizmkit_runtime/reset.py +2 -23
- package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +15 -134
- package/bundled/dev-pipeline/prizmkit_runtime/results.py +25 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +68 -83
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +15 -5
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -29
- package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +7 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +276 -217
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +124 -122
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +90 -9
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +183 -130
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +1 -3
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +2780 -0
- package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +27 -101
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +58 -4
- package/bundled/dev-pipeline/scripts/check-session-status.py +43 -19
- package/bundled/dev-pipeline/scripts/continuation.py +6 -4
- package/bundled/dev-pipeline/scripts/detect-stuck.py +28 -28
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +10 -7
- package/bundled/dev-pipeline/scripts/init-change-artifact.py +8 -2
- package/bundled/dev-pipeline/scripts/init-pipeline.py +14 -69
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +31 -2616
- package/bundled/dev-pipeline/scripts/patch-completion-notes.py +4 -24
- package/bundled/dev-pipeline/scripts/prompt_framework.py +56 -9
- package/bundled/dev-pipeline/scripts/status_common.py +591 -0
- package/bundled/dev-pipeline/scripts/update-bug-status.py +85 -463
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +227 -65
- package/bundled/dev-pipeline/scripts/update-feature-status.py +76 -509
- package/bundled/dev-pipeline/scripts/utils.py +5 -12
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +4 -4
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +7 -0
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -6
- package/bundled/dev-pipeline/templates/session-status-schema.json +2 -5
- package/bundled/dev-pipeline/tests/_helpers.py +418 -0
- package/bundled/dev-pipeline/tests/conftest.py +45 -1
- package/bundled/dev-pipeline/tests/test_auto_skip.py +4 -69
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +126 -1
- package/bundled/dev-pipeline/tests/test_daemon_and_scripts.py +257 -0
- package/bundled/dev-pipeline/tests/test_e2e_pipeline_run.py +500 -0
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +59 -117
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +12 -10
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +431 -3099
- package/bundled/dev-pipeline/tests/test_recovery_workflow.py +7 -8
- package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -1
- package/bundled/dev-pipeline/tests/test_reset_modes.py +15 -27
- package/bundled/dev-pipeline/tests/test_reset_preserve.py +54 -139
- package/bundled/dev-pipeline/tests/test_runner_bookkeeping.py +766 -0
- package/bundled/dev-pipeline/tests/test_runner_lifecycle.py +1257 -0
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +97 -20
- package/bundled/dev-pipeline/tests/test_session_launch.py +1101 -0
- package/bundled/dev-pipeline/tests/test_stream_progress.py +585 -0
- package/bundled/dev-pipeline/tests/test_unified_cli.py +155 -2034
- package/bundled/dev-pipeline/tests/test_utils.py +3 -3
- package/bundled/skills/_metadata.json +9 -63
- package/bundled/skills/app-planner/SKILL.md +32 -303
- package/bundled/skills/app-planner/references/app-design-guide.md +0 -4
- package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
- package/bundled/skills/app-planner/references/project-brief-guide.md +14 -0
- package/bundled/skills/app-planner/references/project-conventions-discovery.md +4 -6
- package/bundled/skills/app-planner/references/project-state-detection.md +2 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +1 -2
- package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +4 -7
- package/bundled/skills/bug-planner/SKILL.md +54 -435
- package/bundled/skills/bug-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/bug-planner/references/input-formats.md +32 -0
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-planner/SKILL.md +60 -439
- package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
- package/bundled/skills/feature-planner/references/completeness-review.md +34 -0
- package/bundled/skills/feature-planner/references/decomposition-patterns.md +2 -2
- package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
- package/bundled/skills/feature-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/feature-planner/references/incremental-feature-planning.md +3 -1
- package/bundled/skills/feature-workflow/SKILL.md +1 -2
- package/bundled/skills/prizmkit/SKILL.md +7 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +14 -6
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +7 -4
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +16 -0
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +58 -20
- package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +24 -127
- package/bundled/skills/prizmkit-init/assets/project-brief-template.md +3 -3
- package/bundled/skills/prizmkit-plan/SKILL.md +6 -8
- package/bundled/skills/prizmkit-plan/references/clarify-guide.md +1 -1
- package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +5 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +6 -5
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +1 -13
- package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +6 -4
- package/bundled/skills/prizmkit-test/SKILL.md +25 -133
- package/bundled/skills/prizmkit-test/references/independent-test-review.md +5 -2
- package/bundled/skills/prizmkit-test/references/test-coverage-model.md +6 -0
- package/bundled/skills/prizmkit-workflow/SKILL.md +2 -3
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +4 -3
- package/bundled/skills/recovery-workflow/SKILL.md +7 -7
- package/bundled/skills/recovery-workflow/evals/evals.json +1 -1
- package/bundled/skills/recovery-workflow/references/detection.md +1 -3
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +0 -6
- package/bundled/templates/project-memory-template.md +1 -2
- package/package.json +1 -1
- package/src/scaffold.js +28 -7
- package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +0 -53
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +0 -649
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +0 -463
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +0 -1512
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -240
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +0 -266
- package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +0 -15
- package/bundled/dev-pipeline/templates/sections/refactor-mission.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +0 -16
- package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +0 -22
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +0 -19
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +0 -12
- package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -6
- package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +0 -52
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +0 -478
- package/bundled/skills/feature-planner/assets/evaluation-guide.md +0 -44
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +0 -219
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +0 -78
- package/bundled/skills/refactor-planner/SKILL.md +0 -467
- package/bundled/skills/refactor-planner/assets/planning-guide.md +0 -291
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +0 -187
- package/bundled/skills/refactor-planner/references/error-recovery.md +0 -45
- package/bundled/skills/refactor-planner/references/fast-path.md +0 -59
- package/bundled/skills/refactor-planner/references/generated-plan-review.md +0 -107
- package/bundled/skills/refactor-planner/references/planning-phases.md +0 -172
- package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +0 -230
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +0 -1120
- package/bundled/skills/refactor-workflow/SKILL.md +0 -205
package/bundled/VERSION.json
CHANGED
|
@@ -6,7 +6,10 @@ function applyAntigravityInteractionCompatibility(content) {
|
|
|
6
6
|
const fallback =
|
|
7
7
|
"Use Antigravity's `ask_question` tool when it is available. If it is unavailable in the current surface, ask the same question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults.";
|
|
8
8
|
return content
|
|
9
|
-
.replace(
|
|
9
|
+
.replace(
|
|
10
|
+
/Use `AskUserQuestion`; do not render path options as plain text\./g,
|
|
11
|
+
fallback,
|
|
12
|
+
)
|
|
10
13
|
.replace(
|
|
11
14
|
/Do NOT render options as plain text — the user must be able to click\/select\./g,
|
|
12
15
|
fallback,
|
|
@@ -14,15 +17,21 @@ function applyAntigravityInteractionCompatibility(content) {
|
|
|
14
17
|
.replace(
|
|
15
18
|
/Do NOT render options as plain text \(e\.g\., `\[A\] option \[B\] option`\) — the user must be able to click\/select, not type a letter\./g,
|
|
16
19
|
fallback,
|
|
17
|
-
)
|
|
20
|
+
)
|
|
21
|
+
.replace(/`AskUserQuestion`/g, "Antigravity's `ask_question` tool")
|
|
22
|
+
.replace(/\bAskUserQuestion\b/g, "Antigravity's `ask_question` tool");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function convertSkillReference(content, skillName) {
|
|
26
|
+
return applyAntigravityInteractionCompatibility(content)
|
|
27
|
+
.replace(/\$\{SKILL_DIR\}/g, `${SKILLS_DIR}/${skillName}`);
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
export function convertSkill(skillContent, skillName) {
|
|
21
31
|
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
22
32
|
if (!frontmatter.name) frontmatter.name = skillName;
|
|
23
33
|
|
|
24
|
-
const convertedBody =
|
|
25
|
-
.replace(/\$\{SKILL_DIR\}/g, `${SKILLS_DIR}/${skillName}`);
|
|
34
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
26
35
|
const note = `> Antigravity project install: Antigravity discovers this Skill from \`${SKILLS_DIR}/${skillName}/SKILL.md\`. Invoke it as \`/${skillName}\` when manual invocation is needed.\n>\n> Antigravity interaction compatibility: use Antigravity's \`ask_question\` tool when available. If the current surface does not expose it, ask the same required question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults. Only true headless runs with no conversational user may use documented conservative defaults.\n\n`;
|
|
27
36
|
|
|
28
37
|
return buildMarkdown(frontmatter, note + convertedBody);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
10
10
|
import { SKILL_DEFINITION_FILE } from './paths.js';
|
|
11
11
|
import { existsSync, mkdirSync, cpSync, readdirSync } from 'node:fs';
|
|
12
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
12
|
+
import { readdir, readFile, writeFile } from 'node:fs/promises';
|
|
13
13
|
import path from 'path';
|
|
14
14
|
|
|
15
15
|
function toCodexSkillReference(commandName) {
|
|
@@ -35,17 +35,13 @@ function applyCodexInteractionCompatibility(content) {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!frontmatter.name) frontmatter.name = skillName;
|
|
42
|
-
|
|
43
|
-
let convertedBody = applyCodexInteractionCompatibility(body).replace(
|
|
38
|
+
export function convertSkillReference(content, skillName) {
|
|
39
|
+
let converted = applyCodexInteractionCompatibility(content).replace(
|
|
44
40
|
/\$\{SKILL_DIR\}/g,
|
|
45
41
|
`.agents/skills/${skillName}`
|
|
46
42
|
);
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
converted = converted.replace(
|
|
49
45
|
/prizmkit\.(\w+)/g,
|
|
50
46
|
(_match, sub) => {
|
|
51
47
|
const commandName = `prizmkit-${sub.replace(/_/g, '-')}`;
|
|
@@ -53,11 +49,34 @@ export function convertSkill(skillContent, skillName) {
|
|
|
53
49
|
}
|
|
54
50
|
);
|
|
55
51
|
|
|
52
|
+
return converted;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function convertSkill(skillContent, skillName) {
|
|
56
|
+
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
57
|
+
|
|
58
|
+
if (!frontmatter.name) frontmatter.name = skillName;
|
|
59
|
+
|
|
60
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
61
|
+
|
|
56
62
|
const codexNote = `> Codex project install: an explicitly named PrizmKit Skill resolves to the same command name under \`.agents/skills/<command-name>/SKILL.md\`.\n>\n> Codex interaction compatibility: when this skill or any referenced PrizmKit file says \`AskUserQuestion\`, use Codex \`request_user_input\` if it is available. If the current Codex surface does not expose \`request_user_input\`, including Default mode, ask the same question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults. If a source instruction asks more questions than Codex allows in one call, split them into multiple calls while preserving order. Only true headless/non-interactive runs, such as \`codex exec\` automation with no conversational user available, may skip interaction and choose documented defaults; never silently choose defaults in an interactive session.\n\n`;
|
|
57
63
|
|
|
58
64
|
return buildMarkdown(frontmatter, codexNote + convertedBody);
|
|
59
65
|
}
|
|
60
66
|
|
|
67
|
+
async function convertReferenceMarkdownDir(dirPath, skillName) {
|
|
68
|
+
if (!existsSync(dirPath)) return;
|
|
69
|
+
for (const entry of await readdir(dirPath, { withFileTypes: true })) {
|
|
70
|
+
const entryPath = path.join(dirPath, entry.name);
|
|
71
|
+
if (entry.isDirectory()) {
|
|
72
|
+
await convertReferenceMarkdownDir(entryPath, skillName);
|
|
73
|
+
} else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
74
|
+
const raw = await readFile(entryPath, 'utf8');
|
|
75
|
+
await writeFile(entryPath, convertSkillReference(raw, skillName), 'utf8');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
61
80
|
export async function installSkill(corePath, targetRoot) {
|
|
62
81
|
const skillName = path.basename(corePath);
|
|
63
82
|
const targetDir = path.join(targetRoot, '.agents', 'skills', skillName);
|
|
@@ -80,5 +99,6 @@ export async function installSkill(corePath, targetRoot) {
|
|
|
80
99
|
);
|
|
81
100
|
}
|
|
82
101
|
}
|
|
102
|
+
await convertReferenceMarkdownDir(path.join(targetDir, 'references'), skillName);
|
|
83
103
|
}
|
|
84
104
|
}
|
|
@@ -4,7 +4,10 @@ import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
|
4
4
|
function applyCursorInteractionCompatibility(content) {
|
|
5
5
|
const fallback = 'Use Cursor\'s Ask Questions capability when it is available. If it is unavailable in the current surface, ask the same question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults.';
|
|
6
6
|
return content
|
|
7
|
-
.replace(
|
|
7
|
+
.replace(
|
|
8
|
+
/Use `AskUserQuestion`; do not render path options as plain text\./g,
|
|
9
|
+
fallback,
|
|
10
|
+
)
|
|
8
11
|
.replace(
|
|
9
12
|
/Do NOT render options as plain text — the user must be able to click\/select\./g,
|
|
10
13
|
fallback,
|
|
@@ -12,15 +15,21 @@ function applyCursorInteractionCompatibility(content) {
|
|
|
12
15
|
.replace(
|
|
13
16
|
/Do NOT render options as plain text \(e\.g\., `\[A\] option \[B\] option`\) — the user must be able to click\/select, not type a letter\./g,
|
|
14
17
|
fallback,
|
|
15
|
-
)
|
|
18
|
+
)
|
|
19
|
+
.replace(/`AskUserQuestion`/g, "Cursor's Ask Questions capability")
|
|
20
|
+
.replace(/\bAskUserQuestion\b/g, "Cursor's Ask Questions capability");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function convertSkillReference(content, skillName) {
|
|
24
|
+
return applyCursorInteractionCompatibility(content)
|
|
25
|
+
.replace(/\$\{SKILL_DIR\}/g, `.cursor/skills/${skillName}`);
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
export function convertSkill(skillContent, skillName) {
|
|
19
29
|
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
20
30
|
if (!frontmatter.name) frontmatter.name = skillName;
|
|
21
31
|
|
|
22
|
-
const convertedBody =
|
|
23
|
-
.replace(/\$\{SKILL_DIR\}/g, `.cursor/skills/${skillName}`);
|
|
32
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
24
33
|
const note = `> Cursor project install: Cursor discovers this Agent Skill from \`.cursor/skills/${skillName}/SKILL.md\`. Invoke it as \`/${skillName}\` when manual invocation is needed.\n>\n> Cursor interaction compatibility: use Cursor's Ask Questions capability when available. If the current Cursor surface does not expose it, ask the same required question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults. Only true headless runs with no conversational user may use documented conservative defaults.\n\n`;
|
|
25
34
|
|
|
26
35
|
return buildMarkdown(frontmatter, note + convertedBody);
|
|
@@ -2,18 +2,39 @@
|
|
|
2
2
|
import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
3
3
|
|
|
4
4
|
function applyPiInteractionCompatibility(content) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const chatFallback =
|
|
6
|
+
'Ask the same options directly in chat and wait for an explicit answer. Do not choose defaults silently.';
|
|
7
|
+
return content
|
|
8
|
+
.replace(
|
|
9
|
+
/Use `AskUserQuestion`; do not render path options as plain text\./g,
|
|
10
|
+
chatFallback,
|
|
11
|
+
)
|
|
12
|
+
.replace(
|
|
13
|
+
/Do NOT render options as plain text[^\n]*\./g,
|
|
14
|
+
chatFallback,
|
|
15
|
+
)
|
|
16
|
+
.replace(/clickable options, never plain text; /g, 'explicit choices in chat; ')
|
|
17
|
+
.replace(/\(never plain text; /g, '(wait for explicit choice in chat; ')
|
|
18
|
+
.replace(
|
|
19
|
+
/`AskUserQuestion`/g,
|
|
20
|
+
'ask the same question directly in chat and wait for explicit user input',
|
|
21
|
+
)
|
|
22
|
+
.replace(
|
|
23
|
+
/\bAskUserQuestion\b/g,
|
|
24
|
+
'ask the same question directly in chat and wait for explicit user input',
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function convertSkillReference(content, skillName) {
|
|
29
|
+
return applyPiInteractionCompatibility(content)
|
|
30
|
+
.replace(/\/(prizmkit-[a-z0-9-]+)/g, '/skill:$1')
|
|
31
|
+
.replace(/\$\{SKILL_DIR\}/g, `.pi/skills/${skillName}`);
|
|
9
32
|
}
|
|
10
33
|
|
|
11
34
|
export function convertSkill(skillContent, skillName) {
|
|
12
35
|
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
13
36
|
if (!frontmatter.name) frontmatter.name = skillName;
|
|
14
|
-
const convertedBody =
|
|
15
|
-
.replace(/\/(prizmkit-[a-z0-9-]+)/g, '/skill:$1')
|
|
16
|
-
.replace(/\$\{SKILL_DIR\}/g, `.pi/skills/${skillName}`);
|
|
37
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
17
38
|
const note = `> Pi project install: invoke this skill with \`/skill:${skillName}\`. An explicitly named PrizmKit Skill uses \`/skill:<same-name>\` and its project definition at \`.pi/skills/<same-name>/SKILL.md\`.\n>\n> Pi interaction compatibility: in interactive sessions, ask required questions directly in chat and wait for explicit user input. Only true headless runs may use documented conservative defaults.\n\n`;
|
|
18
39
|
return buildMarkdown(frontmatter, note + convertedBody);
|
|
19
40
|
}
|
|
@@ -11,23 +11,18 @@
|
|
|
11
11
|
#
|
|
12
12
|
# If .prizmkit/.env does not exist, all defaults apply — no error is raised.
|
|
13
13
|
|
|
14
|
-
# ─── Runtime Environment ──────────────────────────────────────────────
|
|
15
|
-
# PRIZMKIT_ENV=test # "test" = output bootstrap prompts to console for debugging
|
|
16
|
-
# Unset or any other value = normal production mode
|
|
17
|
-
|
|
18
14
|
# ─── AI CLI ───────────────────────────────────────────────────────────
|
|
19
15
|
# AI_CLI=claude # AI CLI command. If unset, PrizmKit prefers the installed
|
|
20
|
-
# project platform, then PATH fallback: claude > cbc > codex
|
|
16
|
+
# project platform, then PATH fallback: claude > cbc > codex > pi > agent > agy
|
|
21
17
|
# MODEL= # AI model override (e.g. claude-sonnet-4-20250514)
|
|
22
18
|
# Per-task model in *-list.json overrides this
|
|
19
|
+
# PRIZMKIT_EFFORT= # Reasoning effort override (platform-specific)
|
|
23
20
|
|
|
24
21
|
# ─── Pipeline Execution ──────────────────────────────────────────────
|
|
25
22
|
# MAX_RETRIES=3 # Max retry attempts per task before marking failed
|
|
23
|
+
# STOP_ON_FAILURE=0 # Stop pipeline immediately on first failed task (1=on, 0=continue)
|
|
26
24
|
# VERBOSE=1 # Verbose logging (1=on, 0=off)
|
|
27
25
|
|
|
28
|
-
# ─── Refactor Pipeline Only ──────────────────────────────────────────
|
|
29
|
-
# STRICT_BEHAVIOR_CHECK=1 # Enable strict behavior-preservation gates for refactor tasks (1=on, 0=off)
|
|
30
|
-
|
|
31
26
|
# ─── Branch Management ────────────────────────────────────────────────
|
|
32
27
|
# AUTO_PUSH=0 # Auto-push to remote after successful task (0=off, 1=on)
|
|
33
28
|
# DEV_BRANCH= # Custom dev branch name (default: auto-generated per task)
|
|
@@ -35,7 +30,4 @@
|
|
|
35
30
|
# ─── Logging & Heartbeat ─────────────────────────────────────────────
|
|
36
31
|
# HEARTBEAT_INTERVAL=30 # Heartbeat log interval in seconds
|
|
37
32
|
# HEARTBEAT_STALE_THRESHOLD=600 # Max seconds without heartbeat before marking stale
|
|
38
|
-
# STALE_KILL_THRESHOLD=
|
|
39
|
-
# CODEX_WAIT_STALE_KILL_THRESHOLD=3600 # Longer no-log window while Codex waits on subagents
|
|
40
|
-
# CODEX_SUBAGENT_TIMEOUT_SECONDS=3300 # Codex subagent max runtime; defaults to wait threshold - 300
|
|
41
|
-
# CB_SUBAGENT_STALE_KILL_THRESHOLD=3600 # Longer no-log window while CodeBuddy sub-agents are running
|
|
33
|
+
# STALE_KILL_THRESHOLD=600 # Auto-kill after N seconds without parent log progress (0 = disabled)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dev-pipeline
|
|
2
2
|
|
|
3
|
-
Autonomous development pipeline that drives iterative AI CLI sessions through PrizmKit skills, implementing feature
|
|
3
|
+
Autonomous development pipeline that drives iterative AI CLI sessions through PrizmKit skills, implementing feature and bugfix work from `.prizmkit/plans/*.json` specifications.
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ Autonomous development pipeline that drives iterative AI CLI sessions through Pr
|
|
|
16
16
|
|
|
17
17
|
- Python 3.10+ for the canonical Python CLI under `dev-pipeline/cli.py`
|
|
18
18
|
- No third-party Python runtime packages are required
|
|
19
|
-
- The Python runtime is the sole
|
|
19
|
+
- The Python runtime under `dev-pipeline/` is the sole runtime implementation
|
|
20
20
|
|
|
21
21
|
Inspect the operation-first command surface without dispatching runtime behavior:
|
|
22
22
|
|
|
@@ -111,10 +111,10 @@ python3 ./cli.py reset <family> --failed --preserve-runtime [list-path]
|
|
|
111
111
|
|
|
112
112
|
| Mode | Selector and effect |
|
|
113
113
|
|------|---------------------|
|
|
114
|
-
| `--state-only` | Requires one ID or explicit `--all`. Resets supported blocking roots and only causal `auto_skipped` descendants whose full blocker set is recovered; preserves checkout identity, branches
|
|
114
|
+
| `--state-only` | Requires one ID or explicit `--all`. Resets supported blocking roots and only causal `auto_skipped` descendants whose full blocker set is recovered; preserves checkout identity, branches, source changes, checkpoints, and artifact/session files. Feature roots are `failed` or `skipped`; Bugfix additionally supports `needs_info`. |
|
|
115
115
|
| `--fresh-checkout` | Requires one ID, range, or supported status filter. Performs the former standard reset, may discard active-checkout WIP, and publishes a new checkout boundary without deleting the task branch. |
|
|
116
116
|
| `--clean` | Accepts the fresh-checkout selectors and additionally deletes task branches, session history, continuation summaries, and task artifacts. |
|
|
117
|
-
| `--failed --preserve-runtime` | Whole-list failed-only recovery. Retains runtime history, valid checkout identity, branches
|
|
117
|
+
| `--failed --preserve-runtime` | Whole-list failed-only recovery. Retains runtime history, valid checkout identity, branches, checkpoints, artifacts, and WIP; a missing recorded branch is replaced from its local base and implementation-and-later checkpoints are rewound. |
|
|
118
118
|
|
|
119
119
|
State-only rejects ranges and status filters. Preserve-runtime rejects IDs, ranges, `--all`, clean, other modes, and other filters. Missing modes, conflicting modes, unsupported selectors, and malformed causal dependency state fail before mutation.
|
|
120
120
|
|
|
@@ -129,10 +129,6 @@ python3 ./.prizmkit/dev-pipeline/cli.py run feature F-007
|
|
|
129
129
|
python3 ./.prizmkit/dev-pipeline/cli.py reset bugfix --state-only --all
|
|
130
130
|
python3 ./.prizmkit/dev-pipeline/cli.py run bugfix .prizmkit/plans/bug-fix-list.json
|
|
131
131
|
|
|
132
|
-
# Preserve all failed runtime chains
|
|
133
|
-
python3 ./.prizmkit/dev-pipeline/cli.py reset refactor --failed --preserve-runtime
|
|
134
|
-
python3 ./.prizmkit/dev-pipeline/cli.py run refactor .prizmkit/plans/refactor-list.json
|
|
135
|
-
|
|
136
132
|
# Publish a fresh checkout boundary
|
|
137
133
|
python3 ./.prizmkit/dev-pipeline/cli.py reset feature F-007 --fresh-checkout
|
|
138
134
|
python3 ./.prizmkit/dev-pipeline/cli.py run feature F-007
|
|
@@ -884,7 +880,7 @@ cli.py run bugfix command
|
|
|
884
880
|
|
|
885
881
|
```
|
|
886
882
|
.prizmkit/dev-pipeline/
|
|
887
|
-
+-- cli.py run <family> # Foreground feature/bugfix
|
|
883
|
+
+-- cli.py run <family> # Foreground feature/bugfix runners
|
|
888
884
|
+-- cli.py status <family|all> # Read-only family or aggregate status
|
|
889
885
|
+-- cli.py reset <family> # Explicit state-only/fresh/clean/preserve reset modes
|
|
890
886
|
+-- cli.py daemon <family> # Background daemon lifecycle
|
|
@@ -916,7 +912,6 @@ cli.py run bugfix command
|
|
|
916
912
|
| +-- bootstrap-tier3.md # Explicit custom-template compatibility fixture
|
|
917
913
|
| +-- bootstrap-prompt.md # Minimal explicit compatibility template
|
|
918
914
|
| +-- bugfix-bootstrap-prompt.md # Bugfix explicit compatibility template
|
|
919
|
-
| +-- refactor-bootstrap-prompt.md # Refactor explicit compatibility template
|
|
920
915
|
| +-- feature-list-schema.json # JSON schema for .prizmkit/plans/feature-list.json
|
|
921
916
|
| +-- bug-fix-list-schema.json # JSON schema for .prizmkit/plans/bug-fix-list.json
|
|
922
917
|
| +-- session-status-schema.json # JSON schema for session-status.json
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
`dev-pipeline` drives feature
|
|
5
|
+
`dev-pipeline` drives feature and bugfix sessions through the unified Python outer loop. Each iteration starts an AI CLI session with a bootstrap prompt that makes the main session orchestrator responsible for planning, implementation, review, testing, retrospective, and commit.
|
|
6
6
|
|
|
7
7
|
Skill behavior is owned by canonical skills:
|
|
8
8
|
|
|
@@ -48,7 +48,7 @@ The Main Agent captures bounded immutable review input from the active checkout
|
|
|
48
48
|
|
|
49
49
|
Independent review runs only when the host can structurally provide read-only access, no mutation, no arbitrary command execution, no downstream execution, and native resume of the same execution unit. If any capability is unavailable or unproven, the stage records strict downgrade and creates no weak substitute. A fresh Reviewer plus a summary is never continuation.
|
|
50
50
|
|
|
51
|
-
Pipeline
|
|
51
|
+
Pipeline execution runs strictly serially in the active project checkout. Skill-level execution units must not create or enter linked worktrees.
|
|
52
52
|
|
|
53
53
|
## Pipeline Scripts
|
|
54
54
|
|
|
@@ -58,14 +58,11 @@ Located at `.prizmkit/dev-pipeline/scripts/`:
|
|
|
58
58
|
|---|---|
|
|
59
59
|
| `init-pipeline.py` | Initialize feature pipeline state |
|
|
60
60
|
| `init-bugfix-pipeline.py` | Initialize bugfix pipeline state |
|
|
61
|
-
| `init-refactor-pipeline.py` | Initialize refactor pipeline state |
|
|
62
61
|
| `init-change-artifact.py` | Initialize feature change-artifact directories |
|
|
63
62
|
| `generate-bootstrap-prompt.py` | Render feature bootstrap prompt with feature context |
|
|
64
63
|
| `generate-bugfix-prompt.py` | Render bugfix bootstrap prompt with bug context |
|
|
65
|
-
| `generate-refactor-prompt.py` | Render refactor bootstrap prompt with refactor context |
|
|
66
64
|
| `update-feature-status.py` | Update feature status after session |
|
|
67
65
|
| `update-bug-status.py` | Update bug status after session |
|
|
68
|
-
| `update-refactor-status.py` | Update refactor status after session |
|
|
69
66
|
| `check-session-status.py` | Read and validate session-status output |
|
|
70
67
|
| `detect-stuck.py` | Detect stuck or stale pipeline sessions |
|
|
71
68
|
| `parse-stream-progress.py` | Parse AI CLI output stream for progress tracking |
|
|
@@ -75,7 +72,7 @@ Located at `.prizmkit/dev-pipeline/scripts/`:
|
|
|
75
72
|
|
|
76
73
|
1. Runtime selects the next eligible item from the plan list.
|
|
77
74
|
2. Prompt generator renders a session prompt and checkpoint file.
|
|
78
|
-
3. AI CLI session executes the generated prompt in the active project checkout
|
|
75
|
+
3. AI CLI session executes the generated prompt in the active project checkout.
|
|
79
76
|
4. Session writes status and completion artifacts.
|
|
80
77
|
5. Runtime updates plan-list status and propagates completion notes.
|
|
81
78
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Atomic file write helpers shared across runtime modules and CLI scripts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import tempfile
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def write_text_atomic(
|
|
12
|
+
path: Path | str,
|
|
13
|
+
text: str,
|
|
14
|
+
*,
|
|
15
|
+
encoding: str = "utf-8",
|
|
16
|
+
fsync: bool = True,
|
|
17
|
+
) -> None:
|
|
18
|
+
"""Atomically write text via a same-directory temporary file and os.replace."""
|
|
19
|
+
target = Path(path)
|
|
20
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
21
|
+
fd, tmp_name = tempfile.mkstemp(dir=target.parent, prefix=f".{target.name}.", suffix=".tmp")
|
|
22
|
+
try:
|
|
23
|
+
with os.fdopen(fd, "w", encoding=encoding) as handle:
|
|
24
|
+
handle.write(text)
|
|
25
|
+
handle.flush()
|
|
26
|
+
if fsync:
|
|
27
|
+
os.fsync(handle.fileno())
|
|
28
|
+
os.replace(tmp_name, target)
|
|
29
|
+
except Exception:
|
|
30
|
+
try:
|
|
31
|
+
os.unlink(tmp_name)
|
|
32
|
+
except OSError:
|
|
33
|
+
pass
|
|
34
|
+
raise
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def write_json_atomic(
|
|
38
|
+
path: Path | str,
|
|
39
|
+
data: object,
|
|
40
|
+
*,
|
|
41
|
+
indent: int | None = 2,
|
|
42
|
+
sort_keys: bool = False,
|
|
43
|
+
ensure_ascii: bool = False,
|
|
44
|
+
fsync: bool = True,
|
|
45
|
+
) -> None:
|
|
46
|
+
"""Atomically serialize JSON to a file with optional fsync durability."""
|
|
47
|
+
payload = json.dumps(data, indent=indent, sort_keys=sort_keys, ensure_ascii=ensure_ascii) + "\n"
|
|
48
|
+
write_text_atomic(path, payload, fsync=fsync)
|
|
@@ -59,7 +59,6 @@ SKILL_WORKFLOW_STAGES.update({
|
|
|
59
59
|
FAMILY_PLAN_SKILLS = {
|
|
60
60
|
"feature-pipeline": "context-snapshot-and-plan",
|
|
61
61
|
"bugfix-pipeline": "bug-diagnosis-and-plan",
|
|
62
|
-
"refactor-pipeline": "prizmkit-plan",
|
|
63
62
|
}
|
|
64
63
|
VALID_TERMINAL_STATUSES = {"WORKFLOW_COMPLETED", "WORKFLOW_BLOCKED"}
|
|
65
64
|
VALID_REPAIR_SCOPES = {
|
|
@@ -73,7 +72,6 @@ VALID_REPAIR_SCOPES = {
|
|
|
73
72
|
SEMANTIC_STATE_KEYS = {
|
|
74
73
|
"feature-pipeline": "feature_state",
|
|
75
74
|
"bugfix-pipeline": "bugfix_state",
|
|
76
|
-
"refactor-pipeline": "refactor_state",
|
|
77
75
|
}
|
|
78
76
|
LEGACY_FAMILY_REQUIRED_STAGES = {
|
|
79
77
|
"feature-pipeline": (
|
|
@@ -92,15 +90,6 @@ LEGACY_FAMILY_REQUIRED_STAGES = {
|
|
|
92
90
|
"prizmkit-committer",
|
|
93
91
|
"bug-report",
|
|
94
92
|
),
|
|
95
|
-
"refactor-pipeline": (
|
|
96
|
-
"prizmkit-implement",
|
|
97
|
-
"prizmkit-code-review",
|
|
98
|
-
"prizmkit-test",
|
|
99
|
-
"prizmkit-retrospective",
|
|
100
|
-
"prizmkit-committer",
|
|
101
|
-
"refactor-report",
|
|
102
|
-
"completion-summary",
|
|
103
|
-
),
|
|
104
93
|
}
|
|
105
94
|
|
|
106
95
|
FAMILY_REQUIRED_STAGES = {
|
|
@@ -120,15 +109,6 @@ FAMILY_REQUIRED_STAGES = {
|
|
|
120
109
|
"prizmkit-retrospective",
|
|
121
110
|
"prizmkit-committer",
|
|
122
111
|
),
|
|
123
|
-
"refactor-pipeline": (
|
|
124
|
-
"prizmkit-implement",
|
|
125
|
-
"prizmkit-code-review",
|
|
126
|
-
"prizmkit-test",
|
|
127
|
-
"refactor-report",
|
|
128
|
-
"completion-summary",
|
|
129
|
-
"prizmkit-retrospective",
|
|
130
|
-
"prizmkit-committer",
|
|
131
|
-
),
|
|
132
112
|
}
|
|
133
113
|
|
|
134
114
|
|
|
@@ -549,6 +529,8 @@ def rewind_checkpoint_for_implementation(
|
|
|
549
529
|
}
|
|
550
530
|
)
|
|
551
531
|
raw_semantic.pop("stage_result", None)
|
|
532
|
+
raw_semantic.pop("runtime_base_head", None)
|
|
533
|
+
raw_semantic.pop("runtime_commit_hash", None)
|
|
552
534
|
if isinstance(raw_semantic.get("completed_stages"), list):
|
|
553
535
|
raw_semantic["completed_stages"] = [
|
|
554
536
|
value
|
|
@@ -712,6 +694,13 @@ def _derive_semantic_state(
|
|
|
712
694
|
return _semantic_error(workflow_type, current_step, "invalid_blocked_reason", "blocked_reason must be a non-empty string")
|
|
713
695
|
if terminal_status == "WORKFLOW_BLOCKED" and not blocked_reason:
|
|
714
696
|
return _semantic_error(workflow_type, current_step, "missing_blocked_reason", "WORKFLOW_BLOCKED requires blocked_reason")
|
|
697
|
+
if terminal_status == "WORKFLOW_BLOCKED" and semantic_status in {"in_progress", "completed"}:
|
|
698
|
+
return _semantic_error(
|
|
699
|
+
workflow_type,
|
|
700
|
+
current_step,
|
|
701
|
+
"blocked_workflow_has_non_failed_status",
|
|
702
|
+
f"WORKFLOW_BLOCKED cannot have status={semantic_status}",
|
|
703
|
+
)
|
|
715
704
|
if blocked_reason and terminal_status == "WORKFLOW_COMPLETED":
|
|
716
705
|
return _semantic_error(
|
|
717
706
|
workflow_type,
|
|
@@ -816,8 +805,8 @@ def _derive_semantic_state(
|
|
|
816
805
|
if (
|
|
817
806
|
current_step is not None
|
|
818
807
|
and current_step.status == "failed"
|
|
819
|
-
and current_step.stage_result
|
|
820
|
-
and raw_state.get("stage_result")
|
|
808
|
+
and current_step.stage_result in {"REVIEW_NEEDS_FIXES", "TEST_NEEDS_FIXES"}
|
|
809
|
+
and raw_state.get("stage_result") in {"REVIEW_NEEDS_FIXES", "TEST_NEEDS_FIXES"}
|
|
821
810
|
and raw_state.get("next_stage") == "prizmkit-implement"
|
|
822
811
|
):
|
|
823
812
|
next_stage = "prizmkit-implement"
|
|
@@ -904,6 +893,56 @@ def _single_step(steps: tuple[CheckpointStep, ...], skill: str) -> CheckpointSte
|
|
|
904
893
|
return matches[0] if len(matches) == 1 else None
|
|
905
894
|
|
|
906
895
|
|
|
896
|
+
def required_step_artifacts_valid(
|
|
897
|
+
raw_step: Mapping[str, Any],
|
|
898
|
+
*,
|
|
899
|
+
index: int = 0,
|
|
900
|
+
checkpoint_path: Path | str | None = None,
|
|
901
|
+
project_root: Path | str | None = None,
|
|
902
|
+
) -> bool:
|
|
903
|
+
"""Validate declared required artifacts for one raw checkpoint step dict."""
|
|
904
|
+
step_id = raw_step.get("id")
|
|
905
|
+
skill = raw_step.get("skill")
|
|
906
|
+
name = raw_step.get("name")
|
|
907
|
+
status = raw_step.get("status")
|
|
908
|
+
if (
|
|
909
|
+
not isinstance(step_id, str)
|
|
910
|
+
or not STEP_ID_PATTERN.match(step_id)
|
|
911
|
+
or not isinstance(skill, str)
|
|
912
|
+
or not skill.strip()
|
|
913
|
+
or not isinstance(name, str)
|
|
914
|
+
or not name.strip()
|
|
915
|
+
or status not in VALID_CHECKPOINT_STATUSES
|
|
916
|
+
):
|
|
917
|
+
return False
|
|
918
|
+
raw_artifacts = raw_step.get("required_artifacts")
|
|
919
|
+
if raw_artifacts is None:
|
|
920
|
+
artifacts: tuple[str, ...] = ()
|
|
921
|
+
elif isinstance(raw_artifacts, (list, tuple)) and all(isinstance(item, str) for item in raw_artifacts):
|
|
922
|
+
artifacts = tuple(raw_artifacts)
|
|
923
|
+
else:
|
|
924
|
+
return False
|
|
925
|
+
stage_result = raw_step.get("stage_result")
|
|
926
|
+
if stage_result is not None and not isinstance(stage_result, str):
|
|
927
|
+
return False
|
|
928
|
+
depends_on = raw_step.get("depends_on")
|
|
929
|
+
if depends_on is not None and not isinstance(depends_on, str):
|
|
930
|
+
return False
|
|
931
|
+
step = CheckpointStep(
|
|
932
|
+
id=step_id,
|
|
933
|
+
skill=skill.strip(),
|
|
934
|
+
name=name.strip(),
|
|
935
|
+
status=str(status),
|
|
936
|
+
depends_on=depends_on,
|
|
937
|
+
required_artifacts=artifacts,
|
|
938
|
+
stage_result=stage_result,
|
|
939
|
+
index=index,
|
|
940
|
+
)
|
|
941
|
+
resolved_cp = Path(checkpoint_path) if checkpoint_path is not None else None
|
|
942
|
+
resolved_root = Path(project_root) if project_root is not None else None
|
|
943
|
+
return _required_step_artifacts_valid(step, resolved_cp, resolved_root)
|
|
944
|
+
|
|
945
|
+
|
|
907
946
|
def _required_step_artifacts_valid(
|
|
908
947
|
step: CheckpointStep,
|
|
909
948
|
checkpoint_path: Path | None,
|
|
@@ -1111,7 +1150,8 @@ def _is_within_root(path: Path, root: Path) -> bool:
|
|
|
1111
1150
|
return True
|
|
1112
1151
|
|
|
1113
1152
|
|
|
1114
|
-
def
|
|
1153
|
+
def infer_project_root(checkpoint_path: Path | None) -> Path:
|
|
1154
|
+
"""Resolve the project root from a conventional ``.prizmkit`` checkpoint path."""
|
|
1115
1155
|
if checkpoint_path is None:
|
|
1116
1156
|
return Path.cwd()
|
|
1117
1157
|
resolved = checkpoint_path.resolve()
|
|
@@ -1121,6 +1161,9 @@ def _infer_project_root(checkpoint_path: Path | None) -> Path:
|
|
|
1121
1161
|
return resolved.parent
|
|
1122
1162
|
|
|
1123
1163
|
|
|
1164
|
+
_infer_project_root = infer_project_root
|
|
1165
|
+
|
|
1166
|
+
|
|
1124
1167
|
def _semantic_error(
|
|
1125
1168
|
workflow_type: str,
|
|
1126
1169
|
current_step: CheckpointStep | None,
|
|
@@ -6,16 +6,17 @@ import argparse
|
|
|
6
6
|
import sys
|
|
7
7
|
from collections.abc import Sequence
|
|
8
8
|
|
|
9
|
-
from .commands import
|
|
9
|
+
from .commands import handle_diagnostics, handle_runtime_command
|
|
10
10
|
from .compat import UnsupportedPythonVersion, ensure_supported_python
|
|
11
11
|
from .paths import resolve_runtime_paths
|
|
12
|
+
from .results import CommandResult as CommandResult
|
|
12
13
|
|
|
13
14
|
DESCRIPTION = (
|
|
14
15
|
"PrizmKit canonical Python runtime CLI.\n"
|
|
15
16
|
"Runs operation-first pipeline, status, reset, daemon, diagnostics, and helper commands."
|
|
16
17
|
)
|
|
17
18
|
|
|
18
|
-
_FAMILIES = ("feature", "bugfix"
|
|
19
|
+
_FAMILIES = ("feature", "bugfix")
|
|
19
20
|
_GLOBAL_OPTIONS_WITH_VALUES = {"--project-root", "--pipeline-root"}
|
|
20
21
|
_LEAF_OPTIONS_WITH_VALUES = {
|
|
21
22
|
"--env",
|
|
@@ -47,17 +48,19 @@ def _non_negative_int(value: str) -> int:
|
|
|
47
48
|
return parsed
|
|
48
49
|
|
|
49
50
|
|
|
50
|
-
def
|
|
51
|
+
def _add_status_arguments(parser: argparse.ArgumentParser, family: str) -> None:
|
|
51
52
|
parser.add_argument("operand", nargs="?", help="Optional task ID or family plan path.")
|
|
52
53
|
parser.add_argument("second_operand", nargs="?", help="Optional family plan path or task ID.")
|
|
53
54
|
if family == "feature":
|
|
54
55
|
parser.add_argument("--features", help="Feature ID, range, or comma-separated selection.")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _add_run_arguments(parser: argparse.ArgumentParser, family: str) -> None:
|
|
59
|
+
_add_status_arguments(parser, family)
|
|
55
60
|
parser.add_argument("--max-retries", type=_non_negative_int)
|
|
56
61
|
parser.add_argument("--max-infra-retries", type=_non_negative_int)
|
|
57
62
|
parser.add_argument("--resume-phase")
|
|
58
63
|
parser.add_argument("--dry-run", action="store_true")
|
|
59
|
-
parser.add_argument("--clean", action="store_true")
|
|
60
|
-
parser.add_argument("--no-reset", action="store_true")
|
|
61
64
|
|
|
62
65
|
|
|
63
66
|
def _add_run_subparsers(
|
|
@@ -67,7 +70,7 @@ def _add_run_subparsers(
|
|
|
67
70
|
family_subparsers = run_parser.add_subparsers(dest="run_family", required=True)
|
|
68
71
|
for family in _FAMILIES:
|
|
69
72
|
family_parser = family_subparsers.add_parser(family, help=f"Run the {family} pipeline")
|
|
70
|
-
|
|
73
|
+
_add_run_arguments(family_parser, family)
|
|
71
74
|
_set_handler(family_parser, "run", "run", family)
|
|
72
75
|
|
|
73
76
|
|
|
@@ -78,7 +81,7 @@ def _add_status_subparsers(
|
|
|
78
81
|
target_subparsers = status_parser.add_subparsers(dest="status_target", required=True)
|
|
79
82
|
for family in _FAMILIES:
|
|
80
83
|
family_parser = target_subparsers.add_parser(family, help=f"Show {family} status")
|
|
81
|
-
|
|
84
|
+
_add_status_arguments(family_parser, family)
|
|
82
85
|
_set_handler(family_parser, "status", "status", family)
|
|
83
86
|
all_parser = target_subparsers.add_parser(
|
|
84
87
|
"all",
|
|
@@ -7,11 +7,12 @@ from dataclasses import dataclass
|
|
|
7
7
|
from .compat import MIN_PYTHON
|
|
8
8
|
from .interoperability import UTILITY_ENTRYPOINTS, describe_existing_entrypoint
|
|
9
9
|
from .paths import RuntimePaths, resolve_runtime_paths
|
|
10
|
+
from .results import CommandResult as CommandResult
|
|
10
11
|
|
|
11
12
|
RUNTIME_STATUS = "python-runtime-canonical"
|
|
12
13
|
CANONICAL_RUNTIME_NOTE = "The Python CLI and prizmkit_runtime modules are the canonical runtime."
|
|
13
14
|
PYTHON_CLI = "dev-pipeline/cli.py"
|
|
14
|
-
_FAMILIES = ("feature", "bugfix"
|
|
15
|
+
_FAMILIES = ("feature", "bugfix")
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
@dataclass(frozen=True)
|
|
@@ -33,26 +34,6 @@ class RuntimeCommand:
|
|
|
33
34
|
return (self.group, self.target, self.action)
|
|
34
35
|
|
|
35
36
|
|
|
36
|
-
@dataclass(frozen=True)
|
|
37
|
-
class CommandResult:
|
|
38
|
-
"""Result returned by runtime command handlers."""
|
|
39
|
-
|
|
40
|
-
exit_code: int
|
|
41
|
-
title: str
|
|
42
|
-
message: str
|
|
43
|
-
details: tuple[str, ...] = ()
|
|
44
|
-
stdout: str | None = None
|
|
45
|
-
stderr: str | None = None
|
|
46
|
-
|
|
47
|
-
def render(self) -> str:
|
|
48
|
-
"""Render a deterministic human-readable result."""
|
|
49
|
-
if self.stdout is not None:
|
|
50
|
-
return self.stdout
|
|
51
|
-
lines = [self.title, self.message]
|
|
52
|
-
lines.extend(self.details)
|
|
53
|
-
return "\n".join(line for line in lines if line)
|
|
54
|
-
|
|
55
|
-
|
|
56
37
|
def _runtime_invocation(group: str, action: str, target: str | None = None) -> str:
|
|
57
38
|
if group == "daemon" and target is not None:
|
|
58
39
|
command = f"daemon {target} {action}"
|