@grovehq/cli 0.39.1 → 0.40.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.
Files changed (2) hide show
  1. package/cli.cjs +36 -89
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -3729,10 +3729,6 @@ var COMMANDS = [
3729
3729
  description: 'Usage: grove help [command]. For subcommands, quote them: `grove help "project assign"`.'
3730
3730
  }
3731
3731
  ];
3732
- var logCommandsEnabled = true;
3733
- function setLogCommandsEnabled(enabled) {
3734
- logCommandsEnabled = enabled;
3735
- }
3736
3732
  var finderMissEnabled = true;
3737
3733
  function setFinderMissEnabled(enabled) {
3738
3734
  finderMissEnabled = enabled;
@@ -3741,8 +3737,7 @@ function withoutFinderMiss(commands) {
3741
3737
  return commands.filter((c) => c.name !== "thread mark-finder-miss" && c.name !== "thread unmark-finder-miss").map((c) => c.flags?.includes(FINDER_MISS_FLAG) ? { ...c, flags: c.flags.filter((f) => f !== FINDER_MISS_FLAG) } : c);
3742
3738
  }
3743
3739
  function visibleCommands() {
3744
- const commands = logCommandsEnabled ? COMMANDS : COMMANDS.filter((c) => c.name !== "log" && !c.name.startsWith("log "));
3745
- return finderMissEnabled ? commands : withoutFinderMiss(commands);
3740
+ return finderMissEnabled ? COMMANDS : withoutFinderMiss(COMMANDS);
3746
3741
  }
3747
3742
  function byName(name) {
3748
3743
  return visibleCommands().find((c) => c.name === name);
@@ -4260,7 +4255,7 @@ async function fetchNpmLatest(signal) {
4260
4255
  }
4261
4256
 
4262
4257
  // src/lib/version.ts
4263
- var CLI_VERSION = true ? "0.39.1" : "0.0.0-dev";
4258
+ var CLI_VERSION = true ? "0.40.1" : "0.0.0-dev";
4264
4259
  function compareSemver(a, b) {
4265
4260
  const parse = (v) => (v.split("-")[0] ?? v).split(".").map((n) => Number.parseInt(n, 10) || 0);
4266
4261
  const pa = parse(a);
@@ -4355,7 +4350,6 @@ function isPreflightFailure(err) {
4355
4350
  return err instanceof SessionExpiredError || err instanceof AuthUnavailableError || err instanceof UpgradeRequiredError;
4356
4351
  }
4357
4352
  var REQUEST_TIMEOUT_MS = 9e4;
4358
- var AGENT_ACTIVITY_LOG_CHECK_TIMEOUT_MS = 5e3;
4359
4353
  var FINDER_FEEDBACK_CHECK_TIMEOUT_MS = 5e3;
4360
4354
  var DOWNLOAD_TIMEOUT_MS = 15 * 6e4;
4361
4355
  function send(path, init, accessToken, timeoutMs = REQUEST_TIMEOUT_MS) {
@@ -5048,13 +5042,6 @@ var api = {
5048
5042
  { method: "PATCH", body: JSON.stringify(body) }
5049
5043
  );
5050
5044
  },
5051
- /** Whether the signed-in org's agent activity log flag is on — checked
5052
- * live since the CLI has no offline signal for it. */
5053
- getAgentActivityLogEnabled() {
5054
- return request("/api/grove/agent-activity-log/enabled", {
5055
- signal: AbortSignal.timeout(AGENT_ACTIVITY_LOG_CHECK_TIMEOUT_MS)
5056
- });
5057
- },
5058
5045
  /**
5059
5046
  * Read a project's activity log back — the channel a waiting coding agent
5060
5047
  * reads to learn whether a handoff has arrived, through the same channel it
@@ -5069,18 +5056,22 @@ var api = {
5069
5056
  * entry on this log is refused server-side rather than read as the start of
5070
5057
  * it — see `unknown_point` in `isSettledRejection`'s callers.
5071
5058
  */
5072
- async readActivityLog(stableId, after) {
5059
+ async readActivityLog(stableId, after, init = {}) {
5073
5060
  const qs = after === void 0 ? "" : `?after=${encodeURIComponent(after)}`;
5074
5061
  const res = await request(
5075
- `/api/grove/projects/${encodeURIComponent(stableId)}/activity-log${qs}`
5062
+ `/api/grove/projects/${encodeURIComponent(stableId)}/activity-log${qs}`,
5063
+ init
5076
5064
  );
5077
5065
  return {
5078
5066
  ...res,
5079
5067
  data: {
5080
- entries: res.data.entries.map((e) => ({
5081
- ...e,
5082
- documents: e.documents ?? (e.documentIds ?? []).map((documentId) => ({ documentId, path: null }))
5083
- }))
5068
+ entries: res.data.entries.map(
5069
+ (e) => e.kind === "state_change" ? e : {
5070
+ ...e,
5071
+ kind: "handoff",
5072
+ documents: e.documents ?? (e.documentIds ?? []).map((documentId) => ({ documentId, path: null }))
5073
+ }
5074
+ )
5084
5075
  }
5085
5076
  };
5086
5077
  },
@@ -5821,6 +5812,10 @@ function refreshMirror(stableId, data) {
5821
5812
  var UNNAMEABLE_DOCUMENT = "a document Grove can no longer name";
5822
5813
  function composerOf(entry) {
5823
5814
  const person3 = entry.authorDisplayName ?? "a workspace member";
5815
+ if (entry.kind === "state_change") {
5816
+ if (entry.authorId === null) return "Grove, on its own";
5817
+ return entry.how === "hand" ? `${person3}, by hand` : `Grove, for ${person3}`;
5818
+ }
5824
5819
  switch (entry.postedBy) {
5825
5820
  case "grove":
5826
5821
  return `Grove, for ${person3}`;
@@ -5831,10 +5826,14 @@ function composerOf(entry) {
5831
5826
  }
5832
5827
  }
5833
5828
  function renderEntry(entry, index, total) {
5834
- const lines = [
5829
+ const head = [
5835
5830
  `Entry ${index + 1} of ${total} \u2014 posted ${new Date(entry.createdAt).toISOString()}, by ${composerOf(entry)}`,
5836
5831
  `Entry id: ${entry.entryId}`,
5837
- entry.text,
5832
+ entry.text
5833
+ ];
5834
+ if (entry.kind === "state_change") return head.join("\n");
5835
+ const lines = [
5836
+ ...head,
5838
5837
  entry.documents.length === 0 ? "Names no documents." : `Documents changed: ${entry.documents.map((doc) => doc.path ?? UNNAMEABLE_DOCUMENT).join(", ")}`,
5839
5838
  ...entry.threadIds.length === 0 && entry.threadOrder.length === 0 ? ["Names no threads."] : [],
5840
5839
  ...entry.threadIds.length === 0 ? [] : [`Threads closed: ${entry.threadIds.join(", ")}`],
@@ -5882,29 +5881,11 @@ async function listActivityLogCommand(stableId, opts = {}) {
5882
5881
  }
5883
5882
  }
5884
5883
 
5885
- // src/lib/agent-activity-log-capability.ts
5886
- async function agentActivityLogEnabled() {
5887
- try {
5888
- const { data } = await api.getAgentActivityLogEnabled();
5889
- return data.enabled;
5890
- } catch (err) {
5891
- if (isPreflightFailure(err)) throw err;
5892
- return false;
5893
- }
5894
- }
5895
-
5896
5884
  // src/lib/log-nudge.ts
5897
- async function logNudgesEnabled() {
5898
- try {
5899
- return await agentActivityLogEnabled();
5900
- } catch {
5901
- return false;
5902
- }
5903
- }
5885
+ var LOG_READ_TIMEOUT_MS = 5e3;
5904
5886
  async function assignLogLines(stableId) {
5905
- if (!await logNudgesEnabled()) return [];
5906
5887
  try {
5907
- const { entries } = (await api.readActivityLog(stableId)).data;
5888
+ const { entries } = (await api.readActivityLog(stableId, void 0, { signal: AbortSignal.timeout(LOG_READ_TIMEOUT_MS) })).data;
5908
5889
  const arrival = `Changes to this spec and answers to your threads arrive on it, so read \`grove log list ${stableId}\` again before you open the PR.`;
5909
5890
  if (entries.length === 0) return [`Nothing on ${stableId}'s agent activity log yet. ${arrival}`];
5910
5891
  const total = entries.length;
@@ -6055,7 +6036,7 @@ async function writeProjectDocCommand(doc, stableId, opts) {
6055
6036
  refreshMirror(stableId, data);
6056
6037
  if (hint) info(`
6057
6038
  ${hint}`);
6058
- if (data.changed && await logNudgesEnabled()) info(`
6039
+ if (data.changed) info(`
6059
6040
  ${specWriteNudge(stableId)}`);
6060
6041
  } catch (err) {
6061
6042
  if (!handleCommandError(err)) throw err;
@@ -6368,17 +6349,12 @@ function pickupReviewLines(stableId) {
6368
6349
  threadCheckLine(stableId)
6369
6350
  ];
6370
6351
  }
6371
- function buildReminderLines(stableId, logEnabled) {
6372
- const lines = [
6352
+ function buildReminderLines(stableId) {
6353
+ return [
6373
6354
  `As you work on ${stableId}, if you find a functional gap in its spec \u2014 something the build needs that it doesn't decide, or that the code contradicts \u2014 offer the person directing you to raise it as a thread.`,
6374
- threadCheckLine(stableId)
6355
+ threadCheckLine(stableId),
6356
+ `Answers arrive on ${stableId}'s agent activity log: read it from your last point with \`grove log list ${stableId} --after <last entry id you read>\`. If an answer changes something you already built, say so in its thread.`
6375
6357
  ];
6376
- if (logEnabled) {
6377
- lines.push(
6378
- `Answers arrive on ${stableId}'s agent activity log: read it from your last point with \`grove log list ${stableId} --after <last entry id you read>\`. If an answer changes something you already built, say so in its thread.`
6379
- );
6380
- }
6381
- return lines;
6382
6358
  }
6383
6359
 
6384
6360
  // src/commands/dashboard.ts
@@ -6390,9 +6366,8 @@ async function dashboardCommand() {
6390
6366
  }
6391
6367
  const auth = authState.auth;
6392
6368
  const binding = worktreeBinding();
6393
- const [listing, logEnabled, outcomes2] = await Promise.all([
6369
+ const [listing, outcomes2] = await Promise.all([
6394
6370
  fetchListing(),
6395
- binding.kind === "assigned" ? logNudgesEnabled() : false,
6396
6371
  binding.kind === "assigned" ? fetchOutcomes(binding.stableId) : null
6397
6372
  ]);
6398
6373
  if (listing.ok) {
@@ -6417,7 +6392,7 @@ async function dashboardCommand() {
6417
6392
  }
6418
6393
  process.exitCode = 1;
6419
6394
  }
6420
- showBindingState(binding, logEnabled, outcomes2);
6395
+ showBindingState(binding, outcomes2);
6421
6396
  await showBehindLatestNotices();
6422
6397
  await refreshStandards(binding);
6423
6398
  }
@@ -6447,7 +6422,7 @@ async function fetchListing() {
6447
6422
  return { ok: false };
6448
6423
  }
6449
6424
  }
6450
- function showBindingState(binding, logEnabled, outcomes2) {
6425
+ function showBindingState(binding, outcomes2) {
6451
6426
  if (binding.kind === "unasked") return;
6452
6427
  info("");
6453
6428
  if (binding.kind === "none") {
@@ -6457,7 +6432,7 @@ function showBindingState(binding, logEnabled, outcomes2) {
6457
6432
  info(assignedHereLead(binding.stableId));
6458
6433
  for (const line of prContractBlock(binding.stableId, outcomes2)) info(line);
6459
6434
  info("");
6460
- for (const line of buildReminderLines(binding.stableId, logEnabled)) info(line);
6435
+ for (const line of buildReminderLines(binding.stableId)) info(line);
6461
6436
  }
6462
6437
  async function showBehindLatestNotices() {
6463
6438
  const entries = Object.entries(readSyncMarker());
@@ -8396,7 +8371,7 @@ async function raiseThreadCommand(stableId, opts) {
8396
8371
  data.url === null ? "Link: none \u2014 this workspace has no web address. Tell the developer the thread id and report the missing address." : `Link: ${data.url}`
8397
8372
  );
8398
8373
  info("Give the link to the person you work for; a thread is answered by a person, not by Grove.");
8399
- if (await logNudgesEnabled()) for (const line of raiseNudge(input.stableId)) info(line);
8374
+ for (const line of raiseNudge(input.stableId)) info(line);
8400
8375
  } catch (err) {
8401
8376
  if (isPreflightFailure(err)) {
8402
8377
  handleCommandError(err);
@@ -8630,7 +8605,7 @@ async function resolveThreadCommand(thread2, opts) {
8630
8605
  });
8631
8606
  info(message === void 0 ? `Resolved. Thread ${data.threadId} is resolved, with no post appended \u2014 it ends on the posts it already holds.` : `Resolved. Thread ${data.threadId} is resolved, and what was decided is recorded on it.`);
8632
8607
  if (data.settledAt !== void 0) info(`Resolved at: ${new Date(data.settledAt).toISOString()}`);
8633
- if (await logNudgesEnabled()) info(resolveNudge());
8608
+ info(resolveNudge());
8634
8609
  return;
8635
8610
  } catch (err) {
8636
8611
  const remarkFact = message !== void 0 ? `The remark WAS recorded on thread ${threadId}.` : `Nothing was appended to thread ${threadId} \u2014 no post was asked for.`;
@@ -9257,39 +9232,11 @@ async function gateFinderMiss(argv) {
9257
9232
  return true;
9258
9233
  }
9259
9234
 
9260
- // src/lib/log-gate.ts
9261
- function touchesLog(argv) {
9262
- if (argv[0] === "log") return true;
9263
- if (argv[0] === "--help" || argv[0] === "-h") return true;
9264
- return argv[0] === "help" && (argv.length <= 1 || argv[1] === "log" || argv[1]?.startsWith("log ") === true);
9265
- }
9266
- async function gateLogCommands(argv) {
9267
- if (!touchesLog(argv)) return true;
9268
- let enabled;
9269
- try {
9270
- enabled = await agentActivityLogEnabled();
9271
- } catch (err) {
9272
- if (argv[0] === "log" && isPreflightFailure(err)) {
9273
- handleCommandError(err);
9274
- return false;
9275
- }
9276
- setLogCommandsEnabled(false);
9277
- return true;
9278
- }
9279
- setLogCommandsEnabled(enabled);
9280
- if (!enabled && argv[0] === "log") {
9281
- unknownCommand("log");
9282
- return false;
9283
- }
9284
- return true;
9285
- }
9286
-
9287
9235
  // src/cli.ts
9288
9236
  async function main() {
9289
9237
  warnIfShadowingNpmCopy();
9290
9238
  const argv = process.argv.slice(2);
9291
- const [logOk, finderMissOk] = await Promise.all([gateLogCommands(argv), gateFinderMiss(argv)]);
9292
- if (logOk && finderMissOk) {
9239
+ if (await gateFinderMiss(argv)) {
9293
9240
  await program2.parseAsync();
9294
9241
  }
9295
9242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grovehq/cli",
3
- "version": "0.39.1",
3
+ "version": "0.40.1",
4
4
  "description": "Grove's command line, for coding agents building Grove projects.",
5
5
  "homepage": "https://grovehq.com",
6
6
  "license": "UNLICENSED",