@geonosis/review 1.2.0 → 1.4.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.
@@ -14,6 +14,17 @@ var REVIEW_DEFAULT = {
14
14
  runner: "peer-session"
15
15
  };
16
16
  var KNOWN = new Set(Object.keys(REVIEW_DEFAULT));
17
+ var configShape = () => [
18
+ "geonosis-review reads geonosis.json",
19
+ "",
20
+ 'geonosis.json \u2192 "review" every key optional, every default a contract',
21
+ ...[...KNOWN].toSorted().map(
22
+ (key) => ` ${key.padEnd(18)}string? default ${JSON.stringify(REVIEW_DEFAULT[key])}`
23
+ ),
24
+ "",
25
+ "A key outside this list is REFUSED by name, and `criteria` and `criteriaHeading` are compiled as",
26
+ "regular expressions when the config is read, never at the moment they are used."
27
+ ].join("\n");
17
28
  var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
18
29
  var loadReviewConfig = (root) => {
19
30
  const file = resolve(root, "geonosis.json");
@@ -156,6 +167,7 @@ var applyDecision = (decision, root, proofs, slug) => {
156
167
  export {
157
168
  ReviewError,
158
169
  REVIEW_DEFAULT,
170
+ configShape,
159
171
  loadReviewConfig,
160
172
  criteriaOf,
161
173
  uncovered,
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  readDecision,
11
11
  render,
12
12
  uncovered
13
- } from "./chunk-PJWPFJAP.js";
13
+ } from "./chunk-GCGDPXAF.js";
14
14
  export {
15
15
  DECISIONS,
16
16
  REVIEW_DEFAULT,
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  ReviewError,
3
3
  applyDecision,
4
+ configShape,
4
5
  criteriaOf,
5
6
  loadReviewConfig,
6
7
  readDecision,
7
8
  render,
8
9
  uncovered
9
- } from "./chunk-PJWPFJAP.js";
10
+ } from "./chunk-GCGDPXAF.js";
10
11
 
11
12
  // src/review-cli.ts
12
13
  import { existsSync, readFileSync } from "fs";
@@ -25,7 +26,8 @@ var parse = (argv) => {
25
26
  if (arg === "--to") out.to = takes("--to");
26
27
  else if (arg === "--slug") out.slug = takes("--slug");
27
28
  else if (arg === "--criteria") out.criteria = takes("--criteria");
28
- else if (arg.startsWith("-")) throw new ReviewError(`unknown option ${arg}`);
29
+ else if (arg.startsWith("-"))
30
+ throw new ReviewError(`unknown option ${arg} \u2014 run geonosis-review --help`);
29
31
  else if (out.verb === void 0) out.verb = arg;
30
32
  else if (out.file === void 0) out.file = arg;
31
33
  else throw new ReviewError(`unexpected argument ${arg}`);
@@ -77,10 +79,38 @@ var check = (argv, root) => {
77
79
  process.stdout.write(`all ${stated.length} criteria checked
78
80
  `);
79
81
  };
82
+ var USAGE = `geonosis-review <apply|check> <decision.md> [options]
83
+
84
+ Reads a release review \u2014 a decision file \u2014 and either applies it or checks that it covered the
85
+ criteria the plan stated.
86
+
87
+ apply <decision.md> [--to ledger|stdout] [--slug <name>]
88
+ Render the decision, or write it into the ledger under a slug.
89
+
90
+ check <decision.md> --criteria <plan.md>
91
+ Refuse a review that did not check every acceptance criterion the plan states.
92
+
93
+ --help, -h this text
94
+
95
+ Exit codes: 0 applied \xB7 1 the review was read and REFUSED \xB7 2 the command could not run.
96
+
97
+ The middle one is the contract: an approval that lists a blocker is an ANSWER, and an answer of
98
+ "no" is not a broken tool.`;
80
99
  var main = () => {
81
100
  const root = process.cwd();
101
+ const args = process.argv.slice(2);
102
+ if (args.includes("--help") || args.includes("-h")) {
103
+ process.stdout.write(`${USAGE}
104
+ `);
105
+ return 0;
106
+ }
107
+ if (args.includes("--print-config-shape")) {
108
+ process.stdout.write(`${configShape()}
109
+ `);
110
+ return 0;
111
+ }
82
112
  try {
83
- const argv = parse(process.argv.slice(2));
113
+ const argv = parse(args);
84
114
  if (argv.verb === "apply") apply(argv, root);
85
115
  else if (argv.verb === "check") check(argv, root);
86
116
  else throw new ReviewError(`geonosis-review takes "apply" or "check", not "${argv.verb ?? ""}"`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geonosis/review",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "description": "The decision-only reviewer contract: a review's sole output is one JSON decision, validated and applied by a step that comments nowhere, approves nothing and cannot reach a forge.",
6
6
  "keywords": [