@codyswann/lisa 8.5.0 → 8.6.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/all/copy-overwrite/scripts/lib/completion-authorization.mjs +3 -3
- package/all/copy-overwrite/scripts/lib/completion-proof-publisher.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/completion-proof-shape.mjs +21 -1
- package/all/copy-overwrite/scripts/lib/push-timing.mjs +2 -0
- package/all/copy-overwrite/scripts/lisa-gates.mjs +89 -7
- package/all/copy-overwrite/scripts/lisa-run-gates.mjs +54 -6
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +6 -6
- package/dist/cli/gate-report-assemble.d.ts +7 -1
- package/dist/cli/gate-report-assemble.d.ts.map +1 -1
- package/dist/cli/gate-report-assemble.js +16 -1
- package/dist/cli/gate-report-assemble.js.map +1 -1
- package/dist/cli/gate-report-cells.d.ts +1 -1
- package/dist/cli/gate-report-cells.d.ts.map +1 -1
- package/dist/cli/gate-report-cells.js +6 -5
- package/dist/cli/gate-report-cells.js.map +1 -1
- package/dist/cli/gate-report-registry.d.ts +3 -0
- package/dist/cli/gate-report-registry.d.ts.map +1 -1
- package/dist/cli/gate-report-registry.js.map +1 -1
- package/dist/cli/gate-report-types.d.ts +5 -0
- package/dist/cli/gate-report-types.d.ts.map +1 -1
- package/dist/cli/gate-report.d.ts.map +1 -1
- package/dist/cli/gate-report.js +2 -5
- package/dist/cli/gate-report.js.map +1 -1
- package/dist/controls/attest-record.d.ts.map +1 -1
- package/dist/controls/attest-record.js +9 -3
- package/dist/controls/attest-record.js.map +1 -1
- package/dist/controls/audit-report-markdown.d.ts.map +1 -1
- package/dist/controls/audit-report-markdown.js +7 -0
- package/dist/controls/audit-report-markdown.js.map +1 -1
- package/dist/controls/carrier-agent-checkout.d.ts +6 -0
- package/dist/controls/carrier-agent-checkout.d.ts.map +1 -0
- package/dist/controls/carrier-agent-checkout.js +101 -0
- package/dist/controls/carrier-agent-checkout.js.map +1 -0
- package/dist/controls/carrier-agent-files.d.ts.map +1 -1
- package/dist/controls/carrier-agent-files.js +2 -1
- package/dist/controls/carrier-agent-files.js.map +1 -1
- package/dist/controls/carrier-agent-program.d.ts +0 -16
- package/dist/controls/carrier-agent-program.d.ts.map +1 -1
- package/dist/controls/carrier-agent-program.js +17 -14
- package/dist/controls/carrier-agent-program.js.map +1 -1
- package/dist/controls/carrier-agent-script.d.ts +2 -0
- package/dist/controls/carrier-agent-script.d.ts.map +1 -1
- package/dist/controls/carrier-agent-script.js +3 -1
- package/dist/controls/carrier-agent-script.js.map +1 -1
- package/dist/controls/carrier-agent-settings.d.ts +20 -0
- package/dist/controls/carrier-agent-settings.d.ts.map +1 -1
- package/dist/controls/carrier-agent-settings.js +91 -15
- package/dist/controls/carrier-agent-settings.js.map +1 -1
- package/dist/controls/carrier-manager-file.d.ts.map +1 -1
- package/dist/controls/carrier-manager-file.js +25 -2
- package/dist/controls/carrier-manager-file.js.map +1 -1
- package/dist/controls/carrier-owned-files.d.ts +4 -1
- package/dist/controls/carrier-owned-files.d.ts.map +1 -1
- package/dist/controls/carrier-owned-files.js +18 -3
- package/dist/controls/carrier-owned-files.js.map +1 -1
- package/dist/controls/carrier-runner-files.d.ts.map +1 -1
- package/dist/controls/carrier-runner-files.js +6 -4
- package/dist/controls/carrier-runner-files.js.map +1 -1
- package/dist/controls/carriers.d.ts.map +1 -1
- package/dist/controls/carriers.js +18 -6
- package/dist/controls/carriers.js.map +1 -1
- package/dist/controls/commands/reconcile.d.ts.map +1 -1
- package/dist/controls/commands/reconcile.js +6 -6
- package/dist/controls/commands/reconcile.js.map +1 -1
- package/dist/controls/enforce-points.d.ts.map +1 -1
- package/dist/controls/enforce-points.js +3 -1
- package/dist/controls/enforce-points.js.map +1 -1
- package/dist/controls/enforce-summary.d.ts.map +1 -1
- package/dist/controls/enforce-summary.js +3 -1
- package/dist/controls/enforce-summary.js.map +1 -1
- package/dist/controls/pull-request-executor.d.ts +1 -1
- package/dist/controls/pull-request-executor.d.ts.map +1 -1
- package/dist/controls/pull-request-executor.js +6 -3
- package/dist/controls/pull-request-executor.js.map +1 -1
- package/dist/controls/reconcile-agent-hooks.d.ts +16 -0
- package/dist/controls/reconcile-agent-hooks.d.ts.map +1 -0
- package/dist/controls/reconcile-agent-hooks.js +125 -0
- package/dist/controls/reconcile-agent-hooks.js.map +1 -0
- package/dist/controls/reconcile-carrier-points.d.ts.map +1 -1
- package/dist/controls/reconcile-carrier-points.js +15 -8
- package/dist/controls/reconcile-carrier-points.js.map +1 -1
- package/dist/controls/reconcile-findings.d.ts.map +1 -1
- package/dist/controls/reconcile-findings.js +17 -3
- package/dist/controls/reconcile-findings.js.map +1 -1
- package/dist/controls/reconcile-hook-lines.d.ts +2 -1
- package/dist/controls/reconcile-hook-lines.d.ts.map +1 -1
- package/dist/controls/reconcile-hook-lines.js +6 -4
- package/dist/controls/reconcile-hook-lines.js.map +1 -1
- package/dist/controls/reconcile-hooks.d.ts +10 -0
- package/dist/controls/reconcile-hooks.d.ts.map +1 -1
- package/dist/controls/reconcile-hooks.js +3 -3
- package/dist/controls/reconcile-hooks.js.map +1 -1
- package/dist/controls/reconcile-points.d.ts +9 -5
- package/dist/controls/reconcile-points.d.ts.map +1 -1
- package/dist/controls/reconcile-points.js +100 -2
- package/dist/controls/reconcile-points.js.map +1 -1
- package/dist/controls/reconcile-result.d.ts.map +1 -1
- package/dist/controls/reconcile-result.js +4 -2
- package/dist/controls/reconcile-result.js.map +1 -1
- package/dist/controls/reconcile-types.d.ts +16 -5
- package/dist/controls/reconcile-types.d.ts.map +1 -1
- package/dist/controls/reconcile-types.js +1 -0
- package/dist/controls/reconcile-types.js.map +1 -1
- package/dist/controls/reconcile.d.ts.map +1 -1
- package/dist/controls/reconcile.js +37 -9
- package/dist/controls/reconcile.js.map +1 -1
- package/dist/controls/unmapped-gate-evidence.d.ts +9 -0
- package/dist/controls/unmapped-gate-evidence.d.ts.map +1 -0
- package/dist/controls/unmapped-gate-evidence.js +16 -0
- package/dist/controls/unmapped-gate-evidence.js.map +1 -0
- package/dist/controls/verdict-summary.d.ts +8 -0
- package/dist/controls/verdict-summary.d.ts.map +1 -1
- package/dist/controls/verdict-summary.js +22 -0
- package/dist/controls/verdict-summary.js.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.json +40 -0
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.json +56 -14
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/scripts/human-gate-act.mjs +50 -21
- package/plugins/lisa/.codex-plugin/skills/lisa-attest/SKILL.md +6 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-enforce/SKILL.md +7 -9
- package/plugins/lisa/.codex-plugin/skills/lisa-enforce/references/pull-request-executor.md +84 -13
- package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/references/estimate.md +5 -5
- package/plugins/lisa/scripts/human-gate-act.mjs +50 -21
- package/plugins/lisa/skills/lisa-attest/SKILL.md +6 -0
- package/plugins/lisa/skills/lisa-enforce/SKILL.md +7 -9
- package/plugins/lisa/skills/lisa-enforce/references/pull-request-executor.md +84 -13
- package/plugins/lisa/skills/lisa-usage-accounting/references/estimate.md +5 -5
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/scripts/human-gate-act.mjs +50 -21
- package/plugins/lisa-agy/skills/lisa-attest/SKILL.md +6 -0
- package/plugins/lisa-agy/skills/lisa-enforce/SKILL.md +7 -9
- package/plugins/lisa-agy/skills/lisa-enforce/references/pull-request-executor.md +84 -13
- package/plugins/lisa-agy/skills/lisa-usage-accounting/references/estimate.md +5 -5
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/scripts/human-gate-act.mjs +50 -21
- package/plugins/lisa-copilot/skills/lisa-attest/SKILL.md +6 -0
- package/plugins/lisa-copilot/skills/lisa-enforce/SKILL.md +7 -9
- package/plugins/lisa-copilot/skills/lisa-enforce/references/pull-request-executor.md +84 -13
- package/plugins/lisa-copilot/skills/lisa-usage-accounting/references/estimate.md +5 -5
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/scripts/human-gate-act.mjs +50 -21
- package/plugins/lisa-cursor/skills/lisa-attest/SKILL.md +6 -0
- package/plugins/lisa-cursor/skills/lisa-enforce/SKILL.md +7 -9
- package/plugins/lisa-cursor/skills/lisa-enforce/references/pull-request-executor.md +84 -13
- package/plugins/lisa-cursor/skills/lisa-usage-accounting/references/estimate.md +5 -5
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/scripts/human-gate-act.mjs +50 -21
- package/plugins/lisa-devin/skills/lisa-attest/SKILL.md +6 -0
- package/plugins/lisa-devin/skills/lisa-enforce/SKILL.md +7 -9
- package/plugins/lisa-devin/skills/lisa-enforce/references/pull-request-executor.md +84 -13
- package/plugins/lisa-devin/skills/lisa-usage-accounting/references/estimate.md +5 -5
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/scripts/human-gate-act.mjs +50 -21
- package/plugins/src/base/skills/lisa-attest/SKILL.md +6 -0
- package/plugins/src/base/skills/lisa-enforce/SKILL.md +7 -9
- package/plugins/src/base/skills/lisa-enforce/references/pull-request-executor.md +84 -13
- package/plugins/src/base/skills/lisa-usage-accounting/references/estimate.md +5 -5
- package/rails/copy-overwrite/lefthook.yml +13 -1
- package/rails/copy-overwrite/scripts/lisa-rails-registry-env.sh +24 -0
- package/rails/copy-overwrite/scripts/lisa-rails-registry-gates.sh +32 -0
- package/scripts/two-channel-couplings.json +1 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Writing a repository's pull-request executor
|
|
2
2
|
|
|
3
|
-
Part of the enforce step. Follow this when the
|
|
4
|
-
|
|
3
|
+
Part of the enforce step. Follow this when the gates declaration checks something at the
|
|
4
|
+
pull-request moment and the repository needs a workflow to run it.
|
|
5
5
|
|
|
6
6
|
The pull-request executor is the file the hosting platform runs when someone proposes a change. It
|
|
7
|
-
runs the gates
|
|
8
|
-
|
|
9
|
-
below.
|
|
7
|
+
runs the gates and reports a failure to the platform when a required gate fails. Lisa's supported
|
|
8
|
+
GitHub stacks ship a pull-request caller. A repository without that workflow can supply its own.
|
|
10
9
|
|
|
11
10
|
Lisa did not write the file you produce and has never seen it refuse a change. So the control
|
|
12
11
|
register marks every rule that file runs as **unproved**, and keeps it that way until the attest
|
|
@@ -37,8 +36,10 @@ Work out which platform hosts the repository from where it is pushed to and wher
|
|
|
37
36
|
requests are opened. If you cannot tell, do not guess: write nothing, and return `blocked` with the
|
|
38
37
|
question "Which platform hosts this repository's pull requests?".
|
|
39
38
|
|
|
40
|
-
- **GitHub:**
|
|
41
|
-
|
|
39
|
+
- **GitHub:** read the pull-request workflow and check whether Lisa's workflow already runs these
|
|
40
|
+
declared gates. If it does, leave it in place. When the repository needs a workflow, use an
|
|
41
|
+
existing host-owned workflow or add `.github/workflows/lisa-declared-controls.yml`. Use the
|
|
42
|
+
GitHub instructions in step 2 and record `platform: "github"` on the declarations.
|
|
42
43
|
- **Any other platform:** carry on.
|
|
43
44
|
|
|
44
45
|
## Step 1: find the executor the register names
|
|
@@ -68,7 +69,7 @@ A gate says where its pull-request executor is on its `pull-request` entry in th
|
|
|
68
69
|
|
|
69
70
|
| Key | Meaning |
|
|
70
71
|
| --- | --- |
|
|
71
|
-
| `platform` | The hosting platform's name in lower-case letters and digits, with hyphens between words
|
|
72
|
+
| `platform` | The hosting platform's name in lower-case letters and digits, with hyphens between words, such as `github`, `gitlab`, `bitbucket` or `azure-devops`. |
|
|
72
73
|
| `path` | The file, written from the repository root with `/` between folders. One spelling only: no leading `./`, no trailing `/`, no `..`, no absolute path. |
|
|
73
74
|
|
|
74
75
|
`executor` is accepted on the `pull-request` entry only, and only in the entry's long form (an
|
|
@@ -155,7 +156,77 @@ how the file is spelled.
|
|
|
155
156
|
result which of them you could confirm and which you could not; never report this requirement
|
|
156
157
|
as met on the strength of the file alone.
|
|
157
158
|
|
|
158
|
-
###
|
|
159
|
+
### GitHub repositories with their own workflow
|
|
160
|
+
|
|
161
|
+
In each declaration the workflow runs, name its exact repository path in `executor` and set
|
|
162
|
+
`caller_chain` to a stable label such as `["Declared Controls"]`. Use the planner's `context`
|
|
163
|
+
as the GitHub job name. It comes from the same declaration that `lisa controls protect` reads,
|
|
164
|
+
so the reported check and the required check have the same name. Install the project's toolchain
|
|
165
|
+
and dependencies in the check job before running the gate.
|
|
166
|
+
|
|
167
|
+
Use the repository's real workflow path and protected branch.
|
|
168
|
+
|
|
169
|
+
Example only, using `.github/workflows/lisa-declared-controls.yml` to protect `main`.
|
|
170
|
+
|
|
171
|
+
```yaml
|
|
172
|
+
name: Run declared controls
|
|
173
|
+
on:
|
|
174
|
+
pull_request:
|
|
175
|
+
branches: [main]
|
|
176
|
+
types: [opened, synchronize, reopened, edited]
|
|
177
|
+
permissions:
|
|
178
|
+
contents: read
|
|
179
|
+
jobs:
|
|
180
|
+
plan:
|
|
181
|
+
runs-on: ubuntu-latest
|
|
182
|
+
outputs:
|
|
183
|
+
legs: ${{ steps.plan.outputs.legs }}
|
|
184
|
+
steps:
|
|
185
|
+
- uses: actions/checkout@v6
|
|
186
|
+
with:
|
|
187
|
+
persist-credentials: false
|
|
188
|
+
- uses: actions/setup-node@v6
|
|
189
|
+
with:
|
|
190
|
+
node-version: '24'
|
|
191
|
+
- name: Plan declared pull-request checks
|
|
192
|
+
id: plan
|
|
193
|
+
shell: bash
|
|
194
|
+
run: |
|
|
195
|
+
legs=$(node scripts/lisa-gates.mjs legs --moment=pull-request --host-workflow=.github/workflows/lisa-declared-controls.yml --json)
|
|
196
|
+
printf 'legs=%s\n' "$legs" >> "$GITHUB_OUTPUT"
|
|
197
|
+
check:
|
|
198
|
+
needs: plan
|
|
199
|
+
if: needs.plan.outputs.legs != '[]'
|
|
200
|
+
strategy:
|
|
201
|
+
fail-fast: false
|
|
202
|
+
matrix:
|
|
203
|
+
include: ${{ fromJSON(needs.plan.outputs.legs) }}
|
|
204
|
+
name: ${{ matrix.context }}
|
|
205
|
+
runs-on: ubuntu-latest
|
|
206
|
+
timeout-minutes: ${{ matrix.timeout }}
|
|
207
|
+
steps:
|
|
208
|
+
- uses: actions/checkout@v6
|
|
209
|
+
with:
|
|
210
|
+
persist-credentials: false
|
|
211
|
+
fetch-depth: 0
|
|
212
|
+
- uses: actions/setup-node@v6
|
|
213
|
+
with:
|
|
214
|
+
node-version: '24'
|
|
215
|
+
- name: Run this gate's declared parts
|
|
216
|
+
if: matrix.action == 'run'
|
|
217
|
+
env:
|
|
218
|
+
GATE_ID: ${{ matrix.gate }}
|
|
219
|
+
run: node scripts/lisa-run-gates.mjs --moment=pull-request --builtins=none --parts=all --gate="$GATE_ID"
|
|
220
|
+
- name: Fail when the declaration has no prover
|
|
221
|
+
if: matrix.action == 'unproved'
|
|
222
|
+
run: exit 1
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Each required gate gets one job, including when it has several folder-scoped parts. All of its
|
|
226
|
+
parts are eligible to run and a failed required part fails that job. After GitHub reports the
|
|
227
|
+
jobs, verify their names against `lisa controls protect` before changing merge settings.
|
|
228
|
+
|
|
229
|
+
### Other platform examples
|
|
159
230
|
|
|
160
231
|
These show the shape of a job that meets requirements 1 and 2 and is triggered as requirement 3
|
|
161
232
|
asks. They are **examples only**. They are not complete pipelines, they are not the contract, and
|
|
@@ -208,8 +279,8 @@ register again without the mark.
|
|
|
208
279
|
|
|
209
280
|
The register is generated from the declaration and the evidence file together. So after either one
|
|
210
281
|
changes, `lisa controls register --check` fails until the register is written again, and it says
|
|
211
|
-
when the status is what differs.
|
|
212
|
-
|
|
282
|
+
when the status is what differs. The mark applies to host-written workflows on GitHub as well.
|
|
283
|
+
Use the verdict to see what was proved.
|
|
213
284
|
|
|
214
285
|
## Step 4: return the result
|
|
215
286
|
|
|
@@ -228,7 +299,7 @@ file refuse a bad change and accept a good one. Name any requirement you could n
|
|
|
228
299
|
|
|
229
300
|
## What this flow never does
|
|
230
301
|
|
|
231
|
-
- It
|
|
302
|
+
- It leaves the Lisa-shipped GitHub caller in place.
|
|
232
303
|
- It never says a rule is proved, and never writes or edits evidence or the register by hand.
|
|
233
304
|
- It never weakens the contract to get a pipeline to pass.
|
|
234
305
|
- It never guesses the hosting platform.
|
|
@@ -130,11 +130,11 @@ reached done with no estimate shows `none recorded` in the estimate row rather t
|
|
|
130
130
|
range.
|
|
131
131
|
|
|
132
132
|
`lisa-work-item complete` enforces it: when `required` is true, it refuses (as `pending-proof`) an
|
|
133
|
-
item with no usage entry, with no tally, or with a tally that no longer matches the ledger.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
item with no usage entry, with no tally, or with a tally that no longer matches the ledger.
|
|
134
|
+
The specification digest stays the same when Lisa first adds the estimate section or refreshes
|
|
135
|
+
its tally. The digest includes prose a person adds inside that section, including lines starting
|
|
136
|
+
with `Actual:` or `Basis:`. Existing proofs can still match the digest that Lisa calculated for
|
|
137
|
+
their unchanged specification.
|
|
138
138
|
|
|
139
139
|
## When the config is off
|
|
140
140
|
|
|
@@ -116,6 +116,24 @@ function readConfig(file) {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Whether parsed JSON is an object that can hold configuration keys.
|
|
121
|
+
* @param {unknown} value - Parsed configuration value
|
|
122
|
+
* @returns {boolean} Whether the value is a config object
|
|
123
|
+
*/
|
|
124
|
+
function isConfigObject(value) {
|
|
125
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Read the raw block, preserving invalid declarations for the mode resolver.
|
|
130
|
+
* @param {unknown} config - Parsed config file
|
|
131
|
+
* @returns {unknown} Raw human-gate block
|
|
132
|
+
*/
|
|
133
|
+
function humanGateBlock(config) {
|
|
134
|
+
return isConfigObject(config) ? config.humanGate : undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
119
137
|
/**
|
|
120
138
|
* The effective human-only classes: local override replaces global when set.
|
|
121
139
|
* @param {unknown} local - Parsed local config
|
|
@@ -123,10 +141,10 @@ function readConfig(file) {
|
|
|
123
141
|
* @returns {unknown[]} Declared classes
|
|
124
142
|
*/
|
|
125
143
|
export function resolveHumanOnly(local, global) {
|
|
126
|
-
const pick = config =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
144
|
+
const pick = config => {
|
|
145
|
+
const block = humanGateBlock(config);
|
|
146
|
+
return isConfigObject(block) ? block.humanOnly : undefined;
|
|
147
|
+
};
|
|
130
148
|
const value = pick(local) ?? pick(global);
|
|
131
149
|
return Array.isArray(value) ? value : [];
|
|
132
150
|
}
|
|
@@ -142,27 +160,37 @@ export function resolveHumanOnly(local, global) {
|
|
|
142
160
|
* as `rejected` (its JSON spelling) so the caller can report it.
|
|
143
161
|
* @param {unknown} local - Parsed local config
|
|
144
162
|
* @param {unknown} global - Parsed global config
|
|
145
|
-
* @returns {{ mode: string, rejected?: string }} The mode in force
|
|
163
|
+
* @returns {{ mode: string, rejected?: string, rejectedBlock?: true }} The mode in force
|
|
146
164
|
*/
|
|
147
165
|
export function resolveHumanGateMode(local, global) {
|
|
148
|
-
const pick = config =>
|
|
149
|
-
|
|
166
|
+
const pick = config => {
|
|
167
|
+
const block = humanGateBlock(config);
|
|
168
|
+
if (!isConfigObject(block))
|
|
169
|
+
return { value: block, mode: undefined, malformed: true };
|
|
170
|
+
return {
|
|
171
|
+
value: block.mode,
|
|
172
|
+
mode: normalizeHumanGateMode(block.mode),
|
|
173
|
+
malformed: false,
|
|
174
|
+
};
|
|
175
|
+
};
|
|
150
176
|
// Every declaration is judged, so a typo in the committed file is reported
|
|
151
177
|
// even while a valid local value is in force.
|
|
152
178
|
const declared = [pick(local), pick(global)].filter(
|
|
153
|
-
|
|
179
|
+
entry => entry.value !== undefined
|
|
154
180
|
);
|
|
155
|
-
const valid = declared
|
|
156
|
-
.map(normalizeHumanGateMode)
|
|
157
|
-
.find(mode => HUMAN_GATE_MODES.includes(mode));
|
|
181
|
+
const valid = declared.find(entry => HUMAN_GATE_MODES.includes(entry.mode));
|
|
158
182
|
const invalid = declared.find(
|
|
159
|
-
|
|
183
|
+
entry => !HUMAN_GATE_MODES.includes(entry.mode)
|
|
160
184
|
);
|
|
161
185
|
const mode =
|
|
162
|
-
valid ?? (invalid === undefined ? DEFAULT_HUMAN_GATE_MODE : "strict");
|
|
186
|
+
valid?.mode ?? (invalid === undefined ? DEFAULT_HUMAN_GATE_MODE : "strict");
|
|
163
187
|
return invalid === undefined
|
|
164
188
|
? { mode }
|
|
165
|
-
: {
|
|
189
|
+
: {
|
|
190
|
+
mode,
|
|
191
|
+
rejected: JSON.stringify(invalid.value),
|
|
192
|
+
...(invalid.malformed ? { rejectedBlock: true } : {}),
|
|
193
|
+
};
|
|
166
194
|
}
|
|
167
195
|
|
|
168
196
|
/**
|
|
@@ -170,23 +198,24 @@ export function resolveHumanGateMode(local, global) {
|
|
|
170
198
|
* human-only classes, each resolved local-then-global.
|
|
171
199
|
* @param {unknown} local - Parsed local config
|
|
172
200
|
* @param {unknown} global - Parsed global config
|
|
173
|
-
* @returns {{ mode: string, humanOnly: unknown[], rejected?: string }} Policy
|
|
201
|
+
* @returns {{ mode: string, humanOnly: unknown[], rejected?: string, rejectedBlock?: true }} Policy
|
|
174
202
|
*/
|
|
175
203
|
export function resolveHumanGatePolicy(local, global) {
|
|
176
|
-
const { mode, rejected } = resolveHumanGateMode(local, global);
|
|
177
204
|
return {
|
|
178
|
-
|
|
205
|
+
...resolveHumanGateMode(local, global),
|
|
179
206
|
humanOnly: resolveHumanOnly(local, global),
|
|
180
|
-
...(rejected === undefined ? {} : { rejected }),
|
|
181
207
|
};
|
|
182
208
|
}
|
|
183
209
|
|
|
184
210
|
/**
|
|
185
211
|
* The stderr line for an invalid `humanGate.mode`.
|
|
186
212
|
* @param {string} rejected - JSON spelling of the declared value
|
|
213
|
+
* @param {boolean} rejectedBlock - Whether the whole block was invalid
|
|
187
214
|
* @returns {string} One warning line
|
|
188
215
|
*/
|
|
189
|
-
function invalidModeWarning(rejected) {
|
|
216
|
+
function invalidModeWarning(rejected, rejectedBlock) {
|
|
217
|
+
if (rejectedBlock)
|
|
218
|
+
return `Invalid humanGate: ${rejected} is not an object.\n`;
|
|
190
219
|
const accepted = HUMAN_GATE_MODES.map(value => `"${value}"`).join(" | ");
|
|
191
220
|
return `Invalid humanGate.mode: ${rejected} is not one of ${accepted}; ignored.\n`;
|
|
192
221
|
}
|
|
@@ -250,12 +279,12 @@ export function main(argv, io = {}) {
|
|
|
250
279
|
error(`${failed.error}\n`);
|
|
251
280
|
return 2;
|
|
252
281
|
}
|
|
253
|
-
const { rejected, ...policy } = resolveHumanGatePolicy(
|
|
282
|
+
const { rejected, rejectedBlock, ...policy } = resolveHumanGatePolicy(
|
|
254
283
|
local.value,
|
|
255
284
|
global.value
|
|
256
285
|
);
|
|
257
286
|
if (rejected !== undefined) {
|
|
258
|
-
error(invalidModeWarning(rejected));
|
|
287
|
+
error(invalidModeWarning(rejected, rejectedBlock === true));
|
|
259
288
|
error(`humanGate.mode in force: "${policy.mode}".\n`);
|
|
260
289
|
}
|
|
261
290
|
if (command === "policy") {
|
|
@@ -283,6 +283,12 @@ the record does not list? It writes nothing, runs nothing it finds, and sends no
|
|
|
283
283
|
prints one JSON document: `findings` lists each difference, with `message` and `next` in plain
|
|
284
284
|
words.
|
|
285
285
|
|
|
286
|
+
Reconcile checks the local edit-time hook of each agent named in the carrier record. It names
|
|
287
|
+
missing or changed registrations and undeclared commands in the shared shell carrier or the
|
|
288
|
+
agents' shell hook settings. For an older carrier record with no agents listed, report the
|
|
289
|
+
`not-verifiable` result and tell the operator that enforce can record the original roster.
|
|
290
|
+
Deployment and scheduled points stay `not-verifiable`.
|
|
291
|
+
|
|
286
292
|
| Exit | Meaning | What you do |
|
|
287
293
|
| --- | --- | --- |
|
|
288
294
|
| 0 | Everything it needed was read. `findings` may be empty or not. | Go on. A finding is something to tell the operator, not a failure of this step. |
|
|
@@ -225,19 +225,17 @@ Never edit the saved file, and never save the result of the `--check` run as `ca
|
|
|
225
225
|
check installs nothing, and every change it lists is one it did not make. The command of step 8
|
|
226
226
|
refuses the result of a `--check` run, so only `carriers.json` can be named to it.
|
|
227
227
|
|
|
228
|
-
### Step 4: Write the
|
|
228
|
+
### Step 4: Write the pull-request workflow where the repository needs one
|
|
229
229
|
|
|
230
230
|
**Needs:** the carriers. **Hands on:** the file that runs the checks on a proposed change, where
|
|
231
231
|
Lisa ships none.
|
|
232
232
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
On GitHub, and when nothing is declared for a proposed change, skip this step.
|
|
233
|
+
When a check is declared at `pull-request`, find the workflow that runs it. Skip this step if a
|
|
234
|
+
Lisa workflow already runs those declared checks. Otherwise follow
|
|
235
|
+
`references/pull-request-executor.md` from start to finish, including its GitHub instructions for
|
|
236
|
+
repositories that need their own workflow. Tell the operator that the new workflow's checks stay
|
|
237
|
+
`unproved` until attest records both halves of their proof. Skip this step when nothing runs on
|
|
238
|
+
pull requests.
|
|
241
239
|
|
|
242
240
|
### Step 5: Bring the control register up to date
|
|
243
241
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Writing a repository's pull-request executor
|
|
2
2
|
|
|
3
|
-
Part of the enforce step. Follow this when the
|
|
4
|
-
|
|
3
|
+
Part of the enforce step. Follow this when the gates declaration checks something at the
|
|
4
|
+
pull-request moment and the repository needs a workflow to run it.
|
|
5
5
|
|
|
6
6
|
The pull-request executor is the file the hosting platform runs when someone proposes a change. It
|
|
7
|
-
runs the gates
|
|
8
|
-
|
|
9
|
-
below.
|
|
7
|
+
runs the gates and reports a failure to the platform when a required gate fails. Lisa's supported
|
|
8
|
+
GitHub stacks ship a pull-request caller. A repository without that workflow can supply its own.
|
|
10
9
|
|
|
11
10
|
Lisa did not write the file you produce and has never seen it refuse a change. So the control
|
|
12
11
|
register marks every rule that file runs as **unproved**, and keeps it that way until the attest
|
|
@@ -37,8 +36,10 @@ Work out which platform hosts the repository from where it is pushed to and wher
|
|
|
37
36
|
requests are opened. If you cannot tell, do not guess: write nothing, and return `blocked` with the
|
|
38
37
|
question "Which platform hosts this repository's pull requests?".
|
|
39
38
|
|
|
40
|
-
- **GitHub:**
|
|
41
|
-
|
|
39
|
+
- **GitHub:** read the pull-request workflow and check whether Lisa's workflow already runs these
|
|
40
|
+
declared gates. If it does, leave it in place. When the repository needs a workflow, use an
|
|
41
|
+
existing host-owned workflow or add `.github/workflows/lisa-declared-controls.yml`. Use the
|
|
42
|
+
GitHub instructions in step 2 and record `platform: "github"` on the declarations.
|
|
42
43
|
- **Any other platform:** carry on.
|
|
43
44
|
|
|
44
45
|
## Step 1: find the executor the register names
|
|
@@ -68,7 +69,7 @@ A gate says where its pull-request executor is on its `pull-request` entry in th
|
|
|
68
69
|
|
|
69
70
|
| Key | Meaning |
|
|
70
71
|
| --- | --- |
|
|
71
|
-
| `platform` | The hosting platform's name in lower-case letters and digits, with hyphens between words
|
|
72
|
+
| `platform` | The hosting platform's name in lower-case letters and digits, with hyphens between words, such as `github`, `gitlab`, `bitbucket` or `azure-devops`. |
|
|
72
73
|
| `path` | The file, written from the repository root with `/` between folders. One spelling only: no leading `./`, no trailing `/`, no `..`, no absolute path. |
|
|
73
74
|
|
|
74
75
|
`executor` is accepted on the `pull-request` entry only, and only in the entry's long form (an
|
|
@@ -155,7 +156,77 @@ how the file is spelled.
|
|
|
155
156
|
result which of them you could confirm and which you could not; never report this requirement
|
|
156
157
|
as met on the strength of the file alone.
|
|
157
158
|
|
|
158
|
-
###
|
|
159
|
+
### GitHub repositories with their own workflow
|
|
160
|
+
|
|
161
|
+
In each declaration the workflow runs, name its exact repository path in `executor` and set
|
|
162
|
+
`caller_chain` to a stable label such as `["Declared Controls"]`. Use the planner's `context`
|
|
163
|
+
as the GitHub job name. It comes from the same declaration that `lisa controls protect` reads,
|
|
164
|
+
so the reported check and the required check have the same name. Install the project's toolchain
|
|
165
|
+
and dependencies in the check job before running the gate.
|
|
166
|
+
|
|
167
|
+
Use the repository's real workflow path and protected branch.
|
|
168
|
+
|
|
169
|
+
Example only, using `.github/workflows/lisa-declared-controls.yml` to protect `main`.
|
|
170
|
+
|
|
171
|
+
```yaml
|
|
172
|
+
name: Run declared controls
|
|
173
|
+
on:
|
|
174
|
+
pull_request:
|
|
175
|
+
branches: [main]
|
|
176
|
+
types: [opened, synchronize, reopened, edited]
|
|
177
|
+
permissions:
|
|
178
|
+
contents: read
|
|
179
|
+
jobs:
|
|
180
|
+
plan:
|
|
181
|
+
runs-on: ubuntu-latest
|
|
182
|
+
outputs:
|
|
183
|
+
legs: ${{ steps.plan.outputs.legs }}
|
|
184
|
+
steps:
|
|
185
|
+
- uses: actions/checkout@v6
|
|
186
|
+
with:
|
|
187
|
+
persist-credentials: false
|
|
188
|
+
- uses: actions/setup-node@v6
|
|
189
|
+
with:
|
|
190
|
+
node-version: '24'
|
|
191
|
+
- name: Plan declared pull-request checks
|
|
192
|
+
id: plan
|
|
193
|
+
shell: bash
|
|
194
|
+
run: |
|
|
195
|
+
legs=$(node scripts/lisa-gates.mjs legs --moment=pull-request --host-workflow=.github/workflows/lisa-declared-controls.yml --json)
|
|
196
|
+
printf 'legs=%s\n' "$legs" >> "$GITHUB_OUTPUT"
|
|
197
|
+
check:
|
|
198
|
+
needs: plan
|
|
199
|
+
if: needs.plan.outputs.legs != '[]'
|
|
200
|
+
strategy:
|
|
201
|
+
fail-fast: false
|
|
202
|
+
matrix:
|
|
203
|
+
include: ${{ fromJSON(needs.plan.outputs.legs) }}
|
|
204
|
+
name: ${{ matrix.context }}
|
|
205
|
+
runs-on: ubuntu-latest
|
|
206
|
+
timeout-minutes: ${{ matrix.timeout }}
|
|
207
|
+
steps:
|
|
208
|
+
- uses: actions/checkout@v6
|
|
209
|
+
with:
|
|
210
|
+
persist-credentials: false
|
|
211
|
+
fetch-depth: 0
|
|
212
|
+
- uses: actions/setup-node@v6
|
|
213
|
+
with:
|
|
214
|
+
node-version: '24'
|
|
215
|
+
- name: Run this gate's declared parts
|
|
216
|
+
if: matrix.action == 'run'
|
|
217
|
+
env:
|
|
218
|
+
GATE_ID: ${{ matrix.gate }}
|
|
219
|
+
run: node scripts/lisa-run-gates.mjs --moment=pull-request --builtins=none --parts=all --gate="$GATE_ID"
|
|
220
|
+
- name: Fail when the declaration has no prover
|
|
221
|
+
if: matrix.action == 'unproved'
|
|
222
|
+
run: exit 1
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Each required gate gets one job, including when it has several folder-scoped parts. All of its
|
|
226
|
+
parts are eligible to run and a failed required part fails that job. After GitHub reports the
|
|
227
|
+
jobs, verify their names against `lisa controls protect` before changing merge settings.
|
|
228
|
+
|
|
229
|
+
### Other platform examples
|
|
159
230
|
|
|
160
231
|
These show the shape of a job that meets requirements 1 and 2 and is triggered as requirement 3
|
|
161
232
|
asks. They are **examples only**. They are not complete pipelines, they are not the contract, and
|
|
@@ -208,8 +279,8 @@ register again without the mark.
|
|
|
208
279
|
|
|
209
280
|
The register is generated from the declaration and the evidence file together. So after either one
|
|
210
281
|
changes, `lisa controls register --check` fails until the register is written again, and it says
|
|
211
|
-
when the status is what differs.
|
|
212
|
-
|
|
282
|
+
when the status is what differs. The mark applies to host-written workflows on GitHub as well.
|
|
283
|
+
Use the verdict to see what was proved.
|
|
213
284
|
|
|
214
285
|
## Step 4: return the result
|
|
215
286
|
|
|
@@ -228,7 +299,7 @@ file refuse a bad change and accept a good one. Name any requirement you could n
|
|
|
228
299
|
|
|
229
300
|
## What this flow never does
|
|
230
301
|
|
|
231
|
-
- It
|
|
302
|
+
- It leaves the Lisa-shipped GitHub caller in place.
|
|
232
303
|
- It never says a rule is proved, and never writes or edits evidence or the register by hand.
|
|
233
304
|
- It never weakens the contract to get a pipeline to pass.
|
|
234
305
|
- It never guesses the hosting platform.
|
|
@@ -130,11 +130,11 @@ reached done with no estimate shows `none recorded` in the estimate row rather t
|
|
|
130
130
|
range.
|
|
131
131
|
|
|
132
132
|
`lisa-work-item complete` enforces it: when `required` is true, it refuses (as `pending-proof`) an
|
|
133
|
-
item with no usage entry, with no tally, or with a tally that no longer matches the ledger.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
item with no usage entry, with no tally, or with a tally that no longer matches the ledger.
|
|
134
|
+
The specification digest stays the same when Lisa first adds the estimate section or refreshes
|
|
135
|
+
its tally. The digest includes prose a person adds inside that section, including lines starting
|
|
136
|
+
with `Actual:` or `Basis:`. Existing proofs can still match the digest that Lisa calculated for
|
|
137
|
+
their unchanged specification.
|
|
138
138
|
|
|
139
139
|
## When the config is off
|
|
140
140
|
|
|
@@ -116,6 +116,24 @@ function readConfig(file) {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Whether parsed JSON is an object that can hold configuration keys.
|
|
121
|
+
* @param {unknown} value - Parsed configuration value
|
|
122
|
+
* @returns {boolean} Whether the value is a config object
|
|
123
|
+
*/
|
|
124
|
+
function isConfigObject(value) {
|
|
125
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Read the raw block, preserving invalid declarations for the mode resolver.
|
|
130
|
+
* @param {unknown} config - Parsed config file
|
|
131
|
+
* @returns {unknown} Raw human-gate block
|
|
132
|
+
*/
|
|
133
|
+
function humanGateBlock(config) {
|
|
134
|
+
return isConfigObject(config) ? config.humanGate : undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
119
137
|
/**
|
|
120
138
|
* The effective human-only classes: local override replaces global when set.
|
|
121
139
|
* @param {unknown} local - Parsed local config
|
|
@@ -123,10 +141,10 @@ function readConfig(file) {
|
|
|
123
141
|
* @returns {unknown[]} Declared classes
|
|
124
142
|
*/
|
|
125
143
|
export function resolveHumanOnly(local, global) {
|
|
126
|
-
const pick = config =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
144
|
+
const pick = config => {
|
|
145
|
+
const block = humanGateBlock(config);
|
|
146
|
+
return isConfigObject(block) ? block.humanOnly : undefined;
|
|
147
|
+
};
|
|
130
148
|
const value = pick(local) ?? pick(global);
|
|
131
149
|
return Array.isArray(value) ? value : [];
|
|
132
150
|
}
|
|
@@ -142,27 +160,37 @@ export function resolveHumanOnly(local, global) {
|
|
|
142
160
|
* as `rejected` (its JSON spelling) so the caller can report it.
|
|
143
161
|
* @param {unknown} local - Parsed local config
|
|
144
162
|
* @param {unknown} global - Parsed global config
|
|
145
|
-
* @returns {{ mode: string, rejected?: string }} The mode in force
|
|
163
|
+
* @returns {{ mode: string, rejected?: string, rejectedBlock?: true }} The mode in force
|
|
146
164
|
*/
|
|
147
165
|
export function resolveHumanGateMode(local, global) {
|
|
148
|
-
const pick = config =>
|
|
149
|
-
|
|
166
|
+
const pick = config => {
|
|
167
|
+
const block = humanGateBlock(config);
|
|
168
|
+
if (!isConfigObject(block))
|
|
169
|
+
return { value: block, mode: undefined, malformed: true };
|
|
170
|
+
return {
|
|
171
|
+
value: block.mode,
|
|
172
|
+
mode: normalizeHumanGateMode(block.mode),
|
|
173
|
+
malformed: false,
|
|
174
|
+
};
|
|
175
|
+
};
|
|
150
176
|
// Every declaration is judged, so a typo in the committed file is reported
|
|
151
177
|
// even while a valid local value is in force.
|
|
152
178
|
const declared = [pick(local), pick(global)].filter(
|
|
153
|
-
|
|
179
|
+
entry => entry.value !== undefined
|
|
154
180
|
);
|
|
155
|
-
const valid = declared
|
|
156
|
-
.map(normalizeHumanGateMode)
|
|
157
|
-
.find(mode => HUMAN_GATE_MODES.includes(mode));
|
|
181
|
+
const valid = declared.find(entry => HUMAN_GATE_MODES.includes(entry.mode));
|
|
158
182
|
const invalid = declared.find(
|
|
159
|
-
|
|
183
|
+
entry => !HUMAN_GATE_MODES.includes(entry.mode)
|
|
160
184
|
);
|
|
161
185
|
const mode =
|
|
162
|
-
valid ?? (invalid === undefined ? DEFAULT_HUMAN_GATE_MODE : "strict");
|
|
186
|
+
valid?.mode ?? (invalid === undefined ? DEFAULT_HUMAN_GATE_MODE : "strict");
|
|
163
187
|
return invalid === undefined
|
|
164
188
|
? { mode }
|
|
165
|
-
: {
|
|
189
|
+
: {
|
|
190
|
+
mode,
|
|
191
|
+
rejected: JSON.stringify(invalid.value),
|
|
192
|
+
...(invalid.malformed ? { rejectedBlock: true } : {}),
|
|
193
|
+
};
|
|
166
194
|
}
|
|
167
195
|
|
|
168
196
|
/**
|
|
@@ -170,23 +198,24 @@ export function resolveHumanGateMode(local, global) {
|
|
|
170
198
|
* human-only classes, each resolved local-then-global.
|
|
171
199
|
* @param {unknown} local - Parsed local config
|
|
172
200
|
* @param {unknown} global - Parsed global config
|
|
173
|
-
* @returns {{ mode: string, humanOnly: unknown[], rejected?: string }} Policy
|
|
201
|
+
* @returns {{ mode: string, humanOnly: unknown[], rejected?: string, rejectedBlock?: true }} Policy
|
|
174
202
|
*/
|
|
175
203
|
export function resolveHumanGatePolicy(local, global) {
|
|
176
|
-
const { mode, rejected } = resolveHumanGateMode(local, global);
|
|
177
204
|
return {
|
|
178
|
-
|
|
205
|
+
...resolveHumanGateMode(local, global),
|
|
179
206
|
humanOnly: resolveHumanOnly(local, global),
|
|
180
|
-
...(rejected === undefined ? {} : { rejected }),
|
|
181
207
|
};
|
|
182
208
|
}
|
|
183
209
|
|
|
184
210
|
/**
|
|
185
211
|
* The stderr line for an invalid `humanGate.mode`.
|
|
186
212
|
* @param {string} rejected - JSON spelling of the declared value
|
|
213
|
+
* @param {boolean} rejectedBlock - Whether the whole block was invalid
|
|
187
214
|
* @returns {string} One warning line
|
|
188
215
|
*/
|
|
189
|
-
function invalidModeWarning(rejected) {
|
|
216
|
+
function invalidModeWarning(rejected, rejectedBlock) {
|
|
217
|
+
if (rejectedBlock)
|
|
218
|
+
return `Invalid humanGate: ${rejected} is not an object.\n`;
|
|
190
219
|
const accepted = HUMAN_GATE_MODES.map(value => `"${value}"`).join(" | ");
|
|
191
220
|
return `Invalid humanGate.mode: ${rejected} is not one of ${accepted}; ignored.\n`;
|
|
192
221
|
}
|
|
@@ -250,12 +279,12 @@ export function main(argv, io = {}) {
|
|
|
250
279
|
error(`${failed.error}\n`);
|
|
251
280
|
return 2;
|
|
252
281
|
}
|
|
253
|
-
const { rejected, ...policy } = resolveHumanGatePolicy(
|
|
282
|
+
const { rejected, rejectedBlock, ...policy } = resolveHumanGatePolicy(
|
|
254
283
|
local.value,
|
|
255
284
|
global.value
|
|
256
285
|
);
|
|
257
286
|
if (rejected !== undefined) {
|
|
258
|
-
error(invalidModeWarning(rejected));
|
|
287
|
+
error(invalidModeWarning(rejected, rejectedBlock === true));
|
|
259
288
|
error(`humanGate.mode in force: "${policy.mode}".\n`);
|
|
260
289
|
}
|
|
261
290
|
if (command === "policy") {
|
|
@@ -283,6 +283,12 @@ the record does not list? It writes nothing, runs nothing it finds, and sends no
|
|
|
283
283
|
prints one JSON document: `findings` lists each difference, with `message` and `next` in plain
|
|
284
284
|
words.
|
|
285
285
|
|
|
286
|
+
Reconcile checks the local edit-time hook of each agent named in the carrier record. It names
|
|
287
|
+
missing or changed registrations and undeclared commands in the shared shell carrier or the
|
|
288
|
+
agents' shell hook settings. For an older carrier record with no agents listed, report the
|
|
289
|
+
`not-verifiable` result and tell the operator that enforce can record the original roster.
|
|
290
|
+
Deployment and scheduled points stay `not-verifiable`.
|
|
291
|
+
|
|
286
292
|
| Exit | Meaning | What you do |
|
|
287
293
|
| --- | --- | --- |
|
|
288
294
|
| 0 | Everything it needed was read. `findings` may be empty or not. | Go on. A finding is something to tell the operator, not a failure of this step. |
|