ushman-ledger 0.3.0 → 1.1.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +4 -14
  2. package/README.md +8 -56
  3. package/dist/archive-journal.d.ts +29 -18
  4. package/dist/archive-journal.d.ts.map +1 -1
  5. package/dist/archive-journal.js +17 -17
  6. package/dist/builders.d.ts +52 -374
  7. package/dist/builders.d.ts.map +1 -1
  8. package/dist/builders.js +10 -60
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +8 -14
  11. package/dist/handle.d.ts +2 -2
  12. package/dist/handle.d.ts.map +1 -1
  13. package/dist/handle.js +1 -14
  14. package/dist/index.d.ts +3 -5
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -4
  17. package/dist/lab-min.d.ts +7 -7
  18. package/dist/lab-min.d.ts.map +1 -1
  19. package/dist/lab-min.js +7 -9
  20. package/dist/list.d.ts +84 -325
  21. package/dist/list.d.ts.map +1 -1
  22. package/dist/read-index.d.ts +45 -57
  23. package/dist/read-index.d.ts.map +1 -1
  24. package/dist/read-index.js +16 -34
  25. package/dist/record.d.ts.map +1 -1
  26. package/dist/record.js +27 -114
  27. package/dist/recovery.d.ts +19 -8
  28. package/dist/recovery.d.ts.map +1 -1
  29. package/dist/recovery.js +13 -13
  30. package/dist/render/retro.d.ts.map +1 -1
  31. package/dist/render/retro.js +1 -4
  32. package/dist/schema/entry.d.ts +1365 -3291
  33. package/dist/schema/entry.d.ts.map +1 -1
  34. package/dist/schema/entry.js +184 -516
  35. package/dist/schema/manifest.d.ts +28 -41
  36. package/dist/schema/manifest.d.ts.map +1 -1
  37. package/dist/schema/manifest.js +20 -24
  38. package/dist/schema/note.d.ts +3 -9
  39. package/dist/schema/note.d.ts.map +1 -1
  40. package/dist/schema/note.js +2 -2
  41. package/dist/storage/filesystem.d.ts +0 -1
  42. package/dist/storage/filesystem.d.ts.map +1 -1
  43. package/dist/storage/filesystem.js +4 -4
  44. package/package.json +3 -4
package/dist/cli.js CHANGED
@@ -5,14 +5,14 @@ import os from 'node:os';
5
5
  import path from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { promisify } from 'node:util';
8
- import { ZodError } from 'zod';
8
+ import * as v from 'valibot';
9
9
  import { openLedger } from "./handle.js";
10
10
  import { LEDGER_KINDS, LEDGER_PHASES, parseLedgerRecord } from "./schema/entry.js";
11
11
  import { NoteSubkindSchema } from "./schema/note.js";
12
12
  import { LEDGER_LIBRARY_VERSION } from "./version.js";
13
13
  const execFileAsync = promisify(execFile);
14
14
  const GIT_DIFF_TIMEOUT_MS = 30_000;
15
- const RENDER_TARGETS = ['retro', 'jsonl', 'timeline-html', 'dependency-graph', 'analytics-summary'];
15
+ const RENDER_TARGETS = ['retro', 'jsonl', 'timeline-html', 'dependency-graph'];
16
16
  class CliUsageError extends Error {
17
17
  }
18
18
  const DEFAULT_CONTEXT = {
@@ -39,7 +39,7 @@ Commands:
39
39
  ${commandName} list [--workspace=<ws>] [--phase=<phase>] [--kind=<kind>] [--since=<iso>] [--limit=<n>] [--json]
40
40
  ${commandName} show [--workspace=<ws>] <entry-id>
41
41
  ${commandName} tail [--workspace=<ws>] [--phase=<phase>] [--limit=<n>]
42
- ${commandName} render [--workspace=<ws>] [--to=retro|jsonl|timeline-html|dependency-graph|analytics-summary] [--phase=<phase>] [--out=<file>] [--fresh] [--json]
42
+ ${commandName} render [--workspace=<ws>] [--to=retro|jsonl|timeline-html|dependency-graph] [--phase=<phase>] [--out=<file>]
43
43
  ${commandName} archive [--workspace=<ws>] --out=<file.tgz>
44
44
  ${commandName} doctor [--workspace=<ws>]
45
45
  ${commandName} --version
@@ -60,9 +60,7 @@ ${renderValidValues()}`;
60
60
 
61
61
  ${renderValidValues()}`;
62
62
  case 'render':
63
- return `${commandName} render [--workspace=<ws>] [--to=<target>] [--phase=<phase>] [--out=<file>] [--fresh] [--json]
64
-
65
- Use \`--fresh\` to bypass the cached analytics summary. \`--json\` remains a compatibility alias for the same behavior.
63
+ return `${commandName} render [--workspace=<ws>] [--to=<target>] [--phase=<phase>] [--out=<file>]
66
64
 
67
65
  ${renderValidValues()}`;
68
66
  default:
@@ -462,13 +460,8 @@ const runTailCli = async (parsed, context) => runListCli({
462
460
  }, context);
463
461
  const runRenderCli = async (parsed, context) => {
464
462
  const target = parseRenderTarget(parsed.flags);
465
- const wantsFresh = hasFlag(parsed.flags, 'fresh') || hasFlag(parsed.flags, 'json');
466
- if (wantsFresh && target !== 'analytics-summary') {
467
- throw new CliUsageError('--fresh and --json are only supported for render --to=analytics-summary.');
468
- }
469
463
  const ledger = await openLedger(getWorkspaceRoot(parsed.flags));
470
464
  const content = await ledger.render({
471
- fresh: wantsFresh,
472
465
  out: getFlag(parsed.flags, 'out'),
473
466
  phase: parseOptionalPhase(parsed.flags),
474
467
  to: target,
@@ -501,10 +494,11 @@ const formatCliError = (error) => {
501
494
  if (error instanceof CliUsageError) {
502
495
  return error.message;
503
496
  }
504
- if (error instanceof ZodError) {
497
+ if (v.isValiError(error)) {
505
498
  return error.issues
506
499
  .map((issue) => {
507
- const pathLabel = issue.path.length > 0 ? issue.path.join('.') : 'input';
500
+ const pathSegments = issue.path?.map((segment) => String(segment.key)) ?? [];
501
+ const pathLabel = pathSegments.length > 0 ? pathSegments.join('.') : 'input';
508
502
  return `${pathLabel}: ${issue.message}`;
509
503
  })
510
504
  .join('\n');
@@ -557,6 +551,6 @@ if (isDirectExecution()) {
557
551
  process.exit(code);
558
552
  }, (error) => {
559
553
  process.stderr.write(`${formatCliError(error)}\n`);
560
- process.exit(error instanceof CliUsageError || error instanceof ZodError ? 1 : 2);
554
+ process.exit(error instanceof CliUsageError || v.isValiError(error) ? 1 : 2);
561
555
  });
562
556
  }
package/dist/handle.d.ts CHANGED
@@ -3,6 +3,7 @@ import { runLedgerDoctor } from './doctor.ts';
3
3
  import { type LedgerFilter } from './list.ts';
4
4
  import { appendNote, type NoteBody } from './note.ts';
5
5
  import type { LedgerEntry, LedgerPhase } from './schema/entry.ts';
6
+ export type RenderTarget = 'dependency-graph' | 'jsonl' | 'retro' | 'timeline-html';
6
7
  export type LedgerHandle = {
7
8
  readonly archive: (outPath: string) => Promise<{
8
9
  integrityHash: string;
@@ -17,10 +18,9 @@ export type LedgerHandle = {
17
18
  id: string;
18
19
  }>;
19
20
  readonly render: (options: {
20
- fresh?: boolean;
21
21
  out?: string;
22
22
  phase?: LedgerPhase;
23
- to: 'analytics-summary' | 'dependency-graph' | 'jsonl' | 'retro' | 'timeline-html';
23
+ to: RenderTarget;
24
24
  }) => Promise<string>;
25
25
  readonly show: (entryId: string) => Promise<LedgerEntry | null>;
26
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAA8B,KAAK,YAAY,EAAe,MAAM,WAAW,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAwDlE,MAAM,MAAM,YAAY,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,QAAQ,CAAC,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;IACrF,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;IAC5E,QAAQ,CAAC,IAAI,EAAE,CAAC,MA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package/dist/handle.js CHANGED
@@ -6,24 +6,14 @@ import { iterateEntriesFromManifest, listEntries } from "./list.js";
6
6
  import { appendNote } from "./note.js";
7
7
  import { appendRecord, readEntryById } from "./record.js";
8
8
  import { loadLedgerState, prepareLedgerState } from "./recovery.js";
9
- import { renderAnalyticsSummary } from "./render/analytics-summary.js";
10
9
  import { renderDependencyGraph } from "./render/dependency-graph.js";
11
10
  import { renderJsonl } from "./render/jsonl.js";
12
11
  import { renderRetroMarkdown } from "./render/retro.js";
13
12
  import { renderTimelineHtml } from "./render/timeline-html.js";
14
13
  import { resolveLedgerPaths, writeAtomicTextFile } from "./storage/filesystem.js";
15
- const renderEntries = async ({ filter, target, useCache, workspaceRoot, }) => {
14
+ const renderEntries = async ({ filter, target, workspaceRoot, }) => {
16
15
  const { manifest, readIndex } = await loadLedgerState(workspaceRoot);
17
16
  switch (target) {
18
- case 'analytics-summary':
19
- return renderAnalyticsSummary({
20
- cachePath: resolveLedgerPaths(workspaceRoot).analyticsSummaryFile,
21
- entries: iterateEntriesFromManifest(workspaceRoot, manifest, readIndex, filter),
22
- filter,
23
- manifest,
24
- readIndex,
25
- useCache,
26
- });
27
17
  case 'dependency-graph':
28
18
  return renderDependencyGraph(iterateEntriesFromManifest(workspaceRoot, manifest, readIndex, filter));
29
19
  case 'jsonl':
@@ -40,8 +30,6 @@ const renderEntries = async ({ filter, target, useCache, workspaceRoot, }) => {
40
30
  const resolveRenderOutputPath = (workspaceRoot, target) => {
41
31
  const paths = resolveLedgerPaths(workspaceRoot);
42
32
  switch (target) {
43
- case 'analytics-summary':
44
- return paths.analyticsSummaryFile;
45
33
  case 'retro':
46
34
  return paths.renderFile;
47
35
  case 'timeline-html':
@@ -70,7 +58,6 @@ export const openLedger = async (workspaceRoot) => {
70
58
  const content = await renderEntries({
71
59
  filter: { phase: options.phase },
72
60
  target: options.to,
73
- useCache: options.to === 'analytics-summary' ? options.fresh !== true : false,
74
61
  workspaceRoot,
75
62
  });
76
63
  const outputPath = options.out ?? resolveRenderOutputPath(workspaceRoot, options.to);
package/dist/index.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- export { buildAgentPatchRecord, buildCorrectionRecord, buildDescopeBriefRecord, buildMergeReturnRecord, buildMergeReturnRejectedRecord, buildOperatorDecisionRecord, buildOperatorPatchRecord, buildRevertRecord, buildReworkTestRetiredRecord, buildRollbackRecord, buildStageTransitionRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from './builders.ts';
1
+ export { buildCorrectionRecord, buildOperatorDecisionRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from './builders.ts';
2
2
  export { runLedgerCli } from './cli.ts';
3
3
  export { type CoverageReport, computeCoverage } from './coverage.ts';
4
- export { type LedgerHandle, openLedger } from './handle.ts';
4
+ export { type LedgerHandle, type RenderTarget, openLedger } from './handle.ts';
5
5
  export type { LedgerFilter } from './list.ts';
6
- export { derivePatchPayloadFromDiffText, parseStructuredPatch } from './patch-metadata.ts';
7
- export { type AnalyticsSummary, AnalyticsSummarySchema } from './render/analytics-summary.ts';
8
- export { type AgentPatchDiff, AgentPatchDiffSchema, AgentPatchEntrySchema, AgentPatchRecordSchema, CorrectionEntrySchema, type CorrectionPayload, CorrectionPayloadSchema, CorrectionRecordSchema, DescopeBriefEntrySchema, type DescopeBriefPayload, DescopeBriefPayloadSchema, DescopeBriefRecordSchema, EmitterSchema, type LedgerEntry, LedgerEntrySchema, type LedgerKind, LedgerLinksSchema, type LedgerPhase, LedgerPhaseSchema, type LedgerRecord, LedgerRecordSchema, MergeReturnEntrySchema, type MergeReturnPayload, MergeReturnPayloadSchema, MergeReturnRecordSchema, MergeReturnRejectedEntrySchema, MergeReturnRejectedPayloadSchema, MergeReturnRejectedRecordSchema, NoteEntrySchema, type OperatorDecisionAction, OperatorDecisionActionSchema, OperatorDecisionEntrySchema, OperatorDecisionPayloadSchema, OperatorDecisionRecordSchema, OperatorPatchEntrySchema, OperatorPatchRecordSchema, type PatchHunk, PatchHunkSchema, type PatchPayload, PatchPayloadSchema, PatchPayloadWriteSchema, parseLedgerEntry, parseLedgerRecord, RevertEntrySchema, RevertPayloadSchema, RevertRecordSchema, ReworkTestRetiredEntrySchema, type ReworkTestRetiredPayload, ReworkTestRetiredPayloadSchema, ReworkTestRetiredRecordSchema, RollbackEntrySchema, type RollbackPayload, RollbackPayloadSchema, RollbackRecordSchema, RuntimeEventEntrySchema, StageTransitionEntrySchema, type StageTransitionPayload, StageTransitionPayloadSchema, StageTransitionRecordSchema, StripDecisionRevertedEntrySchema, type StripDecisionRevertedPayload, StripDecisionRevertedPayloadSchema, StripDecisionRevertedRecordSchema, ToolInvocationEntrySchema, ToolInvocationRecordSchema, ValidatorResultEntrySchema, ValidatorResultPayloadSchema, ValidatorResultRecordSchema, } from './schema/entry.ts';
6
+ export { type AgentPatchDiff, AgentPatchDiffSchema, AgentPatchEntrySchema, AgentPatchRecordSchema, CorrectionEntrySchema, CorrectionRecordSchema, EmitterSchema, type LedgerEntry, LedgerEntrySchema, type LedgerKind, LedgerLinksSchema, type LedgerPhase, LedgerPhaseSchema, type LedgerRecord, LedgerRecordSchema, NoteEntrySchema, type OperatorDecisionAction, OperatorDecisionActionSchema, OperatorDecisionEntrySchema, type OperatorDecisionPayload, OperatorDecisionPayloadSchema, OperatorDecisionRecordSchema, OperatorPatchEntrySchema, OperatorPatchRecordSchema, parseLedgerEntry, parseLedgerRecord, RuntimeEventEntrySchema, StripDecisionRevertedEntrySchema, type StripDecisionRevertedPayload, StripDecisionRevertedPayloadSchema, StripDecisionRevertedRecordSchema, ToolInvocationEntrySchema, ToolInvocationRecordSchema, ValidatorResultEntrySchema, ValidatorResultRecordSchema, } from './schema/entry.ts';
9
7
  export { type NoteSubkind, NoteSubkindSchema } from './schema/note.ts';
10
8
  export { resolveLedgerPaths } from './storage/filesystem.ts';
11
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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AAY,EACjB,kBAAkB,EAClB,eAAe,EACf,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,gCAAgC,EAChC,KAAK,4BAA4B,EACjC,kCAAkC,EAClC,iCAAiC,EACjC,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,7 @@
1
- export { buildAgentPatchRecord, buildCorrectionRecord, buildDescopeBriefRecord, buildMergeReturnRecord, buildMergeReturnRejectedRecord, buildOperatorDecisionRecord, buildOperatorPatchRecord, buildRevertRecord, buildReworkTestRetiredRecord, buildRollbackRecord, buildStageTransitionRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from "./builders.js";
1
+ export { buildCorrectionRecord, buildOperatorDecisionRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from "./builders.js";
2
2
  export { runLedgerCli } from "./cli.js";
3
3
  export { computeCoverage } from "./coverage.js";
4
4
  export { openLedger } from "./handle.js";
5
- export { derivePatchPayloadFromDiffText, parseStructuredPatch } from "./patch-metadata.js";
6
- export { AnalyticsSummarySchema } from "./render/analytics-summary.js";
7
- export { AgentPatchDiffSchema, AgentPatchEntrySchema, AgentPatchRecordSchema, CorrectionEntrySchema, CorrectionPayloadSchema, CorrectionRecordSchema, DescopeBriefEntrySchema, DescopeBriefPayloadSchema, DescopeBriefRecordSchema, EmitterSchema, LedgerEntrySchema, LedgerLinksSchema, LedgerPhaseSchema, LedgerRecordSchema, MergeReturnEntrySchema, MergeReturnPayloadSchema, MergeReturnRecordSchema, MergeReturnRejectedEntrySchema, MergeReturnRejectedPayloadSchema, MergeReturnRejectedRecordSchema, NoteEntrySchema, OperatorDecisionActionSchema, OperatorDecisionEntrySchema, OperatorDecisionPayloadSchema, OperatorDecisionRecordSchema, OperatorPatchEntrySchema, OperatorPatchRecordSchema, PatchHunkSchema, PatchPayloadSchema, PatchPayloadWriteSchema, parseLedgerEntry, parseLedgerRecord, RevertEntrySchema, RevertPayloadSchema, RevertRecordSchema, ReworkTestRetiredEntrySchema, ReworkTestRetiredPayloadSchema, ReworkTestRetiredRecordSchema, RollbackEntrySchema, RollbackPayloadSchema, RollbackRecordSchema, RuntimeEventEntrySchema, StageTransitionEntrySchema, StageTransitionPayloadSchema, StageTransitionRecordSchema, StripDecisionRevertedEntrySchema, StripDecisionRevertedPayloadSchema, StripDecisionRevertedRecordSchema, ToolInvocationEntrySchema, ToolInvocationRecordSchema, ValidatorResultEntrySchema, ValidatorResultPayloadSchema, ValidatorResultRecordSchema, } from "./schema/entry.js";
5
+ export { AgentPatchDiffSchema, AgentPatchEntrySchema, AgentPatchRecordSchema, CorrectionEntrySchema, CorrectionRecordSchema, EmitterSchema, LedgerEntrySchema, LedgerLinksSchema, LedgerPhaseSchema, LedgerRecordSchema, NoteEntrySchema, OperatorDecisionActionSchema, OperatorDecisionEntrySchema, OperatorDecisionPayloadSchema, OperatorDecisionRecordSchema, OperatorPatchEntrySchema, OperatorPatchRecordSchema, parseLedgerEntry, parseLedgerRecord, RuntimeEventEntrySchema, StripDecisionRevertedEntrySchema, StripDecisionRevertedPayloadSchema, StripDecisionRevertedRecordSchema, ToolInvocationEntrySchema, ToolInvocationRecordSchema, ValidatorResultEntrySchema, ValidatorResultRecordSchema, } from "./schema/entry.js";
8
6
  export { NoteSubkindSchema } from "./schema/note.js";
9
7
  export { resolveLedgerPaths } from "./storage/filesystem.js";
package/dist/lab-min.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { z } from 'zod';
2
- export declare const LabManifestMin: z.ZodObject<{
3
- createdAt: z.ZodOptional<z.ZodString>;
4
- schemaVersion: z.ZodLiteral<"ushman-lab/v4.0">;
5
- workspaceId: z.ZodString;
6
- }, z.core.$loose>;
7
- export type LabManifestMin = z.infer<typeof LabManifestMin>;
1
+ import * as v from 'valibot';
2
+ export declare const LabManifestMin: v.LooseObjectSchema<{
3
+ readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
4
+ readonly schemaVersion: v.LiteralSchema<"ushman-lab/v4.0", undefined>;
5
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
6
+ }, undefined>;
7
+ export type LabManifestMin = v.InferOutput<typeof LabManifestMin>;
8
8
  export declare const readLabManifestMin: (workspaceRoot: string) => Promise<LabManifestMin>;
9
9
  //# sourceMappingURL=lab-min.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lab-min.d.ts","sourceRoot":"","sources":["../src/lab-min.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;;iBAMT,CAAC;AAEnB,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,kBAAkB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,cAAc,CAWtF,CAAC"}
1
+ {"version":3,"file":"lab-min.d.ts","sourceRoot":"","sources":["../src/lab-min.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,eAAO,MAAM,cAAc;;;;aAIzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,cAAc,CAWtF,CAAC"}
package/dist/lab-min.js CHANGED
@@ -1,18 +1,16 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- import { z } from 'zod';
4
- export const LabManifestMin = z
5
- .object({
6
- createdAt: z.string().optional(),
7
- schemaVersion: z.literal('ushman-lab/v4.0'),
8
- workspaceId: z.string().uuid(),
9
- })
10
- .passthrough();
3
+ import * as v from 'valibot';
4
+ export const LabManifestMin = v.looseObject({
5
+ createdAt: v.optional(v.string()),
6
+ schemaVersion: v.literal('ushman-lab/v4.0'),
7
+ workspaceId: v.pipe(v.string(), v.uuid()),
8
+ });
11
9
  export const readLabManifestMin = async (workspaceRoot) => {
12
10
  const filePath = path.join(workspaceRoot, '.lab', 'lab.json');
13
11
  try {
14
12
  const text = await readFile(filePath, 'utf8');
15
- return LabManifestMin.parse(JSON.parse(text));
13
+ return v.parse(LabManifestMin, JSON.parse(text));
16
14
  }
17
15
  catch (error) {
18
16
  if (error.code === 'ENOENT') {