@afaik-lab/weigh 0.0.0 → 0.6.1

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 (349) hide show
  1. package/.env.example +49 -0
  2. package/LICENSE +373 -0
  3. package/README.md +103 -1
  4. package/dist/agent.d.ts +83 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/agent.js +204 -0
  7. package/dist/agent.js.map +1 -0
  8. package/dist/ceilings.d.ts +32 -0
  9. package/dist/ceilings.d.ts.map +1 -0
  10. package/dist/ceilings.js +61 -0
  11. package/dist/ceilings.js.map +1 -0
  12. package/dist/cli.d.ts +3 -0
  13. package/dist/cli.d.ts.map +1 -0
  14. package/dist/cli.js +530 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/config-cli.d.ts +15 -0
  17. package/dist/config-cli.d.ts.map +1 -0
  18. package/dist/config-cli.js +141 -0
  19. package/dist/config-cli.js.map +1 -0
  20. package/dist/config.d.ts +198 -0
  21. package/dist/config.d.ts.map +1 -0
  22. package/dist/config.js +373 -0
  23. package/dist/config.js.map +1 -0
  24. package/dist/context-cli.d.ts +35 -0
  25. package/dist/context-cli.d.ts.map +1 -0
  26. package/dist/context-cli.js +251 -0
  27. package/dist/context-cli.js.map +1 -0
  28. package/dist/context.d.ts +118 -0
  29. package/dist/context.d.ts.map +1 -0
  30. package/dist/context.js +159 -0
  31. package/dist/context.js.map +1 -0
  32. package/dist/corrections/correction-set.d.ts +67 -0
  33. package/dist/corrections/correction-set.d.ts.map +1 -0
  34. package/dist/corrections/correction-set.js +104 -0
  35. package/dist/corrections/correction-set.js.map +1 -0
  36. package/dist/corrections/correction.d.ts +74 -0
  37. package/dist/corrections/correction.d.ts.map +1 -0
  38. package/dist/corrections/correction.js +154 -0
  39. package/dist/corrections/correction.js.map +1 -0
  40. package/dist/corrections/follow-up.d.ts +69 -0
  41. package/dist/corrections/follow-up.d.ts.map +1 -0
  42. package/dist/corrections/follow-up.js +217 -0
  43. package/dist/corrections/follow-up.js.map +1 -0
  44. package/dist/corrections/index.d.ts +31 -0
  45. package/dist/corrections/index.d.ts.map +1 -0
  46. package/dist/corrections/index.js +31 -0
  47. package/dist/corrections/index.js.map +1 -0
  48. package/dist/corrections/ledger.d.ts +78 -0
  49. package/dist/corrections/ledger.d.ts.map +1 -0
  50. package/dist/corrections/ledger.js +117 -0
  51. package/dist/corrections/ledger.js.map +1 -0
  52. package/dist/corrections/promotion.d.ts +119 -0
  53. package/dist/corrections/promotion.d.ts.map +1 -0
  54. package/dist/corrections/promotion.js +221 -0
  55. package/dist/corrections/promotion.js.map +1 -0
  56. package/dist/corrections/schema.d.ts +125 -0
  57. package/dist/corrections/schema.d.ts.map +1 -0
  58. package/dist/corrections/schema.js +100 -0
  59. package/dist/corrections/schema.js.map +1 -0
  60. package/dist/corrections-cli.d.ts +28 -0
  61. package/dist/corrections-cli.d.ts.map +1 -0
  62. package/dist/corrections-cli.js +157 -0
  63. package/dist/corrections-cli.js.map +1 -0
  64. package/dist/diff.d.ts +105 -0
  65. package/dist/diff.d.ts.map +1 -0
  66. package/dist/diff.js +202 -0
  67. package/dist/diff.js.map +1 -0
  68. package/dist/doctor.d.ts +38 -0
  69. package/dist/doctor.d.ts.map +1 -0
  70. package/dist/doctor.js +197 -0
  71. package/dist/doctor.js.map +1 -0
  72. package/dist/events.d.ts +21 -0
  73. package/dist/events.d.ts.map +1 -0
  74. package/dist/events.js +5 -0
  75. package/dist/events.js.map +1 -0
  76. package/dist/findings.d.ts +510 -0
  77. package/dist/findings.d.ts.map +1 -0
  78. package/dist/findings.js +645 -0
  79. package/dist/findings.js.map +1 -0
  80. package/dist/follow-up-cli.d.ts +88 -0
  81. package/dist/follow-up-cli.d.ts.map +1 -0
  82. package/dist/follow-up-cli.js +208 -0
  83. package/dist/follow-up-cli.js.map +1 -0
  84. package/dist/harness.d.ts +64 -0
  85. package/dist/harness.d.ts.map +1 -0
  86. package/dist/harness.js +71 -0
  87. package/dist/harness.js.map +1 -0
  88. package/dist/help/command-help.d.ts +9 -0
  89. package/dist/help/command-help.d.ts.map +1 -0
  90. package/dist/help/command-help.js +21 -0
  91. package/dist/help/command-help.js.map +1 -0
  92. package/dist/help/commands/answer.d.ts +3 -0
  93. package/dist/help/commands/answer.d.ts.map +1 -0
  94. package/dist/help/commands/answer.js +39 -0
  95. package/dist/help/commands/answer.js.map +1 -0
  96. package/dist/help/commands/config.d.ts +3 -0
  97. package/dist/help/commands/config.d.ts.map +1 -0
  98. package/dist/help/commands/config.js +25 -0
  99. package/dist/help/commands/config.js.map +1 -0
  100. package/dist/help/commands/context.d.ts +3 -0
  101. package/dist/help/commands/context.d.ts.map +1 -0
  102. package/dist/help/commands/context.js +44 -0
  103. package/dist/help/commands/context.js.map +1 -0
  104. package/dist/help/commands/corrections.d.ts +3 -0
  105. package/dist/help/commands/corrections.d.ts.map +1 -0
  106. package/dist/help/commands/corrections.js +30 -0
  107. package/dist/help/commands/corrections.js.map +1 -0
  108. package/dist/help/commands/doctor.d.ts +3 -0
  109. package/dist/help/commands/doctor.d.ts.map +1 -0
  110. package/dist/help/commands/doctor.js +12 -0
  111. package/dist/help/commands/doctor.js.map +1 -0
  112. package/dist/help/commands/index.d.ts +4 -0
  113. package/dist/help/commands/index.d.ts.map +1 -0
  114. package/dist/help/commands/index.js +27 -0
  115. package/dist/help/commands/index.js.map +1 -0
  116. package/dist/help/commands/memory.d.ts +3 -0
  117. package/dist/help/commands/memory.d.ts.map +1 -0
  118. package/dist/help/commands/memory.js +33 -0
  119. package/dist/help/commands/memory.js.map +1 -0
  120. package/dist/help/commands/models.d.ts +3 -0
  121. package/dist/help/commands/models.d.ts.map +1 -0
  122. package/dist/help/commands/models.js +17 -0
  123. package/dist/help/commands/models.js.map +1 -0
  124. package/dist/help/commands/options.d.ts +4 -0
  125. package/dist/help/commands/options.d.ts.map +1 -0
  126. package/dist/help/commands/options.js +13 -0
  127. package/dist/help/commands/options.js.map +1 -0
  128. package/dist/help/commands/review.d.ts +3 -0
  129. package/dist/help/commands/review.d.ts.map +1 -0
  130. package/dist/help/commands/review.js +50 -0
  131. package/dist/help/commands/review.js.map +1 -0
  132. package/dist/help/commands/sessions.d.ts +3 -0
  133. package/dist/help/commands/sessions.d.ts.map +1 -0
  134. package/dist/help/commands/sessions.js +23 -0
  135. package/dist/help/commands/sessions.js.map +1 -0
  136. package/dist/help/commands/show.d.ts +3 -0
  137. package/dist/help/commands/show.d.ts.map +1 -0
  138. package/dist/help/commands/show.js +18 -0
  139. package/dist/help/commands/show.js.map +1 -0
  140. package/dist/help/help.d.ts +16 -0
  141. package/dist/help/help.d.ts.map +1 -0
  142. package/dist/help/help.js +68 -0
  143. package/dist/help/help.js.map +1 -0
  144. package/dist/help/index.d.ts +4 -0
  145. package/dist/help/index.d.ts.map +1 -0
  146. package/dist/help/index.js +7 -0
  147. package/dist/help/index.js.map +1 -0
  148. package/dist/index.d.ts +80 -0
  149. package/dist/index.d.ts.map +1 -0
  150. package/dist/index.js +51 -0
  151. package/dist/index.js.map +1 -0
  152. package/dist/knowledge/block.d.ts +65 -0
  153. package/dist/knowledge/block.d.ts.map +1 -0
  154. package/dist/knowledge/block.js +89 -0
  155. package/dist/knowledge/block.js.map +1 -0
  156. package/dist/knowledge/claim.d.ts +143 -0
  157. package/dist/knowledge/claim.d.ts.map +1 -0
  158. package/dist/knowledge/claim.js +303 -0
  159. package/dist/knowledge/claim.js.map +1 -0
  160. package/dist/knowledge/index.d.ts +32 -0
  161. package/dist/knowledge/index.d.ts.map +1 -0
  162. package/dist/knowledge/index.js +29 -0
  163. package/dist/knowledge/index.js.map +1 -0
  164. package/dist/knowledge/novelty.d.ts +65 -0
  165. package/dist/knowledge/novelty.d.ts.map +1 -0
  166. package/dist/knowledge/novelty.js +100 -0
  167. package/dist/knowledge/novelty.js.map +1 -0
  168. package/dist/knowledge/recall.d.ts +134 -0
  169. package/dist/knowledge/recall.d.ts.map +1 -0
  170. package/dist/knowledge/recall.js +229 -0
  171. package/dist/knowledge/recall.js.map +1 -0
  172. package/dist/knowledge/recalled-claim.d.ts +35 -0
  173. package/dist/knowledge/recalled-claim.d.ts.map +1 -0
  174. package/dist/knowledge/recalled-claim.js +67 -0
  175. package/dist/knowledge/recalled-claim.js.map +1 -0
  176. package/dist/knowledge/recalled.d.ts +70 -0
  177. package/dist/knowledge/recalled.d.ts.map +1 -0
  178. package/dist/knowledge/recalled.js +149 -0
  179. package/dist/knowledge/recalled.js.map +1 -0
  180. package/dist/knowledge/schema.d.ts +83 -0
  181. package/dist/knowledge/schema.d.ts.map +1 -0
  182. package/dist/knowledge/schema.js +96 -0
  183. package/dist/knowledge/schema.js.map +1 -0
  184. package/dist/knowledge/staleness.d.ts +48 -0
  185. package/dist/knowledge/staleness.d.ts.map +1 -0
  186. package/dist/knowledge/staleness.js +85 -0
  187. package/dist/knowledge/staleness.js.map +1 -0
  188. package/dist/knowledge/store.d.ts +100 -0
  189. package/dist/knowledge/store.d.ts.map +1 -0
  190. package/dist/knowledge/store.js +184 -0
  191. package/dist/knowledge/store.js.map +1 -0
  192. package/dist/memory/compose-file.d.ts +14 -0
  193. package/dist/memory/compose-file.d.ts.map +1 -0
  194. package/dist/memory/compose-file.js +25 -0
  195. package/dist/memory/compose-file.js.map +1 -0
  196. package/dist/memory/index.d.ts +43 -0
  197. package/dist/memory/index.d.ts.map +1 -0
  198. package/dist/memory/index.js +119 -0
  199. package/dist/memory/index.js.map +1 -0
  200. package/dist/memory/oss.d.ts +62 -0
  201. package/dist/memory/oss.d.ts.map +1 -0
  202. package/dist/memory/oss.js +230 -0
  203. package/dist/memory/oss.js.map +1 -0
  204. package/dist/memory/platform.d.ts +37 -0
  205. package/dist/memory/platform.d.ts.map +1 -0
  206. package/dist/memory/platform.js +131 -0
  207. package/dist/memory/platform.js.map +1 -0
  208. package/dist/memory/scope.d.ts +49 -0
  209. package/dist/memory/scope.d.ts.map +1 -0
  210. package/dist/memory/scope.js +70 -0
  211. package/dist/memory/scope.js.map +1 -0
  212. package/dist/memory/types.d.ts +113 -0
  213. package/dist/memory/types.d.ts.map +1 -0
  214. package/dist/memory/types.js +18 -0
  215. package/dist/memory/types.js.map +1 -0
  216. package/dist/memory-cli.d.ts +17 -0
  217. package/dist/memory-cli.d.ts.map +1 -0
  218. package/dist/memory-cli.js +107 -0
  219. package/dist/memory-cli.js.map +1 -0
  220. package/dist/models-cli.d.ts +12 -0
  221. package/dist/models-cli.d.ts.map +1 -0
  222. package/dist/models-cli.js +54 -0
  223. package/dist/models-cli.js.map +1 -0
  224. package/dist/models.d.ts +111 -0
  225. package/dist/models.d.ts.map +1 -0
  226. package/dist/models.js +228 -0
  227. package/dist/models.js.map +1 -0
  228. package/dist/paths.d.ts +35 -0
  229. package/dist/paths.d.ts.map +1 -0
  230. package/dist/paths.js +65 -0
  231. package/dist/paths.js.map +1 -0
  232. package/dist/profile.d.ts +28 -0
  233. package/dist/profile.d.ts.map +1 -0
  234. package/dist/profile.js +154 -0
  235. package/dist/profile.js.map +1 -0
  236. package/dist/progress.d.ts +70 -0
  237. package/dist/progress.d.ts.map +1 -0
  238. package/dist/progress.js +132 -0
  239. package/dist/progress.js.map +1 -0
  240. package/dist/quiet.d.ts +2 -0
  241. package/dist/quiet.d.ts.map +1 -0
  242. package/dist/quiet.js +21 -0
  243. package/dist/quiet.js.map +1 -0
  244. package/dist/reconcile/continuation.d.ts +132 -0
  245. package/dist/reconcile/continuation.d.ts.map +1 -0
  246. package/dist/reconcile/continuation.js +306 -0
  247. package/dist/reconcile/continuation.js.map +1 -0
  248. package/dist/reconcile/index.d.ts +26 -0
  249. package/dist/reconcile/index.d.ts.map +1 -0
  250. package/dist/reconcile/index.js +28 -0
  251. package/dist/reconcile/index.js.map +1 -0
  252. package/dist/reconcile/outcome-set.d.ts +53 -0
  253. package/dist/reconcile/outcome-set.d.ts.map +1 -0
  254. package/dist/reconcile/outcome-set.js +124 -0
  255. package/dist/reconcile/outcome-set.js.map +1 -0
  256. package/dist/reconcile/outcome.d.ts +56 -0
  257. package/dist/reconcile/outcome.d.ts.map +1 -0
  258. package/dist/reconcile/outcome.js +60 -0
  259. package/dist/reconcile/outcome.js.map +1 -0
  260. package/dist/reconcile/reconciliation.d.ts +49 -0
  261. package/dist/reconcile/reconciliation.d.ts.map +1 -0
  262. package/dist/reconcile/reconciliation.js +88 -0
  263. package/dist/reconcile/reconciliation.js.map +1 -0
  264. package/dist/reconcile/schema.d.ts +157 -0
  265. package/dist/reconcile/schema.d.ts.map +1 -0
  266. package/dist/reconcile/schema.js +97 -0
  267. package/dist/reconcile/schema.js.map +1 -0
  268. package/dist/record/index.d.ts +23 -0
  269. package/dist/record/index.d.ts.map +1 -0
  270. package/dist/record/index.js +25 -0
  271. package/dist/record/index.js.map +1 -0
  272. package/dist/record/review-record.d.ts +28 -0
  273. package/dist/record/review-record.d.ts.map +1 -0
  274. package/dist/record/review-record.js +78 -0
  275. package/dist/record/review-record.js.map +1 -0
  276. package/dist/record/schema.d.ts +153 -0
  277. package/dist/record/schema.d.ts.map +1 -0
  278. package/dist/record/schema.js +87 -0
  279. package/dist/record/schema.js.map +1 -0
  280. package/dist/record/store.d.ts +83 -0
  281. package/dist/record/store.d.ts.map +1 -0
  282. package/dist/record/store.js +162 -0
  283. package/dist/record/store.js.map +1 -0
  284. package/dist/record/stored-review.d.ts +36 -0
  285. package/dist/record/stored-review.d.ts.map +1 -0
  286. package/dist/record/stored-review.js +90 -0
  287. package/dist/record/stored-review.js.map +1 -0
  288. package/dist/refute.d.ts +318 -0
  289. package/dist/refute.d.ts.map +1 -0
  290. package/dist/refute.js +513 -0
  291. package/dist/refute.js.map +1 -0
  292. package/dist/render.d.ts +212 -0
  293. package/dist/render.d.ts.map +1 -0
  294. package/dist/render.js +544 -0
  295. package/dist/render.js.map +1 -0
  296. package/dist/review-cli.d.ts +181 -0
  297. package/dist/review-cli.d.ts.map +1 -0
  298. package/dist/review-cli.js +598 -0
  299. package/dist/review-cli.js.map +1 -0
  300. package/dist/reviewer.d.ts +297 -0
  301. package/dist/reviewer.d.ts.map +1 -0
  302. package/dist/reviewer.js +584 -0
  303. package/dist/reviewer.js.map +1 -0
  304. package/dist/session-cli.d.ts +17 -0
  305. package/dist/session-cli.d.ts.map +1 -0
  306. package/dist/session-cli.js +62 -0
  307. package/dist/session-cli.js.map +1 -0
  308. package/dist/session.d.ts +36 -0
  309. package/dist/session.d.ts.map +1 -0
  310. package/dist/session.js +105 -0
  311. package/dist/session.js.map +1 -0
  312. package/dist/settings.d.ts +68 -0
  313. package/dist/settings.d.ts.map +1 -0
  314. package/dist/settings.js +175 -0
  315. package/dist/settings.js.map +1 -0
  316. package/dist/show-cli.d.ts +39 -0
  317. package/dist/show-cli.d.ts.map +1 -0
  318. package/dist/show-cli.js +56 -0
  319. package/dist/show-cli.js.map +1 -0
  320. package/dist/stdout.d.ts +28 -0
  321. package/dist/stdout.d.ts.map +1 -0
  322. package/dist/stdout.js +44 -0
  323. package/dist/stdout.js.map +1 -0
  324. package/dist/target.d.ts +58 -0
  325. package/dist/target.d.ts.map +1 -0
  326. package/dist/target.js +96 -0
  327. package/dist/target.js.map +1 -0
  328. package/dist/tools/index.d.ts +93 -0
  329. package/dist/tools/index.d.ts.map +1 -0
  330. package/dist/tools/index.js +146 -0
  331. package/dist/tools/index.js.map +1 -0
  332. package/dist/tools/root.d.ts +62 -0
  333. package/dist/tools/root.d.ts.map +1 -0
  334. package/dist/tools/root.js +51 -0
  335. package/dist/tools/root.js.map +1 -0
  336. package/dist/usage.d.ts +75 -0
  337. package/dist/usage.d.ts.map +1 -0
  338. package/dist/usage.js +100 -0
  339. package/dist/usage.js.map +1 -0
  340. package/dist/version.d.ts +14 -0
  341. package/dist/version.d.ts.map +1 -0
  342. package/dist/version.js +26 -0
  343. package/dist/version.js.map +1 -0
  344. package/dist/workspace.d.ts +48 -0
  345. package/dist/workspace.d.ts.map +1 -0
  346. package/dist/workspace.js +126 -0
  347. package/dist/workspace.js.map +1 -0
  348. package/docker-compose.yml +61 -0
  349. package/package.json +72 -1
@@ -0,0 +1,141 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
5
+ import { dirname, join } from 'path';
6
+ import { REPO_CONFIG_FILE, loadConfigDetailed } from './config.js';
7
+ import { paths } from './paths.js';
8
+ import { SETTINGS, SETTINGS_BY_KEY, coerce } from './settings.js';
9
+ import { repoRootOf } from './target.js';
10
+ export const CONFIG_VERBS = ['list', 'get', 'set', 'path'];
11
+ export function isConfigVerb(v) {
12
+ return CONFIG_VERBS.includes(v);
13
+ }
14
+ const REDACTED = '••••••••';
15
+ function read(key, config) {
16
+ return key.split('.').reduce((node, part) => node?.[part], config);
17
+ }
18
+ /**
19
+ * `weigh config <verb>` — the answer to "why isn't my setting applied?".
20
+ *
21
+ * Provenance is the point: a value is never shown without where it came from,
22
+ * because with this many layers the interesting question is not what a setting is
23
+ * but which layer won.
24
+ */
25
+ export async function runConfigCommand(verb, args, options) {
26
+ // The repository `--repo` names, else the working directory's: its shared
27
+ // file is a layer, so which repository decides what the answer is.
28
+ const repoRoot = repoRootOf(options.repo);
29
+ if (verb === 'path') {
30
+ const all = {
31
+ home: paths.home(),
32
+ ...(repoRoot && { shared: join(repoRoot, REPO_CONFIG_FILE) }),
33
+ config: paths.config(),
34
+ credentials: paths.envFile(),
35
+ sessions: paths.sessions(),
36
+ reviews: paths.reviews(),
37
+ corrections: paths.corrections(),
38
+ cache: paths.cache(),
39
+ workspaces: paths.workspaces(),
40
+ };
41
+ if (options.json)
42
+ process.stdout.write(JSON.stringify(all) + '\n');
43
+ else
44
+ for (const [k, v] of Object.entries(all))
45
+ process.stdout.write(`${k.padEnd(12)} ${v}\n`);
46
+ return 0;
47
+ }
48
+ if (verb === 'set') {
49
+ const [key, ...rest] = args;
50
+ const value = rest.join(' ');
51
+ const setting = key ? SETTINGS_BY_KEY.get(key) : undefined;
52
+ if (!setting) {
53
+ process.stderr.write(`Unknown setting: ${key ?? '(none)'}\nTry: weigh config list\n`);
54
+ return 1;
55
+ }
56
+ if (!value) {
57
+ process.stderr.write(`Usage: weigh config set ${key} <value>\n`);
58
+ return 1;
59
+ }
60
+ let parsed;
61
+ try {
62
+ parsed = coerce(setting, value, setting.key);
63
+ }
64
+ catch (err) {
65
+ process.stderr.write(`${err.message}\n`);
66
+ return 1;
67
+ }
68
+ const file = paths.config();
69
+ const existing = existsSync(file) ? JSON.parse(readFileSync(file, 'utf-8')) : {};
70
+ const parts = key.split('.');
71
+ // The key is already one of SETTINGS, so none of these can arrive. Refused
72
+ // here as well because this is the loop that would write to
73
+ // Object.prototype if one did.
74
+ for (const part of parts) {
75
+ if (part === '__proto__' || part === 'constructor' || part === 'prototype') {
76
+ process.stderr.write(`Unknown setting: ${key}\n`);
77
+ return 1;
78
+ }
79
+ }
80
+ let node = existing;
81
+ for (const part of parts.slice(0, -1))
82
+ node = node[part] ??= {};
83
+ node[parts.at(-1)] = parsed;
84
+ mkdirSync(dirname(file), { recursive: true });
85
+ writeFileSync(file, JSON.stringify(existing, null, 2) + '\n');
86
+ process.stdout.write(`${key} = ${setting.secret ? REDACTED : parsed} → ${file}\n`);
87
+ if (setting.secret) {
88
+ process.stderr.write(`Note: secrets are usually better placed in ${paths.envFile()}\n`);
89
+ }
90
+ return 0;
91
+ }
92
+ const { config, warnings, provenance } = loadConfigDetailed({}, { skipApiKey: true, ...(repoRoot && { repoRoot }) });
93
+ const rows = SETTINGS.filter((s) => !s.key.startsWith('$')).map((s) => {
94
+ const value = read(s.key, config);
95
+ return {
96
+ key: s.key,
97
+ value: s.secret && value ? REDACTED : (value ?? null),
98
+ source: (provenance.get(s.key) ?? 'default'),
99
+ env: s.env ?? null,
100
+ describe: s.describe,
101
+ };
102
+ });
103
+ if (verb === 'get') {
104
+ const row = rows.find((r) => r.key === args[0]);
105
+ if (!row) {
106
+ process.stderr.write(`Unknown setting: ${args[0] ?? '(none)'}\n`);
107
+ return 1;
108
+ }
109
+ if (options.json)
110
+ process.stdout.write(JSON.stringify(row) + '\n');
111
+ else
112
+ process.stdout.write(`${row.value} (${row.source})\n`);
113
+ return 0;
114
+ }
115
+ if (options.json) {
116
+ process.stdout.write(JSON.stringify({ settings: rows, warnings }) + '\n');
117
+ return warnings.length ? 1 : 0;
118
+ }
119
+ const width = Math.max(...rows.map((r) => r.key.length));
120
+ let group = '';
121
+ for (const row of rows) {
122
+ const prefix = row.key.includes('.') ? row.key.split('.')[0] : 'core';
123
+ if (prefix !== group) {
124
+ group = prefix;
125
+ process.stdout.write(`\n${group}\n`);
126
+ }
127
+ // Collapse to one line: a multi-line value (the system prompt) would
128
+ // otherwise tear the column alignment apart.
129
+ const raw = row.value === null || row.value === '' ? '—' : String(row.value);
130
+ const flat = raw.replace(/\s+/g, ' ').trim();
131
+ const value = flat.length > 28 ? flat.slice(0, 27) + '…' : flat;
132
+ process.stdout.write(` ${row.key.padEnd(width)} ${value.padEnd(28)} ${row.source}\n`);
133
+ }
134
+ if (warnings.length) {
135
+ process.stdout.write('\nwarnings\n');
136
+ for (const w of warnings)
137
+ process.stdout.write(` ! ${w}\n`);
138
+ }
139
+ return warnings.length ? 1 : 0;
140
+ }
141
+ //# sourceMappingURL=config-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-cli.js","sourceRoot":"","sources":["../src/config-cli.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,Q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AG,MAAM,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;QACvC,CAAC;QACD,qEAAqE;QACrE,6CAA6C;QAC7C,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,KAAK,IAAI,IAAI,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7E,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACrC,KAAK,MAAM,CAAC,IAAI,QAAQ;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,198 @@
1
+ export type MemoryBackendName = 'platform' | 'oss';
2
+ /** Mirrors the SDK's EffortLevel, restated so AgentConfig owns its own types. */
3
+ export type Effort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
4
+ export type EmbedderProvider = 'ollama' | 'openai';
5
+ export interface MemorySettings {
6
+ enabled: boolean;
7
+ backend: MemoryBackendName;
8
+ /** Long-term identity — the axis memories are keyed on across sessions. */
9
+ userId: string;
10
+ /** Which agent wrote a memory, so several agents can share a user namespace. */
11
+ agentId: string;
12
+ /** How many memories to pull into the system prompt before a run. */
13
+ topK: number;
14
+ /** Minimum relevance score for recalled memories, when the backend supports it. */
15
+ threshold?: number;
16
+ /** Write each completed run to memory without the model having to ask. */
17
+ autoCapture: boolean;
18
+ platform: {
19
+ apiKey: string;
20
+ host?: string;
21
+ };
22
+ oss: {
23
+ collectionName: string;
24
+ /** Qdrant endpoint. Bring one up with `docker compose up -d qdrant`. */
25
+ qdrantUrl: string;
26
+ qdrantApiKey?: string;
27
+ openRouterApiKey: string;
28
+ extractionModel: string;
29
+ /** Where embeddings come from. Defaults to local Ollama — no key, no egress. */
30
+ embeddingProvider: EmbedderProvider;
31
+ /** Empty means "use the provider default"; resolved before loadConfig returns. */
32
+ embeddingModel: string;
33
+ /** Zero means "use the provider default". Must match the embedding model. */
34
+ embeddingDims: number;
35
+ ollamaUrl: string;
36
+ openAiApiKey: string;
37
+ /** Raw mem0ai/oss MemoryConfig fragments, merged last. */
38
+ overrides?: Record<string, any>;
39
+ };
40
+ }
41
+ /**
42
+ * What reaches a review out of what Weigh knows, and how it is found.
43
+ *
44
+ * Every number here is provisional and every one is a setting, because a
45
+ * retrieval design is only as good as its measurements: `weigh context recall`
46
+ * prints exactly what these let through for the change in front of you, which
47
+ * is how they get picked against real claims rather than from a design.
48
+ */
49
+ export interface KnowledgeSettings {
50
+ /**
51
+ * Put what is remembered about this repository into the review context.
52
+ *
53
+ * Separate from `memory.enabled`, which turns the store off entirely. This
54
+ * says whether a review is told what the repository is like — off, memory
55
+ * still works and `weigh context` still reads and writes it.
56
+ */
57
+ enabled: boolean;
58
+ /** Relevance a proximity hit needs before it is worth the context it costs. */
59
+ threshold: number;
60
+ /** Claims pulled per changed-file query. */
61
+ perFile: number;
62
+ /** Changed files queried by proximity, code first. */
63
+ files: number;
64
+ /** Proximity hits kept across repository scope. The thread on a change has no cap. */
65
+ repoCap: number;
66
+ /** Claims listed from user scope. */
67
+ userCap: number;
68
+ /** Repository claims enumerated for the always-injected and glob mechanisms. */
69
+ scan: number;
70
+ /** Characters of claims to inline. What does not fit is named, not dropped. */
71
+ budget: number;
72
+ /** Similarity at which `context add --if-new` holds a claim back as a likely duplicate. */
73
+ similar: number;
74
+ }
75
+ export interface AgentConfig {
76
+ apiKey: string;
77
+ model: string;
78
+ name: string;
79
+ systemPrompt: string;
80
+ maxSteps: number;
81
+ maxCost: number;
82
+ /** How deeply the model reasons before answering. */
83
+ effort: Effort;
84
+ /**
85
+ * Share of readable changed files a review must open before it may report.
86
+ * 0 disables the floor; 1 demands every one.
87
+ */
88
+ coverageFloor: number;
89
+ /**
90
+ * Confidence a finding needs before it is reported. 0 reports every one.
91
+ *
92
+ * Withheld findings are kept and shown as suppressed, not deleted — the
93
+ * point of a floor you set by hand is being able to see what fell below it.
94
+ */
95
+ confidenceFloor: number;
96
+ /**
97
+ * Whether a review of a branch that has been reviewed before continues it.
98
+ *
99
+ * On, a second review is handed the last one's findings and rules on them
100
+ * instead of restating them. Off, every review is judged on its own: the
101
+ * record is still written, and nothing reads it.
102
+ */
103
+ continuation: boolean;
104
+ /**
105
+ * Whether every review puts its findings to a refute pass.
106
+ *
107
+ * The standing form of `--refute`, for someone who has decided the trade
108
+ * once: fewer false positives, roughly twice the calls. `--no-refute` turns
109
+ * it off for one run.
110
+ */
111
+ refute: boolean;
112
+ sessionDir: string;
113
+ sessionEnabled: boolean;
114
+ /** Keep only the newest N transcripts; 0 keeps every one. */
115
+ sessionRetention: number;
116
+ outputMode: 'text' | 'json' | 'quiet';
117
+ knowledge: KnowledgeSettings;
118
+ memory: MemorySettings;
119
+ github: {
120
+ token: string;
121
+ };
122
+ linear: {
123
+ apiKey: string;
124
+ };
125
+ }
126
+ /** Minimal KEY=VALUE parser: no interpolation, no exports, no surprises. */
127
+ export declare function parseEnvFile(text: string): Record<string, string>;
128
+ /**
129
+ * Loads `~/.weigh/.env` into the environment, filling gaps only.
130
+ *
131
+ * This is not a separate precedence layer — it is how you persist environment
132
+ * variables locally, so CI, which sets them for real, needs no such file. A
133
+ * value already in the environment therefore wins.
134
+ *
135
+ * It writes into `process.env` rather than staying private so that anything
136
+ * Weigh spawns (`git`, `gh`) inherits the same credentials, and it only sets
137
+ * variables Weigh owns: this file configures Weigh, not the whole process.
138
+ */
139
+ export declare function loadWeighEnv(): {
140
+ loaded: string[];
141
+ from: string | null;
142
+ };
143
+ /**
144
+ * Lowest to highest precedence.
145
+ *
146
+ * default < <repo>/.weigh.json < ~/.weigh/config.json < environment < flag
147
+ *
148
+ * The repository's file is the team's recommendation, committed beside the
149
+ * code: the confidence floor, refute, effort — choices that belong to a
150
+ * repository rather than to Weigh. It sits under everything personal, so a
151
+ * developer's own file, environment and flags still have the last word.
152
+ *
153
+ * It is read from the checkout being reviewed, so on a branch it is that
154
+ * branch's copy. Locally that is the developer's own run on their own quota.
155
+ * CI is where it is not, and CI brings its own configuration — environment
156
+ * and flags, which outrank it.
157
+ *
158
+ * It may set only the settings marked `shared`: never a secret, anything
159
+ * `local` to one machine or person, an endpoint credentials are sent to, or
160
+ * the agent's instructions.
161
+ */
162
+ export type Source = 'default' | 'repo' | 'file' | 'env' | 'flag';
163
+ /** The shared file's name, at the repository root. */
164
+ export declare const REPO_CONFIG_FILE = ".weigh.json";
165
+ export interface Resolved {
166
+ key: string;
167
+ value: unknown;
168
+ source: Source;
169
+ }
170
+ export interface LoadResult {
171
+ config: AgentConfig;
172
+ warnings: string[];
173
+ /** Where each setting's value came from, for `weigh config list`. */
174
+ provenance: Map<string, Source>;
175
+ /**
176
+ * Warnings `loadConfig` does not throw on, even ones that say a value is
177
+ * wrong: those about a repository's `.weigh.json`. The file comes from the
178
+ * checkout, so one bad value in it would otherwise stop every command run
179
+ * there. The value is dropped instead, as an unknown or secret key is.
180
+ */
181
+ advisory: ReadonlySet<string>;
182
+ }
183
+ /**
184
+ * Resolves settings through the layers and fills in the defaults that can only
185
+ * be computed once the layers have settled.
186
+ *
187
+ * Unknown keys warn rather than being ignored: a silently dropped
188
+ * `sessionRetension` is indistinguishable from a setting that does not work.
189
+ */
190
+ export interface LoadOptions {
191
+ skipApiKey?: boolean;
192
+ /** The repository whose `.weigh.json` to read. Absent outside one. */
193
+ repoRoot?: string;
194
+ }
195
+ export declare function loadConfigDetailed(overrides?: Partial<AgentConfig>, opts?: LoadOptions): LoadResult;
196
+ /** Throws on the first validation problem, so callers need not inspect warnings. */
197
+ export declare function loadConfig(overrides?: Partial<AgentConfig>, opts?: LoadOptions): AgentConfig;
198
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,KAAK,CAAC;AACnD,iFAAiF;AACjF,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAYnD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,GAAG,EAAE;QACH,cAAc,EA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