prizmkit 1.1.161 → 1.1.164
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 +4 -4
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/cursor/assets/prizmkit-hook.cjs +65 -0
- package/bundled/adapters/cursor/hooks-adapter.js +139 -0
- package/bundled/adapters/cursor/paths.js +11 -0
- package/bundled/adapters/cursor/rules-adapter.js +49 -0
- package/bundled/adapters/cursor/skill-adapter.js +27 -0
- package/bundled/dev-pipeline/README.md +21 -6
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +3 -25
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +71 -14
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +28 -4
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +5 -2
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +21 -3
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +82 -9
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +123 -0
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +123 -28
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +2 -0
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +1 -42
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +43 -6
- package/bundled/dev-pipeline/scripts/init-pipeline.py +46 -8
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +41 -6
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +143 -27
- package/bundled/dev-pipeline/scripts/update-bug-status.py +8 -4
- package/bundled/dev-pipeline/scripts/update-feature-status.py +12 -8
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +8 -4
- package/bundled/dev-pipeline/scripts/utils.py +3 -12
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +4 -2
- package/bundled/dev-pipeline/templates/feature-list-schema.json +4 -2
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +4 -2
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +2 -1
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +5 -23
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +2 -2
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +452 -6
- package/bundled/dev-pipeline/tests/test_runtime_commit.py +138 -1
- package/bundled/dev-pipeline/tests/test_unified_cli.py +406 -30
- package/bundled/dev-pipeline/tests/test_utils.py +23 -0
- package/bundled/rules/USAGE.md +3 -0
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/bug-planner/SKILL.md +0 -1
- package/bundled/skills/bug-planner/references/verification.md +0 -2
- package/bundled/skills/bug-planner/scripts/validate-bug-list.py +37 -7
- package/bundled/skills/feature-planner/SKILL.md +5 -8
- package/bundled/skills/feature-planner/scripts/validate-and-generate.py +43 -19
- package/bundled/skills/prizmkit-init/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +2 -3
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
- package/bundled/skills/refactor-planner/SKILL.md +1 -3
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +38 -9
- package/package.json +4 -2
- package/src/ai-cli-launch.js +9 -2
- package/src/clean.js +42 -6
- package/src/config.js +51 -10
- package/src/detect-platform.js +30 -8
- package/src/external-skills.js +33 -99
- package/src/index.js +5 -0
- package/src/manifest.js +30 -4
- package/src/platforms.js +11 -4
- package/src/prompts.js +12 -4
- package/src/scaffold.js +75 -4
- package/src/upgrade.js +15 -14
|
@@ -30,6 +30,21 @@ VALID_SEVERITIES = {"critical", "high", "medium", "low"}
|
|
|
30
30
|
VALID_SOURCE_TYPES = {"stack_trace", "user_report", "failed_test", "log_pattern", "monitoring_alert"}
|
|
31
31
|
VALID_VERIFICATION_TYPES = {"automated", "manual", "hybrid"}
|
|
32
32
|
VALID_STATUSES = {"pending", "in_progress", "completed", "failed", "skipped", "needs_info", "auto_skipped"}
|
|
33
|
+
ALLOWED_LIST_FIELDS = {
|
|
34
|
+
"$schema", "project_name", "project_description", "created_at",
|
|
35
|
+
"created_by", "bugs", "global_context",
|
|
36
|
+
}
|
|
37
|
+
ALLOWED_GLOBAL_CONTEXT_FIELDS = {
|
|
38
|
+
"tech_stack", "language", "runtime", "frontend_framework",
|
|
39
|
+
"frontend_styling", "backend_framework", "database", "orm",
|
|
40
|
+
"testing_strategy", "bundler", "project_type", "ci_pipeline",
|
|
41
|
+
}
|
|
42
|
+
ALLOWED_BUG_FIELDS = {
|
|
43
|
+
"id", "title", "description", "severity", "priority", "error_source",
|
|
44
|
+
"environment", "affected_modules", "verification_type", "dependencies",
|
|
45
|
+
"acceptance_criteria", "status", "user_context", "browser_interaction",
|
|
46
|
+
"model",
|
|
47
|
+
}
|
|
33
48
|
BUG_ID_PATTERN = re.compile(r"^B-\d{3}$")
|
|
34
49
|
SCHEMA_VERSION = "dev-pipeline-bug-fix-list-v1"
|
|
35
50
|
|
|
@@ -114,6 +129,12 @@ def validate(data, feature_ids=None):
|
|
|
114
129
|
warnings = []
|
|
115
130
|
|
|
116
131
|
# Top-level required fields
|
|
132
|
+
unknown_root = set(data) - ALLOWED_LIST_FIELDS
|
|
133
|
+
if unknown_root:
|
|
134
|
+
errors.append("bug list has unknown fields: {}".format(
|
|
135
|
+
", ".join(sorted(unknown_root))
|
|
136
|
+
))
|
|
137
|
+
|
|
117
138
|
if "$schema" not in data:
|
|
118
139
|
errors.append("Missing required field: $schema")
|
|
119
140
|
elif data["$schema"] != SCHEMA_VERSION:
|
|
@@ -122,6 +143,17 @@ def validate(data, feature_ids=None):
|
|
|
122
143
|
if not data.get("project_name"):
|
|
123
144
|
errors.append("Missing or empty required field: project_name")
|
|
124
145
|
|
|
146
|
+
global_context = data.get("global_context")
|
|
147
|
+
if global_context is not None:
|
|
148
|
+
if not isinstance(global_context, dict):
|
|
149
|
+
errors.append("global_context must be an object")
|
|
150
|
+
else:
|
|
151
|
+
unknown_context = set(global_context) - ALLOWED_GLOBAL_CONTEXT_FIELDS
|
|
152
|
+
if unknown_context:
|
|
153
|
+
errors.append("global_context has unknown fields: {}".format(
|
|
154
|
+
", ".join(sorted(unknown_context))
|
|
155
|
+
))
|
|
156
|
+
|
|
125
157
|
bugs = data.get("bugs", [])
|
|
126
158
|
if not bugs or not isinstance(bugs, list):
|
|
127
159
|
errors.append("Missing or empty required field: bugs")
|
|
@@ -139,13 +171,11 @@ def validate(data, feature_ids=None):
|
|
|
139
171
|
for i, bug in enumerate(bugs):
|
|
140
172
|
prefix = "bugs[{}]".format(i)
|
|
141
173
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
-
)
|
|
174
|
+
unknown = set(bug.keys()) - ALLOWED_BUG_FIELDS
|
|
175
|
+
if unknown:
|
|
176
|
+
errors.append("{} has unknown fields: {}".format(
|
|
177
|
+
prefix, ", ".join(sorted(unknown))
|
|
178
|
+
))
|
|
149
179
|
|
|
150
180
|
# Required fields
|
|
151
181
|
bug_id = bug.get("id", "")
|
|
@@ -130,8 +130,7 @@ Trigger conditions are covered by the frontmatter `description`. Do NOT use this
|
|
|
130
130
|
8. **Browser interaction**: If present, may include `tool` and `verify_steps`; planner should add concrete `verify_steps` when known, but the schema permits an empty object for AI runtime exploration.
|
|
131
131
|
9. **Complexity enum**: If present, is one of: low, medium, high, critical
|
|
132
132
|
10. **Model field**: If present, is a non-empty string
|
|
133
|
-
11. **
|
|
134
|
-
12. **Root schema**: Has $schema='dev-pipeline-feature-list-v1', project_name, and non-empty features array
|
|
133
|
+
11. **Root schema**: Has $schema='dev-pipeline-feature-list-v1', project_name, and non-empty features array
|
|
135
134
|
|
|
136
135
|
5. **Use script output as source of truth** — if validation fails, fix and re-run until pass
|
|
137
136
|
|
|
@@ -142,7 +141,7 @@ Before questions, check optional context files (never block if absent):
|
|
|
142
141
|
- `.prizmkit/config.json` (existing stack preferences and detected tech stack)
|
|
143
142
|
- `.prizmkit/plans/project-brief.md` (project context from app-planner, if available)
|
|
144
143
|
- existing `.prizmkit/plans/feature-list.json` (required for incremental mode)
|
|
145
|
-
- Platform instruction file: use the `platform` field in `.prizmkit/manifest.json` as source of truth when present (`codex` → `AGENTS.md`, `claude` → `CLAUDE.md`, `codebuddy` → `CODEBUDDY.md`, `all` → read every matching file). Legacy manifests may contain `both`; treat it as read-only compatibility and read `CLAUDE.md` plus `CODEBUDDY.md` only when encountered.
|
|
144
|
+
- Platform instruction file: use the `platform` field in `.prizmkit/manifest.json` as source of truth when present (`codex` → `AGENTS.md`, `cursor` → existing user-owned `AGENTS.md` when present, `claude` → `CLAUDE.md`, `codebuddy` → `CODEBUDDY.md`, `all` → read every matching file). Legacy manifests may contain `both`; treat it as read-only compatibility and read `CLAUDE.md` plus `CODEBUDDY.md` only when encountered.
|
|
146
145
|
- If `.prizmkit/prizm-docs/root.prizm` is absent and the project has existing source code, scan the directory structure to understand the codebase layout:
|
|
147
146
|
```bash
|
|
148
147
|
find . -maxdepth 2 -type d \
|
|
@@ -151,7 +150,7 @@ Before questions, check optional context files (never block if absent):
|
|
|
151
150
|
-not -path '*/__pycache__/*' -not -path '*/vendor/*' \
|
|
152
151
|
-not -path '*/.agents/*' -not -path '*/.codex/*' \
|
|
153
152
|
-not -path '*/.claude/*' -not -path '*/.codebuddy/*' \
|
|
154
|
-
-not -path '*/.prizmkit/*' \
|
|
153
|
+
-not -path '*/.cursor/*' -not -path '*/.prizmkit/*' \
|
|
155
154
|
| sed -e 's;[^/]*/;|____;g;s;____|; |;g'
|
|
156
155
|
```
|
|
157
156
|
|
|
@@ -310,7 +309,7 @@ Checkpoints catch cascading errors early — skipping one means the next phase b
|
|
|
310
309
|
| **CP-FP-2** | Feature Proposals | Feature set with titles+deps identified (pre-validation) | 3-5 |
|
|
311
310
|
| **CP-FP-3** | DAG Validity | No cycles, dependencies resolved (validation dry-run) | 5 |
|
|
312
311
|
| **CP-FP-3.1** | Browser Interaction Applied | Qualifying features have `browser_interaction` field; user confirmed or opted out | 4 |
|
|
313
|
-
| **CP-FP-3.2** | Testing Defaults Applied | All features have appropriate testing expectations
|
|
312
|
+
| **CP-FP-3.2** | Testing Defaults Applied | All features have appropriate testing expectations | 7 |
|
|
314
313
|
| **CP-FP-3.3** | Completeness Review Passed | Every new or changed feature passes fresh-session simulation from `description` and `acceptance_criteria` without conversation history or `user_context` | 6 |
|
|
315
314
|
| **CP-FP-4** | `.prizmkit/plans/feature-list.json` Generated | Schema validates, all required keys present | 7-8 |
|
|
316
315
|
| **CP-FP-5** | Final Validation Pass | Python script returns `"valid": true` with zero errors | 9 |
|
|
@@ -422,7 +421,7 @@ Read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the sin
|
|
|
422
421
|
|
|
423
422
|
## Testing Defaults (Phase 8)
|
|
424
423
|
|
|
425
|
-
Set default testing-related fields for each feature. The user can opt out of generated testing expectations
|
|
424
|
+
Set default testing-related fields for each feature. The user can opt out of generated testing expectations.
|
|
426
425
|
|
|
427
426
|
| Priority | Testing expectation | Rationale |
|
|
428
427
|
|----------|---------------------|-----------|
|
|
@@ -430,8 +429,6 @@ Set default testing-related fields for each feature. The user can opt out of gen
|
|
|
430
429
|
| medium | Require focused tests for changed public behavior | Normal changes need meaningful boundary coverage. |
|
|
431
430
|
| low | Require the smallest relevant verification | Low-risk changes should stay lightweight. |
|
|
432
431
|
|
|
433
|
-
Never emit `critic` or `critic_count`; those fields are fully removed and the validator rejects them.
|
|
434
|
-
|
|
435
432
|
For frontend features with `browser_interaction`, browser verification is enabled by default. The `tool` field uses the user's choice from the mandatory browser tool question in Phase 4.2 (see §Browser Interaction Planning → Default Behavior).
|
|
436
433
|
|
|
437
434
|
Present a consolidated testing summary table at Phase 8, then ask for confirmation.
|
|
@@ -42,6 +42,21 @@ VALID_STATUSES = {"pending", "in_progress", "completed", "failed", "skipped", "s
|
|
|
42
42
|
VALID_COMPLEXITIES = {"low", "medium", "high", "critical"}
|
|
43
43
|
VALID_PRIORITIES = {"critical", "high", "medium", "low"}
|
|
44
44
|
VALID_GRANULARITIES = {"feature", "sub_feature", "auto"}
|
|
45
|
+
ALLOWED_LIST_FIELDS = {
|
|
46
|
+
"$schema", "project_name", "project_description", "created_at",
|
|
47
|
+
"created_by", "features", "global_context",
|
|
48
|
+
}
|
|
49
|
+
ALLOWED_GLOBAL_CONTEXT_FIELDS = {
|
|
50
|
+
"tech_stack", "language", "runtime", "frontend_framework",
|
|
51
|
+
"frontend_styling", "backend_framework", "database", "orm",
|
|
52
|
+
"design_system", "testing_strategy", "bundler", "project_type",
|
|
53
|
+
}
|
|
54
|
+
ALLOWED_FEATURE_FIELDS = {
|
|
55
|
+
"id", "title", "description", "priority", "estimated_complexity",
|
|
56
|
+
"dependencies", "acceptance_criteria", "status", "session_granularity",
|
|
57
|
+
"sub_features", "model", "completion_notes", "user_context",
|
|
58
|
+
"browser_interaction", "testing",
|
|
59
|
+
}
|
|
45
60
|
FEATURE_ID_RE = re.compile(r"^F-\d{3}(-[A-Z])?$")
|
|
46
61
|
SUB_FEATURE_ID_RE = re.compile(r"^F-\d{3}-[A-Z]$")
|
|
47
62
|
|
|
@@ -170,17 +185,33 @@ def validate_feature_list(data, is_new_plan=True):
|
|
|
170
185
|
# ------------------------------------------------------------------
|
|
171
186
|
# 1. Top-level schema validation
|
|
172
187
|
# ------------------------------------------------------------------
|
|
188
|
+
unknown_root = set(data) - ALLOWED_LIST_FIELDS
|
|
189
|
+
if unknown_root:
|
|
190
|
+
errors.append("feature list has unknown fields: {}".format(
|
|
191
|
+
", ".join(sorted(unknown_root))
|
|
192
|
+
))
|
|
193
|
+
|
|
173
194
|
schema = data.get("$schema")
|
|
174
195
|
if schema != SCHEMA_VERSION:
|
|
175
196
|
errors.append(
|
|
176
197
|
"$schema must be '{}', got '{}'".format(SCHEMA_VERSION, schema)
|
|
177
198
|
)
|
|
178
199
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if not isinstance(app_name, str) or not app_name.strip():
|
|
200
|
+
project_name = data.get("project_name")
|
|
201
|
+
if not isinstance(project_name, str) or not project_name.strip():
|
|
182
202
|
errors.append("project_name must be a non-empty string")
|
|
183
203
|
|
|
204
|
+
global_context = data.get("global_context")
|
|
205
|
+
if global_context is not None:
|
|
206
|
+
if not isinstance(global_context, dict):
|
|
207
|
+
errors.append("global_context must be an object")
|
|
208
|
+
else:
|
|
209
|
+
unknown_context = set(global_context) - ALLOWED_GLOBAL_CONTEXT_FIELDS
|
|
210
|
+
if unknown_context:
|
|
211
|
+
errors.append("global_context has unknown fields: {}".format(
|
|
212
|
+
", ".join(sorted(unknown_context))
|
|
213
|
+
))
|
|
214
|
+
|
|
184
215
|
features = data.get("features")
|
|
185
216
|
if not isinstance(features, list) or len(features) == 0:
|
|
186
217
|
errors.append("features must be a non-empty array")
|
|
@@ -225,6 +256,12 @@ def validate_feature_list(data, is_new_plan=True):
|
|
|
225
256
|
label, ", ".join(sorted(missing))
|
|
226
257
|
))
|
|
227
258
|
|
|
259
|
+
unknown = set(feat.keys()) - ALLOWED_FEATURE_FIELDS
|
|
260
|
+
if unknown:
|
|
261
|
+
errors.append("{} has unknown fields: {}".format(
|
|
262
|
+
label, ", ".join(sorted(unknown))
|
|
263
|
+
))
|
|
264
|
+
|
|
228
265
|
# -- ID format & uniqueness --
|
|
229
266
|
fid = feat.get("id", "")
|
|
230
267
|
if not FEATURE_ID_RE.match(str(fid)):
|
|
@@ -335,15 +372,6 @@ def validate_feature_list(data, is_new_plan=True):
|
|
|
335
372
|
# -- Sub-features --
|
|
336
373
|
subs = feat.get("sub_features")
|
|
337
374
|
|
|
338
|
-
# -- Retired fields --
|
|
339
|
-
for retired_field in ("critic", "critic_count"):
|
|
340
|
-
if retired_field in feat:
|
|
341
|
-
errors.append(
|
|
342
|
-
"{}: '{}' field is retired; remove it from feature-list data".format(
|
|
343
|
-
label, retired_field
|
|
344
|
-
)
|
|
345
|
-
)
|
|
346
|
-
|
|
347
375
|
# -- Browser interaction check (warning for frontend features) --
|
|
348
376
|
has_frontend = bool(
|
|
349
377
|
data.get("global_context", {}).get("frontend_framework")
|
|
@@ -546,11 +574,11 @@ def _build_dependency_graph_text(features):
|
|
|
546
574
|
|
|
547
575
|
def generate_summary_markdown(data):
|
|
548
576
|
"""Generate a markdown summary of the feature list."""
|
|
549
|
-
|
|
577
|
+
project_name = data.get("project_name", "Unknown")
|
|
550
578
|
features = data.get("features", [])
|
|
551
579
|
|
|
552
580
|
lines = []
|
|
553
|
-
lines.append("# Feature Summary: {}".format(
|
|
581
|
+
lines.append("# Feature Summary: {}".format(project_name))
|
|
554
582
|
lines.append("")
|
|
555
583
|
|
|
556
584
|
# Table header
|
|
@@ -636,7 +664,7 @@ def generate_summary_json(data):
|
|
|
636
664
|
})
|
|
637
665
|
|
|
638
666
|
return {
|
|
639
|
-
"project_name": data.get("project_name",
|
|
667
|
+
"project_name": data.get("project_name", ""),
|
|
640
668
|
"features": feature_summaries,
|
|
641
669
|
"stats": {
|
|
642
670
|
"total_features": len(features),
|
|
@@ -749,10 +777,6 @@ def cmd_generate(args):
|
|
|
749
777
|
data.setdefault("created_at", now)
|
|
750
778
|
data.setdefault("created_by", "feature-planner")
|
|
751
779
|
|
|
752
|
-
# Ensure project_name from app_name if needed
|
|
753
|
-
if "project_name" not in data and "app_name" in data:
|
|
754
|
-
data["project_name"] = data["app_name"]
|
|
755
|
-
|
|
756
780
|
# Set default status for features without one
|
|
757
781
|
for feature in data.get("features", []):
|
|
758
782
|
feature.setdefault("status", "pending")
|
|
@@ -82,7 +82,7 @@ BROWNFIELD WORKFLOW (existing project):
|
|
|
82
82
|
- TOP-LEVEL modules: directories directly under project root that contain source files or sub-directories with source files (e.g. `src/`, `internal/`, `lib/`)
|
|
83
83
|
- SUB-MODULES: directories INSIDE a top-level module (e.g. `src/routes/`, `src/models/`)
|
|
84
84
|
- Exact `root.prizm` is L0; top-level module M maps to direct-child `.prizmkit/prizm-docs/<M>.prizm` (L1); sub-module S maps to nested `.prizmkit/prizm-docs/<M>/<S>.prizm` (L2). Deeper source ownership remains L2 and never creates L3.
|
|
85
|
-
- Exclude: `.git/`, `node_modules/`, `vendor/`, `build/`, `dist/`, `__pycache__/`, `target/`, `bin/`, `.agents/`, `.codex/`, `.claude/`, `.codebuddy/`, `.pi/`, and the complete `.prizmkit/` framework directory. This excludes installed `.prizmkit/dev-pipeline/` artifacts but not canonical top-level `dev-pipeline/` source.
|
|
85
|
+
- Exclude: `.git/`, `node_modules/`, `vendor/`, `build/`, `dist/`, `__pycache__/`, `target/`, `bin/`, `.agents/`, `.codex/`, `.claude/`, `.codebuddy/`, `.pi/`, `.cursor/`, and the complete `.prizmkit/` framework directory. This excludes installed `.prizmkit/dev-pipeline/` artifacts but not canonical top-level `dev-pipeline/` source.
|
|
86
86
|
- **Bounded discovery contract** — use the current Host's available directory-listing or file-search capability to enumerate at most two directory levels, apply the exclusions above before analysis, preserve parent/child relationships, and report the resulting project-relative structure. Do not require a POSIX shell pipeline or any other operating-system-specific command.
|
|
87
87
|
3. Identify entry points by language convention
|
|
88
88
|
4. Catalog dependencies (external packages)
|
|
@@ -20,13 +20,13 @@ Handles re-init without losing user edits:
|
|
|
20
20
|
| Field | Type | Description |
|
|
21
21
|
|-------|------|-------------|
|
|
22
22
|
| `adoption_mode` | string | `"passive"` \| `"advisory"` \| `"active"` |
|
|
23
|
-
| `platform` | string | Installed payload metadata: `"codebuddy"` \| `"claude"` \| `"codex"` \| `"pi"` \| `"all"`. It records installation, not a canonical behavior allowlist. |
|
|
23
|
+
| `platform` | string | Installed payload metadata: `"codebuddy"` \| `"claude"` \| `"codex"` \| `"pi"` \| `"cursor"` \| `"all"`. It records installation, not a canonical behavior allowlist. |
|
|
24
24
|
| `tech_stack` | object | Detected or user-provided tech stack |
|
|
25
25
|
| `tech_stack._auto_detected` | boolean | `true` if auto-detected, `false` if user-provided |
|
|
26
26
|
| `detected_layers` | string[] | Development layers observed in the project. Written by prizmkit-init Phase 4.5. Values: `frontend` / `backend` / `database` / `mobile`. Empty only when no layers are observed. Always refreshed from code and never cleared by rule-adoption choices. |
|
|
27
27
|
| `enabled_rule_profiles` | string[] | Rule profiles the user explicitly enabled. This is independent from `detected_layers`; an empty array means no custom profile is enabled, not that the project has no detected layers. |
|
|
28
28
|
|
|
29
|
-
Legacy manifests may still contain `both` for read-only migration compatibility. New config writes must use `codebuddy`, `claude`, `codex`, `pi`, or `all`.
|
|
29
|
+
Legacy manifests may still contain `both` for read-only migration compatibility. New config writes must use `codebuddy`, `claude`, `codex`, `pi`, `cursor`, or `all`.
|
|
30
30
|
|
|
31
31
|
## Examples
|
|
32
32
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Run this local planning-quality gate after `spec.md` and `plan.md` are drafted or updated, before returning `PLAN_READY`.
|
|
6
6
|
|
|
7
|
-
This
|
|
7
|
+
This mandatory Main-Agent baseline runs inside `prizmkit-plan` to improve the planning artifacts only. Its maximum of two local rounds remains independent of the optional Reviewer described in `independent-plan-review.md`.
|
|
8
8
|
|
|
9
9
|
## Non-Goals
|
|
10
10
|
|
|
@@ -13,7 +13,6 @@ Do not do any of the following from this guide:
|
|
|
13
13
|
- Start implementation or edit product/source code.
|
|
14
14
|
- Run tests, builds, lint, or package commands.
|
|
15
15
|
- Start implementation or any other execution process.
|
|
16
|
-
- Spawn or require a Critic agent inside this Main-Agent loop. The separate optional independent review is considered only after this loop converges and only through `independent-plan-review.md`.
|
|
17
16
|
- Create a separate review-loop skill.
|
|
18
17
|
- Expand scope beyond improving `spec.md` and `plan.md`.
|
|
19
18
|
|
|
@@ -87,7 +86,7 @@ Optional findings do not block planning completion.
|
|
|
87
86
|
4. Do not apply `OPTIONAL` findings unless they clearly improve readiness without expanding scope.
|
|
88
87
|
5. If any fixes were applied, rerun this review once.
|
|
89
88
|
6. Stop after at most 2 total review rounds.
|
|
90
|
-
7. If unresolved `BLOCKER` findings remain after the final round, stop planning and ask targeted clarification questions. Do not
|
|
89
|
+
7. If unresolved `BLOCKER` findings remain after the final round, stop planning and ask targeted clarification questions. Do not treat independent review as blocker recovery.
|
|
91
90
|
8. If no unresolved blockers remain, report that the mandatory Main-Agent planning quality gate passed and hand off to the optional independent Plan review boundary in `independent-plan-review.md`.
|
|
92
91
|
|
|
93
92
|
## Output Summary
|
|
@@ -592,7 +592,7 @@ HIERARCHY RULE: if directory X lives inside top-level module M, X is a sub-modul
|
|
|
592
592
|
|
|
593
593
|
CAPACITY RULE: use MODULE_GROUPS whenever MODULE_INDEX cannot fit L0 within 4096B. Do not change hard limits for project size. Init does not create semantic or mirrored L2 placeholders; later Update/Rebuild/Migrate may create complete L2 documents when durable knowledge and unambiguous identity exist.
|
|
594
594
|
|
|
595
|
-
EXCLUDE: .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .codex/, .agents/, .pi/, .prizmkit/
|
|
595
|
+
EXCLUDE: .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .codex/, .agents/, .pi/, .cursor/, .prizmkit/
|
|
596
596
|
SOURCE_BOUNDARY: Excluding `.prizmkit/` excludes the installed Runtime at `.prizmkit/dev-pipeline/`; never exclude a repository's canonical top-level `dev-pipeline/` source module by basename.
|
|
597
597
|
|
|
598
598
|
## 9.2 Post-Init Behavior
|
|
@@ -11,7 +11,7 @@ STEPS:
|
|
|
11
11
|
- TOP-LEVEL modules: directories directly under project root (or under src/ for src-based layouts) that qualify.
|
|
12
12
|
- SUB-MODULES: directories INSIDE a top-level module that qualify. Record them as source structure in the direct-child parent L1; if durable L2 is created later, its nested path mirrors the sub-module.
|
|
13
13
|
- HIERARCHY RULE: exact `root.prizm` is L0; top-level module M maps to direct-child `.prizmkit/prizm-docs/<M>.prizm` (L1); directory X inside M maps to nested `.prizmkit/prizm-docs/<M>/<X>.prizm` (L2). Deeper source ownership remains L2 and never creates L3.
|
|
14
|
-
- Exclude .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .codex/, .agents/, .pi/, and the complete `.prizmkit/` framework directory. This excludes installed `.prizmkit/dev-pipeline/` artifacts but never excludes a repository's canonical top-level `dev-pipeline/` source module by basename. If total module count > 30, ask user for include/exclude patterns.
|
|
14
|
+
- Exclude .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .codex/, .agents/, .pi/, .cursor/, and the complete `.prizmkit/` framework directory. This excludes installed `.prizmkit/dev-pipeline/` artifacts but never excludes a repository's canonical top-level `dev-pipeline/` source module by basename. If total module count > 30, ask user for include/exclude patterns.
|
|
15
15
|
3. Apply the Value Gate from SKILL.md and the format specification to every metadata, rule, pattern, dependency, file, and summary candidate. Keep navigational structure only when needed to locate ownership. Reject source-derivable signatures, history, test inventories, temporary conclusions, stale/duplicate meanings, procedures, and low-value file lists.
|
|
16
16
|
4. Create `.prizmkit/prizm-docs/` and only the mirrored directories needed by documents that will exist. Do not create placeholder detail files.
|
|
17
17
|
5. Generate `root.prizm` (L0) with concise PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, navigation pointers, and only Value-Gate-qualified global RULES/PATTERNS/CROSS_CUTTING facts. Set `PRIZM_VERSION: 4`. Keep L0 a summary/pointer map; never copy child interfaces, data flow, traps, decisions, or full rules. No CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths.
|
|
@@ -335,7 +335,7 @@ Read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the sin
|
|
|
335
335
|
|
|
336
336
|
## Verification Defaults
|
|
337
337
|
|
|
338
|
-
Set behavior-preservation and testing expectations for each refactor item.
|
|
338
|
+
Set behavior-preservation and testing expectations for each refactor item.
|
|
339
339
|
|
|
340
340
|
| Priority | Complexity | Verification expectation |
|
|
341
341
|
|----------|-----------|--------------------------|
|
|
@@ -344,8 +344,6 @@ Set behavior-preservation and testing expectations for each refactor item. Do no
|
|
|
344
344
|
| high | high | Scoped tests for changed boundaries plus review gate |
|
|
345
345
|
| other combinations | any | Smallest meaningful behavior-preservation check |
|
|
346
346
|
|
|
347
|
-
Never emit `critic` or `critic_count`; those fields are fully removed and validators reject them.
|
|
348
|
-
|
|
349
347
|
---
|
|
350
348
|
|
|
351
349
|
## Fast Path
|
|
@@ -37,6 +37,21 @@ VALID_TYPES = {"extract", "rename", "restructure", "simplify", "decouple", "migr
|
|
|
37
37
|
VALID_PRIORITIES = {"critical", "high", "medium", "low"}
|
|
38
38
|
VALID_COMPLEXITIES = {"low", "medium", "high"}
|
|
39
39
|
VALID_PRESERVATION_STRATEGIES = {"test-gate", "snapshot", "manual"}
|
|
40
|
+
ALLOWED_LIST_FIELDS = {
|
|
41
|
+
"$schema", "project_name", "project_description", "created_at",
|
|
42
|
+
"created_by", "refactors", "global_context",
|
|
43
|
+
}
|
|
44
|
+
ALLOWED_GLOBAL_CONTEXT_FIELDS = {
|
|
45
|
+
"tech_stack", "language", "runtime", "frontend_framework",
|
|
46
|
+
"frontend_styling", "backend_framework", "database", "orm",
|
|
47
|
+
"testing_strategy", "bundler", "project_type", "ci_pipeline",
|
|
48
|
+
}
|
|
49
|
+
ALLOWED_REFACTOR_FIELDS = {
|
|
50
|
+
"id", "title", "description", "scope", "type", "priority", "complexity",
|
|
51
|
+
"estimated_lines", "behavior_preservation", "dependencies",
|
|
52
|
+
"acceptance_criteria", "status", "completion_notes", "user_context",
|
|
53
|
+
"browser_interaction", "model",
|
|
54
|
+
}
|
|
40
55
|
|
|
41
56
|
REFACTOR_ID_RE = re.compile(r"^R-\d{3}$")
|
|
42
57
|
|
|
@@ -155,6 +170,12 @@ def validate_refactor_list(data):
|
|
|
155
170
|
# ------------------------------------------------------------------
|
|
156
171
|
# 1. Top-level schema validation
|
|
157
172
|
# ------------------------------------------------------------------
|
|
173
|
+
unknown_root = set(data) - ALLOWED_LIST_FIELDS
|
|
174
|
+
if unknown_root:
|
|
175
|
+
errors.append("refactor list has unknown fields: {}".format(
|
|
176
|
+
", ".join(sorted(unknown_root))
|
|
177
|
+
))
|
|
178
|
+
|
|
158
179
|
schema = data.get("$schema")
|
|
159
180
|
if schema != SCHEMA_VERSION:
|
|
160
181
|
errors.append(
|
|
@@ -165,6 +186,17 @@ def validate_refactor_list(data):
|
|
|
165
186
|
if not isinstance(project_name, str) or not project_name.strip():
|
|
166
187
|
errors.append("project_name must be a non-empty string")
|
|
167
188
|
|
|
189
|
+
global_context = data.get("global_context")
|
|
190
|
+
if global_context is not None:
|
|
191
|
+
if not isinstance(global_context, dict):
|
|
192
|
+
errors.append("global_context must be an object")
|
|
193
|
+
else:
|
|
194
|
+
unknown_context = set(global_context) - ALLOWED_GLOBAL_CONTEXT_FIELDS
|
|
195
|
+
if unknown_context:
|
|
196
|
+
errors.append("global_context has unknown fields: {}".format(
|
|
197
|
+
", ".join(sorted(unknown_context))
|
|
198
|
+
))
|
|
199
|
+
|
|
168
200
|
refactors = data.get("refactors")
|
|
169
201
|
if not isinstance(refactors, list) or len(refactors) == 0:
|
|
170
202
|
errors.append("refactors must be a non-empty array")
|
|
@@ -209,6 +241,12 @@ def validate_refactor_list(data):
|
|
|
209
241
|
label, ", ".join(sorted(missing))
|
|
210
242
|
))
|
|
211
243
|
|
|
244
|
+
unknown = set(refactor.keys()) - ALLOWED_REFACTOR_FIELDS
|
|
245
|
+
if unknown:
|
|
246
|
+
errors.append("{} has unknown fields: {}".format(
|
|
247
|
+
label, ", ".join(sorted(unknown))
|
|
248
|
+
))
|
|
249
|
+
|
|
212
250
|
# -- ID format & uniqueness --
|
|
213
251
|
rid = refactor.get("id", "")
|
|
214
252
|
if not REFACTOR_ID_RE.match(str(rid)):
|
|
@@ -246,15 +284,6 @@ def validate_refactor_list(data):
|
|
|
246
284
|
)
|
|
247
285
|
)
|
|
248
286
|
|
|
249
|
-
# -- Retired fields --
|
|
250
|
-
for retired_field in ("critic", "critic_count"):
|
|
251
|
-
if retired_field in refactor:
|
|
252
|
-
errors.append(
|
|
253
|
-
"{}: '{}' field is retired; remove it from refactor-list data".format(
|
|
254
|
-
label, retired_field
|
|
255
|
-
)
|
|
256
|
-
)
|
|
257
|
-
|
|
258
287
|
# -- Scope --
|
|
259
288
|
scope = refactor.get("scope")
|
|
260
289
|
if isinstance(scope, dict):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prizmkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.164",
|
|
4
4
|
"description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
"framework",
|
|
37
37
|
"codebuddy",
|
|
38
38
|
"claude-code",
|
|
39
|
-
"codex"
|
|
39
|
+
"codex",
|
|
40
|
+
"cursor",
|
|
41
|
+
"cursor-agent"
|
|
40
42
|
],
|
|
41
43
|
"author": "PrizmKit",
|
|
42
44
|
"license": "MIT"
|
package/src/ai-cli-launch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const BUILT_IN_AI_CLI_NAMES = new Set(['claude', 'cbc', 'codebuddy', 'codex', 'pi']);
|
|
1
|
+
const BUILT_IN_AI_CLI_NAMES = new Set(['claude', 'cbc', 'codebuddy', 'codex', 'pi', 'agent']);
|
|
2
2
|
|
|
3
3
|
function asText(value) {
|
|
4
4
|
return typeof value === 'string' ? value : '';
|
|
@@ -81,6 +81,8 @@ export function formatCliArgsForPrompt(args = []) {
|
|
|
81
81
|
function normalizeExecutable(aiCli) {
|
|
82
82
|
const trimmed = asText(aiCli).trim();
|
|
83
83
|
if (!trimmed) return '';
|
|
84
|
+
const unquoted = trimmed.replace(/^(['"])(.*)\1$/, '$2');
|
|
85
|
+
if (/^[A-Za-z]:\\/.test(unquoted) && /\.(exe|cmd|bat)$/i.test(unquoted)) return unquoted;
|
|
84
86
|
const tokens = tokenizeCliArgs(trimmed);
|
|
85
87
|
if (tokens.length !== 1) {
|
|
86
88
|
throw new Error('自定义 AI CLI 需要把可执行命令和额外参数分开填写;请把额外参数写入无头模式希望添加的参数。');
|
|
@@ -89,8 +91,13 @@ function normalizeExecutable(aiCli) {
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
function executableBasename(aiCli) {
|
|
94
|
+
const raw = asText(aiCli).trim();
|
|
95
|
+
const unquoted = raw.replace(/^(['"])(.*)\1$/, '$2');
|
|
96
|
+
if (/^[A-Za-z]:\\/.test(unquoted) && /\.(exe|cmd|bat)$/i.test(unquoted)) {
|
|
97
|
+
return (unquoted.split(/[\\/]/).pop()?.toLowerCase() || '').replace(/\.(exe|cmd|bat)$/i, '');
|
|
98
|
+
}
|
|
92
99
|
const executable = normalizeExecutable(aiCli);
|
|
93
|
-
return executable.split(/[\\/]/).pop()?.toLowerCase() || '';
|
|
100
|
+
return (executable.split(/[\\/]/).pop()?.toLowerCase() || '').replace(/\.(exe|cmd|bat)$/i, '');
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
export function isBuiltInAiCli(aiCli) {
|
package/src/clean.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
|
-
import {
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { getAdaptersDir, loadMetadata, loadRulesMetadata } from './metadata.js';
|
|
5
6
|
import { readManifest } from './manifest.js';
|
|
6
7
|
import { privateProjectMemoryFile, projectMemoryFile } from './platforms.js';
|
|
7
8
|
|
|
@@ -170,6 +171,18 @@ async function removeGeneratedCodexConfig(projectRoot, dryRun) {
|
|
|
170
171
|
return { path: configPath, removed: true };
|
|
171
172
|
}
|
|
172
173
|
|
|
174
|
+
async function removeCursorHooks(projectRoot, dryRun) {
|
|
175
|
+
const adapterPath = path.join(getAdaptersDir(), 'cursor', 'hooks-adapter.js');
|
|
176
|
+
const { removeHooks } = await import(pathToFileURL(adapterPath).href);
|
|
177
|
+
return (await removeHooks(projectRoot, dryRun)).map(change => ({
|
|
178
|
+
path: path.join(projectRoot, change.path),
|
|
179
|
+
removed: !dryRun && change.action === 'removed',
|
|
180
|
+
updated: !dryRun && change.action === 'updated',
|
|
181
|
+
reason: dryRun ? 'dry_run' : undefined,
|
|
182
|
+
note: change.action === 'updated' ? '(PrizmKit hook entries)' : undefined,
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
|
|
173
186
|
export async function runClean(directory, options = {}) {
|
|
174
187
|
const projectRoot = path.resolve(directory || '.');
|
|
175
188
|
const dryRun = Boolean(options.dryRun);
|
|
@@ -191,18 +204,19 @@ export async function runClean(directory, options = {}) {
|
|
|
191
204
|
// Read manifest for accurate cleanup (covers skills from older versions)
|
|
192
205
|
const manifest = await readManifest(projectRoot);
|
|
193
206
|
|
|
207
|
+
// Validate and merge-remove Cursor hooks before any destructive cleanup.
|
|
208
|
+
const cursorHookResults = await removeCursorHooks(projectRoot, dryRun);
|
|
209
|
+
|
|
194
210
|
const metadataSkillNames = Object.keys(metadata.skills);
|
|
195
211
|
const externalSkillNames = (metadata.external_skills?.known || []).map(s => s.name);
|
|
196
212
|
const manifestSkillNames = manifest?.files?.skills || [];
|
|
197
213
|
const allSkillNames = [...new Set([...metadataSkillNames, ...externalSkillNames, ...manifestSkillNames])];
|
|
198
214
|
|
|
199
|
-
// Retired PrizmKit named-agent files
|
|
200
|
-
const
|
|
215
|
+
// Retired PrizmKit named-agent files have deterministic managed identities.
|
|
216
|
+
const agentFiles = [
|
|
201
217
|
LEGACY_DEV_AGENT_FILE,
|
|
202
218
|
LEGACY_REVIEWER_AGENT_FILE,
|
|
203
219
|
];
|
|
204
|
-
const manifestAgentFiles = manifest?.files?.agents || [];
|
|
205
|
-
const agentFiles = [...new Set([...knownAgentFiles, ...manifestAgentFiles])];
|
|
206
220
|
const codexAgentFiles = [...new Set(agentFiles.flatMap(f => [f, f.replace(/\.md$/, '.toml')]))];
|
|
207
221
|
|
|
208
222
|
// Rule file names installed by PrizmKit (union of metadata + manifest)
|
|
@@ -255,6 +269,10 @@ export async function runClean(directory, options = {}) {
|
|
|
255
269
|
const piSkillsDir = path.join(projectRoot, '.pi', 'skills');
|
|
256
270
|
results.push(...await removeKnownEntries(piSkillsDir, allSkillNames, dryRun));
|
|
257
271
|
|
|
272
|
+
// .cursor/skills/ — Cursor project Agent Skills
|
|
273
|
+
const cursorSkillsDir = path.join(projectRoot, '.cursor', 'skills');
|
|
274
|
+
results.push(...await removeKnownEntries(cursorSkillsDir, allSkillNames, dryRun));
|
|
275
|
+
|
|
258
276
|
// .claude/agents/ — retired PrizmKit named-agent files
|
|
259
277
|
const claudeAgentsDir = path.join(projectRoot, '.claude', 'agents');
|
|
260
278
|
results.push(...await removeKnownEntries(claudeAgentsDir, agentFiles, dryRun));
|
|
@@ -286,7 +304,15 @@ export async function runClean(directory, options = {}) {
|
|
|
286
304
|
const piRulesDir = path.join(projectRoot, '.pi', 'rules');
|
|
287
305
|
results.push(...await removeKnownEntries(piRulesDir, ruleFileNames.map(n => `${n}.md`), dryRun));
|
|
288
306
|
|
|
289
|
-
|
|
307
|
+
const cursorRulesDir = path.join(projectRoot, '.cursor', 'rules');
|
|
308
|
+
results.push(...await removeKnownEntries(
|
|
309
|
+
cursorRulesDir,
|
|
310
|
+
[...ruleFileNames.map(n => `${n}.mdc`), 'prizmkit-framework.mdc'],
|
|
311
|
+
dryRun,
|
|
312
|
+
));
|
|
313
|
+
results.push(...cursorHookResults);
|
|
314
|
+
|
|
315
|
+
for (const platform of ['codebuddy', 'claude', 'codex', 'pi', 'cursor']) {
|
|
290
316
|
const memoryFile = projectMemoryFile(platform);
|
|
291
317
|
const privateMemoryFile = privateProjectMemoryFile(platform);
|
|
292
318
|
if (!privateMemoryFile) continue;
|
|
@@ -297,6 +323,13 @@ export async function runClean(directory, options = {}) {
|
|
|
297
323
|
results.push(await cleanMarkedProjectMemory(projectRoot, privateMemoryFile, dryRun));
|
|
298
324
|
}
|
|
299
325
|
|
|
326
|
+
if (!dryRun) {
|
|
327
|
+
for (const relativeDir of ['.cursor/hooks', '.cursor/rules', '.cursor/skills', '.cursor']) {
|
|
328
|
+
const dir = path.join(projectRoot, relativeDir);
|
|
329
|
+
if (await fs.pathExists(dir) && (await fs.readdir(dir)).length === 0) await fs.remove(dir);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
300
333
|
// ── Private host-memory .gitignore cleanup (never `.prizmkit/**`) ─────────
|
|
301
334
|
const gitignoreResult = await cleanGitignore(projectRoot, dryRun);
|
|
302
335
|
|
|
@@ -318,6 +351,9 @@ export async function runClean(directory, options = {}) {
|
|
|
318
351
|
if (item.removed) {
|
|
319
352
|
const note = item.note ? chalk.gray(` ${item.note}`) : '';
|
|
320
353
|
console.log(chalk.green(` ✓ 已删除: ${item.path}`) + note);
|
|
354
|
+
} else if (item.updated) {
|
|
355
|
+
const note = item.note ? chalk.gray(` ${item.note}`) : '';
|
|
356
|
+
console.log(chalk.green(` ✓ 已更新: ${item.path}`) + note);
|
|
321
357
|
} else if (item.reason === 'dry_run') {
|
|
322
358
|
console.log(chalk.gray(` [dry-run] ${item.path}`));
|
|
323
359
|
}
|