prizmkit 1.1.193 → 1.1.195
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 +43 -12
- package/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/.env.example +5 -0
- package/bundled/dev-pipeline/README.md +2 -1
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +111 -30
- package/bundled/dev-pipeline/prizmkit_runtime/cli.py +44 -3
- package/bundled/dev-pipeline/prizmkit_runtime/commands.py +29 -9
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +121 -44
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +190 -37
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -0
- package/bundled/dev-pipeline/prizmkit_runtime/iterate.py +2480 -0
- package/bundled/dev-pipeline/prizmkit_runtime/paths.py +3 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +32 -8
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +29 -12
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +13 -5
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +166 -0
- package/bundled/dev-pipeline/scripts/feature_list_contract.py +964 -0
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +18 -40
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +24 -19
- package/bundled/dev-pipeline/scripts/prompt_framework.py +24 -8
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +1 -63
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +8 -6
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +0 -10
- package/bundled/dev-pipeline/templates/feature-list-schema.json +8 -6
- package/bundled/dev-pipeline/templates/iterate/evaluate-prompt.md +97 -0
- package/bundled/dev-pipeline/templates/iterate/evaluation-schema.json +538 -0
- package/bundled/dev-pipeline/templates/iterate/headless-plan-prompt.md +66 -0
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +2 -2
- package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +13 -4
- package/bundled/rules/USAGE.md +15 -48
- package/bundled/rules/_rules-metadata.json +7 -14
- package/bundled/rules/general/coding-baseline.md +23 -0
- package/bundled/rules/prizm/prizm-progressive-loading.md +2 -2
- package/bundled/skills/_metadata.json +12 -42
- package/bundled/skills/app-planner/SKILL.md +2 -2
- package/bundled/skills/app-planner/references/generated-plan-review.md +2 -2
- package/bundled/skills/app-planner/references/project-state-detection.md +1 -1
- package/bundled/skills/app-planner/references/rules-configuration.md +158 -88
- package/bundled/skills/app-planner/scripts/validate-rules-configuration.py +543 -12
- package/bundled/skills/bug-planner/references/verification.md +4 -5
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +20 -14
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +49 -9
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +20 -14
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +49 -9
- package/bundled/skills/feature-planner/SKILL.md +3 -3
- package/bundled/skills/feature-planner/references/browser-interaction.md +9 -29
- package/bundled/skills/iterate-pipeline-launcher/SKILL.md +273 -0
- package/bundled/skills/iterate-pipeline-launcher/references/configuration.md +105 -0
- package/bundled/skills/prizmkit-code-review/SKILL.md +10 -8
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +4 -1
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +2 -1
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +12 -8
- package/bundled/skills/prizmkit-implement/SKILL.md +2 -2
- package/bundled/skills/prizmkit-init/SKILL.md +10 -10
- package/bundled/skills/prizmkit-init/references/brownfield-deep-init.md +81 -0
- package/bundled/skills/prizmkit-plan/SKILL.md +2 -1
- package/bundled/skills/prizmkit-plan/assets/plan-template.md +2 -0
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +8 -4
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +8 -7
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +33 -16
- package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +29 -12
- package/bundled/skills/prizmkit-retrospective/references/retrospective-result-schema.json +126 -2
- package/bundled/skills/prizmkit-retrospective/references/rule-evolution-steps.md +86 -0
- package/bundled/skills/prizmkit-test/SKILL.md +2 -1
- package/bundled/skills/prizmkit-workflow/SKILL.md +8 -0
- package/bundled/skills/prizmkit-workflow/references/cold-start-rules.md +84 -0
- package/bundled/templates/project-memory-template.md +3 -3
- package/package.json +1 -1
- package/src/clean.js +2 -3
- package/src/config.js +52 -39
- package/src/index.js +29 -111
- package/src/prompts.js +20 -87
- package/src/runtime-passthrough.js +324 -0
- package/src/scaffold.js +41 -294
- package/src/upgrade.js +7 -39
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +0 -127
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +0 -124
- package/src/external-skills.js +0 -103
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Project Rules Evolution — Strictly Gated Phase B Steps
|
|
2
|
+
|
|
3
|
+
Run this optional Phase B (`Project Rules Evolution Check`) after Phase A Prizm documentation synchronization whenever `change_paths` is non-empty. Phase B governs incremental evolution of `.prizmkit/rules/<layer>-rules.md` files without violating the atomic stage boundary.
|
|
4
|
+
|
|
5
|
+
## 1. Read-Only Evidence Intake and Scope Boundary
|
|
6
|
+
|
|
7
|
+
1. Keep `change_paths` strictly limited to the exact validated non-`.prizmkit/` project paths supplied by the caller. Never add `.prizmkit/` paths to `change_paths`, and never add `.prizmkit/rules/` paths to `documentation_paths`.
|
|
8
|
+
2. Inspect `{artifact_dir}/review-report.md`, `{artifact_dir}/test-report.md`, and `{artifact_dir}/test-result.json` strictly **read-only** when present alongside the validated source diff (`git diff HEAD -- <exact validated change_paths>`) to identify concrete review findings, test regressions, security/data/concurrency/compatibility hazards, or newly introduced heavy dependencies.
|
|
9
|
+
3. Map the validated `change_paths` to affected application layers (`frontend` for browser UI, `backend` for service/API, `database` for schema migration/ORM, `mobile` for iOS/Android/React Native/Flutter). Inspect at most the matching layer(s) by exact path Read of `.prizmkit/rules/<layer>-rules.md` — never load all four files by default and do not depend on git tracking or glob.
|
|
10
|
+
4. Phase B is strictly incremental and **never creates a missing `.prizmkit/rules/<layer>-rules.md` from scratch**. If the target layer file does not exist:
|
|
11
|
+
- if no candidate passes all four admission gates below, record `status: "NO_RULE_CHANGE"` (`updated_paths: []`, `proposals: []`);
|
|
12
|
+
- if one or more cross-task candidates pass all four gates, emit `status: "RULES_PROPOSED"` with `updated_paths: []` and concrete `proposals` without creating the file.
|
|
13
|
+
|
|
14
|
+
## 2. Four-Gate AND Admission Rubric
|
|
15
|
+
|
|
16
|
+
A candidate rule clause is eligible **only** when it passes **all four gates simultaneously**:
|
|
17
|
+
|
|
18
|
+
1. **Cross-Task Reusable**: applies across future tasks in the target layer rather than one isolated file or module. Single-module bugs, quirks, or localized gotchas belong in Prizm detail docs `TRAPS:`, never in `.prizmkit/rules/`.
|
|
19
|
+
2. **Real-Evidence-Driven**: directly backed by concrete evidence from this change's validated diff and/or read-only `{artifact_dir}/review-report.md`, `test-report.md`, or `test-result.json` — specifically:
|
|
20
|
+
- an actual pitfall or test regression caught during review or testing;
|
|
21
|
+
- a substantive review defect that revealed a reusable layer hazard;
|
|
22
|
+
- a security, data-integrity, concurrency, or wire-compatibility redline; or
|
|
23
|
+
- a newly added heavy stack or core dependency contract.
|
|
24
|
+
3. **Falsifiable `MUST` / `NEVER`**: phrased as an unambiguous `MUST:` or `NEVER:` directive with a concrete condition, trigger, or counterexample that a future implementer or reviewer can objectively test as pass/fail.
|
|
25
|
+
4. **Non-Redundant**: not already enforced automatically by project linters, formatters, or compilers; not already covered by built-in `core/rules/` (including `coding-baseline`); and not already owned by a Prizm detail document.
|
|
26
|
+
|
|
27
|
+
## 3. Explicitly Banned Categories (Always Reject)
|
|
28
|
+
|
|
29
|
+
Reject any candidate that falls into any of these categories:
|
|
30
|
+
|
|
31
|
+
- one-off requirement details or feature-specific business logic;
|
|
32
|
+
- temporary workarounds or short-lived migration hacks;
|
|
33
|
+
- unagreed stylistic or subjective formatting preferences;
|
|
34
|
+
- vague slogans (e.g., "write clean code", "follow best practices", "keep it maintainable");
|
|
35
|
+
- temporal or lifecycle metadata: task, feature, bug, refactor, session, run, pipeline, or workflow IDs; dates or timestamps; branch names; absolute worktree paths; or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths.
|
|
36
|
+
|
|
37
|
+
## 4. Automation vs Confirmation Boundaries
|
|
38
|
+
|
|
39
|
+
Classify every candidate that passes all four gates before modifying any file:
|
|
40
|
+
|
|
41
|
+
- **Auto-Persist into `## 5. Project-Evolved Rules`**: permitted **only** when the target `.prizmkit/rules/<layer>-rules.md` already exists, the clause is evidence-backed and non-conflicting with existing rules or `Decision Ledger` choices, it does not weaken safety/security/data-integrity redlines, it introduces no cross-layer conflict, and the resulting file stays within the 20-item and 16 KB hard caps.
|
|
42
|
+
- **Emit `RULES_PROPOSED` without Auto-Overwriting**: required whenever a candidate would:
|
|
43
|
+
1. alter `Decision Ledger` core technology, framework, or architectural choices;
|
|
44
|
+
2. relax or remove an existing safety, security, authorization, or data-integrity redline;
|
|
45
|
+
3. require resolving a cross-layer conflict between two layer-rules files;
|
|
46
|
+
4. target a missing `.prizmkit/rules/<layer>-rules.md`; or
|
|
47
|
+
5. exceed the 20-item cap in `## 5. Project-Evolved Rules` or the 16 KB (16,384 bytes) raw UTF-8 file cap even after safe deduplication, merging, and obsolete-rule removal.
|
|
48
|
+
|
|
49
|
+
Each proposal entry in `rule_evolution.proposals` must carry exact keys:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"target_path": ".prizmkit/rules/<layer>-rules.md",
|
|
54
|
+
"clause": "MUST/NEVER: <falsifiable clause with concrete condition or counterexample>",
|
|
55
|
+
"reason": "<exact confirmation trigger: Decision Ledger change / safety redline relaxation / cross-layer conflict / missing layer file / capacity ceiling>"
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Status selection rules:
|
|
60
|
+
|
|
61
|
+
- `NO_RULE_CHANGE`: no file written and no proposals (`updated_paths: []`, `proposals: []`).
|
|
62
|
+
- `RULES_UPDATED`: one or more existing layer files updated in place and **zero** proposals (`updated_paths: [...]`, `proposals: []`), with non-empty top-level `validation` evidence.
|
|
63
|
+
- `RULES_PROPOSED`: one or more proposals emitted (`proposals: [...]`). When all candidates require confirmation, `updated_paths` is `[]`; when an unaffected layer also had a safe non-conflicting auto-persisted update in the same run, keep that path in `updated_paths` and record validation evidence in top-level `validation` while emitting `status: "RULES_PROPOSED"` so pending confirmation is never hidden.
|
|
64
|
+
|
|
65
|
+
## 5. Non-Append-Only Governance, Caps, Verification, and Rollback
|
|
66
|
+
|
|
67
|
+
For every existing `.prizmkit/rules/<layer>-rules.md` receiving an auto-persisted update:
|
|
68
|
+
|
|
69
|
+
1. **Full-File Read & Pre-Write Capture**: read the complete target file before editing and preserve its exact pre-write bytes in memory.
|
|
70
|
+
2. **Locate or Append Section 5**: locate `## 5. Project-Evolved Rules`. If a pre-existing layer file lacks `## 5. Project-Evolved Rules`, append that heading at the end of the file in place when persisting the first evolved rule. Never overwrite earlier sections (`## 1` through `## 4` or `Decision Ledger`) during auto-persistence.
|
|
71
|
+
3. **Non-Append-Only Reconciliation**:
|
|
72
|
+
- match existing entries in `## 5. Project-Evolved Rules` and new candidates by semantic meaning, not literal string match;
|
|
73
|
+
- deduplicate and merge overlapping or synonymous rules in place into one concise falsifiable bullet;
|
|
74
|
+
- remove an existing evolved rule only when current validated source/dependency evidence proves it obsolete;
|
|
75
|
+
- preserve stable order for unchanged bullets; never perform blind append-only growth.
|
|
76
|
+
4. **Hard Caps and Warning Band**:
|
|
77
|
+
- maximum **20 items** (bullet entries) inside `## 5. Project-Evolved Rules`;
|
|
78
|
+
- maximum **16 KB (16,384 bytes)** exact raw UTF-8 size per `.prizmkit/rules/<layer>-rules.md` file;
|
|
79
|
+
- **12 KB (12,288 bytes)** soft warning band: when current or candidate size reaches 12,288 bytes, consolidate overlapping bullets and trim redundant phrasing before writing, and record the byte measurement in `validation`.
|
|
80
|
+
- if a candidate still exceeds 20 items or 16,384 bytes after safe consolidation, do **not** write the oversized file—keep the original bytes untouched and emit the overflow clause as `RULES_PROPOSED`.
|
|
81
|
+
5. **Byte-Identical Idempotency**: compare complete candidate UTF-8 bytes against preserved pre-write bytes. If identical, skip writing and omit the file from `updated_paths`.
|
|
82
|
+
6. **Post-Write Re-Read Verification & Exact-Byte Rollback**:
|
|
83
|
+
- after writing, re-read the actual bytes from disk;
|
|
84
|
+
- verify exact raw UTF-8 byte count <= 16,384 bytes, `## 5. Project-Evolved Rules` bullet count <= 20, valid Markdown headings, and zero banned metadata (IDs, dates, branch names, worktree paths, artifact paths);
|
|
85
|
+
- record concrete check summaries in top-level `validation` (e.g., `.prizmkit/rules/backend-rules.md raw UTF-8 check: 4820B <= 16384B, evolved rules: 3/20`);
|
|
86
|
+
- if **any** post-write check fails, immediately restore every modified layer file to its exact preserved pre-write bytes (never use Git reset, checkout, or stash), re-verify restored bytes, and fail closed with `outcome: "RETRO_BLOCKED"`, `result: null`, exact failure/rollback details in `reason` and `validation`, and `rule_evolution` omitted.
|
|
@@ -157,7 +157,8 @@ Do not perform the repair in this invocation when it affects or may affect:
|
|
|
157
157
|
- persistence, transaction, data integrity, or concurrency semantics;
|
|
158
158
|
- cross-module contracts or consumer obligations;
|
|
159
159
|
- compatibility guarantees;
|
|
160
|
-
- any change whose locality cannot be established confidently
|
|
160
|
+
- any change whose locality cannot be established confidently;
|
|
161
|
+
- `.prizmkit/rules/*` files (do not create or make ad-hoc edits to project rule files; rule evolution belongs to the dedicated retrospective stage).
|
|
161
162
|
|
|
162
163
|
Record the defect evidence and required correction, return `TEST_NEEDS_FIXES`, and stop. Do not prescribe or execute work outside this testing invocation.
|
|
163
164
|
|
|
@@ -53,6 +53,14 @@ If `description` is missing and no resumable workflow is supplied, ask for the r
|
|
|
53
53
|
|
|
54
54
|
## Core Orchestration Rules
|
|
55
55
|
|
|
56
|
+
### 0.5. Lightweight Cold-Start Rules Preflight
|
|
57
|
+
|
|
58
|
+
Before invoking `prizmkit-plan`, check whether the requirement clearly lands on one or two application layers (`frontend`, `backend`, `database`, or `mobile`) and whether each affected `.prizmkit/rules/<layer>-rules.md` already exists via exact path Read (never load all four files by default and do not depend on git tracking or glob):
|
|
59
|
+
|
|
60
|
+
- Skip pure documentation, config-only, script, or non-layer tasks, and skip any layer whose `.prizmkit/rules/<layer>-rules.md` already exists (idempotent).
|
|
61
|
+
- When one or two affected layer files are absent, read `${SKILL_DIR}/references/cold-start-rules.md` and follow its self-contained non-interactive procedure to generate a concise (<= 4 KB) `Mode: cold-start-lightweight` `.prizmkit/rules/<layer>-rules.md` with verified stack summary, 5–10 high-signal `MUST`/`NEVER` rules, change boundaries, and an empty `## 5. Project-Evolved Rules` section, appending the matching `LAYER_RULES:` pointer only if `.prizmkit/prizm-docs/root.prizm` already exists.
|
|
62
|
+
- Perform this preflight independently without depending on any external planning or orchestration Skill, without questionnaire pauses, and without altering the six-stage `workflow-state.json` schema.
|
|
63
|
+
|
|
56
64
|
### 1. Start with Plan
|
|
57
65
|
|
|
58
66
|
Invoke `/prizmkit-plan` with the requirement and any explicit `artifact_dir`. Do not write a second plan in this orchestrator.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Cold-Start Layer Rules — Lightweight Preflight
|
|
2
|
+
|
|
3
|
+
Run this self-contained preflight once during Stage 0.5 (before invoking `prizmkit-plan`) when a repository lacks a matching `.prizmkit/rules/<layer>-rules.md`. Generate the file independently from direct repository evidence without depending on any external planning or orchestration Skill and without pausing for a questionnaire.
|
|
4
|
+
|
|
5
|
+
## 1. Trigger and Idempotency Gate
|
|
6
|
+
|
|
7
|
+
Evaluate the requirement and map its affected application layer(s):
|
|
8
|
+
|
|
9
|
+
- browser UI work -> `frontend` (`.prizmkit/rules/frontend-rules.md`)
|
|
10
|
+
- service or API work -> `backend` (`.prizmkit/rules/backend-rules.md`)
|
|
11
|
+
- schema migration or ORM work -> `database` (`.prizmkit/rules/database-rules.md`)
|
|
12
|
+
- iOS, Android, React Native, or Flutter work -> `mobile` (`.prizmkit/rules/mobile-rules.md`)
|
|
13
|
+
|
|
14
|
+
Strict gate rules:
|
|
15
|
+
|
|
16
|
+
1. Trigger **only** when the requirement clearly lands on **one or two** of `frontend`, `backend`, `database`, or `mobile`.
|
|
17
|
+
2. Skip pure documentation, configuration-only, build/CI script, or non-layer tasks.
|
|
18
|
+
3. For each affected layer (at most two), check existence by exact path Read of `.prizmkit/rules/<layer>-rules.md` — never load all four files by default and do not depend on git tracking or glob.
|
|
19
|
+
4. If the target `.prizmkit/rules/<layer>-rules.md` already exists, **skip that layer idempotently**; never overwrite or rewrite an existing layer-rules file during cold-start.
|
|
20
|
+
5. Do not alter `workflow-state.json` or add a seventh lifecycle stage; Stage 0.5 is a preflight check prior to `prizmkit-plan`.
|
|
21
|
+
|
|
22
|
+
## 2. Non-Interactive Repository Evidence Scan
|
|
23
|
+
|
|
24
|
+
For each affected missing layer, gather verified signals directly from the repository without asking the user questions:
|
|
25
|
+
|
|
26
|
+
1. **Manifests and build files**: inspect the relevant package/project manifests (e.g., `package.json`, `pyproject.toml`, `requirements*.txt`, `go.mod`, `Cargo.toml`, `pom.xml`, `build.gradle*`, `pubspec.yaml`, `Gemfile`, schema/migration manifests) to verify exact language, framework, runtime, ORM, and test runner.
|
|
27
|
+
2. **Linter, formatter, and compiler configs**: inspect existing config files (e.g., `tsconfig.json`, `eslint*`, `biome.json`, `ruff.toml`, `.golangci.yml`, `.prettierrc*`, `prisma/schema.prisma`, `alembic.ini`) so generated rules reinforce—never contradict or duplicate—automated tooling.
|
|
28
|
+
3. **Existing Prizm memory**: when `.prizmkit/prizm-docs/root.prizm` exists, read `root.prizm` and only the relevant pointed module/detail `.prizm` documents to incorporate already-verified project architecture, contracts, dependencies, and `RULES:` MUST/NEVER directives.
|
|
29
|
+
4. **Target source files**: read a bounded set (up to 5 files) of representative target or neighboring source files for the affected layer to confirm error-handling patterns, module boundaries, API/schema conventions, and test conventions.
|
|
30
|
+
|
|
31
|
+
Never invent unverified frameworks, libraries, or architectural preferences that are not evidenced in the repository.
|
|
32
|
+
|
|
33
|
+
## 3. Generate Concise Layer-Rules File (<= 4 KB)
|
|
34
|
+
|
|
35
|
+
Write `.prizmkit/rules/<layer>-rules.md` using the following bounded template:
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
# <Layer> Development Rules
|
|
39
|
+
|
|
40
|
+
> Mode: cold-start-lightweight
|
|
41
|
+
|
|
42
|
+
## 1. Verified Stack Summary
|
|
43
|
+
- Language & Runtime: <directly evidenced only>
|
|
44
|
+
- Frameworks & Core Libraries: <directly evidenced only>
|
|
45
|
+
- Tooling (Lint / Typecheck / Test): <directly evidenced only>
|
|
46
|
+
|
|
47
|
+
## 2. High-Signal Rules
|
|
48
|
+
- MUST: <concrete falsifiable rule grounded in verified repo evidence>
|
|
49
|
+
- NEVER: <concrete falsifiable prohibition with clear condition or counterexample>
|
|
50
|
+
<!-- 5 to 10 total MUST/NEVER bullets; non-redundant with automated linters or built-in coding-baseline -->
|
|
51
|
+
|
|
52
|
+
## 3. Change Boundaries
|
|
53
|
+
- <explicit boundaries: public API/schema/contract compatibility, auth/security invariants, or module boundaries observed in the repository>
|
|
54
|
+
|
|
55
|
+
## 4. Override Precedence
|
|
56
|
+
1. Repository explicit contracts, current source/detail docs, committed OpenAPI/schemas, project linters/compilers, and host project instruction conventions (highest)
|
|
57
|
+
2. This `.prizmkit/rules/<layer>-rules.md` file
|
|
58
|
+
3. Framework `coding-baseline` and language conventions
|
|
59
|
+
- `root.prizm` `RULES:` MUST/NEVER remain authoritative for that key.
|
|
60
|
+
|
|
61
|
+
## 5. Project-Evolved Rules
|
|
62
|
+
<!-- Governed incremental rules evolved from verified review/test evidence; keep empty on cold-start -->
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Hard quality and size checks before finalizing the file:
|
|
66
|
+
|
|
67
|
+
1. **Header stamp**: must contain `> Mode: cold-start-lightweight`.
|
|
68
|
+
2. **Rule budget**: include **5–10** high-signal, falsifiable `MUST`/`NEVER` rules grounded in observed repository facts (no vague slogans, no task/session/branch/date metadata, no redundant rules already enforced by `coding-baseline` or active linters).
|
|
69
|
+
3. **Empty Section 5**: retain `## 5. Project-Evolved Rules` empty (comment placeholder only) so future governed evolution has a deterministic target.
|
|
70
|
+
4. **Raw UTF-8 byte ceiling**: measure exact raw UTF-8 bytes after writing; the file must be **<= 4 KB (4,096 bytes)**. If it exceeds 4,096 bytes, tighten prose and re-verify before continuing.
|
|
71
|
+
|
|
72
|
+
## 4. Conditional `root.prizm` Pointer Update
|
|
73
|
+
|
|
74
|
+
Only if `.prizmkit/prizm-docs/root.prizm` **already exists**:
|
|
75
|
+
|
|
76
|
+
1. Read `.prizmkit/prizm-docs/root.prizm` in full and preserve its exact pre-write bytes.
|
|
77
|
+
2. Add or append only the newly created layer pointer(s) under `LAYER_RULES:`:
|
|
78
|
+
- `frontend -> .prizmkit/rules/frontend-rules.md`
|
|
79
|
+
- `backend -> .prizmkit/rules/backend-rules.md`
|
|
80
|
+
- `database -> .prizmkit/rules/database-rules.md`
|
|
81
|
+
- `mobile -> .prizmkit/rules/mobile-rules.md`
|
|
82
|
+
3. Include only layers whose rule files exist; never place layer-rule paths inside `RULES:` MUST/NEVER; never rewrite `RULES:` as a file pointer.
|
|
83
|
+
4. Re-read `root.prizm` and verify exact raw UTF-8 length remains **<= 4,096 bytes** and all existing pointers remain intact. If appending `LAYER_RULES:` would exceed 4,096 bytes or fail validation, restore the exact pre-write bytes of `root.prizm` and proceed without failing Stage 0.5 (consumers still discover `.prizmkit/rules/<layer>-rules.md` by exact convention path Read).
|
|
84
|
+
5. If `.prizmkit/prizm-docs/root.prizm` does **not** exist, do **not** create it; continue directly to `prizmkit-plan`.
|
|
@@ -6,9 +6,9 @@ This project uses PrizmKit with the Prizm documentation system for AI-optimized
|
|
|
6
6
|
### Progressive Loading Protocol
|
|
7
7
|
- ON SESSION START: Read exact `.prizmkit/prizm-docs/root.prizm` first when it exists; it alone is L0.
|
|
8
8
|
- ON TASK: Read only relevant direct-child L1 documents (`.prizmkit/prizm-docs/<module>.prizm`) selected through MODULE_INDEX or MODULE_GROUPS pointers.
|
|
9
|
-
- LAYER_RULES: If the current task lands on frontend, backend, database, or mobile, Read `.prizmkit/rules/<layer>-rules.md` when that exact convention path exists
|
|
9
|
+
- LAYER_RULES: If the current task lands on frontend, backend, database, or mobile, Read `.prizmkit/rules/<layer>-rules.md` when that exact convention path exists and enforce it consciously for planning, implementation HOW refinement, and code review. Never load all four files by default. If a task spans two layers, read both existing files. Map browser UI work to frontend, service or API work to backend, schema migration or ORM work to database, and iOS, Android, React Native, or Flutter work to mobile. Discover by exact path Read; do not depend on git tracking or glob. When the file does not exist, do not block and do not silently skip—explicitly activate the built-in `coding-baseline` plus detected language/stack conventions (e.g., strict typing and no unhandled promises in TypeScript, no bare `except:` or mutable default arguments in Python, explicit `err` handling in Go, parameterized SQL) and record the active rule source (`project-layer-rules` vs `framework-coding-baseline`). Enforce three-tier override precedence without a clarification pause: Tier 1 (highest) repository explicit contracts, current source and L2 `.prizm` facts, committed OpenAPI/schemas, project linters/compilers, and host project instruction conventions; Tier 2 `.prizmkit/rules/<layer>-rules.md`; Tier 3 (fallback) framework `coding-baseline` and language conventions—when rules conflict, those current sources win without a clarification pause. L0 `RULES:` MUST/NEVER remain authoritative for that key.
|
|
10
10
|
- ON FILE EDIT: Read the complete relevant nested L2 and complete parent/child documents needed to resolve its SUBDIRS or DETAILS pointer. Grep-only fragments are insufficient modification context.
|
|
11
|
-
- IF L2 IS ABSENT: Inspect bounded target source and narrowly implicated contracts without creating a placeholder; documentation creation belongs to Retrospective or explicit repair.
|
|
11
|
+
- IF L2 IS ABSENT: Inspect bounded target source and narrowly implicated contracts without creating a placeholder; documentation creation belongs to brownfield core initialization, Retrospective, or explicit repair.
|
|
12
12
|
- NEVER load all `.prizm` docs at once, load unrelated modules, or create L3.
|
|
13
13
|
|
|
14
14
|
### Framework Directory and Maintenance Protocol
|
|
@@ -28,7 +28,7 @@ This project uses PrizmKit with the Prizm documentation system for AI-optimized
|
|
|
28
28
|
### Missing L2 Fallback
|
|
29
29
|
- When relevant L2 is absent, inspect only bounded source needed for the current modification.
|
|
30
30
|
- Do not create a placeholder merely because source was read or changed.
|
|
31
|
-
- Retrospective or explicit documentation repair may
|
|
31
|
+
- Brownfield core initialization, Retrospective, or explicit documentation repair may write a complete Value-Gate-qualified L2 and resolving parent pointer after identity, ownership, capacity, and format checks pass.
|
|
32
32
|
|
|
33
33
|
### Available Commands
|
|
34
34
|
Run `/prizmkit` to see all available PrizmKit commands.
|
package/package.json
CHANGED
package/src/clean.js
CHANGED
|
@@ -209,7 +209,7 @@ export async function runClean(directory, options = {}) {
|
|
|
209
209
|
|
|
210
210
|
// Load metadata to know exactly which files PrizmKit owns
|
|
211
211
|
const [metadata, rulesMeta] = await Promise.all([
|
|
212
|
-
loadMetadata().catch(() => ({ skills: {}
|
|
212
|
+
loadMetadata().catch(() => ({ skills: {} })),
|
|
213
213
|
loadRulesMetadata().catch(() => ({ rules: {} })),
|
|
214
214
|
]);
|
|
215
215
|
|
|
@@ -221,9 +221,8 @@ export async function runClean(directory, options = {}) {
|
|
|
221
221
|
const antigravityHookResults = await removeAntigravityHooks(projectRoot, dryRun);
|
|
222
222
|
|
|
223
223
|
const metadataSkillNames = Object.keys(metadata.skills);
|
|
224
|
-
const externalSkillNames = (metadata.external_skills?.known || []).map(s => s.name);
|
|
225
224
|
const manifestSkillNames = manifest?.files?.skills || [];
|
|
226
|
-
const allSkillNames = [...new Set([...metadataSkillNames, ...
|
|
225
|
+
const allSkillNames = [...new Set([...metadataSkillNames, ...manifestSkillNames])];
|
|
227
226
|
|
|
228
227
|
// Retired PrizmKit named-agent files have deterministic managed identities.
|
|
229
228
|
const agentFiles = [
|
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, AI CLI,
|
|
5
|
+
* Supports changing platform, AI CLI, and pipeline toggle.
|
|
6
6
|
*
|
|
7
7
|
* Flow: READ manifest → PROMPT user → COMPUTE DIFF → DISPLAY SUMMARY → EXECUTE
|
|
8
8
|
*
|
|
@@ -15,11 +15,9 @@ import path from 'path';
|
|
|
15
15
|
import { readFileSync } from 'fs';
|
|
16
16
|
import { dirname, join } from 'path';
|
|
17
17
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
18
|
-
import { confirm } from '@inquirer/prompts';
|
|
19
18
|
|
|
20
19
|
import { readManifestForLifecycle, writeManifest, buildManifest, diffManifest } from './manifest.js';
|
|
21
20
|
import {
|
|
22
|
-
loadMetadata,
|
|
23
21
|
loadRulesMetadata,
|
|
24
22
|
getAdaptersDir,
|
|
25
23
|
} from './metadata.js';
|
|
@@ -30,6 +28,7 @@ import {
|
|
|
30
28
|
installPipeline,
|
|
31
29
|
installGitHook,
|
|
32
30
|
installPrizmkitScripts,
|
|
31
|
+
normalizeSkillSuite,
|
|
33
32
|
resolveSkillList,
|
|
34
33
|
resolvePipelineFileList,
|
|
35
34
|
resolveRuleNamesForRuntime,
|
|
@@ -37,6 +36,7 @@ import {
|
|
|
37
36
|
removeStaleManagedPipelineFiles,
|
|
38
37
|
normalizeMainProjectMemoryContent,
|
|
39
38
|
removeRetiredAgentTeamArtifacts,
|
|
39
|
+
EXTRAS_REGISTRY,
|
|
40
40
|
} from './scaffold.js';
|
|
41
41
|
import {
|
|
42
42
|
removeSkillFiles,
|
|
@@ -48,9 +48,8 @@ import { detectPlatform } from './detect-platform.js';
|
|
|
48
48
|
import {
|
|
49
49
|
selectPlatform,
|
|
50
50
|
selectAiCliLaunch,
|
|
51
|
-
selectSkillSuite,
|
|
52
|
-
selectRulesPreset,
|
|
53
51
|
confirmPipeline,
|
|
52
|
+
confirmAction,
|
|
54
53
|
} from './prompts.js';
|
|
55
54
|
import { canonicalizePlatformSelection, isKnownPlatform, platformLabel, privateProjectMemoryFile, projectMemoryFile, resolvePayloadPlatforms, uniquePlatforms, unknownPlatformMessage } from './platforms.js';
|
|
56
55
|
import { normalizeRuntime, runtimeLabel } from './runtimes.js';
|
|
@@ -526,12 +525,19 @@ export async function runConfig(directory, options = {}) {
|
|
|
526
525
|
const normalizedManifestRuntime = normalizeRuntime(rawManifestRuntime);
|
|
527
526
|
const runtimeManifestNeedsNormalization = rawManifestRuntime !== normalizedManifestRuntime;
|
|
528
527
|
const platformManifestNeedsNormalization = detectedPlatformRaw !== detectedPlatform;
|
|
528
|
+
const rawManifestSuite = oldManifest.suite || 'core';
|
|
529
|
+
const suiteManifestNeedsNormalization = rawManifestSuite !== 'core';
|
|
530
|
+
const rawManifestRules = oldManifest.options?.rules || 'recommended';
|
|
531
|
+
const rulesManifestNeedsNormalization = rawManifestRules !== 'recommended';
|
|
532
|
+
const rawManifestExtras = oldManifest.files?.extras || [];
|
|
533
|
+
const normalizedExtras = rawManifestExtras.filter(name => EXTRAS_REGISTRY[name]);
|
|
534
|
+
const extrasManifestNeedsNormalization = normalizedExtras.length !== rawManifestExtras.length;
|
|
529
535
|
|
|
530
536
|
const currentConfig = {
|
|
531
537
|
platform: detectedPlatform,
|
|
532
538
|
runtime: normalizedManifestRuntime,
|
|
533
|
-
suite:
|
|
534
|
-
rules:
|
|
539
|
+
suite: rawManifestSuite,
|
|
540
|
+
rules: rawManifestRules,
|
|
535
541
|
pipeline: oldManifest.options?.pipeline ?? true,
|
|
536
542
|
aiCli: userConfig.ai_cli || oldManifest.options?.aiCli || '',
|
|
537
543
|
aiCliLaunch: storedAiCliLaunch(userConfig),
|
|
@@ -541,13 +547,15 @@ export async function runConfig(directory, options = {}) {
|
|
|
541
547
|
throw new Error(unknownPlatformMessage(options.platform));
|
|
542
548
|
}
|
|
543
549
|
|
|
550
|
+
// 兼容旧 --skills 参数:输出弃用警告并始终归一为 core
|
|
551
|
+
const targetSuite = normalizeSkillSuite(options.skills, { warn: true, warnOnCore: true });
|
|
552
|
+
const targetRules = 'recommended';
|
|
553
|
+
|
|
544
554
|
// Display current config
|
|
545
555
|
console.log(chalk.bold(' 当前配置:'));
|
|
546
556
|
console.log(` 平台: ${chalk.cyan(platformLabel(currentConfig.platform))}`);
|
|
547
557
|
console.log(` 运行时: ${chalk.cyan(runtimeLabel(currentConfig.runtime))}`);
|
|
548
558
|
console.log(` AI CLI: ${currentConfig.aiCli ? chalk.cyan(currentConfig.aiCli) : chalk.gray('(未设置)')}`);
|
|
549
|
-
console.log(` 技能套件: ${chalk.cyan(currentConfig.suite)}`);
|
|
550
|
-
console.log(` 规则: ${chalk.cyan(currentConfig.rules)}`);
|
|
551
559
|
console.log(` 流水线: ${currentConfig.pipeline ? chalk.green('启用') : chalk.gray('禁用')}`);
|
|
552
560
|
console.log('');
|
|
553
561
|
|
|
@@ -559,10 +567,21 @@ export async function runConfig(directory, options = {}) {
|
|
|
559
567
|
|
|
560
568
|
if (nonInteractive) {
|
|
561
569
|
// Non-interactive: only change what's explicitly specified via CLI options
|
|
562
|
-
if (!platformManifestNeedsNormalization
|
|
563
|
-
&&
|
|
570
|
+
if (!platformManifestNeedsNormalization
|
|
571
|
+
&& !runtimeManifestNeedsNormalization
|
|
572
|
+
&& !runtimeOptionNeedsNormalization
|
|
573
|
+
&& !suiteManifestNeedsNormalization
|
|
574
|
+
&& !rulesManifestNeedsNormalization
|
|
575
|
+
&& !extrasManifestNeedsNormalization
|
|
576
|
+
&& !options.platform
|
|
577
|
+
&& options.skills === undefined
|
|
578
|
+
&& options.runtime === undefined
|
|
579
|
+
&& options.aiCli === undefined
|
|
580
|
+
&& options.headlessPromptArg === undefined
|
|
581
|
+
&& options.headlessExtraArgs === undefined
|
|
582
|
+
&& options.pipeline === undefined) {
|
|
564
583
|
console.log(chalk.yellow(' ⚠ 非交互式模式下未指定任何变更。'));
|
|
565
|
-
console.log(chalk.gray(' 使用 --platform, --runtime, --
|
|
584
|
+
console.log(chalk.gray(' 使用 --platform, --runtime, --ai-cli, --headless-prompt-arg, --headless-extra-args, --pipeline/--no-pipeline'));
|
|
566
585
|
return;
|
|
567
586
|
}
|
|
568
587
|
|
|
@@ -575,14 +594,14 @@ export async function runConfig(directory, options = {}) {
|
|
|
575
594
|
newConfig = {
|
|
576
595
|
platform: options.platform || currentConfig.platform,
|
|
577
596
|
runtime: optionRuntime || currentConfig.runtime,
|
|
578
|
-
suite:
|
|
579
|
-
rules:
|
|
597
|
+
suite: targetSuite,
|
|
598
|
+
rules: targetRules,
|
|
580
599
|
pipeline: options.pipeline !== undefined ? options.pipeline : currentConfig.pipeline,
|
|
581
600
|
aiCli: aiCliLaunchValue.aiCli,
|
|
582
601
|
aiCliLaunch: aiCliLaunchValue.aiCliLaunch,
|
|
583
602
|
};
|
|
584
603
|
} else {
|
|
585
|
-
// Interactive:
|
|
604
|
+
// Interactive: platform, AI CLI, and pipeline toggle only
|
|
586
605
|
const detected = detectPlatform();
|
|
587
606
|
|
|
588
607
|
try {
|
|
@@ -591,17 +610,13 @@ export async function runConfig(directory, options = {}) {
|
|
|
591
610
|
const newRuntime = optionRuntime || currentConfig.runtime;
|
|
592
611
|
const newPlatform = await selectPlatform(currentConfig.platform, detected);
|
|
593
612
|
const aiCliSelection = await selectAiCliLaunch(currentConfig.aiCli, detected, currentConfig.aiCliLaunch);
|
|
594
|
-
|
|
595
|
-
const metadata = await loadMetadata();
|
|
596
|
-
const newSuite = await selectSkillSuite(currentConfig.suite, metadata);
|
|
597
|
-
const newRules = await selectRulesPreset(currentConfig.rules);
|
|
598
613
|
const newPipeline = await confirmPipeline(currentConfig.pipeline);
|
|
599
614
|
|
|
600
615
|
newConfig = {
|
|
601
616
|
platform: newPlatform,
|
|
602
617
|
runtime: newRuntime,
|
|
603
|
-
suite:
|
|
604
|
-
rules:
|
|
618
|
+
suite: targetSuite,
|
|
619
|
+
rules: targetRules,
|
|
605
620
|
pipeline: newPipeline,
|
|
606
621
|
aiCli: aiCliSelection.aiCli,
|
|
607
622
|
aiCliLaunch: aiCliSelection.aiCliLaunch,
|
|
@@ -639,11 +654,14 @@ export async function runConfig(directory, options = {}) {
|
|
|
639
654
|
if (JSON.stringify(newConfig.aiCliLaunch || null) !== JSON.stringify(currentConfig.aiCliLaunch || null)) {
|
|
640
655
|
changes.push('AI CLI 无头启动参数已更新');
|
|
641
656
|
}
|
|
642
|
-
if (
|
|
657
|
+
if (suiteManifestNeedsNormalization) {
|
|
643
658
|
changes.push(`技能套件: ${currentConfig.suite} → ${newConfig.suite}`);
|
|
644
659
|
}
|
|
645
|
-
if (
|
|
646
|
-
changes.push(`规则: ${currentConfig.rules} →
|
|
660
|
+
if (rulesManifestNeedsNormalization) {
|
|
661
|
+
changes.push(`规则: ${currentConfig.rules} → 全部内置规则`);
|
|
662
|
+
}
|
|
663
|
+
if (extrasManifestNeedsNormalization) {
|
|
664
|
+
changes.push('清理已退役的浏览器扩展记录');
|
|
647
665
|
}
|
|
648
666
|
if (newConfig.pipeline !== currentConfig.pipeline) {
|
|
649
667
|
changes.push(`流水线: ${currentConfig.pipeline ? '启用' : '禁用'} → ${newConfig.pipeline ? '启用' : '禁用'}`);
|
|
@@ -680,10 +698,7 @@ export async function runConfig(directory, options = {}) {
|
|
|
680
698
|
}
|
|
681
699
|
|
|
682
700
|
if (!nonInteractive) {
|
|
683
|
-
const proceed = await
|
|
684
|
-
message: '确认应用配置变更?',
|
|
685
|
-
default: true,
|
|
686
|
-
});
|
|
701
|
+
const proceed = await confirmAction('确认应用配置变更?', true);
|
|
687
702
|
if (!proceed) {
|
|
688
703
|
console.log(chalk.yellow(' 配置已取消。'));
|
|
689
704
|
return;
|
|
@@ -701,9 +716,9 @@ export async function runConfig(directory, options = {}) {
|
|
|
701
716
|
const platformsToUpdate = newPlatforms.filter(p => oldPlatforms.includes(p));
|
|
702
717
|
|
|
703
718
|
// Resolve new file lists
|
|
704
|
-
const newSkillList = await resolveSkillList(
|
|
719
|
+
const newSkillList = await resolveSkillList();
|
|
705
720
|
const rulesMeta = await loadRulesMetadata();
|
|
706
|
-
const newRuleFiles = resolveRuleNamesForRuntime(rulesMeta, newConfig.
|
|
721
|
+
const newRuleFiles = resolveRuleNamesForRuntime(rulesMeta, newConfig.runtime).map(name => `${name}.md`);
|
|
707
722
|
const newPipelineFiles = newConfig.pipeline ? resolvePipelineFileList(newConfig.runtime) : [];
|
|
708
723
|
|
|
709
724
|
// 5a. Migrate project memory before removing dropped platforms
|
|
@@ -718,14 +733,14 @@ export async function runConfig(directory, options = {}) {
|
|
|
718
733
|
}
|
|
719
734
|
|
|
720
735
|
// 5c. Handle skill/rule diff for existing platforms (suite, rules, or runtime changed)
|
|
721
|
-
if (
|
|
722
|
-
||
|
|
736
|
+
if (suiteManifestNeedsNormalization
|
|
737
|
+
|| rulesManifestNeedsNormalization
|
|
723
738
|
|| newConfig.runtime !== currentConfig.runtime) {
|
|
724
739
|
const newTempManifest = buildManifest({
|
|
725
740
|
version: pkg.version, platform: newConfig.platform, suite: newConfig.suite,
|
|
726
741
|
skills: newSkillList, rules: newRuleFiles,
|
|
727
742
|
pipeline: newPipelineFiles, aiCli: newConfig.aiCli,
|
|
728
|
-
runtime: newConfig.runtime, rulesPreset: newConfig.rules, extras:
|
|
743
|
+
runtime: newConfig.runtime, rulesPreset: newConfig.rules, extras: normalizedExtras, payloadPlatforms: newPlatforms,
|
|
729
744
|
});
|
|
730
745
|
const diff = diffManifest(oldManifest, newTempManifest);
|
|
731
746
|
|
|
@@ -749,8 +764,8 @@ export async function runConfig(directory, options = {}) {
|
|
|
749
764
|
|| runtimeManifestNeedsNormalization
|
|
750
765
|
|| runtimeOptionNeedsNormalization
|
|
751
766
|
|| newConfig.runtime !== currentConfig.runtime
|
|
752
|
-
||
|
|
753
|
-
||
|
|
767
|
+
|| suiteManifestNeedsNormalization
|
|
768
|
+
|| rulesManifestNeedsNormalization
|
|
754
769
|
|| newConfig.aiCli !== currentConfig.aiCli;
|
|
755
770
|
|
|
756
771
|
for (const p of allTargetPlatforms) {
|
|
@@ -764,7 +779,7 @@ export async function runConfig(directory, options = {}) {
|
|
|
764
779
|
await installSkills(p, newSkillList, projectRoot, false, newConfig.runtime);
|
|
765
780
|
|
|
766
781
|
console.log(chalk.blue('\n Settings & Rules:'));
|
|
767
|
-
await installSettings(p, projectRoot, {
|
|
782
|
+
await installSettings(p, projectRoot, {}, false, newConfig.runtime);
|
|
768
783
|
|
|
769
784
|
console.log(chalk.blue('\n Project Memory:'));
|
|
770
785
|
await installProjectMemory(p, projectRoot, false);
|
|
@@ -831,7 +846,7 @@ export async function runConfig(directory, options = {}) {
|
|
|
831
846
|
aiCli: newConfig.aiCli,
|
|
832
847
|
rulesPreset: newConfig.rules,
|
|
833
848
|
payloadPlatforms: newPlatforms,
|
|
834
|
-
extras:
|
|
849
|
+
extras: normalizedExtras,
|
|
835
850
|
});
|
|
836
851
|
|
|
837
852
|
// Preserve original installedAt
|
|
@@ -854,8 +869,6 @@ export async function runConfig(directory, options = {}) {
|
|
|
854
869
|
console.log(chalk.gray(` 平台: ${platformLabel(newConfig.platform)}`));
|
|
855
870
|
console.log(chalk.gray(` 运行时: ${runtimeLabel(newConfig.runtime)}`));
|
|
856
871
|
console.log(chalk.gray(` AI CLI: ${newConfig.aiCli || '(未设置)'}`));
|
|
857
|
-
console.log(chalk.gray(` 技能套件: ${newConfig.suite}`));
|
|
858
|
-
console.log(chalk.gray(` 规则: ${newConfig.rules}`));
|
|
859
872
|
console.log(chalk.gray(` 流水线: ${newConfig.pipeline ? '启用' : '禁用'}`));
|
|
860
873
|
console.log('');
|
|
861
874
|
}
|