@autotelic/joggle 0.1.2 → 0.2.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
@@ -447,6 +447,12 @@ joggle check # nothing changed: the previo
447
447
  joggle cache prune --max-age 90 # the cache is regenerable; keep it small
448
448
  ```
449
449
 
450
+ `--update-baseline` refuses while any candidate was not judged
451
+ (`unreadable`, `no_evidence`, or past a budget): a baseline is the record of
452
+ what a person reviewed, and one written over unjudged candidates ratifies what
453
+ nobody looked at. `--allow-unjudged-baseline` is the explicit override; `jig
454
+ init` passes it, because a ledger born on day one has no review to protect yet.
455
+
450
456
  The baseline is by identity, not by line: rule, kept symbol and cluster
451
457
  membership. Code moves constantly, and a baseline that reports every edit as a
452
458
  new finding is a baseline nobody reads. A rename or a new member does change the
@@ -34,11 +34,30 @@ const singleFile = (path, dir) => path.join(dir, "answers.json");
34
34
  *
35
35
  * Git reads a `.gitattributes` in a subdirectory and applies its patterns
36
36
  * relative to that directory, so joggle can own the treatment of its own files
37
- * without touching the repository's top-level file. `-diff` keeps the shards out
38
- * of a diff (they are generated), `linguist-generated` keeps them out of GitHub
39
- * language stats, and `merge=joggle-answers` names the merge driver.
37
+ * without touching the repository's top-level file.
38
+ *
39
+ * `merge=union` rather than a custom driver: git cannot ship a merge driver in
40
+ * `.gitattributes`, so `merge=joggle-answers` only works on a machine where
41
+ * somebody registered it by hand -- and a fresh clone silently got the default
42
+ * merge instead. Union needs no registration and is correct for an append-only,
43
+ * key-sorted JSONL. `joggle merge-answers` remains available for repositories
44
+ * that want newer-timestamp-wins on a same-key collision, but the committed
45
+ * shape no longer depends on it.
46
+ *
47
+ * No `-diff` and no `linguist-generated`: the ledger's justification is that a
48
+ * maintainer reviewed the verdicts, and those attributes made it a binary blob
49
+ * that GitHub collapses. A verdict change should be one visible line.
40
50
  */
41
- const ATTRIBUTES = "answers/*.jsonl merge=joggle-answers linguist-generated -diff\n" +
51
+ const ATTRIBUTES = "answers/*.jsonl merge=union\n" +
52
+ "answers.json merge=union\n";
53
+ /**
54
+ * The banner earlier versions wrote.
55
+ *
56
+ * Rewritten in place because it is byte-identical to what joggle generated, so
57
+ * this is a migration rather than an edit of a file a person may have changed.
58
+ * A file with any other content is left alone.
59
+ */
60
+ const LEGACY_ATTRIBUTES = "answers/*.jsonl merge=joggle-answers linguist-generated -diff\n" +
42
61
  "answers.json linguist-generated -diff\n";
43
62
  /** The shape of the single file, read once for the migration. */
44
63
  const SingleFile = Schema.Struct({
@@ -192,6 +211,12 @@ export const make = (fs, path, dir) => Effect.gen(function* () {
192
211
  if (!(yield* exists(fs, attributes))) {
193
212
  yield* fs.writeFileString(attributes, ATTRIBUTES).pipe(Effect.orElseSucceed(() => undefined));
194
213
  }
214
+ else {
215
+ const current = yield* readText(fs, attributes);
216
+ if (current === LEGACY_ATTRIBUTES) {
217
+ yield* fs.writeFileString(attributes, ATTRIBUTES).pipe(Effect.orElseSucceed(() => undefined));
218
+ }
219
+ }
195
220
  for (const shard of targets) {
196
221
  const entries = current.get(shard);
197
222
  if (entries === undefined)
@@ -229,6 +254,68 @@ export const make = (fs, path, dir) => Effect.gen(function* () {
229
254
  };
230
255
  });
231
256
  const sizeOf = (entry) => renderEntry(entry).length + 1;
257
+ /**
258
+ * Read every shard and count what is in it.
259
+ *
260
+ * The keys are content hashes, so there is no rule name to group by: a verdict
261
+ * cannot be attributed to a question after the fact. What IS visible is the
262
+ * verdict distribution and the labels a classified answer chose, which is what a
263
+ * reviewer opening a batch of new lines actually wants.
264
+ */
265
+ export const census = (fs, path, dir) => Effect.gen(function* () {
266
+ const target = answersDir(path, dir);
267
+ const names = yield* fs.readDirectory(target).pipe(Effect.orElseSucceed(() => []));
268
+ const kinds = new Map();
269
+ const labels = new Map();
270
+ let entries = 0;
271
+ let shards = 0;
272
+ let bytes = 0;
273
+ let skippedLines = 0;
274
+ let yes = 0;
275
+ let no = 0;
276
+ let oldest;
277
+ let newest;
278
+ for (const name of names) {
279
+ if (!name.endsWith(".jsonl"))
280
+ continue;
281
+ const file = path.join(target, name);
282
+ const text = yield* readText(fs, file);
283
+ const parsed = parseLines(text);
284
+ shards += 1;
285
+ bytes += new TextEncoder().encode(text).length;
286
+ skippedLines += parsed.skippedLines;
287
+ for (const entry of parsed.entries) {
288
+ entries += 1;
289
+ oldest = oldest === undefined ? entry.writtenAt : Math.min(oldest, entry.writtenAt);
290
+ newest = newest === undefined ? entry.writtenAt : Math.max(newest, entry.writtenAt);
291
+ kinds.set(entry.answer.kind, (kinds.get(entry.answer.kind) ?? 0) + 1);
292
+ if (entry.answer.kind === "Probability") {
293
+ if (entry.answer.probability >= 0.5)
294
+ yes += 1;
295
+ else
296
+ no += 1;
297
+ }
298
+ else {
299
+ labels.set(entry.answer.label, (labels.get(entry.answer.label) ?? 0) + 1);
300
+ }
301
+ }
302
+ }
303
+ return {
304
+ entries,
305
+ shards,
306
+ bytes,
307
+ skippedLines,
308
+ kinds: [...kinds.entries()]
309
+ .sort(([left], [right]) => left.localeCompare(right))
310
+ .map(([kind, count]) => ({ kind, count })),
311
+ verdicts: { yes, no },
312
+ labels: [...labels.entries()]
313
+ .sort(([left, leftCount], [right, rightCount]) => rightCount - leftCount || left.localeCompare(right))
314
+ .map(([label, count]) => ({ label, count })),
315
+ oldest,
316
+ newest,
317
+ };
318
+ });
232
319
  /**
233
320
  * Drop cache entries and rewrite only the shards that changed.
234
321
  *
package/dist/check.js CHANGED
@@ -20,6 +20,14 @@ import { Service as Tsgo } from "./tsgo.js";
20
20
  import { applyDeclarationTypes, discoverFiles, loadWorkspace } from "./workspace.js";
21
21
  import { contentMappersOf } from "./content-mappers.js";
22
22
  import { looksLikeSource } from "./source.js";
23
+ /**
24
+ * The drop stages that mean nobody judged the candidate.
25
+ *
26
+ * `declined` is the model looking and saying no; `gated` is a judgement below the
27
+ * threshold. Both are answers. These three are not, and a baseline that lists their
28
+ * consequences is a record of something that never happened.
29
+ */
30
+ const UNJUDGED_STAGES = new Set(["unreadable", "no_evidence", "budget"]);
23
31
  const reasonOf = (error) => error.message;
24
32
  const typecheckFindings = (output) => output.map((diagnostic) => finding({
25
33
  ruleId: "joggle/typecheck",
@@ -187,25 +195,45 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
187
195
  const hashOf = new Map(files.map((file) => [path.relative(options.cwd, file), shortHash(contents.get(file) ?? "")]));
188
196
  const finish = (report) => Effect.gen(function* () {
189
197
  let diagnostics = report.diagnostics;
190
- let note;
198
+ const notes = [];
191
199
  if (options.baselinePath !== undefined) {
192
200
  const known = yield* readBaseline(fs, path, baselinePath(path, options.baselinePath));
193
201
  if (known !== undefined) {
194
202
  const before = diagnostics.length;
195
203
  diagnostics = diagnostics.filter((entry) => entry.identity === undefined || !known.has(entry.identity));
196
- note = {
204
+ notes.push({
197
205
  ruleId: "joggle",
198
206
  reason: `${before - diagnostics.length} finding(s) already in the baseline were not reported`,
199
- };
207
+ });
200
208
  }
201
209
  }
210
+ // The census line the budget used to lack: a run that stopped judging says HOW MANY
211
+ // candidates nobody looked at, so it is one number to read rather than a count per
212
+ // rule to add up. `declined` is an answer and is not in here.
213
+ const unjudged = report.drops.filter((drop) => UNJUDGED_STAGES.has(drop.stage)).length;
214
+ if (unjudged > 0) {
215
+ notes.push({
216
+ ruleId: "joggle",
217
+ reason: `${unjudged} candidate(s) were not judged (unreadable, no evidence, or past the budget); a baseline written now would ratify what nobody looked at`,
218
+ });
219
+ }
202
220
  if (options.updateBaselinePath !== undefined) {
221
+ if (unjudged > 0 && options.allowUnjudgedBaseline !== true) {
222
+ return yield* WorkspaceError.make({
223
+ path: options.updateBaselinePath,
224
+ operation: "baseline",
225
+ cause: new Error(`refusing to write ${options.updateBaselinePath}: ${unjudged} candidate(s) were not judged. ` +
226
+ "Pass --allow-unjudged-baseline to accept that, or judge the run first."),
227
+ });
228
+ }
203
229
  const identities = report.diagnostics
204
230
  .map((entry) => entry.identity)
205
231
  .filter((identity) => identity !== undefined);
206
232
  yield* writeBaseline(fs, path, baselinePath(path, options.updateBaselinePath), identities);
207
233
  }
208
- return note === undefined ? { ...report, diagnostics } : { ...report, diagnostics, notes: [...report.notes, note] };
234
+ return notes.length === 0
235
+ ? { ...report, diagnostics }
236
+ : { ...report, diagnostics, notes: [...report.notes, ...notes] };
209
237
  });
210
238
  const runCache = options.runCacheDir ?? options.cacheDir;
211
239
  const stored = yield* readStored(fs, path, runCache);
package/dist/config.js CHANGED
@@ -122,6 +122,17 @@ export const JoggleConfig = Schema.Struct({
122
122
  * extensions it can parse, and says which declared ones it did not.
123
123
  */
124
124
  runExternalCode: Schema.optionalKey(Schema.Boolean),
125
+ /**
126
+ * The run's judgement budget, in the file rather than in a shell history.
127
+ *
128
+ * `--max-tokens` was the only place to say it, so CI and a local run disagreed
129
+ * unless every invocation remembered the flag. This is the same number, read
130
+ * where the rest of the run's decisions live; an explicit flag still wins.
131
+ */
132
+ decision: Schema.optionalKey(Schema.Struct({
133
+ /** Input tokens one run may spend on judgement. */
134
+ maxInputTokens: Schema.optionalKey(Schema.Finite),
135
+ })),
125
136
  evidence: Schema.optionalKey(Schema.Struct({
126
137
  /**
127
138
  * The repository's architecture, in the repository's own words.
package/dist/main.js CHANGED
@@ -5,7 +5,7 @@ import * as FetchHttpClient from "effect/http/FetchHttpClient";
5
5
  import { NodeRuntime, NodeServices } from "@effect/platform-node";
6
6
  import { checkRepository } from "./check.js";
7
7
  import { layer as decisionLayer } from "./decision.js";
8
- import { make as makeAnswerStore, mergeShardText, prune as pruneAnswers } from "./answer-store.js";
8
+ import { census as censusAnswers, make as makeAnswerStore, mergeShardText, prune as pruneAnswers, } from "./answer-store.js";
9
9
  import { ask } from "./ask.js";
10
10
  import { cacheDirFor, runCacheDirFor, shortHash } from "./state.js";
11
11
  import { canonical } from "./canonical.js";
@@ -76,7 +76,7 @@ const checkCommand = Command.make("check", {
76
76
  maxWarnings: Flag.Int("max-warnings").pipe(Flag.withDescription("Exit non-zero when warnings exceed this count (-1 disables)."), Flag.withDefault(-1)),
77
77
  typecheck: Flag.Boolean("typecheck").pipe(Flag.withDescription("Include tsgo's own diagnostics as joggle/typecheck."), Flag.withDefault(false)),
78
78
  types: Flag.Boolean("types").pipe(Flag.withDescription("Resolve declaration types through tsgo's trace (enables type-aware rules)."), Flag.withDefault(false)),
79
- maxTokens: Flag.Int("max-tokens").pipe(Flag.withDescription("Input-token budget for judgement in this run."), Flag.withDefault(policy.decision.maxInputTokens)),
79
+ maxTokens: Flag.Int("max-tokens").pipe(Flag.withDescription("Input-token budget for judgement in this run (overrides decision.maxInputTokens)."), Flag.optional),
80
80
  offline: Flag.Boolean("offline").pipe(Flag.withDescription("Answer only from the committed judgement cache; never call the model."), Flag.withDefault(false)),
81
81
  noTsgo: Flag.Boolean("no-tsgo").pipe(Flag.withDescription("Never invoke tsgo; walk the paths on disk instead."), Flag.withDefault(false)),
82
82
  runExternalCode: Flag.Boolean("run-external-code").pipe(Flag.withDescription("Allow tsc to execute content-mapper packages declared in tsconfig (TypeScript 7.1+). Off by default: a mapper is arbitrary code."), Flag.withDefault(false)),
@@ -87,6 +87,7 @@ const checkCommand = Command.make("check", {
87
87
  prNumber: Flag.String("pr-number").pipe(Flag.withDescription("Scope to a specific pull request, by number or URL."), Flag.optional),
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
+ 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)),
90
91
  cacheDir: Flag.String("cache-dir").pipe(Flag.withDescription("Where the answer cache lives: <cwd>/.joggle when it exists (an onboarded repository), otherwise the machine cache."), Flag.optional),
91
92
  cwd: Flag.String("cwd").pipe(Flag.withDescription("Project root to analyse (default: the current directory)."), Flag.optional),
92
93
  config: Flag.String("config").pipe(Flag.withDescription("Config file, relative to the project root (default joggle.config.json)."), Flag.optional),
@@ -143,7 +144,7 @@ const checkCommand = Command.make("check", {
143
144
  rules,
144
145
  typecheck: config.typecheck,
145
146
  types: config.types ? "trace" : "off",
146
- maxInputTokens: config.maxTokens,
147
+ maxInputTokens: Option.getOrUndefined(config.maxTokens) ?? effective.decision?.maxInputTokens,
147
148
  useTsgo: !config.noTsgo,
148
149
  runExternalCode: config.runExternalCode || effective.runExternalCode === true,
149
150
  cacheDirExplicit: Option.isSome(config.cacheDir),
@@ -161,6 +162,7 @@ const checkCommand = Command.make("check", {
161
162
  changedBase,
162
163
  baselinePath: Option.getOrUndefined(config.baseline),
163
164
  updateBaselinePath: Option.getOrUndefined(config.updateBaseline),
165
+ allowUnjudgedBaseline: config.allowUnjudgedBaseline,
164
166
  }).pipe(Effect.provide(Layer.mergeAll(rulesLayer, decisionLayer({ cacheDir, wireCacheDir: machineCache, offline: config.offline, apiKey }), tsgoLayer(cwd, {
165
167
  runExternalCode: config.runExternalCode || effective.runExternalCode === true,
166
168
  }))));
@@ -550,6 +552,32 @@ const cachePrune = Command.make("prune", {
550
552
  description: "Cap the committed cache, oldest answers first.",
551
553
  },
552
554
  ]));
555
+ const cacheReport = Command.make("report", {
556
+ cwd: Flag.String("cwd").pipe(Flag.withDescription("Project root whose cache to report (default: the current directory)."), Flag.optional),
557
+ cacheDir: Flag.String("cache-dir").pipe(Flag.withDescription("Where the answer cache lives: <cwd>/.joggle when it exists, otherwise the machine cache."), Flag.optional),
558
+ }, (config) => Effect.gen(function* () {
559
+ const fs = yield* FileSystem.FileSystem;
560
+ const path = yield* Path.Path;
561
+ const cwd = path.resolve(Option.getOrUndefined(config.cwd) ?? process.cwd());
562
+ const dir = yield* cacheDirFor(cwd, Option.getOrUndefined(config.cacheDir));
563
+ const found = yield* censusAnswers(fs, path, dir);
564
+ const date = (seconds) => seconds === undefined ? "never" : new Date(seconds * 1000).toISOString().slice(0, 10);
565
+ const kinds = found.kinds.map((entry) => entry.kind + " " + String(entry.count)).join(", ");
566
+ const labels = found.labels
567
+ .slice(0, 8)
568
+ .map((entry) => entry.label + " " + String(entry.count))
569
+ .join(", ");
570
+ yield* write([
571
+ "joggle: " + found.entries + " entries in " + found.shards + " shard(s), " + found.bytes + " bytes",
572
+ " kinds " + (kinds === "" ? "none" : kinds),
573
+ " verdicts Probability " + found.verdicts.yes + " yes / " + found.verdicts.no + " no",
574
+ " labels " + (labels === "" ? "none" : labels),
575
+ " written " + date(found.oldest) + " .. " + date(found.newest),
576
+ ...(found.skippedLines === 0 ? [] : [" skipped " + found.skippedLines + " unreadable line(s)"]),
577
+ ].join("\n"));
578
+ })).pipe(Command.withDescription("Render the committed answer ledger for a reader: entry and shard counts, verdict distribution, labels, and the date range. A summary cannot be replayed; this is what to read when reviewing the diff."), Command.withShortDescription("Report on the answer cache."), Command.withExamples([
579
+ { command: "joggle cache report", description: "Count what the committed ledger holds." },
580
+ ]));
553
581
  const cacheMigrate = Command.make("migrate", {
554
582
  cwd: Flag.String("cwd").pipe(Flag.withDescription("Project root whose cache to migrate (default: the current directory)."), Flag.optional),
555
583
  cacheDir: Flag.String("cache-dir").pipe(Flag.withDescription("Where the answer cache lives: <cwd>/.joggle when it exists, otherwise the machine cache."), Flag.optional),
@@ -562,7 +590,7 @@ const cacheMigrate = Command.make("migrate", {
562
590
  const written = yield* store.migrate;
563
591
  yield* write("joggle: wrote " + written + " answer(s) to " + path.join(dir, "answers"));
564
592
  })).pipe(Command.withDescription("Rewrite the cache in the sharded shape, and remove a legacy answers.json. Idempotent."), Command.withShortDescription("Migrate the cache to shards."));
565
- const cacheCommand = Command.make("cache", {}, () => write("joggle cache: run `joggle cache prune`, or read docs/artifacts.md for the layout.")).pipe(Command.withDescription("Work on the answer cache itself: prune it, migrate it, and see how it is laid out."), Command.withShortDescription("Prune the answer cache."), Command.withSubcommands([cachePrune, cacheMigrate]));
593
+ const cacheCommand = Command.make("cache", {}, () => write("joggle cache: run `joggle cache prune`, or read docs/artifacts.md for the layout.")).pipe(Command.withDescription("Work on the answer cache itself: prune it, migrate it, and see how it is laid out."), Command.withShortDescription("Prune the answer cache."), Command.withSubcommands([cachePrune, cacheMigrate, cacheReport]));
566
594
  const cli = Command.make("joggle").pipe(Command.withDescription("Cross-file patterns and idioms for TypeScript, enforced like a linter: deterministic where it can prove, System One where it has to judge."), Command.withExamples([
567
595
  {
568
596
  command: "joggle check --pr",
package/dist/tsgo.js CHANGED
@@ -1,6 +1,7 @@
1
- import { Context, Effect, FileSystem, Layer, Order, Path, Stream } from "effect";
1
+ import { Context, Effect, FileSystem, Layer, Option, Order, Path, Stream } from "effect";
2
2
  import { ChildProcess } from "effect/process";
3
- import { resolve, sep } from "node:path";
3
+ import { realpathSync } from "node:fs";
4
+ import { relative, resolve, sep } from "node:path";
4
5
  import { TsgoError } from "./schema.js";
5
6
  import { looksLikeSource } from "./source.js";
6
7
  /**
@@ -29,17 +30,37 @@ const run = ({ binary, args, cwd, }) => Effect.scoped(Effect.gen(function* () {
29
30
  operation: `tsc ${args.join(" ")}`,
30
31
  detail: cause instanceof Error ? cause.message : String(cause),
31
32
  })));
33
+ /** A path with every symlink in it resolved, or the lexical path when it does not exist. */
34
+ const realPathOf = (file) => {
35
+ // SAFETY: `realpathSync` is the only API that resolves symlinks, and it throws for a
36
+ // path that does not exist yet. The lexical path is the right fallback there: the file is
37
+ // absent either way, so `inRoot` rejects it on the same comparison.
38
+ try {
39
+ return realpathSync(file);
40
+ }
41
+ catch {
42
+ return resolve(file);
43
+ }
44
+ };
32
45
  /**
33
- * Whether the compiler's absolute path is inside the analysed root.
46
+ * The compiler's file, expressed under the caller's root, or undefined when it is outside.
47
+ *
48
+ * The comparison happens on REAL paths because the compiler prints the path it resolved:
49
+ * invoked with a cwd of `/tmp/x`, where `/tmp` is a symlink to `/private/tmp`, tsgo lists
50
+ * `/private/tmp/x/src/a.ts`. A lexical `startsWith` on the caller's `/tmp/x` rejected every
51
+ * file, so the run reported "tsgo listed no source files" and analysed nothing -- silently,
52
+ * for anyone whose checkout lives under a symlinked path.
34
53
  *
35
- * Resolved on both sides: the root can be relative (it was, at the CLI
36
- * boundary, before it was normalized), and `startsWith` on raw strings also
37
- * accepts a sibling whose name merely begins with the root.
54
+ * The path handed back is in the caller's namespace (`resolve(cwd, relative(realRoot, file))`)
55
+ * so every later comparison -- git's changed files, `path.relative`, the report's locations --
56
+ * keeps using one spelling of the tree.
38
57
  */
39
- const underRoot = ({ cwd, file }) => {
40
- const root = resolve(cwd);
41
- const candidate = resolve(file);
42
- return candidate === root || candidate.startsWith(root + sep);
58
+ const inRoot = ({ cwd, file }) => {
59
+ const root = realPathOf(cwd);
60
+ const candidate = realPathOf(file);
61
+ if (candidate === root || !candidate.startsWith(root + sep))
62
+ return Option.none();
63
+ return Option.some(resolve(cwd, relative(root, candidate)));
43
64
  };
44
65
  const parseDiagnostics = (output) => {
45
66
  const found = [];
@@ -80,7 +101,7 @@ const parseDiagnostics = (output) => {
80
101
  * cloned repository cannot make an agent execute code by declaring a mapper.
81
102
  */
82
103
  export const compilerArgs = (args, runExternalCode) => (runExternalCode ? ["--runExternalCode", ...args] : args);
83
- const make = (binary, path, runExternalCode) => {
104
+ const make = (binary, runExternalCode) => {
84
105
  const listFiles = Effect.fn("Tsgo.listFiles")(function* (cwd) {
85
106
  const result = yield* run({ binary, args: compilerArgs(["--listFilesOnly"], runExternalCode), cwd });
86
107
  const files = new Set();
@@ -88,9 +109,10 @@ const make = (binary, path, runExternalCode) => {
88
109
  const file = raw.trim();
89
110
  if (!looksLikeSource(file))
90
111
  continue;
91
- if (!underRoot({ cwd, file }))
112
+ const rooted = inRoot({ cwd, file });
113
+ if (Option.isNone(rooted))
92
114
  continue;
93
- files.add(path.resolve(file));
115
+ files.add(rooted.value);
94
116
  }
95
117
  return [...files].sort(Order.String);
96
118
  });
@@ -116,12 +138,12 @@ const make = (binary, path, runExternalCode) => {
116
138
  * project root. Everything else about the adapter is a plain subprocess
117
139
  * boundary: build args, run, parse, map failures to a typed error.
118
140
  */
119
- export const layer = (binary, options = {}) => Layer.effect(Service, Effect.map(Path.Path, (path) => make(binary, path, options.runExternalCode ?? false)));
141
+ export const layer = (binary, options = {}) => Layer.effect(Service, Effect.map(Path.Path, () => make(binary, options.runExternalCode ?? false)));
120
142
  /** Resolve the project's own compiler, falling back to PATH. */
121
143
  export const layerFromConfig = (root, options = {}) => Layer.effect(Service, Effect.gen(function* () {
122
144
  const fs = yield* FileSystem.FileSystem;
123
145
  const path = yield* Path.Path;
124
146
  const local = path.join(root, "node_modules", ".bin", "tsc");
125
147
  const resolved = (yield* Effect.orElseSucceed(fs.exists(local), () => false)) ? local : "tsc";
126
- return make(resolved, path, options.runExternalCode ?? false);
148
+ return make(resolved, options.runExternalCode ?? false);
127
149
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autotelic/joggle",
3
- "version": "0.1.2",
3
+ "version": "0.2.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",