@wrenautomation/aerie 0.4.5 → 0.4.6
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/bin.js +56 -0
- package/dist/bin.js.map +3 -3
- package/dist/cli.js +67 -0
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -18086,6 +18086,62 @@ ${ms.map((m) => ` ${m.id}: ${m.title} (${m.done}/${m.total} done)`).join("\n")}
|
|
|
18086
18086
|
`);
|
|
18087
18087
|
})
|
|
18088
18088
|
);
|
|
18089
|
+
const decisionPlain = (d) => [
|
|
18090
|
+
`#${d.id} ${d.question}${d.answer ? ` \u2192 ${d.answer} (${d.answeredBy})` : ""}`,
|
|
18091
|
+
...d.options.map(
|
|
18092
|
+
(x) => ` ${x.key}: ${x.text}${x.cost ? ` [${x.cost}]` : ""}${x.key === d.recommendation ? " (recommended)" : ""}`
|
|
18093
|
+
),
|
|
18094
|
+
...d.blocks.length ? [` blocks ${d.blocks.join(", ")}`] : [],
|
|
18095
|
+
""
|
|
18096
|
+
].join("\n");
|
|
18097
|
+
program3.command("decisions").description("open decisions; --answered for answered ones").option("--answered", "answered ones").option("--all", "open and answered").option("--json", "JSON out").action(
|
|
18098
|
+
(o) => ctx.withStore(async (a) => {
|
|
18099
|
+
const rows2 = await a.decisions(o.all ? {} : { open: !o.answered });
|
|
18100
|
+
print(o.json ? `${JSON.stringify(rows2)}
|
|
18101
|
+
` : rows2.map(decisionPlain).join("\n"));
|
|
18102
|
+
})
|
|
18103
|
+
);
|
|
18104
|
+
program3.command("ask").argument("<question>").description("ask a person; each blocked task goes to Needs Human Input").option("--option <key=text>", "an option (repeatable)", each).option("--cost <key=cost>", "what an option costs (repeatable)", each).option("--recommend <key>", "the option you recommend").option("--brief <text>", "picked context, 12 lines at most, links not dumps").option("--blocks <ids>", "tasks that wait on the answer", many).option("--area <path>", "area, e.g. dev/wren").option("--due <date>", "answer by (ISO date)").option("--json", "JSON out").action(
|
|
18105
|
+
(question, o) => ctx.withStore(async (a) => {
|
|
18106
|
+
const pair = (s) => {
|
|
18107
|
+
const i = s.indexOf("=");
|
|
18108
|
+
if (i < 1) throw new Error(`"${s}": want key=text`);
|
|
18109
|
+
return [s.slice(0, i).trim(), s.slice(i + 1).trim()];
|
|
18110
|
+
};
|
|
18111
|
+
const costs = new Map((o.cost ?? []).map(pair));
|
|
18112
|
+
const d = await a.ask(
|
|
18113
|
+
{
|
|
18114
|
+
question,
|
|
18115
|
+
options: (o.option ?? []).map(pair).map(([key, text3]) => ({
|
|
18116
|
+
key,
|
|
18117
|
+
text: text3,
|
|
18118
|
+
...costs.has(key) ? { cost: costs.get(key) } : {}
|
|
18119
|
+
})),
|
|
18120
|
+
...o.recommend ? { recommendation: o.recommend } : {},
|
|
18121
|
+
...o.brief ? { brief: o.brief } : {},
|
|
18122
|
+
...o.blocks?.length ? { blocks: o.blocks } : {},
|
|
18123
|
+
...o.area ? { area: o.area } : {},
|
|
18124
|
+
...o.due ? { due: o.due } : {}
|
|
18125
|
+
},
|
|
18126
|
+
ctx.by
|
|
18127
|
+
);
|
|
18128
|
+
for (const b of d.blocks) await after(a, b);
|
|
18129
|
+
print(o.json ? `${JSON.stringify(d)}
|
|
18130
|
+
` : `Asked decision ${d.id}
|
|
18131
|
+
`);
|
|
18132
|
+
})
|
|
18133
|
+
);
|
|
18134
|
+
program3.command("decide").argument("<id>", "decision id").argument("<answer>", "an option key, or your own words").description(
|
|
18135
|
+
"answer a decision; each blocked task goes back to To Do with the answer in its notes"
|
|
18136
|
+
).option("--why <text>", "why, kept with the answer and in the tasks' notes").option("--json", "JSON out").action(
|
|
18137
|
+
(id, answer, o) => ctx.withStore(async (a) => {
|
|
18138
|
+
const d = await a.decide(Number.parseInt(id, 10), answer, ctx.by, o.why);
|
|
18139
|
+
for (const b of d.blocks) await after(a, b);
|
|
18140
|
+
print(o.json ? `${JSON.stringify(d)}
|
|
18141
|
+
` : `Answered decision ${d.id}: ${d.answer}
|
|
18142
|
+
`);
|
|
18143
|
+
})
|
|
18144
|
+
);
|
|
18089
18145
|
const actor2 = program3.command("actor").description("people, agents and runners");
|
|
18090
18146
|
actor2.command("list").option("--json", "JSON out").action(
|
|
18091
18147
|
(o) => ctx.withStore(async (a) => {
|