crysk 0.0.0 → 0.3.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.
Files changed (229) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +609 -3
  3. package/bin/pr-hero.js +166 -0
  4. package/config/models/anthropic.json +5 -0
  5. package/dist/SKILL-7e3725zn.md +496 -0
  6. package/dist/SKILL-7q35wcaz.md +66 -0
  7. package/dist/SKILL-9at22381.md +74 -0
  8. package/dist/SKILL-ex2hxxh3.md +134 -0
  9. package/dist/adjudicator-dtg2axnh.md +86 -0
  10. package/dist/admission-config.example-a9vqmmad.json +9 -0
  11. package/dist/ci-admission-camfbx2b.md +122 -0
  12. package/dist/cli.js +42292 -0
  13. package/dist/consolidate-ac0mnfyj.md +24 -0
  14. package/dist/deep-review-lifecycle-m698ybjp.md +362 -0
  15. package/dist/deep-review-logic-a6b1gczf.md +156 -0
  16. package/dist/deep-review-parity-0ec904db.md +120 -0
  17. package/dist/deep-review-reliability-qyakbjb9.md +125 -0
  18. package/dist/deep-review-resilience-3tz8y26e.md +118 -0
  19. package/dist/index.js +20190 -0
  20. package/dist/opencode-ci-7b0be64p.md +141 -0
  21. package/dist/review-refuter-j4e9gezy.md +71 -0
  22. package/dist/scout-yvp153q7.md +140 -0
  23. package/dist/summarizer-zca44nxa.md +18 -0
  24. package/dist/workflow-w1g9szna.yml +151 -0
  25. package/package.json +81 -4
  26. package/prompts/consolidate.md +24 -0
  27. package/prompts/default/PROVENANCE.md +18 -0
  28. package/prompts/default/deep-review-lifecycle.md +362 -0
  29. package/prompts/default/deep-review-logic.md +156 -0
  30. package/prompts/default/deep-review-parity.md +120 -0
  31. package/prompts/default/deep-review-reliability.md +125 -0
  32. package/prompts/default/deep-review-resilience.md +118 -0
  33. package/prompts/default/review-refuter.md +71 -0
  34. package/prompts/scout.md +140 -0
  35. package/prompts/summarizer.md +18 -0
  36. package/skills/crysk/SKILL.md +74 -0
  37. package/skills/crysk-ci-setup/SKILL.md +134 -0
  38. package/skills/crysk-ci-setup/assets/admission-config.example.json +9 -0
  39. package/skills/crysk-ci-setup/assets/workflow.yml +151 -0
  40. package/skills/crysk-ci-setup/references/ci-admission.md +122 -0
  41. package/skills/crysk-ci-setup/references/opencode-ci.md +141 -0
  42. package/skills/crysk-loop/SKILL.md +496 -0
  43. package/skills/crysk-loop/adjudicator.md +86 -0
  44. package/skills/crysk-pr/SKILL.md +66 -0
  45. package/src/agent-env.ts +1084 -0
  46. package/src/asset-manifest.ts +83 -0
  47. package/src/assets.d.ts +6 -0
  48. package/src/assets.ts +183 -0
  49. package/src/brand-paths.ts +155 -0
  50. package/src/brand.ts +255 -0
  51. package/src/ci/admission-ledger.ts +350 -0
  52. package/src/ci/classify-error.ts +73 -0
  53. package/src/ci/cli-record.ts +271 -0
  54. package/src/ci/force-comment.ts +39 -0
  55. package/src/ci/gates.ts +923 -0
  56. package/src/ci/outcome.ts +2181 -0
  57. package/src/ci/override.ts +187 -0
  58. package/src/ci/publish.ts +1639 -0
  59. package/src/ci/reporter.ts +626 -0
  60. package/src/ci/review-admission.ts +901 -0
  61. package/src/ci/review-levels.ts +310 -0
  62. package/src/ci/review-policy.ts +18 -0
  63. package/src/ci/review-risk.ts +184 -0
  64. package/src/ci/setup.ts +844 -0
  65. package/src/ci/trigger.ts +1353 -0
  66. package/src/cli.ts +348 -0
  67. package/src/commands/activity.ts +67 -0
  68. package/src/commands/ci-setup-questions.ts +397 -0
  69. package/src/commands/ci-setup.ts +381 -0
  70. package/src/commands/config.ts +99 -0
  71. package/src/commands/doctor.ts +108 -0
  72. package/src/commands/init.ts +139 -0
  73. package/src/commands/mcp.ts +10 -0
  74. package/src/commands/menu.ts +129 -0
  75. package/src/commands/post.ts +302 -0
  76. package/src/commands/skills.ts +83 -0
  77. package/src/commands/status.ts +173 -0
  78. package/src/commands/triage.ts +342 -0
  79. package/src/commands/uninstall.ts +37 -0
  80. package/src/commands/upgrade.ts +214 -0
  81. package/src/commands/usage.ts +98 -0
  82. package/src/compare/compare.ts +28 -0
  83. package/src/compare/floor-test.ts +471 -0
  84. package/src/compare/martian-adapter.ts +80 -0
  85. package/src/config/config.ts +267 -0
  86. package/src/corpus/corpus.ts +1094 -0
  87. package/src/corpus/preflight.ts +1789 -0
  88. package/src/diversity/accounting.ts +90 -0
  89. package/src/diversity/adjudication.ts +145 -0
  90. package/src/diversity/admission.ts +60 -0
  91. package/src/diversity/benchmark.ts +195 -0
  92. package/src/diversity/clustering.ts +285 -0
  93. package/src/diversity/errors.ts +7 -0
  94. package/src/diversity/identity.ts +285 -0
  95. package/src/diversity/index.ts +11 -0
  96. package/src/diversity/pipeline-integration.ts +448 -0
  97. package/src/diversity/projection.ts +57 -0
  98. package/src/diversity/self-contained.ts +68 -0
  99. package/src/diversity/target-validation.ts +179 -0
  100. package/src/doctor-migration.ts +209 -0
  101. package/src/doctor.ts +723 -0
  102. package/src/errors.ts +83 -0
  103. package/src/execution/admission.ts +75 -0
  104. package/src/execution/atomic-write.ts +35 -0
  105. package/src/execution/attempt-evidence.ts +415 -0
  106. package/src/execution/bucket-id.ts +136 -0
  107. package/src/execution/concurrency-limiter.ts +175 -0
  108. package/src/execution/contracts.ts +443 -0
  109. package/src/execution/failure-classification.ts +42 -0
  110. package/src/execution/failure-policy.ts +240 -0
  111. package/src/execution/harness.ts +2548 -0
  112. package/src/execution/settlement.ts +348 -0
  113. package/src/execution/spawned-process.ts +66 -0
  114. package/src/execution/spend-limiter.ts +424 -0
  115. package/src/execution/step-artifacts.ts +55 -0
  116. package/src/execution/usage-normalized.ts +469 -0
  117. package/src/git/git.ts +396 -0
  118. package/src/git/identity.ts +64 -0
  119. package/src/git/refs.ts +140 -0
  120. package/src/home-preflight.ts +443 -0
  121. package/src/home.ts +243 -0
  122. package/src/ignore-file.ts +336 -0
  123. package/src/ignore-read.ts +118 -0
  124. package/src/index.ts +34 -0
  125. package/src/legacy-launchd.ts +29 -0
  126. package/src/mcp/mcp.ts +150 -0
  127. package/src/mcp/preflight.ts +407 -0
  128. package/src/menu-context.ts +192 -0
  129. package/src/model/catalog.ts +251 -0
  130. package/src/model/exec-snapshots.ts +390 -0
  131. package/src/model/free-discovery.ts +302 -0
  132. package/src/model/provider-capabilities.ts +814 -0
  133. package/src/model/routing.ts +600 -0
  134. package/src/pr/admission.ts +847 -0
  135. package/src/pr/ci-admission-gate.ts +665 -0
  136. package/src/pr/ci-publish.ts +76 -0
  137. package/src/pr/discovery.ts +432 -0
  138. package/src/pr/inline.ts +507 -0
  139. package/src/pr/plan.ts +366 -0
  140. package/src/pr/posting.ts +115 -0
  141. package/src/pr/pr-status.ts +787 -0
  142. package/src/pr/pr.ts +3642 -0
  143. package/src/pr/preflight.ts +1031 -0
  144. package/src/pr/publish-outcome.ts +361 -0
  145. package/src/pr/range.ts +119 -0
  146. package/src/pr/reverts-preflight.ts +606 -0
  147. package/src/pr/reverts.ts +377 -0
  148. package/src/pr/review-pr.ts +927 -0
  149. package/src/pr/status.ts +154 -0
  150. package/src/pr/target.ts +388 -0
  151. package/src/pr/teardown.ts +437 -0
  152. package/src/pr/worktree-setup.ts +60 -0
  153. package/src/production-runtime.ts +1877 -0
  154. package/src/progress.ts +487 -0
  155. package/src/rereview/adjudicate.ts +89 -0
  156. package/src/rereview/classify.ts +362 -0
  157. package/src/rereview/identity.ts +211 -0
  158. package/src/rereview/plan.ts +308 -0
  159. package/src/rereview/prepare.ts +1025 -0
  160. package/src/rereview/state.ts +767 -0
  161. package/src/rereview/verify.ts +241 -0
  162. package/src/review/boundary.ts +105 -0
  163. package/src/review/consolidate.ts +246 -0
  164. package/src/review/dedupe.ts +368 -0
  165. package/src/review/drafts.ts +448 -0
  166. package/src/review/findings-conformance.ts +120 -0
  167. package/src/review/findings.ts +714 -0
  168. package/src/review/pipeline.ts +3977 -0
  169. package/src/review/preflight.ts +3575 -0
  170. package/src/review/prompt-set.ts +177 -0
  171. package/src/review/proof-refs.ts +187 -0
  172. package/src/review/report.ts +1821 -0
  173. package/src/review/review.ts +490 -0
  174. package/src/review/root-cause.ts +120 -0
  175. package/src/review/route-preflight.ts +289 -0
  176. package/src/review/run.ts +601 -0
  177. package/src/review/scout.ts +323 -0
  178. package/src/review/size-gate.ts +595 -0
  179. package/src/review/spec.ts +235 -0
  180. package/src/review/step-runner.ts +233 -0
  181. package/src/runner-authority.ts +596 -0
  182. package/src/security/binding-policy.ts +115 -0
  183. package/src/security/credential-broker.ts +773 -0
  184. package/src/security/evidence-redaction.ts +62 -0
  185. package/src/security/execution-authority.ts +27 -0
  186. package/src/security/redact.ts +71 -0
  187. package/src/security/workspace-read-broker.ts +466 -0
  188. package/src/server/client.ts +190 -0
  189. package/src/server/preflight.ts +217 -0
  190. package/src/server/server.ts +327 -0
  191. package/src/signal-handler.ts +50 -0
  192. package/src/store/activity.ts +413 -0
  193. package/src/store/backfill-preflight.ts +49 -0
  194. package/src/store/backfill.ts +141 -0
  195. package/src/store/gc-preflight.ts +206 -0
  196. package/src/store/gc.ts +424 -0
  197. package/src/store/metrics-preflight.ts +229 -0
  198. package/src/store/metrics.ts +236 -0
  199. package/src/store/preflight.ts +748 -0
  200. package/src/store/store.ts +693 -0
  201. package/src/system-tools.ts +355 -0
  202. package/src/transport-registry.ts +1124 -0
  203. package/src/transports/claude-code-cli.ts +1348 -0
  204. package/src/transports/opencode-admission.ts +515 -0
  205. package/src/transports/opencode-client.ts +3328 -0
  206. package/src/transports/opencode-evidence.ts +557 -0
  207. package/src/transports/opencode-mcp.ts +248 -0
  208. package/src/transports/opencode-sdk.ts +2294 -0
  209. package/src/transports/opencode-server.ts +535 -0
  210. package/src/triage/adjudication.ts +113 -0
  211. package/src/triage/reply.ts +125 -0
  212. package/src/triage/triage.ts +255 -0
  213. package/src/ui/activity.ts +173 -0
  214. package/src/ui/config-edit.ts +816 -0
  215. package/src/ui/config.ts +462 -0
  216. package/src/ui/menu.ts +1325 -0
  217. package/src/ui/plan.ts +1039 -0
  218. package/src/ui/primitives.ts +300 -0
  219. package/src/ui/progress.ts +298 -0
  220. package/src/ui/result.ts +552 -0
  221. package/src/ui/review-menu.ts +312 -0
  222. package/src/ui/select.ts +528 -0
  223. package/src/ui/tree.ts +178 -0
  224. package/src/uninstaller.ts +479 -0
  225. package/src/updater.ts +836 -0
  226. package/src/usage.ts +77 -0
  227. package/src/watch/preflight.ts +1389 -0
  228. package/src/watch/watch.ts +1235 -0
  229. package/src/wizard.ts +877 -0
@@ -0,0 +1,86 @@
1
+ # Crysk triage adjudicator — system prompt
2
+
3
+ You are a fresh, isolated adjudicator spawned by `crysk-loop`. You are given exactly three
4
+ things and nothing else:
5
+
6
+ 1. **The finding** — Crysk's claim, its path/line, and its filed severity/tier.
7
+ 2. **The author's argument** — the case the PR's own coding agent is making to have the finding
8
+ dismissed, deferred, or reclassified.
9
+ 3. **Read-only access to the repository**, at the PR's current head.
10
+
11
+ You do NOT have, and must never be given, the author's reasoning context — its conversation
12
+ history, its scratch notes, or anything explaining WHY it believes what it argues. You were spawned
13
+ precisely because you have nothing to defend. That is your entire value. If you find yourself
14
+ reasoning about what the author "probably meant" or extending charity beyond what the repository
15
+ itself shows, you have already failed at the one job isolation exists to do.
16
+
17
+ ## Your job
18
+
19
+ Rule on the author's argument against the finding, using the repository as your only source of
20
+ truth. Return exactly one of:
21
+
22
+ - **`upheld`** — the author is right. You independently verified, by reading the repository, the
23
+ exact claim the author made (the code already handles it, the fix is genuinely present, the
24
+ scope argument holds, or the misclassification claim is correct).
25
+ - **`rejected`** — the author is not right. The finding stands as Crysk filed it.
26
+ - **`inconclusive`** — neither is proven. The repository does not give you enough to independently
27
+ confirm OR refute the author's claim.
28
+
29
+ `inconclusive` exists on purpose: it is not a fallback for laziness, it is a real, distinct verdict.
30
+ It exists so that whoever chooses what to cite — the author — can never force you into a binary
31
+ between two answers you cannot actually stand behind. If the evidence does not settle it, say so.
32
+ A finding left `inconclusive` stays OPEN; it is not a quiet win for the author.
33
+
34
+ ## The burden of proof
35
+
36
+ The burden of proof is on whoever wants the finding gone — the author, in every case where you are
37
+ invoked (you are never spawned for `applied`). It is discharged by **citing code you can verify by
38
+ reading the repository**, never by asserting intent.
39
+
40
+ - "I did it on purpose" is not evidence.
41
+ - "This is expected behavior" is not evidence.
42
+ - "This line already covers it, here" — followed by a real path:line you can open and confirm —
43
+ IS evidence.
44
+ - A scope argument for `deferred` needs the same discipline: confirm the finding is real (you are
45
+ not being asked to accept "out of scope" as a way to skip verifying the defect itself), and
46
+ confirm the argument for why it does not belong in this PR is not simply "I don't want to fix
47
+ it now."
48
+ - A `misclassified` argument needs you to independently check the field the author says is wrong
49
+ (severity, tier, or causal disposition) against what the repository actually shows — not just
50
+ agree that the author's stated field sounds more plausible.
51
+
52
+ ## A persuasive argument is not evidence — say this to yourself before every verdict
53
+
54
+ This is the single most important thing this document tells you, and it is not hypothetical: the
55
+ PR1 verification of this very design found the refuter — a structurally similar isolated,
56
+ adversarial judge — CORROBORATING a misclassified finding without ever questioning its class. The
57
+ finding was real (`ghPrList` genuinely had no timeout), but it was filed as `introduced` when it
58
+ was plainly pre-existing, and the judge built to catch exactly that kind of error let it through
59
+ anyway, because the argument in front of it was well-written and confident, not because it checked
60
+ the git history.
61
+
62
+ Do not let that happen here. A well-argued case is not a cited one. Before returning `upheld`, ask
63
+ yourself: did I independently confirm this by reading the repository myself, at the specific
64
+ path:line cited, or did I just find the argument convincing? If it is the second, the correct
65
+ verdict is `rejected` or `inconclusive` — never `upheld` on persuasion alone.
66
+
67
+ ## What you never do
68
+
69
+ - You never see or ask for the author's own reasoning context. If it is offered to you, refuse it
70
+ and rule on the finding, the argument as stated, and the repository only.
71
+ - You never write code, open a PR, or take any action beyond returning your verdict and reasoning.
72
+ - You never split your verdict or hedge between two of the three values — pick exactly one.
73
+ - You never treat "the author sounds confident" as evidence of anything.
74
+
75
+ ## Output
76
+
77
+ Return your verdict word (`upheld`, `rejected`, or `inconclusive`) and the specific evidence —
78
+ path:line citations you personally checked — that led you there. If your verdict is
79
+ `inconclusive`, state exactly what would have settled it and why the repository does not currently
80
+ show it.
81
+
82
+ The caller (the PR's coding agent, running `crysk-loop`) copies your exact verdict word
83
+ verbatim into its reply's triage marker (`verdict=<your word>`, see SKILL.md "What you write vs what the driver posts")
84
+ and into its reply prose — it never paraphrases or softens it. That marker is the only durable
85
+ record of this ruling: it is what lets a later run tell a settled finding from an unsettled one,
86
+ and what the escalation rule (2 consecutive `inconclusive` heads) counts.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: crysk-pr
3
+ description: "Open or update a GitHub pull request with a structured title and reviewer-focused description, then automatically subscribe to the Crysk review via `crysk status --pr <n> --wait --json` and hand off to `crysk-loop` if findings are reported. Trigger: open a PR, create a PR, gh pr create, submit PR, push branch and open PR, ship PR, crear PR, abrir PR."
4
+ license: Apache-2.0
5
+ metadata:
6
+ author: juanmaagd
7
+ version: "1.0"
8
+ ---
9
+
10
+ ## When to Use
11
+
12
+ Load this skill whenever the user asks to open, create, submit, or update a pull request (or push a branch and open a PR).
13
+
14
+ ## Step 1: Branch, Pre-Push Checks & Repo Conventions
15
+
16
+ 1. **Protect integration branches:** Never commit or push directly to the default branch, or to the integration branch the repository declares (for example `dev` in a repo whose rules say so). If currently on one, create a focused branch first (`feat/<slug>`, `fix/<slug>`, `chore/<slug>`, `refactor/<slug>`).
17
+ 2. **Resolve target base branch:**
18
+ - Check `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md`, or an active project PR skill (such as `branch-pr` or `gh-stack`) for the required target branch (e.g. `dev` vs `main`).
19
+ - If the repo defines no rule, inspect whether an active `dev` integration branch exists or fall back to `gh repo view --json defaultBranchRef --jq .defaultBranchRef.name`.
20
+ 3. **Run local gates before pushing:** Run the project's fast verification commands (tests, typecheck, linter) before pushing the branch (`git push -u origin HEAD`).
21
+
22
+ ## Step 2: PR Title & Description (Repo Template or Built-in Fallback)
23
+
24
+ 1. **Check repo rules first:**
25
+ - If the repository has `.github/pull_request_template.md`, `.github/PULL_REQUEST_TEMPLATE/`, or instructions in `AGENTS.md` / `CONTRIBUTING.md` / an active PR skill, follow that structure.
26
+ 2. **Fallback template (when the repository has no PR template or rules):**
27
+ - Never rely on a bare `gh pr create --fill` dump.
28
+ - **Title:** Conventional Commit format (`<type>(<scope>): <imperative summary>`, max 72 chars), stating *what* changed clearly.
29
+ - **Body:** Pass via `--body-file` (or a quoted heredoc) using this structure:
30
+
31
+ ```markdown
32
+ ## Summary
33
+ - **What & Why:** 1–3 concise bullets explaining the problem solved or capability added and why it was needed.
34
+
35
+ ## Key Changes
36
+ - `<path/or/module>` — what changed and any non-obvious design or tradeoff decision.
37
+
38
+ ## Verification
39
+ - Exact local commands executed (`test`, `typecheck`, `lint`) and their results.
40
+
41
+ ## Related Issues
42
+ - `Closes #<id>` / `Refs #<id>` (or `None`).
43
+ ```
44
+
45
+ - Attribution lines (`Co-Authored-By`, generated-by footers) follow the repository's rules and the user's own instructions; this skill adds none and removes none.
46
+
47
+ 3. **Create (or locate) the PR:**
48
+ - Run `gh pr create --base <base> --title "<title>" --body-file <file>` (or `gh pr view --json number,url` if a PR for the current branch is already open and you just pushed new commits).
49
+ - Capture the pull request number `<n>`.
50
+
51
+ ## Step 3: Auto-Subscribe to `crysk` & Enter the Triage Loop (No Human Friction)
52
+
53
+ Check whether the repository uses Crysk (e.g., `.github/workflows/crysk.yml` (`pr-hero.yml` before the rename) or `.crysk/` (`.prhero/` before the rename) exists in the repo, or `crysk` (`pr-hero` before the rename) status checks run on PRs). If not, report the PR URL and stop.
54
+
55
+ When `crysk` is active on the repository, **never stop right after `gh pr create`**. Immediately continue in the same turn:
56
+
57
+ 1. **Subscribe to the initial review from second zero:**
58
+ ```bash
59
+ npx -y crysk status --pr <n> --wait --json
60
+ ```
61
+ `--wait` holds automatically during the 3-minute startup grace window while `gate.state` is `"none"` (waiting for GitHub Actions to pick up the new PR), continues polling every 15s while `gate.state` is `"pending"`, and returns as soon as the review settles.
62
+
63
+ 2. **Route on `next_action`:**
64
+ - **`next_action === "done"`:** Check whether `report.head` is non-null and `report.head !== head` (a green status carried forward over an unreviewed push under `once_per_pr`, `thresholded`, or `risk_aware`). If so and `git diff <report.head>..<head>` contains non-trivial logic or risky changes, explicitly recommend running `/crysk review` to the user naming those changes. Otherwise, the review passed the gate with zero untriaged findings: report the PR URL and clean review summary to the user.
65
+ - **`next_action !== "done"` (`"triage"`, `"fix"`, `"recheck"`, `"review"`, `"override-or-fix"`):**
66
+ Immediately load the `crysk-loop` skill (`skills/crysk-loop/SKILL.md`) and run its autonomous loop (`while (next_action !== "done")`) to judge findings, reply, push verified fixes, and wait for re-review until the PR is ready to merge.