create-principles-disciple 1.153.3 → 1.153.4

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.
@@ -3790,6 +3790,20 @@ export async function ensureOpenClawWorkspaceDeclaration(workspaceDir, channels)
3790
3790
  await fse.writeJson(inspection.configPath, config, { spaces: 2 });
3791
3791
  return { configPath: inspection.configPath, action: 'created' };
3792
3792
  }
3793
+ /**
3794
+ * Collect every non-empty `warnings` array from the hosts this run touched —
3795
+ * the requested host AND the sibling refresh results. The refresh set matters:
3796
+ * it is exactly the path that used to leave WorkBuddy silently un-rebound.
3797
+ */
3798
+ export function collectHostWarnings(results) {
3799
+ const records = [];
3800
+ for (const result of results) {
3801
+ const warnings = (result.warnings ?? []).filter((warning) => warning.trim().length > 0);
3802
+ if (warnings.length > 0)
3803
+ records.push({ hostId: result.hostId, warnings });
3804
+ }
3805
+ return records;
3806
+ }
3793
3807
  /**
3794
3808
  * Marketplace contract (2026-11-07): partition host installer results into
3795
3809
  * REAL failures and pending MANUAL actions (e.g. the Codex Marketplace
@@ -4654,6 +4668,13 @@ transaction) {
4654
4668
  for (const msg of hostFailureMessages) {
4655
4669
  logger.warn(msg);
4656
4670
  }
4671
+ // PRI-1249: a host that installed but had to work around something the
4672
+ // Owner should know (e.g. an unverifiable same-name MCP entry PD refused
4673
+ // to touch) must not be silent — the workaround is reported, never hidden.
4674
+ for (const hr of hostResults) {
4675
+ for (const warning of hr.warnings ?? [])
4676
+ logger.warn(`Host "${hr.hostId}": ${warning}`);
4677
+ }
4657
4678
  for (const hr of hostResults) {
4658
4679
  if (hr.success && hr.configAction === 'skipped') {
4659
4680
  logger.info(`Host "${hr.hostId}" install: ${hr.reason ?? 'skipped'}. Next: ${hr.nextAction}`);
@@ -4678,6 +4699,11 @@ transaction) {
4678
4699
  for (const hr of refreshResults) {
4679
4700
  if (hr.success) {
4680
4701
  logger.info(`Host "${hr.hostId}" refresh: ${hr.configAction === 'updated' ? 'updated' : 'no change needed'}${hr.reason ? ` — ${hr.reason}` : ''}.`);
4702
+ // PRI-1249: the sibling refresh is exactly the path that silently
4703
+ // skipped WorkBuddy's re-bind before this fix — its warnings must be
4704
+ // as visible as a first install's.
4705
+ for (const warning of hr.warnings ?? [])
4706
+ logger.warn(`Host "${hr.hostId}": ${warning}`);
4681
4707
  }
4682
4708
  else {
4683
4709
  // rc-9: never silent — state the reason and the exact recovery step.
@@ -4689,6 +4715,10 @@ transaction) {
4689
4715
  // First installs and upgrades share it, so an already-installed host being
4690
4716
  // brought forward can never be silent (Owner report).
4691
4717
  const hostSummary = summarizeTouchedHosts([...hostResults, ...refreshedResults]);
4718
+ // PRI-1249: the warnings of BOTH sets travel with the result — `--json`
4719
+ // silences logger.warn, so without this a successful install that had to
4720
+ // work around a host condition reports success with no trace of it.
4721
+ const hostWarnings = collectHostWarnings([...hostResults, ...refreshedResults]);
4692
4722
  if (hostSummary.length > 0) {
4693
4723
  logger.info('Install summary:');
4694
4724
  for (const line of hostSummary)
@@ -4885,6 +4915,7 @@ transaction) {
4885
4915
  nextAction: nextActions.join(' | '),
4886
4916
  consoleUrl: launchResult.consoleUrl,
4887
4917
  hostResults,
4918
+ ...(hostWarnings.length > 0 ? { hostWarnings } : {}),
4888
4919
  hostSummary,
4889
4920
  ...(compatibilityVisibility.lines.length > 0 ? { compatibilityWarnings: compatibilityVisibility.lines } : {}),
4890
4921
  ...(manualActionReason !== undefined ? { reason: manualActionReason, manualActions: hostManualActions } : {}),
@@ -2307,26 +2307,58 @@ export class WorkBuddyHostInstaller {
2307
2307
  };
2308
2308
  }
2309
2309
  const { payload } = payloadFind;
2310
- // 3b. SPEC §7.5/§11.3: a same-name user-level MCP server must stop the
2311
- // install BEFORE any marketplace/cache/registration write. The check is
2312
- // read-only and leaves the offending file untouched.
2313
- const mcpConflict = checkMcpRegistrationConflict('workbuddy', {
2310
+ // 3b. SPEC §7.5/§11.3: a same-name user-level MCP server must never be
2311
+ // adopted or overwritten. The check is read-only and leaves the file alone.
2312
+ //
2313
+ // PRI-1249: a PROVEN foreign entry (`conflict`) always stops the install.
2314
+ // An entry whose ownership cannot be proven (`unverifiable` — in practice a
2315
+ // dead absolute `mcp/launcher.cjs` left behind by an older registration)
2316
+ // used to stop it too, and because `writeWorkbuddyMcpBinding` runs later in
2317
+ // this method, a host that was ALREADY installed could never be re-bound to
2318
+ // a new shared runtime: the launcher then failed closed forever with
2319
+ // `binding_version_mismatch`, and every official remedy (install / update /
2320
+ // repair) re-hit this same gate.
2321
+ //
2322
+ // The deadlock only exists for hosts PD has already bound, so only those
2323
+ // are allowed past an unprovable entry. A first registration keeps Gate 4's
2324
+ // hard stop: there the entry may belong to someone else entirely.
2325
+ //
2326
+ // "Already bound" must be read from a fact this run does NOT destroy:
2327
+ // `materializeMarketplace()` wipes the marketplace payload before copying,
2328
+ // so a copy failure would erase the binding that authorises the retry and
2329
+ // re-create the very deadlock this fix removes. The host's own registration
2330
+ // record survives that, so either signal counts.
2331
+ //
2332
+ // Why proceeding is not a user-config write: this installer writes no part
2333
+ // of `~/.workbuddy/mcp.json` — no writer for it exists anywhere in this
2334
+ // repository, and the classifier beside this code is read-only. The bytes
2335
+ // stay identical whether the install proceeds or not (the test asserts the
2336
+ // sha256). What PD itself does write is its own payload + binding.
2337
+ const pdMcpBindingPresent = existsSync(path.join(p.marketplaceRoot, WORKBUDDY_PLUGIN_NAME, 'mcp-binding.json'));
2338
+ const pdAlreadyInstalledForHost = pdMcpBindingPresent || details.registered;
2339
+ const mcpRegistration = checkMcpRegistrationConflict('workbuddy', {
2314
2340
  homeDir: this.deps.homeDir(),
2315
2341
  workbuddyConfigDir: p.configDir,
2316
2342
  // Ownership is proven by the payload PD ships OR by launcher content
2317
2343
  // stamps — never by the `mcp/launcher.cjs` file NAME alone.
2318
2344
  pdLauncherRoots: [payload.pluginDir],
2319
2345
  });
2320
- if (!mcpConflict.ok) {
2346
+ if (!mcpRegistration.ok && (mcpRegistration.kind === 'conflict' || !pdAlreadyInstalledForHost)) {
2321
2347
  return {
2322
2348
  success: false,
2323
2349
  hostId: this.hostId,
2324
2350
  configPath: p.settingsPath,
2325
2351
  configAction: 'skipped',
2326
- reason: mcpConflict.reason,
2327
- nextAction: mcpConflict.nextAction,
2352
+ reason: mcpRegistration.reason,
2353
+ nextAction: mcpRegistration.nextAction,
2328
2354
  };
2329
2355
  }
2356
+ // Not a failure: this host already carries a PD MCP payload, and PD writes
2357
+ // none of that user file. The Owner still needs the exact path and the
2358
+ // recovery step (rc-9: reason + nextAction, never a bare "something was odd").
2359
+ const mcpRegistrationWarning = mcpRegistration.ok
2360
+ ? undefined
2361
+ : `${mcpRegistration.reason} PD left that entry untouched and continued so this host is not left bound to the previous MCP server version. ${mcpRegistration.nextAction}`;
2330
2362
  // 4. Materialize the PD-owned marketplace (source stays inside its root).
2331
2363
  try {
2332
2364
  materializeMarketplace(p.marketplaceRoot, payload.pluginDir);
@@ -2560,12 +2592,16 @@ export class WorkBuddyHostInstaller {
2560
2592
  // pd-review). Idempotent and preservation-first: a copy that is not
2561
2593
  // provably a published payload is reported, never overwritten or deleted.
2562
2594
  const legacySkill = deprecateAllLegacyWorkbuddySkills({ configDir: p.configDir });
2595
+ const installWarnings = [
2596
+ ...legacySkill.warnings,
2597
+ ...(mcpRegistrationWarning === undefined ? [] : [mcpRegistrationWarning]),
2598
+ ];
2563
2599
  return {
2564
2600
  success: true,
2565
2601
  hostId: this.hostId,
2566
2602
  configPath: p.settingsPath,
2567
2603
  configAction: registration.settingsAction,
2568
- warnings: legacySkill.warnings.length > 0 ? legacySkill.warnings : undefined,
2604
+ warnings: installWarnings.length > 0 ? installWarnings : undefined,
2569
2605
  pluginState: this.readInstalledPluginState(),
2570
2606
  governance: governanceDefaults === null
2571
2607
  ? undefined
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.153.3",
3
+ "version": "1.153.4",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {