@harborppm/cli 0.33.0 → 0.34.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.
Files changed (2) hide show
  1. package/lib/cli.mjs +19 -7
  2. package/package.json +1 -1
package/lib/cli.mjs CHANGED
@@ -296,7 +296,7 @@ const FLAG = {
296
296
  };
297
297
 
298
298
  /** Harbor's refusals are worded for agents; say them as the commands and flags that answer them. */
299
- export function hint(message) {
299
+ export function hint(message, project) {
300
300
  const said = message.replace(/\s*Ask the person;.*$/s, "");
301
301
  if (/confirmed: true/.test(message))
302
302
  return `${said}\nTo finish it anyway, run it again with --confirm.`;
@@ -331,8 +331,9 @@ export function hint(message) {
331
331
  .replace(/Find it with search_tasks\.$/, "Find it with harbor tasks.")
332
332
  .replace(
333
333
  /^(.+) has no pre-mortem running\. Start one with start_premortem first\.$/s,
334
+ // What the person typed found it, so the command they're told to run uses that (the name may be shared).
334
335
  (_, name) =>
335
- `${name} has no pre-mortem running. Start one with harbor premortem "${name}" --start.`,
336
+ `${name} has no pre-mortem running. Start one with harbor premortem "${project ?? name}" --start.`,
336
337
  )
337
338
  .replace(
338
339
  /^Nothing to change: pass a field to update\.$/,
@@ -353,11 +354,20 @@ export function hint(message) {
353
354
  }
354
355
 
355
356
  /** get_premortem's answer with its note naming the command, not the agent tool, since --json shows it. */
356
- export function premortemForTerminal(r) {
357
+ export function premortemForTerminal(r, project = r.project) {
357
358
  if (r.running || !r.note) return r;
358
359
  return {
359
360
  ...r,
360
- note: `No pre-mortem on ${r.project} yet. Start one with harbor premortem "${r.project}" --start.`,
361
+ note: `No pre-mortem on ${r.project} yet. Start one with harbor premortem "${project}" --start.`,
362
+ };
363
+ }
364
+
365
+ /** get_voyage_log's answer with its note on an empty crew naming the command, not the agent tool. */
366
+ export function voyageForTerminal(r, project = r.project) {
367
+ if (!r.crewNote) return r;
368
+ return {
369
+ ...r,
370
+ crewNote: `crew is the lines people add to the log; nobody has yet. Add yours with harbor voyage "${project}" "YOUR LINE".`,
361
371
  };
362
372
  }
363
373
 
@@ -405,6 +415,7 @@ const DETAIL = {
405
415
  " harbor voyage PROJECT reads a Done project's voyage log",
406
416
  ' harbor voyage PROJECT "YOUR LINE" writes: adds or changes your line in it',
407
417
  "",
418
+ " In --json, crew is the lines people added; closedBy is who closed tasks.",
408
419
  " PROJECT is a name, a key like RR, or an id. When two projects share a",
409
420
  " name, give the key.",
410
421
  ],
@@ -790,9 +801,10 @@ export async function run(argv, io = {}) {
790
801
  const call = async (name, args, show, forTerminal = (r) => r) => {
791
802
  const result = forTerminal(
792
803
  await client.call(name, args).catch((err) => {
793
- if (err instanceof HarborError) throw new HarborError(hint(err.message));
804
+ if (err instanceof HarborError) throw new HarborError(hint(err.message, args.project));
794
805
  throw err;
795
806
  }),
807
+ args.project,
796
808
  );
797
809
  // The prompt's counts are behind now; its next draw fetches new ones.
798
810
  if (name === "create_task" || name === "update_task") await stalePromptCache(env);
@@ -1307,7 +1319,7 @@ export async function run(argv, io = {}) {
1307
1319
  const answer = words.join(" ").trim();
1308
1320
  if (values.start) {
1309
1321
  const started = await client.call("start_premortem", { harbor, project }).catch((err) => {
1310
- if (err instanceof HarborError) throw new HarborError(hint(err.message));
1322
+ if (err instanceof HarborError) throw new HarborError(hint(err.message, project));
1311
1323
  throw err;
1312
1324
  });
1313
1325
  if (!answer) {
@@ -1362,7 +1374,7 @@ export async function run(argv, io = {}) {
1362
1374
  (r) => `Your line is in ${r.added.project}'s voyage log.`,
1363
1375
  );
1364
1376
  }
1365
- return call("get_voyage_log", { harbor, project }, voyageText);
1377
+ return call("get_voyage_log", { harbor, project }, voyageText, voyageForTerminal);
1366
1378
  }
1367
1379
  case "handover": {
1368
1380
  const { positionals, values, harbor } = parse(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "Harbor from the terminal: a full-screen app with everything, plus commands for scripts and agents.",
5
5
  "keywords": [
6
6
  "harbor",