@cleocode/core 2026.4.83 → 2026.4.84

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/core",
3
- "version": "2026.4.83",
3
+ "version": "2026.4.84",
4
4
  "description": "CLEO core business logic kernel — tasks, sessions, memory, orchestration, lifecycle, with bundled SQLite store",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -76,13 +76,13 @@
76
76
  "write-file-atomic": "^7.0.1",
77
77
  "yaml": "^2.8.3",
78
78
  "zod": "^4.3.6",
79
- "@cleocode/adapters": "2026.4.83",
80
- "@cleocode/agents": "2026.4.83",
81
- "@cleocode/contracts": "2026.4.83",
82
- "@cleocode/lafs": "2026.4.83",
83
- "@cleocode/caamp": "2026.4.83",
84
- "@cleocode/nexus": "2026.4.83",
85
- "@cleocode/skills": "2026.4.83"
79
+ "@cleocode/adapters": "2026.4.84",
80
+ "@cleocode/caamp": "2026.4.84",
81
+ "@cleocode/agents": "2026.4.84",
82
+ "@cleocode/contracts": "2026.4.84",
83
+ "@cleocode/lafs": "2026.4.84",
84
+ "@cleocode/nexus": "2026.4.84",
85
+ "@cleocode/skills": "2026.4.84"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=24.0.0"
@@ -29,9 +29,11 @@
29
29
  */
30
30
 
31
31
  import { execFile } from 'node:child_process';
32
+ import { existsSync } from 'node:fs';
32
33
  import { mkdir, mkdtemp, rm } from 'node:fs/promises';
33
34
  import { tmpdir } from 'node:os';
34
- import { join } from 'node:path';
35
+ import { dirname, join, resolve } from 'node:path';
36
+ import { fileURLToPath } from 'node:url';
35
37
  import { promisify } from 'node:util';
36
38
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
37
39
 
@@ -45,19 +47,38 @@ const execFileAsync = promisify(execFile);
45
47
 
46
48
  // ---------------------------------------------------------------------------
47
49
  // Resolve the `cleo` binary path at module load time.
48
- // Prefer the installed binary on PATH so it exercises the real distributed CLI.
50
+ //
51
+ // Preference order (CI-safe, no PATH dependency):
52
+ // 1. Monorepo-local dist (packages/cleo/dist/cli/index.js) — always present
53
+ // after `pnpm run build` and independent of shell PATH setup.
54
+ // 2. `CLEO_BIN` env override — lets us point at an arbitrary binary for
55
+ // end-to-end integration runs against a released version.
56
+ // 3. Global `cleo` on PATH — last-resort fallback for dev machines that
57
+ // already have it installed.
49
58
  // ---------------------------------------------------------------------------
50
59
 
60
+ const __thisFile = fileURLToPath(import.meta.url);
61
+ // packages/core/src/memory/__tests__ → repo root
62
+ const __repoRoot = resolve(dirname(__thisFile), '..', '..', '..', '..', '..');
63
+ const __localDistCleo = join(__repoRoot, 'packages', 'cleo', 'dist', 'cli', 'index.js');
64
+
51
65
  /**
52
- * Locate the `cleo` executable. Resolves via the system PATH.
53
- * If not found, tests that require the CLI binary will be skipped.
66
+ * Locate the `cleo` executable for integration tests.
67
+ *
68
+ * Returns either a direct Node.js ESM bundle path (to be spawned as a script)
69
+ * OR the literal string "cleo" (to be resolved via PATH). When the return
70
+ * value ends in `.js`, callers must invoke it via `node <path>` rather than
71
+ * as a direct executable.
54
72
  */
55
73
  function getCleoPath(): string {
56
- // Prefer the installed npm-global binary (matches CI environment)
74
+ if (process.env['CLEO_BIN']) return process.env['CLEO_BIN'];
75
+ if (existsSync(__localDistCleo)) return __localDistCleo;
57
76
  return 'cleo';
58
77
  }
59
78
 
60
79
  const CLEO_BIN = getCleoPath();
80
+ /** True when CLEO_BIN is a `.js` script that must be invoked via `node`. */
81
+ const CLEO_BIN_IS_SCRIPT = CLEO_BIN.endsWith('.js');
61
82
 
62
83
  // ---------------------------------------------------------------------------
63
84
  // Helpers
@@ -117,8 +138,12 @@ async function runCleo(
117
138
  args: string[],
118
139
  cleoDirAbsolute: string,
119
140
  ): Promise<{ stdout: string; stderr: string; exitCode: number }> {
141
+ // When CLEO_BIN resolves to a local .js ESM bundle, invoke via `node`.
142
+ // Otherwise spawn the binary directly (PATH lookup or absolute path).
143
+ const executable = CLEO_BIN_IS_SCRIPT ? process.execPath : CLEO_BIN;
144
+ const spawnArgs = CLEO_BIN_IS_SCRIPT ? [CLEO_BIN, ...args] : args;
120
145
  try {
121
- const { stdout, stderr } = await execFileAsync(CLEO_BIN, args, {
146
+ const { stdout, stderr } = await execFileAsync(executable, spawnArgs, {
122
147
  env: {
123
148
  ...process.env,
124
149
  CLEO_DIR: cleoDirAbsolute,