@zeroroot-ai/zerocool-claude 0.2.0 → 0.2.1

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/build.d.ts CHANGED
@@ -28,3 +28,5 @@ export interface Surface {
28
28
  upgrade(next: Gibson): Promise<void>;
29
29
  }
30
30
  export declare function buildServer(env: NodeJS.ProcessEnv, cwd: string, deps?: BuildDeps): Promise<Surface>;
31
+ /** What a coding workspace is, as a URL: its git origin, else the directory. */
32
+ export declare function workspaceURL(cwd: string): Promise<string>;
package/dist/build.js CHANGED
@@ -1,4 +1,6 @@
1
+ import { execFile } from "node:child_process";
1
2
  import { existsSync } from "node:fs";
3
+ import { promisify } from "node:util";
2
4
  import { homedir } from "node:os";
3
5
  import { join } from "node:path";
4
6
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -62,7 +64,7 @@ export async function buildServer(env, cwd, deps = {}) {
62
64
  };
63
65
  registerStatusTool(server, () => gibson);
64
66
  registerComponentizeTool(server, cwd);
65
- registerConnectTools(server, surface, env, deps);
67
+ registerConnectTools(server, surface, env, cwd, deps);
66
68
  posture = await collect(server, () => registerPosture(server, gibson, env, cwd));
67
69
  return surface;
68
70
  }
@@ -104,7 +106,7 @@ async function registerPosture(server, gibson, env, cwd) {
104
106
  }
105
107
  }
106
108
  /** gibson_login and gibson_connect: the in-session path to a platform. */
107
- function registerConnectTools(server, surface, env, deps) {
109
+ function registerConnectTools(server, surface, env, cwd, deps) {
108
110
  const cli = (s) => ({ ...deps.cli, env, gibsonURL: s.platformURL, tenant: s.tenant });
109
111
  server.registerTool("gibson_login", {
110
112
  description: "Sign in to a Gibson platform as the person running this session. Starts the gibson CLI device " +
@@ -132,6 +134,7 @@ function registerConnectTools(server, surface, env, deps) {
132
134
  platform_url: z.string().optional().describe("Platform URL. Defaults to the gibson CLI login session or the saved config."),
133
135
  target_id: z.string().optional().describe("Target id for the live mission. Defaults to the only target in the tenant."),
134
136
  create_target: z.string().optional().describe("Create a target with this name when none exists, and use it."),
137
+ target_url: z.string().optional().describe("URL of the target to create. Defaults to the workspace's git origin, or file://<cwd>."),
135
138
  bootstrap_token: z.string().optional().describe("One-time enrollment token. Only when the CLI cannot mint one."),
136
139
  ca_cert_path: z.string().optional().describe("Path to a private CA to trust. Defaults to the CLI session's CA."),
137
140
  callback_insecure: z.boolean().optional().describe("Dial the callback endpoint without TLS. Local daemons only."),
@@ -156,7 +159,7 @@ function registerConnectTools(server, surface, env, deps) {
156
159
  }
157
160
  if (!s.targetId) {
158
161
  if (args.create_target) {
159
- s.targetId = await createTarget(args.create_target, cli(s));
162
+ s.targetId = await createTarget(args.create_target, args.target_url ?? (await workspaceURL(cwd)), cli(s));
160
163
  }
161
164
  else {
162
165
  const targets = await listTargets(cli(s));
@@ -189,3 +192,16 @@ function registerConnectTools(server, surface, env, deps) {
189
192
  return next.mode === "live" ? text("connected", body) : failure("connected, but not live", body);
190
193
  });
191
194
  }
195
+ /** What a coding workspace is, as a URL: its git origin, else the directory. */
196
+ export async function workspaceURL(cwd) {
197
+ try {
198
+ const { stdout } = await promisify(execFile)("git", ["-C", cwd, "remote", "get-url", "origin"]);
199
+ const remote = stdout.trim();
200
+ if (remote)
201
+ return remote;
202
+ }
203
+ catch {
204
+ // not a git checkout, or no origin
205
+ }
206
+ return `file://${cwd}`;
207
+ }
package/dist/cli.d.ts CHANGED
@@ -43,8 +43,12 @@ export declare function listTargets(opts?: CliOptions & {
43
43
  gibsonURL?: string;
44
44
  tenant?: string;
45
45
  }): Promise<Target[]>;
46
- /** `gibson target create`: prints the new target id. */
47
- export declare function createTarget(name: string, opts?: CliOptions & {
46
+ /**
47
+ * `gibson target create`: prints the new target id. The daemon refuses a
48
+ * target with neither a URL nor connection parameters, so the URL is
49
+ * required here: for a coding workspace it names the repository.
50
+ */
51
+ export declare function createTarget(name: string, url: string, opts?: CliOptions & {
48
52
  gibsonURL?: string;
49
53
  tenant?: string;
50
54
  type?: string;
package/dist/cli.js CHANGED
@@ -68,9 +68,13 @@ export async function listTargets(opts = {}) {
68
68
  }
69
69
  return parseTargetList(r.stdout);
70
70
  }
71
- /** `gibson target create`: prints the new target id. */
72
- export async function createTarget(name, opts = {}) {
73
- const args = ["target", "create", "--name", name, "--type", opts.type ?? "custom"];
71
+ /**
72
+ * `gibson target create`: prints the new target id. The daemon refuses a
73
+ * target with neither a URL nor connection parameters, so the URL is
74
+ * required here: for a coding workspace it names the repository.
75
+ */
76
+ export async function createTarget(name, url, opts = {}) {
77
+ const args = ["target", "create", "--name", name, "--url", url, "--type", opts.type ?? "custom"];
74
78
  if (opts.gibsonURL)
75
79
  args.push("--gibson-url", opts.gibsonURL);
76
80
  if (opts.tenant)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeroroot-ai/zerocool-claude",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Claude Code plugin: Gibson platform integration (zerocool). The session is a live mission. Memory, knowledge, findings, tools, delegation. The model stays on your Claude subscription.",
5
5
  "license": "MIT",
6
6
  "repository": {