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
package/src/scaffold.js
CHANGED
|
@@ -14,8 +14,7 @@ import path from 'path';
|
|
|
14
14
|
import { readFileSync } from 'fs';
|
|
15
15
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
16
16
|
import { dirname, join } from 'path';
|
|
17
|
-
import {
|
|
18
|
-
import os from 'os';
|
|
17
|
+
import { execSync } from 'child_process';
|
|
19
18
|
import {
|
|
20
19
|
loadMetadata,
|
|
21
20
|
getTemplatesDir,
|
|
@@ -174,36 +173,35 @@ async function loadSharedFrontmatter() {
|
|
|
174
173
|
// ============================================================
|
|
175
174
|
|
|
176
175
|
/**
|
|
177
|
-
*
|
|
176
|
+
* 规范化技能套件(仅保留 core 套件;旧 --skills 参数输出弃用警告并归一为 core)
|
|
178
177
|
*/
|
|
179
|
-
export
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const baseSkills = rec.base === '*'
|
|
188
|
-
? Object.keys(metadata.skills)
|
|
189
|
-
: [...(metadata.suites[rec.base]?.skills || [])];
|
|
190
|
-
const includeSkills = rec.include || [];
|
|
191
|
-
const excludeSkills = new Set(rec.exclude || []);
|
|
192
|
-
return [...new Set([...baseSkills, ...includeSkills])].filter(s => !excludeSkills.has(s));
|
|
193
|
-
}
|
|
178
|
+
export function normalizeSkillSuite(suite, { warn = true, warnOnCore = false } = {}) {
|
|
179
|
+
if (suite === undefined || suite === null || suite === '') {
|
|
180
|
+
return 'core';
|
|
181
|
+
}
|
|
182
|
+
if (warn && (warnOnCore || suite !== 'core')) {
|
|
183
|
+
console.warn(chalk.yellow(
|
|
184
|
+
` ⚠ --skills "${suite}" is deprecated and ignored; PrizmKit now always installs the full "core" skill suite.`,
|
|
185
|
+
));
|
|
194
186
|
}
|
|
187
|
+
return 'core';
|
|
188
|
+
}
|
|
195
189
|
|
|
196
|
-
|
|
190
|
+
/**
|
|
191
|
+
* 解析 Skill 列表(唯一套件为 core)
|
|
192
|
+
*/
|
|
193
|
+
export async function resolveSkillList() {
|
|
194
|
+
const metadata = await loadMetadata();
|
|
195
|
+
const suiteDef = metadata.suites.core;
|
|
197
196
|
if (suiteDef.skills === '*') {
|
|
198
197
|
return Object.keys(metadata.skills);
|
|
199
198
|
}
|
|
200
199
|
return suiteDef.skills;
|
|
201
200
|
}
|
|
202
201
|
|
|
203
|
-
export function resolveRuleNamesForRuntime(rulesMeta,
|
|
202
|
+
export function resolveRuleNamesForRuntime(rulesMeta, runtime = 'python') {
|
|
204
203
|
normalizeRuntime(runtime);
|
|
205
|
-
|
|
206
|
-
return preset?.rules || [];
|
|
204
|
+
return Object.keys(rulesMeta?.rules || {});
|
|
207
205
|
}
|
|
208
206
|
|
|
209
207
|
// ============================================================
|
|
@@ -504,12 +502,11 @@ async function readUserSettings(settingsPath) {
|
|
|
504
502
|
/**
|
|
505
503
|
* 安装平台配置文件(settings/hooks/rules)
|
|
506
504
|
*/
|
|
507
|
-
export async function installSettings(platform, projectRoot,
|
|
505
|
+
export async function installSettings(platform, projectRoot, _options = {}, dryRun = false, runtime = 'python') {
|
|
508
506
|
normalizeRuntime(runtime);
|
|
509
|
-
//
|
|
507
|
+
// 从文件加载全部内置 rules
|
|
510
508
|
const rulesMeta = await loadRulesMetadata();
|
|
511
|
-
const
|
|
512
|
-
const ruleNames = resolveRuleNamesForRuntime(rulesMeta, rulesPreset, runtime);
|
|
509
|
+
const ruleNames = resolveRuleNamesForRuntime(rulesMeta, runtime);
|
|
513
510
|
const rulesDir = getRulesDir();
|
|
514
511
|
const ruleFiles = [];
|
|
515
512
|
for (const name of ruleNames) {
|
|
@@ -1538,16 +1535,6 @@ function readLatestNpmVersion(packageName) {
|
|
|
1538
1535
|
}
|
|
1539
1536
|
}
|
|
1540
1537
|
|
|
1541
|
-
function readGlobalNpmPackageVersion(packageName) {
|
|
1542
|
-
try {
|
|
1543
|
-
const output = String(execSync(`npm ls -g ${packageName} --depth=0 --json`, { stdio: 'pipe', timeout: 30000 }));
|
|
1544
|
-
const parsed = JSON.parse(output);
|
|
1545
|
-
return parsed?.dependencies?.[packageName]?.version || null;
|
|
1546
|
-
} catch {
|
|
1547
|
-
return null;
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
1538
|
function installGlobalNpmPackage(packageName, version) {
|
|
1552
1539
|
const target = version || 'latest';
|
|
1553
1540
|
try {
|
|
@@ -1630,17 +1617,6 @@ function extrasContextObject(value) {
|
|
|
1630
1617
|
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
1631
1618
|
}
|
|
1632
1619
|
|
|
1633
|
-
function resolveOpenCliAutoDownload(autoDownloadOrContext, fallback = true) {
|
|
1634
|
-
if (extrasContextObject(autoDownloadOrContext)) {
|
|
1635
|
-
if (Object.prototype.hasOwnProperty.call(autoDownloadOrContext, 'openCliAutoDownload')) {
|
|
1636
|
-
return Boolean(autoDownloadOrContext.openCliAutoDownload);
|
|
1637
|
-
}
|
|
1638
|
-
return fallback;
|
|
1639
|
-
}
|
|
1640
|
-
if (typeof autoDownloadOrContext === 'boolean') return autoDownloadOrContext;
|
|
1641
|
-
return fallback;
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
1620
|
function completePlaywrightSkillDir(dir) {
|
|
1645
1621
|
return dir && fs.pathExistsSync(path.join(dir, 'SKILL.md')) ? dir : null;
|
|
1646
1622
|
}
|
|
@@ -1736,190 +1712,6 @@ export async function installPlaywrightCli(projectRoot, dryRun, extrasContext =
|
|
|
1736
1712
|
}
|
|
1737
1713
|
}
|
|
1738
1714
|
|
|
1739
|
-
// ============================================================
|
|
1740
|
-
// OpenCLI 安装
|
|
1741
|
-
// ============================================================
|
|
1742
|
-
|
|
1743
|
-
const OPENCLI_PACKAGE = '@jackwener/opencli';
|
|
1744
|
-
|
|
1745
|
-
/**
|
|
1746
|
-
* Side-effect-free OpenCLI presence check. Running OpenCLI itself is unsafe here:
|
|
1747
|
-
* browser-oriented commands such as `opencli doctor` create a live browser session.
|
|
1748
|
-
*/
|
|
1749
|
-
function isOpenCliAvailable() {
|
|
1750
|
-
try {
|
|
1751
|
-
execFileSync(os.platform() === 'win32' ? 'where.exe' : 'which', ['opencli'], { stdio: 'ignore' });
|
|
1752
|
-
return true;
|
|
1753
|
-
} catch {
|
|
1754
|
-
return false;
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
function openCliExtensionDir() {
|
|
1759
|
-
return path.join(process.env.HOME || process.env.USERPROFILE || '.', '.opencli', 'extension');
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
function readOpenCliExtensionVersion(extDir) {
|
|
1763
|
-
try {
|
|
1764
|
-
return fs.readJSONSync(path.join(extDir, 'manifest.json'))?.version || null;
|
|
1765
|
-
} catch {
|
|
1766
|
-
return null;
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
/**
|
|
1771
|
-
* Resolve the latest published Chrome extension asset. The release tag names the
|
|
1772
|
-
* CLI version, so the extension version comes from the asset file name.
|
|
1773
|
-
*/
|
|
1774
|
-
function fetchLatestOpenCliExtension() {
|
|
1775
|
-
try {
|
|
1776
|
-
const release = JSON.parse(String(execSync(
|
|
1777
|
-
'curl -sL https://api.github.com/repos/jackwener/OpenCLI/releases/latest',
|
|
1778
|
-
{ stdio: 'pipe', timeout: 30000 },
|
|
1779
|
-
)));
|
|
1780
|
-
const asset = release.assets?.find(a => a.name?.startsWith('opencli-extension-') && a.name?.endsWith('.zip'));
|
|
1781
|
-
if (!asset) return null;
|
|
1782
|
-
return {
|
|
1783
|
-
name: asset.name,
|
|
1784
|
-
url: asset.browser_download_url,
|
|
1785
|
-
version: asset.name.match(/opencli-extension-v?(\d+\.\d+\.\d+)/)?.[1] || null,
|
|
1786
|
-
};
|
|
1787
|
-
} catch {
|
|
1788
|
-
return null;
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
async function downloadOpenCliExtension(asset, extDir) {
|
|
1793
|
-
console.log(chalk.blue(` ⏳ Downloading ${asset.name}...`));
|
|
1794
|
-
const tmpZip = path.join(extDir, '..', '.opencli-ext-tmp.zip');
|
|
1795
|
-
await fs.ensureDir(path.dirname(tmpZip));
|
|
1796
|
-
execSync(`curl -sL "${asset.url}" -o "${tmpZip}"`, { stdio: 'pipe', timeout: 60000 });
|
|
1797
|
-
|
|
1798
|
-
// Extract (use unzip on macOS/Linux, tar on Windows fallback)
|
|
1799
|
-
console.log(chalk.blue(` ⏳ Extracting to ${extDir}...`));
|
|
1800
|
-
await fs.ensureDir(extDir);
|
|
1801
|
-
execSync(`unzip -o "${tmpZip}" -d "${extDir}"`, { stdio: 'pipe', timeout: 30000 });
|
|
1802
|
-
await fs.remove(tmpZip);
|
|
1803
|
-
|
|
1804
|
-
console.log(chalk.green(` ✓ Extension extracted to ${extDir}`));
|
|
1805
|
-
printOpenCliLoadSteps(extDir);
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
/**
|
|
1809
|
-
* Keep the Chrome extension at the latest published version. Extension files are
|
|
1810
|
-
* only staged on disk; the user still reloads them in chrome://extensions.
|
|
1811
|
-
*/
|
|
1812
|
-
async function syncOpenCliExtension() {
|
|
1813
|
-
const extDir = openCliExtensionDir();
|
|
1814
|
-
const installedVersion = readOpenCliExtensionVersion(extDir);
|
|
1815
|
-
if (!installedVersion) console.log(chalk.blue(' ⏳ Fetching latest extension release info...'));
|
|
1816
|
-
const latest = fetchLatestOpenCliExtension();
|
|
1817
|
-
|
|
1818
|
-
if (!latest) {
|
|
1819
|
-
if (installedVersion) {
|
|
1820
|
-
console.log(chalk.green(` ✓ OpenCLI extension ${installedVersion} (already downloaded)`));
|
|
1821
|
-
console.log(chalk.gray(' • Extension version check skipped: latest release unavailable'));
|
|
1822
|
-
} else {
|
|
1823
|
-
console.log(chalk.yellow(' ⚠ Could not read the latest extension release'));
|
|
1824
|
-
printOpenCliManualSteps();
|
|
1825
|
-
}
|
|
1826
|
-
return;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
if (installedVersion) {
|
|
1830
|
-
const comparison = latest.version ? compareVersions(installedVersion, latest.version) : null;
|
|
1831
|
-
if (comparison === null) {
|
|
1832
|
-
console.log(chalk.green(` ✓ OpenCLI extension ${installedVersion} (already downloaded)`));
|
|
1833
|
-
return;
|
|
1834
|
-
}
|
|
1835
|
-
if (comparison >= 0) {
|
|
1836
|
-
console.log(chalk.green(` ✓ OpenCLI extension ${installedVersion} (latest)`));
|
|
1837
|
-
return;
|
|
1838
|
-
}
|
|
1839
|
-
console.log(chalk.blue(` ⏳ Updating OpenCLI extension ${installedVersion} → ${latest.version}...`));
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
try {
|
|
1843
|
-
await downloadOpenCliExtension(latest, extDir);
|
|
1844
|
-
} catch (e) {
|
|
1845
|
-
console.log(chalk.yellow(` ⚠ Extension download failed: ${e.message}`));
|
|
1846
|
-
printOpenCliManualSteps();
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
/**
|
|
1851
|
-
* 安装 opencli(全局 npm 包)
|
|
1852
|
-
* 用于浏览器交互验证,复用 Chrome 已登录会话(OAuth/SSO/第三方集成)
|
|
1853
|
-
*/
|
|
1854
|
-
export async function installOpenCli(projectRoot, dryRun, autoDownload = true) {
|
|
1855
|
-
const shouldAutoDownload = resolveOpenCliAutoDownload(autoDownload);
|
|
1856
|
-
if (dryRun) {
|
|
1857
|
-
console.log(chalk.gray(` [dry-run] ${OPENCLI_PACKAGE}@latest (global install/update)`));
|
|
1858
|
-
console.log(chalk.gray(' [dry-run] OpenCLI extension (version check + update when outdated)'));
|
|
1859
|
-
return;
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
// Detect the executable without running it. This keeps repeated PrizmKit
|
|
1863
|
-
// installs/upgrades idempotent and avoids starting an OpenCLI browser session.
|
|
1864
|
-
if (isOpenCliAvailable()) {
|
|
1865
|
-
const installedVersion = readGlobalNpmPackageVersion(OPENCLI_PACKAGE);
|
|
1866
|
-
if (installedVersion) {
|
|
1867
|
-
syncGlobalNpmPackage(OPENCLI_PACKAGE, 'opencli', installedVersion);
|
|
1868
|
-
} else {
|
|
1869
|
-
console.log(chalk.green(' ✓ opencli (already installed)'));
|
|
1870
|
-
}
|
|
1871
|
-
} else if (!installGlobalNpmPackage(OPENCLI_PACKAGE)) {
|
|
1872
|
-
return;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
if (shouldAutoDownload) {
|
|
1876
|
-
await syncOpenCliExtension();
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
// Auto-download disabled: report what is already on disk and never touch the network.
|
|
1881
|
-
const installedExtension = readOpenCliExtensionVersion(openCliExtensionDir());
|
|
1882
|
-
if (installedExtension) {
|
|
1883
|
-
console.log(chalk.green(` ✓ OpenCLI extension ${installedExtension} (already downloaded)`));
|
|
1884
|
-
} else {
|
|
1885
|
-
printOpenCliManualSteps();
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
// ============================================================
|
|
1890
|
-
// OpenCLI Extension 下载/指引
|
|
1891
|
-
// ============================================================
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
/**
|
|
1895
|
-
* 显示手动安装步骤(兜底路径)。
|
|
1896
|
-
*/
|
|
1897
|
-
function printOpenCliManualSteps() {
|
|
1898
|
-
console.log(chalk.cyan(' ┌─────────────────────────────────────────────────────────────┐'));
|
|
1899
|
-
console.log(chalk.cyan(' │ To enable opencli browser control: │'));
|
|
1900
|
-
console.log(chalk.cyan(' │ 1. Download extension from: │'));
|
|
1901
|
-
console.log(chalk.cyan(' │ https://github.com/jackwener/opencli/releases │'));
|
|
1902
|
-
console.log(chalk.cyan(' │ 2. Unzip the extension file │'));
|
|
1903
|
-
console.log(chalk.cyan(' │ 3. Open chrome://extensions/ → Enable Developer Mode │'));
|
|
1904
|
-
console.log(chalk.cyan(' │ 4. Click "Load unpacked" → select the extension folder │'));
|
|
1905
|
-
console.log(chalk.cyan(' │ 5. Run "opencli doctor" to verify connectivity │'));
|
|
1906
|
-
console.log(chalk.cyan(' └─────────────────────────────────────────────────────────────┘'));
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
/**
|
|
1910
|
-
* 显示加载已解压扩展的指引(已自动下载解压后)。
|
|
1911
|
-
*/
|
|
1912
|
-
function printOpenCliLoadSteps(extDir) {
|
|
1913
|
-
console.log(chalk.yellow(' ⚠ Browser commands will NOT work until the extension is loaded in Chrome'));
|
|
1914
|
-
console.log(chalk.cyan(' ┌─────────────────────────────────────────────────────────────┐'));
|
|
1915
|
-
console.log(chalk.cyan(' │ To complete setup: │'));
|
|
1916
|
-
console.log(chalk.cyan(` │ 1. Open chrome://extensions/ → Enable Developer Mode │`));
|
|
1917
|
-
console.log(chalk.cyan(` │ 2. Click "Load unpacked" → select: │`));
|
|
1918
|
-
console.log(chalk.cyan(` │ ${extDir}`));
|
|
1919
|
-
console.log(chalk.cyan(' │ 3. Run "opencli doctor" to verify connectivity │'));
|
|
1920
|
-
console.log(chalk.cyan(' └─────────────────────────────────────────────────────────────┘'));
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
1715
|
// ============================================================
|
|
1924
1716
|
// Extras 注册表
|
|
1925
1717
|
// ============================================================
|
|
@@ -1933,10 +1725,6 @@ export const EXTRAS_REGISTRY = {
|
|
|
1933
1725
|
label: '浏览器交互工具 (playwright-cli)',
|
|
1934
1726
|
install: installPlaywrightCli,
|
|
1935
1727
|
},
|
|
1936
|
-
'opencli': {
|
|
1937
|
-
label: '浏览器交互工具 (opencli — 复用 Chrome 登录态)',
|
|
1938
|
-
install: installOpenCli,
|
|
1939
|
-
},
|
|
1940
1728
|
};
|
|
1941
1729
|
|
|
1942
1730
|
// ============================================================
|
|
@@ -1944,9 +1732,8 @@ export const EXTRAS_REGISTRY = {
|
|
|
1944
1732
|
// ============================================================
|
|
1945
1733
|
|
|
1946
1734
|
const SCAFFOLD_CONFIG_FIELDS = new Set([
|
|
1947
|
-
'platform', 'runtime', 'skills', 'pipeline', '
|
|
1948
|
-
'
|
|
1949
|
-
'projectRoot', 'dryRun',
|
|
1735
|
+
'platform', 'runtime', 'skills', 'pipeline', 'aiCli', 'aiCliLaunch',
|
|
1736
|
+
'playwrightCli', 'projectRoot', 'dryRun',
|
|
1950
1737
|
]);
|
|
1951
1738
|
|
|
1952
1739
|
/**
|
|
@@ -1954,14 +1741,10 @@ const SCAFFOLD_CONFIG_FIELDS = new Set([
|
|
|
1954
1741
|
* @param {Object} config
|
|
1955
1742
|
* @param {string} config.platform - 'codebuddy' | 'claude' | 'codex' | 'pi' | 'cursor' | 'antigravity' | 'all' | comma-separated subset
|
|
1956
1743
|
* @param {string} [config.runtime] - 'python' (legacy aliases accepted: 'unix' | 'windows')
|
|
1957
|
-
* @param {string} config.skills - 'core'
|
|
1744
|
+
* @param {string} [config.skills] - sole supported suite is 'core' (legacy values warn and normalize to 'core')
|
|
1958
1745
|
* @param {boolean} config.pipeline - 是否安装 dev-pipeline
|
|
1959
|
-
* @param {string} [config.rules] - Rules preset: 'recommended' | 'minimal' | 'none'
|
|
1960
1746
|
* @param {string} [config.aiCli] - AI CLI 可执行命令(写入 .prizmkit/config.json)
|
|
1961
|
-
* @param {string[]} [config.externalSkills] - 要安装的外部 skill 名称列表
|
|
1962
1747
|
* @param {boolean} [config.playwrightCli] - 是否安装 playwright-cli
|
|
1963
|
-
* @param {boolean} [config.openCli] - 是否安装 opencli
|
|
1964
|
-
* @param {boolean} [config.openCliAutoDownload] - opencli 扩展缺失时是否自动下载
|
|
1965
1748
|
* @param {string} config.projectRoot - 目标项目根目录
|
|
1966
1749
|
* @param {boolean} config.dryRun - 是否为预览模式
|
|
1967
1750
|
*/
|
|
@@ -1975,7 +1758,8 @@ export async function scaffold(config) {
|
|
|
1975
1758
|
if (unknownFields.length) {
|
|
1976
1759
|
throw new TypeError(`scaffold config has unknown fields: ${unknownFields.join(', ')}`);
|
|
1977
1760
|
}
|
|
1978
|
-
const { platform, skills, pipeline,
|
|
1761
|
+
const { platform, skills, pipeline, aiCli, aiCliLaunch, playwrightCli, projectRoot, dryRun } = config;
|
|
1762
|
+
const normalizedSuite = normalizeSkillSuite(skills, { warn: true, warnOnCore: false });
|
|
1979
1763
|
const runtime = normalizeRuntime(config.runtime);
|
|
1980
1764
|
const launchSelection = resolveAiCliLaunchSelection(aiCli || '', {
|
|
1981
1765
|
aiCliLaunch,
|
|
@@ -1994,7 +1778,7 @@ export async function scaffold(config) {
|
|
|
1994
1778
|
}
|
|
1995
1779
|
|
|
1996
1780
|
// 解析 Skill 列表
|
|
1997
|
-
const skillList = await resolveSkillList(
|
|
1781
|
+
const skillList = await resolveSkillList();
|
|
1998
1782
|
|
|
1999
1783
|
console.log('');
|
|
2000
1784
|
|
|
@@ -2009,7 +1793,7 @@ export async function scaffold(config) {
|
|
|
2009
1793
|
|
|
2010
1794
|
// 2. Settings/Hooks/Rules
|
|
2011
1795
|
console.log(chalk.blue('\n 平台配置:'));
|
|
2012
|
-
await installSettings(p, projectRoot, {
|
|
1796
|
+
await installSettings(p, projectRoot, {}, dryRun, runtime);
|
|
2013
1797
|
|
|
2014
1798
|
// 5. Project Memory
|
|
2015
1799
|
console.log(chalk.blue('\n 项目记忆文件:'));
|
|
@@ -2043,7 +1827,6 @@ export async function scaffold(config) {
|
|
|
2043
1827
|
// 7. .gitignore
|
|
2044
1828
|
console.log(chalk.blue(' 项目配置:'));
|
|
2045
1829
|
await installGitignore(projectRoot, {
|
|
2046
|
-
pipeline,
|
|
2047
1830
|
privateMemoryFiles: privateProjectMemoryFiles(payloadPlatforms),
|
|
2048
1831
|
}, dryRun);
|
|
2049
1832
|
|
|
@@ -2072,29 +1855,7 @@ export async function scaffold(config) {
|
|
|
2072
1855
|
}
|
|
2073
1856
|
}
|
|
2074
1857
|
|
|
2075
|
-
// 9.
|
|
2076
|
-
if (externalSkills?.length) {
|
|
2077
|
-
const { installExternalSkill, cleanExternalSkillArtifacts } = await import('./external-skills.js');
|
|
2078
|
-
const metadata = await loadMetadata();
|
|
2079
|
-
const knownSkills = metadata.external_skills?.known || [];
|
|
2080
|
-
console.log(chalk.blue('\n 外部技能:'));
|
|
2081
|
-
for (const name of externalSkills) {
|
|
2082
|
-
const skillDef = knownSkills.find(s => s.name === name);
|
|
2083
|
-
if (skillDef) {
|
|
2084
|
-
try {
|
|
2085
|
-
await installExternalSkill(skillDef, canonicalPlatform, projectRoot, dryRun, resolvedAiCli);
|
|
2086
|
-
console.log(chalk.green(` ✓ ${name} (external)`));
|
|
2087
|
-
} catch (e) {
|
|
2088
|
-
console.log(chalk.yellow(` ⚠ ${name} 安装失败,跳过: ${e.message}`));
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
if (!dryRun) {
|
|
2093
|
-
await cleanExternalSkillArtifacts(projectRoot, canonicalPlatform, resolvedAiCli);
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
// 10. Extras (external tools via registry)
|
|
1858
|
+
// 9. Extras (external tools via registry)
|
|
2098
1859
|
const activeExtras = [];
|
|
2099
1860
|
if (playwrightCli) {
|
|
2100
1861
|
activeExtras.push('playwright-cli');
|
|
@@ -2102,16 +1863,8 @@ export async function scaffold(config) {
|
|
|
2102
1863
|
await installPlaywrightCli(projectRoot, dryRun, { platform: canonicalPlatform, aiCli: resolvedAiCli });
|
|
2103
1864
|
console.log('');
|
|
2104
1865
|
}
|
|
2105
|
-
if (openCli) {
|
|
2106
|
-
activeExtras.push('opencli');
|
|
2107
|
-
console.log(chalk.blue(` ${EXTRAS_REGISTRY['opencli'].label}:`));
|
|
2108
|
-
await installOpenCli(projectRoot, dryRun, openCliAutoDownload);
|
|
2109
|
-
console.log('');
|
|
2110
|
-
}
|
|
2111
1866
|
|
|
2112
|
-
//
|
|
2113
|
-
// when installing for Claude Code only. CodeBuddy files should never appear in a
|
|
2114
|
-
// claude-only install.
|
|
1867
|
+
// 10. Clean up empty stray .codebuddy/ directory when CodeBuddy is not a payload platform.
|
|
2115
1868
|
if (!dryRun && !payloadPlatforms.includes('codebuddy')) {
|
|
2116
1869
|
const strayCbDir = path.join(projectRoot, '.codebuddy');
|
|
2117
1870
|
if (await fs.pathExists(strayCbDir)) {
|
|
@@ -2122,30 +1875,29 @@ export async function scaffold(config) {
|
|
|
2122
1875
|
}
|
|
2123
1876
|
}
|
|
2124
1877
|
|
|
2125
|
-
//
|
|
1878
|
+
// 11. Git pre-commit hook
|
|
2126
1879
|
console.log(chalk.blue(' Git Hook:'));
|
|
2127
1880
|
await installGitHook(projectRoot, dryRun, runtime);
|
|
2128
1881
|
|
|
2129
|
-
//
|
|
1882
|
+
// 12. PrizmKit scripts
|
|
2130
1883
|
console.log(chalk.blue(' PrizmKit 脚本:'));
|
|
2131
1884
|
await installPrizmkitScripts(projectRoot, dryRun, runtime);
|
|
2132
1885
|
|
|
2133
|
-
//
|
|
1886
|
+
// 13. Write installation manifest
|
|
2134
1887
|
if (!dryRun) {
|
|
2135
1888
|
const rulesMeta = await loadRulesMetadata();
|
|
2136
|
-
const
|
|
2137
|
-
const ruleFileNames = resolveRuleNamesForRuntime(rulesMeta, rulesPresetName, runtime).map(name => `${name}.md`);
|
|
1889
|
+
const ruleFileNames = resolveRuleNamesForRuntime(rulesMeta, runtime).map(name => `${name}.md`);
|
|
2138
1890
|
|
|
2139
1891
|
const manifest = buildManifest({
|
|
2140
1892
|
version: scaffoldPkg.version,
|
|
2141
1893
|
platform: canonicalPlatform,
|
|
2142
1894
|
runtime,
|
|
2143
|
-
suite:
|
|
1895
|
+
suite: normalizedSuite,
|
|
2144
1896
|
skills: skillList,
|
|
2145
1897
|
rules: ruleFileNames,
|
|
2146
1898
|
pipeline: installedPipelineFiles,
|
|
2147
1899
|
aiCli: resolvedAiCli,
|
|
2148
|
-
rulesPreset:
|
|
1900
|
+
rulesPreset: 'recommended',
|
|
2149
1901
|
extras: activeExtras,
|
|
2150
1902
|
payloadPlatforms,
|
|
2151
1903
|
});
|
|
@@ -2193,21 +1945,16 @@ export async function scaffold(config) {
|
|
|
2193
1945
|
console.log('');
|
|
2194
1946
|
|
|
2195
1947
|
// 安装统计
|
|
2196
|
-
const suiteLabel = skills === 'core' ? `核心 ${skillList.length} 个`
|
|
2197
|
-
: skills === 'minimal' ? `最小 ${skillList.length} 个`
|
|
2198
|
-
: `推荐 ${skillList.length} 个`;
|
|
2199
|
-
|
|
2200
1948
|
console.log(chalk.gray(` 安装统计:`));
|
|
2201
|
-
console.log(chalk.gray(` 技能: ${
|
|
1949
|
+
console.log(chalk.gray(` 技能: 核心 ${skillList.length} 个`));
|
|
2202
1950
|
console.log(chalk.gray(` 平台: ${platforms.map(platformLabel).join(' + ')}`));
|
|
2203
1951
|
if (payloadPlatforms.length !== platforms.length || payloadPlatforms.some(p => !platforms.includes(p))) {
|
|
2204
1952
|
console.log(chalk.gray(` AI CLI 载荷平台: ${payloadPlatforms.map(platformLabel).join(' + ')}`));
|
|
2205
1953
|
}
|
|
2206
1954
|
console.log(chalk.gray(` 运行时: ${runtimeLabel(runtime)}`));
|
|
2207
1955
|
console.log(chalk.gray(` 流水线: ${pipeline ? '已安装' : '未安装'}`));
|
|
2208
|
-
|
|
2209
|
-
console.log(chalk.gray(`
|
|
2210
|
-
console.log(chalk.gray(` 规则: ${rules || 'recommended'}`));
|
|
1956
|
+
console.log(chalk.gray(` 浏览器工具: ${playwrightCli ? '已安装 (playwright-cli)' : '未安装'}`));
|
|
1957
|
+
console.log(chalk.gray(` 规则: 全部内置规则`));
|
|
2211
1958
|
if (resolvedAiCli) console.log(chalk.gray(` AI CLI: ${resolvedAiCli}`));
|
|
2212
1959
|
console.log('');
|
|
2213
1960
|
}
|
package/src/upgrade.js
CHANGED
|
@@ -15,7 +15,6 @@ import { confirm } from '@inquirer/prompts';
|
|
|
15
15
|
|
|
16
16
|
import { readManifestForLifecycle, writeManifest, buildManifest, diffManifest } from './manifest.js';
|
|
17
17
|
import {
|
|
18
|
-
loadMetadata,
|
|
19
18
|
loadRulesMetadata,
|
|
20
19
|
} from './metadata.js';
|
|
21
20
|
import {
|
|
@@ -33,27 +32,12 @@ import {
|
|
|
33
32
|
removeRetiredAgentTeamArtifacts,
|
|
34
33
|
EXTRAS_REGISTRY,
|
|
35
34
|
} from './scaffold.js';
|
|
36
|
-
import { canonicalizePlatformSelection, expandPlatforms, isKnownPlatform,
|
|
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));
|
|
40
39
|
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
41
40
|
|
|
42
|
-
/**
|
|
43
|
-
* Discover external Skill trees this installation already owns. Presence in a
|
|
44
|
-
* payload skill root is the only signal available: third-party Skill repos
|
|
45
|
-
* publish no version metadata, so the refresh always fetches upstream HEAD.
|
|
46
|
-
*/
|
|
47
|
-
async function resolveInstalledExternalSkills(projectRoot, payloadPlatforms) {
|
|
48
|
-
const metadata = await loadMetadata();
|
|
49
|
-
const known = metadata.external_skills?.known || [];
|
|
50
|
-
if (known.length === 0) return [];
|
|
51
|
-
const roots = payloadPlatforms.map(p => nativeSkillRoot(p, projectRoot));
|
|
52
|
-
return known.filter(skillDef => roots.some(
|
|
53
|
-
root => fs.pathExistsSync(path.join(root, skillDef.name, 'SKILL.md')),
|
|
54
|
-
));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
41
|
/**
|
|
58
42
|
* Remove skill files for a specific platform.
|
|
59
43
|
*/
|
|
@@ -335,11 +319,11 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
335
319
|
} catch { /* ignore corrupt config */ }
|
|
336
320
|
}
|
|
337
321
|
|
|
338
|
-
// 3. Resolve new skill list
|
|
339
|
-
const suite =
|
|
322
|
+
// 3. Resolve new skill list and built-in rules (migrating legacy minimal suites/presets)
|
|
323
|
+
const suite = 'core';
|
|
340
324
|
const runtime = normalizeRuntime(oldManifest?.runtime);
|
|
341
325
|
const pipeline = oldManifest?.options?.pipeline ?? true;
|
|
342
|
-
const rulesPreset =
|
|
326
|
+
const rulesPreset = 'recommended';
|
|
343
327
|
const aiCli = userConfig.ai_cli || oldManifest?.options?.aiCli || '';
|
|
344
328
|
|
|
345
329
|
// Platform detection: manifest is the source of truth (set by install/config).
|
|
@@ -383,9 +367,9 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
383
367
|
: 'claude';
|
|
384
368
|
}
|
|
385
369
|
|
|
386
|
-
const newSkillList = await resolveSkillList(
|
|
370
|
+
const newSkillList = await resolveSkillList();
|
|
387
371
|
const rulesMeta = await loadRulesMetadata();
|
|
388
|
-
const newRuleFiles = resolveRuleNamesForRuntime(rulesMeta,
|
|
372
|
+
const newRuleFiles = resolveRuleNamesForRuntime(rulesMeta, runtime).map(name => `${name}.md`);
|
|
389
373
|
|
|
390
374
|
// Resolve pipeline file list from source (for manifest diff)
|
|
391
375
|
const newPipelineFiles = pipeline ? resolvePipelineFileList(runtime) : [];
|
|
@@ -509,7 +493,7 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
509
493
|
|
|
510
494
|
// Settings/Rules
|
|
511
495
|
console.log(chalk.blue('\n Settings & Rules:'));
|
|
512
|
-
await installSettings(p, projectRoot, {
|
|
496
|
+
await installSettings(p, projectRoot, {}, dryRun, runtime);
|
|
513
497
|
|
|
514
498
|
console.log('');
|
|
515
499
|
}
|
|
@@ -532,22 +516,6 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
532
516
|
}
|
|
533
517
|
}
|
|
534
518
|
|
|
535
|
-
// External Skills have no version metadata: refresh the installed trees from upstream
|
|
536
|
-
const externalSkillDefs = await resolveInstalledExternalSkills(projectRoot, payloadPlatforms);
|
|
537
|
-
if (externalSkillDefs.length > 0) {
|
|
538
|
-
const { installExternalSkill } = await import('./external-skills.js');
|
|
539
|
-
console.log(chalk.blue(' External Skills:'));
|
|
540
|
-
for (const skillDef of externalSkillDefs) {
|
|
541
|
-
try {
|
|
542
|
-
await installExternalSkill(skillDef, platform, projectRoot, dryRun, aiCli);
|
|
543
|
-
console.log(chalk.green(` ✓ ${skillDef.name} (refreshed)`));
|
|
544
|
-
} catch (e) {
|
|
545
|
-
console.log(chalk.yellow(` ⚠ ${skillDef.name} refresh skipped: ${e.message}`));
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
console.log('');
|
|
549
|
-
}
|
|
550
|
-
|
|
551
519
|
// Git hook
|
|
552
520
|
console.log(chalk.blue(' Git Hook:'));
|
|
553
521
|
await installGitHook(projectRoot, dryRun, runtime);
|