slicekit 0.0.0-stage → 0.1.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.
Files changed (170) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +253 -2
  3. package/bin/slicekit.js +4 -0
  4. package/package.json +23 -4
  5. package/src/adapters/githost/errors.js +17 -0
  6. package/src/adapters/githost/fixture.js +136 -0
  7. package/src/adapters/githost/gh-json.js +99 -0
  8. package/src/adapters/githost/github.js +127 -0
  9. package/src/adapters/githost/index.js +12 -0
  10. package/src/adapters/tracker/errors.js +53 -0
  11. package/src/adapters/tracker/fixture.js +71 -0
  12. package/src/adapters/tracker/github-issues.js +65 -0
  13. package/src/adapters/tracker/index.js +14 -0
  14. package/src/baseline.js +109 -0
  15. package/src/build/commit.js +201 -0
  16. package/src/build/decline.js +81 -0
  17. package/src/build/finish.js +155 -0
  18. package/src/build/order.js +158 -0
  19. package/src/build/overlap.js +173 -0
  20. package/src/build/parallel.js +50 -0
  21. package/src/build/pr.js +263 -0
  22. package/src/build/record.js +28 -0
  23. package/src/build/red.js +207 -0
  24. package/src/build/review.js +123 -0
  25. package/src/build/sync.js +47 -0
  26. package/src/build/verdict.js +410 -0
  27. package/src/build/worktree.js +169 -0
  28. package/src/check/ci-event.js +52 -0
  29. package/src/check/context.js +129 -0
  30. package/src/check/index.js +140 -0
  31. package/src/check/rules/.gitkeep +0 -0
  32. package/src/check/rules/ci-body.js +22 -0
  33. package/src/check/rules/ci-title.js +43 -0
  34. package/src/check/rules/citations.js +224 -0
  35. package/src/check/rules/commands.js +146 -0
  36. package/src/check/rules/coverage.js +248 -0
  37. package/src/check/rules/hooks.js +58 -0
  38. package/src/check/rules/journal.js +17 -0
  39. package/src/check/rules/layout.js +56 -0
  40. package/src/check/rules/managed.js +31 -0
  41. package/src/check/rules/queue.js +106 -0
  42. package/src/check/rules/references.js +249 -0
  43. package/src/check/rules/style.js +177 -0
  44. package/src/check/rules/trailer.js +67 -0
  45. package/src/cli/baseline.js +66 -0
  46. package/src/cli/branch.js +86 -0
  47. package/src/cli/build.js +239 -0
  48. package/src/cli/check.js +40 -0
  49. package/src/cli/decide.js +59 -0
  50. package/src/cli/gaps.js +73 -0
  51. package/src/cli/hook.js +28 -0
  52. package/src/cli/index.js +83 -0
  53. package/src/cli/init.js +96 -0
  54. package/src/cli/instructions.js +63 -0
  55. package/src/cli/intake.js +107 -0
  56. package/src/cli/journal.js +82 -0
  57. package/src/cli/plan.js +29 -0
  58. package/src/cli/pr.js +83 -0
  59. package/src/cli/process.js +59 -0
  60. package/src/cli/ready-label.js +119 -0
  61. package/src/cli/review.js +64 -0
  62. package/src/cli/spec.js +31 -0
  63. package/src/cli/stage.js +37 -0
  64. package/src/cli/state.js +106 -0
  65. package/src/cli/status.js +108 -0
  66. package/src/cli/update.js +62 -0
  67. package/src/cli/workflow.js +48 -0
  68. package/src/config.js +203 -0
  69. package/src/decisions.js +289 -0
  70. package/src/evidence.js +27 -0
  71. package/src/fs.js +38 -0
  72. package/src/gaps.js +271 -0
  73. package/src/git.js +209 -0
  74. package/src/githooks.js +37 -0
  75. package/src/hook-cli.js +63 -0
  76. package/src/hooks/io.js +205 -0
  77. package/src/hooks/paths.js +82 -0
  78. package/src/hooks/pre-bash.js +715 -0
  79. package/src/hooks/pre-compact.js +139 -0
  80. package/src/hooks/pre-edit.js +170 -0
  81. package/src/hooks/session-end.js +118 -0
  82. package/src/hooks/session-start.js +209 -0
  83. package/src/hooks/shapes.js +103 -0
  84. package/src/hooks/stop.js +37 -0
  85. package/src/hooks/subagent-marker.js +88 -0
  86. package/src/hooks/subagent-start.js +100 -0
  87. package/src/hooks/subagent-stop.js +106 -0
  88. package/src/ids.js +43 -0
  89. package/src/init.js +276 -0
  90. package/src/instructions.js +235 -0
  91. package/src/intake.js +409 -0
  92. package/src/journal.js +326 -0
  93. package/src/lock.js +35 -0
  94. package/src/markdown.js +155 -0
  95. package/src/paths.js +33 -0
  96. package/src/plan.js +25 -0
  97. package/src/pr.js +73 -0
  98. package/src/prbody.js +266 -0
  99. package/src/ready-label.js +107 -0
  100. package/src/redact.js +33 -0
  101. package/src/render/compare.js +23 -0
  102. package/src/render/entry.js +101 -0
  103. package/src/render/index.js +27 -0
  104. package/src/render/managed.js +128 -0
  105. package/src/render/manifest.js +24 -0
  106. package/src/render/settings.js +76 -0
  107. package/src/render/update.js +151 -0
  108. package/src/slicefile.js +173 -0
  109. package/src/spec-verify.js +58 -0
  110. package/src/stage.js +325 -0
  111. package/src/state/build.js +156 -0
  112. package/src/state/covers.js +58 -0
  113. package/src/state/index.js +191 -0
  114. package/src/state/sync.js +64 -0
  115. package/src/state/transitions.js +282 -0
  116. package/src/verdict.js +203 -0
  117. package/src/which.js +37 -0
  118. package/src/workflow.js +177 -0
  119. package/src/worktrees.js +68 -0
  120. package/templates/claude-code/agents/auditor.md +7 -0
  121. package/templates/claude-code/agents/designer.md +7 -0
  122. package/templates/claude-code/agents/developer.md +7 -0
  123. package/templates/claude-code/agents/fixer.md +7 -0
  124. package/templates/claude-code/agents/ops.md +7 -0
  125. package/templates/claude-code/agents/reviewer.md +7 -0
  126. package/templates/claude-code/commands/slicekit-audit.md +7 -0
  127. package/templates/claude-code/commands/slicekit-build.md +7 -0
  128. package/templates/claude-code/commands/slicekit-gaps.md +6 -0
  129. package/templates/claude-code/commands/slicekit-intake.md +7 -0
  130. package/templates/claude-code/commands/slicekit-ops.md +7 -0
  131. package/templates/claude-code/commands/slicekit-plan.md +6 -0
  132. package/templates/claude-code/commands/slicekit-release.md +7 -0
  133. package/templates/claude-code/commands/slicekit-review.md +7 -0
  134. package/templates/claude-code/commands/slicekit-specify.md +6 -0
  135. package/templates/claude-code/commands/slicekit.md +7 -0
  136. package/templates/claude-code/hooks.json +90 -0
  137. package/templates/claude-code/manifest.json +171 -0
  138. package/templates/claude-code/skills/slicekit-ids/SKILL.md +16 -0
  139. package/templates/claude-code/skills/slicekit-loop/SKILL.md +23 -0
  140. package/templates/claude-code/skills/slicekit-writing/SKILL.md +24 -0
  141. package/templates/docs/BUILD.md +5 -0
  142. package/templates/docs/decisions.md +15 -0
  143. package/templates/docs/intake/.keep +0 -0
  144. package/templates/docs/observability.md +25 -0
  145. package/templates/docs/phases/.keep +0 -0
  146. package/templates/docs/platform.md +25 -0
  147. package/templates/docs/releases/.keep +0 -0
  148. package/templates/docs/runbook.md +21 -0
  149. package/templates/docs/spec/00-overview.md +8 -0
  150. package/templates/docs/spec/contracts/.keep +0 -0
  151. package/templates/docs/spec/gaps.md +6 -0
  152. package/templates/docs/spec/stack.md +3 -0
  153. package/templates/githooks/pre-commit +59 -0
  154. package/templates/githooks/pre-merge-commit +59 -0
  155. package/templates/githooks/prepare-commit-msg +74 -0
  156. package/templates/instructions/agents/auditor.md +33 -0
  157. package/templates/instructions/agents/designer.md +21 -0
  158. package/templates/instructions/agents/developer.md +49 -0
  159. package/templates/instructions/agents/fixer.md +41 -0
  160. package/templates/instructions/agents/ops.md +21 -0
  161. package/templates/instructions/agents/reviewer.md +63 -0
  162. package/templates/instructions/commands/build.md +234 -0
  163. package/templates/instructions/commands/gaps.md +65 -0
  164. package/templates/instructions/commands/intake.md +90 -0
  165. package/templates/instructions/commands/plan.md +60 -0
  166. package/templates/instructions/commands/review.md +117 -0
  167. package/templates/instructions/commands/specify.md +49 -0
  168. package/templates/style.json +11 -0
  169. package/templates/workflow/pins.json +6 -0
  170. package/templates/workflow/slicekit.yml +110 -0
@@ -0,0 +1,60 @@
1
+ # /slicekit plan
2
+
3
+ Write the stack, the phases and the slice files from the spec, regenerate `BUILD.md`, then open the
4
+ plan pull request (REQ-2.5). Arguments: {{args}}.
5
+
6
+ `<docsRoot>` below is the `docsRoot` in `.slicekit/config.json`. Every step that touches the
7
+ repository's history goes through `{{cli}}`; run no git or gh command yourself.
8
+
9
+ ## Steps
10
+
11
+ 1. Run `{{cli}} branch plan <slug>`. The slug is the program name (`name` in
12
+ `.slicekit/config.json`) lower-cased, with each run of characters other than `a-z0-9` turned
13
+ into one `-`, dashes trimmed from both ends, cut to 60 characters, then dashes trimmed again; it
14
+ is `source` if nothing is left. That is the slug intake and the spec used, so the plan lands on
15
+ the program's branch.
16
+ 2. Run `{{cli}} plan check`. When it exits 1 it prints one blocker per line: a clarification marker
17
+ as `<file>:<line> clarification marker: …`, or the earlier stage that is not done yet, such as
18
+ spec review or the gap scan. Print them and stop: the plan waits for each marker to be resolved
19
+ and for the stage the refusal names. Go on only when it prints `ready to plan`.
20
+ 3. When `<docsRoot>/spec/stack.md` is absent or says nothing yet, take the stack (language, runtime,
21
+ storage, test runner, hosting) from the intake snapshots or `<docsRoot>/decisions.md` when they
22
+ give it. For each choice they leave open, ask the human one question, and record the answer with
23
+ `{{cli}} decide add --type Decision --question "<the question>" --answer "<the answer>"`. Then
24
+ write `stack.md` from those sources only.
25
+ 4. Write one phase per milestone in the intake or the decisions:
26
+ `<docsRoot>/phases/P<n>-<name>/P<n>.md`, with a `# Phase <n> — <name>` heading, the phase's goal
27
+ in a few sentences, and one `**Order:** <step>; <step>; …` line, each step a comma list of the
28
+ parallel groups that run at the same time (D-38). The line names every group of the phase
29
+ exactly once, and no group that no slice has.
30
+ 5. Write the slice files, `<docsRoot>/phases/P<n>-<name>/S-<nn>-<descr>.md`, in the shape of REQ-1.5:
31
+ - front matter with `slice` (`P<n>/S-<nn>`), `name`, `repo`, `group`, `runbook`,
32
+ `requirements` and `decisions`;
33
+ - a `## Done when` list of at most five observable checks;
34
+ - a `## Evaluation set` table with the columns `Test | Kind | Covers`, at least one `happy` and
35
+ one `negative` row, each row naming the REQ it covers;
36
+ - a `## Expected changes` list of the files or packages the slice changes, each in backticks;
37
+ - the runbook flag set to `yes` when the slice touches configuration, infrastructure,
38
+ migrations, alerts, queues or integrations (D-21), else `no`.
39
+
40
+ Every REQ in the spec is named by at least one slice. No two slices of one Order step expect the
41
+ same path, apart from the shared roots: `.`, anything under `test/`, `src/cli/index.js` and
42
+ `<docsRoot>/runbook.md`. When two slices must change one file, put them in groups of different
43
+ steps.
44
+ 6. Run `{{cli}} status --write` to regenerate `BUILD.md`, then run `{{cli}} check` and fix each
45
+ finding it prints, in the plan files only, until it reports `0 findings`. A `coverage` finding is
46
+ a plan defect: a REQ no slice names, a slice with no happy or no negative test, an Order line
47
+ that misses or repeats a group, or two slices of one step expecting one path. Run
48
+ `{{cli}} status --write` again after each change to a slice file.
49
+ 7. Write the pull request body to a file outside the repository, with these three sections:
50
+
51
+ ```
52
+ **Done when:** every REQ named by a slice, each slice with a happy and a negative test, no shared path within an Order step
53
+ **Proof:** <the summary line check printed>
54
+ **Decisions:** <the D rows recorded in step 3, one per line, or "none">
55
+ ```
56
+
57
+ Then run `{{cli}} pr open --title "[plan] <program name>" --body-file <file> --commit "docs(plan): <program name>" --paths <docsRoot>/spec/stack.md,<docsRoot>/phases,<docsRoot>/decisions.md,BUILD.md`,
58
+ with the program name from `.slicekit/config.json`.
59
+ 8. Print the pull request line `pr open` printed, and tell the human that merging the pull request
60
+ approves the plan; `/slicekit build` then takes the first slice.
@@ -0,0 +1,117 @@
1
+ # /slicekit review
2
+
3
+ Give a slice pull request its independent verdict: a reviewer in a fresh worktree of the pull
4
+ request head, a verdict file marked independent, and on blockers a fixer whose commits the command
5
+ pushes to the slice branch (REQ-2.8, D-39). This round does not count against the build's two.
6
+ Arguments: {{args}}.
7
+
8
+ `<docsRoot>` below is the `docsRoot` in `.slicekit/config.json`. Every step that touches the
9
+ repository's history goes through `{{cli}}`; run no git or gh command yourself. Stop at the first
10
+ command that exits non-zero and act on what it prints. A refusal this procedure does not say how to
11
+ fix goes to the human: print it and stop.
12
+
13
+ ## 1. A session with no context from the building session
14
+
15
+ This review runs in a session that holds no context from the session that built the slice (D-18):
16
+ no part of its conversation, its notes file or its developer's reports. The kit cannot check this;
17
+ it is left to the person who started this session. When this session built the slice, or was given
18
+ the building session's context, stop and tell the human to run `/slicekit review <PR>` in a new
19
+ session.
20
+
21
+ When the arguments are `(none)`, ask the human for the pull request's number and use it in place of
22
+ `{{args}}` below. Call that number `<n>`.
23
+
24
+ ## 2. A fresh worktree of the pull request head
25
+
26
+ Run `{{cli}} review start {{args}}`. It prints four lines:
27
+
28
+ - `slice <id>`: the slice the pull request builds.
29
+ - `worktree <wt>`: the review worktree's absolute path. Every later build command in this session
30
+ passes `--worktree <wt>`, since two worktrees now hold the slice.
31
+ - `round <k>`: the round this verdict records.
32
+ - `verdict <path>`: the absolute path, in the session root, where the reviewer writes its verdict.
33
+
34
+ Keep all four. A refusal that the head `is not origin/<branch>` and ends `run the same command again
35
+ in a minute` can be a push the git host has not seen yet: run this step once more after a minute;
36
+ when it refuses again, print it and stop. It also refuses a pull request that is not open, not a
37
+ slice pull request or from a fork, and a review worktree with uncommitted changes: print the
38
+ refusal and stop, since the human decides each of these. A refusal that names
39
+ `build pr <id> --worktree <dir>` means an earlier review session committed a fix it did not push:
40
+ run `{{cli}} build pr <id> --worktree <dir>` with the path it names, then this step again.
41
+
42
+ ## 3. The reviewer gives the independent verdict
43
+
44
+ Run `{{cli}} instructions reviewer <id> --worktree <wt>`. Spawn the reviewer with that output as its
45
+ whole prompt, followed by the pull request number `<n>`, the worktree `<wt>`, the round `<k>` and
46
+ the verdict path `<path>`, all four as step 2 printed them. Give it nothing else. The brief's Where
47
+ section lets it write that one file outside the worktree.
48
+
49
+ ## 4. Record the verdict
50
+
51
+ When the reviewer stops, run `{{cli}} build verdict <id> <path> --independent --worktree <wt>` with
52
+ step 2's verdict path. It commits the verdict into the review worktree, pushes it to the slice
53
+ branch, and prints `next: <step>`, `blockers: <IDs or none>`, `should-haves: <IDs or none>` and
54
+ `rounds: <used> of 2`; the rounds stay as they were. By what it prints:
55
+
56
+ - A refusal that names the verdict's content (a finding with no "How verified", a reused finding
57
+ number, a banned phrase, a `<!--`): send the reviewer back with the printed message, then run this
58
+ command again with the file it writes.
59
+ - A refusal that the branch is behind origin, ending `run slicekit build sync <id>`: the building
60
+ session pushed since step 2. Run `{{cli}} build sync <id> --worktree <wt>`, then this command again.
61
+ - `a new verdict needs a fresh fetch`: origin could not be reached. Print it and stop; tell the
62
+ human to run this command again once origin answers.
63
+ - Any other refusal goes to the human: print it and stop.
64
+
65
+ When the verdict lists should-haves, ask the human once, listing each with its ID and its "What is
66
+ wrong" from the verdict file: decline it or leave it. An independent round offers no fix for a
67
+ should-have. For each one declined, run `{{cli}} build decline <id> <H-n> --worktree <wt>`. It
68
+ prints the issue's URL, followed by `(already filed)` or `(already filed, closed)` when the issue
69
+ was there before, which is success too. Then act on `next:`:
70
+
71
+ - `next: fix`: step 5.
72
+ - `next: ci`: step 6, whatever the should-haves were.
73
+
74
+ ## 5. The fixer answers the blockers
75
+
76
+ Ask the human whether the fixer should answer the blockers in the review worktree. On no, print the
77
+ blockers and stop: the slice stays in review, and the human decides what happens to it.
78
+
79
+ On yes, run `{{cli}} instructions fixer <id> --worktree <wt>`. Spawn the fixer with that output as
80
+ its whole prompt, followed by the verdict file's path in the review worktree,
81
+ `<wt>/.slicekit/reviews/<the verdict file's name>`, and every blocker's ID.
82
+
83
+ When the fixer reports, run these two in this order:
84
+
85
+ 1. `{{cli}} build commit <id> --worktree <wt> --message "fix: <ids>" --require-green`, with the
86
+ answered IDs joined by `, `. A failing test run or a frozen test is refused, and
87
+ `nothing to commit` means the fixer changed nothing: send the fixer back with what was printed.
88
+ 2. `{{cli}} build pr <id> --worktree <wt>`. Without `--notes` it keeps the pull request's live body,
89
+ pushes the fix to the slice branch and returns the pull request to draft. A `verdict` line it
90
+ prints is the building session's next in-loop round: ignore it here. When it refuses with
91
+ `pass --notes <file>`, the body lost a section: print the refusal and stop, since the notes are the
92
+ building session's.
93
+
94
+ Then start again at step 2 with `{{cli}} review start <n>`: the new head needs its own independent
95
+ verdict, at the next round. Tell the human that the slice branch moved under the building session:
96
+ that session syncs its worktree with `build sync <id>` before its next push.
97
+
98
+ ## 6. Green CI, then ready
99
+
100
+ Run `{{cli}} build finish <id> --worktree <wt>`. Each call waits at most 90 seconds for CI on the
101
+ pull request's head. On exit 1, by what it prints:
102
+
103
+ - `CI failed on <sha7>: <url>`: print it and stop; tell the human CI failed on the reviewed head.
104
+ - `CI still running on <sha7>; …`: nothing has changed; run the same command again. When it still
105
+ says so after five tries, print it and stop; tell the human CI has not finished.
106
+ - `no CI run found for <sha7>; check that the workflow ran`: print it and stop.
107
+ - A refusal that ends `run slicekit build sync <id>`, such as the branch behind origin or the head
108
+ not in the worktree: run `{{cli}} build sync <id> --worktree <wt>`, then this command again. When
109
+ it refuses the same way after the sync, print it and stop.
110
+
111
+ On exit 0 it prints `ci-green` and the CI run's URL, then one line:
112
+
113
+ - `ready`: print the pull request's number and URL and the CI run's URL, and stop. Tell the human
114
+ the slice is ready: a human merges, never this session.
115
+ - `ready: not yet: <reason>`: print it and stop; tell the human the reason the slice is not ready.
116
+ - `ready: waiting for an independent review; …`: the verdict recorded in step 4 is not on the live
117
+ head. Print it and stop; tell the human to run `/slicekit review <n>` in a new session.
@@ -0,0 +1,49 @@
1
+ # /slicekit specify
2
+
3
+ Write the spec from the intake snapshots and the decisions, one capability per file, with a contract
4
+ for each interface named at intake, then open the spec pull request (REQ-2.3, D-07). Arguments:
5
+ {{args}}.
6
+
7
+ `<docsRoot>` below is the `docsRoot` in `.slicekit/config.json`. Every step that touches the
8
+ repository's history goes through `{{cli}}`; run no git or gh command yourself.
9
+
10
+ ## Steps
11
+
12
+ 1. Run `{{cli}} branch spec <slug>`. The slug is the program name (`name` in
13
+ `.slicekit/config.json`) lower-cased, with each run of characters other than `a-z0-9` turned
14
+ into one `-`, dashes trimmed from both ends, cut to 60 characters. That is the slug intake used,
15
+ so the spec lands on the branch that holds the intake snapshot.
16
+ 2. Run `{{cli}} stage require clarify`. On exit 1, print what it says and stop: the spec waits for
17
+ intake and clarify.
18
+ 3. Read every snapshot under `<docsRoot>/intake/` and every row of `<docsRoot>/decisions.md`. These
19
+ are the only sources a requirement may stand on.
20
+ 4. Write `<docsRoot>/spec/<capability>.md`, one capability per file. Each requirement has the shape
21
+ of REQ-1.3:
22
+ - a `## REQ-<n>.<m> <title>` heading;
23
+ - one or more sentences with SHALL;
24
+ - a `Scenario:` line in GIVEN / WHEN / THEN form;
25
+ - a `Cites:` line naming the snapshot (`../intake/<file>`) or the D rows that support it;
26
+ - an `Enforced by:` line naming the test or check that proves it.
27
+
28
+ Where no intake sentence and no decision supports a claim, write
29
+ `[NEEDS CLARIFICATION: <question>]` in its place. Never guess, and never add a requirement the
30
+ sources do not ask for.
31
+ 5. Run `{{cli}} spec verify`. For each interface it lists without a contract, write
32
+ `<docsRoot>/spec/contracts/C-<n>-<name>.md`: the producer, the consumers, a table of the
33
+ operations with their inputs and outputs, and a `Cites:` line naming the interface's D row.
34
+ 6. Run `{{cli}} spec verify` again until it exits 0, fixing each finding it prints. A REQ that cites
35
+ nothing that exists gets a clarification marker, not an invented source. The markers it lists may
36
+ stay: the gaps step and the plan deal with them. Then run `{{cli}} check` and fix each finding
37
+ until it reports 0 blocking.
38
+ 7. Write the pull request body to a file outside the repository, with these three sections:
39
+
40
+ ```
41
+ **Done when:** one spec file per capability, each REQ citing its source, a contract per interface named at intake
42
+ **Proof:** <the first line spec verify printed> · <the summary line check printed>
43
+ **Decisions:** <the D rows the spec cites, one per line, or "none">
44
+ ```
45
+
46
+ Then run `{{cli}} pr open --title "[spec] <program name>" --body-file <file> --commit "docs(spec): <program name>" --paths <docsRoot>/spec,<docsRoot>/decisions.md`,
47
+ with the program name from `.slicekit/config.json`.
48
+ 8. Print the pull request line `pr open` printed, and tell the human that merging the pull request
49
+ approves the spec (D-07). Each clarification marker still in the spec is listed under the line.
@@ -0,0 +1,11 @@
1
+ {
2
+ "banned": [
3
+ "minting at the gate",
4
+ "at the boundary of",
5
+ "it's worth noting",
6
+ "robust",
7
+ "seamlessly",
8
+ "leverage",
9
+ "delve"
10
+ ]
11
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "resolved": "2026-10-25",
3
+ "actions/checkout": { "tag": "v4.2.2", "sha": "11bd71901bbe5b1630ceea73d27597364c9af683" },
4
+ "actions/setup-node": { "tag": "v4.1.0", "sha": "39370e3970a6d050c480ffad4ff0ed4d3fdee5af" },
5
+ "actions/upload-artifact": { "tag": "v4.4.3", "sha": "b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882" }
6
+ }
@@ -0,0 +1,110 @@
1
+ # slicekit: the pull request gate and the state sync (REQ-3.11). Every action is pinned by SHA.
2
+ name: slicekit
3
+
4
+ on:
5
+ pull_request:
6
+ types: [opened, synchronize, reopened, edited]
7
+ push:
8
+ branches: [{{defaultBranchItem}}]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: slicekit-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ defaults:
18
+ run:
19
+ shell: bash
20
+
21
+ jobs:
22
+ gate:
23
+ runs-on: ubuntu-latest
24
+ timeout-minutes: {{timeoutMinutes}}
25
+ steps:
26
+ - uses: actions/checkout@{{checkoutSha}} # {{checkoutTag}}
27
+ with:
28
+ fetch-depth: 0
29
+ persist-credentials: false
30
+ - name: The default branch is present
31
+ run: git rev-parse --verify --quiet refs/remotes/origin/{{defaultBranch}}
32
+ - uses: actions/setup-node@{{setupNodeSha}} # {{setupNodeTag}}
33
+ with:
34
+ node-version: 22
35
+ - name: Install
36
+ if: hashFiles('package-lock.json') != ''
37
+ run: npm ci
38
+ - name: Use the repository's git hooks
39
+ run: git config core.hooksPath .githooks
40
+ {{gateExtraSteps}}
41
+ - name: slicekit check
42
+ run: {{cli}} check --ci
43
+ - name: The workflow matches the generator
44
+ run: {{cli}} workflow --check
45
+ - name: Upload the graph
46
+ if: always() && hashFiles('.slicekit/graph/graph.json') != ''
47
+ uses: actions/upload-artifact@{{uploadArtifactSha}} # {{uploadArtifactTag}}
48
+ with:
49
+ name: slicekit-graph
50
+ path: .slicekit/graph/graph.json
51
+ {{commandJobs}}
52
+ {{observabilityJobs}}
53
+
54
+ ready-label:
55
+ if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
56
+ needs: [{{readyNeeds}}]
57
+ runs-on: ubuntu-latest
58
+ timeout-minutes: 10
59
+ permissions:
60
+ contents: read
61
+ issues: write
62
+ pull-requests: write
63
+ steps:
64
+ - uses: actions/checkout@{{checkoutSha}} # {{checkoutTag}}
65
+ with:
66
+ fetch-depth: 0
67
+ persist-credentials: false
68
+ - uses: actions/setup-node@{{setupNodeSha}} # {{setupNodeTag}}
69
+ with:
70
+ node-version: 22
71
+ - name: Install
72
+ if: hashFiles('package-lock.json') != ''
73
+ run: npm ci
74
+ - name: Ready label
75
+ env:
76
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77
+ SLICEKIT_CHECKS_OK: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'skipped') }}
78
+ run: {{cli}} ready-label
79
+
80
+ sync:
81
+ if: github.event_name == 'push'
82
+ runs-on: ubuntu-latest
83
+ timeout-minutes: 10
84
+ permissions:
85
+ contents: write
86
+ pull-requests: read
87
+ steps:
88
+ - uses: actions/checkout@{{checkoutSha}} # {{checkoutTag}}
89
+ with:
90
+ fetch-depth: 0
91
+ - uses: actions/setup-node@{{setupNodeSha}} # {{setupNodeTag}}
92
+ with:
93
+ node-version: 22
94
+ - name: Install
95
+ if: hashFiles('package-lock.json') != ''
96
+ run: npm ci
97
+ - name: Use the repository's git hooks
98
+ run: git config core.hooksPath .githooks
99
+ - name: Sync state
100
+ env:
101
+ GH_TOKEN: ${{ github.token }}
102
+ run: {{cli}} status --sync --write
103
+ - name: Commit state
104
+ env:
105
+ ALLOW_PROTECTED_COMMIT: '1'
106
+ run: |
107
+ git config user.name 'github-actions[bot]'
108
+ git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
109
+ git add -- {{syncPaths}}
110
+ git diff --cached --quiet || { git commit -m 'chore(slicekit): sync state [skip ci]' && git push; }