@autotelic/joggle 0.7.1 → 0.8.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.
package/JOGGLE.md CHANGED
@@ -432,6 +432,17 @@ and every CI checkout. GitHub warns above **50 MB per file** and refuses above
432
432
  `--max-age 90` needs ages, which only the machine cache records.
433
433
  - A run says so when the store passes 8 MB, because a cache nobody measured is how
434
434
  a 0-byte ledger on the base branch becomes 55 MB at the top of a stack.
435
+ - **Build output is never source.** The directory walk skips `node_modules`, `dist`,
436
+ `build`, `out`, `coverage`, `.next`, `.turbo`, `.vercel`, `.cache` and anything a
437
+ `.gitignore` excludes, and the checker's file list (under `--types`) is filtered the same
438
+ way. Without that, a tsconfig that includes `dist` made every declaration appear twice, and
439
+ the report said "declared in two places" about a build artifact — 73 of 95 findings on one
440
+ repository, present on a developer's machine and absent in CI because CI had never built.
441
+ - **The analysed set is machine-readable.** `--format json` carries a `discovery` block —
442
+ files analysed, files and directories ignored, extensions skipped, whether the walk was
443
+ truncated — and `--list-files` adds the paths. Two checkouts of one commit that report
444
+ different findings differ either in that set or in its verdicts, and the JSON used to show
445
+ neither: the census was prose and the list was never emitted.
435
446
  - **A run says how it got its answers.** "N judgement(s) were asked of the model" means a
436
447
  key was present and this run judged for itself; "N judgement(s) were replayed" means no model
437
448
  was called. The two can name the same site differently, so a local report and a CI report at
package/dist/check.js CHANGED
@@ -908,6 +908,18 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
908
908
  duplicated,
909
909
  overloaded,
910
910
  };
911
+ const seen = {
912
+ analysed: workspace.files.length,
913
+ ignored: discovery.ignored,
914
+ ignoredDirectories: discovery.ignoredDirectories,
915
+ truncated: discovery.truncated,
916
+ skippedExtensions: discovery.skippedExtensions,
917
+ };
918
+ // Only when asked: the list is thousands of lines, and the reason to ask is exactly "diff
919
+ // these two trees".
920
+ if (options.listFiles === true) {
921
+ Object.assign(seen, { paths: workspace.files.map((file) => file.path).sort(Order.String) });
922
+ }
911
923
  const decisionTotals = yield* decisionStats.read;
912
924
  // Say how the answers were obtained. A keyed run judges live and a keyless one replays,
913
925
  // and the two can name the same site differently — which is the whole difference between
@@ -933,6 +945,7 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
933
945
  files: workspace.files.length,
934
946
  rules: effective.length,
935
947
  structure,
948
+ discovery: seen,
936
949
  skipped,
937
950
  notes,
938
951
  drops,
package/dist/main.js CHANGED
@@ -88,6 +88,7 @@ const checkCommand = Command.make("check", {
88
88
  baseline: Flag.String("baseline").pipe(Flag.withDescription("Report only findings not already accepted in this baseline file."), Flag.optional),
89
89
  updateBaseline: Flag.String("update-baseline").pipe(Flag.withDescription("Write the current findings to this file as the accepted baseline."), Flag.optional),
90
90
  mergeBaseline: Flag.Boolean("merge-baseline").pipe(Flag.withDescription("With --update-baseline, keep the identities already in that file and add this run's. A scoped run (--since) judges all of its own files, so this grows a ledger by one change instead of replacing it."), Flag.withDefault(false)),
91
+ listFiles: Flag.Boolean("list-files").pipe(Flag.withDescription("Include the analysed file paths in the report's discovery block (--format json). The only honest way to answer why two checkouts of one commit report different findings is to diff their file lists."), Flag.withDefault(false)),
91
92
  readOnly: Flag.Boolean("read-only").pipe(Flag.withDescription("Answer from the cache and never write it. Set for every engine jig runs: a check must not edit the tree it judges, because new answers rename the findings they verify."), Flag.withDefault(false)),
92
93
  allowScopedBaseline: Flag.Boolean("allow-scoped-baseline").pipe(Flag.withDescription("Write a ledger from a scoped run. Refused by default: a scoped run's identities are not a subset of a full run's, so the ledger can miss the identity CI reports. Accept from a full run instead."), Flag.withDefault(false)),
93
94
  allowUnjudgedBaseline: Flag.Boolean("allow-unjudged-baseline").pipe(Flag.withDescription("Write the baseline even though some candidates were not judged. A baseline is what was reviewed; this is the explicit way to accept that some of it was not."), Flag.withDefault(false)),
@@ -179,6 +180,7 @@ const checkCommand = Command.make("check", {
179
180
  allowUnjudgedBaseline: config.allowUnjudgedBaseline,
180
181
  mergeBaseline: config.mergeBaseline,
181
182
  allowScopedBaseline: config.allowScopedBaseline,
183
+ listFiles: config.listFiles,
182
184
  }).pipe(Effect.provide(Layer.mergeAll(rulesLayer, decisionLayer({
183
185
  cacheDir,
184
186
  wireCacheDir: machineCache,
package/dist/report.js CHANGED
@@ -432,6 +432,7 @@ const json = (report) => JSON.stringify({
432
432
  // artifact that hid where the candidates went -- and reading it is how the
433
433
  // gated band below was found.
434
434
  drops: report.drops,
435
+ discovery: report.discovery,
435
436
  },
436
437
  }, null, 2);
437
438
  /** GitHub Actions workflow commands, so CI annotations come for free. */
package/dist/workspace.js CHANGED
@@ -1760,11 +1760,22 @@ export const discoverFiles = (root, inputs, discovered) => discovered !== undefi
1760
1760
  const inScope = yield* tsconfigScope(root);
1761
1761
  const walked = yield* resolveInputs(root, ["."]);
1762
1762
  const astro = walked.files.filter((file) => isAstro(file) && inScope(path.relative(root, file).split(path.sep).join("/")));
1763
+ // The checker's file list is a tsconfig's include, and a tsconfig's include is not a
1764
+ // judgement about what is source: `packages/*/dist` is inside the program when a
1765
+ // declaration is emitted there. Analysing it reads every declaration twice — once as
1766
+ // written, once as built — and reports "Query is declared in two places" about a
1767
+ // build artifact. 73 of 95 findings on one repository were exactly that, and the
1768
+ // walk has always known better (`policy.ignoredDirectories`); this list did not.
1769
+ const keep = (file) => !path
1770
+ .relative(root, file)
1771
+ .split(path.sep)
1772
+ .some((segment) => ignored.has(segment));
1773
+ const files = discovered.filter(keep);
1763
1774
  return {
1764
- files: [...discovered, ...astro].sort(Order.String),
1775
+ files: [...files, ...astro.filter(keep)].sort(Order.String),
1765
1776
  skippedExtensions: [],
1766
1777
  truncated: walked.truncated,
1767
- ignored: 0,
1778
+ ignored: discovered.length - files.length,
1768
1779
  ignoredDirectories: 0,
1769
1780
  };
1770
1781
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autotelic/joggle",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Cross-file patterns and idioms for TypeScript — the layer above the linter and the typechecker.",
6
6
  "license": "MIT",