@cleocode/cleo 2026.5.1 → 2026.5.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/bin/postinstall.js +23 -0
- package/dist/cli/index.js +183 -50
- package/dist/cli/index.js.map +3 -3
- package/package.json +12 -9
- package/scripts/install-daemon-service.mjs +801 -0
package/bin/postinstall.js
CHANGED
|
@@ -154,6 +154,29 @@ async function runPostinstall() {
|
|
|
154
154
|
console.error('CLEO: Bootstrap detail:', err);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
+
|
|
158
|
+
// Register the CLEO daemon as a user-level system service (systemd / launchd).
|
|
159
|
+
// This is non-blocking and never fails the install — errors are caught and logged.
|
|
160
|
+
await installDaemonServiceFromScript();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Install the CLEO daemon as a user-level system service after global install.
|
|
165
|
+
*
|
|
166
|
+
* Delegates to the cross-platform installer in scripts/install-daemon-service.mjs.
|
|
167
|
+
* Always exits cleanly — installation failures are non-fatal.
|
|
168
|
+
*/
|
|
169
|
+
async function installDaemonServiceFromScript() {
|
|
170
|
+
try {
|
|
171
|
+
const scriptPath = join(getPackageRoot(), 'scripts', 'install-daemon-service.mjs');
|
|
172
|
+
const { installDaemonService } = await import(scriptPath);
|
|
173
|
+
await installDaemonService();
|
|
174
|
+
} catch (err) {
|
|
175
|
+
console.log('CLEO: Daemon service registration deferred (will retry on first "cleo daemon install")');
|
|
176
|
+
if (process.env.CLEO_DEBUG) {
|
|
177
|
+
console.error('CLEO: Daemon install detail:', err);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
157
180
|
}
|
|
158
181
|
|
|
159
182
|
runPostinstall().catch((err) => {
|
package/dist/cli/index.js
CHANGED
|
@@ -21134,12 +21134,12 @@ async function orchestrateRejectOp(params) {
|
|
|
21134
21134
|
async function orchestrateClassify(request, context, projectRoot) {
|
|
21135
21135
|
try {
|
|
21136
21136
|
const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
|
|
21137
|
-
const { readFileSync: readFileSync14, readdirSync: readdirSync3, existsSync:
|
|
21137
|
+
const { readFileSync: readFileSync14, readdirSync: readdirSync3, existsSync: existsSync12 } = await import("node:fs");
|
|
21138
21138
|
const { join: join20 } = await import("node:path");
|
|
21139
21139
|
const workflowsDir = getCleoCantWorkflowsDir();
|
|
21140
21140
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
21141
21141
|
const matches = [];
|
|
21142
|
-
if (
|
|
21142
|
+
if (existsSync12(workflowsDir)) {
|
|
21143
21143
|
const files = readdirSync3(workflowsDir).filter((f) => f.endsWith(".cant"));
|
|
21144
21144
|
for (const file of files) {
|
|
21145
21145
|
try {
|
|
@@ -21159,7 +21159,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
21159
21159
|
}
|
|
21160
21160
|
}
|
|
21161
21161
|
const localCantDir = join20(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
|
|
21162
|
-
if (
|
|
21162
|
+
if (existsSync12(localCantDir)) {
|
|
21163
21163
|
const files = readdirSync3(localCantDir).filter((f) => f.endsWith(".cant"));
|
|
21164
21164
|
for (const file of files) {
|
|
21165
21165
|
try {
|
|
@@ -25958,7 +25958,7 @@ var init_cli = __esm({
|
|
|
25958
25958
|
// packages/cleo/src/cli/index.ts
|
|
25959
25959
|
import { readFileSync as readFileSync13 } from "node:fs";
|
|
25960
25960
|
import { dirname as dirname9, join as join19 } from "node:path";
|
|
25961
|
-
import { fileURLToPath as
|
|
25961
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
25962
25962
|
import {
|
|
25963
25963
|
detectAndRemoveLegacyGlobalFiles,
|
|
25964
25964
|
detectAndRemoveStrayProjectNexus,
|
|
@@ -27659,12 +27659,12 @@ var registerCommand = defineCommand({
|
|
|
27659
27659
|
transportConfig: {},
|
|
27660
27660
|
isActive: true
|
|
27661
27661
|
});
|
|
27662
|
-
const { existsSync:
|
|
27662
|
+
const { existsSync: existsSync12, mkdirSync: mkdirSync5, writeFileSync: writeFileSync5 } = await import("node:fs");
|
|
27663
27663
|
const { join: join20 } = await import("node:path");
|
|
27664
27664
|
const cantDir = join20(CLEO_DIR_NAME, AGENTS_SUBDIR);
|
|
27665
27665
|
const cantPath = join20(cantDir, `${agentId}.cant`);
|
|
27666
27666
|
let cantScaffolded = false;
|
|
27667
|
-
if (!
|
|
27667
|
+
if (!existsSync12(cantPath)) {
|
|
27668
27668
|
mkdirSync5(cantDir, { recursive: true });
|
|
27669
27669
|
const role = classification ?? "specialist";
|
|
27670
27670
|
const cantContent = `---
|
|
@@ -27724,7 +27724,7 @@ agent ${agentId}:
|
|
|
27724
27724
|
data: {
|
|
27725
27725
|
agentId: credential.agentId,
|
|
27726
27726
|
displayName: credential.displayName,
|
|
27727
|
-
cantFile: cantScaffolded ? cantPath :
|
|
27727
|
+
cantFile: cantScaffolded ? cantPath : existsSync12(cantPath) ? cantPath : null,
|
|
27728
27728
|
cantScaffolded
|
|
27729
27729
|
}
|
|
27730
27730
|
},
|
|
@@ -27843,7 +27843,7 @@ var startCommand = defineCommand({
|
|
|
27843
27843
|
try {
|
|
27844
27844
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
27845
27845
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
27846
|
-
const { existsSync:
|
|
27846
|
+
const { existsSync: existsSync12, readFileSync: readFileSync14 } = await import("node:fs");
|
|
27847
27847
|
const { join: join20 } = await import("node:path");
|
|
27848
27848
|
await getDb3();
|
|
27849
27849
|
const registry = new AgentRegistryAccessor(process.cwd());
|
|
@@ -27865,7 +27865,7 @@ var startCommand = defineCommand({
|
|
|
27865
27865
|
let profile = null;
|
|
27866
27866
|
let cantValidation = null;
|
|
27867
27867
|
const cantPath = args.cant ?? join20(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
27868
|
-
if (
|
|
27868
|
+
if (existsSync12(cantPath)) {
|
|
27869
27869
|
profile = readFileSync14(cantPath, "utf-8");
|
|
27870
27870
|
try {
|
|
27871
27871
|
const cantModule = await import("@cleocode/cant");
|
|
@@ -28389,7 +28389,7 @@ var workCommand = defineCommand({
|
|
|
28389
28389
|
try {
|
|
28390
28390
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
28391
28391
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
28392
|
-
const { existsSync:
|
|
28392
|
+
const { existsSync: existsSync12 } = await import("node:fs");
|
|
28393
28393
|
const { join: join20 } = await import("node:path");
|
|
28394
28394
|
const { execFile: execFile2 } = await import("node:child_process");
|
|
28395
28395
|
const { promisify: promisify2 } = await import("node:util");
|
|
@@ -28411,7 +28411,7 @@ var workCommand = defineCommand({
|
|
|
28411
28411
|
await registry.update(args.agentId, { isActive: true });
|
|
28412
28412
|
await registry.markUsed(args.agentId);
|
|
28413
28413
|
const cantPath = join20(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
28414
|
-
const hasProfile =
|
|
28414
|
+
const hasProfile = existsSync12(cantPath);
|
|
28415
28415
|
const runtime = await createRuntime(registry, {
|
|
28416
28416
|
agentId: args.agentId,
|
|
28417
28417
|
pollIntervalMs: 5e3,
|
|
@@ -29261,11 +29261,11 @@ var installCommand = defineCommand({
|
|
|
29261
29261
|
async run({ args }) {
|
|
29262
29262
|
let tempDir = null;
|
|
29263
29263
|
try {
|
|
29264
|
-
const { existsSync:
|
|
29264
|
+
const { existsSync: existsSync12, mkdirSync: mkdirSync5, statSync, readdirSync: readdirSync3, copyFileSync } = await import("node:fs");
|
|
29265
29265
|
const { join: join20, basename, resolve: resolve5, extname } = await import("node:path");
|
|
29266
29266
|
const { tmpdir } = await import("node:os");
|
|
29267
29267
|
const resolvedPath = resolve5(args.path);
|
|
29268
|
-
if (!
|
|
29268
|
+
if (!existsSync12(resolvedPath)) {
|
|
29269
29269
|
cliOutput(
|
|
29270
29270
|
{
|
|
29271
29271
|
success: false,
|
|
@@ -29326,7 +29326,7 @@ var installCommand = defineCommand({
|
|
|
29326
29326
|
}
|
|
29327
29327
|
const agentName = topLevel[0];
|
|
29328
29328
|
const personaPath = join20(tempDir, agentName, "persona.cant");
|
|
29329
|
-
if (!
|
|
29329
|
+
if (!existsSync12(personaPath)) {
|
|
29330
29330
|
cliOutput(
|
|
29331
29331
|
{
|
|
29332
29332
|
success: false,
|
|
@@ -29345,7 +29345,7 @@ var installCommand = defineCommand({
|
|
|
29345
29345
|
} else if (stat2.isDirectory()) {
|
|
29346
29346
|
const agentName = basename(resolvedPath);
|
|
29347
29347
|
const personaPath = join20(resolvedPath, "persona.cant");
|
|
29348
|
-
if (!
|
|
29348
|
+
if (!existsSync12(personaPath)) {
|
|
29349
29349
|
cliOutput(
|
|
29350
29350
|
{
|
|
29351
29351
|
success: false,
|
|
@@ -29488,11 +29488,11 @@ var packCommand = defineCommand({
|
|
|
29488
29488
|
},
|
|
29489
29489
|
async run({ args }) {
|
|
29490
29490
|
try {
|
|
29491
|
-
const { existsSync:
|
|
29491
|
+
const { existsSync: existsSync12, statSync } = await import("node:fs");
|
|
29492
29492
|
const { resolve: resolve5, basename, dirname: dirname10 } = await import("node:path");
|
|
29493
29493
|
const { execFileSync: execFileSync5 } = await import("node:child_process");
|
|
29494
29494
|
const resolvedDir = resolve5(args.dir);
|
|
29495
|
-
if (!
|
|
29495
|
+
if (!existsSync12(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
|
|
29496
29496
|
cliOutput(
|
|
29497
29497
|
{
|
|
29498
29498
|
success: false,
|
|
@@ -29508,7 +29508,7 @@ var packCommand = defineCommand({
|
|
|
29508
29508
|
}
|
|
29509
29509
|
const { join: join20 } = await import("node:path");
|
|
29510
29510
|
const personaPath = join20(resolvedDir, "persona.cant");
|
|
29511
|
-
if (!
|
|
29511
|
+
if (!existsSync12(personaPath)) {
|
|
29512
29512
|
cliOutput(
|
|
29513
29513
|
{
|
|
29514
29514
|
success: false,
|
|
@@ -29624,7 +29624,7 @@ var createCommand = defineCommand({
|
|
|
29624
29624
|
},
|
|
29625
29625
|
async run({ args }) {
|
|
29626
29626
|
try {
|
|
29627
|
-
const { existsSync:
|
|
29627
|
+
const { existsSync: existsSync12, mkdirSync: mkdirSync5, writeFileSync: writeFileSync5 } = await import("node:fs");
|
|
29628
29628
|
const { join: join20 } = await import("node:path");
|
|
29629
29629
|
const { homedir: homedir6 } = await import("node:os");
|
|
29630
29630
|
const name = args.name;
|
|
@@ -29691,7 +29691,7 @@ var createCommand = defineCommand({
|
|
|
29691
29691
|
targetRoot = join20(process.cwd(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
|
|
29692
29692
|
}
|
|
29693
29693
|
const agentDir = join20(targetRoot, name);
|
|
29694
|
-
if (
|
|
29694
|
+
if (existsSync12(agentDir)) {
|
|
29695
29695
|
cliOutput(
|
|
29696
29696
|
{
|
|
29697
29697
|
success: false,
|
|
@@ -29835,10 +29835,10 @@ var mintCommand = defineCommand({
|
|
|
29835
29835
|
},
|
|
29836
29836
|
async run({ args }) {
|
|
29837
29837
|
try {
|
|
29838
|
-
const { existsSync:
|
|
29838
|
+
const { existsSync: existsSync12, readFileSync: readFileSync14, mkdirSync: mkdirSync5 } = await import("node:fs");
|
|
29839
29839
|
const { resolve: resolve5, join: join20 } = await import("node:path");
|
|
29840
29840
|
const specPath = resolve5(args.spec);
|
|
29841
|
-
if (!
|
|
29841
|
+
if (!existsSync12(specPath)) {
|
|
29842
29842
|
const errEnv = {
|
|
29843
29843
|
success: false,
|
|
29844
29844
|
error: { code: "E_NOT_FOUND", message: `spec file not found: ${specPath}` },
|
|
@@ -34024,10 +34024,15 @@ var currentCommand = defineCommand({
|
|
|
34024
34024
|
});
|
|
34025
34025
|
|
|
34026
34026
|
// packages/cleo/src/cli/commands/daemon.ts
|
|
34027
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
34027
34028
|
import { homedir as homedir2 } from "node:os";
|
|
34028
34029
|
import { join as join9 } from "node:path";
|
|
34030
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
34029
34031
|
import { getGCDaemonStatus, spawnGCDaemon, stopGCDaemon } from "@cleocode/core/gc/daemon.js";
|
|
34030
|
-
import {
|
|
34032
|
+
import {
|
|
34033
|
+
bootstrapDaemon as bootstrapSentientDaemon,
|
|
34034
|
+
getSentientDaemonStatus
|
|
34035
|
+
} from "@cleocode/core/sentient";
|
|
34031
34036
|
async function showDaemonStatus(cleoDir, projectRoot, json2) {
|
|
34032
34037
|
try {
|
|
34033
34038
|
const gcStatus = await getGCDaemonStatus(cleoDir);
|
|
@@ -34040,11 +34045,15 @@ async function showDaemonStatus(cleoDir, projectRoot, json2) {
|
|
|
34040
34045
|
duplicateEpicGroups: 0,
|
|
34041
34046
|
worktreesPruned: 0
|
|
34042
34047
|
};
|
|
34048
|
+
let supervisesStudio = null;
|
|
34049
|
+
let studioStatus = null;
|
|
34043
34050
|
try {
|
|
34044
34051
|
const sentientStatus = await getSentientDaemonStatus(projectRoot);
|
|
34045
34052
|
hygieneLastRunAt = sentientStatus.hygieneLastRunAt;
|
|
34046
34053
|
hygieneSummary = sentientStatus.hygieneSummary;
|
|
34047
34054
|
hygieneStats = sentientStatus.hygieneStats;
|
|
34055
|
+
supervisesStudio = sentientStatus.supervisesStudio;
|
|
34056
|
+
studioStatus = sentientStatus.studioStatus;
|
|
34048
34057
|
} catch {
|
|
34049
34058
|
}
|
|
34050
34059
|
const result = {
|
|
@@ -34055,6 +34064,10 @@ async function showDaemonStatus(cleoDir, projectRoot, json2) {
|
|
|
34055
34064
|
lastRunAt: hygieneLastRunAt,
|
|
34056
34065
|
summary: hygieneSummary,
|
|
34057
34066
|
stats: hygieneStats
|
|
34067
|
+
},
|
|
34068
|
+
studio: {
|
|
34069
|
+
supervises: supervisesStudio,
|
|
34070
|
+
status: studioStatus
|
|
34058
34071
|
}
|
|
34059
34072
|
}
|
|
34060
34073
|
};
|
|
@@ -34078,6 +34091,15 @@ WARNING: Disk threshold breached. Run 'cleo gc run' to reclaim space.
|
|
|
34078
34091
|
`
|
|
34079
34092
|
);
|
|
34080
34093
|
}
|
|
34094
|
+
if (supervisesStudio !== null) {
|
|
34095
|
+
process.stdout.write(`
|
|
34096
|
+
Studio Supervision:
|
|
34097
|
+
`);
|
|
34098
|
+
process.stdout.write(` Enabled: ${supervisesStudio ? "yes" : "no"}
|
|
34099
|
+
`);
|
|
34100
|
+
process.stdout.write(` Status: ${studioStatus ?? "unknown"}
|
|
34101
|
+
`);
|
|
34102
|
+
}
|
|
34081
34103
|
process.stdout.write(`
|
|
34082
34104
|
Hygiene Loop (cross-project):
|
|
34083
34105
|
`);
|
|
@@ -34123,6 +34145,21 @@ Hygiene Loop (cross-project):
|
|
|
34123
34145
|
process.exit(1);
|
|
34124
34146
|
}
|
|
34125
34147
|
}
|
|
34148
|
+
function resolveDaemonInstallerScript() {
|
|
34149
|
+
const filePath = fileURLToPath3(import.meta.url);
|
|
34150
|
+
const candidate1 = join9(filePath, "..", "..", "..", "scripts", "install-daemon-service.mjs");
|
|
34151
|
+
if (existsSync8(candidate1)) return candidate1;
|
|
34152
|
+
const candidate2 = join9(
|
|
34153
|
+
filePath,
|
|
34154
|
+
"..",
|
|
34155
|
+
"..",
|
|
34156
|
+
"..",
|
|
34157
|
+
"..",
|
|
34158
|
+
"scripts",
|
|
34159
|
+
"install-daemon-service.mjs"
|
|
34160
|
+
);
|
|
34161
|
+
return candidate2;
|
|
34162
|
+
}
|
|
34126
34163
|
var startCommand3 = defineCommand({
|
|
34127
34164
|
meta: { name: "start", description: "Spawn the GC daemon as a detached background process" },
|
|
34128
34165
|
args: {
|
|
@@ -34130,6 +34167,10 @@ var startCommand3 = defineCommand({
|
|
|
34130
34167
|
type: "string",
|
|
34131
34168
|
description: "Override .cleo/ directory path"
|
|
34132
34169
|
},
|
|
34170
|
+
foreground: {
|
|
34171
|
+
type: "boolean",
|
|
34172
|
+
description: "Run the sentient daemon in the foreground (used by systemd/launchd service units)"
|
|
34173
|
+
},
|
|
34133
34174
|
json: {
|
|
34134
34175
|
type: "boolean",
|
|
34135
34176
|
description: "Output result as JSON"
|
|
@@ -34138,6 +34179,16 @@ var startCommand3 = defineCommand({
|
|
|
34138
34179
|
async run({ args }) {
|
|
34139
34180
|
const cleoDir = args["cleo-dir"] ?? join9(homedir2(), ".cleo");
|
|
34140
34181
|
const jsonMode = args.json ?? false;
|
|
34182
|
+
const foreground = args.foreground ?? false;
|
|
34183
|
+
if (foreground) {
|
|
34184
|
+
const projectRoot = process.cwd();
|
|
34185
|
+
process.stdout.write(
|
|
34186
|
+
`[CLEO DAEMON] Starting sentient daemon in foreground mode (PID ${process.pid})
|
|
34187
|
+
`
|
|
34188
|
+
);
|
|
34189
|
+
await bootstrapSentientDaemon(projectRoot);
|
|
34190
|
+
return;
|
|
34191
|
+
}
|
|
34141
34192
|
try {
|
|
34142
34193
|
const status = await getGCDaemonStatus(cleoDir);
|
|
34143
34194
|
if (status.running && status.pid) {
|
|
@@ -34246,6 +34297,86 @@ var statusCommand4 = defineCommand({
|
|
|
34246
34297
|
await showDaemonStatus(cleoDir, process.cwd(), args.json ?? false);
|
|
34247
34298
|
}
|
|
34248
34299
|
});
|
|
34300
|
+
var installCommand2 = defineCommand({
|
|
34301
|
+
meta: {
|
|
34302
|
+
name: "install",
|
|
34303
|
+
description: "Register the CLEO daemon as a user-level system service (systemd / launchd)"
|
|
34304
|
+
},
|
|
34305
|
+
args: {
|
|
34306
|
+
json: {
|
|
34307
|
+
type: "boolean",
|
|
34308
|
+
description: "Output result as JSON"
|
|
34309
|
+
}
|
|
34310
|
+
},
|
|
34311
|
+
async run({ args }) {
|
|
34312
|
+
const jsonMode = args.json ?? false;
|
|
34313
|
+
try {
|
|
34314
|
+
const scriptPath = resolveDaemonInstallerScript();
|
|
34315
|
+
const { installDaemonService } = await import(scriptPath);
|
|
34316
|
+
await installDaemonService();
|
|
34317
|
+
const result = {
|
|
34318
|
+
success: true,
|
|
34319
|
+
data: {
|
|
34320
|
+
platform: process.platform,
|
|
34321
|
+
message: "Daemon service installation complete."
|
|
34322
|
+
}
|
|
34323
|
+
};
|
|
34324
|
+
if (jsonMode) {
|
|
34325
|
+
process.stdout.write(JSON.stringify(result) + "\n");
|
|
34326
|
+
} else {
|
|
34327
|
+
process.stdout.write("CLEO: Daemon service installation complete.\n");
|
|
34328
|
+
}
|
|
34329
|
+
} catch (err) {
|
|
34330
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
34331
|
+
const result = { success: false, error: { code: "E_INTERNAL", message } };
|
|
34332
|
+
if (jsonMode) {
|
|
34333
|
+
process.stdout.write(JSON.stringify(result) + "\n");
|
|
34334
|
+
} else {
|
|
34335
|
+
process.stderr.write(`Error installing daemon service: ${message}
|
|
34336
|
+
`);
|
|
34337
|
+
}
|
|
34338
|
+
process.exit(1);
|
|
34339
|
+
}
|
|
34340
|
+
}
|
|
34341
|
+
});
|
|
34342
|
+
var uninstallCommand = defineCommand({
|
|
34343
|
+
meta: {
|
|
34344
|
+
name: "uninstall",
|
|
34345
|
+
description: "Disable and remove the user-level system service (systemd unit / launchd plist)"
|
|
34346
|
+
},
|
|
34347
|
+
args: {
|
|
34348
|
+
json: {
|
|
34349
|
+
type: "boolean",
|
|
34350
|
+
description: "Output result as JSON"
|
|
34351
|
+
}
|
|
34352
|
+
},
|
|
34353
|
+
async run({ args }) {
|
|
34354
|
+
const jsonMode = args.json ?? false;
|
|
34355
|
+
try {
|
|
34356
|
+
const scriptPath = resolveDaemonInstallerScript();
|
|
34357
|
+
const { uninstallDaemonService } = await import(scriptPath);
|
|
34358
|
+
const result = await uninstallDaemonService();
|
|
34359
|
+
const envelope = { success: result.success, data: result };
|
|
34360
|
+
if (jsonMode) {
|
|
34361
|
+
process.stdout.write(JSON.stringify(envelope) + "\n");
|
|
34362
|
+
} else {
|
|
34363
|
+
process.stdout.write(`CLEO: ${result.message}
|
|
34364
|
+
`);
|
|
34365
|
+
}
|
|
34366
|
+
if (!result.success) process.exit(1);
|
|
34367
|
+
} catch (err) {
|
|
34368
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
34369
|
+
const result = { success: false, error: { code: "E_INTERNAL", message } };
|
|
34370
|
+
if (jsonMode) {
|
|
34371
|
+
process.stdout.write(JSON.stringify(result) + "\n");
|
|
34372
|
+
} else {
|
|
34373
|
+
process.stderr.write(`Error uninstalling daemon service: ${message}
|
|
34374
|
+
`);
|
|
34375
|
+
}
|
|
34376
|
+
process.exit(1);
|
|
34377
|
+
}
|
|
34378
|
+
}
|
|
34379
|
+
});
|
|
34249
34380
|
var daemonCommand = defineCommand({
|
|
34250
34381
|
meta: {
|
|
34251
34382
|
name: "daemon",
|
|
@@ -34264,7 +34395,9 @@ var daemonCommand = defineCommand({
|
|
|
34264
34395
|
subCommands: {
|
|
34265
34396
|
start: startCommand3,
|
|
34266
34397
|
stop: stopCommand3,
|
|
34267
|
-
status: statusCommand4
|
|
34398
|
+
status: statusCommand4,
|
|
34399
|
+
install: installCommand2,
|
|
34400
|
+
uninstall: uninstallCommand
|
|
34268
34401
|
},
|
|
34269
34402
|
async run({ args, cmd, rawArgs }) {
|
|
34270
34403
|
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
@@ -34628,14 +34761,14 @@ var detectCommand2 = defineCommand({
|
|
|
34628
34761
|
|
|
34629
34762
|
// packages/cleo/src/cli/commands/detect-drift.ts
|
|
34630
34763
|
init_src();
|
|
34631
|
-
import { existsSync as
|
|
34764
|
+
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync9 } from "node:fs";
|
|
34632
34765
|
import { dirname as dirname6, join as join10 } from "node:path";
|
|
34633
34766
|
init_paths();
|
|
34634
34767
|
init_renderers();
|
|
34635
34768
|
function findProjectRoot() {
|
|
34636
34769
|
let currentDir = process.cwd();
|
|
34637
34770
|
while (currentDir !== "/") {
|
|
34638
|
-
if (
|
|
34771
|
+
if (existsSync9(join10(currentDir, "package.json"))) {
|
|
34639
34772
|
return currentDir;
|
|
34640
34773
|
}
|
|
34641
34774
|
const parent = dirname6(currentDir);
|
|
@@ -34651,7 +34784,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34651
34784
|
},
|
|
34652
34785
|
async run() {
|
|
34653
34786
|
const projectRoot = findProjectRoot();
|
|
34654
|
-
const isCleoRepo =
|
|
34787
|
+
const isCleoRepo = existsSync9(join10(projectRoot, "packages", "cleo", "src"));
|
|
34655
34788
|
const cleoSrcRoot = isCleoRepo ? join10(projectRoot, "packages", "cleo", "src") : join10(projectRoot, "src");
|
|
34656
34789
|
const safeRead = (filePath) => {
|
|
34657
34790
|
try {
|
|
@@ -34667,7 +34800,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34667
34800
|
recommendations: []
|
|
34668
34801
|
};
|
|
34669
34802
|
const injPath = join10(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
34670
|
-
if (
|
|
34803
|
+
if (existsSync9(injPath)) {
|
|
34671
34804
|
const content = safeRead(injPath);
|
|
34672
34805
|
userResult.checks.push({
|
|
34673
34806
|
name: "Agent injection",
|
|
@@ -34721,7 +34854,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34721
34854
|
const specPath = join10(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
|
|
34722
34855
|
const registryPath = join10(cleoSrcRoot, "dispatch", "registry.ts");
|
|
34723
34856
|
const dispatchDomainsDir = join10(cleoSrcRoot, "dispatch", "domains");
|
|
34724
|
-
if (!
|
|
34857
|
+
if (!existsSync9(specPath)) {
|
|
34725
34858
|
addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
|
|
34726
34859
|
{
|
|
34727
34860
|
severity: "error",
|
|
@@ -34731,7 +34864,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34731
34864
|
recommendation: "Create docs/specs/CLEO-OPERATION-CONSTITUTION.md with canonical operation definitions"
|
|
34732
34865
|
}
|
|
34733
34866
|
]);
|
|
34734
|
-
} else if (!
|
|
34867
|
+
} else if (!existsSync9(registryPath) || !existsSync9(dispatchDomainsDir)) {
|
|
34735
34868
|
addCheck("Gateway-to-spec sync", "fail", "Dispatch registry or domains missing", [
|
|
34736
34869
|
{
|
|
34737
34870
|
severity: "error",
|
|
@@ -34791,7 +34924,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34791
34924
|
try {
|
|
34792
34925
|
const cliDir = join10(cleoSrcRoot, "cli", "commands");
|
|
34793
34926
|
const coreDir = isCleoRepo ? join10(projectRoot, "packages", "core", "src") : join10(projectRoot, "src", "core");
|
|
34794
|
-
if (!
|
|
34927
|
+
if (!existsSync9(cliDir)) {
|
|
34795
34928
|
addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
|
|
34796
34929
|
{
|
|
34797
34930
|
severity: "error",
|
|
@@ -34800,7 +34933,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34800
34933
|
recommendation: "Verify TypeScript source structure is intact"
|
|
34801
34934
|
}
|
|
34802
34935
|
]);
|
|
34803
|
-
} else if (!
|
|
34936
|
+
} else if (!existsSync9(coreDir)) {
|
|
34804
34937
|
addCheck("CLI-to-core sync", "fail", "Core directory missing", [
|
|
34805
34938
|
{
|
|
34806
34939
|
severity: "error",
|
|
@@ -34818,7 +34951,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34818
34951
|
}
|
|
34819
34952
|
try {
|
|
34820
34953
|
const domainsDir = join10(cleoSrcRoot, "dispatch", "domains");
|
|
34821
|
-
if (!
|
|
34954
|
+
if (!existsSync9(domainsDir)) {
|
|
34822
34955
|
addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
|
|
34823
34956
|
{
|
|
34824
34957
|
severity: "error",
|
|
@@ -34836,7 +34969,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34836
34969
|
}
|
|
34837
34970
|
try {
|
|
34838
34971
|
const matrixPath = join10(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
|
|
34839
|
-
if (!
|
|
34972
|
+
if (!existsSync9(matrixPath)) {
|
|
34840
34973
|
addCheck("Capability matrix", "fail", "Capability matrix missing", [
|
|
34841
34974
|
{
|
|
34842
34975
|
severity: "error",
|
|
@@ -34853,7 +34986,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34853
34986
|
}
|
|
34854
34987
|
try {
|
|
34855
34988
|
const schemaPath = join10(projectRoot, "src", "store", "schema.ts");
|
|
34856
|
-
if (!
|
|
34989
|
+
if (!existsSync9(schemaPath)) {
|
|
34857
34990
|
addCheck("Schema validation", "fail", "Schema definition missing", [
|
|
34858
34991
|
{
|
|
34859
34992
|
severity: "error",
|
|
@@ -34890,7 +35023,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34890
35023
|
const visionPath = join10(projectRoot, "docs", "concepts", "CLEO-VISION.md");
|
|
34891
35024
|
const specPath = join10(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
|
|
34892
35025
|
const issues = [];
|
|
34893
|
-
if (!
|
|
35026
|
+
if (!existsSync9(visionPath)) {
|
|
34894
35027
|
issues.push({
|
|
34895
35028
|
severity: "error",
|
|
34896
35029
|
category: "vision",
|
|
@@ -34899,7 +35032,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34899
35032
|
recommendation: "Create docs/concepts/CLEO-VISION.md with project vision"
|
|
34900
35033
|
});
|
|
34901
35034
|
}
|
|
34902
|
-
if (!
|
|
35035
|
+
if (!existsSync9(specPath)) {
|
|
34903
35036
|
issues.push({
|
|
34904
35037
|
severity: "error",
|
|
34905
35038
|
category: "spec",
|
|
@@ -34944,7 +35077,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34944
35077
|
}
|
|
34945
35078
|
try {
|
|
34946
35079
|
const injectionPath = join10(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
34947
|
-
if (!
|
|
35080
|
+
if (!existsSync9(injectionPath)) {
|
|
34948
35081
|
addCheck("Agent injection", "fail", "Agent injection template missing", [
|
|
34949
35082
|
{
|
|
34950
35083
|
severity: "error",
|
|
@@ -34974,7 +35107,7 @@ var detectDriftCommand = defineCommand({
|
|
|
34974
35107
|
}
|
|
34975
35108
|
try {
|
|
34976
35109
|
const exitCodesPath = join10(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
|
|
34977
|
-
if (!
|
|
35110
|
+
if (!existsSync9(exitCodesPath)) {
|
|
34978
35111
|
addCheck("Exit codes", "fail", "Exit codes definition missing", [
|
|
34979
35112
|
{
|
|
34980
35113
|
severity: "error",
|
|
@@ -36671,7 +36804,7 @@ var gcCommand = defineCommand({
|
|
|
36671
36804
|
// packages/cleo/src/cli/commands/generate-changelog.ts
|
|
36672
36805
|
init_src();
|
|
36673
36806
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
36674
|
-
import { existsSync as
|
|
36807
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync10, writeFileSync as writeFileSync3 } from "node:fs";
|
|
36675
36808
|
import { dirname as dirname8, join as join13 } from "node:path";
|
|
36676
36809
|
import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as getProjectRoot23 } from "@cleocode/core";
|
|
36677
36810
|
init_renderers();
|
|
@@ -36832,7 +36965,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
36832
36965
|
const dryRun = args["dry-run"] === true;
|
|
36833
36966
|
const sourceFile = getChangelogSource();
|
|
36834
36967
|
const sourcePath = join13(getProjectRoot23(), sourceFile);
|
|
36835
|
-
if (!
|
|
36968
|
+
if (!existsSync10(sourcePath)) {
|
|
36836
36969
|
throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
36837
36970
|
}
|
|
36838
36971
|
const sourceContent = readFileSync10(sourcePath, "utf-8");
|
|
@@ -38283,7 +38416,7 @@ var mapCommand = defineCommand({
|
|
|
38283
38416
|
|
|
38284
38417
|
// packages/cleo/src/cli/commands/memory.ts
|
|
38285
38418
|
import { createHash as createHash2 } from "node:crypto";
|
|
38286
|
-
import { existsSync as
|
|
38419
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync11, writeFileSync as writeFileSync4 } from "node:fs";
|
|
38287
38420
|
import { homedir as homedir4 } from "node:os";
|
|
38288
38421
|
import { join as join14 } from "node:path";
|
|
38289
38422
|
import {
|
|
@@ -38328,7 +38461,7 @@ ${body}`).digest("hex").slice(0, 16);
|
|
|
38328
38461
|
}
|
|
38329
38462
|
function loadImportHashes(stateFile) {
|
|
38330
38463
|
try {
|
|
38331
|
-
if (!
|
|
38464
|
+
if (!existsSync11(stateFile)) return /* @__PURE__ */ new Set();
|
|
38332
38465
|
const raw = readFileSync11(stateFile, "utf-8");
|
|
38333
38466
|
const parsed = JSON.parse(raw);
|
|
38334
38467
|
return new Set(parsed.hashes);
|
|
@@ -38338,7 +38471,7 @@ function loadImportHashes(stateFile) {
|
|
|
38338
38471
|
}
|
|
38339
38472
|
function saveImportHashes(stateFile, hashes) {
|
|
38340
38473
|
const dir = stateFile.slice(0, stateFile.lastIndexOf("/"));
|
|
38341
|
-
if (!
|
|
38474
|
+
if (!existsSync11(dir)) mkdirSync4(dir, { recursive: true });
|
|
38342
38475
|
writeFileSync4(stateFile, JSON.stringify({ hashes: [...hashes] }, null, 2), "utf-8");
|
|
38343
38476
|
}
|
|
38344
38477
|
var storeCommand = defineCommand({
|
|
@@ -39588,7 +39721,7 @@ var importCommand3 = defineCommand({
|
|
|
39588
39721
|
const isJson = !!args.json;
|
|
39589
39722
|
const projectRoot = getProjectRoot24();
|
|
39590
39723
|
const stateFile = join14(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
39591
|
-
if (!
|
|
39724
|
+
if (!existsSync11(sourceDir)) {
|
|
39592
39725
|
const msg = `Source directory not found: ${sourceDir}`;
|
|
39593
39726
|
if (isJson) {
|
|
39594
39727
|
console.log(JSON.stringify({ success: false, error: msg }));
|
|
@@ -50243,7 +50376,7 @@ var infoCommand = defineCommand({
|
|
|
50243
50376
|
);
|
|
50244
50377
|
}
|
|
50245
50378
|
});
|
|
50246
|
-
var
|
|
50379
|
+
var installCommand3 = defineCommand({
|
|
50247
50380
|
meta: { name: "install", description: "Install skill to agent directory" },
|
|
50248
50381
|
args: {
|
|
50249
50382
|
"skill-name": {
|
|
@@ -50269,7 +50402,7 @@ var installCommand2 = defineCommand({
|
|
|
50269
50402
|
);
|
|
50270
50403
|
}
|
|
50271
50404
|
});
|
|
50272
|
-
var
|
|
50405
|
+
var uninstallCommand2 = defineCommand({
|
|
50273
50406
|
meta: { name: "uninstall", description: "Uninstall a skill" },
|
|
50274
50407
|
args: {
|
|
50275
50408
|
"skill-name": {
|
|
@@ -50470,8 +50603,8 @@ var skillsCommand2 = defineCommand({
|
|
|
50470
50603
|
search: searchCommand3,
|
|
50471
50604
|
validate: validateCommand7,
|
|
50472
50605
|
info: infoCommand,
|
|
50473
|
-
install:
|
|
50474
|
-
uninstall:
|
|
50606
|
+
install: installCommand3,
|
|
50607
|
+
uninstall: uninstallCommand2,
|
|
50475
50608
|
enable: enableCommand2,
|
|
50476
50609
|
disable: disableCommand2,
|
|
50477
50610
|
refresh: refreshCommand,
|
|
@@ -52638,7 +52771,7 @@ Or via NodeSource: https://github.com/nodesource/distributions
|
|
|
52638
52771
|
}
|
|
52639
52772
|
}
|
|
52640
52773
|
function getPackageVersion() {
|
|
52641
|
-
const pkgPath = join19(dirname9(
|
|
52774
|
+
const pkgPath = join19(dirname9(fileURLToPath4(import.meta.url)), "../../package.json");
|
|
52642
52775
|
const pkg = JSON.parse(readFileSync13(pkgPath, "utf-8"));
|
|
52643
52776
|
return pkg.version;
|
|
52644
52777
|
}
|