cimux-mcp 0.2.0 → 0.2.2

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.
Files changed (77) hide show
  1. package/README.md +57 -13
  2. package/dist/bin.js +10 -1
  3. package/dist/bin.js.map +1 -1
  4. package/dist/cli/cimux-cli.d.ts +2 -9
  5. package/dist/cli/cimux-cli.js +62 -201
  6. package/dist/cli/cimux-cli.js.map +1 -1
  7. package/dist/cli/commands/ack.d.ts +2 -0
  8. package/dist/cli/commands/ack.js +24 -0
  9. package/dist/cli/commands/ack.js.map +1 -0
  10. package/dist/cli/commands/brief.d.ts +2 -0
  11. package/dist/cli/commands/brief.js +33 -0
  12. package/dist/cli/commands/brief.js.map +1 -0
  13. package/dist/cli/commands/check.d.ts +2 -0
  14. package/dist/cli/commands/check.js +24 -0
  15. package/dist/cli/commands/check.js.map +1 -0
  16. package/dist/cli/commands/install.d.ts +2 -0
  17. package/dist/cli/commands/install.js +55 -0
  18. package/dist/cli/commands/install.js.map +1 -0
  19. package/dist/cli/commands/mailboxes.d.ts +2 -0
  20. package/dist/cli/commands/mailboxes.js +14 -0
  21. package/dist/cli/commands/mailboxes.js.map +1 -0
  22. package/dist/cli/commands/mcp.d.ts +2 -0
  23. package/dist/cli/commands/mcp.js +11 -0
  24. package/dist/cli/commands/mcp.js.map +1 -0
  25. package/dist/cli/commands/notify.d.ts +2 -0
  26. package/dist/cli/commands/notify.js +24 -0
  27. package/dist/cli/commands/notify.js.map +1 -0
  28. package/dist/cli/commands/read.d.ts +2 -0
  29. package/dist/cli/commands/read.js +21 -0
  30. package/dist/cli/commands/read.js.map +1 -0
  31. package/dist/cli/commands/register.d.ts +2 -0
  32. package/dist/cli/commands/register.js +27 -0
  33. package/dist/cli/commands/register.js.map +1 -0
  34. package/dist/cli/commands/send.d.ts +2 -0
  35. package/dist/cli/commands/send.js +37 -0
  36. package/dist/cli/commands/send.js.map +1 -0
  37. package/dist/cli/shared.d.ts +36 -0
  38. package/dist/cli/shared.js +71 -0
  39. package/dist/cli/shared.js.map +1 -0
  40. package/dist/index.d.ts +4 -3
  41. package/dist/index.js +2 -2
  42. package/dist/index.js.map +1 -1
  43. package/dist/install/cimux-install-plan.d.ts +5 -1
  44. package/dist/install/cimux-install-plan.js +37 -108
  45. package/dist/install/cimux-install-plan.js.map +1 -1
  46. package/dist/install/harnesses/claude.d.ts +2 -0
  47. package/dist/install/harnesses/claude.js +27 -0
  48. package/dist/install/harnesses/claude.js.map +1 -0
  49. package/dist/install/harnesses/codex.d.ts +2 -0
  50. package/dist/install/harnesses/codex.js +26 -0
  51. package/dist/install/harnesses/codex.js.map +1 -0
  52. package/dist/install/harnesses/cursor.d.ts +2 -0
  53. package/dist/install/harnesses/cursor.js +46 -0
  54. package/dist/install/harnesses/cursor.js.map +1 -0
  55. package/dist/install/harnesses/index.d.ts +5 -0
  56. package/dist/install/harnesses/index.js +16 -0
  57. package/dist/install/harnesses/index.js.map +1 -0
  58. package/dist/install/harnesses/shared.d.ts +26 -0
  59. package/dist/install/harnesses/shared.js +43 -0
  60. package/dist/install/harnesses/shared.js.map +1 -0
  61. package/dist/mcp/cimux-mcp-server.js +1 -1
  62. package/dist/mcp/cimux-mcp-server.js.map +1 -1
  63. package/dist/{registration/mailbox-registration.d.ts → naming/mailbox-naming.d.ts} +21 -0
  64. package/dist/naming/mailbox-naming.js +96 -0
  65. package/dist/naming/mailbox-naming.js.map +1 -0
  66. package/dist/service/cimux-mailbox-service.d.ts +1 -1
  67. package/dist/service/cimux-mailbox-service.js +5 -3
  68. package/dist/service/cimux-mailbox-service.js.map +1 -1
  69. package/dist/version.d.ts +1 -1
  70. package/dist/version.js +1 -1
  71. package/package.json +1 -2
  72. package/dist/registration/mailbox-registration.js +0 -48
  73. package/dist/registration/mailbox-registration.js.map +0 -1
  74. package/dist/runtime/mailbox-runtime.d.ts +0 -22
  75. package/dist/runtime/mailbox-runtime.js +0 -50
  76. package/dist/runtime/mailbox-runtime.js.map +0 -1
  77. package/docs/mvp-readiness.md +0 -85
@@ -0,0 +1,55 @@
1
+ import { applyInstallPlan, createInstallPlan } from "../../install/cimux-install-plan.js";
2
+ import { detectInstalledHarnesses, SUPPORTED_HARNESSES } from "../../install/harnesses/index.js";
3
+ import { readString, resolvePackageCommand } from "../shared.js";
4
+ export const installCommand = {
5
+ name: "install",
6
+ usage: "cimux install [--dry-run] [--all | --harness <name>]",
7
+ options: {
8
+ "dry-run": { type: "boolean" },
9
+ all: { type: "boolean" },
10
+ harness: { type: "string" }
11
+ },
12
+ run(context) {
13
+ const harnesses = selectHarnesses(context);
14
+ if (harnesses !== undefined && harnesses.length === 0) {
15
+ context.io.error(`No supported harnesses detected (looked for ${SUPPORTED_HARNESSES.map((name) => `~/.${name}`).join(", ")}). Use --all to write config for every supported harness.`);
16
+ return 1;
17
+ }
18
+ const plan = createInstallPlan({
19
+ packageCommand: resolvePackageCommand(),
20
+ ...(harnesses === undefined ? {} : { harnesses })
21
+ });
22
+ if (context.values["dry-run"] !== true) {
23
+ const results = applyInstallPlan(plan);
24
+ for (const result of results) {
25
+ const backup = result.backupPath ? ` backup: ${result.backupPath}` : "";
26
+ context.io.log(`${result.status}: ${result.path}${backup}`);
27
+ }
28
+ return 0;
29
+ }
30
+ for (const target of plan.targets) {
31
+ context.io.log(`# ${target.harness}: ${target.path}`);
32
+ context.io.log(`# ${target.purpose}`);
33
+ context.io.log(target.snippet);
34
+ }
35
+ return 0;
36
+ }
37
+ };
38
+ // undefined means "no filter": --all installs every supported harness.
39
+ function selectHarnesses(context) {
40
+ const harness = readString(context.values, "harness");
41
+ if (harness !== undefined) {
42
+ if (!isHarnessName(harness)) {
43
+ throw new Error(`Unknown harness: ${harness} (supported: ${SUPPORTED_HARNESSES.join(", ")})`);
44
+ }
45
+ return [harness];
46
+ }
47
+ if (context.values.all === true) {
48
+ return undefined;
49
+ }
50
+ return detectInstalledHarnesses();
51
+ }
52
+ function isHarnessName(value) {
53
+ return SUPPORTED_HARNESSES.includes(value);
54
+ }
55
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/cli/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGjE,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,sDAAsD;IAC7D,OAAO,EAAE;QACP,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC9B,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACxB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,GAAG,CAAC,OAAO;QACT,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtD,OAAO,CAAC,EAAE,CAAC,KAAK,CACd,+CAA+C,mBAAmB,CAAC,GAAG,CACpE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,IAAI,EAAE,CACvB,CAAC,IAAI,CAAC,IAAI,CAAC,2DAA2D,CACxE,CAAC;YACF,OAAO,CAAC,CAAC;QACX,CAAC;QAED,MAAM,IAAI,GAAG,iBAAiB,CAAC;YAC7B,cAAc,EAAE,qBAAqB,EAAE;YACvC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;SAClD,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;YACvC,MAAM,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,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,wBAAwB,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAQ,mBAAyC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandSpec } from "../shared.js";
2
+ export declare const mailboxesCommand: CommandSpec;
@@ -0,0 +1,14 @@
1
+ import { listMailboxes } from "../../service/cimux-mailbox-service.js";
2
+ import { withStore, writeJson } from "../shared.js";
3
+ export const mailboxesCommand = {
4
+ name: "mailboxes",
5
+ usage: "cimux mailboxes",
6
+ options: {},
7
+ run(context) {
8
+ return withStore(context.env, async (store) => {
9
+ writeJson(context.io, await listMailboxes(store));
10
+ return 0;
11
+ });
12
+ }
13
+ };
14
+ //# sourceMappingURL=mailboxes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailboxes.js","sourceRoot":"","sources":["../../../src/cli/commands/mailboxes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpD,MAAM,CAAC,MAAM,gBAAgB,GAAgB;IAC3C,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,EAAE;IACX,GAAG,CAAC,OAAO;QACT,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC5C,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YAClD,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandSpec } from "../shared.js";
2
+ export declare const mcpCommand: CommandSpec;
@@ -0,0 +1,11 @@
1
+ import { runCimuxMcpServer } from "../../mcp/cimux-mcp-server.js";
2
+ export const mcpCommand = {
3
+ name: "mcp",
4
+ usage: "cimux mcp",
5
+ options: {},
6
+ async run(context) {
7
+ await runCimuxMcpServer(context.env.CIMUX_DB_PATH);
8
+ return 0;
9
+ }
10
+ };
11
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../../src/cli/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,EAAE;IACX,KAAK,CAAC,GAAG,CAAC,OAAO;QACf,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACnD,OAAO,CAAC,CAAC;IACX,CAAC;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandSpec } from "../shared.js";
2
+ export declare const notifyCommand: CommandSpec;
@@ -0,0 +1,24 @@
1
+ import { createInboxNotification } from "../../service/cimux-mailbox-service.js";
2
+ import { resolveRuntimeMailboxFromArgs, withStore } from "../shared.js";
3
+ export const notifyCommand = {
4
+ name: "notify",
5
+ usage: "cimux notify [--mailbox <harness/name> | --harness <name>]",
6
+ options: {
7
+ mailbox: { type: "string" },
8
+ harness: { type: "string" }
9
+ },
10
+ run(context) {
11
+ return withStore(context.env, async (store) => {
12
+ const { mailbox } = resolveRuntimeMailboxFromArgs(context);
13
+ // Hook checks also act as a heartbeat for the current local session name.
14
+ // Creation is idempotent, so this does not reset existing mailbox state.
15
+ await store.createMailbox(mailbox);
16
+ const result = await createInboxNotification(store, { mailbox });
17
+ if (result.message) {
18
+ context.io.log(result.message);
19
+ }
20
+ return 0;
21
+ });
22
+ }
23
+ };
24
+ //# sourceMappingURL=notify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify.js","sourceRoot":"","sources":["../../../src/cli/commands/notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxE,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,4DAA4D;IACnE,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,GAAG,CAAC,OAAO;QACT,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC5C,MAAM,EAAE,OAAO,EAAE,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;YAE3D,0EAA0E;YAC1E,yEAAyE;YACzE,MAAM,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YACjE,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACjC,CAAC;YACD,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandSpec } from "../shared.js";
2
+ export declare const readCommand: CommandSpec;
@@ -0,0 +1,21 @@
1
+ import { readContext } from "../../service/cimux-mailbox-service.js";
2
+ import { requireString, withStore, writeJson } from "../shared.js";
3
+ export const readCommand = {
4
+ name: "read",
5
+ usage: "cimux read --mailbox <harness/name> --id <context-id>",
6
+ options: {
7
+ mailbox: { type: "string" },
8
+ id: { type: "string" }
9
+ },
10
+ run(context) {
11
+ return withStore(context.env, async (store) => {
12
+ const result = await readContext(store, {
13
+ mailbox: requireString(context.values, "mailbox"),
14
+ id: requireString(context.values, "id")
15
+ });
16
+ writeJson(context.io, result);
17
+ return 0;
18
+ });
19
+ }
20
+ };
21
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/cli/commands/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGnE,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,uDAAuD;IAC9D,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACvB;IACD,GAAG,CAAC,OAAO;QACT,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC5C,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE;gBACtC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC;gBACjD,EAAE,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;aACxC,CAAC,CAAC;YACH,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandSpec } from "../shared.js";
2
+ export declare const registerCommand: CommandSpec;
@@ -0,0 +1,27 @@
1
+ import { registerSession } from "../../service/cimux-mailbox-service.js";
2
+ import { readString, resolveRuntimeMailboxFromArgs, withStore, writeJson } from "../shared.js";
3
+ export const registerCommand = {
4
+ name: "register",
5
+ usage: "cimux register [--mailbox <harness/name> | --harness <name>]",
6
+ options: {
7
+ mailbox: { type: "string" },
8
+ harness: { type: "string" }
9
+ },
10
+ run(context) {
11
+ return withStore(context.env, async (store) => {
12
+ const mailbox = resolveRuntimeMailboxFromArgs(context);
13
+ const result = await registerSession(store, {
14
+ harness: readString(context.values, "harness") ?? context.env.CIMUX_HARNESS ?? "codex",
15
+ ...(mailbox.inferredFrom === "explicit"
16
+ ? { explicitMailbox: mailbox.mailbox }
17
+ : {
18
+ branchName: mailbox.branchName ?? undefined,
19
+ folderName: mailbox.folderName
20
+ })
21
+ });
22
+ writeJson(context.io, result);
23
+ return 0;
24
+ });
25
+ }
26
+ };
27
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/cli/commands/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EACL,UAAU,EACV,6BAA6B,EAC7B,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,8DAA8D;IACrE,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC5B;IACD,GAAG,CAAC,OAAO;QACT,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;YACvD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,KAAK,EAAE;gBAC1C,OAAO,EACL,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO;gBAC/E,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,UAAU;oBACrC,CAAC,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,OAAO,EAAE;oBACtC,CAAC,CAAC;wBACE,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,SAAS;wBAC3C,UAAU,EAAE,OAAO,CAAC,UAAU;qBAC/B,CAAC;aACP,CAAC,CAAC;YACH,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandSpec } from "../shared.js";
2
+ export declare const sendCommand: CommandSpec;
@@ -0,0 +1,37 @@
1
+ import { sendContext } from "../../service/cimux-mailbox-service.js";
2
+ import { readCsv, readJson, requireString, withStore, writeJson } from "../shared.js";
3
+ export const sendCommand = {
4
+ name: "send",
5
+ usage: "cimux send --from <mailbox> --to <mailbox> --title <title> --summary <summary> --body <body> [--tags a,b] [--artifacts-json <json>] [--payload-json <json>]",
6
+ options: {
7
+ from: { type: "string" },
8
+ to: { type: "string" },
9
+ title: { type: "string" },
10
+ summary: { type: "string" },
11
+ body: { type: "string" },
12
+ tags: { type: "string" },
13
+ "artifacts-json": { type: "string" },
14
+ "payload-json": { type: "string" }
15
+ },
16
+ run(context) {
17
+ return withStore(context.env, async (store) => {
18
+ // The JSON flags are parsed here and validated by the service schemas,
19
+ // so malformed artifacts fail with a schema error, not a crash.
20
+ const artifacts = readJson(context.values, "artifacts-json") ?? {};
21
+ const payload = readJson(context.values, "payload-json") ?? {};
22
+ const result = await sendContext(store, {
23
+ fromMailbox: requireString(context.values, "from"),
24
+ toMailbox: requireString(context.values, "to"),
25
+ title: requireString(context.values, "title"),
26
+ summary: requireString(context.values, "summary"),
27
+ body: requireString(context.values, "body"),
28
+ tags: readCsv(context.values, "tags"),
29
+ artifacts: artifacts,
30
+ payload: payload
31
+ });
32
+ writeJson(context.io, result);
33
+ return 0;
34
+ });
35
+ }
36
+ };
37
+ //# sourceMappingURL=send.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/cli/commands/send.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGtF,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,MAAM;IACZ,KAAK,EACH,6JAA6J;IAC/J,OAAO,EAAE;QACP,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACtB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACpC,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACnC;IACD,GAAG,CAAC,OAAO;QACT,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC5C,uEAAuE;YACvE,gEAAgE;YAChE,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,EAAE,CAAC;YACnE,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,EAAE,CAAC;YAE/D,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE;gBACtC,WAAW,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC;gBAClD,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;gBAC9C,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC;gBAC7C,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC;gBACjD,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC3C,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC;gBACrC,SAAS,EAAE,SAAmD;gBAC9D,OAAO,EAAE,OAA+C;aACzD,CAAC,CAAC;YACH,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YAC9B,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { RuntimeMailboxResult } from "../naming/mailbox-naming.js";
2
+ import { SQLiteCimuxStore } from "../storage/sqlite-cimux-store.js";
3
+ export type CimuxCliIo = {
4
+ log(message: string): void;
5
+ error(message: string): void;
6
+ };
7
+ export type CimuxCliEnv = {
8
+ CIMUX_DB_PATH?: string;
9
+ CIMUX_MAILBOX?: string;
10
+ CIMUX_HARNESS?: string;
11
+ CURSOR_PROJECT_DIR?: string;
12
+ CLAUDE_PROJECT_DIR?: string;
13
+ };
14
+ export type ParsedValues = Record<string, string | boolean | undefined>;
15
+ export type CommandContext = {
16
+ values: ParsedValues;
17
+ env: CimuxCliEnv;
18
+ cwd: string;
19
+ io: CimuxCliIo;
20
+ };
21
+ export type CommandSpec = {
22
+ name: string;
23
+ usage: string;
24
+ options: Record<string, {
25
+ type: "string" | "boolean";
26
+ }>;
27
+ run(context: CommandContext): number | Promise<number>;
28
+ };
29
+ export declare function withStore(env: CimuxCliEnv, callback: (store: SQLiteCimuxStore) => Promise<number>): Promise<number>;
30
+ export declare function resolveRuntimeMailboxFromArgs(context: CommandContext): RuntimeMailboxResult;
31
+ export declare function resolvePackageCommand(): string;
32
+ export declare function readString(values: ParsedValues, name: string): string | undefined;
33
+ export declare function requireString(values: ParsedValues, name: string): string;
34
+ export declare function readCsv(values: ParsedValues, name: string): string[];
35
+ export declare function readJson(values: ParsedValues, name: string): unknown;
36
+ export declare function writeJson(io: CimuxCliIo, value: unknown): void;
@@ -0,0 +1,71 @@
1
+ import path from "node:path";
2
+ import { defaultDatabasePath } from "../mcp/cimux-mcp-server.js";
3
+ import { resolveRuntimeMailbox } from "../naming/mailbox-naming.js";
4
+ import { SQLiteCimuxStore } from "../storage/sqlite-cimux-store.js";
5
+ export async function withStore(env, callback) {
6
+ const store = new SQLiteCimuxStore(env.CIMUX_DB_PATH ?? defaultDatabasePath());
7
+ try {
8
+ return await callback(store);
9
+ }
10
+ finally {
11
+ store.close();
12
+ }
13
+ }
14
+ export function resolveRuntimeMailboxFromArgs(context) {
15
+ const explicitMailbox = readString(context.values, "mailbox") ?? context.env.CIMUX_MAILBOX;
16
+ const harness = readString(context.values, "harness") ?? context.env.CIMUX_HARNESS;
17
+ if (!explicitMailbox && !harness) {
18
+ throw new Error("Expected --mailbox <harness/name> or --harness <name>");
19
+ }
20
+ // Some harnesses (Cursor) run hooks from their own directory, not the
21
+ // workspace, and pass the real project location through the environment.
22
+ const cwd = context.env.CURSOR_PROJECT_DIR ?? context.env.CLAUDE_PROJECT_DIR ?? context.cwd;
23
+ return resolveRuntimeMailbox({
24
+ ...(explicitMailbox === undefined ? {} : { explicitMailbox }),
25
+ ...(harness === undefined ? {} : { harness }),
26
+ cwd
27
+ });
28
+ }
29
+ export function resolvePackageCommand() {
30
+ // GUI-launched harnesses (e.g. the Codex desktop app) do not inherit the
31
+ // shell PATH, so write the absolute path of the running bin into config.
32
+ const binPath = process.argv[1];
33
+ return binPath && path.isAbsolute(binPath) ? binPath : "cimux";
34
+ }
35
+ export function readString(values, name) {
36
+ const value = values[name];
37
+ return typeof value === "string" && value !== "" ? value : undefined;
38
+ }
39
+ export function requireString(values, name) {
40
+ const value = readString(values, name);
41
+ if (value === undefined) {
42
+ throw new Error(`Expected --${name}`);
43
+ }
44
+ return value;
45
+ }
46
+ export function readCsv(values, name) {
47
+ const value = readString(values, name);
48
+ if (!value) {
49
+ return [];
50
+ }
51
+ return value
52
+ .split(",")
53
+ .map((item) => item.trim())
54
+ .filter(Boolean);
55
+ }
56
+ export function readJson(values, name) {
57
+ const value = readString(values, name);
58
+ if (value === undefined) {
59
+ return undefined;
60
+ }
61
+ try {
62
+ return JSON.parse(value);
63
+ }
64
+ catch {
65
+ throw new Error(`Invalid JSON for --${name}`);
66
+ }
67
+ }
68
+ export function writeJson(io, value) {
69
+ io.log(JSON.stringify(value, null, 2));
70
+ }
71
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/cli/shared.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAmCpE,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAgB,EAChB,QAAsD;IAEtD,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,aAAa,IAAI,mBAAmB,EAAE,CAAC,CAAC;IAC/E,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,OAAuB;IAEvB,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,OAAO,CAA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,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,MAAoB,EAAE,IAAY;IACxD,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,MAAoB,EAAE,IAAY;IACzD,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAc,EAAE,KAAc;IACtD,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,12 +2,13 @@ export { name, version } from "./version.js";
2
2
  export declare function getProjectStage(): string;
3
3
  export type { AckState, Artifacts, CodeSnippetArtifact, CommitArtifact, ContextPackage, ContextPackagePreview, CreateContextPackageInput, FileArtifact, FunctionArtifact, Mailbox, MailboxName, NormalizedCreateContextPackageInput, PullRequestArtifact, UrlArtifact } from "./model/context-package.js";
4
4
  export type { AckContextPackageOptions, ContextPackageStore, ListInboxPreviewsOptions, MailboxStore } from "./storage/mailbox-store.js";
5
- export type { RegisterMailboxInput, RegisterMailboxResult } from "./registration/mailbox-registration.js";
5
+ export type { RegisterMailboxInput, RegisterMailboxResult } from "./naming/mailbox-naming.js";
6
6
  export { ackStateSchema, artifactsSchema, codeSnippetArtifactSchema, commitArtifactSchema, contextPackagePreviewSchema, contextPackageSchema, createContextPackagePreview, createContextPackageInputSchema, DEFAULT_INBOX_PREVIEW_LIMIT, fileArtifactSchema, functionArtifactSchema, MAX_INBOX_PREVIEW_LIMIT, mailboxNameSchema, mailboxSchema, normalizeInboxPreviewLimit, PREVIEW_SUMMARY_MAX_LENGTH, PREVIEW_TAG_MAX_COUNT, PREVIEW_TITLE_MAX_LENGTH, pullRequestArtifactSchema, urlArtifactSchema } from "./model/context-package.js";
7
7
  export { ackContext, checkInbox, ContextPackageNotFoundError, createInboxNotification, createSessionBrief, listMailboxes, MailboxAccessError, readContext, registerSession, sendContext } from "./service/cimux-mailbox-service.js";
8
8
  export { runCimuxCli } from "./cli/cimux-cli.js";
9
9
  export { applyInstallPlan, createInstallPlan } from "./install/cimux-install-plan.js";
10
+ export { detectInstalledHarnesses, SUPPORTED_HARNESSES } from "./install/harnesses/index.js";
11
+ export type { HarnessName } from "./install/harnesses/index.js";
10
12
  export { createCimuxMcpServer, defaultDatabasePath, runCimuxMcpServer } from "./mcp/cimux-mcp-server.js";
11
- export { resolveRuntimeMailbox } from "./runtime/mailbox-runtime.js";
12
- export { inferMailboxName, registerMailboxInputSchema, registerMailbox } from "./registration/mailbox-registration.js";
13
+ export { inferMailboxName, registerMailbox, registerMailboxInputSchema, resolveRuntimeMailbox } from "./naming/mailbox-naming.js";
13
14
  export { SQLiteCimuxStore, UnknownMailboxError } from "./storage/sqlite-cimux-store.js";
package/dist/index.js CHANGED
@@ -6,8 +6,8 @@ export { ackStateSchema, artifactsSchema, codeSnippetArtifactSchema, commitArtif
6
6
  export { ackContext, checkInbox, ContextPackageNotFoundError, createInboxNotification, createSessionBrief, listMailboxes, MailboxAccessError, readContext, registerSession, sendContext } from "./service/cimux-mailbox-service.js";
7
7
  export { runCimuxCli } from "./cli/cimux-cli.js";
8
8
  export { applyInstallPlan, createInstallPlan } from "./install/cimux-install-plan.js";
9
+ export { detectInstalledHarnesses, SUPPORTED_HARNESSES } from "./install/harnesses/index.js";
9
10
  export { createCimuxMcpServer, defaultDatabasePath, runCimuxMcpServer } from "./mcp/cimux-mcp-server.js";
10
- export { resolveRuntimeMailbox } from "./runtime/mailbox-runtime.js";
11
- export { inferMailboxName, registerMailboxInputSchema, registerMailbox } from "./registration/mailbox-registration.js";
11
+ export { inferMailboxName, registerMailbox, registerMailboxInputSchema, resolveRuntimeMailbox } from "./naming/mailbox-naming.js";
12
12
  export { SQLiteCimuxStore, UnknownMailboxError } from "./storage/sqlite-cimux-store.js";
13
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,UAAU,eAAe;IAC7B,OAAO,WAAW,CAAC;AACrB,CAAC;AA6BD,OAAO,EACL,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,+BAA+B,EAC/B,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,4BAA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AAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1,17 +1,21 @@
1
1
  import { z } from "zod";
2
+ import type { HarnessName } from "./harnesses/index.js";
2
3
  export declare const installPlanInputSchema: z.ZodObject<{
3
4
  packageCommand: z.ZodDefault<z.ZodString>;
4
5
  homeDirectory: z.ZodDefault<z.ZodString>;
6
+ harnesses: z.ZodOptional<z.ZodArray<z.ZodEnum<["codex", "claude", "cursor"]>, "many">>;
5
7
  }, "strip", z.ZodTypeAny, {
6
8
  packageCommand: string;
7
9
  homeDirectory: string;
10
+ harnesses?: ("codex" | "cursor" | "claude")[] | undefined;
8
11
  }, {
9
12
  packageCommand?: string | undefined;
10
13
  homeDirectory?: string | undefined;
14
+ harnesses?: ("codex" | "cursor" | "claude")[] | undefined;
11
15
  }>;
12
16
  export type InstallPlanInput = z.input<typeof installPlanInputSchema>;
13
17
  export type InstallPlanTarget = {
14
- harness: "codex" | "claude";
18
+ harness: HarnessName;
15
19
  path: string;
16
20
  purpose: string;
17
21
  format: "toml" | "json" | "markdown";
@@ -2,64 +2,51 @@ import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { z } from "zod";
5
+ import { AGENT_NORMS_MARKER, createAgentNormsSnippet, createHookSnippet, HARNESS_DESCRIPTORS, HOOKS_PURPOSE, SUPPORTED_HARNESSES } from "./harnesses/index.js";
5
6
  export const installPlanInputSchema = z.object({
6
7
  packageCommand: z.string().min(1).default("cimux"),
7
- homeDirectory: z.string().min(1).default(os.homedir())
8
+ homeDirectory: z.string().min(1).default(os.homedir()),
9
+ harnesses: z.array(z.enum(SUPPORTED_HARNESSES)).min(1).optional()
8
10
  });
9
11
  export function createInstallPlan(input = {}) {
10
12
  const parsed = installPlanInputSchema.parse(input);
11
- const codexHome = path.join(parsed.homeDirectory, ".codex");
12
- const claudeHome = path.join(parsed.homeDirectory, ".claude");
13
+ const selected = HARNESS_DESCRIPTORS.filter((descriptor) => !parsed.harnesses || parsed.harnesses.includes(descriptor.name));
13
14
  return {
14
- targets: [
15
- {
16
- harness: "codex",
17
- path: path.join(codexHome, "config.toml"),
18
- purpose: "Register the Cimux MCP server for Codex.",
19
- format: "toml",
20
- snippet: createCodexMcpSnippet(parsed.packageCommand)
21
- },
22
- {
23
- harness: "codex",
24
- // Codex hooks share Claude Code's shape; Codex asks the user to trust
25
- // a hook on first use and after any change to it.
26
- path: path.join(codexHome, "hooks.json"),
27
- purpose: "Notify on unread mail each prompt; brief the agent on its mailbox at session start.",
28
- format: "json",
29
- snippet: createHookSnippet(parsed.packageCommand, "codex")
30
- },
31
- {
32
- harness: "codex",
33
- path: path.join(codexHome, "AGENTS.md"),
34
- purpose: "Teach Codex agents to check and send Cimux mail without prompting.",
35
- format: "markdown",
36
- snippet: createAgentNormsSnippet()
37
- },
38
- {
39
- harness: "claude",
40
- path: path.join(claudeHome, "settings.json"),
41
- purpose: "Notify on unread mail each prompt; brief the agent on its mailbox at session start.",
42
- format: "json",
43
- snippet: createHookSnippet(parsed.packageCommand, "claude")
44
- },
45
- {
46
- harness: "claude",
47
- path: path.join(claudeHome, "CLAUDE.md"),
48
- purpose: "Teach Claude Code agents to check and send Cimux mail without prompting.",
49
- format: "markdown",
50
- snippet: createAgentNormsSnippet()
51
- },
52
- {
53
- harness: "claude",
54
- // Claude Code reads user-scope MCP servers from ~/.claude.json.
55
- path: path.join(parsed.homeDirectory, ".claude.json"),
56
- purpose: "Register the Cimux MCP server for Claude Code (user scope).",
57
- format: "json",
58
- snippet: createClaudeMcpSnippet(parsed.packageCommand)
59
- }
60
- ]
15
+ targets: selected.flatMap((descriptor) => createHarnessTargets(descriptor, parsed.homeDirectory, parsed.packageCommand))
61
16
  };
62
17
  }
18
+ function createHarnessTargets(descriptor, homeDirectory, packageCommand) {
19
+ const targets = [
20
+ {
21
+ harness: descriptor.name,
22
+ path: path.join(homeDirectory, descriptor.mcp.path),
23
+ purpose: descriptor.mcp.purpose,
24
+ format: descriptor.mcp.format,
25
+ snippet: descriptor.mcp.snippet(packageCommand)
26
+ }
27
+ ];
28
+ if (descriptor.hooks) {
29
+ const snippet = descriptor.hooks.snippet ?? createHookSnippet;
30
+ targets.push({
31
+ harness: descriptor.name,
32
+ path: path.join(homeDirectory, descriptor.hooks.path),
33
+ purpose: descriptor.hooks.purpose ?? HOOKS_PURPOSE,
34
+ format: "json",
35
+ snippet: snippet(packageCommand, descriptor.name)
36
+ });
37
+ }
38
+ if (descriptor.norms) {
39
+ const snippet = descriptor.norms.snippet ?? createAgentNormsSnippet;
40
+ targets.push({
41
+ harness: descriptor.name,
42
+ path: path.join(homeDirectory, descriptor.norms.path),
43
+ purpose: descriptor.norms.purpose,
44
+ format: "markdown",
45
+ snippet: snippet()
46
+ });
47
+ }
48
+ return targets;
49
+ }
63
50
  export function applyInstallPlan(plan) {
64
51
  return plan.targets.map((target) => applyInstallTarget(target));
65
52
  }
@@ -193,62 +180,4 @@ function stableStringify(value) {
193
180
  }
194
181
  return JSON.stringify(sorted);
195
182
  }
196
- function createCodexMcpSnippet(packageCommand) {
197
- return `[mcp_servers.cimux]
198
- command = "${packageCommand}"
199
- args = ["mcp"]
200
- startup_timeout_sec = 10
201
- tool_timeout_sec = 60
202
- `;
203
- }
204
- // Codex and Claude Code share the same hooks JSON shape and event names.
205
- function createHookSnippet(packageCommand, harness) {
206
- return JSON.stringify({
207
- hooks: {
208
- UserPromptSubmit: [
209
- {
210
- hooks: [
211
- {
212
- type: "command",
213
- command: `${packageCommand} notify --harness ${harness}`
214
- }
215
- ]
216
- }
217
- ],
218
- SessionStart: [
219
- {
220
- hooks: [
221
- {
222
- type: "command",
223
- command: `${packageCommand} brief --harness ${harness}`
224
- }
225
- ]
226
- }
227
- ]
228
- }
229
- }, null, 2);
230
- }
231
- const AGENT_NORMS_MARKER = "<!-- cimux:norms -->";
232
- function createAgentNormsSnippet() {
233
- return `${AGENT_NORMS_MARKER}
234
- ## Cimux agent mail
235
-
236
- You have a Cimux mailbox (MCP server \`cimux\`). Follow these norms without being asked:
237
-
238
- - When notified of unread context packages, call \`check_inbox\`, use \`read_context\` on what is relevant, and \`ack_context\` after loading it.
239
- - When you finish work whose outcome another agent or a future session may need (root causes, decisions, gotchas, handoffs), send it with \`send_context\`: short title, tight summary, full detail in the body, artifact pointers instead of pasted file contents.
240
- - Find recipients with \`list_mailboxes\`; only existing mailboxes can receive mail. Register your own with \`register_session\` if unsure.
241
- <!-- cimux:end -->
242
- `;
243
- }
244
- function createClaudeMcpSnippet(packageCommand) {
245
- return JSON.stringify({
246
- mcpServers: {
247
- cimux: {
248
- command: packageCommand,
249
- args: ["mcp"]
250
- }
251
- }
252
- }, null, 2);
253
- }
254
183
  //# sourceMappingURL=cimux-install-plan.js.map