prizmkit 1.1.184 → 1.1.185

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.1.184",
3
- "bundledAt": "2026-09-18T15:58:59.797Z",
4
- "bundledFrom": "72909d7"
2
+ "frameworkVersion": "1.1.185",
3
+ "bundledAt": "2026-10-13T14:28:39.367Z",
4
+ "bundledFrom": "aab8bf1"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.184",
2
+ "version": "1.1.185",
3
3
  "skills": {
4
4
  "prizmkit": {
5
5
  "description": "Framework introduction and navigation for the formal single-requirement lifecycle, project initialization, Prizm docs, and independent deployment.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.1.184",
3
+ "version": "1.1.185",
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": {
@@ -1,19 +1,50 @@
1
1
  /**
2
- * Generate only explicit private host-memory ignores.
2
+ * Generate install-time gitignore text.
3
3
  *
4
- * `.prizmkit/**` tracking policy is project-controlled: this module never adds
5
- * framework-directory ignore entries. Only install appends private host-memory
6
- * ignores; upgrade and config must not write `.gitignore`.
4
+ * Install appends the exact `.prizmkit/*` line and any explicit private
5
+ * host-memory filenames. Upgrade and config must not write `.gitignore`.
6
+ * Cleanup removes only private host-memory entries.
7
7
  */
8
8
 
9
+ const FRAMEWORK_HEADER = '# PrizmKit';
10
+ const FRAMEWORK_ENTRY = '.prizmkit/*';
11
+ const PRIVATE_MEMORY_HEADER = '# PrizmKit private host memory';
12
+
13
+ /**
14
+ * @param {string[] | undefined} values
15
+ * @returns {string[]}
16
+ */
17
+ function uniqueGitignoreEntries(values) {
18
+ return Array.isArray(values) ? [...new Set(values.filter(Boolean))] : [];
19
+ }
20
+
9
21
  /**
10
22
  * @param {Object} options - { privateMemoryFiles?: string[] }
11
23
  * @returns {string}
12
24
  */
13
25
  export function generateGitignore(options = {}) {
14
- const privateMemoryFiles = Array.isArray(options.privateMemoryFiles)
15
- ? [...new Set(options.privateMemoryFiles.filter(Boolean))]
16
- : [];
17
- if (privateMemoryFiles.length === 0) return '';
18
- return ['# PrizmKit private host memory', ...privateMemoryFiles].join('\n');
26
+ const privateMemoryFiles = uniqueGitignoreEntries(options.privateMemoryFiles);
27
+ const lines = [FRAMEWORK_HEADER, FRAMEWORK_ENTRY];
28
+ if (privateMemoryFiles.length > 0) {
29
+ lines.push(PRIVATE_MEMORY_HEADER, ...privateMemoryFiles);
30
+ }
31
+ return lines.join('\n');
32
+ }
33
+
34
+ /**
35
+ * Sections appended independently so an existing private-memory header
36
+ * is not treated as the framework header.
37
+ *
38
+ * @param {Object} options - { privateMemoryFiles?: string[] }
39
+ * @returns {{ header: string, entries: string[] }[]}
40
+ */
41
+ export function gitignoreSections(options = {}) {
42
+ const privateMemoryFiles = uniqueGitignoreEntries(options.privateMemoryFiles);
43
+ const sections = [
44
+ { header: FRAMEWORK_HEADER, entries: [FRAMEWORK_ENTRY] },
45
+ ];
46
+ if (privateMemoryFiles.length > 0) {
47
+ sections.push({ header: PRIVATE_MEMORY_HEADER, entries: privateMemoryFiles });
48
+ }
49
+ return sections;
19
50
  }
package/src/scaffold.js CHANGED
@@ -4,7 +4,8 @@
4
4
  * 全部使用 Copy 模式(不使用 symlink),项目完全独立于框架仓库。
5
5
  * 通过 adapters 转换 core/ 资源为平台特定格式。
6
6
  * 不安装框架开发文件(docs、tests、scripts 等)。
7
- * 仅按显式平台需要合并私有记忆文件 ignore;`.prizmkit/**` Git 策略由项目控制。
7
+ * 安装时追加精确的 `.prizmkit/*` 行和所选平台的私有记忆文件 ignore。
8
+ * upgrade 与 config 不写 `.gitignore`。
8
9
  */
9
10
 
10
11
  import chalk from 'chalk';
@@ -24,7 +25,7 @@ import {
24
25
  loadRulesMetadata,
25
26
  getSkillCandidatePaths,
26
27
  } from './metadata.js';
27
- import { generateGitignore } from './gitignore-template.js';
28
+ import { generateGitignore, gitignoreSections } from './gitignore-template.js';
28
29
  import { buildManifest, readManifestForLifecycle, writeManifest } from './manifest.js';
29
30
  import { canonicalizePlatformSelection, defaultCliForPlatform, expandPlatforms, isKnownPlatform, nativeSkillRoot, payloadSkillRoots, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms, unknownPlatformMessage } from './platforms.js';
30
31
  import { normalizeRuntime, runtimeLabel } from './runtimes.js';
@@ -1374,46 +1375,42 @@ export async function installPipeline(projectRoot, dryRun, options = {}) {
1374
1375
  */
1375
1376
  export async function installGitignore(projectRoot, options = {}, dryRun) {
1376
1377
  const targetPath = path.join(projectRoot, '.gitignore');
1377
- const templateContent = generateGitignore({
1378
- pipeline: options.pipeline,
1379
- privateMemoryFiles: options.privateMemoryFiles || [],
1380
- });
1378
+ const sectionOptions = { privateMemoryFiles: options.privateMemoryFiles || [] };
1379
+ const templateContent = generateGitignore(sectionOptions);
1380
+ const sections = gitignoreSections(sectionOptions);
1381
1381
  const existed = await fs.pathExists(targetPath);
1382
1382
 
1383
1383
  if (dryRun) {
1384
- if (!templateContent) {
1385
- if (!existed) console.log(chalk.gray(' [dry-run] .gitignore (no managed private-memory entries)'));
1386
- return;
1387
- }
1388
- console.log(chalk.gray(' [dry-run] .gitignore (private host memory only)'));
1384
+ console.log(chalk.gray(' [dry-run] .gitignore (.prizmkit/* and private host memory)'));
1389
1385
  return;
1390
1386
  }
1391
1387
 
1392
- if (!templateContent) {
1393
- if (!existed) console.log(chalk.gray(' • .gitignore (no managed private-memory entries)'));
1388
+ if (!existed) {
1389
+ await fs.writeFile(targetPath, `${templateContent}\n`);
1390
+ console.log(chalk.green(' ✓ .gitignore'));
1394
1391
  return;
1395
1392
  }
1396
1393
 
1397
- if (existed) {
1398
- const current = await fs.readFile(targetPath, 'utf-8');
1399
- const existingLines = new Set(current.split('\n').map(l => l.trim()));
1400
- const templateLines = templateContent.split('\n').map(l => l.trim()).filter(Boolean);
1401
- const missing = templateLines.filter(line => !existingLines.has(line) && !line.startsWith('#'));
1394
+ const current = await fs.readFile(targetPath, 'utf-8');
1395
+ const existingLines = new Set(current.split('\n').map(line => line.trim()));
1396
+ const chunks = [];
1397
+ let missingCount = 0;
1398
+ for (const section of sections) {
1399
+ const missing = section.entries.filter(line => !existingLines.has(line));
1400
+ if (missing.length === 0) continue;
1401
+ missingCount += missing.length;
1402
+ const header = existingLines.has(section.header) ? '' : `${section.header}\n`;
1403
+ chunks.push(header + missing.join('\n'));
1404
+ }
1402
1405
 
1403
- if (missing.length > 0) {
1404
- const separator = current.endsWith('\n') ? '' : '\n';
1405
- const managedHeader = '# PrizmKit private host memory';
1406
- const header = existingLines.has(managedHeader) ? '' : `${managedHeader}\n`;
1407
- await fs.appendFile(targetPath, separator + '\n' + header + missing.join('\n') + '\n');
1408
- console.log(chalk.green(` ✓ .gitignore (added ${missing.length} entries)`));
1409
- } else {
1410
- console.log(chalk.green(' ✓ .gitignore (up-to-date)'));
1411
- }
1406
+ if (missingCount === 0) {
1407
+ console.log(chalk.green(' ✓ .gitignore (up-to-date)'));
1412
1408
  return;
1413
1409
  }
1414
1410
 
1415
- await fs.writeFile(targetPath, `${templateContent}\n`);
1416
- console.log(chalk.green(' ✓ .gitignore'));
1411
+ const separator = current.endsWith('\n') ? '' : '\n';
1412
+ await fs.appendFile(targetPath, `${separator}\n${chunks.join('\n')}\n`);
1413
+ console.log(chalk.green(` ✓ .gitignore (added ${missingCount} entries)`));
1417
1414
  }
1418
1415
 
1419
1416
  // ============================================================