@alterset/alterspec-client 0.27.0 → 0.29.0

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/README.md CHANGED
@@ -98,6 +98,31 @@ The dispatcher's tools appear in the next Claude Code session started in the rep
98
98
  skills too, copy the block in [`agent-instructions.md`](agent-instructions.md) (in this package) into your agent's
99
99
  instructions, wherever you keep them.
100
100
 
101
+ ## The product side
102
+
103
+ The owner of the spec answers the build's questions from the **spec project** (the folder that holds `spec/`, where
104
+ alterspec runs), through the same client in a second role, `product`. alterspec itself never talks to the
105
+ dispatcher; the client does, on the person's typed word. In the spec project:
106
+
107
+ ```bash
108
+ npx @alterset/alterspec-client init --product --dispatcher https://<dispatcher>
109
+ ```
110
+
111
+ It writes `.alterspec-client.json` with `dispatcher` and `key` only (`--key` as above; no export, no tracks), the
112
+ `dispatcher` entry in `.mcp.json` and its approval, and nothing of the developer's: no hook, no skill, no prompt. It
113
+ prints the key to send to the admin, who registers the owner as a **product person** (the product flag). One key,
114
+ both roles: an owner who also develops has their tracks and the product flag on one person, and the client asks the
115
+ dispatcher for the role its folder means (`product` here, `developer` in a code repository; dispatcher decision 33).
116
+
117
+ In the next Claude Code session in the spec project the dispatcher's product tools appear, and only those:
118
+ `whoami`, `questions`, `answer`, `reconcile`, `feedback` (the teams' feedback lines, read) and `bug_reports` (the
119
+ words of the bugs they raised). alterspec's own skills use them: `/alterspec-answer post` posts the answers of an
120
+ answers file and marks the ones the spec already gives reconciled; `/alterspec-reconcile`, after a sign-off and an
121
+ export, marks the questions a change answered reconciled. A product session sees no task, progress or assignment:
122
+ the proxy lists only the six tools and refuses any other call itself (`NOT_DEVELOPER`), whatever the dispatcher
123
+ lists, and the dispatcher refuses the same way. The developer commands (`context`, `progress`, `lookup`, …) stop on a
124
+ product configuration with one sentence: it has no export.
125
+
101
126
  ## Working day
102
127
 
103
128
  You talk to Claude Code; the skills call the dispatcher and the CLI for you.
@@ -163,8 +188,9 @@ switch or commit (`merged` fetches `origin/<main>` and the task branch, to read
163
188
 
164
189
  | Command | What it does |
165
190
  | ----------------------------------------- | ----------------------------------------------------------------------------- |
166
- | `init [options]` | Set the repository up (see above). |
191
+ | `init [options]` | Set the repository up (see above); `--product` in the spec project. |
167
192
  | `key` | Print the public key and fingerprint you sign with. |
193
+ | `whoami [--json]` | Sign in and print who your key is to the dispatcher: email, role (developer or product person), the latest ingested export. |
168
194
  | `open dispatcher` | Sign in and open the dispatcher's pages in the browser. The link works once, for a minute. |
169
195
  | `context <task> [--json] [--stats]` | Print the task's brief from the export, starting with its questions and its checklist; for a bug's task (`BUG-3/BE`), the bug's words, its cites as the checklist and the objects as they are now. |
170
196
  | `progress [task] [--json]` | Report the items your commits cover. Default: the task of the branch `task/<chg>-<track>`, else of the last commit's `Alterspec-Task` trailer. |
@@ -174,7 +200,7 @@ switch or commit (`merged` fetches `origin/<main>` and the task branch, to read
174
200
  | `bugs [--about <ID...>] [--status open\|done\|dismissed] [--track <code>] [--json]` | Print the bugs naming some IDs (to find one raised before), or without `--about` your own, each with its tasks' statuses and branches. |
175
201
  | `merged <task> [--json]` | Print the commit and branch to report `done` with: the pushed task branch's head, or the commit on `origin/<main>` that brought the task in. |
176
202
  | `export-head [--latest <sha>]` | Pull the export clone and print the commit to send to the dispatcher. |
177
- | `mcp` | The MCP server Claude Code starts from `.mcp.json`. It forwards to the dispatcher. |
203
+ | `mcp` | The MCP server Claude Code starts from `.mcp.json`. It forwards to the dispatcher, listing and allowing only the tools of your key's role. |
178
204
 
179
205
  Each runs as `npx @alterset/alterspec-client <command>`.
180
206
 
@@ -193,7 +193,9 @@ npx @alterset/alterspec-client open dispatcher
193
193
  ```
194
194
 
195
195
  It opens the dispatcher in your browser, signed in as you: the dashboard, the changes and tasks, the graph of what
196
- waits for what. If it says the dispatcher refused your SSH key, send your admin the two lines it prints.
196
+ waits for what. If it says the dispatcher refused your SSH key, send your admin the two lines it prints. Without a
197
+ browser, `npx @alterset/alterspec-client whoami` prints who your key is to the dispatcher and the latest export it
198
+ ingested.
197
199
 
198
200
  ## Step 6: Working with Claude Code
199
201
 
@@ -389,6 +391,10 @@ when one of yours was fixed since you last looked.
389
391
  - **Tell Claude about the spec outside the skills too.** The skills explain the export only while they run. Copy the
390
392
  block in [`agent-instructions.md`](agent-instructions.md) (in this package) into your `CLAUDE.md` or wherever you
391
393
  keep your agent's instructions, with your export clone's path.
394
+ - **The product owner uses the same client, in another role.** In the spec project, `init --product` sets up a
395
+ `product` session that answers your questions, marks them reconciled and reads your feedback, and sees nothing of
396
+ the tasks (README, "The product side"). What your code does today reaches the spec only through your question
397
+ and the owner's answer, never by anyone reading your repository.
392
398
 
393
399
  ## When something goes wrong
394
400
 
package/dist/cli.js CHANGED
@@ -166,9 +166,12 @@ var NpxArg = z2.string().regex(/^--?[A-Za-z0-9][A-Za-z0-9=._:/-]*$/, "must be on
166
166
  var ClientConfigSchema = z2.object({
167
167
  /** The dispatcher's URL. */
168
168
  dispatcher: z2.url(),
169
- /** The developer's clone of the export repository, relative to this file's folder or absolute. */
170
- export: z2.string().min(1),
171
- /** The tracks this repository builds: the default of `next_task`. */
169
+ /**
170
+ * The developer's clone of the export repository, relative to this file's folder or absolute. Absent in the
171
+ * product side's configuration (`init --product`, spec 8.6): the spec project reads its own spec, never an export.
172
+ */
173
+ export: z2.string().min(1).optional(),
174
+ /** The tracks this repository builds: the default of `next_task`. A product configuration has none. */
172
175
  tracks: z2.array(TrackCode).default([]),
173
176
  /** Unused since 0.14.0 (the client makes no worktree); accepted so a configuration written before stays valid. */
174
177
  worktrees: z2.string().min(1).optional(),
@@ -182,6 +185,7 @@ var ClientConfigSchema = z2.object({
182
185
  */
183
186
  npx: z2.object({ args: z2.array(NpxArg).default([]) }).strict().optional()
184
187
  }).strict();
188
+ var isProduct = (config) => config.export === void 0;
185
189
  var ConfigError = class extends Error {
186
190
  };
187
191
  var git = (cwd, ...args) => {
@@ -219,18 +223,53 @@ function loadConfig(cwd = process.cwd()) {
219
223
  if (config) return { root, config };
220
224
  }
221
225
  throw new ConfigError(
222
- `No ${CONFIG_FILE} here: run \`npx @alterset/alterspec-client init --dispatcher <url> --export <path>\` first.`
226
+ `No ${CONFIG_FILE} here: run \`npx @alterset/alterspec-client init --dispatcher <url> --export <path>\` first (in a spec project, \`init --product --dispatcher <url>\`).`
223
227
  );
224
228
  }
225
229
  function configPath(root, path) {
226
230
  if (path === "~" || path.startsWith("~/")) return join(homedir(), path.slice(1));
227
231
  return isAbsolute(path) ? path : resolve(root, path);
228
232
  }
229
- var exportDir = ({ root, config }) => configPath(root, config.export);
233
+ function exportDir({ root, config }) {
234
+ if (config.export === void 0)
235
+ throw new ConfigError(
236
+ `${join(root, CONFIG_FILE)} is a product configuration (no export): it answers the build's questions and takes no task. The developer commands need a repository set up with \`init --dispatcher <url> --export <path>\`.`
237
+ );
238
+ return configPath(root, config.export);
239
+ }
230
240
  function writeConfig(root, config) {
231
241
  writeFileSync(join(root, CONFIG_FILE), JSON.stringify(config, null, 2) + "\n");
232
242
  }
233
243
 
244
+ // src/role.ts
245
+ var ROLE_HEADER = "x-alterspec-role";
246
+ var roleOfConfig = (config) => isProduct(config) ? "product" : "developer";
247
+ var PRODUCT_TOOLS = [
248
+ "whoami",
249
+ "questions",
250
+ "answer",
251
+ "reconcile",
252
+ "feedback",
253
+ "bug_reports"
254
+ ];
255
+ var PRODUCT_ONLY = /* @__PURE__ */ new Set(["answer", "reconcile", "bug_reports"]);
256
+ function roleOf(whoami) {
257
+ if (whoami.role === "product" || whoami.role === "developer") return whoami.role;
258
+ return whoami.product === true ? "product" : "developer";
259
+ }
260
+ function allows(role, tool) {
261
+ return role === "product" ? PRODUCT_TOOLS.includes(tool) : !PRODUCT_ONLY.has(tool);
262
+ }
263
+ function refusal(role, tool) {
264
+ return role === "product" ? {
265
+ code: "NOT_DEVELOPER",
266
+ message: `Your key is registered as a product person; \`${tool}\` is the developers'. A product session sees the build's questions, feedback and bugs, never its tasks.`
267
+ } : {
268
+ code: "NOT_PRODUCT",
269
+ message: `Your key is registered as a developer; \`${tool}\` is the product side's. Answers and reconciling are the spec project's, through a key registered as a product person.`
270
+ };
271
+ }
272
+
234
273
  // src/ssh.ts
235
274
  import { execFileSync as execFileSync2 } from "child_process";
236
275
  import { createHash } from "crypto";
@@ -349,11 +388,14 @@ var Session = class {
349
388
  this.fetchFn = opts.fetch ?? fetch;
350
389
  this.now = opts.now ?? Date.now;
351
390
  this.signer = opts.signer ?? sign;
391
+ this.role = opts.role;
352
392
  }
353
393
  token;
354
394
  fetchFn;
355
395
  now;
356
396
  signer;
397
+ /** The role asked for on every request, when the configuration means one (decision 33). */
398
+ role;
357
399
  /** How many times this session signed in, for tests and logs. */
358
400
  signIns = 0;
359
401
  async call(path, init) {
@@ -396,6 +438,7 @@ var Session = class {
396
438
  for (let attempt = 0; ; attempt++) {
397
439
  const headers = new Headers(init.headers);
398
440
  headers.set("authorization", `Bearer ${await this.bearer()}`);
441
+ if (this.role) headers.set(ROLE_HEADER, this.role);
399
442
  const res = await this.call(path, { ...init, headers });
400
443
  if (res.status !== 401 || attempt > 0) {
401
444
  if (res.status === 401 || res.status === 403) throw await errorOf(res, this.key);
@@ -412,7 +455,7 @@ function keyOf(loaded) {
412
455
  const configured = key && !/^(ssh-ed25519|sk-ssh-ed25519@openssh\.com) /.test(key) ? configPath(loaded.root, key) : key;
413
456
  return resolveKey({ configured });
414
457
  }
415
- var sessionOf = (loaded) => new Session(loaded.config.dispatcher, keyOf(loaded));
458
+ var sessionOf = (loaded) => new Session(loaded.config.dispatcher, keyOf(loaded), { role: roleOfConfig(loaded.config) });
416
459
 
417
460
  // src/bugs.ts
418
461
  import { z as z8 } from "zod";
@@ -1288,6 +1331,17 @@ function runProxy(opts) {
1288
1331
  const send = (message) => void output.write(JSON.stringify(message) + "\n");
1289
1332
  const result = (id, value) => send({ jsonrpc: "2.0", id, result: value });
1290
1333
  const error = (id, message, code = -32e3) => send({ jsonrpc: "2.0", id, error: { code, message } });
1334
+ let role;
1335
+ const roleOnce = () => role ??= callTool(session, "whoami").then(roleOf).catch((e) => {
1336
+ role = void 0;
1337
+ throw e;
1338
+ });
1339
+ const cut = (answer, r) => {
1340
+ const tools = answer.result?.tools;
1341
+ if (!Array.isArray(tools)) return answer;
1342
+ const a = answer;
1343
+ return { ...a, result: { ...a.result, tools: tools.filter((t) => allows(r, t.name ?? "")) } };
1344
+ };
1291
1345
  function refused(m, e) {
1292
1346
  if (!isRequest(m)) return;
1293
1347
  const id = m.id;
@@ -1326,6 +1380,21 @@ function runProxy(opts) {
1326
1380
  }
1327
1381
  async function forward(m) {
1328
1382
  try {
1383
+ const gated = m.method === "tools/list" || m.method === "tools/call";
1384
+ const r = gated ? await roleOnce() : void 0;
1385
+ if (r && m.method === "tools/call") {
1386
+ const tool = String(m.params?.name ?? "");
1387
+ if (!allows(r, tool)) {
1388
+ const why = refusal(r, tool);
1389
+ log(`${tool} refused: ${why.code}`);
1390
+ if (!isRequest(m)) return;
1391
+ return result(m.id, {
1392
+ content: [{ type: "text", text: why.message }],
1393
+ structuredContent: { error: why },
1394
+ isError: true
1395
+ });
1396
+ }
1397
+ }
1329
1398
  const headers = {
1330
1399
  "content-type": "application/json",
1331
1400
  accept: "application/json, text/event-stream"
@@ -1345,7 +1414,7 @@ function runProxy(opts) {
1345
1414
  for (const answer of messagesOf(res.headers.get("content-type") ?? "", text)) {
1346
1415
  const pv = answer.result?.protocolVersion;
1347
1416
  if (m.method === "initialize" && typeof pv === "string") protocolVersion = pv;
1348
- send(answer);
1417
+ send(r && m.method === "tools/list" ? cut(answer, r) : answer);
1349
1418
  }
1350
1419
  } catch (e) {
1351
1420
  if (e instanceof KeyRefused) {
@@ -1919,7 +1988,7 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
1919
1988
  const e = entries.get(key);
1920
1989
  return e ? diffLines(forDiff(key, e.before), forDiff(key, e.after)).filter((l) => l.op === "+") : [];
1921
1990
  }).map((l) => l.text);
1922
- const written = [ctx.proposal.why ?? "", ctx.proposal.what ?? "", ...added];
1991
+ const written2 = [ctx.proposal.why ?? "", ctx.proposal.what ?? "", ...added];
1923
1992
  const changed = new Set(work.objects);
1924
1993
  const isNew = (id) => changed.has(id) && !entries.get(id)?.exported.before;
1925
1994
  const piece = (id, bears) => {
@@ -1949,7 +2018,7 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
1949
2018
  const existed = new Set([...(entries.get(id)?.before ?? "").matchAll(/^### (\S+)/gm)].map((m) => m[1]));
1950
2019
  const idOf2 = (c) => c.slice(4).split(/\s/)[0];
1951
2020
  const listed = onList ? chunks.filter((c) => onList.has(idOf2(c))) : chunks;
1952
- written.push(...listed);
2021
+ written2.push(...listed);
1953
2022
  const kept = onList ? listed.filter((c) => existed.has(idOf2(c))) : chunks;
1954
2023
  const added2 = listed.length - kept.length;
1955
2024
  const title = titleOf(x, id);
@@ -1976,13 +2045,13 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
1976
2045
  ])
1977
2046
  ];
1978
2047
  const carried = (kind) => {
1979
- const bearing2 = idsIn(written.join("\n"), [kind]);
2048
+ const bearing2 = idsIn(written2.join("\n"), [kind]);
1980
2049
  return [.../* @__PURE__ */ new Set([...named3(kind), ...bearing2])].flatMap((id) => piece(id, bearing2.includes(id)));
1981
2050
  };
1982
2051
  ctx.rules = carried("rule");
1983
2052
  ctx.events = carried("event");
1984
2053
  const whole = (kind) => {
1985
- const bearing2 = idsIn(written.join("\n"), [kind]);
2054
+ const bearing2 = idsIn(written2.join("\n"), [kind]);
1986
2055
  const own = work.objects.filter((k) => idKind(k) === kind);
1987
2056
  return [.../* @__PURE__ */ new Set([...own, ...bearing2])].flatMap((id) => piece(id, true));
1988
2057
  };
@@ -2039,7 +2108,7 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
2039
2108
  patterns: existing(patternsPath(track.code))
2040
2109
  };
2041
2110
  }
2042
- const bearing = idsIn(written.join("\n"), ["decision"]);
2111
+ const bearing = idsIn(written2.join("\n"), ["decision"]);
2043
2112
  const named2 = idsIn(work.objects.map((k) => entries.get(k)?.after ?? "").join("\n"), ["decision"]);
2044
2113
  ctx.decisions = [.../* @__PURE__ */ new Set([...bearing, ...named2])].flatMap((id) => piece(id, bearing.includes(id)));
2045
2114
  const rules = [
@@ -2059,7 +2128,7 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
2059
2128
  if (legend.length) ctx.matrixLegend = legend;
2060
2129
  }
2061
2130
  const glossary = x.fileOf("term:");
2062
- const writtenText = written.join("\n");
2131
+ const writtenText = written2.join("\n");
2063
2132
  ctx.terms = (glossary && x.has(glossary) ? x.shards(glossary) : []).filter((path) => !/\/\d{2}-[^/]*$/.test(path)).flatMap((path) => {
2064
2133
  const name = /^## (.+)$/m.exec(shardText(x, path) ?? "")?.[1]?.trim();
2065
2134
  if (!name || changed.has(`term:${name}`)) return [];
@@ -3104,26 +3173,60 @@ function ignoreLocalSettings(root) {
3104
3173
  `);
3105
3174
  return "added";
3106
3175
  }
3176
+ var NO_FILES = {
3177
+ created: [],
3178
+ updated: [],
3179
+ unchanged: [],
3180
+ kept: [],
3181
+ outdated: [],
3182
+ conflicts: [],
3183
+ removed: []
3184
+ };
3185
+ function written(config) {
3186
+ const out = { ...config };
3187
+ if (!out.npx?.args.length) delete out.npx;
3188
+ if (isProduct(out) && !out.tracks.length) delete out.tracks;
3189
+ return out;
3190
+ }
3107
3191
  function initClient(root, opts, version) {
3108
- const { force, ...given } = opts;
3192
+ const { force, product: asked, ...given } = opts;
3109
3193
  const existing = readConfigAt(root);
3110
3194
  const defined = Object.fromEntries(Object.entries(given).filter(([, v]) => v !== void 0));
3195
+ const developerFlags = given.export !== void 0 || (given.tracks?.length ?? 0) > 0;
3196
+ if (asked && developerFlags)
3197
+ throw new ConfigError(
3198
+ "init --product takes no --export and no --track: the product side has no export and builds no track."
3199
+ );
3200
+ if (asked && existing && !isProduct(existing))
3201
+ throw new ConfigError(
3202
+ `This repository is set up for a developer (${CONFIG_FILE} has an export): remove that configuration first if it is to be the product side's.`
3203
+ );
3204
+ if (!asked && existing && isProduct(existing) && developerFlags)
3205
+ throw new ConfigError(
3206
+ `This repository is set up for the product side (${CONFIG_FILE} has no export): remove that configuration first if a developer is to use it.`
3207
+ );
3208
+ const product = asked || existing !== void 0 && isProduct(existing);
3111
3209
  const parsed = ClientConfigSchema.safeParse({ ...existing, ...defined });
3112
3210
  if (!parsed.success) {
3113
3211
  const missing = parsed.error.issues.map((i) => i.path.join(".")).filter(Boolean);
3114
3212
  throw new ConfigError(
3115
- existing ? `The configuration would not be valid: ${parsed.error.issues.map((i) => `${i.path.join(".")} ${i.message}`).join("; ")}.` : `init needs --dispatcher <url> and --export <path to your clone of the export>${missing.length ? ` (missing or wrong: ${missing.join(", ")})` : ""}.`
3213
+ existing ? `The configuration would not be valid: ${parsed.error.issues.map((i) => `${i.path.join(".")} ${i.message}`).join("; ")}.` : product ? `init --product needs --dispatcher <url>${missing.length ? ` (missing or wrong: ${missing.join(", ")})` : ""}.` : `init needs --dispatcher <url> and --export <path to your clone of the export>${missing.length ? ` (missing or wrong: ${missing.join(", ")})` : ""}.`
3116
3214
  );
3117
3215
  }
3118
- if (!parsed.data.npx?.args.length) delete parsed.data.npx;
3119
- const npxArgs = parsed.data.npx?.args ?? [];
3120
- const before2 = existing && JSON.stringify(existing);
3121
- const config = !existing ? "created" : before2 === JSON.stringify(parsed.data) ? "unchanged" : "updated";
3122
- if (config !== "unchanged") writeConfig(root, parsed.data);
3216
+ if (!product && parsed.data.export === void 0)
3217
+ throw new ConfigError(
3218
+ "init needs --export <path to your clone of the export> for a developer\u2019s repository; the product side runs `init --product` instead."
3219
+ );
3220
+ const next = written(parsed.data);
3221
+ const npxArgs = next.npx?.args ?? [];
3222
+ const before2 = existing && JSON.stringify(written(existing));
3223
+ const config = !existing ? "created" : before2 === JSON.stringify(next) ? "unchanged" : "updated";
3224
+ if (config !== "unchanged") writeConfig(root, next);
3123
3225
  const mcp = writeMcpJson(root, npxArgs);
3124
- const hook = writeClaudeSettings(root, npxArgs);
3125
3226
  const ignore = ignoreLocalSettings(root);
3126
3227
  const approval = writeLocalSettings(root);
3228
+ if (product) return { role: "product", config, mcp, hook: "none", approval, ignore, files: NO_FILES };
3229
+ const hook = writeClaudeSettings(root, npxArgs);
3127
3230
  const files = install(root, buildClientPlan(version, npxArgs), {
3128
3231
  mode: "update",
3129
3232
  force,
@@ -3131,7 +3234,7 @@ function initClient(root, opts, version) {
3131
3234
  manifestPath: MANIFEST_PATH2,
3132
3235
  emptiedFolder: /\.claude\/skills\/alterspec-[^/]+$/
3133
3236
  });
3134
- return { config, mcp, hook, approval, ignore, files };
3237
+ return { role: "developer", config, mcp, hook, approval, ignore, files };
3135
3238
  }
3136
3239
 
3137
3240
  // ../src/lib/names.ts
@@ -3644,6 +3747,26 @@ function packageVersion() {
3644
3747
  }
3645
3748
 
3646
3749
  // src/cli.ts
3750
+ function whoamiText(me) {
3751
+ const role = roleOf(me);
3752
+ const latest = me.latest_export;
3753
+ const lines = [
3754
+ `${String(me.email ?? "?")}${me.name ? ` (${String(me.name)})` : ""}: ${role === "product" ? "a product person (answers questions, sees no task)" : "a developer"}`
3755
+ ];
3756
+ if (role === "developer") {
3757
+ const tracks = Array.isArray(me.tracks) ? me.tracks : [];
3758
+ if (tracks.length) lines.push(`Tracks: ${tracks.join(", ")}`);
3759
+ }
3760
+ if (latest?.commit)
3761
+ lines.push(`Latest ingested export: ${latest.commit}${latest.ordinal ? ` (#${latest.ordinal})` : ""}`);
3762
+ const ingested = Array.isArray(me.ingested) ? me.ingested : [];
3763
+ if (ingested.length)
3764
+ lines.push(
3765
+ "Ingested exports, newest first:",
3766
+ ...ingested.map((i) => ` ${String(i.commit ?? "?").slice(0, 12)} ${String(i.at ?? "")}`)
3767
+ );
3768
+ return lines.join("\n") + "\n";
3769
+ }
3647
3770
  var tryConfig = () => {
3648
3771
  try {
3649
3772
  return loadConfig();
@@ -3700,10 +3823,13 @@ function approveWorktree(loaded) {
3700
3823
  var program = new Command();
3701
3824
  program.name("alterspec-client").description("alterspec client \u2014 takes tasks of an alterspec export from the dispatcher.").version(packageVersion());
3702
3825
  program.command("init").description(
3703
- "set the client up in this repository: configuration, the dispatcher in .mcp.json, the progress hook, the skills"
3826
+ "set the client up in this repository: configuration, the dispatcher in .mcp.json, the progress hook, the skills; with --product (in a spec project) only the configuration and the dispatcher"
3704
3827
  ).option("--dispatcher <url>", "the dispatcher\u2019s URL").option("--export <path>", "your clone of the export repository").option("--track <code...>", "the tracks this repository builds (BE, WEB, \u2026)").option("--key <key>", "the public key to sign with: a .pub path or the key line").option("--branch <name>", "the track\u2019s main branch (default the remote\u2019s HEAD)").option(
3705
3828
  "--npx <flags>",
3706
3829
  "flags this project runs npx with, comma-separated (--npx=--min-release-age=0); --npx= removes them"
3830
+ ).option(
3831
+ "--product",
3832
+ "the product side\u2019s set-up, in the spec project: a dispatcher and a key, no export, no track, no developer skill or hook"
3707
3833
  ).option("--force", "replace skills you modified").action(
3708
3834
  run(
3709
3835
  (opts) => {
@@ -3717,7 +3843,16 @@ program.command("init").description(
3717
3843
  packageVersion()
3718
3844
  );
3719
3845
  const f = r.files;
3720
- const lines = [
3846
+ const lines = r.role === "product" ? [
3847
+ `${CONFIG_FILE} (the product side: dispatcher and key, no export, no tracks): ${r.config}`,
3848
+ `${MCP_JSON} (server "dispatcher"): ${r.mcp}`,
3849
+ `${CLAUDE_LOCAL_SETTINGS} (the "dispatcher" server approved for you): ${r.approval}`,
3850
+ "Nothing of the developer\u2019s was installed: no hook, no skill, no prompt.",
3851
+ "",
3852
+ `Commit ${CONFIG_FILE} and ${MCP_JSON}.`,
3853
+ ...ignoreLines(r.ignore),
3854
+ "The dispatcher\u2019s product tools (whoami, questions, answer, reconcile, feedback, bug_reports) appear in the next Claude Code session; /alterspec-answer post and /alterspec-reconcile use them."
3855
+ ] : [
3721
3856
  `${CONFIG_FILE}: ${r.config}`,
3722
3857
  `${MCP_JSON} (server "dispatcher"): ${r.mcp}`,
3723
3858
  `${CLAUDE_SETTINGS} (progress hook after git commit): ${r.hook}`,
@@ -3731,7 +3866,12 @@ program.command("init").description(
3731
3866
  ];
3732
3867
  try {
3733
3868
  const key = keyOf({ root, config: readConfigAt(root) });
3734
- lines.push("", "Send this public key to the dispatcher\u2019s admin:", key.line, key.fingerprint);
3869
+ lines.push(
3870
+ "",
3871
+ r.role === "product" ? "Send this public key to the dispatcher\u2019s admin, to register as a product person:" : "Send this public key to the dispatcher\u2019s admin:",
3872
+ key.line,
3873
+ key.fingerprint
3874
+ );
3735
3875
  } catch (e) {
3736
3876
  lines.push("", e.message);
3737
3877
  }
@@ -3739,6 +3879,13 @@ program.command("init").description(
3739
3879
  }
3740
3880
  )
3741
3881
  );
3882
+ program.command("whoami").description("sign in and print who this key is to the dispatcher: email, role, the latest ingested export").option("--json", "print the dispatcher\u2019s answer as JSON").action(
3883
+ run(async (opts) => {
3884
+ const me = await callTool(sessionOf(loadConfig()), "whoami");
3885
+ if (opts.json) return void process.stdout.write(JSON.stringify(me, null, 2) + "\n");
3886
+ process.stdout.write(whoamiText(me));
3887
+ })
3888
+ );
3742
3889
  program.command("key").description("print the public key and fingerprint the client signs with, to send to the admin").action(
3743
3890
  run(() => {
3744
3891
  const key = keyOf(tryConfig());
@@ -3925,4 +4072,7 @@ program.command("merged").description(
3925
4072
  })
3926
4073
  );
3927
4074
  await program.parseAsync();
4075
+ export {
4076
+ whoamiText
4077
+ };
3928
4078
  //# sourceMappingURL=cli.js.map