architecture-harness 0.21.2 → 0.22.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/package.json +8 -3
- package/src/cli/check.mjs +61 -0
- package/src/cli/child-run.mjs +39 -0
- package/src/cli/child-run.test.mjs +16 -0
- package/src/cli/ci-template.test.mjs +28 -0
- package/src/cli/codex-implement.mjs +72 -3
- package/src/cli/codex-implement.test.mjs +141 -4
- package/src/cli/dispatch-guard.mjs +24 -1
- package/src/cli/dispatch-guard.test.mjs +30 -0
- package/src/cli/dispatch-reminder.mjs +4 -4
- package/src/cli/dispatch-reminder.test.mjs +3 -3
- package/src/cli/dispatch-slot.mjs +12 -0
- package/src/cli/gate-slot.mjs +151 -0
- package/src/cli/gate-slot.test.mjs +90 -0
- package/src/cli/integrate.mjs +122 -0
- package/src/cli/integrate.test.mjs +94 -0
- package/src/cli/ledger.mjs +25 -3
- package/src/cli/ledger.test.mjs +9 -0
- package/src/cli/merge-guard.mjs +13 -3
- package/src/cli/merge-guard.test.mjs +24 -1
- package/src/cli/migrations.mjs +127 -0
- package/src/cli/migrations.test.mjs +94 -0
- package/src/cli/plugin-agents.test.mjs +35 -8
- package/src/cli/qc.mjs +44 -0
- package/src/cli/report-stop.mjs +3 -0
- package/src/cli/report-stop.test.mjs +8 -0
- package/src/cli/retry-failed.mjs +80 -0
- package/src/cli/retry-failed.test.mjs +51 -0
- package/src/cli/review-gate.mjs +16 -7
- package/src/cli/slot-guard.mjs +43 -0
- package/src/cli/slot-guard.test.mjs +28 -0
- package/src/cli/task-gate-review.test.mjs +10 -0
- package/src/cli/task-gate.mjs +39 -7
- package/src/cli/task-gate.test.mjs +45 -0
- package/src/cli/throwaway-db.mjs +127 -0
- package/src/cli/throwaway-db.test.mjs +83 -0
- package/src/cli/ui-reuse-hint.mjs +89 -0
- package/src/cli/ui-reuse-hint.test.mjs +60 -0
- package/src/cli/ui.mjs +181 -0
- package/src/cli/ui.test.mjs +137 -0
- package/src/cli/watch.mjs +211 -0
- package/src/cli/watch.test.mjs +246 -0
- package/src/config.mjs +27 -2
- package/src/descriptions.mjs +3 -0
- package/src/gates/contract-keys.mjs +33 -0
- package/src/gates/contract-keys.test.mjs +38 -0
- package/src/gates/migration-numbers.mjs +1 -1
- package/src/gates/migration-numbers.test.mjs +1 -0
- package/src/gates/ui-catalog.mjs +45 -0
- package/src/gates/ui-catalog.test.mjs +48 -0
- package/src/gates/ui-dupes.mjs +36 -0
- package/src/gates/ui-dupes.test.mjs +29 -0
- package/src/ui/catalog.mjs +87 -0
- package/src/ui/catalog.test.mjs +54 -0
- package/src/ui/class-sites.mjs +151 -0
- package/src/ui/class-sites.test.mjs +41 -0
- package/src/ui/codemod.mjs +138 -0
- package/src/ui/codemod.test.mjs +140 -0
- package/src/ui/components.mjs +176 -0
- package/src/ui/components.test.mjs +87 -0
- package/src/ui/dupes.mjs +141 -0
- package/src/ui/dupes.test.mjs +85 -0
- package/src/ui/find.mjs +45 -0
- package/src/ui/find.test.mjs +48 -0
- package/src/ui/options.mjs +40 -0
- package/src/ui/scan.mjs +78 -0
- package/src/ui/typescript.mjs +29 -0
- package/templates/github/workflows/ci.yml +54 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// PreToolUse on a shell command or an edit: a subagent may not touch a slot folder. The hooks and
|
|
3
|
+
// `qc gate-slot` own those files, and a hand edit leaves a slot claimed or frees one still in use.
|
|
4
|
+
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const SLOT_FOLDER = /architecture-kit[\\/]+(?:dispatch|gate-slots)(?:[\\/"'\s]|$)/i;
|
|
8
|
+
const REASON =
|
|
9
|
+
"Slot guard: a subagent may not touch a slot folder. The hooks and `qc gate-slot` own those files. " +
|
|
10
|
+
"Wrap a heavy command in `npx qc gate-slot --`, and ask the controller to free a slot.";
|
|
11
|
+
|
|
12
|
+
const norm = (text) => text.replace(/\\+/g, "/").toLowerCase();
|
|
13
|
+
|
|
14
|
+
/** The text of a call that can name a path: its command, or its file path. */
|
|
15
|
+
const targetOf = (input) => [input?.command, input?.file_path, input?.notebook_path].filter((value) => typeof value === "string").join("\n");
|
|
16
|
+
|
|
17
|
+
/** @returns the hook output that denies the call, or null to let it run */
|
|
18
|
+
export function decide(call, env = process.env) {
|
|
19
|
+
if (call?.hook_event_name !== "PreToolUse") return null;
|
|
20
|
+
if (typeof call.agent_id !== "string" || call.agent_id === "") return null;
|
|
21
|
+
const text = targetOf(call.tool_input);
|
|
22
|
+
const custom = typeof env.QC_GATE_SLOT_DIR === "string" && env.QC_GATE_SLOT_DIR !== "" && norm(text).includes(norm(env.QC_GATE_SLOT_DIR));
|
|
23
|
+
if (!SLOT_FOLDER.test(text) && !custom) return null;
|
|
24
|
+
return { hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", permissionDecisionReason: REASON } };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function readStdin() {
|
|
28
|
+
let data = "";
|
|
29
|
+
for await (const chunk of process.stdin) data += chunk;
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const isEntryPoint = process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1];
|
|
34
|
+
if (isEntryPoint) {
|
|
35
|
+
let call = null;
|
|
36
|
+
try {
|
|
37
|
+
call = JSON.parse(await readStdin());
|
|
38
|
+
} catch {
|
|
39
|
+
// Not hook input, so there is nothing to judge.
|
|
40
|
+
}
|
|
41
|
+
const result = call ? decide(call) : null;
|
|
42
|
+
if (result) process.stdout.write(JSON.stringify(result));
|
|
43
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { strict as assert } from "node:assert";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { test } from "node:test";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { decide } from "./slot-guard.mjs";
|
|
6
|
+
|
|
7
|
+
const HOOKS = fileURLToPath(new URL("../../../../hooks/hooks.json", import.meta.url));
|
|
8
|
+
const call = (tool_name, tool_input, agent_id = "agent-1") => ({ hook_event_name: "PreToolUse", tool_name, tool_input, agent_id });
|
|
9
|
+
const denied = (output) => output?.hookSpecificOutput?.permissionDecision === "deny";
|
|
10
|
+
|
|
11
|
+
test("a subagent may not touch a slot folder, by a command or by an edit", () => {
|
|
12
|
+
assert.ok(denied(decide(call("Bash", { command: "rm -rf /tmp/architecture-kit/gate-slots/slot-0.json" }), {})));
|
|
13
|
+
assert.ok(denied(decide(call("PowerShell", { command: "Remove-Item C:\\Temp\\architecture-kit\\dispatch\\s1 -Recurse" }), {})));
|
|
14
|
+
assert.ok(denied(decide(call("Write", { file_path: "C:/Temp/architecture-kit/gate-slots/slot-1.json" }), {})));
|
|
15
|
+
assert.ok(denied(decide(call("Bash", { command: "rm -rf D:/slots/slot-0.json" }), { QC_GATE_SLOT_DIR: "D:\\slots" })));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("the main session, the gate-slot command, and the kit's own source pass", () => {
|
|
19
|
+
assert.equal(decide(call("Bash", { command: "rm -rf /tmp/architecture-kit/gate-slots" }, ""), {}), null);
|
|
20
|
+
assert.equal(decide(call("Bash", { command: "npx qc gate-slot -- pnpm check:local" }), {}), null);
|
|
21
|
+
assert.equal(decide(call("Edit", { file_path: "C:/GitHub/architecture-kit/packages/qc-harness/src/cli/dispatch-slot.mjs" }), {}), null);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("hooks.json runs the slot guard before a shell command or an edit", () => {
|
|
25
|
+
const { hooks } = JSON.parse(readFileSync(HOOKS, "utf8"));
|
|
26
|
+
const matchers = hooks.PreToolUse.filter((entry) => entry.hooks.some((hook) => hook.command.includes("slot-guard.mjs"))).map((entry) => entry.matcher);
|
|
27
|
+
assert.deepEqual(matchers, ["Bash|PowerShell|Write|Edit|MultiEdit|NotebookEdit"]);
|
|
28
|
+
});
|
|
@@ -223,3 +223,13 @@ test("the dispatch guard refuses a reviewer and claims no slot for it", (t) => {
|
|
|
223
223
|
assert.equal(output.hookSpecificOutput.permissionDecision, "deny");
|
|
224
224
|
assert.match(output.hookSpecificOutput.permissionDecisionReason, /^Task gate:/);
|
|
225
225
|
});
|
|
226
|
+
|
|
227
|
+
test("branch reviews of distinct scopes run on one head, and a second review of one scope needs a Reviewed line", (t) => {
|
|
228
|
+
const ws = workspace(t);
|
|
229
|
+
const head = git(ws.linked, "rev-parse", "HEAD");
|
|
230
|
+
appendRecord(ws.ledger, { type: "verdict", kind: "branch", verdict: "APPROVED", sha: head, branch: "feat/1-x", scope: "photos" });
|
|
231
|
+
assert.equal(judge(ws, BRANCH_REVIEWER, reviewPrompt(ws, "Scope: Inspections")).refusal, null);
|
|
232
|
+
assert.match(judge(ws, BRANCH_REVIEWER, reviewPrompt(ws, "Scope: photos")).refusal ?? "", /scope "photos".*Reviewed: /s);
|
|
233
|
+
assert.match(judge(ws, BRANCH_REVIEWER, reviewPrompt(ws)).refusal ?? "", /Scope: <name>/);
|
|
234
|
+
assert.equal(judge(ws, BRANCH_REVIEWER, reviewPrompt(ws, `Scope: photos\nReviewed: ${head.slice(0, 7)}`)).refusal, null);
|
|
235
|
+
});
|
package/src/cli/task-gate.mjs
CHANGED
|
@@ -10,28 +10,33 @@ import { handoffPathOf, resolveHandoff } from "./handoff-note.mjs";
|
|
|
10
10
|
import { gitOutWithin, linkedWorktrees, pathKey } from "./git-read.mjs";
|
|
11
11
|
import { appendRecord, latestVerdictFor, latestVerdictOn, readLedger, shaMatches } from "./ledger.mjs";
|
|
12
12
|
import { resolveNamedWorktree, workflowOfRepo, worktreeNamed } from "./workflow-place.mjs";
|
|
13
|
-
import { READ_MS, branchOfCheckout, briefCheck, defaultReads, headOf, reviewerCheck, unreadableRefusal } from "./review-gate.mjs";
|
|
13
|
+
import { READ_MS, branchOfCheckout, briefCheck, defaultReads, headOf, reviewerCheck, scopeOf, unreadableRefusal } from "./review-gate.mjs";
|
|
14
14
|
import { rememberSession, workflowAt } from "./workflow-settings.mjs";
|
|
15
15
|
|
|
16
16
|
export { worktreeNamed };
|
|
17
17
|
|
|
18
18
|
const NO_RESUME_LINE = /^[ \t]*NO-RESUME:[ \t]*(\S.*?)[ \t]*$/im;
|
|
19
|
+
const FIX_LINE = /^[ \t]*Fix:[ \t]*(ci|review)[ \t]*$/im;
|
|
19
20
|
const short = (sha) => (typeof sha === "string" ? sha.slice(0, 7) : "(none)");
|
|
20
21
|
|
|
21
22
|
/** The reason on a prompt's `NO-RESUME:` line, or null. */
|
|
22
23
|
export const noResumeReason = (prompt) => NO_RESUME_LINE.exec(prompt)?.[1] ?? null;
|
|
23
24
|
|
|
25
|
+
/** The purpose on a prompt's `Fix:` line, `ci` or `review`, or null. */
|
|
26
|
+
export const fixOf = (prompt) => FIX_LINE.exec(prompt)?.[1]?.toLowerCase() ?? null;
|
|
27
|
+
|
|
24
28
|
const fixRoundRefusal = (branch, sha, type) =>
|
|
25
29
|
`Task gate: the last review on ${branch} (${short(sha)}) is CHANGES_REQUIRED, so the fix goes back to the implementer that wrote it. ` +
|
|
26
30
|
"Resume it with SendMessage and the findings, then have the fix reviewed. " +
|
|
27
|
-
`If a resume cannot work, such as a spent tool-call budget, add a line \`NO-RESUME: <reason>\` to the ${type} prompt; the ledger records the reason
|
|
31
|
+
`If a resume cannot work, such as a spent tool-call budget, add a line \`NO-RESUME: <reason>\` to the ${type} prompt; the ledger records the reason. ` +
|
|
32
|
+
"A fresh agent that fixes the review findings adds a line `Fix: review` instead.";
|
|
28
33
|
|
|
29
34
|
const unreviewedRefusal = (branch, stopHead, head) =>
|
|
30
35
|
`Task gate: an implementer stopped on ${branch} at ${short(stopHead)}, and no review in the ledger names ${short(stopHead)} or a later commit. ` +
|
|
31
36
|
`Dispatch the task reviewer on ${short(head)} first; its first line \`VERDICT: <APPROVED|CHANGES_REQUIRED> <sha>\` records the review. ` +
|
|
32
37
|
`The review runs once CI on the head is green: when CI on ${short(stopHead)} has failed or still runs, the next implementer continues the task and this gate passes it. ` +
|
|
33
38
|
`If that stop handed off, its report named \`HANDOFF: <note path>\`; the same line in the next implementer prompt continues the task. ` +
|
|
34
|
-
`\`qc ledger ${branch}\` lists what is recorded
|
|
39
|
+
`\`qc ledger ${branch}\` lists what is recorded. A CI fix adds a line \`Fix: ci\`, and a review fix adds \`Fix: review\`.`;
|
|
35
40
|
|
|
36
41
|
const HISTORY_LIMIT = 5000;
|
|
37
42
|
// A read is capped, so the whole dispatch guard ends inside the Agent hook's 30 second limit.
|
|
@@ -76,13 +81,31 @@ export function continuedStop(records, branch, handoff) {
|
|
|
76
81
|
return reviewed ? null : stop;
|
|
77
82
|
}
|
|
78
83
|
|
|
84
|
+
/** A CI fix or a review fix may start on a red or unreviewed head; a CI fix on a head whose CI is green is refused. */
|
|
85
|
+
function fixVerdict({ records, branch, head, fix, ciStatus }) {
|
|
86
|
+
if (fix === "ci") {
|
|
87
|
+
const state = ciStatus(head);
|
|
88
|
+
if (state.reason === null) {
|
|
89
|
+
const why = state.unknown === null ? "is green" : `is not known to be red (${state.unknown})`;
|
|
90
|
+
return { refusal: `Task gate: \`Fix: ci\` names a CI fix, and CI on ${short(head)} ${why}. A CI fix needs a red run. Dispatch the reviewer, or drop the line.` };
|
|
91
|
+
}
|
|
92
|
+
return { refusal: null, fix };
|
|
93
|
+
}
|
|
94
|
+
const last = latestVerdictOn(records, branch);
|
|
95
|
+
if (last?.verdict !== "CHANGES_REQUIRED") {
|
|
96
|
+
return { refusal: `Task gate: \`Fix: review\` on ${branch}, where no review in the ledger asks for changes. Drop the line, or dispatch the reviewer first.` };
|
|
97
|
+
}
|
|
98
|
+
return { refusal: null, fix };
|
|
99
|
+
}
|
|
100
|
+
|
|
79
101
|
/**
|
|
80
102
|
* The task gate's answer for an implementer on `branch`: `refusal` is the reason it may not start now, or null.
|
|
81
103
|
* `ciPass` is `{ sha, reason }` when an unreviewed stop head passes because CI on it is not green, else absent.
|
|
82
104
|
* Only implementer commits need a review, so a controller commit after a reviewed head passes. `cwd` is any
|
|
83
105
|
* checkout; `git` reads it, and `ci` answers why CI on a sha is not green, or null.
|
|
84
106
|
*/
|
|
85
|
-
export function gateVerdict({ records, branch, head, reason, type, cwd, git = gitRead, handoff = null, ci = (sha) => ciNotGreen(sha, cwd) }) {
|
|
107
|
+
export function gateVerdict({ records, branch, head, reason, type, cwd, git = gitRead, handoff = null, ci = (sha) => ciNotGreen(sha, cwd), fix = null, ciStatus = (sha) => readCiState(sha, cwd) }) {
|
|
108
|
+
if (fix !== null) return fixVerdict({ records, branch, head, fix, ciStatus });
|
|
86
109
|
// A continuation of the newest stop's hand-off is the same task, so it is neither a fix round nor a new task.
|
|
87
110
|
const continued = continuedStop(records, branch, handoff);
|
|
88
111
|
const why = reason ?? (continued ? `continues the hand-off ${continued.handoff}` : null);
|
|
@@ -180,7 +203,9 @@ export function judgeTask(call, tmp = os.tmpdir(), { ci, ciState, reads = defaul
|
|
|
180
203
|
}
|
|
181
204
|
const checked = reviewerCheck({ type, prompt, review: workflow.review, base: workflow.base, records, root, branch, head, ciState: state, reads });
|
|
182
205
|
if (checked.refusal) return refuse(checked.refusal);
|
|
183
|
-
|
|
206
|
+
const scope = scopeOf(prompt);
|
|
207
|
+
const scoped = scope && workflow.review.reviewerTypes.branch.includes(type) ? { scope } : {};
|
|
208
|
+
return pass(workflow, { ...base, worktree: root, branch, head, ...scoped }, [ledgerNote, checked.note].filter(Boolean).join(" ") || null);
|
|
184
209
|
}
|
|
185
210
|
if (named === null) return pass(workflow, base, briefNote);
|
|
186
211
|
const key = pathKey(abs);
|
|
@@ -198,11 +223,18 @@ export function judgeTask(call, tmp = os.tmpdir(), { ci, ciState, reads = defaul
|
|
|
198
223
|
const reason = noResumeReason(prompt);
|
|
199
224
|
const spelled = handoffPathOf(prompt);
|
|
200
225
|
const handoff = spelled === null ? null : resolveHandoff(spelled, cwd);
|
|
201
|
-
const
|
|
226
|
+
const fix = fixOf(prompt);
|
|
227
|
+
const { refusal, ciPass, note: fixNote } = gateVerdict({
|
|
228
|
+
records, branch: worktree.branch, head: worktree.head, reason, type, cwd: workflow.root, handoff, fix,
|
|
229
|
+
...(ci ? { ci } : {}),
|
|
230
|
+
...(ciState ? { ciStatus: ciState } : {}),
|
|
231
|
+
});
|
|
202
232
|
if (refusal) return refuse(refusal);
|
|
203
233
|
const continues = handoff ? { handoff } : {};
|
|
204
234
|
const unreviewed = ciPass ? { ciPass } : {};
|
|
205
|
-
|
|
235
|
+
const purpose = fix ? { fix } : {};
|
|
236
|
+
const notes = [briefNote, fixNote].filter(Boolean).join(" ") || null;
|
|
237
|
+
return pass(workflow, { ...base, task: true, worktree: worktree.path, branch: worktree.branch, head: worktree.head, resumeReason: reason, ...continues, ...unreviewed, ...purpose }, notes);
|
|
206
238
|
}
|
|
207
239
|
|
|
208
240
|
/** Writes the dispatch record of a judged call. @returns a note for the session, or null. */
|
|
@@ -567,3 +567,48 @@ test("gateVerdict reports the stop and the reason of a CI pass, and gateRefusal
|
|
|
567
567
|
assert.match(gateRefusal({ ...input, ci: () => null }) ?? "", /no review/);
|
|
568
568
|
assert.equal(gateRefusal({ ...input, ci: () => "red" }), null);
|
|
569
569
|
});
|
|
570
|
+
|
|
571
|
+
test("a Fix: ci line passes an unreviewed implementer commit while CI on the head is not green, and records the purpose", (t) => {
|
|
572
|
+
const ws = workspace(t);
|
|
573
|
+
implementerStop(ws, commitIn(ws.linked, "b.txt"));
|
|
574
|
+
const call = dispatch(ws.main, taskPrompt(ws.linked, "Fix: ci"));
|
|
575
|
+
const red = () => ({ reason: "CI on abc1234: unit ended failure", unknown: null });
|
|
576
|
+
const passed = judgeTask(call, ws.tmp, { ci: () => null, ciState: red });
|
|
577
|
+
assert.equal(passed.refusal, null);
|
|
578
|
+
recordDispatch(passed);
|
|
579
|
+
assert.equal(readLedger(ws.ledger).at(-1).fix, "ci");
|
|
580
|
+
const green = () => ({ reason: null, unknown: null });
|
|
581
|
+
assert.match(judgeTask(call, ws.tmp, { ci: () => null, ciState: green }).refusal ?? "", /`Fix: ci`.*green/);
|
|
582
|
+
assert.match(refusalOf(ws) ?? "", /Fix: ci/);
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
test("a Fix: review line passes a fresh implementer after CHANGES_REQUIRED and over an unreviewed fix commit", (t) => {
|
|
586
|
+
const ws = workspace(t);
|
|
587
|
+
const moved = commitIn(ws.linked, "b.txt");
|
|
588
|
+
implementerStop(ws, moved);
|
|
589
|
+
verdict(ws, moved, "CHANGES_REQUIRED", "branch");
|
|
590
|
+
implementerStop(ws, commitIn(ws.linked, "c.txt"));
|
|
591
|
+
assert.notEqual(refusalOf(ws), null);
|
|
592
|
+
assert.equal(refusalOf(ws, "Fix: review"), null);
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
test("a Fix: review line is refused when no verdict on the branch asks for changes", (t) => {
|
|
596
|
+
const ws = workspace(t);
|
|
597
|
+
assert.match(refusalOf(ws, "Fix: review") ?? "", /Fix: review.*no review/s);
|
|
598
|
+
verdict(ws, commitIn(ws.linked, "b.txt"), "APPROVED", "branch");
|
|
599
|
+
assert.match(refusalOf(ws, "Fix: review") ?? "", /Fix: review.*no review/s);
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
test("a Fix: ci line is refused while CI on the head is unknown", (t) => {
|
|
603
|
+
const ws = workspace(t);
|
|
604
|
+
implementerStop(ws, commitIn(ws.linked, "b.txt"));
|
|
605
|
+
const unknown = () => ({ reason: null, unknown: "gh is not signed in" });
|
|
606
|
+
assert.match(judgeTask(dispatch(ws.main, taskPrompt(ws.linked, "Fix: ci")), ws.tmp, { ci: () => null, ciState: unknown }).refusal ?? "", /Fix: ci.*not known to be red/s);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
test("a branch reviewer dispatch records its scope", (t) => {
|
|
610
|
+
const ws = workspace(t);
|
|
611
|
+
const prompt = `Review.\nWorktree: ${ws.linked}\nScope: Photos\n`;
|
|
612
|
+
const task = judgeTask(dispatch(ws.main, prompt, "architecture:sdd-branch-reviewer"), ws.tmp, { ci: () => null, ciState: () => ({ reason: null, unknown: null }) });
|
|
613
|
+
assert.equal(task.record?.scope, "photos");
|
|
614
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// `qc throwaway-db -- <command>`: run a command on a database of its own, in a container on a free port.
|
|
2
|
+
// It never takes a port the local stack owns, and it removes the container once the command exits.
|
|
3
|
+
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { randomBytes } from "node:crypto";
|
|
6
|
+
import net from "node:net";
|
|
7
|
+
import { parseArgs } from "node:util";
|
|
8
|
+
import { merge } from "../config.mjs";
|
|
9
|
+
import { commandLine, runInShell, splitAtDashes } from "./child-run.mjs";
|
|
10
|
+
|
|
11
|
+
export const USAGE = `qc throwaway-db — run a command on a database of its own
|
|
12
|
+
|
|
13
|
+
qc throwaway-db [--port <n>|auto] -- <command...>
|
|
14
|
+
start a postgres container on a free port (auto by default), wait until it is ready, run the
|
|
15
|
+
command with the variables of throwawayDb.env filled in, and remove the container after.
|
|
16
|
+
|
|
17
|
+
qc.config.json "throwawayDb": image, user, database, env (each value may hold {url},
|
|
18
|
+
{host}, {port}, {user}, {password}, {database}), avoidPorts, and readySeconds. The password is random for each run.`;
|
|
19
|
+
|
|
20
|
+
export const throwawayDefaults = {
|
|
21
|
+
image: "postgres:17-alpine",
|
|
22
|
+
user: "postgres",
|
|
23
|
+
database: "app",
|
|
24
|
+
env: { DATABASE_URL: "{url}" },
|
|
25
|
+
avoidPorts: [5432],
|
|
26
|
+
readySeconds: 60,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const HOST = "127.0.0.1";
|
|
30
|
+
const PORT_TRIES = 10;
|
|
31
|
+
|
|
32
|
+
function listenOnZero() {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const server = net.createServer();
|
|
35
|
+
server.unref();
|
|
36
|
+
server.on("error", reject);
|
|
37
|
+
server.listen(0, HOST, () => {
|
|
38
|
+
const { port } = server.address();
|
|
39
|
+
server.close(() => resolve(port));
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A port the OS calls free, never one of `avoid`. */
|
|
45
|
+
export async function freePort(avoid = [], open = listenOnZero) {
|
|
46
|
+
for (let tries = 0; tries < PORT_TRIES; tries += 1) {
|
|
47
|
+
const port = await open();
|
|
48
|
+
if (!avoid.includes(port)) return port;
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`no free port outside ${avoid.join(", ")} after ${PORT_TRIES} tries`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Each variable of the template, with `{name}` replaced by its value; an unknown name stays as written. */
|
|
54
|
+
export function fillEnv(template, values) {
|
|
55
|
+
return Object.fromEntries(
|
|
56
|
+
Object.entries(template).map(([name, value]) => [name, String(value).replace(/\{(\w+)\}/g, (whole, key) => (key in values ? String(values[key]) : whole))]),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The `docker run` arguments: a detached container that removes itself, published on the loopback address only. */
|
|
61
|
+
export function dockerRunArgs(settings, name, port, password) {
|
|
62
|
+
return [
|
|
63
|
+
"run", "--detach", "--rm", "--name", name, "--publish", `${HOST}:${port}:5432`,
|
|
64
|
+
"--env", `POSTGRES_USER=${settings.user}`, "--env", `POSTGRES_PASSWORD=${password}`, "--env", `POSTGRES_DB=${settings.database}`,
|
|
65
|
+
settings.image,
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function dockerSync(args) {
|
|
70
|
+
const result = spawnSync("docker", args, { encoding: "utf8", windowsHide: true });
|
|
71
|
+
return { code: result.status ?? 1, err: (result.stderr ?? "").trim() || (result.error?.message ?? "") };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** `qc throwaway-db`. @returns the command's exit code, 1 when the database did not start, or 2 on a usage error */
|
|
75
|
+
export async function runThrowawayDb(config, argv, deps = {}) {
|
|
76
|
+
const {
|
|
77
|
+
docker = dockerSync,
|
|
78
|
+
run = runInShell,
|
|
79
|
+
open = listenOnZero,
|
|
80
|
+
sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
81
|
+
now = Date.now,
|
|
82
|
+
env = process.env,
|
|
83
|
+
say = (line) => console.error(line),
|
|
84
|
+
name = `qc-throwaway-${randomBytes(4).toString("hex")}`,
|
|
85
|
+
password = randomBytes(16).toString("hex"),
|
|
86
|
+
} = deps;
|
|
87
|
+
const merged = merge(throwawayDefaults, config.throwawayDb ?? {});
|
|
88
|
+
const settings = { ...merged, avoidPorts: [...new Set([5432, ...merged.avoidPorts])] };
|
|
89
|
+
const { flags, command } = splitAtDashes(argv);
|
|
90
|
+
let port;
|
|
91
|
+
try {
|
|
92
|
+
const { values } = parseArgs({ args: flags, options: { port: { type: "string" } }, strict: true });
|
|
93
|
+
if (command.length === 0) throw new Error("name the command after --");
|
|
94
|
+
const asked = values.port ?? "auto";
|
|
95
|
+
if (asked === "auto") port = await freePort(settings.avoidPorts, open);
|
|
96
|
+
else {
|
|
97
|
+
port = Number(asked);
|
|
98
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error(`--port must be auto or a port number, got ${asked}`);
|
|
99
|
+
if (settings.avoidPorts.includes(port)) throw new Error(`port ${port} is in throwawayDb.avoidPorts; use --port auto`);
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
say(`qc throwaway-db: ${error.message}\n\n${USAGE}`);
|
|
103
|
+
return 2;
|
|
104
|
+
}
|
|
105
|
+
say(`qc throwaway-db: starting ${name} on port ${port}`);
|
|
106
|
+
const started = docker(dockerRunArgs(settings, name, port, password));
|
|
107
|
+
if (started.code !== 0) {
|
|
108
|
+
say(`qc throwaway-db: docker run failed: ${started.err}`);
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const deadline = now() + settings.readySeconds * 1000;
|
|
113
|
+
while (docker(["exec", name, "pg_isready", "-h", HOST, "-U", settings.user, "-d", settings.database]).code !== 0) {
|
|
114
|
+
if (now() >= deadline) {
|
|
115
|
+
say(`qc throwaway-db: ${name} was not ready after ${settings.readySeconds} s`);
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
await sleep(1000);
|
|
119
|
+
}
|
|
120
|
+
const url = `postgres://${encodeURIComponent(settings.user)}:${encodeURIComponent(password)}@${HOST}:${port}/${settings.database}`;
|
|
121
|
+
const values = { url, host: HOST, port, user: settings.user, password, database: settings.database };
|
|
122
|
+
return await run(commandLine(command), { ...env, ...fillEnv(settings.env, values) });
|
|
123
|
+
} finally {
|
|
124
|
+
say(`qc throwaway-db: removing ${name}`);
|
|
125
|
+
if (docker(["rm", "--force", name]).code !== 0) say(`qc throwaway-db: remove it by hand: docker rm --force ${name}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { strict as assert } from "node:assert";
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { test } from "node:test";
|
|
4
|
+
import { dockerRunArgs, fillEnv, freePort, runThrowawayDb, throwawayDefaults } from "./throwaway-db.mjs";
|
|
5
|
+
|
|
6
|
+
test("a free port skips each port to avoid", async () => {
|
|
7
|
+
const ports = [5432, 55001];
|
|
8
|
+
assert.equal(await freePort([5432], async () => ports.shift()), 55001);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test("the OS hands out a real free port that is never 5432", async () => {
|
|
12
|
+
const port = await freePort([5432]);
|
|
13
|
+
assert.ok(Number.isInteger(port) && port > 0 && port !== 5432);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("the env template fills the url, the port, and the rest, and keeps a literal", () => {
|
|
17
|
+
const env = fillEnv({ DATABASE_URL: "{url}", PGPORT: "{port}", LIVE: "1" }, { url: "postgres://u:p@127.0.0.1:55001/app", port: 55001 });
|
|
18
|
+
assert.deepEqual(env, { DATABASE_URL: "postgres://u:p@127.0.0.1:55001/app", PGPORT: "55001", LIVE: "1" });
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("the container publishes only on the loopback address", () => {
|
|
22
|
+
const args = dockerRunArgs(throwawayDefaults, "qc-throwaway-1", 55001, generated);
|
|
23
|
+
assert.ok(args.includes("127.0.0.1:55001:5432"));
|
|
24
|
+
assert.equal(args.at(-1), throwawayDefaults.image);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const generated = randomBytes(8).toString("hex");
|
|
28
|
+
|
|
29
|
+
/** A docker that answers each call, and records it. */
|
|
30
|
+
function fakeDocker(calls, { readyAfter = 1, runCode = 0 } = {}) {
|
|
31
|
+
let checks = 0;
|
|
32
|
+
return (args) => {
|
|
33
|
+
calls.push(args.slice(0, 2).join(" "));
|
|
34
|
+
if (args[0] === "run") return { code: runCode, err: runCode === 0 ? "" : "no daemon" };
|
|
35
|
+
if (args[0] === "exec") return { code: (checks += 1) > readyAfter ? 0 : 1, err: "" };
|
|
36
|
+
return { code: 0, err: "" };
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
test("the command runs on its own database on a free port, and the container is removed after it", async () => {
|
|
41
|
+
const calls = [];
|
|
42
|
+
let seen = null;
|
|
43
|
+
const code = await runThrowawayDb({ throwawayDb: { env: { LIVE_DB: "1" } } }, ["--", "pnpm", "vitest", "run", "a.test.ts"], {
|
|
44
|
+
docker: fakeDocker(calls),
|
|
45
|
+
open: async () => 55002,
|
|
46
|
+
sleep: async () => {},
|
|
47
|
+
run: async (command, env) => {
|
|
48
|
+
seen = { command, env };
|
|
49
|
+
return 5;
|
|
50
|
+
},
|
|
51
|
+
env: {},
|
|
52
|
+
say: () => {},
|
|
53
|
+
name: "qc-throwaway-test",
|
|
54
|
+
password: generated,
|
|
55
|
+
});
|
|
56
|
+
assert.equal(code, 5);
|
|
57
|
+
assert.equal(seen.command, "pnpm vitest run a.test.ts");
|
|
58
|
+
assert.equal(seen.env.DATABASE_URL, `postgres://postgres:${encodeURIComponent(generated)}@127.0.0.1:55002/app`);
|
|
59
|
+
assert.equal(seen.env.LIVE_DB, "1");
|
|
60
|
+
assert.deepEqual(calls, ["run --detach", "exec qc-throwaway-test", "exec qc-throwaway-test", "rm --force"]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("an explicit port to avoid is refused, and a docker that cannot start removes nothing", async () => {
|
|
64
|
+
const deps = { docker: fakeDocker([]), open: async () => 55003, sleep: async () => {}, run: async () => 0, env: {}, say: () => {} };
|
|
65
|
+
assert.equal(await runThrowawayDb({}, ["--port", "5432", "--", "x"], deps), 2);
|
|
66
|
+
const calls = [];
|
|
67
|
+
assert.equal(await runThrowawayDb({}, ["--", "x"], { ...deps, docker: fakeDocker(calls, { runCode: 1 }) }), 1);
|
|
68
|
+
assert.deepEqual(calls, ["run --detach"]);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("port 5432 stays avoided when the config lists other ports to avoid", async () => {
|
|
72
|
+
const deps = { docker: fakeDocker([]), open: async () => 55003, sleep: async () => {}, run: async () => 0, env: {}, say: () => {} };
|
|
73
|
+
const config = { throwawayDb: { avoidPorts: [5433] } };
|
|
74
|
+
assert.equal(await runThrowawayDb(config, ["--port", "5432", "--", "x"], deps), 2);
|
|
75
|
+
assert.equal(await runThrowawayDb(config, ["--port", "5433", "--", "x"], deps), 2);
|
|
76
|
+
const opened = [5432, 5433, 55003];
|
|
77
|
+
let next = 0;
|
|
78
|
+
const ports = [];
|
|
79
|
+
const run = async () => 0;
|
|
80
|
+
const docker = (args) => { if (args[0] === "run") ports.push(args[args.indexOf("--publish") + 1]); return { code: 0, err: "" }; };
|
|
81
|
+
await runThrowawayDb(config, ["--", "x"], { ...deps, docker, run, open: async () => opened[next++] });
|
|
82
|
+
assert.deepEqual(ports, ["127.0.0.1:55003:5432"]);
|
|
83
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The PreToolUse trigger that names the components a new component file may duplicate. It runs on a `Write`
|
|
3
|
+
// of a `.tsx` file that does not exist yet and lies under the component roots, ranks the catalog by the
|
|
4
|
+
// words of the file name and the exported names in the content, and adds context. It never blocks.
|
|
5
|
+
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { CONFIG_FILE, load } from "../config.mjs";
|
|
10
|
+
import { findComponents } from "../ui/find.mjs";
|
|
11
|
+
import { componentFileMatcher, uiOptions } from "../ui/options.mjs";
|
|
12
|
+
import { scanComponents } from "../ui/scan.mjs";
|
|
13
|
+
import { checkoutRootOf } from "./checkout-root.mjs";
|
|
14
|
+
|
|
15
|
+
const TOP = 5;
|
|
16
|
+
const EXPORTED = /\bexport\s+(?:default\s+)?(?:async\s+)?(?:function|const|class)\s+([A-Z]\w*)/g;
|
|
17
|
+
const EXPORT_LIST = /\bexport\s*\{([^}]*)\}/g;
|
|
18
|
+
|
|
19
|
+
const context = (text) => ({ hookSpecificOutput: { hookEventName: "PreToolUse", additionalContext: text } });
|
|
20
|
+
|
|
21
|
+
/** The names a new file exports: declared with `export`, or listed in an `export { }`. */
|
|
22
|
+
export function exportedNames(content) {
|
|
23
|
+
const names = [...content.matchAll(EXPORTED)].map((found) => found[1]);
|
|
24
|
+
for (const list of content.matchAll(EXPORT_LIST)) {
|
|
25
|
+
for (const item of list[1].split(",")) {
|
|
26
|
+
const name = item.trim().split(/\s+as\s+/).at(-1);
|
|
27
|
+
if (name && /^[A-Z]\w*$/.test(name)) names.push(name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return [...new Set(names)];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The nearest folder that exists, since a new file may sit in a folder nobody has made yet. */
|
|
34
|
+
function existingAncestor(dir) {
|
|
35
|
+
let here = dir;
|
|
36
|
+
while (!existsSync(here) && path.dirname(here) !== here) here = path.dirname(here);
|
|
37
|
+
return here;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The hook output for one call, or null to let it run with no message. */
|
|
41
|
+
export async function decide(call) {
|
|
42
|
+
const input = call.tool_input ?? {};
|
|
43
|
+
if (call.tool_name !== "Write" || typeof input.file_path !== "string" || !input.file_path.endsWith(".tsx")) return null;
|
|
44
|
+
const file = path.resolve(call.cwd ?? process.cwd(), input.file_path);
|
|
45
|
+
if (existsSync(file)) return null;
|
|
46
|
+
const root = checkoutRootOf(existingAncestor(path.dirname(file)));
|
|
47
|
+
if (!root || !existsSync(path.join(root, CONFIG_FILE))) return null;
|
|
48
|
+
|
|
49
|
+
const rel = path.relative(root, file).split(path.sep).join("/");
|
|
50
|
+
let config;
|
|
51
|
+
try {
|
|
52
|
+
config = load(root);
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
if (!componentFileMatcher(uiOptions(config))(rel)) return null;
|
|
57
|
+
|
|
58
|
+
const words = [path.basename(file, ".tsx"), ...exportedNames(String(input.content ?? ""))];
|
|
59
|
+
let entries;
|
|
60
|
+
try {
|
|
61
|
+
({ entries } = await scanComponents(config));
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const found = findComponents(entries, words, TOP);
|
|
66
|
+
if (found.length === 0) return null;
|
|
67
|
+
const list = found.map(({ entry }) => `${entry.name} (${entry.path})`).join(", ");
|
|
68
|
+
return context(
|
|
69
|
+
`Existing components that may already do this: ${list}. Reuse or extend one; write a new one only when none fits, and say why in its JSDoc.`,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function readStdin() {
|
|
74
|
+
let data = "";
|
|
75
|
+
for await (const chunk of process.stdin) data += chunk;
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const isEntryPoint = process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1];
|
|
80
|
+
if (isEntryPoint) {
|
|
81
|
+
let call = null;
|
|
82
|
+
try {
|
|
83
|
+
call = JSON.parse(await readStdin());
|
|
84
|
+
} catch {
|
|
85
|
+
// Not hook input, so there is nothing to judge.
|
|
86
|
+
}
|
|
87
|
+
const output = call ? await decide(call).catch(() => null) : null;
|
|
88
|
+
if (output) process.stdout.write(JSON.stringify(output));
|
|
89
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { strict as assert } from "node:assert";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { test } from "node:test";
|
|
7
|
+
import { decide, exportedNames } from "./ui-reuse-hint.mjs";
|
|
8
|
+
|
|
9
|
+
const UI = "frontend/src/platform/ui";
|
|
10
|
+
|
|
11
|
+
function project() {
|
|
12
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "qc-hint-"));
|
|
13
|
+
execFileSync("git", ["init", "-q"], { cwd: root });
|
|
14
|
+
writeFileSync(path.join(root, "qc.config.json"), "{}");
|
|
15
|
+
mkdirSync(path.join(root, UI), { recursive: true });
|
|
16
|
+
writeFileSync(path.join(root, UI, "confirm-dialog.tsx"), "/** Asks the user to confirm a destructive action. */\nexport const ConfirmDialog = () => null;\n");
|
|
17
|
+
return root;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const write = (root, rel, content) => ({ tool_name: "Write", cwd: root, tool_input: { file_path: path.join(root, rel), content } });
|
|
21
|
+
|
|
22
|
+
test("a new component file under the roots gets the components that may already do the job", async () => {
|
|
23
|
+
const root = project();
|
|
24
|
+
try {
|
|
25
|
+
const out = await decide(write(root, `${UI}/confirm-modal.tsx`, "export const Modal = () => null;"));
|
|
26
|
+
const text = out.hookSpecificOutput.additionalContext;
|
|
27
|
+
assert.equal(out.hookSpecificOutput.hookEventName, "PreToolUse");
|
|
28
|
+
assert.equal(out.hookSpecificOutput.permissionDecision, undefined);
|
|
29
|
+
assert.match(text, /^Existing components that may already do this: ConfirmDialog \(frontend\/src\/platform\/ui\/confirm-dialog\.tsx\)\./);
|
|
30
|
+
assert.match(text, /Reuse or extend one; write a new one only when none fits, and say why in its JSDoc\.$/);
|
|
31
|
+
} finally {
|
|
32
|
+
rmSync(root, { recursive: true, force: true });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("a file that exists, is outside the roots, is not tsx, or matches nothing gets no message", async () => {
|
|
37
|
+
const root = project();
|
|
38
|
+
try {
|
|
39
|
+
assert.equal(await decide(write(root, `${UI}/confirm-dialog.tsx`, "export const ConfirmDialog = () => null;")), null);
|
|
40
|
+
assert.equal(await decide(write(root, "frontend/src/pages/confirm-page.tsx", "export const ConfirmPage = () => null;")), null);
|
|
41
|
+
assert.equal(await decide(write(root, `${UI}/confirm-thing.ts`, "export const x = 1;")), null);
|
|
42
|
+
assert.equal(await decide(write(root, `${UI}/zebra.tsx`, "export const Zebra = () => null;")), null);
|
|
43
|
+
assert.equal(await decide({ tool_name: "Edit", cwd: root, tool_input: { file_path: path.join(root, `${UI}/new.tsx`) } }), null);
|
|
44
|
+
} finally {
|
|
45
|
+
rmSync(root, { recursive: true, force: true });
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("a repository with no config file gets no message", async () => {
|
|
50
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "qc-hint-"));
|
|
51
|
+
try {
|
|
52
|
+
assert.equal(await decide(write(root, `${UI}/confirm.tsx`, "export const Confirm = () => null;")), null);
|
|
53
|
+
} finally {
|
|
54
|
+
rmSync(root, { recursive: true, force: true });
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("exportedNames reads declared and listed exports", () => {
|
|
59
|
+
assert.deepEqual(exportedNames("export const A = 1;\nexport default function B() {}\nconst c = 1; export { c, C as D };"), ["A", "B", "D"]);
|
|
60
|
+
});
|