@cleocode/cleo 2026.5.95 → 2026.5.97
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 +1331 -400
- package/dist/cli/index.js.map +3 -3
- package/package.json +12 -11
package/dist/cli/index.js
CHANGED
|
@@ -1591,6 +1591,13 @@ var init_credentials = __esm({
|
|
|
1591
1591
|
}
|
|
1592
1592
|
});
|
|
1593
1593
|
|
|
1594
|
+
// packages/contracts/src/dispatch/identity.ts
|
|
1595
|
+
var init_identity = __esm({
|
|
1596
|
+
"packages/contracts/src/dispatch/identity.ts"() {
|
|
1597
|
+
"use strict";
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
|
|
1594
1601
|
// packages/contracts/src/docs-taxonomy.ts
|
|
1595
1602
|
import { readFileSync } from "node:fs";
|
|
1596
1603
|
import { join } from "node:path";
|
|
@@ -1982,6 +1989,13 @@ var init_engine_result = __esm({
|
|
|
1982
1989
|
}
|
|
1983
1990
|
});
|
|
1984
1991
|
|
|
1992
|
+
// packages/contracts/src/enums.ts
|
|
1993
|
+
var init_enums = __esm({
|
|
1994
|
+
"packages/contracts/src/enums.ts"() {
|
|
1995
|
+
"use strict";
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
|
|
1985
1999
|
// packages/contracts/src/exit-codes.ts
|
|
1986
2000
|
var ExitCode;
|
|
1987
2001
|
var init_exit_codes = __esm({
|
|
@@ -2198,6 +2212,13 @@ var init_plugin_llm = __esm({
|
|
|
2198
2212
|
}
|
|
2199
2213
|
});
|
|
2200
2214
|
|
|
2215
|
+
// packages/contracts/src/memory/observe.ts
|
|
2216
|
+
var init_observe = __esm({
|
|
2217
|
+
"packages/contracts/src/memory/observe.ts"() {
|
|
2218
|
+
"use strict";
|
|
2219
|
+
}
|
|
2220
|
+
});
|
|
2221
|
+
|
|
2201
2222
|
// packages/contracts/src/operations/admin.ts
|
|
2202
2223
|
var init_admin = __esm({
|
|
2203
2224
|
"packages/contracts/src/operations/admin.ts"() {
|
|
@@ -2234,6 +2255,13 @@ var init_docs = __esm({
|
|
|
2234
2255
|
}
|
|
2235
2256
|
});
|
|
2236
2257
|
|
|
2258
|
+
// packages/contracts/src/operations/focus.ts
|
|
2259
|
+
var init_focus = __esm({
|
|
2260
|
+
"packages/contracts/src/operations/focus.ts"() {
|
|
2261
|
+
"use strict";
|
|
2262
|
+
}
|
|
2263
|
+
});
|
|
2264
|
+
|
|
2237
2265
|
// packages/contracts/src/operations/intelligence.ts
|
|
2238
2266
|
var init_intelligence = __esm({
|
|
2239
2267
|
"packages/contracts/src/operations/intelligence.ts"() {
|
|
@@ -2424,6 +2452,7 @@ var init_operations = __esm({
|
|
|
2424
2452
|
init_conduit();
|
|
2425
2453
|
init_dialectic();
|
|
2426
2454
|
init_docs();
|
|
2455
|
+
init_focus();
|
|
2427
2456
|
init_intelligence();
|
|
2428
2457
|
init_issues();
|
|
2429
2458
|
init_lifecycle();
|
|
@@ -3387,8 +3416,10 @@ var init_src2 = __esm({
|
|
|
3387
3416
|
init_changesets();
|
|
3388
3417
|
init_cli_category();
|
|
3389
3418
|
init_credentials();
|
|
3419
|
+
init_identity();
|
|
3390
3420
|
init_docs_taxonomy();
|
|
3391
3421
|
init_engine_result();
|
|
3422
|
+
init_enums();
|
|
3392
3423
|
init_errors();
|
|
3393
3424
|
init_evidence_record_schema();
|
|
3394
3425
|
init_exit_codes();
|
|
@@ -3396,6 +3427,7 @@ var init_src2 = __esm({
|
|
|
3396
3427
|
init_graph();
|
|
3397
3428
|
init_lafs();
|
|
3398
3429
|
init_plugin_llm();
|
|
3430
|
+
init_observe();
|
|
3399
3431
|
init_operations();
|
|
3400
3432
|
init_nexus_scope_map();
|
|
3401
3433
|
init_params();
|
|
@@ -8682,6 +8714,25 @@ var init_registry = __esm({
|
|
|
8682
8714
|
requiredParams: [],
|
|
8683
8715
|
params: []
|
|
8684
8716
|
},
|
|
8717
|
+
// T9975 — per-agent session isolation: adopt rebinds env to a specific session.
|
|
8718
|
+
{
|
|
8719
|
+
gateway: "mutate",
|
|
8720
|
+
domain: "session",
|
|
8721
|
+
operation: "adopt",
|
|
8722
|
+
description: "session.adopt \u2014 rebind env to a specific session for multi-agent isolation (T9975)",
|
|
8723
|
+
tier: 0,
|
|
8724
|
+
idempotent: true,
|
|
8725
|
+
sessionRequired: false,
|
|
8726
|
+
requiredParams: [],
|
|
8727
|
+
params: [
|
|
8728
|
+
{
|
|
8729
|
+
name: "sessionId",
|
|
8730
|
+
type: "string",
|
|
8731
|
+
required: true,
|
|
8732
|
+
description: "Session ID to adopt"
|
|
8733
|
+
}
|
|
8734
|
+
]
|
|
8735
|
+
},
|
|
8685
8736
|
// session.context.inject moved to admin.context.inject (T5615)
|
|
8686
8737
|
{
|
|
8687
8738
|
gateway: "mutate",
|
|
@@ -13628,6 +13679,102 @@ var init_registry = __esm({
|
|
|
13628
13679
|
description: "Task ID whose worktree (branch task/T<id>) to unlock"
|
|
13629
13680
|
}
|
|
13630
13681
|
]
|
|
13682
|
+
},
|
|
13683
|
+
// T9804 — Claude Code Agent isolation:worktree bridge (adopt)
|
|
13684
|
+
{
|
|
13685
|
+
gateway: "mutate",
|
|
13686
|
+
domain: "worktree",
|
|
13687
|
+
operation: "adopt",
|
|
13688
|
+
description: "worktree.adopt (mutate) \u2014 register an externally-created worktree (e.g. Claude Code Agent isolation:worktree) in the CLEO SSoT. Writes to .cleo/worktrees.json sentinel index and appends audit entry (T9804).",
|
|
13689
|
+
tier: 1,
|
|
13690
|
+
idempotent: true,
|
|
13691
|
+
sessionRequired: false,
|
|
13692
|
+
requiredParams: ["worktreePath"],
|
|
13693
|
+
params: [
|
|
13694
|
+
{
|
|
13695
|
+
name: "worktreePath",
|
|
13696
|
+
type: "string",
|
|
13697
|
+
required: true,
|
|
13698
|
+
description: "Absolute or relative path to the worktree directory to adopt"
|
|
13699
|
+
},
|
|
13700
|
+
{
|
|
13701
|
+
name: "source",
|
|
13702
|
+
type: "string",
|
|
13703
|
+
required: false,
|
|
13704
|
+
description: "Source classification (claude-agent | manual | adopted). Inferred from path when omitted."
|
|
13705
|
+
},
|
|
13706
|
+
{
|
|
13707
|
+
name: "taskId",
|
|
13708
|
+
type: "string",
|
|
13709
|
+
required: false,
|
|
13710
|
+
description: "Task ID to associate with this worktree. Extracted from branch name when omitted."
|
|
13711
|
+
},
|
|
13712
|
+
{
|
|
13713
|
+
name: "actor",
|
|
13714
|
+
type: "string",
|
|
13715
|
+
required: false,
|
|
13716
|
+
description: "Override actor name written to the audit log."
|
|
13717
|
+
}
|
|
13718
|
+
]
|
|
13719
|
+
},
|
|
13720
|
+
// T9805 — Explicit single-worktree destruction with sentinel + audit update
|
|
13721
|
+
{
|
|
13722
|
+
gateway: "mutate",
|
|
13723
|
+
domain: "worktree",
|
|
13724
|
+
operation: "destroy",
|
|
13725
|
+
description: "worktree.destroy (mutate) \u2014 explicitly destroy the XDG worktree for a task, remove its sentinel index entry, and append an audit-log row to .cleo/audit/worktree-lifecycle.jsonl (T9805 AC1).",
|
|
13726
|
+
tier: 1,
|
|
13727
|
+
idempotent: true,
|
|
13728
|
+
sessionRequired: false,
|
|
13729
|
+
requiredParams: ["taskId"],
|
|
13730
|
+
params: [
|
|
13731
|
+
{
|
|
13732
|
+
name: "taskId",
|
|
13733
|
+
type: "string",
|
|
13734
|
+
required: true,
|
|
13735
|
+
description: "Task ID whose XDG worktree should be destroyed (e.g. T9805).",
|
|
13736
|
+
cli: { positional: true }
|
|
13737
|
+
},
|
|
13738
|
+
{
|
|
13739
|
+
name: "force",
|
|
13740
|
+
type: "boolean",
|
|
13741
|
+
required: false,
|
|
13742
|
+
description: "Force removal even when the worktree has uncommitted changes. Default: false."
|
|
13743
|
+
},
|
|
13744
|
+
{
|
|
13745
|
+
name: "deleteBranch",
|
|
13746
|
+
type: "boolean",
|
|
13747
|
+
required: false,
|
|
13748
|
+
description: "Delete the task branch (task/T<id>) after removing the worktree. Default: true."
|
|
13749
|
+
},
|
|
13750
|
+
{
|
|
13751
|
+
name: "reason",
|
|
13752
|
+
type: "string",
|
|
13753
|
+
required: false,
|
|
13754
|
+
description: "Free-form reason recorded in the audit log (e.g. pr-merged, manual, idle-timeout). Default: manual."
|
|
13755
|
+
}
|
|
13756
|
+
]
|
|
13757
|
+
},
|
|
13758
|
+
// ---------------------------------------------------------------------------
|
|
13759
|
+
// T9973 — focus domain: single-envelope task orientation (8 calls → 1)
|
|
13760
|
+
// ---------------------------------------------------------------------------
|
|
13761
|
+
{
|
|
13762
|
+
gateway: "query",
|
|
13763
|
+
domain: "focus",
|
|
13764
|
+
operation: "show",
|
|
13765
|
+
description: "focus.show (query) \u2014 single-envelope orientation for a task, epic, or saga. Aggregates identity + scope + members + blockers + readyWave + attachedDocs + recentActivity + brainContext into \u2264 1 500 tokens.",
|
|
13766
|
+
tier: 0,
|
|
13767
|
+
idempotent: true,
|
|
13768
|
+
sessionRequired: false,
|
|
13769
|
+
requiredParams: ["id"],
|
|
13770
|
+
params: [
|
|
13771
|
+
{
|
|
13772
|
+
name: "id",
|
|
13773
|
+
type: "string",
|
|
13774
|
+
required: true,
|
|
13775
|
+
description: "Task, Epic, or Saga ID to orient on (e.g. T9973, T9831)"
|
|
13776
|
+
}
|
|
13777
|
+
]
|
|
13631
13778
|
}
|
|
13632
13779
|
];
|
|
13633
13780
|
counts = getCounts();
|
|
@@ -13989,6 +14136,7 @@ __export(engine_exports, {
|
|
|
13989
14136
|
releaseRollbackFull: () => releaseRollbackFull,
|
|
13990
14137
|
releaseShow: () => releaseShow,
|
|
13991
14138
|
releaseTag: () => releaseTag,
|
|
14139
|
+
sessionAdopt: () => sessionAdopt,
|
|
13992
14140
|
sessionArchive: () => sessionArchive,
|
|
13993
14141
|
sessionBriefing: () => sessionBriefing,
|
|
13994
14142
|
sessionChainShow: () => sessionChainShow,
|
|
@@ -14214,6 +14362,7 @@ import {
|
|
|
14214
14362
|
releaseRollbackFull,
|
|
14215
14363
|
releaseShow,
|
|
14216
14364
|
releaseTag,
|
|
14365
|
+
sessionAdopt,
|
|
14217
14366
|
sessionArchive,
|
|
14218
14367
|
sessionBriefing,
|
|
14219
14368
|
sessionChainShow,
|
|
@@ -17620,6 +17769,7 @@ import {
|
|
|
17620
17769
|
generateDocsLlmsTxt,
|
|
17621
17770
|
getCleoDirAbsolute,
|
|
17622
17771
|
getProjectRoot as getProjectRoot5,
|
|
17772
|
+
memoryObserve as memoryObserve2,
|
|
17623
17773
|
resolveAttachmentBackend,
|
|
17624
17774
|
SlugCollisionError
|
|
17625
17775
|
} from "@cleocode/core/internal";
|
|
@@ -17716,6 +17866,23 @@ function compareByOrderBy(orderBy) {
|
|
|
17716
17866
|
}
|
|
17717
17867
|
return (a, b) => b.createdAt.localeCompare(a.createdAt);
|
|
17718
17868
|
}
|
|
17869
|
+
function docObservationTitle(slug, attachmentId) {
|
|
17870
|
+
return `Doc attached: ${slug ?? attachmentId}`;
|
|
17871
|
+
}
|
|
17872
|
+
function emitDocAttachmentObservation(payload, projectRoot) {
|
|
17873
|
+
const title = docObservationTitle(payload.slug, payload.attachmentId);
|
|
17874
|
+
const narrative = JSON.stringify(payload);
|
|
17875
|
+
memoryObserve2(
|
|
17876
|
+
{
|
|
17877
|
+
text: narrative,
|
|
17878
|
+
title,
|
|
17879
|
+
type: "feature",
|
|
17880
|
+
sourceType: "manual"
|
|
17881
|
+
},
|
|
17882
|
+
projectRoot
|
|
17883
|
+
).catch(() => {
|
|
17884
|
+
});
|
|
17885
|
+
}
|
|
17719
17886
|
function docsEnvelopeToResponse(envelope, gateway, operation, startTime) {
|
|
17720
17887
|
if (!envelope.success) {
|
|
17721
17888
|
return {
|
|
@@ -18187,6 +18354,15 @@ var init_docs2 = __esm({
|
|
|
18187
18354
|
)
|
|
18188
18355
|
).catch(() => {
|
|
18189
18356
|
});
|
|
18357
|
+
const filePayload = {
|
|
18358
|
+
kind: "doc-attachment",
|
|
18359
|
+
attachmentId: meta.id,
|
|
18360
|
+
ownerId,
|
|
18361
|
+
addedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18362
|
+
...slug !== void 0 ? { slug } : {},
|
|
18363
|
+
...type2 !== void 0 ? { type: type2 } : {}
|
|
18364
|
+
};
|
|
18365
|
+
emitDocAttachmentObservation(filePayload, getProjectRoot5());
|
|
18190
18366
|
return lafsSuccess(
|
|
18191
18367
|
{
|
|
18192
18368
|
attachmentId: meta.id,
|
|
@@ -18240,6 +18416,15 @@ var init_docs2 = __esm({
|
|
|
18240
18416
|
).catch(() => {
|
|
18241
18417
|
});
|
|
18242
18418
|
const backend = "legacy";
|
|
18419
|
+
const urlPayload = {
|
|
18420
|
+
kind: "doc-attachment",
|
|
18421
|
+
attachmentId: meta.id,
|
|
18422
|
+
ownerId,
|
|
18423
|
+
addedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18424
|
+
...slug !== void 0 ? { slug } : {},
|
|
18425
|
+
...type2 !== void 0 ? { type: type2 } : {}
|
|
18426
|
+
};
|
|
18427
|
+
emitDocAttachmentObservation(urlPayload, getProjectRoot5());
|
|
18243
18428
|
return lafsSuccess(
|
|
18244
18429
|
{
|
|
18245
18430
|
attachmentId: meta.id,
|
|
@@ -18379,8 +18564,272 @@ var init_docs2 = __esm({
|
|
|
18379
18564
|
}
|
|
18380
18565
|
});
|
|
18381
18566
|
|
|
18567
|
+
// packages/cleo/src/dispatch/domains/focus.ts
|
|
18568
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
18569
|
+
import { getProjectRoot as getProjectRoot6 } from "@cleocode/core";
|
|
18570
|
+
import {
|
|
18571
|
+
createAttachmentStore as createAttachmentStore2,
|
|
18572
|
+
memoryFind as memoryFind2,
|
|
18573
|
+
orchestrateReady as orchestrateReady2,
|
|
18574
|
+
taskRelates as taskRelates2,
|
|
18575
|
+
taskShow as taskShow2
|
|
18576
|
+
} from "@cleocode/core/internal";
|
|
18577
|
+
function roughTokenCount(value) {
|
|
18578
|
+
try {
|
|
18579
|
+
return Math.ceil(JSON.stringify(value).length / 4);
|
|
18580
|
+
} catch {
|
|
18581
|
+
return 0;
|
|
18582
|
+
}
|
|
18583
|
+
}
|
|
18584
|
+
function fetchRecentActivity(taskId, projectRoot) {
|
|
18585
|
+
try {
|
|
18586
|
+
const raw = execSync2(`git log --grep="${taskId}" --pretty=format:"%H %s %aI" -n 5`, {
|
|
18587
|
+
encoding: "utf8",
|
|
18588
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
18589
|
+
cwd: projectRoot
|
|
18590
|
+
});
|
|
18591
|
+
return raw.trim().split("\n").filter(Boolean).map((line) => {
|
|
18592
|
+
const parts = line.split(" ");
|
|
18593
|
+
return {
|
|
18594
|
+
commitSha: parts[0] ?? "",
|
|
18595
|
+
message: parts[1] ?? "",
|
|
18596
|
+
date: parts[2] ?? ""
|
|
18597
|
+
};
|
|
18598
|
+
}).filter((c) => c.commitSha !== "");
|
|
18599
|
+
} catch {
|
|
18600
|
+
return [];
|
|
18601
|
+
}
|
|
18602
|
+
}
|
|
18603
|
+
async function fetchAttachedDocs(projectRoot, taskId) {
|
|
18604
|
+
try {
|
|
18605
|
+
const store = createAttachmentStore2();
|
|
18606
|
+
const metas = await store.listByOwner("task", taskId, projectRoot);
|
|
18607
|
+
const entries = [];
|
|
18608
|
+
for (const meta of metas) {
|
|
18609
|
+
const extras = await store.getExtras(meta.id, projectRoot);
|
|
18610
|
+
entries.push({
|
|
18611
|
+
attachmentId: meta.id,
|
|
18612
|
+
kind: meta.attachment.kind,
|
|
18613
|
+
...extras?.slug != null ? { slug: extras.slug } : {},
|
|
18614
|
+
...extras?.type != null ? { type: extras.type } : {}
|
|
18615
|
+
});
|
|
18616
|
+
}
|
|
18617
|
+
return entries;
|
|
18618
|
+
} catch {
|
|
18619
|
+
return [];
|
|
18620
|
+
}
|
|
18621
|
+
}
|
|
18622
|
+
async function fetchBrainContext(taskId) {
|
|
18623
|
+
try {
|
|
18624
|
+
const [obsResult, decResult, lrnResult] = await Promise.allSettled([
|
|
18625
|
+
memoryFind2({ query: taskId, limit: 3, tables: ["observations"] }),
|
|
18626
|
+
memoryFind2({ query: taskId, limit: 3, tables: ["decisions"] }),
|
|
18627
|
+
memoryFind2({ query: taskId, limit: 3, tables: ["learnings"] })
|
|
18628
|
+
]);
|
|
18629
|
+
const toHits = (r) => {
|
|
18630
|
+
if (r.status !== "fulfilled" || !r.value.success) return [];
|
|
18631
|
+
const data = r.value.data;
|
|
18632
|
+
return (data?.results ?? []).slice(0, 3);
|
|
18633
|
+
};
|
|
18634
|
+
return {
|
|
18635
|
+
observations: toHits(obsResult),
|
|
18636
|
+
learnings: toHits(lrnResult),
|
|
18637
|
+
decisions: toHits(decResult)
|
|
18638
|
+
};
|
|
18639
|
+
} catch {
|
|
18640
|
+
return void 0;
|
|
18641
|
+
}
|
|
18642
|
+
}
|
|
18643
|
+
async function fetchSagaMembersWithTitles(projectRoot, sagaId) {
|
|
18644
|
+
try {
|
|
18645
|
+
const relResult = await taskRelates2(projectRoot, sagaId);
|
|
18646
|
+
if (!relResult.success) return [];
|
|
18647
|
+
const memberIds = (relResult.data?.relations ?? []).filter((r) => r.type === "groups").map((r) => r.taskId);
|
|
18648
|
+
if (memberIds.length === 0) return [];
|
|
18649
|
+
const showResults = await Promise.allSettled(
|
|
18650
|
+
memberIds.map((epicId) => taskShow2(projectRoot, epicId))
|
|
18651
|
+
);
|
|
18652
|
+
return showResults.map((r, i) => {
|
|
18653
|
+
const epicId = memberIds[i] ?? "";
|
|
18654
|
+
if (r.status !== "fulfilled" || !r.value.success) {
|
|
18655
|
+
return { epicId, title: epicId, status: "unknown" };
|
|
18656
|
+
}
|
|
18657
|
+
const t = r.value.data.task;
|
|
18658
|
+
return { epicId: t.id, title: t.title, status: t.status };
|
|
18659
|
+
}).filter((m) => m.epicId !== "");
|
|
18660
|
+
} catch {
|
|
18661
|
+
return [];
|
|
18662
|
+
}
|
|
18663
|
+
}
|
|
18664
|
+
async function buildFocusEnvelope(id, projectRoot) {
|
|
18665
|
+
const showResult = await taskShow2(projectRoot, id);
|
|
18666
|
+
if (!showResult.success) {
|
|
18667
|
+
return {
|
|
18668
|
+
error: {
|
|
18669
|
+
code: showResult.error?.code?.toString() ?? "E_NOT_FOUND",
|
|
18670
|
+
message: showResult.error?.message ?? `Task not found: ${id}`
|
|
18671
|
+
}
|
|
18672
|
+
};
|
|
18673
|
+
}
|
|
18674
|
+
const task = showResult.data.task;
|
|
18675
|
+
const labels = Array.isArray(task.labels) ? task.labels : [];
|
|
18676
|
+
const isSaga = labels.includes("saga");
|
|
18677
|
+
const isEpic = task.type === "epic" && !isSaga;
|
|
18678
|
+
const entityType = isSaga ? "saga" : isEpic ? "epic" : "task";
|
|
18679
|
+
const identity = {
|
|
18680
|
+
id: task.id,
|
|
18681
|
+
title: task.title,
|
|
18682
|
+
type: entityType,
|
|
18683
|
+
status: task.status,
|
|
18684
|
+
...task.parentId != null ? { parentId: task.parentId } : {}
|
|
18685
|
+
};
|
|
18686
|
+
const scope = {};
|
|
18687
|
+
if (entityType === "task") {
|
|
18688
|
+
scope.taskId = task.id;
|
|
18689
|
+
if (task.parentId) scope.epicId = task.parentId;
|
|
18690
|
+
} else if (entityType === "epic") {
|
|
18691
|
+
scope.epicId = task.id;
|
|
18692
|
+
} else {
|
|
18693
|
+
scope.sagaId = task.id;
|
|
18694
|
+
}
|
|
18695
|
+
const blockers = [];
|
|
18696
|
+
const explicitBlockers = Array.isArray(task.blockedBy) ? task.blockedBy : [];
|
|
18697
|
+
const unresolvedDepends = [];
|
|
18698
|
+
if (explicitBlockers.length === 0 && Array.isArray(task.depends)) {
|
|
18699
|
+
for (const depId of task.depends) {
|
|
18700
|
+
const dRes = await taskShow2(projectRoot, depId).catch(() => null);
|
|
18701
|
+
if (dRes?.success && dRes.data) {
|
|
18702
|
+
const s = dRes.data.task.status;
|
|
18703
|
+
if (s !== "done" && s !== "cancelled") {
|
|
18704
|
+
unresolvedDepends.push(depId);
|
|
18705
|
+
blockers.push({
|
|
18706
|
+
id: depId,
|
|
18707
|
+
title: dRes.data.task.title,
|
|
18708
|
+
reason: `dependency not resolved (status: ${s})`
|
|
18709
|
+
});
|
|
18710
|
+
}
|
|
18711
|
+
}
|
|
18712
|
+
}
|
|
18713
|
+
}
|
|
18714
|
+
if (explicitBlockers.length > 0) {
|
|
18715
|
+
await Promise.allSettled(
|
|
18716
|
+
explicitBlockers.map(async (bid) => {
|
|
18717
|
+
const bRes = await taskShow2(projectRoot, bid).catch(() => null);
|
|
18718
|
+
blockers.push({
|
|
18719
|
+
id: bid,
|
|
18720
|
+
title: bRes?.success ? bRes.data?.task.title ?? bid : bid,
|
|
18721
|
+
reason: bRes?.success ? bRes.data?.task.status ?? "unknown" : "unknown"
|
|
18722
|
+
});
|
|
18723
|
+
})
|
|
18724
|
+
);
|
|
18725
|
+
}
|
|
18726
|
+
const epicIdForReady = entityType === "epic" ? task.id : entityType === "task" && task.parentId ? task.parentId : void 0;
|
|
18727
|
+
const [sagaMembersResult, readyResult, docsResult, brainResult] = await Promise.allSettled([
|
|
18728
|
+
isSaga ? fetchSagaMembersWithTitles(projectRoot, id) : Promise.resolve(void 0),
|
|
18729
|
+
epicIdForReady && TASK_ID_RE2.test(epicIdForReady) ? orchestrateReady2(epicIdForReady, projectRoot) : Promise.resolve(null),
|
|
18730
|
+
fetchAttachedDocs(projectRoot, id),
|
|
18731
|
+
fetchBrainContext(id)
|
|
18732
|
+
]);
|
|
18733
|
+
const recentActivity = fetchRecentActivity(id, projectRoot);
|
|
18734
|
+
const members = sagaMembersResult.status === "fulfilled" && sagaMembersResult.value != null ? sagaMembersResult.value : void 0;
|
|
18735
|
+
let readyWave;
|
|
18736
|
+
if (readyResult.status === "fulfilled" && readyResult.value?.success) {
|
|
18737
|
+
const rData = readyResult.value.data;
|
|
18738
|
+
const rTasks = rData?.readyTasks ?? [];
|
|
18739
|
+
if (rTasks.length > 0) {
|
|
18740
|
+
readyWave = rTasks.map((t) => ({
|
|
18741
|
+
id: t.id,
|
|
18742
|
+
title: t.title,
|
|
18743
|
+
priority: t.priority,
|
|
18744
|
+
depends: t.depends
|
|
18745
|
+
}));
|
|
18746
|
+
}
|
|
18747
|
+
}
|
|
18748
|
+
const attachedDocs = docsResult.status === "fulfilled" && docsResult.value.length > 0 ? docsResult.value : void 0;
|
|
18749
|
+
const brainContext = brainResult.status === "fulfilled" ? brainResult.value : void 0;
|
|
18750
|
+
const envelope = {
|
|
18751
|
+
identity,
|
|
18752
|
+
scope,
|
|
18753
|
+
...members != null ? { members } : {},
|
|
18754
|
+
blockers,
|
|
18755
|
+
...readyWave != null ? { readyWave } : {},
|
|
18756
|
+
...attachedDocs != null ? { attachedDocs } : {},
|
|
18757
|
+
...recentActivity.length > 0 ? { recentActivity } : {},
|
|
18758
|
+
...brainContext != null ? { brainContext } : {},
|
|
18759
|
+
tokensEstimated: 0
|
|
18760
|
+
};
|
|
18761
|
+
envelope.tokensEstimated = roughTokenCount(envelope);
|
|
18762
|
+
return envelope;
|
|
18763
|
+
}
|
|
18764
|
+
var TASK_ID_RE2, QUERY_OPS4, FocusHandler;
|
|
18765
|
+
var init_focus2 = __esm({
|
|
18766
|
+
"packages/cleo/src/dispatch/domains/focus.ts"() {
|
|
18767
|
+
"use strict";
|
|
18768
|
+
init_typed();
|
|
18769
|
+
init_base();
|
|
18770
|
+
init_meta2();
|
|
18771
|
+
TASK_ID_RE2 = /^T\d+$/i;
|
|
18772
|
+
QUERY_OPS4 = /* @__PURE__ */ new Set(["show"]);
|
|
18773
|
+
FocusHandler = class {
|
|
18774
|
+
/**
|
|
18775
|
+
* Execute a read-only focus query operation.
|
|
18776
|
+
*
|
|
18777
|
+
* @param operation - Operation name (`'show'`).
|
|
18778
|
+
* @param params - Raw params (must contain `id: string`).
|
|
18779
|
+
*/
|
|
18780
|
+
async query(operation, params) {
|
|
18781
|
+
const startTime = Date.now();
|
|
18782
|
+
if (!QUERY_OPS4.has(operation)) {
|
|
18783
|
+
return unsupportedOp("query", "focus", operation, startTime);
|
|
18784
|
+
}
|
|
18785
|
+
try {
|
|
18786
|
+
const id = typeof params?.["id"] === "string" ? params["id"].trim() : "";
|
|
18787
|
+
if (!id) {
|
|
18788
|
+
return {
|
|
18789
|
+
meta: dispatchMeta("query", "focus", operation, startTime),
|
|
18790
|
+
success: false,
|
|
18791
|
+
error: { code: "E_INVALID_INPUT", message: "id is required (e.g. cleo focus T9973)" }
|
|
18792
|
+
};
|
|
18793
|
+
}
|
|
18794
|
+
const projectRoot = getProjectRoot6();
|
|
18795
|
+
const result = await buildFocusEnvelope(id, projectRoot);
|
|
18796
|
+
if ("error" in result) {
|
|
18797
|
+
return {
|
|
18798
|
+
meta: dispatchMeta("query", "focus", operation, startTime),
|
|
18799
|
+
success: false,
|
|
18800
|
+
error: result.error
|
|
18801
|
+
};
|
|
18802
|
+
}
|
|
18803
|
+
const wrapped = lafsSuccess(result, "focus.show");
|
|
18804
|
+
return {
|
|
18805
|
+
meta: dispatchMeta("query", "focus", operation, startTime),
|
|
18806
|
+
success: true,
|
|
18807
|
+
data: wrapped.data
|
|
18808
|
+
};
|
|
18809
|
+
} catch (error) {
|
|
18810
|
+
return handleErrorResult("query", "focus", operation, error, startTime);
|
|
18811
|
+
}
|
|
18812
|
+
}
|
|
18813
|
+
/**
|
|
18814
|
+
* The focus domain has no mutate operations.
|
|
18815
|
+
*
|
|
18816
|
+
* @param operation - Always unsupported.
|
|
18817
|
+
* @param _params - Unused.
|
|
18818
|
+
*/
|
|
18819
|
+
async mutate(operation, _params) {
|
|
18820
|
+
const startTime = Date.now();
|
|
18821
|
+
return unsupportedOp("mutate", "focus", operation, startTime);
|
|
18822
|
+
}
|
|
18823
|
+
/** Declared operations for introspection. */
|
|
18824
|
+
getSupportedOperations() {
|
|
18825
|
+
return { query: ["show"], mutate: [] };
|
|
18826
|
+
}
|
|
18827
|
+
};
|
|
18828
|
+
}
|
|
18829
|
+
});
|
|
18830
|
+
|
|
18382
18831
|
// packages/cleo/src/dispatch/domains/intelligence.ts
|
|
18383
|
-
import { getLogger as getLogger5, getProjectRoot as
|
|
18832
|
+
import { getLogger as getLogger5, getProjectRoot as getProjectRoot7, getTaskAccessor as getTaskAccessor2 } from "@cleocode/core";
|
|
18384
18833
|
import {
|
|
18385
18834
|
calculateTaskRisk,
|
|
18386
18835
|
extractPatternsFromHistory,
|
|
@@ -18400,7 +18849,7 @@ var init_intelligence2 = __esm({
|
|
|
18400
18849
|
// Query
|
|
18401
18850
|
// -----------------------------------------------------------------------
|
|
18402
18851
|
async query(operation, params) {
|
|
18403
|
-
const projectRoot =
|
|
18852
|
+
const projectRoot = getProjectRoot7();
|
|
18404
18853
|
const startTime = Date.now();
|
|
18405
18854
|
try {
|
|
18406
18855
|
switch (operation) {
|
|
@@ -18619,7 +19068,7 @@ async function wrap(op, params, label) {
|
|
|
18619
19068
|
return lafsError("E_INTERNAL", err instanceof Error ? err.message : String(err), label);
|
|
18620
19069
|
}
|
|
18621
19070
|
}
|
|
18622
|
-
var coreOps, _llmTypedHandler,
|
|
19071
|
+
var coreOps, _llmTypedHandler, QUERY_OPS5, MUTATE_OPS4, LlmHandler;
|
|
18623
19072
|
var init_llm2 = __esm({
|
|
18624
19073
|
"packages/cleo/src/dispatch/domains/llm/index.ts"() {
|
|
18625
19074
|
"use strict";
|
|
@@ -18651,7 +19100,7 @@ var init_llm2 = __esm({
|
|
|
18651
19100
|
use: async (params) => wrap(coreOps["use"], params, "use"),
|
|
18652
19101
|
profile: async (params) => wrap(coreOps["profile"], params, "profile")
|
|
18653
19102
|
});
|
|
18654
|
-
|
|
19103
|
+
QUERY_OPS5 = /* @__PURE__ */ new Set(["list", "test", "whoami", "auxiliary-status"]);
|
|
18655
19104
|
MUTATE_OPS4 = /* @__PURE__ */ new Set(["add", "remove", "use", "profile"]);
|
|
18656
19105
|
LlmHandler = class {
|
|
18657
19106
|
/** Declared operations for introspection and validation. */
|
|
@@ -18666,7 +19115,7 @@ var init_llm2 = __esm({
|
|
|
18666
19115
|
*/
|
|
18667
19116
|
async query(operation, params) {
|
|
18668
19117
|
const startTime = Date.now();
|
|
18669
|
-
if (!
|
|
19118
|
+
if (!QUERY_OPS5.has(operation)) {
|
|
18670
19119
|
return unsupportedOp("query", "llm", operation, startTime);
|
|
18671
19120
|
}
|
|
18672
19121
|
try {
|
|
@@ -18704,8 +19153,9 @@ var init_llm2 = __esm({
|
|
|
18704
19153
|
});
|
|
18705
19154
|
|
|
18706
19155
|
// packages/cleo/src/dispatch/domains/memory.ts
|
|
18707
|
-
import { getLogger as getLogger6, getProjectRoot as
|
|
19156
|
+
import { getLogger as getLogger6, getProjectRoot as getProjectRoot8 } from "@cleocode/core";
|
|
18708
19157
|
import {
|
|
19158
|
+
createAttachmentStore as createAttachmentStore3,
|
|
18709
19159
|
generateMemoryBridgeContent,
|
|
18710
19160
|
getBrainDb,
|
|
18711
19161
|
getBrainNativeDb,
|
|
@@ -18732,7 +19182,7 @@ var init_memory2 = __esm({
|
|
|
18732
19182
|
// Query
|
|
18733
19183
|
// -----------------------------------------------------------------------
|
|
18734
19184
|
async query(operation, params) {
|
|
18735
|
-
const projectRoot =
|
|
19185
|
+
const projectRoot = getProjectRoot8();
|
|
18736
19186
|
const startTime = Date.now();
|
|
18737
19187
|
try {
|
|
18738
19188
|
switch (operation) {
|
|
@@ -19839,7 +20289,7 @@ var init_memory2 = __esm({
|
|
|
19839
20289
|
// Mutate
|
|
19840
20290
|
// -----------------------------------------------------------------------
|
|
19841
20291
|
async mutate(operation, params) {
|
|
19842
|
-
const projectRoot =
|
|
20292
|
+
const projectRoot = getProjectRoot8();
|
|
19843
20293
|
const startTime = Date.now();
|
|
19844
20294
|
try {
|
|
19845
20295
|
switch (operation) {
|
|
@@ -20098,15 +20548,16 @@ var init_memory2 = __esm({
|
|
|
20098
20548
|
let found = false;
|
|
20099
20549
|
let foundTable = "";
|
|
20100
20550
|
let alreadyVerified = false;
|
|
20551
|
+
let foundNarrative = null;
|
|
20101
20552
|
for (const tbl of tables) {
|
|
20102
20553
|
try {
|
|
20103
|
-
const
|
|
20104
|
-
|
|
20105
|
-
).get(entryId);
|
|
20554
|
+
const selectSql = tbl === "brain_observations" ? `SELECT id, verified, narrative FROM ${tbl} WHERE id = ? AND invalid_at IS NULL LIMIT 1` : `SELECT id, verified FROM ${tbl} WHERE id = ? AND invalid_at IS NULL LIMIT 1`;
|
|
20555
|
+
const row = nativeDb.prepare(selectSql).get(entryId);
|
|
20106
20556
|
if (row) {
|
|
20107
20557
|
found = true;
|
|
20108
20558
|
foundTable = tbl;
|
|
20109
20559
|
alreadyVerified = row.verified === 1;
|
|
20560
|
+
foundNarrative = row.narrative ?? null;
|
|
20110
20561
|
if (!alreadyVerified) {
|
|
20111
20562
|
if (tbl === "brain_observations") {
|
|
20112
20563
|
try {
|
|
@@ -20135,6 +20586,22 @@ var init_memory2 = __esm({
|
|
|
20135
20586
|
startTime
|
|
20136
20587
|
);
|
|
20137
20588
|
}
|
|
20589
|
+
let attachmentMissing;
|
|
20590
|
+
let attachmentId;
|
|
20591
|
+
if (foundTable === "brain_observations" && foundNarrative) {
|
|
20592
|
+
try {
|
|
20593
|
+
const payload = JSON.parse(
|
|
20594
|
+
foundNarrative
|
|
20595
|
+
);
|
|
20596
|
+
if (payload.kind === "doc-attachment" && typeof payload.attachmentId === "string") {
|
|
20597
|
+
attachmentId = payload.attachmentId;
|
|
20598
|
+
const store = createAttachmentStore3();
|
|
20599
|
+
const meta = await store.getMetadata(payload.attachmentId);
|
|
20600
|
+
attachmentMissing = meta === null;
|
|
20601
|
+
}
|
|
20602
|
+
} catch {
|
|
20603
|
+
}
|
|
20604
|
+
}
|
|
20138
20605
|
return wrapResult(
|
|
20139
20606
|
{
|
|
20140
20607
|
success: true,
|
|
@@ -20143,7 +20610,13 @@ var init_memory2 = __esm({
|
|
|
20143
20610
|
table: foundTable.replace("brain_", ""),
|
|
20144
20611
|
verified: true,
|
|
20145
20612
|
alreadyVerified,
|
|
20146
|
-
verifiedAt: alreadyVerified ? null : now
|
|
20613
|
+
verifiedAt: alreadyVerified ? null : now,
|
|
20614
|
+
// T9976 — doc-attachment round-trip fields (only present when applicable).
|
|
20615
|
+
...attachmentId !== void 0 ? { attachmentId } : {},
|
|
20616
|
+
...attachmentMissing !== void 0 ? { attachmentMissing } : {},
|
|
20617
|
+
...attachmentMissing === true ? {
|
|
20618
|
+
warning: `Attachment '${attachmentId}' referenced by this observation no longer exists in the docs store. The doc may have been removed.`
|
|
20619
|
+
} : {}
|
|
20147
20620
|
}
|
|
20148
20621
|
},
|
|
20149
20622
|
"mutate",
|
|
@@ -20299,6 +20772,92 @@ var init_memory2 = __esm({
|
|
|
20299
20772
|
// which already handles all sweep sub-commands via a unified case block.
|
|
20300
20773
|
case "sweep":
|
|
20301
20774
|
return this.query(operation, params);
|
|
20775
|
+
// T9976 — backfill: emit memory observations for existing doc attachments
|
|
20776
|
+
// that do not yet have a corresponding brain observation.
|
|
20777
|
+
case "backfill-docs": {
|
|
20778
|
+
try {
|
|
20779
|
+
const store = createAttachmentStore3();
|
|
20780
|
+
const allAttachments = await store.listAllInProject();
|
|
20781
|
+
await getBrainDb(projectRoot);
|
|
20782
|
+
const nativeDb = getBrainNativeDb();
|
|
20783
|
+
const existingAttachmentIds = /* @__PURE__ */ new Set();
|
|
20784
|
+
if (nativeDb) {
|
|
20785
|
+
try {
|
|
20786
|
+
const existing = nativeDb.prepare(
|
|
20787
|
+
`SELECT narrative FROM brain_observations
|
|
20788
|
+
WHERE narrative LIKE '%"kind":"doc-attachment"%'
|
|
20789
|
+
AND invalid_at IS NULL`
|
|
20790
|
+
).all();
|
|
20791
|
+
for (const row of existing) {
|
|
20792
|
+
if (!row.narrative) continue;
|
|
20793
|
+
try {
|
|
20794
|
+
const p = JSON.parse(row.narrative);
|
|
20795
|
+
if (p.kind === "doc-attachment" && typeof p.attachmentId === "string") {
|
|
20796
|
+
existingAttachmentIds.add(p.attachmentId);
|
|
20797
|
+
}
|
|
20798
|
+
} catch {
|
|
20799
|
+
}
|
|
20800
|
+
}
|
|
20801
|
+
} catch {
|
|
20802
|
+
}
|
|
20803
|
+
}
|
|
20804
|
+
let emitted = 0;
|
|
20805
|
+
let skipped = 0;
|
|
20806
|
+
const emittedIds = [];
|
|
20807
|
+
for (const item of allAttachments) {
|
|
20808
|
+
const attId = item.metadata.id;
|
|
20809
|
+
if (existingAttachmentIds.has(attId)) {
|
|
20810
|
+
skipped++;
|
|
20811
|
+
continue;
|
|
20812
|
+
}
|
|
20813
|
+
const extras = await store.getExtras(attId);
|
|
20814
|
+
const slug = extras?.slug ?? void 0;
|
|
20815
|
+
const type2 = extras?.type ?? void 0;
|
|
20816
|
+
const payload = {
|
|
20817
|
+
kind: "doc-attachment",
|
|
20818
|
+
attachmentId: attId,
|
|
20819
|
+
ownerId: item.ownerId,
|
|
20820
|
+
addedAt: item.metadata.createdAt,
|
|
20821
|
+
...slug !== void 0 ? { slug } : {},
|
|
20822
|
+
...type2 !== void 0 ? { type: type2 } : {}
|
|
20823
|
+
};
|
|
20824
|
+
const { memoryObserve: brainObserve } = await import("@cleocode/core/internal");
|
|
20825
|
+
await brainObserve(
|
|
20826
|
+
{
|
|
20827
|
+
text: JSON.stringify(payload),
|
|
20828
|
+
title: `Doc attached: ${slug ?? attId}`,
|
|
20829
|
+
type: "feature",
|
|
20830
|
+
// sourceType: 'manual' avoids the mental-model queue (5s flush interval).
|
|
20831
|
+
// The mental-model queue is only entered when `agent` is set + type is in
|
|
20832
|
+
// MENTAL_MODEL_TYPES. Using 'manual' bypasses this path entirely.
|
|
20833
|
+
sourceType: "manual"
|
|
20834
|
+
},
|
|
20835
|
+
projectRoot
|
|
20836
|
+
).catch(() => {
|
|
20837
|
+
});
|
|
20838
|
+
emittedIds.push(attId);
|
|
20839
|
+
emitted++;
|
|
20840
|
+
}
|
|
20841
|
+
return wrapResult(
|
|
20842
|
+
{
|
|
20843
|
+
success: true,
|
|
20844
|
+
data: {
|
|
20845
|
+
total: allAttachments.length,
|
|
20846
|
+
emitted,
|
|
20847
|
+
skipped,
|
|
20848
|
+
emittedAttachmentIds: emittedIds,
|
|
20849
|
+
hint: emitted === 0 ? "All existing attachments already have memory observations \u2014 nothing to backfill." : `Emitted ${emitted} new doc-attachment observations. Use 'cleo memory find <slug>' to verify.`
|
|
20850
|
+
}
|
|
20851
|
+
},
|
|
20852
|
+
"mutate",
|
|
20853
|
+
"memory",
|
|
20854
|
+
operation,
|
|
20855
|
+
startTime
|
|
20856
|
+
);
|
|
20857
|
+
} catch (backfillErr) {
|
|
20858
|
+
return handleErrorResult("mutate", "memory", operation, backfillErr, startTime);
|
|
20859
|
+
}
|
|
20860
|
+
}
|
|
20302
20861
|
default:
|
|
20303
20862
|
return unsupportedOp("mutate", "memory", operation, startTime);
|
|
20304
20863
|
}
|
|
@@ -20380,7 +20939,9 @@ var init_memory2 = __esm({
|
|
|
20380
20939
|
// T1003 — staged backfill operations
|
|
20381
20940
|
"backfill.run",
|
|
20382
20941
|
"backfill.approve",
|
|
20383
|
-
"backfill.rollback"
|
|
20942
|
+
"backfill.rollback",
|
|
20943
|
+
// T9976 — emit memory observations for existing doc attachments
|
|
20944
|
+
"backfill-docs"
|
|
20384
20945
|
]
|
|
20385
20946
|
};
|
|
20386
20947
|
}
|
|
@@ -20488,7 +21049,7 @@ import {
|
|
|
20488
21049
|
getBrainNativeDb as getBrainNativeDb2,
|
|
20489
21050
|
getLogger as getLogger7,
|
|
20490
21051
|
getNexusNativeDb,
|
|
20491
|
-
getProjectRoot as
|
|
21052
|
+
getProjectRoot as getProjectRoot9,
|
|
20492
21053
|
nexusAugment,
|
|
20493
21054
|
nexusBlockers,
|
|
20494
21055
|
nexusBrainAnchors,
|
|
@@ -20760,7 +21321,7 @@ async function handleImpact(operation, params, startTime) {
|
|
|
20760
21321
|
5
|
|
20761
21322
|
);
|
|
20762
21323
|
const projectIdParam = params?.projectId;
|
|
20763
|
-
const projectId = projectIdParam ?? Buffer.from(
|
|
21324
|
+
const projectId = projectIdParam ?? Buffer.from(getProjectRoot9()).toString("base64url").slice(0, 32);
|
|
20764
21325
|
try {
|
|
20765
21326
|
const { getNexusDb } = await import("@cleocode/core/store/nexus-sqlite");
|
|
20766
21327
|
await getNexusDb();
|
|
@@ -20937,7 +21498,7 @@ async function handleImpact(operation, params, startTime) {
|
|
|
20937
21498
|
return handleErrorResult("query", "nexus", operation, dbErr, startTime);
|
|
20938
21499
|
}
|
|
20939
21500
|
}
|
|
20940
|
-
var _nexusTypedHandler,
|
|
21501
|
+
var _nexusTypedHandler, QUERY_OPS6, MUTATE_OPS5, NexusHandler, IMPACT_REVERSE_TYPES;
|
|
20941
21502
|
var init_nexus3 = __esm({
|
|
20942
21503
|
"packages/cleo/src/dispatch/domains/nexus.ts"() {
|
|
20943
21504
|
"use strict";
|
|
@@ -21021,7 +21582,7 @@ var init_nexus3 = __esm({
|
|
|
21021
21582
|
return wrapCoreResult(await nexusAugment(params.pattern, params.limit ?? 5), "augment");
|
|
21022
21583
|
},
|
|
21023
21584
|
"share.status": async (_params) => {
|
|
21024
|
-
const projectRoot =
|
|
21585
|
+
const projectRoot = getProjectRoot9();
|
|
21025
21586
|
return wrapCoreResult(await nexusShareStatus(projectRoot), "share.status");
|
|
21026
21587
|
},
|
|
21027
21588
|
"transfer.preview": async (params) => {
|
|
@@ -21057,39 +21618,39 @@ var init_nexus3 = __esm({
|
|
|
21057
21618
|
},
|
|
21058
21619
|
"full-context": async (params) => {
|
|
21059
21620
|
if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "full-context");
|
|
21060
|
-
const projectRoot =
|
|
21621
|
+
const projectRoot = getProjectRoot9();
|
|
21061
21622
|
return wrapCoreResult(await nexusFullContext(params.symbol, projectRoot), "full-context");
|
|
21062
21623
|
},
|
|
21063
21624
|
"task-footprint": async (params) => {
|
|
21064
21625
|
if (!params.taskId) return lafsError("E_INVALID_INPUT", "taskId is required", "task-footprint");
|
|
21065
|
-
const projectRoot =
|
|
21626
|
+
const projectRoot = getProjectRoot9();
|
|
21066
21627
|
return wrapCoreResult(await nexusTaskFootprint(params.taskId, projectRoot), "task-footprint");
|
|
21067
21628
|
},
|
|
21068
21629
|
"brain-anchors": async (params) => {
|
|
21069
21630
|
if (!params.entryId)
|
|
21070
21631
|
return lafsError("E_INVALID_INPUT", "entryId is required", "brain-anchors");
|
|
21071
|
-
const projectRoot =
|
|
21632
|
+
const projectRoot = getProjectRoot9();
|
|
21072
21633
|
return wrapCoreResult(await nexusBrainAnchors(params.entryId, projectRoot), "brain-anchors");
|
|
21073
21634
|
},
|
|
21074
21635
|
why: async (params) => {
|
|
21075
21636
|
if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "why");
|
|
21076
|
-
const projectRoot =
|
|
21637
|
+
const projectRoot = getProjectRoot9();
|
|
21077
21638
|
return wrapCoreResult(await nexusWhy(params.symbol, projectRoot), "why");
|
|
21078
21639
|
},
|
|
21079
21640
|
"impact-full": async (params) => {
|
|
21080
21641
|
if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "impact-full");
|
|
21081
|
-
const projectRoot =
|
|
21642
|
+
const projectRoot = getProjectRoot9();
|
|
21082
21643
|
return wrapCoreResult(await nexusImpactFull(params.symbol, projectRoot), "impact-full");
|
|
21083
21644
|
},
|
|
21084
21645
|
"route-map": async (params) => {
|
|
21085
|
-
const projectRoot =
|
|
21646
|
+
const projectRoot = getProjectRoot9();
|
|
21086
21647
|
const projectId = params.projectId ?? Buffer.from(projectRoot).toString("base64url").slice(0, 32);
|
|
21087
21648
|
return wrapCoreResult(await nexusRouteMap(projectId, projectRoot), "route-map");
|
|
21088
21649
|
},
|
|
21089
21650
|
"shape-check": async (params) => {
|
|
21090
21651
|
if (!params.routeSymbol)
|
|
21091
21652
|
return lafsError("E_INVALID_INPUT", "routeSymbol is required", "shape-check");
|
|
21092
|
-
const projectRoot =
|
|
21653
|
+
const projectRoot = getProjectRoot9();
|
|
21093
21654
|
const projectId = params.projectId ?? Buffer.from(projectRoot).toString("base64url").slice(0, 32);
|
|
21094
21655
|
return wrapCoreResult(
|
|
21095
21656
|
await nexusShapeCheck(params.routeSymbol, projectId, projectRoot),
|
|
@@ -21101,7 +21662,7 @@ var init_nexus3 = __esm({
|
|
|
21101
21662
|
return wrapCoreResult(await nexusSearchCode(params.pattern, params.limit ?? 10), "search-code");
|
|
21102
21663
|
},
|
|
21103
21664
|
wiki: async (params) => {
|
|
21104
|
-
const projectRoot =
|
|
21665
|
+
const projectRoot = getProjectRoot9();
|
|
21105
21666
|
const outputDir = params.outputDir ?? `${projectRoot}/.cleo/wiki`;
|
|
21106
21667
|
return wrapCoreResult(
|
|
21107
21668
|
await nexusWiki(outputDir, projectRoot, {
|
|
@@ -21114,7 +21675,7 @@ var init_nexus3 = __esm({
|
|
|
21114
21675
|
"contracts-show": async (params) => {
|
|
21115
21676
|
if (!params.projectA || !params.projectB)
|
|
21116
21677
|
return lafsError("E_INVALID_INPUT", "projectA and projectB are required", "contracts-show");
|
|
21117
|
-
const projectRoot =
|
|
21678
|
+
const projectRoot = getProjectRoot9();
|
|
21118
21679
|
return wrapCoreResult(
|
|
21119
21680
|
await nexusContractsShow(params.projectA, params.projectB, projectRoot),
|
|
21120
21681
|
"contracts-show"
|
|
@@ -21122,7 +21683,7 @@ var init_nexus3 = __esm({
|
|
|
21122
21683
|
},
|
|
21123
21684
|
"task-symbols": async (params) => {
|
|
21124
21685
|
if (!params.taskId) return lafsError("E_INVALID_INPUT", "taskId is required", "task-symbols");
|
|
21125
|
-
const projectRoot =
|
|
21686
|
+
const projectRoot = getProjectRoot9();
|
|
21126
21687
|
return wrapCoreResult(await nexusTaskSymbols(params.taskId, projectRoot), "task-symbols");
|
|
21127
21688
|
},
|
|
21128
21689
|
"profile.view": async (params) => wrapCoreResult(
|
|
@@ -21137,20 +21698,20 @@ var init_nexus3 = __esm({
|
|
|
21137
21698
|
"sigil.list": async (params) => wrapCoreResult(await nexusSigilList(params.role), "sigil.list"),
|
|
21138
21699
|
// T1510 — Phase 2 query ops
|
|
21139
21700
|
clusters: async (params) => {
|
|
21140
|
-
const projectRoot =
|
|
21701
|
+
const projectRoot = getProjectRoot9();
|
|
21141
21702
|
const repoPath = params.repoPath ?? projectRoot;
|
|
21142
21703
|
const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
21143
21704
|
return wrapCoreResult(await nexusClusters(projectId, repoPath), "clusters");
|
|
21144
21705
|
},
|
|
21145
21706
|
flows: async (params) => {
|
|
21146
|
-
const projectRoot =
|
|
21707
|
+
const projectRoot = getProjectRoot9();
|
|
21147
21708
|
const repoPath = params.repoPath ?? projectRoot;
|
|
21148
21709
|
const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
21149
21710
|
return wrapCoreResult(await nexusFlows(projectId, repoPath), "flows");
|
|
21150
21711
|
},
|
|
21151
21712
|
context: async (params) => {
|
|
21152
21713
|
if (!params.symbol) return lafsError("E_INVALID_INPUT", "symbol is required", "context");
|
|
21153
|
-
const projectRoot =
|
|
21714
|
+
const projectRoot = getProjectRoot9();
|
|
21154
21715
|
const projectId = params.projectId ?? Buffer.from(projectRoot).toString("base64url").slice(0, 32);
|
|
21155
21716
|
const limit = typeof params.limit === "number" ? params.limit : 20;
|
|
21156
21717
|
const showContent = params.content === true;
|
|
@@ -21199,13 +21760,13 @@ var init_nexus3 = __esm({
|
|
|
21199
21760
|
"projects.clean"
|
|
21200
21761
|
),
|
|
21201
21762
|
"refresh-bridge": async (params) => {
|
|
21202
|
-
const projectRoot =
|
|
21763
|
+
const projectRoot = getProjectRoot9();
|
|
21203
21764
|
const repoPath = params.repoPath ?? projectRoot;
|
|
21204
21765
|
const projectId = params.projectId;
|
|
21205
21766
|
return wrapCoreResult(await nexusRefreshBridge(repoPath, projectId), "refresh-bridge");
|
|
21206
21767
|
},
|
|
21207
21768
|
diff: async (params) => {
|
|
21208
|
-
const projectRoot =
|
|
21769
|
+
const projectRoot = getProjectRoot9();
|
|
21209
21770
|
const repoPath = params.repoPath ?? projectRoot;
|
|
21210
21771
|
return wrapCoreResult(
|
|
21211
21772
|
await nexusDiff(
|
|
@@ -21225,17 +21786,17 @@ var init_nexus3 = __esm({
|
|
|
21225
21786
|
);
|
|
21226
21787
|
},
|
|
21227
21788
|
"hot-paths": async (params) => {
|
|
21228
|
-
const projectRoot =
|
|
21789
|
+
const projectRoot = getProjectRoot9();
|
|
21229
21790
|
const limit = typeof params.limit === "number" ? params.limit : 20;
|
|
21230
21791
|
return wrapCoreResult(await nexusHotPaths(projectRoot, limit), "hot-paths");
|
|
21231
21792
|
},
|
|
21232
21793
|
"hot-nodes": async (params) => {
|
|
21233
|
-
const projectRoot =
|
|
21794
|
+
const projectRoot = getProjectRoot9();
|
|
21234
21795
|
const limit = typeof params.limit === "number" ? params.limit : 20;
|
|
21235
21796
|
return wrapCoreResult(await nexusHotNodes(projectRoot, limit), "hot-nodes");
|
|
21236
21797
|
},
|
|
21237
21798
|
"cold-symbols": async (params) => {
|
|
21238
|
-
const projectRoot =
|
|
21799
|
+
const projectRoot = getProjectRoot9();
|
|
21239
21800
|
const days = typeof params.days === "number" ? params.days : 30;
|
|
21240
21801
|
return wrapCoreResult(await nexusColdSymbols(projectRoot, days), "cold-symbols");
|
|
21241
21802
|
},
|
|
@@ -21271,11 +21832,11 @@ var init_nexus3 = __esm({
|
|
|
21271
21832
|
);
|
|
21272
21833
|
},
|
|
21273
21834
|
reconcile: async (params) => wrapCoreResult(
|
|
21274
|
-
await nexusReconcileProject(params.projectRoot ??
|
|
21835
|
+
await nexusReconcileProject(params.projectRoot ?? getProjectRoot9()),
|
|
21275
21836
|
"reconcile"
|
|
21276
21837
|
),
|
|
21277
21838
|
"share.snapshot.export": async (params) => {
|
|
21278
|
-
const projectRoot =
|
|
21839
|
+
const projectRoot = getProjectRoot9();
|
|
21279
21840
|
return wrapCoreResult(
|
|
21280
21841
|
await nexusShareSnapshotExport(projectRoot, params.outputPath),
|
|
21281
21842
|
"share.snapshot.export"
|
|
@@ -21284,7 +21845,7 @@ var init_nexus3 = __esm({
|
|
|
21284
21845
|
"share.snapshot.import": async (params) => {
|
|
21285
21846
|
if (!params.inputPath)
|
|
21286
21847
|
return lafsError("E_INVALID_INPUT", "inputPath is required", "share.snapshot.import");
|
|
21287
|
-
const projectRoot =
|
|
21848
|
+
const projectRoot = getProjectRoot9();
|
|
21288
21849
|
return wrapCoreResult(
|
|
21289
21850
|
await nexusShareSnapshotImport(projectRoot, params.inputPath),
|
|
21290
21851
|
"share.snapshot.import"
|
|
@@ -21312,13 +21873,13 @@ var init_nexus3 = __esm({
|
|
|
21312
21873
|
);
|
|
21313
21874
|
},
|
|
21314
21875
|
"contracts-sync": async (params) => {
|
|
21315
|
-
const projectRoot =
|
|
21876
|
+
const projectRoot = getProjectRoot9();
|
|
21316
21877
|
const repoPath = params.repoPath ?? projectRoot;
|
|
21317
21878
|
const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
21318
21879
|
return wrapCoreResult(await nexusContractsSync(projectId, repoPath), "contracts-sync");
|
|
21319
21880
|
},
|
|
21320
21881
|
"contracts-link-tasks": async (params) => {
|
|
21321
|
-
const projectRoot =
|
|
21882
|
+
const projectRoot = getProjectRoot9();
|
|
21322
21883
|
const repoPath = params.repoPath ?? projectRoot;
|
|
21323
21884
|
const projectId = params.projectId ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
21324
21885
|
return wrapCoreResult(
|
|
@@ -21327,7 +21888,7 @@ var init_nexus3 = __esm({
|
|
|
21327
21888
|
);
|
|
21328
21889
|
},
|
|
21329
21890
|
"conduit-scan": async (_params) => {
|
|
21330
|
-
const projectRoot =
|
|
21891
|
+
const projectRoot = getProjectRoot9();
|
|
21331
21892
|
return wrapCoreResult(await nexusConduitScan(projectRoot), "conduit-scan");
|
|
21332
21893
|
},
|
|
21333
21894
|
"profile.import": async (params) => wrapCoreResult(await nexusProfileImport(params.path), "profile.import"),
|
|
@@ -21360,7 +21921,7 @@ var init_nexus3 = __esm({
|
|
|
21360
21921
|
},
|
|
21361
21922
|
"sigil.sync": async (_params) => wrapCoreResult(await nexusSigilSync(), "sigil.sync")
|
|
21362
21923
|
});
|
|
21363
|
-
|
|
21924
|
+
QUERY_OPS6 = /* @__PURE__ */ new Set([
|
|
21364
21925
|
"share.status",
|
|
21365
21926
|
"status",
|
|
21366
21927
|
"list",
|
|
@@ -21437,7 +21998,7 @@ var init_nexus3 = __esm({
|
|
|
21437
21998
|
*/
|
|
21438
21999
|
async query(operation, params) {
|
|
21439
22000
|
const startTime = Date.now();
|
|
21440
|
-
if (!
|
|
22001
|
+
if (!QUERY_OPS6.has(operation)) {
|
|
21441
22002
|
return unsupportedOp("query", "nexus", operation, startTime);
|
|
21442
22003
|
}
|
|
21443
22004
|
if (operation === "top-entries") {
|
|
@@ -21494,7 +22055,7 @@ var init_nexus3 = __esm({
|
|
|
21494
22055
|
/** Declared operations for introspection and validation. */
|
|
21495
22056
|
getSupportedOperations() {
|
|
21496
22057
|
return {
|
|
21497
|
-
query: Array.from(
|
|
22058
|
+
query: Array.from(QUERY_OPS6),
|
|
21498
22059
|
mutate: Array.from(MUTATE_OPS5)
|
|
21499
22060
|
};
|
|
21500
22061
|
}
|
|
@@ -21531,7 +22092,7 @@ import {
|
|
|
21531
22092
|
extractTypedGates,
|
|
21532
22093
|
getIvtrState,
|
|
21533
22094
|
getLogger as getLogger8,
|
|
21534
|
-
getProjectRoot as
|
|
22095
|
+
getProjectRoot as getProjectRoot10,
|
|
21535
22096
|
getTask,
|
|
21536
22097
|
loopBackIvtr,
|
|
21537
22098
|
releaseIvtr,
|
|
@@ -21547,7 +22108,7 @@ function extractEvidenceFromRaw(raw) {
|
|
|
21547
22108
|
return [];
|
|
21548
22109
|
}
|
|
21549
22110
|
async function ivtrStatusOp(params) {
|
|
21550
|
-
const cwd =
|
|
22111
|
+
const cwd = getProjectRoot10();
|
|
21551
22112
|
const state = await getIvtrState(params.taskId, { cwd });
|
|
21552
22113
|
if (!state) {
|
|
21553
22114
|
return engineSuccess2({
|
|
@@ -21577,7 +22138,7 @@ async function ivtrStatusOp(params) {
|
|
|
21577
22138
|
});
|
|
21578
22139
|
}
|
|
21579
22140
|
async function ivtrStartOp(params) {
|
|
21580
|
-
const cwd =
|
|
22141
|
+
const cwd = getProjectRoot10();
|
|
21581
22142
|
const task = await getTask(params.taskId, cwd);
|
|
21582
22143
|
if (!task) {
|
|
21583
22144
|
return engineError2("E_NOT_FOUND", `Task ${params.taskId} not found`);
|
|
@@ -21598,7 +22159,7 @@ async function ivtrStartOp(params) {
|
|
|
21598
22159
|
});
|
|
21599
22160
|
}
|
|
21600
22161
|
async function ivtrNextOp(params) {
|
|
21601
|
-
const cwd =
|
|
22162
|
+
const cwd = getProjectRoot10();
|
|
21602
22163
|
const task = await getTask(params.taskId, cwd);
|
|
21603
22164
|
if (!task) {
|
|
21604
22165
|
return engineError2("E_NOT_FOUND", `Task ${params.taskId} not found`);
|
|
@@ -21649,7 +22210,7 @@ async function ivtrNextOp(params) {
|
|
|
21649
22210
|
});
|
|
21650
22211
|
}
|
|
21651
22212
|
async function ivtrReleaseOp(params) {
|
|
21652
|
-
const cwd =
|
|
22213
|
+
const cwd = getProjectRoot10();
|
|
21653
22214
|
const result = await releaseIvtr(params.taskId, { cwd });
|
|
21654
22215
|
if (!result.released) {
|
|
21655
22216
|
return {
|
|
@@ -21686,7 +22247,7 @@ async function ivtrReleaseOp(params) {
|
|
|
21686
22247
|
};
|
|
21687
22248
|
}
|
|
21688
22249
|
async function ivtrLoopBackOp(params) {
|
|
21689
|
-
const cwd =
|
|
22250
|
+
const cwd = getProjectRoot10();
|
|
21690
22251
|
if (!isLoopBackTarget(params.phase)) {
|
|
21691
22252
|
return {
|
|
21692
22253
|
success: false,
|
|
@@ -26252,8 +26813,8 @@ async function loadPlaybookByName(name) {
|
|
|
26252
26813
|
return null;
|
|
26253
26814
|
}
|
|
26254
26815
|
try {
|
|
26255
|
-
const { getProjectRoot:
|
|
26256
|
-
const projectRoot = __playbookRuntimeOverrides.projectRoot ??
|
|
26816
|
+
const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
|
|
26817
|
+
const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot44();
|
|
26257
26818
|
const resolved = resolvePlaybook(name, {
|
|
26258
26819
|
projectRoot,
|
|
26259
26820
|
globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
|
|
@@ -26297,8 +26858,8 @@ async function acquireDb() {
|
|
|
26297
26858
|
async function buildDefaultDispatcher() {
|
|
26298
26859
|
if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
|
|
26299
26860
|
const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
|
|
26300
|
-
const { getProjectRoot:
|
|
26301
|
-
const projectRoot =
|
|
26861
|
+
const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
|
|
26862
|
+
const projectRoot = getProjectRoot44();
|
|
26302
26863
|
return {
|
|
26303
26864
|
async dispatch(input2) {
|
|
26304
26865
|
try {
|
|
@@ -26364,7 +26925,7 @@ async function lookupApprovalByTokenForDispatch(token) {
|
|
|
26364
26925
|
const db = await acquireDb();
|
|
26365
26926
|
return getPlaybookApprovalByToken(db, token);
|
|
26366
26927
|
}
|
|
26367
|
-
var __playbookRuntimeOverrides, _playbookTypedHandler,
|
|
26928
|
+
var __playbookRuntimeOverrides, _playbookTypedHandler, QUERY_OPS7, MUTATE_OPS6, PlaybookHandler;
|
|
26368
26929
|
var init_playbook2 = __esm({
|
|
26369
26930
|
"packages/cleo/src/dispatch/domains/playbook.ts"() {
|
|
26370
26931
|
"use strict";
|
|
@@ -26488,8 +27049,8 @@ var init_playbook2 = __esm({
|
|
|
26488
27049
|
projectRoot = __playbookRuntimeOverrides.projectRoot;
|
|
26489
27050
|
} else {
|
|
26490
27051
|
try {
|
|
26491
|
-
const { getProjectRoot:
|
|
26492
|
-
projectRoot =
|
|
27052
|
+
const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
|
|
27053
|
+
projectRoot = getProjectRoot44();
|
|
26493
27054
|
} catch {
|
|
26494
27055
|
projectRoot = void 0;
|
|
26495
27056
|
}
|
|
@@ -26553,14 +27114,14 @@ var init_playbook2 = __esm({
|
|
|
26553
27114
|
const dispatcher = await buildDefaultDispatcher();
|
|
26554
27115
|
let result;
|
|
26555
27116
|
try {
|
|
26556
|
-
const { getProjectRoot:
|
|
27117
|
+
const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core/internal");
|
|
26557
27118
|
const opts = {
|
|
26558
27119
|
db,
|
|
26559
27120
|
playbook: parsed.definition,
|
|
26560
27121
|
playbookHash: parsed.sourceHash,
|
|
26561
27122
|
initialContext,
|
|
26562
27123
|
dispatcher,
|
|
26563
|
-
projectRoot:
|
|
27124
|
+
projectRoot: getProjectRoot44()
|
|
26564
27125
|
};
|
|
26565
27126
|
if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
|
|
26566
27127
|
opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
|
|
@@ -26667,7 +27228,7 @@ var init_playbook2 = __esm({
|
|
|
26667
27228
|
}
|
|
26668
27229
|
}
|
|
26669
27230
|
});
|
|
26670
|
-
|
|
27231
|
+
QUERY_OPS7 = /* @__PURE__ */ new Set(["status", "list", "validate", "catalog"]);
|
|
26671
27232
|
MUTATE_OPS6 = /* @__PURE__ */ new Set(["run", "resume"]);
|
|
26672
27233
|
PlaybookHandler = class {
|
|
26673
27234
|
/**
|
|
@@ -26675,7 +27236,7 @@ var init_playbook2 = __esm({
|
|
|
26675
27236
|
*/
|
|
26676
27237
|
async query(operation, params) {
|
|
26677
27238
|
const startTime = Date.now();
|
|
26678
|
-
if (!
|
|
27239
|
+
if (!QUERY_OPS7.has(operation)) {
|
|
26679
27240
|
return unsupportedOp("query", "playbook", operation, startTime);
|
|
26680
27241
|
}
|
|
26681
27242
|
try {
|
|
@@ -26742,7 +27303,7 @@ var init_playbook2 = __esm({
|
|
|
26742
27303
|
// packages/cleo/src/dispatch/domains/orchestrate.ts
|
|
26743
27304
|
import {
|
|
26744
27305
|
getLogger as getLogger9,
|
|
26745
|
-
getProjectRoot as
|
|
27306
|
+
getProjectRoot as getProjectRoot11,
|
|
26746
27307
|
instantiateTessera,
|
|
26747
27308
|
listTesseraTemplates,
|
|
26748
27309
|
paginate as paginate2,
|
|
@@ -26756,25 +27317,25 @@ function evictFanoutManifest() {
|
|
|
26756
27317
|
}
|
|
26757
27318
|
}
|
|
26758
27319
|
async function orchestrateStatusOp(params) {
|
|
26759
|
-
return orchestrateStatus(params.epicId,
|
|
27320
|
+
return orchestrateStatus(params.epicId, getProjectRoot11());
|
|
26760
27321
|
}
|
|
26761
27322
|
async function orchestrateNextOp(params) {
|
|
26762
|
-
return orchestrateNext(params.epicId,
|
|
27323
|
+
return orchestrateNext(params.epicId, getProjectRoot11());
|
|
26763
27324
|
}
|
|
26764
27325
|
async function orchestrateReadyOp(params) {
|
|
26765
|
-
return orchestrateReady(params.epicId,
|
|
27326
|
+
return orchestrateReady(params.epicId, getProjectRoot11(), {
|
|
26766
27327
|
ignoreDepsValidate: params.ignoreDepsValidate,
|
|
26767
27328
|
via: params.via
|
|
26768
27329
|
});
|
|
26769
27330
|
}
|
|
26770
27331
|
async function orchestrateAnalyzeOp(params) {
|
|
26771
27332
|
if (params.mode === "parallel-safety") {
|
|
26772
|
-
return orchestrateAnalyzeParallelSafety(params.taskIds ?? [],
|
|
27333
|
+
return orchestrateAnalyzeParallelSafety(params.taskIds ?? [], getProjectRoot11());
|
|
26773
27334
|
}
|
|
26774
|
-
return orchestrateAnalyze(params.epicId,
|
|
27335
|
+
return orchestrateAnalyze(params.epicId, getProjectRoot11(), params.mode);
|
|
26775
27336
|
}
|
|
26776
27337
|
async function orchestrateClassifyOp(params) {
|
|
26777
|
-
return orchestrateClassify(params.request, params.context,
|
|
27338
|
+
return orchestrateClassify(params.request, params.context, getProjectRoot11());
|
|
26778
27339
|
}
|
|
26779
27340
|
function orchestrateFanoutStatusOp(params) {
|
|
26780
27341
|
const entry = fanoutManifestStore.get(params.manifestEntryId);
|
|
@@ -26807,23 +27368,23 @@ function orchestrateFanoutStatusOp(params) {
|
|
|
26807
27368
|
});
|
|
26808
27369
|
}
|
|
26809
27370
|
async function orchestrateContextOp(params) {
|
|
26810
|
-
return orchestrateContext(params.epicId,
|
|
27371
|
+
return orchestrateContext(params.epicId, getProjectRoot11());
|
|
26811
27372
|
}
|
|
26812
27373
|
async function orchestrateWavesOp(params) {
|
|
26813
|
-
return orchestrateWaves(params.epicId,
|
|
27374
|
+
return orchestrateWaves(params.epicId, getProjectRoot11(), { via: params.via });
|
|
26814
27375
|
}
|
|
26815
27376
|
async function orchestratePlanOp(params) {
|
|
26816
27377
|
return orchestratePlan({
|
|
26817
27378
|
epicId: params.epicId,
|
|
26818
|
-
projectRoot:
|
|
27379
|
+
projectRoot: getProjectRoot11(),
|
|
26819
27380
|
preferTier: params.preferTier
|
|
26820
27381
|
});
|
|
26821
27382
|
}
|
|
26822
27383
|
async function orchestrateBootstrapOp(params) {
|
|
26823
|
-
return orchestrateBootstrap(
|
|
27384
|
+
return orchestrateBootstrap(getProjectRoot11(), { speed: params.speed });
|
|
26824
27385
|
}
|
|
26825
27386
|
async function orchestrateUnblockOp(_params) {
|
|
26826
|
-
return orchestrateUnblockOpportunities(
|
|
27387
|
+
return orchestrateUnblockOpportunities(getProjectRoot11());
|
|
26827
27388
|
}
|
|
26828
27389
|
async function orchestrateTesseraListOp(params) {
|
|
26829
27390
|
return Promise.resolve({ success: true, data: params });
|
|
@@ -26835,15 +27396,16 @@ async function orchestratePendingOp(_params) {
|
|
|
26835
27396
|
return Promise.resolve({ success: true, data: {} });
|
|
26836
27397
|
}
|
|
26837
27398
|
async function orchestrateStartOp(params) {
|
|
26838
|
-
return orchestrateStartup(params.epicId,
|
|
27399
|
+
return orchestrateStartup(params.epicId, getProjectRoot11());
|
|
26839
27400
|
}
|
|
26840
27401
|
async function orchestrateSpawnOp(params) {
|
|
26841
27402
|
return orchestrateSpawn(
|
|
26842
27403
|
params.taskId,
|
|
26843
27404
|
params.protocolType,
|
|
26844
|
-
|
|
27405
|
+
getProjectRoot11(),
|
|
26845
27406
|
params.tier,
|
|
26846
|
-
params.noWorktree
|
|
27407
|
+
params.noWorktree,
|
|
27408
|
+
params.spawnScope
|
|
26847
27409
|
);
|
|
26848
27410
|
}
|
|
26849
27411
|
async function orchestrateHandoffOp(params) {
|
|
@@ -26859,7 +27421,7 @@ async function orchestrateHandoffOp(params) {
|
|
|
26859
27421
|
},
|
|
26860
27422
|
// Inject cleo session ops to avoid core→cleo import cycle (T1570 ADR-057)
|
|
26861
27423
|
{ sessionStatus, sessionEnd, sessionContextInject },
|
|
26862
|
-
|
|
27424
|
+
getProjectRoot11()
|
|
26863
27425
|
);
|
|
26864
27426
|
}
|
|
26865
27427
|
async function orchestrateSpawnExecuteOp(params) {
|
|
@@ -26867,19 +27429,19 @@ async function orchestrateSpawnExecuteOp(params) {
|
|
|
26867
27429
|
params.taskId,
|
|
26868
27430
|
params.adapterId,
|
|
26869
27431
|
params.protocolType,
|
|
26870
|
-
|
|
27432
|
+
getProjectRoot11(),
|
|
26871
27433
|
params.tier
|
|
26872
27434
|
);
|
|
26873
27435
|
}
|
|
26874
27436
|
async function orchestrateValidateOp(params) {
|
|
26875
|
-
return orchestrateValidate(params.taskId,
|
|
27437
|
+
return orchestrateValidate(params.taskId, getProjectRoot11());
|
|
26876
27438
|
}
|
|
26877
27439
|
async function orchestratePivotOp(params) {
|
|
26878
27440
|
try {
|
|
26879
27441
|
const result = await pivotTask(params.fromTaskId, params.toTaskId, {
|
|
26880
27442
|
reason: params.reason,
|
|
26881
27443
|
blocksFrom: params.blocksFrom,
|
|
26882
|
-
projectRoot:
|
|
27444
|
+
projectRoot: getProjectRoot11()
|
|
26883
27445
|
});
|
|
26884
27446
|
return { success: true, data: result };
|
|
26885
27447
|
} catch (err) {
|
|
@@ -26897,19 +27459,19 @@ async function orchestratePivotOp(params) {
|
|
|
26897
27459
|
}
|
|
26898
27460
|
}
|
|
26899
27461
|
async function orchestrateWorktreeCompleteOp(params) {
|
|
26900
|
-
return handleWorktreeComplete(params.taskId,
|
|
27462
|
+
return handleWorktreeComplete(params.taskId, getProjectRoot11(), params.resolve);
|
|
26901
27463
|
}
|
|
26902
27464
|
async function orchestrateWorktreeCleanupOp(params) {
|
|
26903
|
-
return handleWorktreeCleanup(
|
|
27465
|
+
return handleWorktreeCleanup(getProjectRoot11(), params.taskIds);
|
|
26904
27466
|
}
|
|
26905
27467
|
async function orchestrateWorktreePruneOp(params) {
|
|
26906
|
-
return handleWorktreePrune(
|
|
27468
|
+
return handleWorktreePrune(getProjectRoot11(), params.taskId);
|
|
26907
27469
|
}
|
|
26908
27470
|
async function orchestrateParallelOp(params) {
|
|
26909
27471
|
return Promise.resolve({ success: true, data: params });
|
|
26910
27472
|
}
|
|
26911
27473
|
async function orchestrateFanoutOp(params) {
|
|
26912
|
-
return orchestrateFanoutImpl(params.items,
|
|
27474
|
+
return orchestrateFanoutImpl(params.items, getProjectRoot11());
|
|
26913
27475
|
}
|
|
26914
27476
|
async function orchestrateTesseraInstantiateOp(params) {
|
|
26915
27477
|
return Promise.resolve({ success: true, data: params });
|
|
@@ -27684,7 +28246,8 @@ var init_orchestrate2 = __esm({
|
|
|
27684
28246
|
taskId: params.taskId,
|
|
27685
28247
|
protocolType: params.protocolType,
|
|
27686
28248
|
tier,
|
|
27687
|
-
noWorktree: params.noWorktree
|
|
28249
|
+
noWorktree: params.noWorktree,
|
|
28250
|
+
spawnScope: params.spawnScope
|
|
27688
28251
|
};
|
|
27689
28252
|
return wrapResult(await coreOps2.spawn(p), "mutate", "orchestrate", operation, startTime);
|
|
27690
28253
|
}
|
|
@@ -27885,7 +28448,7 @@ var init_orchestrate2 = __esm({
|
|
|
27885
28448
|
startTime
|
|
27886
28449
|
);
|
|
27887
28450
|
return wrapResult(
|
|
27888
|
-
await orchestrateParallelStart(epicId, wave,
|
|
28451
|
+
await orchestrateParallelStart(epicId, wave, getProjectRoot11()),
|
|
27889
28452
|
"mutate",
|
|
27890
28453
|
"orchestrate",
|
|
27891
28454
|
"parallel",
|
|
@@ -27914,7 +28477,7 @@ var init_orchestrate2 = __esm({
|
|
|
27914
28477
|
startTime
|
|
27915
28478
|
);
|
|
27916
28479
|
return wrapResult(
|
|
27917
|
-
await orchestrateParallelEnd(epicId, wave,
|
|
28480
|
+
await orchestrateParallelEnd(epicId, wave, getProjectRoot11()),
|
|
27918
28481
|
"mutate",
|
|
27919
28482
|
"orchestrate",
|
|
27920
28483
|
"parallel",
|
|
@@ -27981,7 +28544,7 @@ var init_orchestrate2 = __esm({
|
|
|
27981
28544
|
epicId,
|
|
27982
28545
|
variables: { epicId, ...variables }
|
|
27983
28546
|
},
|
|
27984
|
-
|
|
28547
|
+
getProjectRoot11()
|
|
27985
28548
|
);
|
|
27986
28549
|
return {
|
|
27987
28550
|
meta: dispatchMeta("mutate", "orchestrate", operation, startTime),
|
|
@@ -28074,7 +28637,7 @@ import {
|
|
|
28074
28637
|
describeChannel,
|
|
28075
28638
|
formatStageGuidance,
|
|
28076
28639
|
getLogger as getLogger10,
|
|
28077
|
-
getProjectRoot as
|
|
28640
|
+
getProjectRoot as getProjectRoot12,
|
|
28078
28641
|
isValidStage,
|
|
28079
28642
|
listChains,
|
|
28080
28643
|
paginate as paginate3,
|
|
@@ -28082,19 +28645,19 @@ import {
|
|
|
28082
28645
|
showChain
|
|
28083
28646
|
} from "@cleocode/core/internal";
|
|
28084
28647
|
async function stageValidateOp(params) {
|
|
28085
|
-
return lifecycleCheck(params.epicId, params.targetStage,
|
|
28648
|
+
return lifecycleCheck(params.epicId, params.targetStage, getProjectRoot12());
|
|
28086
28649
|
}
|
|
28087
28650
|
async function stageStatusOp(params) {
|
|
28088
|
-
return lifecycleStatus(params.epicId,
|
|
28651
|
+
return lifecycleStatus(params.epicId, getProjectRoot12());
|
|
28089
28652
|
}
|
|
28090
28653
|
async function stageHistoryOp(params) {
|
|
28091
|
-
return lifecycleHistory(params.taskId,
|
|
28654
|
+
return lifecycleHistory(params.taskId, getProjectRoot12());
|
|
28092
28655
|
}
|
|
28093
28656
|
async function stageGuidanceOp(params) {
|
|
28094
28657
|
let stage = params.stage;
|
|
28095
28658
|
const epicId = params.epicId;
|
|
28096
28659
|
const format = params.format ?? "markdown";
|
|
28097
|
-
const projectRoot =
|
|
28660
|
+
const projectRoot = getProjectRoot12();
|
|
28098
28661
|
if (!stage && epicId) {
|
|
28099
28662
|
const statusResult = await lifecycleStatus(epicId, projectRoot);
|
|
28100
28663
|
if (statusResult.success) {
|
|
@@ -28110,14 +28673,14 @@ async function stageRecordOp(params) {
|
|
|
28110
28673
|
params.stage,
|
|
28111
28674
|
params.status,
|
|
28112
28675
|
params.notes,
|
|
28113
|
-
|
|
28676
|
+
getProjectRoot12()
|
|
28114
28677
|
);
|
|
28115
28678
|
}
|
|
28116
28679
|
async function stageSkipOp(params) {
|
|
28117
|
-
return lifecycleSkip(params.taskId, params.stage, params.reason,
|
|
28680
|
+
return lifecycleSkip(params.taskId, params.stage, params.reason, getProjectRoot12());
|
|
28118
28681
|
}
|
|
28119
28682
|
async function stageResetOp(params) {
|
|
28120
|
-
return lifecycleReset(params.taskId, params.stage, params.reason,
|
|
28683
|
+
return lifecycleReset(params.taskId, params.stage, params.reason, getProjectRoot12());
|
|
28121
28684
|
}
|
|
28122
28685
|
async function stageGatePassOp(params) {
|
|
28123
28686
|
return lifecycleGatePass(
|
|
@@ -28125,24 +28688,24 @@ async function stageGatePassOp(params) {
|
|
|
28125
28688
|
params.gateName,
|
|
28126
28689
|
params.agent,
|
|
28127
28690
|
params.notes,
|
|
28128
|
-
|
|
28691
|
+
getProjectRoot12()
|
|
28129
28692
|
);
|
|
28130
28693
|
}
|
|
28131
28694
|
async function stageGateFailOp(params) {
|
|
28132
|
-
return lifecycleGateFail(params.taskId, params.gateName, params.reason,
|
|
28695
|
+
return lifecycleGateFail(params.taskId, params.gateName, params.reason, getProjectRoot12());
|
|
28133
28696
|
}
|
|
28134
28697
|
async function releaseListOp(params) {
|
|
28135
28698
|
return releaseList(
|
|
28136
28699
|
{ status: params.status, limit: params.limit, offset: params.offset },
|
|
28137
|
-
|
|
28700
|
+
getProjectRoot12()
|
|
28138
28701
|
);
|
|
28139
28702
|
}
|
|
28140
28703
|
async function releaseShowOp(params) {
|
|
28141
|
-
return releaseShow(params.version,
|
|
28704
|
+
return releaseShow(params.version, getProjectRoot12());
|
|
28142
28705
|
}
|
|
28143
28706
|
async function releaseChannelShowOp(_params) {
|
|
28144
28707
|
let currentBranch = "unknown";
|
|
28145
|
-
const projectRoot =
|
|
28708
|
+
const projectRoot = getProjectRoot12();
|
|
28146
28709
|
try {
|
|
28147
28710
|
currentBranch = execFileSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
28148
28711
|
encoding: "utf-8",
|
|
@@ -28160,52 +28723,52 @@ async function releaseChannelShowOp(_params) {
|
|
|
28160
28723
|
};
|
|
28161
28724
|
}
|
|
28162
28725
|
async function releasePrStatusOp(params) {
|
|
28163
|
-
return releasePrStatus(params.version,
|
|
28726
|
+
return releasePrStatus(params.version, getProjectRoot12());
|
|
28164
28727
|
}
|
|
28165
28728
|
async function releaseCancelOp(params) {
|
|
28166
|
-
return releaseCancel(params.version,
|
|
28729
|
+
return releaseCancel(params.version, getProjectRoot12());
|
|
28167
28730
|
}
|
|
28168
28731
|
async function releaseRollbackOp(params) {
|
|
28169
|
-
return releaseRollback(params.version, params.reason,
|
|
28732
|
+
return releaseRollback(params.version, params.reason, getProjectRoot12());
|
|
28170
28733
|
}
|
|
28171
28734
|
async function releaseRollbackFullOp(params) {
|
|
28172
28735
|
return releaseRollbackFull(
|
|
28173
28736
|
params.version,
|
|
28174
28737
|
{ reason: params.reason, force: params.force, unpublish: params.unpublish },
|
|
28175
|
-
|
|
28738
|
+
getProjectRoot12()
|
|
28176
28739
|
);
|
|
28177
28740
|
}
|
|
28178
28741
|
async function manifestShowOp(params) {
|
|
28179
|
-
return pipelineManifestShow(params.entryId,
|
|
28742
|
+
return pipelineManifestShow(params.entryId, getProjectRoot12());
|
|
28180
28743
|
}
|
|
28181
28744
|
async function manifestListOp(params) {
|
|
28182
|
-
return pipelineManifestList(params,
|
|
28745
|
+
return pipelineManifestList(params, getProjectRoot12());
|
|
28183
28746
|
}
|
|
28184
28747
|
async function manifestFindOp(params) {
|
|
28185
28748
|
return pipelineManifestFind(
|
|
28186
28749
|
params.query,
|
|
28187
28750
|
{ confidence: params.confidence, limit: params.limit },
|
|
28188
|
-
|
|
28751
|
+
getProjectRoot12()
|
|
28189
28752
|
);
|
|
28190
28753
|
}
|
|
28191
28754
|
async function manifestStatsOp(params) {
|
|
28192
|
-
return pipelineManifestStats(params.epicId,
|
|
28755
|
+
return pipelineManifestStats(params.epicId, getProjectRoot12());
|
|
28193
28756
|
}
|
|
28194
28757
|
async function manifestAppendOp(params) {
|
|
28195
|
-
return pipelineManifestAppend(params.entry,
|
|
28758
|
+
return pipelineManifestAppend(params.entry, getProjectRoot12());
|
|
28196
28759
|
}
|
|
28197
28760
|
async function manifestArchiveOp(params) {
|
|
28198
|
-
return pipelineManifestArchive(params.beforeDate,
|
|
28761
|
+
return pipelineManifestArchive(params.beforeDate, getProjectRoot12());
|
|
28199
28762
|
}
|
|
28200
28763
|
async function phaseShowOp(params) {
|
|
28201
|
-
return phaseShow(params.phaseId,
|
|
28764
|
+
return phaseShow(params.phaseId, getProjectRoot12());
|
|
28202
28765
|
}
|
|
28203
28766
|
async function phaseListOp(_params) {
|
|
28204
|
-
return phaseList(
|
|
28767
|
+
return phaseList(getProjectRoot12());
|
|
28205
28768
|
}
|
|
28206
28769
|
async function phaseSetOp(params) {
|
|
28207
28770
|
const { phaseId, action, rollback, force, dryRun } = params;
|
|
28208
|
-
const projectRoot =
|
|
28771
|
+
const projectRoot = getProjectRoot12();
|
|
28209
28772
|
if (action === "start") {
|
|
28210
28773
|
return phaseStart(phaseId, projectRoot);
|
|
28211
28774
|
}
|
|
@@ -28215,28 +28778,28 @@ async function phaseSetOp(params) {
|
|
|
28215
28778
|
return phaseSet({ phaseId, rollback, force, dryRun }, projectRoot);
|
|
28216
28779
|
}
|
|
28217
28780
|
async function phaseAdvanceOp(params) {
|
|
28218
|
-
return phaseAdvance(params.force,
|
|
28781
|
+
return phaseAdvance(params.force, getProjectRoot12());
|
|
28219
28782
|
}
|
|
28220
28783
|
async function phaseRenameOp(params) {
|
|
28221
|
-
return phaseRename(params.oldName, params.newName,
|
|
28784
|
+
return phaseRename(params.oldName, params.newName, getProjectRoot12());
|
|
28222
28785
|
}
|
|
28223
28786
|
async function phaseDeleteOp(params) {
|
|
28224
28787
|
return phaseDelete(
|
|
28225
28788
|
params.phaseId,
|
|
28226
28789
|
{ reassignTo: params.reassignTo, force: params.force },
|
|
28227
|
-
|
|
28790
|
+
getProjectRoot12()
|
|
28228
28791
|
);
|
|
28229
28792
|
}
|
|
28230
28793
|
async function chainShowOp(params) {
|
|
28231
|
-
const chain = await showChain(params.chainId,
|
|
28794
|
+
const chain = await showChain(params.chainId, getProjectRoot12());
|
|
28232
28795
|
return { _chain: chain, _chainId: params.chainId };
|
|
28233
28796
|
}
|
|
28234
28797
|
async function chainListOp(_params) {
|
|
28235
|
-
const chains = await listChains(
|
|
28798
|
+
const chains = await listChains(getProjectRoot12());
|
|
28236
28799
|
return { _chains: chains };
|
|
28237
28800
|
}
|
|
28238
28801
|
async function chainAddOp(params) {
|
|
28239
|
-
await addChain(params.chain,
|
|
28802
|
+
await addChain(params.chain, getProjectRoot12());
|
|
28240
28803
|
return { id: params.chain.id };
|
|
28241
28804
|
}
|
|
28242
28805
|
async function chainInstantiateOp(params) {
|
|
@@ -28247,7 +28810,7 @@ async function chainInstantiateOp(params) {
|
|
|
28247
28810
|
variables: params.variables,
|
|
28248
28811
|
stageToTask: params.stageToTask
|
|
28249
28812
|
},
|
|
28250
|
-
|
|
28813
|
+
getProjectRoot12()
|
|
28251
28814
|
);
|
|
28252
28815
|
}
|
|
28253
28816
|
async function chainAdvanceOp(params) {
|
|
@@ -28255,7 +28818,7 @@ async function chainAdvanceOp(params) {
|
|
|
28255
28818
|
params.instanceId,
|
|
28256
28819
|
params.nextStage,
|
|
28257
28820
|
params.gateResults ?? [],
|
|
28258
|
-
|
|
28821
|
+
getProjectRoot12()
|
|
28259
28822
|
);
|
|
28260
28823
|
}
|
|
28261
28824
|
function pipelinePhaseListResponse(envelope, params, operation, startTime) {
|
|
@@ -28773,7 +29336,7 @@ var init_pipeline3 = __esm({
|
|
|
28773
29336
|
// packages/cleo/src/dispatch/domains/provenance.ts
|
|
28774
29337
|
import {
|
|
28775
29338
|
getLogger as getLogger11,
|
|
28776
|
-
getProjectRoot as
|
|
29339
|
+
getProjectRoot as getProjectRoot13,
|
|
28777
29340
|
provenanceBackfill,
|
|
28778
29341
|
verifyProvenance
|
|
28779
29342
|
} from "@cleocode/core/internal";
|
|
@@ -28818,7 +29381,7 @@ var init_provenance = __esm({
|
|
|
28818
29381
|
...version ? { version } : {},
|
|
28819
29382
|
all,
|
|
28820
29383
|
...limit !== void 0 ? { limit } : {},
|
|
28821
|
-
projectRoot:
|
|
29384
|
+
projectRoot: getProjectRoot13()
|
|
28822
29385
|
});
|
|
28823
29386
|
return wrapResult(result, "query", "provenance", operation, startTime);
|
|
28824
29387
|
}
|
|
@@ -28864,7 +29427,7 @@ var init_provenance = __esm({
|
|
|
28864
29427
|
const resetCheckpoint = typeof params?.["resetCheckpoint"] === "boolean" ? params["resetCheckpoint"] : false;
|
|
28865
29428
|
const result = await provenanceBackfill({
|
|
28866
29429
|
since,
|
|
28867
|
-
projectRoot:
|
|
29430
|
+
projectRoot: getProjectRoot13(),
|
|
28868
29431
|
forceOverwrite,
|
|
28869
29432
|
dryRun,
|
|
28870
29433
|
resetCheckpoint
|
|
@@ -28894,12 +29457,12 @@ var init_provenance = __esm({
|
|
|
28894
29457
|
});
|
|
28895
29458
|
|
|
28896
29459
|
// packages/cleo/src/dispatch/domains/release.ts
|
|
28897
|
-
import { getLogger as getLogger12, getProjectRoot as
|
|
29460
|
+
import { getLogger as getLogger12, getProjectRoot as getProjectRoot14 } from "@cleocode/core/internal";
|
|
28898
29461
|
async function releaseGateOp(params) {
|
|
28899
|
-
return releaseGateCheck(params.epicId, params.force ?? false,
|
|
29462
|
+
return releaseGateCheck(params.epicId, params.force ?? false, getProjectRoot14());
|
|
28900
29463
|
}
|
|
28901
29464
|
async function releaseIvtrSuggestOp(params) {
|
|
28902
|
-
return releaseIvtrAutoSuggest(params.taskId,
|
|
29465
|
+
return releaseIvtrAutoSuggest(params.taskId, getProjectRoot14());
|
|
28903
29466
|
}
|
|
28904
29467
|
var log3, coreOps4, ReleaseHandler;
|
|
28905
29468
|
var init_release2 = __esm({
|
|
@@ -29076,7 +29639,7 @@ var init_release2 = __esm({
|
|
|
29076
29639
|
hotfix: typeof params?.hotfix === "boolean" ? params.hotfix : false,
|
|
29077
29640
|
dryRun: typeof params?.dryRun === "boolean" ? params.dryRun : false,
|
|
29078
29641
|
writeChangelog: typeof params?.writeChangelog === "boolean" ? params.writeChangelog : true,
|
|
29079
|
-
projectRoot:
|
|
29642
|
+
projectRoot: getProjectRoot14()
|
|
29080
29643
|
};
|
|
29081
29644
|
return wrapResult(await releasePlan(typed), "mutate", "release", operation, startTime);
|
|
29082
29645
|
}
|
|
@@ -29098,7 +29661,7 @@ var init_release2 = __esm({
|
|
|
29098
29661
|
workflow: typeof params?.workflow === "string" ? params.workflow : void 0,
|
|
29099
29662
|
watch: typeof params?.watch === "boolean" ? params.watch : false,
|
|
29100
29663
|
commitPlan: typeof params?.commitPlan === "boolean" ? params.commitPlan : false,
|
|
29101
|
-
projectRoot:
|
|
29664
|
+
projectRoot: getProjectRoot14()
|
|
29102
29665
|
};
|
|
29103
29666
|
return wrapResult(await releaseOpen(typed), "mutate", "release", operation, startTime);
|
|
29104
29667
|
}
|
|
@@ -29115,7 +29678,7 @@ var init_release2 = __esm({
|
|
|
29115
29678
|
startTime
|
|
29116
29679
|
);
|
|
29117
29680
|
const result = await releaseReconcileV2(version, {
|
|
29118
|
-
projectRoot:
|
|
29681
|
+
projectRoot: getProjectRoot14(),
|
|
29119
29682
|
fromWorkflow: typeof params?.fromWorkflow === "boolean" ? params.fromWorkflow : false,
|
|
29120
29683
|
rollback: typeof params?.rollback === "boolean" ? params.rollback : false
|
|
29121
29684
|
});
|
|
@@ -29144,7 +29707,7 @@ var init_release2 = __esm({
|
|
|
29144
29707
|
});
|
|
29145
29708
|
|
|
29146
29709
|
// packages/cleo/src/dispatch/domains/sentient.ts
|
|
29147
|
-
import { getProjectRoot as
|
|
29710
|
+
import { getProjectRoot as getProjectRoot15 } from "@cleocode/core";
|
|
29148
29711
|
import {
|
|
29149
29712
|
sentientAllowlistAdd,
|
|
29150
29713
|
sentientAllowlistList,
|
|
@@ -29157,23 +29720,23 @@ import {
|
|
|
29157
29720
|
sentientProposeReject,
|
|
29158
29721
|
sentientProposeRun
|
|
29159
29722
|
} from "@cleocode/core/sentient";
|
|
29160
|
-
var coreOps5, _sentientTypedHandler,
|
|
29723
|
+
var coreOps5, _sentientTypedHandler, QUERY_OPS8, MUTATE_OPS7, SentientHandler;
|
|
29161
29724
|
var init_sentient2 = __esm({
|
|
29162
29725
|
"packages/cleo/src/dispatch/domains/sentient.ts"() {
|
|
29163
29726
|
"use strict";
|
|
29164
29727
|
init_typed();
|
|
29165
29728
|
init_base();
|
|
29166
29729
|
coreOps5 = {
|
|
29167
|
-
"propose.list": (params) => sentientProposeList(
|
|
29168
|
-
"propose.diff": (params) => sentientProposeDiff(
|
|
29169
|
-
"allowlist.list": (params) => sentientAllowlistList(
|
|
29170
|
-
"propose.accept": (params) => sentientProposeAccept(
|
|
29171
|
-
"propose.reject": (params) => sentientProposeReject(
|
|
29172
|
-
"propose.run": (params) => sentientProposeRun(
|
|
29173
|
-
"propose.enable": (params) => sentientProposeEnable(
|
|
29174
|
-
"propose.disable": (params) => sentientProposeDisable(
|
|
29175
|
-
"allowlist.add": (params) => sentientAllowlistAdd(
|
|
29176
|
-
"allowlist.remove": (params) => sentientAllowlistRemove(
|
|
29730
|
+
"propose.list": (params) => sentientProposeList(getProjectRoot15(), params),
|
|
29731
|
+
"propose.diff": (params) => sentientProposeDiff(getProjectRoot15(), params),
|
|
29732
|
+
"allowlist.list": (params) => sentientAllowlistList(getProjectRoot15(), params),
|
|
29733
|
+
"propose.accept": (params) => sentientProposeAccept(getProjectRoot15(), params),
|
|
29734
|
+
"propose.reject": (params) => sentientProposeReject(getProjectRoot15(), params),
|
|
29735
|
+
"propose.run": (params) => sentientProposeRun(getProjectRoot15(), params),
|
|
29736
|
+
"propose.enable": (params) => sentientProposeEnable(getProjectRoot15(), params),
|
|
29737
|
+
"propose.disable": (params) => sentientProposeDisable(getProjectRoot15(), params),
|
|
29738
|
+
"allowlist.add": (params) => sentientAllowlistAdd(getProjectRoot15(), params),
|
|
29739
|
+
"allowlist.remove": (params) => sentientAllowlistRemove(getProjectRoot15(), params)
|
|
29177
29740
|
};
|
|
29178
29741
|
_sentientTypedHandler = defineTypedHandler("sentient", {
|
|
29179
29742
|
// -------------------------------------------------------------------------
|
|
@@ -29277,7 +29840,7 @@ var init_sentient2 = __esm({
|
|
|
29277
29840
|
}
|
|
29278
29841
|
}
|
|
29279
29842
|
});
|
|
29280
|
-
|
|
29843
|
+
QUERY_OPS8 = /* @__PURE__ */ new Set(["propose.list", "propose.diff", "allowlist.list"]);
|
|
29281
29844
|
MUTATE_OPS7 = /* @__PURE__ */ new Set([
|
|
29282
29845
|
"propose.accept",
|
|
29283
29846
|
"propose.reject",
|
|
@@ -29311,7 +29874,7 @@ var init_sentient2 = __esm({
|
|
|
29311
29874
|
*/
|
|
29312
29875
|
async query(operation, params) {
|
|
29313
29876
|
const startTime = Date.now();
|
|
29314
|
-
if (!
|
|
29877
|
+
if (!QUERY_OPS8.has(operation)) {
|
|
29315
29878
|
return unsupportedOp("query", "sentient", operation, startTime);
|
|
29316
29879
|
}
|
|
29317
29880
|
try {
|
|
@@ -29406,31 +29969,31 @@ var init_session_context = __esm({
|
|
|
29406
29969
|
import {
|
|
29407
29970
|
getDb,
|
|
29408
29971
|
getLogger as getLogger13,
|
|
29409
|
-
getProjectRoot as
|
|
29972
|
+
getProjectRoot as getProjectRoot16,
|
|
29410
29973
|
lintSessionForCanonViolations,
|
|
29411
29974
|
sessions
|
|
29412
29975
|
} from "@cleocode/core/internal";
|
|
29413
29976
|
import { eq } from "drizzle-orm";
|
|
29414
29977
|
async function sessionStatusOp() {
|
|
29415
|
-
return sessionStatus(
|
|
29978
|
+
return sessionStatus(getProjectRoot16());
|
|
29416
29979
|
}
|
|
29417
29980
|
async function sessionListOp(params) {
|
|
29418
|
-
return sessionList(
|
|
29981
|
+
return sessionList(getProjectRoot16(), params);
|
|
29419
29982
|
}
|
|
29420
29983
|
async function sessionShowOp(params) {
|
|
29421
29984
|
if (params.include === "debrief") {
|
|
29422
|
-
return sessionDebriefShow(
|
|
29985
|
+
return sessionDebriefShow(getProjectRoot16(), params.sessionId);
|
|
29423
29986
|
}
|
|
29424
|
-
return sessionShow(
|
|
29987
|
+
return sessionShow(getProjectRoot16(), params.sessionId);
|
|
29425
29988
|
}
|
|
29426
29989
|
async function sessionFindOp(params) {
|
|
29427
|
-
return sessionFind(
|
|
29990
|
+
return sessionFind(getProjectRoot16(), params);
|
|
29428
29991
|
}
|
|
29429
29992
|
async function sessionDecisionLogOp(params) {
|
|
29430
|
-
return sessionDecisionLog(
|
|
29993
|
+
return sessionDecisionLog(getProjectRoot16(), params);
|
|
29431
29994
|
}
|
|
29432
29995
|
async function sessionContextDriftOp(params) {
|
|
29433
|
-
return sessionContextDrift(
|
|
29996
|
+
return sessionContextDrift(getProjectRoot16(), params);
|
|
29434
29997
|
}
|
|
29435
29998
|
async function sessionHandoffShowOp(params) {
|
|
29436
29999
|
let scopeFilter;
|
|
@@ -29441,33 +30004,36 @@ async function sessionHandoffShowOp(params) {
|
|
|
29441
30004
|
scopeFilter = { type: "epic", epicId: params.scope.replace("epic:", "") };
|
|
29442
30005
|
}
|
|
29443
30006
|
}
|
|
29444
|
-
return sessionHandoff(
|
|
30007
|
+
return sessionHandoff(getProjectRoot16(), scopeFilter);
|
|
29445
30008
|
}
|
|
29446
30009
|
async function sessionBriefingShowOp(params) {
|
|
29447
|
-
return sessionBriefing(
|
|
30010
|
+
return sessionBriefing(getProjectRoot16(), params);
|
|
29448
30011
|
}
|
|
29449
30012
|
async function sessionStartOp(params) {
|
|
29450
|
-
return sessionStart(
|
|
30013
|
+
return sessionStart(getProjectRoot16(), params);
|
|
29451
30014
|
}
|
|
29452
30015
|
async function sessionEndOp(params) {
|
|
29453
|
-
return sessionEnd(
|
|
30016
|
+
return sessionEnd(getProjectRoot16(), params.note, {
|
|
29454
30017
|
sessionSummary: params.sessionSummary
|
|
29455
30018
|
});
|
|
29456
30019
|
}
|
|
29457
30020
|
async function sessionResumeOp(params) {
|
|
29458
|
-
return sessionResume(
|
|
30021
|
+
return sessionResume(getProjectRoot16(), params.sessionId);
|
|
29459
30022
|
}
|
|
29460
30023
|
async function sessionSuspendOp(params) {
|
|
29461
|
-
return sessionSuspend(
|
|
30024
|
+
return sessionSuspend(getProjectRoot16(), params.sessionId, params.reason);
|
|
29462
30025
|
}
|
|
29463
30026
|
async function sessionGcOp(params) {
|
|
29464
|
-
return sessionGc(
|
|
30027
|
+
return sessionGc(getProjectRoot16(), params.maxAgeDays);
|
|
29465
30028
|
}
|
|
29466
30029
|
async function sessionRecordDecisionOp(params) {
|
|
29467
|
-
return sessionRecordDecision(
|
|
30030
|
+
return sessionRecordDecision(getProjectRoot16(), params);
|
|
29468
30031
|
}
|
|
29469
30032
|
async function sessionRecordAssumptionOp(params) {
|
|
29470
|
-
return sessionRecordAssumption(
|
|
30033
|
+
return sessionRecordAssumption(getProjectRoot16(), params);
|
|
30034
|
+
}
|
|
30035
|
+
async function sessionAdoptOp(params) {
|
|
30036
|
+
return sessionAdopt(getProjectRoot16(), params.sessionId);
|
|
29471
30037
|
}
|
|
29472
30038
|
async function sessionLintOp(params) {
|
|
29473
30039
|
if (!params.transcript) {
|
|
@@ -29479,7 +30045,7 @@ async function sessionLintOp(params) {
|
|
|
29479
30045
|
try {
|
|
29480
30046
|
const result = lintSessionForCanonViolations({
|
|
29481
30047
|
transcriptPath: params.transcript,
|
|
29482
|
-
projectRoot:
|
|
30048
|
+
projectRoot: getProjectRoot16()
|
|
29483
30049
|
});
|
|
29484
30050
|
const wireResult = {
|
|
29485
30051
|
transcriptPath: result.transcriptPath,
|
|
@@ -29516,7 +30082,7 @@ async function storeSessionOwnerAuthToken(projectRoot, sessionId, token) {
|
|
|
29516
30082
|
const db = await getDb(projectRoot);
|
|
29517
30083
|
db.update(sessions).set({ ownerAuthToken: token }).where(eq(sessions.id, sessionId)).run();
|
|
29518
30084
|
}
|
|
29519
|
-
var coreOps6, _sessionTypedHandler,
|
|
30085
|
+
var coreOps6, _sessionTypedHandler, QUERY_OPS9, MUTATE_OPS8, SessionHandler;
|
|
29520
30086
|
var init_session3 = __esm({
|
|
29521
30087
|
"packages/cleo/src/dispatch/domains/session.ts"() {
|
|
29522
30088
|
"use strict";
|
|
@@ -29540,7 +30106,9 @@ var init_session3 = __esm({
|
|
|
29540
30106
|
gc: sessionGcOp,
|
|
29541
30107
|
"record.decision": sessionRecordDecisionOp,
|
|
29542
30108
|
"record.assumption": sessionRecordAssumptionOp,
|
|
29543
|
-
lint: sessionLintOp
|
|
30109
|
+
lint: sessionLintOp,
|
|
30110
|
+
// T9975 — per-agent session isolation
|
|
30111
|
+
adopt: sessionAdoptOp
|
|
29544
30112
|
};
|
|
29545
30113
|
_sessionTypedHandler = defineTypedHandler("session", {
|
|
29546
30114
|
// -------------------------------------------------------------------------
|
|
@@ -29600,7 +30168,7 @@ var init_session3 = __esm({
|
|
|
29600
30168
|
// SSoT-EXEMPT: storeOwnerAuthToken (DB side-effect requiring post-create sessionId),
|
|
29601
30169
|
// bindSession (process-scoped context, requires scope-string parsing) — ADR-058
|
|
29602
30170
|
start: async (params) => {
|
|
29603
|
-
const projectRoot =
|
|
30171
|
+
const projectRoot = getProjectRoot16();
|
|
29604
30172
|
if (!params.scope) {
|
|
29605
30173
|
return lafsError("E_INVALID_INPUT", "scope is required", "start");
|
|
29606
30174
|
}
|
|
@@ -29649,7 +30217,7 @@ var init_session3 = __esm({
|
|
|
29649
30217
|
// SSoT-EXEMPT: orchestrated post-op pipeline — sessionComputeDebrief, persistSessionMemory,
|
|
29650
30218
|
// unbindSession (process-context teardown), refreshMemoryBridge — ADR-058
|
|
29651
30219
|
end: async (params) => {
|
|
29652
|
-
const projectRoot =
|
|
30220
|
+
const projectRoot = getProjectRoot16();
|
|
29653
30221
|
const endResult = await coreOps6.end(params);
|
|
29654
30222
|
if (!endResult.success) {
|
|
29655
30223
|
return lafsError(
|
|
@@ -29748,9 +30316,27 @@ var init_session3 = __esm({
|
|
|
29748
30316
|
return lafsError("E_INTERNAL", "session.lint returned no data", "lint");
|
|
29749
30317
|
}
|
|
29750
30318
|
return lafsSuccess(result.data, "lint");
|
|
30319
|
+
},
|
|
30320
|
+
// T9975 — per-agent session isolation: adopt rebinds env to a specific session.
|
|
30321
|
+
adopt: async (params) => {
|
|
30322
|
+
if (!params.sessionId) {
|
|
30323
|
+
return lafsError("E_INVALID_INPUT", "sessionId is required", "adopt");
|
|
30324
|
+
}
|
|
30325
|
+
const result = await coreOps6.adopt(params);
|
|
30326
|
+
if (!result.success) {
|
|
30327
|
+
return lafsError(
|
|
30328
|
+
String(result.error?.code ?? "E_INTERNAL"),
|
|
30329
|
+
result.error?.message ?? "Unknown error",
|
|
30330
|
+
"adopt"
|
|
30331
|
+
);
|
|
30332
|
+
}
|
|
30333
|
+
if (!result.data) {
|
|
30334
|
+
return lafsError("E_INTERNAL", "session.adopt returned no data", "adopt");
|
|
30335
|
+
}
|
|
30336
|
+
return lafsSuccess(result.data, "adopt");
|
|
29751
30337
|
}
|
|
29752
30338
|
});
|
|
29753
|
-
|
|
30339
|
+
QUERY_OPS9 = /* @__PURE__ */ new Set([
|
|
29754
30340
|
"status",
|
|
29755
30341
|
"list",
|
|
29756
30342
|
"show",
|
|
@@ -29768,7 +30354,9 @@ var init_session3 = __esm({
|
|
|
29768
30354
|
"suspend",
|
|
29769
30355
|
"gc",
|
|
29770
30356
|
"record.decision",
|
|
29771
|
-
"record.assumption"
|
|
30357
|
+
"record.assumption",
|
|
30358
|
+
// T9975 — per-agent session isolation
|
|
30359
|
+
"adopt"
|
|
29772
30360
|
]);
|
|
29773
30361
|
SessionHandler = class {
|
|
29774
30362
|
// -----------------------------------------------------------------------
|
|
@@ -29782,7 +30370,7 @@ var init_session3 = __esm({
|
|
|
29782
30370
|
*/
|
|
29783
30371
|
async query(operation, params) {
|
|
29784
30372
|
const startTime = Date.now();
|
|
29785
|
-
if (!
|
|
30373
|
+
if (!QUERY_OPS9.has(operation)) {
|
|
29786
30374
|
return unsupportedOp("query", "session", operation, startTime);
|
|
29787
30375
|
}
|
|
29788
30376
|
try {
|
|
@@ -29859,7 +30447,7 @@ var init_session3 = __esm({
|
|
|
29859
30447
|
});
|
|
29860
30448
|
|
|
29861
30449
|
// packages/cleo/src/dispatch/domains/sticky.ts
|
|
29862
|
-
import { getLogger as getLogger14, getProjectRoot as
|
|
30450
|
+
import { getLogger as getLogger14, getProjectRoot as getProjectRoot17 } from "@cleocode/core";
|
|
29863
30451
|
import {
|
|
29864
30452
|
stickyAdd,
|
|
29865
30453
|
stickyArchive,
|
|
@@ -29873,7 +30461,7 @@ import {
|
|
|
29873
30461
|
} from "@cleocode/core/internal";
|
|
29874
30462
|
async function stickyListOp(params) {
|
|
29875
30463
|
return stickyListFiltered(
|
|
29876
|
-
|
|
30464
|
+
getProjectRoot17(),
|
|
29877
30465
|
{
|
|
29878
30466
|
status: params.status,
|
|
29879
30467
|
color: params.color,
|
|
@@ -29885,10 +30473,10 @@ async function stickyListOp(params) {
|
|
|
29885
30473
|
);
|
|
29886
30474
|
}
|
|
29887
30475
|
async function stickyShowOp(params) {
|
|
29888
|
-
return stickyShow(
|
|
30476
|
+
return stickyShow(getProjectRoot17(), params.stickyId);
|
|
29889
30477
|
}
|
|
29890
30478
|
async function stickyAddOp(params) {
|
|
29891
|
-
return stickyAdd(
|
|
30479
|
+
return stickyAdd(getProjectRoot17(), {
|
|
29892
30480
|
content: params.content,
|
|
29893
30481
|
tags: params.tags,
|
|
29894
30482
|
color: params.color,
|
|
@@ -29896,24 +30484,24 @@ async function stickyAddOp(params) {
|
|
|
29896
30484
|
});
|
|
29897
30485
|
}
|
|
29898
30486
|
async function stickyArchiveOp(params) {
|
|
29899
|
-
return stickyArchive(
|
|
30487
|
+
return stickyArchive(getProjectRoot17(), params.stickyId);
|
|
29900
30488
|
}
|
|
29901
30489
|
async function stickyPurgeOp(params) {
|
|
29902
|
-
return stickyPurge(
|
|
30490
|
+
return stickyPurge(getProjectRoot17(), params.stickyId);
|
|
29903
30491
|
}
|
|
29904
30492
|
async function stickyConvertTaskOp(params) {
|
|
29905
|
-
const result = await stickyConvertToTask(
|
|
30493
|
+
const result = await stickyConvertToTask(getProjectRoot17(), params.stickyId, params.title);
|
|
29906
30494
|
if (!result.success) return { taskId: void 0 };
|
|
29907
30495
|
return { taskId: result.data.taskId };
|
|
29908
30496
|
}
|
|
29909
30497
|
async function stickyConvertMemoryOp(params) {
|
|
29910
|
-
const result = await stickyConvertToMemory(
|
|
30498
|
+
const result = await stickyConvertToMemory(getProjectRoot17(), params.stickyId, params.memoryType);
|
|
29911
30499
|
if (!result.success) return { memoryId: void 0 };
|
|
29912
30500
|
return { memoryId: result.data.memoryId };
|
|
29913
30501
|
}
|
|
29914
30502
|
async function stickyConvertSessionNoteOp(params) {
|
|
29915
30503
|
const result = await stickyConvertToSessionNote(
|
|
29916
|
-
|
|
30504
|
+
getProjectRoot17(),
|
|
29917
30505
|
params.stickyId,
|
|
29918
30506
|
params.sessionId
|
|
29919
30507
|
);
|
|
@@ -29921,7 +30509,7 @@ async function stickyConvertSessionNoteOp(params) {
|
|
|
29921
30509
|
return { sessionId: result.data.sessionId };
|
|
29922
30510
|
}
|
|
29923
30511
|
async function stickyConvertTaskNoteOp(params) {
|
|
29924
|
-
const result = await stickyConvertToTaskNote(
|
|
30512
|
+
const result = await stickyConvertToTaskNote(getProjectRoot17(), params.stickyId, params.taskId);
|
|
29925
30513
|
if (!result.success) return { taskId: void 0 };
|
|
29926
30514
|
return { taskId: result.data.taskId };
|
|
29927
30515
|
}
|
|
@@ -29944,7 +30532,7 @@ function envelopeToDispatch(envelope, gateway, operation, startTime) {
|
|
|
29944
30532
|
}
|
|
29945
30533
|
};
|
|
29946
30534
|
}
|
|
29947
|
-
var log4, stickyCoreOps, _stickyTypedHandler,
|
|
30535
|
+
var log4, stickyCoreOps, _stickyTypedHandler, QUERY_OPS10, MUTATE_OPS9, CONVERT_TARGET_TO_KEY, StickyHandler;
|
|
29948
30536
|
var init_sticky2 = __esm({
|
|
29949
30537
|
"packages/cleo/src/dispatch/domains/sticky.ts"() {
|
|
29950
30538
|
"use strict";
|
|
@@ -30022,7 +30610,7 @@ var init_sticky2 = __esm({
|
|
|
30022
30610
|
return data.taskId ? lafsSuccess(data, "convert.task_note") : lafsError("E_CONVERT_FAILED", "convert to task note failed", "convert.task_note");
|
|
30023
30611
|
}
|
|
30024
30612
|
});
|
|
30025
|
-
|
|
30613
|
+
QUERY_OPS10 = /* @__PURE__ */ new Set(["list", "show"]);
|
|
30026
30614
|
MUTATE_OPS9 = /* @__PURE__ */ new Set(["add", "convert", "archive", "purge"]);
|
|
30027
30615
|
CONVERT_TARGET_TO_KEY = {
|
|
30028
30616
|
task: "convert.task",
|
|
@@ -30033,7 +30621,7 @@ var init_sticky2 = __esm({
|
|
|
30033
30621
|
StickyHandler = class {
|
|
30034
30622
|
async query(operation, params) {
|
|
30035
30623
|
const startTime = Date.now();
|
|
30036
|
-
if (!
|
|
30624
|
+
if (!QUERY_OPS10.has(operation)) {
|
|
30037
30625
|
return unsupportedOp("query", "sticky", operation, startTime);
|
|
30038
30626
|
}
|
|
30039
30627
|
try {
|
|
@@ -30092,9 +30680,30 @@ var init_sticky2 = __esm({
|
|
|
30092
30680
|
});
|
|
30093
30681
|
|
|
30094
30682
|
// packages/cleo/src/dispatch/domains/tasks.ts
|
|
30095
|
-
import { getLogger as getLogger15, getProjectRoot as
|
|
30683
|
+
import { getLogger as getLogger15, getProjectRoot as getProjectRoot18 } from "@cleocode/core";
|
|
30684
|
+
import { createAttachmentStore as createAttachmentStore4 } from "@cleocode/core/internal";
|
|
30685
|
+
async function fetchTaskAttachments(projectRoot, taskId) {
|
|
30686
|
+
try {
|
|
30687
|
+
const store = createAttachmentStore4();
|
|
30688
|
+
const metas = await store.listByOwner("task", taskId, projectRoot);
|
|
30689
|
+
const entries = [];
|
|
30690
|
+
for (const meta of metas) {
|
|
30691
|
+
const extras = await store.getExtras(meta.id, projectRoot);
|
|
30692
|
+
const entry = {
|
|
30693
|
+
attachmentId: meta.id,
|
|
30694
|
+
kind: meta.attachment.kind,
|
|
30695
|
+
...extras?.slug != null ? { slug: extras.slug } : {},
|
|
30696
|
+
...extras?.type != null ? { type: extras.type } : {}
|
|
30697
|
+
};
|
|
30698
|
+
entries.push(entry);
|
|
30699
|
+
}
|
|
30700
|
+
return entries;
|
|
30701
|
+
} catch {
|
|
30702
|
+
return [];
|
|
30703
|
+
}
|
|
30704
|
+
}
|
|
30096
30705
|
async function sagaCreate(params) {
|
|
30097
|
-
const projectRoot =
|
|
30706
|
+
const projectRoot = getProjectRoot18();
|
|
30098
30707
|
const title = typeof params.title === "string" ? params.title : "";
|
|
30099
30708
|
const description = typeof params.description === "string" ? params.description : void 0;
|
|
30100
30709
|
const acceptance = Array.isArray(params.acceptance) ? params.acceptance : void 0;
|
|
@@ -30110,7 +30719,7 @@ async function sagaCreate(params) {
|
|
|
30110
30719
|
);
|
|
30111
30720
|
}
|
|
30112
30721
|
async function sagaAdd(params) {
|
|
30113
|
-
const projectRoot =
|
|
30722
|
+
const projectRoot = getProjectRoot18();
|
|
30114
30723
|
const sagaId = typeof params.sagaId === "string" ? params.sagaId : "";
|
|
30115
30724
|
const epicId = typeof params.epicId === "string" ? params.epicId : "";
|
|
30116
30725
|
if (!sagaId || !epicId) {
|
|
@@ -30148,7 +30757,7 @@ async function sagaAdd(params) {
|
|
|
30148
30757
|
return lafsSuccess({ sagaId, epicId, added: relResult.data?.added ?? true }, "saga.add");
|
|
30149
30758
|
}
|
|
30150
30759
|
async function sagaList() {
|
|
30151
|
-
const projectRoot =
|
|
30760
|
+
const projectRoot = getProjectRoot18();
|
|
30152
30761
|
const result = await taskList(projectRoot, { type: "epic", label: "saga" });
|
|
30153
30762
|
if (!result.success) {
|
|
30154
30763
|
return lafsError("E_GENERAL", result.error?.message ?? "Failed to list Sagas", "saga.list");
|
|
@@ -30161,7 +30770,7 @@ async function sagaList() {
|
|
|
30161
30770
|
return lafsSuccess({ sagas: topLevel, total: topLevel.length }, "saga.list");
|
|
30162
30771
|
}
|
|
30163
30772
|
async function sagaMembers(params) {
|
|
30164
|
-
const projectRoot =
|
|
30773
|
+
const projectRoot = getProjectRoot18();
|
|
30165
30774
|
const sagaId = typeof params.sagaId === "string" ? params.sagaId : "";
|
|
30166
30775
|
if (!sagaId) {
|
|
30167
30776
|
return lafsError("E_INVALID_INPUT", "sagaId is required", "saga.members");
|
|
@@ -30186,7 +30795,7 @@ async function sagaMembers(params) {
|
|
|
30186
30795
|
);
|
|
30187
30796
|
}
|
|
30188
30797
|
async function sagaRollup(params) {
|
|
30189
|
-
const projectRoot =
|
|
30798
|
+
const projectRoot = getProjectRoot18();
|
|
30190
30799
|
const sagaId = typeof params.sagaId === "string" ? params.sagaId : "";
|
|
30191
30800
|
if (!sagaId) {
|
|
30192
30801
|
return lafsError("E_INVALID_INPUT", "sagaId is required", "saga.rollup");
|
|
@@ -30226,7 +30835,7 @@ async function sagaRollup(params) {
|
|
|
30226
30835
|
"saga.rollup"
|
|
30227
30836
|
);
|
|
30228
30837
|
}
|
|
30229
|
-
var _tasksTypedHandler,
|
|
30838
|
+
var _tasksTypedHandler, QUERY_OPS11, MUTATE_OPS10, TasksHandler;
|
|
30230
30839
|
var init_tasks3 = __esm({
|
|
30231
30840
|
"packages/cleo/src/dispatch/domains/tasks.ts"() {
|
|
30232
30841
|
"use strict";
|
|
@@ -30238,17 +30847,29 @@ var init_tasks3 = __esm({
|
|
|
30238
30847
|
// Query ops
|
|
30239
30848
|
// -------------------------------------------------------------------------
|
|
30240
30849
|
show: async (params) => {
|
|
30241
|
-
const projectRoot =
|
|
30850
|
+
const projectRoot = getProjectRoot18();
|
|
30242
30851
|
if (params.ivtrHistory) {
|
|
30243
30852
|
return wrapCoreResult(await taskShowIvtrHistory(projectRoot, params.taskId), "show");
|
|
30244
30853
|
}
|
|
30245
30854
|
if (params.history) {
|
|
30246
30855
|
return wrapCoreResult(await taskShowWithHistory(projectRoot, params.taskId, true), "show");
|
|
30247
30856
|
}
|
|
30248
|
-
|
|
30857
|
+
const [coreResult, attachments] = await Promise.all([
|
|
30858
|
+
taskShow(projectRoot, params.taskId),
|
|
30859
|
+
fetchTaskAttachments(projectRoot, params.taskId)
|
|
30860
|
+
]);
|
|
30861
|
+
if (!coreResult.success) {
|
|
30862
|
+
return wrapCoreResult(coreResult, "show");
|
|
30863
|
+
}
|
|
30864
|
+
const showResult = {
|
|
30865
|
+
task: coreResult.data.task,
|
|
30866
|
+
view: coreResult.data.view,
|
|
30867
|
+
attachments
|
|
30868
|
+
};
|
|
30869
|
+
return { success: true, data: showResult };
|
|
30249
30870
|
},
|
|
30250
30871
|
list: async (params) => {
|
|
30251
|
-
const projectRoot =
|
|
30872
|
+
const projectRoot = getProjectRoot18();
|
|
30252
30873
|
const result = await taskList(projectRoot, {
|
|
30253
30874
|
parent: params.parent,
|
|
30254
30875
|
status: params.status,
|
|
@@ -30274,7 +30895,7 @@ var init_tasks3 = __esm({
|
|
|
30274
30895
|
return lafsSuccess(result.data, "list");
|
|
30275
30896
|
},
|
|
30276
30897
|
find: async (params) => {
|
|
30277
|
-
const projectRoot =
|
|
30898
|
+
const projectRoot = getProjectRoot18();
|
|
30278
30899
|
return wrapCoreResult(
|
|
30279
30900
|
await taskFind(projectRoot, params.query, params.limit, {
|
|
30280
30901
|
id: params.id,
|
|
@@ -30291,15 +30912,15 @@ var init_tasks3 = __esm({
|
|
|
30291
30912
|
);
|
|
30292
30913
|
},
|
|
30293
30914
|
tree: async (params) => {
|
|
30294
|
-
const projectRoot =
|
|
30915
|
+
const projectRoot = getProjectRoot18();
|
|
30295
30916
|
return wrapCoreResult(await taskTree(projectRoot, params.taskId, params.withBlockers), "tree");
|
|
30296
30917
|
},
|
|
30297
30918
|
blockers: async (params) => {
|
|
30298
|
-
const projectRoot =
|
|
30919
|
+
const projectRoot = getProjectRoot18();
|
|
30299
30920
|
return wrapCoreResult(await taskBlockers(projectRoot, params), "blockers");
|
|
30300
30921
|
},
|
|
30301
30922
|
depends: async (params) => {
|
|
30302
|
-
const projectRoot =
|
|
30923
|
+
const projectRoot = getProjectRoot18();
|
|
30303
30924
|
if (params.action === "overview") {
|
|
30304
30925
|
return wrapCoreResult(await taskDepsOverview(projectRoot), "depends");
|
|
30305
30926
|
}
|
|
@@ -30319,14 +30940,14 @@ var init_tasks3 = __esm({
|
|
|
30319
30940
|
);
|
|
30320
30941
|
},
|
|
30321
30942
|
"deps.validate": async (params) => {
|
|
30322
|
-
const projectRoot =
|
|
30943
|
+
const projectRoot = getProjectRoot18();
|
|
30323
30944
|
return wrapCoreResult(
|
|
30324
30945
|
await taskDepsValidate(projectRoot, params.epicId, params.scope),
|
|
30325
30946
|
"deps.validate"
|
|
30326
30947
|
);
|
|
30327
30948
|
},
|
|
30328
30949
|
"deps.tree": async (params) => {
|
|
30329
|
-
const projectRoot =
|
|
30950
|
+
const projectRoot = getProjectRoot18();
|
|
30330
30951
|
if (!params.epicId) {
|
|
30331
30952
|
return lafsError("E_INVALID_INPUT", "epicId is required for deps.tree", "deps.tree");
|
|
30332
30953
|
}
|
|
@@ -30336,29 +30957,29 @@ var init_tasks3 = __esm({
|
|
|
30336
30957
|
);
|
|
30337
30958
|
},
|
|
30338
30959
|
analyze: async (params) => {
|
|
30339
|
-
const projectRoot =
|
|
30960
|
+
const projectRoot = getProjectRoot18();
|
|
30340
30961
|
return wrapCoreResult(
|
|
30341
30962
|
await taskAnalyze(projectRoot, params.taskId, { tierLimit: params.tierLimit }),
|
|
30342
30963
|
"analyze"
|
|
30343
30964
|
);
|
|
30344
30965
|
},
|
|
30345
30966
|
impact: async (params) => {
|
|
30346
|
-
const projectRoot =
|
|
30967
|
+
const projectRoot = getProjectRoot18();
|
|
30347
30968
|
return wrapCoreResult(
|
|
30348
30969
|
await taskImpact(projectRoot, params.change, params.matchLimit),
|
|
30349
30970
|
"impact"
|
|
30350
30971
|
);
|
|
30351
30972
|
},
|
|
30352
30973
|
next: async (params) => {
|
|
30353
|
-
const projectRoot =
|
|
30974
|
+
const projectRoot = getProjectRoot18();
|
|
30354
30975
|
return wrapCoreResult(await taskNext(projectRoot, params), "next");
|
|
30355
30976
|
},
|
|
30356
30977
|
plan: async (_params) => {
|
|
30357
|
-
const projectRoot =
|
|
30978
|
+
const projectRoot = getProjectRoot18();
|
|
30358
30979
|
return wrapCoreResult(await taskPlan(projectRoot), "plan");
|
|
30359
30980
|
},
|
|
30360
30981
|
relates: async (params) => {
|
|
30361
|
-
const projectRoot =
|
|
30982
|
+
const projectRoot = getProjectRoot18();
|
|
30362
30983
|
if (params.mode) {
|
|
30363
30984
|
return wrapCoreResult(
|
|
30364
30985
|
await taskRelatesFind(projectRoot, params.taskId, {
|
|
@@ -30371,36 +30992,36 @@ var init_tasks3 = __esm({
|
|
|
30371
30992
|
return wrapCoreResult(await taskRelates(projectRoot, params.taskId), "relates");
|
|
30372
30993
|
},
|
|
30373
30994
|
"complexity.estimate": async (params) => {
|
|
30374
|
-
const projectRoot =
|
|
30995
|
+
const projectRoot = getProjectRoot18();
|
|
30375
30996
|
return wrapCoreResult(
|
|
30376
30997
|
await taskComplexityEstimate(projectRoot, { taskId: params.taskId }),
|
|
30377
30998
|
"complexity.estimate"
|
|
30378
30999
|
);
|
|
30379
31000
|
},
|
|
30380
31001
|
history: async (params) => {
|
|
30381
|
-
const projectRoot =
|
|
31002
|
+
const projectRoot = getProjectRoot18();
|
|
30382
31003
|
if (params.taskId) {
|
|
30383
31004
|
return wrapCoreResult(await taskHistory(projectRoot, params.taskId, params.limit), "history");
|
|
30384
31005
|
}
|
|
30385
31006
|
return wrapCoreResult(await taskWorkHistory(projectRoot), "history");
|
|
30386
31007
|
},
|
|
30387
31008
|
current: async (_params) => {
|
|
30388
|
-
const projectRoot =
|
|
31009
|
+
const projectRoot = getProjectRoot18();
|
|
30389
31010
|
return wrapCoreResult(await taskCurrentGet(projectRoot), "current");
|
|
30390
31011
|
},
|
|
30391
31012
|
"label.list": async (_params) => {
|
|
30392
|
-
const projectRoot =
|
|
31013
|
+
const projectRoot = getProjectRoot18();
|
|
30393
31014
|
return wrapCoreResult(await taskLabelList(projectRoot), "label.list");
|
|
30394
31015
|
},
|
|
30395
31016
|
"sync.links": async (params) => {
|
|
30396
|
-
const projectRoot =
|
|
31017
|
+
const projectRoot = getProjectRoot18();
|
|
30397
31018
|
return wrapCoreResult(await taskSyncLinks(projectRoot, params), "sync.links");
|
|
30398
31019
|
},
|
|
30399
31020
|
// -------------------------------------------------------------------------
|
|
30400
31021
|
// Mutate ops
|
|
30401
31022
|
// -------------------------------------------------------------------------
|
|
30402
31023
|
"add-batch": async (params) => {
|
|
30403
|
-
const projectRoot =
|
|
31024
|
+
const projectRoot = getProjectRoot18();
|
|
30404
31025
|
return wrapCoreResult(
|
|
30405
31026
|
await tasksAddBatchOp(projectRoot, {
|
|
30406
31027
|
tasks: params.tasks ?? [],
|
|
@@ -30411,7 +31032,7 @@ var init_tasks3 = __esm({
|
|
|
30411
31032
|
);
|
|
30412
31033
|
},
|
|
30413
31034
|
add: async (params) => {
|
|
30414
|
-
const projectRoot =
|
|
31035
|
+
const projectRoot = getProjectRoot18();
|
|
30415
31036
|
return wrapCoreResult(
|
|
30416
31037
|
await addTaskWithSessionScope(projectRoot, {
|
|
30417
31038
|
title: params.title,
|
|
@@ -30439,7 +31060,7 @@ var init_tasks3 = __esm({
|
|
|
30439
31060
|
);
|
|
30440
31061
|
},
|
|
30441
31062
|
update: async (params) => {
|
|
30442
|
-
const projectRoot =
|
|
31063
|
+
const projectRoot = getProjectRoot18();
|
|
30443
31064
|
return wrapCoreResult(
|
|
30444
31065
|
await taskUpdate(projectRoot, params.taskId, {
|
|
30445
31066
|
title: params.title,
|
|
@@ -30482,7 +31103,7 @@ var init_tasks3 = __esm({
|
|
|
30482
31103
|
);
|
|
30483
31104
|
},
|
|
30484
31105
|
complete: async (params) => {
|
|
30485
|
-
const projectRoot =
|
|
31106
|
+
const projectRoot = getProjectRoot18();
|
|
30486
31107
|
if (params.force !== void 0) {
|
|
30487
31108
|
return lafsError(
|
|
30488
31109
|
"E_FLAG_REMOVED",
|
|
@@ -30505,15 +31126,15 @@ var init_tasks3 = __esm({
|
|
|
30505
31126
|
return wrapCoreResult(result, "complete");
|
|
30506
31127
|
},
|
|
30507
31128
|
cancel: async (params) => {
|
|
30508
|
-
const projectRoot =
|
|
31129
|
+
const projectRoot = getProjectRoot18();
|
|
30509
31130
|
return wrapCoreResult(await taskCancel(projectRoot, params.taskId, params.reason), "cancel");
|
|
30510
31131
|
},
|
|
30511
31132
|
delete: async (params) => {
|
|
30512
|
-
const projectRoot =
|
|
31133
|
+
const projectRoot = getProjectRoot18();
|
|
30513
31134
|
return wrapCoreResult(await taskDelete(projectRoot, params.taskId, params.force), "delete");
|
|
30514
31135
|
},
|
|
30515
31136
|
archive: async (params) => {
|
|
30516
|
-
const projectRoot =
|
|
31137
|
+
const projectRoot = getProjectRoot18();
|
|
30517
31138
|
return wrapCoreResult(
|
|
30518
31139
|
await taskArchive(projectRoot, params.taskId, params.before, {
|
|
30519
31140
|
taskIds: params.taskIds,
|
|
@@ -30524,7 +31145,7 @@ var init_tasks3 = __esm({
|
|
|
30524
31145
|
);
|
|
30525
31146
|
},
|
|
30526
31147
|
restore: async (params) => {
|
|
30527
|
-
const projectRoot =
|
|
31148
|
+
const projectRoot = getProjectRoot18();
|
|
30528
31149
|
if (params.from === "done") {
|
|
30529
31150
|
return wrapCoreResult(
|
|
30530
31151
|
await taskReopen(projectRoot, params.taskId, {
|
|
@@ -30552,21 +31173,21 @@ var init_tasks3 = __esm({
|
|
|
30552
31173
|
);
|
|
30553
31174
|
},
|
|
30554
31175
|
reparent: async (params) => {
|
|
30555
|
-
const projectRoot =
|
|
31176
|
+
const projectRoot = getProjectRoot18();
|
|
30556
31177
|
return wrapCoreResult(
|
|
30557
31178
|
await taskReparent(projectRoot, params.taskId, params.newParentId ?? null),
|
|
30558
31179
|
"reparent"
|
|
30559
31180
|
);
|
|
30560
31181
|
},
|
|
30561
31182
|
reorder: async (params) => {
|
|
30562
|
-
const projectRoot =
|
|
31183
|
+
const projectRoot = getProjectRoot18();
|
|
30563
31184
|
return wrapCoreResult(
|
|
30564
31185
|
await taskReorder(projectRoot, params.taskId, params.position),
|
|
30565
31186
|
"reorder"
|
|
30566
31187
|
);
|
|
30567
31188
|
},
|
|
30568
31189
|
"relates.add": async (params) => {
|
|
30569
|
-
const projectRoot =
|
|
31190
|
+
const projectRoot = getProjectRoot18();
|
|
30570
31191
|
const relatedId = params.relatedId ?? params.targetId;
|
|
30571
31192
|
if (!relatedId) {
|
|
30572
31193
|
return lafsError("E_INVALID_INPUT", "relatedId (or targetId) is required", "relates.add");
|
|
@@ -30577,7 +31198,7 @@ var init_tasks3 = __esm({
|
|
|
30577
31198
|
);
|
|
30578
31199
|
},
|
|
30579
31200
|
"relates.remove": async (params) => {
|
|
30580
|
-
const projectRoot =
|
|
31201
|
+
const projectRoot = getProjectRoot18();
|
|
30581
31202
|
if (!params.relatedId) {
|
|
30582
31203
|
return lafsError("E_INVALID_INPUT", "relatedId is required", "relates.remove");
|
|
30583
31204
|
}
|
|
@@ -30587,15 +31208,15 @@ var init_tasks3 = __esm({
|
|
|
30587
31208
|
);
|
|
30588
31209
|
},
|
|
30589
31210
|
start: async (params) => {
|
|
30590
|
-
const projectRoot =
|
|
31211
|
+
const projectRoot = getProjectRoot18();
|
|
30591
31212
|
return wrapCoreResult(await taskStart(projectRoot, params.taskId), "start");
|
|
30592
31213
|
},
|
|
30593
31214
|
stop: async (_params) => {
|
|
30594
|
-
const projectRoot =
|
|
31215
|
+
const projectRoot = getProjectRoot18();
|
|
30595
31216
|
return wrapCoreResult(await taskStop(projectRoot), "stop");
|
|
30596
31217
|
},
|
|
30597
31218
|
"sync.reconcile": async (params) => {
|
|
30598
|
-
const projectRoot =
|
|
31219
|
+
const projectRoot = getProjectRoot18();
|
|
30599
31220
|
return wrapCoreResult(
|
|
30600
31221
|
await taskSyncReconcile(projectRoot, {
|
|
30601
31222
|
providerId: params.providerId,
|
|
@@ -30609,22 +31230,22 @@ var init_tasks3 = __esm({
|
|
|
30609
31230
|
);
|
|
30610
31231
|
},
|
|
30611
31232
|
"sync.links.remove": async (params) => {
|
|
30612
|
-
const projectRoot =
|
|
31233
|
+
const projectRoot = getProjectRoot18();
|
|
30613
31234
|
return wrapCoreResult(
|
|
30614
31235
|
await taskSyncLinksRemove(projectRoot, params.providerId),
|
|
30615
31236
|
"sync.links.remove"
|
|
30616
31237
|
);
|
|
30617
31238
|
},
|
|
30618
31239
|
claim: async (params) => {
|
|
30619
|
-
const projectRoot =
|
|
31240
|
+
const projectRoot = getProjectRoot18();
|
|
30620
31241
|
return wrapCoreResult(await taskClaim(projectRoot, params.taskId, params.agentId), "claim");
|
|
30621
31242
|
},
|
|
30622
31243
|
unclaim: async (params) => {
|
|
30623
|
-
const projectRoot =
|
|
31244
|
+
const projectRoot = getProjectRoot18();
|
|
30624
31245
|
return wrapCoreResult(await taskUnclaim(projectRoot, params.taskId), "unclaim");
|
|
30625
31246
|
}
|
|
30626
31247
|
});
|
|
30627
|
-
|
|
31248
|
+
QUERY_OPS11 = /* @__PURE__ */ new Set([
|
|
30628
31249
|
"show",
|
|
30629
31250
|
"list",
|
|
30630
31251
|
"find",
|
|
@@ -30683,7 +31304,7 @@ var init_tasks3 = __esm({
|
|
|
30683
31304
|
*/
|
|
30684
31305
|
async query(operation, params) {
|
|
30685
31306
|
const startTime = Date.now();
|
|
30686
|
-
if (!
|
|
31307
|
+
if (!QUERY_OPS11.has(operation)) {
|
|
30687
31308
|
return unsupportedOp("query", "tasks", operation, startTime);
|
|
30688
31309
|
}
|
|
30689
31310
|
if (operation === "impact" && !params?.change) {
|
|
@@ -30847,7 +31468,7 @@ var init_tasks3 = __esm({
|
|
|
30847
31468
|
});
|
|
30848
31469
|
|
|
30849
31470
|
// packages/cleo/src/dispatch/domains/tools.ts
|
|
30850
|
-
import { getLogger as getLogger16, getProjectRoot as
|
|
31471
|
+
import { getLogger as getLogger16, getProjectRoot as getProjectRoot19 } from "@cleocode/core";
|
|
30851
31472
|
import {
|
|
30852
31473
|
codeOutline,
|
|
30853
31474
|
codeParse,
|
|
@@ -30898,7 +31519,7 @@ var init_tools = __esm({
|
|
|
30898
31519
|
init_routing();
|
|
30899
31520
|
ToolsHandler = class {
|
|
30900
31521
|
get projectRoot() {
|
|
30901
|
-
return
|
|
31522
|
+
return getProjectRoot19();
|
|
30902
31523
|
}
|
|
30903
31524
|
// -----------------------------------------------------------------------
|
|
30904
31525
|
// DomainHandler interface
|
|
@@ -31480,7 +32101,7 @@ var init_tools = __esm({
|
|
|
31480
32101
|
// packages/cleo/src/dispatch/domains/upgrade.ts
|
|
31481
32102
|
import { dirname as dirname3, resolve as resolve3 } from "node:path";
|
|
31482
32103
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
31483
|
-
import { getLogger as getLogger17, getProjectRoot as
|
|
32104
|
+
import { getLogger as getLogger17, getProjectRoot as getProjectRoot20 } from "@cleocode/core";
|
|
31484
32105
|
import { upgradeWorkflows } from "@cleocode/core/internal";
|
|
31485
32106
|
function resolveTemplatesDir() {
|
|
31486
32107
|
const here = dirname3(fileURLToPath2(import.meta.url));
|
|
@@ -31520,7 +32141,7 @@ var init_upgrade = __esm({
|
|
|
31520
32141
|
case "workflows": {
|
|
31521
32142
|
const includeRendered = params?.["includeRendered"] === true;
|
|
31522
32143
|
const result = await upgradeWorkflows({
|
|
31523
|
-
projectRoot:
|
|
32144
|
+
projectRoot: getProjectRoot20(),
|
|
31524
32145
|
templatesDir: resolveTemplatesDir(),
|
|
31525
32146
|
dryRun: true
|
|
31526
32147
|
});
|
|
@@ -31563,7 +32184,7 @@ var init_upgrade = __esm({
|
|
|
31563
32184
|
const dryRun = params?.["dryRun"] === true;
|
|
31564
32185
|
const includeRendered = params?.["includeRendered"] === true;
|
|
31565
32186
|
const result = await upgradeWorkflows({
|
|
31566
|
-
projectRoot:
|
|
32187
|
+
projectRoot: getProjectRoot20(),
|
|
31567
32188
|
templatesDir: resolveTemplatesDir(),
|
|
31568
32189
|
force,
|
|
31569
32190
|
dryRun
|
|
@@ -31602,12 +32223,14 @@ var init_upgrade = __esm({
|
|
|
31602
32223
|
|
|
31603
32224
|
// packages/cleo/src/dispatch/domains/worktree.ts
|
|
31604
32225
|
import {
|
|
32226
|
+
adoptWorktree,
|
|
31605
32227
|
forceUnlockWorktree,
|
|
31606
32228
|
getLogger as getLogger18,
|
|
31607
|
-
getProjectRoot as
|
|
32229
|
+
getProjectRoot as getProjectRoot21,
|
|
31608
32230
|
listWorktrees,
|
|
31609
32231
|
pruneOrphanedWorktreesByStatus
|
|
31610
32232
|
} from "@cleocode/core/internal";
|
|
32233
|
+
import { destroyWorktree } from "@cleocode/worktree";
|
|
31611
32234
|
function coerceStatusFilter(value) {
|
|
31612
32235
|
if (value === void 0 || value === null) return void 0;
|
|
31613
32236
|
const raw = Array.isArray(value) ? value.filter((v) => typeof v === "string") : typeof value === "string" ? value.split(",").map((s) => s.trim()) : [];
|
|
@@ -31655,7 +32278,7 @@ var init_worktree2 = __esm({
|
|
|
31655
32278
|
switch (operation) {
|
|
31656
32279
|
case "list": {
|
|
31657
32280
|
const opts = {
|
|
31658
|
-
projectRoot:
|
|
32281
|
+
projectRoot: getProjectRoot21(),
|
|
31659
32282
|
statusFilter: coerceStatusFilter(params?.["statusFilter"]),
|
|
31660
32283
|
staleDays: typeof params?.["staleDays"] === "number" ? params["staleDays"] : void 0
|
|
31661
32284
|
};
|
|
@@ -31680,23 +32303,100 @@ var init_worktree2 = __esm({
|
|
|
31680
32303
|
* Handle worktree mutations.
|
|
31681
32304
|
*
|
|
31682
32305
|
* Supported operations:
|
|
32306
|
+
* - `adopt` — register an externally-created worktree in the SSoT. Params:
|
|
32307
|
+
* `{ worktreePath, source?, taskId?, actor? }`. Returns an
|
|
32308
|
+
* {@link AdoptWorktreeResult} envelope. (T9804)
|
|
32309
|
+
* - `destroy` — explicitly destroy a single agent worktree. Params:
|
|
32310
|
+
* `{ taskId, force?, deleteBranch?, reason? }`. Returns a
|
|
32311
|
+
* {@link DestroyWorktreeResult} envelope (T9805).
|
|
31683
32312
|
* - `prune` — remove orphan/merged worktrees. Params:
|
|
31684
|
-
* `{ dryRun?, staleDays?, paths?, actor? }`. Returns a
|
|
32313
|
+
* `{ dryRun?, staleDays?, idleDays?, paths?, actor? }`. Returns a
|
|
31685
32314
|
* {@link PruneOrphanedWorktreesResult} envelope.
|
|
31686
32315
|
* - `forceUnlock` — clear wedge state for a single worktree. Params:
|
|
31687
32316
|
* `{ taskId, actor? }`. Returns a {@link ForceUnlockWorktreeResult}.
|
|
31688
32317
|
*
|
|
31689
32318
|
* @task T9547
|
|
32319
|
+
* @task T9804
|
|
32320
|
+
* @task T9805
|
|
31690
32321
|
*/
|
|
31691
32322
|
async mutate(operation, params) {
|
|
31692
32323
|
const startTime = Date.now();
|
|
31693
32324
|
try {
|
|
31694
32325
|
switch (operation) {
|
|
32326
|
+
case "adopt": {
|
|
32327
|
+
const worktreePath = params?.["worktreePath"];
|
|
32328
|
+
if (typeof worktreePath !== "string" || worktreePath.length === 0) {
|
|
32329
|
+
return errorResult(
|
|
32330
|
+
"mutate",
|
|
32331
|
+
"worktree",
|
|
32332
|
+
operation,
|
|
32333
|
+
"E_VALIDATION",
|
|
32334
|
+
"Missing required param: worktreePath (pass the path to the worktree directory).",
|
|
32335
|
+
startTime
|
|
32336
|
+
);
|
|
32337
|
+
}
|
|
32338
|
+
const rawSource = params?.["source"];
|
|
32339
|
+
const validSources = ["claude-agent", "manual", "adopted"];
|
|
32340
|
+
const source = typeof rawSource === "string" && validSources.includes(rawSource) ? rawSource : void 0;
|
|
32341
|
+
const rawTaskId = params?.["taskId"];
|
|
32342
|
+
const taskId = rawTaskId === null ? null : typeof rawTaskId === "string" && rawTaskId.length > 0 ? rawTaskId : void 0;
|
|
32343
|
+
const opts = {
|
|
32344
|
+
projectRoot: getProjectRoot21(),
|
|
32345
|
+
worktreePath,
|
|
32346
|
+
...source !== void 0 ? { source } : {},
|
|
32347
|
+
...taskId !== void 0 ? { taskId } : {},
|
|
32348
|
+
...typeof params?.["actor"] === "string" && params["actor"].length > 0 ? { actor: params["actor"] } : {}
|
|
32349
|
+
};
|
|
32350
|
+
const result = await adoptWorktree(opts);
|
|
32351
|
+
return wrapResult(
|
|
32352
|
+
result,
|
|
32353
|
+
"mutate",
|
|
32354
|
+
"worktree",
|
|
32355
|
+
operation,
|
|
32356
|
+
startTime
|
|
32357
|
+
);
|
|
32358
|
+
}
|
|
32359
|
+
case "destroy": {
|
|
32360
|
+
const taskId = params?.["taskId"];
|
|
32361
|
+
if (typeof taskId !== "string" || taskId.length === 0) {
|
|
32362
|
+
return errorResult(
|
|
32363
|
+
"mutate",
|
|
32364
|
+
"worktree",
|
|
32365
|
+
operation,
|
|
32366
|
+
"E_VALIDATION",
|
|
32367
|
+
"Missing required param: taskId (e.g. T9805).",
|
|
32368
|
+
startTime
|
|
32369
|
+
);
|
|
32370
|
+
}
|
|
32371
|
+
const opts = {
|
|
32372
|
+
taskId,
|
|
32373
|
+
force: params?.["force"] === true,
|
|
32374
|
+
deleteBranch: params?.["deleteBranch"] !== false,
|
|
32375
|
+
...typeof params?.["reason"] === "string" && params["reason"].length > 0 ? { reason: params["reason"] } : {}
|
|
32376
|
+
};
|
|
32377
|
+
const result = await destroyWorktree(getProjectRoot21(), opts);
|
|
32378
|
+
const engineResult = result.error !== void 0 ? {
|
|
32379
|
+
success: false,
|
|
32380
|
+
error: {
|
|
32381
|
+
code: "E_DESTROY_FAILED",
|
|
32382
|
+
message: result.error,
|
|
32383
|
+
fix: "Check worktree state with `cleo worktree list`."
|
|
32384
|
+
}
|
|
32385
|
+
} : { success: true, data: result };
|
|
32386
|
+
return wrapResult(
|
|
32387
|
+
engineResult,
|
|
32388
|
+
"mutate",
|
|
32389
|
+
"worktree",
|
|
32390
|
+
operation,
|
|
32391
|
+
startTime
|
|
32392
|
+
);
|
|
32393
|
+
}
|
|
31695
32394
|
case "prune": {
|
|
31696
32395
|
const opts = {
|
|
31697
|
-
projectRoot:
|
|
32396
|
+
projectRoot: getProjectRoot21(),
|
|
31698
32397
|
dryRun: params?.["dryRun"] === true,
|
|
31699
32398
|
...typeof params?.["staleDays"] === "number" ? { staleDays: params["staleDays"] } : {},
|
|
32399
|
+
...typeof params?.["idleDays"] === "number" ? { staleDays: params["idleDays"] } : {},
|
|
31700
32400
|
...coerceStringList(params?.["paths"]) !== void 0 ? { paths: coerceStringList(params?.["paths"]) } : {},
|
|
31701
32401
|
...typeof params?.["actor"] === "string" && params["actor"].length > 0 ? { actor: params["actor"] } : {}
|
|
31702
32402
|
};
|
|
@@ -31722,7 +32422,7 @@ var init_worktree2 = __esm({
|
|
|
31722
32422
|
);
|
|
31723
32423
|
}
|
|
31724
32424
|
const opts = {
|
|
31725
|
-
projectRoot:
|
|
32425
|
+
projectRoot: getProjectRoot21(),
|
|
31726
32426
|
taskId,
|
|
31727
32427
|
...typeof params?.["actor"] === "string" && params["actor"].length > 0 ? { actor: params["actor"] } : {}
|
|
31728
32428
|
};
|
|
@@ -31752,7 +32452,7 @@ var init_worktree2 = __esm({
|
|
|
31752
32452
|
getSupportedOperations() {
|
|
31753
32453
|
return {
|
|
31754
32454
|
query: ["list"],
|
|
31755
|
-
mutate: ["prune", "forceUnlock"]
|
|
32455
|
+
mutate: ["adopt", "destroy", "prune", "forceUnlock"]
|
|
31756
32456
|
};
|
|
31757
32457
|
}
|
|
31758
32458
|
};
|
|
@@ -31775,6 +32475,7 @@ function createDomainHandlers() {
|
|
|
31775
32475
|
handlers.set("sticky", new StickyHandler());
|
|
31776
32476
|
handlers.set("diagnostics", new DiagnosticsHandler());
|
|
31777
32477
|
handlers.set("docs", new DocsHandler());
|
|
32478
|
+
handlers.set("focus", new FocusHandler());
|
|
31778
32479
|
handlers.set("playbook", new PlaybookHandler());
|
|
31779
32480
|
handlers.set("conduit", new ConduitHandler());
|
|
31780
32481
|
handlers.set("sentient", new SentientHandler());
|
|
@@ -31793,6 +32494,7 @@ var init_domains = __esm({
|
|
|
31793
32494
|
init_conduit2();
|
|
31794
32495
|
init_diagnostics();
|
|
31795
32496
|
init_docs2();
|
|
32497
|
+
init_focus2();
|
|
31796
32498
|
init_intelligence2();
|
|
31797
32499
|
init_llm2();
|
|
31798
32500
|
init_memory2();
|
|
@@ -32245,11 +32947,11 @@ var init_security = __esm({
|
|
|
32245
32947
|
});
|
|
32246
32948
|
|
|
32247
32949
|
// packages/cleo/src/dispatch/middleware/sanitizer.ts
|
|
32248
|
-
function createSanitizer(
|
|
32950
|
+
function createSanitizer(getProjectRoot44) {
|
|
32249
32951
|
return async (req, next) => {
|
|
32250
32952
|
if (req.params) {
|
|
32251
32953
|
try {
|
|
32252
|
-
const root =
|
|
32954
|
+
const root = getProjectRoot44 ? getProjectRoot44() : void 0;
|
|
32253
32955
|
req.params = sanitizeParams(req.params, root, {
|
|
32254
32956
|
domain: req.domain,
|
|
32255
32957
|
operation: req.operation
|
|
@@ -32374,7 +33076,7 @@ import { createRequire } from "node:module";
|
|
|
32374
33076
|
import { dirname as dirname4, join as join8 } from "node:path";
|
|
32375
33077
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
32376
33078
|
import { catalog, registerSkillLibraryFromPath } from "@cleocode/caamp";
|
|
32377
|
-
import { autoRecordDispatchTokenUsage, getProjectRoot as
|
|
33079
|
+
import { autoRecordDispatchTokenUsage, getProjectRoot as getProjectRoot22, hooks } from "@cleocode/core/internal";
|
|
32378
33080
|
function ensureCaampLibrary() {
|
|
32379
33081
|
if (catalog.isCatalogAvailable()) return;
|
|
32380
33082
|
try {
|
|
@@ -32425,7 +33127,7 @@ function createCliDispatcher() {
|
|
|
32425
33127
|
middlewares: [
|
|
32426
33128
|
createSessionResolver(lookupCliSession),
|
|
32427
33129
|
// T4959: session identity first
|
|
32428
|
-
createSanitizer(() =>
|
|
33130
|
+
createSanitizer(() => getProjectRoot22()),
|
|
32429
33131
|
createFieldFilter(),
|
|
32430
33132
|
createAudit(),
|
|
32431
33133
|
// T4959: CLI now gets audit trail
|
|
@@ -32439,7 +33141,7 @@ function resetCliDispatcher() {
|
|
|
32439
33141
|
}
|
|
32440
33142
|
async function dispatchFromCli(gateway, domain, operation, params, outputOpts) {
|
|
32441
33143
|
const dispatcher = getCliDispatcher();
|
|
32442
|
-
const projectRoot =
|
|
33144
|
+
const projectRoot = getProjectRoot22();
|
|
32443
33145
|
const dispatchStart = Date.now();
|
|
32444
33146
|
hooks.dispatch("PromptSubmit", projectRoot, {
|
|
32445
33147
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -32484,7 +33186,7 @@ async function dispatchFromCli(gateway, domain, operation, params, outputOpts) {
|
|
|
32484
33186
|
operation,
|
|
32485
33187
|
sessionId: response.meta.sessionId,
|
|
32486
33188
|
requestId: response.meta.requestId,
|
|
32487
|
-
cwd:
|
|
33189
|
+
cwd: getProjectRoot22()
|
|
32488
33190
|
});
|
|
32489
33191
|
const opts = {
|
|
32490
33192
|
command: outputOpts?.command ?? operation,
|
|
@@ -32546,7 +33248,7 @@ function handleRawError(response, _opts) {
|
|
|
32546
33248
|
}
|
|
32547
33249
|
async function dispatchRaw(gateway, domain, operation, params) {
|
|
32548
33250
|
const dispatcher = getCliDispatcher();
|
|
32549
|
-
const projectRoot =
|
|
33251
|
+
const projectRoot = getProjectRoot22();
|
|
32550
33252
|
const dispatchStart = Date.now();
|
|
32551
33253
|
hooks.dispatch("PromptSubmit", projectRoot, {
|
|
32552
33254
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -32901,7 +33603,7 @@ __export(add_exports, {
|
|
|
32901
33603
|
});
|
|
32902
33604
|
import {
|
|
32903
33605
|
appendSignedSeverityAttestation,
|
|
32904
|
-
getProjectRoot as
|
|
33606
|
+
getProjectRoot as getProjectRoot23,
|
|
32905
33607
|
inferTaskAddParams
|
|
32906
33608
|
} from "@cleocode/core";
|
|
32907
33609
|
var addCommand;
|
|
@@ -33130,7 +33832,7 @@ For 2+ tasks at once: cleo add-batch --file tasks.json (single transaction, atom
|
|
|
33130
33832
|
return;
|
|
33131
33833
|
}
|
|
33132
33834
|
if (args["depends-waiver"] !== void 0) params["dependsWaiver"] = args["depends-waiver"];
|
|
33133
|
-
const inferred = await inferTaskAddParams(
|
|
33835
|
+
const inferred = await inferTaskAddParams(getProjectRoot23(), {
|
|
33134
33836
|
title: args.title,
|
|
33135
33837
|
description: args.description ?? args.desc,
|
|
33136
33838
|
filesInfer: args["files-infer"],
|
|
@@ -33754,7 +34456,7 @@ var agent_exports = {};
|
|
|
33754
34456
|
__export(agent_exports, {
|
|
33755
34457
|
agentCommand: () => agentCommand
|
|
33756
34458
|
});
|
|
33757
|
-
import { getProjectRoot as
|
|
34459
|
+
import { getProjectRoot as getProjectRoot24 } from "@cleocode/core";
|
|
33758
34460
|
import {
|
|
33759
34461
|
checkAgentHealth,
|
|
33760
34462
|
detectCrashedAgents,
|
|
@@ -34147,7 +34849,7 @@ var init_agent = __esm({
|
|
|
34147
34849
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
34148
34850
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34149
34851
|
await getDb3();
|
|
34150
|
-
const registry = new AgentRegistryAccessor(
|
|
34852
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34151
34853
|
const agentId = args.id;
|
|
34152
34854
|
const displayName = args.name;
|
|
34153
34855
|
const classification = args.classification;
|
|
@@ -34265,7 +34967,7 @@ agent ${agentId}:
|
|
|
34265
34967
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
34266
34968
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34267
34969
|
await getDb3();
|
|
34268
|
-
const registry = new AgentRegistryAccessor(
|
|
34970
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34269
34971
|
const credential = await registry.get(args.agentId);
|
|
34270
34972
|
if (!credential) {
|
|
34271
34973
|
cliOutput(
|
|
@@ -34353,7 +35055,7 @@ agent ${agentId}:
|
|
|
34353
35055
|
const { existsSync: existsSync18, readFileSync: readFileSync19 } = await import("node:fs");
|
|
34354
35056
|
const { join: join35 } = await import("node:path");
|
|
34355
35057
|
await getDb3();
|
|
34356
|
-
const registry = new AgentRegistryAccessor(
|
|
35058
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34357
35059
|
const credential = await registry.get(args.agentId);
|
|
34358
35060
|
if (!credential) {
|
|
34359
35061
|
cliOutput(
|
|
@@ -34472,7 +35174,7 @@ agent ${agentId}:
|
|
|
34472
35174
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
34473
35175
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34474
35176
|
await getDb3();
|
|
34475
|
-
const registry = new AgentRegistryAccessor(
|
|
35177
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34476
35178
|
const credential = await registry.get(args.agentId);
|
|
34477
35179
|
if (!credential) {
|
|
34478
35180
|
cliOutput(
|
|
@@ -34529,7 +35231,7 @@ agent ${agentId}:
|
|
|
34529
35231
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
34530
35232
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34531
35233
|
await getDb3();
|
|
34532
|
-
const registry = new AgentRegistryAccessor(
|
|
35234
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34533
35235
|
if (args.agentId) {
|
|
34534
35236
|
const credential = await registry.get(args.agentId);
|
|
34535
35237
|
if (!credential) {
|
|
@@ -34605,7 +35307,7 @@ agent ${agentId}:
|
|
|
34605
35307
|
const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
|
|
34606
35308
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34607
35309
|
await getDb3();
|
|
34608
|
-
const registry = new AgentRegistryAccessor(
|
|
35310
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34609
35311
|
const active = await registry.getActive();
|
|
34610
35312
|
if (!active) {
|
|
34611
35313
|
cliOutput(
|
|
@@ -34662,7 +35364,7 @@ Assigned task ${args.taskId}. Run: cleo show ${args.taskId} && cleo start ${args
|
|
|
34662
35364
|
const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
|
|
34663
35365
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34664
35366
|
await getDb3();
|
|
34665
|
-
const registry = new AgentRegistryAccessor(
|
|
35367
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34666
35368
|
const active = await registry.getActive();
|
|
34667
35369
|
if (!active) {
|
|
34668
35370
|
cliOutput(
|
|
@@ -34728,7 +35430,7 @@ You are idle. Check your queue: cleo current || cleo next. Report status immedia
|
|
|
34728
35430
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
34729
35431
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34730
35432
|
await getDb3();
|
|
34731
|
-
const registry = new AgentRegistryAccessor(
|
|
35433
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34732
35434
|
const role = args.role;
|
|
34733
35435
|
const taskId = args.task;
|
|
34734
35436
|
const model = args.model ?? "sonnet";
|
|
@@ -34793,7 +35495,7 @@ You are idle. Check your queue: cleo current || cleo next. Report status immedia
|
|
|
34793
35495
|
const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
|
|
34794
35496
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34795
35497
|
await getDb3();
|
|
34796
|
-
const registry = new AgentRegistryAccessor(
|
|
35498
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34797
35499
|
const active = await registry.getActive();
|
|
34798
35500
|
if (!active) {
|
|
34799
35501
|
cliOutput(
|
|
@@ -34837,7 +35539,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34837
35539
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
34838
35540
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34839
35541
|
await getDb3();
|
|
34840
|
-
const registry = new AgentRegistryAccessor(
|
|
35542
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34841
35543
|
const agents = await registry.list({ active: true });
|
|
34842
35544
|
let stopped = 0;
|
|
34843
35545
|
for (const a of agents) {
|
|
@@ -34910,7 +35612,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34910
35612
|
const { promisify: promisify2 } = await import("node:util");
|
|
34911
35613
|
const execFileAsync = promisify2(execFile2);
|
|
34912
35614
|
await getDb3();
|
|
34913
|
-
const registry = new AgentRegistryAccessor(
|
|
35615
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
34914
35616
|
const credential = await registry.get(args.agentId);
|
|
34915
35617
|
if (!credential) {
|
|
34916
35618
|
cliOutput(
|
|
@@ -35067,7 +35769,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35067
35769
|
await getDb3();
|
|
35068
35770
|
const includeGlobal = args.global === true;
|
|
35069
35771
|
const includeDisabled = args["include-disabled"] === true;
|
|
35070
|
-
const agents = listAgentsForProject(
|
|
35772
|
+
const agents = listAgentsForProject(getProjectRoot24(), {
|
|
35071
35773
|
includeGlobal,
|
|
35072
35774
|
includeDisabled
|
|
35073
35775
|
});
|
|
@@ -35118,7 +35820,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35118
35820
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35119
35821
|
await getDb3();
|
|
35120
35822
|
const includeGlobal = args.global === true;
|
|
35121
|
-
const agent = lookupAgent(
|
|
35823
|
+
const agent = lookupAgent(getProjectRoot24(), args.agentId, { includeGlobal });
|
|
35122
35824
|
if (!agent) {
|
|
35123
35825
|
cliOutput(
|
|
35124
35826
|
{
|
|
@@ -35184,7 +35886,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35184
35886
|
const { AgentRegistryAccessor, attachAgentToProject, lookupAgent } = await import("@cleocode/core/agents");
|
|
35185
35887
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35186
35888
|
await getDb3();
|
|
35187
|
-
const projectRoot =
|
|
35889
|
+
const projectRoot = getProjectRoot24();
|
|
35188
35890
|
const _registry = new AgentRegistryAccessor(projectRoot);
|
|
35189
35891
|
void _registry;
|
|
35190
35892
|
const globalAgent = lookupAgent(projectRoot, args.agentId, { includeGlobal: true });
|
|
@@ -35240,7 +35942,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35240
35942
|
const { AgentRegistryAccessor, detachAgentFromProject, getProjectAgentRef } = await import("@cleocode/core/agents");
|
|
35241
35943
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35242
35944
|
await getDb3();
|
|
35243
|
-
const projectRoot =
|
|
35945
|
+
const projectRoot = getProjectRoot24();
|
|
35244
35946
|
const _registry = new AgentRegistryAccessor(projectRoot);
|
|
35245
35947
|
void _registry;
|
|
35246
35948
|
const ref = getProjectAgentRef(projectRoot, args.agentId);
|
|
@@ -35297,7 +35999,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35297
35999
|
const { AgentRegistryAccessor, detachAgentFromProject, getProjectAgentRef } = await import("@cleocode/core/agents");
|
|
35298
36000
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35299
36001
|
await getDb3();
|
|
35300
|
-
const projectRoot =
|
|
36002
|
+
const projectRoot = getProjectRoot24();
|
|
35301
36003
|
if (!args.global) {
|
|
35302
36004
|
const _registry = new AgentRegistryAccessor(projectRoot);
|
|
35303
36005
|
void _registry;
|
|
@@ -35379,7 +36081,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35379
36081
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
35380
36082
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35381
36083
|
await getDb3();
|
|
35382
|
-
const registry = new AgentRegistryAccessor(
|
|
36084
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
35383
36085
|
const result = await registry.rotateKey(args.agentId);
|
|
35384
36086
|
cliOutput(
|
|
35385
36087
|
{
|
|
@@ -35418,7 +36120,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35418
36120
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
35419
36121
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35420
36122
|
await getDb3();
|
|
35421
|
-
const registry = new AgentRegistryAccessor(
|
|
36123
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
35422
36124
|
const credential = await registry.get(args.agentId);
|
|
35423
36125
|
if (!credential) {
|
|
35424
36126
|
cliOutput(
|
|
@@ -35493,7 +36195,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35493
36195
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35494
36196
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
35495
36197
|
await getDb3();
|
|
35496
|
-
const registry = new AgentRegistryAccessor(
|
|
36198
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
35497
36199
|
const groupIds = args.group ? args.group.split(",").map((s) => s.trim()) : void 0;
|
|
35498
36200
|
const handle = await createRuntime(registry, {
|
|
35499
36201
|
agentId: args.agent,
|
|
@@ -35576,7 +36278,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35576
36278
|
const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
|
|
35577
36279
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35578
36280
|
await getDb3();
|
|
35579
|
-
const registry = new AgentRegistryAccessor(
|
|
36281
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
35580
36282
|
const agentId = args.agent;
|
|
35581
36283
|
const conduit = await createConduit(registry, agentId);
|
|
35582
36284
|
const limit = Number(args.limit) || 20;
|
|
@@ -35628,7 +36330,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35628
36330
|
const { AgentRegistryAccessor, createConduit } = await import("@cleocode/core/agents");
|
|
35629
36331
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
35630
36332
|
await getDb3();
|
|
35631
|
-
const registry = new AgentRegistryAccessor(
|
|
36333
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
35632
36334
|
const agentId = args.agent;
|
|
35633
36335
|
const to = args.to;
|
|
35634
36336
|
const conv = args.conv;
|
|
@@ -35906,7 +36608,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35906
36608
|
const db = _sdDb;
|
|
35907
36609
|
const isGlobal = args.global === true;
|
|
35908
36610
|
const targetTier = isGlobal ? "global" : "project";
|
|
35909
|
-
const projectRoot =
|
|
36611
|
+
const projectRoot = getProjectRoot24();
|
|
35910
36612
|
try {
|
|
35911
36613
|
if (args.resync) {
|
|
35912
36614
|
const parsedName = basename(cantPath, ".cant");
|
|
@@ -36203,7 +36905,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
36203
36905
|
const xdgData = process.env["XDG_DATA_HOME"] ?? join35(home, ".local", "share");
|
|
36204
36906
|
targetRoot = join35(xdgData, "cleo", "cant", "agents");
|
|
36205
36907
|
} else {
|
|
36206
|
-
targetRoot = join35(
|
|
36908
|
+
targetRoot = join35(getProjectRoot24(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
|
|
36207
36909
|
}
|
|
36208
36910
|
const agentDir = join35(targetRoot, name);
|
|
36209
36911
|
if (existsSync18(agentDir)) {
|
|
@@ -36276,7 +36978,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
36276
36978
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
36277
36979
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
36278
36980
|
await getDb3();
|
|
36279
|
-
const registry = new AgentRegistryAccessor(
|
|
36981
|
+
const registry = new AgentRegistryAccessor(getProjectRoot24());
|
|
36280
36982
|
const existing = await registry.get(name);
|
|
36281
36983
|
if (!existing) {
|
|
36282
36984
|
const descMatch = personaContent.match(/description:\s*"([^"]+)"/);
|
|
@@ -36360,7 +37062,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
36360
37062
|
return;
|
|
36361
37063
|
}
|
|
36362
37064
|
const specContent = readFileSync19(specPath, "utf-8");
|
|
36363
|
-
const projectRoot =
|
|
37065
|
+
const projectRoot = getProjectRoot24();
|
|
36364
37066
|
const outputDir = args["output-dir"] ? resolve9(args["output-dir"]) : join35(projectRoot, ".cleo", "cant", "agents");
|
|
36365
37067
|
mkdirSync6(outputDir, { recursive: true });
|
|
36366
37068
|
if (args["dry-run"]) {
|
|
@@ -36491,7 +37193,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
36491
37193
|
const { db: _sdDb3 } = await openCleoDb2("signaldock");
|
|
36492
37194
|
const db = _sdDb3;
|
|
36493
37195
|
try {
|
|
36494
|
-
const report = await buildDoctorReport(db, { projectRoot:
|
|
37196
|
+
const report = await buildDoctorReport(db, { projectRoot: getProjectRoot24() });
|
|
36495
37197
|
const repairFlag = args.repair === true;
|
|
36496
37198
|
let reconciled;
|
|
36497
37199
|
if (repairFlag) {
|
|
@@ -36759,7 +37461,7 @@ var audit_exports = {};
|
|
|
36759
37461
|
__export(audit_exports, {
|
|
36760
37462
|
auditCommand: () => auditCommand
|
|
36761
37463
|
});
|
|
36762
|
-
import { getProjectRoot as
|
|
37464
|
+
import { getProjectRoot as getProjectRoot25, reconstructLineage } from "@cleocode/core/internal";
|
|
36763
37465
|
var reconstructCommand, auditCommand;
|
|
36764
37466
|
var init_audit2 = __esm({
|
|
36765
37467
|
"packages/cleo/src/cli/commands/audit.ts"() {
|
|
@@ -36803,7 +37505,7 @@ var init_audit2 = __esm({
|
|
|
36803
37505
|
repoRoot = args["repo-root"];
|
|
36804
37506
|
} else {
|
|
36805
37507
|
try {
|
|
36806
|
-
repoRoot =
|
|
37508
|
+
repoRoot = getProjectRoot25(process.cwd()) ?? process.cwd();
|
|
36807
37509
|
} catch {
|
|
36808
37510
|
repoRoot = process.cwd();
|
|
36809
37511
|
}
|
|
@@ -37427,7 +38129,7 @@ var backfill_exports = {};
|
|
|
37427
38129
|
__export(backfill_exports, {
|
|
37428
38130
|
backfillCommand: () => backfillCommand
|
|
37429
38131
|
});
|
|
37430
|
-
import { backfillTasks, getProjectRoot as
|
|
38132
|
+
import { backfillTasks, getProjectRoot as getProjectRoot26, populateEmbeddings } from "@cleocode/core/internal";
|
|
37431
38133
|
var backfillCommand;
|
|
37432
38134
|
var init_backfill = __esm({
|
|
37433
38135
|
"packages/cleo/src/cli/commands/backfill.ts"() {
|
|
@@ -37461,7 +38163,7 @@ var init_backfill = __esm({
|
|
|
37461
38163
|
}
|
|
37462
38164
|
},
|
|
37463
38165
|
async run({ args }) {
|
|
37464
|
-
const root =
|
|
38166
|
+
const root = getProjectRoot26();
|
|
37465
38167
|
if (args.embeddings) {
|
|
37466
38168
|
try {
|
|
37467
38169
|
let lastLine = "";
|
|
@@ -37979,9 +38681,9 @@ var init_backup = __esm({
|
|
|
37979
38681
|
async run({ args }) {
|
|
37980
38682
|
const scope = args.scope;
|
|
37981
38683
|
const { packBundle } = await import("@cleocode/core/store/backup-pack.js");
|
|
37982
|
-
const { getProjectRoot:
|
|
38684
|
+
const { getProjectRoot: getProjectRoot44 } = await import("@cleocode/core");
|
|
37983
38685
|
const includesProject = scope === "project" || scope === "all";
|
|
37984
|
-
const projectRoot = includesProject ?
|
|
38686
|
+
const projectRoot = includesProject ? getProjectRoot44() : void 0;
|
|
37985
38687
|
let passphrase;
|
|
37986
38688
|
if (args.encrypt === true) {
|
|
37987
38689
|
passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
@@ -38057,12 +38759,12 @@ var init_backup = __esm({
|
|
|
38057
38759
|
},
|
|
38058
38760
|
async run({ args }) {
|
|
38059
38761
|
const bundlePath = args.bundle;
|
|
38060
|
-
const { getProjectRoot:
|
|
38762
|
+
const { getProjectRoot: getProjectRoot44, getCleoHome: getCleoHome6, getCleoVersion } = await import("@cleocode/core");
|
|
38061
38763
|
const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
|
|
38062
38764
|
const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
|
|
38063
38765
|
const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
|
|
38064
38766
|
const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
|
|
38065
|
-
const projectRoot =
|
|
38767
|
+
const projectRoot = getProjectRoot44();
|
|
38066
38768
|
if (args.force !== true) {
|
|
38067
38769
|
const existing = checkForExistingData(projectRoot, getCleoHome6());
|
|
38068
38770
|
if (existing.length > 0) {
|
|
@@ -38280,7 +38982,7 @@ var brain_exports = {};
|
|
|
38280
38982
|
__export(brain_exports, {
|
|
38281
38983
|
brainCommand: () => brainCommand
|
|
38282
38984
|
});
|
|
38283
|
-
import { getProjectRoot as
|
|
38985
|
+
import { getProjectRoot as getProjectRoot27 } from "@cleocode/core";
|
|
38284
38986
|
import {
|
|
38285
38987
|
backfillBrainGraph,
|
|
38286
38988
|
exportBrainAsGexf,
|
|
@@ -38325,7 +39027,7 @@ var init_brain2 = __esm({
|
|
|
38325
39027
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38326
39028
|
},
|
|
38327
39029
|
async run({ args }) {
|
|
38328
|
-
const root =
|
|
39030
|
+
const root = getProjectRoot27();
|
|
38329
39031
|
try {
|
|
38330
39032
|
const result = await runBrainMaintenance(root, {
|
|
38331
39033
|
skipDecay: !!args["skip-decay"],
|
|
@@ -38396,7 +39098,7 @@ var init_brain2 = __esm({
|
|
|
38396
39098
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38397
39099
|
},
|
|
38398
39100
|
async run({ args: _args }) {
|
|
38399
|
-
const root =
|
|
39101
|
+
const root = getProjectRoot27();
|
|
38400
39102
|
try {
|
|
38401
39103
|
const result = await backfillBrainGraph(root);
|
|
38402
39104
|
cliOutput(
|
|
@@ -38437,7 +39139,7 @@ var init_brain2 = __esm({
|
|
|
38437
39139
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38438
39140
|
},
|
|
38439
39141
|
async run({ args: _args }) {
|
|
38440
|
-
const root =
|
|
39142
|
+
const root = getProjectRoot27();
|
|
38441
39143
|
try {
|
|
38442
39144
|
const result = await purgeBrainNoise(root);
|
|
38443
39145
|
cliOutput(
|
|
@@ -38483,7 +39185,7 @@ var init_brain2 = __esm({
|
|
|
38483
39185
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38484
39186
|
},
|
|
38485
39187
|
async run({ args }) {
|
|
38486
|
-
const root =
|
|
39188
|
+
const root = getProjectRoot27();
|
|
38487
39189
|
const limit = Number.parseInt(args.limit, 10) || 20;
|
|
38488
39190
|
try {
|
|
38489
39191
|
const stats = await getPlasticityStats(root, limit);
|
|
@@ -38533,7 +39235,7 @@ var init_brain2 = __esm({
|
|
|
38533
39235
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38534
39236
|
},
|
|
38535
39237
|
async run({ args: _args }) {
|
|
38536
|
-
const root =
|
|
39238
|
+
const root = getProjectRoot27();
|
|
38537
39239
|
try {
|
|
38538
39240
|
const report = await getMemoryQualityReport(root);
|
|
38539
39241
|
cliOutput(
|
|
@@ -38582,7 +39284,7 @@ var init_brain2 = __esm({
|
|
|
38582
39284
|
}
|
|
38583
39285
|
},
|
|
38584
39286
|
async run({ args }) {
|
|
38585
|
-
const root =
|
|
39287
|
+
const root = getProjectRoot27();
|
|
38586
39288
|
const format = args.format ?? "gexf";
|
|
38587
39289
|
if (format !== "gexf" && format !== "json") {
|
|
38588
39290
|
cliError(`Invalid format: ${format}. Use 'gexf' or 'json'.`, "E_VALIDATION", {
|
|
@@ -38799,7 +39501,7 @@ var init_briefing = __esm({
|
|
|
38799
39501
|
"max-next": {
|
|
38800
39502
|
type: "string",
|
|
38801
39503
|
description: "Maximum next tasks to show",
|
|
38802
|
-
default: "
|
|
39504
|
+
default: "3"
|
|
38803
39505
|
},
|
|
38804
39506
|
"max-bugs": {
|
|
38805
39507
|
type: "string",
|
|
@@ -38827,6 +39529,25 @@ var init_briefing = __esm({
|
|
|
38827
39529
|
type: "boolean",
|
|
38828
39530
|
description: "Exit non-zero when briefing contract violations are detected (T1905)",
|
|
38829
39531
|
alias: "x"
|
|
39532
|
+
},
|
|
39533
|
+
/**
|
|
39534
|
+
* T9974: debug mode — surface peerPatterns and other verbose fields
|
|
39535
|
+
* suppressed by default. Passing --debug --with-profile --max-next 5
|
|
39536
|
+
* restores the ~pre-T9974 output shape.
|
|
39537
|
+
*/
|
|
39538
|
+
debug: {
|
|
39539
|
+
type: "boolean",
|
|
39540
|
+
description: "Include verbose debug fields (peerPatterns etc.) suppressed by default",
|
|
39541
|
+
default: false
|
|
39542
|
+
},
|
|
39543
|
+
/**
|
|
39544
|
+
* T9974: include cold.userProfile traits in the bundle.
|
|
39545
|
+
* Off by default — large trait dump rarely needed at session start.
|
|
39546
|
+
*/
|
|
39547
|
+
"with-profile": {
|
|
39548
|
+
type: "boolean",
|
|
39549
|
+
description: "Include user profile traits in the bundle (suppressed by default)",
|
|
39550
|
+
default: false
|
|
38830
39551
|
}
|
|
38831
39552
|
},
|
|
38832
39553
|
async run({ args, cmd, rawArgs }) {
|
|
@@ -38852,7 +39573,9 @@ var init_briefing = __esm({
|
|
|
38852
39573
|
maxNextTasks: parseInt(args["max-next"], 10),
|
|
38853
39574
|
maxBugs: parseInt(args["max-bugs"], 10),
|
|
38854
39575
|
maxBlocked: parseInt(args["max-blocked"], 10),
|
|
38855
|
-
maxEpics: parseInt(args["max-epics"], 10)
|
|
39576
|
+
maxEpics: parseInt(args["max-epics"], 10),
|
|
39577
|
+
debug: args.debug,
|
|
39578
|
+
withProfile: args["with-profile"]
|
|
38856
39579
|
},
|
|
38857
39580
|
{ command: "briefing" }
|
|
38858
39581
|
);
|
|
@@ -39367,7 +40090,7 @@ __export(changeset_exports, {
|
|
|
39367
40090
|
});
|
|
39368
40091
|
import { existsSync as existsSync11 } from "node:fs";
|
|
39369
40092
|
import { join as join14 } from "node:path";
|
|
39370
|
-
import { changesets, getProjectRoot as
|
|
40093
|
+
import { changesets, getProjectRoot as getProjectRoot28 } from "@cleocode/core";
|
|
39371
40094
|
function isValidKind(raw) {
|
|
39372
40095
|
return typeof raw === "string" && CHANGESET_KINDS.includes(raw);
|
|
39373
40096
|
}
|
|
@@ -39462,7 +40185,7 @@ var init_changeset = __esm({
|
|
|
39462
40185
|
...typeof args.notes === "string" && args.notes.length > 0 ? { notes: args.notes } : {},
|
|
39463
40186
|
...typeof args.breaking === "string" && args.breaking.length > 0 ? { breaking: args.breaking } : {}
|
|
39464
40187
|
};
|
|
39465
|
-
const projectRoot =
|
|
40188
|
+
const projectRoot = getProjectRoot28();
|
|
39466
40189
|
const outcome = await changesets.writeChangesetEntry(entry, {
|
|
39467
40190
|
projectRoot,
|
|
39468
40191
|
...typeof args["attached-by"] === "string" && args["attached-by"].length > 0 ? { attachedBy: args["attached-by"] } : {}
|
|
@@ -39489,7 +40212,7 @@ var init_changeset = __esm({
|
|
|
39489
40212
|
},
|
|
39490
40213
|
args: {},
|
|
39491
40214
|
async run() {
|
|
39492
|
-
const projectRoot =
|
|
40215
|
+
const projectRoot = getProjectRoot28();
|
|
39493
40216
|
const dir = join14(projectRoot, ".changeset");
|
|
39494
40217
|
if (!existsSync11(dir)) {
|
|
39495
40218
|
const empty = { entries: [], count: 0, dir, note: "no .changeset/ dir" };
|
|
@@ -39878,7 +40601,7 @@ var init_check2 = __esm({
|
|
|
39878
40601
|
}
|
|
39879
40602
|
},
|
|
39880
40603
|
async run({ args }) {
|
|
39881
|
-
const { execSync:
|
|
40604
|
+
const { execSync: execSync3 } = await import("node:child_process");
|
|
39882
40605
|
const since = args.since;
|
|
39883
40606
|
const branch = args.branch || "HEAD";
|
|
39884
40607
|
const strict = Boolean(args.strict);
|
|
@@ -39886,7 +40609,7 @@ var init_check2 = __esm({
|
|
|
39886
40609
|
const range = since ? `${since}..${branch}` : branch;
|
|
39887
40610
|
let logOutput;
|
|
39888
40611
|
try {
|
|
39889
|
-
logOutput =
|
|
40612
|
+
logOutput = execSync3(`git log --no-merges --pretty=format:"%H %s" -n ${limit} ${range}`, {
|
|
39890
40613
|
encoding: "utf8",
|
|
39891
40614
|
stdio: ["pipe", "pipe", "pipe"]
|
|
39892
40615
|
});
|
|
@@ -39899,7 +40622,7 @@ var init_check2 = __esm({
|
|
|
39899
40622
|
process.exit(1);
|
|
39900
40623
|
}
|
|
39901
40624
|
const lines = logOutput.trim().split("\n").filter(Boolean);
|
|
39902
|
-
const
|
|
40625
|
+
const TASK_ID_RE3 = /T[0-9]+/;
|
|
39903
40626
|
const EXEMPT_RE = /^(Merge |Revert |fixup! |squash! |amend! )/;
|
|
39904
40627
|
const untagged = [];
|
|
39905
40628
|
const total = lines.length;
|
|
@@ -39909,7 +40632,7 @@ var init_check2 = __esm({
|
|
|
39909
40632
|
const sha = line.slice(0, tabIdx).trim();
|
|
39910
40633
|
const subject = line.slice(tabIdx + 1).trim();
|
|
39911
40634
|
if (EXEMPT_RE.test(subject)) continue;
|
|
39912
|
-
if (!
|
|
40635
|
+
if (!TASK_ID_RE3.test(subject)) {
|
|
39913
40636
|
untagged.push({ sha: sha.slice(0, 12), subject });
|
|
39914
40637
|
}
|
|
39915
40638
|
}
|
|
@@ -42925,8 +43648,8 @@ import { stat } from "node:fs/promises";
|
|
|
42925
43648
|
import { dirname as dirname8, join as join19, normalize, resolve as resolve5 } from "node:path";
|
|
42926
43649
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
42927
43650
|
import {
|
|
42928
|
-
createAttachmentStore as
|
|
42929
|
-
getProjectRoot as
|
|
43651
|
+
createAttachmentStore as createAttachmentStore5,
|
|
43652
|
+
getProjectRoot as getProjectRoot29,
|
|
42930
43653
|
searchAllProjectDocs
|
|
42931
43654
|
} from "@cleocode/core/internal";
|
|
42932
43655
|
function getViewerAssetsDir() {
|
|
@@ -42986,9 +43709,9 @@ async function serveStatic(res, assetsDir, relPath) {
|
|
|
42986
43709
|
}
|
|
42987
43710
|
}
|
|
42988
43711
|
function buildViewerHandler(opts = {}) {
|
|
42989
|
-
const projectRoot = opts.projectRoot ??
|
|
43712
|
+
const projectRoot = opts.projectRoot ?? getProjectRoot29();
|
|
42990
43713
|
const assetsDir = getViewerAssetsDir();
|
|
42991
|
-
const store =
|
|
43714
|
+
const store = createAttachmentStore5();
|
|
42992
43715
|
return async (req, res) => {
|
|
42993
43716
|
try {
|
|
42994
43717
|
const method = (req.method ?? "GET").toUpperCase();
|
|
@@ -43164,7 +43887,7 @@ import { spawn } from "node:child_process";
|
|
|
43164
43887
|
import { open as fsOpen } from "node:fs/promises";
|
|
43165
43888
|
import { join as join20 } from "node:path";
|
|
43166
43889
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
43167
|
-
import { getCleoHome as getCleoHome3, getProjectRoot as
|
|
43890
|
+
import { getCleoHome as getCleoHome3, getProjectRoot as getProjectRoot30 } from "@cleocode/core";
|
|
43168
43891
|
function getCleoBinPath() {
|
|
43169
43892
|
const thisFile = fileURLToPath6(import.meta.url);
|
|
43170
43893
|
return join20(thisFile, "..", "..", "index.js");
|
|
@@ -43215,7 +43938,7 @@ async function spawnDetachedServer(opts) {
|
|
|
43215
43938
|
detached: true,
|
|
43216
43939
|
stdio,
|
|
43217
43940
|
env: { ...process.env, [DETACHED_CHILD_ENV]: "1" },
|
|
43218
|
-
cwd:
|
|
43941
|
+
cwd: getProjectRoot30()
|
|
43219
43942
|
});
|
|
43220
43943
|
child.unref();
|
|
43221
43944
|
if (handle) await handle.close();
|
|
@@ -43367,7 +44090,7 @@ var init_docs_viewer = __esm({
|
|
|
43367
44090
|
pid: process.pid,
|
|
43368
44091
|
port: handle.port,
|
|
43369
44092
|
host: handle.host,
|
|
43370
|
-
projectRoot:
|
|
44093
|
+
projectRoot: getProjectRoot30(),
|
|
43371
44094
|
startedAt: Date.now()
|
|
43372
44095
|
};
|
|
43373
44096
|
await writeViewerPidFile(record);
|
|
@@ -43651,7 +44374,7 @@ import {
|
|
|
43651
44374
|
createAttachmentStoreDocsAccessor,
|
|
43652
44375
|
exportDocument,
|
|
43653
44376
|
getAgentOutputsAbsolute,
|
|
43654
|
-
getProjectRoot as
|
|
44377
|
+
getProjectRoot as getProjectRoot31,
|
|
43655
44378
|
listDocVersions,
|
|
43656
44379
|
makeClassifierForScanRoot,
|
|
43657
44380
|
mergeDocs,
|
|
@@ -44037,7 +44760,7 @@ var init_docs3 = __esm({
|
|
|
44037
44760
|
const taskId = String(args.task);
|
|
44038
44761
|
const includeAttachments = args["include-attachments"] !== false;
|
|
44039
44762
|
const includeMemoryRefs = args["include-memory-refs"] === true;
|
|
44040
|
-
const projectRoot =
|
|
44763
|
+
const projectRoot = getProjectRoot31();
|
|
44041
44764
|
try {
|
|
44042
44765
|
const result = await exportDocument({
|
|
44043
44766
|
taskId,
|
|
@@ -44103,7 +44826,7 @@ var init_docs3 = __esm({
|
|
|
44103
44826
|
}
|
|
44104
44827
|
},
|
|
44105
44828
|
async run({ args }) {
|
|
44106
|
-
const projectRoot =
|
|
44829
|
+
const projectRoot = getProjectRoot31();
|
|
44107
44830
|
const limit = args.limit ? Number.parseInt(String(args.limit), 10) : 10;
|
|
44108
44831
|
try {
|
|
44109
44832
|
const result = args.owner ? await searchDocs2(String(args.query), {
|
|
@@ -44159,7 +44882,7 @@ var init_docs3 = __esm({
|
|
|
44159
44882
|
}
|
|
44160
44883
|
},
|
|
44161
44884
|
async run({ args }) {
|
|
44162
|
-
const projectRoot =
|
|
44885
|
+
const projectRoot = getProjectRoot31();
|
|
44163
44886
|
const rawStrategy = args.strategy ?? "three-way";
|
|
44164
44887
|
const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
|
|
44165
44888
|
try {
|
|
@@ -44208,7 +44931,7 @@ var init_docs3 = __esm({
|
|
|
44208
44931
|
}
|
|
44209
44932
|
},
|
|
44210
44933
|
async run({ args }) {
|
|
44211
|
-
const projectRoot =
|
|
44934
|
+
const projectRoot = getProjectRoot31();
|
|
44212
44935
|
const fmt = args.format ?? "mermaid";
|
|
44213
44936
|
try {
|
|
44214
44937
|
const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
|
|
@@ -44277,7 +45000,7 @@ var init_docs3 = __esm({
|
|
|
44277
45000
|
}
|
|
44278
45001
|
},
|
|
44279
45002
|
async run({ args }) {
|
|
44280
|
-
const projectRoot =
|
|
45003
|
+
const projectRoot = getProjectRoot31();
|
|
44281
45004
|
try {
|
|
44282
45005
|
const result = await rankDocs({
|
|
44283
45006
|
ownerId: String(args.for),
|
|
@@ -44315,7 +45038,7 @@ var init_docs3 = __esm({
|
|
|
44315
45038
|
}
|
|
44316
45039
|
},
|
|
44317
45040
|
async run({ args }) {
|
|
44318
|
-
const projectRoot =
|
|
45041
|
+
const projectRoot = getProjectRoot31();
|
|
44319
45042
|
try {
|
|
44320
45043
|
const result = await listDocVersions({
|
|
44321
45044
|
ownerId: String(args.for),
|
|
@@ -44358,7 +45081,7 @@ var init_docs3 = __esm({
|
|
|
44358
45081
|
}
|
|
44359
45082
|
},
|
|
44360
45083
|
async run({ args }) {
|
|
44361
|
-
const projectRoot =
|
|
45084
|
+
const projectRoot = getProjectRoot31();
|
|
44362
45085
|
try {
|
|
44363
45086
|
const result = await publishDocs({
|
|
44364
45087
|
ownerId: String(args.for),
|
|
@@ -44482,7 +45205,7 @@ var init_docs3 = __esm({
|
|
|
44482
45205
|
},
|
|
44483
45206
|
async run({ args }) {
|
|
44484
45207
|
if (args.from) {
|
|
44485
|
-
const projectRoot =
|
|
45208
|
+
const projectRoot = getProjectRoot31();
|
|
44486
45209
|
const ownerId = args.for ?? void 0;
|
|
44487
45210
|
if (!ownerId) {
|
|
44488
45211
|
cliError(
|
|
@@ -44549,7 +45272,7 @@ var init_docs3 = __esm({
|
|
|
44549
45272
|
}
|
|
44550
45273
|
},
|
|
44551
45274
|
async run() {
|
|
44552
|
-
const projectRoot =
|
|
45275
|
+
const projectRoot = getProjectRoot31();
|
|
44553
45276
|
try {
|
|
44554
45277
|
const result = await statusDocs({ projectRoot });
|
|
44555
45278
|
cliOutput(result, { command: "docs status", operation: "docs.status" });
|
|
@@ -44634,7 +45357,7 @@ var init_docs3 = __esm({
|
|
|
44634
45357
|
}
|
|
44635
45358
|
},
|
|
44636
45359
|
async run({ args }) {
|
|
44637
|
-
const projectRoot =
|
|
45360
|
+
const projectRoot = getProjectRoot31();
|
|
44638
45361
|
const dirArg = String(args.dir);
|
|
44639
45362
|
const scanRoot = isAbsolute2(dirArg) ? dirArg : resolve6(projectRoot, dirArg);
|
|
44640
45363
|
const dryRun = args["dry-run"] === true;
|
|
@@ -44708,15 +45431,15 @@ var init_docs3 = __esm({
|
|
|
44708
45431
|
}
|
|
44709
45432
|
},
|
|
44710
45433
|
async run({ args }) {
|
|
44711
|
-
const projectRoot =
|
|
45434
|
+
const projectRoot = getProjectRoot31();
|
|
44712
45435
|
const { registry, configError } = loadCliRegistry(projectRoot);
|
|
44713
45436
|
const kinds = registry.list().map(toWireKind);
|
|
44714
45437
|
const extensionsCount = kinds.filter((k) => k.isExtension).length;
|
|
44715
45438
|
let counts2;
|
|
44716
45439
|
if (args["include-counts"]) {
|
|
44717
45440
|
counts2 = {};
|
|
44718
|
-
const { createAttachmentStore:
|
|
44719
|
-
const store =
|
|
45441
|
+
const { createAttachmentStore: createAttachmentStore6 } = await import("@cleocode/core/internal");
|
|
45442
|
+
const store = createAttachmentStore6();
|
|
44720
45443
|
for (const k of kinds) counts2[k.kind] = 0;
|
|
44721
45444
|
try {
|
|
44722
45445
|
const rows = await store.listAllInProject(projectRoot);
|
|
@@ -44752,14 +45475,14 @@ var init_docs3 = __esm({
|
|
|
44752
45475
|
}
|
|
44753
45476
|
},
|
|
44754
45477
|
async run({ args }) {
|
|
44755
|
-
const projectRoot =
|
|
45478
|
+
const projectRoot = getProjectRoot31();
|
|
44756
45479
|
const { registry, configError } = loadCliRegistry(projectRoot);
|
|
44757
45480
|
const kinds = registry.list().map(toWireKind);
|
|
44758
45481
|
let counts2;
|
|
44759
45482
|
if (args.counts) {
|
|
44760
45483
|
counts2 = {};
|
|
44761
|
-
const { createAttachmentStore:
|
|
44762
|
-
const store =
|
|
45484
|
+
const { createAttachmentStore: createAttachmentStore6 } = await import("@cleocode/core/internal");
|
|
45485
|
+
const store = createAttachmentStore6();
|
|
44763
45486
|
for (const k of kinds) counts2[k.kind] = 0;
|
|
44764
45487
|
try {
|
|
44765
45488
|
const rows2 = await store.listAllInProject(projectRoot);
|
|
@@ -45106,7 +45829,7 @@ __export(migrate_agents_v2_exports, {
|
|
|
45106
45829
|
import { createHash as createHash2 } from "node:crypto";
|
|
45107
45830
|
import { appendFileSync as appendFileSync2, existsSync as existsSync14, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync14 } from "node:fs";
|
|
45108
45831
|
import { join as join22 } from "node:path";
|
|
45109
|
-
import { getProjectRoot as
|
|
45832
|
+
import { getProjectRoot as getProjectRoot32, installAgentFromCant } from "@cleocode/core/internal";
|
|
45110
45833
|
import { openCleoDb } from "@cleocode/core/store/open-cleo-db";
|
|
45111
45834
|
function sha256Hex(bytes) {
|
|
45112
45835
|
return createHash2("sha256").update(bytes).digest("hex");
|
|
@@ -45293,7 +46016,7 @@ var init_migrate_agents_v2 = __esm({
|
|
|
45293
46016
|
}
|
|
45294
46017
|
},
|
|
45295
46018
|
async run({ args }) {
|
|
45296
|
-
const projectRoot =
|
|
46019
|
+
const projectRoot = getProjectRoot32();
|
|
45297
46020
|
const verbose = args.quiet !== true;
|
|
45298
46021
|
if (verbose) {
|
|
45299
46022
|
humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
|
|
@@ -45337,7 +46060,7 @@ __export(doctor_exports, {
|
|
|
45337
46060
|
});
|
|
45338
46061
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
45339
46062
|
import { join as join23 } from "node:path";
|
|
45340
|
-
import { getProjectRoot as
|
|
46063
|
+
import { getProjectRoot as getProjectRoot33 } from "@cleocode/core";
|
|
45341
46064
|
import {
|
|
45342
46065
|
quarantineRogueCleoDir,
|
|
45343
46066
|
scanRogueCleoDirs
|
|
@@ -45580,7 +46303,7 @@ var init_doctor = __esm({
|
|
|
45580
46303
|
try {
|
|
45581
46304
|
if (args.brain) {
|
|
45582
46305
|
const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
|
|
45583
|
-
const projectRoot =
|
|
46306
|
+
const projectRoot = getProjectRoot33();
|
|
45584
46307
|
const dashboard = await computeBrainHealthDashboard(projectRoot);
|
|
45585
46308
|
cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
|
|
45586
46309
|
if (dashboard.hasP0Failure) {
|
|
@@ -45589,7 +46312,7 @@ var init_doctor = __esm({
|
|
|
45589
46312
|
return;
|
|
45590
46313
|
}
|
|
45591
46314
|
if (args["scan-test-fixtures-in-prod"]) {
|
|
45592
|
-
const projectRoot =
|
|
46315
|
+
const projectRoot = getProjectRoot33();
|
|
45593
46316
|
const matches = await scanTestFixturesInProd(projectRoot);
|
|
45594
46317
|
const dryRun = args["dry-run"] !== false && args.quarantine !== true;
|
|
45595
46318
|
const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
|
|
@@ -45677,7 +46400,7 @@ var init_doctor = __esm({
|
|
|
45677
46400
|
progress.complete("Comprehensive diagnostics complete");
|
|
45678
46401
|
} else if (args["scan-rogue-cleo-dirs"]) {
|
|
45679
46402
|
progress.step(0, "Scanning for rogue .cleo/ directories");
|
|
45680
|
-
const projectRoot =
|
|
46403
|
+
const projectRoot = getProjectRoot33();
|
|
45681
46404
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
45682
46405
|
progress.complete(
|
|
45683
46406
|
`Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
|
|
@@ -45686,7 +46409,7 @@ var init_doctor = __esm({
|
|
|
45686
46409
|
} else if (args["quarantine-rogue-cleo-dirs"]) {
|
|
45687
46410
|
const isDryRun = args["dry-run"] === true;
|
|
45688
46411
|
progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
|
|
45689
|
-
const projectRoot =
|
|
46412
|
+
const projectRoot = getProjectRoot33();
|
|
45690
46413
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
45691
46414
|
if (reports.length === 0) {
|
|
45692
46415
|
progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
|
|
@@ -45740,7 +46463,7 @@ var init_doctor = __esm({
|
|
|
45740
46463
|
const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
|
|
45741
46464
|
const { getCleoHome: getCleoHome6 } = await import("@cleocode/core");
|
|
45742
46465
|
const cleoHome = getCleoHome6();
|
|
45743
|
-
const projectRoot =
|
|
46466
|
+
const projectRoot = getProjectRoot33();
|
|
45744
46467
|
const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
|
|
45745
46468
|
const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
|
|
45746
46469
|
const isDryRun = args["dry-run"] === true;
|
|
@@ -45771,16 +46494,27 @@ var init_doctor = __esm({
|
|
|
45771
46494
|
process.exitCode = 2;
|
|
45772
46495
|
}
|
|
45773
46496
|
} else if (args["audit-worktree-orphans"]) {
|
|
45774
|
-
progress.step(0, "
|
|
45775
|
-
const { scanWorktreeOrphans } = await import("@cleocode/core/doctor/worktree-orphans.js");
|
|
45776
|
-
const projectRoot =
|
|
45777
|
-
const
|
|
45778
|
-
|
|
46497
|
+
progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
|
|
46498
|
+
const { auditWorktreeOrphansComprehensive, scanWorktreeOrphans } = await import("@cleocode/core/doctor/worktree-orphans.js");
|
|
46499
|
+
const projectRoot = getProjectRoot33();
|
|
46500
|
+
const [comprehensive, legacyOrphans] = await Promise.all([
|
|
46501
|
+
auditWorktreeOrphansComprehensive(projectRoot),
|
|
46502
|
+
scanWorktreeOrphans(projectRoot)
|
|
46503
|
+
]);
|
|
46504
|
+
const totalAnomalies = comprehensive.count;
|
|
46505
|
+
progress.complete(
|
|
46506
|
+
`Found ${totalAnomalies} anomal${totalAnomalies === 1 ? "y" : "ies"}` + (legacyOrphans.length > 0 ? ` (${legacyOrphans.length} legacy orphan(s))` : "")
|
|
46507
|
+
);
|
|
45779
46508
|
cliOutput(
|
|
45780
|
-
{
|
|
46509
|
+
{
|
|
46510
|
+
projectRoot,
|
|
46511
|
+
comprehensive,
|
|
46512
|
+
legacyOrphans,
|
|
46513
|
+
count: totalAnomalies
|
|
46514
|
+
},
|
|
45781
46515
|
{ command: "doctor", operation: "doctor.audit-worktree-orphans" }
|
|
45782
46516
|
);
|
|
45783
|
-
if (
|
|
46517
|
+
if (totalAnomalies > 0 && (process.exitCode === void 0 || process.exitCode === 0)) {
|
|
45784
46518
|
process.exitCode = 2;
|
|
45785
46519
|
}
|
|
45786
46520
|
} else if (args["prune-worktree-orphans"]) {
|
|
@@ -45790,7 +46524,7 @@ var init_doctor = __esm({
|
|
|
45790
46524
|
`${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
|
|
45791
46525
|
);
|
|
45792
46526
|
const { pruneWorktreeOrphans, scanWorktreeOrphans } = await import("@cleocode/core/doctor/worktree-orphans.js");
|
|
45793
|
-
const projectRoot =
|
|
46527
|
+
const projectRoot = getProjectRoot33();
|
|
45794
46528
|
const orphans = await scanWorktreeOrphans(projectRoot);
|
|
45795
46529
|
if (orphans.length === 0) {
|
|
45796
46530
|
progress.complete("No worktree orphans found \u2014 nothing to prune");
|
|
@@ -45845,7 +46579,7 @@ var init_doctor = __esm({
|
|
|
45845
46579
|
{ command: "doctor", operation: "admin.health" }
|
|
45846
46580
|
);
|
|
45847
46581
|
try {
|
|
45848
|
-
const projectRoot =
|
|
46582
|
+
const projectRoot = getProjectRoot33();
|
|
45849
46583
|
const conflicts = readMigrationConflicts(projectRoot);
|
|
45850
46584
|
if (conflicts.length > 0) {
|
|
45851
46585
|
progress.complete(
|
|
@@ -46664,6 +47398,42 @@ var init_find = __esm({
|
|
|
46664
47398
|
}
|
|
46665
47399
|
});
|
|
46666
47400
|
|
|
47401
|
+
// packages/cleo/src/cli/commands/focus.ts
|
|
47402
|
+
var focus_exports = {};
|
|
47403
|
+
__export(focus_exports, {
|
|
47404
|
+
focusCommand: () => focusCommand
|
|
47405
|
+
});
|
|
47406
|
+
var focusCommand;
|
|
47407
|
+
var init_focus3 = __esm({
|
|
47408
|
+
"packages/cleo/src/cli/commands/focus.ts"() {
|
|
47409
|
+
"use strict";
|
|
47410
|
+
init_dist();
|
|
47411
|
+
init_cli();
|
|
47412
|
+
focusCommand = defineCommand({
|
|
47413
|
+
meta: {
|
|
47414
|
+
name: "focus",
|
|
47415
|
+
description: "Single-envelope orientation for a task, epic, or saga \u2014 replaces 8 separate calls with one"
|
|
47416
|
+
},
|
|
47417
|
+
args: {
|
|
47418
|
+
id: {
|
|
47419
|
+
type: "positional",
|
|
47420
|
+
description: "Task, Epic, or Saga ID to orient on (e.g. T9973, T9831)",
|
|
47421
|
+
required: true
|
|
47422
|
+
}
|
|
47423
|
+
},
|
|
47424
|
+
async run({ args }) {
|
|
47425
|
+
await dispatchFromCli(
|
|
47426
|
+
"query",
|
|
47427
|
+
"focus",
|
|
47428
|
+
"show",
|
|
47429
|
+
{ id: args["id"] },
|
|
47430
|
+
{ command: "focus" }
|
|
47431
|
+
);
|
|
47432
|
+
}
|
|
47433
|
+
});
|
|
47434
|
+
}
|
|
47435
|
+
});
|
|
47436
|
+
|
|
46667
47437
|
// packages/cleo/src/cli/commands/gc.ts
|
|
46668
47438
|
var gc_exports = {};
|
|
46669
47439
|
__export(gc_exports, {
|
|
@@ -48960,7 +49730,7 @@ var llm_cost_exports = {};
|
|
|
48960
49730
|
__export(llm_cost_exports, {
|
|
48961
49731
|
costCommand: () => costCommand
|
|
48962
49732
|
});
|
|
48963
|
-
import { getProjectRoot as
|
|
49733
|
+
import { getProjectRoot as getProjectRoot34 } from "@cleocode/core/internal";
|
|
48964
49734
|
import { computeCost } from "@cleocode/core/llm/usage-pricing";
|
|
48965
49735
|
function resolveSessionId(raw) {
|
|
48966
49736
|
if (raw === "current") {
|
|
@@ -49033,7 +49803,7 @@ var init_llm_cost = __esm({
|
|
|
49033
49803
|
process.exit(6);
|
|
49034
49804
|
}
|
|
49035
49805
|
const sessionId = resolveSessionId(rawSessionId);
|
|
49036
|
-
const projectRoot =
|
|
49806
|
+
const projectRoot = getProjectRoot34(process.cwd());
|
|
49037
49807
|
let breakdown;
|
|
49038
49808
|
try {
|
|
49039
49809
|
breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
|
|
@@ -50584,7 +51354,7 @@ import { createHash as createHash3 } from "node:crypto";
|
|
|
50584
51354
|
import { existsSync as existsSync16, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync16, writeFileSync as writeFileSync5 } from "node:fs";
|
|
50585
51355
|
import { homedir as homedir5 } from "node:os";
|
|
50586
51356
|
import { join as join27 } from "node:path";
|
|
50587
|
-
import { getProjectRoot as
|
|
51357
|
+
import { getProjectRoot as getProjectRoot35 } from "@cleocode/core";
|
|
50588
51358
|
import {
|
|
50589
51359
|
getBrainDb as getBrainDb2,
|
|
50590
51360
|
getDreamStatus,
|
|
@@ -51551,7 +52321,7 @@ var init_memory3 = __esm({
|
|
|
51551
52321
|
},
|
|
51552
52322
|
args: {},
|
|
51553
52323
|
async run() {
|
|
51554
|
-
const root =
|
|
52324
|
+
const root = getProjectRoot35();
|
|
51555
52325
|
try {
|
|
51556
52326
|
const result = await runConsolidation(root);
|
|
51557
52327
|
cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
|
|
@@ -51575,7 +52345,7 @@ var init_memory3 = __esm({
|
|
|
51575
52345
|
}
|
|
51576
52346
|
},
|
|
51577
52347
|
async run({ args }) {
|
|
51578
|
-
const root =
|
|
52348
|
+
const root = getProjectRoot35();
|
|
51579
52349
|
if (args.status) {
|
|
51580
52350
|
try {
|
|
51581
52351
|
const status = await getDreamStatus(root);
|
|
@@ -51612,7 +52382,7 @@ var init_memory3 = __esm({
|
|
|
51612
52382
|
}
|
|
51613
52383
|
},
|
|
51614
52384
|
async run({ args }) {
|
|
51615
|
-
const root =
|
|
52385
|
+
const root = getProjectRoot35();
|
|
51616
52386
|
try {
|
|
51617
52387
|
const { runObserver, runReflector } = await import("@cleocode/core/memory");
|
|
51618
52388
|
const observerResult = await runObserver(root, args.session, {
|
|
@@ -51652,7 +52422,7 @@ var init_memory3 = __esm({
|
|
|
51652
52422
|
}
|
|
51653
52423
|
},
|
|
51654
52424
|
async run({ args }) {
|
|
51655
|
-
const root =
|
|
52425
|
+
const root = getProjectRoot35();
|
|
51656
52426
|
try {
|
|
51657
52427
|
await getBrainDb2(root);
|
|
51658
52428
|
const { totalDuplicateRows, groups } = await scanDuplicateEntries();
|
|
@@ -51698,7 +52468,7 @@ var init_memory3 = __esm({
|
|
|
51698
52468
|
async run({ args }) {
|
|
51699
52469
|
const sourceDir = args.from ?? join27(homedir5(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
51700
52470
|
const isDryRun = !!args["dry-run"];
|
|
51701
|
-
const projectRoot =
|
|
52471
|
+
const projectRoot = getProjectRoot35();
|
|
51702
52472
|
const stateFile = join27(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
51703
52473
|
if (!existsSync16(sourceDir)) {
|
|
51704
52474
|
cliError(`Source directory not found: ${sourceDir}`, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
|
|
@@ -51911,7 +52681,7 @@ var init_memory3 = __esm({
|
|
|
51911
52681
|
},
|
|
51912
52682
|
args: {},
|
|
51913
52683
|
async run() {
|
|
51914
|
-
const root =
|
|
52684
|
+
const root = getProjectRoot35();
|
|
51915
52685
|
try {
|
|
51916
52686
|
await getBrainDb2(root);
|
|
51917
52687
|
const result = await getTierStats(root);
|
|
@@ -51954,7 +52724,7 @@ var init_memory3 = __esm({
|
|
|
51954
52724
|
}
|
|
51955
52725
|
},
|
|
51956
52726
|
async run({ args }) {
|
|
51957
|
-
const root =
|
|
52727
|
+
const root = getProjectRoot35();
|
|
51958
52728
|
const targetTier = args.to;
|
|
51959
52729
|
const reason = args.reason;
|
|
51960
52730
|
const validTiers = ["medium", "long"];
|
|
@@ -52020,7 +52790,7 @@ var init_memory3 = __esm({
|
|
|
52020
52790
|
}
|
|
52021
52791
|
},
|
|
52022
52792
|
async run({ args }) {
|
|
52023
|
-
const root =
|
|
52793
|
+
const root = getProjectRoot35();
|
|
52024
52794
|
const targetTier = args.to;
|
|
52025
52795
|
const reason = args.reason;
|
|
52026
52796
|
const validTiers = ["short", "medium"];
|
|
@@ -52488,7 +53258,7 @@ var migrate_claude_mem_exports = {};
|
|
|
52488
53258
|
__export(migrate_claude_mem_exports, {
|
|
52489
53259
|
migrateClaudeMemCommand: () => migrateClaudeMemCommand
|
|
52490
53260
|
});
|
|
52491
|
-
import { getProjectRoot as
|
|
53261
|
+
import { getProjectRoot as getProjectRoot36, migrateClaudeMem } from "@cleocode/core/internal";
|
|
52492
53262
|
import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
|
|
52493
53263
|
import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
|
|
52494
53264
|
var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
|
|
@@ -52551,7 +53321,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
52551
53321
|
}
|
|
52552
53322
|
},
|
|
52553
53323
|
async run({ args }) {
|
|
52554
|
-
const root =
|
|
53324
|
+
const root = getProjectRoot36();
|
|
52555
53325
|
try {
|
|
52556
53326
|
const result = await migrateClaudeMem(root, {
|
|
52557
53327
|
sourcePath: args.source,
|
|
@@ -52600,7 +53370,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
52600
53370
|
}
|
|
52601
53371
|
},
|
|
52602
53372
|
async run({ args }) {
|
|
52603
|
-
const projectRoot =
|
|
53373
|
+
const projectRoot = getProjectRoot36();
|
|
52604
53374
|
try {
|
|
52605
53375
|
const db = await getDb2(projectRoot);
|
|
52606
53376
|
const rcasdFlag = Boolean(args.rcasd);
|
|
@@ -52704,7 +53474,7 @@ __export(nexus_exports, {
|
|
|
52704
53474
|
import { appendFile as appendFile2, mkdir as mkdir3 } from "node:fs/promises";
|
|
52705
53475
|
import { homedir as homedir6 } from "node:os";
|
|
52706
53476
|
import path4 from "node:path";
|
|
52707
|
-
import { getProjectRoot as
|
|
53477
|
+
import { getProjectRoot as getProjectRoot37 } from "@cleocode/core";
|
|
52708
53478
|
import { generateGexf, getSymbolImpact } from "@cleocode/core/nexus";
|
|
52709
53479
|
async function appendDeprecationTelemetry(op, replacement) {
|
|
52710
53480
|
try {
|
|
@@ -52816,7 +53586,7 @@ var init_nexus4 = __esm({
|
|
|
52816
53586
|
async run({ args }) {
|
|
52817
53587
|
applyJsonFlag2(args.json);
|
|
52818
53588
|
const projectIdOverride = args["project-id"];
|
|
52819
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
53589
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
52820
53590
|
const startTime = Date.now();
|
|
52821
53591
|
try {
|
|
52822
53592
|
const [{ getNexusDb, nexusSchema }, { getIndexStats }] = await Promise.all([
|
|
@@ -53331,7 +54101,7 @@ var init_nexus4 = __esm({
|
|
|
53331
54101
|
applyJsonFlag2(args.json);
|
|
53332
54102
|
const startTime = Date.now();
|
|
53333
54103
|
const projectIdOverride = args["project-id"];
|
|
53334
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
54104
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
53335
54105
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
53336
54106
|
const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
|
|
53337
54107
|
const durationMs = Date.now() - startTime;
|
|
@@ -53375,7 +54145,7 @@ var init_nexus4 = __esm({
|
|
|
53375
54145
|
applyJsonFlag2(args.json);
|
|
53376
54146
|
const startTime = Date.now();
|
|
53377
54147
|
const projectIdOverride = args["project-id"];
|
|
53378
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
54148
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
53379
54149
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
53380
54150
|
const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
|
|
53381
54151
|
const durationMs = Date.now() - startTime;
|
|
@@ -53418,7 +54188,7 @@ var init_nexus4 = __esm({
|
|
|
53418
54188
|
void appendDeprecationTelemetry("nexus.context", "cleo graph context");
|
|
53419
54189
|
const startTime = Date.now();
|
|
53420
54190
|
const projectIdOverride = args["project-id"];
|
|
53421
|
-
const repoPath =
|
|
54191
|
+
const repoPath = getProjectRoot37();
|
|
53422
54192
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
53423
54193
|
const limit = parseInt(args.limit, 10);
|
|
53424
54194
|
const symbolName = args.symbol;
|
|
@@ -53481,7 +54251,7 @@ var init_nexus4 = __esm({
|
|
|
53481
54251
|
const startTime = Date.now();
|
|
53482
54252
|
const whyFlag = !!args.why;
|
|
53483
54253
|
const projectIdOverride = args["project-id"];
|
|
53484
|
-
const repoPath =
|
|
54254
|
+
const repoPath = getProjectRoot37();
|
|
53485
54255
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
53486
54256
|
const maxDepth = Math.min(parseInt(args.depth, 10), 5);
|
|
53487
54257
|
const symbolName = args.symbol;
|
|
@@ -53553,7 +54323,7 @@ var init_nexus4 = __esm({
|
|
|
53553
54323
|
const projectIdOverride = args["project-id"];
|
|
53554
54324
|
const isIncremental = !!args.incremental;
|
|
53555
54325
|
const ctx = getFormatContext();
|
|
53556
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
54326
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
53557
54327
|
humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
|
|
53558
54328
|
try {
|
|
53559
54329
|
const [{ getNexusDb, nexusSchema }, { runPipeline }, { eq: eq2 }] = await Promise.all([
|
|
@@ -53705,7 +54475,7 @@ var init_nexus4 = __esm({
|
|
|
53705
54475
|
async run({ args }) {
|
|
53706
54476
|
applyJsonFlag2(args.json);
|
|
53707
54477
|
const startTime = Date.now();
|
|
53708
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
54478
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
53709
54479
|
const name = args.name;
|
|
53710
54480
|
const response = await dispatchRaw("mutate", "nexus", "projects.register", {
|
|
53711
54481
|
path: repoPath,
|
|
@@ -54063,7 +54833,7 @@ var init_nexus4 = __esm({
|
|
|
54063
54833
|
applyJsonFlag2(args.json);
|
|
54064
54834
|
const startTime = Date.now();
|
|
54065
54835
|
const projectIdOverride = args["project-id"];
|
|
54066
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
54836
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
54067
54837
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
54068
54838
|
const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
|
|
54069
54839
|
repoPath,
|
|
@@ -54212,7 +54982,7 @@ var init_nexus4 = __esm({
|
|
|
54212
54982
|
async run({ args }) {
|
|
54213
54983
|
applyJsonFlag2(args.json);
|
|
54214
54984
|
const startTime = Date.now();
|
|
54215
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
54985
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
54216
54986
|
const projectIdOverride = args["project-id"];
|
|
54217
54987
|
const beforeRef = args.before ?? "HEAD~1";
|
|
54218
54988
|
const afterRef = args.after ?? "HEAD";
|
|
@@ -54330,7 +55100,7 @@ var init_nexus4 = __esm({
|
|
|
54330
55100
|
applyJsonFlag2(args.json);
|
|
54331
55101
|
const startTime = Date.now();
|
|
54332
55102
|
const projectIdOverride = args["project-id"];
|
|
54333
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
55103
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
54334
55104
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
54335
55105
|
const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
|
|
54336
55106
|
const durationMs = Date.now() - startTime;
|
|
@@ -54386,7 +55156,7 @@ var init_nexus4 = __esm({
|
|
|
54386
55156
|
const startTime = Date.now();
|
|
54387
55157
|
const routeSymbol = args.routeSymbol;
|
|
54388
55158
|
const projectIdOverride = args["project-id"];
|
|
54389
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
55159
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
54390
55160
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
54391
55161
|
const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
|
|
54392
55162
|
const durationMs = Date.now() - startTime;
|
|
@@ -54776,7 +55546,7 @@ var init_nexus4 = __esm({
|
|
|
54776
55546
|
async run({ args }) {
|
|
54777
55547
|
applyJsonFlag2(args.json);
|
|
54778
55548
|
const startTime = Date.now();
|
|
54779
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
55549
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
54780
55550
|
const projectIdOverride = args["project-id"];
|
|
54781
55551
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
54782
55552
|
const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
|
|
@@ -54880,7 +55650,7 @@ var init_nexus4 = __esm({
|
|
|
54880
55650
|
async run({ args }) {
|
|
54881
55651
|
applyJsonFlag2(args.json);
|
|
54882
55652
|
const startTime = Date.now();
|
|
54883
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
55653
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot37();
|
|
54884
55654
|
const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
54885
55655
|
const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
|
|
54886
55656
|
projectId,
|
|
@@ -54956,7 +55726,7 @@ var init_nexus4 = __esm({
|
|
|
54956
55726
|
async run({ args }) {
|
|
54957
55727
|
applyJsonFlag2(args.json);
|
|
54958
55728
|
const startTime = Date.now();
|
|
54959
|
-
const outputDir = args.output ?? path4.join(
|
|
55729
|
+
const outputDir = args.output ?? path4.join(getProjectRoot37(), ".cleo", "wiki");
|
|
54960
55730
|
const communityFilter = args.community ?? void 0;
|
|
54961
55731
|
const isIncremental = !!args.incremental;
|
|
54962
55732
|
let loomProvider = null;
|
|
@@ -54980,11 +55750,11 @@ var init_nexus4 = __esm({
|
|
|
54980
55750
|
}
|
|
54981
55751
|
try {
|
|
54982
55752
|
const { generateNexusWikiIndex } = await import("@cleocode/core/nexus/wiki-index.js");
|
|
54983
|
-
const result = await generateNexusWikiIndex(outputDir,
|
|
55753
|
+
const result = await generateNexusWikiIndex(outputDir, getProjectRoot37(), {
|
|
54984
55754
|
communityFilter,
|
|
54985
55755
|
incremental: isIncremental,
|
|
54986
55756
|
loomProvider,
|
|
54987
|
-
projectRoot:
|
|
55757
|
+
projectRoot: getProjectRoot37()
|
|
54988
55758
|
});
|
|
54989
55759
|
const durationMs = Date.now() - startTime;
|
|
54990
55760
|
if (!result.success) {
|
|
@@ -55587,6 +56357,10 @@ var init_orchestrate3 = __esm({
|
|
|
55587
56357
|
"no-worktree": {
|
|
55588
56358
|
type: "boolean",
|
|
55589
56359
|
description: "Skip worktree provisioning for this spawn. The opt-out is logged to the audit log (T1140)."
|
|
56360
|
+
},
|
|
56361
|
+
scope: {
|
|
56362
|
+
type: "string",
|
|
56363
|
+
description: "T9807 sparse-checkout scope: directory prefix to check out in the worktree (cone mode). Example: --scope packages/cleo creates a worktree with only that subtree checked out. Reduces disk usage and checkout time for tasks scoped to a single package."
|
|
55590
56364
|
}
|
|
55591
56365
|
},
|
|
55592
56366
|
async run({ args }) {
|
|
@@ -55605,7 +56379,8 @@ var init_orchestrate3 = __esm({
|
|
|
55605
56379
|
taskId: args.taskId,
|
|
55606
56380
|
protocolType: args.protocol,
|
|
55607
56381
|
tier,
|
|
55608
|
-
noWorktree: args["no-worktree"] === true
|
|
56382
|
+
noWorktree: args["no-worktree"] === true,
|
|
56383
|
+
...args.scope ? { spawnScope: args.scope } : {}
|
|
55609
56384
|
},
|
|
55610
56385
|
{ command: "orchestrate" }
|
|
55611
56386
|
);
|
|
@@ -57400,7 +58175,7 @@ var refresh_memory_exports = {};
|
|
|
57400
58175
|
__export(refresh_memory_exports, {
|
|
57401
58176
|
refreshMemoryCommand: () => refreshMemoryCommand
|
|
57402
58177
|
});
|
|
57403
|
-
import { getProjectRoot as
|
|
58178
|
+
import { getProjectRoot as getProjectRoot38 } from "@cleocode/core";
|
|
57404
58179
|
var refreshMemoryCommand;
|
|
57405
58180
|
var init_refresh_memory = __esm({
|
|
57406
58181
|
"packages/cleo/src/cli/commands/refresh-memory.ts"() {
|
|
@@ -57413,7 +58188,7 @@ var init_refresh_memory = __esm({
|
|
|
57413
58188
|
description: "Regenerate .cleo/memory-bridge.md from brain.db"
|
|
57414
58189
|
},
|
|
57415
58190
|
async run() {
|
|
57416
|
-
const projectDir =
|
|
58191
|
+
const projectDir = getProjectRoot38();
|
|
57417
58192
|
const { writeMemoryBridge } = await import("@cleocode/core/internal");
|
|
57418
58193
|
const result = await writeMemoryBridge(projectDir);
|
|
57419
58194
|
if (result.written) {
|
|
@@ -58801,7 +59576,7 @@ __export(restore_exports, {
|
|
|
58801
59576
|
});
|
|
58802
59577
|
import fs3 from "node:fs";
|
|
58803
59578
|
import path5 from "node:path";
|
|
58804
|
-
import { CleoError as CleoError7, getProjectRoot as
|
|
59579
|
+
import { CleoError as CleoError7, getProjectRoot as getProjectRoot39, getTaskAccessor as getTaskAccessor3 } from "@cleocode/core";
|
|
58805
59580
|
function parseMarkdownValue(raw) {
|
|
58806
59581
|
const trimmed = raw.trim();
|
|
58807
59582
|
if (trimmed === "_(not present)_" || trimmed === "") return void 0;
|
|
@@ -58921,7 +59696,7 @@ var init_restore = __esm({
|
|
|
58921
59696
|
description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
|
|
58922
59697
|
},
|
|
58923
59698
|
async run() {
|
|
58924
|
-
const projectRoot =
|
|
59699
|
+
const projectRoot = getProjectRoot39();
|
|
58925
59700
|
const reportPath = path5.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
|
|
58926
59701
|
if (!fs3.existsSync(reportPath)) {
|
|
58927
59702
|
humanLine("No pending restore conflicts. Nothing to finalize.");
|
|
@@ -61327,7 +62102,7 @@ var sequence_exports = {};
|
|
|
61327
62102
|
__export(sequence_exports, {
|
|
61328
62103
|
sequenceCommand: () => sequenceCommand
|
|
61329
62104
|
});
|
|
61330
|
-
import { getProjectRoot as
|
|
62105
|
+
import { getProjectRoot as getProjectRoot40 } from "@cleocode/core/internal";
|
|
61331
62106
|
var showCommand12, checkCommand6, repairCommand, sequenceCommand;
|
|
61332
62107
|
var init_sequence = __esm({
|
|
61333
62108
|
"packages/cleo/src/cli/commands/sequence.ts"() {
|
|
@@ -61363,7 +62138,7 @@ var init_sequence = __esm({
|
|
|
61363
62138
|
meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
|
|
61364
62139
|
async run() {
|
|
61365
62140
|
const { repairSequence } = await import("@cleocode/core/internal");
|
|
61366
|
-
const projectRoot =
|
|
62141
|
+
const projectRoot = getProjectRoot40();
|
|
61367
62142
|
const repair = await repairSequence(projectRoot);
|
|
61368
62143
|
const result = {
|
|
61369
62144
|
repaired: repair.repaired,
|
|
@@ -61452,7 +62227,7 @@ async function promptOwnerAuthPassword(sessionName) {
|
|
|
61452
62227
|
const token = deriveOwnerAuthToken(sessionName, password);
|
|
61453
62228
|
return token;
|
|
61454
62229
|
}
|
|
61455
|
-
var startCommand7, endCommand, handoffCommand2, statusCommand14, resumeCommand2, findCommand6, listCommand23, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, lintCommand, sessionCommand;
|
|
62230
|
+
var startCommand7, endCommand, handoffCommand2, statusCommand14, resumeCommand2, findCommand6, listCommand23, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, adoptCommand, lintCommand, sessionCommand;
|
|
61456
62231
|
var init_session4 = __esm({
|
|
61457
62232
|
"packages/cleo/src/cli/commands/session.ts"() {
|
|
61458
62233
|
"use strict";
|
|
@@ -61527,7 +62302,9 @@ var init_session4 = __esm({
|
|
|
61527
62302
|
// CLI-level alias normalization: --focus and --start-task both map to startTask (ADR-057 D2)
|
|
61528
62303
|
startTask: args["start-task"] ?? args.focus,
|
|
61529
62304
|
grade: args.grade,
|
|
61530
|
-
ownerAuthToken
|
|
62305
|
+
ownerAuthToken,
|
|
62306
|
+
// T9975: per-agent handle for multi-agent isolation
|
|
62307
|
+
agentHandle: args.agent
|
|
61531
62308
|
},
|
|
61532
62309
|
{ command: "session", operation: "session.start" }
|
|
61533
62310
|
);
|
|
@@ -61732,6 +62509,15 @@ var init_session4 = __esm({
|
|
|
61732
62509
|
offset: {
|
|
61733
62510
|
type: "string",
|
|
61734
62511
|
description: "Skip first n results"
|
|
62512
|
+
},
|
|
62513
|
+
/**
|
|
62514
|
+
* T9975: surface all per-agent columns (agent, scope, lastActivity).
|
|
62515
|
+
* When set, the result includes agentHandle, scopeKind, scopeId, and
|
|
62516
|
+
* lastActivity for each session — useful for multi-agent dashboards.
|
|
62517
|
+
*/
|
|
62518
|
+
all: {
|
|
62519
|
+
type: "boolean",
|
|
62520
|
+
description: "Show all columns including per-agent fields (agent, scope, lastActivity) \u2014 T9975"
|
|
61735
62521
|
}
|
|
61736
62522
|
},
|
|
61737
62523
|
async run({ args }) {
|
|
@@ -61742,7 +62528,8 @@ var init_session4 = __esm({
|
|
|
61742
62528
|
{
|
|
61743
62529
|
status: args.status,
|
|
61744
62530
|
limit: args.limit ? Number.parseInt(args.limit, 10) : void 0,
|
|
61745
|
-
offset: args.offset ? Number.parseInt(args.offset, 10) : void 0
|
|
62531
|
+
offset: args.offset ? Number.parseInt(args.offset, 10) : void 0,
|
|
62532
|
+
all: args.all
|
|
61746
62533
|
},
|
|
61747
62534
|
{ command: "session", operation: "session.list" }
|
|
61748
62535
|
);
|
|
@@ -61806,8 +62593,8 @@ var init_session4 = __esm({
|
|
|
61806
62593
|
"audit-scope": { type: "string", description: "Audit log scope (global|local)" }
|
|
61807
62594
|
},
|
|
61808
62595
|
async run({ args }) {
|
|
61809
|
-
const { detectSessionDrift, getProjectRoot:
|
|
61810
|
-
const projectRoot = await
|
|
62596
|
+
const { detectSessionDrift, getProjectRoot: getProjectRoot44 } = await import("@cleocode/core");
|
|
62597
|
+
const projectRoot = await getProjectRoot44();
|
|
61811
62598
|
const scope = args["audit-scope"] === "local" ? "local" : "global";
|
|
61812
62599
|
const report = await detectSessionDrift({ projectRoot, auditScope: scope });
|
|
61813
62600
|
cliOutput(report, { command: "session drift", operation: "session.drift" });
|
|
@@ -61973,6 +62760,35 @@ var init_session4 = __esm({
|
|
|
61973
62760
|
);
|
|
61974
62761
|
}
|
|
61975
62762
|
});
|
|
62763
|
+
adoptCommand = defineCommand({
|
|
62764
|
+
meta: {
|
|
62765
|
+
name: "adopt",
|
|
62766
|
+
description: "Rebind env to a specific session \u2014 prints export command to eval (T9975)"
|
|
62767
|
+
},
|
|
62768
|
+
args: {
|
|
62769
|
+
sessionId: {
|
|
62770
|
+
type: "positional",
|
|
62771
|
+
description: "Session ID to adopt",
|
|
62772
|
+
required: true
|
|
62773
|
+
}
|
|
62774
|
+
},
|
|
62775
|
+
async run({ args }) {
|
|
62776
|
+
const response = await dispatchRaw("mutate", "session", "adopt", {
|
|
62777
|
+
sessionId: args.sessionId
|
|
62778
|
+
});
|
|
62779
|
+
if (!response.success) {
|
|
62780
|
+
handleRawError(response, { command: "session adopt", operation: "session.adopt" });
|
|
62781
|
+
return;
|
|
62782
|
+
}
|
|
62783
|
+
const data = response.data;
|
|
62784
|
+
if (data?.exportCommand) {
|
|
62785
|
+
process.stdout.write(`${data.exportCommand}
|
|
62786
|
+
`);
|
|
62787
|
+
} else {
|
|
62788
|
+
cliOutput(data ?? {}, { command: "session adopt", operation: "session.adopt" });
|
|
62789
|
+
}
|
|
62790
|
+
}
|
|
62791
|
+
});
|
|
61976
62792
|
lintCommand = defineCommand({
|
|
61977
62793
|
meta: {
|
|
61978
62794
|
name: "lint",
|
|
@@ -62014,7 +62830,9 @@ var init_session4 = __esm({
|
|
|
62014
62830
|
"record-assumption": recordAssumptionCommand,
|
|
62015
62831
|
"record-decision": recordDecisionCommand,
|
|
62016
62832
|
"decision-log": decisionLogCommand,
|
|
62017
|
-
lint: lintCommand
|
|
62833
|
+
lint: lintCommand,
|
|
62834
|
+
// T9975 — per-agent session isolation
|
|
62835
|
+
adopt: adoptCommand
|
|
62018
62836
|
},
|
|
62019
62837
|
async run({ cmd, rawArgs }) {
|
|
62020
62838
|
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
@@ -64660,7 +65478,7 @@ __export(token_exports, {
|
|
|
64660
65478
|
tokenCommand: () => tokenCommand
|
|
64661
65479
|
});
|
|
64662
65480
|
import { readFileSync as readFileSync17 } from "node:fs";
|
|
64663
|
-
import { getProjectRoot as
|
|
65481
|
+
import { getProjectRoot as getProjectRoot41, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
|
|
64664
65482
|
function readPayload(args, textKey, fileKey) {
|
|
64665
65483
|
const text = args[textKey];
|
|
64666
65484
|
const file = args[fileKey];
|
|
@@ -64824,7 +65642,7 @@ var init_token = __esm({
|
|
|
64824
65642
|
domain: args.domain,
|
|
64825
65643
|
operation: args.operation
|
|
64826
65644
|
};
|
|
64827
|
-
const result = args.record ? await recordTokenExchange2(
|
|
65645
|
+
const result = args.record ? await recordTokenExchange2(getProjectRoot41(), input2) : await measureTokenExchange(input2);
|
|
64828
65646
|
cliOutput(result, {
|
|
64829
65647
|
command: "token",
|
|
64830
65648
|
operation: args.record ? "admin.token.record" : "token.estimate"
|
|
@@ -64860,7 +65678,7 @@ __export(transcript_exports, {
|
|
|
64860
65678
|
});
|
|
64861
65679
|
import { homedir as homedir7 } from "node:os";
|
|
64862
65680
|
import { join as join31 } from "node:path";
|
|
64863
|
-
import { getProjectRoot as
|
|
65681
|
+
import { getProjectRoot as getProjectRoot42 } from "@cleocode/core";
|
|
64864
65682
|
import {
|
|
64865
65683
|
parseDurationMs,
|
|
64866
65684
|
pruneTranscripts,
|
|
@@ -64890,7 +65708,7 @@ var init_transcript = __esm({
|
|
|
64890
65708
|
async run({ args }) {
|
|
64891
65709
|
if (args.pending) {
|
|
64892
65710
|
try {
|
|
64893
|
-
const projectRoot =
|
|
65711
|
+
const projectRoot = getProjectRoot42();
|
|
64894
65712
|
const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
64895
65713
|
const pending = await scanPendingTranscripts(projectRoot);
|
|
64896
65714
|
cliOutput(
|
|
@@ -64987,7 +65805,7 @@ var init_transcript = __esm({
|
|
|
64987
65805
|
async run({ args }) {
|
|
64988
65806
|
const tier = args.tier ?? "warm";
|
|
64989
65807
|
const dryRun = args["dry-run"] ?? false;
|
|
64990
|
-
const projectRoot =
|
|
65808
|
+
const projectRoot = getProjectRoot42();
|
|
64991
65809
|
try {
|
|
64992
65810
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
64993
65811
|
const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -65099,7 +65917,7 @@ var init_transcript = __esm({
|
|
|
65099
65917
|
const dryRun = args["dry-run"] ?? false;
|
|
65100
65918
|
const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
|
|
65101
65919
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
|
|
65102
|
-
const projectRoot =
|
|
65920
|
+
const projectRoot = getProjectRoot42();
|
|
65103
65921
|
try {
|
|
65104
65922
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
65105
65923
|
const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -66226,7 +67044,7 @@ __export(worktree_exports, {
|
|
|
66226
67044
|
worktreeCommand: () => worktreeCommand
|
|
66227
67045
|
});
|
|
66228
67046
|
import readline4 from "node:readline";
|
|
66229
|
-
import { getProjectRoot as
|
|
67047
|
+
import { getProjectRoot as getProjectRoot43, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
|
|
66230
67048
|
async function promptYesNo2(question) {
|
|
66231
67049
|
return new Promise((resolve9) => {
|
|
66232
67050
|
const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -66247,7 +67065,7 @@ function renderOrphanPreamble(wt) {
|
|
|
66247
67065
|
""
|
|
66248
67066
|
].join("\n");
|
|
66249
67067
|
}
|
|
66250
|
-
var VALID_STATUS_VALUES, listCommand27, pruneCommand3, forceUnlockCommand, worktreeCommand;
|
|
67068
|
+
var VALID_STATUS_VALUES, listCommand27, pruneCommand3, destroyCommand, forceUnlockCommand, VALID_ADOPT_SOURCES, adoptCommand2, worktreeCommand;
|
|
66251
67069
|
var init_worktree3 = __esm({
|
|
66252
67070
|
"packages/cleo/src/cli/commands/worktree.ts"() {
|
|
66253
67071
|
"use strict";
|
|
@@ -66310,6 +67128,10 @@ var init_worktree3 = __esm({
|
|
|
66310
67128
|
days: {
|
|
66311
67129
|
type: "string",
|
|
66312
67130
|
description: "Override staleness threshold passed through to the listing (default: 7)."
|
|
67131
|
+
},
|
|
67132
|
+
"idle-days": {
|
|
67133
|
+
type: "string",
|
|
67134
|
+
description: "Abandonment-timeout threshold in days (T9805 AC2). Worktrees whose last commit is older than this value AND have no open PR are also pruned."
|
|
66313
67135
|
}
|
|
66314
67136
|
},
|
|
66315
67137
|
async run({ args }) {
|
|
@@ -66325,7 +67147,9 @@ var init_worktree3 = __esm({
|
|
|
66325
67147
|
const yes = args["yes"] === true;
|
|
66326
67148
|
const staleDaysRaw = typeof args["days"] === "string" ? args["days"] : void 0;
|
|
66327
67149
|
const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
|
|
66328
|
-
const
|
|
67150
|
+
const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
|
|
67151
|
+
const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
|
|
67152
|
+
const projectRoot = getProjectRoot43();
|
|
66329
67153
|
const listResult = await listWorktrees2({
|
|
66330
67154
|
projectRoot,
|
|
66331
67155
|
...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
|
|
@@ -66398,12 +67222,61 @@ var init_worktree3 = __esm({
|
|
|
66398
67222
|
{
|
|
66399
67223
|
dryRun,
|
|
66400
67224
|
paths: confirmedPaths,
|
|
66401
|
-
...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
|
|
67225
|
+
...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {},
|
|
67226
|
+
...idleDays !== void 0 && !Number.isNaN(idleDays) ? { idleDays } : {}
|
|
66402
67227
|
},
|
|
66403
67228
|
{ command: "worktree-prune", operation: "worktree.prune" }
|
|
66404
67229
|
);
|
|
66405
67230
|
}
|
|
66406
67231
|
});
|
|
67232
|
+
destroyCommand = defineCommand({
|
|
67233
|
+
meta: {
|
|
67234
|
+
name: "destroy",
|
|
67235
|
+
description: "Destroy the XDG worktree for a task, update audit log and sentinel index (T9805)."
|
|
67236
|
+
},
|
|
67237
|
+
args: {
|
|
67238
|
+
taskId: {
|
|
67239
|
+
type: "positional",
|
|
67240
|
+
description: "The task ID whose worktree to destroy (e.g. T9805).",
|
|
67241
|
+
required: true
|
|
67242
|
+
},
|
|
67243
|
+
force: {
|
|
67244
|
+
type: "boolean",
|
|
67245
|
+
description: "Force removal even when the worktree has uncommitted changes.",
|
|
67246
|
+
default: false
|
|
67247
|
+
},
|
|
67248
|
+
reason: {
|
|
67249
|
+
type: "string",
|
|
67250
|
+
description: "Reason string recorded in the audit log (e.g. pr-merged, manual, idle-timeout)."
|
|
67251
|
+
},
|
|
67252
|
+
"keep-branch": {
|
|
67253
|
+
type: "boolean",
|
|
67254
|
+
description: "Do not delete the task branch after removing the worktree.",
|
|
67255
|
+
default: false
|
|
67256
|
+
}
|
|
67257
|
+
},
|
|
67258
|
+
async run({ args }) {
|
|
67259
|
+
const rawTaskId = typeof args["taskId"] === "string" ? args["taskId"] : "";
|
|
67260
|
+
if (rawTaskId.length === 0) {
|
|
67261
|
+
cliError("Missing required positional: <taskId>.", 2);
|
|
67262
|
+
process.exit(2);
|
|
67263
|
+
return;
|
|
67264
|
+
}
|
|
67265
|
+
const reason = typeof args["reason"] === "string" && args["reason"].length > 0 ? args["reason"] : "manual";
|
|
67266
|
+
await dispatchFromCli(
|
|
67267
|
+
"mutate",
|
|
67268
|
+
"worktree",
|
|
67269
|
+
"destroy",
|
|
67270
|
+
{
|
|
67271
|
+
taskId: rawTaskId,
|
|
67272
|
+
force: args["force"] === true,
|
|
67273
|
+
deleteBranch: args["keep-branch"] !== true,
|
|
67274
|
+
reason
|
|
67275
|
+
},
|
|
67276
|
+
{ command: "worktree-destroy", operation: "worktree.destroy" }
|
|
67277
|
+
);
|
|
67278
|
+
}
|
|
67279
|
+
});
|
|
66407
67280
|
forceUnlockCommand = defineCommand({
|
|
66408
67281
|
meta: {
|
|
66409
67282
|
name: "force-unlock",
|
|
@@ -66432,6 +67305,56 @@ var init_worktree3 = __esm({
|
|
|
66432
67305
|
);
|
|
66433
67306
|
}
|
|
66434
67307
|
});
|
|
67308
|
+
VALID_ADOPT_SOURCES = ["claude-agent", "manual", "adopted"];
|
|
67309
|
+
adoptCommand2 = defineCommand({
|
|
67310
|
+
meta: {
|
|
67311
|
+
name: "adopt",
|
|
67312
|
+
description: "Register an externally-created worktree (e.g. Claude Code Agent isolation:worktree) in the CLEO SSoT so it surfaces in `cleo worktree list`."
|
|
67313
|
+
},
|
|
67314
|
+
args: {
|
|
67315
|
+
path: {
|
|
67316
|
+
type: "positional",
|
|
67317
|
+
description: "Absolute or relative path to the worktree directory to adopt. For Claude Code Agent worktrees this is typically `.claude/worktrees/<sessionId>/`.",
|
|
67318
|
+
required: true
|
|
67319
|
+
},
|
|
67320
|
+
source: {
|
|
67321
|
+
type: "string",
|
|
67322
|
+
description: `Source classification for this worktree (${VALID_ADOPT_SOURCES.join("|")}). Defaults to \`claude-agent\` for paths under \`.claude/worktrees/\`, else \`manual\`.`
|
|
67323
|
+
},
|
|
67324
|
+
"task-id": {
|
|
67325
|
+
type: "string",
|
|
67326
|
+
description: "Optional task ID to associate with this worktree. When omitted the command attempts to extract it from the branch name."
|
|
67327
|
+
},
|
|
67328
|
+
actor: {
|
|
67329
|
+
type: "string",
|
|
67330
|
+
description: "Override actor name written to the audit log."
|
|
67331
|
+
}
|
|
67332
|
+
},
|
|
67333
|
+
async run({ args }) {
|
|
67334
|
+
const rawPath = typeof args["path"] === "string" ? args["path"] : "";
|
|
67335
|
+
if (rawPath.length === 0) {
|
|
67336
|
+
cliError("Missing required positional: <path>.", 2);
|
|
67337
|
+
process.exit(2);
|
|
67338
|
+
return;
|
|
67339
|
+
}
|
|
67340
|
+
const rawSource = typeof args["source"] === "string" ? args["source"] : void 0;
|
|
67341
|
+
const source = rawSource !== void 0 && VALID_ADOPT_SOURCES.includes(rawSource) ? rawSource : void 0;
|
|
67342
|
+
const rawTaskId = typeof args["task-id"] === "string" ? args["task-id"] : void 0;
|
|
67343
|
+
const rawActor = typeof args["actor"] === "string" ? args["actor"] : void 0;
|
|
67344
|
+
await dispatchFromCli(
|
|
67345
|
+
"mutate",
|
|
67346
|
+
"worktree",
|
|
67347
|
+
"adopt",
|
|
67348
|
+
{
|
|
67349
|
+
worktreePath: rawPath,
|
|
67350
|
+
...source !== void 0 ? { source } : {},
|
|
67351
|
+
...rawTaskId !== void 0 ? { taskId: rawTaskId } : {},
|
|
67352
|
+
...rawActor !== void 0 ? { actor: rawActor } : {}
|
|
67353
|
+
},
|
|
67354
|
+
{ command: "worktree-adopt", operation: "worktree.adopt" }
|
|
67355
|
+
);
|
|
67356
|
+
}
|
|
67357
|
+
});
|
|
66435
67358
|
worktreeCommand = defineCommand({
|
|
66436
67359
|
meta: {
|
|
66437
67360
|
name: "worktree",
|
|
@@ -66439,7 +67362,9 @@ var init_worktree3 = __esm({
|
|
|
66439
67362
|
},
|
|
66440
67363
|
subCommands: {
|
|
66441
67364
|
list: listCommand27,
|
|
67365
|
+
adopt: adoptCommand2,
|
|
66442
67366
|
prune: pruneCommand3,
|
|
67367
|
+
destroy: destroyCommand,
|
|
66443
67368
|
"force-unlock": forceUnlockCommand
|
|
66444
67369
|
},
|
|
66445
67370
|
// Early-return when a subcommand was matched; citty still invokes the
|
|
@@ -66813,6 +67738,12 @@ var COMMAND_MANIFEST = [
|
|
|
66813
67738
|
description: "Fuzzy search tasks by title/description",
|
|
66814
67739
|
load: async () => (await Promise.resolve().then(() => (init_find(), find_exports))).findCommand
|
|
66815
67740
|
},
|
|
67741
|
+
{
|
|
67742
|
+
exportName: "focusCommand",
|
|
67743
|
+
name: "focus",
|
|
67744
|
+
description: "Single-envelope orientation for a task, epic, or saga \u2014 replaces 8 separate calls with one",
|
|
67745
|
+
load: async () => (await Promise.resolve().then(() => (init_focus3(), focus_exports))).focusCommand
|
|
67746
|
+
},
|
|
66816
67747
|
{
|
|
66817
67748
|
exportName: "gcCommand",
|
|
66818
67749
|
name: "gc",
|
|
@@ -67086,7 +68017,7 @@ var COMMAND_MANIFEST = [
|
|
|
67086
68017
|
{
|
|
67087
68018
|
exportName: "reqCommand",
|
|
67088
68019
|
name: "req",
|
|
67089
|
-
description: "Manage REQ-ID-addressable acceptance gates on tasks",
|
|
68020
|
+
description: "Manage REQ-ID-addressable acceptance gates on tasks (in-task gates only). For cross-task dependency edges, use ",
|
|
67090
68021
|
load: async () => (await Promise.resolve().then(() => (init_req(), req_exports))).reqCommand
|
|
67091
68022
|
},
|
|
67092
68023
|
{
|
|
@@ -67254,7 +68185,7 @@ var COMMAND_MANIFEST = [
|
|
|
67254
68185
|
{
|
|
67255
68186
|
exportName: "updateCommand",
|
|
67256
68187
|
name: "update",
|
|
67257
|
-
description: "Update a task",
|
|
68188
|
+
description: "Update a task. Safe under concurrent invocation \u2014 retries on SQLITE_BUSY up to 4 attempts (gh#391).",
|
|
67258
68189
|
load: async () => (await Promise.resolve().then(() => (init_update(), update_exports))).updateCommand
|
|
67259
68190
|
},
|
|
67260
68191
|
{
|
|
@@ -67751,7 +68682,7 @@ async function runStartupMaintenance() {
|
|
|
67751
68682
|
detectAndRemoveStrayProjectNexus,
|
|
67752
68683
|
getGlobalSalt,
|
|
67753
68684
|
getLogger: getLogger20,
|
|
67754
|
-
getProjectRoot:
|
|
68685
|
+
getProjectRoot: getProjectRoot44,
|
|
67755
68686
|
isCleanupMarkerSet,
|
|
67756
68687
|
migrateSignaldockToConduit,
|
|
67757
68688
|
needsSignaldockToConduitMigration,
|
|
@@ -67760,7 +68691,7 @@ async function runStartupMaintenance() {
|
|
|
67760
68691
|
} = await import("@cleocode/core/internal");
|
|
67761
68692
|
let projectRootForCleanup = "";
|
|
67762
68693
|
try {
|
|
67763
|
-
projectRootForCleanup =
|
|
68694
|
+
projectRootForCleanup = getProjectRoot44();
|
|
67764
68695
|
} catch {
|
|
67765
68696
|
}
|
|
67766
68697
|
if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
|
|
@@ -67780,7 +68711,7 @@ async function runStartupMaintenance() {
|
|
|
67780
68711
|
const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
|
|
67781
68712
|
if (!isInitInvocation) {
|
|
67782
68713
|
try {
|
|
67783
|
-
const _projectRootForMigration =
|
|
68714
|
+
const _projectRootForMigration = getProjectRoot44();
|
|
67784
68715
|
if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
|
|
67785
68716
|
const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
|
|
67786
68717
|
if (migrationResult.status === "failed") {
|