prizmkit 1.1.113 → 1.1.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/scripts/utils.py +8 -3
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +23 -0
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/app-planner/SKILL.md +18 -2
- package/bundled/skills/app-planner/references/generated-plan-review.md +67 -0
- package/bundled/skills/bug-planner/SKILL.md +19 -24
- package/bundled/skills/bug-planner/references/generated-plan-review.md +63 -0
- package/bundled/skills/feature-planner/SKILL.md +17 -22
- package/bundled/skills/feature-planner/references/generated-plan-review.md +63 -0
- package/bundled/skills/prizmkit-init/SKILL.md +2 -2
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
- package/bundled/skills/refactor-planner/SKILL.md +20 -26
- package/bundled/skills/refactor-planner/references/fast-path.md +2 -2
- package/bundled/skills/refactor-planner/references/generated-plan-review.md +63 -0
- package/package.json +1 -1
- package/src/clean.js +60 -7
- package/src/config.js +61 -20
- package/src/gitignore-template.js +6 -3
- package/src/manifest.js +6 -2
- package/src/platforms.js +14 -0
- package/src/scaffold.js +198 -34
- package/src/upgrade.js +5 -2
|
@@ -265,12 +265,12 @@ See `${SKILL_DIR}/references/planning-phases.md` for the full 5-step review chec
|
|
|
265
265
|
```
|
|
266
266
|
The script fills in defaults (`$schema`, `created_at`, `created_by`), validates all fields, and writes the final file only if validation passes.
|
|
267
267
|
3. If validation fails -> fix the draft and retry (max 3 attempts)
|
|
268
|
-
4. If validation passes -> run the mandatory
|
|
268
|
+
4. If validation passes -> run the mandatory Local Generated-Plan Review Gate (see §Local Generated-Plan Review Gate below); apply accepted fixes to the draft/source plan, regenerate, and revalidate until pass
|
|
269
269
|
5. If review and validation pass -> present final summary
|
|
270
270
|
|
|
271
271
|
**CHECKPOINT CP-RP-6**: `.prizmkit/plans/refactor-list.json` generated and validated.
|
|
272
272
|
|
|
273
|
-
**CHECKPOINT CP-RP-7**:
|
|
273
|
+
**CHECKPOINT CP-RP-7**: Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only newly added/changed refactor entries, applied accepted fixes through draft/source data, regenerated, and revalidated.
|
|
274
274
|
|
|
275
275
|
## Checkpoints (Mandatory Gates)
|
|
276
276
|
|
|
@@ -283,32 +283,26 @@ See `${SKILL_DIR}/references/planning-phases.md` for the full 5-step review chec
|
|
|
283
283
|
| **CP-RP-4** | Items Confirmed | User confirmed/modified/skipped each item | 5 |
|
|
284
284
|
| **CP-RP-5** | Completeness OK | DAG valid, preservation strategies declared, no gaps | 6 |
|
|
285
285
|
| **CP-RP-6** | Output Valid | `.prizmkit/plans/refactor-list.json` passes validation script | 7 |
|
|
286
|
-
| **CP-RP-7** | Plan Review Passed |
|
|
287
|
-
|
|
288
|
-
##
|
|
289
|
-
|
|
290
|
-
User requirement preserved verbatim:
|
|
291
|
-
|
|
292
|
-
Run this gate **after** `.prizmkit/plans/refactor-list.json` passes the validation/generate script and **before** the final handoff summary recommends `refactor-pipeline-launcher`. This gate applies to full workflow, Mode B from analysis, and fast-path refactor planning.
|
|
293
|
-
|
|
294
|
-
1. **
|
|
295
|
-
2. **
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
- `behavior_preservation` strategy quality and target scope consistency
|
|
301
|
-
- preservation of user-provided wording in `description`, `acceptance_criteria`, and `user_context`
|
|
302
|
-
- task-scoped `user_context` isolation: no unrelated sibling refactor goals, target files, constraints, or supplementary materials, and shared context appears on multiple items only when explicitly global
|
|
303
|
-
- priority/complexity calibration: every reviewed refactor has a short priority rationale and complexity rationale, medium/low assignments are allowed when criteria fit, and high/high is not used merely because the work is cleanup, framework-related, multi-file, or user-requested
|
|
304
|
-
3. **Keep the review planning-only**: do NOT start `refactor-pipeline-launcher`, do NOT run the refactor pipeline, do NOT run tests/builds/installs, and do NOT implement source-code refactors.
|
|
305
|
-
4. **Apply accepted review fixes through the draft/source plan**: when a finding is accepted, update `.prizmkit/plans/refactor-list.draft.json` or the in-memory draft representation first, then regenerate the final file with:
|
|
286
|
+
| **CP-RP-7** | Local Plan Review Passed | Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only newly added/changed refactor entries, applied accepted fixes through draft/source data, regenerated, and revalidated | 7 |
|
|
287
|
+
|
|
288
|
+
## Local Generated-Plan Review Gate
|
|
289
|
+
|
|
290
|
+
User requirement preserved verbatim: `there is a litter bug for prizm-code-review will to check git diff in working space and staged space , however the .prizmkit will be gitignored in most situation. so do you think the content should be change to inline a new reference file instead of use prizmkit-code-review`
|
|
291
|
+
|
|
292
|
+
Run this gate **after** `.prizmkit/plans/refactor-list.json` passes the validation/generate script and **before** the final handoff summary recommends `refactor-pipeline-launcher`. This gate applies to full workflow, Mode B from analysis, and fast-path refactor planning when the current session generated, appended, or rewrote final refactor planning content. For validate-only, summary-only, or draft-save flows with no new final planning content, report: `Local generated-plan review: not applicable — no new final planning content written.`
|
|
293
|
+
|
|
294
|
+
1. **Load the local reference**: read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the source of truth for this planner-output review loop.
|
|
295
|
+
2. **Read actual planning artifacts directly**: inspect `.prizmkit/plans/refactor-list.json`, `.prizmkit/plans/refactor-list.draft.json` when present, and any pre-session or in-memory draft snapshot. Do not rely on `git status`, `git diff`, or `git diff --cached`, because `.prizmkit` planning artifacts are often gitignored or untracked.
|
|
296
|
+
3. **Identify review scope**: compare by stable refactor IDs and item fields against the pre-session list when one existed. Ignore root generator metadata such as `$schema`, `created_at`, and `created_by`. Review only newly added or changed refactor entries; preserve unchanged historical entries except when needed to verify dependency references or behavior-preservation interactions.
|
|
297
|
+
4. **Run the local checklist** from the reference: schema compatibility, dependency/DAG soundness, safe behavior-preserving order, description completeness, headless execution readiness, acceptance criteria measurability, `behavior_preservation` strategy quality, user-provided wording preservation, task-scoped `user_context` isolation, and priority/complexity calibration.
|
|
298
|
+
5. **Keep the review planning-only**: do NOT start `refactor-pipeline-launcher`, do NOT run the refactor pipeline, do NOT run tests/builds/installs, and do NOT implement source-code refactors.
|
|
299
|
+
6. **Apply accepted review fixes through the draft/source plan**: when a finding is accepted, update `.prizmkit/plans/refactor-list.draft.json` or the in-memory draft representation first, then regenerate the final file with:
|
|
306
300
|
```bash
|
|
307
301
|
python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
|
|
308
302
|
```
|
|
309
303
|
Do not hand-patch the final JSON as the source of truth; map final-output findings back to draft entries before regeneration.
|
|
310
|
-
|
|
311
|
-
|
|
304
|
+
7. **Revalidate after every accepted fix batch**: the generate script must pass again before the planner can proceed. If validation fails, fix the draft and rerun until pass.
|
|
305
|
+
8. **Report the gate outcome** in the final summary: include local generated-plan review verdict, reviewed refactor IDs, accepted fixes (or "none"), and final validation result.
|
|
312
306
|
|
|
313
307
|
## Output Rules
|
|
314
308
|
|
|
@@ -444,10 +438,10 @@ Prevent accidental session exit without deliverable completion.
|
|
|
444
438
|
|
|
445
439
|
## Handoff Message Template
|
|
446
440
|
|
|
447
|
-
After successful validation and the
|
|
441
|
+
After successful validation and the Local Generated-Plan Review Gate, report:
|
|
448
442
|
1. Output file path
|
|
449
443
|
2. Total refactor items
|
|
450
444
|
3. Dependency ordering highlights (which items must run first)
|
|
451
445
|
4. Behavior preservation strategy distribution (N items with test-gate, M with snapshot, etc.)
|
|
452
|
-
5.
|
|
446
|
+
5. Local generated-plan review result: verdict, reviewed refactor IDs, accepted fixes (or "none"), and final validation result
|
|
453
447
|
6. Recommended next action: `refactor-pipeline-launcher`
|
|
@@ -34,7 +34,7 @@ For simple refactoring with minimal scope.
|
|
|
34
34
|
```bash
|
|
35
35
|
python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
|
|
36
36
|
```
|
|
37
|
-
5. If valid -> run the mandatory
|
|
37
|
+
5. If valid -> run the mandatory Local Generated-Plan Review Gate from the main `refactor-planner` skill before summarizing or recommending `refactor-pipeline-launcher`.
|
|
38
38
|
6. If invalid -> apply fixes to the draft, re-run generate (max 2 attempts, then escalate to full workflow)
|
|
39
39
|
|
|
40
40
|
## When NOT to Use Fast Path
|
|
@@ -53,6 +53,6 @@ AI: [Uses AskUserQuestion with options: "Fast-path", "Full workflow"]
|
|
|
53
53
|
User: [Selects "Fast-path"]
|
|
54
54
|
AI: "Drafting R-001..."
|
|
55
55
|
AI: [Validates immediately]
|
|
56
|
-
AI: [Runs the
|
|
56
|
+
AI: [Runs the Local Generated-Plan Review Gate on R-001 only]
|
|
57
57
|
AI: "Ready to proceed to dev-pipeline."
|
|
58
58
|
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Generated Plan Review — Refactor Planner
|
|
2
|
+
|
|
3
|
+
Use this local review loop after `.prizmkit/plans/refactor-list.json` has been generated and validated. This is a planner-output review, not an implementation/code-diff review.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
|
|
7
|
+
Run only when the current `refactor-planner` session generated, appended, or rewrote final refactor planning content. For validate-only, summary-only, or draft-save flows with no new final planning content, report: `Local generated-plan review: not applicable — no new final planning content written.`
|
|
8
|
+
|
|
9
|
+
## Direct Artifact Reads
|
|
10
|
+
|
|
11
|
+
Planning artifacts may be gitignored, untracked, or absent from staged and unstaged diffs. Read the actual files directly:
|
|
12
|
+
|
|
13
|
+
- Final list: `.prizmkit/plans/refactor-list.json`
|
|
14
|
+
- Draft/source list when present: `.prizmkit/plans/refactor-list.draft.json`
|
|
15
|
+
- Pre-session final list snapshot if captured in memory before edits
|
|
16
|
+
- In-memory draft object if the session has not written a draft file yet
|
|
17
|
+
|
|
18
|
+
Do not rely on `git status`, `git diff`, or `git diff --cached` to decide whether planner output exists or changed. Do not invoke `/prizmkit-code-review` for this planner-output gate; `/prizmkit-code-review` remains the implementation/code-diff review gate after `/prizmkit-implement`.
|
|
19
|
+
|
|
20
|
+
## Review Scope
|
|
21
|
+
|
|
22
|
+
1. If a pre-session final list exists, compare by stable refactor IDs (`R-*`).
|
|
23
|
+
2. Treat refactors as changed only when item fields changed. Ignore root generator metadata and formatting-only differences such as `$schema`, `created_at`, and `created_by`.
|
|
24
|
+
3. Review newly added refactor IDs and changed refactor IDs.
|
|
25
|
+
4. Preserve unchanged historical refactors. Read unchanged entries only when needed to verify dependency references or behavior-preservation interactions with reviewed refactors.
|
|
26
|
+
5. If no snapshot exists, review all refactor entries produced by the current generation flow.
|
|
27
|
+
|
|
28
|
+
## Review Checklist
|
|
29
|
+
|
|
30
|
+
For every reviewed refactor entry, check:
|
|
31
|
+
|
|
32
|
+
- Schema compatibility with `dev-pipeline-refactor-list-v1` and `.prizmkit/dev-pipeline/templates/refactor-list-schema.json`
|
|
33
|
+
- Dependency/DAG soundness, including safe behavior-preserving order
|
|
34
|
+
- Description completeness, target scope clarity, and headless execution readiness
|
|
35
|
+
- Acceptance criteria specificity and measurable behavior-preservation verification
|
|
36
|
+
- `behavior_preservation` strategy quality and consistency with target scope and existing tests
|
|
37
|
+
- User-provided wording preservation in `description`, `acceptance_criteria`, and `user_context`
|
|
38
|
+
- Task-scoped `user_context` isolation: no unrelated sibling refactor goals, target files, constraints, desired end states, or supplementary materials; shared context appears on multiple items only when explicitly global
|
|
39
|
+
- Priority/complexity calibration: every reviewed refactor has short priority and complexity rationales, medium/low assignments are allowed when criteria fit, and high/high is not used merely because the work is cleanup, framework-related, multi-file, or user-requested
|
|
40
|
+
|
|
41
|
+
## Fix Loop
|
|
42
|
+
|
|
43
|
+
1. Present findings with IDs, severity, evidence, and suggested draft/source changes.
|
|
44
|
+
2. Accept only findings that improve planner correctness, completeness, or downstream behavior-preserving execution readiness.
|
|
45
|
+
3. Apply accepted fixes to `.prizmkit/plans/refactor-list.draft.json` or the in-memory draft object first.
|
|
46
|
+
4. Regenerate the final list through the existing generator:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
5. Re-run validation/generation until valid. Do not hand-patch `.prizmkit/plans/refactor-list.json` as the source of truth.
|
|
53
|
+
6. Repeat the local review only for entries changed by accepted fixes.
|
|
54
|
+
|
|
55
|
+
## Report Format
|
|
56
|
+
|
|
57
|
+
Report in the final handoff summary:
|
|
58
|
+
|
|
59
|
+
- `Local generated-plan review: PASS` or `NEEDS_FIXES`
|
|
60
|
+
- Reviewed refactor IDs
|
|
61
|
+
- Accepted fixes, or `none`
|
|
62
|
+
- Final validation result
|
|
63
|
+
- Note when review was not applicable because no new final planning content was written
|
package/package.json
CHANGED
package/src/clean.js
CHANGED
|
@@ -3,6 +3,19 @@ import path from 'path';
|
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import { loadMetadata, loadRulesMetadata } from './metadata.js';
|
|
5
5
|
import { readManifest } from './manifest.js';
|
|
6
|
+
import { privateProjectMemoryFile, projectMemoryFile } from './platforms.js';
|
|
7
|
+
|
|
8
|
+
const PRIZMKIT_GITIGNORE_HEADERS = new Set([
|
|
9
|
+
'# PrizmKit',
|
|
10
|
+
'# PrizmKit 运行时全部产物(state/、prizm-docs/、.env、logs 等)',
|
|
11
|
+
]);
|
|
12
|
+
const PRIZMKIT_GITIGNORE_ENTRIES = new Set([
|
|
13
|
+
'.prizmkit/',
|
|
14
|
+
'.prizmkit/*',
|
|
15
|
+
'CLAUDE.private.md',
|
|
16
|
+
'AGENTS.private.md',
|
|
17
|
+
'CODEBUDDY.private.md',
|
|
18
|
+
]);
|
|
6
19
|
|
|
7
20
|
async function removePath(targetPath, dryRun) {
|
|
8
21
|
if (!await fs.pathExists(targetPath)) {
|
|
@@ -54,11 +67,14 @@ async function cleanGitignore(projectRoot, dryRun) {
|
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
const content = await fs.readFile(gitignorePath, 'utf8');
|
|
57
|
-
const
|
|
58
|
-
.
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
const nextLines = content.split(/\r?\n/).filter(line => {
|
|
71
|
+
const trimmed = line.trim();
|
|
72
|
+
return !PRIZMKIT_GITIGNORE_HEADERS.has(trimmed)
|
|
73
|
+
&& !PRIZMKIT_GITIGNORE_ENTRIES.has(trimmed);
|
|
74
|
+
});
|
|
75
|
+
const next = nextLines.join('\n').replace(/\n{3,}/g, '\n\n').trimEnd();
|
|
76
|
+
|
|
77
|
+
if (`${next}\n` === content || next === content.trimEnd()) {
|
|
62
78
|
return { updated: false, reason: 'no_prizmkit_section' };
|
|
63
79
|
}
|
|
64
80
|
|
|
@@ -66,7 +82,7 @@ async function cleanGitignore(projectRoot, dryRun) {
|
|
|
66
82
|
return { updated: true, reason: 'dry_run' };
|
|
67
83
|
}
|
|
68
84
|
|
|
69
|
-
await fs.writeFile(gitignorePath, next
|
|
85
|
+
await fs.writeFile(gitignorePath, next ? `${next}\n` : '');
|
|
70
86
|
return { updated: true };
|
|
71
87
|
}
|
|
72
88
|
|
|
@@ -100,6 +116,38 @@ async function cleanMarkedProjectMemory(projectRoot, fileName, dryRun) {
|
|
|
100
116
|
return { path: filePath, removed: true, note: '(PrizmKit section)' };
|
|
101
117
|
}
|
|
102
118
|
|
|
119
|
+
async function cleanProjectMemoryImport(projectRoot, fileName, privateFileName, dryRun) {
|
|
120
|
+
const filePath = path.join(projectRoot, fileName);
|
|
121
|
+
if (!await fs.pathExists(filePath)) {
|
|
122
|
+
return { path: filePath, removed: false, reason: 'not_found' };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const importPointer = `@./${privateFileName}`;
|
|
126
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
127
|
+
const next = content
|
|
128
|
+
.split(/\r?\n/)
|
|
129
|
+
.filter(line => line.trim() !== importPointer)
|
|
130
|
+
.join('\n')
|
|
131
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
132
|
+
.trimEnd();
|
|
133
|
+
|
|
134
|
+
if (next === content.trimEnd()) {
|
|
135
|
+
return { path: filePath, removed: false, reason: 'no_prizmkit_import' };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (dryRun) {
|
|
139
|
+
return { path: filePath, removed: false, reason: 'dry_run' };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!next) {
|
|
143
|
+
await fs.remove(filePath);
|
|
144
|
+
return { path: filePath, removed: true, note: '(PrizmKit import only)' };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
await fs.writeFile(filePath, `${next}\n`);
|
|
148
|
+
return { path: filePath, removed: true, note: '(PrizmKit import)' };
|
|
149
|
+
}
|
|
150
|
+
|
|
103
151
|
async function removeGeneratedCodexConfig(projectRoot, dryRun) {
|
|
104
152
|
const configPath = path.join(projectRoot, '.codex', 'config.toml');
|
|
105
153
|
if (!await fs.pathExists(configPath)) {
|
|
@@ -228,7 +276,12 @@ export async function runClean(directory, options = {}) {
|
|
|
228
276
|
const legacyCodexRulesDir = path.join(projectRoot, '.codex', 'rules');
|
|
229
277
|
results.push(...await removeKnownEntries(legacyCodexRulesDir, ruleFileNames.map(n => `${n}.md`), dryRun));
|
|
230
278
|
|
|
231
|
-
for (const
|
|
279
|
+
for (const platform of ['codebuddy', 'claude', 'codex']) {
|
|
280
|
+
const memoryFile = projectMemoryFile(platform);
|
|
281
|
+
const privateMemoryFile = privateProjectMemoryFile(platform);
|
|
282
|
+
if (!memoryFile || !privateMemoryFile) continue;
|
|
283
|
+
results.push(await cleanProjectMemoryImport(projectRoot, memoryFile, privateMemoryFile, dryRun));
|
|
284
|
+
results.push(await cleanMarkedProjectMemory(projectRoot, privateMemoryFile, dryRun));
|
|
232
285
|
results.push(await cleanMarkedProjectMemory(projectRoot, memoryFile, dryRun));
|
|
233
286
|
}
|
|
234
287
|
|
package/src/config.js
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
resolveRuleNamesForRuntime,
|
|
39
39
|
findStaleManagedPipelineFiles,
|
|
40
40
|
removeStaleManagedPipelineFiles,
|
|
41
|
+
normalizeMainProjectMemoryContent,
|
|
41
42
|
} from './scaffold.js';
|
|
42
43
|
import {
|
|
43
44
|
removeSkillFiles,
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
confirmTeamMode,
|
|
55
56
|
confirmPipeline,
|
|
56
57
|
} from './prompts.js';
|
|
57
|
-
import { isKnownPlatform, platformLabel, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
|
|
58
|
+
import { isKnownPlatform, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
|
|
58
59
|
import { normalizeRuntime, runtimeLabel } from './runtimes.js';
|
|
59
60
|
import { applyAiCliLaunchToConfig, resolveAiCliLaunchSelection, storedAiCliLaunch } from './ai-cli-launch.js';
|
|
60
61
|
|
|
@@ -114,6 +115,50 @@ function getProjectMemoryFile(platform) {
|
|
|
114
115
|
return projectMemoryFile(platform);
|
|
115
116
|
}
|
|
116
117
|
|
|
118
|
+
function logManagedMemoryWarnings(mainFile, warnings) {
|
|
119
|
+
for (const warning of warnings) {
|
|
120
|
+
console.log(chalk.yellow(` ⚠ ${mainFile}: ${warning}; preserving unmatched marker content`));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function removeProjectMemoryArtifacts(platform, projectRoot, dryRun) {
|
|
125
|
+
const mainFile = projectMemoryFile(platform);
|
|
126
|
+
const privateFile = privateProjectMemoryFile(platform);
|
|
127
|
+
if (!mainFile || !privateFile) return;
|
|
128
|
+
|
|
129
|
+
const privatePath = path.join(projectRoot, privateFile);
|
|
130
|
+
if (await fs.pathExists(privatePath)) {
|
|
131
|
+
if (dryRun) {
|
|
132
|
+
console.log(chalk.gray(` [dry-run] remove ${privateFile}`));
|
|
133
|
+
} else {
|
|
134
|
+
await fs.remove(privatePath);
|
|
135
|
+
console.log(chalk.red(` ✗ removed ${privateFile}`));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const mainPath = path.join(projectRoot, mainFile);
|
|
140
|
+
if (!await fs.pathExists(mainPath)) return;
|
|
141
|
+
|
|
142
|
+
const current = await fs.readFile(mainPath, 'utf-8');
|
|
143
|
+
const normalized = normalizeMainProjectMemoryContent(current, privateFile);
|
|
144
|
+
logManagedMemoryWarnings(mainFile, normalized.warnings);
|
|
145
|
+
const next = normalized.content.trim();
|
|
146
|
+
if (next === current.trim()) return;
|
|
147
|
+
|
|
148
|
+
if (dryRun) {
|
|
149
|
+
console.log(chalk.gray(` [dry-run] update ${mainFile} (remove PrizmKit import)`));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!next) {
|
|
154
|
+
await fs.remove(mainPath);
|
|
155
|
+
console.log(chalk.red(` ✗ removed ${mainFile} (empty after PrizmKit import removal)`));
|
|
156
|
+
} else {
|
|
157
|
+
await fs.writeFile(mainPath, `${next}\n`, 'utf-8');
|
|
158
|
+
console.log(chalk.green(` ✓ updated ${mainFile} (removed PrizmKit import)`));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
117
162
|
async function migrateProjectMemoryOnPlatformDrop(droppedPlatform, newPlatforms, projectRoot, dryRun) {
|
|
118
163
|
const sourceFile = getProjectMemoryFile(droppedPlatform);
|
|
119
164
|
if (!sourceFile) return;
|
|
@@ -135,8 +180,13 @@ async function migrateProjectMemoryOnPlatformDrop(droppedPlatform, newPlatforms,
|
|
|
135
180
|
return;
|
|
136
181
|
}
|
|
137
182
|
|
|
138
|
-
const
|
|
139
|
-
|
|
183
|
+
const normalized = normalizeMainProjectMemoryContent(
|
|
184
|
+
await fs.readFile(sourcePath, 'utf-8'),
|
|
185
|
+
privateProjectMemoryFile(droppedPlatform),
|
|
186
|
+
);
|
|
187
|
+
logManagedMemoryWarnings(sourceFile, normalized.warnings);
|
|
188
|
+
const sourceContent = normalized.content.trim();
|
|
189
|
+
if (!sourceContent) return;
|
|
140
190
|
|
|
141
191
|
if (!await fs.pathExists(targetPath)) {
|
|
142
192
|
const normalized = sourceContent.endsWith('\n') ? sourceContent : `${sourceContent}\n`;
|
|
@@ -244,18 +294,8 @@ async function removePlatformFiles(platform, projectRoot, manifest, dryRun) {
|
|
|
244
294
|
}
|
|
245
295
|
}
|
|
246
296
|
|
|
247
|
-
// Project memory file
|
|
248
|
-
|
|
249
|
-
if (!memoryFile) return;
|
|
250
|
-
const memoryPath = path.join(projectRoot, memoryFile);
|
|
251
|
-
if (await fs.pathExists(memoryPath)) {
|
|
252
|
-
if (dryRun) {
|
|
253
|
-
console.log(chalk.gray(` [dry-run] remove ${memoryFile}`));
|
|
254
|
-
} else {
|
|
255
|
-
await fs.remove(memoryPath);
|
|
256
|
-
console.log(chalk.red(` ✗ removed ${memoryFile}`));
|
|
257
|
-
}
|
|
258
|
-
}
|
|
297
|
+
// Project memory artifacts: remove only managed private file/imports, not user-owned main content.
|
|
298
|
+
await removeProjectMemoryArtifacts(platform, projectRoot, dryRun);
|
|
259
299
|
|
|
260
300
|
// Command assets (Claude only)
|
|
261
301
|
if (platform === 'claude') {
|
|
@@ -611,10 +651,8 @@ export async function runConfig(directory, options = {}) {
|
|
|
611
651
|
console.log(chalk.blue('\n Settings & Rules:'));
|
|
612
652
|
await installSettings(p, projectRoot, { pipeline: newConfig.pipeline, rules: newConfig.rules }, false, newConfig.runtime);
|
|
613
653
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
await installProjectMemory(p, projectRoot, false);
|
|
617
|
-
}
|
|
654
|
+
console.log(chalk.blue('\n Project Memory:'));
|
|
655
|
+
await installProjectMemory(p, projectRoot, false);
|
|
618
656
|
|
|
619
657
|
if (newConfig.team) {
|
|
620
658
|
console.log(chalk.blue('\n Team Config:'));
|
|
@@ -648,7 +686,10 @@ export async function runConfig(directory, options = {}) {
|
|
|
648
686
|
|
|
649
687
|
// 5f. Update .gitignore
|
|
650
688
|
console.log(chalk.blue('\n Gitignore:'));
|
|
651
|
-
await installGitignore(projectRoot, {
|
|
689
|
+
await installGitignore(projectRoot, {
|
|
690
|
+
pipeline: newConfig.pipeline,
|
|
691
|
+
privateMemoryFiles: privateProjectMemoryFiles(newPlatforms),
|
|
692
|
+
}, false);
|
|
652
693
|
|
|
653
694
|
// 5g. Runtime-aware git hook and PrizmKit helper scripts
|
|
654
695
|
if (newConfig.runtime !== currentConfig.runtime || runtimeManifestNeedsNormalization || runtimeOptionNeedsNormalization) {
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
* @returns {string}
|
|
10
10
|
*/
|
|
11
11
|
export function generateGitignore(options = {}) {
|
|
12
|
-
|
|
12
|
+
const privateMemoryFiles = Array.isArray(options.privateMemoryFiles)
|
|
13
|
+
? options.privateMemoryFiles.filter(Boolean)
|
|
14
|
+
: [];
|
|
13
15
|
const lines = [
|
|
14
|
-
'# PrizmKit
|
|
16
|
+
'# PrizmKit',
|
|
15
17
|
'.prizmkit/*',
|
|
18
|
+
...privateMemoryFiles,
|
|
16
19
|
];
|
|
17
20
|
|
|
18
|
-
return lines.join('\n');
|
|
21
|
+
return [...new Set(lines)].join('\n');
|
|
19
22
|
}
|
package/src/manifest.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import fs from 'fs-extra';
|
|
11
11
|
import path from 'path';
|
|
12
|
-
import { projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
|
|
12
|
+
import { privateProjectMemoryFile, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
|
|
13
13
|
import { normalizeRuntime } from './runtimes.js';
|
|
14
14
|
|
|
15
15
|
const MANIFEST_FILE = 'manifest.json';
|
|
@@ -100,7 +100,11 @@ export function buildManifest({
|
|
|
100
100
|
pipeline: pipeline ? [...pipeline] : [],
|
|
101
101
|
extras: extras ? [...extras] : [],
|
|
102
102
|
payloadPlatforms: installedPayloadPlatforms,
|
|
103
|
-
|
|
103
|
+
memory: {
|
|
104
|
+
main: [...new Set(installedPayloadPlatforms.map(projectMemoryFile).filter(Boolean))],
|
|
105
|
+
private: [...new Set(installedPayloadPlatforms.map(privateProjectMemoryFile).filter(Boolean))],
|
|
106
|
+
},
|
|
107
|
+
other: [...new Set(installedPayloadPlatforms.map(privateProjectMemoryFile).filter(Boolean))],
|
|
104
108
|
},
|
|
105
109
|
};
|
|
106
110
|
}
|
package/src/platforms.js
CHANGED
|
@@ -62,6 +62,20 @@ export function projectMemoryFile(platform) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
export function privateProjectMemoryFile(platform) {
|
|
66
|
+
const mainFile = projectMemoryFile(platform);
|
|
67
|
+
if (!mainFile) return null;
|
|
68
|
+
return mainFile.replace(/\.md$/i, '.private.md');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function projectMemoryFiles(platform) {
|
|
72
|
+
return [projectMemoryFile(platform), privateProjectMemoryFile(platform)].filter(Boolean);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function privateProjectMemoryFiles(platforms) {
|
|
76
|
+
return [...new Set((platforms || []).map(privateProjectMemoryFile).filter(Boolean))];
|
|
77
|
+
}
|
|
78
|
+
|
|
65
79
|
export function defaultCliForPlatform(platform) {
|
|
66
80
|
if (platform === 'claude') return 'claude';
|
|
67
81
|
if (platform === 'codebuddy') return 'cbc';
|