@harborppm/cli 0.117.0 → 0.119.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 +3 -0
- package/dist/app.mjs +1280 -226
- package/dist/words.mjs +19 -9
- package/lib/cli.mjs +410 -120
- package/lib/format.mjs +91 -0
- package/package.json +1 -1
package/lib/format.mjs
CHANGED
|
@@ -1099,6 +1099,52 @@ export function agentWorkText(r) {
|
|
|
1099
1099
|
return lines.join("\n");
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
|
+
/** agents_overview: the Agents page as text, what needs you first. */
|
|
1103
|
+
export function agentsText(r) {
|
|
1104
|
+
if (!r.agents?.length) return r.note;
|
|
1105
|
+
const c = r.counts;
|
|
1106
|
+
const lines = [
|
|
1107
|
+
`Agents: ${c.needsYou} for you to check, ${c.working} in play, ${c.doneToday} approved today`,
|
|
1108
|
+
];
|
|
1109
|
+
const one = (t, when) => {
|
|
1110
|
+
const where = [t.agent, t.project].filter(Boolean).join(", ");
|
|
1111
|
+
lines.push(
|
|
1112
|
+
`${t.key ?? t.id} ${t.title} (${where}${t.late ? ", late" : ""}${when ? `, ${when}` : ""})`,
|
|
1113
|
+
);
|
|
1114
|
+
};
|
|
1115
|
+
const said = (body) => {
|
|
1116
|
+
const text = (body ?? "").replace(/\s+/g, " ").trim();
|
|
1117
|
+
if (text) lines.push(` ${text.length > 140 ? `${text.slice(0, 139)}…` : text}`);
|
|
1118
|
+
};
|
|
1119
|
+
const section = (title, rows, each) => {
|
|
1120
|
+
if (!rows?.length) return;
|
|
1121
|
+
lines.push("", title);
|
|
1122
|
+
for (const t of rows) each(t);
|
|
1123
|
+
};
|
|
1124
|
+
section("For you to check", r.needsYou, (t) => {
|
|
1125
|
+
one(t);
|
|
1126
|
+
said(t.agentNote?.body);
|
|
1127
|
+
});
|
|
1128
|
+
section("With someone else", r.withOthers, (t) =>
|
|
1129
|
+
one(t, t.waitingOn ? `with ${t.waitingOn}` : ""),
|
|
1130
|
+
);
|
|
1131
|
+
section("In play", r.working, (t) => {
|
|
1132
|
+
one(t);
|
|
1133
|
+
said(t.agentNote?.body);
|
|
1134
|
+
});
|
|
1135
|
+
section("Sent back, not picked up", r.sentBack, (t) => {
|
|
1136
|
+
one(t);
|
|
1137
|
+
if (t.note) lines.push(` ${t.by ?? "Someone"}: ${t.note}`);
|
|
1138
|
+
});
|
|
1139
|
+
section("Approved today", r.doneToday, (t) => one(t, t.by ? `by ${t.by}` : ""));
|
|
1140
|
+
if (r.needsYou?.length)
|
|
1141
|
+
lines.push(
|
|
1142
|
+
"",
|
|
1143
|
+
'harbor approve TASK approves one; harbor approve TASK --changes "NOTE" sends it back.',
|
|
1144
|
+
);
|
|
1145
|
+
return lines.join("\n");
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1102
1148
|
/** CSV text as rows of cells: quoted cells may hold commas, quotes ("") and line breaks. */
|
|
1103
1149
|
export function csvRows(text) {
|
|
1104
1150
|
const rows = [];
|
|
@@ -1363,6 +1409,19 @@ export function catchupText(r) {
|
|
|
1363
1409
|
if (r.lookFirst.length) {
|
|
1364
1410
|
out.push("", "Look at first:");
|
|
1365
1411
|
for (const l of r.lookFirst) out.push(` ${l.text}`);
|
|
1412
|
+
const m = r.lookFirstMore ?? {};
|
|
1413
|
+
const bits = [
|
|
1414
|
+
m.late ? [m.late, "late"] : null,
|
|
1415
|
+
m.due ? [m.due, "due soon"] : null,
|
|
1416
|
+
m.handed ? [m.handed, "handed to you"] : null,
|
|
1417
|
+
].filter(Boolean);
|
|
1418
|
+
const n = bits.reduce((sum, [k]) => sum + k, 0);
|
|
1419
|
+
if (n)
|
|
1420
|
+
out.push(
|
|
1421
|
+
bits.length === 1
|
|
1422
|
+
? ` …and ${n} more ${bits[0][1]}; harbor mine lists them.`
|
|
1423
|
+
: ` …and ${n} more (${bits.map(([k, w]) => `${k} ${w}`).join(", ")}); harbor mine lists them.`,
|
|
1424
|
+
);
|
|
1366
1425
|
}
|
|
1367
1426
|
if (r.decisions.length) {
|
|
1368
1427
|
out.push("", "Decided without you:");
|
|
@@ -1738,6 +1797,38 @@ export function saltsText(r) {
|
|
|
1738
1797
|
return lines.join("\n");
|
|
1739
1798
|
}
|
|
1740
1799
|
|
|
1800
|
+
/**
|
|
1801
|
+
* harbor wbs: the work breakdown, one numbered line per program, project,
|
|
1802
|
+
* task and subtask, indented by level, with owner, dates and progress.
|
|
1803
|
+
*/
|
|
1804
|
+
export function wbsText(r) {
|
|
1805
|
+
const head = `${r.of.name}: work breakdown · ${r.done} of ${r.tasks} task${r.tasks === 1 ? "" : "s"} done${r.late ? ` · ${r.late} late` : ""}`;
|
|
1806
|
+
if (!r.lines.length) return `${head}\n\nNothing under it yet.`;
|
|
1807
|
+
const width = Math.max(...r.lines.map((l) => l.wbs.length + (l.level - 1) * 2));
|
|
1808
|
+
const out = [head, ""];
|
|
1809
|
+
for (const l of r.lines) {
|
|
1810
|
+
const lead = `${" ".repeat(l.level - 1)}${l.wbs}`.padEnd(width);
|
|
1811
|
+
const dates =
|
|
1812
|
+
l.start && l.end && l.start !== l.end
|
|
1813
|
+
? `${l.start} to ${l.end}`
|
|
1814
|
+
: l.end && !l.subtasks
|
|
1815
|
+
? `due ${l.end}`
|
|
1816
|
+
: l.end || (l.start ? `from ${l.start}` : null);
|
|
1817
|
+
const bits = [
|
|
1818
|
+
l.kind === "task" || l.kind === "subtask"
|
|
1819
|
+
? `${STATUS[l.status] ?? l.status}${l.subtasks ? `, ${l.done}/${l.subtasks} subtasks done` : ""}`
|
|
1820
|
+
: `${l.percent}% (${l.done}/${l.tasks})`,
|
|
1821
|
+
l.owner || null,
|
|
1822
|
+
dates,
|
|
1823
|
+
l.late ? `${l.late} late` : null,
|
|
1824
|
+
l.runsPastEnd ? "runs past its end" : null,
|
|
1825
|
+
].filter(Boolean);
|
|
1826
|
+
out.push(` ${lead} ${l.name}${l.key ? ` ${l.key}` : ""} (${bits.join(" · ")})`);
|
|
1827
|
+
}
|
|
1828
|
+
if (r.more) out.push("", "More lines: --offset to page, or --depth to stay higher up.");
|
|
1829
|
+
return out.join("\n");
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1741
1832
|
/** What harbor salts --risk, --task or --put-away did. */
|
|
1742
1833
|
export function heedSaltText(r) {
|
|
1743
1834
|
if (r.putAway)
|