@cleocode/core 2026.4.26 → 2026.4.28
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/index.js +58 -68
- package/dist/index.js.map +3 -3
- package/dist/system/safestop.d.ts +1 -1
- package/dist/system/safestop.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/system/safestop.ts +13 -23
package/dist/index.js
CHANGED
|
@@ -25748,10 +25748,10 @@ async function readProjectMeta(projectPath) {
|
|
|
25748
25748
|
}
|
|
25749
25749
|
async function readProjectId(projectPath) {
|
|
25750
25750
|
try {
|
|
25751
|
-
const { readFileSync:
|
|
25751
|
+
const { readFileSync: readFileSync78, existsSync: existsSync108 } = await import("node:fs");
|
|
25752
25752
|
const infoPath = join63(projectPath, ".cleo", "project-info.json");
|
|
25753
25753
|
if (!existsSync108(infoPath)) return "";
|
|
25754
|
-
const data = JSON.parse(
|
|
25754
|
+
const data = JSON.parse(readFileSync78(infoPath, "utf-8"));
|
|
25755
25755
|
return typeof data.projectId === "string" ? data.projectId : "";
|
|
25756
25756
|
} catch {
|
|
25757
25757
|
return "";
|
|
@@ -27161,7 +27161,7 @@ __export(init_exports, {
|
|
|
27161
27161
|
resolveSeedAgentsDir: () => resolveSeedAgentsDir,
|
|
27162
27162
|
updateDocs: () => updateDocs
|
|
27163
27163
|
});
|
|
27164
|
-
import { existsSync as existsSync104, readdirSync as readdirSync36, readFileSync as
|
|
27164
|
+
import { existsSync as existsSync104, readdirSync as readdirSync36, readFileSync as readFileSync74 } from "node:fs";
|
|
27165
27165
|
import { copyFile as copyFile4, lstat, mkdir as mkdir16, readFile as readFile17, symlink, unlink as unlink4, writeFile as writeFile11 } from "node:fs/promises";
|
|
27166
27166
|
import { platform as platform4 } from "node:os";
|
|
27167
27167
|
import { basename as basename17, dirname as dirname21, join as join104 } from "node:path";
|
|
@@ -27295,7 +27295,7 @@ async function initCoreSkills(created, warnings) {
|
|
|
27295
27295
|
warnings.push("Failed to register skill library with CAAMP");
|
|
27296
27296
|
}
|
|
27297
27297
|
const catalogPath = join104(ctSkillsRoot, "skills.json");
|
|
27298
|
-
const catalog3 = JSON.parse(
|
|
27298
|
+
const catalog3 = JSON.parse(readFileSync74(catalogPath, "utf-8"));
|
|
27299
27299
|
const skills = catalog3.skills ?? [];
|
|
27300
27300
|
const coreSkills = skills.filter((s) => s.tier <= 2);
|
|
27301
27301
|
const installed = [];
|
|
@@ -27364,7 +27364,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
|
|
|
27364
27364
|
skipped.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
27365
27365
|
continue;
|
|
27366
27366
|
}
|
|
27367
|
-
const content =
|
|
27367
|
+
const content = readFileSync74(join104(issueSrcDir, file2), "utf-8");
|
|
27368
27368
|
await writeFile11(dest, content, "utf-8");
|
|
27369
27369
|
created.push(`.github/ISSUE_TEMPLATE/${file2}`);
|
|
27370
27370
|
}
|
|
@@ -27375,7 +27375,7 @@ async function installGitHubTemplates(projectRoot, created, skipped) {
|
|
|
27375
27375
|
if (existsSync104(prTemplateDest)) {
|
|
27376
27376
|
skipped.push(".github/pull_request_template.md");
|
|
27377
27377
|
} else {
|
|
27378
|
-
const content =
|
|
27378
|
+
const content = readFileSync74(prTemplateSrc, "utf-8");
|
|
27379
27379
|
await writeFile11(prTemplateDest, content, "utf-8");
|
|
27380
27380
|
created.push(".github/pull_request_template.md");
|
|
27381
27381
|
}
|
|
@@ -52936,33 +52936,23 @@ async function getRuntimeDiagnostics(options) {
|
|
|
52936
52936
|
init_src();
|
|
52937
52937
|
init_errors3();
|
|
52938
52938
|
init_data_accessor();
|
|
52939
|
-
import { existsSync as existsSync94
|
|
52939
|
+
import { existsSync as existsSync94 } from "node:fs";
|
|
52940
52940
|
import { join as join97 } from "node:path";
|
|
52941
|
-
function safestop(projectRoot, opts) {
|
|
52941
|
+
async function safestop(projectRoot, opts) {
|
|
52942
52942
|
const dryRun = opts?.dryRun ?? false;
|
|
52943
52943
|
const reason = opts?.reason ?? "Manual safestop";
|
|
52944
52944
|
let sessionEnded = false;
|
|
52945
52945
|
if (!dryRun && !opts?.noSessionEnd) {
|
|
52946
|
-
|
|
52947
|
-
|
|
52948
|
-
|
|
52949
|
-
|
|
52950
|
-
|
|
52951
|
-
|
|
52952
|
-
|
|
52953
|
-
|
|
52954
|
-
s.status = "ended";
|
|
52955
|
-
s.endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
52956
|
-
s.endNote = `Safestop: ${reason}`;
|
|
52957
|
-
changed = true;
|
|
52958
|
-
sessionEnded = true;
|
|
52959
|
-
}
|
|
52960
|
-
}
|
|
52961
|
-
if (changed) {
|
|
52962
|
-
writeFileSync15(sessPath, JSON.stringify(data, null, 2), "utf-8");
|
|
52963
|
-
}
|
|
52964
|
-
} catch {
|
|
52946
|
+
try {
|
|
52947
|
+
const accessor = await getAccessor(projectRoot);
|
|
52948
|
+
const activeSession = await accessor.getActiveSession();
|
|
52949
|
+
if (activeSession && activeSession.id !== "default") {
|
|
52950
|
+
activeSession.status = "ended";
|
|
52951
|
+
activeSession.endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
52952
|
+
await accessor.upsertSingleSession(activeSession);
|
|
52953
|
+
sessionEnded = true;
|
|
52965
52954
|
}
|
|
52955
|
+
} catch {
|
|
52966
52956
|
}
|
|
52967
52957
|
}
|
|
52968
52958
|
return { stopped: !dryRun, reason, sessionEnded, handoff: opts?.handoff, dryRun };
|
|
@@ -53495,7 +53485,7 @@ __export(templates_exports, {
|
|
|
53495
53485
|
});
|
|
53496
53486
|
|
|
53497
53487
|
// packages/core/src/templates/parser.ts
|
|
53498
|
-
import { existsSync as existsSync95, readdirSync as readdirSync31, readFileSync as
|
|
53488
|
+
import { existsSync as existsSync95, readdirSync as readdirSync31, readFileSync as readFileSync67 } from "fs";
|
|
53499
53489
|
import { join as join98 } from "path";
|
|
53500
53490
|
import { parse as parseYaml } from "yaml";
|
|
53501
53491
|
var SUFFIX_PATTERNS = ["_report", "_request", "_question"];
|
|
@@ -53512,7 +53502,7 @@ function deriveSubcommand(filename) {
|
|
|
53512
53502
|
}
|
|
53513
53503
|
function parseTemplateFile2(templateDir, filename) {
|
|
53514
53504
|
const filePath = join98(templateDir, filename);
|
|
53515
|
-
const raw =
|
|
53505
|
+
const raw = readFileSync67(filePath, "utf-8");
|
|
53516
53506
|
const parsed = parseYaml(raw);
|
|
53517
53507
|
const name2 = typeof parsed.name === "string" ? parsed.name : filename;
|
|
53518
53508
|
const titlePrefix = typeof parsed.title === "string" ? parsed.title : "";
|
|
@@ -53709,7 +53699,7 @@ __export(ui_exports, {
|
|
|
53709
53699
|
});
|
|
53710
53700
|
|
|
53711
53701
|
// packages/core/src/ui/aliases.ts
|
|
53712
|
-
import { existsSync as existsSync96, readFileSync as
|
|
53702
|
+
import { existsSync as existsSync96, readFileSync as readFileSync68, writeFileSync as writeFileSync15 } from "node:fs";
|
|
53713
53703
|
import { homedir as homedir5, platform as platform3 } from "node:os";
|
|
53714
53704
|
import { join as join99 } from "node:path";
|
|
53715
53705
|
var MARKER_START = "# CLEO-CLAUDE-ALIASES:START";
|
|
@@ -53781,40 +53771,40 @@ function generatePowershellAliases(cleoPath) {
|
|
|
53781
53771
|
}
|
|
53782
53772
|
function hasAliasBlock(filePath) {
|
|
53783
53773
|
if (!existsSync96(filePath)) return false;
|
|
53784
|
-
const content =
|
|
53774
|
+
const content = readFileSync68(filePath, "utf-8");
|
|
53785
53775
|
return content.includes(MARKER_START) && content.includes(MARKER_END);
|
|
53786
53776
|
}
|
|
53787
53777
|
function getInstalledVersion(filePath) {
|
|
53788
53778
|
if (!existsSync96(filePath)) return null;
|
|
53789
|
-
const content =
|
|
53779
|
+
const content = readFileSync68(filePath, "utf-8");
|
|
53790
53780
|
const match = content.match(/CLEO CLI aliases \(v([^)]+)\)/);
|
|
53791
53781
|
return match?.[1] ?? null;
|
|
53792
53782
|
}
|
|
53793
53783
|
function injectAliases(filePath, shell = "bash", cleoPath) {
|
|
53794
53784
|
const content = shell === "powershell" ? generatePowershellAliases(cleoPath) : generateBashAliases(cleoPath);
|
|
53795
53785
|
if (!existsSync96(filePath)) {
|
|
53796
|
-
|
|
53786
|
+
writeFileSync15(filePath, content + "\n", "utf-8");
|
|
53797
53787
|
return { action: "created", version: ALIASES_VERSION };
|
|
53798
53788
|
}
|
|
53799
|
-
const existing =
|
|
53789
|
+
const existing = readFileSync68(filePath, "utf-8");
|
|
53800
53790
|
if (hasAliasBlock(filePath)) {
|
|
53801
53791
|
const startIdx = existing.indexOf(MARKER_START);
|
|
53802
53792
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
53803
53793
|
const updated = existing.slice(0, startIdx) + content + existing.slice(endIdx);
|
|
53804
|
-
|
|
53794
|
+
writeFileSync15(filePath, updated, "utf-8");
|
|
53805
53795
|
return { action: "updated", version: ALIASES_VERSION };
|
|
53806
53796
|
}
|
|
53807
|
-
|
|
53797
|
+
writeFileSync15(filePath, existing + "\n" + content + "\n", "utf-8");
|
|
53808
53798
|
return { action: "added", version: ALIASES_VERSION };
|
|
53809
53799
|
}
|
|
53810
53800
|
function removeAliases(filePath) {
|
|
53811
53801
|
if (!existsSync96(filePath) || !hasAliasBlock(filePath)) return false;
|
|
53812
|
-
const existing =
|
|
53802
|
+
const existing = readFileSync68(filePath, "utf-8");
|
|
53813
53803
|
const startIdx = existing.indexOf(MARKER_START);
|
|
53814
53804
|
const endIdx = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
53815
53805
|
const before = existing.slice(0, startIdx).replace(/\n+$/, "\n");
|
|
53816
53806
|
const after = existing.slice(endIdx).replace(/^\n+/, "\n");
|
|
53817
|
-
|
|
53807
|
+
writeFileSync15(filePath, before + after, "utf-8");
|
|
53818
53808
|
return true;
|
|
53819
53809
|
}
|
|
53820
53810
|
function checkAliasesStatus(shell) {
|
|
@@ -53831,7 +53821,7 @@ function checkAliasesStatus(shell) {
|
|
|
53831
53821
|
|
|
53832
53822
|
// packages/core/src/ui/changelog.ts
|
|
53833
53823
|
init_data_accessor();
|
|
53834
|
-
import { appendFileSync as appendFileSync9, existsSync as existsSync97, readFileSync as
|
|
53824
|
+
import { appendFileSync as appendFileSync9, existsSync as existsSync97, readFileSync as readFileSync69, writeFileSync as writeFileSync16 } from "node:fs";
|
|
53835
53825
|
var LABEL_CATEGORIES = {
|
|
53836
53826
|
feature: "Features",
|
|
53837
53827
|
feat: "Features",
|
|
@@ -53932,21 +53922,21 @@ function formatChangelogJson(version2, date6, sections) {
|
|
|
53932
53922
|
};
|
|
53933
53923
|
}
|
|
53934
53924
|
function writeChangelogFile(filePath, content) {
|
|
53935
|
-
|
|
53925
|
+
writeFileSync16(filePath, content, "utf-8");
|
|
53936
53926
|
}
|
|
53937
53927
|
function appendToChangelog(filePath, newContent) {
|
|
53938
53928
|
if (!existsSync97(filePath)) {
|
|
53939
|
-
|
|
53929
|
+
writeFileSync16(filePath, `# Changelog
|
|
53940
53930
|
|
|
53941
53931
|
${newContent}`, "utf-8");
|
|
53942
53932
|
return;
|
|
53943
53933
|
}
|
|
53944
|
-
const existing =
|
|
53934
|
+
const existing = readFileSync69(filePath, "utf-8");
|
|
53945
53935
|
const headerMatch = existing.match(/^# .+\n/m);
|
|
53946
53936
|
if (headerMatch) {
|
|
53947
53937
|
const insertPos = (headerMatch.index ?? 0) + headerMatch[0].length;
|
|
53948
53938
|
const updated = existing.slice(0, insertPos) + "\n" + newContent + existing.slice(insertPos);
|
|
53949
|
-
|
|
53939
|
+
writeFileSync16(filePath, updated, "utf-8");
|
|
53950
53940
|
} else {
|
|
53951
53941
|
appendFileSync9(filePath, "\n" + newContent);
|
|
53952
53942
|
}
|
|
@@ -53981,13 +53971,13 @@ ${markdown}`);
|
|
|
53981
53971
|
}
|
|
53982
53972
|
|
|
53983
53973
|
// packages/core/src/ui/command-registry.ts
|
|
53984
|
-
import { existsSync as existsSync98, readdirSync as readdirSync32, readFileSync as
|
|
53974
|
+
import { existsSync as existsSync98, readdirSync as readdirSync32, readFileSync as readFileSync70 } from "node:fs";
|
|
53985
53975
|
import { basename as basename16, join as join100 } from "node:path";
|
|
53986
53976
|
var CLEO_HEADER_START = "###CLEO";
|
|
53987
53977
|
var CLEO_HEADER_END = "###END";
|
|
53988
53978
|
function parseCommandHeader(scriptPath) {
|
|
53989
53979
|
if (!existsSync98(scriptPath)) return null;
|
|
53990
|
-
const content =
|
|
53980
|
+
const content = readFileSync70(scriptPath, "utf-8");
|
|
53991
53981
|
const lines = content.split("\n");
|
|
53992
53982
|
let inHeader = false;
|
|
53993
53983
|
const headerLines = [];
|
|
@@ -68779,7 +68769,7 @@ function calculateOrchestrationOverhead(orchestratorTokens, totalSubagentTokens,
|
|
|
68779
68769
|
}
|
|
68780
68770
|
|
|
68781
68771
|
// packages/core/src/validation/docs-sync.ts
|
|
68782
|
-
import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as
|
|
68772
|
+
import { existsSync as existsSync99, readdirSync as readdirSync33, readFileSync as readFileSync71 } from "node:fs";
|
|
68783
68773
|
import { join as join101 } from "node:path";
|
|
68784
68774
|
function getScriptCommands(scriptsDir) {
|
|
68785
68775
|
if (!existsSync99(scriptsDir)) return [];
|
|
@@ -68792,7 +68782,7 @@ function getScriptCommands(scriptsDir) {
|
|
|
68792
68782
|
function getIndexScripts(indexPath) {
|
|
68793
68783
|
if (!existsSync99(indexPath)) return [];
|
|
68794
68784
|
try {
|
|
68795
|
-
const content =
|
|
68785
|
+
const content = readFileSync71(indexPath, "utf-8");
|
|
68796
68786
|
const index2 = JSON.parse(content);
|
|
68797
68787
|
return index2.commands.map((cmd) => cmd.script ?? "").filter((s) => s).map((s) => s.replace(/\.sh$/, "")).sort();
|
|
68798
68788
|
} catch {
|
|
@@ -68802,7 +68792,7 @@ function getIndexScripts(indexPath) {
|
|
|
68802
68792
|
function getIndexCommands(indexPath) {
|
|
68803
68793
|
if (!existsSync99(indexPath)) return [];
|
|
68804
68794
|
try {
|
|
68805
|
-
const content =
|
|
68795
|
+
const content = readFileSync71(indexPath, "utf-8");
|
|
68806
68796
|
const index2 = JSON.parse(content);
|
|
68807
68797
|
return index2.commands.map((cmd) => cmd.name).sort();
|
|
68808
68798
|
} catch {
|
|
@@ -68839,8 +68829,8 @@ function checkWrapperSync(wrapperPath, indexPath) {
|
|
|
68839
68829
|
if (!existsSync99(wrapperPath) || !existsSync99(indexPath)) return [];
|
|
68840
68830
|
const issues = [];
|
|
68841
68831
|
try {
|
|
68842
|
-
const wrapperContent =
|
|
68843
|
-
const indexContent =
|
|
68832
|
+
const wrapperContent = readFileSync71(wrapperPath, "utf-8");
|
|
68833
|
+
const indexContent = readFileSync71(indexPath, "utf-8");
|
|
68844
68834
|
const index2 = JSON.parse(indexContent);
|
|
68845
68835
|
const match = wrapperContent.match(/_get_all_commands\(\)\s*\{[^}]*echo\s+"([^"]+)"/);
|
|
68846
68836
|
const wrapperCmds = new Set(match ? match[1].split(/\s+/).filter(Boolean) : []);
|
|
@@ -68882,7 +68872,7 @@ function detectDrift(mode = "full", projectRoot = ".") {
|
|
|
68882
68872
|
const readmePath = join101(projectRoot, "README.md");
|
|
68883
68873
|
if (existsSync99(readmePath)) {
|
|
68884
68874
|
try {
|
|
68885
|
-
const readme =
|
|
68875
|
+
const readme = readFileSync71(readmePath, "utf-8");
|
|
68886
68876
|
const readmeCmds = new Set(
|
|
68887
68877
|
(readme.match(/cleo [a-z-]+/g) ?? []).map((m) => m.replace("cleo ", ""))
|
|
68888
68878
|
);
|
|
@@ -68916,7 +68906,7 @@ function shouldRunDriftDetection(enabled = true, autoCheck = false, command, cri
|
|
|
68916
68906
|
// packages/core/src/validation/doctor/project-cache.ts
|
|
68917
68907
|
init_paths();
|
|
68918
68908
|
import { createHash as createHash10 } from "node:crypto";
|
|
68919
|
-
import { existsSync as existsSync100, mkdirSync as mkdirSync22, readFileSync as
|
|
68909
|
+
import { existsSync as existsSync100, mkdirSync as mkdirSync22, readFileSync as readFileSync72, unlinkSync as unlinkSync8, writeFileSync as writeFileSync17 } from "node:fs";
|
|
68920
68910
|
import { dirname as dirname19, join as join102 } from "node:path";
|
|
68921
68911
|
var CACHE_VERSION = "1.0.0";
|
|
68922
68912
|
var CACHE_TTL_SECONDS = 300;
|
|
@@ -68935,13 +68925,13 @@ function initCacheFile(cacheFile) {
|
|
|
68935
68925
|
if (!existsSync100(dir)) {
|
|
68936
68926
|
mkdirSync22(dir, { recursive: true });
|
|
68937
68927
|
}
|
|
68938
|
-
|
|
68928
|
+
writeFileSync17(cacheFile, JSON.stringify(cache, null, 2));
|
|
68939
68929
|
return cache;
|
|
68940
68930
|
}
|
|
68941
68931
|
function loadCache(cacheFile) {
|
|
68942
68932
|
if (!existsSync100(cacheFile)) return null;
|
|
68943
68933
|
try {
|
|
68944
|
-
const content =
|
|
68934
|
+
const content = readFileSync72(cacheFile, "utf-8");
|
|
68945
68935
|
return JSON.parse(content);
|
|
68946
68936
|
} catch {
|
|
68947
68937
|
return null;
|
|
@@ -68950,7 +68940,7 @@ function loadCache(cacheFile) {
|
|
|
68950
68940
|
function getFileHash(filePath) {
|
|
68951
68941
|
if (!existsSync100(filePath)) return "";
|
|
68952
68942
|
try {
|
|
68953
|
-
const content =
|
|
68943
|
+
const content = readFileSync72(filePath);
|
|
68954
68944
|
return createHash10("sha256").update(content).digest("hex");
|
|
68955
68945
|
} catch {
|
|
68956
68946
|
return "";
|
|
@@ -68995,14 +68985,14 @@ function cacheValidationResult(projectHash, projectPath, validationStatus, issue
|
|
|
68995
68985
|
ttl: CACHE_TTL_SECONDS
|
|
68996
68986
|
};
|
|
68997
68987
|
cache.lastUpdated = timestamp2;
|
|
68998
|
-
|
|
68988
|
+
writeFileSync17(cachePath, JSON.stringify(cache, null, 2));
|
|
68999
68989
|
}
|
|
69000
68990
|
function clearProjectCache(projectHash, cacheFile) {
|
|
69001
68991
|
const cachePath = cacheFile ?? getCacheFilePath();
|
|
69002
68992
|
const cache = loadCache(cachePath);
|
|
69003
68993
|
if (!cache) return;
|
|
69004
68994
|
delete cache.projects[projectHash];
|
|
69005
|
-
|
|
68995
|
+
writeFileSync17(cachePath, JSON.stringify(cache, null, 2));
|
|
69006
68996
|
}
|
|
69007
68997
|
function clearEntireCache(cacheFile) {
|
|
69008
68998
|
const cachePath = cacheFile ?? getCacheFilePath();
|
|
@@ -70177,7 +70167,7 @@ async function validateAndLog(taskId, manifestPath = DEFAULT_MANIFEST_PATH, comp
|
|
|
70177
70167
|
|
|
70178
70168
|
// packages/core/src/validation/protocol-common.ts
|
|
70179
70169
|
init_src();
|
|
70180
|
-
import { existsSync as existsSync102, readdirSync as readdirSync34, readFileSync as
|
|
70170
|
+
import { existsSync as existsSync102, readdirSync as readdirSync34, readFileSync as readFileSync73 } from "node:fs";
|
|
70181
70171
|
function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
70182
70172
|
if (!existsSync102(expectedDir)) return false;
|
|
70183
70173
|
const filePattern = pattern ?? `${taskId}`;
|
|
@@ -70191,7 +70181,7 @@ function checkOutputFileExists(taskId, expectedDir, pattern) {
|
|
|
70191
70181
|
function checkDocumentationSections(filePath, sections) {
|
|
70192
70182
|
if (!existsSync102(filePath)) return false;
|
|
70193
70183
|
try {
|
|
70194
|
-
const content =
|
|
70184
|
+
const content = readFileSync73(filePath, "utf-8");
|
|
70195
70185
|
return sections.every((section) => {
|
|
70196
70186
|
const regex = new RegExp(`^#+ .*${escapeRegex3(section)}`, "m");
|
|
70197
70187
|
return regex.test(content);
|
|
@@ -70286,7 +70276,7 @@ function checkLinkedTasksPresent(entry, requiredIds) {
|
|
|
70286
70276
|
function checkProvenanceTags(filePath, taskId) {
|
|
70287
70277
|
if (!existsSync102(filePath)) return false;
|
|
70288
70278
|
try {
|
|
70289
|
-
const content =
|
|
70279
|
+
const content = readFileSync73(filePath, "utf-8");
|
|
70290
70280
|
if (taskId) {
|
|
70291
70281
|
return content.includes(`@task ${taskId}`);
|
|
70292
70282
|
}
|
|
@@ -70949,13 +70939,13 @@ import { randomUUID as randomUUID7 } from "node:crypto";
|
|
|
70949
70939
|
|
|
70950
70940
|
// packages/core/src/sessions/context-alert.ts
|
|
70951
70941
|
init_paths();
|
|
70952
|
-
import { existsSync as existsSync105, readFileSync as
|
|
70942
|
+
import { existsSync as existsSync105, readFileSync as readFileSync75, writeFileSync as writeFileSync18 } from "node:fs";
|
|
70953
70943
|
import { join as join105 } from "node:path";
|
|
70954
70944
|
function getCurrentSessionId(cwd) {
|
|
70955
70945
|
if (process.env.CLEO_SESSION) return process.env.CLEO_SESSION;
|
|
70956
70946
|
const sessionFile = join105(getCleoDir(cwd), ".current-session");
|
|
70957
70947
|
if (existsSync105(sessionFile)) {
|
|
70958
|
-
return
|
|
70948
|
+
return readFileSync75(sessionFile, "utf-8").trim() || null;
|
|
70959
70949
|
}
|
|
70960
70950
|
return null;
|
|
70961
70951
|
}
|
|
@@ -71034,7 +71024,7 @@ init_paths();
|
|
|
71034
71024
|
|
|
71035
71025
|
// packages/core/src/project-info.ts
|
|
71036
71026
|
init_paths();
|
|
71037
|
-
import { existsSync as existsSync106, readFileSync as
|
|
71027
|
+
import { existsSync as existsSync106, readFileSync as readFileSync76, writeFileSync as writeFileSync19 } from "node:fs";
|
|
71038
71028
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
71039
71029
|
import { join as join106 } from "node:path";
|
|
71040
71030
|
async function getProjectInfo(cwd) {
|
|
@@ -71061,7 +71051,7 @@ function getProjectInfoSync(cwd) {
|
|
|
71061
71051
|
const infoPath = join106(cleoDir, "project-info.json");
|
|
71062
71052
|
if (!existsSync106(infoPath)) return null;
|
|
71063
71053
|
try {
|
|
71064
|
-
const raw =
|
|
71054
|
+
const raw = readFileSync76(infoPath, "utf-8");
|
|
71065
71055
|
const data = JSON.parse(raw);
|
|
71066
71056
|
if (typeof data.projectHash !== "string" || data.projectHash.length === 0) {
|
|
71067
71057
|
return null;
|
|
@@ -71082,10 +71072,10 @@ function updateProjectName(cwd, name2) {
|
|
|
71082
71072
|
const cleoDir = getCleoDirAbsolute(cwd);
|
|
71083
71073
|
const infoPath = join106(cleoDir, "project-info.json");
|
|
71084
71074
|
if (!existsSync106(infoPath)) return;
|
|
71085
|
-
const data = JSON.parse(
|
|
71075
|
+
const data = JSON.parse(readFileSync76(infoPath, "utf-8"));
|
|
71086
71076
|
data.projectName = name2;
|
|
71087
71077
|
data.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
71088
|
-
|
|
71078
|
+
writeFileSync19(infoPath, `${JSON.stringify(data, null, 2)}
|
|
71089
71079
|
`);
|
|
71090
71080
|
}
|
|
71091
71081
|
|
|
@@ -71096,7 +71086,7 @@ init_adapters();
|
|
|
71096
71086
|
// packages/core/src/bootstrap.ts
|
|
71097
71087
|
init_paths();
|
|
71098
71088
|
init_scaffold();
|
|
71099
|
-
import { existsSync as existsSync107, readFileSync as
|
|
71089
|
+
import { existsSync as existsSync107, readFileSync as readFileSync77 } from "node:fs";
|
|
71100
71090
|
import { mkdir as mkdir17, readFile as readFile19, writeFile as writeFile12 } from "node:fs/promises";
|
|
71101
71091
|
import { homedir as homedir6 } from "node:os";
|
|
71102
71092
|
import { join as join107 } from "node:path";
|
|
@@ -71135,7 +71125,7 @@ async function ensureGlobalTemplatesBootstrap(ctx, packageRootOverride) {
|
|
|
71135
71125
|
const pkgRoot = packageRootOverride ?? getPackageRoot();
|
|
71136
71126
|
const templatePath = join107(pkgRoot, "templates", "CLEO-INJECTION.md");
|
|
71137
71127
|
if (existsSync107(templatePath)) {
|
|
71138
|
-
templateContent =
|
|
71128
|
+
templateContent = readFileSync77(templatePath, "utf-8");
|
|
71139
71129
|
}
|
|
71140
71130
|
} catch {
|
|
71141
71131
|
}
|