@codechart/core 0.1.0 → 0.3.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/README.md CHANGED
@@ -9,6 +9,7 @@ It is the part both products must agree on:
9
9
  - **Git rules** — changed files, log, preview and diff, and which diagram a change should produce.
10
10
  - **Review notes** — the note format, parser, merge, carry-over and storage, plus shared page and review file naming.
11
11
  - **Config** — the `.codechart.yaml` schema, loader and repo-root lookup.
12
+ - **Code layer** — reads a repo's files and their symbols (classes, functions, methods, types) with tree-sitter, for TypeScript and JavaScript so far. `parseRepo` reads a whole repo, `parseCode` one file; a file with a syntax error keeps its last good symbols. Imports resolve to repo files (relative paths, tsconfig `paths`, package `exports` and `imports`, npm, yarn and pnpm workspaces mapped to their source) and imported names are followed through barrel files to where they're defined; an import nothing proves is `unknown`, a package outside the repo `external`. `createResolver` and `linkImports` re-resolve without re-parsing.
12
13
  - **Agent presets** — the agents codechart knows, their skill folders, and commander-free helpers to install and remove the skill.
13
14
 
14
15
  The CLI owns everything that talks to a user or an agent: commands, terminal and HTML renderers, PR maps, the update check and the OpenCode plugin.
@@ -20,11 +21,11 @@ Version `0.x`: the API may change between minor versions. The app pins a version
20
21
  ## Usage
21
22
 
22
23
  ```ts
23
- import { validateSpec, checkMapNodes, layoutSpec, loadConfig } from '@codechart/core';
24
+ import { validateSpec, checkMapNodes, layoutSpec, loadConfig, parseRepo } from '@codechart/core';
24
25
  ```
25
26
 
26
27
  Node 22.12 or later, ESM.
27
28
 
28
29
  ## Licence
29
30
 
30
- MIT. The map layout uses [elkjs](https://github.com/kieler/elkjs) at runtime, under the EPL-2.0 licence; see the notice in the [CLI package](https://github.com/MiscomLab/codechart/blob/main/packages/cli/THIRD_PARTY_NOTICES.md).
31
+ MIT. The map layout uses [elkjs](https://github.com/kieler/elkjs) at runtime, under the EPL-2.0 licence; see the notice in the [CLI package](https://github.com/MiscomLab/codechart/blob/main/packages/cli/THIRD_PARTY_NOTICES.md). The code layer runs [web-tree-sitter](https://github.com/tree-sitter/tree-sitter) and ships the MIT tree-sitter grammars listed in [THIRD_PARTY_NOTICES.md](https://github.com/MiscomLab/codechart/blob/main/packages/core/THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,61 @@
1
+ # Third-party notices
2
+
3
+ `dist/grammars/` holds files copied from these tree-sitter grammars: the compiled `.wasm` parsers and the `queries/tags.scm` definition queries.
4
+
5
+ ## tree-sitter-javascript 0.25.0
6
+
7
+ - Source: <https://github.com/tree-sitter/tree-sitter-javascript>
8
+ - License: MIT
9
+
10
+ ```text
11
+ The MIT License (MIT)
12
+
13
+ Copyright (c) 2014 Max Brunsfeld
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+ ```
33
+
34
+ ## tree-sitter-typescript 0.23.2
35
+
36
+ - Source: <https://github.com/tree-sitter/tree-sitter-typescript>
37
+ - License: MIT
38
+
39
+ ```text
40
+ The MIT License (MIT)
41
+
42
+ Copyright (c) 2017 Max Brunsfeld
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining a copy
45
+ of this software and associated documentation files (the "Software"), to deal
46
+ in the Software without restriction, including without limitation the rights
47
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48
+ copies of the Software, and to permit persons to whom the Software is
49
+ furnished to do so, subject to the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be included in all
52
+ copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
60
+ SOFTWARE.
61
+ ```
@@ -0,0 +1,99 @@
1
+ (
2
+ (comment)* @doc
3
+ .
4
+ (method_definition
5
+ name: (property_identifier) @name) @definition.method
6
+ (#not-eq? @name "constructor")
7
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
8
+ (#select-adjacent! @doc @definition.method)
9
+ )
10
+
11
+ (
12
+ (comment)* @doc
13
+ .
14
+ [
15
+ (class
16
+ name: (_) @name)
17
+ (class_declaration
18
+ name: (_) @name)
19
+ ] @definition.class
20
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
21
+ (#select-adjacent! @doc @definition.class)
22
+ )
23
+
24
+ (
25
+ (comment)* @doc
26
+ .
27
+ [
28
+ (function_expression
29
+ name: (identifier) @name)
30
+ (function_declaration
31
+ name: (identifier) @name)
32
+ (generator_function
33
+ name: (identifier) @name)
34
+ (generator_function_declaration
35
+ name: (identifier) @name)
36
+ ] @definition.function
37
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
38
+ (#select-adjacent! @doc @definition.function)
39
+ )
40
+
41
+ (
42
+ (comment)* @doc
43
+ .
44
+ (lexical_declaration
45
+ (variable_declarator
46
+ name: (identifier) @name
47
+ value: [(arrow_function) (function_expression)]) @definition.function)
48
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
49
+ (#select-adjacent! @doc @definition.function)
50
+ )
51
+
52
+ (
53
+ (comment)* @doc
54
+ .
55
+ (variable_declaration
56
+ (variable_declarator
57
+ name: (identifier) @name
58
+ value: [(arrow_function) (function_expression)]) @definition.function)
59
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
60
+ (#select-adjacent! @doc @definition.function)
61
+ )
62
+
63
+ (assignment_expression
64
+ left: [
65
+ (identifier) @name
66
+ (member_expression
67
+ property: (property_identifier) @name)
68
+ ]
69
+ right: [(arrow_function) (function_expression)]
70
+ ) @definition.function
71
+
72
+ (pair
73
+ key: (property_identifier) @name
74
+ value: [(arrow_function) (function_expression)]) @definition.function
75
+
76
+ (
77
+ (call_expression
78
+ function: (identifier) @name) @reference.call
79
+ (#not-match? @name "^(require)$")
80
+ )
81
+
82
+ (call_expression
83
+ function: (member_expression
84
+ property: (property_identifier) @name)
85
+ arguments: (_) @reference.call)
86
+
87
+ (new_expression
88
+ constructor: (_) @name) @reference.class
89
+
90
+ (export_statement value: (assignment_expression left: (identifier) @name right: ([
91
+ (number)
92
+ (string)
93
+ (identifier)
94
+ (undefined)
95
+ (null)
96
+ (new_expression)
97
+ (binary_expression)
98
+ (call_expression)
99
+ ]))) @definition.constant
@@ -0,0 +1,23 @@
1
+ (function_signature
2
+ name: (identifier) @name) @definition.function
3
+
4
+ (method_signature
5
+ name: (property_identifier) @name) @definition.method
6
+
7
+ (abstract_method_signature
8
+ name: (property_identifier) @name) @definition.method
9
+
10
+ (abstract_class_declaration
11
+ name: (type_identifier) @name) @definition.class
12
+
13
+ (module
14
+ name: (identifier) @name) @definition.module
15
+
16
+ (interface_declaration
17
+ name: (type_identifier) @name) @definition.interface
18
+
19
+ (type_annotation
20
+ (type_identifier) @name) @reference.type
21
+
22
+ (new_expression
23
+ constructor: (identifier) @name) @reference.class
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
  };
@@ -113,10 +113,10 @@ declare const questionSchema: z.ZodObject<{
113
113
  text: z.ZodString;
114
114
  kind: z.ZodEnum<{
115
115
  number: "number";
116
- other: "other";
117
116
  unhandled: "unhandled";
118
117
  conflict: "conflict";
119
118
  assumption: "assumption";
119
+ other: "other";
120
120
  }>;
121
121
  }, z.core.$strict>;
122
122
  type Issue$2 = (path: (string | number)[], message: string) => void;
@@ -181,10 +181,10 @@ declare const businessSchema: z.ZodObject<{
181
181
  text: z.ZodString;
182
182
  kind: z.ZodEnum<{
183
183
  number: "number";
184
- other: "other";
185
184
  unhandled: "unhandled";
186
185
  conflict: "conflict";
187
186
  assumption: "assumption";
187
+ other: "other";
188
188
  }>;
189
189
  }, z.core.$strict>>>;
190
190
  }, z.core.$strict>;
@@ -351,11 +351,11 @@ declare const stepSchema: z.ZodObject<{
351
351
  end: "end";
352
352
  }>>;
353
353
  status: z.ZodEnum<{
354
- existing: "existing";
355
354
  new: "new";
356
355
  changed: "changed";
357
- planned: "planned";
358
356
  removed: "removed";
357
+ existing: "existing";
358
+ planned: "planned";
359
359
  }>;
360
360
  source: z.ZodOptional<z.ZodString>;
361
361
  match: z.ZodOptional<z.ZodString>;
@@ -398,8 +398,8 @@ declare function isRemovedLink(spec: StatusOf, link: RemovedEnds): boolean;
398
398
  declare const flowObject: z.ZodObject<{
399
399
  diagram: z.ZodOptional<z.ZodLiteral<"flow">>;
400
400
  kind: z.ZodEnum<{
401
- plan: "plan";
402
401
  summary: "summary";
402
+ plan: "plan";
403
403
  }>;
404
404
  title: z.ZodString;
405
405
  rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -413,11 +413,11 @@ declare const flowObject: z.ZodObject<{
413
413
  end: "end";
414
414
  }>>;
415
415
  status: z.ZodEnum<{
416
- existing: "existing";
417
416
  new: "new";
418
417
  changed: "changed";
419
- planned: "planned";
420
418
  removed: "removed";
419
+ existing: "existing";
420
+ planned: "planned";
421
421
  }>;
422
422
  source: z.ZodOptional<z.ZodString>;
423
423
  match: z.ZodOptional<z.ZodString>;
@@ -434,12 +434,12 @@ declare const flowObject: z.ZodObject<{
434
434
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
435
435
  drift: z.ZodOptional<z.ZodArray<z.ZodObject<{
436
436
  cause: z.ZodEnum<{
437
+ other: "other";
437
438
  "bug-found": "bug-found";
438
439
  "wrong-assumption": "wrong-assumption";
439
440
  "user-asked": "user-asked";
440
441
  "cleaner-way": "cleaner-way";
441
442
  "out-of-scope": "out-of-scope";
442
- other: "other";
443
443
  }>;
444
444
  why: z.ZodString;
445
445
  step: z.ZodString;
@@ -452,8 +452,8 @@ declare function flowShapeIssues(spec: FlowInput, issue: Issue$1): void;
452
452
  declare const flowSchema: z.ZodObject<{
453
453
  diagram: z.ZodOptional<z.ZodLiteral<"flow">>;
454
454
  kind: z.ZodEnum<{
455
- plan: "plan";
456
455
  summary: "summary";
456
+ plan: "plan";
457
457
  }>;
458
458
  title: z.ZodString;
459
459
  rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -467,11 +467,11 @@ declare const flowSchema: z.ZodObject<{
467
467
  end: "end";
468
468
  }>>;
469
469
  status: z.ZodEnum<{
470
- existing: "existing";
471
470
  new: "new";
472
471
  changed: "changed";
473
- planned: "planned";
474
472
  removed: "removed";
473
+ existing: "existing";
474
+ planned: "planned";
475
475
  }>;
476
476
  source: z.ZodOptional<z.ZodString>;
477
477
  match: z.ZodOptional<z.ZodString>;
@@ -488,12 +488,12 @@ declare const flowSchema: z.ZodObject<{
488
488
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
489
489
  drift: z.ZodOptional<z.ZodArray<z.ZodObject<{
490
490
  cause: z.ZodEnum<{
491
+ other: "other";
491
492
  "bug-found": "bug-found";
492
493
  "wrong-assumption": "wrong-assumption";
493
494
  "user-asked": "user-asked";
494
495
  "cleaner-way": "cleaner-way";
495
496
  "out-of-scope": "out-of-scope";
496
- other: "other";
497
497
  }>;
498
498
  why: z.ZodString;
499
499
  step: z.ZodString;
@@ -542,11 +542,11 @@ declare const explainFlowSchema: z.ZodObject<{
542
542
  box: z.ZodOptional<z.ZodString>;
543
543
  }, z.core.$strict>>;
544
544
  links: z.ZodArray<z.ZodObject<{
545
+ from: z.ZodString;
546
+ to: z.ZodString;
545
547
  label: z.ZodOptional<z.ZodString>;
546
548
  source: z.ZodOptional<z.ZodString>;
547
549
  match: z.ZodOptional<z.ZodString>;
548
- from: z.ZodString;
549
- to: z.ZodString;
550
550
  }, z.core.$strict>>;
551
551
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
552
552
  }, z.core.$strict>;
@@ -632,9 +632,9 @@ declare const releaseSchema: z.ZodObject<{
632
632
  }, z.core.$strict>>>;
633
633
  data: z.ZodDefault<z.ZodArray<z.ZodObject<{
634
634
  id: z.ZodString;
635
- why: z.ZodString;
636
635
  name: z.ZodString;
637
636
  what: z.ZodString;
637
+ why: z.ZodString;
638
638
  }, z.core.$strict>>>;
639
639
  }, z.core.$strict>>;
640
640
  }, z.core.$strict>;
@@ -649,9 +649,9 @@ declare const specSchema: z.ZodObject<{
649
649
  diagram: z.ZodOptional<z.ZodLiteral<"map">>;
650
650
  title: z.ZodString;
651
651
  kind: z.ZodEnum<{
652
- plan: "plan";
653
652
  summary: "summary";
654
653
  explain: "explain";
654
+ plan: "plan";
655
655
  }>;
656
656
  rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
657
657
  nodes: z.ZodArray<z.ZodObject<{
@@ -669,10 +669,10 @@ declare const specSchema: z.ZodObject<{
669
669
  component: "component";
670
670
  }>>;
671
671
  status: z.ZodEnum<{
672
- existing: "existing";
673
672
  new: "new";
674
673
  changed: "changed";
675
674
  removed: "removed";
675
+ existing: "existing";
676
676
  context: "context";
677
677
  config: "config";
678
678
  outside: "outside";
@@ -718,12 +718,12 @@ declare const specSchema: z.ZodObject<{
718
718
  omitted: z.ZodOptional<z.ZodArray<z.ZodString>>;
719
719
  drift: z.ZodOptional<z.ZodArray<z.ZodObject<{
720
720
  cause: z.ZodEnum<{
721
+ other: "other";
721
722
  "bug-found": "bug-found";
722
723
  "wrong-assumption": "wrong-assumption";
723
724
  "user-asked": "user-asked";
724
725
  "cleaner-way": "cleaner-way";
725
726
  "out-of-scope": "out-of-scope";
726
- other: "other";
727
727
  }>;
728
728
  why: z.ZodString;
729
729
  node: z.ZodString;
@@ -746,11 +746,11 @@ declare const specSchema: z.ZodObject<{
746
746
  box: z.ZodOptional<z.ZodString>;
747
747
  }, z.core.$strict>>;
748
748
  links: z.ZodArray<z.ZodObject<{
749
+ from: z.ZodString;
750
+ to: z.ZodString;
749
751
  label: z.ZodOptional<z.ZodString>;
750
752
  source: z.ZodOptional<z.ZodString>;
751
753
  match: z.ZodOptional<z.ZodString>;
752
- from: z.ZodString;
753
- to: z.ZodString;
754
754
  }, z.core.$strict>>;
755
755
  gaps: z.ZodOptional<z.ZodArray<z.ZodString>>;
756
756
  }, z.core.$strict>>>;
@@ -823,6 +823,8 @@ interface Config {
823
823
  /** Look up the newest codechart once a day and say when there is one. */
824
824
  updateCheck: boolean;
825
825
  release: ReleaseConfig;
826
+ /** Paths the desktop app's code layer never reads, from both config files. */
827
+ ignore: string[];
826
828
  rules: Rule[];
827
829
  }
828
830
  declare const configFileSchema: z.ZodObject<{
@@ -873,6 +875,7 @@ declare const configFileSchema: z.ZodObject<{
873
875
  }>>;
874
876
  }, z.core.$strict>>;
875
877
  useBuiltinRules: z.ZodOptional<z.ZodBoolean>;
878
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString>>;
876
879
  updateCheck: z.ZodOptional<z.ZodBoolean>;
877
880
  rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
878
881
  name: z.ZodString;
@@ -1249,8 +1252,8 @@ declare const reviewSchema: z.ZodObject<{
1249
1252
  title: z.ZodOptional<z.ZodString>;
1250
1253
  kind: z.ZodEnum<{
1251
1254
  map: "map";
1252
- flow: "flow";
1253
1255
  business: "business";
1256
+ flow: "flow";
1254
1257
  }>;
1255
1258
  branch: z.ZodString;
1256
1259
  html: z.ZodOptional<z.ZodString>;
@@ -1765,5 +1768,196 @@ declare function installCopy(skillDir: string, dir: string, who: string, files:
1765
1768
  /** Deletes only the skill's own files, and the folder if that empties it. */
1766
1769
  declare function removeSkill(dir: string, files: string[]): string | undefined;
1767
1770
 
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 };
1771
+ declare const LANGS: readonly ["typescript", "javascript", "python", "html", "css", "sql", "bash", "yaml", "json"];
1772
+ type Lang = (typeof LANGS)[number];
1773
+ declare const codeRangeSchema: z.ZodObject<{
1774
+ start: z.ZodObject<{
1775
+ line: z.ZodNumber;
1776
+ column: z.ZodNumber;
1777
+ }, z.core.$strip>;
1778
+ end: z.ZodObject<{
1779
+ line: z.ZodNumber;
1780
+ column: z.ZodNumber;
1781
+ }, z.core.$strip>;
1782
+ }, z.core.$strip>;
1783
+ type CodeRange = z.infer<typeof codeRangeSchema>;
1784
+ declare const fileInfoSchema: z.ZodObject<{
1785
+ path: z.ZodString;
1786
+ lang: z.ZodEnum<{
1787
+ html: "html";
1788
+ typescript: "typescript";
1789
+ javascript: "javascript";
1790
+ python: "python";
1791
+ css: "css";
1792
+ sql: "sql";
1793
+ bash: "bash";
1794
+ yaml: "yaml";
1795
+ json: "json";
1796
+ }>;
1797
+ hash: z.ZodString;
1798
+ }, z.core.$strip>;
1799
+ type FileInfo = z.infer<typeof fileInfoSchema>;
1800
+ declare const SYMBOL_KINDS: readonly ["class", "interface", "type", "enum", "function", "method", "module", "constant"];
1801
+ type SymbolKind = (typeof SYMBOL_KINDS)[number];
1802
+ declare const codeSymbolSchema: z.ZodObject<{
1803
+ id: z.ZodString;
1804
+ file: z.ZodString;
1805
+ path: z.ZodArray<z.ZodString>;
1806
+ kind: z.ZodEnum<{
1807
+ function: "function";
1808
+ type: "type";
1809
+ enum: "enum";
1810
+ class: "class";
1811
+ interface: "interface";
1812
+ method: "method";
1813
+ module: "module";
1814
+ constant: "constant";
1815
+ }>;
1816
+ range: z.ZodObject<{
1817
+ start: z.ZodObject<{
1818
+ line: z.ZodNumber;
1819
+ column: z.ZodNumber;
1820
+ }, z.core.$strip>;
1821
+ end: z.ZodObject<{
1822
+ line: z.ZodNumber;
1823
+ column: z.ZodNumber;
1824
+ }, z.core.$strip>;
1825
+ }, z.core.$strip>;
1826
+ }, z.core.$strip>;
1827
+ type CodeSymbol = z.infer<typeof codeSymbolSchema>;
1828
+ declare const importedNameSchema: z.ZodObject<{
1829
+ imported: z.ZodString;
1830
+ local: z.ZodString;
1831
+ typeOnly: z.ZodOptional<z.ZodBoolean>;
1832
+ definedIn: z.ZodOptional<z.ZodString>;
1833
+ }, z.core.$strip>;
1834
+ type ImportedName = z.infer<typeof importedNameSchema>;
1835
+ declare const IMPORT_KINDS: readonly ["import", "export", "require", "dynamic"];
1836
+ declare const importSchema: z.ZodObject<{
1837
+ file: z.ZodString;
1838
+ spec: z.ZodString;
1839
+ resolved: z.ZodOptional<z.ZodString>;
1840
+ status: z.ZodEnum<{
1841
+ unknown: "unknown";
1842
+ resolved: "resolved";
1843
+ external: "external";
1844
+ }>;
1845
+ kind: z.ZodEnum<{
1846
+ import: "import";
1847
+ export: "export";
1848
+ require: "require";
1849
+ dynamic: "dynamic";
1850
+ }>;
1851
+ typeOnly: z.ZodOptional<z.ZodBoolean>;
1852
+ names: z.ZodOptional<z.ZodArray<z.ZodObject<{
1853
+ imported: z.ZodString;
1854
+ local: z.ZodString;
1855
+ typeOnly: z.ZodOptional<z.ZodBoolean>;
1856
+ definedIn: z.ZodOptional<z.ZodString>;
1857
+ }, z.core.$strip>>>;
1858
+ range: z.ZodObject<{
1859
+ start: z.ZodObject<{
1860
+ line: z.ZodNumber;
1861
+ column: z.ZodNumber;
1862
+ }, z.core.$strip>;
1863
+ end: z.ZodObject<{
1864
+ line: z.ZodNumber;
1865
+ column: z.ZodNumber;
1866
+ }, z.core.$strip>;
1867
+ }, z.core.$strip>;
1868
+ }, z.core.$strip>;
1869
+ type Import = z.infer<typeof importSchema>;
1870
+ declare const callRefSchema: z.ZodObject<{
1871
+ from: z.ZodString;
1872
+ name: z.ZodString;
1873
+ to: z.ZodOptional<z.ZodString>;
1874
+ evidence: z.ZodEnum<{
1875
+ resolved: "resolved";
1876
+ "name-only": "name-only";
1877
+ }>;
1878
+ range: z.ZodObject<{
1879
+ start: z.ZodObject<{
1880
+ line: z.ZodNumber;
1881
+ column: z.ZodNumber;
1882
+ }, z.core.$strip>;
1883
+ end: z.ZodObject<{
1884
+ line: z.ZodNumber;
1885
+ column: z.ZodNumber;
1886
+ }, z.core.$strip>;
1887
+ }, z.core.$strip>;
1888
+ }, z.core.$strip>;
1889
+ type CallRef = z.infer<typeof callRefSchema>;
1890
+ /** Node identity (Live map #9): file + symbol path + kind, so line moves keep the node. */
1891
+ declare const symbolId: (file: string, path: readonly string[], kind: SymbolKind) => string;
1892
+
1893
+ /** A tree-sitter grammar codechart parses symbols with. */
1894
+ type Grammar = 'typescript' | 'tsx' | 'javascript';
1895
+ /** The v1 language of a file, from its extension; undefined for files the code layer skips. */
1896
+ declare function langOf(path: string): Lang | undefined;
1897
+ /** The grammar that reads a file's symbols, or undefined while its language has entities only or none yet. */
1898
+ declare function grammarOf(path: string): Grammar | undefined;
1899
+
1900
+ /** A name the file exports from its own scope; `local` is the binding behind `export { local as name }` or `export default local`. */
1901
+ interface ExportName {
1902
+ name: string;
1903
+ local?: string;
1904
+ }
1905
+ /** What a file exports itself. `complete` is false when it may export more than `names` (CommonJS, `export =`, syntax errors). */
1906
+ interface ModuleExports {
1907
+ names: ExportName[];
1908
+ complete: boolean;
1909
+ }
1910
+
1911
+ /** One file of the code layer. */
1912
+ interface ParsedFile {
1913
+ file: FileInfo;
1914
+ symbols: CodeSymbol[];
1915
+ /** Where tree-sitter recovered from a syntax error; empty when the file parses. */
1916
+ parseErrors: CodeRange[];
1917
+ /** Ids of symbols carried over from the last good parse with their old range, since the broken text no longer shows them. */
1918
+ kept: string[];
1919
+ /** `unknown` until `linkImports` resolves them against the rest of the repo. */
1920
+ imports: Import[];
1921
+ exports: ModuleExports;
1922
+ }
1923
+ /**
1924
+ * Parses one file in isolation. `path` is repo-relative with `/`; `lastGood` is the file's previous symbols, which
1925
+ * stand in for definitions a syntax error hides. A file in a v1 language without a symbol grammar yet gets no symbols.
1926
+ */
1927
+ declare function parseCode(path: string, text: string, lastGood?: readonly CodeSymbol[]): Promise<ParsedFile | undefined>;
1928
+
1929
+ /** Dependencies, build output and minified bundles: never source a map should point at. */
1930
+ declare const DEFAULT_CODE_IGNORE: string[];
1931
+ /**
1932
+ * Repo-relative paths of the files the code layer reads: tracked and untracked files git does not ignore
1933
+ * (`.gitignore`, `.git/info/exclude`, the global excludes file), in a v1 language, outside `DEFAULT_CODE_IGNORE` and `ignore`
1934
+ * (the config's `ignore`).
1935
+ */
1936
+ declare function listCodeFiles(root: string, ignore?: readonly string[]): string[];
1937
+ /** Reads a repo file as text; undefined when it is gone, not a regular file, too large or binary. */
1938
+ declare function readCodeFile(root: string, path: string): string | undefined;
1939
+ /** The code layer of the repo at `root`, one entry per readable file of `listCodeFiles`, imports resolved. */
1940
+ declare function parseRepo(root: string, opts?: {
1941
+ ignore?: readonly string[];
1942
+ }): Promise<ParsedFile[]>;
1943
+
1944
+ type Resolution = Pick<Import, 'status' | 'resolved'>;
1945
+ /** Resolves import specifiers against one snapshot of a repo's files; caches configs, so make a new one when a config changes. */
1946
+ interface Resolver {
1947
+ /** Where `spec`, imported by repo file `from`, leads; `kind` picks the package conditions (`require` or the rest). */
1948
+ resolve(from: string, spec: string, kind?: Import['kind']): Resolution;
1949
+ }
1950
+ /**
1951
+ * A resolver over `files` (repo paths with `/`, as `listCodeFiles` gives them); `read` returns a repo file's text.
1952
+ * Only listed files count, so nothing resolves into `node_modules` or ignored build output.
1953
+ */
1954
+ declare function createResolver(files: Iterable<string>, read: (path: string) => string | undefined): Resolver;
1955
+
1956
+ /**
1957
+ * Resolves every file's imports with `resolver`, then follows each imported name through re-exports to the file
1958
+ * that defines it. Files not passed in count as unparsed: names reaching them get no `definedIn`.
1959
+ */
1960
+ declare function linkImports(files: readonly ParsedFile[], resolver: Resolver): ParsedFile[];
1961
+
1962
+ export { AGENTS, BLOCK_MAX, BUILTIN_DEFAULTS, CODE_PATTERNS, DEFAULT_CODE_IGNORE, DEFAULT_RELEASE_BRANCHES, DESCRIPTION_CANVASES, EDGE_KINDS, FLOW_PREFIX, GENERATED_PATHS, GLOBAL_ONLY, HTML_NAME, IMPORT_KINDS, IN_DIFF, KIND_ROW, LABEL_LINE_HEIGHT, LANGS, 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, SYMBOL_KINDS, THEMES, agentsFor, anchorContext, arrowNames, asFlowSpec, blockOf, buildDoc, builtinRules, businessLinkIssues, businessSpecJsonSchema, businessTexts, callRefSchema, carryNotes, changeTitle, checkFlowAnchors, checkFlowDiff, checkMapNodes, checkRef, cleanPath, clip, codeLabelIssue, codeRangeSchema, codeSymbolSchema, configJsonSchema, copyFiles, createResolver, csv, dataSchema, diffOf, diffRange, driftBase, driftIssues, 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, linkImports, linkSchema, listCodeFiles, listReviews, load, loadConfig, loadConfigWithSources, locate, long, looksSecret, loose, marker, matchSchema, mentionsPath, mergeNotes, nodeOfHeading, normalizeEol, normalizePath, oneLine, onlyBuiltinsToJudge, opencodeConfigDir, parseCode, parseConfigFile, parseDoc, parseRepo, parseStamp, pathStr, pickLayout, plainDiffName, plainLabel, plainTextIssues, questionsOf, quotable, 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, writeReview };
1963
+ export type { AgentPreset, AnchorCtx, AnchorFailure, Block, BusinessSpec, CallRef, ChangeSpec, ChangeStatus, CheckResult, CheckSummary, CodeRange, CodeSymbol, Config, ConfigFile, ConfigWithSources, ContextMode, Diagram, Diff, DiffLine, DiffRange, Direction, DriftCause, 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, Layout, LayoutEdge, Lists, Loaded, LogEntry, MapCheck, Mismatch, ModuleExports, NodeKind, Note, NoteKind, Output, Pair, Parsed, ParsedFile, Point, Range, ReleaseSpec, Resolution, Resolver, Review, ReviewNode, ReviewSnapshot, Rule, Snippet, Spec, SpecEdge, SpecNode, Status, SymbolKind, Target, TechBox, Theme, ToJudge, ValidationResult$1 as ValidationResult, Which };