@hraness/wordcell 0.25.1 → 0.26.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.
Files changed (48) hide show
  1. package/README.md +37 -35
  2. package/dist/capture.js +6 -6
  3. package/dist/cli-bin.js +14 -0
  4. package/dist/cli-release-c74c5m3k.js +799 -0
  5. package/dist/cli.js +26 -23
  6. package/dist/clip/acquire.js +3 -3
  7. package/dist/clip/cli.js +6 -6
  8. package/dist/clip/doctor.js +4 -4
  9. package/dist/evaluation-builder-bin.js +14 -0
  10. package/dist/evaluation-builder.js +12 -17
  11. package/dist/evaluation-kb.js +6 -6
  12. package/dist/graph-percolation.js +2 -2
  13. package/dist/index-3t0v457d.js +18 -0
  14. package/dist/{index-47893rgw.js → index-5h5awwh4.js} +4 -4
  15. package/dist/index-8pabwzqg.js +909 -0
  16. package/dist/{index-1wccy765.js → index-8w1zsgcm.js} +63 -930
  17. package/dist/{index-7drercgk.js → index-9fywek7g.js} +1 -1
  18. package/dist/{index-hz2wyggk.js → index-9paxge84.js} +1 -1
  19. package/dist/{index-mcpppwbq.js → index-9zkba8hr.js} +6 -6
  20. package/dist/{index-59bcxqee.js → index-j2jt49gr.js} +1 -1
  21. package/dist/index-ncgdaja4.js +64 -0
  22. package/dist/{index-nwrehke7.js → index-nd8v7r0z.js} +1 -1
  23. package/dist/{index-t3abkwk4.js → index-zbv70qmk.js} +15 -15
  24. package/dist/index.js +40 -40
  25. package/dist/pdf.js +2 -2
  26. package/dist/portfolio.js +5 -5
  27. package/dist/sdk.js +4 -4
  28. package/dist/{support-adj7bbge.js → support-ym4mpf7w.js} +19 -18
  29. package/dist/url-intelligence.js +3 -3
  30. package/dist/workflows/decision-context.js +5 -5
  31. package/dist/workflows/index.js +5 -5
  32. package/package.json +13 -6
  33. package/skills/wordcell/SKILL.md +10 -1
  34. package/src/cli-bin.ts +5 -0
  35. package/src/cli-help.ts +12 -0
  36. package/src/cli-program.ts +3 -57
  37. package/src/cli-release.ts +732 -0
  38. package/src/cli-startup.ts +76 -0
  39. package/src/cli-update.ts +53 -0
  40. package/src/cli.ts +5 -4
  41. package/src/evaluation-builder-bin.ts +5 -0
  42. package/src/evaluation-builder-cli-args.ts +30 -0
  43. package/src/evaluation-builder.ts +3 -27
  44. package/src/import-supermemory.ts +3 -1
  45. package/dist/{index-hxyjer3x.js → index-hacpnaew.js} +3 -3
  46. package/dist/{index-qfqjfxaa.js → index-m9p2a4mj.js} +4 -4
  47. package/dist/{index-xwxy71ew.js → index-ncwzmsge.js} +5 -5
  48. package/dist/{index-e26mdwxz.js → index-wqx1x32f.js} +3 -3
@@ -3,23 +3,37 @@ import {
3
3
  backfillSavedUrlMetadata,
4
4
  createRustMetadataSearchProvider,
5
5
  savedSourceProblem
6
- } from "./index-47893rgw.js";
6
+ } from "./index-5h5awwh4.js";
7
7
  import {
8
8
  main as main2
9
- } from "./index-qfqjfxaa.js";
9
+ } from "./index-m9p2a4mj.js";
10
10
  import {
11
11
  MAX_AUTHORIZED_VAULTS,
12
12
  auditKnowledgePortfolio,
13
13
  loadPortfolioRegistry,
14
14
  openKnowledgePortfolio,
15
15
  snapshotPortfolioRegistry
16
- } from "./index-hz2wyggk.js";
16
+ } from "./index-9paxge84.js";
17
17
  import {
18
18
  diffCaptureBundle
19
19
  } from "./index-j4zgmzjr.js";
20
+ import {
21
+ verifyCaptureBundle
22
+ } from "./index-npg9z1a4.js";
20
23
  import {
21
24
  main
22
- } from "./index-t3abkwk4.js";
25
+ } from "./index-zbv70qmk.js";
26
+ import {
27
+ advancedHelp,
28
+ closestMatch,
29
+ commandHelpText,
30
+ knownCommandWords,
31
+ optionNames,
32
+ parseCliStartupCommand,
33
+ resolveCommandId,
34
+ rootHelp,
35
+ startHelp
36
+ } from "./index-8pabwzqg.js";
23
37
  import {
24
38
  detectAudience,
25
39
  renderFailure,
@@ -30,9 +44,6 @@ import {
30
44
  terminalOutput,
31
45
  terminalStyle
32
46
  } from "./index-cd75vky9.js";
33
- import {
34
- verifyCaptureBundle
35
- } from "./index-npg9z1a4.js";
36
47
  import {
37
48
  redactSensitiveText,
38
49
  sanitizeArtifactUrl
@@ -40,18 +51,18 @@ import {
40
51
  import {
41
52
  initVault
42
53
  } from "./index-23z4zxgg.js";
54
+ import {
55
+ createTypeSafeReranker
56
+ } from "./index-9rf81m0p.js";
43
57
  import {
44
58
  MAX_SOURCE_INBOX_PREFIXES,
45
59
  MAX_SOURCE_INBOX_RESULTS,
46
60
  sourceInbox
47
61
  } from "./index-pj501bh1.js";
48
- import {
49
- createTypeSafeReranker
50
- } from "./index-9rf81m0p.js";
51
62
  import {
52
63
  knowledgeBaseEvaluationRetrieverIds,
53
64
  openKnowledgeBaseEvaluation
54
- } from "./index-59bcxqee.js";
65
+ } from "./index-j2jt49gr.js";
55
66
  import {
56
67
  DEFAULT_SEARCH_RESULTS,
57
68
  MAX_SEARCH_CANDIDATES,
@@ -60,7 +71,7 @@ import {
60
71
  MAX_SEARCH_RESULTS,
61
72
  openKnowledgeBase,
62
73
  searchEvidenceRank
63
- } from "./index-mcpppwbq.js";
74
+ } from "./index-9zkba8hr.js";
64
75
  import {
65
76
  MAX_SEARCH_RULE_CONFIG_BYTES,
66
77
  parseSearchRules
@@ -74,18 +85,16 @@ import {
74
85
  sha256EmbeddingModelFile
75
86
  } from "./index-fp732bgg.js";
76
87
  import {
77
- MAX_RERANK_CANDIDATES
78
- } from "./index-j70m75wd.js";
88
+ percolateWithGraph
89
+ } from "./index-wqx1x32f.js";
79
90
  import {
80
- MAX_EVALUATION_RESULTS_PER_QUERY,
81
- MAX_EVALUATION_TIMEOUT_MS,
82
- buildRetrievalEvaluationReport,
83
- parseRetrievalEvaluationCorpus,
84
- runRetrievalEvaluation
85
- } from "./index-b88v3vtm.js";
91
+ queryGraph,
92
+ rebuildGraph,
93
+ verifyGraph
94
+ } from "./index-3gc2yk4k.js";
86
95
  import {
87
- percolateWithGraph
88
- } from "./index-e26mdwxz.js";
96
+ validateGraphQueryRequest
97
+ } from "./index-pgtm2nhf.js";
89
98
  import {
90
99
  MAX_PERCOLATION_MENTIONS,
91
100
  MAX_PERCOLATION_MENTION_PAIRS,
@@ -94,13 +103,15 @@ import {
94
103
  percolateVault
95
104
  } from "./index-bdwcjvr4.js";
96
105
  import {
97
- queryGraph,
98
- rebuildGraph,
99
- verifyGraph
100
- } from "./index-3gc2yk4k.js";
106
+ MAX_RERANK_CANDIDATES
107
+ } from "./index-j70m75wd.js";
101
108
  import {
102
- validateGraphQueryRequest
103
- } from "./index-pgtm2nhf.js";
109
+ MAX_EVALUATION_RESULTS_PER_QUERY,
110
+ MAX_EVALUATION_TIMEOUT_MS,
111
+ buildRetrievalEvaluationReport,
112
+ parseRetrievalEvaluationCorpus,
113
+ runRetrievalEvaluation
114
+ } from "./index-b88v3vtm.js";
104
115
  import {
105
116
  validateSearchQuery
106
117
  } from "./index-ahyhryb8.js";
@@ -859,833 +870,6 @@ function terminalIntro(terminal) {
859
870
  `;
860
871
  }
861
872
 
862
- // src/cli-help.ts
863
- var ROOT = ["--root <directory>", "Knowledge base folder (default: current directory)"];
864
- var INDEX = ["--index <path>", "Catalog note to use (default: index.md)"];
865
- var JSON_OPTION = ["--json", "Print machine-readable output"];
866
- var REPO = ["--repo <repository>", "Git repository the notes describe"];
867
- var WHERE = ["--where <path=value>", "Keep notes whose metadata field has this value"];
868
- var HAS = ["--has <path>", "Keep notes that set this metadata field"];
869
- var TAG = ["--tag <tag>", "Keep notes with this tag"];
870
- var SCOPE = ["--scope <repository-path>", "Keep notes about this code path"];
871
- var DATABASE = ["--database <path>", "Use this search index file"];
872
- var MODE = [
873
- "--mode <hybrid|exact|keyword|semantic>",
874
- "Match exact words, the keyword index, meaning, or keywords and meaning together"
875
- ];
876
- var RULES = ["--rules <file>", "Apply reviewed search aliases from a JSON file"];
877
- var PRIORITY = ["--priority", "Order results by the rules file first"];
878
- var DEPTH = ["--depth <count>", "How many links to follow (1 to 10)"];
879
- var DIRECTION = ["--direction <in|out|both>", "Follow incoming links, outgoing links, or both"];
880
- var commandHelp = [
881
- {
882
- id: "init",
883
- label: "init [directory]",
884
- usage: "wordcell init [directory] [--json]",
885
- summary: "Create a knowledge base folder (default: kb). It never merges into an existing folder.",
886
- group: "start",
887
- options: [JSON_OPTION],
888
- examples: ["wordcell init kb"]
889
- },
890
- {
891
- id: "note create",
892
- label: "note create <id>",
893
- usage: "wordcell note create <id> --title <title> [options]",
894
- summary: "Write one new Markdown note.",
895
- group: "start",
896
- options: [
897
- ["--title <title>", "Note title (required)"],
898
- ["--type <type>", "Note type, such as decision or concept"],
899
- ["--tag <tag>", "Add a tag (repeatable)"],
900
- ["--body <markdown>", "Note body"],
901
- ["--body-file <path|->", "Read the body from a file, or from piped input with -"],
902
- ROOT,
903
- JSON_OPTION
904
- ],
905
- examples: [
906
- 'wordcell note create notes/first --title "First note" --body "Keep retries bounded." --root kb'
907
- ]
908
- },
909
- {
910
- id: "search",
911
- label: "search <query>",
912
- usage: "wordcell search <query> [options]",
913
- summary: "Search notes by words or meaning.",
914
- group: "start",
915
- notes: [
916
- "Exact mode needs no index or model. Keyword, semantic, and hybrid modes",
917
- "use the local index from `wordcell index`."
918
- ],
919
- options: [
920
- ROOT,
921
- MODE,
922
- ["--limit <count>", "Show at most this many results"],
923
- WHERE,
924
- HAS,
925
- TAG,
926
- SCOPE,
927
- ["--related <note>", "Also show notes linked to this note"],
928
- ["--graph-depth <1|2>", "How far to follow links for context"],
929
- ["--no-graph", "Skip link context"],
930
- ["--history", "Add recent Git history when available"],
931
- ["--no-history", "Skip Git history (default)"],
932
- ["--require-history", "Fail when Git history is unavailable"],
933
- REPO,
934
- DATABASE,
935
- RULES,
936
- PRIORITY,
937
- ["--candidate-limit <count>", "How many candidates to rank before trimming"],
938
- ["--min-score <score>", "Drop results scoring below this (0 to 1)"],
939
- ["--rerank <typesafe>", "Rerank results with the hosted TypeSafe service"],
940
- ["--rerank-limit <2..25>", "How many results the reranker sees"],
941
- ["--selected-passage", "Add a local source excerpt to each result"],
942
- JSON_OPTION
943
- ],
944
- examples: ['wordcell search "retries" --root kb --mode exact', 'wordcell search "retry policy" --root kb --limit 5']
945
- },
946
- {
947
- id: "check",
948
- label: "check",
949
- usage: "wordcell check [options]",
950
- summary: "Check links, metadata, and attachments. It changes no files.",
951
- group: "start",
952
- options: [
953
- ROOT,
954
- INDEX,
955
- ["--no-catalog", "Skip the catalog check"],
956
- ["--repo <repository>", "Also report notes whose code paths no longer exist"],
957
- JSON_OPTION
958
- ],
959
- examples: ["wordcell check --root kb", "wordcell check --root kb --repo ."]
960
- },
961
- {
962
- id: "list",
963
- label: "list",
964
- usage: "wordcell list [options]",
965
- summary: "List notes by metadata or tag. Also: wordcell notes.",
966
- group: "notes",
967
- options: [
968
- ROOT,
969
- INDEX,
970
- WHERE,
971
- HAS,
972
- TAG,
973
- SCOPE,
974
- ["--sort <field>", "Sort by a metadata field, title, path, or link counts"],
975
- ["--order <asc|desc>", "Sort direction"],
976
- ["--limit <count>", "Show at most this many notes"],
977
- JSON_OPTION
978
- ],
979
- examples: ["wordcell list --root kb --tag decision", "wordcell list --root kb --where status=active"]
980
- },
981
- {
982
- id: "links",
983
- label: "links <note>",
984
- usage: "wordcell links <note> [options]",
985
- summary: "Follow links into and out of a note.",
986
- group: "notes",
987
- options: [ROOT, INDEX, DIRECTION, DEPTH, ["--limit <count>", "Show at most this many notes"], JSON_OPTION],
988
- examples: ["wordcell links notes/first --root kb --direction both --depth 2"]
989
- },
990
- {
991
- id: "backlinks",
992
- label: "backlinks <note>",
993
- usage: "wordcell backlinks <note> [options]",
994
- summary: "Show the notes that link to a note.",
995
- group: "notes",
996
- options: [ROOT, INDEX, JSON_OPTION],
997
- examples: ["wordcell backlinks notes/first --root kb"]
998
- },
999
- {
1000
- id: "relation",
1001
- label: "relation add|remove|list",
1002
- usage: "wordcell relation <add|remove|list> ...",
1003
- summary: "Edit a note's typed links. They live in its frontmatter.",
1004
- group: "notes",
1005
- family: true,
1006
- options: [],
1007
- examples: ["wordcell relation add notes/first supersedes notes/old --root kb"],
1008
- notes: ["Run `wordcell relation add --help` for each action."]
1009
- },
1010
- {
1011
- id: "relation add",
1012
- label: "relation add <source> <predicate> <target>",
1013
- usage: "wordcell relation add <source> <predicate> <target> [options]",
1014
- summary: "Add a typed link from one note to another. Running it twice changes nothing.",
1015
- group: "notes",
1016
- unlisted: true,
1017
- options: [ROOT, ["--expected-revision <sha256:...>", "Only write if the note is still at this revision"], JSON_OPTION],
1018
- examples: ["wordcell relation add notes/first supersedes notes/old --root kb"]
1019
- },
1020
- {
1021
- id: "relation remove",
1022
- label: "relation remove <source> <predicate> <target>",
1023
- usage: "wordcell relation remove <source> <predicate> <target> [options]",
1024
- summary: "Remove a typed link from a note.",
1025
- group: "notes",
1026
- unlisted: true,
1027
- options: [ROOT, ["--expected-revision <sha256:...>", "Only write if the note is still at this revision"], JSON_OPTION],
1028
- examples: ["wordcell relation remove notes/first supersedes notes/old --root kb"]
1029
- },
1030
- {
1031
- id: "relation list",
1032
- label: "relation list <note>",
1033
- usage: "wordcell relation list <note> [options]",
1034
- summary: "List a note's typed links in both directions.",
1035
- group: "notes",
1036
- unlisted: true,
1037
- options: [ROOT, JSON_OPTION],
1038
- examples: ["wordcell relation list notes/first --root kb"]
1039
- },
1040
- {
1041
- id: "refresh",
1042
- label: "refresh",
1043
- usage: "wordcell refresh [options]",
1044
- summary: "Update the catalog in index.md. It also reports link problems.",
1045
- group: "notes",
1046
- options: [ROOT, INDEX, JSON_OPTION],
1047
- examples: ["wordcell refresh --root kb"]
1048
- },
1049
- {
1050
- id: "catalog",
1051
- label: "catalog",
1052
- usage: "wordcell catalog [options]",
1053
- summary: "Print a catalog of every note. It writes nothing.",
1054
- group: "notes",
1055
- options: [ROOT, INDEX, JSON_OPTION],
1056
- examples: ["wordcell catalog --root kb"]
1057
- },
1058
- {
1059
- id: "import supermemory",
1060
- label: "import supermemory <file>",
1061
- usage: "wordcell import supermemory <export.json>... [options]",
1062
- summary: "Import a Supermemory export as notes.",
1063
- group: "notes",
1064
- options: [
1065
- ROOT,
1066
- ["--prefix <directory>", "Put every imported note in this folder"],
1067
- ["--dry-run", "Show what would be written without writing"],
1068
- JSON_OPTION
1069
- ],
1070
- examples: ["wordcell import supermemory export.json --root kb --dry-run"]
1071
- },
1072
- {
1073
- id: "index",
1074
- label: "index",
1075
- usage: "wordcell index [options]",
1076
- summary: "Build the local index for meaning-based search.",
1077
- group: "search",
1078
- notes: ["The first run downloads a local embedding model (about 300 MB) once."],
1079
- options: [ROOT, DATABASE, ["--force", "Rebuild the index from scratch"], JSON_OPTION],
1080
- examples: ["wordcell index --root kb"]
1081
- },
1082
- {
1083
- id: "context",
1084
- label: "context <path>",
1085
- usage: "wordcell context <repository-path> [options]",
1086
- summary: "Find notes and AGENTS.md files for a code path.",
1087
- group: "search",
1088
- options: [
1089
- ["--root <vault>", "Knowledge base folder (default: current directory)"],
1090
- REPO,
1091
- ["--kind <auto|file|directory>", "Treat the path as a file or a folder"],
1092
- JSON_OPTION
1093
- ],
1094
- examples: ["wordcell context src/index.ts --root kb --repo ."]
1095
- },
1096
- {
1097
- id: "history",
1098
- label: "history <note>",
1099
- usage: "wordcell history <note> [options]",
1100
- summary: "Show the Git commits that changed a note. Also: wordcell history search <query>.",
1101
- group: "search",
1102
- options: [
1103
- ROOT,
1104
- REPO,
1105
- ["--limit <count>", "Show at most this many commits"],
1106
- ["--cochanged-limit <count>", "Show at most this many files changed alongside"],
1107
- JSON_OPTION
1108
- ],
1109
- examples: ["wordcell history notes/first --root kb --repo ."]
1110
- },
1111
- {
1112
- id: "history search",
1113
- label: "history search <query>",
1114
- usage: "wordcell history search <query-or-path> [options]",
1115
- summary: "Search commit messages and changed paths in the repository.",
1116
- group: "search",
1117
- unlisted: true,
1118
- options: [
1119
- ROOT,
1120
- REPO,
1121
- ["--limit <count>", "Show at most this many results"],
1122
- ["--commit-limit <count>", "Read at most this many commits"],
1123
- ["--cochanged-limit <count>", "Show at most this many files changed alongside"],
1124
- JSON_OPTION
1125
- ],
1126
- examples: ['wordcell history search "retry" --root kb --repo .']
1127
- },
1128
- {
1129
- id: "inbox",
1130
- label: "inbox",
1131
- usage: "wordcell inbox [options]",
1132
- summary: "List saved sources no note links to yet. Also: wordcell source-inbox.",
1133
- group: "search",
1134
- options: [
1135
- ROOT,
1136
- INDEX,
1137
- ["--source-prefix <directory>", "Look for sources in this folder (repeatable)"],
1138
- ["--limit <count>", "Show at most this many sources"],
1139
- JSON_OPTION
1140
- ],
1141
- examples: ["wordcell inbox --root kb"]
1142
- },
1143
- {
1144
- id: "clip",
1145
- label: "clip <url|current>",
1146
- usage: "wordcell clip <url|current> [options]",
1147
- summary: "Save a web page as Markdown. Threads, videos, and images are kept too.",
1148
- group: "capture",
1149
- options: [],
1150
- examples: ["wordcell clip https://example.com/article --output kb/articles"],
1151
- notes: ["Run `wordcell clip --help` for every capture option."]
1152
- },
1153
- {
1154
- id: "inspect",
1155
- label: "inspect <url>",
1156
- usage: "wordcell inspect <url> [options]",
1157
- summary: "Preview a capture. It writes no files.",
1158
- group: "capture",
1159
- options: [],
1160
- examples: ["wordcell inspect https://example.com/article"]
1161
- },
1162
- {
1163
- id: "pdf",
1164
- label: "pdf <file-or-url>",
1165
- usage: "wordcell pdf <file-or-url> [options]",
1166
- summary: "Save a PDF as Markdown. The original file and its images are kept.",
1167
- group: "capture",
1168
- options: [],
1169
- examples: ["wordcell pdf paper.pdf --output kb/articles"]
1170
- },
1171
- {
1172
- id: "capture",
1173
- label: "capture show|verify|diff",
1174
- usage: "wordcell capture <show|verify|diff> <bundle> [options]",
1175
- summary: "Read, check, or compare a saved capture.",
1176
- group: "capture",
1177
- family: true,
1178
- options: [],
1179
- examples: ["wordcell capture verify kb/articles/example"],
1180
- notes: ["Run `wordcell capture show --help` for each action. `wordcell capture <url>` is the same as clip."]
1181
- },
1182
- {
1183
- id: "capture show",
1184
- label: "capture show <bundle>",
1185
- usage: "wordcell capture show <bundle> [options]",
1186
- summary: "Print a saved capture as plain text.",
1187
- group: "capture",
1188
- unlisted: true,
1189
- options: [
1190
- ["--verify-assets", "Also check saved images and files"],
1191
- ["--include-source-html", "Include the original page HTML"],
1192
- JSON_OPTION
1193
- ],
1194
- examples: ["wordcell capture show kb/articles/example"]
1195
- },
1196
- {
1197
- id: "capture verify",
1198
- label: "capture verify <bundle>",
1199
- usage: "wordcell capture verify <bundle> [options]",
1200
- summary: "Check that a saved capture still matches its recorded hashes.",
1201
- group: "capture",
1202
- unlisted: true,
1203
- options: [["--verify-assets", "Also check saved images and files"], JSON_OPTION],
1204
- examples: ["wordcell capture verify kb/articles/example --verify-assets"]
1205
- },
1206
- {
1207
- id: "capture diff",
1208
- label: "capture diff <bundle>",
1209
- usage: "wordcell capture diff <bundle> [options]",
1210
- summary: "Compare a saved capture with an earlier Git version.",
1211
- group: "capture",
1212
- unlisted: true,
1213
- options: [REPO, ["--ref <ref>", "Git version to compare with (default: HEAD)"], JSON_OPTION],
1214
- examples: ["wordcell capture diff kb/articles/example --repo . --ref main"]
1215
- },
1216
- {
1217
- id: "publish",
1218
- label: "publish --out <directory>",
1219
- usage: "wordcell publish --out <directory> [options]",
1220
- summary: "Build a static website from your notes.",
1221
- group: "publish",
1222
- options: [
1223
- ["--out <directory>", "Folder to write the site to (required)"],
1224
- ROOT,
1225
- INDEX,
1226
- ["--include <path>", "Publish only these notes or folders (repeatable)"],
1227
- ["--exclude <path>", "Leave out these notes or folders (repeatable)"],
1228
- ["--include-glob <pattern>", "Publish notes matching a pattern (repeatable)"],
1229
- ["--exclude-glob <pattern>", "Leave out notes matching a pattern (repeatable)"],
1230
- WHERE,
1231
- HAS,
1232
- TAG,
1233
- SCOPE,
1234
- ["--from <note>", "Publish the notes linked from this note"],
1235
- DEPTH,
1236
- DIRECTION,
1237
- ["--title <title>", "Site title"],
1238
- ["--description <text>", "Site description"],
1239
- ["--base-path <path>", "Serve the site under this path"],
1240
- ["--base-url <url>", "Public address of the site"],
1241
- ["--noindex", "Ask search engines not to index the site"],
1242
- ["--no-index-content", "Leave note text out of the site search"],
1243
- ["--deterministic", "Omit the build time so builds match byte for byte"],
1244
- ["--dry-run", "Show what would be published without writing"],
1245
- ["--list-limit <0-1000>", "How many paths to list in the report"],
1246
- ["--force", "Replace an existing output folder"],
1247
- JSON_OPTION
1248
- ],
1249
- examples: ["wordcell publish --root kb --out site", "wordcell publish --root kb --out site --tag public"]
1250
- },
1251
- {
1252
- id: "serve",
1253
- label: "serve --root <directory>",
1254
- usage: "wordcell serve --root <directory> [options]",
1255
- summary: "Preview a published site on this computer.",
1256
- group: "publish",
1257
- options: [
1258
- ["--root <directory>", "Published site folder (required)"],
1259
- ["--host <host>", "Address to listen on (default: 127.0.0.1)"],
1260
- ["--port <port>", "Port to listen on"],
1261
- JSON_OPTION
1262
- ],
1263
- examples: ["wordcell serve --root site --port 8080"]
1264
- },
1265
- {
1266
- id: "mcp",
1267
- label: "mcp --root <vault>",
1268
- usage: "wordcell mcp --root <vault> [options]",
1269
- summary: "Serve your notes to AI apps over MCP.",
1270
- group: "publish",
1271
- notes: ["MCP (Model Context Protocol) is how AI apps such as Claude call local tools."],
1272
- options: [
1273
- ["--root <vault>", "Knowledge base folder (required)"],
1274
- REPO,
1275
- ["--read-only", "Offer only the read tools"]
1276
- ],
1277
- examples: ["wordcell mcp --root /absolute/path/to/kb --read-only"]
1278
- },
1279
- {
1280
- id: "agents",
1281
- label: "agents check|audit",
1282
- usage: "wordcell agents <check|audit|identity> ...",
1283
- summary: "Check the notes that give coding agents context for each code folder.",
1284
- group: "agents",
1285
- family: true,
1286
- unlisted: true,
1287
- options: [],
1288
- examples: ["wordcell agents check --root kb --repo ."],
1289
- notes: ["Run `wordcell agents check --help` for each action."]
1290
- },
1291
- {
1292
- id: "agents check",
1293
- label: "agents check",
1294
- usage: "wordcell agents check [options]",
1295
- summary: "Check AGENTS.md context notes against the code.",
1296
- group: "agents",
1297
- options: [["--root <vault>", "Knowledge base folder"], REPO, JSON_OPTION],
1298
- examples: ["wordcell agents check --root kb --repo ."]
1299
- },
1300
- {
1301
- id: "agents audit",
1302
- label: "agents audit",
1303
- usage: "wordcell agents audit [options]",
1304
- summary: "Find long or repeated AGENTS.md rules. It runs agents check first.",
1305
- group: "agents",
1306
- options: [["--root <vault>", "Knowledge base folder"], REPO, JSON_OPTION],
1307
- examples: ["wordcell agents audit --root kb --repo ."]
1308
- },
1309
- {
1310
- id: "doctor",
1311
- label: "doctor",
1312
- usage: "wordcell doctor [--json]",
1313
- summary: "Check optional tools for capture and search. It changes nothing.",
1314
- group: "diagnostics",
1315
- options: [JSON_OPTION],
1316
- examples: ["wordcell doctor"]
1317
- },
1318
- {
1319
- id: "adapters",
1320
- label: "adapters",
1321
- usage: "wordcell adapters [--json]",
1322
- summary: "List the sites and platforms clip supports.",
1323
- group: "diagnostics",
1324
- options: [JSON_OPTION],
1325
- examples: ["wordcell adapters"]
1326
- },
1327
- {
1328
- id: "graph",
1329
- label: "graph",
1330
- usage: "wordcell graph [options]",
1331
- summary: "Show the link graph and broken links. Unlinked notes are listed too.",
1332
- group: "diagnostics",
1333
- notes: ["See `wordcell help advanced` for graph rebuild, verify, and query."],
1334
- options: [ROOT, INDEX, JSON_OPTION],
1335
- examples: ["wordcell graph --root kb"]
1336
- },
1337
- {
1338
- id: "agents identity",
1339
- label: "agents identity <scope>",
1340
- usage: "wordcell agents identity <repository-scope> [--json]",
1341
- summary: "Print the context note name and marker for a code folder, without writing.",
1342
- group: "advanced",
1343
- options: [JSON_OPTION],
1344
- examples: ["wordcell agents identity packages/parser"]
1345
- },
1346
- {
1347
- id: "graph rebuild",
1348
- label: "graph rebuild",
1349
- usage: "wordcell graph rebuild [options]",
1350
- summary: "Rebuild the local graph cache from the Markdown files.",
1351
- group: "advanced",
1352
- options: [["--fresh", "Discard the old cache first"], ROOT, INDEX, JSON_OPTION],
1353
- examples: ["wordcell graph rebuild --root kb"]
1354
- },
1355
- {
1356
- id: "graph verify",
1357
- label: "graph verify",
1358
- usage: "wordcell graph verify [options]",
1359
- summary: "Check that the local graph cache matches the Markdown files.",
1360
- group: "advanced",
1361
- options: [ROOT, INDEX, JSON_OPTION],
1362
- examples: ["wordcell graph verify --root kb"]
1363
- },
1364
- {
1365
- id: "graph query",
1366
- label: "graph query --program <name>",
1367
- usage: "wordcell graph query --program <name> [options]",
1368
- summary: "Run a built-in graph query, with proof of each answer.",
1369
- group: "advanced",
1370
- options: [
1371
- ["--program <name>", "backlinks, reachability, scope-route, relation-closure, shared-tags, or shared-concepts"],
1372
- ["--note <id>", "Start from this note"],
1373
- ["--scope <path>", "Start from this code path"],
1374
- ["--predicate <predicate>", "Follow only this typed link"],
1375
- DEPTH,
1376
- ["--limit <count>", "Show at most this many results"],
1377
- ["--persisted", "Read the saved graph cache"],
1378
- ROOT,
1379
- INDEX,
1380
- JSON_OPTION
1381
- ],
1382
- examples: ["wordcell graph query --program backlinks --note notes/first --root kb"]
1383
- },
1384
- {
1385
- id: "percolate",
1386
- label: "percolate [note]",
1387
- usage: "wordcell percolate [note] [options]",
1388
- summary: "Suggest recurring concepts and missing links, with evidence. Writes nothing.",
1389
- group: "advanced",
1390
- options: [
1391
- ["--proofs", "Show the evidence for one note"],
1392
- ["--min-support <count>", "Require this many supporting notes"],
1393
- ["--limit <count>", "Show at most this many suggestions"],
1394
- ROOT,
1395
- JSON_OPTION
1396
- ],
1397
- examples: ["wordcell percolate --root kb"]
1398
- },
1399
- {
1400
- id: "portfolio search",
1401
- label: "portfolio search <query>",
1402
- usage: "wordcell portfolio search <query> --registry <file> --workspace <directory> [options]",
1403
- summary: "Search several knowledge bases you list in a registry file.",
1404
- group: "advanced",
1405
- options: [
1406
- ["--registry <file>", "Registry of knowledge bases (required)"],
1407
- ["--workspace <directory>", "Folder that holds their checkouts (required)"],
1408
- ["--shared", "Search every shared entry"],
1409
- ["--vault <owner/id>", "Search this entry (repeatable)"],
1410
- MODE,
1411
- RULES,
1412
- PRIORITY,
1413
- ["--limit <count>", "Show at most this many results"],
1414
- ["--require-all", "Fail when any selected knowledge base is missing"],
1415
- JSON_OPTION
1416
- ],
1417
- examples: ['wordcell portfolio search "retries" --registry kb-portfolio.json --workspace .. --shared']
1418
- },
1419
- {
1420
- id: "portfolio audit",
1421
- label: "portfolio audit",
1422
- usage: "wordcell portfolio audit --registry <file> --workspace <directory> [options]",
1423
- summary: "Check several knowledge bases for broken links, duplicates, and missing files.",
1424
- group: "advanced",
1425
- options: [
1426
- ["--registry <file>", "Registry of knowledge bases (required)"],
1427
- ["--workspace <directory>", "Folder that holds their checkouts (required)"],
1428
- ["--all", "Audit every entry"],
1429
- ["--shared", "Audit every shared entry"],
1430
- ["--vault <owner/id>", "Audit this entry (repeatable)"],
1431
- ["--strict", "Fail on warnings"],
1432
- JSON_OPTION
1433
- ],
1434
- examples: ["wordcell portfolio audit --registry kb-portfolio.json --workspace .. --all"]
1435
- },
1436
- {
1437
- id: "evaluate",
1438
- label: "evaluate <manifest.json>",
1439
- usage: "wordcell evaluate <manifest.json> [options]",
1440
- summary: "Measure how well each search method finds the right notes in a frozen test set.",
1441
- group: "advanced",
1442
- options: [
1443
- ROOT,
1444
- REPO,
1445
- DATABASE,
1446
- ["--retriever <id>", "Run only this search method (repeatable)"],
1447
- ["--split <development|test|all>", "Which questions to run"],
1448
- ["--limit <count>", "Results to keep per question"],
1449
- ["--cutoff <count>", "Rank cutoff for the scores"],
1450
- ["--timeout <milliseconds>", "Time limit per question"],
1451
- ["--baseline <id>", "Compare every method with this one"],
1452
- ["--model-file <path>", "Record the embedding model file used"],
1453
- ["--cache-state <cold|mixed|warm>", "Record how warm the caches were"],
1454
- JSON_OPTION
1455
- ],
1456
- examples: ["wordcell evaluate eval/manifest.json --root kb --repo ."]
1457
- },
1458
- {
1459
- id: "url-metadata tool",
1460
- label: "url-metadata tool build|check",
1461
- usage: "wordcell url-metadata tool <build|check>",
1462
- summary: "Build or check the helper that looks up metadata for saved links. Needs Rust.",
1463
- group: "advanced",
1464
- options: [],
1465
- examples: ["wordcell url-metadata tool build"]
1466
- },
1467
- {
1468
- id: "url-metadata backfill",
1469
- label: "url-metadata backfill",
1470
- usage: "wordcell url-metadata backfill [options]",
1471
- summary: "Add title and archive metadata files next to saved links.",
1472
- group: "advanced",
1473
- options: [],
1474
- examples: ["wordcell url-metadata backfill --root kb"],
1475
- notes: ["Run `wordcell url-metadata --help` for every option."]
1476
- },
1477
- {
1478
- id: "support",
1479
- label: "support",
1480
- usage: "wordcell support [status | enable | dismiss | snooze] [--json]",
1481
- summary: "Optional support settings. No command signs you up or charges you.",
1482
- group: "advanced",
1483
- notes: ["Set HRANESS_SUPPORT=off to turn off support invitations."],
1484
- options: [JSON_OPTION],
1485
- examples: ["wordcell support status"]
1486
- }
1487
- ];
1488
- var COMMAND_ALIASES = {
1489
- notes: "list",
1490
- "source-inbox": "inbox"
1491
- };
1492
- var byId = new Map(commandHelp.map((entry) => [entry.id, entry]));
1493
- var GROUP_TITLES = [
1494
- ["start", "Start here"],
1495
- ["notes", "Notes and links"],
1496
- ["search", "Search"],
1497
- ["capture", "Capture"],
1498
- ["publish", "Publish and serve"],
1499
- ["agents", "Agents"],
1500
- ["diagnostics", "Diagnostics"]
1501
- ];
1502
- var DESCRIPTION = [
1503
- "Wordcell keeps decisions, plans, and sources as Markdown beside your code,",
1504
- "so coding agents can find them from the file they are about to change."
1505
- ];
1506
- var LABEL_WIDTH = 28;
1507
- var MAX_COLUMNS = 80;
1508
- function wrapWords(text, width) {
1509
- const lines = [];
1510
- let current = "";
1511
- for (const word of text.split(" ")) {
1512
- if (current !== "" && current.length + 1 + word.length > width) {
1513
- lines.push(current);
1514
- current = word;
1515
- } else {
1516
- current = current === "" ? word : `${current} ${word}`;
1517
- }
1518
- }
1519
- if (current !== "")
1520
- lines.push(current);
1521
- return lines;
1522
- }
1523
- function row(label, summary, indent = " ", width = LABEL_WIDTH) {
1524
- const column = indent.length + width;
1525
- const padded = `${indent}${label}`;
1526
- const summaryLines = wrapWords(summary, Math.max(20, MAX_COLUMNS - column));
1527
- const continuation = summaryLines.slice(1).map((line) => `${" ".repeat(column)}${line}`);
1528
- if (label === "")
1529
- return [`${" ".repeat(column)}${summaryLines[0] ?? ""}`, ...continuation].join(`
1530
- `);
1531
- const head = padded.length < column ? [`${padded.padEnd(column)}${summaryLines[0] ?? ""}`] : [padded, `${" ".repeat(column)}${summaryLines[0] ?? ""}`];
1532
- return [...head, ...continuation].join(`
1533
- `);
1534
- }
1535
- function firstSentence(summary) {
1536
- const end = summary.search(/\.(\s|$)/u);
1537
- return end === -1 ? summary : summary.slice(0, end);
1538
- }
1539
- function listGroup(group) {
1540
- return commandHelp.filter((entry) => entry.group === group && entry.unlisted !== true).map((entry) => row(entry.label, firstSentence(entry.summary)));
1541
- }
1542
- function startHelp(version) {
1543
- const start = (command, summary) => row(command, summary, " ", 40);
1544
- const lines = [
1545
- ...DESCRIPTION,
1546
- "",
1547
- "Start here (no account or model needed)",
1548
- start("wordcell init kb", "Create a knowledge base in ./kb"),
1549
- start('wordcell note create notes/first --title "First note" --root kb', "Write your first note"),
1550
- start('wordcell search "first" --root kb', "Search your notes"),
1551
- start("wordcell check --root kb", "Check links and metadata"),
1552
- "",
1553
- "Everyday",
1554
- start("wordcell clip <url> --output kb/articles", "Save a web page as Markdown"),
1555
- start("wordcell context <path> --root kb", "Find notes about a code path"),
1556
- start("wordcell index --root kb", "Turn on meaning-based search"),
1557
- "",
1558
- "All commands: wordcell --help \xB7 Command help: wordcell help <command>"
1559
- ];
1560
- if (version !== undefined)
1561
- lines.push(`wordcell ${version}`);
1562
- return `${lines.join(`
1563
- `)}
1564
- `;
1565
- }
1566
- function rootHelp() {
1567
- const lines = ["Usage: wordcell <command> [options]", "", ...DESCRIPTION];
1568
- for (const [group, title] of GROUP_TITLES) {
1569
- lines.push("", title, ...listGroup(group));
1570
- }
1571
- lines.push("", "Options", row("-h, --help", "Show help. Also: wordcell help <command>", " ", 22), row("-V, --version", "Print the version", " ", 22), row("--root <directory>", "Knowledge base folder (default: current directory)", " ", 22), row("--json", "Print machine-readable output", " ", 22), "", "More commands: wordcell help advanced \xB7 Docs: https://wordcell.io/docs", "Optional support: wordcell support \xB7 Turn off: HRANESS_SUPPORT=off");
1572
- return `${lines.join(`
1573
- `)}
1574
- `;
1575
- }
1576
- function advancedHelp() {
1577
- const lines = [
1578
- "Usage: wordcell <command> [options]",
1579
- "",
1580
- "Advanced commands for maintainers, evaluation, and several knowledge bases.",
1581
- "",
1582
- ...listGroup("advanced"),
1583
- "",
1584
- "Command help: wordcell help <command> \xB7 Everyday commands: wordcell --help"
1585
- ];
1586
- return `${lines.join(`
1587
- `)}
1588
- `;
1589
- }
1590
- function commandHelpText(id) {
1591
- const entry = byId.get(id);
1592
- if (entry === undefined)
1593
- return;
1594
- const lines = [`Usage: ${entry.usage}`, "", ...wrapWords(entry.summary, MAX_COLUMNS)];
1595
- if (entry.notes !== undefined)
1596
- lines.push(...entry.notes);
1597
- const family = commandHelp.filter((candidate) => candidate.id.startsWith(`${entry.id} `));
1598
- if (family.length > 0) {
1599
- lines.push("", "Commands", ...family.map((candidate) => row(`${candidate.label}`, firstSentence(candidate.summary))));
1600
- }
1601
- if (entry.options.length > 0) {
1602
- const width = Math.min(30, Math.max(...entry.options.map(([spelling]) => spelling.length)) + 2);
1603
- lines.push("", "Options", ...entry.options.map(([spelling, description]) => row(spelling, description, " ", width)));
1604
- }
1605
- if (entry.examples.length > 0) {
1606
- lines.push("", entry.examples.length === 1 ? "Example" : "Examples", ...entry.examples.map((example) => ` ${example}`));
1607
- }
1608
- return `${lines.join(`
1609
- `)}
1610
- `;
1611
- }
1612
- function canonicalFirstWord(word) {
1613
- return COMMAND_ALIASES[word] ?? word;
1614
- }
1615
- function resolveCommandId(words) {
1616
- const first = words[0];
1617
- if (first === undefined)
1618
- return;
1619
- const head = canonicalFirstWord(first);
1620
- const second = words[1];
1621
- if (second !== undefined && byId.has(`${head} ${second}`))
1622
- return `${head} ${second}`;
1623
- if (byId.has(head))
1624
- return head;
1625
- if (head === "note")
1626
- return "note create";
1627
- if (head === "import")
1628
- return "import supermemory";
1629
- if (head === "portfolio")
1630
- return "portfolio search";
1631
- if (head === "url-metadata")
1632
- return "url-metadata backfill";
1633
- return;
1634
- }
1635
- function commandWordCount(id) {
1636
- return id.split(" ").length;
1637
- }
1638
- function knownCommandWords() {
1639
- const words = new Set;
1640
- for (const entry of commandHelp)
1641
- words.add(entry.id.split(" ")[0] ?? entry.id);
1642
- for (const alias of Object.keys(COMMAND_ALIASES))
1643
- words.add(alias);
1644
- for (const word of ["help", "version", "note", "import", "portfolio", "url-metadata"])
1645
- words.add(word);
1646
- return [...words].toSorted();
1647
- }
1648
- function valueOptions(id) {
1649
- const entry = byId.get(id);
1650
- const names = new Set;
1651
- for (const [spelling] of entry?.options ?? []) {
1652
- if (spelling.includes("<"))
1653
- names.add(spelling.split(" ")[0] ?? spelling);
1654
- }
1655
- return names;
1656
- }
1657
- function optionNames(id) {
1658
- const entry = byId.get(id);
1659
- return (entry?.options ?? []).map(([spelling]) => spelling.split(" ")[0] ?? spelling);
1660
- }
1661
- function editDistance(left, right) {
1662
- const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
1663
- for (let row_ = 1;row_ <= left.length; row_ += 1) {
1664
- let diagonal = previous[0] ?? 0;
1665
- previous[0] = row_;
1666
- for (let column = 1;column <= right.length; column += 1) {
1667
- const above = previous[column] ?? 0;
1668
- const cost = left[row_ - 1] === right[column - 1] ? 0 : 1;
1669
- previous[column] = Math.min(above + 1, (previous[column - 1] ?? 0) + 1, diagonal + cost);
1670
- diagonal = above;
1671
- }
1672
- }
1673
- return previous[right.length] ?? Number.MAX_SAFE_INTEGER;
1674
- }
1675
- function closestMatch(input, candidates) {
1676
- const letters = input.replace(/^-+/u, "").length;
1677
- let best;
1678
- let bestDistance = Math.max(1, Math.floor(letters / 3)) + 1;
1679
- for (const candidate of candidates) {
1680
- const distance = editDistance(input, candidate);
1681
- if (distance < bestDistance) {
1682
- best = candidate;
1683
- bestDistance = distance;
1684
- }
1685
- }
1686
- return best;
1687
- }
1688
-
1689
873
  // src/cli-program.ts
1690
874
  import { open as open3, realpath as realpath2, stat as stat2 } from "fs/promises";
1691
875
  import { cpus, release, totalmem } from "os";
@@ -1773,7 +957,7 @@ async function executeGraphCommand(command, dependencies = {}) {
1773
957
  `Snapshot: ${value2.revision}`,
1774
958
  "Proofs and exact source record digests are included in --json output.",
1775
959
  value2.columns.join("\t"),
1776
- ...value2.rows.map((row2) => row2.values.map((atom) => JSON.stringify(atom)).join("\t"))
960
+ ...value2.rows.map((row) => row.values.map((atom) => JSON.stringify(atom)).join("\t"))
1777
961
  ];
1778
962
  if (value2.truncated || value2.proofsTruncated) {
1779
963
  lines.push(`Partial result: ${value2.truncationReasons.join(", ") || "proof evidence was truncated"}.`);
@@ -2856,7 +2040,10 @@ function occupancyKey(value) {
2856
2040
  return value.normalize("NFC").toLowerCase();
2857
2041
  }
2858
2042
  function normalizePrefix(prefix) {
2859
- const trimmed = prefix.replace(/\/+$/u, "");
2043
+ let end = prefix.length;
2044
+ while (end > 0 && prefix.charCodeAt(end - 1) === 47)
2045
+ end -= 1;
2046
+ const trimmed = prefix.slice(0, end);
2860
2047
  let canonical;
2861
2048
  try {
2862
2049
  canonical = canonicalNoteId(trimmed);
@@ -3868,18 +3055,18 @@ var READ_ONLY = {
3868
3055
  idempotentHint: true,
3869
3056
  openWorldHint: false
3870
3057
  };
3871
- function listRow(row2) {
3058
+ function listRow(row) {
3872
3059
  return {
3873
- id: row2.id,
3874
- path: row2.path,
3875
- title: row2.title,
3876
- aliases: row2.aliases,
3877
- tags: row2.tags,
3878
- properties: row2.properties,
3879
- metadata: row2.metadata,
3880
- summary: row2.summary,
3881
- inboundContextualCount: row2.inboundContextualCount,
3882
- outboundContextualCount: row2.outboundContextualCount
3060
+ id: row.id,
3061
+ path: row.path,
3062
+ title: row.title,
3063
+ aliases: row.aliases,
3064
+ tags: row.tags,
3065
+ properties: row.properties,
3066
+ metadata: row.metadata,
3067
+ summary: row.summary,
3068
+ inboundContextualCount: row.inboundContextualCount,
3069
+ outboundContextualCount: row.outboundContextualCount
3883
3070
  };
3884
3071
  }
3885
3072
  function bodyAfterFrontmatter(suffix) {
@@ -6159,9 +5346,6 @@ function parsePortfolioCommand(arguments_) {
6159
5346
  }
6160
5347
  };
6161
5348
  }
6162
- function isHelpFlag(argument) {
6163
- return argument === "--help" || argument === "-h";
6164
- }
6165
5349
  function isDelegatedHelp(command) {
6166
5350
  if (command.kind === "clip")
6167
5351
  return command.arguments.length === 1 && command.arguments[0] === "help";
@@ -6170,62 +5354,11 @@ function isDelegatedHelp(command) {
6170
5354
  }
6171
5355
  return false;
6172
5356
  }
6173
- function delegatedHelp(first) {
6174
- if (first === "clip" || first === "inspect")
6175
- return { kind: "clip", arguments: ["help"] };
6176
- if (first === "pdf")
6177
- return { kind: "pdf", arguments: ["--help"] };
6178
- if (first === "url-metadata")
6179
- return { kind: "url-metadata", arguments: ["--help"] };
6180
- return;
6181
- }
6182
- function parseHelpTopic(words) {
6183
- const topic = words.filter((word) => !isHelpFlag(word) && word !== "--json");
6184
- if (topic.length === 0)
6185
- return { ok: true, value: { kind: "help" } };
6186
- if (topic.length === 1 && topic[0] === "advanced")
6187
- return { ok: true, value: { kind: "help", topic: "advanced" } };
6188
- const delegated = delegatedHelp(topic[0] ?? "");
6189
- if (delegated !== undefined)
6190
- return { ok: true, value: delegated };
6191
- const id = resolveCommandId(topic);
6192
- if (id === undefined)
6193
- return { ok: false, message: "unknown help topic" };
6194
- return { ok: true, value: { kind: "help", topic: id } };
6195
- }
6196
- function embeddedHelp(arguments_) {
6197
- const separator = arguments_.indexOf("--");
6198
- const end = separator === -1 ? arguments_.length : separator;
6199
- const index = arguments_.slice(0, end).findIndex(isHelpFlag);
6200
- if (index <= 0)
6201
- return;
6202
- const delegated = delegatedHelp(arguments_[0] ?? "");
6203
- if (delegated !== undefined) {
6204
- return index === 1 || index === end - 1 ? { ok: true, value: delegated } : undefined;
6205
- }
6206
- const id = resolveCommandId(arguments_.slice(0, index).filter((word) => !word.startsWith("-")));
6207
- if (id === undefined)
6208
- return;
6209
- const words = commandWordCount(id);
6210
- const previous = arguments_[index - 1] ?? "";
6211
- const flag = arguments_[index];
6212
- const lastArgument = index === end - 1 && (flag === "--help" || !valueOptions(id).has(previous));
6213
- if (index !== words && !lastArgument)
6214
- return;
6215
- return { ok: true, value: { kind: "help", topic: id } };
6216
- }
6217
5357
  function parseArguments(arguments_) {
5358
+ const startup = parseCliStartupCommand(arguments_);
5359
+ if (startup !== undefined)
5360
+ return startup;
6218
5361
  const command = arguments_[0];
6219
- if (command === undefined)
6220
- return { ok: true, value: { kind: "help", topic: "start" } };
6221
- if (command === "help" || isHelpFlag(command))
6222
- return parseHelpTopic(arguments_.slice(1));
6223
- if (command === "--version" || command === "-V" || command === "-v" || command === "version") {
6224
- return { ok: true, value: { kind: "version", json: arguments_.includes("--json") } };
6225
- }
6226
- const help = embeddedHelp(arguments_);
6227
- if (help !== undefined)
6228
- return help;
6229
5362
  if (command === "capture" && arguments_[1] === "diff") {
6230
5363
  return parseCaptureDiffCommand(arguments_.slice(2));
6231
5364
  }
@@ -6588,9 +5721,9 @@ async function runEvaluation(command, output, dependencies) {
6588
5721
  ...embeddingModelFile === undefined ? {} : { embeddingModelFile }
6589
5722
  });
6590
5723
  try {
6591
- const byId2 = new Map(evaluation.retrievers.map((retriever) => [retriever.id, retriever]));
5724
+ const byId = new Map(evaluation.retrievers.map((retriever) => [retriever.id, retriever]));
6592
5725
  const retrievers = command.retrievers.map((id) => {
6593
- const retriever = byId2.get(id);
5726
+ const retriever = byId.get(id);
6594
5727
  if (retriever === undefined)
6595
5728
  throw new Error(`Evaluation adapter ${id} is unavailable.`);
6596
5729
  return retriever;
@@ -6880,9 +6013,9 @@ function renderList(rows) {
6880
6013
  const lines = [`Notes (${rows.length})`];
6881
6014
  if (rows.length === 0)
6882
6015
  lines.push(" None.");
6883
- for (const row2 of rows) {
6884
- const tags = row2.tags.length === 0 ? "" : ` #${row2.tags.map(safe).join(" #")}`;
6885
- lines.push(` ${safe(row2.path)} \u2014 ${safe(row2.title)} \u2190 ${row2.inboundContextualCount} \u2192 ${row2.outboundContextualCount}${tags}`);
6016
+ for (const row of rows) {
6017
+ const tags = row.tags.length === 0 ? "" : ` #${row.tags.map(safe).join(" #")}`;
6018
+ lines.push(` ${safe(row.path)} \u2014 ${safe(row.title)} \u2190 ${row.inboundContextualCount} \u2192 ${row.outboundContextualCount}${tags}`);
6886
6019
  }
6887
6020
  return `${lines.join(`
6888
6021
  `)}