harnessed 4.39.0 → 4.40.0

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/cli.mjs CHANGED
@@ -38,7 +38,7 @@ var init_package = __esm({
38
38
  "package.json"() {
39
39
  package_default = {
40
40
  name: "harnessed",
41
- version: "4.39.0",
41
+ version: "4.40.0",
42
42
  description: "AI coding harness package manager + composition orchestrator",
43
43
  type: "module",
44
44
  license: "Apache-2.0",
@@ -5947,14 +5947,30 @@ async function pathExists(p7) {
5947
5947
  return false;
5948
5948
  }
5949
5949
  }
5950
- async function checkEcc() {
5950
+ function codexPluginPresent() {
5951
+ try {
5952
+ const r = spawnSync(process.platform === "win32" ? "codex.cmd" : "codex", ["plugin", "list"], {
5953
+ encoding: "utf8",
5954
+ timeout: 1e4,
5955
+ windowsHide: true
5956
+ });
5957
+ if (r.error || r.status !== 0) return false;
5958
+ return /\becc\b/.test(`${r.stdout ?? ""}`);
5959
+ } catch {
5960
+ return false;
5961
+ }
5962
+ }
5963
+ async function checkEcc(deps) {
5964
+ const probeCodexPlugin = deps?.codexPluginPresent ?? codexPluginPresent;
5951
5965
  const cdt = await probeChromeDevtools();
5952
5966
  const ccInstalled = cdt.ecc;
5953
5967
  const codexHome = join(homedir(), ".codex");
5954
5968
  const codexPresent = await pathExists(join(codexHome, "config.toml"));
5955
- const codexInstalled = codexPresent && await pathExists(join(codexHome, ".cache", "ecc", ".git"));
5969
+ const codexLegacy = codexPresent && await pathExists(join(codexHome, ".cache", "ecc", ".git"));
5970
+ const codexNative = codexPresent && !codexLegacy && probeCodexPlugin();
5971
+ const codexInstalled = codexLegacy || codexNative;
5956
5972
  const ccPart = ccInstalled ? "CC: installed (plugin ecc@ecc)" : "CC: not installed";
5957
- const codexPart = codexPresent ? codexInstalled ? "codex: installed (~/.codex/.cache/ecc sync clone)" : "codex: not installed" : "codex: not present (no ~/.codex/config.toml)";
5973
+ const codexPart = codexPresent ? codexInstalled ? codexNative ? "codex: installed (native plugin ecc@ecc)" : "codex: installed (legacy ~/.codex/.cache/ecc sync clone \u2014 upstream deprecated it in 2.2; migrate with `node scripts/ecc.js uninstall --legacy-codex-sync` then `codex plugin marketplace add affaan-m/ECC && codex plugin add ecc@ecc`)" : "codex: not installed" : "codex: not present (no ~/.codex/config.toml)";
5958
5974
  if (ccInstalled) {
5959
5975
  const leftovers = [];
5960
5976
  const fixes = [];
@@ -6052,6 +6068,138 @@ var init_check_inject_invalidate = __esm({
6052
6068
  }
6053
6069
  });
6054
6070
 
6071
+ // src/cli/lib/check-plugin-staleness.ts
6072
+ var check_plugin_staleness_exports = {};
6073
+ __export(check_plugin_staleness_exports, {
6074
+ checkPluginStaleness: () => checkPluginStaleness
6075
+ });
6076
+ function defaultDeps3() {
6077
+ return {
6078
+ assetsRoot: getAssetsRoot(),
6079
+ registryPath: getPluginsRegistry(),
6080
+ readText: (p7) => {
6081
+ try {
6082
+ return readFileSync(p7, "utf8");
6083
+ } catch {
6084
+ return null;
6085
+ }
6086
+ },
6087
+ listDir: (p7) => {
6088
+ try {
6089
+ return readdirSync(p7);
6090
+ } catch {
6091
+ return null;
6092
+ }
6093
+ },
6094
+ isDir: (p7) => {
6095
+ try {
6096
+ return statSync(p7).isDirectory();
6097
+ } catch {
6098
+ return false;
6099
+ }
6100
+ }
6101
+ };
6102
+ }
6103
+ function collectPluginManifests(deps) {
6104
+ const out = [];
6105
+ const root = join(deps.assetsRoot, "manifests");
6106
+ const walk = (dir) => {
6107
+ const entries = deps.listDir(dir);
6108
+ if (entries === null) return;
6109
+ for (const entry of entries) {
6110
+ const full = join(dir, entry);
6111
+ if (deps.isDir(full)) {
6112
+ walk(full);
6113
+ continue;
6114
+ }
6115
+ if (!entry.endsWith(".yaml") || entry.endsWith(".zh-Hans.yaml")) continue;
6116
+ const raw = deps.readText(full);
6117
+ if (raw === null) continue;
6118
+ let doc;
6119
+ try {
6120
+ doc = parse(raw);
6121
+ } catch {
6122
+ continue;
6123
+ }
6124
+ const d = doc;
6125
+ if (d.spec?.install?.method !== "cc-plugin-marketplace") continue;
6126
+ const name = d.metadata?.name;
6127
+ const recorded = d.spec?.upstream_health?.last_known_good_version;
6128
+ if (typeof name !== "string" || typeof recorded !== "string") continue;
6129
+ out.push({ name, recorded });
6130
+ }
6131
+ };
6132
+ walk(root);
6133
+ return out;
6134
+ }
6135
+ function readInstalledVersions(deps, registryPath) {
6136
+ const raw = deps.readText(registryPath);
6137
+ if (raw === null) return null;
6138
+ let parsed;
6139
+ try {
6140
+ parsed = JSON.parse(raw);
6141
+ } catch {
6142
+ return null;
6143
+ }
6144
+ const plugins = parsed.plugins;
6145
+ if (!plugins || typeof plugins !== "object") return null;
6146
+ const map = /* @__PURE__ */ new Map();
6147
+ for (const [key, value] of Object.entries(plugins)) {
6148
+ const pluginName = key.split("@")[0];
6149
+ if (!pluginName || !Array.isArray(value)) continue;
6150
+ for (const entry of value) {
6151
+ const v = entry?.version;
6152
+ if (typeof v === "string" && v.length > 0) {
6153
+ map.set(pluginName, v);
6154
+ break;
6155
+ }
6156
+ }
6157
+ }
6158
+ return map;
6159
+ }
6160
+ function checkPluginStaleness(overrides) {
6161
+ const deps = { ...defaultDeps3(), ...overrides };
6162
+ if (deps.registryPath === null) {
6163
+ return { name: NAME4, status: "pass", message: "no plugin registry on this harness" };
6164
+ }
6165
+ const installed = readInstalledVersions(deps, deps.registryPath);
6166
+ if (installed === null) {
6167
+ return { name: NAME4, status: "pass", message: "plugin registry unreadable \u2014 skipped" };
6168
+ }
6169
+ const manifests = collectPluginManifests(deps);
6170
+ const behind = [];
6171
+ let compared = 0;
6172
+ for (const m of manifests) {
6173
+ const have = installed.get(m.name);
6174
+ if (have === void 0) continue;
6175
+ compared += 1;
6176
+ if (compareVersions(have, m.recorded) === "behind") {
6177
+ behind.push(`${m.name} ${have} \u2192 ${m.recorded}`);
6178
+ }
6179
+ }
6180
+ if (compared === 0) {
6181
+ return { name: NAME4, status: "pass", message: "no marketplace plugins installed" };
6182
+ }
6183
+ if (behind.length === 0) {
6184
+ return { name: NAME4, status: "pass", message: `${compared} marketplace plugin(s) current` };
6185
+ }
6186
+ return {
6187
+ name: NAME4,
6188
+ status: "warn",
6189
+ message: `${behind.length}/${compared} marketplace plugin(s) behind the version harnessed verified: ${behind.join(", ")} \u2014 \`claude plugin install\` pins a version at install time and never re-resolves`,
6190
+ fix: `claude plugin update ${behind.map((b) => b.split(" ")[0]).join(" && claude plugin update ")}`
6191
+ };
6192
+ }
6193
+ var NAME4;
6194
+ var init_check_plugin_staleness = __esm({
6195
+ "src/cli/lib/check-plugin-staleness.ts"() {
6196
+ init_assetsRoot();
6197
+ init_platform();
6198
+ init_version_check();
6199
+ NAME4 = "plugin install freshness";
6200
+ }
6201
+ });
6202
+
6055
6203
  // src/cli/lib/doctor-registry.ts
6056
6204
  var CHECKS;
6057
6205
  var init_doctor_registry = __esm({
@@ -6107,7 +6255,13 @@ var init_doctor_registry = __esm({
6107
6255
  // 4.38.0 — half-installed per-turn injection (warn-only): perturn-inject
6108
6256
  // without perturn-inject-invalidate keeps skipping <project-context> after a
6109
6257
  // compact/clear has already dropped the copy it is skipping on behalf of.
6110
- async () => (await Promise.resolve().then(() => (init_check_inject_invalidate(), check_inject_invalidate_exports))).checkInjectInvalidate()
6258
+ async () => (await Promise.resolve().then(() => (init_check_inject_invalidate(), check_inject_invalidate_exports))).checkInjectInvalidate(),
6259
+ // Phase 56 — silently stale marketplace plugins (warn-only): `claude plugin
6260
+ // install` pins a version into a versioned cache dir and never re-resolves, so
6261
+ // the four cc-plugin-marketplace components drift behind without any signal.
6262
+ // The only comparison in the codebase between a genuinely DETECTED version and
6263
+ // a recorded one — see the header for why the installer-state layer cannot do it.
6264
+ async () => (await Promise.resolve().then(() => (init_check_plugin_staleness(), check_plugin_staleness_exports))).checkPluginStaleness()
6111
6265
  ];
6112
6266
  }
6113
6267
  });
@@ -9174,7 +9328,7 @@ var release_preflight_exports = {};
9174
9328
  __export(release_preflight_exports, {
9175
9329
  anyFailed: () => anyFailed,
9176
9330
  collectPreflight: () => collectPreflight,
9177
- defaultDeps: () => defaultDeps3
9331
+ defaultDeps: () => defaultDeps4
9178
9332
  });
9179
9333
  function unreleasedSection(changelog) {
9180
9334
  const start = changelog.indexOf("## [Unreleased]");
@@ -9229,7 +9383,7 @@ function collectPreflight(deps) {
9229
9383
  function anyFailed(checks) {
9230
9384
  return checks.some((c) => c.status === "fail");
9231
9385
  }
9232
- function defaultDeps3(cwd) {
9386
+ function defaultDeps4(cwd) {
9233
9387
  let changelog = "";
9234
9388
  let version = "";
9235
9389
  try {
@@ -10674,7 +10828,7 @@ init_i18n();
10674
10828
  init_doctor_registry();
10675
10829
  function registerDoctor(program2) {
10676
10830
  program2.command("doctor").description(
10677
- "Preflight checks (Node / MCP scope / jq / Win bash / origin URL / gstack prefix / deprecations / token budget / Agent Teams / planning-with-files / mattpocock-skills / MCP availability / ECC)"
10831
+ "Preflight checks (Node / MCP scope / jq / Win bash / origin URL / gstack prefix / deprecations / token budget / Agent Teams / planning-with-files / mattpocock-skills / MCP availability / ECC / plugin freshness)"
10678
10832
  ).option("--json", "output JSON instead of human-readable").action(async (opts) => {
10679
10833
  const settled = await Promise.allSettled(CHECKS.map((c) => c()));
10680
10834
  const results = settled.map(
@@ -13479,8 +13633,8 @@ function registerReleasePreflight(program2) {
13479
13633
  program2.command("release-preflight").description(
13480
13634
  "Read-only release-readiness gate (CHANGELOG / version / git-clean / tag). Exits 1 if not ready."
13481
13635
  ).action(async () => {
13482
- const { collectPreflight: collectPreflight2, anyFailed: anyFailed2, defaultDeps: defaultDeps4 } = await Promise.resolve().then(() => (init_release_preflight(), release_preflight_exports));
13483
- const checks = collectPreflight2(defaultDeps4(process.cwd()));
13636
+ const { collectPreflight: collectPreflight2, anyFailed: anyFailed2, defaultDeps: defaultDeps5 } = await Promise.resolve().then(() => (init_release_preflight(), release_preflight_exports));
13637
+ const checks = collectPreflight2(defaultDeps5(process.cwd()));
13484
13638
  console.log("\n release preflight (read-only \u2014 nothing is pushed/published):\n");
13485
13639
  for (const c of checks) {
13486
13640
  const mark = c.status === "pass" ? "\u2713" : c.status === "warn" ? "\u26A0" : "\u2717";
@@ -14293,7 +14447,7 @@ var V3_4_3_SIGNATURE_MASTER_RX = /\*\*Preferred path\*\*[\s\S]*dispatch to the p
14293
14447
  function shouldOverwriteFile(content) {
14294
14448
  return HARNESSED_MARKER_RX2.test(content) || V3_4_3_SIGNATURE_SUB_RX.test(content) || V3_4_3_SIGNATURE_MASTER_RX.test(content);
14295
14449
  }
14296
- async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync24 = (p7) => readFileSync(p7, "utf8")) {
14450
+ async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync25 = (p7) => readFileSync(p7, "utf8")) {
14297
14451
  const results = [];
14298
14452
  const aggregatedWarnings = /* @__PURE__ */ new Set();
14299
14453
  for (const name of slashNames) {
@@ -14312,7 +14466,7 @@ async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabiliti
14312
14466
  if (fileExists2(path)) {
14313
14467
  let existing = "";
14314
14468
  try {
14315
- existing = readFileSync24(path);
14469
+ existing = readFileSync25(path);
14316
14470
  } catch {
14317
14471
  existing = "";
14318
14472
  }