@g3nomaly/mods 0.1.0 → 0.1.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 (96) hide show
  1. package/README.md +13 -12
  2. package/dist/cli/commands/add.d.ts +11 -2
  3. package/dist/cli/commands/add.d.ts.map +1 -1
  4. package/dist/cli/commands/add.js +7 -4
  5. package/dist/cli/commands/add.js.map +1 -1
  6. package/dist/cli/commands/init.d.ts +15 -4
  7. package/dist/cli/commands/init.d.ts.map +1 -1
  8. package/dist/cli/commands/init.js +8 -4
  9. package/dist/cli/commands/init.js.map +1 -1
  10. package/dist/cli/commands/ls.d.ts +13 -3
  11. package/dist/cli/commands/ls.d.ts.map +1 -1
  12. package/dist/cli/commands/ls.js +6 -1
  13. package/dist/cli/commands/ls.js.map +1 -1
  14. package/dist/cli/commands/remove.d.ts +10 -1
  15. package/dist/cli/commands/remove.d.ts.map +1 -1
  16. package/dist/cli/commands/remove.js +11 -2
  17. package/dist/cli/commands/remove.js.map +1 -1
  18. package/dist/cli/commands/source.d.ts +37 -6
  19. package/dist/cli/commands/source.d.ts.map +1 -1
  20. package/dist/cli/commands/source.js +23 -4
  21. package/dist/cli/commands/source.js.map +1 -1
  22. package/dist/cli/commands/update.d.ts +10 -1
  23. package/dist/cli/commands/update.d.ts.map +1 -1
  24. package/dist/cli/commands/update.js +5 -1
  25. package/dist/cli/commands/update.js.map +1 -1
  26. package/dist/cli/index.js +10 -4
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/cli/project.d.ts +34 -11
  29. package/dist/cli/project.d.ts.map +1 -1
  30. package/dist/cli/project.js +19 -5
  31. package/dist/cli/project.js.map +1 -1
  32. package/dist/cli/viewer.d.ts +17 -5
  33. package/dist/cli/viewer.d.ts.map +1 -1
  34. package/dist/cli/viewer.js +77 -18
  35. package/dist/cli/viewer.js.map +1 -1
  36. package/dist/registry/locate.d.ts +9 -4
  37. package/dist/registry/locate.d.ts.map +1 -1
  38. package/dist/registry/locate.js +4 -3
  39. package/dist/registry/locate.js.map +1 -1
  40. package/dist/registry/manifest.d.ts +2 -2
  41. package/dist/registry/manifest.js +2 -2
  42. package/dist/registry/readModDir.d.ts +2 -2
  43. package/dist/registry/readModDir.d.ts.map +1 -1
  44. package/dist/registry/readModDir.js +8 -3
  45. package/dist/registry/readModDir.js.map +1 -1
  46. package/dist/registry/readSource.d.ts +1 -1
  47. package/dist/registry/readSource.js +1 -1
  48. package/dist/registry/types.d.ts +15 -0
  49. package/dist/registry/types.d.ts.map +1 -1
  50. package/dist/registry/types.js.map +1 -1
  51. package/dist/relay/index.d.ts +2 -0
  52. package/dist/relay/index.d.ts.map +1 -0
  53. package/dist/relay/index.js +9 -0
  54. package/dist/relay/index.js.map +1 -0
  55. package/dist/relay/lines.d.ts +25 -0
  56. package/dist/relay/lines.d.ts.map +1 -0
  57. package/dist/relay/lines.js +35 -0
  58. package/dist/relay/lines.js.map +1 -0
  59. package/dist/relay/protocol.d.ts +123 -0
  60. package/dist/relay/protocol.d.ts.map +1 -0
  61. package/dist/relay/protocol.js +70 -0
  62. package/dist/relay/protocol.js.map +1 -0
  63. package/dist/relay/relay.d.ts +16 -0
  64. package/dist/relay/relay.d.ts.map +1 -0
  65. package/dist/relay/relay.js +213 -0
  66. package/dist/relay/relay.js.map +1 -0
  67. package/dist/relay/sessions.d.ts +28 -0
  68. package/dist/relay/sessions.d.ts.map +1 -0
  69. package/dist/relay/sessions.js +86 -0
  70. package/dist/relay/sessions.js.map +1 -0
  71. package/dist/viewer/extension.d.ts +16 -6
  72. package/dist/viewer/extension.d.ts.map +1 -1
  73. package/dist/viewer/extension.js +10 -4
  74. package/dist/viewer/extension.js.map +1 -1
  75. package/dist/viewer/index.d.ts +6 -0
  76. package/dist/viewer/index.d.ts.map +1 -1
  77. package/dist/viewer/index.js +3 -0
  78. package/dist/viewer/index.js.map +1 -1
  79. package/dist/viewer/machine.d.ts +37 -0
  80. package/dist/viewer/machine.d.ts.map +1 -0
  81. package/dist/viewer/machine.js +55 -0
  82. package/dist/viewer/machine.js.map +1 -0
  83. package/dist/viewer/relay.d.ts +23 -0
  84. package/dist/viewer/relay.d.ts.map +1 -0
  85. package/dist/viewer/relay.js +51 -0
  86. package/dist/viewer/relay.js.map +1 -0
  87. package/dist/viewer/settings.d.ts +13 -7
  88. package/dist/viewer/settings.d.ts.map +1 -1
  89. package/dist/viewer/settings.js +10 -3
  90. package/dist/viewer/settings.js.map +1 -1
  91. package/dist/viewer/viewerExtension.d.ts +27 -0
  92. package/dist/viewer/viewerExtension.d.ts.map +1 -0
  93. package/dist/viewer/viewerExtension.js +48 -0
  94. package/dist/viewer/viewerExtension.js.map +1 -0
  95. package/dist/vscode/g3n-mods-viewer.vsix +0 -0
  96. package/package.json +9 -5
@@ -9,41 +9,64 @@ export declare const ScopeSchema: z.ZodEnum<{
9
9
  project: "project";
10
10
  user: "user";
11
11
  }>;
12
+ /** Install scope, one of the values of `ScopeSchema`. */
12
13
  export type Scope = z.infer<typeof ScopeSchema>;
13
14
  /**
14
- * One install scope opened for a command: where mods go, the `mods.json`
15
- * that records them, and the root that sources resolve against.
15
+ * Install scope opened for one command: where mods go, the `mods.json` that
16
+ * records them, and the root that sources resolve against. Created by
17
+ * `openModProject`.
18
+ *
19
+ * @property scope - Scope the project was opened for.
20
+ * @property projectRoot - Absolute root for local source paths and the `node_modules` lookup: the git project, or home for `user` outside one.
21
+ * @property claudeDir - Absolute `.claude/` directory of the scope.
22
+ * @property target - The one install destination with the `mods.json` that backs it.
16
23
  */
17
24
  export interface ModProject {
18
25
  scope: Scope;
19
- /** Absolute root for local source paths and the `node_modules` lookup: the git project, or home for `user` outside one */
20
26
  projectRoot: string;
21
- /** Absolute `.claude/` directory of the scope */
22
27
  claudeDir: string;
23
- /** The one install destination with the `mods.json` that backs it */
24
28
  target: ManifestTarget;
25
29
  }
26
- /** Injection point for tests; the real project root comes from git discovery. */
30
+ /**
31
+ * Overrides for the project lookup, used by tests.
32
+ *
33
+ * @property resolveProjectRoot - Replaces git discovery of the project root.
34
+ * @property home - Home folder for the `user` scope, instead of `os.homedir()`.
35
+ */
27
36
  export interface ProjectDeps {
28
37
  resolveProjectRoot?: typeof resolveProjectRoot;
29
38
  home?: string;
30
39
  }
31
40
  /**
32
- * Opens the scope's `.claude/` directory and its `mods.json`. Exits with an
41
+ * @brief Opens the scope's `.claude/` directory and its `mods.json`. Exits with an
33
42
  * error when the project scope is asked for outside a git repository.
43
+ *
44
+ * @param scope - Scope to open.
45
+ * @param deps - Overrides for the project lookup, used by tests.
46
+ * @returns The opened project.
34
47
  */
35
48
  export declare function openModProject(scope: Scope, deps?: ProjectDeps): ModProject;
36
- /** Built-in sources first, then the ones registered in this scope's `mods.json`. */
49
+ /**
50
+ * @brief Lists the sources of a scope: built-in ones first, then those registered in its `mods.json`.
51
+ *
52
+ * @param project - Scope to list sources for.
53
+ */
37
54
  export declare function modSources(project: ModProject): RegisteredSource[];
38
55
  /** What the core install and source commands print and check for mods. */
39
56
  export declare const MOD_CONTEXT: InstallCommandContext<ModMeta>;
40
- /** Installed mods of the scope. */
57
+ /**
58
+ * @brief Reads the mods installed in the scope.
59
+ *
60
+ * @param project - Scope to read.
61
+ */
41
62
  export declare function installedMods(project: ModProject): ModRegistry;
42
63
  /**
43
- * Reads every mod the scope's sources provide, or only those of `only`, and
64
+ * @brief Reads every mod the scope's sources provide, or only those of `only`, and
44
65
  * prints each warning. The caller disposes the result when done.
45
66
  *
46
- * @param only - Source name to read alone; exits when no such source is registered
67
+ * @param project - Scope to read sources for.
68
+ * @param only - Source name to read alone; exits when no such source is registered.
69
+ * @returns Registry of the mods read.
47
70
  */
48
71
  export declare function openModRegistry(project: ModProject, only?: string): Promise<SourceRegistry<ModMeta>>;
49
72
  //# sourceMappingURL=project.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/cli/project.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,K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H,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAI1G"}
@@ -14,8 +14,12 @@ export const ScopeSchema = z.enum(["project", "user"]);
14
14
  /** Folder under `.claude/` that Claude Code auto-loads plugins from, as `<name>@skills-dir`. */
15
15
  const INSTALL_DIR = "skills";
16
16
  /**
17
- * Opens the scope's `.claude/` directory and its `mods.json`. Exits with an
17
+ * @brief Opens the scope's `.claude/` directory and its `mods.json`. Exits with an
18
18
  * error when the project scope is asked for outside a git repository.
19
+ *
20
+ * @param scope - Scope to open.
21
+ * @param deps - Overrides for the project lookup, used by tests.
22
+ * @returns The opened project.
19
23
  */
20
24
  export function openModProject(scope, deps = {}) {
21
25
  const home = deps.home ?? os.homedir();
@@ -34,21 +38,31 @@ export function openModProject(scope, deps = {}) {
34
38
  target: { label: scope, installDir: path.join(claudeDir, INSTALL_DIR), store: manifest.store, manifest },
35
39
  };
36
40
  }
37
- /** Built-in sources first, then the ones registered in this scope's `mods.json`. */
41
+ /**
42
+ * @brief Lists the sources of a scope: built-in ones first, then those registered in its `mods.json`.
43
+ *
44
+ * @param project - Scope to list sources for.
45
+ */
38
46
  export function modSources(project) {
39
47
  return manifestSources([project.target.manifest], BUILTIN_SOURCES);
40
48
  }
41
49
  /** What the core install and source commands print and check for mods. */
42
50
  export const MOD_CONTEXT = { bin: "g3n-mods", noun: "mod", entrySchema: ModMetaSchema };
43
- /** Installed mods of the scope. */
51
+ /**
52
+ * @brief Reads the mods installed in the scope.
53
+ *
54
+ * @param project - Scope to read.
55
+ */
44
56
  export function installedMods(project) {
45
57
  return installedEntries(project.target.manifest, ModMetaSchema);
46
58
  }
47
59
  /**
48
- * Reads every mod the scope's sources provide, or only those of `only`, and
60
+ * @brief Reads every mod the scope's sources provide, or only those of `only`, and
49
61
  * prints each warning. The caller disposes the result when done.
50
62
  *
51
- * @param only - Source name to read alone; exits when no such source is registered
63
+ * @param project - Scope to read sources for.
64
+ * @param only - Source name to read alone; exits when no such source is registered.
65
+ * @returns Registry of the mods read.
52
66
  */
53
67
  export async function openModRegistry(project, only) {
54
68
  const registry = await loadSourceRegistry(narrowSources(modSources(project), only, "g3n-mods"), project.projectRoot, readModSource);
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/cli/project.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,uGAAuG;AACvG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAIvD,gGAAgG;AAChG,MAAM,WAAW,GAAG,QAAQ,CAAC;AAsB7B;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,IAAI,GAAgB,EAAE;IACjE,MAAM,IAAI,GAAI,IAAI,CAAC,IAAI,IAAI,EAAE,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H;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAmB;IAC/C,OAAO,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAmB,EAAE,IAAa;IACtE,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACpI,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,11 +1,23 @@
1
1
  import type { ViewerLocation } from "../viewer";
2
2
  import type { ModProject } from "./project";
3
+ /** How `setUpViewer` sets up the viewer. */
4
+ export interface ViewerSetup {
5
+ /** Where Claude opens in VS Code; a location already set is kept when absent */
6
+ location?: ViewerLocation;
7
+ /** Build the relay, set it as Claude Code's process wrapper and install the viewer extension; `init` does, `add` only checks */
8
+ install?: boolean;
9
+ /** Replace a process wrapper some other tool set */
10
+ replaceWrapper?: boolean;
11
+ }
3
12
  /**
4
- * Sets up where mods are seen and prints what it found: the project's VS
5
- * Code settings (project scope only) and the installed extension's version
6
- * against the one the mod API needs.
13
+ * @brief Sets up where mods are seen and prints what it found. Every run points the
14
+ * project's VS Code settings at the extension's own chat. With `install`, it
15
+ * also builds the relay the sessions run through, sets it as Claude Code's
16
+ * process wrapper, and installs the viewer extension; without, it says when
17
+ * that is still to do.
7
18
  *
8
- * @param location - Where Claude opens; when absent, a location already set is kept
19
+ * @param project - Scope to set up; VS Code settings are written only for `project`.
20
+ * @param setup - Viewer location, whether to install, and whether to replace another tool's wrapper.
9
21
  */
10
- export declare function setUpViewer(project: ModProject, location?: ViewerLocation): void;
22
+ export declare function setUpViewer(project: ModProject, setup?: ViewerSetup): Promise<void>;
11
23
  //# sourceMappingURL=viewer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../src/cli/viewer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAkBhF"}
1
+ {"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../src/cli/viewer.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,EAAQ,cAAc,CAAC;IAChC,gIAAgI;IAChI,OAAO,CAAC,EAAS,OAAO,CAAC;IACzB,oDAAoD;IACpD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAwDD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB7F"}
@@ -1,32 +1,91 @@
1
1
  // packages/mods/src/cli/viewer.ts
2
- import { c, lineInfo, lineSuccess, lineWarn } from "@g3nomaly/core/cli";
3
- import { MIN_ENGINE_VERSION, compareVersions, configureViewer, findClaudeExtension } from "../viewer";
2
+ import fs from "node:fs";
3
+ import { c, lineError, lineInfo, lineSuccess, lineWarn } from "@g3nomaly/core/cli";
4
+ import { MIN_ENGINE_VERSION, compareVersions, configureViewer, findClaudeExtension, installRelay, installViewer, machineSettingsPath, relayBinaryPath, setProcessWrapper, } from "../viewer";
5
+ /** Checks the Claude Code extension's version against the one the mod API needs. */
6
+ function checkClaudeExtension() {
7
+ const extension = findClaudeExtension();
8
+ if (extension === null) {
9
+ console.log(lineWarn(`Claude Code for VS Code is not installed. Install it from the marketplace (anthropic.claude-code), ${MIN_ENGINE_VERSION} or newer.`));
10
+ }
11
+ else if (compareVersions(extension.version, MIN_ENGINE_VERSION) < 0) {
12
+ console.log(lineWarn(`Claude Code for VS Code is ${extension.version}; mods need ${MIN_ENGINE_VERSION} or newer. Update the extension.`));
13
+ }
14
+ }
15
+ /** Builds the relay and makes Claude Code launch its sessions through it. */
16
+ async function setUpRelay(replaceWrapper) {
17
+ const relay = await installRelay();
18
+ if (relay.kind === "failed") {
19
+ console.log(lineError(`Could not build the relay at ${c.file(relay.binary)}: ${relay.reason}`));
20
+ return;
21
+ }
22
+ if (relay.kind === "built")
23
+ console.log(lineSuccess(`Built the relay ${c.dim(`(${c.file(relay.binary)})`)}`));
24
+ const wrapper = setProcessWrapper(relay.binary, { force: replaceWrapper });
25
+ switch (wrapper.kind) {
26
+ case "written":
27
+ console.log(lineSuccess(`Claude Code sessions start through the relay ${c.dim(`(${c.file(wrapper.file)})`)}`));
28
+ break;
29
+ case "taken":
30
+ console.log(lineWarn(`claudeCode.claudeProcessWrapper is already ${c.file(wrapper.current)}; left in place. Run ${c.cmd("g3n-mods init --replace-wrapper")} to use the relay.`));
31
+ break;
32
+ case "unreadable":
33
+ console.log(lineWarn(`${c.file(wrapper.file)} is not plain JSON — add by hand: "claudeCode.claudeProcessWrapper": "${relay.binary}"`));
34
+ break;
35
+ case "unchanged":
36
+ break;
37
+ }
38
+ }
39
+ /** Installs the viewer extension that draws the mods in a window of its own. */
40
+ function setUpViewerExtension() {
41
+ const viewer = installViewer();
42
+ switch (viewer.kind) {
43
+ case "installed":
44
+ console.log(lineSuccess(`Installed the mods viewer. Click its button in the editor title bar, or run ${c.cmd("g3n Mods: Open Mods Viewer")}.`));
45
+ break;
46
+ case "no-cli":
47
+ console.log(lineWarn(`VS Code's ${c.cmd("code")} command was not found. Install the viewer by hand: Extensions → … → Install from VSIX → ${c.file(viewer.vsix)}`));
48
+ break;
49
+ case "no-package":
50
+ console.log(lineError(`The viewer package is missing (${c.file(viewer.vsix)}); reinstall @g3nomaly/mods.`));
51
+ break;
52
+ case "failed":
53
+ console.log(lineError(`Installing the viewer failed: ${viewer.reason}`));
54
+ break;
55
+ }
56
+ }
4
57
  /**
5
- * Sets up where mods are seen and prints what it found: the project's VS
6
- * Code settings (project scope only) and the installed extension's version
7
- * against the one the mod API needs.
58
+ * @brief Sets up where mods are seen and prints what it found. Every run points the
59
+ * project's VS Code settings at the extension's own chat. With `install`, it
60
+ * also builds the relay the sessions run through, sets it as Claude Code's
61
+ * process wrapper, and installs the viewer extension; without, it says when
62
+ * that is still to do.
8
63
  *
9
- * @param location - Where Claude opens; when absent, a location already set is kept
64
+ * @param project - Scope to set up; VS Code settings are written only for `project`.
65
+ * @param setup - Viewer location, whether to install, and whether to replace another tool's wrapper.
10
66
  */
11
- export function setUpViewer(project, location) {
67
+ export async function setUpViewer(project, setup = {}) {
12
68
  if (project.scope === "project") {
13
- const result = configureViewer(project.projectRoot, location);
69
+ const result = configureViewer(project.projectRoot, setup.location);
14
70
  if (result.kind === "written") {
15
- console.log(lineSuccess(`VS Code opens Claude in its native UI ${c.dim(`(${c.file(result.file)})`)}`));
71
+ console.log(lineSuccess(`VS Code opens Claude in its own chat view ${c.dim(`(${c.file(result.file)})`)}`));
16
72
  }
17
73
  else if (result.kind === "unreadable") {
18
74
  console.log(lineWarn(`${c.file(result.file)} is not plain JSON — add these settings by hand: ${JSON.stringify(result.settings)}`));
19
75
  }
20
76
  }
21
- const extension = findClaudeExtension();
22
- if (extension === null) {
23
- console.log(lineWarn(`Claude Code for VS Code is not installed — mods draw in its native UI. Install it from the marketplace (anthropic.claude-code), ${MIN_ENGINE_VERSION} or newer.`));
24
- }
25
- else if (compareVersions(extension.version, MIN_ENGINE_VERSION) < 0) {
26
- console.log(lineWarn(`Claude Code for VS Code is ${extension.version}; mods need ${MIN_ENGINE_VERSION} or newer. Update the extension.`));
27
- }
28
- else {
29
- console.log(lineInfo(`Claude Code for VS Code ${extension.version} draws mod panes. Run ${c.cmd("Claude Code: Open in New Window")} to give them a window of their own.`));
77
+ checkClaudeExtension();
78
+ if (setup.install === true) {
79
+ await setUpRelay(setup.replaceWrapper === true);
80
+ setUpViewerExtension();
81
+ console.log(lineInfo("Sessions started from now on show their mods in the viewer; restart open ones."));
82
+ return;
30
83
  }
84
+ const settings = machineSettingsPath();
85
+ const isSetUp = fs.existsSync(relayBinaryPath()) && fs.existsSync(settings) && fs.readFileSync(settings, "utf8").includes(relayBinaryPath());
86
+ if (!isSetUp)
87
+ console.log(lineInfo(`Run ${c.cmd("g3n-mods init")} once to set up the window the mods are drawn in.`));
88
+ else
89
+ console.log(lineInfo("Mods show in the viewer of sessions started from now on; in a running one, run /reload-plugins."));
31
90
  }
32
91
  //# sourceMappingURL=viewer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../src/cli/viewer.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAItG;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAmB,EAAE,QAAyB;IACxE,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAC9D,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,yCAAyC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM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IAAI,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;IAC7I,IAAI,CAAC,OAAO;QAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,mDAAmD,CAAC,CAAC,CAAC;;QACjH,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,iGAAiG,CAAC,CAAC,CAAC;AAChI,CAAC"}
@@ -1,16 +1,21 @@
1
- /** The mod folders found in one source checkout, with what was skipped and why. */
1
+ /**
2
+ * Mod folders found in one source checkout, and what was skipped.
3
+ *
4
+ * @property dirs - Absolute mod folders.
5
+ * @property warnings - Why each skipped plugin or folder was left out.
6
+ */
2
7
  export interface ModScan {
3
- /** Absolute mod folders */
4
8
  dirs: string[];
5
9
  warnings: string[];
6
10
  }
7
11
  /**
8
- * Finds the mods a source provides. A `marketplace.json` lists them by
12
+ * @brief Finds the mods a source provides. A `marketplace.json` lists them by
9
13
  * relative path; without one, the source root is the mod when it is one,
10
14
  * else every mod folder directly under `mods/` or the root. Plugins that
11
15
  * hold no hooks module are skipped with a warning.
12
16
  *
13
- * @param root - Absolute root of the source checkout
17
+ * @param root - Absolute root of the source checkout.
18
+ * @returns Mod folders, and warnings for what was skipped.
14
19
  */
15
20
  export declare function locateMods(root: string): ModScan;
16
21
  //# sourceMappingURL=locate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locate.d.ts","sourceRoot":"","sources":["../../src/registry/locate.ts"],"names":[],"mappings":"AAQA,mFAAmF;AACnF,MAAM,WAAW,OAAO;IACtB,2BAA2B;IAC3B,IAAI,EAAM,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAUD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgBhD"}
1
+ {"version":3,"file":"locate.d.ts","sourceRoot":"","sources":["../../src/registry/locate.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAM,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAUD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgBhD"}
@@ -4,7 +4,7 @@ import path from "node:path";
4
4
  import { readMarketplace } from "@g3nomaly/core/installer";
5
5
  import { isModDir } from "./readModDir";
6
6
  const MODS_DIR = "mods";
7
- /** Direct child folders of `dir`, leaving out hidden ones and `node_modules`. */
7
+ /** Lists the direct child folders of `dir`, leaving out hidden ones and `node_modules`. */
8
8
  function childDirs(dir) {
9
9
  if (!fs.existsSync(dir))
10
10
  return [];
@@ -13,12 +13,13 @@ function childDirs(dir) {
13
13
  .map((d) => path.join(dir, d.name));
14
14
  }
15
15
  /**
16
- * Finds the mods a source provides. A `marketplace.json` lists them by
16
+ * @brief Finds the mods a source provides. A `marketplace.json` lists them by
17
17
  * relative path; without one, the source root is the mod when it is one,
18
18
  * else every mod folder directly under `mods/` or the root. Plugins that
19
19
  * hold no hooks module are skipped with a warning.
20
20
  *
21
- * @param root - Absolute root of the source checkout
21
+ * @param root - Absolute root of the source checkout.
22
+ * @returns Mod folders, and warnings for what was skipped.
22
23
  */
23
24
  export function locateMods(root) {
24
25
  const marketplace = readMarketplace(root);
@@ -1 +1 @@
1
- {"version":3,"file":"locate.js","sourceRoot":"","sources":["../../src/registry/locate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,QAAQ,GAAG,MAAM,CAAC;AASxB,iFAAiF;AACjF,S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AAI,CAAC,CAAC;IAC1C,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,KAAK,MAAM,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;;gBAC3C,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,uDAAuD,CAAC,CAAC;QAC5F,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAE1D,MAAM,IAAI,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5F,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAC3D,CAAC"}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Path of `mods.json` in a Claude directory.
2
+ * @brief Builds the path of `mods.json` in a Claude directory.
3
3
  *
4
4
  * @param claudeDir - Absolute `.claude` directory of the scope, e.g. `/home/me/app/.claude`
5
- * @returns absolute path
5
+ * @returns Absolute path of the file.
6
6
  */
7
7
  export declare function modsManifestPath(claudeDir: string): string;
8
8
  //# sourceMappingURL=manifest.d.ts.map
@@ -2,10 +2,10 @@
2
2
  import path from "node:path";
3
3
  const MANIFEST_FILE = "mods.json";
4
4
  /**
5
- * Path of `mods.json` in a Claude directory.
5
+ * @brief Builds the path of `mods.json` in a Claude directory.
6
6
  *
7
7
  * @param claudeDir - Absolute `.claude` directory of the scope, e.g. `/home/me/app/.claude`
8
- * @returns absolute path
8
+ * @returns Absolute path of the file.
9
9
  */
10
10
  export function modsManifestPath(claudeDir) {
11
11
  return path.join(claudeDir, MANIFEST_FILE);
@@ -2,10 +2,10 @@ import type { ReadContext } from "@g3nomaly/core/installer";
2
2
  import type { ModMeta } from "./types";
3
3
  export declare const PLUGIN_MANIFEST: string;
4
4
  export declare const HOOKS_MANIFEST: string;
5
- /** Whether `dir` is a plugin with a `hooks/hooks.json`, which makes it a mod; `readModDir` checks the rest. */
5
+ /** Tells whether `dir` holds the plugin and hooks manifests a mod needs; `readModDir` checks the rest. */
6
6
  export declare function isModDir(dir: string): boolean;
7
7
  /**
8
- * Reads one mod folder into its registry entry. The key is the folder name,
8
+ * @brief Reads one mod folder into its registry entry. The key is the folder name,
9
9
  * which must equal the `name` in its `plugin.json`, the name Claude Code
10
10
  * loads it under; every installable file becomes a `files[]` entry at
11
11
  * `<key>/<file>`.
@@ -1 +1 @@
1
- {"version":3,"file":"readModDir.d.ts","sourceRoot":"","sources":["../../src/registry/readModDir.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAwB,OAAO,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,eAAe,QAA6C,CAAC;AAC1E,eAAO,MAAM,cAAc,QAAoC,CAAC;AAsBhE,+GAA+G;AAC/G,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7C;AAWD;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA8BjG"}
1
+ {"version":3,"file":"readModDir.d.ts","sourceRoot":"","sources":["../../src/registry/readModDir.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAwB,OAAO,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,eAAe,QAA6C,CAAC;AAC1E,eAAO,MAAM,cAAc,QAAoC,CAAC;AAsBhE,0GAA0G;AAC1G,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7C;AAgBD;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA8BjG"}
@@ -21,11 +21,16 @@ const TYPESCRIPT_MODULE = /\.(?:ts|tsx|mts|cts)$/i;
21
21
  const HooksManifestSchema = z.object({
22
22
  modules: z.array(z.string().regex(TYPESCRIPT_MODULE, "must be a TypeScript file (.ts, .tsx, .mts, .cts)")).min(1),
23
23
  });
24
- /** Whether `dir` is a plugin with a `hooks/hooks.json`, which makes it a mod; `readModDir` checks the rest. */
24
+ /** Tells whether `dir` holds the plugin and hooks manifests a mod needs; `readModDir` checks the rest. */
25
25
  export function isModDir(dir) {
26
26
  return fs.existsSync(path.join(dir, PLUGIN_MANIFEST)) && fs.existsSync(path.join(dir, HOOKS_MANIFEST));
27
27
  }
28
- /** Kind of a file by the folder it sits in inside the mod. */
28
+ /**
29
+ * @brief Classifies a file by the top folder it sits in inside the mod.
30
+ *
31
+ * @param relativeToMod - File path relative to the mod folder.
32
+ * @returns Kind of the file; `asset` for anything outside the known folders.
33
+ */
29
34
  function fileType(relativeToMod) {
30
35
  const [top] = relativeToMod.split(path.sep);
31
36
  if (top === ".claude-plugin")
@@ -37,7 +42,7 @@ function fileType(relativeToMod) {
37
42
  return "asset";
38
43
  }
39
44
  /**
40
- * Reads one mod folder into its registry entry. The key is the folder name,
45
+ * @brief Reads one mod folder into its registry entry. The key is the folder name,
41
46
  * which must equal the `name` in its `plugin.json`, the name Claude Code
42
47
  * loads it under; every installable file becomes a `files[]` entry at
43
48
  * `<key>/<file>`.
@@ -1 +1 @@
1
- {"version":3,"file":"readModDir.js","sourceRoot":"","sources":["../../src/registry/readModDir.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAIrD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,cAAc,GAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAEhE,sHAAsH;AACtH,MAAM,YAAY,GAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;AACtE,MAAM,aAAa,GAAG,mDAAmD,CAAC;AAE1E,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAS,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,sBAAsB,EAAE,uCAAuC,CAAC;IAC9F,OAAO,EAAM,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,4DAA4D;AAC5D,MAAM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EAAE,CAAC,CAAC;IAC/G,CAAC;IAED,OAAO,CAAC,GAAG,EAAE;YACX,IAAI,EAAS,QAAQ,CAAC,IAAI;YAC1B,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,OAAO,EAAM,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO;YAChD,KAAK,EAAQ,OAAO,CAAC,KAAK;YAC1B,MAAM,EAAO,OAAO,CAAC,MAAM;YAC3B,KAAK;SACN,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { ReadSource } from "@g3nomaly/core/installer";
2
2
  import type { ModMeta } from "./types";
3
3
  /**
4
- * Reads every mod a checked-out source provides, with the source as group.
4
+ * @brief Reads every mod a checked-out source provides, with the source as group.
5
5
  * An unreadable mod is skipped with a warning. Handed to
6
6
  * `loadSourceRegistry` by every mods command.
7
7
  */
@@ -4,7 +4,7 @@ import { errorMessage } from "@g3nomaly/core/utils";
4
4
  import { locateMods } from "./locate";
5
5
  import { readModDir } from "./readModDir";
6
6
  /**
7
- * Reads every mod a checked-out source provides, with the source as group.
7
+ * @brief Reads every mod a checked-out source provides, with the source as group.
8
8
  * An unreadable mod is skipped with a warning. Handed to
9
9
  * `loadSourceRegistry` by every mods command.
10
10
  */
@@ -6,6 +6,7 @@ export declare const ModFileTypeSchema: z.ZodEnum<{
6
6
  manifest: "manifest";
7
7
  types: "types";
8
8
  }>;
9
+ /** Kind of a mod file: `manifest`, `hooks`, `types` or `asset`. */
9
10
  export type ModFileType = z.infer<typeof ModFileTypeSchema>;
10
11
  /** One installed or installable file of a mod; `path` is `<mod>/<file>`, relative to the install directory. */
11
12
  export declare const ModFileSchema: z.ZodObject<{
@@ -19,6 +20,12 @@ export declare const ModFileSchema: z.ZodObject<{
19
20
  types: "types";
20
21
  }>;
21
22
  }, z.core.$strip>;
23
+ /**
24
+ * File entry of a mod, as `ModFileSchema` parses it.
25
+ *
26
+ * @property path - `<mod>/<file>`, relative to the install directory.
27
+ * @property type - Kind of the file.
28
+ */
22
29
  export type ModFile = z.infer<typeof ModFileSchema>;
23
30
  /**
24
31
  * One installable mod. Built from a mod folder's `plugin.json` by
@@ -36,6 +43,7 @@ export declare const ModMetaSchema: z.ZodObject<{
36
43
  commit: z.ZodOptional<z.ZodString>;
37
44
  version: z.ZodOptional<z.ZodString>;
38
45
  }, z.core.$strip>;
46
+ forkedFrom: z.ZodOptional<z.ZodString>;
39
47
  group: z.ZodString;
40
48
  files: z.ZodArray<z.ZodObject<{
41
49
  path: z.ZodString;
@@ -49,6 +57,13 @@ export declare const ModMetaSchema: z.ZodObject<{
49
57
  }>;
50
58
  }, z.core.$strip>>;
51
59
  }, z.core.$strip>;
60
+ /**
61
+ * Entry of one mod in `mods.json`, as `ModMetaSchema` parses it.
62
+ *
63
+ * @property group - Source name, so `ls` groups by source.
64
+ * @property files - Installable files of the mod.
65
+ */
52
66
  export type ModMeta = z.infer<typeof ModMetaSchema>;
67
+ /** Mods keyed by their folder name. */
53
68
  export type ModRegistry = Record<string, ModMeta>;
54
69
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,mHAAmH;AACnH,eAAO,MAAM,iBAAiB;;;;;EAAkD,CAAC;AAEjF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,+GAA+G;AAC/G,eAAO,MAAM,aAAa;;;;;;;;;;iBAExB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;iBAGxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAO,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACxD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,mHAAmH;AACnH,eAAO,MAAM,iBAAiB;;;;;EAAkD,CAAC;AAEjF,mEAAmE;AACnE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,+GAA+G;AAC/G,eAAO,MAAM,aAAa;;;;;;;;;;iBAExB,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;iBAGxB,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAO,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACxD,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,mHAAmH;AACnH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAIjF,+GAA+G;AAC/G,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,iBAAiB;CACxB,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC;IACpD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACrC,CAAC,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,mHAAmH;AACnH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAKjF,+GAA+G;AAC/G,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,iBAAiB;CACxB,CAAC,CAAC;AAUH;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC;IACpD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACrC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/relay/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ // packages/mods/src/relay/index.ts
2
+ import { runRelay } from "./relay";
3
+ const [claudePath, ...args] = process.argv.slice(2);
4
+ if (claudePath === undefined) {
5
+ console.error("g3n-mods-relay: set as claudeCode.claudeProcessWrapper, it is launched as `<relay> <claude> [args...]`; no Claude Code path was given.");
6
+ process.exit(2);
7
+ }
8
+ process.exit(await runRelay(claudePath, args));
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/relay/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,wIAAwI,CAAC,CAAC;IACxJ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Cuts a byte stream into whole lines. Holds the unfinished tail of each
3
+ * chunk until its newline arrives, so a writer can put its own lines between
4
+ * the stream's lines without splitting one.
5
+ *
6
+ * Created once per stream by `runRelay`, which feeds it every chunk the
7
+ * extension or Claude writes and acts on each line it returns.
8
+ *
9
+ * @example
10
+ * const lines = new LineSplitter();
11
+ * for (const line of lines.push(chunk)) forward(line);
12
+ */
13
+ export declare class LineSplitter {
14
+ private tail;
15
+ private readonly decoder;
16
+ /**
17
+ * Adds a chunk and returns the lines it completed, each without its newline.
18
+ *
19
+ * @returns the completed lines; empty while the chunk ends mid-line
20
+ */
21
+ push(chunk: Uint8Array | string): string[];
22
+ /** Returns what is left when the stream ends, or `undefined` when it ended on a newline. */
23
+ flush(): string | undefined;
24
+ }
25
+ //# sourceMappingURL=lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../../src/relay/lines.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAE7C;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,EAAE,CAKzC;IAED,4FAA4F;IAC5F,KAAK,IAAI,MAAM,GAAG,SAAS,CAI1B;CACF"}