@ccoalm/ccl-skills 0.15.0 → 0.15.2

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.
Files changed (71) hide show
  1. package/README.md +3 -1
  2. package/dist/assets/marketplace/plugins/ccl-skills/agent-context/session-start.md +1 -1
  3. package/dist/assets/marketplace/plugins/ccl-skills/packages/opencode-plugin/ccl-skills.ts +80 -4
  4. package/dist/assets/marketplace/plugins/ccl-skills/packages/opencode-plugin/commands/ccl-install-skills.md +16 -4
  5. package/dist/assets/marketplace/plugins/ccl-skills/scripts/owner-dispatch/owner-dispatch.sh +13 -2
  6. package/dist/assets/marketplace/plugins/ccl-skills/scripts/owner-dispatch/test.sh +53 -0
  7. package/dist/assets/marketplace/plugins/ccl-skills/skills/app-cross-platform-dev/SKILL.md +2 -2
  8. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/SKILL.md +6 -5
  9. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/references/development-completion.md +26 -0
  10. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/references/staged-review-contract.md +37 -13
  11. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/AGENTS.md +5 -2
  12. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/codex_review.sh +77 -5
  13. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/kimi_packet_mcp.py +98 -4
  14. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/parse_cli_review.py +48 -1
  15. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/review_gate.py +237 -17
  16. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_cli_review_wrappers.sh +165 -11
  17. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_kimi_packet_mcp.py +143 -0
  18. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_review_client_compat.py +572 -0
  19. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_review_gate.sh +65 -0
  20. package/dist/assets/marketplace/plugins/ccl-skills/skills/defect-diagnosis/SKILL.md +3 -1
  21. package/dist/assets/marketplace/plugins/ccl-skills/skills/go-microservice-dev/SKILL.md +1 -1
  22. package/dist/assets/marketplace/plugins/ccl-skills/skills/llm-inference-integration/SKILL.md +2 -0
  23. package/dist/assets/marketplace/plugins/ccl-skills/skills/miniapp-product-dev/SKILL.md +1 -1
  24. package/dist/assets/marketplace/plugins/ccl-skills/skills/multi-agent-delegation/SKILL.md +1 -1
  25. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/SKILL.md +2 -0
  26. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-observability/SKILL.md +7 -5
  27. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-observability/references/alerting-and-on-call.md +8 -0
  28. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-release-engineering/SKILL.md +3 -1
  29. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-service-connectivity/SKILL.md +16 -14
  30. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-service-connectivity/references/dual-sidecar-and-traffic-config-center.md +1 -1
  31. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-service-connectivity/references/grpc-authority-workaround.md +40 -83
  32. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-service-connectivity/references/mesh-architecture.md +2 -2
  33. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-service-connectivity/references/retry-timeout-circuit-breaker.md +44 -37
  34. package/dist/assets/marketplace/plugins/ccl-skills/skills/platform-service-connectivity/references/service-discovery-recipe.md +1 -1
  35. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/SKILL.md +7 -7
  36. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/delivery-lifecycle.md +1 -1
  37. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/design-review-gate-mechanics.md +1 -1
  38. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/pre-final-continuation-gate.md +20 -11
  39. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/refactoring-discipline.md +7 -1
  40. package/dist/assets/marketplace/plugins/ccl-skills/skills/python-service-dev/SKILL.md +1 -1
  41. package/dist/assets/marketplace/plugins/ccl-skills/skills/requirement-scope/SKILL.md +8 -5
  42. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/SKILL.md +2 -2
  43. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/dual-track-review-gate.md +17 -17
  44. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/external-practice-controls.md +3 -3
  45. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/harness-patterns-and-eval.md +4 -4
  46. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/resume-paused-delivery.md +3 -3
  47. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/source-register.md +24 -0
  48. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/eval-golden-trace.rb +31 -7
  49. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/impact-chain-gate.rb +74 -3
  50. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/skill-behavior-eval.py +103 -21
  51. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_ai_coding_implementation_gates.sh +83 -48
  52. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_body_compliance_grading.sh +80 -2
  53. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_check_ccl_impact_chain_refscripts.sh +74 -1
  54. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_controlled_escalation_pins.sh +3 -2
  55. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_eval_runtime.py +428 -0
  56. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_validate_extraction_review_state.sh +190 -2
  57. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/validate_extraction_review_state.py +106 -4
  58. package/dist/assets/marketplace/plugins/ccl-skills/skills/terminal-cli-dev/SKILL.md +1 -1
  59. package/dist/assets/marketplace/plugins/ccl-skills/skills/testing-strategy/SKILL.md +3 -1
  60. package/dist/assets/marketplace/plugins/ccl-skills/skills/web-react-dev/SKILL.md +1 -1
  61. package/dist/assets/release.json +87 -67
  62. package/dist/claude-adapter.js +14 -7
  63. package/dist/codex-host.d.ts +2 -4
  64. package/dist/codex-host.js +40 -19
  65. package/dist/host-probe.d.ts +27 -0
  66. package/dist/host-probe.js +51 -0
  67. package/dist/opencode-adapter.js +24 -19
  68. package/dist/operations.js +34 -8
  69. package/dist/unified.d.ts +1 -1
  70. package/dist/unified.js +18 -9
  71. package/package.json +1 -1
@@ -11,12 +11,10 @@ export declare function checkHost(codexHome?: string): {
11
11
  ok: false;
12
12
  kind: string;
13
13
  message: string;
14
- version?: undefined;
14
+ output?: undefined;
15
+ stdout?: undefined;
15
16
  } | {
16
17
  ok: true;
17
- version: string;
18
- kind?: undefined;
19
- message?: undefined;
20
18
  };
21
19
  export declare function parsePluginList(text: string, marketplaceSource: string | null): {
22
20
  ok: boolean;
@@ -1,9 +1,10 @@
1
1
  import { spawnSync } from "node:child_process";
2
- import { existsSync } from "node:fs";
2
+ import { existsSync, mkdtempSync, rmSync, statSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
3
4
  import { isAbsolute, join, resolve } from "node:path";
4
5
  import { LEGACY_REF, MARKET, REF } from "./paths.js";
5
- import { canonicalAlias } from "./fs-safe.js";
6
- import { compare, parseVersion } from "./version.js";
6
+ import { assertSafeRoot, canonicalAlias } from "./fs-safe.js";
7
+ import { probeHostCommand } from "./host-probe.js";
7
8
  function call(args, codexHome) {
8
9
  const env = {
9
10
  ...process.env,
@@ -16,28 +17,48 @@ function call(args, codexHome) {
16
17
  });
17
18
  }
18
19
  export function checkHost(codexHome) {
19
- const p = call(["--version"], codexHome);
20
- if (p.error || p.status !== 0)
21
- return {
22
- ok: false,
23
- kind: "missing",
24
- message: "Codex CLI is missing",
25
- };
26
- const version = parseVersion(`${p.stdout}\n${p.stderr}`);
27
- if (!version || compare(version, "0.133.0") < 0)
28
- return {
29
- ok: false,
30
- kind: "old",
31
- message: "Codex >=0.133.0 is required",
32
- };
33
- return { ok: true, version };
20
+ const targetHome = codexHome || process.env.CODEX_HOME || join(process.env.HOME || "", ".codex");
21
+ try {
22
+ assertSafeRoot(targetHome, join(targetHome, "ccl-skills-npm"));
23
+ try {
24
+ if (!statSync(targetHome).isDirectory())
25
+ throw new Error(`Codex home is not a directory: ${targetHome}`);
26
+ }
27
+ catch (error) {
28
+ if (error.code !== "ENOENT")
29
+ throw error;
30
+ }
31
+ }
32
+ catch (error) {
33
+ return { ok: false, kind: "safety-refusal", message: String(error) };
34
+ }
35
+ // Codex refuses a nonexistent CODEX_HOME. Probe the binary against a private
36
+ // empty home without creating the user's target just to discover capability.
37
+ const temporaryHome = existsSync(targetHome) ? null : mkdtempSync(join(tmpdir(), "ccl-codex-probe-"));
38
+ try {
39
+ const env = { ...process.env, CODEX_HOME: temporaryHome || targetHome };
40
+ const marketplace = probeHostCommand("codex", ["plugin", "marketplace", "list"], env);
41
+ if (!marketplace.ok)
42
+ return marketplace;
43
+ const plugins = probeHostCommand("codex", ["plugin", "list"], env);
44
+ if (!plugins.ok)
45
+ return plugins;
46
+ const parsed = parseMarketplace(marketplace.stdout);
47
+ if (!parsed.ok || !parsePluginList(plugins.stdout, parsed.source).ok)
48
+ return { ok: false, kind: "state-unknown", message: "Codex public state could not be verified" };
49
+ return { ok: true };
50
+ }
51
+ finally {
52
+ if (temporaryHome)
53
+ rmSync(temporaryHome, { recursive: true, force: true });
54
+ }
34
55
  }
35
56
  export function parsePluginList(text, marketplaceSource) {
36
57
  const lines = text.split(/\r?\n/).filter((line) => line.trim());
37
58
  if (lines.length === 0 ||
38
59
  (lines.length === 1 && lines[0] === "No marketplace plugins found."))
39
60
  return { ok: true, plugin: false, legacy: false };
40
- const header = /^PLUGIN\s+STATUS\s+VERSION\s+PATH\s*$/;
61
+ const header = /^PLUGIN\s+STATUS\s+VERSION\s+(?:PATH|SOURCE)\s*$/;
41
62
  const provenance = /^Marketplace `([^`]+)`$/;
42
63
  const sensitiveRefs = new Set();
43
64
  let plugin = false;
@@ -0,0 +1,27 @@
1
+ export declare function isHostCommandMissing(command: string, env?: NodeJS.ProcessEnv): boolean;
2
+ export declare function probeHostVersion(command: string, env?: NodeJS.ProcessEnv): {
3
+ ok: false;
4
+ kind: string;
5
+ message: string;
6
+ output?: undefined;
7
+ stdout?: undefined;
8
+ } | {
9
+ ok: true;
10
+ output: string;
11
+ stdout: string;
12
+ kind?: undefined;
13
+ message?: undefined;
14
+ };
15
+ export declare function probeHostCommand(command: string, args: string[], env?: NodeJS.ProcessEnv): {
16
+ ok: false;
17
+ kind: string;
18
+ message: string;
19
+ output?: undefined;
20
+ stdout?: undefined;
21
+ } | {
22
+ ok: true;
23
+ output: string;
24
+ stdout: string;
25
+ kind?: undefined;
26
+ message?: undefined;
27
+ };
@@ -0,0 +1,51 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { accessSync } from "node:fs";
3
+ import { delimiter, resolve } from "node:path";
4
+ // Host discovery must not hold up other hosts or wait for interactive input.
5
+ const HOST_PROBE_TIMEOUT_MS = 10000;
6
+ // Presence only: do not execute a candidate or inspect its configuration.
7
+ export function isHostCommandMissing(command, env = process.env) {
8
+ const candidates = command.includes("/")
9
+ ? [command]
10
+ : (env.PATH ?? "/usr/bin:/bin").split(delimiter).map((dir) => resolve(dir, command));
11
+ let uncertain = false;
12
+ for (const candidate of candidates) {
13
+ try {
14
+ accessSync(candidate);
15
+ return false;
16
+ }
17
+ catch (error) {
18
+ const code = error.code;
19
+ if (code !== "ENOENT" && code !== "ENOTDIR")
20
+ uncertain = true;
21
+ }
22
+ }
23
+ return !uncertain;
24
+ }
25
+ export function probeHostVersion(command, env = process.env) {
26
+ return probeHostCommand(command, ["--version"], env);
27
+ }
28
+ export function probeHostCommand(command, args, env = process.env) {
29
+ const result = spawnSync(command, args, {
30
+ encoding: "utf8",
31
+ env,
32
+ stdio: ["ignore", "pipe", "pipe"],
33
+ timeout: HOST_PROBE_TIMEOUT_MS,
34
+ // spawnSync still waits if a child catches SIGTERM and does not exit.
35
+ killSignal: "SIGKILL",
36
+ });
37
+ if (result.error || result.status !== 0) {
38
+ const errorCode = result.error?.code;
39
+ const kind = errorCode === "ETIMEDOUT" ? "timeout" : errorCode === "ENOENT" ? "missing" : "probe-failed";
40
+ return {
41
+ ok: false,
42
+ kind,
43
+ message: kind === "timeout"
44
+ ? `${command} ${args.join(" ")} timed out after ${HOST_PROBE_TIMEOUT_MS}ms`
45
+ : kind === "missing"
46
+ ? `${command} CLI is unavailable (ENOENT)`
47
+ : `${command} ${args.join(" ")} failed (${errorCode || (result.signal ? `signal ${result.signal}` : result.error ? "spawn error" : `exit ${result.status}`)})`,
48
+ };
49
+ }
50
+ return { ok: true, output: `${result.stdout}\n${result.stderr}`, stdout: result.stdout };
51
+ }
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import { atomicJson, sha256 } from "./fs-safe.js";
7
7
  import { readRelease } from "./manifest.js";
8
8
  import { compare } from "./version.js";
9
+ import { probeHostVersion } from "./host-probe.js";
9
10
  const PACKAGE = "@ccoalm/ccl-skills";
10
11
  function paths(context) {
11
12
  const rawHome = context.home ?? (context.env ? context.env.HOME : process.env.HOME);
@@ -21,7 +22,7 @@ function assertExclusiveRoot(base, root, createBase = false) {
21
22
  throw new Error("managed root is not canonical");
22
23
  if (createBase)
23
24
  mkdirSync(base, { recursive: true });
24
- for (const component of [base, root]) {
25
+ for (const component of [base, root, join(root, "snapshots")]) {
25
26
  if (!existsSync(component))
26
27
  continue;
27
28
  const stat = lstatSync(component);
@@ -124,10 +125,6 @@ function readManifest(path, root) {
124
125
  }).sort((a, b) => a.destination.localeCompare(b.destination));
125
126
  return { schema: 1, npmPackage: PACKAGE, installedAt: raw.installedAt, version: raw.version, sourceCommit: raw.sourceCommit, sourceKind: raw.sourceKind, snapshot, snapshotHash: raw.snapshotHash, entries };
126
127
  }
127
- function hostAvailable(context) {
128
- const result = spawnSync("opencode", ["--version"], { encoding: "utf8", env: context.env || process.env });
129
- return !result.error && result.status === 0;
130
- }
131
128
  function sharedPath(base, rel) {
132
129
  const path = resolve(base, safeRel(rel, "OpenCode destination"));
133
130
  if (!path.startsWith(`${resolve(base)}${sep}`))
@@ -190,17 +187,19 @@ function actualFiles(directory) {
190
187
  function preflight(base, next, old) {
191
188
  assertSafeSharedParents(base, next);
192
189
  const previous = new Map((old?.entries || []).map((entry) => [entry.destination, entry]));
190
+ const drift = [];
193
191
  if (old) {
192
+ assertSafeSharedParents(base, old.entries);
194
193
  for (const entry of old.entries) {
195
194
  const path = sharedPath(base, entry.destination);
196
195
  if (!existsSync(path) || (regular(path).mode & 0o777) !== entry.mode || sha256(path) !== entry.sha256)
197
- throw new Error(`owned OpenCode file drifted: ${entry.destination}`);
196
+ drift.push(entry.destination);
198
197
  }
199
198
  const skillNames = new Set(old.entries.filter((entry) => entry.destination.startsWith("skills/")).map((entry) => entry.destination.split("/")[1]));
200
199
  for (const skill of skillNames) {
201
200
  const expected = old.entries.filter((entry) => entry.destination.startsWith(`skills/${skill}/`)).map((entry) => entry.destination.slice(`skills/${skill}/`.length)).sort();
202
201
  if (JSON.stringify(actualFiles(join(base, "skills", skill))) !== JSON.stringify(expected))
203
- throw new Error(`owned OpenCode skill directory drifted: ${skill}`);
202
+ drift.push(`skills/${skill}`);
204
203
  }
205
204
  }
206
205
  const nextSkills = new Set(next.filter((entry) => entry.destination.startsWith("skills/")).map((entry) => entry.destination.split("/")[1]));
@@ -211,6 +210,7 @@ function preflight(base, next, old) {
211
210
  for (const entry of next)
212
211
  if (!previous.has(entry.destination) && existsSync(sharedPath(base, entry.destination)))
213
212
  throw new Error(`OpenCode path collision: ${entry.destination}`);
213
+ return drift;
214
214
  }
215
215
  function prepareSnapshot(p, candidate) {
216
216
  const snapshotRel = join("snapshots", candidate.snapshotHash, "source"), snapshot = join(p.root, snapshotRel);
@@ -305,8 +305,9 @@ function writeShared(p, snapshot, entries, old, isInterrupted, copyShared = (fro
305
305
  function doctor(context) {
306
306
  const p = paths(context);
307
307
  assertExclusiveRoot(p.base, p.root);
308
- if (!hostAvailable(context))
309
- return { code: 4, status: "host-missing", message: "OpenCode CLI is not installed" };
308
+ const host = probeHostVersion("opencode", context.env || process.env);
309
+ if (!host.ok)
310
+ return { code: 4, status: `host-${host.kind}`, message: host.message };
310
311
  const legacy = existsSync(join(p.base, "ccl-skills/install-manifest.json")), manifest = readManifest(p.manifest, p.root);
311
312
  if (legacy && manifest)
312
313
  return { code: 3, status: "double-install", message: "legacy checkout and npm OpenCode installs are both present; keep exactly one" };
@@ -315,20 +316,22 @@ function doctor(context) {
315
316
  return { code: 3, status: legacy ? "legacy-install" : "unowned-registration", message: "OpenCode ccl-skills files exist without an npm ownership receipt" };
316
317
  return { code: 3, status: "absent", message: "ccl-skills is not installed for OpenCode" };
317
318
  }
318
- const drift = [];
319
- for (const entry of manifest.entries) {
320
- const path = sharedPath(p.base, entry.destination);
321
- if (!existsSync(path) || sha256(path) !== entry.sha256)
322
- drift.push(entry.destination);
319
+ let drift = [], reason;
320
+ try {
321
+ drift = preflight(p.base, manifest.entries, manifest);
322
+ }
323
+ catch (error) {
324
+ reason = String(error);
323
325
  }
324
- if (drift.length)
325
- return { code: 3, status: "shared-drift", message: "OpenCode shared files changed after npm install; they will never be auto-deleted", details: { drift } };
326
+ if (drift.length || reason)
327
+ return { code: 3, status: "shared-drift", message: "OpenCode shared files changed after npm install; they will never be auto-deleted", details: { drift, ...(reason ? { reason } : {}) } };
326
328
  return { code: 0, status: "healthy", message: `OpenCode uses @ccoalm/ccl-skills ${manifest.version}` };
327
329
  }
328
330
  function installOrUpdate(commandName, options, context) {
329
331
  const p = paths(context);
330
- if (!hostAvailable(context))
331
- return { code: 4, status: "host-missing", message: "OpenCode CLI is not installed" };
332
+ const host = probeHostVersion("opencode", context.env || process.env);
333
+ if (!host.ok)
334
+ return { code: 4, status: `host-${host.kind}`, message: host.message };
332
335
  let candidate;
333
336
  try {
334
337
  candidate = source(context);
@@ -350,7 +353,9 @@ function installOrUpdate(commandName, options, context) {
350
353
  return { code: 3, status: "downgrade-refused", message: "newer OpenCode assets are installed" };
351
354
  }
352
355
  try {
353
- preflight(p.base, candidate.entries, old);
356
+ const drift = preflight(p.base, candidate.entries, old);
357
+ if (drift.length)
358
+ throw new Error(`owned OpenCode paths drifted: ${drift.join(", ")}`);
354
359
  }
355
360
  catch (error) {
356
361
  return { code: 3, status: "collision", message: String(error) };
@@ -200,13 +200,24 @@ function cleanupCandidate(path, files, context) {
200
200
  removeEmptyTree(path, files);
201
201
  return [];
202
202
  }
203
- function resumeJournal(context) {
203
+ function resumeJournal(context, host) {
204
204
  const p = paths(context), j = journal(p.journal, p.root);
205
+ const hostFailure = host.ok ? undefined : { kind: host.kind, message: host.message };
205
206
  if (!j)
206
207
  return {
207
208
  code: 5,
208
209
  status: "partial-journal",
209
210
  message: "operation journal is malformed",
211
+ ...(hostFailure ? { details: { hostFailure } } : {}),
212
+ };
213
+ if (!host.ok)
214
+ return {
215
+ code: 5,
216
+ status: "partial-journal",
217
+ message: host.kind === "missing"
218
+ ? "operation journal retained; restore or reinstall the Codex CLI, then rerun this command"
219
+ : "operation journal retained; restore readable Codex public plugin state, then rerun this command",
220
+ details: { hostFailure },
210
221
  };
211
222
  if (j.step === "committed" || j.step === "journal-unlink-failed") {
212
223
  if (j.operation !== "install" && j.operation !== "update")
@@ -274,6 +285,12 @@ function resumeJournal(context) {
274
285
  }
275
286
  }
276
287
  if (j.trashPath && j.snapshot) {
288
+ if (j.operation === "uninstall" && !exactState(p.codexHome, null, false))
289
+ return {
290
+ code: 5,
291
+ status: "partial",
292
+ message: "uninstall resume requires absent public state",
293
+ };
277
294
  const trash = contained(p.root, j.trashPath), deleted = j.deletedFiles || [], errors = remainingErrors(trash, j.snapshot, deleted);
278
295
  if (errors.length)
279
296
  return {
@@ -423,13 +440,16 @@ function doctor(context) {
423
440
  return { code: 3, status: "safety-refusal", message: String(error) };
424
441
  }
425
442
  const host = checkHost(p.codexHome);
426
- if (!host.ok)
427
- return { code: 4, status: `host-${host.kind}`, message: host.message };
443
+ if (!host.ok && host.kind === "safety-refusal")
444
+ return { code: 3, status: host.kind, message: host.message };
445
+ // Diagnose pending journals first; unreadable public state cannot authorize cleanup.
428
446
  if (existsSync(p.journal)) {
429
- const repair = resumeJournal(context);
447
+ const repair = resumeJournal(context, host);
430
448
  if (repair)
431
449
  return repair;
432
450
  }
451
+ if (!host.ok)
452
+ return { code: host.kind === "state-unknown" ? 3 : 4, status: `host-${host.kind}`, message: host.message };
433
453
  const unknownTrash = existsSync(p.root)
434
454
  ? readdirSync(p.root).filter((name) => name.startsWith(".trash-"))
435
455
  : [];
@@ -478,13 +498,16 @@ function installOrUpdate(command, options, context) {
478
498
  return { code: 3, status: "safety-refusal", message: String(error) };
479
499
  }
480
500
  const host = checkHost(p.codexHome);
481
- if (!host.ok)
482
- return { code: 4, status: `host-${host.kind}`, message: host.message };
501
+ if (!host.ok && host.kind === "safety-refusal")
502
+ return { code: 3, status: host.kind, message: host.message };
503
+ // Diagnose pending journals first; unreadable public state cannot authorize cleanup.
483
504
  if (existsSync(p.journal)) {
484
- const repair = resumeJournal(context);
505
+ const repair = resumeJournal(context, host);
485
506
  if (repair)
486
507
  return repair;
487
508
  }
509
+ if (!host.ok)
510
+ return { code: host.kind === "state-unknown" ? 3 : 4, status: `host-${host.kind}`, message: host.message };
488
511
  const problem = conflict(command, context);
489
512
  if (problem)
490
513
  return problem;
@@ -787,7 +810,10 @@ function uninstall(options, context) {
787
810
  return { code: 3, status: "safety-refusal", message: String(error) };
788
811
  }
789
812
  if (existsSync(p.journal)) {
790
- const repair = resumeJournal(context);
813
+ const host = checkHost(p.codexHome);
814
+ if (!host.ok && host.kind === "safety-refusal")
815
+ return { code: 3, status: host.kind, message: host.message };
816
+ const repair = resumeJournal(context, host);
791
817
  if (repair)
792
818
  return repair;
793
819
  }
package/dist/unified.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PathContext } from "./paths.js";
1
+ import { type PathContext } from "./paths.js";
2
2
  import type { Host, Options, Result } from "./types.js";
3
3
  export declare function runHostSequence(hosts: Host[], invoke: (host: Host) => Result): Result;
4
4
  export declare function runUnified(command: string, options?: Options, codexContext?: PathContext): Result;
package/dist/unified.js CHANGED
@@ -1,14 +1,11 @@
1
- import { spawnSync } from "node:child_process";
1
+ import { isHostCommandMissing, probeHostVersion } from "./host-probe.js";
2
+ import { checkHost } from "./codex-host.js";
2
3
  import { existsSync } from "node:fs";
3
4
  import { join, resolve } from "node:path";
4
5
  import { runClaude } from "./claude-adapter.js";
5
6
  import { run as runCodex } from "./operations.js";
6
7
  import { runOpenCode } from "./opencode-adapter.js";
7
- function available(host) {
8
- const command = host === "opencode" ? "opencode" : host;
9
- const result = spawnSync(command, ["--version"], { encoding: "utf8" });
10
- return !result.error && result.status === 0;
11
- }
8
+ import { paths } from "./paths.js";
12
9
  function owned(host) {
13
10
  const home = process.env.HOME;
14
11
  if (!home)
@@ -57,8 +54,20 @@ export function runUnified(command, options = {}, codexContext = {}) {
57
54
  if (options.host)
58
55
  return dispatch(options.host, command, options, codexContext);
59
56
  const includeOwned = command === "doctor" || command === "uninstall";
60
- const hosts = ["claude", "codex", "opencode"].filter((host) => command === "update" ? available(host) && owned(host) : available(host) || (includeOwned && owned(host)));
57
+ const candidates = ["claude", "codex", "opencode"].filter((host) => command !== "update" || owned(host));
58
+ const probes = candidates.map((host) => {
59
+ const probe = host !== "codex" ? probeHostVersion(host)
60
+ : isHostCommandMissing(host) ? { ok: false, kind: "missing", message: "codex CLI was not found on PATH" }
61
+ : checkHost(paths(codexContext).codexHome);
62
+ return { host, probe };
63
+ });
64
+ const hosts = probes.filter(({ host, probe }) => probe.ok || probe.kind !== "missing" || (includeOwned && owned(host))).map(({ host }) => host);
61
65
  if (!hosts.length)
62
- return { code: 4, status: "host-missing", message: "none of Claude Code, Codex, or OpenCode is installed" };
63
- return runHostSequence(hosts, (host) => dispatch(host, command, { ...options, host }, codexContext));
66
+ return { code: 4, status: "host-missing", message: "no Claude Code, Codex, or OpenCode CLI is available" };
67
+ return runHostSequence(hosts, (host) => {
68
+ const probe = probes.find((entry) => entry.host === host).probe;
69
+ if (!probe.ok && probe.kind !== "missing" && !(host === "codex" && probe.kind !== "safety-refusal" && existsSync(paths(codexContext).journal)))
70
+ return { code: probe.kind === "state-unknown" || probe.kind === "safety-refusal" ? 3 : 4, status: probe.kind === "safety-refusal" ? probe.kind : `host-${probe.kind}`, message: probe.message };
71
+ return dispatch(host, command, { ...options, host }, codexContext);
72
+ });
64
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccoalm/ccl-skills",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Reusable workflows that help coding agents plan, build, test, review, and release software — for Claude Code, Codex, and OpenCode",
5
5
  "keywords": ["skills", "agent-skills", "claude", "claude-code", "codex", "opencode", "agent", "ai", "ai-agents", "cli", "anthropic", "developer-tools"],
6
6
  "type": "module",