@yaks/code 0.0.0-stage → 0.2.36

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 (55) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +106 -2
  3. package/_dist/anatomy.d.ts +144 -0
  4. package/_dist/anatomy.d.ts.map +1 -0
  5. package/_dist/described.d.ts +31 -0
  6. package/_dist/described.d.ts.map +1 -0
  7. package/_dist/effects.d.ts +9 -0
  8. package/_dist/effects.d.ts.map +1 -0
  9. package/_dist/frames.d.ts +16 -0
  10. package/_dist/frames.d.ts.map +1 -0
  11. package/_dist/mod.d.ts +26 -0
  12. package/_dist/mod.d.ts.map +1 -0
  13. package/_dist/read.d.ts +89 -0
  14. package/_dist/read.d.ts.map +1 -0
  15. package/_dist/source.d.ts +55 -0
  16. package/_dist/source.d.ts.map +1 -0
  17. package/_dist/sync.d.ts +39 -0
  18. package/_dist/sync.d.ts.map +1 -0
  19. package/_dist/tools.d.ts +8 -0
  20. package/_dist/tools.d.ts.map +1 -0
  21. package/_dist/vocab.d.ts +6 -0
  22. package/_dist/vocab.d.ts.map +1 -0
  23. package/anatomy.js +552 -0
  24. package/anatomy.js.map +1 -0
  25. package/anatomy.ts +638 -0
  26. package/deno.json +1 -0
  27. package/described.js +274 -0
  28. package/described.js.map +1 -0
  29. package/described.ts +314 -0
  30. package/effects.js +24 -0
  31. package/effects.js.map +1 -0
  32. package/effects.ts +30 -0
  33. package/frames.js +46 -0
  34. package/frames.js.map +1 -0
  35. package/frames.ts +54 -0
  36. package/mod.js +26 -0
  37. package/mod.js.map +1 -0
  38. package/mod.ts +27 -0
  39. package/package.json +54 -4
  40. package/read.js +178 -0
  41. package/read.js.map +1 -0
  42. package/read.ts +249 -0
  43. package/source.js +238 -0
  44. package/source.js.map +1 -0
  45. package/source.ts +263 -0
  46. package/sync.js +345 -0
  47. package/sync.js.map +1 -0
  48. package/sync.ts +323 -0
  49. package/tools.js +49 -0
  50. package/tools.js.map +1 -0
  51. package/tools.ts +59 -0
  52. package/vocab.js +21 -0
  53. package/vocab.js.map +1 -0
  54. package/vocab.json +143 -0
  55. package/vocab.ts +22 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Jeff Peterson
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,107 @@
1
- # Temporary Holding Version
1
+ # @yaks/code
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Read a codebase into a graph, so its packages, files and exports can be
4
+ searched, linked and cited like anything else.
5
+
6
+ ```sh
7
+ yak --config yak.json code sync # read what moved since the last sync
8
+ yak --config yak.json code sync --full # read every file again
9
+ ```
10
+
11
+ A config that lists `@yaks/code` needs `@yaks/file` (the `file` a module wears),
12
+ `@yaks/git` (the `repository` that file is rooted in), `@yaks/edge` (the
13
+ `imports` relation) and `@yaks/doc` (the searchable text) beside it.
14
+
15
+ ## What it writes
16
+
17
+ ```
18
+ package{name, version, manifest} one per package.json with a name; id from name
19
+ module{blob, package} one per file, wearing @yaks/file's
20
+ file{path, root}, rooted in the
21
+ repository; id from the file
22
+ symbol{module, name, kind, line} one per export; id from module + name
23
+ imports @yaks/edge relation: module → module
24
+ ```
25
+
26
+ Where the config also lists `@yaks/vocab`, the vocabulary the graph is served
27
+ with is described in it as
28
+ [@yaks/vocab](../vocab/README.md#a-vocabulary-as-entities)'s `_namespace`,
29
+ `_comp`, `_kind`, `_effect`, `_extends`, `_prop` and `_before` entities, by the
30
+ `vocab_describe` start-up effect (`start: true`, ./described.ts), owed each time
31
+ a process starts working the effects. It is the composed vocabulary, not the
32
+ files: a package the checkout holds and the config does not list is not
33
+ described. The graph's `_vocab` holds the hash of the rows as last described, so
34
+ a graph already describing it is checked by that hash and written nothing;
35
+ otherwise only the difference is written. The `_namespace` carries its name and
36
+ the description its package.json gives it (@yaks/cli `compose` writes it on each
37
+ document), and each row points at the `_namespace` that declares it, so
38
+ `._prop.namespace._namespace.name=@yaks/id` lists every property @yaks/id
39
+ declares, on its own components and on the ones it extends. Each row is its
40
+ word's `$id`, so a word renamed in its vocab.json patches the row it had, and a
41
+ `_comp` or `_prop` keeps the label it had before in `former`, oldest first. A
42
+ row the served vocabulary stops declaring is cleared like a gone export.
43
+
44
+ A host keeping many graphs on one vocabulary can store none of it: the
45
+ `describing` plugin (`@yaks/code/described`) answers every query that names a
46
+ description component or entity from the rows the served vocabulary describes,
47
+ the same ones `described` would write, read past any an earlier copy left. A
48
+ query naming neither, such as a search, finds only what storage holds.
49
+
50
+ Each one's text is in `doc`: a package's description, a module's opening comment
51
+ (the `/** */` block or the run of `//` lines it starts with), the whole of a
52
+ markdown file, and an export's doc comment. `doc` is what full-text search and
53
+ embeddings read, so `yak search declares an identity` finds @yaks/graph's
54
+ `identities` by its doc comment.
55
+
56
+ Every id is derived from a declared identity (`identity` in the vocabulary), so
57
+ reading the same tree twice writes one set of entities. Exports are read with
58
+ `deno doc --json`; a module `deno doc` cannot resolve is still read, without its
59
+ exports, and named in the report. Imports are read from the module's own
60
+ `import … from` and `export … from` lines, resolved relative to the file or
61
+ through a workspace package's `exports`.
62
+
63
+ ## Staying current
64
+
65
+ `code sync` is a read-only [@yaks/mirror](../mirror) binding over the files Git
66
+ tracks in the checkout the command runs in. Each module records the Git blob id
67
+ of the text it was read from, and a sync reads a file again only when that blob
68
+ moved. Nothing is deleted: a file or export that is gone has its components
69
+ cleared, and a later sync fills them in when the path or name comes back.
70
+ Nothing runs a sync on its own: `yak code sync` reads what moved since the last
71
+ one.
72
+
73
+ A citation of code (`cites`, [@yaks/git](../git)) points at a `symbol`, and
74
+ `cites check` asks Git which commits touched that definition since the citation
75
+ was verified.
76
+
77
+ ## Resolving runtime places
78
+
79
+ `@yaks/code/frames` exports `resolveFrames(catalog, repository, blobs, places)`:
80
+ a catalog with `get(eids)`, the repository eid, a path-to-blob map from the
81
+ failing commit, and `{path, function, line}` places. It returns
82
+ `{app, module,
83
+ symbol}` only for catalog records whose file identity and blob
84
+ agree. A symbol must name an exported definition of that same module, not an
85
+ inferred class member or anonymous function. Unknown or stale records leave
86
+ their eids absent.
87
+
88
+ `@yaks/code/source` supplies the box boundary:
89
+ `sourceFrames({cwd, url,
90
+ origins})` reads regular-file blobs from Git at the
91
+ reported commit and reads only requested records from the catalog's HTTP query
92
+ door. File URLs must be under that repository's known checkout roots; browser
93
+ module URLs must use an explicitly served origin. It reads no source path chosen
94
+ by a frame, follows no symlink blob, and never substitutes HEAD for an unknown
95
+ commit. Bundle URLs have no source module mapping without source maps and remain
96
+ unresolved. A resolver keeps what it read: the checkout once, each commit's
97
+ blobs per path, and the worktree roots until a file frame falls under none of
98
+ them (read again at most every five seconds), so a run starts no Git process
99
+ once its commit is known. Its catalog by default is `remembered(catalog)`, which
100
+ keeps each answer a minute and shares a request among callers asking at once.
101
+
102
+ Deno doc's zero-based locations become one-based `symbol.line` at ingestion.
103
+
104
+ A host that composes another runtime can reuse `described(graph, docs)` from
105
+ `@yaks/code/effects`: it returns the schema patches and final hash without
106
+ applying them. The host can commit them in bounded batches; writing the hash
107
+ last makes an interrupted description retryable.
@@ -0,0 +1,144 @@
1
+ /** Value-free composition metadata shared by native hosts, workers and pages. */ /** A declaration is not evidence that its implementation was imported or bound. */ export type AnatomyPart = {
2
+ id: string;
3
+ name: string;
4
+ package?: string;
5
+ facet?: string;
6
+ declared: boolean;
7
+ loaded: boolean;
8
+ bound: boolean;
9
+ description?: string;
10
+ };
11
+ export type AnatomyPackage = AnatomyPart & {
12
+ configured: boolean;
13
+ };
14
+ export type AnatomyRole = AnatomyPart & {
15
+ facets: string[];
16
+ };
17
+ export type AnatomyFacet = AnatomyPart & {
18
+ selected: boolean;
19
+ /** A selected facet which has not been attempted is not known to be absent. */ attempted: boolean;
20
+ };
21
+ export type AnatomyProp = {
22
+ name: string;
23
+ schema: Record<string, unknown>;
24
+ refs: string[];
25
+ rules?: Record<string, unknown>;
26
+ };
27
+ export type AnatomyComp = AnatomyPart & {
28
+ schema: Record<string, unknown>;
29
+ props: AnatomyProp[];
30
+ extends: boolean;
31
+ refs: string[];
32
+ before: string[];
33
+ rules: Record<string, unknown>;
34
+ indexes?: {
35
+ props: string[];
36
+ unique: boolean;
37
+ present?: string[];
38
+ }[];
39
+ identity?: string[];
40
+ assocs?: {
41
+ name: string;
42
+ prop: string;
43
+ }[];
44
+ };
45
+ export type AnatomyTool = AnatomyPart & {
46
+ inputSchema: Record<string, unknown>;
47
+ outputSchema?: Record<string, unknown>;
48
+ tier?: string;
49
+ hints?: Record<string, unknown>;
50
+ };
51
+ export type AnatomyCommand = AnatomyPart & {
52
+ schema?: Record<string, unknown>;
53
+ usage?: string;
54
+ };
55
+ export type AnatomyEffect = AnatomyPart & {
56
+ handler?: string;
57
+ noop: boolean;
58
+ triggers?: Record<string, unknown>;
59
+ /** A worker registration callback is not a named effect handler. */ registration?: boolean;
60
+ };
61
+ export type AnatomyRule = AnatomyPart & {
62
+ hooks: string[];
63
+ kind?: 'plugin' | 'code' | 'data';
64
+ match?: string;
65
+ phase?: string;
66
+ before?: string[];
67
+ optimistic?: boolean;
68
+ requests?: string[];
69
+ resources?: string[];
70
+ capabilities?: string[];
71
+ };
72
+ export type AnatomyRoute = AnatomyPart & {
73
+ method: string;
74
+ path: string;
75
+ };
76
+ export type AnatomySkill = AnatomyPart & {
77
+ path?: string;
78
+ };
79
+ export type AnatomyEdge = {
80
+ id: string;
81
+ from: string;
82
+ to: string;
83
+ kind: string;
84
+ };
85
+ export type AnatomyGroup = 'packages' | 'roles' | 'facets' | 'comps' | 'tools' | 'commands' | 'effects' | 'rules' | 'hooks' | 'routes' | 'views' | 'inspectViews' | 'tui' | 'kits' | 'themes' | 'skills' | 'secrets';
86
+ /** No graph rows, plugin options, handler functions or secret values. */ export type Anatomy = {
87
+ version: 1;
88
+ host: string;
89
+ /** This is one composition, not evidence of what another host has loaded. */ scope?: 'native' | 'worker' | 'static';
90
+ /** False means the category is outside this adapter's observation, not absent. */ observed?: Partial<Record<AnatomyGroup, boolean>>;
91
+ packages: AnatomyPackage[];
92
+ roles: AnatomyRole[];
93
+ facets: AnatomyFacet[];
94
+ comps: AnatomyComp[];
95
+ tools: AnatomyTool[];
96
+ commands: AnatomyCommand[];
97
+ effects: AnatomyEffect[];
98
+ rules: AnatomyRule[];
99
+ hooks: AnatomyPart[];
100
+ routes: AnatomyRoute[];
101
+ views: AnatomyPart[];
102
+ inspectViews: AnatomyPart[];
103
+ tui: AnatomyPart[];
104
+ kits: AnatomyPart[];
105
+ themes: AnatomyPart[];
106
+ skills: AnatomySkill[];
107
+ secrets: AnatomyPart[];
108
+ edges: AnatomyEdge[];
109
+ };
110
+ /** An already-loaded metadata contribution; a supplier never requests one. */ export type AnatomyObservation = {
111
+ package: string;
112
+ facet: 'ui' | 'cli' | 'views' | 'tui';
113
+ loaded: boolean;
114
+ bound: boolean;
115
+ /** Only an adapter's allowlisted fields are retained, never this whole value. */ value?: unknown;
116
+ };
117
+ export type AnatomyObserver = (observation: AnatomyObservation) => void;
118
+ /** Adapters pass metadata they already observed, never a host or its options. */ export type AnatomySeed<T extends AnatomyPart = AnatomyPart> = Omit<T, 'id' | 'declared' | 'loaded' | 'bound'> & {
119
+ /** Distinguishes repeated registrations, and additive schema documents. */ key?: string;
120
+ declared?: boolean;
121
+ loaded?: boolean;
122
+ bound?: boolean;
123
+ };
124
+ export type AnatomySource = {
125
+ host: string;
126
+ scope: NonNullable<Anatomy['scope']>;
127
+ observed?: Anatomy['observed'];
128
+ } & {
129
+ [K in AnatomyGroup]?: AnatomySeed<Anatomy[K][number]>[];
130
+ };
131
+ /** IDs depend on provenance and registration identity, never on loading state. */ export declare let anatomyId: (group: AnatomyGroup | 'edges', owner?: string, name?: string, key?: string) => string;
132
+ /** Clone schema/declaration data without invoking getters or keeping functions. */ export declare let anatomyData: (value: unknown) => Record<string, unknown>;
133
+ /** The same value-free DTO and relationship mapper for every host adapter. */ export declare let anatomy: (source: AnatomySource) => Anatomy;
134
+ /** Project authored documents, keeping additive declarations with their owner. */ export declare let anatomyDocuments: (documents: unknown) => {
135
+ comps: AnatomySeed<AnatomyComp>[];
136
+ tools: AnatomySeed<AnatomyTool>[];
137
+ effects: AnatomySeed<AnatomyEffect>[];
138
+ rules: AnatomySeed<AnatomyRule>[];
139
+ };
140
+ /** Read registrations, never execute hooks, resources, rules or tool code. */ export declare let anatomyPlugin: (owner: string, plugin: unknown, ordinal?: string) => {
141
+ rules: AnatomySeed<AnatomyRule>[];
142
+ hooks: AnatomySeed[];
143
+ };
144
+ //# sourceMappingURL=anatomy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anatomy.d.ts","sources":["../anatomy.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,31 @@
1
+ import { type Bundle, type Graph, type Plugin } from "@yaks/graph";
2
+ import { type VocabDoc } from "@yaks/vocab";
3
+ /**
4
+ * Whether writing `fresh` over `held` would change anything: a component it
5
+ * patches that `held` lacks, or a property whose value differs.
6
+ *
7
+ * ```ts
8
+ * import { moves } from './described.ts'
9
+ * let at = { entity: { eid: 'c' }, _comp: { name: 'note', wire: null } }
10
+ * moves({ entity: { eid: 'c' }, _comp: { wire: null, name: 'note' } }, at) // false
11
+ * moves({ entity: { eid: 'c' }, _comp: { name: 'task' } }, at) // true
12
+ * moves({ entity: { eid: 'c' }, doc: { title: 'note' } }, at) // true
13
+ * ```
14
+ */ export declare let moves: (fresh: Bundle, held?: Bundle) => boolean;
15
+ /** What to write so `g` describes `docs`, the vocabulary it is served with:
16
+ * every row that is missing or says something else, every row it holds that
17
+ * `docs` no longer declares, cleared, and the hash of the rows as described
18
+ * (`_vocab`). A graph whose hash already matches is not read further and is
19
+ * written nothing; nor is one that cannot hold a vocabulary (@yaks/vocab not
20
+ * composed). A single-owner host can supply its previously committed docs to
21
+ * select only changed identities rather than read every description. */ export declare let described: (g: Graph, docs: VocabDoc[], previous?: VocabDoc[]) => Promise<Bundle[]>;
22
+ /**
23
+ * The description of the vocabulary a graph is served with, derived when
24
+ * read rather than stored: a plugin that answers every query that can match
25
+ * one of its rows from what storage holds and the rows the vocabulary
26
+ * describes, the same rows `described` would write. A stored row on an entity
27
+ * the vocabulary describes, or one saying what a component is, is what an
28
+ * earlier copy left, and is not read. A walk from a stored entity into a
29
+ * description is answered by storage alone.
30
+ */ export declare let describing: Plugin;
31
+ //# sourceMappingURL=described.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"described.d.ts","sources":["../described.ts"],"names":[],"mappings":"AA2BA,SACE,KAAK,MAAM,EAGX,KAAK,KAAK,EACV,KAAK,MAAM,2BACkB;AAG/B,SAAgC,KAAK,QAAQ,2BAAgC;AAkC7E;;;;;;;;;;;CAWC,GACD,OAAO,YAAI,QAAS,OAAO,QAAQ,OAAO,WAAS,OAAO,CAOvD;AAyDH;;;;;;sEAMsE,GACtE,OAAO,YAAI,YACT,GAAG,OACH,MAAM,YACN,WAAW,eACV,QAAQ,UA8CV;AAgFD;;;;;;;;CAQC,GACD,OAAO,YAAI,YAAY,OAqBtB"}
@@ -0,0 +1,9 @@
1
+ import type { Handlers } from "@yaks/effects";
2
+ import type { Graph } from "@yaks/graph";
3
+ export { described } from "./described.js";
4
+ /** What the handler is given: the graph. */ export type Host = {
5
+ graph: Graph;
6
+ };
7
+ /** The graph's vocabulary described in it, whenever a process starts working
8
+ * the effects. */ export declare let effects: (host: Host) => Handlers;
9
+ //# sourceMappingURL=effects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effects.d.ts","sources":["../effects.ts"],"names":[],"mappings":"AAYA,cAAc,QAAQ,6BAAkC;AACxD,cAAc,KAAK,2BAAgC;AAGnD,SAAS,SAAS,yBAAwB;AAE1C,0CAA0C,GAC1C,YAAY;EAAS,OAAO;;AAE5B;gBACgB,GAChB,OAAO,YAAI,UAAW,MAAM,SAAO,SAMjC"}
@@ -0,0 +1,16 @@
1
+ import type { Bundle } from "@yaks/graph";
2
+ export type Place = {
3
+ path: string;
4
+ function?: string;
5
+ line?: number;
6
+ };
7
+ export type Catalog = {
8
+ get: (ids: string[]) => Promise<Bundle[]>;
9
+ };
10
+ export type Resolved = {
11
+ app: boolean;
12
+ module?: string;
13
+ symbol?: string;
14
+ };
15
+ export declare let resolveFrames: (catalog: Catalog, repository: string, blobs: Map<string, string>, places: Place[]) => Promise<Resolved[]>;
16
+ //# sourceMappingURL=frames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames.d.ts","sources":["../frames.ts"],"names":[],"mappings":"AAGA,cAAc,MAAM,2BAAsC;AAI1D,YAAY;EAAU,MAAM,MAAM;EAAE,WAAW,MAAM;EAAE,OAAO,MAAM;;AACpE,YAAY;EAAY,MAAM,KAAK,MAAM,OAAO,QAAQ;;AACxD,YAAY;EAAa,KAAK,OAAO;EAAE,SAAS,MAAM;EAAE,SAAS,MAAM;;AAMvE,OAAO,YAAI,gBACT,SAAS,SACT,YAAY,MAAM,EAClB,OAAO,IAAI,MAAM,EAAE,MAAM,GACzB,QAAQ,YACP,QAAQ,YAiCV"}
package/_dist/mod.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @yaks/code — a codebase, read into a graph.
3
+ *
4
+ * A package per manifest, a module per file, a symbol per export, and an
5
+ * `imports` link per import, each with its text in `doc`, so full-text and
6
+ * vector search find code by what its comments say. A module wears the
7
+ * @yaks/git `file` it was read from, a symbol names its module, and every id
8
+ * is derived from those declared identities, so reading the same tree twice
9
+ * writes one set of entities.
10
+ *
11
+ * ```ts
12
+ * import { codeSync } from '@yaks/code'
13
+ *
14
+ * // await codeSync(graph, '/home/me/project')
15
+ * // '/home/me/project: read 1204 files (6142 exports, …) in 21000 ms.'
16
+ * ```
17
+ *
18
+ * The reading is a read-only @yaks/mirror binding: the files own the code,
19
+ * and a file is read again only when its Git blob moved.
20
+ *
21
+ * @module
22
+ */ export * from "./read.js";
23
+ export * from "./sync.js";
24
+ export * from "./tools.js";
25
+ export * from "./vocab.js";
26
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;CAqBC,GAED,0BAAyB;AACzB,0BAAyB;AACzB,2BAA0B;AAC1B,2BAA0B"}
@@ -0,0 +1,89 @@
1
+ /** Is this a file whose exports `deno doc` can read? */ export declare let isCode: (path: string) => boolean;
2
+ /** Is this a markdown document? */ export declare let isMarkdown: (path: string) => boolean;
3
+ /**
4
+ * A file's opening comment, as prose: a leading `/** *\/` or `/* *\/` block,
5
+ * or the run of `//` lines the file starts with. Blank comment lines keep the
6
+ * paragraphs apart; the first line of code ends it.
7
+ *
8
+ * ```ts
9
+ * header('// Owns the store.\n//\n// Nothing else.\nlet x = 1')
10
+ * // 'Owns the store.\n\nNothing else.'
11
+ * ```
12
+ */ export declare let header: (text: string) => string;
13
+ /**
14
+ * The specifiers a module imports or re-exports, in the order it names them,
15
+ * each once.
16
+ *
17
+ * ```ts
18
+ * specifiers("import { a } from './a.ts'\nexport * from '@yaks/git'")
19
+ * // ['./a.ts', '@yaks/git']
20
+ * ```
21
+ */ export declare let specifiers: (text: string) => string[];
22
+ /** A package as its manifest describes it: where it is and what it exports. */ export type Manifest = {
23
+ /** the manifest's own path */ path: string;
24
+ /** the directory it governs, `''` for the repository root */ dir: string;
25
+ name: string;
26
+ version?: string;
27
+ description?: string;
28
+ /** subpath → file, relative to `dir` */ exports: Record<string, string>;
29
+ };
30
+ /** Whether a path is a package's manifest: a `package.json`. */ export declare let manifests: (path: string) => boolean;
31
+ /** A `package.json`'s package, or nothing when it has no name or is a
32
+ * workspace's root rather than a package. */ export declare let manifest: (path: string, text: string) => Manifest | undefined;
33
+ /** The package a path belongs to: the manifest in its nearest directory. */ export declare let owner: (path: string, pkgs: Manifest[]) => Manifest | undefined;
34
+ /**
35
+ * The repository path a specifier names, from the module at `from`: a relative
36
+ * path, or a package of this repository by its published name and subpath.
37
+ * Anything else — a registry, a URL, a package from elsewhere — names no file
38
+ * here and resolves to nothing.
39
+ *
40
+ * ```ts
41
+ * import { assertEquals } from '@std/assert'
42
+ *
43
+ * let git = {
44
+ * path: 'packages/git/package.json',
45
+ * dir: 'packages/git',
46
+ * name: '@yaks/git',
47
+ * exports: { './cites': './cites.ts' },
48
+ * }
49
+ * assertEquals(resolve('./b.ts', 'src/a.ts', []), 'src/b.ts')
50
+ * assertEquals(
51
+ * resolve('@yaks/git/cites', 'src/a.ts', [git]),
52
+ * 'packages/git/cites.ts',
53
+ * )
54
+ * ```
55
+ */ export declare let resolve: (spec: string, from: string, pkgs: Manifest[]) => string | undefined;
56
+ /** A markdown document's title and body: the frontmatter's `doc.title` or
57
+ * the first `#` heading, else the file's name; the body after frontmatter. */ export declare let markdown: (path: string, text: string) => {
58
+ title: string;
59
+ body: string;
60
+ };
61
+ /** One export, as `deno doc` describes it. */ export type Export = {
62
+ name: string;
63
+ kind: string;
64
+ line: number;
65
+ doc: string;
66
+ };
67
+ /** One module in `deno doc --json` output, as far as this package reads it. */ export type DocNode = {
68
+ symbols?: {
69
+ name: string;
70
+ declarations?: {
71
+ location: {
72
+ filename: string;
73
+ line: number;
74
+ };
75
+ declarationKind: string;
76
+ kind: string;
77
+ jsDoc?: {
78
+ doc?: string;
79
+ };
80
+ }[];
81
+ }[];
82
+ };
83
+ /**
84
+ * The exports a module declares itself, from `deno doc --json` output: a
85
+ * re-export belongs to the module that declares it, and an overloaded name
86
+ * is one export at its first declaration. Deno locations are zero-based;
87
+ * symbol lines are one-based.
88
+ */ export declare let exportsOf: (nodes: Record<string, DocNode>, url: string) => Export[];
89
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sources":["../read.ts"],"names":[],"mappings":"AAcA,sDAAsD,GACtD,OAAO,YAAI,SAAU,MAAM,MAAM,KAAG,OAAO,CAAmC;AAE9E,iCAAiC,GACjC,OAAO,YAAI,aAAc,MAAM,MAAM,KAAG,OAAO,CAAwB;AAMvE;;;;;;;;;CASC,GACD,OAAO,YAAI,SAAU,MAAM,MAAM,KAAG,MAAM,CAwBzC;AAUD;;;;;;;;CAQC,GACD,OAAO,YAAI,aAAc,MAAM,MAAM,KAAG,MAAM,GAK7C;AAED,6EAA6E,GAC7E,YAAY;EACV,4BAA4B,GAC5B,MAAM,MAAM;EACZ,2DAA2D,GAC3D,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB,cAAc,MAAM;EACpB,sCAAsC,GACtC,SAAS,OAAO,MAAM,EAAE,MAAM;;AAGhC,8DAA8D,GAC9D,OAAO,YAAI,YAAa,MAAM,MAAM,KAAG,OAAO,CACX;AAEnC;2CAC2C,GAC3C,OAAO,YAAI,WAAY,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,WAAW,SAAS,CA0BvE;AAED,0EAA0E,GAC1E,OAAO,YAAI,QACT,MAAM,MAAM,EACZ,MAAM,eACL,WAAW,SAAS,CAE4B;AAanD;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,YAAI,UACT,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,MAAM,eACL,MAAM,GAAG,SAAS,CAWpB;AAED;4EAC4E,GAC5E,OAAO,YAAI,WACT,MAAM,MAAM,EACZ,MAAM,MAAM;EACT,OAAO,MAAM;EAAE,MAAM,MAAM;EAW/B;AAED,4CAA4C,GAC5C,YAAY;EAAW,MAAM,MAAM;EAAE,MAAM,MAAM;EAAE,MAAM,MAAM;EAAE,KAAK,MAAM;;AAE5E,6EAA6E,GAC7E,YAAY;EACV;IACE,MAAM,MAAM;IACZ;MACE;QAAY,UAAU,MAAM;QAAE,MAAM,MAAM;;MAC1C,iBAAiB,MAAM;MACvB,MAAM,MAAM;MACZ;QAAU,MAAM,MAAM;;;;;AAK5B;;;;;CAKC,GACD,OAAO,YAAI,YACT,OAAO,OAAO,MAAM,EAAE,UACtB,KAAK,MAAM,KACV,SAgBF"}