@popoverai/dotrequirements 0.33.0 → 0.34.1
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 +2 -2
- package/dist/cli.js +13 -1
- package/dist/cloud.d.ts +5 -1
- package/dist/cloud.js +6 -2
- package/dist/commands/acceptance-test.js +1 -1
- package/dist/commands/board/index.d.ts +13 -0
- package/dist/commands/board/index.js +96 -0
- package/dist/commands/branch-merge.d.ts +78 -0
- package/dist/commands/branch-merge.js +129 -0
- package/dist/commands/diff.js +15 -5
- package/dist/commands/mockup/index.d.ts +11 -0
- package/dist/commands/mockup/index.js +82 -0
- package/dist/commands/scores/index.d.ts +50 -0
- package/dist/commands/scores/index.js +190 -0
- package/dist/commands/solution/ask.d.ts +9 -0
- package/dist/commands/solution/ask.js +27 -0
- package/dist/commands/solution/author.d.ts +19 -0
- package/dist/commands/solution/author.js +202 -0
- package/dist/commands/solution/branch.d.ts +103 -0
- package/dist/commands/solution/branch.js +341 -0
- package/dist/commands/solution/brief.d.ts +81 -0
- package/dist/commands/solution/brief.js +47 -0
- package/dist/commands/solution/checkout.d.ts +27 -0
- package/dist/commands/solution/checkout.js +66 -0
- package/dist/commands/solution/client.d.ts +16 -0
- package/dist/commands/solution/client.js +46 -0
- package/dist/commands/solution/contract.d.ts +9 -0
- package/dist/commands/solution/contract.js +23 -0
- package/dist/commands/solution/create.d.ts +14 -0
- package/dist/commands/solution/create.js +52 -0
- package/dist/commands/solution/demo-script.d.ts +28 -0
- package/dist/commands/solution/demo-script.js +43 -0
- package/dist/commands/solution/image.d.ts +60 -0
- package/dist/commands/solution/image.js +148 -0
- package/dist/commands/solution/index.d.ts +12 -0
- package/dist/commands/solution/index.js +282 -0
- package/dist/commands/solution/look-up.d.ts +9 -0
- package/dist/commands/solution/look-up.js +69 -0
- package/dist/commands/solution/next.d.ts +12 -0
- package/dist/commands/solution/next.js +48 -0
- package/dist/commands/solution/plan-file.d.ts +22 -0
- package/dist/commands/solution/plan-file.js +33 -0
- package/dist/commands/solution/preview-screenshot.d.ts +21 -0
- package/dist/commands/solution/preview-screenshot.js +56 -0
- package/dist/commands/solution/pull-request.d.ts +25 -0
- package/dist/commands/solution/pull-request.js +117 -0
- package/dist/commands/solution/pushing.d.ts +66 -0
- package/dist/commands/solution/pushing.js +185 -0
- package/dist/commands/solution/rehearse.d.ts +10 -0
- package/dist/commands/solution/rehearse.js +24 -0
- package/dist/commands/solution/request.d.ts +3 -0
- package/dist/commands/solution/request.js +13 -0
- package/dist/commands/solution/review.d.ts +27 -0
- package/dist/commands/solution/review.js +104 -0
- package/dist/commands/solution/run-file.d.ts +43 -0
- package/dist/commands/solution/run-file.js +69 -0
- package/dist/commands/solution/share.d.ts +62 -0
- package/dist/commands/solution/share.js +346 -0
- package/dist/commands/solution/stall.d.ts +14 -0
- package/dist/commands/solution/stall.js +41 -0
- package/dist/commands/solution/start.d.ts +14 -0
- package/dist/commands/solution/start.js +31 -0
- package/dist/commands/solution/status.d.ts +39 -0
- package/dist/commands/solution/status.js +145 -0
- package/dist/commands/solution/summary.d.ts +13 -0
- package/dist/commands/solution/summary.js +5 -0
- package/dist/commands/solution/things.d.ts +118 -0
- package/dist/commands/solution/things.js +78 -0
- package/dist/commands/solution/thread.d.ts +13 -0
- package/dist/commands/solution/thread.js +53 -0
- package/dist/commands/solution/upload.d.ts +24 -0
- package/dist/commands/solution/upload.js +27 -0
- package/dist/commands/solution/video.d.ts +88 -0
- package/dist/commands/solution/video.js +364 -0
- package/dist/commands/solution/working-folder.d.ts +44 -0
- package/dist/commands/solution/working-folder.js +64 -0
- package/dist/commands/sync.d.ts +2 -1
- package/dist/commands/sync.js +21 -5
- package/dist/convex.d.ts +54 -0
- package/dist/convex.js +64 -0
- package/dist/push/core.js +7 -2
- package/dist/rehearsal/derive.d.ts +23 -0
- package/dist/rehearsal/derive.js +112 -0
- package/dist/rehearsal/driver.d.ts +44 -0
- package/dist/rehearsal/driver.js +337 -0
- package/dist/rehearsal/earlier.d.ts +25 -0
- package/dist/rehearsal/earlier.js +138 -0
- package/dist/rehearsal/index.d.ts +5 -0
- package/dist/rehearsal/index.js +4 -0
- package/dist/rehearsal/live.d.ts +72 -0
- package/dist/rehearsal/live.js +301 -0
- package/dist/rehearsal/report.d.ts +4 -0
- package/dist/rehearsal/report.js +69 -0
- package/dist/rehearsal/types.d.ts +377 -0
- package/dist/rehearsal/types.js +8 -0
- package/dist/requirements/index.d.ts +6 -0
- package/dist/requirements/index.js +24 -0
- package/dist/schema/browser.d.ts +2 -1
- package/dist/schema/browser.js +6 -1
- package/dist/schema/file-writer.d.ts +5 -0
- package/dist/schema/file-writer.js +4 -0
- package/dist/schema/parser.d.ts +11 -2
- package/dist/schema/parser.js +11 -7
- package/dist/schema/provenance.d.ts +27 -0
- package/dist/schema/provenance.js +66 -0
- package/dist/schema/schemas.d.ts +40 -0
- package/dist/schema/schemas.js +4 -0
- package/dist/sync/execute.d.ts +10 -1
- package/dist/sync/execute.js +68 -5
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/sync/publish.d.ts +7 -0
- package/dist/sync/segment.js +4 -1
- package/dist/sync/snapshot.d.ts +23 -1
- package/dist/sync/snapshot.js +75 -3
- package/dist/sync/solution-documents.d.ts +74 -0
- package/dist/sync/solution-documents.js +135 -0
- package/dist/sync/types.d.ts +20 -0
- package/package.json +3 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dotreq solution rehearse <scenario.yaml>` (REHEARSE-4): run a scenario
|
|
3
|
+
* against the linked project, real parties awaited, and print how it went.
|
|
4
|
+
* The scenario's earlier runs are removed first, unless `--keep` says to
|
|
5
|
+
* leave them for comparing (REHEARSE-6).
|
|
6
|
+
*/
|
|
7
|
+
export declare function rehearseCommand(path: string, options?: {
|
|
8
|
+
keep?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=rehearse.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { checkScenario, rehearse } from "../../rehearsal/driver.js";
|
|
2
|
+
import { removeEarlierRuns } from "../../rehearsal/earlier.js";
|
|
3
|
+
import { liveClient, scenarioFrom } from "../../rehearsal/live.js";
|
|
4
|
+
import { renderReport } from "../../rehearsal/report.js";
|
|
5
|
+
import { solutionClient } from "./client.js";
|
|
6
|
+
/**
|
|
7
|
+
* `dotreq solution rehearse <scenario.yaml>` (REHEARSE-4): run a scenario
|
|
8
|
+
* against the linked project, real parties awaited, and print how it went.
|
|
9
|
+
* The scenario's earlier runs are removed first, unless `--keep` says to
|
|
10
|
+
* leave them for comparing (REHEARSE-6).
|
|
11
|
+
*/
|
|
12
|
+
export async function rehearseCommand(path, options = {}) {
|
|
13
|
+
const client = solutionClient();
|
|
14
|
+
const scenario = await scenarioFrom(path, client);
|
|
15
|
+
checkScenario(scenario);
|
|
16
|
+
const earlier = options.keep
|
|
17
|
+
? { scenario: scenario.file ?? path, removed: 0, keep: true, kept: [] }
|
|
18
|
+
: await removeEarlierRuns(path, client);
|
|
19
|
+
const report = await rehearse(liveClient(), scenario);
|
|
20
|
+
process.stdout.write(renderReport({ ...report, earlier }));
|
|
21
|
+
if (!/^nothing ready$/.test(report.ended))
|
|
22
|
+
process.exitCode = 3;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=rehearse.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
/** A decision request from the JSON file an agent wrote. The backend validates it against the contract. */
|
|
4
|
+
export function readRequest(file) {
|
|
5
|
+
const text = readFileSync(resolve(process.cwd(), file), "utf8");
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(text);
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
throw new Error(`${file} isn't JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type WhereOptions } from "./run-file.js";
|
|
2
|
+
import { type SummaryOptions } from "./summary.js";
|
|
3
|
+
export type ReviewOptions = WhereOptions & SummaryOptions & {
|
|
4
|
+
/** What should change, what was checked, or what the owner is to decide: required for every result (VERB-2.0, 2.1, 2.4). */
|
|
5
|
+
comment?: string;
|
|
6
|
+
/**
|
|
7
|
+
* With an approval of a demo's script: the video recorded from it and
|
|
8
|
+
* the script as the reviewer left it, each `"video:<video> <steps
|
|
9
|
+
* file>"`, given after the result on the command line (SIGHT-13.2).
|
|
10
|
+
*/
|
|
11
|
+
videos?: string[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* `dotreq solution review <result> --comment "..."`: the reviewer's
|
|
15
|
+
* result on the outcome it is reviewing, or on the one `--outcome` names.
|
|
16
|
+
* The comment is what the next reader of the thread sees first — the
|
|
17
|
+
* drafter works from it, and on an escalation it is the note the owner
|
|
18
|
+
* reads — so every result is refused without one before anything is
|
|
19
|
+
* recorded (VERB-2.0, 2.1, 2.4). An approval also carries an executive
|
|
20
|
+
* summary, `--executive-summary "..."`, which is what the owner reads with
|
|
21
|
+
* the work (VERB-2.5); the outcome's own rules decide what follows. An
|
|
22
|
+
* approval of a demo's script carries the video the reviewer recorded from
|
|
23
|
+
* it, `"video:<video> <steps file>"`, which takes the script's place
|
|
24
|
+
* (SIGHT-13.2); no other result carries one (13.4.0).
|
|
25
|
+
*/
|
|
26
|
+
export declare function reviewCommand(result: string, options: ReviewOptions): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { api } from "../../convex.js";
|
|
2
|
+
import { solutionClient } from "./client.js";
|
|
3
|
+
import { pushBeforeRecord } from "./pushing.js";
|
|
4
|
+
import { onOutcome, requireWhere } from "./run-file.js";
|
|
5
|
+
import { summaryGiven } from "./summary.js";
|
|
6
|
+
import { parseThing } from "./things.js";
|
|
7
|
+
import { readRecording, submittedRecording } from "./video.js";
|
|
8
|
+
/** What an agent types, and the result in the words the outcome keeps. */
|
|
9
|
+
const RESULTS = {
|
|
10
|
+
approved: "approved",
|
|
11
|
+
"approved-with-revisions": "approved with revisions",
|
|
12
|
+
"needs-revision": "needs revision",
|
|
13
|
+
escalate: "escalate",
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* `dotreq solution review <result> --comment "..."`: the reviewer's
|
|
17
|
+
* result on the outcome it is reviewing, or on the one `--outcome` names.
|
|
18
|
+
* The comment is what the next reader of the thread sees first — the
|
|
19
|
+
* drafter works from it, and on an escalation it is the note the owner
|
|
20
|
+
* reads — so every result is refused without one before anything is
|
|
21
|
+
* recorded (VERB-2.0, 2.1, 2.4). An approval also carries an executive
|
|
22
|
+
* summary, `--executive-summary "..."`, which is what the owner reads with
|
|
23
|
+
* the work (VERB-2.5); the outcome's own rules decide what follows. An
|
|
24
|
+
* approval of a demo's script carries the video the reviewer recorded from
|
|
25
|
+
* it, `"video:<video> <steps file>"`, which takes the script's place
|
|
26
|
+
* (SIGHT-13.2); no other result carries one (13.4.0).
|
|
27
|
+
*/
|
|
28
|
+
export async function reviewCommand(result, options) {
|
|
29
|
+
const outcome = RESULTS[result];
|
|
30
|
+
if (!outcome) {
|
|
31
|
+
throw new Error(`A review result is approved, approved-with-revisions, needs-revision or escalate, not "${result}".`);
|
|
32
|
+
}
|
|
33
|
+
const comment = options.comment?.trim();
|
|
34
|
+
if (!comment) {
|
|
35
|
+
throw new Error(outcome === "approved"
|
|
36
|
+
? "Say what you checked: your comment is what the next reader sees first."
|
|
37
|
+
: outcome === "escalate"
|
|
38
|
+
? "Say what the owner is to decide: your comment is the note they read with the work."
|
|
39
|
+
: "Say what should change: the drafter works from your comment.");
|
|
40
|
+
}
|
|
41
|
+
// VERB-2.5, 2.5.0: an approval carries an executive summary for the
|
|
42
|
+
// owner, and nothing else does; refused before anything is recorded, in
|
|
43
|
+
// the backend's words.
|
|
44
|
+
const summary = summaryGiven(options);
|
|
45
|
+
const approving = outcome === "approved" || outcome === "approved with revisions";
|
|
46
|
+
if (approving && !summary) {
|
|
47
|
+
throw new Error("Write an executive summary for the owner with --executive-summary: it's what they read first. Say what this is and what most needs their eye, as the work will stand once any fixes you asked for are made.");
|
|
48
|
+
}
|
|
49
|
+
if (!approving && summary) {
|
|
50
|
+
throw new Error(`Only an approval carries an executive summary, so nothing was recorded. Leave --executive-summary off: ${outcome === "escalate" ? "your comment is the note the owner reads." : "the drafter works from your comment."}`);
|
|
51
|
+
}
|
|
52
|
+
// SIGHT-13.2, 13.4.0: a video goes only with a plain approval, and is
|
|
53
|
+
// read before anything is pushed, uploaded or recorded.
|
|
54
|
+
const recordings = readVideos(options.videos ?? []);
|
|
55
|
+
if (recordings.length > 0 && outcome !== "approved") {
|
|
56
|
+
throw new Error(outcome === "approved with revisions"
|
|
57
|
+
? "Nothing was recorded: a demo's script isn't approved with revisions, because its drafter can't change the script without the video going out of step. Fix anything small yourself, record the video, and approve with it, saying in your comment what you changed; or give needs-revision."
|
|
58
|
+
: `Nothing was recorded: only an approval carries a video. Give your result without it: ${outcome === "escalate" ? "your comment is the note the owner reads" : "the drafter works from your comment"}, and no video is kept.`);
|
|
59
|
+
}
|
|
60
|
+
const where = requireWhere(options);
|
|
61
|
+
const { solutionId, agent } = where;
|
|
62
|
+
const client = solutionClient();
|
|
63
|
+
// SOLBRANCH-3.0: what the reviewer committed reaches the branch first.
|
|
64
|
+
await pushBeforeRecord(client, where);
|
|
65
|
+
const videos = [];
|
|
66
|
+
for (const recording of recordings) {
|
|
67
|
+
videos.push(await submittedRecording(client, solutionId, recording));
|
|
68
|
+
}
|
|
69
|
+
const args = {
|
|
70
|
+
solutionId,
|
|
71
|
+
agent,
|
|
72
|
+
...(where.outcome ? { outcome: where.outcome } : {}),
|
|
73
|
+
review: {
|
|
74
|
+
outcome,
|
|
75
|
+
comment,
|
|
76
|
+
...(summary ? { summary } : {}),
|
|
77
|
+
...(videos.length ? { videos } : {}),
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const said = await client.mutation(api.solutions.mutations.complete, args);
|
|
81
|
+
// STEP-REVIEW-18.7.0: the drafter submitted again after this review began.
|
|
82
|
+
// Nothing was recorded; the words say what changed and to give the result
|
|
83
|
+
// again once the reviewer has looked.
|
|
84
|
+
if (said?.refused)
|
|
85
|
+
throw new Error(said.refused);
|
|
86
|
+
console.log(outcome === "escalate"
|
|
87
|
+
? `Escalated${onOutcome(where.outcome)}. It waits on the owner's decision.`
|
|
88
|
+
: `Recorded your review${onOutcome(where.outcome)}: ${outcome}.`);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The videos a review carries (SIGHT-13.2): each recorded from a demo's
|
|
92
|
+
* script, named as the drafter names one, `"video:<video> <steps file>"`.
|
|
93
|
+
* Nothing else goes with a review.
|
|
94
|
+
*/
|
|
95
|
+
function readVideos(references) {
|
|
96
|
+
return references.map((reference) => {
|
|
97
|
+
const thing = parseThing(reference);
|
|
98
|
+
if (thing.kind !== "video") {
|
|
99
|
+
throw new Error(`Nothing was recorded: a review carries no "${reference}". The one thing it carries is the video you recorded from a demo's script, with your approval: "video:<video> <steps file>".`);
|
|
100
|
+
}
|
|
101
|
+
return readRecording(thing.path, thing.scriptPath);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which solution and agent a verb is for (VERB-4). Inside a runner the run
|
|
3
|
+
* itself says — the runner writes a run file and names it in
|
|
4
|
+
* `DOTREQ_RUN_FILE`: `{ solutionId, agent, branch, outcome }` — so an agent
|
|
5
|
+
* types no ids. Outside one, the agent names them with `--solution` and
|
|
6
|
+
* `--agent`, which win wherever they are given. The outcome is the one the
|
|
7
|
+
* run was handed, so a verb records on the outcome the agent is at even
|
|
8
|
+
* when it drafts one outcome and reviews another (VERB-3.4, 6.0);
|
|
9
|
+
* `--outcome` names another. Outside a run, the backend works it out.
|
|
10
|
+
*/
|
|
11
|
+
/** The options every solution verb an agent runs carries. */
|
|
12
|
+
export type WhereOptions = {
|
|
13
|
+
solution?: string;
|
|
14
|
+
agent?: string;
|
|
15
|
+
outcome?: string;
|
|
16
|
+
/** The outcome under its old name: a hidden alias of `--outcome`. */
|
|
17
|
+
step?: string;
|
|
18
|
+
};
|
|
19
|
+
export type Where = {
|
|
20
|
+
solutionId: string;
|
|
21
|
+
/** The agent working: a plan's named agent, or one dedicated to an outcome ("Pitch/drafter"). */
|
|
22
|
+
agent: string;
|
|
23
|
+
/** The outcome the agent named, or the one its run was handed; otherwise the backend's to work out. */
|
|
24
|
+
outcome?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The solution's branch, which the runner has checked out (SOLBRANCH-1):
|
|
27
|
+
* only a run says it, and a verb that has it pushes to it before its
|
|
28
|
+
* record is kept (SOLBRANCH-3). Absent outside a runner, where a person
|
|
29
|
+
* pushes their own branches.
|
|
30
|
+
*/
|
|
31
|
+
branch?: string;
|
|
32
|
+
};
|
|
33
|
+
/** The run's own, with anything the agent named winning over it. */
|
|
34
|
+
export declare function whereOf(options: WhereOptions): Partial<Where>;
|
|
35
|
+
/** For a verb an agent runs: both the solution and the agent, or a refusal saying how to give them. */
|
|
36
|
+
export declare function requireWhere(options: WhereOptions): Where;
|
|
37
|
+
/** For a verb that needs only the solution, as `checkout`: the solution, or a refusal saying how to give it. */
|
|
38
|
+
export declare function requireSolution(options: WhereOptions): Partial<Where> & {
|
|
39
|
+
solutionId: string;
|
|
40
|
+
};
|
|
41
|
+
/** `"Pitch"` when the outcome is known, for what a verb prints; empty when it isn't. */
|
|
42
|
+
export declare function onOutcome(outcome: string | undefined): string;
|
|
43
|
+
//# sourceMappingURL=run-file.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
const SAY_BOTH = 'Nothing says which solution and which agent this is for. Name them: --solution <id> --agent "<agent>". Inside a runner they come from the run itself.';
|
|
3
|
+
const SAY_SOLUTION = "Nothing says which solution this is for. Name it: --solution <id>. Inside a runner it comes from the run itself.";
|
|
4
|
+
/** What the runner wrote for this run, or nothing when there is no run file to read. */
|
|
5
|
+
function fromRun() {
|
|
6
|
+
const path = process.env.DOTREQ_RUN_FILE;
|
|
7
|
+
if (!path)
|
|
8
|
+
return {};
|
|
9
|
+
let parsed;
|
|
10
|
+
try {
|
|
11
|
+
parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// A run file that cannot be read is no worse than none: the options,
|
|
15
|
+
// or the refusal, decide.
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
if (!parsed || typeof parsed !== "object")
|
|
19
|
+
return {};
|
|
20
|
+
const { solutionId, agent, branch, outcome } = parsed;
|
|
21
|
+
return {
|
|
22
|
+
solutionId: typeof solutionId === "string" ? solutionId : undefined,
|
|
23
|
+
agent: typeof agent === "string" && agent ? agent : undefined,
|
|
24
|
+
branch: typeof branch === "string" && branch ? branch : undefined,
|
|
25
|
+
outcome: typeof outcome === "string" && outcome ? outcome : undefined,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** The outcome named, by `--outcome` or its old name `--step`; blank is none. */
|
|
29
|
+
function outcomeNamed(options) {
|
|
30
|
+
return (options.outcome ?? options.step)?.trim() || undefined;
|
|
31
|
+
}
|
|
32
|
+
/** The run's own, with anything the agent named winning over it. */
|
|
33
|
+
export function whereOf(options) {
|
|
34
|
+
const run = fromRun();
|
|
35
|
+
const agent = options.agent?.trim() || run.agent;
|
|
36
|
+
// The run's outcome is its own agent's on its own solution: naming
|
|
37
|
+
// another is working outside the run.
|
|
38
|
+
const inTheRun = (options.solution === undefined || options.solution === run.solutionId) &&
|
|
39
|
+
agent === run.agent;
|
|
40
|
+
return {
|
|
41
|
+
solutionId: options.solution ?? run.solutionId,
|
|
42
|
+
agent,
|
|
43
|
+
outcome: outcomeNamed(options) ?? (inTheRun ? run.outcome : undefined),
|
|
44
|
+
// The run's branch is the run's solution's: naming another solution
|
|
45
|
+
// is working outside the run.
|
|
46
|
+
branch: options.solution === undefined || options.solution === run.solutionId
|
|
47
|
+
? run.branch
|
|
48
|
+
: undefined,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** For a verb an agent runs: both the solution and the agent, or a refusal saying how to give them. */
|
|
52
|
+
export function requireWhere(options) {
|
|
53
|
+
const where = whereOf(options);
|
|
54
|
+
if (!where.solutionId || !where.agent)
|
|
55
|
+
throw new Error(SAY_BOTH);
|
|
56
|
+
return { ...where, solutionId: where.solutionId, agent: where.agent };
|
|
57
|
+
}
|
|
58
|
+
/** For a verb that needs only the solution, as `checkout`: the solution, or a refusal saying how to give it. */
|
|
59
|
+
export function requireSolution(options) {
|
|
60
|
+
const where = whereOf(options);
|
|
61
|
+
if (!where.solutionId)
|
|
62
|
+
throw new Error(SAY_SOLUTION);
|
|
63
|
+
return { ...where, solutionId: where.solutionId };
|
|
64
|
+
}
|
|
65
|
+
/** `"Pitch"` when the outcome is known, for what a verb prints; empty when it isn't. */
|
|
66
|
+
export function onOutcome(outcome) {
|
|
67
|
+
return outcome ? ` on "${outcome}"` : "";
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=run-file.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The verbs as the share command runs them, with no install: a developer
|
|
3
|
+
* who ran `npx` has no `dotreq` on their path.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SHARE_CLI = "npx @popoverai/dotrequirements@latest solution";
|
|
6
|
+
type RecordedFile = {
|
|
7
|
+
documentId: string;
|
|
8
|
+
path: string;
|
|
9
|
+
version: number;
|
|
10
|
+
onBranch: boolean;
|
|
11
|
+
hash: string;
|
|
12
|
+
};
|
|
13
|
+
/** What a checkout leaves in the repository, for push and done to act on. */
|
|
14
|
+
export type ShareRecord = {
|
|
15
|
+
token: string;
|
|
16
|
+
/** The outcome checked out: one someone outside the product creates. */
|
|
17
|
+
outcome: string;
|
|
18
|
+
round: number | null;
|
|
19
|
+
solution: {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
directory: string;
|
|
23
|
+
};
|
|
24
|
+
files: RecordedFile[];
|
|
25
|
+
};
|
|
26
|
+
/** Every solution checked out into this repository, by its folder. */
|
|
27
|
+
export declare function checkedOut(): ShareRecord[];
|
|
28
|
+
/**
|
|
29
|
+
* `dotreq solution checkout --share <token> --outcome "<name>"`
|
|
30
|
+
* (SOLSHARE-2): every document of the project into `.requirements/`, the
|
|
31
|
+
* solution's branch's versions where it has them, each at the file this
|
|
32
|
+
* repository already has for it or where the project's sync would put it;
|
|
33
|
+
* the solution's mockups as pages to open; the record push and done act
|
|
34
|
+
* on; and the outcome's prompt, printed for whoever or whatever reads the
|
|
35
|
+
* output.
|
|
36
|
+
*/
|
|
37
|
+
export declare function shareCheckout(token: string,
|
|
38
|
+
/** The outcome handed over: one someone outside the product creates. */
|
|
39
|
+
outcome: string | undefined,
|
|
40
|
+
/** SOLSHARE-2.10: the branch's version replaces an edit it has a newer version than. */
|
|
41
|
+
branchWins?: boolean): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* `dotreq solution push`, in a repository a solution was checked out into
|
|
44
|
+
* (SOLSHARE-3): each document changed since the checkout, and each one
|
|
45
|
+
* added under `.requirements/`, to the solution's branch. False when no
|
|
46
|
+
* solution is checked out here, for the runner's push to take over.
|
|
47
|
+
*/
|
|
48
|
+
export declare function sharePush(solution?: string,
|
|
49
|
+
/** SOLSHARE-3.8: the repository's version wins over a newer one on the branch. */
|
|
50
|
+
repoWins?: boolean): Promise<boolean>;
|
|
51
|
+
export type DoneOptions = {
|
|
52
|
+
comment?: string;
|
|
53
|
+
solution?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* `dotreq solution done [<where it is>...] [--comment "..."]` (SOLSHARE-4):
|
|
57
|
+
* close the round of the outcome the repository was checked out for, with
|
|
58
|
+
* nothing to paste.
|
|
59
|
+
*/
|
|
60
|
+
export declare function doneCommand(made: string[], options: DoneOptions): Promise<void>;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=share.d.ts.map
|