@ref0/workspace 0.10.0 → 0.11.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.
@@ -0,0 +1,39 @@
1
+ /** The path of the settings, in the repo. */
2
+ export declare const settingsPath = ".agents/repo/review.json";
3
+ export interface Settings {
4
+ /**
5
+ * The review types the repo accepts: a session naming another fails, by that type's name. The
6
+ * shared review skill's `references/types.md` lists them.
7
+ */
8
+ readonly reviewTypes: ReadonlyArray<string>;
9
+ /** The types every session names, as run or as not run with why, on a change a review covers. */
10
+ readonly consideredTypes: ReadonlyArray<string>;
11
+ /** Changed lines, additions plus deletions from the merge base, up to which a pull request may be low. */
12
+ readonly lowTierLines: number;
13
+ /** Changed lines up to which a pull request may be medium: past them its floor is high. */
14
+ readonly highTierLines: number;
15
+ /**
16
+ * Production source, as globs, whose net lines count toward a large change. Test code and
17
+ * fixtures are left out whether the globs name them or not.
18
+ */
19
+ readonly productionSource: ReadonlyArray<string>;
20
+ /**
21
+ * Test code, as globs: a pull request that changes it needs a tests reviewer, or at low or medium
22
+ * a recorded break.
23
+ */
24
+ readonly testCode: ReadonlyArray<string>;
25
+ /**
26
+ * Shared test helpers, test code whether `testCode` names them or not: a change to one puts a
27
+ * pull request at medium or above.
28
+ */
29
+ readonly testHelpers: ReadonlyArray<string>;
30
+ /**
31
+ * The list that ties source to the bench cases that time it, as `<case> <glob>` lines, or none in
32
+ * a repo with no bench.
33
+ */
34
+ readonly benchedPaths: string | undefined;
35
+ /** Files under a `testing/` folder that a bench case runs all the same, so a change to one owes its readings. */
36
+ readonly benchRuns: ReadonlyArray<string>;
37
+ }
38
+ /** `settingsOf`'s settings, which throws on a problem, as the gate does on anything it can't read. */
39
+ export declare const settingsFrom: (text: string | undefined) => Settings;
@@ -0,0 +1,100 @@
1
+ import { Result, Schema } from "effect";
2
+ // src/review-record/settings.ts
3
+ /**
4
+ * What the review gate reads of each repo: `.agents/repo/review.json`, beside `review-paths.txt`, as
5
+ * the package's README says under "The review gate". Every key may be left out, for the value
6
+ * `defaults` gives it, so a repo names only where it differs. CI reads the base's copy, so a pull
7
+ * request can't loosen the settings that judge it.
8
+ */
9
+ /** The path of the settings, in the repo. */
10
+ const settingsPath = ".agents/repo/review.json";
11
+ /** The path of the list of files a review covers, in the repo. */
12
+ const listPath = ".agents/repo/review-paths.txt";
13
+ /** Globs in `review-paths.txt`'s form, where `*` crosses folders and a `!` entry takes a path off. */
14
+ const Globs = Schema.Array(Schema.String);
15
+ /** A count of lines, a whole number above 0. */
16
+ const Lines = Schema.Int.check(Schema.isGreaterThan(0));
17
+ /** A review type, in lowercase, as the shared review skill's `references/types.md` names it. */
18
+ const ReviewType = Schema.String.check(Schema.isPattern(/^[a-z][a-z -]*[a-z]$/));
19
+ /** The settings file's keys, each optional, and no others, so a misspelt one is named. */
20
+ const File = Schema.Struct({
21
+ reviewTypes: Schema.optionalKey(Schema.Array(ReviewType)),
22
+ consideredTypes: Schema.optionalKey(Schema.Array(ReviewType)),
23
+ lowTierLines: Schema.optionalKey(Lines),
24
+ highTierLines: Schema.optionalKey(Lines),
25
+ productionSource: Schema.optionalKey(Globs),
26
+ testCode: Schema.optionalKey(Globs),
27
+ testHelpers: Schema.optionalKey(Globs),
28
+ benchedPaths: Schema.optionalKey(Schema.String),
29
+ benchRuns: Schema.optionalKey(Schema.Array(Schema.String))
30
+ });
31
+ /** Each setting's value when the file leaves it out: ref-0/git's, where the gate began. */
32
+ const defaults = {
33
+ reviewTypes: [
34
+ "stress test",
35
+ "red team",
36
+ "system design",
37
+ "formal verification",
38
+ "fuzzing",
39
+ "storage",
40
+ "program design",
41
+ "tests",
42
+ "code quality",
43
+ "agent reader",
44
+ "fidelity",
45
+ "experiment",
46
+ "skeptic",
47
+ "cold read"
48
+ ],
49
+ consideredTypes: [
50
+ "stress test",
51
+ "system design",
52
+ "red team",
53
+ "storage",
54
+ "program design",
55
+ "formal verification",
56
+ "fuzzing",
57
+ "fidelity"
58
+ ],
59
+ lowTierLines: 150,
60
+ highTierLines: 500,
61
+ productionSource: [
62
+ "packages/*/src/*.ts",
63
+ "packages/*/src/*.tsx",
64
+ "apps/*/src/*.ts",
65
+ "apps/*/src/*.tsx"
66
+ ],
67
+ testCode: [
68
+ "*.test.ts",
69
+ "*.test-d.ts",
70
+ "*/testing/*"
71
+ ],
72
+ testHelpers: ["*/testing/*"],
73
+ benchedPaths: void 0,
74
+ benchRuns: []
75
+ };
76
+ const decodeFile = Schema.decodeUnknownResult(Schema.fromJsonString(File), { onExcessProperty: "error" });
77
+ /**
78
+ * The settings a file's text gives, `defaults` for each key it leaves out and all of them when
79
+ * there's no file, or what's wrong with it.
80
+ */
81
+ const settingsOf = (text) => {
82
+ if (text === void 0) return { settings: defaults };
83
+ const decoded = decodeFile(text);
84
+ if (Result.isFailure(decoded)) return { problem: `${settingsPath}: ${decoded.failure.message}` };
85
+ const settings = {
86
+ ...defaults,
87
+ ...decoded.success
88
+ };
89
+ const unknown = settings.consideredTypes.filter((type) => !settings.reviewTypes.includes(type));
90
+ if (unknown.length > 0) return { problem: `${settingsPath}: consideredTypes names ${unknown.join(", ")}, not in reviewTypes` };
91
+ if (settings.highTierLines < settings.lowTierLines) return { problem: `${settingsPath}: highTierLines, ${settings.highTierLines}, is below lowTierLines, ${settings.lowTierLines}` };
92
+ return { settings };
93
+ };
94
+ /** `settingsOf`'s settings, which throws on a problem, as the gate does on anything it can't read. */
95
+ const settingsFrom = (text) => {
96
+ const read = settingsOf(text);
97
+ if ("problem" in read) throw new Error(read.problem);
98
+ return read.settings;
99
+ };
100
+ export { defaults, listPath, settingsFrom, settingsOf, settingsPath };
@@ -3,8 +3,8 @@ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "
3
3
  import { pid } from "node:process";
4
4
  import { dirname, join } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
- import { parseAst } from "vite-plus";
7
6
  import { createHash } from "node:crypto";
7
+ import { parseAst } from "vite-plus";
8
8
  import { deserialize, serialize } from "node:v8";
9
9
  // src/symbols/symbols.ts
10
10
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ref0/workspace",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "The lint and workspace checks every ref-0 repo shares",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -28,6 +28,14 @@
28
28
  "./lint/plugins": {
29
29
  "types": "./dist/lint/plugins.d.mts",
30
30
  "import": "./dist/lint/plugins.mjs"
31
+ },
32
+ "./lint/graph": {
33
+ "types": "./dist/lint/graph.d.mts",
34
+ "import": "./dist/lint/graph.mjs"
35
+ },
36
+ "./review-record": {
37
+ "types": "./dist/review-record/index.d.mts",
38
+ "import": "./dist/review-record/index.mjs"
31
39
  }
32
40
  },
33
41
  "publishConfig": {