@gmickel/gno 0.7.0 → 0.8.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 (209) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -50
  3. package/THIRD_PARTY_NOTICES.md +22 -0
  4. package/assets/screenshots/webui-ask-answer.png +0 -0
  5. package/assets/screenshots/webui-collections.png +0 -0
  6. package/assets/screenshots/webui-editor.png +0 -0
  7. package/assets/screenshots/webui-home.png +0 -0
  8. package/assets/skill/SKILL.md +12 -12
  9. package/assets/skill/cli-reference.md +59 -57
  10. package/assets/skill/examples.md +8 -7
  11. package/assets/skill/mcp-reference.md +8 -4
  12. package/package.json +31 -24
  13. package/src/app/constants.ts +43 -42
  14. package/src/cli/colors.ts +1 -1
  15. package/src/cli/commands/ask.ts +44 -43
  16. package/src/cli/commands/cleanup.ts +9 -8
  17. package/src/cli/commands/collection/add.ts +12 -12
  18. package/src/cli/commands/collection/index.ts +4 -4
  19. package/src/cli/commands/collection/list.ts +26 -25
  20. package/src/cli/commands/collection/remove.ts +10 -10
  21. package/src/cli/commands/collection/rename.ts +10 -10
  22. package/src/cli/commands/context/add.ts +1 -1
  23. package/src/cli/commands/context/check.ts +17 -17
  24. package/src/cli/commands/context/index.ts +4 -4
  25. package/src/cli/commands/context/list.ts +11 -11
  26. package/src/cli/commands/context/rm.ts +1 -1
  27. package/src/cli/commands/doctor.ts +86 -84
  28. package/src/cli/commands/embed.ts +30 -28
  29. package/src/cli/commands/get.ts +27 -26
  30. package/src/cli/commands/index-cmd.ts +9 -9
  31. package/src/cli/commands/index.ts +16 -16
  32. package/src/cli/commands/init.ts +13 -12
  33. package/src/cli/commands/ls.ts +20 -19
  34. package/src/cli/commands/mcp/config.ts +30 -28
  35. package/src/cli/commands/mcp/index.ts +4 -4
  36. package/src/cli/commands/mcp/install.ts +17 -17
  37. package/src/cli/commands/mcp/paths.ts +133 -133
  38. package/src/cli/commands/mcp/status.ts +21 -21
  39. package/src/cli/commands/mcp/uninstall.ts +13 -13
  40. package/src/cli/commands/mcp.ts +2 -2
  41. package/src/cli/commands/models/clear.ts +12 -11
  42. package/src/cli/commands/models/index.ts +5 -5
  43. package/src/cli/commands/models/list.ts +31 -30
  44. package/src/cli/commands/models/path.ts +1 -1
  45. package/src/cli/commands/models/pull.ts +19 -18
  46. package/src/cli/commands/models/use.ts +4 -4
  47. package/src/cli/commands/multi-get.ts +38 -36
  48. package/src/cli/commands/query.ts +21 -20
  49. package/src/cli/commands/ref-parser.ts +10 -10
  50. package/src/cli/commands/reset.ts +40 -39
  51. package/src/cli/commands/search.ts +14 -13
  52. package/src/cli/commands/serve.ts +4 -4
  53. package/src/cli/commands/shared.ts +11 -10
  54. package/src/cli/commands/skill/index.ts +5 -5
  55. package/src/cli/commands/skill/install.ts +18 -17
  56. package/src/cli/commands/skill/paths-cmd.ts +11 -10
  57. package/src/cli/commands/skill/paths.ts +23 -23
  58. package/src/cli/commands/skill/show.ts +13 -12
  59. package/src/cli/commands/skill/uninstall.ts +16 -15
  60. package/src/cli/commands/status.ts +25 -24
  61. package/src/cli/commands/update.ts +3 -3
  62. package/src/cli/commands/vsearch.ts +17 -16
  63. package/src/cli/context.ts +5 -5
  64. package/src/cli/errors.ts +3 -3
  65. package/src/cli/format/search-results.ts +37 -37
  66. package/src/cli/options.ts +43 -43
  67. package/src/cli/program.ts +455 -459
  68. package/src/cli/progress.ts +1 -1
  69. package/src/cli/run.ts +24 -23
  70. package/src/collection/add.ts +9 -8
  71. package/src/collection/index.ts +3 -3
  72. package/src/collection/remove.ts +7 -6
  73. package/src/collection/types.ts +6 -6
  74. package/src/config/defaults.ts +1 -1
  75. package/src/config/index.ts +5 -5
  76. package/src/config/loader.ts +19 -18
  77. package/src/config/paths.ts +9 -8
  78. package/src/config/saver.ts +14 -13
  79. package/src/config/types.ts +53 -52
  80. package/src/converters/adapters/markitdownTs/adapter.ts +21 -19
  81. package/src/converters/adapters/officeparser/adapter.ts +18 -16
  82. package/src/converters/canonicalize.ts +12 -12
  83. package/src/converters/errors.ts +26 -22
  84. package/src/converters/index.ts +8 -8
  85. package/src/converters/mime.ts +25 -25
  86. package/src/converters/native/markdown.ts +10 -9
  87. package/src/converters/native/plaintext.ts +8 -7
  88. package/src/converters/path.ts +2 -2
  89. package/src/converters/pipeline.ts +11 -10
  90. package/src/converters/registry.ts +8 -8
  91. package/src/converters/types.ts +14 -14
  92. package/src/converters/versions.ts +4 -4
  93. package/src/index.ts +4 -4
  94. package/src/ingestion/chunker.ts +10 -9
  95. package/src/ingestion/index.ts +6 -6
  96. package/src/ingestion/language.ts +62 -62
  97. package/src/ingestion/sync.ts +50 -49
  98. package/src/ingestion/types.ts +10 -10
  99. package/src/ingestion/walker.ts +14 -13
  100. package/src/llm/cache.ts +51 -49
  101. package/src/llm/errors.ts +40 -36
  102. package/src/llm/index.ts +9 -9
  103. package/src/llm/lockfile.ts +6 -6
  104. package/src/llm/nodeLlamaCpp/adapter.ts +13 -12
  105. package/src/llm/nodeLlamaCpp/embedding.ts +9 -8
  106. package/src/llm/nodeLlamaCpp/generation.ts +7 -6
  107. package/src/llm/nodeLlamaCpp/lifecycle.ts +11 -10
  108. package/src/llm/nodeLlamaCpp/rerank.ts +6 -5
  109. package/src/llm/policy.ts +5 -5
  110. package/src/llm/registry.ts +6 -5
  111. package/src/llm/types.ts +2 -2
  112. package/src/mcp/resources/index.ts +15 -13
  113. package/src/mcp/server.ts +25 -23
  114. package/src/mcp/tools/get.ts +25 -23
  115. package/src/mcp/tools/index.ts +32 -29
  116. package/src/mcp/tools/multi-get.ts +34 -32
  117. package/src/mcp/tools/query.ts +29 -27
  118. package/src/mcp/tools/search.ts +14 -12
  119. package/src/mcp/tools/status.ts +12 -11
  120. package/src/mcp/tools/vsearch.ts +26 -24
  121. package/src/pipeline/answer.ts +9 -9
  122. package/src/pipeline/chunk-lookup.ts +1 -1
  123. package/src/pipeline/contextual.ts +4 -4
  124. package/src/pipeline/expansion.ts +23 -21
  125. package/src/pipeline/explain.ts +21 -21
  126. package/src/pipeline/fusion.ts +9 -9
  127. package/src/pipeline/hybrid.ts +41 -42
  128. package/src/pipeline/index.ts +10 -10
  129. package/src/pipeline/query-language.ts +39 -39
  130. package/src/pipeline/rerank.ts +8 -7
  131. package/src/pipeline/search.ts +22 -22
  132. package/src/pipeline/types.ts +8 -8
  133. package/src/pipeline/vsearch.ts +21 -24
  134. package/src/serve/CLAUDE.md +21 -15
  135. package/src/serve/config-sync.ts +9 -8
  136. package/src/serve/context.ts +19 -18
  137. package/src/serve/index.ts +1 -1
  138. package/src/serve/jobs.ts +7 -7
  139. package/src/serve/public/app.tsx +79 -25
  140. package/src/serve/public/components/AddCollectionDialog.tsx +382 -0
  141. package/src/serve/public/components/CaptureButton.tsx +60 -0
  142. package/src/serve/public/components/CaptureModal.tsx +365 -0
  143. package/src/serve/public/components/IndexingProgress.tsx +333 -0
  144. package/src/serve/public/components/ShortcutHelpModal.tsx +106 -0
  145. package/src/serve/public/components/ai-elements/code-block.tsx +42 -32
  146. package/src/serve/public/components/ai-elements/conversation.tsx +16 -14
  147. package/src/serve/public/components/ai-elements/inline-citation.tsx +33 -32
  148. package/src/serve/public/components/ai-elements/loader.tsx +5 -4
  149. package/src/serve/public/components/ai-elements/message.tsx +39 -37
  150. package/src/serve/public/components/ai-elements/prompt-input.tsx +97 -95
  151. package/src/serve/public/components/ai-elements/sources.tsx +12 -10
  152. package/src/serve/public/components/ai-elements/suggestion.tsx +10 -9
  153. package/src/serve/public/components/editor/CodeMirrorEditor.tsx +142 -0
  154. package/src/serve/public/components/editor/MarkdownPreview.tsx +311 -0
  155. package/src/serve/public/components/editor/index.ts +6 -0
  156. package/src/serve/public/components/preset-selector.tsx +29 -28
  157. package/src/serve/public/components/ui/badge.tsx +13 -12
  158. package/src/serve/public/components/ui/button-group.tsx +13 -12
  159. package/src/serve/public/components/ui/button.tsx +23 -22
  160. package/src/serve/public/components/ui/card.tsx +16 -16
  161. package/src/serve/public/components/ui/carousel.tsx +36 -35
  162. package/src/serve/public/components/ui/collapsible.tsx +1 -1
  163. package/src/serve/public/components/ui/command.tsx +17 -15
  164. package/src/serve/public/components/ui/dialog.tsx +13 -12
  165. package/src/serve/public/components/ui/dropdown-menu.tsx +13 -12
  166. package/src/serve/public/components/ui/hover-card.tsx +6 -5
  167. package/src/serve/public/components/ui/input-group.tsx +45 -43
  168. package/src/serve/public/components/ui/input.tsx +6 -6
  169. package/src/serve/public/components/ui/progress.tsx +5 -4
  170. package/src/serve/public/components/ui/scroll-area.tsx +11 -10
  171. package/src/serve/public/components/ui/select.tsx +19 -18
  172. package/src/serve/public/components/ui/separator.tsx +6 -5
  173. package/src/serve/public/components/ui/table.tsx +18 -18
  174. package/src/serve/public/components/ui/textarea.tsx +4 -4
  175. package/src/serve/public/components/ui/tooltip.tsx +5 -4
  176. package/src/serve/public/globals.css +27 -4
  177. package/src/serve/public/hooks/use-api.ts +8 -8
  178. package/src/serve/public/hooks/useCaptureModal.tsx +83 -0
  179. package/src/serve/public/hooks/useKeyboardShortcuts.ts +85 -0
  180. package/src/serve/public/index.html +4 -4
  181. package/src/serve/public/lib/utils.ts +6 -0
  182. package/src/serve/public/pages/Ask.tsx +27 -26
  183. package/src/serve/public/pages/Browse.tsx +28 -27
  184. package/src/serve/public/pages/Collections.tsx +439 -0
  185. package/src/serve/public/pages/Dashboard.tsx +166 -40
  186. package/src/serve/public/pages/DocView.tsx +258 -73
  187. package/src/serve/public/pages/DocumentEditor.tsx +510 -0
  188. package/src/serve/public/pages/Search.tsx +80 -58
  189. package/src/serve/routes/api.ts +272 -155
  190. package/src/serve/security.ts +4 -4
  191. package/src/serve/server.ts +66 -48
  192. package/src/store/index.ts +5 -5
  193. package/src/store/migrations/001-initial.ts +24 -23
  194. package/src/store/migrations/002-documents-fts.ts +7 -6
  195. package/src/store/migrations/index.ts +4 -4
  196. package/src/store/migrations/runner.ts +17 -15
  197. package/src/store/sqlite/adapter.ts +123 -121
  198. package/src/store/sqlite/fts5-snowball.ts +24 -23
  199. package/src/store/sqlite/index.ts +1 -1
  200. package/src/store/sqlite/setup.ts +12 -12
  201. package/src/store/sqlite/types.ts +4 -4
  202. package/src/store/types.ts +19 -19
  203. package/src/store/vector/index.ts +3 -3
  204. package/src/store/vector/sqlite-vec.ts +23 -20
  205. package/src/store/vector/stats.ts +10 -8
  206. package/src/store/vector/types.ts +2 -2
  207. package/vendor/fts5-snowball/README.md +6 -6
  208. package/assets/screenshots/webui-ask-answer.jpg +0 -0
  209. package/assets/screenshots/webui-home.jpg +0 -0
@@ -4,14 +4,14 @@
4
4
  * @module src/cli/commands/mcp/status
5
5
  */
6
6
 
7
- import { getGlobals } from '../../program.js';
7
+ import { getGlobals } from "../../program.js";
8
8
  import {
9
9
  type AnyMcpConfig,
10
10
  getServerEntry,
11
11
  isYamlFormat,
12
12
  type OpenCodeMcpEntry,
13
13
  type StandardMcpEntry,
14
- } from './config.js';
14
+ } from "./config.js";
15
15
  import {
16
16
  getTargetDisplayName,
17
17
  MCP_SERVER_NAME,
@@ -20,15 +20,15 @@ import {
20
20
  type McpTarget,
21
21
  resolveMcpConfigPath,
22
22
  TARGETS_WITH_PROJECT_SCOPE,
23
- } from './paths.js';
23
+ } from "./paths.js";
24
24
 
25
25
  // ─────────────────────────────────────────────────────────────────────────────
26
26
  // Types
27
27
  // ─────────────────────────────────────────────────────────────────────────────
28
28
 
29
29
  export interface StatusOptions {
30
- target?: McpTarget | 'all';
31
- scope?: McpScope | 'all';
30
+ target?: McpTarget | "all";
31
+ scope?: McpScope | "all";
32
32
  /** Override cwd (testing) */
33
33
  cwd?: string;
34
34
  /** Override home dir (testing) */
@@ -64,9 +64,9 @@ interface StatusResult {
64
64
  function normalizeEntry(
65
65
  entry: StandardMcpEntry | OpenCodeMcpEntry
66
66
  ): StandardMcpEntry {
67
- if ('type' in entry && entry.type === 'local') {
67
+ if ("type" in entry && entry.type === "local") {
68
68
  // OpenCode format: command is array [command, ...args]
69
- const [command = '', ...args] = entry.command;
69
+ const [command = "", ...args] = entry.command;
70
70
  return { command, args };
71
71
  }
72
72
  return entry as StandardMcpEntry;
@@ -112,7 +112,7 @@ async function checkTargetStatus(
112
112
 
113
113
  return { target, scope, configPath, configured: false };
114
114
  } catch {
115
- const format = isYamlFormat(configFormat) ? 'YAML' : 'JSON';
115
+ const format = isYamlFormat(configFormat) ? "YAML" : "JSON";
116
116
  return {
117
117
  target,
118
118
  scope,
@@ -141,15 +141,15 @@ function safeGetGlobals(): { json: boolean } {
141
141
  /**
142
142
  * Show MCP installation status.
143
143
  */
144
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: status display with multiple targets and scopes
144
+ // oxlint-disable-next-line max-lines-per-function -- status display with multiple targets and scopes
145
145
  export async function statusMcp(opts: StatusOptions = {}): Promise<void> {
146
- const targetFilter = opts.target ?? 'all';
147
- const scopeFilter = opts.scope ?? 'all';
146
+ const targetFilter = opts.target ?? "all";
147
+ const scopeFilter = opts.scope ?? "all";
148
148
  const globals = safeGetGlobals();
149
149
  const json = opts.json ?? globals.json;
150
150
 
151
151
  const targets: McpTarget[] =
152
- targetFilter === 'all' ? MCP_TARGETS : [targetFilter];
152
+ targetFilter === "all" ? MCP_TARGETS : [targetFilter];
153
153
 
154
154
  const results: TargetStatus[] = [];
155
155
 
@@ -159,7 +159,7 @@ export async function statusMcp(opts: StatusOptions = {}): Promise<void> {
159
159
  if (supportsProject) {
160
160
  // Targets that support both scopes
161
161
  const scopes: McpScope[] =
162
- scopeFilter === 'all' ? ['user', 'project'] : [scopeFilter];
162
+ scopeFilter === "all" ? ["user", "project"] : [scopeFilter];
163
163
 
164
164
  for (const scope of scopes) {
165
165
  results.push(
@@ -169,10 +169,10 @@ export async function statusMcp(opts: StatusOptions = {}): Promise<void> {
169
169
  })
170
170
  );
171
171
  }
172
- } else if (scopeFilter === 'all' || scopeFilter === 'user') {
172
+ } else if (scopeFilter === "all" || scopeFilter === "user") {
173
173
  // User scope only - skip if filtering by project
174
174
  results.push(
175
- await checkTargetStatus(target, 'user', {
175
+ await checkTargetStatus(target, "user", {
176
176
  cwd: opts.cwd,
177
177
  homeDir: opts.homeDir,
178
178
  })
@@ -193,14 +193,14 @@ export async function statusMcp(opts: StatusOptions = {}): Promise<void> {
193
193
  }
194
194
 
195
195
  // Terminal output
196
- process.stdout.write('MCP Server Status\n');
197
- process.stdout.write(`${''.repeat(50)}\n\n`);
196
+ process.stdout.write("MCP Server Status\n");
197
+ process.stdout.write(`${"".repeat(50)}\n\n`);
198
198
 
199
199
  for (const status of results) {
200
200
  const targetName = getTargetDisplayName(status.target);
201
- const scopeLabel = status.scope === 'project' ? ' (project)' : '';
202
- const statusIcon = status.configured ? '' : '';
203
- const statusText = status.configured ? 'configured' : 'not configured';
201
+ const scopeLabel = status.scope === "project" ? " (project)" : "";
202
+ const statusIcon = status.configured ? "" : "";
203
+ const statusText = status.configured ? "configured" : "not configured";
204
204
 
205
205
  process.stdout.write(
206
206
  `${statusIcon} ${targetName}${scopeLabel}: ${statusText}\n`
@@ -208,7 +208,7 @@ export async function statusMcp(opts: StatusOptions = {}): Promise<void> {
208
208
 
209
209
  if (status.configured && status.serverEntry) {
210
210
  process.stdout.write(` Command: ${status.serverEntry.command}\n`);
211
- process.stdout.write(` Args: ${status.serverEntry.args.join(' ')}\n`);
211
+ process.stdout.write(` Args: ${status.serverEntry.args.join(" ")}\n`);
212
212
  }
213
213
 
214
214
  if (status.error) {
@@ -4,15 +4,15 @@
4
4
  * @module src/cli/commands/mcp/uninstall
5
5
  */
6
6
 
7
- import { CliError } from '../../errors.js';
8
- import { getGlobals } from '../../program.js';
7
+ import { CliError } from "../../errors.js";
8
+ import { getGlobals } from "../../program.js";
9
9
  import {
10
10
  type AnyMcpConfig,
11
11
  isYamlFormat,
12
12
  readMcpConfig,
13
13
  removeServerEntry,
14
14
  writeMcpConfig,
15
- } from './config.js';
15
+ } from "./config.js";
16
16
  import {
17
17
  getTargetDisplayName,
18
18
  MCP_SERVER_NAME,
@@ -20,7 +20,7 @@ import {
20
20
  type McpTarget,
21
21
  resolveMcpConfigPath,
22
22
  TARGETS_WITH_PROJECT_SCOPE,
23
- } from './paths.js';
23
+ } from "./paths.js";
24
24
 
25
25
  // ─────────────────────────────────────────────────────────────────────────────
26
26
  // Types
@@ -43,7 +43,7 @@ interface UninstallResult {
43
43
  target: McpTarget;
44
44
  scope: McpScope;
45
45
  configPath: string;
46
- action: 'removed' | 'not_found';
46
+ action: "removed" | "not_found";
47
47
  }
48
48
 
49
49
  // ─────────────────────────────────────────────────────────────────────────────
@@ -75,7 +75,7 @@ async function uninstallFromTarget(
75
75
 
76
76
  // File doesn't exist
77
77
  if (config === null) {
78
- return { target, scope, configPath, action: 'not_found' };
78
+ return { target, scope, configPath, action: "not_found" };
79
79
  }
80
80
 
81
81
  // Try to remove entry using format-aware helper
@@ -86,13 +86,13 @@ async function uninstallFromTarget(
86
86
  );
87
87
 
88
88
  if (!removed) {
89
- return { target, scope, configPath, action: 'not_found' };
89
+ return { target, scope, configPath, action: "not_found" };
90
90
  }
91
91
 
92
92
  // Write back
93
93
  await writeMcpConfig(configPath, config as AnyMcpConfig, { yaml: useYaml });
94
94
 
95
- return { target, scope, configPath, action: 'removed' };
95
+ return { target, scope, configPath, action: "removed" };
96
96
  }
97
97
 
98
98
  /**
@@ -110,16 +110,16 @@ function safeGetGlobals(): { json: boolean; quiet: boolean } {
110
110
  * Uninstall gno MCP server.
111
111
  */
112
112
  export async function uninstallMcp(opts: UninstallOptions = {}): Promise<void> {
113
- const target = opts.target ?? 'claude-desktop';
114
- const scope = opts.scope ?? 'user';
113
+ const target = opts.target ?? "claude-desktop";
114
+ const scope = opts.scope ?? "user";
115
115
  const globals = safeGetGlobals();
116
116
  const json = opts.json ?? globals.json;
117
117
  const quiet = opts.quiet ?? globals.quiet;
118
118
 
119
119
  // Validate scope - only some targets support project scope
120
- if (scope === 'project' && !TARGETS_WITH_PROJECT_SCOPE.includes(target)) {
120
+ if (scope === "project" && !TARGETS_WITH_PROJECT_SCOPE.includes(target)) {
121
121
  throw new CliError(
122
- 'VALIDATION',
122
+ "VALIDATION",
123
123
  `${getTargetDisplayName(target)} does not support project scope.`
124
124
  );
125
125
  }
@@ -141,7 +141,7 @@ export async function uninstallMcp(opts: UninstallOptions = {}): Promise<void> {
141
141
  return;
142
142
  }
143
143
 
144
- if (result.action === 'not_found') {
144
+ if (result.action === "not_found") {
145
145
  process.stdout.write(
146
146
  `gno is not configured in ${getTargetDisplayName(target)}.\n`
147
147
  );
@@ -4,14 +4,14 @@
4
4
  * @module src/cli/commands/mcp
5
5
  */
6
6
 
7
- import type { GlobalOptions } from '../context';
7
+ import type { GlobalOptions } from "../context";
8
8
 
9
9
  /**
10
10
  * Start the MCP server.
11
11
  * Reads global options for --index and --config flags.
12
12
  */
13
13
  export async function mcpCommand(options: GlobalOptions): Promise<void> {
14
- const { startMcpServer } = await import('../../mcp/server.js');
14
+ const { startMcpServer } = await import("../../mcp/server.js");
15
15
  await startMcpServer({
16
16
  indexName: options.index,
17
17
  configPath: options.config,
@@ -5,9 +5,10 @@
5
5
  * @module src/cli/commands/models/clear
6
6
  */
7
7
 
8
- import { getModelsCachePath } from '../../../app/constants';
9
- import { ModelCache } from '../../../llm/cache';
10
- import type { ModelType } from '../../../llm/types';
8
+ import type { ModelType } from "../../../llm/types";
9
+
10
+ import { getModelsCachePath } from "../../../app/constants";
11
+ import { ModelCache } from "../../../llm/cache";
11
12
 
12
13
  // ─────────────────────────────────────────────────────────────────────────────
13
14
  // Types
@@ -52,13 +53,13 @@ export async function modelsClear(
52
53
  } else if (options.embed || options.rerank || options.gen) {
53
54
  types = [];
54
55
  if (options.embed) {
55
- types.push('embed');
56
+ types.push("embed");
56
57
  }
57
58
  if (options.rerank) {
58
- types.push('rerank');
59
+ types.push("rerank");
59
60
  }
60
61
  if (options.gen) {
61
- types.push('gen');
62
+ types.push("gen");
62
63
  }
63
64
  } else {
64
65
  // Default: clear all
@@ -70,7 +71,7 @@ export async function modelsClear(
70
71
  const sizeAfter = await cache.totalSize();
71
72
 
72
73
  return {
73
- cleared: types ?? ['embed', 'rerank', 'gen'],
74
+ cleared: types ?? ["embed", "rerank", "gen"],
74
75
  sizeBefore,
75
76
  sizeAfter,
76
77
  };
@@ -82,10 +83,10 @@ export async function modelsClear(
82
83
 
83
84
  function formatBytes(bytes: number): string {
84
85
  if (bytes === 0) {
85
- return '0 B';
86
+ return "0 B";
86
87
  }
87
88
  const k = 1024;
88
- const sizes = ['B', 'KB', 'MB', 'GB'];
89
+ const sizes = ["B", "KB", "MB", "GB"];
89
90
  const i = Math.floor(Math.log(bytes) / Math.log(k));
90
91
  return `${(bytes / k ** i).toFixed(1)} ${sizes[i]}`;
91
92
  }
@@ -96,8 +97,8 @@ function formatBytes(bytes: number): string {
96
97
  export function formatModelsClear(result: ModelsClearResult): string {
97
98
  const lines: string[] = [];
98
99
 
99
- lines.push(`Cleared: ${result.cleared.join(', ')}`);
100
+ lines.push(`Cleared: ${result.cleared.join(", ")}`);
100
101
  lines.push(`Freed: ${formatBytes(result.sizeBefore - result.sizeAfter)}`);
101
102
 
102
- return lines.join('\n');
103
+ return lines.join("\n");
103
104
  }
@@ -4,29 +4,29 @@
4
4
  * @module src/cli/commands/models
5
5
  */
6
6
 
7
- export { createProgressRenderer } from '../../progress';
7
+ export { createProgressRenderer } from "../../progress";
8
8
  export {
9
9
  formatModelsClear,
10
10
  type ModelsClearOptions,
11
11
  type ModelsClearResult,
12
12
  modelsClear,
13
- } from './clear';
13
+ } from "./clear";
14
14
  export {
15
15
  formatModelsList,
16
16
  type ModelsListOptions,
17
17
  type ModelsListResult,
18
18
  modelsList,
19
- } from './list';
19
+ } from "./list";
20
20
  export {
21
21
  formatModelsPath,
22
22
  type ModelsPathOptions,
23
23
  type ModelsPathResult,
24
24
  modelsPath,
25
- } from './path';
25
+ } from "./path";
26
26
  export {
27
27
  formatModelsPull,
28
28
  type ModelPullResult,
29
29
  type ModelsPullOptions,
30
30
  type ModelsPullResult,
31
31
  modelsPull,
32
- } from './pull';
32
+ } from "./pull";
@@ -5,11 +5,12 @@
5
5
  * @module src/cli/commands/models/list
6
6
  */
7
7
 
8
- import { getModelsCachePath } from '../../../app/constants';
9
- import { loadConfig } from '../../../config';
10
- import { ModelCache } from '../../../llm/cache';
11
- import { getActivePreset } from '../../../llm/registry';
12
- import type { ModelStatus } from '../../../llm/types';
8
+ import type { ModelStatus } from "../../../llm/types";
9
+
10
+ import { getModelsCachePath } from "../../../app/constants";
11
+ import { loadConfig } from "../../../config";
12
+ import { ModelCache } from "../../../llm/cache";
13
+ import { getActivePreset } from "../../../llm/registry";
13
14
 
14
15
  // ─────────────────────────────────────────────────────────────────────────────
15
16
  // Types
@@ -73,8 +74,8 @@ export async function modelsList(
73
74
  options: ModelsListOptions = {}
74
75
  ): Promise<ModelsListResult> {
75
76
  // Load config (use defaults if not initialized)
76
- const { createDefaultConfig } = await import('../../../config');
77
- const { getModelConfig, listPresets } = await import('../../../llm/registry');
77
+ const { createDefaultConfig } = await import("../../../config");
78
+ const { getModelConfig, listPresets } = await import("../../../llm/registry");
78
79
  const configResult = await loadConfig(options.configPath);
79
80
  const config = configResult.ok ? configResult.value : createDefaultConfig();
80
81
 
@@ -110,10 +111,10 @@ export async function modelsList(
110
111
 
111
112
  function formatBytes(bytes: number): string {
112
113
  if (bytes === 0) {
113
- return '0 B';
114
+ return "0 B";
114
115
  }
115
116
  const k = 1024;
116
- const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
117
+ const sizes = ["B", "KB", "MB", "GB", "TB"];
117
118
  const i = Math.min(
118
119
  Math.floor(Math.log(bytes) / Math.log(k)),
119
120
  sizes.length - 1
@@ -125,58 +126,58 @@ function formatTerminal(result: ModelsListResult): string {
125
126
  const lines: string[] = [];
126
127
 
127
128
  // Show presets
128
- lines.push('Presets:');
129
+ lines.push("Presets:");
129
130
  for (const p of result.presets) {
130
- const marker = p.active ? '>' : ' ';
131
+ const marker = p.active ? ">" : " ";
131
132
  lines.push(` ${marker} ${p.id}: ${p.name}`);
132
133
  }
133
- lines.push('');
134
+ lines.push("");
134
135
 
135
136
  // Show models for active preset
136
137
  lines.push(`Models (${result.activePreset}):`);
137
138
 
138
- const statusIcon = (s: ModelStatus) => (s.cached ? '' : '');
139
+ const statusIcon = (s: ModelStatus) => (s.cached ? "" : "");
139
140
 
140
141
  lines.push(
141
142
  ` embed: ${statusIcon(result.embed)} ${result.embed.uri}` +
142
- (result.embed.size ? ` (${formatBytes(result.embed.size)})` : '')
143
+ (result.embed.size ? ` (${formatBytes(result.embed.size)})` : "")
143
144
  );
144
145
  lines.push(
145
146
  ` rerank: ${statusIcon(result.rerank)} ${result.rerank.uri}` +
146
- (result.rerank.size ? ` (${formatBytes(result.rerank.size)})` : '')
147
+ (result.rerank.size ? ` (${formatBytes(result.rerank.size)})` : "")
147
148
  );
148
149
  lines.push(
149
150
  ` gen: ${statusIcon(result.gen)} ${result.gen.uri}` +
150
- (result.gen.size ? ` (${formatBytes(result.gen.size)})` : '')
151
+ (result.gen.size ? ` (${formatBytes(result.gen.size)})` : "")
151
152
  );
152
153
 
153
- lines.push('');
154
+ lines.push("");
154
155
  lines.push(`Cache: ${result.cacheDir}`);
155
156
  lines.push(`Total size: ${formatBytes(result.totalSize)}`);
156
157
 
157
158
  const allCached =
158
159
  result.embed.cached && result.rerank.cached && result.gen.cached;
159
160
  if (!allCached) {
160
- lines.push('');
161
- lines.push('Run: gno models pull --all');
161
+ lines.push("");
162
+ lines.push("Run: gno models pull --all");
162
163
  }
163
164
 
164
- lines.push('');
165
- lines.push('Switch preset: gno models use <preset>');
165
+ lines.push("");
166
+ lines.push("Switch preset: gno models use <preset>");
166
167
 
167
- return lines.join('\n');
168
+ return lines.join("\n");
168
169
  }
169
170
 
170
171
  function formatMarkdown(result: ModelsListResult): string {
171
172
  const lines: string[] = [];
172
173
 
173
- lines.push('# Models');
174
- lines.push('');
175
- lines.push('| Type | URI | Cached | Size |');
176
- lines.push('|------|-----|--------|------|');
174
+ lines.push("# Models");
175
+ lines.push("");
176
+ lines.push("| Type | URI | Cached | Size |");
177
+ lines.push("|------|-----|--------|------|");
177
178
 
178
- const status = (s: ModelStatus) => (s.cached ? '' : '');
179
- const size = (s: ModelStatus) => (s.size ? formatBytes(s.size) : '-');
179
+ const status = (s: ModelStatus) => (s.cached ? "" : "");
180
+ const size = (s: ModelStatus) => (s.size ? formatBytes(s.size) : "-");
180
181
 
181
182
  lines.push(
182
183
  `| embed | ${result.embed.uri} | ${status(result.embed)} | ${size(result.embed)} |`
@@ -188,11 +189,11 @@ function formatMarkdown(result: ModelsListResult): string {
188
189
  `| gen | ${result.gen.uri} | ${status(result.gen)} | ${size(result.gen)} |`
189
190
  );
190
191
 
191
- lines.push('');
192
+ lines.push("");
192
193
  lines.push(`**Cache**: ${result.cacheDir}`);
193
194
  lines.push(`**Total size**: ${formatBytes(result.totalSize)}`);
194
195
 
195
- return lines.join('\n');
196
+ return lines.join("\n");
196
197
  }
197
198
 
198
199
  /**
@@ -5,7 +5,7 @@
5
5
  * @module src/cli/commands/models/path
6
6
  */
7
7
 
8
- import { getModelsCachePath } from '../../../app/constants';
8
+ import { getModelsCachePath } from "../../../app/constants";
9
9
 
10
10
  // ─────────────────────────────────────────────────────────────────────────────
11
11
  // Types
@@ -5,11 +5,12 @@
5
5
  * @module src/cli/commands/models/pull
6
6
  */
7
7
 
8
- import { getModelsCachePath } from '../../../app/constants';
9
- import { loadConfig } from '../../../config';
10
- import { ModelCache } from '../../../llm/cache';
11
- import { getActivePreset } from '../../../llm/registry';
12
- import type { DownloadProgress, ModelType } from '../../../llm/types';
8
+ import type { DownloadProgress, ModelType } from "../../../llm/types";
9
+
10
+ import { getModelsCachePath } from "../../../app/constants";
11
+ import { loadConfig } from "../../../config";
12
+ import { ModelCache } from "../../../llm/cache";
13
+ import { getActivePreset } from "../../../llm/registry";
13
14
 
14
15
  // ─────────────────────────────────────────────────────────────────────────────
15
16
  // Types
@@ -19,7 +20,7 @@ export interface ModelsPullOptions {
19
20
  /** Override config path */
20
21
  configPath?: string;
21
22
  /** Override config object (takes precedence over configPath) */
22
- config?: import('../../../config/types').Config;
23
+ config?: import("../../../config/types").Config;
23
24
  /** Pull all models */
24
25
  all?: boolean;
25
26
  /** Pull embedding model */
@@ -58,23 +59,23 @@ export interface ModelsPullResult {
58
59
  */
59
60
  function getTypesToPull(options: ModelsPullOptions): ModelType[] {
60
61
  if (options.all) {
61
- return ['embed', 'rerank', 'gen'];
62
+ return ["embed", "rerank", "gen"];
62
63
  }
63
64
  if (options.embed || options.rerank || options.gen) {
64
65
  const types: ModelType[] = [];
65
66
  if (options.embed) {
66
- types.push('embed');
67
+ types.push("embed");
67
68
  }
68
69
  if (options.rerank) {
69
- types.push('rerank');
70
+ types.push("rerank");
70
71
  }
71
72
  if (options.gen) {
72
- types.push('gen');
73
+ types.push("gen");
73
74
  }
74
75
  return types;
75
76
  }
76
77
  // Default: pull all
77
- return ['embed', 'rerank', 'gen'];
78
+ return ["embed", "rerank", "gen"];
78
79
  }
79
80
 
80
81
  /**
@@ -86,7 +87,7 @@ export async function modelsPull(
86
87
  // Use provided config, or load from disk (use defaults if not initialized)
87
88
  let config = options.config;
88
89
  if (!config) {
89
- const { createDefaultConfig } = await import('../../../config');
90
+ const { createDefaultConfig } = await import("../../../config");
90
91
  const configResult = await loadConfig(options.configPath);
91
92
  config = configResult.ok ? configResult.value : createDefaultConfig();
92
93
  }
@@ -173,15 +174,15 @@ export function formatModelsPull(result: ModelsPullResult): string {
173
174
  }
174
175
 
175
176
  if (result.failed > 0) {
176
- lines.push('');
177
+ lines.push("");
177
178
  lines.push(`${result.failed} model(s) failed to download.`);
178
179
  } else if (result.skipped === result.results.length) {
179
- lines.push('');
180
- lines.push('All models already cached. Use --force to re-download.');
180
+ lines.push("");
181
+ lines.push("All models already cached. Use --force to re-download.");
181
182
  } else {
182
- lines.push('');
183
- lines.push('All models downloaded successfully.');
183
+ lines.push("");
184
+ lines.push("All models downloaded successfully.");
184
185
  }
185
186
 
186
- return lines.join('\n');
187
+ return lines.join("\n");
187
188
  }
@@ -5,9 +5,9 @@
5
5
  * @module src/cli/commands/models/use
6
6
  */
7
7
 
8
- import { createDefaultConfig, loadConfig } from '../../../config';
9
- import { saveConfig } from '../../../config/saver';
10
- import { getPreset, listPresets } from '../../../llm/registry';
8
+ import { createDefaultConfig, loadConfig } from "../../../config";
9
+ import { saveConfig } from "../../../config/saver";
10
+ import { getPreset, listPresets } from "../../../llm/registry";
11
11
 
12
12
  // ─────────────────────────────────────────────────────────────────────────────
13
13
  // Types
@@ -42,7 +42,7 @@ export async function modelsUse(
42
42
  if (!preset) {
43
43
  const available = listPresets(config)
44
44
  .map((p) => p.id)
45
- .join(', ');
45
+ .join(", ");
46
46
  return {
47
47
  success: false,
48
48
  error: `Unknown preset: ${presetId}. Available: ${available}`,