@harborppm/cli 0.117.0 → 0.118.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/dist/app.mjs +763 -187
- package/dist/words.mjs +19 -9
- package/lib/cli.mjs +367 -120
- package/lib/format.mjs +59 -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:");
|