@creator-notes/cnotes 0.117.1 → 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/commands/draft.js
CHANGED
|
@@ -726,6 +726,63 @@ Sending it back as a verdict stays with the person, in the browser.
|
|
|
726
726
|
handleError(error, cfg.json);
|
|
727
727
|
}
|
|
728
728
|
});
|
|
729
|
+
draft
|
|
730
|
+
.command("prepare")
|
|
731
|
+
.description("Prepare the answer to a proposal asked of your person, for them to give: accept or send it back, with why")
|
|
732
|
+
.argument("[draft]", "Proposal handle (PROPOSAL-n, as operations begin lists it) or id")
|
|
733
|
+
.option("--accept", "Recommend accepting it")
|
|
734
|
+
.option("--send-back", "Recommend sending it back")
|
|
735
|
+
.requiredOption("--note <text>", "Why, in one line the person reads before deciding")
|
|
736
|
+
.addHelpText("after", `
|
|
737
|
+
For another agent of the person a proposal in place was asked of, under its
|
|
738
|
+
own key. The person reads your recommendation on the review in the browser or
|
|
739
|
+
on the phone and gives the answer with one tap; nothing lands until they do.
|
|
740
|
+
Then stop: preparing is your whole part.
|
|
741
|
+
|
|
742
|
+
The key that built the proposal (opened it, wrote into it, or asked for it)
|
|
743
|
+
cannot prepare its answer (403, exit 7). Two agents on one login key count as
|
|
744
|
+
one agent, so give each its own key: cnotes auth keys create --name "<agent>".
|
|
745
|
+
A proposal with no record of which key built it is left to the person.
|
|
746
|
+
|
|
747
|
+
An accept is refused while a check blocks it; prepare a send-back instead,
|
|
748
|
+
saying what should change. Any later write into the proposal clears what you
|
|
749
|
+
prepared, so prepare after the last change you reviewed.
|
|
750
|
+
|
|
751
|
+
--json: { prepared, verdict }.
|
|
752
|
+
|
|
753
|
+
Examples:
|
|
754
|
+
$ cnotes draft prepare PROPOSAL-7 --accept --note "Matches DECISION-1 and the checks pass"
|
|
755
|
+
$ cnotes draft prepare PROPOSAL-7 --send-back --note "It drops the monthly option DECISION-1 keeps"
|
|
756
|
+
`)
|
|
757
|
+
.action(async (ref, opts) => {
|
|
758
|
+
const cfg = resolveBaseConfig(program.opts());
|
|
759
|
+
const api = new ApiClient(cfg.serverUrl, cfg.token, cfg.workspaceId);
|
|
760
|
+
try {
|
|
761
|
+
if (Boolean(opts.accept) === Boolean(opts.sendBack)) {
|
|
762
|
+
throw new ValidationError("Choose one: --accept or --send-back");
|
|
763
|
+
}
|
|
764
|
+
const inPlaceId = await inPlaceTarget(api, ref, cfg);
|
|
765
|
+
if (!inPlaceId) {
|
|
766
|
+
throw new ValidationError("Only a proposal in place can be prepared. Name it by its handle: cnotes draft prepare PROPOSAL-n.");
|
|
767
|
+
}
|
|
768
|
+
const verdict = opts.accept ? "accept" : "send_back";
|
|
769
|
+
const result = await api.post(`/api/proposals/${inPlaceId}`, {
|
|
770
|
+
action: "prepare",
|
|
771
|
+
verdict,
|
|
772
|
+
note: opts.note,
|
|
773
|
+
});
|
|
774
|
+
if (cfg.quiet)
|
|
775
|
+
console.log(inPlaceId);
|
|
776
|
+
else if (cfg.json)
|
|
777
|
+
outputJson(result);
|
|
778
|
+
else {
|
|
779
|
+
console.log(`Prepared: ${verdict === "accept" ? "accept" : "send it back"}. The person reads it on the review and gives the answer; your part is done, so stop here.`);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
catch (error) {
|
|
783
|
+
handleError(error, cfg.json);
|
|
784
|
+
}
|
|
785
|
+
});
|
|
729
786
|
draft
|
|
730
787
|
.command("propose")
|
|
731
788
|
.description("Propose a new text for a SHARED note from inside the draft; the note changes only when a person approves the draft")
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ApiError } from "./errors.js";
|
|
2
2
|
import { liveWorkspaceId } from "./config.js";
|
|
3
3
|
import { proposalHandle } from "./draft-ref.js";
|
|
4
|
+
/** One line for a prepared answer: who recommends what, and why. */
|
|
5
|
+
export function preparedLine(p) {
|
|
6
|
+
return `Prepared by ${p.byKeyName}: ${p.verdict === "accept" ? "accept it" : "send it back"}. ${p.note}`;
|
|
7
|
+
}
|
|
4
8
|
const PROPOSAL_ID = /^[a-z0-9]{32}$/;
|
|
5
9
|
/** Whether a 404 means "not a proposal in place" rather than a real failure. */
|
|
6
10
|
export function isNotFound(error) {
|
|
@@ -59,6 +63,12 @@ export function inPlaceStatusLines(s) {
|
|
|
59
63
|
else {
|
|
60
64
|
out.push(s.decision.line);
|
|
61
65
|
}
|
|
66
|
+
if (s.prepared) {
|
|
67
|
+
out.push(`${preparedLine(s.prepared)} The person gives the answer.`);
|
|
68
|
+
}
|
|
69
|
+
else if (p.isReviewer && p.isOwner && p.status === "open" && p.message) {
|
|
70
|
+
out.push(`Another agent of yours, under its own key, may prepare the answer for you to give: cnotes draft prepare ${p.displayId} --accept|--send-back --note "<why>".`);
|
|
71
|
+
}
|
|
62
72
|
if (p.intent)
|
|
63
73
|
out.push(`Why: ${p.intent}`);
|
|
64
74
|
if (p.message) {
|
|
@@ -20,6 +20,9 @@ export function renderProposalsForCaller(result) {
|
|
|
20
20
|
const parts = [`${p.displayId} "${p.name}"`, `built by ${p.builtBy}`];
|
|
21
21
|
if (p.sentBack)
|
|
22
22
|
parts.push("sent back");
|
|
23
|
+
if (p.prepared) {
|
|
24
|
+
parts.push(`${p.prepared.byKeyName} prepared: ${p.prepared.verdict === "accept" ? "accept" : "send back"}`);
|
|
25
|
+
}
|
|
23
26
|
if (p.overlaps.length > 0)
|
|
24
27
|
parts.push(overlapText(p.overlaps));
|
|
25
28
|
lines.push(` ${parts.join(" · ")}`);
|
package/package.json
CHANGED
|
@@ -243,6 +243,29 @@ As the builder, a status line reading "Merged runs 2 and 4 of 4. Runs 1 and 3
|
|
|
243
243
|
are still proposed." means the rest is yours again: fix it and ask, or
|
|
244
244
|
dismiss it.
|
|
245
245
|
|
|
246
|
+
### Preparing the answer for your own person
|
|
247
|
+
|
|
248
|
+
When another agent of the same person built a proposal in place and asked
|
|
249
|
+
that person, you cannot accept it: no key of theirs lands their own agents'
|
|
250
|
+
work. You can prepare the answer they give. `operations begin` lists it under
|
|
251
|
+
waiting on you, with "built by you via Codex (Slack)". Read it with `cnotes
|
|
252
|
+
draft status PROPOSAL-n` and its rewordings, check it against what it rewords,
|
|
253
|
+
then:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
cnotes draft prepare PROPOSAL-n --accept --note "<why it should land>"
|
|
257
|
+
cnotes draft prepare PROPOSAL-n --send-back --note "<what should change>"
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The person reads "<your key's name> recommends landing it" with your line on
|
|
261
|
+
the review, in the browser or on the phone, and gives the answer with one
|
|
262
|
+
tap. Then stop. You need your own key (`cnotes auth keys create --name
|
|
263
|
+
"<agent>"`): the key that opened, wrote into or asked for the proposal is
|
|
264
|
+
refused, and two agents on one login key count as one. An accept is refused
|
|
265
|
+
while a check blocks; prepare a send-back that says what to fix. A later write
|
|
266
|
+
into the proposal clears what you prepared, and `operations begin` says
|
|
267
|
+
"<agent> prepared: accept" so a second reviewer does not start again.
|
|
268
|
+
|
|
246
269
|
## What to rely on
|
|
247
270
|
- **One line says who it waits on.** `draft status`, `draft checkout` and
|
|
248
271
|
`workspace current` print it: nobody asked yet, the changes a person asked
|