chatroom-cli 1.77.2 → 1.77.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +159 -45
- package/dist/index.js.map +14 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77251,7 +77251,7 @@ function getDelegationBriefDisclosureBlock() {
|
|
|
77251
77251
|
return `${DELEGATION_BRIEF_DISCLOSURE_CHECKBOX}
|
|
77252
77252
|
${getDelegationBriefDisclosureComment()}`;
|
|
77253
77253
|
}
|
|
77254
|
-
var DELEGATION_BRIEF_DISCLOSURE_CHECKBOX = "- [ ] I confirm
|
|
77254
|
+
var DELEGATION_BRIEF_DISCLOSURE_CHECKBOX = "- [ ] I confirm the delegation brief is fully met: all (Required) files done, verified end-to-end, acceptance criteria pass";
|
|
77255
77255
|
|
|
77256
77256
|
// ../../services/backend/prompts/utils/file-reference-guidance.ts
|
|
77257
77257
|
function getFileReferenceGuidanceComment() {
|
|
@@ -77423,7 +77423,7 @@ ${getDelegationBriefIntro()}
|
|
|
77423
77423
|
<choices that greatly simplify the solution while preserving long-term maintainability — reuse existing abstractions, avoid unnecessary layers, leverage platform conventions>
|
|
77424
77424
|
|
|
77425
77425
|
## Files to implement (exhaustive, file-level)
|
|
77426
|
-
List **every** file in this slice. For each file, state the exact change and paste the code the builder should match (no guessing).
|
|
77426
|
+
List **every** file in this slice. Mark each file **(Required)** or **(Optional)** — all Required files must land before PR. For each file, state the exact change and paste the code the builder should match (no guessing).
|
|
77427
77427
|
${getFileReferenceGuidanceComment()}
|
|
77428
77428
|
|
|
77429
77429
|
### \`apps/webapp/src/path/to/file.ts\`
|
|
@@ -77458,6 +77458,7 @@ Cross-file types, interfaces, or patterns that apply beyond a single file. Omit
|
|
|
77458
77458
|
|
|
77459
77459
|
## Requirements (acceptance criteria)
|
|
77460
77460
|
- <verifiable outcome the builder can self-check>
|
|
77461
|
+
- Include at least one check that the feature is **verified end-to-end**. Unit tests alone are insufficient for new features.
|
|
77461
77462
|
|
|
77462
77463
|
## What to avoid
|
|
77463
77464
|
- <anti-patterns, recurring mistakes, or scope creep for this slice — be explicit>
|
|
@@ -77582,7 +77583,7 @@ ${getFileReferenceProofOfCompletionExample()}
|
|
|
77582
77583
|
<Omit if no backlog items were in scope.>
|
|
77583
77584
|
|
|
77584
77585
|
## Backlog Pending User Review Confirmation
|
|
77585
|
-
- [ ] I confirm that every backlog item implemented in this work has been moved to \`pending_user_review\` via \`chatroom backlog mark-for-review\`
|
|
77586
|
+
- [ ] I confirm that every backlog item implemented in this work has been moved to \`pending_user_review\` via \`chatroom backlog mark-for-review\` after the feature was verified end-to-end and a PR was raised for user review
|
|
77586
77587
|
- PR URL(s): <link to PR(s)>
|
|
77587
77588
|
<Omit this section if no backlog items apply.>
|
|
77588
77589
|
|
|
@@ -77684,7 +77685,7 @@ ${getFileReferenceProofOfCompletionExample()}
|
|
|
77684
77685
|
<Omit if no backlog items were in scope.>
|
|
77685
77686
|
|
|
77686
77687
|
## Backlog Pending User Review Confirmation
|
|
77687
|
-
- [ ] I confirm that every backlog item implemented in this work has been moved to \`pending_user_review\` via \`chatroom backlog mark-for-review\`
|
|
77688
|
+
- [ ] I confirm that every backlog item implemented in this work has been moved to \`pending_user_review\` via \`chatroom backlog mark-for-review\` after the feature was verified end-to-end and a PR was raised for user review
|
|
77688
77689
|
- PR URL(s): <link to PR(s)>
|
|
77689
77690
|
<Omit this section if no backlog items apply.>
|
|
77690
77691
|
|
|
@@ -78808,6 +78809,10 @@ ${getBuilderFlowMermaid(nativeIntegration, codeChangesTarget, questionTarget)}
|
|
|
78808
78809
|
- Follow established patterns and best practices from the codebase
|
|
78809
78810
|
- Handle edge cases and error scenarios
|
|
78810
78811
|
- Commit work with descriptive, atomic commit messages
|
|
78812
|
+
|
|
78813
|
+
**Completion gates (before PR or handoff):**
|
|
78814
|
+
- All **(Required)** files done; **verified end-to-end** (user-facing entry point works: CLI command runnable, API reachable, or UI action functional)
|
|
78815
|
+
- If blocked → ## Blockers / questions to planner. No PR or \`mark-for-review\` until gates pass — unless the user explicitly requested a draft or incremental PR
|
|
78811
78816
|
`;
|
|
78812
78817
|
}
|
|
78813
78818
|
var init_builder = () => {};
|
|
@@ -78879,13 +78884,14 @@ flowchart TD
|
|
|
78879
78884
|
- **Spell out what to avoid** — anti-patterns and recurring mistakes you have seen from builders on similar work (scope creep, wrong abstractions, forbidden refactors).
|
|
78880
78885
|
- **One slice ≈ one focused review surface.** If you can't imagine reviewing it in one sitting, split it.
|
|
78881
78886
|
- **Order by dependency**, not by team convention. A slice should be runnable/testable when its dependencies are done.
|
|
78887
|
+
- **A slice is shippable only when verified end-to-end** — infra/helper files alone are not a complete slice.
|
|
78882
78888
|
- **Skip phases that don't apply** (e.g., no frontend for a backend-only change, no schema for a pure refactor).
|
|
78883
78889
|
|
|
78884
78890
|
**Code review:** For code-producing work, review before delivering. Activate the review framework with: ${cmd("skill activate code-review")}.
|
|
78885
78891
|
|
|
78886
78892
|
**Backlog items:** When the task originates from a backlog item, activate the backlog skill: ${cmd("skill activate backlog")}.
|
|
78887
78893
|
|
|
78888
|
-
**If stuck:** After 2 failed rework attempts →
|
|
78894
|
+
**If stuck:** After 2 failed rework attempts → replan or hand back to planner as blocked. No partial PR, \`mark-for-review\`, or user delivery.
|
|
78889
78895
|
|
|
78890
78896
|
**Review loop:**
|
|
78891
78897
|
- Review completed work before moving to the next slice.
|
|
@@ -78929,7 +78935,7 @@ var init_handoff_rules = () => {};
|
|
|
78929
78935
|
|
|
78930
78936
|
// ../../services/backend/prompts/cli/sections/when-work-comes-back.ts
|
|
78931
78937
|
function getWhenWorkComesBackSection(config3) {
|
|
78932
|
-
const reworkLine = config3.hasBuilder ? "3. If requirements are NOT met → hand back to `builder` for rework" : "3. If requirements are NOT met
|
|
78938
|
+
const reworkLine = config3.hasBuilder ? "3. If requirements are NOT met (including partial work) → hand back to `builder` for rework" : "3. If requirements are NOT met (including partial work) → revise and re-validate";
|
|
78933
78939
|
return `**When you receive work back from team members:**
|
|
78934
78940
|
1. Review the completed work against the original user request
|
|
78935
78941
|
2. If requirements are met → deliver to \`user\`
|
|
@@ -82330,7 +82336,7 @@ function renderBacklogAttachments(items, ctx) {
|
|
|
82330
82336
|
for (const item of items) {
|
|
82331
82337
|
lines.push(` <attachment type="backlog" backlog-item-id="${escapeXmlAttribute(item._id)}">`);
|
|
82332
82338
|
lines.push(...xmlTextElement("content", item.content, " "));
|
|
82333
|
-
lines.push(` <hint>Work on this item.
|
|
82339
|
+
lines.push(` <hint>Work on this item. Verified end-to-end + PR ready: chatroom backlog mark-for-review --chatroom-id="${escapeXmlAttribute(ctx.chatroomId)}" --role="${escapeXmlAttribute(ctx.role)}" --backlog-item-id=${item._id}</hint>`);
|
|
82334
82340
|
lines.push(` </attachment>`);
|
|
82335
82341
|
}
|
|
82336
82342
|
return lines;
|
|
@@ -82436,7 +82442,7 @@ function renderContextSection(input, chatroomId, role) {
|
|
|
82436
82442
|
"</context>"
|
|
82437
82443
|
];
|
|
82438
82444
|
if (ctx.triggerMessageContent) {
|
|
82439
|
-
lines.push(`(
|
|
82445
|
+
lines.push(`(Trigger: chatroom context read --chatroom-id="${chatroomId}" --role="${role}")`);
|
|
82440
82446
|
}
|
|
82441
82447
|
lines.push(...renderStalenessNotice(ctx.elapsedHours));
|
|
82442
82448
|
return lines;
|
|
@@ -82448,7 +82454,7 @@ function renderTaskPrompt(input) {
|
|
|
82448
82454
|
lines.push(` Task ID: ${taskId}`);
|
|
82449
82455
|
lines.push(` Status: ${status3}`);
|
|
82450
82456
|
if (input.context) {
|
|
82451
|
-
lines.push("On conflict,
|
|
82457
|
+
lines.push("On conflict, message wins over background context.");
|
|
82452
82458
|
}
|
|
82453
82459
|
lines.push(...renderDivergenceWarnings(input));
|
|
82454
82460
|
lines.push(`
|
|
@@ -82745,14 +82751,58 @@ var init_skill = __esm(() => {
|
|
|
82745
82751
|
init_convex_error();
|
|
82746
82752
|
});
|
|
82747
82753
|
|
|
82754
|
+
// src/commands/messages/messages-fs-service.ts
|
|
82755
|
+
import * as nodeFs2 from "node:fs/promises";
|
|
82756
|
+
function buildMessageMarkdown(msg) {
|
|
82757
|
+
const ts = new Date(msg._creationTime).toISOString();
|
|
82758
|
+
const parts2 = [];
|
|
82759
|
+
parts2.push("---");
|
|
82760
|
+
parts2.push(`id: ${msg._id}`);
|
|
82761
|
+
parts2.push(`createdAt: ${ts}`);
|
|
82762
|
+
parts2.push(`senderRole: ${msg.senderRole}`);
|
|
82763
|
+
parts2.push(`type: ${msg.type}`);
|
|
82764
|
+
if (msg.targetRole)
|
|
82765
|
+
parts2.push(`targetRole: ${msg.targetRole}`);
|
|
82766
|
+
if (msg.classification)
|
|
82767
|
+
parts2.push(`classification: ${msg.classification}`);
|
|
82768
|
+
if (msg.taskStatus)
|
|
82769
|
+
parts2.push(`taskStatus: ${msg.taskStatus}`);
|
|
82770
|
+
if (msg.featureTitle)
|
|
82771
|
+
parts2.push(`featureTitle: ${msg.featureTitle}`);
|
|
82772
|
+
parts2.push("---");
|
|
82773
|
+
parts2.push("");
|
|
82774
|
+
parts2.push(msg.content);
|
|
82775
|
+
return parts2.join(`
|
|
82776
|
+
`);
|
|
82777
|
+
}
|
|
82778
|
+
var MessagesFsService, MessagesFsServiceLive;
|
|
82779
|
+
var init_messages_fs_service = __esm(() => {
|
|
82780
|
+
init_esm();
|
|
82781
|
+
MessagesFsService = class MessagesFsService extends exports_Context.Tag("MessagesFsService")() {
|
|
82782
|
+
};
|
|
82783
|
+
MessagesFsServiceLive = exports_Layer.succeed(MessagesFsService, {
|
|
82784
|
+
writeFile: (path3, data) => exports_Effect.tryPromise({
|
|
82785
|
+
try: () => nodeFs2.writeFile(path3, data, "utf-8"),
|
|
82786
|
+
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
82787
|
+
}),
|
|
82788
|
+
mkdir: (path3, opts) => exports_Effect.tryPromise({
|
|
82789
|
+
try: () => nodeFs2.mkdir(path3, opts),
|
|
82790
|
+
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
82791
|
+
})
|
|
82792
|
+
});
|
|
82793
|
+
});
|
|
82794
|
+
|
|
82748
82795
|
// src/commands/messages/index.ts
|
|
82749
82796
|
var exports_messages = {};
|
|
82750
82797
|
__export(exports_messages, {
|
|
82751
82798
|
listSinceMessageEffect: () => listSinceMessageEffect,
|
|
82752
82799
|
listSinceMessage: () => listSinceMessage,
|
|
82753
82800
|
listBySenderRoleEffect: () => listBySenderRoleEffect,
|
|
82754
|
-
listBySenderRole: () => listBySenderRole
|
|
82801
|
+
listBySenderRole: () => listBySenderRole,
|
|
82802
|
+
exportMessagesEffect: () => exportMessagesEffect,
|
|
82803
|
+
exportMessages: () => exportMessages
|
|
82755
82804
|
});
|
|
82805
|
+
import * as nodePath2 from "node:path";
|
|
82756
82806
|
async function createDefaultDeps14() {
|
|
82757
82807
|
const client4 = await getConvexClient();
|
|
82758
82808
|
return {
|
|
@@ -82823,6 +82873,20 @@ async function listSinceMessage(chatroomId, options, deps) {
|
|
|
82823
82873
|
const layer = commandServicesLayerFromDeps(d);
|
|
82824
82874
|
await exports_Effect.runPromise(listSinceMessageEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleMessagesError(err)), exports_Effect.provide(layer)));
|
|
82825
82875
|
}
|
|
82876
|
+
async function exportMessages(chatroomId, options, deps) {
|
|
82877
|
+
const d = deps ?? await createDefaultDeps14();
|
|
82878
|
+
const layer = commandServicesLayerFromDeps(d);
|
|
82879
|
+
await exports_Effect.runPromise(exportMessagesEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => {
|
|
82880
|
+
if ("_tag" in err) {
|
|
82881
|
+
return handleMessagesError(err);
|
|
82882
|
+
}
|
|
82883
|
+
return exports_Effect.sync(() => {
|
|
82884
|
+
console.error(`
|
|
82885
|
+
❌ Export failed: ${err.message}`);
|
|
82886
|
+
process.exit(1);
|
|
82887
|
+
});
|
|
82888
|
+
}), exports_Effect.provide(exports_Layer.mergeAll(layer, MessagesFsServiceLive))));
|
|
82889
|
+
}
|
|
82826
82890
|
var listBySenderRoleEffect = (chatroomId, options) => exports_Effect.gen(function* () {
|
|
82827
82891
|
const backend2 = yield* BackendService;
|
|
82828
82892
|
const sessionId = yield* requireSessionIdEffect((a) => ({
|
|
@@ -82913,9 +82977,59 @@ ${roleIndicator} ${message.senderRole}${message.targetRole ? ` → ${message.tar
|
|
|
82913
82977
|
` + "─".repeat(60));
|
|
82914
82978
|
console.log(`\uD83D\uDCA1 Use --full to see complete message content`);
|
|
82915
82979
|
});
|
|
82980
|
+
}), exportMessagesEffect = (chatroomId, options) => exports_Effect.gen(function* () {
|
|
82981
|
+
const backend2 = yield* BackendService;
|
|
82982
|
+
const fs11 = yield* MessagesFsService;
|
|
82983
|
+
const sessionId = yield* requireSessionIdEffect((a) => ({
|
|
82984
|
+
_tag: "NotAuthenticated",
|
|
82985
|
+
convexUrl: a.convexUrl,
|
|
82986
|
+
otherUrls: a.otherUrls
|
|
82987
|
+
}));
|
|
82988
|
+
yield* validateChatroomIdEffect(chatroomId, (id3) => ({
|
|
82989
|
+
_tag: "InvalidChatroomId",
|
|
82990
|
+
id: id3
|
|
82991
|
+
}));
|
|
82992
|
+
const messagesResult = yield* exports_Effect.either(backend2.query(api.messages.listBySenderRole, {
|
|
82993
|
+
sessionId,
|
|
82994
|
+
chatroomId,
|
|
82995
|
+
senderRole: options.senderRole || "planner",
|
|
82996
|
+
limit: options.limit
|
|
82997
|
+
}));
|
|
82998
|
+
if (messagesResult._tag === "Left") {
|
|
82999
|
+
return yield* exports_Effect.fail({
|
|
83000
|
+
_tag: "QueryFailed",
|
|
83001
|
+
cause: messagesResult.left
|
|
83002
|
+
});
|
|
83003
|
+
}
|
|
83004
|
+
const messages = messagesResult.right;
|
|
83005
|
+
if (messages.length === 0) {
|
|
83006
|
+
yield* exports_Effect.sync(() => console.log("No messages to export."));
|
|
83007
|
+
return;
|
|
83008
|
+
}
|
|
83009
|
+
const dir = options.exportPath || `.chatroom/exports/messages/${chatroomId}`;
|
|
83010
|
+
yield* fs11.mkdir(dir, { recursive: true });
|
|
83011
|
+
const manifest = [];
|
|
83012
|
+
for (const msg of messages) {
|
|
83013
|
+
const filename = `${msg._creationTime}-${msg.senderRole}-${msg._id.slice(0, 8)}.md`;
|
|
83014
|
+
const markdown = buildMessageMarkdown(msg);
|
|
83015
|
+
yield* fs11.writeFile(nodePath2.join(dir, filename), markdown);
|
|
83016
|
+
manifest.push({
|
|
83017
|
+
id: msg._id,
|
|
83018
|
+
senderRole: msg.senderRole,
|
|
83019
|
+
createdAt: msg._creationTime,
|
|
83020
|
+
filename
|
|
83021
|
+
});
|
|
83022
|
+
}
|
|
83023
|
+
yield* fs11.writeFile(nodePath2.join(dir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
83024
|
+
yield* exports_Effect.sync(() => {
|
|
83025
|
+
console.log(`
|
|
83026
|
+
\uD83D\uDCE8 Exported ${messages.length} messages to ${dir}`);
|
|
83027
|
+
console.log(` Manifest: ${dir}/manifest.json`);
|
|
83028
|
+
});
|
|
82916
83029
|
});
|
|
82917
83030
|
var init_messages = __esm(() => {
|
|
82918
83031
|
init_esm();
|
|
83032
|
+
init_messages_fs_service();
|
|
82919
83033
|
init_api3();
|
|
82920
83034
|
init_storage();
|
|
82921
83035
|
init_client2();
|
|
@@ -99678,17 +99792,17 @@ import {
|
|
|
99678
99792
|
writeFileSync as writeFileSync3
|
|
99679
99793
|
} from "node:fs";
|
|
99680
99794
|
import { homedir as homedir5 } from "node:os";
|
|
99681
|
-
import { join as
|
|
99795
|
+
import { join as join16 } from "node:path";
|
|
99682
99796
|
function getUrlHash() {
|
|
99683
99797
|
const url3 = getConvexUrl();
|
|
99684
99798
|
return createHash2("sha256").update(url3).digest("hex").substring(0, 8);
|
|
99685
99799
|
}
|
|
99686
99800
|
function getChildPidsFilePath() {
|
|
99687
|
-
const dir =
|
|
99688
|
-
return
|
|
99801
|
+
const dir = join16(homedir5(), ".chatroom");
|
|
99802
|
+
return join16(dir, `daemon-children-${getUrlHash()}.pids`);
|
|
99689
99803
|
}
|
|
99690
99804
|
function ensureChatroomDir2() {
|
|
99691
|
-
const dir =
|
|
99805
|
+
const dir = join16(homedir5(), ".chatroom");
|
|
99692
99806
|
if (!existsSync5(dir)) {
|
|
99693
99807
|
mkdirSync4(dir, { recursive: true, mode: 448 });
|
|
99694
99808
|
}
|
|
@@ -100018,9 +100132,9 @@ var init_log_observer_sync = __esm(() => {
|
|
|
100018
100132
|
});
|
|
100019
100133
|
|
|
100020
100134
|
// src/commands/machine/daemon-start/handlers/process/output-store.ts
|
|
100021
|
-
import { appendFile as appendFile2, mkdir as
|
|
100135
|
+
import { appendFile as appendFile2, mkdir as mkdir8, readFile as readFile6, rm } from "node:fs/promises";
|
|
100022
100136
|
import { tmpdir } from "node:os";
|
|
100023
|
-
import { join as
|
|
100137
|
+
import { join as join17 } from "node:path";
|
|
100024
100138
|
|
|
100025
100139
|
class TempFileOutputStore {
|
|
100026
100140
|
state;
|
|
@@ -100083,11 +100197,11 @@ function createOutputStore(runId) {
|
|
|
100083
100197
|
if (!RUN_ID_RE.test(runId)) {
|
|
100084
100198
|
throw new Error(`Invalid runId: ${runId}`);
|
|
100085
100199
|
}
|
|
100086
|
-
const filePath =
|
|
100200
|
+
const filePath = join17(TEMP_DIR, `${runId}.log`);
|
|
100087
100201
|
return new TempFileOutputStore(filePath);
|
|
100088
100202
|
}
|
|
100089
100203
|
async function ensureTempDir() {
|
|
100090
|
-
await
|
|
100204
|
+
await mkdir8(TEMP_DIR, { recursive: true });
|
|
100091
100205
|
}
|
|
100092
100206
|
async function cleanOrphanTempFiles() {
|
|
100093
100207
|
try {
|
|
@@ -100097,7 +100211,7 @@ async function cleanOrphanTempFiles() {
|
|
|
100097
100211
|
var TAIL_WINDOW_BYTES, TEMP_DIR, RUN_ID_RE, MAX_TAIL_LINES_V2 = 50;
|
|
100098
100212
|
var init_output_store = __esm(() => {
|
|
100099
100213
|
TAIL_WINDOW_BYTES = 32 * 1024;
|
|
100100
|
-
TEMP_DIR =
|
|
100214
|
+
TEMP_DIR = join17(tmpdir(), "chatroom-cli", "runs");
|
|
100101
100215
|
RUN_ID_RE = /^[a-z0-9]+$/i;
|
|
100102
100216
|
});
|
|
100103
100217
|
|
|
@@ -100788,7 +100902,7 @@ var init_pick_folder = () => {};
|
|
|
100788
100902
|
import { createHash as createHash3 } from "node:crypto";
|
|
100789
100903
|
import { existsSync as existsSync6, readFileSync as readFileSync8, writeFileSync as writeFileSync4, unlinkSync as unlinkSync2, mkdirSync as mkdirSync5 } from "node:fs";
|
|
100790
100904
|
import { homedir as homedir6 } from "node:os";
|
|
100791
|
-
import { join as
|
|
100905
|
+
import { join as join18 } from "node:path";
|
|
100792
100906
|
function getUrlHash2() {
|
|
100793
100907
|
const url3 = getConvexUrl();
|
|
100794
100908
|
return createHash3("sha256").update(url3).digest("hex").substring(0, 8);
|
|
@@ -100802,7 +100916,7 @@ function ensureChatroomDir3() {
|
|
|
100802
100916
|
}
|
|
100803
100917
|
}
|
|
100804
100918
|
function getPidFilePath() {
|
|
100805
|
-
return
|
|
100919
|
+
return join18(CHATROOM_DIR4, getPidFileName());
|
|
100806
100920
|
}
|
|
100807
100921
|
function isProcessRunning(pid) {
|
|
100808
100922
|
try {
|
|
@@ -100899,7 +101013,7 @@ function releaseLock() {
|
|
|
100899
101013
|
var CHATROOM_DIR4, LOCK_RETRY_INTERVAL_MS = 500, LOCK_RETRY_MAX_WAIT_MS = 15000;
|
|
100900
101014
|
var init_pid = __esm(() => {
|
|
100901
101015
|
init_client2();
|
|
100902
|
-
CHATROOM_DIR4 =
|
|
101016
|
+
CHATROOM_DIR4 = join18(homedir6(), ".chatroom");
|
|
100903
101017
|
});
|
|
100904
101018
|
|
|
100905
101019
|
// src/infrastructure/harnesses/claude-sdk/claude-session.ts
|
|
@@ -107548,7 +107662,7 @@ function diffPathIndexes(previous, next4) {
|
|
|
107548
107662
|
import { createHash as createHash6, randomUUID as randomUUID8 } from "node:crypto";
|
|
107549
107663
|
import * as fs11 from "node:fs/promises";
|
|
107550
107664
|
import { homedir as homedir7 } from "node:os";
|
|
107551
|
-
import { join as
|
|
107665
|
+
import { join as join21 } from "node:path";
|
|
107552
107666
|
function workspaceKeyFor(workingDir) {
|
|
107553
107667
|
const normalized = normalizeWorkingDirForLookup(workingDir);
|
|
107554
107668
|
return createHash6("sha256").update(normalized).digest("hex").slice(0, 16);
|
|
@@ -107562,10 +107676,10 @@ function buildPathIndex(entries2) {
|
|
|
107562
107676
|
}
|
|
107563
107677
|
function manifestPath(machineId, workingDir) {
|
|
107564
107678
|
const key = workspaceKeyFor(workingDir);
|
|
107565
|
-
return
|
|
107679
|
+
return join21(SYNC_STATE_DIR, machineId, key, "manifest.json");
|
|
107566
107680
|
}
|
|
107567
107681
|
async function ensureDir(filePath) {
|
|
107568
|
-
await fs11.mkdir(
|
|
107682
|
+
await fs11.mkdir(join21(filePath, ".."), { recursive: true, mode: 448 });
|
|
107569
107683
|
}
|
|
107570
107684
|
async function loadWorkspaceSyncManifest(machineId, workingDir) {
|
|
107571
107685
|
try {
|
|
@@ -107625,7 +107739,7 @@ function entriesFromPathIndex(paths) {
|
|
|
107625
107739
|
}
|
|
107626
107740
|
var SYNC_STATE_VERSION = "2", SYNC_STATE_DIR;
|
|
107627
107741
|
var init_workspace_sync_state = __esm(() => {
|
|
107628
|
-
SYNC_STATE_DIR =
|
|
107742
|
+
SYNC_STATE_DIR = join21(homedir7(), ".chatroom", "sync-state");
|
|
107629
107743
|
});
|
|
107630
107744
|
|
|
107631
107745
|
// src/infrastructure/services/workspace/workspace-file-tree-coordinator.ts
|
|
@@ -108100,7 +108214,7 @@ function unsupportedFileWriteOperationMessage(operation) {
|
|
|
108100
108214
|
}
|
|
108101
108215
|
|
|
108102
108216
|
// src/commands/machine/daemon-start/file-write-fulfillment.ts
|
|
108103
|
-
import { access as access4, mkdir as
|
|
108217
|
+
import { access as access4, mkdir as mkdir10, rename as rename4, rm as rm3, writeFile as writeFile9 } from "node:fs/promises";
|
|
108104
108218
|
import { dirname as dirname11 } from "node:path";
|
|
108105
108219
|
function isTerminalFileWriteError(errorMessage) {
|
|
108106
108220
|
const terminalMessages = new Set([
|
|
@@ -108153,9 +108267,9 @@ async function validateWriteOperation(operation, absolutePath) {
|
|
|
108153
108267
|
}
|
|
108154
108268
|
async function writePayloadToDisk(absolutePath, operation, content) {
|
|
108155
108269
|
if (operation === "create") {
|
|
108156
|
-
await
|
|
108270
|
+
await mkdir10(dirname11(absolutePath), { recursive: true });
|
|
108157
108271
|
}
|
|
108158
|
-
await
|
|
108272
|
+
await writeFile9(absolutePath, content);
|
|
108159
108273
|
}
|
|
108160
108274
|
async function fulfillOneFileWriteRequest(session2, request2) {
|
|
108161
108275
|
const startTime = Date.now();
|
|
@@ -108216,7 +108330,7 @@ async function fulfillOneFileWriteRequest(session2, request2) {
|
|
|
108216
108330
|
});
|
|
108217
108331
|
return;
|
|
108218
108332
|
}
|
|
108219
|
-
await
|
|
108333
|
+
await mkdir10(dirname11(targetResolved.absolutePath), { recursive: true });
|
|
108220
108334
|
await rename4(resolved.absolutePath, targetResolved.absolutePath);
|
|
108221
108335
|
await completeWriteRequest(session2, request2._id, { status: "done" });
|
|
108222
108336
|
const elapsed4 = Date.now() - startTime;
|
|
@@ -108232,7 +108346,7 @@ async function fulfillOneFileWriteRequest(session2, request2) {
|
|
|
108232
108346
|
});
|
|
108233
108347
|
return;
|
|
108234
108348
|
}
|
|
108235
|
-
await
|
|
108349
|
+
await mkdir10(resolved.absolutePath, { recursive: true });
|
|
108236
108350
|
await completeWriteRequest(session2, request2._id, { status: "done" });
|
|
108237
108351
|
const elapsed4 = Date.now() - startTime;
|
|
108238
108352
|
console.log(`[${formatTimestamp()}] ✏️ Directory mkdir fulfilled: ${filePath} (${elapsed4}ms)`);
|
|
@@ -112956,16 +113070,16 @@ var init_jsonc = __esm(() => {
|
|
|
112956
113070
|
|
|
112957
113071
|
// src/infrastructure/services/workspace/workspace-resolver.ts
|
|
112958
113072
|
import { readFile as readFile10, readdir as readdir3, stat as stat6 } from "node:fs/promises";
|
|
112959
|
-
import { join as
|
|
113073
|
+
import { join as join22, basename as basename4, resolve as resolve7 } from "node:path";
|
|
112960
113074
|
async function resolveGlobPatternStar(rootDir, cleaned) {
|
|
112961
|
-
const parentDir =
|
|
113075
|
+
const parentDir = join22(rootDir, cleaned.slice(0, -2));
|
|
112962
113076
|
try {
|
|
112963
113077
|
const entries2 = await readdir3(parentDir, { withFileTypes: true });
|
|
112964
113078
|
const dirs = [];
|
|
112965
113079
|
for (const entry of entries2) {
|
|
112966
113080
|
if (!entry.isDirectory())
|
|
112967
113081
|
continue;
|
|
112968
|
-
const dirPath =
|
|
113082
|
+
const dirPath = join22(parentDir, entry.name);
|
|
112969
113083
|
if (resolve7(dirPath).startsWith(resolve7(rootDir))) {
|
|
112970
113084
|
dirs.push(dirPath);
|
|
112971
113085
|
}
|
|
@@ -112976,7 +113090,7 @@ async function resolveGlobPatternStar(rootDir, cleaned) {
|
|
|
112976
113090
|
}
|
|
112977
113091
|
}
|
|
112978
113092
|
async function resolveLiteralPath(rootDir, cleaned) {
|
|
112979
|
-
const dir =
|
|
113093
|
+
const dir = join22(rootDir, cleaned);
|
|
112980
113094
|
try {
|
|
112981
113095
|
if (!resolve7(dir).startsWith(resolve7(rootDir)))
|
|
112982
113096
|
return [];
|
|
@@ -112996,7 +113110,7 @@ async function resolveGlobPattern(rootDir, pattern) {
|
|
|
112996
113110
|
}
|
|
112997
113111
|
async function readPackageJson(dir) {
|
|
112998
113112
|
try {
|
|
112999
|
-
const content = await readFile10(
|
|
113113
|
+
const content = await readFile10(join22(dir, "package.json"), "utf-8");
|
|
113000
113114
|
const pkg = JSON.parse(content);
|
|
113001
113115
|
return {
|
|
113002
113116
|
name: pkg.name || basename4(dir),
|
|
@@ -113008,7 +113122,7 @@ async function readPackageJson(dir) {
|
|
|
113008
113122
|
}
|
|
113009
113123
|
async function readPnpmWorkspacePatterns(rootDir) {
|
|
113010
113124
|
try {
|
|
113011
|
-
const content = await readFile10(
|
|
113125
|
+
const content = await readFile10(join22(rootDir, "pnpm-workspace.yaml"), "utf-8");
|
|
113012
113126
|
const patterns = [];
|
|
113013
113127
|
let inPackages = false;
|
|
113014
113128
|
for (const line of content.split(`
|
|
@@ -113035,7 +113149,7 @@ async function readPnpmWorkspacePatterns(rootDir) {
|
|
|
113035
113149
|
}
|
|
113036
113150
|
async function readPackageJsonWorkspacePatterns(rootDir) {
|
|
113037
113151
|
try {
|
|
113038
|
-
const content = await readFile10(
|
|
113152
|
+
const content = await readFile10(join22(rootDir, "package.json"), "utf-8");
|
|
113039
113153
|
const pkg = JSON.parse(content);
|
|
113040
113154
|
if (!pkg.workspaces)
|
|
113041
113155
|
return [];
|
|
@@ -113116,11 +113230,11 @@ var MAX_NAME_LENGTH = 256;
|
|
|
113116
113230
|
|
|
113117
113231
|
// src/infrastructure/services/workspace/command-discovery.ts
|
|
113118
113232
|
import { access as access5, readFile as readFile11 } from "node:fs/promises";
|
|
113119
|
-
import { join as
|
|
113233
|
+
import { join as join23, relative as relative4, basename as basename5 } from "node:path";
|
|
113120
113234
|
async function detectPackageManager(workingDir) {
|
|
113121
113235
|
for (const { file: file2, manager } of LOCKFILE_MAP) {
|
|
113122
113236
|
try {
|
|
113123
|
-
await access5(
|
|
113237
|
+
await access5(join23(workingDir, file2));
|
|
113124
113238
|
return manager;
|
|
113125
113239
|
} catch {}
|
|
113126
113240
|
}
|
|
@@ -113189,7 +113303,7 @@ function collectRootScriptCommands(scripts, pm, scriptPrefix, rootSw) {
|
|
|
113189
113303
|
}
|
|
113190
113304
|
async function readRootPackageJson(workingDir, pm, scriptPrefix) {
|
|
113191
113305
|
let rootPackageName = basename5(workingDir);
|
|
113192
|
-
const pkg = await readJsonFile(
|
|
113306
|
+
const pkg = await readJsonFile(join23(workingDir, "package.json"), "root package.json");
|
|
113193
113307
|
if (!pkg)
|
|
113194
113308
|
return { commands: [], rootPackageName };
|
|
113195
113309
|
if (pkg.name)
|
|
@@ -113205,7 +113319,7 @@ async function readRootPackageJson(workingDir, pm, scriptPrefix) {
|
|
|
113205
113319
|
}
|
|
113206
113320
|
async function readTurboJson(workingDir, _turboPrefix, _rootSubWorkspace) {
|
|
113207
113321
|
const turboTaskNames = [];
|
|
113208
|
-
const turbo = await readJsonFile(
|
|
113322
|
+
const turbo = await readJsonFile(join23(workingDir, "turbo.json"), "turbo.json");
|
|
113209
113323
|
if (!turbo?.tasks || typeof turbo.tasks !== "object")
|
|
113210
113324
|
return turboTaskNames;
|
|
113211
113325
|
for (const taskName of Object.keys(turbo.tasks)) {
|
|
@@ -113218,7 +113332,7 @@ async function readTurboJson(workingDir, _turboPrefix, _rootSubWorkspace) {
|
|
|
113218
113332
|
async function readDenoJson(workingDir) {
|
|
113219
113333
|
const commands = [];
|
|
113220
113334
|
for (const fileName of ["deno.json", "deno.jsonc"]) {
|
|
113221
|
-
const deno = await readJsonFile(
|
|
113335
|
+
const deno = await readJsonFile(join23(workingDir, fileName), fileName);
|
|
113222
113336
|
if (!deno?.tasks || typeof deno.tasks !== "object")
|
|
113223
113337
|
continue;
|
|
113224
113338
|
const pkgName = deno.name ?? basename5(workingDir);
|
|
@@ -113241,7 +113355,7 @@ async function readMakefile(workingDir) {
|
|
|
113241
113355
|
const commands = [];
|
|
113242
113356
|
for (const fileName of ["Makefile", "makefile"]) {
|
|
113243
113357
|
try {
|
|
113244
|
-
const content = await readFile11(
|
|
113358
|
+
const content = await readFile11(join23(workingDir, fileName), "utf-8");
|
|
113245
113359
|
const targets = parseMakefileTargets(content);
|
|
113246
113360
|
if (targets.length === 0)
|
|
113247
113361
|
continue;
|
|
@@ -116265,4 +116379,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
116265
116379
|
});
|
|
116266
116380
|
program2.parse();
|
|
116267
116381
|
|
|
116268
|
-
//# debugId=
|
|
116382
|
+
//# debugId=550B12123AE171BD64756E2164756E21
|