@cleocode/cleo 2026.5.107 → 2026.5.109
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/cli/index.js +856 -287
- package/dist/cli/index.js.map +3 -3
- package/package.json +11 -11
package/dist/cli/index.js
CHANGED
|
@@ -1719,6 +1719,189 @@ var init_credentials = __esm({
|
|
|
1719
1719
|
}
|
|
1720
1720
|
});
|
|
1721
1721
|
|
|
1722
|
+
// packages/core/src/store/db-inventory.json
|
|
1723
|
+
var db_inventory_default;
|
|
1724
|
+
var init_db_inventory = __esm({
|
|
1725
|
+
"packages/core/src/store/db-inventory.json"() {
|
|
1726
|
+
db_inventory_default = {
|
|
1727
|
+
$schemaNote: "SSoT machine-readable inventory of every CLEO SQLite database. Consumed by T10307 fleet survey, T10310 pragma drift, T10311 migration coverage, T10312 doctor integrity, T10320 cross-DB invariants. Owned by Saga T10281 SG-BRAIN-DB-RESILIENCE / Epic T10282 E1-DB-INVENTORY (task T10305). Amend together with ADR-068 charter; the CI drift gate (forthcoming under E1) compares entries to disk reality.",
|
|
1728
|
+
$pathTokens: {
|
|
1729
|
+
"<projectRoot>": "Resolved at runtime from CLEO_ROOT env var or process.cwd(). Substituted by SSoT helpers `getCleoProjectDir()` in packages/brain/src/cleo-home.ts.",
|
|
1730
|
+
$XDG_DATA_HOME: "Resolved via env-paths through `getCleoHome()` in @cleocode/paths. Linux: ~/.local/share/cleo/, macOS: ~/Library/Application Support/cleo/."
|
|
1731
|
+
},
|
|
1732
|
+
entries: [
|
|
1733
|
+
{
|
|
1734
|
+
role: "tasks",
|
|
1735
|
+
tier: "project",
|
|
1736
|
+
filePathTemplate: "<projectRoot>/.cleo/tasks.db",
|
|
1737
|
+
drizzleSchemaPath: "packages/core/src/store/tasks-schema.ts",
|
|
1738
|
+
migrationsDir: "packages/core/migrations/drizzle-tasks/",
|
|
1739
|
+
ownerPackage: "@cleocode/core",
|
|
1740
|
+
openedVia: "openCleoDb('tasks', cwd)",
|
|
1741
|
+
concurrency: "single-writer",
|
|
1742
|
+
privacy: "local-only",
|
|
1743
|
+
backupPath: ".cleo/backups/sqlite/tasks-YYYYMMDD-HHmmss.db",
|
|
1744
|
+
documentedIn: "ADR-068 row 1; ADR-013 \xA79"
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
role: "brain",
|
|
1748
|
+
tier: "project",
|
|
1749
|
+
filePathTemplate: "<projectRoot>/.cleo/brain.db",
|
|
1750
|
+
drizzleSchemaPath: "packages/core/src/store/memory-schema.ts",
|
|
1751
|
+
migrationsDir: "packages/core/migrations/drizzle-brain/",
|
|
1752
|
+
ownerPackage: "@cleocode/brain",
|
|
1753
|
+
openedVia: "openCleoDb('brain', cwd)",
|
|
1754
|
+
concurrency: "single-writer",
|
|
1755
|
+
privacy: "local-only-pii",
|
|
1756
|
+
backupPath: ".cleo/backups/sqlite/brain-YYYYMMDD-HHmmss.db",
|
|
1757
|
+
documentedIn: "ADR-068 row 2; ADR-013 \xA79; audit \xA72 (P0 malformed 2026-05-23)"
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
role: "conduit",
|
|
1761
|
+
tier: "project",
|
|
1762
|
+
filePathTemplate: "<projectRoot>/.cleo/conduit.db",
|
|
1763
|
+
drizzleSchemaPath: "packages/core/src/store/conduit-schema.ts",
|
|
1764
|
+
migrationsDir: "packages/core/migrations/drizzle-conduit/",
|
|
1765
|
+
ownerPackage: "@cleocode/core",
|
|
1766
|
+
openedVia: "openCleoDb('conduit', cwd)",
|
|
1767
|
+
concurrency: "single-writer",
|
|
1768
|
+
privacy: "local-only",
|
|
1769
|
+
backupPath: ".cleo/backups/sqlite/conduit-YYYYMMDD-HHmmss.db",
|
|
1770
|
+
documentedIn: "ADR-068 row 3; ADR-037 (signaldock\u2192conduit split)"
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
role: "manifest",
|
|
1774
|
+
tier: "derived",
|
|
1775
|
+
filePathTemplate: "<projectRoot>/.cleo/blobs/manifest.db",
|
|
1776
|
+
drizzleSchemaPath: "packages/core/src/store/llmtxt-blob-adapter.ts",
|
|
1777
|
+
migrationsDir: null,
|
|
1778
|
+
ownerPackage: "@cleocode/core",
|
|
1779
|
+
openedVia: "CleoBlobStore via llmtxt/blob BlobFsAdapter (no openCleoDb role registered)",
|
|
1780
|
+
concurrency: "single-writer",
|
|
1781
|
+
privacy: "local-only",
|
|
1782
|
+
backupPath: "rebuildable-from-blob-store",
|
|
1783
|
+
documentedIn: "ADR-068 row 7 (derived); schema owned by llmtxt/blob BlobFsAdapter contract"
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
role: "llmtxt",
|
|
1787
|
+
tier: "project",
|
|
1788
|
+
filePathTemplate: "<projectRoot>/.cleo/llmtxt/llmtxt.db",
|
|
1789
|
+
drizzleSchemaPath: null,
|
|
1790
|
+
migrationsDir: null,
|
|
1791
|
+
ownerPackage: "@cleocode/llmtxt-core",
|
|
1792
|
+
openedVia: "openCleoDb('llmtxt', cwd) \u2014 RESERVED; opener throws 'not yet implemented' (see open-cleo-db.ts L138)",
|
|
1793
|
+
concurrency: "single-writer",
|
|
1794
|
+
privacy: "local-only-pii",
|
|
1795
|
+
backupPath: ".cleo/backups/sqlite/llmtxt-YYYYMMDD-HHmmss.db",
|
|
1796
|
+
documentedIn: "ADR-068 row 8 (reserved); audit \xA71.1 row 4 (live at .cleo/llmtxt/llmtxt.db)"
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
role: "nexus",
|
|
1800
|
+
tier: "global",
|
|
1801
|
+
filePathTemplate: "$XDG_DATA_HOME/cleo/nexus.db",
|
|
1802
|
+
drizzleSchemaPath: "packages/core/src/store/nexus-schema.ts",
|
|
1803
|
+
migrationsDir: "packages/core/migrations/drizzle-nexus/",
|
|
1804
|
+
ownerPackage: "@cleocode/core",
|
|
1805
|
+
openedVia: "openCleoDb('nexus')",
|
|
1806
|
+
concurrency: "single-writer",
|
|
1807
|
+
privacy: "local-only-pii",
|
|
1808
|
+
backupPath: "$XDG_DATA_HOME/cleo/backups/sqlite/nexus-YYYYMMDD-HHmmss.db",
|
|
1809
|
+
documentedIn: "ADR-068 row 5"
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
role: "signaldock-project",
|
|
1813
|
+
tier: "project",
|
|
1814
|
+
filePathTemplate: "<projectRoot>/.cleo/signaldock.db",
|
|
1815
|
+
drizzleSchemaPath: "packages/core/src/store/signaldock-schema.ts",
|
|
1816
|
+
migrationsDir: "packages/core/migrations/drizzle-signaldock/",
|
|
1817
|
+
ownerPackage: "@cleocode/core",
|
|
1818
|
+
openedVia: "HISTORICAL \u2014 project-tier signaldock.db was migrated into conduit.db post-T310/ADR-037. No live opener; charter row retained for migration provenance and legacy backup detection.",
|
|
1819
|
+
concurrency: "single-writer",
|
|
1820
|
+
privacy: "local-only",
|
|
1821
|
+
backupPath: ".cleo/backups/sqlite/signaldock-project-YYYYMMDD-HHmmss.db",
|
|
1822
|
+
documentedIn: "ADR-068 row 4 (stale \u2014 superseded by ADR-037); audit \xA71.1 (not in live project DB list)"
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
role: "signaldock-global",
|
|
1826
|
+
tier: "global",
|
|
1827
|
+
filePathTemplate: "$XDG_DATA_HOME/cleo/signaldock.db",
|
|
1828
|
+
drizzleSchemaPath: "packages/core/src/store/signaldock-schema.ts",
|
|
1829
|
+
migrationsDir: "packages/core/migrations/drizzle-signaldock/",
|
|
1830
|
+
ownerPackage: "@cleocode/core",
|
|
1831
|
+
openedVia: "openCleoDb('signaldock')",
|
|
1832
|
+
concurrency: "single-writer",
|
|
1833
|
+
privacy: "local-only",
|
|
1834
|
+
backupPath: "$XDG_DATA_HOME/cleo/backups/sqlite/signaldock-global-YYYYMMDD-HHmmss.db",
|
|
1835
|
+
documentedIn: "ADR-068 row 9; ADR-037 (post-split global identity registry)"
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
role: "telemetry",
|
|
1839
|
+
tier: "global",
|
|
1840
|
+
filePathTemplate: "$XDG_DATA_HOME/cleo/telemetry.db",
|
|
1841
|
+
drizzleSchemaPath: "packages/core/src/telemetry/schema.ts",
|
|
1842
|
+
migrationsDir: "packages/core/migrations/drizzle-telemetry/",
|
|
1843
|
+
ownerPackage: "@cleocode/core",
|
|
1844
|
+
openedVia: "@cleocode/core telemetry/sqlite.ts \u2014 lazy open on first event when opted-in; not yet registered as openCleoDb role",
|
|
1845
|
+
concurrency: "single-writer",
|
|
1846
|
+
privacy: "cloud-exportable-opt-in",
|
|
1847
|
+
backupPath: "$XDG_DATA_HOME/cleo/backups/sqlite/telemetry-YYYYMMDD-HHmmss.db",
|
|
1848
|
+
documentedIn: "ADR-068 row 6; T624"
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
role: "skills",
|
|
1852
|
+
tier: "global",
|
|
1853
|
+
filePathTemplate: "$XDG_DATA_HOME/cleo/skills.db",
|
|
1854
|
+
drizzleSchemaPath: "packages/core/src/store/skills-schema.ts",
|
|
1855
|
+
migrationsDir: "packages/core/migrations/drizzle-skills/",
|
|
1856
|
+
ownerPackage: "@cleocode/core",
|
|
1857
|
+
openedVia: "openCleoDb('skills')",
|
|
1858
|
+
concurrency: "single-writer",
|
|
1859
|
+
privacy: "local-only",
|
|
1860
|
+
backupPath: "$XDG_DATA_HOME/cleo/backups/sqlite/skills-YYYYMMDD-HHmmss.db",
|
|
1861
|
+
documentedIn: "T9651 (initial skills.db migration); audit \xA71.2 row 4 \u2014 NOT yet in ADR-068 table"
|
|
1862
|
+
},
|
|
1863
|
+
{
|
|
1864
|
+
role: "global-brain",
|
|
1865
|
+
tier: "global",
|
|
1866
|
+
filePathTemplate: "$XDG_DATA_HOME/cleo/brain.db",
|
|
1867
|
+
drizzleSchemaPath: "packages/core/src/store/memory-schema.ts",
|
|
1868
|
+
migrationsDir: "packages/core/migrations/drizzle-brain/",
|
|
1869
|
+
ownerPackage: "@cleocode/brain",
|
|
1870
|
+
openedVia: "UNREGISTERED \u2014 file exists on disk (audit \xA71.2 row 3) but no live opener. Provenance unclear; likely orphan from a getCleoHome()-vs-project-resolution path bug. Tracked for cleanup decision under T10282/T10307.",
|
|
1871
|
+
concurrency: "single-writer",
|
|
1872
|
+
privacy: "local-only-pii",
|
|
1873
|
+
backupPath: "$XDG_DATA_HOME/cleo/backups/sqlite/global-brain-YYYYMMDD-HHmmss.db",
|
|
1874
|
+
documentedIn: "audit \xA71.2 row 3 \u2014 NEW per saga T10281; not in ADR-068"
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
role: "global-tasks",
|
|
1878
|
+
tier: "global",
|
|
1879
|
+
filePathTemplate: "$XDG_DATA_HOME/cleo/tasks.db",
|
|
1880
|
+
drizzleSchemaPath: "packages/core/src/store/tasks-schema.ts",
|
|
1881
|
+
migrationsDir: "packages/core/migrations/drizzle-tasks/",
|
|
1882
|
+
ownerPackage: "@cleocode/core",
|
|
1883
|
+
openedVia: "UNREGISTERED \u2014 file exists on disk (audit \xA71.2 row 5, 4 KB) but no live opener. Provenance unclear; likely orphan from a cwd-cascade bug (T9550 class). Tracked for cleanup decision under T10282/T10307.",
|
|
1884
|
+
concurrency: "single-writer",
|
|
1885
|
+
privacy: "local-only",
|
|
1886
|
+
backupPath: "$XDG_DATA_HOME/cleo/backups/sqlite/global-tasks-YYYYMMDD-HHmmss.db",
|
|
1887
|
+
documentedIn: "audit \xA71.2 row 5 \u2014 NEW per saga T10281; not in ADR-068"
|
|
1888
|
+
}
|
|
1889
|
+
]
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
|
|
1894
|
+
// packages/contracts/src/db-inventory.ts
|
|
1895
|
+
var rawInventory, DB_INVENTORY;
|
|
1896
|
+
var init_db_inventory2 = __esm({
|
|
1897
|
+
"packages/contracts/src/db-inventory.ts"() {
|
|
1898
|
+
"use strict";
|
|
1899
|
+
init_db_inventory();
|
|
1900
|
+
rawInventory = db_inventory_default;
|
|
1901
|
+
DB_INVENTORY = rawInventory.entries;
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
|
|
1722
1905
|
// packages/contracts/src/dispatch/identity.ts
|
|
1723
1906
|
var init_identity = __esm({
|
|
1724
1907
|
"packages/contracts/src/dispatch/identity.ts"() {
|
|
@@ -11309,6 +11492,7 @@ var init_src2 = __esm({
|
|
|
11309
11492
|
init_changesets();
|
|
11310
11493
|
init_cli_category();
|
|
11311
11494
|
init_credentials();
|
|
11495
|
+
init_db_inventory2();
|
|
11312
11496
|
init_identity();
|
|
11313
11497
|
init_operations_registry();
|
|
11314
11498
|
init_docs_taxonomy();
|
|
@@ -25027,8 +25211,8 @@ async function loadPlaybookByName(name) {
|
|
|
25027
25211
|
return null;
|
|
25028
25212
|
}
|
|
25029
25213
|
try {
|
|
25030
|
-
const { getProjectRoot:
|
|
25031
|
-
const projectRoot = __playbookRuntimeOverrides.projectRoot ??
|
|
25214
|
+
const { getProjectRoot: getProjectRoot46 } = await import("@cleocode/core/internal");
|
|
25215
|
+
const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot46();
|
|
25032
25216
|
const resolved = resolvePlaybook(name, {
|
|
25033
25217
|
projectRoot,
|
|
25034
25218
|
globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
|
|
@@ -25072,8 +25256,8 @@ async function acquireDb() {
|
|
|
25072
25256
|
async function buildDefaultDispatcher() {
|
|
25073
25257
|
if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
|
|
25074
25258
|
const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
|
|
25075
|
-
const { getProjectRoot:
|
|
25076
|
-
const projectRoot =
|
|
25259
|
+
const { getProjectRoot: getProjectRoot46 } = await import("@cleocode/core/internal");
|
|
25260
|
+
const projectRoot = getProjectRoot46();
|
|
25077
25261
|
return {
|
|
25078
25262
|
async dispatch(input2) {
|
|
25079
25263
|
try {
|
|
@@ -25263,8 +25447,8 @@ var init_playbook2 = __esm({
|
|
|
25263
25447
|
projectRoot = __playbookRuntimeOverrides.projectRoot;
|
|
25264
25448
|
} else {
|
|
25265
25449
|
try {
|
|
25266
|
-
const { getProjectRoot:
|
|
25267
|
-
projectRoot =
|
|
25450
|
+
const { getProjectRoot: getProjectRoot46 } = await import("@cleocode/core/internal");
|
|
25451
|
+
projectRoot = getProjectRoot46();
|
|
25268
25452
|
} catch {
|
|
25269
25453
|
projectRoot = void 0;
|
|
25270
25454
|
}
|
|
@@ -25328,14 +25512,14 @@ var init_playbook2 = __esm({
|
|
|
25328
25512
|
const dispatcher = await buildDefaultDispatcher();
|
|
25329
25513
|
let result;
|
|
25330
25514
|
try {
|
|
25331
|
-
const { getProjectRoot:
|
|
25515
|
+
const { getProjectRoot: getProjectRoot46 } = await import("@cleocode/core/internal");
|
|
25332
25516
|
const opts = {
|
|
25333
25517
|
db,
|
|
25334
25518
|
playbook: parsed.definition,
|
|
25335
25519
|
playbookHash: parsed.sourceHash,
|
|
25336
25520
|
initialContext,
|
|
25337
25521
|
dispatcher,
|
|
25338
|
-
projectRoot:
|
|
25522
|
+
projectRoot: getProjectRoot46()
|
|
25339
25523
|
};
|
|
25340
25524
|
if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
|
|
25341
25525
|
opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
|
|
@@ -25700,7 +25884,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
25700
25884
|
try {
|
|
25701
25885
|
const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
|
|
25702
25886
|
const { readFileSync: readFileSync18, readdirSync: readdirSync3, existsSync: existsSync17 } = await import("node:fs");
|
|
25703
|
-
const { join:
|
|
25887
|
+
const { join: join35 } = await import("node:path");
|
|
25704
25888
|
const workflowsDir = getCleoCantWorkflowsDir();
|
|
25705
25889
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
25706
25890
|
const matches = [];
|
|
@@ -25708,7 +25892,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
25708
25892
|
const files = readdirSync3(workflowsDir).filter((f) => f.endsWith(".cant"));
|
|
25709
25893
|
for (const file of files) {
|
|
25710
25894
|
try {
|
|
25711
|
-
const src = readFileSync18(
|
|
25895
|
+
const src = readFileSync18(join35(workflowsDir, file), "utf-8");
|
|
25712
25896
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
25713
25897
|
if (!teamMatch) continue;
|
|
25714
25898
|
const teamName = teamMatch[1];
|
|
@@ -25723,12 +25907,12 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
25723
25907
|
}
|
|
25724
25908
|
}
|
|
25725
25909
|
}
|
|
25726
|
-
const localCantDir =
|
|
25910
|
+
const localCantDir = join35(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
|
|
25727
25911
|
if (existsSync17(localCantDir)) {
|
|
25728
25912
|
const files = readdirSync3(localCantDir).filter((f) => f.endsWith(".cant"));
|
|
25729
25913
|
for (const file of files) {
|
|
25730
25914
|
try {
|
|
25731
|
-
const src = readFileSync18(
|
|
25915
|
+
const src = readFileSync18(join35(localCantDir, file), "utf-8");
|
|
25732
25916
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
25733
25917
|
if (!teamMatch) continue;
|
|
25734
25918
|
const teamName = teamMatch[1];
|
|
@@ -31123,11 +31307,11 @@ var init_security = __esm({
|
|
|
31123
31307
|
});
|
|
31124
31308
|
|
|
31125
31309
|
// packages/cleo/src/dispatch/middleware/sanitizer.ts
|
|
31126
|
-
function createSanitizer(
|
|
31310
|
+
function createSanitizer(getProjectRoot46) {
|
|
31127
31311
|
return async (req, next) => {
|
|
31128
31312
|
if (req.params) {
|
|
31129
31313
|
try {
|
|
31130
|
-
const root =
|
|
31314
|
+
const root = getProjectRoot46 ? getProjectRoot46() : void 0;
|
|
31131
31315
|
req.params = sanitizeParams(req.params, root, {
|
|
31132
31316
|
domain: req.domain,
|
|
31133
31317
|
operation: req.operation
|
|
@@ -32719,9 +32903,9 @@ var init_agent = __esm({
|
|
|
32719
32903
|
isActive: true
|
|
32720
32904
|
});
|
|
32721
32905
|
const { existsSync: existsSync17, mkdirSync: mkdirSync5, writeFileSync: writeFileSync5 } = await import("node:fs");
|
|
32722
|
-
const { join:
|
|
32723
|
-
const cantDir =
|
|
32724
|
-
const cantPath =
|
|
32906
|
+
const { join: join35 } = await import("node:path");
|
|
32907
|
+
const cantDir = join35(CLEO_DIR_NAME, AGENTS_SUBDIR);
|
|
32908
|
+
const cantPath = join35(cantDir, `${agentId}.cant`);
|
|
32725
32909
|
let cantScaffolded = false;
|
|
32726
32910
|
if (!existsSync17(cantPath)) {
|
|
32727
32911
|
mkdirSync5(cantDir, { recursive: true });
|
|
@@ -32903,7 +33087,7 @@ agent ${agentId}:
|
|
|
32903
33087
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
32904
33088
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
32905
33089
|
const { existsSync: existsSync17, readFileSync: readFileSync18 } = await import("node:fs");
|
|
32906
|
-
const { join:
|
|
33090
|
+
const { join: join35 } = await import("node:path");
|
|
32907
33091
|
await openCleoDb("tasks");
|
|
32908
33092
|
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
32909
33093
|
const credential = await registry.get(args.agentId);
|
|
@@ -32923,7 +33107,7 @@ agent ${agentId}:
|
|
|
32923
33107
|
}
|
|
32924
33108
|
let profile = null;
|
|
32925
33109
|
let cantValidation = null;
|
|
32926
|
-
const cantPath = args.cant ??
|
|
33110
|
+
const cantPath = args.cant ?? join35(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
32927
33111
|
if (existsSync17(cantPath)) {
|
|
32928
33112
|
profile = readFileSync18(cantPath, "utf-8");
|
|
32929
33113
|
try {
|
|
@@ -33449,7 +33633,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33449
33633
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
33450
33634
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
33451
33635
|
const { existsSync: existsSync17 } = await import("node:fs");
|
|
33452
|
-
const { join:
|
|
33636
|
+
const { join: join35 } = await import("node:path");
|
|
33453
33637
|
await openCleoDb("tasks");
|
|
33454
33638
|
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
33455
33639
|
const credential = await registry.get(args.agentId);
|
|
@@ -33466,7 +33650,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33466
33650
|
}
|
|
33467
33651
|
await registry.update(args.agentId, { isActive: true });
|
|
33468
33652
|
await registry.markUsed(args.agentId);
|
|
33469
|
-
const cantPath =
|
|
33653
|
+
const cantPath = join35(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
33470
33654
|
const hasProfile = existsSync17(cantPath);
|
|
33471
33655
|
const runtime = await createRuntime(registry, {
|
|
33472
33656
|
agentId: args.agentId,
|
|
@@ -34409,8 +34593,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34409
34593
|
process.exitCode = 4;
|
|
34410
34594
|
return;
|
|
34411
34595
|
}
|
|
34412
|
-
const { join:
|
|
34413
|
-
const personaPath =
|
|
34596
|
+
const { join: join35 } = await import("node:path");
|
|
34597
|
+
const personaPath = join35(resolvedDir, "persona.cant");
|
|
34414
34598
|
if (!existsSync17(personaPath)) {
|
|
34415
34599
|
cliOutput(
|
|
34416
34600
|
{
|
|
@@ -34458,7 +34642,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34458
34642
|
if (entry.isFile()) {
|
|
34459
34643
|
fileCount++;
|
|
34460
34644
|
} else if (entry.isDirectory()) {
|
|
34461
|
-
countFiles(
|
|
34645
|
+
countFiles(join35(dirPath, entry.name));
|
|
34462
34646
|
}
|
|
34463
34647
|
}
|
|
34464
34648
|
};
|
|
@@ -34707,7 +34891,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34707
34891
|
async run({ args }) {
|
|
34708
34892
|
try {
|
|
34709
34893
|
const { existsSync: existsSync17, readFileSync: readFileSync18, mkdirSync: mkdirSync5 } = await import("node:fs");
|
|
34710
|
-
const { resolve: resolve7, join:
|
|
34894
|
+
const { resolve: resolve7, join: join35 } = await import("node:path");
|
|
34711
34895
|
const specPath = resolve7(args.spec);
|
|
34712
34896
|
if (!existsSync17(specPath)) {
|
|
34713
34897
|
cliError(`spec file not found: ${specPath}`, 4, { name: "E_NOT_FOUND" });
|
|
@@ -34716,7 +34900,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34716
34900
|
}
|
|
34717
34901
|
const specContent = readFileSync18(specPath, "utf-8");
|
|
34718
34902
|
const projectRoot = getProjectRoot24();
|
|
34719
|
-
const outputDir = args["output-dir"] ? resolve7(args["output-dir"]) :
|
|
34903
|
+
const outputDir = args["output-dir"] ? resolve7(args["output-dir"]) : join35(projectRoot, ".cleo", "cant", "agents");
|
|
34720
34904
|
mkdirSync5(outputDir, { recursive: true });
|
|
34721
34905
|
if (args["dry-run"]) {
|
|
34722
34906
|
cliOutput(
|
|
@@ -36113,6 +36297,155 @@ var init_backup_inspect = __esm({
|
|
|
36113
36297
|
}
|
|
36114
36298
|
});
|
|
36115
36299
|
|
|
36300
|
+
// packages/cleo/src/cli/lib/define-cli-command.ts
|
|
36301
|
+
var init_define_cli_command = __esm({
|
|
36302
|
+
"packages/cleo/src/cli/lib/define-cli-command.ts"() {
|
|
36303
|
+
"use strict";
|
|
36304
|
+
init_dist();
|
|
36305
|
+
}
|
|
36306
|
+
});
|
|
36307
|
+
|
|
36308
|
+
// packages/cleo/src/cli/commands/backup-recover.ts
|
|
36309
|
+
var backup_recover_exports = {};
|
|
36310
|
+
__export(backup_recover_exports, {
|
|
36311
|
+
backupRecoverBrainLeaf: () => backupRecoverBrainLeaf,
|
|
36312
|
+
backupRecoverSubCommand: () => backupRecoverSubCommand
|
|
36313
|
+
});
|
|
36314
|
+
import { join as join11 } from "node:path";
|
|
36315
|
+
import { getCleoDirAbsolute as getCleoDirAbsolute2, getLogger as getLogger20, getProjectRoot as getProjectRoot27 } from "@cleocode/core";
|
|
36316
|
+
import {
|
|
36317
|
+
BackupRecoverBrainError,
|
|
36318
|
+
runBackupRecoverBrain
|
|
36319
|
+
} from "@cleocode/core/store/backup-recover-brain.js";
|
|
36320
|
+
function readBoolFlag(args, key) {
|
|
36321
|
+
return args[key] === true;
|
|
36322
|
+
}
|
|
36323
|
+
function readStringFlag(args, key) {
|
|
36324
|
+
const v = args[key];
|
|
36325
|
+
return typeof v === "string" ? v : "";
|
|
36326
|
+
}
|
|
36327
|
+
var backupRecoverBrainLeaf, backupRecoverSubCommand;
|
|
36328
|
+
var init_backup_recover = __esm({
|
|
36329
|
+
"packages/cleo/src/cli/commands/backup-recover.ts"() {
|
|
36330
|
+
"use strict";
|
|
36331
|
+
init_src2();
|
|
36332
|
+
init_define_cli_command();
|
|
36333
|
+
init_renderers();
|
|
36334
|
+
backupRecoverBrainLeaf = defineCommand({
|
|
36335
|
+
meta: {
|
|
36336
|
+
name: "brain",
|
|
36337
|
+
description: "Recover a malformed brain.db from the freshest validated snapshot (Saga T10281 SG-BRAIN-DB-RESILIENCE)"
|
|
36338
|
+
},
|
|
36339
|
+
args: {
|
|
36340
|
+
"dry-run": {
|
|
36341
|
+
type: "boolean",
|
|
36342
|
+
description: "Print what would be done without quarantining or copying any files",
|
|
36343
|
+
default: false
|
|
36344
|
+
},
|
|
36345
|
+
"from-snapshot": {
|
|
36346
|
+
type: "string",
|
|
36347
|
+
description: "Pin recovery to a specific snapshot \u2014 absolute path or ISO timestamp prefix (e.g. 2026-05-23)",
|
|
36348
|
+
default: ""
|
|
36349
|
+
},
|
|
36350
|
+
"no-delta": {
|
|
36351
|
+
type: "boolean",
|
|
36352
|
+
description: "Skip the sqlite3 .recover delta-merge step (reserved \u2014 current pipeline does not delta-merge; flag plumbed for forward-compat)",
|
|
36353
|
+
default: false
|
|
36354
|
+
},
|
|
36355
|
+
force: {
|
|
36356
|
+
type: "boolean",
|
|
36357
|
+
description: "Bypass any safety prompts (currently a no-op; reserved)",
|
|
36358
|
+
default: false
|
|
36359
|
+
}
|
|
36360
|
+
},
|
|
36361
|
+
async run({ args }) {
|
|
36362
|
+
const projectRoot = getProjectRoot27();
|
|
36363
|
+
const cleoDir = getCleoDirAbsolute2();
|
|
36364
|
+
const corruptPath = join11(cleoDir, "brain.db");
|
|
36365
|
+
const snapshotDir = join11(cleoDir, "backups", "snapshot");
|
|
36366
|
+
const vacuumSnapshotDir = join11(cleoDir, "backups", "sqlite");
|
|
36367
|
+
const quarantineRoot = join11(cleoDir, "quarantine");
|
|
36368
|
+
const argsBag = args;
|
|
36369
|
+
const dryRun = readBoolFlag(argsBag, "dry-run");
|
|
36370
|
+
const fromSnapshot = readStringFlag(argsBag, "from-snapshot");
|
|
36371
|
+
const noDelta = readBoolFlag(argsBag, "no-delta");
|
|
36372
|
+
try {
|
|
36373
|
+
const result = runBackupRecoverBrain({
|
|
36374
|
+
corruptPath,
|
|
36375
|
+
snapshotDir,
|
|
36376
|
+
vacuumSnapshotDir,
|
|
36377
|
+
legacyArtifactDir: cleoDir,
|
|
36378
|
+
quarantineRoot,
|
|
36379
|
+
logger: getLogger20("backup-recover-brain"),
|
|
36380
|
+
dryRun,
|
|
36381
|
+
fromSnapshot: fromSnapshot.length > 0 ? fromSnapshot : void 0,
|
|
36382
|
+
noDelta
|
|
36383
|
+
});
|
|
36384
|
+
cliOutput(result, {
|
|
36385
|
+
command: "backup",
|
|
36386
|
+
operation: "backup.recover.brain"
|
|
36387
|
+
});
|
|
36388
|
+
if (result.dryRun) {
|
|
36389
|
+
humanInfo(
|
|
36390
|
+
`[dry-run] Would restore from ${result.restoredFrom} (${result.dataLossWindowHours !== null ? `~${result.dataLossWindowHours}h data-loss window` : "data-loss window unknown"}). Re-run without --dry-run to execute (project root: ${projectRoot}).`
|
|
36391
|
+
);
|
|
36392
|
+
} else {
|
|
36393
|
+
humanInfo(
|
|
36394
|
+
`Recovered brain.db from ${result.restoredFrom}. Corrupt DB quarantined at ${result.quarantinedTo}.`
|
|
36395
|
+
);
|
|
36396
|
+
}
|
|
36397
|
+
} catch (err) {
|
|
36398
|
+
if (err instanceof BackupRecoverBrainError) {
|
|
36399
|
+
cliError(
|
|
36400
|
+
err.message,
|
|
36401
|
+
err.code,
|
|
36402
|
+
{
|
|
36403
|
+
name: err.codeName,
|
|
36404
|
+
...err.fix ? { fix: err.fix } : {}
|
|
36405
|
+
},
|
|
36406
|
+
{ operation: "backup.recover.brain" }
|
|
36407
|
+
);
|
|
36408
|
+
process.exitCode = err.code;
|
|
36409
|
+
return;
|
|
36410
|
+
}
|
|
36411
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
36412
|
+
cliError(
|
|
36413
|
+
message,
|
|
36414
|
+
1 /* GENERAL_ERROR */,
|
|
36415
|
+
{ name: "E_RECOVERY_FAILED" },
|
|
36416
|
+
{ operation: "backup.recover.brain" }
|
|
36417
|
+
);
|
|
36418
|
+
process.exitCode = 1 /* GENERAL_ERROR */;
|
|
36419
|
+
}
|
|
36420
|
+
}
|
|
36421
|
+
});
|
|
36422
|
+
backupRecoverSubCommand = defineCommand({
|
|
36423
|
+
meta: {
|
|
36424
|
+
name: "recover",
|
|
36425
|
+
description: "Recover a malformed CLEO database from snapshot"
|
|
36426
|
+
},
|
|
36427
|
+
subCommands: {
|
|
36428
|
+
brain: backupRecoverBrainLeaf
|
|
36429
|
+
},
|
|
36430
|
+
async run({ args }) {
|
|
36431
|
+
const argsBag = args;
|
|
36432
|
+
const positional = argsBag["_"];
|
|
36433
|
+
if (Array.isArray(positional) && positional.length > 0) return;
|
|
36434
|
+
cliError(
|
|
36435
|
+
"Missing subcommand. Try `cleo backup recover brain` (currently the only available recovery verb).",
|
|
36436
|
+
6 /* VALIDATION_ERROR */,
|
|
36437
|
+
{
|
|
36438
|
+
name: "E_VALIDATION",
|
|
36439
|
+
fix: "Run `cleo backup recover brain --help` to see available flags."
|
|
36440
|
+
},
|
|
36441
|
+
{ operation: "backup.recover" }
|
|
36442
|
+
);
|
|
36443
|
+
process.exitCode = 6 /* VALIDATION_ERROR */;
|
|
36444
|
+
}
|
|
36445
|
+
});
|
|
36446
|
+
}
|
|
36447
|
+
});
|
|
36448
|
+
|
|
36116
36449
|
// packages/cleo/src/cli/commands/backup.ts
|
|
36117
36450
|
var backup_exports = {};
|
|
36118
36451
|
__export(backup_exports, {
|
|
@@ -36184,6 +36517,7 @@ var init_backup = __esm({
|
|
|
36184
36517
|
init_paths();
|
|
36185
36518
|
init_renderers();
|
|
36186
36519
|
init_backup_inspect();
|
|
36520
|
+
init_backup_recover();
|
|
36187
36521
|
addCommand2 = defineCommand({
|
|
36188
36522
|
meta: {
|
|
36189
36523
|
name: "add",
|
|
@@ -36267,9 +36601,9 @@ var init_backup = __esm({
|
|
|
36267
36601
|
async run({ args }) {
|
|
36268
36602
|
const scope = args.scope;
|
|
36269
36603
|
const { packBundle } = await import("@cleocode/core/store/backup-pack.js");
|
|
36270
|
-
const { getProjectRoot:
|
|
36604
|
+
const { getProjectRoot: getProjectRoot46 } = await import("@cleocode/core");
|
|
36271
36605
|
const includesProject = scope === "project" || scope === "all";
|
|
36272
|
-
const projectRoot = includesProject ?
|
|
36606
|
+
const projectRoot = includesProject ? getProjectRoot46() : void 0;
|
|
36273
36607
|
let passphrase;
|
|
36274
36608
|
if (args.encrypt === true) {
|
|
36275
36609
|
passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
@@ -36345,12 +36679,12 @@ var init_backup = __esm({
|
|
|
36345
36679
|
},
|
|
36346
36680
|
async run({ args }) {
|
|
36347
36681
|
const bundlePath = args.bundle;
|
|
36348
|
-
const { getProjectRoot:
|
|
36682
|
+
const { getProjectRoot: getProjectRoot46, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
|
|
36349
36683
|
const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
|
|
36350
36684
|
const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
|
|
36351
36685
|
const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
|
|
36352
36686
|
const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
|
|
36353
|
-
const projectRoot =
|
|
36687
|
+
const projectRoot = getProjectRoot46();
|
|
36354
36688
|
if (args.force !== true) {
|
|
36355
36689
|
const existing = checkForExistingData(projectRoot, getCleoHome6());
|
|
36356
36690
|
if (existing.length > 0) {
|
|
@@ -36518,7 +36852,8 @@ var init_backup = __esm({
|
|
|
36518
36852
|
list: listCommand4,
|
|
36519
36853
|
export: exportCommand,
|
|
36520
36854
|
import: importCommand,
|
|
36521
|
-
inspect: backupInspectSubCommand
|
|
36855
|
+
inspect: backupInspectSubCommand,
|
|
36856
|
+
recover: backupRecoverSubCommand
|
|
36522
36857
|
},
|
|
36523
36858
|
async run({ cmd, rawArgs }) {
|
|
36524
36859
|
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
@@ -36568,7 +36903,7 @@ var brain_exports = {};
|
|
|
36568
36903
|
__export(brain_exports, {
|
|
36569
36904
|
brainCommand: () => brainCommand
|
|
36570
36905
|
});
|
|
36571
|
-
import { getProjectRoot as
|
|
36906
|
+
import { getProjectRoot as getProjectRoot28 } from "@cleocode/core";
|
|
36572
36907
|
import {
|
|
36573
36908
|
backfillBrainGraph,
|
|
36574
36909
|
exportBrainAsGexf,
|
|
@@ -36613,7 +36948,7 @@ var init_brain2 = __esm({
|
|
|
36613
36948
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36614
36949
|
},
|
|
36615
36950
|
async run({ args }) {
|
|
36616
|
-
const root =
|
|
36951
|
+
const root = getProjectRoot28();
|
|
36617
36952
|
try {
|
|
36618
36953
|
const result = await runBrainMaintenance(root, {
|
|
36619
36954
|
skipDecay: !!args["skip-decay"],
|
|
@@ -36684,7 +37019,7 @@ var init_brain2 = __esm({
|
|
|
36684
37019
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36685
37020
|
},
|
|
36686
37021
|
async run({ args: _args }) {
|
|
36687
|
-
const root =
|
|
37022
|
+
const root = getProjectRoot28();
|
|
36688
37023
|
try {
|
|
36689
37024
|
const result = await backfillBrainGraph(root);
|
|
36690
37025
|
cliOutput(
|
|
@@ -36725,7 +37060,7 @@ var init_brain2 = __esm({
|
|
|
36725
37060
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36726
37061
|
},
|
|
36727
37062
|
async run({ args: _args }) {
|
|
36728
|
-
const root =
|
|
37063
|
+
const root = getProjectRoot28();
|
|
36729
37064
|
try {
|
|
36730
37065
|
const result = await purgeBrainNoise(root);
|
|
36731
37066
|
cliOutput(
|
|
@@ -36771,7 +37106,7 @@ var init_brain2 = __esm({
|
|
|
36771
37106
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36772
37107
|
},
|
|
36773
37108
|
async run({ args }) {
|
|
36774
|
-
const root =
|
|
37109
|
+
const root = getProjectRoot28();
|
|
36775
37110
|
const limit = Number.parseInt(args.limit, 10) || 20;
|
|
36776
37111
|
try {
|
|
36777
37112
|
const stats = await getPlasticityStats(root, limit);
|
|
@@ -36821,7 +37156,7 @@ var init_brain2 = __esm({
|
|
|
36821
37156
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
36822
37157
|
},
|
|
36823
37158
|
async run({ args: _args }) {
|
|
36824
|
-
const root =
|
|
37159
|
+
const root = getProjectRoot28();
|
|
36825
37160
|
try {
|
|
36826
37161
|
const report = await getMemoryQualityReport(root);
|
|
36827
37162
|
cliOutput(
|
|
@@ -36870,7 +37205,7 @@ var init_brain2 = __esm({
|
|
|
36870
37205
|
}
|
|
36871
37206
|
},
|
|
36872
37207
|
async run({ args }) {
|
|
36873
|
-
const root =
|
|
37208
|
+
const root = getProjectRoot28();
|
|
36874
37209
|
const format = args.format ?? "gexf";
|
|
36875
37210
|
if (format !== "gexf" && format !== "json") {
|
|
36876
37211
|
cliError(`Invalid format: ${format}. Use 'gexf' or 'json'.`, "E_VALIDATION", {
|
|
@@ -36951,12 +37286,12 @@ __export(briefing_exports, {
|
|
|
36951
37286
|
briefingCommand: () => briefingCommand
|
|
36952
37287
|
});
|
|
36953
37288
|
import { existsSync as existsSync9, readFileSync as readFileSync10 } from "node:fs";
|
|
36954
|
-
import { join as
|
|
37289
|
+
import { join as join12 } from "node:path";
|
|
36955
37290
|
import { pushWarning } from "@cleocode/core";
|
|
36956
37291
|
import { resolveLegacyCleoDir } from "@cleocode/paths";
|
|
36957
37292
|
function resolveInjectionTemplatePath() {
|
|
36958
37293
|
const xdgConfig = resolveLegacyCleoDir(process.env["XDG_CONFIG_HOME"]);
|
|
36959
|
-
return
|
|
37294
|
+
return join12(xdgConfig, "templates", "CLEO-INJECTION.md");
|
|
36960
37295
|
}
|
|
36961
37296
|
function extractSection(content, sectionName) {
|
|
36962
37297
|
const openTag = `<!-- CLEO-INJECTION:section=${sectionName} -->`;
|
|
@@ -37195,7 +37530,7 @@ __export(caamp_exports, {
|
|
|
37195
37530
|
caampCommand: () => caampCommand
|
|
37196
37531
|
});
|
|
37197
37532
|
import { homedir as homedir3 } from "node:os";
|
|
37198
|
-
import { join as
|
|
37533
|
+
import { join as join13 } from "node:path";
|
|
37199
37534
|
var dedupeCommand, caampCommand;
|
|
37200
37535
|
var init_caamp = __esm({
|
|
37201
37536
|
"packages/cleo/src/cli/commands/caamp.ts"() {
|
|
@@ -37232,9 +37567,9 @@ var init_caamp = __esm({
|
|
|
37232
37567
|
} else {
|
|
37233
37568
|
const home = homedir3();
|
|
37234
37569
|
filePaths = [
|
|
37235
|
-
|
|
37570
|
+
join13(home, ".agents", "AGENTS.md"),
|
|
37236
37571
|
// project-level AGENTS.md in cwd
|
|
37237
|
-
|
|
37572
|
+
join13(process.cwd(), "AGENTS.md")
|
|
37238
37573
|
];
|
|
37239
37574
|
}
|
|
37240
37575
|
if (args["dry-run"]) {
|
|
@@ -37342,7 +37677,7 @@ __export(cant_exports, {
|
|
|
37342
37677
|
cantCommand: () => cantCommand
|
|
37343
37678
|
});
|
|
37344
37679
|
import { existsSync as existsSync10, mkdirSync as mkdirSync2, readFileSync as readFileSync11, writeFileSync as writeFileSync3 } from "node:fs";
|
|
37345
|
-
import { dirname as dirname4, isAbsolute, join as
|
|
37680
|
+
import { dirname as dirname4, isAbsolute, join as join14, resolve as resolve3 } from "node:path";
|
|
37346
37681
|
function resolveFilePath(file) {
|
|
37347
37682
|
return isAbsolute(file) ? file : resolve3(process.cwd(), file);
|
|
37348
37683
|
}
|
|
@@ -37507,7 +37842,7 @@ var init_cant = __esm({
|
|
|
37507
37842
|
const projectRoot = process.cwd();
|
|
37508
37843
|
let written = 0;
|
|
37509
37844
|
for (const outputFile of result.outputFiles) {
|
|
37510
|
-
const outputPath = isAbsolute(outputFile.path) ? outputFile.path :
|
|
37845
|
+
const outputPath = isAbsolute(outputFile.path) ? outputFile.path : join14(projectRoot, outputFile.path);
|
|
37511
37846
|
mkdirSync2(dirname4(outputPath), { recursive: true });
|
|
37512
37847
|
writeFileSync3(outputPath, outputFile.content, "utf-8");
|
|
37513
37848
|
written++;
|
|
@@ -37687,8 +38022,8 @@ __export(changeset_exports, {
|
|
|
37687
38022
|
changesetCommand: () => changesetCommand
|
|
37688
38023
|
});
|
|
37689
38024
|
import { existsSync as existsSync11 } from "node:fs";
|
|
37690
|
-
import { join as
|
|
37691
|
-
import { changesets, dataTable, getProjectRoot as
|
|
38025
|
+
import { join as join15 } from "node:path";
|
|
38026
|
+
import { changesets, dataTable, getProjectRoot as getProjectRoot29 } from "@cleocode/core";
|
|
37692
38027
|
function isValidKind(raw) {
|
|
37693
38028
|
return typeof raw === "string" && CHANGESET_KINDS.includes(raw);
|
|
37694
38029
|
}
|
|
@@ -37782,7 +38117,7 @@ var init_changeset = __esm({
|
|
|
37782
38117
|
...typeof args.notes === "string" && args.notes.length > 0 ? { notes: args.notes } : {},
|
|
37783
38118
|
...typeof args.breaking === "string" && args.breaking.length > 0 ? { breaking: args.breaking } : {}
|
|
37784
38119
|
};
|
|
37785
|
-
const projectRoot =
|
|
38120
|
+
const projectRoot = getProjectRoot29();
|
|
37786
38121
|
const outcome = await changesets.writeChangesetEntry(entry, {
|
|
37787
38122
|
projectRoot,
|
|
37788
38123
|
...typeof args["attached-by"] === "string" && args["attached-by"].length > 0 ? { attachedBy: args["attached-by"] } : {}
|
|
@@ -37809,8 +38144,8 @@ var init_changeset = __esm({
|
|
|
37809
38144
|
},
|
|
37810
38145
|
args: {},
|
|
37811
38146
|
async run() {
|
|
37812
|
-
const projectRoot =
|
|
37813
|
-
const dir =
|
|
38147
|
+
const projectRoot = getProjectRoot29();
|
|
38148
|
+
const dir = join15(projectRoot, ".changeset");
|
|
37814
38149
|
if (!existsSync11(dir)) {
|
|
37815
38150
|
const empty = { entries: [], count: 0, dir, note: "no .changeset/ dir" };
|
|
37816
38151
|
if (isHumanOutput()) {
|
|
@@ -38275,7 +38610,7 @@ var init_check2 = __esm({
|
|
|
38275
38610
|
async run({ args }) {
|
|
38276
38611
|
const { spawnSync } = await import("node:child_process");
|
|
38277
38612
|
const { existsSync: existsSync17 } = await import("node:fs");
|
|
38278
|
-
const { join:
|
|
38613
|
+
const { join: join35, resolve: resolve7 } = await import("node:path");
|
|
38279
38614
|
const strict = Boolean(args.strict);
|
|
38280
38615
|
const jsonOnly = Boolean(args.json);
|
|
38281
38616
|
const repoRoot = resolve7(process.cwd());
|
|
@@ -38315,7 +38650,7 @@ var init_check2 = __esm({
|
|
|
38315
38650
|
const results = [];
|
|
38316
38651
|
let anyFailed = false;
|
|
38317
38652
|
for (const gate of gates) {
|
|
38318
|
-
const scriptPath =
|
|
38653
|
+
const scriptPath = join35(repoRoot, gate.script);
|
|
38319
38654
|
if (!existsSync17(scriptPath)) {
|
|
38320
38655
|
results.push({
|
|
38321
38656
|
id: gate.id,
|
|
@@ -38631,9 +38966,9 @@ var init_code = __esm({
|
|
|
38631
38966
|
async run({ args }) {
|
|
38632
38967
|
await requireTreeSitter();
|
|
38633
38968
|
const { smartOutline } = await import("@cleocode/core/internal");
|
|
38634
|
-
const { join:
|
|
38969
|
+
const { join: join35 } = await import("node:path");
|
|
38635
38970
|
const root = process.cwd();
|
|
38636
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
38971
|
+
const absPath = args.file.startsWith("/") ? args.file : join35(root, args.file);
|
|
38637
38972
|
const result = smartOutline(absPath, root);
|
|
38638
38973
|
if (result.errors.length > 0 && result.symbols.length === 0) {
|
|
38639
38974
|
cliError(result.errors.join(", "), 1, { name: "E_OUTLINE_FAILED" });
|
|
@@ -38724,9 +39059,9 @@ var init_code = __esm({
|
|
|
38724
39059
|
async run({ args }) {
|
|
38725
39060
|
await requireTreeSitter();
|
|
38726
39061
|
const { smartUnfold } = await import("@cleocode/core/internal");
|
|
38727
|
-
const { join:
|
|
39062
|
+
const { join: join35 } = await import("node:path");
|
|
38728
39063
|
const root = process.cwd();
|
|
38729
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
39064
|
+
const absPath = args.file.startsWith("/") ? args.file : join35(root, args.file);
|
|
38730
39065
|
const result = smartUnfold(absPath, args.symbol, root);
|
|
38731
39066
|
if (!result.found) {
|
|
38732
39067
|
const errs = result.errors.length > 0 ? `: ${result.errors.join(", ")}` : "";
|
|
@@ -39849,7 +40184,7 @@ var curator_exports = {};
|
|
|
39849
40184
|
__export(curator_exports, {
|
|
39850
40185
|
curatorCommand: () => curatorCommand
|
|
39851
40186
|
});
|
|
39852
|
-
import { join as
|
|
40187
|
+
import { join as join16 } from "node:path";
|
|
39853
40188
|
import { getCleoHome } from "@cleocode/paths";
|
|
39854
40189
|
async function loadCurator() {
|
|
39855
40190
|
return import("@cleocode/core/sentient/curator.js");
|
|
@@ -39879,7 +40214,7 @@ var init_curator = __esm({
|
|
|
39879
40214
|
try {
|
|
39880
40215
|
const { runCuratorTick } = await loadCurator();
|
|
39881
40216
|
const { readCuratorConfig } = await loadDaemon();
|
|
39882
|
-
const configPath =
|
|
40217
|
+
const configPath = join16(getCleoHome(), "config.json");
|
|
39883
40218
|
const cfg = await readCuratorConfig(configPath);
|
|
39884
40219
|
const result = await runCuratorTick({
|
|
39885
40220
|
dryRun: args["dry-run"] === true,
|
|
@@ -39920,7 +40255,7 @@ var init_curator = __esm({
|
|
|
39920
40255
|
async run() {
|
|
39921
40256
|
try {
|
|
39922
40257
|
const { readCuratorConfig, curatorCronExpression } = await loadDaemon();
|
|
39923
|
-
const configPath =
|
|
40258
|
+
const configPath = join16(getCleoHome(), "config.json");
|
|
39924
40259
|
const cfg = await readCuratorConfig(configPath);
|
|
39925
40260
|
cliOutput(
|
|
39926
40261
|
{
|
|
@@ -39995,7 +40330,7 @@ __export(daemon_exports, {
|
|
|
39995
40330
|
daemonCommand: () => daemonCommand
|
|
39996
40331
|
});
|
|
39997
40332
|
import { existsSync as existsSync12 } from "node:fs";
|
|
39998
|
-
import { join as
|
|
40333
|
+
import { join as join17 } from "node:path";
|
|
39999
40334
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
40000
40335
|
import { getGCDaemonStatus, spawnGCDaemon, stopGCDaemon } from "@cleocode/core/gc/daemon.js";
|
|
40001
40336
|
import {
|
|
@@ -40061,9 +40396,9 @@ async function showDaemonStatus(cleoDir, projectRoot) {
|
|
|
40061
40396
|
}
|
|
40062
40397
|
function resolveDaemonInstallerScript() {
|
|
40063
40398
|
const filePath = fileURLToPath3(import.meta.url);
|
|
40064
|
-
const candidate1 =
|
|
40399
|
+
const candidate1 = join17(filePath, "..", "..", "..", "scripts", "install-daemon-service.mjs");
|
|
40065
40400
|
if (existsSync12(candidate1)) return candidate1;
|
|
40066
|
-
const candidate2 =
|
|
40401
|
+
const candidate2 = join17(
|
|
40067
40402
|
filePath,
|
|
40068
40403
|
"..",
|
|
40069
40404
|
"..",
|
|
@@ -40135,13 +40470,13 @@ var init_daemon = __esm({
|
|
|
40135
40470
|
{
|
|
40136
40471
|
pid,
|
|
40137
40472
|
cleoDir,
|
|
40138
|
-
logs:
|
|
40473
|
+
logs: join17(cleoDir, "logs", "gc.log"),
|
|
40139
40474
|
message: `GC daemon started (PID ${pid})`
|
|
40140
40475
|
},
|
|
40141
40476
|
{
|
|
40142
40477
|
command: "daemon",
|
|
40143
40478
|
operation: "daemon.start",
|
|
40144
|
-
message: `GC daemon started (PID ${pid}) \u2014 Logs: ${
|
|
40479
|
+
message: `GC daemon started (PID ${pid}) \u2014 Logs: ${join17(cleoDir, "logs", "gc.log")}`
|
|
40145
40480
|
}
|
|
40146
40481
|
);
|
|
40147
40482
|
} catch (err) {
|
|
@@ -40543,17 +40878,18 @@ var init_colors = __esm({
|
|
|
40543
40878
|
// packages/cleo/src/cli/renderers/generic-tree.ts
|
|
40544
40879
|
import { ascii as ascii2, KindIcon as KindIcon2, pickIcon, RelationIcon } from "@cleocode/contracts/render/icon.js";
|
|
40545
40880
|
function renderGenericTree(result, opts) {
|
|
40881
|
+
const explicitCtx = opts.ctx !== void 0;
|
|
40546
40882
|
const ctx = opts.ctx ?? resolveAnimateContext();
|
|
40547
40883
|
if (!ctx.enabled) return "";
|
|
40548
40884
|
if (opts.quiet) return renderQuiet(result);
|
|
40549
|
-
const useAscii = ctx.inputs.noColor;
|
|
40885
|
+
const useAscii = explicitCtx ? ctx.inputs.noColor : ctx.inputs.noColor || process.env["NO_COLOR"] != null;
|
|
40550
40886
|
const lines = [];
|
|
40551
40887
|
if (result.ancestors.length > 0) {
|
|
40552
40888
|
lines.push(formatAncestorBanner(result.ancestors, useAscii));
|
|
40553
40889
|
lines.push("");
|
|
40554
40890
|
}
|
|
40555
40891
|
const treeWithGlyphs = decorateGroupsEdges(result.tree, useAscii);
|
|
40556
|
-
const body = renderTree(treeWithGlyphs, { ctx });
|
|
40892
|
+
const body = renderTree(treeWithGlyphs, { ctx, asciiBoxDrawing: useAscii });
|
|
40557
40893
|
if (body) lines.push(body);
|
|
40558
40894
|
if (opts.withDeps || opts.withBlockers) {
|
|
40559
40895
|
const annotations = renderAnnotations(result.tree, opts);
|
|
@@ -40617,7 +40953,15 @@ function kindIconOf(kind) {
|
|
|
40617
40953
|
}
|
|
40618
40954
|
}
|
|
40619
40955
|
function resolveAnimateContext() {
|
|
40620
|
-
|
|
40956
|
+
const fmt = getFormatContext();
|
|
40957
|
+
if (fmt.format !== "human") {
|
|
40958
|
+
return createAnimateContext({ flagResolution: fmt });
|
|
40959
|
+
}
|
|
40960
|
+
return createAnimateContext({
|
|
40961
|
+
flagResolution: fmt,
|
|
40962
|
+
isTTY: true,
|
|
40963
|
+
noColor: false
|
|
40964
|
+
});
|
|
40621
40965
|
}
|
|
40622
40966
|
var init_generic_tree = __esm({
|
|
40623
40967
|
"packages/cleo/src/cli/renderers/generic-tree.ts"() {
|
|
@@ -40903,11 +41247,11 @@ __export(detect_drift_exports, {
|
|
|
40903
41247
|
detectDriftCommand: () => detectDriftCommand
|
|
40904
41248
|
});
|
|
40905
41249
|
import { existsSync as existsSync13, readdirSync, readFileSync as readFileSync13 } from "node:fs";
|
|
40906
|
-
import { dirname as dirname5, join as
|
|
41250
|
+
import { dirname as dirname5, join as join18 } from "node:path";
|
|
40907
41251
|
function findProjectRoot() {
|
|
40908
41252
|
let currentDir = process.cwd();
|
|
40909
41253
|
while (currentDir !== "/") {
|
|
40910
|
-
if (existsSync13(
|
|
41254
|
+
if (existsSync13(join18(currentDir, "package.json"))) {
|
|
40911
41255
|
return currentDir;
|
|
40912
41256
|
}
|
|
40913
41257
|
const parent = dirname5(currentDir);
|
|
@@ -40931,8 +41275,8 @@ var init_detect_drift = __esm({
|
|
|
40931
41275
|
},
|
|
40932
41276
|
async run() {
|
|
40933
41277
|
const projectRoot = findProjectRoot();
|
|
40934
|
-
const isCleoRepo = existsSync13(
|
|
40935
|
-
const cleoSrcRoot = isCleoRepo ?
|
|
41278
|
+
const isCleoRepo = existsSync13(join18(projectRoot, "packages", "cleo", "src"));
|
|
41279
|
+
const cleoSrcRoot = isCleoRepo ? join18(projectRoot, "packages", "cleo", "src") : join18(projectRoot, "src");
|
|
40936
41280
|
const safeRead = (filePath) => {
|
|
40937
41281
|
try {
|
|
40938
41282
|
return readFileSync13(filePath, "utf-8");
|
|
@@ -40946,7 +41290,7 @@ var init_detect_drift = __esm({
|
|
|
40946
41290
|
checks: [],
|
|
40947
41291
|
recommendations: []
|
|
40948
41292
|
};
|
|
40949
|
-
const injPath =
|
|
41293
|
+
const injPath = join18(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
40950
41294
|
if (existsSync13(injPath)) {
|
|
40951
41295
|
const content = safeRead(injPath);
|
|
40952
41296
|
userResult.checks.push({
|
|
@@ -40998,9 +41342,9 @@ var init_detect_drift = __esm({
|
|
|
40998
41342
|
}
|
|
40999
41343
|
};
|
|
41000
41344
|
try {
|
|
41001
|
-
const specPath =
|
|
41002
|
-
const registryPath =
|
|
41003
|
-
const dispatchDomainsDir =
|
|
41345
|
+
const specPath = join18(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
|
|
41346
|
+
const registryPath = join18(cleoSrcRoot, "dispatch", "registry.ts");
|
|
41347
|
+
const dispatchDomainsDir = join18(cleoSrcRoot, "dispatch", "domains");
|
|
41004
41348
|
if (!existsSync13(specPath)) {
|
|
41005
41349
|
addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
|
|
41006
41350
|
{
|
|
@@ -41069,8 +41413,8 @@ var init_detect_drift = __esm({
|
|
|
41069
41413
|
]);
|
|
41070
41414
|
}
|
|
41071
41415
|
try {
|
|
41072
|
-
const cliDir =
|
|
41073
|
-
const coreDir = isCleoRepo ?
|
|
41416
|
+
const cliDir = join18(cleoSrcRoot, "cli", "commands");
|
|
41417
|
+
const coreDir = isCleoRepo ? join18(projectRoot, "packages", "core", "src") : join18(projectRoot, "src", "core");
|
|
41074
41418
|
if (!existsSync13(cliDir)) {
|
|
41075
41419
|
addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
|
|
41076
41420
|
{
|
|
@@ -41097,7 +41441,7 @@ var init_detect_drift = __esm({
|
|
|
41097
41441
|
addCheck("CLI-to-core sync", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41098
41442
|
}
|
|
41099
41443
|
try {
|
|
41100
|
-
const domainsDir =
|
|
41444
|
+
const domainsDir = join18(cleoSrcRoot, "dispatch", "domains");
|
|
41101
41445
|
if (!existsSync13(domainsDir)) {
|
|
41102
41446
|
addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
|
|
41103
41447
|
{
|
|
@@ -41115,7 +41459,7 @@ var init_detect_drift = __esm({
|
|
|
41115
41459
|
addCheck("Domain handler coverage", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41116
41460
|
}
|
|
41117
41461
|
try {
|
|
41118
|
-
const matrixPath =
|
|
41462
|
+
const matrixPath = join18(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
|
|
41119
41463
|
if (!existsSync13(matrixPath)) {
|
|
41120
41464
|
addCheck("Capability matrix", "fail", "Capability matrix missing", [
|
|
41121
41465
|
{
|
|
@@ -41132,7 +41476,7 @@ var init_detect_drift = __esm({
|
|
|
41132
41476
|
addCheck("Capability matrix", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41133
41477
|
}
|
|
41134
41478
|
try {
|
|
41135
|
-
const schemaPath =
|
|
41479
|
+
const schemaPath = join18(projectRoot, "src", "store", "schema.ts");
|
|
41136
41480
|
if (!existsSync13(schemaPath)) {
|
|
41137
41481
|
addCheck("Schema validation", "fail", "Schema definition missing", [
|
|
41138
41482
|
{
|
|
@@ -41167,8 +41511,8 @@ var init_detect_drift = __esm({
|
|
|
41167
41511
|
addCheck("Schema validation", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41168
41512
|
}
|
|
41169
41513
|
try {
|
|
41170
|
-
const visionPath =
|
|
41171
|
-
const specPath =
|
|
41514
|
+
const visionPath = join18(projectRoot, "docs", "concepts", "CLEO-VISION.md");
|
|
41515
|
+
const specPath = join18(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
|
|
41172
41516
|
const issues = [];
|
|
41173
41517
|
if (!existsSync13(visionPath)) {
|
|
41174
41518
|
issues.push({
|
|
@@ -41223,7 +41567,7 @@ var init_detect_drift = __esm({
|
|
|
41223
41567
|
addCheck("Canonical identity", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41224
41568
|
}
|
|
41225
41569
|
try {
|
|
41226
|
-
const injectionPath =
|
|
41570
|
+
const injectionPath = join18(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
41227
41571
|
if (!existsSync13(injectionPath)) {
|
|
41228
41572
|
addCheck("Agent injection", "fail", "Agent injection template missing", [
|
|
41229
41573
|
{
|
|
@@ -41253,7 +41597,7 @@ var init_detect_drift = __esm({
|
|
|
41253
41597
|
addCheck("Agent injection", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41254
41598
|
}
|
|
41255
41599
|
try {
|
|
41256
|
-
const exitCodesPath =
|
|
41600
|
+
const exitCodesPath = join18(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
|
|
41257
41601
|
if (!existsSync13(exitCodesPath)) {
|
|
41258
41602
|
addCheck("Exit codes", "fail", "Exit codes definition missing", [
|
|
41259
41603
|
{
|
|
@@ -41422,12 +41766,190 @@ var init_diagnostics2 = __esm({
|
|
|
41422
41766
|
}
|
|
41423
41767
|
});
|
|
41424
41768
|
|
|
41769
|
+
// packages/cleo/src/cli/lib/did-you-mean.ts
|
|
41770
|
+
function levenshteinDistance(input2, candidate) {
|
|
41771
|
+
const inputLen = input2.length;
|
|
41772
|
+
const candidateLen = candidate.length;
|
|
41773
|
+
const matrix = Array.from({ length: inputLen + 1 }, (_, i) => [i]);
|
|
41774
|
+
for (let j = 1; j <= candidateLen; j++) {
|
|
41775
|
+
matrix[0][j] = j;
|
|
41776
|
+
}
|
|
41777
|
+
for (let i = 1; i <= inputLen; i++) {
|
|
41778
|
+
for (let j = 1; j <= candidateLen; j++) {
|
|
41779
|
+
const cost = input2[i - 1] === candidate[j - 1] ? 0 : 1;
|
|
41780
|
+
matrix[i][j] = Math.min(
|
|
41781
|
+
matrix[i - 1][j] + 1,
|
|
41782
|
+
// deletion
|
|
41783
|
+
matrix[i][j - 1] + 1,
|
|
41784
|
+
// insertion
|
|
41785
|
+
matrix[i - 1][j - 1] + cost
|
|
41786
|
+
// substitution
|
|
41787
|
+
);
|
|
41788
|
+
}
|
|
41789
|
+
}
|
|
41790
|
+
return matrix[inputLen][candidateLen];
|
|
41791
|
+
}
|
|
41792
|
+
function didYouMean(input2, candidates, maxDistance = 2) {
|
|
41793
|
+
const suggestions = candidates.map((candidate) => ({
|
|
41794
|
+
command: candidate,
|
|
41795
|
+
distance: levenshteinDistance(input2, candidate)
|
|
41796
|
+
})).filter((item) => item.distance <= maxDistance).sort((a, b) => {
|
|
41797
|
+
if (a.distance !== b.distance) {
|
|
41798
|
+
return a.distance - b.distance;
|
|
41799
|
+
}
|
|
41800
|
+
return a.command.localeCompare(b.command);
|
|
41801
|
+
}).map((item) => item.command);
|
|
41802
|
+
return suggestions;
|
|
41803
|
+
}
|
|
41804
|
+
var init_did_you_mean = __esm({
|
|
41805
|
+
"packages/cleo/src/cli/lib/did-you-mean.ts"() {
|
|
41806
|
+
"use strict";
|
|
41807
|
+
}
|
|
41808
|
+
});
|
|
41809
|
+
|
|
41810
|
+
// packages/cleo/src/cli/lib/strict-args.ts
|
|
41811
|
+
function collectKnownLongFlags(schema2) {
|
|
41812
|
+
const known = /* @__PURE__ */ new Set();
|
|
41813
|
+
for (const [name, def] of Object.entries(schema2)) {
|
|
41814
|
+
if (!def || def.type === "positional") continue;
|
|
41815
|
+
known.add(`--${name}`);
|
|
41816
|
+
if (def.type === "boolean") {
|
|
41817
|
+
known.add(`--no-${name}`);
|
|
41818
|
+
}
|
|
41819
|
+
const alias2 = def.alias;
|
|
41820
|
+
if (typeof alias2 === "string" && alias2.length > 0) {
|
|
41821
|
+
known.add(alias2.length === 1 ? `-${alias2}` : `--${alias2}`);
|
|
41822
|
+
} else if (Array.isArray(alias2)) {
|
|
41823
|
+
for (const a of alias2) {
|
|
41824
|
+
if (typeof a !== "string" || a.length === 0) continue;
|
|
41825
|
+
known.add(a.length === 1 ? `-${a}` : `--${a}`);
|
|
41826
|
+
}
|
|
41827
|
+
}
|
|
41828
|
+
}
|
|
41829
|
+
return known;
|
|
41830
|
+
}
|
|
41831
|
+
function collectSuggestionCandidates(schema2) {
|
|
41832
|
+
const candidates = [];
|
|
41833
|
+
for (const [name, def] of Object.entries(schema2)) {
|
|
41834
|
+
if (!def || def.type === "positional") continue;
|
|
41835
|
+
candidates.push(`--${name}`);
|
|
41836
|
+
}
|
|
41837
|
+
return candidates.sort();
|
|
41838
|
+
}
|
|
41839
|
+
function assertKnownFlags(rawArgs, schema2, commandName) {
|
|
41840
|
+
if (!rawArgs || rawArgs.length === 0) return;
|
|
41841
|
+
if (schema2 === void 0) return;
|
|
41842
|
+
if (typeof schema2 === "function" || typeof schema2 === "object" && schema2 !== null && "then" in schema2) {
|
|
41843
|
+
return;
|
|
41844
|
+
}
|
|
41845
|
+
const resolved = schema2;
|
|
41846
|
+
const known = collectKnownLongFlags(resolved);
|
|
41847
|
+
const candidates = collectSuggestionCandidates(resolved);
|
|
41848
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
41849
|
+
const token = rawArgs[i];
|
|
41850
|
+
if (token === void 0) continue;
|
|
41851
|
+
if (token === "--") break;
|
|
41852
|
+
if (!token.startsWith("-")) continue;
|
|
41853
|
+
if (token === "-") continue;
|
|
41854
|
+
if (token.startsWith("--")) {
|
|
41855
|
+
const eqIdx = token.indexOf("=");
|
|
41856
|
+
const flagName = eqIdx >= 0 ? token.slice(0, eqIdx) : token;
|
|
41857
|
+
if (!known.has(flagName)) {
|
|
41858
|
+
throw new UnknownFlagError({
|
|
41859
|
+
flag: flagName,
|
|
41860
|
+
command: commandName,
|
|
41861
|
+
suggestions: didYouMean(flagName, candidates, 3),
|
|
41862
|
+
knownFlags: [...known].sort()
|
|
41863
|
+
});
|
|
41864
|
+
}
|
|
41865
|
+
} else {
|
|
41866
|
+
const eqIdx = token.indexOf("=");
|
|
41867
|
+
const body = eqIdx >= 0 ? token.slice(1, eqIdx) : token.slice(1);
|
|
41868
|
+
const first = `-${body[0]}`;
|
|
41869
|
+
if (!known.has(first)) {
|
|
41870
|
+
throw new UnknownFlagError({
|
|
41871
|
+
flag: first,
|
|
41872
|
+
command: commandName,
|
|
41873
|
+
suggestions: didYouMean(first, candidates, 3),
|
|
41874
|
+
knownFlags: [...known].sort()
|
|
41875
|
+
});
|
|
41876
|
+
}
|
|
41877
|
+
if (eqIdx < 0 && body.length > 1) {
|
|
41878
|
+
const isBooleanShort = isBooleanAlias(resolved, body[0]);
|
|
41879
|
+
if (isBooleanShort) {
|
|
41880
|
+
for (let k = 1; k < body.length; k++) {
|
|
41881
|
+
const ch = body[k];
|
|
41882
|
+
if (ch === void 0) continue;
|
|
41883
|
+
const short = `-${ch}`;
|
|
41884
|
+
if (!known.has(short)) {
|
|
41885
|
+
throw new UnknownFlagError({
|
|
41886
|
+
flag: short,
|
|
41887
|
+
command: commandName,
|
|
41888
|
+
suggestions: didYouMean(short, candidates, 3),
|
|
41889
|
+
knownFlags: [...known].sort()
|
|
41890
|
+
});
|
|
41891
|
+
}
|
|
41892
|
+
}
|
|
41893
|
+
}
|
|
41894
|
+
}
|
|
41895
|
+
}
|
|
41896
|
+
}
|
|
41897
|
+
}
|
|
41898
|
+
function isBooleanAlias(schema2, letter) {
|
|
41899
|
+
if (!letter) return false;
|
|
41900
|
+
for (const def of Object.values(schema2)) {
|
|
41901
|
+
if (!def || def.type !== "boolean") continue;
|
|
41902
|
+
const alias2 = def.alias;
|
|
41903
|
+
if (alias2 === letter) return true;
|
|
41904
|
+
if (Array.isArray(alias2) && alias2.includes(letter)) return true;
|
|
41905
|
+
}
|
|
41906
|
+
return false;
|
|
41907
|
+
}
|
|
41908
|
+
var E_UNKNOWN_FLAG, UnknownFlagError;
|
|
41909
|
+
var init_strict_args = __esm({
|
|
41910
|
+
"packages/cleo/src/cli/lib/strict-args.ts"() {
|
|
41911
|
+
"use strict";
|
|
41912
|
+
init_did_you_mean();
|
|
41913
|
+
E_UNKNOWN_FLAG = "E_UNKNOWN_FLAG";
|
|
41914
|
+
UnknownFlagError = class extends Error {
|
|
41915
|
+
/** Stable LAFS error code string for envelope emission. */
|
|
41916
|
+
code = E_UNKNOWN_FLAG;
|
|
41917
|
+
/** The unknown flag token as it appeared in `rawArgs` (e.g. `--titel`, `-X`). */
|
|
41918
|
+
flag;
|
|
41919
|
+
/** Human-readable command label (e.g. `'docs add'`). */
|
|
41920
|
+
command;
|
|
41921
|
+
/** Did-you-mean suggestions, sorted by Levenshtein distance ascending. */
|
|
41922
|
+
suggestions;
|
|
41923
|
+
/** The full list of known flags accepted by the command (long form + short). */
|
|
41924
|
+
knownFlags;
|
|
41925
|
+
/** Suggested fix string for {@link CliErrorDetails.fix}. */
|
|
41926
|
+
fix;
|
|
41927
|
+
/**
|
|
41928
|
+
* @param input - Structured failure context: offending flag, command
|
|
41929
|
+
* label, ranked suggestions, and the full known-flag set.
|
|
41930
|
+
*/
|
|
41931
|
+
constructor(input2) {
|
|
41932
|
+
const suggestionPart = input2.suggestions.length > 0 ? ` Did you mean: ${input2.suggestions.join(", ")}?` : "";
|
|
41933
|
+
super(
|
|
41934
|
+
`${E_UNKNOWN_FLAG}: unknown flag '${input2.flag}' for '${input2.command}'.${suggestionPart}`
|
|
41935
|
+
);
|
|
41936
|
+
this.name = "UnknownFlagError";
|
|
41937
|
+
this.flag = input2.flag;
|
|
41938
|
+
this.command = input2.command;
|
|
41939
|
+
this.suggestions = input2.suggestions;
|
|
41940
|
+
this.knownFlags = input2.knownFlags;
|
|
41941
|
+
this.fix = input2.suggestions.length > 0 ? `Try one of: ${input2.suggestions.join(", ")}. Run \`cleo ${input2.command} --help\` for the full flag list.` : `Run \`cleo ${input2.command} --help\` for the full flag list.`;
|
|
41942
|
+
}
|
|
41943
|
+
};
|
|
41944
|
+
}
|
|
41945
|
+
});
|
|
41946
|
+
|
|
41425
41947
|
// packages/cleo/src/viewer/pidfile.ts
|
|
41426
41948
|
import { mkdir, readFile as readFile2, unlink, writeFile } from "node:fs/promises";
|
|
41427
|
-
import { dirname as dirname6, join as
|
|
41949
|
+
import { dirname as dirname6, join as join19 } from "node:path";
|
|
41428
41950
|
import { getCleoHome as getCleoHome2 } from "@cleocode/core/internal";
|
|
41429
41951
|
function viewerPidFilePath() {
|
|
41430
|
-
return
|
|
41952
|
+
return join19(getCleoHome2(), "viewer.pid");
|
|
41431
41953
|
}
|
|
41432
41954
|
async function writeViewerPidFile(record) {
|
|
41433
41955
|
const path6 = viewerPidFilePath();
|
|
@@ -41527,11 +42049,11 @@ var init_port_allocator = __esm({
|
|
|
41527
42049
|
// packages/cleo/src/viewer/server.ts
|
|
41528
42050
|
import { createReadStream } from "node:fs";
|
|
41529
42051
|
import { stat } from "node:fs/promises";
|
|
41530
|
-
import { dirname as dirname7, join as
|
|
42052
|
+
import { dirname as dirname7, join as join20, normalize, resolve as resolve4 } from "node:path";
|
|
41531
42053
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
41532
42054
|
import {
|
|
41533
42055
|
createAttachmentStore as createAttachmentStore5,
|
|
41534
|
-
getProjectRoot as
|
|
42056
|
+
getProjectRoot as getProjectRoot30,
|
|
41535
42057
|
searchAllProjectDocs
|
|
41536
42058
|
} from "@cleocode/core/internal";
|
|
41537
42059
|
function getViewerAssetsDir() {
|
|
@@ -41566,7 +42088,7 @@ function inferTitle(markdown, fallback) {
|
|
|
41566
42088
|
}
|
|
41567
42089
|
async function serveStatic(res, assetsDir, relPath) {
|
|
41568
42090
|
const safeRel = normalize(relPath).replace(/^[\\/]+/, "");
|
|
41569
|
-
const absPath =
|
|
42091
|
+
const absPath = join20(assetsDir, safeRel);
|
|
41570
42092
|
const resolvedAssets = resolve4(assetsDir) + "/";
|
|
41571
42093
|
const resolvedAbs = resolve4(absPath);
|
|
41572
42094
|
if (`${resolvedAbs}/`.indexOf(resolvedAssets) !== 0 && resolvedAbs !== resolve4(assetsDir)) {
|
|
@@ -41591,7 +42113,7 @@ async function serveStatic(res, assetsDir, relPath) {
|
|
|
41591
42113
|
}
|
|
41592
42114
|
}
|
|
41593
42115
|
function buildViewerHandler(opts = {}) {
|
|
41594
|
-
const projectRoot = opts.projectRoot ??
|
|
42116
|
+
const projectRoot = opts.projectRoot ?? getProjectRoot30();
|
|
41595
42117
|
const assetsDir = getViewerAssetsDir();
|
|
41596
42118
|
const store = createAttachmentStore5();
|
|
41597
42119
|
return async (req, res) => {
|
|
@@ -41767,12 +42289,12 @@ var init_server = __esm({
|
|
|
41767
42289
|
// packages/cleo/src/cli/commands/docs-viewer.ts
|
|
41768
42290
|
import { spawn } from "node:child_process";
|
|
41769
42291
|
import { open as fsOpen } from "node:fs/promises";
|
|
41770
|
-
import { join as
|
|
42292
|
+
import { join as join21 } from "node:path";
|
|
41771
42293
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
41772
|
-
import { getCleoHome as getCleoHome3, getProjectRoot as
|
|
42294
|
+
import { getCleoHome as getCleoHome3, getProjectRoot as getProjectRoot31 } from "@cleocode/core";
|
|
41773
42295
|
function getCleoBinPath() {
|
|
41774
42296
|
const thisFile = fileURLToPath5(import.meta.url);
|
|
41775
|
-
return
|
|
42297
|
+
return join21(thisFile, "..", "..", "index.js");
|
|
41776
42298
|
}
|
|
41777
42299
|
async function waitForExit(pid, timeoutMs, intervalMs = 100) {
|
|
41778
42300
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -41801,7 +42323,7 @@ function openInBrowser(url) {
|
|
|
41801
42323
|
}
|
|
41802
42324
|
}
|
|
41803
42325
|
async function spawnDetachedServer(opts) {
|
|
41804
|
-
const logFile =
|
|
42326
|
+
const logFile = join21(getCleoHome3(), "viewer.log");
|
|
41805
42327
|
const handle = await fsOpen(logFile, "a").catch(() => null);
|
|
41806
42328
|
const stdio = handle ? ["ignore", handle.fd, handle.fd] : ["ignore", "ignore", "ignore"];
|
|
41807
42329
|
const args = [
|
|
@@ -41820,7 +42342,7 @@ async function spawnDetachedServer(opts) {
|
|
|
41820
42342
|
detached: true,
|
|
41821
42343
|
stdio,
|
|
41822
42344
|
env: { ...process.env, [DETACHED_CHILD_ENV]: "1" },
|
|
41823
|
-
cwd:
|
|
42345
|
+
cwd: getProjectRoot31()
|
|
41824
42346
|
});
|
|
41825
42347
|
child.unref();
|
|
41826
42348
|
if (handle) await handle.close();
|
|
@@ -41972,7 +42494,7 @@ var init_docs_viewer = __esm({
|
|
|
41972
42494
|
pid: process.pid,
|
|
41973
42495
|
port: handle.port,
|
|
41974
42496
|
host: handle.host,
|
|
41975
|
-
projectRoot:
|
|
42497
|
+
projectRoot: getProjectRoot31(),
|
|
41976
42498
|
startedAt: Date.now()
|
|
41977
42499
|
};
|
|
41978
42500
|
await writeViewerPidFile(record);
|
|
@@ -42248,7 +42770,7 @@ __export(docs_exports, {
|
|
|
42248
42770
|
docsCommand: () => docsCommand
|
|
42249
42771
|
});
|
|
42250
42772
|
import { appendFile, mkdir as mkdir2, readdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
42251
|
-
import { dirname as dirname8, isAbsolute as isAbsolute2, join as
|
|
42773
|
+
import { dirname as dirname8, isAbsolute as isAbsolute2, join as join22, resolve as resolve5 } from "node:path";
|
|
42252
42774
|
import {
|
|
42253
42775
|
buildDocsGraph,
|
|
42254
42776
|
CleoError as CleoError3,
|
|
@@ -42256,7 +42778,7 @@ import {
|
|
|
42256
42778
|
createAttachmentStoreDocsAccessor,
|
|
42257
42779
|
exportDocument,
|
|
42258
42780
|
getAgentOutputsAbsolute,
|
|
42259
|
-
getProjectRoot as
|
|
42781
|
+
getProjectRoot as getProjectRoot32,
|
|
42260
42782
|
listDocVersions,
|
|
42261
42783
|
makeClassifierForScanRoot,
|
|
42262
42784
|
mergeDocs,
|
|
@@ -42272,7 +42794,7 @@ import {
|
|
|
42272
42794
|
syncFromGit
|
|
42273
42795
|
} from "@cleocode/core/internal";
|
|
42274
42796
|
async function getScriptNames(projectRoot) {
|
|
42275
|
-
const scriptsDir =
|
|
42797
|
+
const scriptsDir = join22(projectRoot, "scripts");
|
|
42276
42798
|
try {
|
|
42277
42799
|
const files = await readdir(scriptsDir);
|
|
42278
42800
|
return files.filter((f) => f.endsWith(".sh")).map((f) => f.replace(".sh", "")).sort();
|
|
@@ -42281,7 +42803,7 @@ async function getScriptNames(projectRoot) {
|
|
|
42281
42803
|
}
|
|
42282
42804
|
}
|
|
42283
42805
|
async function getIndexedCommands(projectRoot) {
|
|
42284
|
-
const indexPath =
|
|
42806
|
+
const indexPath = join22(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
|
|
42285
42807
|
const index = await readJson(indexPath);
|
|
42286
42808
|
if (!index) return [];
|
|
42287
42809
|
return index.commands.map((c) => c.name).sort();
|
|
@@ -42314,7 +42836,7 @@ async function runGapCheck(_projectRoot, filterId) {
|
|
|
42314
42836
|
const reviewFiles = files.filter((f) => f.endsWith(".md"));
|
|
42315
42837
|
for (const file of reviewFiles) {
|
|
42316
42838
|
if (filterId && !file.includes(filterId)) continue;
|
|
42317
|
-
const filePath =
|
|
42839
|
+
const filePath = join22(reviewDir, file);
|
|
42318
42840
|
const content = await readFile3(filePath, "utf-8");
|
|
42319
42841
|
const taskMatch = file.match(/^(T\d+)/);
|
|
42320
42842
|
const taskId = taskMatch ? taskMatch[1] : "UNKNOWN";
|
|
@@ -42365,12 +42887,13 @@ var init_docs3 = __esm({
|
|
|
42365
42887
|
init_src2();
|
|
42366
42888
|
init_dist();
|
|
42367
42889
|
init_cli();
|
|
42890
|
+
init_strict_args();
|
|
42368
42891
|
init_renderers();
|
|
42369
42892
|
init_docs_viewer();
|
|
42370
42893
|
addCommand5 = defineCommand({
|
|
42371
42894
|
meta: {
|
|
42372
42895
|
name: "add",
|
|
42373
|
-
description:
|
|
42896
|
+
description: 'Attach a local file or remote URL to a CLEO entity (task, session, observation). Owner type is inferred from the ID prefix: T### \u2192 task, ses_* \u2192 session, O-* \u2192 observation. Use --slug to set a human-friendly alias (unique per project) (T9636).\n\nPositional arguments:\n <owner-id> Owner entity ID (T###, ses_*, O-*) \u2014 required\n [file] Local file path to attach \u2014 optional when --url is set\n\nNamed arguments:\n --url <url> Remote URL to attach (instead of a local file)\n --desc <text> Free-text description of this attachment\n --labels <csv> Comma-separated labels (e.g. rfc,spec)\n --attached-by <name> Agent identity that created the attachment (default: "human")\n --slug <kebab> Human-friendly alias, unique per project (T9636)\n --type <kind> Taxonomy classification \u2014 run `cleo docs list-types` for kinds\n\nUnknown flags are rejected with E_UNKNOWN_FLAG + did-you-mean suggestions (T10359).'
|
|
42374
42897
|
},
|
|
42375
42898
|
args: {
|
|
42376
42899
|
"owner-id": {
|
|
@@ -42408,7 +42931,21 @@ var init_docs3 = __esm({
|
|
|
42408
42931
|
description: "Taxonomy classification \u2014 run `cleo docs list-types` to enumerate registered kinds (T9637 / T9788)"
|
|
42409
42932
|
}
|
|
42410
42933
|
},
|
|
42411
|
-
async run({ args }) {
|
|
42934
|
+
async run({ args, rawArgs }) {
|
|
42935
|
+
try {
|
|
42936
|
+
assertKnownFlags(rawArgs, addCommand5.args, "docs add");
|
|
42937
|
+
} catch (err) {
|
|
42938
|
+
if (err instanceof UnknownFlagError) {
|
|
42939
|
+
cliError(err.message, 6 /* VALIDATION_ERROR */, {
|
|
42940
|
+
name: err.code,
|
|
42941
|
+
fix: err.fix,
|
|
42942
|
+
alternatives: err.suggestions.map((s) => ({ action: s, command: s })),
|
|
42943
|
+
details: { flag: err.flag, knownFlags: err.knownFlags }
|
|
42944
|
+
});
|
|
42945
|
+
process.exit(6 /* VALIDATION_ERROR */);
|
|
42946
|
+
}
|
|
42947
|
+
throw err;
|
|
42948
|
+
}
|
|
42412
42949
|
const ownerId = args["owner-id"];
|
|
42413
42950
|
const fileArg = args.file ?? void 0;
|
|
42414
42951
|
const url = args.url ?? void 0;
|
|
@@ -42642,7 +43179,7 @@ var init_docs3 = __esm({
|
|
|
42642
43179
|
const taskId = String(args.task);
|
|
42643
43180
|
const includeAttachments = args["include-attachments"] !== false;
|
|
42644
43181
|
const includeMemoryRefs = args["include-memory-refs"] === true;
|
|
42645
|
-
const projectRoot =
|
|
43182
|
+
const projectRoot = getProjectRoot32();
|
|
42646
43183
|
try {
|
|
42647
43184
|
const result = await exportDocument({
|
|
42648
43185
|
taskId,
|
|
@@ -42708,7 +43245,7 @@ var init_docs3 = __esm({
|
|
|
42708
43245
|
}
|
|
42709
43246
|
},
|
|
42710
43247
|
async run({ args }) {
|
|
42711
|
-
const projectRoot =
|
|
43248
|
+
const projectRoot = getProjectRoot32();
|
|
42712
43249
|
const limit = args.limit ? Number.parseInt(String(args.limit), 10) : 10;
|
|
42713
43250
|
try {
|
|
42714
43251
|
const result = args.owner ? await searchDocs2(String(args.query), {
|
|
@@ -42764,7 +43301,7 @@ var init_docs3 = __esm({
|
|
|
42764
43301
|
}
|
|
42765
43302
|
},
|
|
42766
43303
|
async run({ args }) {
|
|
42767
|
-
const projectRoot =
|
|
43304
|
+
const projectRoot = getProjectRoot32();
|
|
42768
43305
|
const rawStrategy = args.strategy ?? "three-way";
|
|
42769
43306
|
const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
|
|
42770
43307
|
try {
|
|
@@ -42813,7 +43350,7 @@ var init_docs3 = __esm({
|
|
|
42813
43350
|
}
|
|
42814
43351
|
},
|
|
42815
43352
|
async run({ args }) {
|
|
42816
|
-
const projectRoot =
|
|
43353
|
+
const projectRoot = getProjectRoot32();
|
|
42817
43354
|
const fmt = args.format ?? "mermaid";
|
|
42818
43355
|
try {
|
|
42819
43356
|
const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
|
|
@@ -42882,7 +43419,7 @@ var init_docs3 = __esm({
|
|
|
42882
43419
|
}
|
|
42883
43420
|
},
|
|
42884
43421
|
async run({ args }) {
|
|
42885
|
-
const projectRoot =
|
|
43422
|
+
const projectRoot = getProjectRoot32();
|
|
42886
43423
|
try {
|
|
42887
43424
|
const result = await rankDocs({
|
|
42888
43425
|
ownerId: String(args.for),
|
|
@@ -42920,7 +43457,7 @@ var init_docs3 = __esm({
|
|
|
42920
43457
|
}
|
|
42921
43458
|
},
|
|
42922
43459
|
async run({ args }) {
|
|
42923
|
-
const projectRoot =
|
|
43460
|
+
const projectRoot = getProjectRoot32();
|
|
42924
43461
|
try {
|
|
42925
43462
|
const result = await listDocVersions({
|
|
42926
43463
|
ownerId: String(args.for),
|
|
@@ -42963,7 +43500,7 @@ var init_docs3 = __esm({
|
|
|
42963
43500
|
}
|
|
42964
43501
|
},
|
|
42965
43502
|
async run({ args }) {
|
|
42966
|
-
const projectRoot =
|
|
43503
|
+
const projectRoot = getProjectRoot32();
|
|
42967
43504
|
try {
|
|
42968
43505
|
const result = await publishDocs({
|
|
42969
43506
|
ownerId: String(args.for),
|
|
@@ -43087,7 +43624,7 @@ var init_docs3 = __esm({
|
|
|
43087
43624
|
},
|
|
43088
43625
|
async run({ args }) {
|
|
43089
43626
|
if (args.from) {
|
|
43090
|
-
const projectRoot =
|
|
43627
|
+
const projectRoot = getProjectRoot32();
|
|
43091
43628
|
const ownerId = args.for ?? void 0;
|
|
43092
43629
|
if (!ownerId) {
|
|
43093
43630
|
cliError(
|
|
@@ -43154,7 +43691,7 @@ var init_docs3 = __esm({
|
|
|
43154
43691
|
}
|
|
43155
43692
|
},
|
|
43156
43693
|
async run() {
|
|
43157
|
-
const projectRoot =
|
|
43694
|
+
const projectRoot = getProjectRoot32();
|
|
43158
43695
|
try {
|
|
43159
43696
|
const result = await statusDocs({ projectRoot });
|
|
43160
43697
|
cliOutput(result, { command: "docs status", operation: "docs.status" });
|
|
@@ -43239,7 +43776,7 @@ var init_docs3 = __esm({
|
|
|
43239
43776
|
}
|
|
43240
43777
|
},
|
|
43241
43778
|
async run({ args }) {
|
|
43242
|
-
const projectRoot =
|
|
43779
|
+
const projectRoot = getProjectRoot32();
|
|
43243
43780
|
const dirArg = String(args.dir);
|
|
43244
43781
|
const scanRoot = isAbsolute2(dirArg) ? dirArg : resolve5(projectRoot, dirArg);
|
|
43245
43782
|
const dryRun = args["dry-run"] === true;
|
|
@@ -43253,9 +43790,9 @@ var init_docs3 = __esm({
|
|
|
43253
43790
|
})}
|
|
43254
43791
|
`;
|
|
43255
43792
|
try {
|
|
43256
|
-
await mkdir2(
|
|
43793
|
+
await mkdir2(join22(projectRoot, ".cleo", "audit"), { recursive: true });
|
|
43257
43794
|
await appendFile(
|
|
43258
|
-
|
|
43795
|
+
join22(projectRoot, ".cleo", "audit", "import-force-bypass.jsonl"),
|
|
43259
43796
|
auditLine,
|
|
43260
43797
|
"utf-8"
|
|
43261
43798
|
);
|
|
@@ -43313,7 +43850,7 @@ var init_docs3 = __esm({
|
|
|
43313
43850
|
}
|
|
43314
43851
|
},
|
|
43315
43852
|
async run({ args }) {
|
|
43316
|
-
const projectRoot =
|
|
43853
|
+
const projectRoot = getProjectRoot32();
|
|
43317
43854
|
const { registry, configError } = loadCliRegistry(projectRoot);
|
|
43318
43855
|
const kinds = registry.list().map(toWireKind);
|
|
43319
43856
|
const extensionsCount = kinds.filter((k) => k.isExtension).length;
|
|
@@ -43357,7 +43894,7 @@ var init_docs3 = __esm({
|
|
|
43357
43894
|
}
|
|
43358
43895
|
},
|
|
43359
43896
|
async run({ args }) {
|
|
43360
|
-
const projectRoot =
|
|
43897
|
+
const projectRoot = getProjectRoot32();
|
|
43361
43898
|
const { registry, configError } = loadCliRegistry(projectRoot);
|
|
43362
43899
|
const kinds = registry.list().map(toWireKind);
|
|
43363
43900
|
let counts2;
|
|
@@ -43699,6 +44236,66 @@ ${this.prefix}: \u2717 ${message}
|
|
|
43699
44236
|
}
|
|
43700
44237
|
});
|
|
43701
44238
|
|
|
44239
|
+
// packages/cleo/src/cli/commands/doctor-db-substrate.ts
|
|
44240
|
+
import { getProjectRoot as getProjectRoot33, pushWarning as pushWarning2 } from "@cleocode/core";
|
|
44241
|
+
import { surveyDbSubstrate, surveyFleetDbSubstrate } from "@cleocode/core/doctor/db-substrate.js";
|
|
44242
|
+
function pushSubstrateWarnings(result) {
|
|
44243
|
+
for (const warning of result.warnings) {
|
|
44244
|
+
pushWarning2({
|
|
44245
|
+
code: warning.kind === "orphan-project-root" ? "W_DB_SUBSTRATE_ORPHAN_PROJECT_ROOT" : "W_DB_SUBSTRATE_NESTED_NEXUS_DUPLICATE",
|
|
44246
|
+
message: warning.kind === "orphan-project-root" ? `Orphan project-root .cleo/ at ${warning.path} (T9550 regression class \u2014 review then remove)` : `Nested-nexus duplicate at ${warning.path} (structural duplicate of the canonical flat layout)`,
|
|
44247
|
+
severity: "warn",
|
|
44248
|
+
context: {
|
|
44249
|
+
kind: warning.kind,
|
|
44250
|
+
path: warning.path,
|
|
44251
|
+
lastWriteMs: warning.lastWriteMs
|
|
44252
|
+
}
|
|
44253
|
+
});
|
|
44254
|
+
}
|
|
44255
|
+
}
|
|
44256
|
+
var DEFAULT_FLEET_ROOT, doctorDbSubstrateCommand;
|
|
44257
|
+
var init_doctor_db_substrate = __esm({
|
|
44258
|
+
"packages/cleo/src/cli/commands/doctor-db-substrate.ts"() {
|
|
44259
|
+
"use strict";
|
|
44260
|
+
init_define_cli_command();
|
|
44261
|
+
init_renderers();
|
|
44262
|
+
DEFAULT_FLEET_ROOT = "/mnt/projects";
|
|
44263
|
+
doctorDbSubstrateCommand = defineCommand({
|
|
44264
|
+
meta: {
|
|
44265
|
+
name: "db-substrate",
|
|
44266
|
+
description: "Walk every DB in the inventory + report integrity, row counts, orphan dirs. Use --fleet for a multi-project survey under --fleet-root (default /mnt/projects)."
|
|
44267
|
+
},
|
|
44268
|
+
args: {
|
|
44269
|
+
fleet: {
|
|
44270
|
+
type: "boolean",
|
|
44271
|
+
description: "Multi-project survey \u2014 walk every .cleo/-bearing subdir under --fleet-root"
|
|
44272
|
+
},
|
|
44273
|
+
"fleet-root": {
|
|
44274
|
+
type: "string",
|
|
44275
|
+
description: "Fleet root path (default: /mnt/projects). Only used with --fleet."
|
|
44276
|
+
},
|
|
44277
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
44278
|
+
human: { type: "boolean", description: "Force human-readable output" },
|
|
44279
|
+
quiet: { type: "boolean", description: "Suppress non-essential output" }
|
|
44280
|
+
},
|
|
44281
|
+
async run({ args }) {
|
|
44282
|
+
const isFleet = args.fleet === true;
|
|
44283
|
+
const result = isFleet ? surveyFleetDbSubstrate(
|
|
44284
|
+
typeof args["fleet-root"] === "string" && args["fleet-root"].length > 0 ? args["fleet-root"] : DEFAULT_FLEET_ROOT
|
|
44285
|
+
) : surveyDbSubstrate(getProjectRoot33());
|
|
44286
|
+
pushSubstrateWarnings(result);
|
|
44287
|
+
cliOutput(result, {
|
|
44288
|
+
command: "doctor",
|
|
44289
|
+
operation: "doctor.db-substrate.run"
|
|
44290
|
+
});
|
|
44291
|
+
if (result.summary.corrupt > 0 && (process.exitCode === void 0 || process.exitCode === 0)) {
|
|
44292
|
+
process.exitCode = 2;
|
|
44293
|
+
}
|
|
44294
|
+
}
|
|
44295
|
+
});
|
|
44296
|
+
}
|
|
44297
|
+
});
|
|
44298
|
+
|
|
43702
44299
|
// packages/cleo/src/cli/commands/migrate-agents-v2.ts
|
|
43703
44300
|
var migrate_agents_v2_exports = {};
|
|
43704
44301
|
__export(migrate_agents_v2_exports, {
|
|
@@ -43710,8 +44307,8 @@ __export(migrate_agents_v2_exports, {
|
|
|
43710
44307
|
});
|
|
43711
44308
|
import { createHash as createHash2 } from "node:crypto";
|
|
43712
44309
|
import { appendFileSync as appendFileSync2, existsSync as existsSync14, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync14 } from "node:fs";
|
|
43713
|
-
import { join as
|
|
43714
|
-
import { getProjectRoot as
|
|
44310
|
+
import { join as join23 } from "node:path";
|
|
44311
|
+
import { getProjectRoot as getProjectRoot34, installAgentFromCant } from "@cleocode/core/internal";
|
|
43715
44312
|
import { openCleoDb as openCleoDb2 } from "@cleocode/core/store/open-cleo-db";
|
|
43716
44313
|
function sha256Hex(bytes) {
|
|
43717
44314
|
return createHash2("sha256").update(bytes).digest("hex");
|
|
@@ -43730,8 +44327,8 @@ function extractAgentName(source) {
|
|
|
43730
44327
|
return headerMatch[1] ?? null;
|
|
43731
44328
|
}
|
|
43732
44329
|
function appendAuditLog(projectRoot, entry) {
|
|
43733
|
-
const auditPath =
|
|
43734
|
-
const auditDir =
|
|
44330
|
+
const auditPath = join23(projectRoot, AUDIT_LOG_RELATIVE);
|
|
44331
|
+
const auditDir = join23(auditPath, "..");
|
|
43735
44332
|
if (!existsSync14(auditDir)) {
|
|
43736
44333
|
mkdirSync3(auditDir, { recursive: true });
|
|
43737
44334
|
}
|
|
@@ -43749,7 +44346,7 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
|
|
|
43749
44346
|
return;
|
|
43750
44347
|
}
|
|
43751
44348
|
for (const filename of files) {
|
|
43752
|
-
const cantPath =
|
|
44349
|
+
const cantPath = join23(scanDir, filename);
|
|
43753
44350
|
const relPath = cantPath.replace(`${projectRoot}/`, "");
|
|
43754
44351
|
let sourceBytes;
|
|
43755
44352
|
let sourceText;
|
|
@@ -43846,9 +44443,9 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
|
|
|
43846
44443
|
const { db: _sdDb } = await openCleoDb2("signaldock");
|
|
43847
44444
|
const db = _sdDb;
|
|
43848
44445
|
try {
|
|
43849
|
-
const canonicalDir =
|
|
44446
|
+
const canonicalDir = join23(projectRoot, ".cleo", "cant", "agents");
|
|
43850
44447
|
walkAgentsDir(db, canonicalDir, projectRoot, summary, verbose);
|
|
43851
|
-
const legacyDir =
|
|
44448
|
+
const legacyDir = join23(projectRoot, ".cleo", "agents");
|
|
43852
44449
|
walkAgentsDir(db, legacyDir, projectRoot, summary, verbose);
|
|
43853
44450
|
} finally {
|
|
43854
44451
|
db.close();
|
|
@@ -43856,7 +44453,7 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
|
|
|
43856
44453
|
return summary;
|
|
43857
44454
|
}
|
|
43858
44455
|
function readMigrationConflicts(projectRoot) {
|
|
43859
|
-
const auditPath =
|
|
44456
|
+
const auditPath = join23(projectRoot, AUDIT_LOG_RELATIVE);
|
|
43860
44457
|
if (!existsSync14(auditPath)) return [];
|
|
43861
44458
|
let raw;
|
|
43862
44459
|
try {
|
|
@@ -43898,7 +44495,7 @@ var init_migrate_agents_v2 = __esm({
|
|
|
43898
44495
|
}
|
|
43899
44496
|
},
|
|
43900
44497
|
async run({ args }) {
|
|
43901
|
-
const projectRoot =
|
|
44498
|
+
const projectRoot = getProjectRoot34();
|
|
43902
44499
|
const verbose = args.quiet !== true;
|
|
43903
44500
|
if (verbose) {
|
|
43904
44501
|
humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
|
|
@@ -43941,8 +44538,8 @@ __export(doctor_exports, {
|
|
|
43941
44538
|
doctorCommand: () => doctorCommand2
|
|
43942
44539
|
});
|
|
43943
44540
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
43944
|
-
import { join as
|
|
43945
|
-
import { getProjectRoot as
|
|
44541
|
+
import { join as join24 } from "node:path";
|
|
44542
|
+
import { getProjectRoot as getProjectRoot35, pushWarning as pushWarning3 } from "@cleocode/core";
|
|
43946
44543
|
import {
|
|
43947
44544
|
quarantineRogueCleoDir,
|
|
43948
44545
|
scanRogueCleoDirs
|
|
@@ -43980,8 +44577,8 @@ async function scanTestFixturesInProd(projectRoot) {
|
|
|
43980
44577
|
}
|
|
43981
44578
|
async function quarantineTestFixtures(projectRoot, matches) {
|
|
43982
44579
|
if (matches.length === 0) return 0;
|
|
43983
|
-
const cleoDir =
|
|
43984
|
-
const quarantineDir =
|
|
44580
|
+
const cleoDir = join24(projectRoot, ".cleo");
|
|
44581
|
+
const quarantineDir = join24(
|
|
43985
44582
|
cleoDir,
|
|
43986
44583
|
"quarantine",
|
|
43987
44584
|
`fixture-scan-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`
|
|
@@ -43989,7 +44586,7 @@ async function quarantineTestFixtures(projectRoot, matches) {
|
|
|
43989
44586
|
mkdirSync4(quarantineDir, { recursive: true });
|
|
43990
44587
|
const manifest = matches.map((m) => ({ ...m, quarantinedAt: (/* @__PURE__ */ new Date()).toISOString() }));
|
|
43991
44588
|
writeFileSync4(
|
|
43992
|
-
|
|
44589
|
+
join24(quarantineDir, "manifest.jsonl"),
|
|
43993
44590
|
manifest.map((m) => JSON.stringify(m)).join("\n") + "\n"
|
|
43994
44591
|
);
|
|
43995
44592
|
const { getNativeDb } = await import("@cleocode/core/store/sqlite.js");
|
|
@@ -44049,8 +44646,10 @@ var init_doctor = __esm({
|
|
|
44049
44646
|
"use strict";
|
|
44050
44647
|
init_dist();
|
|
44051
44648
|
init_cli();
|
|
44649
|
+
init_subcommand_guard();
|
|
44052
44650
|
init_progress();
|
|
44053
44651
|
init_renderers();
|
|
44652
|
+
init_doctor_db_substrate();
|
|
44054
44653
|
init_doctor_projects();
|
|
44055
44654
|
init_migrate_agents_v2();
|
|
44056
44655
|
FIXTURE_ID_PATTERNS = [/^E\d+$/, /^T\d+EP$/];
|
|
@@ -44062,6 +44661,10 @@ var init_doctor = __esm({
|
|
|
44062
44661
|
];
|
|
44063
44662
|
doctorCommand2 = defineCommand({
|
|
44064
44663
|
meta: { name: "doctor", description: "Run system diagnostics and health checks" },
|
|
44664
|
+
subCommands: {
|
|
44665
|
+
// T10307 / Saga T10281 / Epic T10282 — DB-substrate walker
|
|
44666
|
+
"db-substrate": doctorDbSubstrateCommand
|
|
44667
|
+
},
|
|
44065
44668
|
args: {
|
|
44066
44669
|
detailed: {
|
|
44067
44670
|
type: "boolean",
|
|
@@ -44220,14 +44823,15 @@ var init_doctor = __esm({
|
|
|
44220
44823
|
description: "Suppress non-essential output"
|
|
44221
44824
|
}
|
|
44222
44825
|
},
|
|
44223
|
-
async run({ args }) {
|
|
44826
|
+
async run({ args, cmd, rawArgs }) {
|
|
44827
|
+
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
44224
44828
|
const isHuman = args.human === true || !!process.stdout.isTTY && args.json !== true;
|
|
44225
44829
|
const progress = createDoctorProgress(isHuman);
|
|
44226
44830
|
progress.start();
|
|
44227
44831
|
try {
|
|
44228
44832
|
if (args.brain) {
|
|
44229
44833
|
const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
|
|
44230
|
-
const projectRoot =
|
|
44834
|
+
const projectRoot = getProjectRoot35();
|
|
44231
44835
|
const dashboard = await computeBrainHealthDashboard(projectRoot);
|
|
44232
44836
|
cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
|
|
44233
44837
|
if (dashboard.hasP0Failure) {
|
|
@@ -44236,7 +44840,7 @@ var init_doctor = __esm({
|
|
|
44236
44840
|
return;
|
|
44237
44841
|
}
|
|
44238
44842
|
if (args["scan-test-fixtures-in-prod"]) {
|
|
44239
|
-
const projectRoot =
|
|
44843
|
+
const projectRoot = getProjectRoot35();
|
|
44240
44844
|
const matches = await scanTestFixturesInProd(projectRoot);
|
|
44241
44845
|
const dryRun = args["dry-run"] !== false && args.quarantine !== true;
|
|
44242
44846
|
const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
|
|
@@ -44324,7 +44928,7 @@ var init_doctor = __esm({
|
|
|
44324
44928
|
progress.complete("Comprehensive diagnostics complete");
|
|
44325
44929
|
} else if (args["scan-rogue-cleo-dirs"]) {
|
|
44326
44930
|
progress.step(0, "Scanning for rogue .cleo/ directories");
|
|
44327
|
-
const projectRoot =
|
|
44931
|
+
const projectRoot = getProjectRoot35();
|
|
44328
44932
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
44329
44933
|
progress.complete(
|
|
44330
44934
|
`Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
|
|
@@ -44333,7 +44937,7 @@ var init_doctor = __esm({
|
|
|
44333
44937
|
} else if (args["quarantine-rogue-cleo-dirs"]) {
|
|
44334
44938
|
const isDryRun = args["dry-run"] === true;
|
|
44335
44939
|
progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
|
|
44336
|
-
const projectRoot =
|
|
44940
|
+
const projectRoot = getProjectRoot35();
|
|
44337
44941
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
44338
44942
|
if (reports.length === 0) {
|
|
44339
44943
|
progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
|
|
@@ -44387,7 +44991,7 @@ var init_doctor = __esm({
|
|
|
44387
44991
|
const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
|
|
44388
44992
|
const { getCleoHome: getCleoHome6 } = await import("@cleocode/core");
|
|
44389
44993
|
const cleoHome = getCleoHome6();
|
|
44390
|
-
const projectRoot =
|
|
44994
|
+
const projectRoot = getProjectRoot35();
|
|
44391
44995
|
const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
|
|
44392
44996
|
const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
|
|
44393
44997
|
const isDryRun = args["dry-run"] === true;
|
|
@@ -44420,7 +45024,7 @@ var init_doctor = __esm({
|
|
|
44420
45024
|
} else if (args["audit-worktree-orphans"]) {
|
|
44421
45025
|
progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
|
|
44422
45026
|
const { auditWorktreeOrphansComprehensive, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
|
|
44423
|
-
const projectRoot =
|
|
45027
|
+
const projectRoot = getProjectRoot35();
|
|
44424
45028
|
const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
|
|
44425
45029
|
const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
|
|
44426
45030
|
const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
|
|
@@ -44434,7 +45038,7 @@ var init_doctor = __esm({
|
|
|
44434
45038
|
const legacyOrphans = legacyScanResult.orphans;
|
|
44435
45039
|
const totalAnomalies = comprehensive.count;
|
|
44436
45040
|
if (legacyScanResult.softWarnMessage) {
|
|
44437
|
-
|
|
45041
|
+
pushWarning3({
|
|
44438
45042
|
code: "W_DOCTOR_SCAN_SOFT_WARN",
|
|
44439
45043
|
message: legacyScanResult.softWarnMessage,
|
|
44440
45044
|
severity: "warn"
|
|
@@ -44442,7 +45046,7 @@ var init_doctor = __esm({
|
|
|
44442
45046
|
}
|
|
44443
45047
|
if (legacyScanResult.isPartial) {
|
|
44444
45048
|
const reason = legacyScanResult.partialReason === "timeout" ? `timed out after ${timeoutSecs}s (use --timeout <seconds> to adjust)` : `per-level entry cap of ${maxEntriesPerLevel} exceeded (use --max-entries-per-level <n> to adjust)`;
|
|
44445
|
-
|
|
45049
|
+
pushWarning3({
|
|
44446
45050
|
code: "W_DOCTOR_SCAN_PARTIAL",
|
|
44447
45051
|
message: `legacy orphan scan is PARTIAL \u2014 ${reason}. Results may be incomplete.`,
|
|
44448
45052
|
severity: "warn",
|
|
@@ -44477,7 +45081,7 @@ var init_doctor = __esm({
|
|
|
44477
45081
|
`${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
|
|
44478
45082
|
);
|
|
44479
45083
|
const { pruneWorktreeOrphans, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
|
|
44480
|
-
const projectRoot =
|
|
45084
|
+
const projectRoot = getProjectRoot35();
|
|
44481
45085
|
const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
|
|
44482
45086
|
const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
|
|
44483
45087
|
const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
|
|
@@ -44486,7 +45090,7 @@ var init_doctor = __esm({
|
|
|
44486
45090
|
maxEntriesPerLevel: Number.isFinite(maxEntriesPerLevel) ? maxEntriesPerLevel : 500
|
|
44487
45091
|
});
|
|
44488
45092
|
if (scanResult.softWarnMessage) {
|
|
44489
|
-
|
|
45093
|
+
pushWarning3({
|
|
44490
45094
|
code: "W_DOCTOR_SCAN_SOFT_WARN",
|
|
44491
45095
|
message: scanResult.softWarnMessage,
|
|
44492
45096
|
severity: "warn"
|
|
@@ -44494,7 +45098,7 @@ var init_doctor = __esm({
|
|
|
44494
45098
|
}
|
|
44495
45099
|
if (scanResult.isPartial) {
|
|
44496
45100
|
const reason = scanResult.partialReason === "timeout" ? `timed out after ${timeoutSecs}s (use --timeout <seconds> to adjust)` : `per-level entry cap of ${maxEntriesPerLevel} exceeded (use --max-entries-per-level <n> to adjust)`;
|
|
44497
|
-
|
|
45101
|
+
pushWarning3({
|
|
44498
45102
|
code: "W_DOCTOR_SCAN_PARTIAL",
|
|
44499
45103
|
message: `orphan scan is PARTIAL \u2014 ${reason}. Only orphans found before abort will be pruned.`,
|
|
44500
45104
|
severity: "warn",
|
|
@@ -44525,8 +45129,8 @@ var init_doctor = __esm({
|
|
|
44525
45129
|
);
|
|
44526
45130
|
return;
|
|
44527
45131
|
}
|
|
44528
|
-
const archiveDir =
|
|
44529
|
-
const auditLogPath =
|
|
45132
|
+
const archiveDir = join24(projectRoot, ".cleo", "backups");
|
|
45133
|
+
const auditLogPath = join24(projectRoot, ".cleo", "audit", "worktree-prune.jsonl");
|
|
44530
45134
|
const result = await pruneWorktreeOrphans(orphans, {
|
|
44531
45135
|
archiveDir,
|
|
44532
45136
|
auditLogPath,
|
|
@@ -44556,7 +45160,7 @@ var init_doctor = __esm({
|
|
|
44556
45160
|
`${isDryRun ? "[DRY RUN] " : ""}Migrating .cleo/worktree-include \u2192 .worktreeinclude`
|
|
44557
45161
|
);
|
|
44558
45162
|
const { migrateWorktreeIncludeFile } = await import("@cleocode/core");
|
|
44559
|
-
const projectRoot =
|
|
45163
|
+
const projectRoot = getProjectRoot35();
|
|
44560
45164
|
const result = await migrateWorktreeIncludeFile(projectRoot, { dryRun: isDryRun });
|
|
44561
45165
|
progress.complete(`Migration ${result.action}`);
|
|
44562
45166
|
cliOutput(result, { command: "doctor", operation: "doctor.migrate-worktree-include" });
|
|
@@ -44572,7 +45176,7 @@ var init_doctor = __esm({
|
|
|
44572
45176
|
} else if (args["audit-sagas"]) {
|
|
44573
45177
|
progress.step(0, "Auditing Saga hierarchy for ADR-073 invariants");
|
|
44574
45178
|
const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
|
|
44575
|
-
const projectRoot =
|
|
45179
|
+
const projectRoot = getProjectRoot35();
|
|
44576
45180
|
const result = await auditSagaHierarchy(projectRoot);
|
|
44577
45181
|
const summary = `Saga audit complete \u2014 ${result.sagas.length} saga(s) inspected, ${result.count} invariant violation(s), ${result.driftCount} drift warning(s)`;
|
|
44578
45182
|
progress.complete(summary);
|
|
@@ -44590,7 +45194,7 @@ var init_doctor = __esm({
|
|
|
44590
45194
|
{ command: "doctor", operation: "admin.health" }
|
|
44591
45195
|
);
|
|
44592
45196
|
try {
|
|
44593
|
-
const projectRoot =
|
|
45197
|
+
const projectRoot = getProjectRoot35();
|
|
44594
45198
|
const conflicts = readMigrationConflicts(projectRoot);
|
|
44595
45199
|
if (conflicts.length > 0) {
|
|
44596
45200
|
progress.complete(
|
|
@@ -44621,7 +45225,7 @@ var init_doctor = __esm({
|
|
|
44621
45225
|
progress.complete("Health check complete");
|
|
44622
45226
|
}
|
|
44623
45227
|
try {
|
|
44624
|
-
const projectRoot =
|
|
45228
|
+
const projectRoot = getProjectRoot35();
|
|
44625
45229
|
const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
|
|
44626
45230
|
const sagaAudit = await auditSagaHierarchy(projectRoot);
|
|
44627
45231
|
if (sagaAudit.sagas.length === 0) {
|
|
@@ -44683,7 +45287,7 @@ __export(event_exports, {
|
|
|
44683
45287
|
orchestratorCommand: () => orchestratorCommand
|
|
44684
45288
|
});
|
|
44685
45289
|
import { readdir as readdir2 } from "node:fs/promises";
|
|
44686
|
-
import { join as
|
|
45290
|
+
import { join as join25 } from "node:path";
|
|
44687
45291
|
import { cwd as processCwd } from "node:process";
|
|
44688
45292
|
import { appendEvent } from "@cleocode/core/events/event-bus.js";
|
|
44689
45293
|
function resolveProjectRoot3(arg) {
|
|
@@ -44806,7 +45410,7 @@ var init_event = __esm({
|
|
|
44806
45410
|
const agentIdFilter = args.agent;
|
|
44807
45411
|
const showAll = args.all === true;
|
|
44808
45412
|
const lines = parseInt(args.lines ?? "20", 10);
|
|
44809
|
-
const eventsDir =
|
|
45413
|
+
const eventsDir = join25(projectRoot, ".cleo", "agent-events");
|
|
44810
45414
|
try {
|
|
44811
45415
|
let files = [];
|
|
44812
45416
|
try {
|
|
@@ -44844,7 +45448,7 @@ var init_event = __esm({
|
|
|
44844
45448
|
for (const file of filesToTail) {
|
|
44845
45449
|
const agentId = file.replace(".jsonl", "");
|
|
44846
45450
|
const { readFileSync: readFileSync18 } = await import("node:fs");
|
|
44847
|
-
const content = readFileSync18(
|
|
45451
|
+
const content = readFileSync18(join25(eventsDir, file), "utf-8");
|
|
44848
45452
|
const eventLines = content.trim().split("\n").filter(Boolean);
|
|
44849
45453
|
const tail = eventLines.slice(-lines);
|
|
44850
45454
|
if (jsonMode) {
|
|
@@ -44914,7 +45518,7 @@ var init_event = __esm({
|
|
|
44914
45518
|
const epicFilter = args.epic;
|
|
44915
45519
|
const follow = args.follow === true;
|
|
44916
45520
|
const lines = parseInt(args.lines ?? "50", 10);
|
|
44917
|
-
const eventsDir =
|
|
45521
|
+
const eventsDir = join25(projectRoot, ".cleo", "agent-events");
|
|
44918
45522
|
let files = [];
|
|
44919
45523
|
try {
|
|
44920
45524
|
const entries = await readdir2(eventsDir);
|
|
@@ -44940,7 +45544,7 @@ var init_event = __esm({
|
|
|
44940
45544
|
const agentId = file.replace(".jsonl", "");
|
|
44941
45545
|
try {
|
|
44942
45546
|
const { readFileSync: readFileSync18 } = await import("node:fs");
|
|
44943
|
-
const content = readFileSync18(
|
|
45547
|
+
const content = readFileSync18(join25(eventsDir, file), "utf-8");
|
|
44944
45548
|
const eventLines = content.trim().split("\n").filter(Boolean);
|
|
44945
45549
|
const tail = eventLines.slice(-lines);
|
|
44946
45550
|
if (jsonMode) {
|
|
@@ -45479,7 +46083,7 @@ __export(gc_exports, {
|
|
|
45479
46083
|
gcCommand: () => gcCommand
|
|
45480
46084
|
});
|
|
45481
46085
|
import { homedir as homedir4, tmpdir } from "node:os";
|
|
45482
|
-
import { join as
|
|
46086
|
+
import { join as join26 } from "node:path";
|
|
45483
46087
|
import { pruneOrphanTempDirs, pruneOrphanWorktrees } from "@cleocode/core/gc/cleanup.js";
|
|
45484
46088
|
import { runGC } from "@cleocode/core/gc/runner.js";
|
|
45485
46089
|
import { readGCState } from "@cleocode/core/gc/state.js";
|
|
@@ -45562,7 +46166,7 @@ var init_gc = __esm({
|
|
|
45562
46166
|
},
|
|
45563
46167
|
async run({ args }) {
|
|
45564
46168
|
const cleoDir = resolveLegacyCleoDir3(args["cleo-dir"]);
|
|
45565
|
-
const statePath =
|
|
46169
|
+
const statePath = join26(cleoDir, "gc-state.json");
|
|
45566
46170
|
try {
|
|
45567
46171
|
const state = await readGCState(statePath);
|
|
45568
46172
|
const diskStr = state.lastDiskUsedPct !== null ? `${state.lastDiskUsedPct.toFixed(1)}%` : "unknown";
|
|
@@ -45615,8 +46219,8 @@ var init_gc = __esm({
|
|
|
45615
46219
|
}
|
|
45616
46220
|
},
|
|
45617
46221
|
async run({ args }) {
|
|
45618
|
-
const xdgData = process.env["XDG_DATA_HOME"] ??
|
|
45619
|
-
const worktreesRoot = args["worktrees-root"] ??
|
|
46222
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join26(homedir4(), ".local", "share");
|
|
46223
|
+
const worktreesRoot = args["worktrees-root"] ?? join26(xdgData, "cleo", "worktrees");
|
|
45620
46224
|
const projectHash = args["project-hash"];
|
|
45621
46225
|
const dryRun = args["dry-run"];
|
|
45622
46226
|
const preserveRaw = args["preserve-tasks"];
|
|
@@ -46829,7 +47433,7 @@ __export(init_exports, {
|
|
|
46829
47433
|
initCommand: () => initCommand2
|
|
46830
47434
|
});
|
|
46831
47435
|
import { existsSync as existsSync15, readFileSync as readFileSync15 } from "node:fs";
|
|
46832
|
-
import { join as
|
|
47436
|
+
import { join as join27 } from "node:path";
|
|
46833
47437
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
46834
47438
|
import {
|
|
46835
47439
|
CleoError as CleoError4,
|
|
@@ -46841,9 +47445,9 @@ import {
|
|
|
46841
47445
|
function getGitignoreTemplate() {
|
|
46842
47446
|
try {
|
|
46843
47447
|
const thisFile = fileURLToPath6(import.meta.url);
|
|
46844
|
-
const packageRoot =
|
|
46845
|
-
const localTemplatePath =
|
|
46846
|
-
const monorepoTemplatePath =
|
|
47448
|
+
const packageRoot = join27(thisFile, "..", "..", "..", "..");
|
|
47449
|
+
const localTemplatePath = join27(packageRoot, "templates", "cleo-gitignore");
|
|
47450
|
+
const monorepoTemplatePath = join27(packageRoot, "..", "..", "templates", "cleo-gitignore");
|
|
46847
47451
|
const templatePath = existsSync15(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
|
|
46848
47452
|
if (existsSync15(templatePath)) {
|
|
46849
47453
|
return readFileSync15(templatePath, "utf-8");
|
|
@@ -47768,7 +48372,7 @@ var llm_cost_exports = {};
|
|
|
47768
48372
|
__export(llm_cost_exports, {
|
|
47769
48373
|
costCommand: () => costCommand
|
|
47770
48374
|
});
|
|
47771
|
-
import { getProjectRoot as
|
|
48375
|
+
import { getProjectRoot as getProjectRoot36 } from "@cleocode/core/internal";
|
|
47772
48376
|
import { computeCost } from "@cleocode/core/llm/usage-pricing";
|
|
47773
48377
|
function resolveSessionId(raw) {
|
|
47774
48378
|
if (raw === "current") {
|
|
@@ -47841,7 +48445,7 @@ var init_llm_cost = __esm({
|
|
|
47841
48445
|
process.exit(6);
|
|
47842
48446
|
}
|
|
47843
48447
|
const sessionId = resolveSessionId(rawSessionId);
|
|
47844
|
-
const projectRoot =
|
|
48448
|
+
const projectRoot = getProjectRoot36(process.cwd());
|
|
47845
48449
|
let breakdown;
|
|
47846
48450
|
try {
|
|
47847
48451
|
breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
|
|
@@ -48482,7 +49086,7 @@ var llm_exports = {};
|
|
|
48482
49086
|
__export(llm_exports, {
|
|
48483
49087
|
llmCommand: () => llmCommand
|
|
48484
49088
|
});
|
|
48485
|
-
import { pushWarning as
|
|
49089
|
+
import { pushWarning as pushWarning4 } from "@cleocode/core";
|
|
48486
49090
|
async function getListProviders() {
|
|
48487
49091
|
const { listProviders } = await import(
|
|
48488
49092
|
/* webpackIgnore: true */
|
|
@@ -48613,7 +49217,7 @@ var init_llm3 = __esm({
|
|
|
48613
49217
|
apiKey = envValue;
|
|
48614
49218
|
source = "env";
|
|
48615
49219
|
} else if (typeof a["api-key"] === "string" && a["api-key"]) {
|
|
48616
|
-
|
|
49220
|
+
pushWarning4({
|
|
48617
49221
|
code: "W_DEPRECATED_FLAG",
|
|
48618
49222
|
message: API_KEY_FLAG_DEPRECATION,
|
|
48619
49223
|
deprecated: "--api-key=<value>",
|
|
@@ -49388,7 +49992,7 @@ var memory_exports = {};
|
|
|
49388
49992
|
__export(memory_exports, {
|
|
49389
49993
|
memoryCommand: () => memoryCommand
|
|
49390
49994
|
});
|
|
49391
|
-
import { getProjectRoot as
|
|
49995
|
+
import { getProjectRoot as getProjectRoot37 } from "@cleocode/core";
|
|
49392
49996
|
import {
|
|
49393
49997
|
getBrainDb as getBrainDb2,
|
|
49394
49998
|
getDreamStatus,
|
|
@@ -50312,7 +50916,7 @@ var init_memory3 = __esm({
|
|
|
50312
50916
|
},
|
|
50313
50917
|
args: {},
|
|
50314
50918
|
async run() {
|
|
50315
|
-
const root =
|
|
50919
|
+
const root = getProjectRoot37();
|
|
50316
50920
|
try {
|
|
50317
50921
|
const result = await runConsolidation(root);
|
|
50318
50922
|
cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
|
|
@@ -50336,7 +50940,7 @@ var init_memory3 = __esm({
|
|
|
50336
50940
|
}
|
|
50337
50941
|
},
|
|
50338
50942
|
async run({ args }) {
|
|
50339
|
-
const root =
|
|
50943
|
+
const root = getProjectRoot37();
|
|
50340
50944
|
if (args.status) {
|
|
50341
50945
|
try {
|
|
50342
50946
|
const status = await getDreamStatus(root);
|
|
@@ -50373,7 +50977,7 @@ var init_memory3 = __esm({
|
|
|
50373
50977
|
}
|
|
50374
50978
|
},
|
|
50375
50979
|
async run({ args }) {
|
|
50376
|
-
const root =
|
|
50980
|
+
const root = getProjectRoot37();
|
|
50377
50981
|
try {
|
|
50378
50982
|
const { runObserver, runReflector } = await import("@cleocode/core/memory");
|
|
50379
50983
|
const observerResult = await runObserver(root, args.session, {
|
|
@@ -50413,7 +51017,7 @@ var init_memory3 = __esm({
|
|
|
50413
51017
|
}
|
|
50414
51018
|
},
|
|
50415
51019
|
async run({ args }) {
|
|
50416
|
-
const root =
|
|
51020
|
+
const root = getProjectRoot37();
|
|
50417
51021
|
try {
|
|
50418
51022
|
await getBrainDb2(root);
|
|
50419
51023
|
const { totalDuplicateRows, groups } = await scanDuplicateEntries();
|
|
@@ -50459,7 +51063,7 @@ var init_memory3 = __esm({
|
|
|
50459
51063
|
async run({ args }) {
|
|
50460
51064
|
const sourceDir = args.from;
|
|
50461
51065
|
const isDryRun = !!args["dry-run"];
|
|
50462
|
-
const projectRoot =
|
|
51066
|
+
const projectRoot = getProjectRoot37();
|
|
50463
51067
|
try {
|
|
50464
51068
|
const result = await importMemoryFiles({
|
|
50465
51069
|
sourceDir,
|
|
@@ -50610,7 +51214,7 @@ var init_memory3 = __esm({
|
|
|
50610
51214
|
},
|
|
50611
51215
|
args: {},
|
|
50612
51216
|
async run() {
|
|
50613
|
-
const root =
|
|
51217
|
+
const root = getProjectRoot37();
|
|
50614
51218
|
try {
|
|
50615
51219
|
await getBrainDb2(root);
|
|
50616
51220
|
const result = await getTierStats(root);
|
|
@@ -50653,7 +51257,7 @@ var init_memory3 = __esm({
|
|
|
50653
51257
|
}
|
|
50654
51258
|
},
|
|
50655
51259
|
async run({ args }) {
|
|
50656
|
-
const root =
|
|
51260
|
+
const root = getProjectRoot37();
|
|
50657
51261
|
const targetTier = args.to;
|
|
50658
51262
|
const reason = args.reason;
|
|
50659
51263
|
const validTiers = ["medium", "long"];
|
|
@@ -50719,7 +51323,7 @@ var init_memory3 = __esm({
|
|
|
50719
51323
|
}
|
|
50720
51324
|
},
|
|
50721
51325
|
async run({ args }) {
|
|
50722
|
-
const root =
|
|
51326
|
+
const root = getProjectRoot37();
|
|
50723
51327
|
const targetTier = args.to;
|
|
50724
51328
|
const reason = args.reason;
|
|
50725
51329
|
const validTiers = ["short", "medium"];
|
|
@@ -51179,7 +51783,7 @@ var migrate_claude_mem_exports = {};
|
|
|
51179
51783
|
__export(migrate_claude_mem_exports, {
|
|
51180
51784
|
migrateClaudeMemCommand: () => migrateClaudeMemCommand
|
|
51181
51785
|
});
|
|
51182
|
-
import { getProjectRoot as
|
|
51786
|
+
import { getProjectRoot as getProjectRoot38, migrateClaudeMem } from "@cleocode/core/internal";
|
|
51183
51787
|
import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
|
|
51184
51788
|
import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
|
|
51185
51789
|
var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
|
|
@@ -51242,7 +51846,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
51242
51846
|
}
|
|
51243
51847
|
},
|
|
51244
51848
|
async run({ args }) {
|
|
51245
|
-
const root =
|
|
51849
|
+
const root = getProjectRoot38();
|
|
51246
51850
|
try {
|
|
51247
51851
|
const result = await migrateClaudeMem(root, {
|
|
51248
51852
|
sourcePath: args.source,
|
|
@@ -51291,7 +51895,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
51291
51895
|
}
|
|
51292
51896
|
},
|
|
51293
51897
|
async run({ args }) {
|
|
51294
|
-
const projectRoot =
|
|
51898
|
+
const projectRoot = getProjectRoot38();
|
|
51295
51899
|
try {
|
|
51296
51900
|
const db = await getDb2(projectRoot);
|
|
51297
51901
|
const rcasdFlag = Boolean(args.rcasd);
|
|
@@ -51395,7 +51999,7 @@ __export(nexus_exports, {
|
|
|
51395
51999
|
import { appendFile as appendFile2, mkdir as mkdir3 } from "node:fs/promises";
|
|
51396
52000
|
import { homedir as homedir5 } from "node:os";
|
|
51397
52001
|
import path4 from "node:path";
|
|
51398
|
-
import { getProjectRoot as
|
|
52002
|
+
import { getProjectRoot as getProjectRoot39 } from "@cleocode/core";
|
|
51399
52003
|
import { getSymbolImpact } from "@cleocode/core/nexus";
|
|
51400
52004
|
import { runNexusAnalysis } from "@cleocode/core/nexus/analyze-orchestrator.js";
|
|
51401
52005
|
import { exportNexusGraph } from "@cleocode/core/nexus/export.js";
|
|
@@ -51510,7 +52114,7 @@ var init_nexus3 = __esm({
|
|
|
51510
52114
|
async run({ args }) {
|
|
51511
52115
|
applyJsonFlag2(args.json);
|
|
51512
52116
|
const projectIdOverride = args["project-id"];
|
|
51513
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
52117
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
51514
52118
|
const startTime = Date.now();
|
|
51515
52119
|
try {
|
|
51516
52120
|
const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
|
|
@@ -52025,7 +52629,7 @@ var init_nexus3 = __esm({
|
|
|
52025
52629
|
applyJsonFlag2(args.json);
|
|
52026
52630
|
const startTime = Date.now();
|
|
52027
52631
|
const projectIdOverride = args["project-id"];
|
|
52028
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
52632
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52029
52633
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
52030
52634
|
const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
|
|
52031
52635
|
const durationMs = Date.now() - startTime;
|
|
@@ -52069,7 +52673,7 @@ var init_nexus3 = __esm({
|
|
|
52069
52673
|
applyJsonFlag2(args.json);
|
|
52070
52674
|
const startTime = Date.now();
|
|
52071
52675
|
const projectIdOverride = args["project-id"];
|
|
52072
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
52676
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52073
52677
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
52074
52678
|
const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
|
|
52075
52679
|
const durationMs = Date.now() - startTime;
|
|
@@ -52112,7 +52716,7 @@ var init_nexus3 = __esm({
|
|
|
52112
52716
|
void appendDeprecationTelemetry("nexus.context", "cleo graph context");
|
|
52113
52717
|
const startTime = Date.now();
|
|
52114
52718
|
const projectIdOverride = args["project-id"];
|
|
52115
|
-
const repoPath =
|
|
52719
|
+
const repoPath = getProjectRoot39();
|
|
52116
52720
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
52117
52721
|
const limit = parseInt(args.limit, 10);
|
|
52118
52722
|
const symbolName = args.symbol;
|
|
@@ -52175,7 +52779,7 @@ var init_nexus3 = __esm({
|
|
|
52175
52779
|
const startTime = Date.now();
|
|
52176
52780
|
const whyFlag = !!args.why;
|
|
52177
52781
|
const projectIdOverride = args["project-id"];
|
|
52178
|
-
const repoPath =
|
|
52782
|
+
const repoPath = getProjectRoot39();
|
|
52179
52783
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
52180
52784
|
const maxDepth = Math.min(parseInt(args.depth, 10), 5);
|
|
52181
52785
|
const symbolName = args.symbol;
|
|
@@ -52247,7 +52851,7 @@ var init_nexus3 = __esm({
|
|
|
52247
52851
|
const projectIdOverride = args["project-id"];
|
|
52248
52852
|
const isIncremental = !!args.incremental;
|
|
52249
52853
|
const ctx = getFormatContext();
|
|
52250
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
52854
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52251
52855
|
humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
|
|
52252
52856
|
if (!isIncremental) humanInfo("[nexus] Clearing existing index for project...");
|
|
52253
52857
|
try {
|
|
@@ -52350,7 +52954,7 @@ var init_nexus3 = __esm({
|
|
|
52350
52954
|
async run({ args }) {
|
|
52351
52955
|
applyJsonFlag2(args.json);
|
|
52352
52956
|
const startTime = Date.now();
|
|
52353
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
52957
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52354
52958
|
const name = args.name;
|
|
52355
52959
|
const response = await dispatchRaw("mutate", "nexus", "projects.register", {
|
|
52356
52960
|
path: repoPath,
|
|
@@ -52708,7 +53312,7 @@ var init_nexus3 = __esm({
|
|
|
52708
53312
|
applyJsonFlag2(args.json);
|
|
52709
53313
|
const startTime = Date.now();
|
|
52710
53314
|
const projectIdOverride = args["project-id"];
|
|
52711
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
53315
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52712
53316
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
52713
53317
|
const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
|
|
52714
53318
|
repoPath,
|
|
@@ -52814,7 +53418,7 @@ var init_nexus3 = __esm({
|
|
|
52814
53418
|
async run({ args }) {
|
|
52815
53419
|
applyJsonFlag2(args.json);
|
|
52816
53420
|
const startTime = Date.now();
|
|
52817
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
53421
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52818
53422
|
const projectIdOverride = args["project-id"];
|
|
52819
53423
|
const beforeRef = args.before ?? "HEAD~1";
|
|
52820
53424
|
const afterRef = args.after ?? "HEAD";
|
|
@@ -52932,7 +53536,7 @@ var init_nexus3 = __esm({
|
|
|
52932
53536
|
applyJsonFlag2(args.json);
|
|
52933
53537
|
const startTime = Date.now();
|
|
52934
53538
|
const projectIdOverride = args["project-id"];
|
|
52935
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
53539
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52936
53540
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
52937
53541
|
const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
|
|
52938
53542
|
const durationMs = Date.now() - startTime;
|
|
@@ -52988,7 +53592,7 @@ var init_nexus3 = __esm({
|
|
|
52988
53592
|
const startTime = Date.now();
|
|
52989
53593
|
const routeSymbol = args.routeSymbol;
|
|
52990
53594
|
const projectIdOverride = args["project-id"];
|
|
52991
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
53595
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
52992
53596
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
52993
53597
|
const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
|
|
52994
53598
|
const durationMs = Date.now() - startTime;
|
|
@@ -53378,7 +53982,7 @@ var init_nexus3 = __esm({
|
|
|
53378
53982
|
async run({ args }) {
|
|
53379
53983
|
applyJsonFlag2(args.json);
|
|
53380
53984
|
const startTime = Date.now();
|
|
53381
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
53985
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
53382
53986
|
const projectIdOverride = args["project-id"];
|
|
53383
53987
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
53384
53988
|
const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
|
|
@@ -53482,7 +54086,7 @@ var init_nexus3 = __esm({
|
|
|
53482
54086
|
async run({ args }) {
|
|
53483
54087
|
applyJsonFlag2(args.json);
|
|
53484
54088
|
const startTime = Date.now();
|
|
53485
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
54089
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot39();
|
|
53486
54090
|
const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
53487
54091
|
const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
|
|
53488
54092
|
projectId,
|
|
@@ -53563,7 +54167,7 @@ var init_nexus3 = __esm({
|
|
|
53563
54167
|
const isIncremental = !!args.incremental;
|
|
53564
54168
|
try {
|
|
53565
54169
|
const result = await runNexusWiki({
|
|
53566
|
-
projectRoot:
|
|
54170
|
+
projectRoot: getProjectRoot39(),
|
|
53567
54171
|
outputDir,
|
|
53568
54172
|
communityFilter,
|
|
53569
54173
|
incremental: isIncremental
|
|
@@ -55990,7 +56594,7 @@ var refresh_memory_exports = {};
|
|
|
55990
56594
|
__export(refresh_memory_exports, {
|
|
55991
56595
|
refreshMemoryCommand: () => refreshMemoryCommand
|
|
55992
56596
|
});
|
|
55993
|
-
import { getProjectRoot as
|
|
56597
|
+
import { getProjectRoot as getProjectRoot40 } from "@cleocode/core";
|
|
55994
56598
|
var refreshMemoryCommand;
|
|
55995
56599
|
var init_refresh_memory = __esm({
|
|
55996
56600
|
"packages/cleo/src/cli/commands/refresh-memory.ts"() {
|
|
@@ -56003,7 +56607,7 @@ var init_refresh_memory = __esm({
|
|
|
56003
56607
|
description: "Regenerate .cleo/memory-bridge.md from brain.db"
|
|
56004
56608
|
},
|
|
56005
56609
|
async run() {
|
|
56006
|
-
const projectDir =
|
|
56610
|
+
const projectDir = getProjectRoot40();
|
|
56007
56611
|
const { writeMemoryBridge } = await import("@cleocode/core/internal");
|
|
56008
56612
|
const result = await writeMemoryBridge(projectDir);
|
|
56009
56613
|
if (result.written) {
|
|
@@ -56179,14 +56783,6 @@ var init_relates = __esm({
|
|
|
56179
56783
|
}
|
|
56180
56784
|
});
|
|
56181
56785
|
|
|
56182
|
-
// packages/cleo/src/cli/lib/define-cli-command.ts
|
|
56183
|
-
var init_define_cli_command = __esm({
|
|
56184
|
-
"packages/cleo/src/cli/lib/define-cli-command.ts"() {
|
|
56185
|
-
"use strict";
|
|
56186
|
-
init_dist();
|
|
56187
|
-
}
|
|
56188
|
-
});
|
|
56189
|
-
|
|
56190
56786
|
// packages/cleo/src/cli/commands/release/ship-e2e-smoke.ts
|
|
56191
56787
|
import { release as release2 } from "@cleocode/core";
|
|
56192
56788
|
var shipE2eSmokeCommand;
|
|
@@ -57412,7 +58008,7 @@ import fs3 from "node:fs";
|
|
|
57412
58008
|
import path5 from "node:path";
|
|
57413
58009
|
import {
|
|
57414
58010
|
CleoError as CleoError7,
|
|
57415
|
-
getProjectRoot as
|
|
58011
|
+
getProjectRoot as getProjectRoot41,
|
|
57416
58012
|
getTaskAccessor as getTaskAccessor3,
|
|
57417
58013
|
parseConflictReport,
|
|
57418
58014
|
setAtPath
|
|
@@ -57433,7 +58029,7 @@ var init_restore = __esm({
|
|
|
57433
58029
|
description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
|
|
57434
58030
|
},
|
|
57435
58031
|
async run() {
|
|
57436
|
-
const projectRoot =
|
|
58032
|
+
const projectRoot = getProjectRoot41();
|
|
57437
58033
|
const reportPath = path5.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
|
|
57438
58034
|
if (!fs3.existsSync(reportPath)) {
|
|
57439
58035
|
humanLine("No pending restore conflicts. Nothing to finalize.");
|
|
@@ -57799,7 +58395,7 @@ __export(revert_exports, {
|
|
|
57799
58395
|
revertCommand: () => revertCommand
|
|
57800
58396
|
});
|
|
57801
58397
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
57802
|
-
import { join as
|
|
58398
|
+
import { join as join28 } from "node:path";
|
|
57803
58399
|
import { cwd as processCwd2 } from "node:process";
|
|
57804
58400
|
import { E_RECEIPT_NOT_FOUND } from "@cleocode/core/sentient/chain-walker.js";
|
|
57805
58401
|
import { SENTIENT_STATE_FILE } from "@cleocode/core/sentient/daemon.js";
|
|
@@ -57852,7 +58448,7 @@ async function loadOwnerAttestation(attestationFilePath) {
|
|
|
57852
58448
|
return obj;
|
|
57853
58449
|
}
|
|
57854
58450
|
async function loadOwnerPubkeys(projectRoot) {
|
|
57855
|
-
const path6 =
|
|
58451
|
+
const path6 = join28(projectRoot, OWNER_PUBKEYS_FILE);
|
|
57856
58452
|
try {
|
|
57857
58453
|
const raw = await readFile4(path6, "utf-8");
|
|
57858
58454
|
const parsed = JSON.parse(raw);
|
|
@@ -57936,7 +58532,7 @@ var init_revert = __esm({
|
|
|
57936
58532
|
if (attestation && allowedPubkeys.size > 0 && !allowedPubkeys.has(attestation.ownerPubkey)) {
|
|
57937
58533
|
emitFailure2(
|
|
57938
58534
|
E_OWNER_ATTESTATION_REQUIRED,
|
|
57939
|
-
`Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${
|
|
58535
|
+
`Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${join28(projectRoot, OWNER_PUBKEYS_FILE)}`,
|
|
57940
58536
|
jsonMode
|
|
57941
58537
|
);
|
|
57942
58538
|
}
|
|
@@ -57989,7 +58585,7 @@ ${lines}`
|
|
|
57989
58585
|
identity,
|
|
57990
58586
|
includeHuman
|
|
57991
58587
|
});
|
|
57992
|
-
const statePath =
|
|
58588
|
+
const statePath = join28(projectRoot, SENTIENT_STATE_FILE);
|
|
57993
58589
|
const state = await readSentientState(statePath);
|
|
57994
58590
|
emitSuccess(
|
|
57995
58591
|
{
|
|
@@ -58459,7 +59055,7 @@ __export(self_update_exports, {
|
|
|
58459
59055
|
});
|
|
58460
59056
|
import { execFile } from "node:child_process";
|
|
58461
59057
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
58462
|
-
import { join as
|
|
59058
|
+
import { join as join29 } from "node:path";
|
|
58463
59059
|
import * as readline2 from "node:readline";
|
|
58464
59060
|
import { promisify } from "node:util";
|
|
58465
59061
|
import {
|
|
@@ -58474,7 +59070,7 @@ import {
|
|
|
58474
59070
|
async function getCurrentVersion() {
|
|
58475
59071
|
const cleoHome = getCleoHome4();
|
|
58476
59072
|
try {
|
|
58477
|
-
const content = await readFile5(
|
|
59073
|
+
const content = await readFile5(join29(cleoHome, "VERSION"), "utf-8");
|
|
58478
59074
|
return (content.split("\n")[0] ?? "unknown").trim();
|
|
58479
59075
|
} catch {
|
|
58480
59076
|
return "unknown";
|
|
@@ -58528,7 +59124,7 @@ async function writeRuntimeVersionMetadata(mode, source, version) {
|
|
|
58528
59124
|
];
|
|
58529
59125
|
await import("node:fs/promises").then(
|
|
58530
59126
|
({ writeFile: writeFile4, mkdir: mkdir5 }) => mkdir5(cleoHome, { recursive: true }).then(
|
|
58531
|
-
() => writeFile4(
|
|
59127
|
+
() => writeFile4(join29(cleoHome, "VERSION"), `${lines.join("\n")}
|
|
58532
59128
|
`, "utf-8")
|
|
58533
59129
|
)
|
|
58534
59130
|
);
|
|
@@ -58939,7 +59535,7 @@ var sentient_exports = {};
|
|
|
58939
59535
|
__export(sentient_exports, {
|
|
58940
59536
|
sentientCommand: () => sentientCommand
|
|
58941
59537
|
});
|
|
58942
|
-
import { join as
|
|
59538
|
+
import { join as join30 } from "node:path";
|
|
58943
59539
|
import { cwd as processCwd3 } from "node:process";
|
|
58944
59540
|
import {
|
|
58945
59541
|
getSentientDaemonStatus as getSentientDaemonStatus2,
|
|
@@ -59014,7 +59610,7 @@ var init_sentient3 = __esm({
|
|
|
59014
59610
|
return;
|
|
59015
59611
|
}
|
|
59016
59612
|
if (dryRun) {
|
|
59017
|
-
const statePath2 =
|
|
59613
|
+
const statePath2 = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59018
59614
|
const outcome = await safeRunTick({ projectRoot, statePath: statePath2, dryRun: true });
|
|
59019
59615
|
emitSuccess2(
|
|
59020
59616
|
{ dryRun: true, outcome },
|
|
@@ -59130,7 +59726,7 @@ Logs: ${logPath}`
|
|
|
59130
59726
|
const jsonMode = args.json === true;
|
|
59131
59727
|
const dryRun = args["dry-run"] === true;
|
|
59132
59728
|
try {
|
|
59133
|
-
const statePath =
|
|
59729
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59134
59730
|
const outcome = await safeRunTick({ projectRoot, statePath, dryRun });
|
|
59135
59731
|
emitSuccess2(
|
|
59136
59732
|
{ outcome, dryRun },
|
|
@@ -59199,7 +59795,7 @@ Logs: ${logPath}`
|
|
|
59199
59795
|
return;
|
|
59200
59796
|
}
|
|
59201
59797
|
await db.update(tasks).set({ status: "pending", updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
59202
|
-
const statePath =
|
|
59798
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59203
59799
|
const state = await readSentientState2(statePath);
|
|
59204
59800
|
await patchSentientState(statePath, {
|
|
59205
59801
|
tier2Stats: {
|
|
@@ -59251,7 +59847,7 @@ Logs: ${logPath}`
|
|
|
59251
59847
|
return;
|
|
59252
59848
|
}
|
|
59253
59849
|
await db.update(tasks).set({ status: "cancelled", cancellationReason: reason, cancelledAt: now, updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
59254
|
-
const statePath =
|
|
59850
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59255
59851
|
const state = await readSentientState2(statePath);
|
|
59256
59852
|
await patchSentientState(statePath, {
|
|
59257
59853
|
tier2Stats: {
|
|
@@ -59296,7 +59892,7 @@ Logs: ${logPath}`
|
|
|
59296
59892
|
const projectRoot = resolveProjectRoot6(args.project);
|
|
59297
59893
|
const jsonMode = args.json === true;
|
|
59298
59894
|
try {
|
|
59299
|
-
const statePath =
|
|
59895
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59300
59896
|
const outcome = await safeRunProposeTick({ projectRoot, statePath });
|
|
59301
59897
|
emitSuccess2(
|
|
59302
59898
|
{ outcome },
|
|
@@ -59316,7 +59912,7 @@ Logs: ${logPath}`
|
|
|
59316
59912
|
const projectRoot = resolveProjectRoot6(args.project);
|
|
59317
59913
|
const jsonMode = args.json === true;
|
|
59318
59914
|
try {
|
|
59319
|
-
const statePath =
|
|
59915
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59320
59916
|
const updated = await patchSentientState(statePath, { tier2Enabled: true });
|
|
59321
59917
|
emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals enabled");
|
|
59322
59918
|
} catch (err) {
|
|
@@ -59335,7 +59931,7 @@ Logs: ${logPath}`
|
|
|
59335
59931
|
const projectRoot = resolveProjectRoot6(args.project);
|
|
59336
59932
|
const jsonMode = args.json === true;
|
|
59337
59933
|
try {
|
|
59338
|
-
const statePath =
|
|
59934
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59339
59935
|
const updated = await patchSentientState(statePath, { tier2Enabled: false });
|
|
59340
59936
|
emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals disabled");
|
|
59341
59937
|
} catch (err) {
|
|
@@ -59366,7 +59962,7 @@ Logs: ${logPath}`
|
|
|
59366
59962
|
const projectRoot = resolveProjectRoot6(args.project);
|
|
59367
59963
|
const jsonMode = args.json === true;
|
|
59368
59964
|
try {
|
|
59369
|
-
const statePath =
|
|
59965
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE2);
|
|
59370
59966
|
const state = await readSentientState2(statePath);
|
|
59371
59967
|
emitSuccess2(
|
|
59372
59968
|
{
|
|
@@ -59924,7 +60520,7 @@ var sequence_exports = {};
|
|
|
59924
60520
|
__export(sequence_exports, {
|
|
59925
60521
|
sequenceCommand: () => sequenceCommand
|
|
59926
60522
|
});
|
|
59927
|
-
import { getProjectRoot as
|
|
60523
|
+
import { getProjectRoot as getProjectRoot42 } from "@cleocode/core/internal";
|
|
59928
60524
|
var showCommand12, checkCommand6, repairCommand2, sequenceCommand;
|
|
59929
60525
|
var init_sequence = __esm({
|
|
59930
60526
|
"packages/cleo/src/cli/commands/sequence.ts"() {
|
|
@@ -59960,7 +60556,7 @@ var init_sequence = __esm({
|
|
|
59960
60556
|
meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
|
|
59961
60557
|
async run() {
|
|
59962
60558
|
const { repairSequence } = await import("@cleocode/core/internal");
|
|
59963
|
-
const projectRoot =
|
|
60559
|
+
const projectRoot = getProjectRoot42();
|
|
59964
60560
|
const repair = await repairSequence(projectRoot);
|
|
59965
60561
|
const result = {
|
|
59966
60562
|
repaired: repair.repaired,
|
|
@@ -60415,8 +61011,8 @@ var init_session4 = __esm({
|
|
|
60415
61011
|
"audit-scope": { type: "string", description: "Audit log scope (global|local)" }
|
|
60416
61012
|
},
|
|
60417
61013
|
async run({ args }) {
|
|
60418
|
-
const { detectSessionDrift, getProjectRoot:
|
|
60419
|
-
const projectRoot = await
|
|
61014
|
+
const { detectSessionDrift, getProjectRoot: getProjectRoot46 } = await import("@cleocode/core");
|
|
61015
|
+
const projectRoot = await getProjectRoot46();
|
|
60420
61016
|
const scope = args["audit-scope"] === "local" ? "local" : "global";
|
|
60421
61017
|
const report = await detectSessionDrift({ projectRoot, auditScope: scope });
|
|
60422
61018
|
cliOutput(report, { command: "session drift", operation: "session.drift" });
|
|
@@ -63182,7 +63778,7 @@ __export(token_exports, {
|
|
|
63182
63778
|
tokenCommand: () => tokenCommand
|
|
63183
63779
|
});
|
|
63184
63780
|
import { readFileSync as readFileSync16 } from "node:fs";
|
|
63185
|
-
import { getProjectRoot as
|
|
63781
|
+
import { getProjectRoot as getProjectRoot43, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
|
|
63186
63782
|
function readPayload(args, textKey, fileKey) {
|
|
63187
63783
|
const text = args[textKey];
|
|
63188
63784
|
const file = args[fileKey];
|
|
@@ -63346,7 +63942,7 @@ var init_token = __esm({
|
|
|
63346
63942
|
domain: args.domain,
|
|
63347
63943
|
operation: args.operation
|
|
63348
63944
|
};
|
|
63349
|
-
const result = args.record ? await recordTokenExchange2(
|
|
63945
|
+
const result = args.record ? await recordTokenExchange2(getProjectRoot43(), input2) : await measureTokenExchange(input2);
|
|
63350
63946
|
cliOutput(result, {
|
|
63351
63947
|
command: "token",
|
|
63352
63948
|
operation: args.record ? "admin.token.record" : "token.estimate"
|
|
@@ -63381,8 +63977,8 @@ __export(transcript_exports, {
|
|
|
63381
63977
|
transcriptCommand: () => transcriptCommand
|
|
63382
63978
|
});
|
|
63383
63979
|
import { homedir as homedir6 } from "node:os";
|
|
63384
|
-
import { join as
|
|
63385
|
-
import { getProjectRoot as
|
|
63980
|
+
import { join as join31 } from "node:path";
|
|
63981
|
+
import { getProjectRoot as getProjectRoot44 } from "@cleocode/core";
|
|
63386
63982
|
import {
|
|
63387
63983
|
parseDurationMs,
|
|
63388
63984
|
pruneTranscripts,
|
|
@@ -63412,7 +64008,7 @@ var init_transcript = __esm({
|
|
|
63412
64008
|
async run({ args }) {
|
|
63413
64009
|
if (args.pending) {
|
|
63414
64010
|
try {
|
|
63415
|
-
const projectRoot =
|
|
64011
|
+
const projectRoot = getProjectRoot44();
|
|
63416
64012
|
const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
63417
64013
|
const pending = await scanPendingTranscripts(projectRoot);
|
|
63418
64014
|
cliOutput(
|
|
@@ -63435,7 +64031,7 @@ var init_transcript = __esm({
|
|
|
63435
64031
|
}
|
|
63436
64032
|
return;
|
|
63437
64033
|
}
|
|
63438
|
-
const projectsDir = args["projects-dir"] ??
|
|
64034
|
+
const projectsDir = args["projects-dir"] ?? join31(homedir6(), ".claude", "projects");
|
|
63439
64035
|
try {
|
|
63440
64036
|
const result = await scanTranscripts(projectsDir);
|
|
63441
64037
|
cliOutput(
|
|
@@ -63509,7 +64105,7 @@ var init_transcript = __esm({
|
|
|
63509
64105
|
async run({ args }) {
|
|
63510
64106
|
const tier = args.tier ?? "warm";
|
|
63511
64107
|
const dryRun = args["dry-run"] ?? false;
|
|
63512
|
-
const projectRoot =
|
|
64108
|
+
const projectRoot = getProjectRoot44();
|
|
63513
64109
|
try {
|
|
63514
64110
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
63515
64111
|
const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -63621,7 +64217,7 @@ var init_transcript = __esm({
|
|
|
63621
64217
|
const dryRun = args["dry-run"] ?? false;
|
|
63622
64218
|
const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
|
|
63623
64219
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
|
|
63624
|
-
const projectRoot =
|
|
64220
|
+
const projectRoot = getProjectRoot44();
|
|
63625
64221
|
try {
|
|
63626
64222
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
63627
64223
|
const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -63741,7 +64337,7 @@ var init_transcript = __esm({
|
|
|
63741
64337
|
process.exit(2);
|
|
63742
64338
|
return;
|
|
63743
64339
|
}
|
|
63744
|
-
const projectsDir = args["projects-dir"] ??
|
|
64340
|
+
const projectsDir = args["projects-dir"] ?? join31(homedir6(), ".claude", "projects");
|
|
63745
64341
|
try {
|
|
63746
64342
|
const pruneResult = await pruneTranscripts({
|
|
63747
64343
|
olderThanMs,
|
|
@@ -64418,15 +65014,15 @@ __export(web_exports, {
|
|
|
64418
65014
|
});
|
|
64419
65015
|
import { execFileSync as execFileSync3, spawn as spawn3 } from "node:child_process";
|
|
64420
65016
|
import { mkdir as mkdir4, open, readFile as readFile6, rm, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
64421
|
-
import { join as
|
|
65017
|
+
import { join as join32 } from "node:path";
|
|
64422
65018
|
import { CleoError as CleoError11, formatError as formatError7, getCleoHome as getCleoHome5 } from "@cleocode/core";
|
|
64423
65019
|
function getWebPaths() {
|
|
64424
65020
|
const cleoHome = getCleoHome5();
|
|
64425
65021
|
return {
|
|
64426
|
-
pidFile:
|
|
64427
|
-
configFile:
|
|
64428
|
-
logDir:
|
|
64429
|
-
logFile:
|
|
65022
|
+
pidFile: join32(cleoHome, "web-server.pid"),
|
|
65023
|
+
configFile: join32(cleoHome, "web-server.json"),
|
|
65024
|
+
logDir: join32(cleoHome, "logs"),
|
|
65025
|
+
logFile: join32(cleoHome, "logs", "web-server.log")
|
|
64430
65026
|
};
|
|
64431
65027
|
}
|
|
64432
65028
|
function isProcessRunning(pid) {
|
|
@@ -64465,7 +65061,7 @@ async function startWebServer(port, host) {
|
|
|
64465
65061
|
throw new CleoError11(1 /* GENERAL_ERROR */, `Server already running (PID: ${status.pid})`);
|
|
64466
65062
|
}
|
|
64467
65063
|
const projectRoot = process.env["CLEO_ROOT"] ?? process.cwd();
|
|
64468
|
-
const studioDir = process.env["CLEO_STUDIO_DIR"] ??
|
|
65064
|
+
const studioDir = process.env["CLEO_STUDIO_DIR"] ?? join32(projectRoot, "packages", "studio", "build");
|
|
64469
65065
|
await mkdir4(logDir, { recursive: true });
|
|
64470
65066
|
await writeFile3(
|
|
64471
65067
|
configFile,
|
|
@@ -64475,7 +65071,7 @@ async function startWebServer(port, host) {
|
|
|
64475
65071
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
64476
65072
|
})
|
|
64477
65073
|
);
|
|
64478
|
-
const webIndexPath =
|
|
65074
|
+
const webIndexPath = join32(studioDir, "index.js");
|
|
64479
65075
|
try {
|
|
64480
65076
|
await stat2(webIndexPath);
|
|
64481
65077
|
} catch {
|
|
@@ -64748,7 +65344,7 @@ __export(worktree_exports, {
|
|
|
64748
65344
|
worktreeCommand: () => worktreeCommand
|
|
64749
65345
|
});
|
|
64750
65346
|
import readline4 from "node:readline";
|
|
64751
|
-
import { getProjectRoot as
|
|
65347
|
+
import { getProjectRoot as getProjectRoot45, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
|
|
64752
65348
|
async function promptYesNo2(question) {
|
|
64753
65349
|
return new Promise((resolve7) => {
|
|
64754
65350
|
const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -64853,7 +65449,7 @@ var init_worktree3 = __esm({
|
|
|
64853
65449
|
const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
|
|
64854
65450
|
const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
|
|
64855
65451
|
const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
|
|
64856
|
-
const projectRoot =
|
|
65452
|
+
const projectRoot = getProjectRoot45();
|
|
64857
65453
|
const listResult = await listWorktrees2({
|
|
64858
65454
|
projectRoot,
|
|
64859
65455
|
...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
|
|
@@ -65089,7 +65685,7 @@ init_dist();
|
|
|
65089
65685
|
init_field_context();
|
|
65090
65686
|
init_format_context();
|
|
65091
65687
|
import { readFileSync as readFileSync17 } from "node:fs";
|
|
65092
|
-
import { dirname as dirname9, join as
|
|
65688
|
+
import { dirname as dirname9, join as join34 } from "node:path";
|
|
65093
65689
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
65094
65690
|
|
|
65095
65691
|
// packages/cleo/src/cli/generated/command-manifest.ts
|
|
@@ -65178,6 +65774,12 @@ var COMMAND_MANIFEST = [
|
|
|
65178
65774
|
description: "Show bundle manifest without extracting or modifying anything",
|
|
65179
65775
|
load: async () => (await Promise.resolve().then(() => (init_backup_inspect(), backup_inspect_exports))).backupInspectSubCommand
|
|
65180
65776
|
},
|
|
65777
|
+
{
|
|
65778
|
+
exportName: "backupRecoverSubCommand",
|
|
65779
|
+
name: "recover",
|
|
65780
|
+
description: "Recover a malformed CLEO database from snapshot",
|
|
65781
|
+
load: async () => (await Promise.resolve().then(() => (init_backup_recover(), backup_recover_exports))).backupRecoverSubCommand
|
|
65782
|
+
},
|
|
65181
65783
|
{
|
|
65182
65784
|
exportName: "backupCommand",
|
|
65183
65785
|
name: "backup",
|
|
@@ -66075,50 +66677,17 @@ function lazyCommand(meta, loader2) {
|
|
|
66075
66677
|
};
|
|
66076
66678
|
}
|
|
66077
66679
|
|
|
66078
|
-
// packages/cleo/src/cli/
|
|
66079
|
-
|
|
66080
|
-
const inputLen = input2.length;
|
|
66081
|
-
const candidateLen = candidate.length;
|
|
66082
|
-
const matrix = Array.from({ length: inputLen + 1 }, (_, i) => [i]);
|
|
66083
|
-
for (let j = 1; j <= candidateLen; j++) {
|
|
66084
|
-
matrix[0][j] = j;
|
|
66085
|
-
}
|
|
66086
|
-
for (let i = 1; i <= inputLen; i++) {
|
|
66087
|
-
for (let j = 1; j <= candidateLen; j++) {
|
|
66088
|
-
const cost = input2[i - 1] === candidate[j - 1] ? 0 : 1;
|
|
66089
|
-
matrix[i][j] = Math.min(
|
|
66090
|
-
matrix[i - 1][j] + 1,
|
|
66091
|
-
// deletion
|
|
66092
|
-
matrix[i][j - 1] + 1,
|
|
66093
|
-
// insertion
|
|
66094
|
-
matrix[i - 1][j - 1] + cost
|
|
66095
|
-
// substitution
|
|
66096
|
-
);
|
|
66097
|
-
}
|
|
66098
|
-
}
|
|
66099
|
-
return matrix[inputLen][candidateLen];
|
|
66100
|
-
}
|
|
66101
|
-
function didYouMean(input2, candidates, maxDistance = 2) {
|
|
66102
|
-
const suggestions = candidates.map((candidate) => ({
|
|
66103
|
-
command: candidate,
|
|
66104
|
-
distance: levenshteinDistance(input2, candidate)
|
|
66105
|
-
})).filter((item) => item.distance <= maxDistance).sort((a, b) => {
|
|
66106
|
-
if (a.distance !== b.distance) {
|
|
66107
|
-
return a.distance - b.distance;
|
|
66108
|
-
}
|
|
66109
|
-
return a.command.localeCompare(b.command);
|
|
66110
|
-
}).map((item) => item.command);
|
|
66111
|
-
return suggestions;
|
|
66112
|
-
}
|
|
66680
|
+
// packages/cleo/src/cli/index.ts
|
|
66681
|
+
init_did_you_mean();
|
|
66113
66682
|
|
|
66114
66683
|
// packages/cleo/src/cli/lib/first-run-detection.ts
|
|
66115
66684
|
import { existsSync as existsSync16 } from "node:fs";
|
|
66116
|
-
import { join as
|
|
66685
|
+
import { join as join33 } from "node:path";
|
|
66117
66686
|
async function detectFirstRun() {
|
|
66118
66687
|
const envKey = process.env["ANTHROPIC_API_KEY"];
|
|
66119
66688
|
if (typeof envKey === "string" && envKey.length > 0) return false;
|
|
66120
66689
|
const { getCleoPlatformPaths } = await import("@cleocode/paths");
|
|
66121
|
-
const configPath =
|
|
66690
|
+
const configPath = join33(getCleoPlatformPaths().config, "config.json");
|
|
66122
66691
|
if (existsSync16(configPath)) return false;
|
|
66123
66692
|
try {
|
|
66124
66693
|
const { getCredentialPool } = await import("@cleocode/core/llm/credential-pool.js");
|
|
@@ -66233,7 +66802,7 @@ Or via NodeSource: https://github.com/nodesource/distributions
|
|
|
66233
66802
|
}
|
|
66234
66803
|
}
|
|
66235
66804
|
function getPackageVersion() {
|
|
66236
|
-
const pkgPath =
|
|
66805
|
+
const pkgPath = join34(dirname9(fileURLToPath7(import.meta.url)), "../../package.json");
|
|
66237
66806
|
const pkg = JSON.parse(readFileSync17(pkgPath, "utf-8"));
|
|
66238
66807
|
return pkg.version;
|
|
66239
66808
|
}
|
|
@@ -66385,8 +66954,8 @@ async function runStartupMaintenance() {
|
|
|
66385
66954
|
detectAndRemoveLegacyGlobalFiles,
|
|
66386
66955
|
detectAndRemoveStrayProjectNexus,
|
|
66387
66956
|
getGlobalSalt,
|
|
66388
|
-
getLogger:
|
|
66389
|
-
getProjectRoot:
|
|
66957
|
+
getLogger: getLogger21,
|
|
66958
|
+
getProjectRoot: getProjectRoot46,
|
|
66390
66959
|
isCleanupMarkerSet,
|
|
66391
66960
|
migrateSignaldockToConduit,
|
|
66392
66961
|
needsSignaldockToConduitMigration,
|
|
@@ -66395,7 +66964,7 @@ async function runStartupMaintenance() {
|
|
|
66395
66964
|
} = await import("@cleocode/core/internal");
|
|
66396
66965
|
let projectRootForCleanup = "";
|
|
66397
66966
|
try {
|
|
66398
|
-
projectRootForCleanup =
|
|
66967
|
+
projectRootForCleanup = getProjectRoot46();
|
|
66399
66968
|
} catch {
|
|
66400
66969
|
}
|
|
66401
66970
|
if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
|
|
@@ -66411,11 +66980,11 @@ async function runStartupMaintenance() {
|
|
|
66411
66980
|
}
|
|
66412
66981
|
setCleanupMarker(CLI_VERSION, projectRootForCleanup);
|
|
66413
66982
|
}
|
|
66414
|
-
const _startupLog =
|
|
66983
|
+
const _startupLog = getLogger21("cli-startup");
|
|
66415
66984
|
const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
|
|
66416
66985
|
if (!isInitInvocation) {
|
|
66417
66986
|
try {
|
|
66418
|
-
const _projectRootForMigration =
|
|
66987
|
+
const _projectRootForMigration = getProjectRoot46();
|
|
66419
66988
|
if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
|
|
66420
66989
|
const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
|
|
66421
66990
|
if (migrationResult.status === "failed") {
|