prizmkit 1.1.182 → 1.1.184
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 +2 -2
- package/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +30 -15
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +62 -2
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +27 -0
- package/bundled/dev-pipeline/tests/test_unified_cli.py +48 -0
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/feature-planner/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
- package/package.json +1 -1
- package/src/config.js +12 -22
- package/src/gitignore-template.js +2 -27
- package/src/index.js +3 -32
- package/src/platforms.js +62 -16
- package/src/prompts.js +46 -44
- package/src/scaffold.js +19 -27
- package/src/upgrade.js +10 -16
package/bin/create-prizmkit.js
CHANGED
|
@@ -31,7 +31,7 @@ program
|
|
|
31
31
|
program
|
|
32
32
|
.command('install [directory]')
|
|
33
33
|
.description('Install PrizmKit into a project directory')
|
|
34
|
-
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, or all')
|
|
34
|
+
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, comma-separated list, or all')
|
|
35
35
|
.option('--runtime <runtime>', 'Runtime assets: python or auto; unix/windows are accepted as legacy aliases for python')
|
|
36
36
|
.option('--skills <suite>', 'Skill suite: core, minimal, or recommended:<type> (frontend/backend/fullstack/library)', 'core')
|
|
37
37
|
.option('--pipeline', 'Install dev-pipeline (default: true)')
|
|
@@ -90,7 +90,7 @@ program
|
|
|
90
90
|
program
|
|
91
91
|
.command('config [directory]')
|
|
92
92
|
.description('Reconfigure existing PrizmKit installation (change platform, skills, rules, options)')
|
|
93
|
-
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, or all')
|
|
93
|
+
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, comma-separated list, or all')
|
|
94
94
|
.option('--runtime <runtime>', 'Runtime assets: python or auto; unix/windows are accepted as legacy aliases for python')
|
|
95
95
|
.option('--skills <suite>', 'Skill suite: core, minimal, or recommended:<type>')
|
|
96
96
|
.option('--rules <preset>', 'Rules preset: recommended, minimal, or none')
|
package/bundled/VERSION.json
CHANGED
|
@@ -13,6 +13,7 @@ from pathlib import Path
|
|
|
13
13
|
|
|
14
14
|
from .launch_profiles import HeadlessLaunchProfile
|
|
15
15
|
from .paths import RuntimePaths
|
|
16
|
+
from .platform_detection import PlatformSelectionError, parse_platform_selection
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
@dataclass(frozen=True)
|
|
@@ -168,21 +169,23 @@ def _normalize_platform(platform: str | None) -> str:
|
|
|
168
169
|
|
|
169
170
|
def _cli_names_for_platform(platform: str | None) -> tuple[str, ...]:
|
|
170
171
|
normalized = _normalize_platform(platform)
|
|
171
|
-
if normalized
|
|
172
|
-
return (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
172
|
+
if not normalized:
|
|
173
|
+
return ()
|
|
174
|
+
try:
|
|
175
|
+
hosts = parse_platform_selection(normalized)
|
|
176
|
+
except PlatformSelectionError:
|
|
177
|
+
return ()
|
|
178
|
+
cli_by_host = {
|
|
179
|
+
"codex": ("codex",),
|
|
180
|
+
"claude": ("claude",),
|
|
181
|
+
"codebuddy": ("cbc",),
|
|
182
|
+
"pi": ("pi",),
|
|
183
|
+
"cursor": ("agent",),
|
|
184
|
+
}
|
|
185
|
+
names: list[str] = []
|
|
186
|
+
for host in hosts:
|
|
187
|
+
names.extend(cli_by_host[host])
|
|
188
|
+
return tuple(names)
|
|
186
189
|
|
|
187
190
|
|
|
188
191
|
def _known_platform_from_cli(cli_command: str | None) -> str | None:
|
|
@@ -400,6 +403,18 @@ def _resolve_ai_client(paths: RuntimePaths, env: Mapping[str, str]) -> AIClientR
|
|
|
400
403
|
(manifest_platform, "prizmkit-manifest:platform", "Installed PrizmKit platform"),
|
|
401
404
|
(config_platform, "prizmkit-config:platform", "Configured PrizmKit platform"),
|
|
402
405
|
):
|
|
406
|
+
if not platform:
|
|
407
|
+
continue
|
|
408
|
+
try:
|
|
409
|
+
parse_platform_selection(platform)
|
|
410
|
+
except PlatformSelectionError as exc:
|
|
411
|
+
return AIClientResolution(
|
|
412
|
+
command=None,
|
|
413
|
+
platform=None,
|
|
414
|
+
source=f"unresolved:{source}",
|
|
415
|
+
precedence=AI_CLIENT_PRECEDENCE,
|
|
416
|
+
notes=(str(exc),),
|
|
417
|
+
)
|
|
403
418
|
resolved = _cli_for_platform(platform, env)
|
|
404
419
|
if resolved:
|
|
405
420
|
return AIClientResolution(
|
|
@@ -4,11 +4,23 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
import os
|
|
7
|
+
import shutil
|
|
7
8
|
from collections.abc import Mapping
|
|
8
9
|
from dataclasses import dataclass
|
|
9
10
|
from pathlib import Path
|
|
10
11
|
|
|
11
12
|
SUPPORTED_PLATFORMS = ("claude", "codex", "codebuddy", "pi", "cursor")
|
|
13
|
+
PLATFORM_IDS = ("codebuddy", "claude", "codex", "pi", "cursor")
|
|
14
|
+
PLATFORM_INPUT_HELP = (
|
|
15
|
+
"codebuddy, claude, codex, pi, cursor, a comma-separated list of those, or all"
|
|
16
|
+
)
|
|
17
|
+
_CLI_BY_PLATFORM = {
|
|
18
|
+
"codebuddy": "cbc",
|
|
19
|
+
"claude": "claude",
|
|
20
|
+
"codex": "codex",
|
|
21
|
+
"pi": "pi",
|
|
22
|
+
"cursor": "agent",
|
|
23
|
+
}
|
|
12
24
|
|
|
13
25
|
|
|
14
26
|
@dataclass(frozen=True)
|
|
@@ -117,6 +129,48 @@ def platform_from_command(command: object) -> str:
|
|
|
117
129
|
return ""
|
|
118
130
|
|
|
119
131
|
|
|
132
|
+
class PlatformSelectionError(ValueError):
|
|
133
|
+
"""Raised when a stored or supplied platform field cannot be parsed."""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def unknown_platform_message(platform: object) -> str:
|
|
137
|
+
return f'Unknown platform "{platform}". Expected {PLATFORM_INPUT_HELP}.'
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def parse_platform_selection(platform: object) -> tuple[str, ...]:
|
|
141
|
+
"""Parse a single host, comma-separated subset, or standalone all."""
|
|
142
|
+
if not isinstance(platform, str):
|
|
143
|
+
raise PlatformSelectionError(unknown_platform_message(platform))
|
|
144
|
+
trimmed = platform.strip()
|
|
145
|
+
if not trimmed:
|
|
146
|
+
raise PlatformSelectionError(unknown_platform_message(platform))
|
|
147
|
+
tokens = [part.strip() for part in trimmed.split(",")]
|
|
148
|
+
if any(not token for token in tokens):
|
|
149
|
+
raise PlatformSelectionError(unknown_platform_message(platform))
|
|
150
|
+
if "all" in tokens:
|
|
151
|
+
if len(tokens) != 1:
|
|
152
|
+
raise PlatformSelectionError(unknown_platform_message(platform))
|
|
153
|
+
return PLATFORM_IDS
|
|
154
|
+
if "both" in tokens or any(token not in PLATFORM_IDS for token in tokens):
|
|
155
|
+
raise PlatformSelectionError(unknown_platform_message(platform))
|
|
156
|
+
present = set(tokens)
|
|
157
|
+
return tuple(pid for pid in PLATFORM_IDS if pid in present)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def prompt_host_from_platform_field(value: object, env: Mapping[str, str] | None = None) -> str:
|
|
161
|
+
"""Return one concrete prompt host from a legal platform field, or "" if absent."""
|
|
162
|
+
if not isinstance(value, str) or not value.strip():
|
|
163
|
+
return ""
|
|
164
|
+
hosts = parse_platform_selection(value)
|
|
165
|
+
if len(hosts) == 1:
|
|
166
|
+
return hosts[0]
|
|
167
|
+
which_path = None if env is None else env.get("PATH")
|
|
168
|
+
for host in hosts:
|
|
169
|
+
if shutil.which(_CLI_BY_PLATFORM[host], path=which_path):
|
|
170
|
+
return host
|
|
171
|
+
return hosts[0]
|
|
172
|
+
|
|
173
|
+
|
|
120
174
|
def valid_prompt_platform(value: object) -> str:
|
|
121
175
|
"""Normalize a platform value for prompt path rendering."""
|
|
122
176
|
platform = str(value or "").strip().lower()
|
|
@@ -146,7 +200,10 @@ def resolve_platform(project_root: str | Path, env: Mapping[str, str] | None = N
|
|
|
146
200
|
detected = platform_from_command(config.get(key, ""))
|
|
147
201
|
if detected:
|
|
148
202
|
return PlatformResolution(detected, f"config:{key}")
|
|
149
|
-
|
|
203
|
+
try:
|
|
204
|
+
detected = prompt_host_from_platform_field(config.get("platform", ""), environment)
|
|
205
|
+
except PlatformSelectionError as exc:
|
|
206
|
+
return PlatformResolution("", "unresolved:config:platform", (str(exc),))
|
|
150
207
|
if detected:
|
|
151
208
|
return PlatformResolution(detected, "config:platform")
|
|
152
209
|
|
|
@@ -156,7 +213,10 @@ def resolve_platform(project_root: str | Path, env: Mapping[str, str] | None = N
|
|
|
156
213
|
detected = platform_from_command(value)
|
|
157
214
|
if detected:
|
|
158
215
|
return PlatformResolution(detected, f"manifest:{key}")
|
|
159
|
-
|
|
216
|
+
try:
|
|
217
|
+
detected = prompt_host_from_platform_field(manifest.get("platform", ""), environment)
|
|
218
|
+
except PlatformSelectionError as exc:
|
|
219
|
+
return PlatformResolution("", "unresolved:manifest:platform", (str(exc),))
|
|
160
220
|
if detected:
|
|
161
221
|
return PlatformResolution(detected, "manifest:platform")
|
|
162
222
|
|
|
@@ -175,6 +175,33 @@ class TestPlatformExecutableAndPortHelpers:
|
|
|
175
175
|
assert resolution.platform == "codebuddy"
|
|
176
176
|
assert resolution.source == "environment:CODEBUDDY_CLI"
|
|
177
177
|
|
|
178
|
+
def test_manifest_platform_list_selects_a_concrete_prompt_host(self, tmp_path, monkeypatch):
|
|
179
|
+
from prizmkit_runtime.platform_detection import resolve_platform
|
|
180
|
+
|
|
181
|
+
project = tmp_path / "project"
|
|
182
|
+
(project / ".prizmkit").mkdir(parents=True)
|
|
183
|
+
(project / ".prizmkit" / "manifest.json").write_text(
|
|
184
|
+
json.dumps({"platform": "claude,cursor"}), encoding="utf-8"
|
|
185
|
+
)
|
|
186
|
+
monkeypatch.delenv("PRIZMKIT_PLATFORM", raising=False)
|
|
187
|
+
resolution = resolve_platform(project, env={"PATH": ""})
|
|
188
|
+
assert resolution.platform == "claude"
|
|
189
|
+
assert resolution.source == "manifest:platform"
|
|
190
|
+
|
|
191
|
+
def test_manifest_both_platform_does_not_fall_through_to_filesystem(self, tmp_path, monkeypatch):
|
|
192
|
+
from prizmkit_runtime.platform_detection import resolve_platform
|
|
193
|
+
|
|
194
|
+
project = tmp_path / "project"
|
|
195
|
+
(project / ".prizmkit").mkdir(parents=True)
|
|
196
|
+
(project / ".prizmkit" / "manifest.json").write_text(
|
|
197
|
+
json.dumps({"platform": "both"}), encoding="utf-8"
|
|
198
|
+
)
|
|
199
|
+
(project / ".claude" / "commands").mkdir(parents=True)
|
|
200
|
+
monkeypatch.delenv("PRIZMKIT_PLATFORM", raising=False)
|
|
201
|
+
resolution = resolve_platform(project, env={"PATH": ""})
|
|
202
|
+
assert resolution.platform == ""
|
|
203
|
+
assert resolution.source == "unresolved:manifest:platform"
|
|
204
|
+
|
|
178
205
|
def test_executable_check_and_version_use_shutil_and_direct_subprocess(self, tmp_path):
|
|
179
206
|
executable = tmp_path / "tool.py"
|
|
180
207
|
executable.write_text("#!/usr/bin/env python3\nprint('tool 1.2.3')\n", encoding="utf-8")
|
|
@@ -339,6 +339,54 @@ def test_runtime_config_matches_canonical_ai_cli_precedence(tmp_path):
|
|
|
339
339
|
assert legacy_alias.source == "environment:CODEBUDDY_CLI"
|
|
340
340
|
|
|
341
341
|
|
|
342
|
+
def test_runtime_config_resolves_comma_separated_manifest_platform(tmp_path, monkeypatch):
|
|
343
|
+
import prizmkit_runtime.config as runtime_config
|
|
344
|
+
from prizmkit_runtime.config import resolve_ai_client
|
|
345
|
+
from prizmkit_runtime.paths import resolve_runtime_paths
|
|
346
|
+
|
|
347
|
+
project = tmp_path / "project"
|
|
348
|
+
pipeline = project / ".prizmkit" / "dev-pipeline"
|
|
349
|
+
pipeline.mkdir(parents=True)
|
|
350
|
+
(project / ".prizmkit" / "manifest.json").write_text(
|
|
351
|
+
json.dumps({"platform": "claude,cursor"}), encoding="utf-8"
|
|
352
|
+
)
|
|
353
|
+
paths = resolve_runtime_paths(pipeline_root=pipeline)
|
|
354
|
+
monkeypatch.setattr(
|
|
355
|
+
runtime_config.shutil,
|
|
356
|
+
"which",
|
|
357
|
+
lambda name, path=None: "/tools/claude" if name == "claude" else None,
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
resolved = resolve_ai_client(paths, env={"PATH": "/tools"})
|
|
361
|
+
assert resolved.command == "claude"
|
|
362
|
+
assert resolved.platform == "claude"
|
|
363
|
+
assert resolved.source == "prizmkit-manifest:platform"
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def test_runtime_config_rejects_legacy_both_manifest_without_path_fallback(tmp_path, monkeypatch):
|
|
367
|
+
import prizmkit_runtime.config as runtime_config
|
|
368
|
+
from prizmkit_runtime.config import resolve_ai_client
|
|
369
|
+
from prizmkit_runtime.paths import resolve_runtime_paths
|
|
370
|
+
|
|
371
|
+
project = tmp_path / "project"
|
|
372
|
+
pipeline = project / ".prizmkit" / "dev-pipeline"
|
|
373
|
+
pipeline.mkdir(parents=True)
|
|
374
|
+
(project / ".prizmkit" / "manifest.json").write_text(
|
|
375
|
+
json.dumps({"platform": "both"}), encoding="utf-8"
|
|
376
|
+
)
|
|
377
|
+
paths = resolve_runtime_paths(pipeline_root=pipeline)
|
|
378
|
+
monkeypatch.setattr(
|
|
379
|
+
runtime_config.shutil,
|
|
380
|
+
"which",
|
|
381
|
+
lambda name, path=None: "/tools/claude" if name == "claude" else None,
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
rejected = resolve_ai_client(paths, env={"PATH": "/tools"})
|
|
385
|
+
assert rejected.command is None
|
|
386
|
+
assert rejected.source == "unresolved:prizmkit-manifest:platform"
|
|
387
|
+
assert "both" in rejected.notes[0]
|
|
388
|
+
|
|
389
|
+
|
|
342
390
|
def test_runtime_config_resolves_custom_ai_cli_launch_profile(tmp_path):
|
|
343
391
|
from prizmkit_runtime.config import RuntimeConfigError, load_runtime_config
|
|
344
392
|
from prizmkit_runtime.paths import resolve_runtime_paths
|
|
@@ -154,7 +154,7 @@ Before questions, check optional context files (never block if absent):
|
|
|
154
154
|
- `.prizmkit/config.json` (existing stack preferences and detected tech stack)
|
|
155
155
|
- `.prizmkit/plans/project-brief.md` (project context from app-planner, if available)
|
|
156
156
|
- existing `.prizmkit/plans/feature-list.json` (required for incremental mode; inspect it only through the bounded commands below)
|
|
157
|
-
- 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
|
|
157
|
+
- 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`). A comma-separated list selects those hosts; the five-name form or an older stored `all` means read every matching file. `both` is not a supported alias.
|
|
158
158
|
- If `.prizmkit/prizm-docs/root.prizm` is absent and the project has existing source code, scan the directory structure to understand the codebase layout:
|
|
159
159
|
```bash
|
|
160
160
|
find . -maxdepth 2 -type d \
|
|
@@ -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
|
|
23
|
+
| `platform` | string | Installed host metadata: a single id (`codebuddy`, `claude`, `codex`, `pi`, `cursor`), a canonical comma-separated subset such as `claude,cursor`, or the five-name form `codebuddy,claude,codex,pi,cursor`. It records installation, not a canonical behavior allowlist. Input alias `all` expands to the five names on write. |
|
|
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
|
-
|
|
29
|
+
New writes must use a single host id, a canonical comma-separated subset, or the five concrete names. `all` is an installer input alias only. `both` is not a supported value.
|
|
30
30
|
|
|
31
31
|
## Examples
|
|
32
32
|
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
installSettings,
|
|
29
29
|
installProjectMemory,
|
|
30
30
|
installPipeline,
|
|
31
|
-
installGitignore,
|
|
32
31
|
installGitHook,
|
|
33
32
|
installPrizmkitScripts,
|
|
34
33
|
resolveSkillList,
|
|
@@ -53,7 +52,7 @@ import {
|
|
|
53
52
|
selectRulesPreset,
|
|
54
53
|
confirmPipeline,
|
|
55
54
|
} from './prompts.js';
|
|
56
|
-
import { isKnownPlatform, platformLabel, privateProjectMemoryFile,
|
|
55
|
+
import { canonicalizePlatformSelection, isKnownPlatform, platformLabel, privateProjectMemoryFile, projectMemoryFile, resolvePayloadPlatforms, uniquePlatforms, unknownPlatformMessage } from './platforms.js';
|
|
57
56
|
import { normalizeRuntime, runtimeLabel } from './runtimes.js';
|
|
58
57
|
import { applyAiCliLaunchToConfig, resolveAiCliLaunchSelection, storedAiCliLaunch } from './ai-cli-launch.js';
|
|
59
58
|
|
|
@@ -131,15 +130,9 @@ async function detectInstalledPlatforms(projectRoot) {
|
|
|
131
130
|
const hasCodex = await hasPlatformFiles(path.join(projectRoot, '.agents', 'skills'));
|
|
132
131
|
const hasPi = await hasPlatformFiles(path.join(projectRoot, '.pi', 'skills'));
|
|
133
132
|
const hasCursor = await hasPlatformFiles(path.join(projectRoot, '.cursor', 'skills'));
|
|
134
|
-
const detected = [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (hasCursor) return 'cursor';
|
|
138
|
-
if (hasPi) return 'pi';
|
|
139
|
-
if (hasCodex) return 'codex';
|
|
140
|
-
if (hasCodeBuddy) return 'codebuddy';
|
|
141
|
-
if (hasClaude) return 'claude';
|
|
142
|
-
return null;
|
|
133
|
+
const detected = [hasCodeBuddy && 'codebuddy', hasClaude && 'claude', hasCodex && 'codex', hasPi && 'pi', hasCursor && 'cursor'].filter(Boolean);
|
|
134
|
+
if (detected.length === 0) return null;
|
|
135
|
+
return uniquePlatforms(detected).join(',');
|
|
143
136
|
}
|
|
144
137
|
|
|
145
138
|
function getProjectMemoryFile(platform) {
|
|
@@ -464,7 +457,10 @@ export async function runConfig(directory, options = {}) {
|
|
|
464
457
|
// Existing manifests are the source of truth. Filesystem detection is only a
|
|
465
458
|
// legacy fallback for manifests created before platform was recorded.
|
|
466
459
|
const detectedPlatformRaw = oldManifest.platform || await detectInstalledPlatforms(projectRoot) || 'claude';
|
|
467
|
-
|
|
460
|
+
if (!isKnownPlatform(detectedPlatformRaw)) {
|
|
461
|
+
throw new Error(unknownPlatformMessage(detectedPlatformRaw));
|
|
462
|
+
}
|
|
463
|
+
const detectedPlatform = canonicalizePlatformSelection(detectedPlatformRaw);
|
|
468
464
|
|
|
469
465
|
const rawManifestRuntime = oldManifest.runtime;
|
|
470
466
|
const normalizedManifestRuntime = normalizeRuntime(rawManifestRuntime);
|
|
@@ -482,7 +478,7 @@ export async function runConfig(directory, options = {}) {
|
|
|
482
478
|
};
|
|
483
479
|
|
|
484
480
|
if (options.platform !== undefined && !isKnownPlatform(options.platform)) {
|
|
485
|
-
throw new Error(
|
|
481
|
+
throw new Error(unknownPlatformMessage(options.platform));
|
|
486
482
|
}
|
|
487
483
|
|
|
488
484
|
// Display current config
|
|
@@ -560,8 +556,9 @@ export async function runConfig(directory, options = {}) {
|
|
|
560
556
|
}
|
|
561
557
|
|
|
562
558
|
if (!isKnownPlatform(newConfig.platform)) {
|
|
563
|
-
throw new Error(
|
|
559
|
+
throw new Error(unknownPlatformMessage(newConfig.platform));
|
|
564
560
|
}
|
|
561
|
+
newConfig.platform = canonicalizePlatformSelection(newConfig.platform);
|
|
565
562
|
|
|
566
563
|
// ── Phase 3: COMPUTE DIFF ────────────────────────────────────────────────
|
|
567
564
|
|
|
@@ -737,14 +734,7 @@ export async function runConfig(directory, options = {}) {
|
|
|
737
734
|
}
|
|
738
735
|
}
|
|
739
736
|
|
|
740
|
-
// 5f.
|
|
741
|
-
console.log(chalk.blue('\n Gitignore:'));
|
|
742
|
-
await installGitignore(projectRoot, {
|
|
743
|
-
pipeline: newConfig.pipeline,
|
|
744
|
-
privateMemoryFiles: privateProjectMemoryFiles(newPlatforms),
|
|
745
|
-
}, false);
|
|
746
|
-
|
|
747
|
-
// 5g. Runtime-aware git hook and PrizmKit helper scripts
|
|
737
|
+
// 5f. Runtime-aware git hook and PrizmKit helper scripts
|
|
748
738
|
if (newConfig.runtime !== currentConfig.runtime || runtimeManifestNeedsNormalization || runtimeOptionNeedsNormalization) {
|
|
749
739
|
console.log(chalk.blue('\n Git Hook:'));
|
|
750
740
|
await installGitHook(projectRoot, false, newConfig.runtime);
|
|
@@ -2,35 +2,10 @@
|
|
|
2
2
|
* Generate only explicit private host-memory ignores.
|
|
3
3
|
*
|
|
4
4
|
* `.prizmkit/**` tracking policy is project-controlled: this module never adds
|
|
5
|
-
* framework-directory ignore entries.
|
|
6
|
-
*
|
|
7
|
-
* old `# PrizmKit` header; they do not interpret other `.prizmkit/` ignores.
|
|
5
|
+
* framework-directory ignore entries. Only install appends private host-memory
|
|
6
|
+
* ignores; upgrade and config must not write `.gitignore`.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
export const RETIRED_FRAMEWORK_GITIGNORE_LINES = new Set([
|
|
11
|
-
'.prizmkit/*',
|
|
12
|
-
'.prizmkit/**',
|
|
13
|
-
'# PrizmKit',
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Remove exact retired installer-written framework-directory ignore lines.
|
|
18
|
-
* @param {string} content
|
|
19
|
-
* @returns {string}
|
|
20
|
-
*/
|
|
21
|
-
export function stripRetiredFrameworkGitignore(content) {
|
|
22
|
-
const next = String(content).split(/\r?\n/).filter(line => (
|
|
23
|
-
!RETIRED_FRAMEWORK_GITIGNORE_LINES.has(line.trim())
|
|
24
|
-
));
|
|
25
|
-
return next.join('\n').replace(/\n{3,}/g, '\n\n').replace(/^\n+/, '');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function hasRetiredFrameworkGitignore(content) {
|
|
29
|
-
return String(content).split(/\r?\n/).some(line => (
|
|
30
|
-
RETIRED_FRAMEWORK_GITIGNORE_LINES.has(line.trim())
|
|
31
|
-
));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
9
|
/**
|
|
35
10
|
* @param {Object} options - { privateMemoryFiles?: string[] }
|
|
36
11
|
* @returns {string}
|
package/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { loadMetadata } from './metadata.js';
|
|
|
17
17
|
import { platformLabel } from './platforms.js';
|
|
18
18
|
import { normalizeRuntime, runtimeLabel } from './runtimes.js';
|
|
19
19
|
import { resolveAiCliLaunchSelection } from './ai-cli-launch.js';
|
|
20
|
-
import { selectAiCliLaunch } from './prompts.js';
|
|
20
|
+
import { selectAiCliLaunch, selectPlatform } from './prompts.js';
|
|
21
21
|
|
|
22
22
|
export { runUpgrade } from './upgrade.js';
|
|
23
23
|
|
|
@@ -94,37 +94,8 @@ export async function runScaffold(directory, options) {
|
|
|
94
94
|
// 1. 统一 Python runtime(旧 runtime 参数仅作为兼容别名归一)
|
|
95
95
|
const runtime = normalizeRuntime(options.runtime);
|
|
96
96
|
|
|
97
|
-
// 2.
|
|
98
|
-
const platform = await
|
|
99
|
-
message: '选择目标平台 (决定安装的目录结构):',
|
|
100
|
-
choices: [
|
|
101
|
-
{
|
|
102
|
-
name: `CodeBuddy (.codebuddy/)${detected.cbc ? chalk.green(' ← 已检测到 cbc') : ''}`,
|
|
103
|
-
value: 'codebuddy',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: `Claude Code (.claude/)${(detected.claude || detected.claudeInternal) ? chalk.green(' ← 已检测到') : ''}`,
|
|
107
|
-
value: 'claude',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: `Codex (AGENTS.md + .agents/skills + .codex/)${detected.codex ? chalk.green(' ← 已检测到 codex') : ''}`,
|
|
111
|
-
value: 'codex',
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: `Pi (.pi/skills + .pi/APPEND_SYSTEM.md)${detected.pi ? chalk.green(' ← 已检测到 pi') : ''}`,
|
|
115
|
-
value: 'pi',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: `Cursor (.cursor/skills + .cursor/rules + .cursor/hooks.json)${detected.cursor ? chalk.green(' ← 已验证 agent') : ''}`,
|
|
119
|
-
value: 'cursor',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: '同时安装全部平台',
|
|
123
|
-
value: 'all',
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
default: detected.suggested,
|
|
127
|
-
});
|
|
97
|
+
// 2. 选择平台(控制安装的目录结构,可多选)
|
|
98
|
+
const platform = await selectPlatform('', detected);
|
|
128
99
|
|
|
129
100
|
// 2.5. AI CLI 命令配置(独立于平台,决定实际运行的可执行命令)
|
|
130
101
|
const aiCliSelection = await selectAiCliLaunch('', detected);
|
package/src/platforms.js
CHANGED
|
@@ -2,15 +2,55 @@ import path from 'path';
|
|
|
2
2
|
import { isBuiltInAiCli } from './ai-cli-launch.js';
|
|
3
3
|
|
|
4
4
|
export const PLATFORM_IDS = ['codebuddy', 'claude', 'codex', 'pi', 'cursor'];
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
5
|
+
export const PLATFORM_INPUT_HELP = 'codebuddy, claude, codex, pi, cursor, a comma-separated list of those, or all';
|
|
6
|
+
export const CANONICAL_ALL_PLATFORMS = PLATFORM_IDS.join(',');
|
|
7
|
+
|
|
8
|
+
const HOST_LABELS = {
|
|
9
|
+
codebuddy: 'CodeBuddy',
|
|
10
|
+
claude: 'Claude Code',
|
|
11
|
+
codex: 'Codex',
|
|
12
|
+
pi: 'Pi',
|
|
13
|
+
cursor: 'Cursor',
|
|
10
14
|
};
|
|
11
15
|
|
|
16
|
+
export function unknownPlatformMessage(platform) {
|
|
17
|
+
return `Unknown platform "${platform}". Expected ${PLATFORM_INPUT_HELP}.`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function parsePlatformSelection(platform) {
|
|
21
|
+
if (typeof platform !== 'string') {
|
|
22
|
+
throw new Error(unknownPlatformMessage(platform));
|
|
23
|
+
}
|
|
24
|
+
const trimmed = platform.trim();
|
|
25
|
+
if (!trimmed) {
|
|
26
|
+
throw new Error(unknownPlatformMessage(platform));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const tokens = trimmed.split(',').map(part => part.trim());
|
|
30
|
+
if (tokens.some(token => !token)) {
|
|
31
|
+
throw new Error(unknownPlatformMessage(platform));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (tokens.includes('all')) {
|
|
35
|
+
if (tokens.length !== 1) {
|
|
36
|
+
throw new Error(unknownPlatformMessage(platform));
|
|
37
|
+
}
|
|
38
|
+
return [...PLATFORM_IDS];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (tokens.includes('both') || tokens.some(token => !PLATFORM_IDS.includes(token))) {
|
|
42
|
+
throw new Error(unknownPlatformMessage(platform));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return PLATFORM_IDS.filter(id => tokens.includes(id));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function canonicalizePlatformSelection(platform) {
|
|
49
|
+
return parsePlatformSelection(platform).join(',');
|
|
50
|
+
}
|
|
51
|
+
|
|
12
52
|
export function expandPlatforms(platform) {
|
|
13
|
-
return
|
|
53
|
+
return parsePlatformSelection(platform);
|
|
14
54
|
}
|
|
15
55
|
|
|
16
56
|
export function platformFromAiCli(aiCli) {
|
|
@@ -35,7 +75,8 @@ export function platformFromAiCli(aiCli) {
|
|
|
35
75
|
}
|
|
36
76
|
|
|
37
77
|
export function uniquePlatforms(platforms) {
|
|
38
|
-
|
|
78
|
+
const present = new Set((platforms || []).filter(p => PLATFORM_IDS.includes(p)));
|
|
79
|
+
return PLATFORM_IDS.filter(id => present.has(id));
|
|
39
80
|
}
|
|
40
81
|
|
|
41
82
|
export function resolvePayloadPlatforms(platform, aiCli = '') {
|
|
@@ -50,18 +91,23 @@ export function payloadPlatformLabel(platform, aiCli = '') {
|
|
|
50
91
|
}
|
|
51
92
|
|
|
52
93
|
export function isKnownPlatform(platform) {
|
|
53
|
-
|
|
94
|
+
try {
|
|
95
|
+
parsePlatformSelection(platform);
|
|
96
|
+
return true;
|
|
97
|
+
} catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
54
100
|
}
|
|
55
101
|
|
|
56
102
|
export function platformLabel(platform) {
|
|
57
|
-
if (platform === '
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
103
|
+
if (typeof platform === 'string' && HOST_LABELS[platform]) {
|
|
104
|
+
return HOST_LABELS[platform];
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return parsePlatformSelection(platform).map(id => HOST_LABELS[id]).join(' + ');
|
|
108
|
+
} catch {
|
|
109
|
+
return platform;
|
|
110
|
+
}
|
|
65
111
|
}
|
|
66
112
|
|
|
67
113
|
export function projectMemoryFile(platform) {
|
package/src/prompts.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { select, confirm, checkbox, input } from '@inquirer/prompts';
|
|
7
7
|
import chalk from 'chalk';
|
|
8
|
-
import {
|
|
8
|
+
import { canonicalizePlatformSelection, parsePlatformSelection, PLATFORM_IDS } from './platforms.js';
|
|
9
9
|
import {
|
|
10
10
|
formatCliArgsForPrompt,
|
|
11
11
|
isCustomAiCli,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
tokenizeCliArgs,
|
|
15
15
|
} from './ai-cli-launch.js';
|
|
16
16
|
|
|
17
|
-
let selectPlatformPrompt =
|
|
17
|
+
let selectPlatformPrompt = checkbox;
|
|
18
18
|
let selectAiCliPrompt = select;
|
|
19
19
|
let inputPrompt = input;
|
|
20
20
|
|
|
@@ -37,53 +37,55 @@ export function __resetAiCliPromptsForTests() {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Select target
|
|
40
|
+
* Select target platforms (codebuddy, claude, codex, pi, cursor).
|
|
41
41
|
* @param {string} currentPlatform - current platform value
|
|
42
42
|
* @param {Object} detected - detected environment info (e.g., { cbc: true, claude: false })
|
|
43
|
-
* @returns {Promise<string>}
|
|
43
|
+
* @returns {Promise<string>} canonical comma-separated platform ids
|
|
44
44
|
*/
|
|
45
45
|
export async function selectPlatform(currentPlatform, detected = {}) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
name: `同时安装全部平台 (${platformLabel('all')})`,
|
|
81
|
-
value: 'all',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
default: defaultPlatform,
|
|
46
|
+
const checked = currentPlatform
|
|
47
|
+
? parsePlatformSelection(currentPlatform)
|
|
48
|
+
: [];
|
|
49
|
+
const platformChoices = [
|
|
50
|
+
{
|
|
51
|
+
id: 'codebuddy',
|
|
52
|
+
name: `CodeBuddy (.codebuddy/)${detected.cbc ? chalk.green(' ← 已检测到 cbc') : ''}`,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'claude',
|
|
56
|
+
name: `Claude Code (.claude/)${(detected.claude || detected.claudeInternal) ? chalk.green(' ← 已检测到') : ''}`,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'codex',
|
|
60
|
+
name: `Codex (AGENTS.md + .agents/skills + .codex/)${detected.codex ? chalk.green(' ← 已检测到 codex') : ''}`,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'pi',
|
|
64
|
+
name: `Pi (.pi/skills + .pi/APPEND_SYSTEM.md)${detected.pi ? chalk.green(' ← 已检测到 pi') : ''}`,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'cursor',
|
|
68
|
+
name: `Cursor (.cursor/skills + .cursor/rules + .cursor/hooks.json)${detected.cursor ? chalk.green(' ← 已检测到 agent') : ''}`,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
const selected = await selectPlatformPrompt({
|
|
72
|
+
message: '选择目标平台 (决定安装的目录结构,可多选):',
|
|
73
|
+
choices: platformChoices.map(choice => ({
|
|
74
|
+
name: choice.name,
|
|
75
|
+
value: choice.id,
|
|
76
|
+
checked: checked.includes(choice.id),
|
|
77
|
+
})),
|
|
78
|
+
required: true,
|
|
79
|
+
validate: value => (value?.length ? true : '请至少选择一个平台'),
|
|
85
80
|
});
|
|
86
|
-
|
|
81
|
+
if (!Array.isArray(selected) || selected.length === 0) {
|
|
82
|
+
throw new Error('请至少选择一个平台');
|
|
83
|
+
}
|
|
84
|
+
const selectedIds = selected.filter(id => PLATFORM_IDS.includes(id));
|
|
85
|
+
if (selectedIds.length === 0) {
|
|
86
|
+
throw new Error('请至少选择一个平台');
|
|
87
|
+
}
|
|
88
|
+
return canonicalizePlatformSelection(selectedIds.join(','));
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
/**
|
package/src/scaffold.js
CHANGED
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
loadRulesMetadata,
|
|
25
25
|
getSkillCandidatePaths,
|
|
26
26
|
} from './metadata.js';
|
|
27
|
-
import { generateGitignore
|
|
27
|
+
import { generateGitignore } from './gitignore-template.js';
|
|
28
28
|
import { buildManifest, readManifestForLifecycle, writeManifest } from './manifest.js';
|
|
29
|
-
import { defaultCliForPlatform, expandPlatforms, isKnownPlatform, nativeSkillRoot, payloadSkillRoots, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
|
|
29
|
+
import { canonicalizePlatformSelection, defaultCliForPlatform, expandPlatforms, isKnownPlatform, nativeSkillRoot, payloadSkillRoots, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms, unknownPlatformMessage } from './platforms.js';
|
|
30
30
|
import { normalizeRuntime, runtimeLabel } from './runtimes.js';
|
|
31
31
|
import { applyAiCliLaunchToConfig, resolveAiCliLaunchSelection } from './ai-cli-launch.js';
|
|
32
32
|
|
|
@@ -1379,33 +1379,23 @@ export async function installGitignore(projectRoot, options = {}, dryRun) {
|
|
|
1379
1379
|
privateMemoryFiles: options.privateMemoryFiles || [],
|
|
1380
1380
|
});
|
|
1381
1381
|
const existed = await fs.pathExists(targetPath);
|
|
1382
|
-
const existing = existed ? await fs.readFile(targetPath, 'utf-8') : '';
|
|
1383
|
-
const retiredRemoved = existed && hasRetiredFrameworkGitignore(existing);
|
|
1384
|
-
const stripped = retiredRemoved ? stripRetiredFrameworkGitignore(existing) : existing;
|
|
1385
1382
|
|
|
1386
1383
|
if (dryRun) {
|
|
1387
|
-
if (retiredRemoved) console.log(chalk.gray(' [dry-run] .gitignore (remove retired .prizmkit/* ignore)'));
|
|
1388
1384
|
if (!templateContent) {
|
|
1389
|
-
if (!
|
|
1385
|
+
if (!existed) console.log(chalk.gray(' [dry-run] .gitignore (no managed private-memory entries)'));
|
|
1390
1386
|
return;
|
|
1391
1387
|
}
|
|
1392
1388
|
console.log(chalk.gray(' [dry-run] .gitignore (private host memory only)'));
|
|
1393
1389
|
return;
|
|
1394
1390
|
}
|
|
1395
1391
|
|
|
1396
|
-
let current = existed ? stripped : '';
|
|
1397
|
-
if (retiredRemoved) {
|
|
1398
|
-
await fs.writeFile(targetPath, current ? `${current.replace(/\s+$/, '')}\n` : '');
|
|
1399
|
-
current = await fs.readFile(targetPath, 'utf-8');
|
|
1400
|
-
console.log(chalk.green(' ✓ .gitignore (removed retired .prizmkit/* ignore)'));
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
1392
|
if (!templateContent) {
|
|
1404
1393
|
if (!existed) console.log(chalk.gray(' • .gitignore (no managed private-memory entries)'));
|
|
1405
1394
|
return;
|
|
1406
1395
|
}
|
|
1407
1396
|
|
|
1408
|
-
if (
|
|
1397
|
+
if (existed) {
|
|
1398
|
+
const current = await fs.readFile(targetPath, 'utf-8');
|
|
1409
1399
|
const existingLines = new Set(current.split('\n').map(l => l.trim()));
|
|
1410
1400
|
const templateLines = templateContent.split('\n').map(l => l.trim()).filter(Boolean);
|
|
1411
1401
|
const missing = templateLines.filter(line => !existingLines.has(line) && !line.startsWith('#'));
|
|
@@ -1416,13 +1406,14 @@ export async function installGitignore(projectRoot, options = {}, dryRun) {
|
|
|
1416
1406
|
const header = existingLines.has(managedHeader) ? '' : `${managedHeader}\n`;
|
|
1417
1407
|
await fs.appendFile(targetPath, separator + '\n' + header + missing.join('\n') + '\n');
|
|
1418
1408
|
console.log(chalk.green(` ✓ .gitignore (added ${missing.length} entries)`));
|
|
1419
|
-
} else
|
|
1409
|
+
} else {
|
|
1420
1410
|
console.log(chalk.green(' ✓ .gitignore (up-to-date)'));
|
|
1421
1411
|
}
|
|
1422
|
-
|
|
1423
|
-
await fs.writeFile(targetPath, `${templateContent}\n`);
|
|
1424
|
-
console.log(chalk.green(' ✓ .gitignore'));
|
|
1412
|
+
return;
|
|
1425
1413
|
}
|
|
1414
|
+
|
|
1415
|
+
await fs.writeFile(targetPath, `${templateContent}\n`);
|
|
1416
|
+
console.log(chalk.green(' ✓ .gitignore'));
|
|
1426
1417
|
}
|
|
1427
1418
|
|
|
1428
1419
|
// ============================================================
|
|
@@ -1734,7 +1725,7 @@ const SCAFFOLD_CONFIG_FIELDS = new Set([
|
|
|
1734
1725
|
/**
|
|
1735
1726
|
* 执行纯净安装
|
|
1736
1727
|
* @param {Object} config
|
|
1737
|
-
* @param {string} config.platform - 'codebuddy' | 'claude' | 'codex' | 'pi' | 'cursor' | 'all'
|
|
1728
|
+
* @param {string} config.platform - 'codebuddy' | 'claude' | 'codex' | 'pi' | 'cursor' | 'all' | comma-separated subset
|
|
1738
1729
|
* @param {string} [config.runtime] - 'python' (legacy aliases accepted: 'unix' | 'windows')
|
|
1739
1730
|
* @param {string} config.skills - 'core' | 'minimal' | 'recommended:<type>'
|
|
1740
1731
|
* @param {boolean} config.pipeline - 是否安装 dev-pipeline
|
|
@@ -1765,10 +1756,11 @@ export async function scaffold(config) {
|
|
|
1765
1756
|
});
|
|
1766
1757
|
const resolvedAiCli = launchSelection.aiCli;
|
|
1767
1758
|
if (!isKnownPlatform(platform)) {
|
|
1768
|
-
throw new Error(
|
|
1759
|
+
throw new Error(unknownPlatformMessage(platform));
|
|
1769
1760
|
}
|
|
1770
|
-
const
|
|
1771
|
-
const
|
|
1761
|
+
const canonicalPlatform = canonicalizePlatformSelection(platform);
|
|
1762
|
+
const platforms = expandPlatforms(canonicalPlatform);
|
|
1763
|
+
const payloadPlatforms = resolvePayloadPlatforms(canonicalPlatform, resolvedAiCli);
|
|
1772
1764
|
|
|
1773
1765
|
if (dryRun) {
|
|
1774
1766
|
console.log(chalk.yellow('\n [DRY RUN] 预览将要安装的内容:\n'));
|
|
@@ -1863,7 +1855,7 @@ export async function scaffold(config) {
|
|
|
1863
1855
|
const skillDef = knownSkills.find(s => s.name === name);
|
|
1864
1856
|
if (skillDef) {
|
|
1865
1857
|
try {
|
|
1866
|
-
await installExternalSkill(skillDef,
|
|
1858
|
+
await installExternalSkill(skillDef, canonicalPlatform, projectRoot, dryRun, resolvedAiCli);
|
|
1867
1859
|
console.log(chalk.green(` ✓ ${name} (external)`));
|
|
1868
1860
|
} catch (e) {
|
|
1869
1861
|
console.log(chalk.yellow(` ⚠ ${name} 安装失败,跳过: ${e.message}`));
|
|
@@ -1871,7 +1863,7 @@ export async function scaffold(config) {
|
|
|
1871
1863
|
}
|
|
1872
1864
|
}
|
|
1873
1865
|
if (!dryRun) {
|
|
1874
|
-
await cleanExternalSkillArtifacts(projectRoot,
|
|
1866
|
+
await cleanExternalSkillArtifacts(projectRoot, canonicalPlatform, resolvedAiCli);
|
|
1875
1867
|
}
|
|
1876
1868
|
}
|
|
1877
1869
|
|
|
@@ -1880,7 +1872,7 @@ export async function scaffold(config) {
|
|
|
1880
1872
|
if (playwrightCli) {
|
|
1881
1873
|
activeExtras.push('playwright-cli');
|
|
1882
1874
|
console.log(chalk.blue(` ${EXTRAS_REGISTRY['playwright-cli'].label}:`));
|
|
1883
|
-
await installPlaywrightCli(projectRoot, dryRun, { platform, aiCli: resolvedAiCli });
|
|
1875
|
+
await installPlaywrightCli(projectRoot, dryRun, { platform: canonicalPlatform, aiCli: resolvedAiCli });
|
|
1884
1876
|
console.log('');
|
|
1885
1877
|
}
|
|
1886
1878
|
if (openCli) {
|
|
@@ -1919,7 +1911,7 @@ export async function scaffold(config) {
|
|
|
1919
1911
|
|
|
1920
1912
|
const manifest = buildManifest({
|
|
1921
1913
|
version: scaffoldPkg.version,
|
|
1922
|
-
platform,
|
|
1914
|
+
platform: canonicalPlatform,
|
|
1923
1915
|
runtime,
|
|
1924
1916
|
suite: skills,
|
|
1925
1917
|
skills: skillList,
|
package/src/upgrade.js
CHANGED
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
installPipeline,
|
|
24
24
|
installPrizmkitScripts,
|
|
25
25
|
installGitHook,
|
|
26
|
-
installGitignore,
|
|
27
26
|
installProjectMemory,
|
|
28
27
|
resolvePipelineFileList,
|
|
29
28
|
findStaleManagedPipelineFiles,
|
|
@@ -33,7 +32,7 @@ import {
|
|
|
33
32
|
removeRetiredAgentTeamArtifacts,
|
|
34
33
|
EXTRAS_REGISTRY,
|
|
35
34
|
} from './scaffold.js';
|
|
36
|
-
import { expandPlatforms, PLATFORM_IDS, platformLabel,
|
|
35
|
+
import { canonicalizePlatformSelection, expandPlatforms, isKnownPlatform, PLATFORM_IDS, platformLabel, resolvePayloadPlatforms, uniquePlatforms, unknownPlatformMessage } from './platforms.js';
|
|
37
36
|
import { normalizeRuntime, runtimeLabel } from './runtimes.js';
|
|
38
37
|
|
|
39
38
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -160,9 +159,8 @@ export function previousPayloadPlatformsFromManifest(manifest) {
|
|
|
160
159
|
if (Array.isArray(manifest.files?.payloadPlatforms)) {
|
|
161
160
|
listed.push(...manifest.files.payloadPlatforms);
|
|
162
161
|
}
|
|
163
|
-
if (manifest.platform) {
|
|
164
|
-
|
|
165
|
-
listed.push(...expandPlatforms(group));
|
|
162
|
+
if (manifest.platform && isKnownPlatform(manifest.platform)) {
|
|
163
|
+
listed.push(...expandPlatforms(manifest.platform));
|
|
166
164
|
}
|
|
167
165
|
return uniquePlatforms(listed);
|
|
168
166
|
}
|
|
@@ -330,7 +328,10 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
330
328
|
// (e.g. legacy installs before manifest tracked platform).
|
|
331
329
|
let platform;
|
|
332
330
|
if (oldManifest?.platform) {
|
|
333
|
-
|
|
331
|
+
if (!isKnownPlatform(oldManifest.platform)) {
|
|
332
|
+
throw new Error(unknownPlatformMessage(oldManifest.platform));
|
|
333
|
+
}
|
|
334
|
+
platform = canonicalizePlatformSelection(oldManifest.platform);
|
|
334
335
|
} else {
|
|
335
336
|
// Fallback: detect from filesystem for legacy manifests without platform field
|
|
336
337
|
const hasPlatformFiles = async (dir) => {
|
|
@@ -355,9 +356,9 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
355
356
|
hasCursor && 'cursor',
|
|
356
357
|
].filter(Boolean);
|
|
357
358
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
359
|
+
platform = detectedPlatforms.length
|
|
360
|
+
? uniquePlatforms(detectedPlatforms).join(',')
|
|
361
|
+
: 'claude';
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
const newSkillList = await resolveSkillList(suite);
|
|
@@ -513,13 +514,6 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
513
514
|
console.log(chalk.blue(' Git Hook:'));
|
|
514
515
|
await installGitHook(projectRoot, dryRun, runtime);
|
|
515
516
|
|
|
516
|
-
// .gitignore
|
|
517
|
-
console.log(chalk.blue(' Gitignore:'));
|
|
518
|
-
await installGitignore(projectRoot, {
|
|
519
|
-
pipeline,
|
|
520
|
-
privateMemoryFiles: privateProjectMemoryFiles(payloadPlatforms),
|
|
521
|
-
}, dryRun);
|
|
522
|
-
|
|
523
517
|
// PrizmKit scripts
|
|
524
518
|
console.log(chalk.blue(' PrizmKit Scripts:'));
|
|
525
519
|
await installPrizmkitScripts(projectRoot, dryRun, runtime);
|