@lazehq/cli 0.1.24 → 0.1.26
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/laze.mjs +80 -50
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -35437,7 +35437,7 @@ function cliEnvironment({
|
|
|
35437
35437
|
|
|
35438
35438
|
// src/services/config-store.service.ts
|
|
35439
35439
|
import { chmod, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
35440
|
-
import { dirname, resolve } from "node:path";
|
|
35440
|
+
import { basename, dirname, resolve } from "node:path";
|
|
35441
35441
|
var EMPTY = { profiles: {}, bindings: {} };
|
|
35442
35442
|
var ConfigStore = class _ConfigStore {
|
|
35443
35443
|
constructor(path) {
|
|
@@ -35540,6 +35540,11 @@ function chooseProfile({
|
|
|
35540
35540
|
const profile = name2 ? config2.profiles[name2] : void 0;
|
|
35541
35541
|
return name2 && profile ? { name: name2, profile } : { name: void 0, profile: void 0 };
|
|
35542
35542
|
}
|
|
35543
|
+
function isWorktreeRoot({ directory }) {
|
|
35544
|
+
const parent = dirname(directory);
|
|
35545
|
+
if (basename(parent) === ".worktrees") return true;
|
|
35546
|
+
return basename(parent) === "worktrees" && basename(dirname(parent)) === ".claude";
|
|
35547
|
+
}
|
|
35543
35548
|
function boundProfileOf({
|
|
35544
35549
|
bindings,
|
|
35545
35550
|
cwd
|
|
@@ -35549,7 +35554,7 @@ function boundProfileOf({
|
|
|
35549
35554
|
const bound = bindings[directory];
|
|
35550
35555
|
if (bound) return bound;
|
|
35551
35556
|
const parent = dirname(directory);
|
|
35552
|
-
if (parent === directory) return void 0;
|
|
35557
|
+
if (parent === directory || isWorktreeRoot({ directory })) return void 0;
|
|
35553
35558
|
directory = parent;
|
|
35554
35559
|
}
|
|
35555
35560
|
return void 0;
|
|
@@ -35620,7 +35625,7 @@ function flagText({
|
|
|
35620
35625
|
}
|
|
35621
35626
|
|
|
35622
35627
|
// src/rules/cli-version.rules.ts
|
|
35623
|
-
var STAMPED = "0.1.
|
|
35628
|
+
var STAMPED = "0.1.26";
|
|
35624
35629
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35625
35630
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35626
35631
|
}
|
|
@@ -59877,6 +59882,7 @@ var feedDigestIntentSchemaDefinition = external_exports.object({
|
|
|
59877
59882
|
// ../../modules/notification/contract/src/notification.ui.ts
|
|
59878
59883
|
var notificationUi = uiTokens("notification");
|
|
59879
59884
|
var NotificationPauseHooksToken = notificationUi.hooks("pause");
|
|
59885
|
+
var NotificationDefaultHooksToken = notificationUi.hooks("channel-default");
|
|
59880
59886
|
var NotificationPauseDialogSlot = notificationUi.component("pause-dialog");
|
|
59881
59887
|
|
|
59882
59888
|
// ../../modules/chat/contract/src/chat.events.ts
|
|
@@ -65626,6 +65632,29 @@ function selfClauseOf({ self: self2 }) {
|
|
|
65626
65632
|
return self2 ? `, where you are ${self2}` : "";
|
|
65627
65633
|
}
|
|
65628
65634
|
|
|
65635
|
+
// src/rules/session-headers.rules.ts
|
|
65636
|
+
import { relative, sep } from "node:path";
|
|
65637
|
+
function sessionKeyOf({ session }) {
|
|
65638
|
+
return `${session.harness}:${session.sessionId}`;
|
|
65639
|
+
}
|
|
65640
|
+
function sessionHeadersOf({
|
|
65641
|
+
session
|
|
65642
|
+
}) {
|
|
65643
|
+
if (!session) return {};
|
|
65644
|
+
return {
|
|
65645
|
+
[AGENT_SESSION_HEADER]: sessionKeyOf({ session }),
|
|
65646
|
+
[AGENT_SESSION_FOLDER_HEADER]: encodeURIComponent(session.folder),
|
|
65647
|
+
[AGENT_SESSION_HOST_HEADER]: encodeURIComponent(session.host)
|
|
65648
|
+
};
|
|
65649
|
+
}
|
|
65650
|
+
function displayFolderOf({ folder, home }) {
|
|
65651
|
+
if (!home) return folder;
|
|
65652
|
+
const below = relative(home, folder);
|
|
65653
|
+
if (below === "") return "~";
|
|
65654
|
+
if (below.startsWith("..") || below.startsWith(sep)) return folder;
|
|
65655
|
+
return `~/${below.split(sep).join("/")}`;
|
|
65656
|
+
}
|
|
65657
|
+
|
|
65629
65658
|
// src/rules/transcript.rules.ts
|
|
65630
65659
|
function record2(value) {
|
|
65631
65660
|
return typeof value === "object" && value !== null ? value : {};
|
|
@@ -66544,33 +66573,32 @@ import { mkdir as mkdir3, readdir, readFile as readFile3, writeFile as writeFile
|
|
|
66544
66573
|
import { hostname as hostname3 } from "node:os";
|
|
66545
66574
|
import { dirname as dirname3, join as join3 } from "node:path";
|
|
66546
66575
|
|
|
66547
|
-
// src/rules/
|
|
66548
|
-
|
|
66549
|
-
|
|
66550
|
-
return `${session.harness}:${session.sessionId}`;
|
|
66551
|
-
}
|
|
66552
|
-
function sessionHeadersOf({
|
|
66553
|
-
session
|
|
66576
|
+
// src/rules/rush-host.rules.ts
|
|
66577
|
+
function rushSessionOf({
|
|
66578
|
+
parentArgs
|
|
66554
66579
|
}) {
|
|
66555
|
-
if (!
|
|
66556
|
-
|
|
66557
|
-
|
|
66558
|
-
|
|
66559
|
-
|
|
66560
|
-
};
|
|
66580
|
+
if (!parentArgs) return void 0;
|
|
66581
|
+
const [program = "", verb, action, id] = parentArgs;
|
|
66582
|
+
const isRush = program === "rush" || program.endsWith("/rush");
|
|
66583
|
+
if (!isRush || verb !== "host" || action !== "run" || !id) return void 0;
|
|
66584
|
+
return { id, program };
|
|
66561
66585
|
}
|
|
66562
|
-
function
|
|
66563
|
-
|
|
66564
|
-
|
|
66565
|
-
|
|
66566
|
-
|
|
66567
|
-
|
|
66586
|
+
function rushSendCommand({ program, id }) {
|
|
66587
|
+
return ["sh", "-c", 'printf "%s\\n" "$LAZE_WAKE_TEXT" | "$0" session send "$1"', program, id];
|
|
66588
|
+
}
|
|
66589
|
+
function rushListsLive({ listed, sessionId }) {
|
|
66590
|
+
try {
|
|
66591
|
+
const sessions = JSON.parse(listed);
|
|
66592
|
+
return sessions.some((one) => one.sessionId === sessionId && one.state !== "stopped");
|
|
66593
|
+
} catch {
|
|
66594
|
+
return false;
|
|
66595
|
+
}
|
|
66568
66596
|
}
|
|
66569
66597
|
|
|
66570
66598
|
// src/services/claude-project.service.ts
|
|
66571
|
-
import { basename, isAbsolute, relative as relative2, resolve as resolve2 } from "node:path";
|
|
66599
|
+
import { basename as basename2, isAbsolute, relative as relative2, resolve as resolve2 } from "node:path";
|
|
66572
66600
|
function harnessIn({ words }) {
|
|
66573
|
-
const names = words.slice(0, 2).map((word3) =>
|
|
66601
|
+
const names = words.slice(0, 2).map((word3) => basename2(word3).replace(/\.(js|mjs|cjs)$/, ""));
|
|
66574
66602
|
if (names.includes("codex")) return "codex";
|
|
66575
66603
|
if (words.some((word3) => word3.includes("@openai/codex"))) return "codex";
|
|
66576
66604
|
const claude = words.some((word3) => word3.includes("@anthropic-ai/claude-code"));
|
|
@@ -66743,7 +66771,8 @@ async function currentSessionOf({
|
|
|
66743
66771
|
async function sessionProfileArgs({
|
|
66744
66772
|
context,
|
|
66745
66773
|
args,
|
|
66746
|
-
session
|
|
66774
|
+
session,
|
|
66775
|
+
binds = true
|
|
66747
66776
|
}) {
|
|
66748
66777
|
if (!session) return args;
|
|
66749
66778
|
const key = sessionKeyOf({ session });
|
|
@@ -66753,16 +66782,29 @@ async function sessionProfileArgs({
|
|
|
66753
66782
|
return { ...args, flags: { ...args.flags, profile: bound } };
|
|
66754
66783
|
}
|
|
66755
66784
|
const own2 = flagText({ args, name: "profile" });
|
|
66756
|
-
if (own2 && config2.profiles[own2]?.kind === "agent") {
|
|
66785
|
+
if (binds && !args.flags.plugin && own2 && config2.profiles[own2]?.kind === "agent") {
|
|
66757
66786
|
await context.store.bindSession({ session: key, profile: own2 });
|
|
66758
66787
|
}
|
|
66759
66788
|
return args;
|
|
66760
66789
|
}
|
|
66790
|
+
async function rushKeeps({ context, key }) {
|
|
66791
|
+
const sessionId = key.slice(key.indexOf(":") + 1);
|
|
66792
|
+
let listed = "";
|
|
66793
|
+
const code = await context.runCommand({
|
|
66794
|
+
command: ["sh", "-c", "command -v rush >/dev/null && rush session list --json"],
|
|
66795
|
+
env: {},
|
|
66796
|
+
stdout: { write: (chunk) => listed += chunk },
|
|
66797
|
+
stderr: { write: () => true }
|
|
66798
|
+
}).catch(() => 1);
|
|
66799
|
+
if (code !== 0) return false;
|
|
66800
|
+
return rushListsLive({ listed, sessionId });
|
|
66801
|
+
}
|
|
66761
66802
|
async function liveElsewhere({
|
|
66762
66803
|
context,
|
|
66763
66804
|
key,
|
|
66764
66805
|
claudePid
|
|
66765
66806
|
}) {
|
|
66807
|
+
if (await rushKeeps({ context, key })) return true;
|
|
66766
66808
|
const folder = dirname3(statePathOf({ context, kind: "sessions", profile: "x" }));
|
|
66767
66809
|
for (const file3 of await readdir(folder).catch(() => [])) {
|
|
66768
66810
|
const pid = Number(file3.replace(/\.json$/, ""));
|
|
@@ -66820,7 +66862,7 @@ async function agentProfileHere({
|
|
|
66820
66862
|
if (!folder && !session) return void 0;
|
|
66821
66863
|
const asked = { ...args, flags: { ...args.flags, ...folder ? { profile: folder } : {} } };
|
|
66822
66864
|
const name2 = flagText({
|
|
66823
|
-
args: await sessionProfileArgs({ context, args: asked, session }),
|
|
66865
|
+
args: await sessionProfileArgs({ context, args: asked, session, binds: false }),
|
|
66824
66866
|
name: "profile"
|
|
66825
66867
|
});
|
|
66826
66868
|
return name2 && config2.profiles[name2]?.kind === "agent" ? name2 : void 0;
|
|
@@ -67481,20 +67523,6 @@ function channelLabelIn(channel) {
|
|
|
67481
67523
|
import { readFile as readFile7, rm as rm2, writeFile as writeFile6, mkdir as mkdir6 } from "node:fs/promises";
|
|
67482
67524
|
import { dirname as dirname6 } from "node:path";
|
|
67483
67525
|
|
|
67484
|
-
// src/rules/rush-host.rules.ts
|
|
67485
|
-
function rushSessionOf({
|
|
67486
|
-
parentArgs
|
|
67487
|
-
}) {
|
|
67488
|
-
if (!parentArgs) return void 0;
|
|
67489
|
-
const [program = "", verb, action, id] = parentArgs;
|
|
67490
|
-
const isRush = program === "rush" || program.endsWith("/rush");
|
|
67491
|
-
if (!isRush || verb !== "host" || action !== "run" || !id) return void 0;
|
|
67492
|
-
return { id, program };
|
|
67493
|
-
}
|
|
67494
|
-
function rushSendCommand({ program, id }) {
|
|
67495
|
-
return ["sh", "-c", 'printf "%s\\n" "$LAZE_WAKE_TEXT" | "$0" session send "$1"', program, id];
|
|
67496
|
-
}
|
|
67497
|
-
|
|
67498
67526
|
// src/services/rush-host.service.ts
|
|
67499
67527
|
import { mkdir as mkdir5, readFile as readFile6, writeFile as writeFile5 } from "node:fs/promises";
|
|
67500
67528
|
import { dirname as dirname5, join as join6 } from "node:path";
|
|
@@ -69438,7 +69466,9 @@ async function registerWithClaude({ context, folder }) {
|
|
|
69438
69466
|
const script = [
|
|
69439
69467
|
`claude plugin marketplace add ${quote2(folder)} --scope user ${quiet}`,
|
|
69440
69468
|
`claude plugin marketplace update ${LAZE_PLUGIN} ${quiet}`,
|
|
69441
|
-
|
|
69469
|
+
// install is a no-op for a plugin Claude Code already has; update refreshes its cached copy.
|
|
69470
|
+
`{ claude plugin install ${LAZE_PLUGIN}@${LAZE_PLUGIN} --scope user ${quiet} || true; }`,
|
|
69471
|
+
`claude plugin update ${LAZE_PLUGIN}@${LAZE_PLUGIN} ${quiet}`
|
|
69442
69472
|
].join("; ");
|
|
69443
69473
|
const stop3 = new AbortController();
|
|
69444
69474
|
const command = ["sh", "-c", script];
|
|
@@ -69904,10 +69934,10 @@ async function nextStepsFor({
|
|
|
69904
69934
|
}) {
|
|
69905
69935
|
if (harness === "codex") return linkCodexSession({ context, args, profile, laze, directory });
|
|
69906
69936
|
if (!hooked) return waiterStepsOf({ profile, laze });
|
|
69937
|
+
const session = await currentSessionOf({ context, args });
|
|
69938
|
+
if (session) await context.store.bindSession({ session: sessionKeyOf({ session }), profile });
|
|
69907
69939
|
const plugin2 = args.flags["no-plugin"] ? void 0 : await installLazePlugin({ context });
|
|
69908
|
-
if (plugin2?.registered) {
|
|
69909
|
-
await markReloadTipTold({ context, session: await currentSessionOf({ context, args }) });
|
|
69910
|
-
}
|
|
69940
|
+
if (plugin2?.registered) await markReloadTipTold({ context, session });
|
|
69911
69941
|
const mcp2 = args.flags.mcp ? await registerMcp({ context, directory, profile }) : void 0;
|
|
69912
69942
|
const mcpAdd2 = mcpAddCommandOf({ context, profile });
|
|
69913
69943
|
const lines = pluginLinesOf({ context, registered: plugin2?.registered });
|
|
@@ -75810,7 +75840,7 @@ async function channelSettings({ context, args }) {
|
|
|
75810
75840
|
|
|
75811
75841
|
// src/services/chat-actions-commands.service.ts
|
|
75812
75842
|
import { readFile as readFile17 } from "node:fs/promises";
|
|
75813
|
-
import { basename as
|
|
75843
|
+
import { basename as basename3, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve7 } from "node:path";
|
|
75814
75844
|
|
|
75815
75845
|
// src/services/file-upload.service.ts
|
|
75816
75846
|
async function sendParts({
|
|
@@ -76110,7 +76140,7 @@ var files = async ({ context, args, client }) => {
|
|
|
76110
76140
|
};
|
|
76111
76141
|
function uploadNameOf({ cwd, path }) {
|
|
76112
76142
|
const inside = relative4(cwd, path);
|
|
76113
|
-
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside :
|
|
76143
|
+
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename3(path);
|
|
76114
76144
|
}
|
|
76115
76145
|
var fileUpload = async ({ context, args, client }) => {
|
|
76116
76146
|
const path = resolve7(context.cwd, wordAt(args, 3));
|
|
@@ -79107,7 +79137,7 @@ function feedFlagsOf({ args }) {
|
|
|
79107
79137
|
|
|
79108
79138
|
// src/services/feed-files.service.ts
|
|
79109
79139
|
import { readFile as readFile23 } from "node:fs/promises";
|
|
79110
|
-
import { basename as
|
|
79140
|
+
import { basename as basename4, resolve as resolve9 } from "node:path";
|
|
79111
79141
|
|
|
79112
79142
|
// ../../modules/feed/contract/src/feed.ts
|
|
79113
79143
|
var feedAuthorSchemaDefinition = external_exports.object({
|
|
@@ -79686,7 +79716,7 @@ async function bytesOf2({
|
|
|
79686
79716
|
async function downloaded({ context, url: url2 }) {
|
|
79687
79717
|
const response = await context.fetcher(url2);
|
|
79688
79718
|
if (!response.ok) throw new CliUsageError(`${url2} answered ${response.status}`);
|
|
79689
|
-
const fileName =
|
|
79719
|
+
const fileName = basename4(new URL(url2).pathname) || "file";
|
|
79690
79720
|
const header = (response.headers.get("content-type") ?? "").split(";")[0]?.trim();
|
|
79691
79721
|
return {
|
|
79692
79722
|
fileName,
|
|
@@ -79696,7 +79726,7 @@ async function downloaded({ context, url: url2 }) {
|
|
|
79696
79726
|
}
|
|
79697
79727
|
async function local({ context, path }) {
|
|
79698
79728
|
const full = resolve9(context.cwd, path);
|
|
79699
|
-
const fileName =
|
|
79729
|
+
const fileName = basename4(full);
|
|
79700
79730
|
return {
|
|
79701
79731
|
fileName,
|
|
79702
79732
|
contentType: contentTypeOf(fileName),
|
package/package.json
CHANGED