@zenera/rag 1.1.6 → 1.1.9

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 (40) hide show
  1. package/README.md +28 -2
  2. package/dist/command.js +41 -727
  3. package/dist/common/embedder.d.ts +3 -0
  4. package/dist/common/embedder.js +64 -0
  5. package/dist/common/locate.d.ts +18 -0
  6. package/dist/{schema → common}/locate.js +42 -28
  7. package/dist/common/manifest.d.ts +50 -0
  8. package/dist/common/manifest.js +62 -0
  9. package/dist/common/progress.d.ts +57 -0
  10. package/dist/common/progress.js +155 -0
  11. package/dist/common/prose.d.ts +13 -0
  12. package/dist/common/prose.js +56 -0
  13. package/dist/index.d.ts +6 -4
  14. package/dist/index.js +6 -4
  15. package/dist/schema/build.js +6 -2
  16. package/dist/schema/command.d.ts +3 -0
  17. package/dist/schema/command.js +819 -0
  18. package/dist/schema/files.d.ts +5 -27
  19. package/dist/schema/files.js +9 -29
  20. package/dist/schema/lookup.d.ts +1 -1
  21. package/dist/schema/lookup.js +1 -1
  22. package/dist/{present.d.ts → schema/present.d.ts} +5 -5
  23. package/dist/{present.js → schema/present.js} +2 -2
  24. package/dist/{query.d.ts → schema/query.d.ts} +1 -1
  25. package/dist/schema/readme.d.ts +6 -0
  26. package/dist/schema/readme.js +122 -0
  27. package/dist/{repl.d.ts → schema/repl.d.ts} +1 -1
  28. package/dist/schema/search.js +2 -1
  29. package/dist/schema/tools.d.ts +1 -1
  30. package/dist/schema/tools.js +97 -6
  31. package/dist/schema/trace.d.ts +52 -0
  32. package/dist/schema/trace.js +144 -0
  33. package/package.json +3 -3
  34. package/dist/schema/locate.d.ts +0 -20
  35. package/dist/schema/progress.d.ts +0 -26
  36. package/dist/schema/progress.js +0 -316
  37. /package/dist/{schema → common}/match.d.ts +0 -0
  38. /package/dist/{schema → common}/match.js +0 -0
  39. /package/dist/{query.js → schema/query.js} +0 -0
  40. /package/dist/{repl.js → schema/repl.js} +0 -0
package/README.md CHANGED
@@ -56,6 +56,7 @@ zen rag schema list methods --path "*/users*" # every route under /users
56
56
  zen rag schema list types --name "*Password*" # every schema so named
57
57
  zen rag schema grep password # every literal occurrence
58
58
  zen rag schema grep "pass(word|phrase)" --regex
59
+ zen rag schema trace city # which calls can reach the field
59
60
  zen rag schema show --method GetCurrentUserInfo --format openapi --exact
60
61
  ```
61
62
 
@@ -80,6 +81,27 @@ printed rows, so a shortened answer still tells you how much there is. Nothing
80
81
  matching exits 0 — an empty answer is an answer, and here it is a trustworthy
81
82
  one: if `grep` finds nothing, the word is not in the description.
82
83
 
84
+ Finding a field is half the job; the other half is which call can reach it, and
85
+ that is a walk up the `$ref`s rather than a match on anything. `trace` does it:
86
+
87
+ ```sh
88
+ zen rag schema trace city
89
+ ```
90
+
91
+ ```
92
+ Property:Address.city
93
+ GET /users/{userId} getUser output PublicUserProfile.address → Address.city
94
+ ```
95
+
96
+ No search can be relied on for that — `search` stitches its seeds into one
97
+ connected piece, but only between the nodes that ranked and only within
98
+ `--max-hops`, and `getUser` and `city` share no word for either of them to rank
99
+ on. `--direction` keeps just the calls that accept it or return it,
100
+ `--kind` narrows what a bare pattern may start from, `--routes` and `--limit`
101
+ cut the printed rows without lying about `found`, and `--ids-only` pipes the
102
+ operations onward. A node nothing carries says so, which is worth knowing: it
103
+ means no request in this document will ever carry it.
104
+
83
105
  Non-interactive search is a machine interface: every field is a flag, the whole
84
106
  query can arrive as one JSON object, the `--json` output keeps the same
85
107
  structure from run to run, no terminal is required, and an empty result exits 0.
@@ -118,6 +140,7 @@ zen rag schema index <spec...> Read the documents and write a searchable index
118
140
  zen rag schema search Ask it something. --interactive for a prompt.
119
141
  zen rag schema list <what> Every method, type or property. No ranking.
120
142
  zen rag schema grep <pattern> Every literal match across the whole index.
143
+ zen rag schema trace <what> Up from a field to the calls that carry it.
121
144
  zen rag schema show [id...] Print named nodes, with no search in between.
122
145
  zen rag schema stats What is in an index, and what built it.
123
146
  ```
@@ -157,7 +180,7 @@ const index = await SchemaIndex.open(
157
180
  const project = await loadProject('./my-project', { tools: schemaTools(index) });
158
181
  ```
159
182
 
160
- Five tools in the group `schema`, selectable as `schema:*`:
183
+ Six tools in the group `schema`, selectable as `schema:*`:
161
184
 
162
185
  | Tool | For |
163
186
  | -------------------------- | ------------------------------------------------------- |
@@ -166,6 +189,7 @@ Five tools in the group `schema`, selectable as `schema:*`:
166
189
  | `find_types_with_property` | which types have a field of this name — no search |
167
190
  | `list_api` | the shape of the API: methods, types or fields |
168
191
  | `grep_api` | every literal occurrence of a string — no search |
192
+ | `trace_api` | the operations that carry a given field or schema |
169
193
 
170
194
  Only the first of those ranks anything. The rest are exact, because a model
171
195
  told "no results" by a vector search has learned nothing: a ranking returns the
@@ -173,7 +197,9 @@ top of a list, so an empty answer and an absent thing look identical.
173
197
  `find_types_with_property` is the one for the repair loop — when `tsc` says
174
198
  `'password' does not exist in type 'PublicUserProfile'`, the model does not
175
199
  need the word explained again, it needs the list of types that have one.
176
- `grep_api` is the same instinct widened to the whole description.
200
+ `grep_api` is the same instinct widened to the whole description, and
201
+ `trace_api` is the step after both: a field is of no use until the call that
202
+ carries it is known.
177
203
 
178
204
  ## What an index is
179
205