@c4a/context-cli 0.6.0-beta.2 → 0.6.0-beta.3

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/cli.js CHANGED
@@ -72320,6 +72320,17 @@ async function runExternalOptional(command, args2) {
72320
72320
  async function commandAvailable(command) {
72321
72321
  return runExternalOptional("sh", ["-lc", `command -v ${command} >/dev/null 2>&1`]);
72322
72322
  }
72323
+ async function claudePluginInstalled() {
72324
+ try {
72325
+ const { stdout } = await execFileAsync5("claude", ["plugin", "list", "--json"], {
72326
+ maxBuffer: 1024 * 1024
72327
+ });
72328
+ const parsed = JSON.parse(stdout);
72329
+ return Array.isArray(parsed) && parsed.some((item) => item !== null && typeof item === "object" && ("id" in item) && item.id === PLUGIN_ID);
72330
+ } catch {
72331
+ return false;
72332
+ }
72333
+ }
72323
72334
  function missingAgentResult(agent) {
72324
72335
  return {
72325
72336
  agent,
@@ -72503,6 +72514,24 @@ async function pruneClaudeLegacyPluginCache(dryRun, steps) {
72503
72514
  });
72504
72515
  }
72505
72516
  }
72517
+ async function pruneClaudeSupersededContextCache(root2, dryRun, steps) {
72518
+ const manifest = await readFile31(join44(root2, "claude", ".claude-plugin", "plugin.json"), "utf8").then((content3) => JSON.parse(content3)).catch(() => null);
72519
+ const currentVersion = typeof manifest?.version === "string" ? manifest.version : null;
72520
+ if (!currentVersion)
72521
+ return;
72522
+ const pluginDir = join44(claudePluginCacheRoot(), MARKETPLACE_NAME, PLUGIN_NAME);
72523
+ const staleVersions = (await readdir15(pluginDir, { withFileTypes: true }).catch(() => [])).filter((entry) => entry.isDirectory() && entry.name !== currentVersion).map((entry) => entry.name);
72524
+ if (staleVersions.length === 0)
72525
+ return;
72526
+ steps.push({
72527
+ agent: "claude",
72528
+ command: `prune superseded Claude ${MARKETPLACE_NAME}/${PLUGIN_NAME} version(s): ${staleVersions.join(", ")}`,
72529
+ status: dryRun ? "planned" : "ran"
72530
+ });
72531
+ if (!dryRun) {
72532
+ await Promise.all(staleVersions.map((version3) => rm10(join44(pluginDir, version3), { recursive: true, force: true })));
72533
+ }
72534
+ }
72506
72535
  function enableCodexPluginConfig(content3) {
72507
72536
  const header = `[plugins."${PLUGIN_ID}"]`;
72508
72537
  const blockStart = content3.indexOf(header);
@@ -72604,14 +72633,22 @@ async function installClaude(root2, dryRun, steps) {
72604
72633
  const addArgs = ["plugin", "marketplace", "add", root2];
72605
72634
  const installArgs = ["plugin", "install", PLUGIN_ID, "--scope", "user"];
72606
72635
  steps.push({ agent: "claude", command: commandLine("claude", addArgs), status: dryRun ? "planned" : "ran" });
72607
- steps.push({ agent: "claude", command: commandLine("claude", installArgs), status: dryRun ? "planned" : "ran" });
72608
- if (dryRun)
72636
+ if (dryRun) {
72637
+ steps.push({ agent: "claude", command: commandLine("claude", installArgs), status: "planned" });
72609
72638
  return;
72639
+ }
72610
72640
  const added = await runExternalOptional("claude", addArgs);
72611
72641
  if (!added) {
72612
72642
  await runExternal("claude", ["plugin", "marketplace", "update", MARKETPLACE_NAME]);
72613
72643
  }
72644
+ if (await claudePluginInstalled()) {
72645
+ const uninstallArgs = ["plugin", "uninstall", PLUGIN_ID, "--scope", "user"];
72646
+ steps.push({ agent: "claude", command: commandLine("claude", uninstallArgs), status: "ran" });
72647
+ await runExternal("claude", uninstallArgs);
72648
+ }
72649
+ steps.push({ agent: "claude", command: commandLine("claude", installArgs), status: "ran" });
72614
72650
  await runExternal("claude", installArgs);
72651
+ await pruneClaudeSupersededContextCache(root2, dryRun, steps);
72615
72652
  }
72616
72653
  async function installCodex(root2, dryRun, steps) {
72617
72654
  await pruneLegacyCodexConfig(dryRun, steps);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@c4a/context-cli",
3
- "version": "0.6.0-beta.2",
3
+ "version": "0.6.0-beta.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "context": "./cli.js"
7
7
  },
8
8
  "dependencies": {
9
- "@c4a/context": "0.6.0-beta.2",
9
+ "@c4a/context": "0.6.0-beta.3",
10
10
  "commander": "^11.0.0",
11
11
  "handlebars": "^4.7.8",
12
12
  "ink": "^5.0.0",
package/plugins/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0-beta.2
1
+ 0.6.0-beta.3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "context",
3
3
  "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
4
- "version": "0.6.0-beta.2",
4
+ "version": "0.6.0-beta.3",
5
5
  "author": {
6
6
  "name": "c4a"
7
7
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context",
3
- "version": "0.6.0-beta.2",
3
+ "version": "0.6.0-beta.3",
4
4
  "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
5
5
  "author": {
6
6
  "name": "c4a"
@@ -18,7 +18,7 @@
18
18
  "skills": "./skills/",
19
19
  "interface": {
20
20
  "displayName": "C4A Context",
21
- "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv0.6.0-beta.2",
21
+ "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv0.6.0-beta.3",
22
22
  "longDescription": "Create a Context workspace and use agent-guided next steps to register sources, run extraction, review candidates, build package outputs, and verify health without silently mutating source repositories.",
23
23
  "developerName": "c4a",
24
24
  "category": "Productivity",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "context",
3
3
  "displayName": "C4A Context",
4
- "version": "0.6.0-beta.2",
4
+ "version": "0.6.0-beta.3",
5
5
  "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
6
6
  "author": {
7
7
  "name": "Context4AI",