@codechart/core 0.1.0 → 0.7.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/dist/index.d.ts CHANGED
@@ -28,12 +28,12 @@ declare const DRIFT_CAUSES: readonly ["bug-found", "wrong-assumption", "user-ask
28
28
  type DriftCause = (typeof DRIFT_CAUSES)[number];
29
29
  declare const driftBase: {
30
30
  cause: z.ZodEnum<{
31
+ other: "other";
31
32
  "bug-found": "bug-found";
32
33
  "wrong-assumption": "wrong-assumption";
33
34
  "user-asked": "user-asked";
34
35
  "cleaner-way": "cleaner-way";
35
36
  "out-of-scope": "out-of-scope";
36
- other: "other";
37
37
  }>;
38
38
  why: z.ZodString;
39
39
  };
@@ -54,6 +54,8 @@ type ValidationResult$1<T> = {
54
54
  ok: false;
55
55
  errors: string[];
56
56
  };
57
+ /** `s` in double quotes, with control and invisible characters as `\uXXXX`, so it can't break or reorder an error line. */
58
+ declare const quotedVisible: (s: string) => string;
57
59
  declare function formatPath(path: PropertyKey[]): string;
58
60
  declare function formatIssues(error: z.ZodError): string[];
59
61
 
@@ -113,10 +115,10 @@ declare const questionSchema: z.ZodObject<{
113
115
  text: z.ZodString;
114
116
  kind: z.ZodEnum<{
115
117
  number: "number";
116
- other: "other";
117
118
  unhandled: "unhandled";
118
119
  conflict: "conflict";
119
120
  assumption: "assumption";
121
+ other: "other";
120
122
  }>;
121
123
  }, z.core.$strict>;
122
124
  type Issue$2 = (path: (string | number)[], message: string) => void;
@@ -181,10 +183,10 @@ declare const businessSchema: z.ZodObject<{
181
183
  text: z.ZodString;
182
184
  kind: z.ZodEnum<{
183
185
  number: "number";
184
- other: "other";
185
186
  unhandled: "unhandled";
186
187
  conflict: "conflict";
187
188
  assumption: "assumption";
189
+ other: "other";
188
190
  }>;
189
191
  }, z.core.$strict>>>;
190
192
  }, z.core.$strict>;
@@ -351,11 +353,11 @@ declare const stepSchema: z.ZodObject<{
351
353
  end: "end";
352
354
  }>>;
353
355
  status: z.ZodEnum<{
354
- existing: "existing";
355
356
  new: "new";
356
357
  changed: "changed";
357
- planned: "planned";
358
358
  removed: "removed";
359
+ existing: "existing";
360
+ planned: "planned";
359
361
  }>;
360
362
  source: z.ZodOptional<z.ZodString>;
361
363
  match: z.ZodOptional<z.ZodString>;
@@ -398,8 +400,8 @@ declare function isRemovedLink(spec: StatusOf, link: RemovedEnds): boolean;
398
400
  declare const flowObject: z.ZodObject<{
399
401
  diagram: z.ZodOptional<z.ZodLiteral<"flow">>;
400
402
  kind: z.ZodEnum<{
401
- plan: "plan";
402
403
  summary: "summary";
404
+ plan: "plan";
403
405
  }>;
404
406
  title: z.ZodString;
405
407
  rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -413,11 +415,11 @@ declare const flowObject: z.ZodObject<{
413
415
  end: "end";
414
416
  }>>;
415
417
  status: z.ZodEnum<{
416
- existing: "existing";
417
418
  new: "new";
418
419
  changed: "changed";
419
- planned: "planned";
420
420
  removed: "removed";
421
+ existing: "existing";
422
+ planned: "planned";
421
423
  }>;
422
424
  source: z.ZodOptional<z.ZodString>;
423
425
  match: z.ZodOptional<z.ZodString>;
@@ -434,12 +436,12 @@ declare const flowObject: z.ZodObject<{
434
436
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
435
437
  drift: z.ZodOptional<z.ZodArray<z.ZodObject<{
436
438
  cause: z.ZodEnum<{
439
+ other: "other";
437
440
  "bug-found": "bug-found";
438
441
  "wrong-assumption": "wrong-assumption";
439
442
  "user-asked": "user-asked";
440
443
  "cleaner-way": "cleaner-way";
441
444
  "out-of-scope": "out-of-scope";
442
- other: "other";
443
445
  }>;
444
446
  why: z.ZodString;
445
447
  step: z.ZodString;
@@ -452,8 +454,8 @@ declare function flowShapeIssues(spec: FlowInput, issue: Issue$1): void;
452
454
  declare const flowSchema: z.ZodObject<{
453
455
  diagram: z.ZodOptional<z.ZodLiteral<"flow">>;
454
456
  kind: z.ZodEnum<{
455
- plan: "plan";
456
457
  summary: "summary";
458
+ plan: "plan";
457
459
  }>;
458
460
  title: z.ZodString;
459
461
  rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -467,11 +469,11 @@ declare const flowSchema: z.ZodObject<{
467
469
  end: "end";
468
470
  }>>;
469
471
  status: z.ZodEnum<{
470
- existing: "existing";
471
472
  new: "new";
472
473
  changed: "changed";
473
- planned: "planned";
474
474
  removed: "removed";
475
+ existing: "existing";
476
+ planned: "planned";
475
477
  }>;
476
478
  source: z.ZodOptional<z.ZodString>;
477
479
  match: z.ZodOptional<z.ZodString>;
@@ -488,12 +490,12 @@ declare const flowSchema: z.ZodObject<{
488
490
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
489
491
  drift: z.ZodOptional<z.ZodArray<z.ZodObject<{
490
492
  cause: z.ZodEnum<{
493
+ other: "other";
491
494
  "bug-found": "bug-found";
492
495
  "wrong-assumption": "wrong-assumption";
493
496
  "user-asked": "user-asked";
494
497
  "cleaner-way": "cleaner-way";
495
498
  "out-of-scope": "out-of-scope";
496
- other: "other";
497
499
  }>;
498
500
  why: z.ZodString;
499
501
  step: z.ZodString;
@@ -542,11 +544,11 @@ declare const explainFlowSchema: z.ZodObject<{
542
544
  box: z.ZodOptional<z.ZodString>;
543
545
  }, z.core.$strict>>;
544
546
  links: z.ZodArray<z.ZodObject<{
547
+ from: z.ZodString;
548
+ to: z.ZodString;
545
549
  label: z.ZodOptional<z.ZodString>;
546
550
  source: z.ZodOptional<z.ZodString>;
547
551
  match: z.ZodOptional<z.ZodString>;
548
- from: z.ZodString;
549
- to: z.ZodString;
550
552
  }, z.core.$strict>>;
551
553
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
552
554
  }, z.core.$strict>;
@@ -632,9 +634,9 @@ declare const releaseSchema: z.ZodObject<{
632
634
  }, z.core.$strict>>>;
633
635
  data: z.ZodDefault<z.ZodArray<z.ZodObject<{
634
636
  id: z.ZodString;
635
- why: z.ZodString;
636
637
  name: z.ZodString;
637
638
  what: z.ZodString;
639
+ why: z.ZodString;
638
640
  }, z.core.$strict>>>;
639
641
  }, z.core.$strict>>;
640
642
  }, z.core.$strict>;
@@ -649,9 +651,9 @@ declare const specSchema: z.ZodObject<{
649
651
  diagram: z.ZodOptional<z.ZodLiteral<"map">>;
650
652
  title: z.ZodString;
651
653
  kind: z.ZodEnum<{
652
- plan: "plan";
653
654
  summary: "summary";
654
655
  explain: "explain";
656
+ plan: "plan";
655
657
  }>;
656
658
  rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
657
659
  nodes: z.ZodArray<z.ZodObject<{
@@ -669,10 +671,10 @@ declare const specSchema: z.ZodObject<{
669
671
  component: "component";
670
672
  }>>;
671
673
  status: z.ZodEnum<{
672
- existing: "existing";
673
674
  new: "new";
674
675
  changed: "changed";
675
676
  removed: "removed";
677
+ existing: "existing";
676
678
  context: "context";
677
679
  config: "config";
678
680
  outside: "outside";
@@ -718,12 +720,12 @@ declare const specSchema: z.ZodObject<{
718
720
  omitted: z.ZodOptional<z.ZodArray<z.ZodString>>;
719
721
  drift: z.ZodOptional<z.ZodArray<z.ZodObject<{
720
722
  cause: z.ZodEnum<{
723
+ other: "other";
721
724
  "bug-found": "bug-found";
722
725
  "wrong-assumption": "wrong-assumption";
723
726
  "user-asked": "user-asked";
724
727
  "cleaner-way": "cleaner-way";
725
728
  "out-of-scope": "out-of-scope";
726
- other: "other";
727
729
  }>;
728
730
  why: z.ZodString;
729
731
  node: z.ZodString;
@@ -746,11 +748,11 @@ declare const specSchema: z.ZodObject<{
746
748
  box: z.ZodOptional<z.ZodString>;
747
749
  }, z.core.$strict>>;
748
750
  links: z.ZodArray<z.ZodObject<{
751
+ from: z.ZodString;
752
+ to: z.ZodString;
749
753
  label: z.ZodOptional<z.ZodString>;
750
754
  source: z.ZodOptional<z.ZodString>;
751
755
  match: z.ZodOptional<z.ZodString>;
752
- from: z.ZodString;
753
- to: z.ZodString;
754
756
  }, z.core.$strict>>;
755
757
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
756
758
  }, z.core.$strict>>>;
@@ -823,8 +825,90 @@ interface Config {
823
825
  /** Look up the newest codechart once a day and say when there is one. */
824
826
  updateCheck: boolean;
825
827
  release: ReleaseConfig;
828
+ /** Paths the desktop app's code layer never reads, from both config files. */
829
+ ignore: string[];
826
830
  rules: Rule[];
827
831
  }
832
+ /** What a map rule can make of code (Code model #4). */
833
+ declare const MAP_ENTITY_KINDS: readonly ["table", "model", "service", "endpoint", "component", "config"];
834
+ type MapEntityKind = (typeof MAP_ENTITY_KINDS)[number];
835
+ /** Prefix of a folder box's id: `folder:src/payments`. */
836
+ declare const FOLDER_BOX_PREFIX = "folder:";
837
+ /** Which pinned id this is, by syntax alone: `::` makes a node, a `folder:` prefix a folder box, else a rule box slug. */
838
+ declare function pinnedIdKind(id: string): 'node' | 'folder' | 'rule-box' | undefined;
839
+ declare const mapRuleSchema: z.ZodObject<{
840
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
841
+ pattern: z.ZodOptional<z.ZodString>;
842
+ lang: z.ZodOptional<z.ZodEnum<{
843
+ typescript: "typescript";
844
+ javascript: "javascript";
845
+ python: "python";
846
+ html: "html";
847
+ css: "css";
848
+ sql: "sql";
849
+ bash: "bash";
850
+ yaml: "yaml";
851
+ json: "json";
852
+ }>>;
853
+ kind: z.ZodOptional<z.ZodEnum<{
854
+ config: "config";
855
+ table: "table";
856
+ model: "model";
857
+ service: "service";
858
+ endpoint: "endpoint";
859
+ component: "component";
860
+ }>>;
861
+ box: z.ZodOptional<z.ZodString>;
862
+ ignore: z.ZodOptional<z.ZodLiteral<true>>;
863
+ }, z.core.$strict>;
864
+ declare const pinnedEntrySchema: z.ZodObject<{
865
+ name: z.ZodString;
866
+ reason: z.ZodOptional<z.ZodString>;
867
+ }, z.core.$strict>;
868
+ declare const mapSchema: z.ZodObject<{
869
+ rules: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
870
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
871
+ pattern: z.ZodOptional<z.ZodString>;
872
+ lang: z.ZodOptional<z.ZodEnum<{
873
+ typescript: "typescript";
874
+ javascript: "javascript";
875
+ python: "python";
876
+ html: "html";
877
+ css: "css";
878
+ sql: "sql";
879
+ bash: "bash";
880
+ yaml: "yaml";
881
+ json: "json";
882
+ }>>;
883
+ kind: z.ZodOptional<z.ZodEnum<{
884
+ config: "config";
885
+ table: "table";
886
+ model: "model";
887
+ service: "service";
888
+ endpoint: "endpoint";
889
+ component: "component";
890
+ }>>;
891
+ box: z.ZodOptional<z.ZodString>;
892
+ ignore: z.ZodOptional<z.ZodLiteral<true>>;
893
+ }, z.core.$strict>>>>;
894
+ guidance: z.ZodOptional<z.ZodNullable<z.ZodString>>;
895
+ pinned: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
896
+ name: z.ZodString;
897
+ reason: z.ZodOptional<z.ZodString>;
898
+ }, z.core.$strict>>>>;
899
+ }, z.core.$strict>;
900
+ type MapRule = z.infer<typeof mapRuleSchema>;
901
+ type PinnedEntry = z.infer<typeof pinnedEntrySchema>;
902
+ type Pinned = Record<string, PinnedEntry>;
903
+ type MapConfig = z.infer<typeof mapSchema>;
904
+ /** Checks pins before they are written: formatIssues lines, paths starting at `pinned`. */
905
+ declare function parsePinned(input: unknown): {
906
+ ok: true;
907
+ pinned: Pinned;
908
+ } | {
909
+ ok: false;
910
+ errors: string[];
911
+ };
828
912
  declare const configFileSchema: z.ZodObject<{
829
913
  defaults: z.ZodOptional<z.ZodObject<{
830
914
  output: z.ZodOptional<z.ZodEnum<{
@@ -873,6 +957,7 @@ declare const configFileSchema: z.ZodObject<{
873
957
  }>>;
874
958
  }, z.core.$strict>>;
875
959
  useBuiltinRules: z.ZodOptional<z.ZodBoolean>;
960
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
876
961
  updateCheck: z.ZodOptional<z.ZodBoolean>;
877
962
  rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
878
963
  name: z.ZodString;
@@ -894,6 +979,38 @@ declare const configFileSchema: z.ZodObject<{
894
979
  full: "full";
895
980
  }>>;
896
981
  }, z.core.$strict>>>;
982
+ map: z.ZodOptional<z.ZodNullable<z.ZodObject<{
983
+ rules: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
984
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
985
+ pattern: z.ZodOptional<z.ZodString>;
986
+ lang: z.ZodOptional<z.ZodEnum<{
987
+ typescript: "typescript";
988
+ javascript: "javascript";
989
+ python: "python";
990
+ html: "html";
991
+ css: "css";
992
+ sql: "sql";
993
+ bash: "bash";
994
+ yaml: "yaml";
995
+ json: "json";
996
+ }>>;
997
+ kind: z.ZodOptional<z.ZodEnum<{
998
+ config: "config";
999
+ table: "table";
1000
+ model: "model";
1001
+ service: "service";
1002
+ endpoint: "endpoint";
1003
+ component: "component";
1004
+ }>>;
1005
+ box: z.ZodOptional<z.ZodString>;
1006
+ ignore: z.ZodOptional<z.ZodLiteral<true>>;
1007
+ }, z.core.$strict>>>>;
1008
+ guidance: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1009
+ pinned: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
1010
+ name: z.ZodString;
1011
+ reason: z.ZodOptional<z.ZodString>;
1012
+ }, z.core.$strict>>>>;
1013
+ }, z.core.$strict>>>;
897
1014
  }, z.core.$strict>;
898
1015
  type ConfigFile = z.infer<typeof configFileSchema>;
899
1016
  declare function configJsonSchema(): object;
@@ -929,6 +1046,14 @@ declare function loadConfig(opts: LoadOptions): Config;
929
1046
 
930
1047
  declare function findRepoRoot(cwd: string): string | undefined;
931
1048
 
1049
+ /**
1050
+ * `text` (a `.codechart.yaml`) with `map.pinned` set to `pinned`, sorted by id, so the same pins in any order give the
1051
+ * same bytes. Only that block is rewritten (comments inside it are not kept); the rest of the file stays byte-identical.
1052
+ * New lines indent like the file's `map`, else by 2. No pins removes the block, and `map` when nothing else is in it.
1053
+ * Throws on invalid pins, or a file it can't edit safely: not one block mapping, or `map` using aliases.
1054
+ */
1055
+ declare function writePinned(text: string, pinned: Pinned): string;
1056
+
932
1057
  /** Git's change to a file: added, modified, deleted, or moved (the status is the new path's). */
933
1058
  type ChangeStatus = 'A' | 'M' | 'D' | 'R';
934
1059
  /** One changed file, repo-relative with `/`. */
@@ -1249,8 +1374,8 @@ declare const reviewSchema: z.ZodObject<{
1249
1374
  title: z.ZodOptional<z.ZodString>;
1250
1375
  kind: z.ZodEnum<{
1251
1376
  map: "map";
1252
- flow: "flow";
1253
1377
  business: "business";
1378
+ flow: "flow";
1254
1379
  }>;
1255
1380
  branch: z.ZodString;
1256
1381
  html: z.ZodOptional<z.ZodString>;
@@ -1765,5 +1890,355 @@ declare function installCopy(skillDir: string, dir: string, who: string, files:
1765
1890
  /** Deletes only the skill's own files, and the folder if that empties it. */
1766
1891
  declare function removeSkill(dir: string, files: string[]): string | undefined;
1767
1892
 
1768
- export { AGENTS, BLOCK_MAX, BUILTIN_DEFAULTS, CODE_PATTERNS, DEFAULT_RELEASE_BRANCHES, DESCRIPTION_CANVASES, EDGE_KINDS, FLOW_PREFIX, GENERATED_PATHS, GLOBAL_ONLY, HTML_NAME, IN_DIFF, KIND_ROW, LABEL_LINE_HEIGHT, LINE_HEIGHT, LONG, MAX_FLOWS, MAX_ITEMS, MAX_SPEC_BYTES, NODE_KINDS, OutputTooLarge, PANE_CANVASES, PRIVATE_KEY, REVIEW_NAME, SHORT, STATUSES, STEP_STATUSES, SUMMARY_CHARS_PER_LINE, SUMMARY_MAX_LINES, THEMES, agentsFor, anchorContext, arrowNames, asFlowSpec, blockOf, buildDoc, builtinRules, businessLinkIssues, businessSpecJsonSchema, businessTexts, carryNotes, changeTitle, checkFlowAnchors, checkFlowDiff, checkMapNodes, checkRef, cleanPath, clip, codeLabelIssue, configJsonSchema, copyFiles, csv, dataSchema, diffOf, diffRange, driftBase, driftIssues, entryPaths, entryProse, entryWords, escapeJsonControls, explainFlowSchema, explainIssues, explainTexts, explains, fileSlug, findChange, findMatch, findRepoRoot, flat, flowIssues, flowJsonSchema, flowShapeIssues, flowTexts, formatIssues, formatPath, git, gitBinary, gitBlob, gitBlobSizes, gitBlobs, gitBranch, gitChangedChanges, gitChangedFiles, gitChanges, gitCommitChanges, gitCommitFiles, gitDiffFiles, gitDirtyHashes, gitEmptyTree, gitFileAt, gitFileDiff, gitFileDiffs, gitFiles, gitFirstParentLog, gitGeneratedAttr, gitHead, gitIsAncestor, gitIsShallow, gitLatestTag, gitListFiles, gitMergeBase, gitParent, gitSinceChanges, gitSinceFiles, gitTagNames, gitUntracked, gitWorktreeChanges, globalConfigPath, hasAny, hasGitSelection, hasHiddenChars, hashToken, headerHeight, htmlOutputPath, ident, installCopy, installPairs, isAt, isCodechartSkill, isExplain, isExplainSlug, isPlannedLink, isQuestion, isRemovedLink, itemGroups, itemIssues, itemTexts, journeySchema, labelIssues, labelLines, lastNoteNumber, layoutSpec, legacyAgentsFor, likelyPath, linkSchema, listReviews, load, loadConfig, loadConfigWithSources, locate, long, looksSecret, loose, marker, matchSchema, mentionsPath, mergeNotes, nodeOfHeading, normalizeEol, normalizePath, oneLine, onlyBuiltinsToJudge, opencodeConfigDir, parseConfigFile, parseDoc, parseStamp, pathStr, pickLayout, plainDiffName, plainLabel, plainTextIssues, questionsOf, quotable, readRegularBytes, readRegularFile, readReview, releaseSpecJsonSchema, removeSkill, repoDiffOverrides, repoFilterOverrides, repoFolder, repoPath, repoPathResolver, resolveCommit, resolveRules, reviewFile, reviewLock, reviewSchema, ruleSchema, sameFile, sameNote, sanitizeText, saveReview, scanFlowAnchors, selectionError, short, shortOpt, shown, shownLines, skillFiles, skillFolders, specJsonSchema, stamp, stepLabel, stepSchema, stripInvisible, targetExists, techIdIssue, text, trustedBinary, unionOutputs, unmappedFiles, updateReview, validateAnySpec, validateBusinessSpec, validateFlowSpec, validateReleaseSpec, validateSpec, withStepTypes, withTypes, wrapSummary, wrapText, writeReview };
1769
- export type { AgentPreset, AnchorCtx, AnchorFailure, Block, BusinessSpec, ChangeSpec, ChangeStatus, CheckResult, CheckSummary, Config, ConfigFile, ConfigWithSources, ContextMode, Diagram, Diff, DiffLine, DiffRange, Direction, DriftCause, ExplainFlow, ExplainSpec, Field, FileChange, Flow, FlowInput, FlowLink, FlowSnippets, FlowSpec, FlowStep, Flows, Found, GitOpts, GitSelection, InstallIO, Issue$2 as Issue, ItemBase, ItemGroup, Items, Layout, LayoutEdge, Lists, Loaded, LogEntry, MapCheck, Mismatch, NodeKind, Note, NoteKind, Output, Pair, Parsed, Point, Range, ReleaseSpec, Review, ReviewNode, ReviewSnapshot, Rule, Snippet, Spec, SpecEdge, SpecNode, Status, Target, TechBox, Theme, ToJudge, ValidationResult$1 as ValidationResult, Which };
1893
+ declare const LANGS: readonly ["typescript", "javascript", "python", "html", "css", "sql", "bash", "yaml", "json"];
1894
+ type Lang = (typeof LANGS)[number];
1895
+ declare const codeRangeSchema: z.ZodObject<{
1896
+ start: z.ZodObject<{
1897
+ line: z.ZodNumber;
1898
+ column: z.ZodNumber;
1899
+ }, z.core.$strip>;
1900
+ end: z.ZodObject<{
1901
+ line: z.ZodNumber;
1902
+ column: z.ZodNumber;
1903
+ }, z.core.$strip>;
1904
+ }, z.core.$strip>;
1905
+ type CodeRange = z.infer<typeof codeRangeSchema>;
1906
+ declare const fileInfoSchema: z.ZodObject<{
1907
+ path: z.ZodString;
1908
+ lang: z.ZodEnum<{
1909
+ typescript: "typescript";
1910
+ javascript: "javascript";
1911
+ python: "python";
1912
+ html: "html";
1913
+ css: "css";
1914
+ sql: "sql";
1915
+ bash: "bash";
1916
+ yaml: "yaml";
1917
+ json: "json";
1918
+ }>;
1919
+ hash: z.ZodString;
1920
+ }, z.core.$strip>;
1921
+ type FileInfo = z.infer<typeof fileInfoSchema>;
1922
+ declare const SYMBOL_KINDS: readonly ["class", "interface", "type", "enum", "function", "method", "module", "constant"];
1923
+ type SymbolKind = (typeof SYMBOL_KINDS)[number];
1924
+ declare const codeSymbolSchema: z.ZodObject<{
1925
+ id: z.ZodString;
1926
+ file: z.ZodString;
1927
+ path: z.ZodArray<z.ZodString>;
1928
+ kind: z.ZodEnum<{
1929
+ function: "function";
1930
+ type: "type";
1931
+ enum: "enum";
1932
+ class: "class";
1933
+ interface: "interface";
1934
+ method: "method";
1935
+ module: "module";
1936
+ constant: "constant";
1937
+ }>;
1938
+ range: z.ZodObject<{
1939
+ start: z.ZodObject<{
1940
+ line: z.ZodNumber;
1941
+ column: z.ZodNumber;
1942
+ }, z.core.$strip>;
1943
+ end: z.ZodObject<{
1944
+ line: z.ZodNumber;
1945
+ column: z.ZodNumber;
1946
+ }, z.core.$strip>;
1947
+ }, z.core.$strip>;
1948
+ }, z.core.$strip>;
1949
+ type CodeSymbol = z.infer<typeof codeSymbolSchema>;
1950
+ declare const importedNameSchema: z.ZodObject<{
1951
+ imported: z.ZodString;
1952
+ local: z.ZodString;
1953
+ typeOnly: z.ZodOptional<z.ZodBoolean>;
1954
+ definedIn: z.ZodOptional<z.ZodString>;
1955
+ }, z.core.$strip>;
1956
+ type ImportedName = z.infer<typeof importedNameSchema>;
1957
+ declare const IMPORT_KINDS: readonly ["import", "export", "require", "dynamic"];
1958
+ declare const importSchema: z.ZodObject<{
1959
+ file: z.ZodString;
1960
+ spec: z.ZodString;
1961
+ resolved: z.ZodOptional<z.ZodString>;
1962
+ status: z.ZodEnum<{
1963
+ unknown: "unknown";
1964
+ resolved: "resolved";
1965
+ external: "external";
1966
+ }>;
1967
+ packageFolder: z.ZodOptional<z.ZodString>;
1968
+ anchored: z.ZodOptional<z.ZodString>;
1969
+ kind: z.ZodEnum<{
1970
+ import: "import";
1971
+ export: "export";
1972
+ require: "require";
1973
+ dynamic: "dynamic";
1974
+ }>;
1975
+ typeOnly: z.ZodOptional<z.ZodBoolean>;
1976
+ names: z.ZodOptional<z.ZodArray<z.ZodObject<{
1977
+ imported: z.ZodString;
1978
+ local: z.ZodString;
1979
+ typeOnly: z.ZodOptional<z.ZodBoolean>;
1980
+ definedIn: z.ZodOptional<z.ZodString>;
1981
+ }, z.core.$strip>>>;
1982
+ range: z.ZodObject<{
1983
+ start: z.ZodObject<{
1984
+ line: z.ZodNumber;
1985
+ column: z.ZodNumber;
1986
+ }, z.core.$strip>;
1987
+ end: z.ZodObject<{
1988
+ line: z.ZodNumber;
1989
+ column: z.ZodNumber;
1990
+ }, z.core.$strip>;
1991
+ }, z.core.$strip>;
1992
+ }, z.core.$strip>;
1993
+ type Import = z.infer<typeof importSchema>;
1994
+ declare const CALL_VIAS: readonly ["bare", "this", "member"];
1995
+ type CallVia = (typeof CALL_VIAS)[number];
1996
+ declare const callRefSchema: z.ZodObject<{
1997
+ from: z.ZodString;
1998
+ name: z.ZodString;
1999
+ via: z.ZodOptional<z.ZodEnum<{
2000
+ bare: "bare";
2001
+ this: "this";
2002
+ member: "member";
2003
+ }>>;
2004
+ receiver: z.ZodOptional<z.ZodString>;
2005
+ receiverPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
2006
+ to: z.ZodOptional<z.ZodString>;
2007
+ evidence: z.ZodEnum<{
2008
+ resolved: "resolved";
2009
+ "name-only": "name-only";
2010
+ }>;
2011
+ range: z.ZodObject<{
2012
+ start: z.ZodObject<{
2013
+ line: z.ZodNumber;
2014
+ column: z.ZodNumber;
2015
+ }, z.core.$strip>;
2016
+ end: z.ZodObject<{
2017
+ line: z.ZodNumber;
2018
+ column: z.ZodNumber;
2019
+ }, z.core.$strip>;
2020
+ }, z.core.$strip>;
2021
+ }, z.core.$strip>;
2022
+ type CallRef = z.infer<typeof callRefSchema>;
2023
+ /** Node identity (Live map #9): file + symbol path + kind, so line moves keep the node. */
2024
+ declare const symbolId: (file: string, path: readonly string[], kind: SymbolKind) => string;
2025
+ /** What files without imports define (Code model #3): SQL tables, workflow jobs and steps, compose services, npm scripts. */
2026
+ declare const ENTITY_KINDS: readonly ["table", "job", "step", "service", "script"];
2027
+ type EntityKind = (typeof ENTITY_KINDS)[number];
2028
+ /**
2029
+ * Like a symbol: `id` is `entityId(file, path, kind)`, `~2`, `~3`… for a repeated identity. `path` holds names from the
2030
+ * outermost in: `['public', 'orders']` for a table, `['deploy', 'ship']` for a step of job `deploy`. Path parts are joined
2031
+ * with `.`, so a name holding a dot (`"a.b"`, a `build.web` script) can share an id with a nested path.
2032
+ */
2033
+ declare const codeEntitySchema: z.ZodObject<{
2034
+ id: z.ZodString;
2035
+ file: z.ZodString;
2036
+ path: z.ZodArray<z.ZodString>;
2037
+ range: z.ZodObject<{
2038
+ start: z.ZodObject<{
2039
+ line: z.ZodNumber;
2040
+ column: z.ZodNumber;
2041
+ }, z.core.$strip>;
2042
+ end: z.ZodObject<{
2043
+ line: z.ZodNumber;
2044
+ column: z.ZodNumber;
2045
+ }, z.core.$strip>;
2046
+ }, z.core.$strip>;
2047
+ kind: z.ZodEnum<{
2048
+ step: "step";
2049
+ table: "table";
2050
+ service: "service";
2051
+ job: "job";
2052
+ script: "script";
2053
+ }>;
2054
+ }, z.core.$strip>;
2055
+ type CodeEntity = z.infer<typeof codeEntitySchema>;
2056
+ declare const entityId: (file: string, path: readonly string[], kind: EntityKind) => string;
2057
+ /**
2058
+ * `run`: a file a workflow step or npm script runs; `source`: a file a shell script sources; `script` and `link`: an
2059
+ * HTML `<script src>` and `<link href>`; `import`: a CSS `@import`.
2060
+ */
2061
+ declare const REF_KINDS: readonly ["run", "source", "script", "link", "import"];
2062
+ declare const codeRefSchema: z.ZodObject<{
2063
+ file: z.ZodString;
2064
+ from: z.ZodOptional<z.ZodString>;
2065
+ spec: z.ZodString;
2066
+ written: z.ZodOptional<z.ZodString>;
2067
+ kind: z.ZodEnum<{
2068
+ source: "source";
2069
+ link: "link";
2070
+ import: "import";
2071
+ script: "script";
2072
+ run: "run";
2073
+ }>;
2074
+ candidate: z.ZodOptional<z.ZodString>;
2075
+ resolved: z.ZodOptional<z.ZodString>;
2076
+ status: z.ZodEnum<{
2077
+ unknown: "unknown";
2078
+ resolved: "resolved";
2079
+ external: "external";
2080
+ }>;
2081
+ range: z.ZodObject<{
2082
+ start: z.ZodObject<{
2083
+ line: z.ZodNumber;
2084
+ column: z.ZodNumber;
2085
+ }, z.core.$strip>;
2086
+ end: z.ZodObject<{
2087
+ line: z.ZodNumber;
2088
+ column: z.ZodNumber;
2089
+ }, z.core.$strip>;
2090
+ }, z.core.$strip>;
2091
+ }, z.core.$strip>;
2092
+ type CodeRef = z.infer<typeof codeRefSchema>;
2093
+
2094
+ /** A tree-sitter grammar codechart parses symbols with. */
2095
+ type Grammar = 'typescript' | 'tsx' | 'javascript' | 'python';
2096
+ /** The v1 language of a file, from its extension; undefined for files the code layer skips. */
2097
+ declare function langOf(path: string): Lang | undefined;
2098
+ /** A tree-sitter grammar codechart reads entities and references with (and, for Bash, functions). */
2099
+ type EntityGrammar = 'html' | 'css' | 'sql' | 'bash' | 'yaml' | 'json';
2100
+ /** The grammar that reads a file's entities and references, for the v1 languages without imports. */
2101
+ declare function entityGrammarOf(path: string): EntityGrammar | undefined;
2102
+ /** The grammar that reads a file's symbols, or undefined while its language has entities only or none yet. */
2103
+ declare function grammarOf(path: string): Grammar | undefined;
2104
+
2105
+ /** A name the file exports from its own scope; `local` is the binding behind `export { local as name }` or `export default local`. */
2106
+ interface ExportName {
2107
+ name: string;
2108
+ local?: string;
2109
+ }
2110
+ /** What a file exports itself. `complete` is false when it may export more than `names` (CommonJS, `export =`, syntax errors). */
2111
+ interface ModuleExports {
2112
+ names: ExportName[];
2113
+ complete: boolean;
2114
+ }
2115
+
2116
+ /**
2117
+ * One name a Python scope binds. `scope` is the id of the function or class whose body binds it, `''` for the module.
2118
+ * `import` points at the file's import by index; `def` is a `def` or `class`; `other` is any other write (assignment,
2119
+ * parameter, loop or `with` target, `del`, `global` write), with `built` set for `name = Name(…)`.
2120
+ */
2121
+ interface PyBinding {
2122
+ scope: string;
2123
+ name: string;
2124
+ kind: 'import' | 'def' | 'other';
2125
+ import?: number;
2126
+ /** For `import a.b` without an alias: binds `a`, and `a.b` stays reachable through it. */
2127
+ dotted?: boolean;
2128
+ built?: string;
2129
+ }
2130
+
2131
+ /** One file of the code layer. */
2132
+ interface ParsedFile {
2133
+ file: FileInfo;
2134
+ symbols: CodeSymbol[];
2135
+ /** Where tree-sitter recovered from a syntax error; empty when the file parses. */
2136
+ parseErrors: CodeRange[];
2137
+ /** Ids of symbols and entities carried over from the last good parse with their old range, since the broken text no longer shows them. */
2138
+ kept: string[];
2139
+ /** `unknown` until the link pass resolves them against the rest of the repo. */
2140
+ imports: Import[];
2141
+ exports: ModuleExports;
2142
+ /** Calls by `from` symbol; `name-only` until the link pass proves a target. */
2143
+ calls: CallRef[];
2144
+ /** Tables, workflow jobs and steps, compose services and npm scripts (Code model #3); empty for languages with imports. */
2145
+ entities: CodeEntity[];
2146
+ /** Files this one runs, sources, loads or imports without an import statement; `unknown` until the link pass. */
2147
+ refs: CodeRef[];
2148
+ /** Python only: every name each scope binds, which decides what a called name means where it is called. */
2149
+ bindings?: PyBinding[];
2150
+ /** The file edits `sys.path`, so its absolute Python imports have no provable target. Absent for other files. */
2151
+ sysPathEdited?: boolean;
2152
+ }
2153
+ /** The previous parse of a file: symbols, imports and exports that stand in while syntax errors hide them. */
2154
+ type LastGood = ParsedFile | readonly CodeSymbol[];
2155
+ /**
2156
+ * Parses one file in isolation. `path` is repo-relative with `/`; `lastGood` is the file's previous parse, whose
2157
+ * symbols, entities, imports, exports and references stand in for what a syntax error hides.
2158
+ */
2159
+ declare function parseCode(path: string, text: string, lastGood?: LastGood): Promise<ParsedFile | undefined>;
2160
+
2161
+ /** Dependencies, build output and minified bundles: never source a map should point at. */
2162
+ declare const DEFAULT_CODE_IGNORE: string[];
2163
+ /**
2164
+ * Repo-relative paths of the files the code layer reads: tracked and untracked files git does not ignore
2165
+ * (`.gitignore`, `.git/info/exclude`, the global excludes file), in a v1 language, outside `DEFAULT_CODE_IGNORE` and `ignore`
2166
+ * (the config's `ignore`).
2167
+ */
2168
+ declare function listCodeFiles(root: string, ignore?: readonly string[]): string[];
2169
+ /** Reads a repo file as text; undefined when it is gone, not a regular file, too large or binary. */
2170
+ declare function readCodeFile(root: string, path: string): string | undefined;
2171
+ /** The code layer of the repo at `root`, one entry per readable file of `listCodeFiles`, imports and calls resolved. */
2172
+ declare function parseRepo(root: string, opts?: {
2173
+ ignore?: readonly string[];
2174
+ }): Promise<ParsedFile[]>;
2175
+
2176
+ interface CodeIndexOptions {
2177
+ /** The config's `ignore` globs, as `parseRepo` takes them. */
2178
+ ignore?: readonly string[];
2179
+ }
2180
+ /** What one update touched; every path is repo-relative with `/`. */
2181
+ interface CodeUpdate {
2182
+ /** Files added, edited or removed by content hash. */
2183
+ changed: string[];
2184
+ /** Changed files parsed again: one file on the live path, more in bulk. */
2185
+ parsed: string[];
2186
+ /** Files outside `parsed` whose imports or calls changed through the ripple. */
2187
+ relinked: string[];
2188
+ /** Files that left the repo or became unreadable. */
2189
+ removed: string[];
2190
+ }
2191
+ interface CodeIndex {
2192
+ readonly root: string;
2193
+ /** Every readable file of the code layer, sorted by path. */
2194
+ readonly files: readonly ParsedFile[];
2195
+ file(path: string): ParsedFile | undefined;
2196
+ /**
2197
+ * Re-reads `paths` (repo-relative or absolute) and the repo's file list, parses only files whose hash changed, and
2198
+ * re-matches only the files the change affects. With no paths, hashes every listed file (bulk mode).
2199
+ */
2200
+ update(paths?: readonly string[]): Promise<CodeUpdate>;
2201
+ }
2202
+ /** Opens the code layer of `root` and keeps it ready for one-file updates; links as `parseRepo` does, recording probes. */
2203
+ declare function openCodeIndex(root: string, opts?: CodeIndexOptions): Promise<CodeIndex>;
2204
+
2205
+ type RefResolution = Pick<CodeRef, 'status' | 'resolved'>;
2206
+
2207
+ type Resolution = Pick<Import, 'status' | 'resolved' | 'packageFolder'>;
2208
+ /** What a resolution needs beyond the specifier: whether the importing Python file edits `sys.path`. */
2209
+ interface ResolveContext {
2210
+ sysPathEdited?: boolean;
2211
+ }
2212
+ /** Resolves import specifiers against one snapshot of a repo's files; caches configs, so make a new one when a config changes. */
2213
+ interface Resolver {
2214
+ /** Where `spec`, imported by repo file `from`, leads; `kind` picks the package conditions (`require` or the rest). */
2215
+ resolve(from: string, spec: string, kind?: Import['kind'], context?: ResolveContext): Resolution;
2216
+ /** Where a reference of a file without imports leads: the listed file it names, the web, or unknown. */
2217
+ ref(ref: CodeRef): RefResolution;
2218
+ }
2219
+ /** Hooks that see what resolution depends on. */
2220
+ interface ResolverProbes {
2221
+ /** Every path one resolution checks for. */
2222
+ path?: (path: string) => void;
2223
+ /**
2224
+ * Every path a config lookup (package.json, tsconfig and its `extends` chain, workspaces) checks for or reads. Those
2225
+ * lookups are cached and shared by every resolution, so a change to one of these paths can change any of them.
2226
+ */
2227
+ config?: (path: string) => void;
2228
+ }
2229
+ /**
2230
+ * A resolver over `files` (repo paths with `/`, as `listCodeFiles` gives them); `read` returns a repo file's text.
2231
+ * Only listed files count, so nothing resolves into `node_modules` or ignored build output.
2232
+ */
2233
+ declare function createResolver(files: Iterable<string>, read: (path: string) => string | undefined, probes?: ResolverProbes): Resolver;
2234
+
2235
+ /**
2236
+ * Resolves every file's imports with `resolver`, then follows each imported name through re-exports to the file
2237
+ * that defines it. Files not passed in count as unparsed: names reaching them get no `definedIn`.
2238
+ */
2239
+ declare function linkImports(files: readonly ParsedFile[], resolver: Resolver): ParsedFile[];
2240
+ /** Imports and calls of every file, linked against the full set. */
2241
+ declare function linkCode(files: readonly ParsedFile[], resolver: Resolver): ParsedFile[];
2242
+
2243
+ export { AGENTS, BLOCK_MAX, BUILTIN_DEFAULTS, CALL_VIAS, CODE_PATTERNS, DEFAULT_CODE_IGNORE, DEFAULT_RELEASE_BRANCHES, DESCRIPTION_CANVASES, EDGE_KINDS, ENTITY_KINDS, FLOW_PREFIX, FOLDER_BOX_PREFIX, GENERATED_PATHS, GLOBAL_ONLY, HTML_NAME, IMPORT_KINDS, IN_DIFF, KIND_ROW, LABEL_LINE_HEIGHT, LANGS, LINE_HEIGHT, LONG, MAP_ENTITY_KINDS, MAX_FLOWS, MAX_ITEMS, MAX_SPEC_BYTES, NODE_KINDS, OutputTooLarge, PANE_CANVASES, PRIVATE_KEY, REF_KINDS, REVIEW_NAME, SHORT, STATUSES, STEP_STATUSES, SUMMARY_CHARS_PER_LINE, SUMMARY_MAX_LINES, SYMBOL_KINDS, THEMES, agentsFor, anchorContext, arrowNames, asFlowSpec, blockOf, buildDoc, builtinRules, businessLinkIssues, businessSpecJsonSchema, businessTexts, callRefSchema, carryNotes, changeTitle, checkFlowAnchors, checkFlowDiff, checkMapNodes, checkRef, cleanPath, clip, codeEntitySchema, codeLabelIssue, codeRangeSchema, codeRefSchema, codeSymbolSchema, configJsonSchema, copyFiles, createResolver, csv, dataSchema, diffOf, diffRange, driftBase, driftIssues, entityGrammarOf, entityId, entryPaths, entryProse, entryWords, escapeJsonControls, explainFlowSchema, explainIssues, explainTexts, explains, fileInfoSchema, fileSlug, findChange, findMatch, findRepoRoot, flat, flowIssues, flowJsonSchema, flowShapeIssues, flowTexts, formatIssues, formatPath, git, gitBinary, gitBlob, gitBlobSizes, gitBlobs, gitBranch, gitChangedChanges, gitChangedFiles, gitChanges, gitCommitChanges, gitCommitFiles, gitDiffFiles, gitDirtyHashes, gitEmptyTree, gitFileAt, gitFileDiff, gitFileDiffs, gitFiles, gitFirstParentLog, gitGeneratedAttr, gitHead, gitIsAncestor, gitIsShallow, gitLatestTag, gitListFiles, gitMergeBase, gitParent, gitSinceChanges, gitSinceFiles, gitTagNames, gitUntracked, gitWorktreeChanges, globalConfigPath, grammarOf, hasAny, hasGitSelection, hasHiddenChars, hashToken, headerHeight, htmlOutputPath, ident, importSchema, importedNameSchema, installCopy, installPairs, isAt, isCodechartSkill, isExplain, isExplainSlug, isPlannedLink, isQuestion, isRemovedLink, itemGroups, itemIssues, itemTexts, journeySchema, labelIssues, labelLines, langOf, lastNoteNumber, layoutSpec, legacyAgentsFor, likelyPath, linkCode, linkImports, linkSchema, listCodeFiles, listReviews, load, loadConfig, loadConfigWithSources, locate, long, looksSecret, loose, marker, matchSchema, mentionsPath, mergeNotes, nodeOfHeading, normalizeEol, normalizePath, oneLine, onlyBuiltinsToJudge, openCodeIndex, opencodeConfigDir, parseCode, parseConfigFile, parseDoc, parsePinned, parseRepo, parseStamp, pathStr, pickLayout, pinnedIdKind, plainDiffName, plainLabel, plainTextIssues, questionsOf, quotable, quotedVisible, readCodeFile, readRegularBytes, readRegularFile, readReview, releaseSpecJsonSchema, removeSkill, repoDiffOverrides, repoFilterOverrides, repoFolder, repoPath, repoPathResolver, resolveCommit, resolveRules, reviewFile, reviewLock, reviewSchema, ruleSchema, sameFile, sameNote, sanitizeText, saveReview, scanFlowAnchors, selectionError, short, shortOpt, shown, shownLines, skillFiles, skillFolders, specJsonSchema, stamp, stepLabel, stepSchema, stripInvisible, symbolId, targetExists, techIdIssue, text, trustedBinary, unionOutputs, unmappedFiles, updateReview, validateAnySpec, validateBusinessSpec, validateFlowSpec, validateReleaseSpec, validateSpec, withStepTypes, withTypes, wrapSummary, wrapText, writePinned, writeReview };
2244
+ export type { AgentPreset, AnchorCtx, AnchorFailure, Block, BusinessSpec, CallRef, CallVia, ChangeSpec, ChangeStatus, CheckResult, CheckSummary, CodeEntity, CodeIndex, CodeIndexOptions, CodeRange, CodeRef, CodeSymbol, CodeUpdate, Config, ConfigFile, ConfigWithSources, ContextMode, Diagram, Diff, DiffLine, DiffRange, Direction, DriftCause, EntityGrammar, EntityKind, ExplainFlow, ExplainSpec, ExportName, Field, FileChange, FileInfo, Flow, FlowInput, FlowLink, FlowSnippets, FlowSpec, FlowStep, Flows, Found, GitOpts, GitSelection, Grammar, Import, ImportedName, InstallIO, Issue$2 as Issue, ItemBase, ItemGroup, Items, Lang, LastGood, Layout, LayoutEdge, Lists, Loaded, LogEntry, MapCheck, MapConfig, MapEntityKind, MapRule, Mismatch, ModuleExports, NodeKind, Note, NoteKind, Output, Pair, Parsed, ParsedFile, Pinned, PinnedEntry, Point, Range, ReleaseSpec, Resolution, Resolver, ResolverProbes, Review, ReviewNode, ReviewSnapshot, Rule, Snippet, Spec, SpecEdge, SpecNode, Status, SymbolKind, Target, TechBox, Theme, ToJudge, ValidationResult$1 as ValidationResult, Which };