@harborppm/cli 0.44.0 → 0.45.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/lib/cli.mjs CHANGED
@@ -115,7 +115,9 @@ export const HELP = `harbor: Harbor from the terminal
115
115
  harbor add "TITLE" --project P [--assignee me|none|NAME] [--due DATE]
116
116
  [--priority low|medium|high|urgent] [--status S]
117
117
  [--over-limit]
118
- harbor start TASK | review TASK | done TASK [--confirm] [--over-limit]
118
+ harbor start TASK | submit TASK | done TASK [--confirm] [--over-limit]
119
+ move a task to In play, In review
120
+ or Done
119
121
  harbor edit TASK [--title T] [--assignee me|none|NAME] [--due DATE|none]
120
122
  [--priority P] [--status S] [--notes TEXT]
121
123
  [--repeat weekly|biweekly|monthly|never]
@@ -139,9 +141,10 @@ export const HELP = `harbor: Harbor from the terminal
139
141
  [--notes T]
140
142
  one risk, issue or decision in
141
143
  full, or change it
142
- harbor review [--mine|--owner NAME] [--portfolio P] [--done]
144
+ harbor review [WORDS] [--mine|--owner NAME] [--portfolio P] [--done]
143
145
  the review: programs worst first,
144
- each with its next move
146
+ each with its next move (reads
147
+ only; harbor submit moves a task)
145
148
  harbor next-move PROGRAM "TEXT" write a program's next move
146
149
  harbor health --program P|--project P|--portfolio P STATE [--note WHY]
147
150
  set its health by hand, or auto
@@ -658,8 +661,10 @@ const DETAIL = {
658
661
  " project in or hold a task in",
659
662
  " harbor review --owner NAME the same for someone else",
660
663
  " harbor review --portfolio P one portfolio's",
661
- " harbor review TASK writes: moves a task to In review",
664
+ ' harbor review "WORDS" only programs whose name has them',
662
665
  "",
666
+ " The review only reads. To move a task to In review, run harbor submit",
667
+ " TASK (harbor review TASK did that before 0.45.0, and now says so).",
663
668
  ' Write a next move with harbor next-move PROGRAM "TEXT"; set a health by',
664
669
  " hand with harbor health. harbor export review prints it as CSV.",
665
670
  ],
@@ -789,6 +794,13 @@ async function harborNamed(client, key) {
789
794
 
790
795
  const TASK_KEY = /^[A-Za-z][A-Za-z0-9]{0,9}-\d+$/;
791
796
 
797
+ /** True when every word of `words` is somewhere in `name`, any case. */
798
+ const nameHas = (name, words) =>
799
+ words
800
+ .toLowerCase()
801
+ .split(/\s+/)
802
+ .every((w) => name.toLowerCase().includes(w));
803
+
792
804
  /**
793
805
  * A task by its key, else a project by name, else a task by id: its web
794
806
  * link and what to call it. Harbor's own refusal when nothing matches.
@@ -919,6 +931,7 @@ export async function run(argv, io = {}) {
919
931
  await writeCredentials({ ...now, harbor: h.id, harborName: h.name }, env);
920
932
  },
921
933
  theme: (await readSettings(env)).theme,
934
+ browse: io.browse ?? openBrowser,
922
935
  });
923
936
  return 0;
924
937
  }
@@ -1581,6 +1594,7 @@ export async function run(argv, io = {}) {
1581
1594
  );
1582
1595
  }
1583
1596
  case "start":
1597
+ case "submit":
1584
1598
  case "review":
1585
1599
  case "done": {
1586
1600
  const { positionals, values, harbor } = parse(
@@ -1588,7 +1602,17 @@ export async function run(argv, io = {}) {
1588
1602
  ? spec(["confirm", "over-limit", "mine", "done"], ["owner", "portfolio"])
1589
1603
  : spec(["confirm", "over-limit"]),
1590
1604
  );
1591
- if (command === "review" && positionals.length === 0) {
1605
+ if (command === "review") {
1606
+ // The review only reads: a task key here once moved the task, so it says where that went.
1607
+ const words = positionals.join(" ").trim();
1608
+ if (TASK_KEY.test(words)) {
1609
+ throw new HarborError(
1610
+ `harbor review only reads the review now. To move ${words} to In review, run harbor submit ${words}.`,
1611
+ );
1612
+ }
1613
+ if (values.confirm || values["over-limit"]) {
1614
+ throw new HarborError("--confirm and --over-limit are for moving a task: harbor submit TASK.");
1615
+ }
1592
1616
  if (values.mine && values.owner) throw new HarborError("Say --mine or --owner, not both.");
1593
1617
  return call(
1594
1618
  "program_review",
@@ -1598,15 +1622,14 @@ export async function run(argv, io = {}) {
1598
1622
  portfolio: values.portfolio,
1599
1623
  includeDone: Boolean(values.done),
1600
1624
  },
1601
- reviewList,
1602
- );
1603
- }
1604
- if (values.mine || values.done || values.owner || values.portfolio) {
1605
- throw new HarborError(
1606
- "--mine, --owner, --portfolio and --done are for the review: harbor review on its own.",
1625
+ (r) =>
1626
+ words && r.programs.length === 0
1627
+ ? `No program in the review matches "${words}".`
1628
+ : reviewList(r),
1629
+ (r) => (words ? { ...r, programs: r.programs.filter((p) => nameHas(p.name, words)) } : r),
1607
1630
  );
1608
1631
  }
1609
- const status = { start: "doing", review: "review", done: "done" }[command];
1632
+ const status = { start: "doing", submit: "review", done: "done" }[command];
1610
1633
  return call(
1611
1634
  "update_task",
1612
1635
  {
@@ -2005,7 +2028,8 @@ export async function run(argv, io = {}) {
2005
2028
  ([k, v]) => !["harbor", "item"].includes(k) && v !== undefined,
2006
2029
  );
2007
2030
  if (!changes.length) {
2008
- return call("get_raid", { harbor, item }, (r) => raidDetail(r.item));
2031
+ // --json gives the item itself, as harbor show does a task.
2032
+ return call("get_raid", { harbor, item }, raidDetail, (r) => r.item ?? r);
2009
2033
  }
2010
2034
  return call("update_raid", args, (r) => `Updated.\n\n${raidDetail(r.updated)}`);
2011
2035
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.44.0",
3
+ "version": "0.45.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",