shoplazza-ai-dev-cli 0.1.19 → 0.1.20
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/dist/_chunks/test.mjs +1 -0
- package/dist/cli.mjs +70 -1
- package/package.json +1 -1
package/dist/_chunks/test.mjs
CHANGED
|
@@ -1109,6 +1109,7 @@ async function get(client, args, json) {
|
|
|
1109
1109
|
console.log(`\n Cases (${cases.length}):`);
|
|
1110
1110
|
for (const c of cases) {
|
|
1111
1111
|
const marks = [];
|
|
1112
|
+
if (c["status"] === "deprecated") marks.push("已废弃 · 不计入进度");
|
|
1112
1113
|
if (c["in_source_set"] === false) marks.push("已离开来源集");
|
|
1113
1114
|
if (c["content_updated"] === true) marks.push(`正文已更新 v${c["case_version_at_add"]}→v${c["current_version"]}`);
|
|
1114
1115
|
const suffix = marks.length ? ` [${marks.join(" · ")}]` : "";
|
package/dist/cli.mjs
CHANGED
|
@@ -2521,6 +2521,28 @@ async function installFromExtracted(ref, extractedDir, opts, commitSha) {
|
|
|
2521
2521
|
const pluginCanonical = join(storeRoot, "plugins", `${scopeNamespace}__${pluginName}`);
|
|
2522
2522
|
const components = await classifyExtracted(extractedDir);
|
|
2523
2523
|
const ignoredComponents = await collectIgnoredTopLevel(extractedDir);
|
|
2524
|
+
if (opts.agents.length > 0 && opts.agents.every((a) => a === "claude-code")) {
|
|
2525
|
+
const unchanged = await findUnchangedInstall({
|
|
2526
|
+
ref,
|
|
2527
|
+
pluginName,
|
|
2528
|
+
extractedDir,
|
|
2529
|
+
pluginCanonical,
|
|
2530
|
+
claudeHome: getAgentHome("claude-code"),
|
|
2531
|
+
commitSha,
|
|
2532
|
+
force: opts.force
|
|
2533
|
+
});
|
|
2534
|
+
if (unchanged) return {
|
|
2535
|
+
pluginRef: ref,
|
|
2536
|
+
pluginCanonical,
|
|
2537
|
+
installedComponents: unchanged.installedComponents,
|
|
2538
|
+
installedEntries: [],
|
|
2539
|
+
forgeOtherReplacements: [],
|
|
2540
|
+
ignoredComponents,
|
|
2541
|
+
warnings: [],
|
|
2542
|
+
registrationFailed: false,
|
|
2543
|
+
unchanged: true
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2524
2546
|
const preflight = buildPreflightList(pluginCanonical, components, opts);
|
|
2525
2547
|
const foreignConflicts = [];
|
|
2526
2548
|
const forgeOtherReplacements = [];
|
|
@@ -2727,6 +2749,53 @@ function componentSubRef$1(c) {
|
|
|
2727
2749
|
case "plugin-rule-deps-dir": return `rules/${c.dirname}`;
|
|
2728
2750
|
}
|
|
2729
2751
|
}
|
|
2752
|
+
async function findUnchangedInstall(params) {
|
|
2753
|
+
if (params.force) return null;
|
|
2754
|
+
let version;
|
|
2755
|
+
try {
|
|
2756
|
+
version = await resolvePluginVersion(params.extractedDir, params.pluginName);
|
|
2757
|
+
} catch {
|
|
2758
|
+
return null;
|
|
2759
|
+
}
|
|
2760
|
+
const entry = (await readJsonOrNull(join(params.claudeHome, "plugins", "installed_plugins.json")))?.plugins?.[`${params.pluginName}@${MARKETPLACE}`]?.[0];
|
|
2761
|
+
if (!entry?.installPath || entry.version !== version) return null;
|
|
2762
|
+
if (params.commitSha && entry.gitCommitSha && params.commitSha !== entry.gitCommitSha) return null;
|
|
2763
|
+
const ledger = await readJsonOrNull(join(params.pluginCanonical, ".forge-plugin.json"));
|
|
2764
|
+
if (!ledger || ledger.ref !== params.ref) return null;
|
|
2765
|
+
if (!await cacheDirIntact(params.extractedDir, entry.installPath)) return null;
|
|
2766
|
+
return {
|
|
2767
|
+
version,
|
|
2768
|
+
installPath: entry.installPath,
|
|
2769
|
+
installedComponents: ledger.installed_components ?? []
|
|
2770
|
+
};
|
|
2771
|
+
}
|
|
2772
|
+
const CACHE_SKIPPED_TOP_LEVEL = new Set([
|
|
2773
|
+
".cursor-plugin",
|
|
2774
|
+
".codex-plugin",
|
|
2775
|
+
"hooks-cursor.json",
|
|
2776
|
+
"hooks-codex.json"
|
|
2777
|
+
]);
|
|
2778
|
+
async function cacheDirIntact(extractedDir, installPath) {
|
|
2779
|
+
if (!existsSync(installPath)) return false;
|
|
2780
|
+
let entries;
|
|
2781
|
+
try {
|
|
2782
|
+
entries = await readdir(extractedDir);
|
|
2783
|
+
} catch {
|
|
2784
|
+
return false;
|
|
2785
|
+
}
|
|
2786
|
+
for (const name of entries) {
|
|
2787
|
+
if (CACHE_SKIPPED_TOP_LEVEL.has(name)) continue;
|
|
2788
|
+
if (!existsSync(join(installPath, name))) return false;
|
|
2789
|
+
}
|
|
2790
|
+
return true;
|
|
2791
|
+
}
|
|
2792
|
+
async function readJsonOrNull(path) {
|
|
2793
|
+
try {
|
|
2794
|
+
return JSON.parse(await readFile(path, "utf-8"));
|
|
2795
|
+
} catch {
|
|
2796
|
+
return null;
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2730
2799
|
async function resolvePluginVersion(pluginCanonical, pluginName) {
|
|
2731
2800
|
for (const manifestPath of [join(pluginCanonical, "plugin.json"), join(pluginCanonical, ".claude-plugin", "plugin.json")]) try {
|
|
2732
2801
|
const manifest = JSON.parse(await readFile(manifestPath, "utf-8"));
|
|
@@ -4459,7 +4528,7 @@ async function runAdd(args, options = {}) {
|
|
|
4459
4528
|
spinner.stop(import_picocolors.default.red("Plugin installation failed"));
|
|
4460
4529
|
throw err;
|
|
4461
4530
|
}
|
|
4462
|
-
spinner.stop(import_picocolors.default.green("Plugin installed"));
|
|
4531
|
+
spinner.stop(pluginResult.unchanged ? import_picocolors.default.green("Plugin already up to date (same version installed, nothing rewritten)") : import_picocolors.default.green("Plugin installed"));
|
|
4463
4532
|
if (pluginResult.warnings.length > 0) for (const w of pluginResult.warnings) M.warn(w);
|
|
4464
4533
|
if (pluginResult.registrationFailed) {
|
|
4465
4534
|
M.error(import_picocolors.default.red("Claude native plugin registration failed"));
|