@wirecat/drive-cli 0.14.1 → 0.15.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 (95) hide show
  1. package/README.md +8 -4
  2. package/dist/{catalog-commands.d.ts → commands/catalog.d.ts} +2 -2
  3. package/dist/commands/catalog.d.ts.map +1 -0
  4. package/dist/{catalog-commands.js → commands/catalog.js} +19 -22
  5. package/dist/commands/catalog.js.map +1 -0
  6. package/dist/commands/config.d.ts +5 -0
  7. package/dist/commands/config.d.ts.map +1 -0
  8. package/dist/commands/config.js +81 -0
  9. package/dist/commands/config.js.map +1 -0
  10. package/dist/commands/context.d.ts +38 -0
  11. package/dist/commands/context.d.ts.map +1 -0
  12. package/dist/commands/context.js +14 -0
  13. package/dist/commands/context.js.map +1 -0
  14. package/dist/commands/discovery.d.ts +5 -0
  15. package/dist/commands/discovery.d.ts.map +1 -0
  16. package/dist/commands/discovery.js +27 -0
  17. package/dist/commands/discovery.js.map +1 -0
  18. package/dist/commands/documents.d.ts +10 -0
  19. package/dist/commands/documents.d.ts.map +1 -0
  20. package/dist/commands/documents.js +89 -0
  21. package/dist/commands/documents.js.map +1 -0
  22. package/dist/commands/folders.d.ts +4 -0
  23. package/dist/commands/folders.d.ts.map +1 -0
  24. package/dist/commands/folders.js +44 -0
  25. package/dist/commands/folders.js.map +1 -0
  26. package/dist/{knowledge-commands.d.ts → commands/knowledge.d.ts} +4 -4
  27. package/dist/commands/knowledge.d.ts.map +1 -0
  28. package/dist/{knowledge-commands.js → commands/knowledge.js} +36 -54
  29. package/dist/commands/knowledge.js.map +1 -0
  30. package/dist/commands/mcp.d.ts +4 -0
  31. package/dist/commands/mcp.d.ts.map +1 -0
  32. package/dist/commands/mcp.js +18 -0
  33. package/dist/commands/mcp.js.map +1 -0
  34. package/dist/{remote-commands.d.ts → commands/remote.d.ts} +1 -1
  35. package/dist/commands/remote.d.ts.map +1 -0
  36. package/dist/{remote-commands.js → commands/remote.js} +42 -61
  37. package/dist/commands/remote.js.map +1 -0
  38. package/dist/commands/search.d.ts +4 -0
  39. package/dist/commands/search.d.ts.map +1 -0
  40. package/dist/commands/search.js +20 -0
  41. package/dist/commands/search.js.map +1 -0
  42. package/dist/commands/session.d.ts +4 -0
  43. package/dist/commands/session.d.ts.map +1 -0
  44. package/dist/commands/session.js +59 -0
  45. package/dist/commands/session.js.map +1 -0
  46. package/dist/commands/sync.d.ts +4 -0
  47. package/dist/commands/sync.d.ts.map +1 -0
  48. package/dist/commands/sync.js +50 -0
  49. package/dist/commands/sync.js.map +1 -0
  50. package/dist/config-upgrade.d.ts.map +1 -1
  51. package/dist/config-upgrade.js +10 -7
  52. package/dist/config-upgrade.js.map +1 -1
  53. package/dist/config.d.ts.map +1 -1
  54. package/dist/config.js +48 -11
  55. package/dist/config.js.map +1 -1
  56. package/dist/failure.d.ts.map +1 -1
  57. package/dist/failure.js +12 -1
  58. package/dist/failure.js.map +1 -1
  59. package/dist/google.js +4 -3
  60. package/dist/google.js.map +1 -1
  61. package/dist/mcp.d.ts +1 -1
  62. package/dist/mcp.d.ts.map +1 -1
  63. package/dist/mcp.js +8 -6
  64. package/dist/mcp.js.map +1 -1
  65. package/dist/model.d.ts +10 -1
  66. package/dist/model.d.ts.map +1 -1
  67. package/dist/program.d.ts +2 -19
  68. package/dist/program.d.ts.map +1 -1
  69. package/dist/program.js +66 -437
  70. package/dist/program.js.map +1 -1
  71. package/dist/registry.d.ts +4 -0
  72. package/dist/registry.d.ts.map +1 -1
  73. package/dist/registry.js +3 -0
  74. package/dist/registry.js.map +1 -1
  75. package/dist/state.d.ts.map +1 -1
  76. package/dist/state.js +4 -1
  77. package/dist/state.js.map +1 -1
  78. package/dist/store-transition.d.ts +3 -0
  79. package/dist/store-transition.d.ts.map +1 -0
  80. package/dist/store-transition.js +99 -0
  81. package/dist/store-transition.js.map +1 -0
  82. package/dist/store.d.ts +1 -1
  83. package/dist/store.d.ts.map +1 -1
  84. package/dist/store.js +21 -6
  85. package/dist/store.js.map +1 -1
  86. package/dist/sync.d.ts.map +1 -1
  87. package/dist/sync.js +25 -2
  88. package/dist/sync.js.map +1 -1
  89. package/package.json +2 -2
  90. package/dist/catalog-commands.d.ts.map +0 -1
  91. package/dist/catalog-commands.js.map +0 -1
  92. package/dist/knowledge-commands.d.ts.map +0 -1
  93. package/dist/knowledge-commands.js.map +0 -1
  94. package/dist/remote-commands.d.ts.map +0 -1
  95. package/dist/remote-commands.js.map +0 -1
@@ -1,40 +1,34 @@
1
1
  import { annotate } from "@wirecat/cli-base/commands";
2
2
  import { defineQuery } from "@wirecat/cli-base/query";
3
- import { itemOf, listOf, queryHelp, queryTerms, withQuery } from "@wirecat/cli-core/cli";
3
+ import { itemOf, LOCAL_READ, LOCAL_WRITE, listOf, queryHelp, queryTerms, REMOTE_WRITE, withQuery, } from "@wirecat/cli-core/cli";
4
4
  import { extractDocumentMemories } from "@wirecat/cli-core/documents";
5
5
  import { FACT_TYPES, MEMORY_KINDS } from "@wirecat/cli-core/store";
6
6
  import { Option } from "commander";
7
- import { FACT_QUERY, factItem, MEMORY_QUERY, MEMORY_SEARCH_QUERY, memoryItem, memorySearch } from "./knowledge-query.js";
8
- import { allOf } from "./output.js";
9
- import { examples } from "./registry.js";
7
+ import { FACT_QUERY, factItem, MEMORY_QUERY, MEMORY_SEARCH_QUERY, memoryItem, memorySearch, } from "../knowledge-query.js";
8
+ import { allOf } from "../output.js";
9
+ import { examples } from "../registry.js";
10
10
  export const installKnowledgeCommands = (program, helpers) => {
11
11
  const { run, output, positive } = helpers;
12
12
  const documentArgument = "Google file or folder id or URL in the local catalog";
13
13
  const scopes = ["personal", "work"];
14
14
  const documents = program.commands.find((command) => command.name() === "documents");
15
- examples(documents
16
- .command("context")
15
+ examples(annotate(documents.command("context"), { effects: LOCAL_READ })
17
16
  .argument("<document>", documentArgument)
18
17
  .description("show a document with its tags, relationships, notes, memories and editors"), ["drive personal documents context DOC_ID"]).action(async (doc) => output(itemOf(await run(doc, (k, p, ref) => k.context(p, ref)))));
19
- const tags = program.command("tags").description("label imported documents; labels survive a sync");
18
+ const tags = annotate(program.command("tags"), { effects: LOCAL_READ }).description("label imported documents; labels survive a sync");
20
19
  for (const action of ["list", "add", "remove"]) {
21
- const command = examples(tags
22
- .command(action)
20
+ const command = examples(annotate(tags.command(action), { effects: action === "list" ? LOCAL_READ : LOCAL_WRITE })
23
21
  .description(action === "list" ? "list a document's tags" : action === "add" ? "tag a document" : "untag a document")
24
22
  .argument("<document>", documentArgument), [`drive personal tags ${action} DOC_ID${action === "list" ? "" : " budget q3"}`]);
25
23
  if (action !== "list")
26
24
  command.argument("<tags...>", "one or more tags");
27
25
  command.action(async (doc, values = []) => output(itemOf({ tags: await run(doc, (k, p, ref) => k.tags(p, ref, action, action === "list" ? [] : values)) })));
28
26
  }
29
- const relationships = program
30
- .command("relationships")
31
- .description("connect a document to people, projects, notes and other references");
32
- examples(relationships.command("list").description("list a document's relationships"), [
33
- "drive personal relationships list DOC_ID",
34
- ])
27
+ const relationships = annotate(program.command("relationships"), { effects: LOCAL_READ }).description("connect a document to people, projects, notes and other references");
28
+ examples(annotate(relationships.command("list"), { effects: LOCAL_READ }).description("list a document's relationships"), ["drive personal relationships list DOC_ID"])
35
29
  .argument("<document>", documentArgument)
36
30
  .action(async (doc) => output(allOf(await run(doc, (k, p, ref) => k.links(p, ref)))));
37
- examples(relationships.command("add").description("connect a document to another reference"), [
31
+ examples(annotate(relationships.command("add"), { effects: LOCAL_WRITE }).description("connect a document to another reference"), [
38
32
  "drive personal relationships add DOC_ID project:PROJECT_ID --kind about",
39
33
  "drive personal relationships add DOC_ID person:PERSON_UID --kind assigned-to --role reviewer",
40
34
  ])
@@ -46,22 +40,20 @@ export const installKnowledgeCommands = (program, helpers) => {
46
40
  .option("--role <role>", "the part the reference plays, in a word or two")
47
41
  .option("--reason <text>", "why the two are connected")
48
42
  .action(async (doc, to, { reason, ...args }) => output(itemOf(await run(doc, (k, p, ref) => k.addLink(p, ref, { to, ...args, ...(reason ? { evidence: reason } : {}) })))));
49
- examples(relationships.command("remove").description("remove one of a document's relationships"), [
50
- "drive personal relationships remove DOC_ID LINK_ID",
51
- ])
43
+ examples(annotate(relationships.command("remove"), { effects: LOCAL_WRITE }).description("remove one of a document's relationships"), ["drive personal relationships remove DOC_ID LINK_ID"])
52
44
  .argument("<document>", documentArgument)
53
45
  .argument("<relationship-id>", "id, as relationships list prints it")
54
46
  .action(async (doc, id) => output(itemOf(await run(doc, (k, p, ref) => k.removeLink(p, ref, id)))));
55
- const notes = program.command("notes").description("write notes about an imported document");
47
+ const notes = annotate(program.command("notes"), { effects: LOCAL_READ }).description("write notes about an imported document");
56
48
  const noteArgument = "note:<id> reference, as notes list prints it";
57
- examples(notes.command("add").description("write a note about a document"), [
49
+ examples(annotate(notes.command("add"), { effects: LOCAL_WRITE }).description("write a note about a document"), [
58
50
  `drive personal notes add DOC_ID "Check the numbers" --title Review`,
59
51
  ])
60
52
  .argument("<document>", documentArgument)
61
53
  .argument("<text>", "the note's text")
62
54
  .option("--title <title>", "a title for the note")
63
55
  .action(async (doc, text, args) => output(itemOf(await run(doc, (k, p, ref) => k.addNote(p, ref, text, args.title)))));
64
- examples(notes.command("list").description("list a document's notes"), [
56
+ examples(annotate(notes.command("list"), { effects: LOCAL_READ }).description("list a document's notes"), [
65
57
  "drive personal notes list DOC_ID",
66
58
  "drive personal notes list DOC_ID review --limit 10",
67
59
  ])
@@ -80,11 +72,13 @@ export const installKnowledgeCommands = (program, helpers) => {
80
72
  args: { document: doc, query },
81
73
  }));
82
74
  });
83
- examples(notes.command("show").description("show one note"), ["drive personal notes show DOC_ID note:NOTE_ID"])
75
+ examples(annotate(notes.command("show"), { effects: LOCAL_READ }).description("show one note"), [
76
+ "drive personal notes show DOC_ID note:NOTE_ID",
77
+ ])
84
78
  .argument("<document>", documentArgument)
85
79
  .argument("<note>", noteArgument)
86
80
  .action(async (doc, noteRef) => output(itemOf(await run(doc, (k, p, ref) => k.note(p, ref, noteRef)))));
87
- examples(notes.command("edit").description("replace a note's text"), [
81
+ examples(annotate(notes.command("edit"), { effects: LOCAL_WRITE }).description("replace a note's text"), [
88
82
  `drive personal notes edit DOC_ID note:NOTE_ID "Numbers checked" --revision 2`,
89
83
  ])
90
84
  .argument("<document>", documentArgument)
@@ -92,25 +86,23 @@ export const installKnowledgeCommands = (program, helpers) => {
92
86
  .argument("<text>", "the note's new text")
93
87
  .requiredOption("--revision <n>", "revision from notes show; a newer note is not overwritten", positive)
94
88
  .action(async (doc, noteRef, text, args) => output(itemOf(await run(doc, (k, p, ref) => k.editNote(p, ref, noteRef, text, args.revision)))));
95
- examples(notes.command("remove").description("delete one note"), ["drive personal notes remove DOC_ID note:NOTE_ID"])
89
+ examples(annotate(notes.command("remove"), { effects: LOCAL_WRITE }).description("delete one note"), [
90
+ "drive personal notes remove DOC_ID note:NOTE_ID",
91
+ ])
96
92
  .argument("<document>", documentArgument)
97
93
  .argument("<note>", noteArgument)
98
94
  .action(async (doc, noteRef) => output(itemOf(await run(doc, (k, p, ref) => k.removeNote(p, ref, noteRef)))));
99
- const memories = program
100
- .command("memories")
101
- .description("keep what was learned from a document, with evidence; an agent's stay proposed");
95
+ const memories = annotate(program.command("memories"), { effects: LOCAL_READ }).description("keep what was learned from a document, with evidence; an agent's stay proposed");
102
96
  const memoryArgument = "memory:<id> reference, as memories list prints it";
103
97
  const scope = (description) => new Option("--scope <scope>", description).choices(scopes);
104
- examples(memories.command("add").description("record a memory about a document"), [
105
- `drive personal memories add DOC_ID "The team prefers async reviews" --scope work --kind preference`,
106
- ])
98
+ examples(annotate(memories.command("add"), { effects: LOCAL_WRITE }).description("record a memory about a document"), [`drive personal memories add DOC_ID "The team prefers async reviews" --scope work --kind preference`])
107
99
  .argument("<document>", documentArgument)
108
100
  .argument("<text>", "what to remember")
109
101
  .addOption(scope("whose memory it is: personal or work").makeOptionMandatory())
110
102
  .addOption(new Option("--kind <kind>", "what kind of memory it is").choices(MEMORY_KINDS).default("summary"))
111
103
  .option("--supersedes <ref>", "a memory:<id> about the same document that this one replaces")
112
104
  .action(async (doc, body, args) => output(itemOf(memoryItem(await run(doc, (k, p, ref) => k.addMemory(p, ref, { body, ...args, status: "proposed" }))))));
113
- withQuery(examples(memories.command("list").description("list a document's memories"), [
105
+ withQuery(examples(annotate(memories.command("list"), { effects: LOCAL_READ }).description("list a document's memories"), [
114
106
  "drive personal memories list DOC_ID scope:work",
115
107
  "drive personal memories list DOC_ID kind:preference status:confirmed",
116
108
  ]).argument("<document>", documentArgument), MEMORY_QUERY)
@@ -130,13 +122,11 @@ export const installKnowledgeCommands = (program, helpers) => {
130
122
  stale: "mark a memory as out of date",
131
123
  };
132
124
  for (const [action, description] of Object.entries(memoryActions))
133
- examples(memories.command(action).description(description), [
134
- `drive personal memories ${action} DOC_ID memory:MEMORY_ID`,
135
- ])
125
+ examples(annotate(memories.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`drive personal memories ${action} DOC_ID memory:MEMORY_ID`])
136
126
  .argument("<document>", documentArgument)
137
127
  .argument("<memory>", memoryArgument)
138
128
  .action(async (doc, memoryRef) => output(itemOf(memoryItem(await run(doc, (k, p, ref) => k.memory(p, ref, memoryRef, action))))));
139
- const search = examples(memories.command("search").description("search a document's memories by words"), [
129
+ const search = examples(annotate(memories.command("search"), { effects: LOCAL_READ }).description("search a document's memories by words"), [
140
130
  "drive personal memories search DOC_ID reviews scope:work",
141
131
  `drive personal memories search DOC_ID "async reviews"`,
142
132
  ])
@@ -153,8 +143,7 @@ export const installKnowledgeCommands = (program, helpers) => {
153
143
  });
154
144
  });
155
145
  annotate(search, { query: defineQuery(MEMORY_SEARCH_QUERY), output: { entity: "memory" } });
156
- examples(memories
157
- .command("extract")
146
+ examples(annotate(memories.command("extract"), { effects: REMOTE_WRITE })
158
147
  .argument("<document>", documentArgument)
159
148
  .description("send a document's text to the model and show the memories it proposes"), [
160
149
  "drive personal memories extract DOC_ID --scope work",
@@ -166,6 +155,7 @@ export const installKnowledgeCommands = (program, helpers) => {
166
155
  .action(async function (doc) {
167
156
  // The root --yes takes the flag wherever it is typed; this one only lists it for help and MCP.
168
157
  const args = this.optsWithGlobals();
158
+ await run(doc, async () => undefined);
169
159
  const result = await extractDocumentMemories({
170
160
  read: () => helpers.document(doc),
171
161
  complete: helpers.complete(),
@@ -177,11 +167,9 @@ export const installKnowledgeCommands = (program, helpers) => {
177
167
  });
178
168
  output(itemOf({ ...result, saved: result.saved.map((item) => ("type" in item ? factItem(item) : memoryItem(item))) }));
179
169
  });
180
- const facts = program
181
- .command("facts")
182
- .description("what happened, as a document shows it; an agent's stay proposed until confirmed");
170
+ const facts = annotate(program.command("facts"), { effects: LOCAL_READ }).description("what happened, as a document shows it; an agent's stay proposed until confirmed");
183
171
  const factArgument = "fact:<id> reference, as facts list prints it";
184
- examples(facts.command("add").description("record a fact a document shows"), [
172
+ examples(annotate(facts.command("add"), { effects: LOCAL_WRITE }).description("record a fact a document shows"), [
185
173
  `drive personal facts add DOC_ID "Budget approved" --type decision --scope work`,
186
174
  ])
187
175
  .argument("<document>", documentArgument)
@@ -195,7 +183,7 @@ export const installKnowledgeCommands = (program, helpers) => {
195
183
  ...args,
196
184
  ...(occurredTime === undefined ? {} : { occurredAt: occurredTime }),
197
185
  }))))));
198
- withQuery(examples(facts.command("list").description("list a document's facts"), [
186
+ withQuery(examples(annotate(facts.command("list"), { effects: LOCAL_READ }).description("list a document's facts"), [
199
187
  "drive personal facts list DOC_ID status:proposed",
200
188
  "drive personal facts list DOC_ID kind:decision",
201
189
  ]).argument("<document>", documentArgument), FACT_QUERY)
@@ -214,24 +202,18 @@ export const installKnowledgeCommands = (program, helpers) => {
214
202
  reverse: "an accepted decision no longer holds, and nothing replaced it",
215
203
  };
216
204
  for (const [action, description] of Object.entries(factActions))
217
- examples(facts.command(action).description(description), [`drive personal facts ${action} DOC_ID fact:FACT_ID`])
205
+ examples(annotate(facts.command(action), { effects: action === "show" ? LOCAL_READ : LOCAL_WRITE }).description(description), [`drive personal facts ${action} DOC_ID fact:FACT_ID`])
218
206
  .argument("<document>", documentArgument)
219
207
  .argument("<fact>", factArgument)
220
208
  .action(async (doc, factRef) => output(itemOf(factItem(await run(doc, (k, p, ref) => k.fact(p, ref, factRef, action))))));
221
- const identities = program
222
- .command("identities")
223
- .description("the Google accounts seen on a document, and the people they belong to");
224
- examples(identities.command("list").description("list the owners and last editor Google shows for a document"), [
225
- "drive personal identities list DOC_ID",
226
- ])
209
+ const identities = annotate(program.command("identities"), { effects: LOCAL_READ }).description("the Google accounts seen on a document, and the people they belong to");
210
+ examples(annotate(identities.command("list"), { effects: LOCAL_READ }).description("list the owners and last editor Google shows for a document"), ["drive personal identities list DOC_ID"])
227
211
  .argument("<document>", documentArgument)
228
212
  .action(async (doc) => output(itemOf(await run(doc, (k, p, ref) => k.people(p, ref)))));
229
- examples(identities.command("link").description("record that a Google account belongs to a known person"), [
230
- "drive personal identities link DOC_ID GOOGLE_ID person:PERSON_UID",
231
- ])
213
+ examples(annotate(identities.command("link"), { effects: LOCAL_WRITE }).description("record that a Google account belongs to a known person"), ["drive personal identities link DOC_ID GOOGLE_ID person:PERSON_UID"])
232
214
  .argument("<document>", documentArgument)
233
215
  .argument("<google-id>", "Google account id, as identities list prints it")
234
216
  .argument("<person>", "person:<uid> reference of someone already known")
235
217
  .action(async (doc, googleId, personRef) => output(itemOf(await run(doc, (k, p, ref) => k.linkPerson(p, ref, googleId, personRef)))));
236
218
  };
237
- //# sourceMappingURL=knowledge-commands.js.map
219
+ //# sourceMappingURL=knowledge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge.js","sourceRoot":"","sources":["../../src/commands/knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAEL,MAAM,EACN,UAAU,EACV,WAAW,EACX,MAAM,E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AAE,CACjE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CACzF,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { CommandContext, ProgramOptions } from "./context.js";
3
+ export declare const installMcpCommand: (program: Command, { env, options, selected, output, policyFlags, signal }: CommandContext, createProgram: (options: ProgramOptions) => Command) => void;
4
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElE,eAAO,MAAM,iBAAiB,YACnB,OAAO,2DACyC,cAAc,iBACxD,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,SA6BpD,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { annotate } from "@wirecat/cli-base/commands";
2
+ import { LOCAL_READ } from "@wirecat/cli-core/cli";
3
+ import { allOf } from "../output.js";
4
+ import { examples } from "../registry.js";
5
+ export const installMcpCommand = (program, { env, options, selected, output, policyFlags, signal }, createProgram) => {
6
+ examples(annotate(program.command("mcp"), { effects: LOCAL_READ }).description("serve drive's commands to an agent over MCP on stdio"), ["drive personal mcp", "drive personal mcp --tools"])
7
+ .option("--tools", "list the tools offered instead of starting the server")
8
+ .action(async (args) => {
9
+ const { mcpTools, serveMcp } = await import("../mcp.js");
10
+ if (args.tools)
11
+ output(allOf(mcpTools(createProgram, { ...options, env }, selected(), policyFlags()).map(({ name, schema, command }) => ({ name, input_schema: schema, effects: command.effects }))));
12
+ else {
13
+ const active = signal();
14
+ await serveMcp(createProgram, { ...options, env, ...(active ? { signal: active } : {}) }, selected(), policyFlags());
15
+ }
16
+ });
17
+ };
18
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAgB,EAChB,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAkB,EACvE,aAAmD,EACnD,EAAE;IACF,QAAQ,CACN,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,WAAW,CACnE,sDAAsD,CACvD,EACD,CAAC,oBAAoB,EAAE,4BAA4B,CAAC,CACrD;SACE,MAAM,CAAC,SAAS,EAAE,uDAAuD,CAAC;SAC1E,MAAM,CAAC,KAAK,EAAE,IAAyB,EAAE,EAAE;QAC1C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,KAAK;YACZ,MAAM,CACJ,KAAK,CACH,QAAQ,CAAC,aAAa,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,GAAG,CACzE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAC1F,CACF,CACF,CAAA;aACE,CAAC;YACJ,MAAM,MAAM,GAAG,MAAM,EAAE,CAAA;YACvB,MAAM,QAAQ,CACZ,aAAa,EACb,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAC1D,QAAQ,EAAE,EACV,WAAW,EAAE,CACd,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -12,4 +12,4 @@ export interface RemoteCommands {
12
12
  }): Promise<unknown>;
13
13
  }
14
14
  export declare const installRemoteCommands: (program: Command, helpers: RemoteCommands) => void;
15
- //# sourceMappingURL=remote-commands.d.ts.map
15
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/commands/remote.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,IAAI,EAcV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAcxC,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAKhE,CAAA;AAuBD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACvG,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAA;IAC5C,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACpF;AACD,eAAO,MAAM,qBAAqB,YAAa,OAAO,WAAW,cAAc,SAwV9E,CAAA"}
@@ -1,11 +1,12 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
- import { apiPlainJson, checkApiBody, checkApiParameter, generatedApiCommand, itemOf, listOf, parseApiJson, queryTerms, readApiBody, termField, withQuery, } from "@wirecat/cli-core/cli";
3
- import { operationOf, operations, schemas, validateRequest } from "./api-contract.js";
4
- import { fileId } from "./config.js";
5
- import { apiMethod, apiMethods, validateApiParams } from "./google-api.js";
6
- import { allOf } from "./output.js";
7
- import { examples } from "./registry.js";
8
- import { requestSchema } from "./schema.js";
2
+ import { annotate } from "@wirecat/cli-base/commands";
3
+ import { apiPlainJson, checkApiBody, checkApiParameter, generatedApiCommand, itemOf, LOCAL_READ, listOf, NO_EFFECTS, parseApiJson, queryTerms, readApiBody, termField, withQuery, } from "@wirecat/cli-core/cli";
4
+ import { operationOf, operations, schemas } from "../api-contract.js";
5
+ import { fileId } from "../config.js";
6
+ import { apiMethods, validateApiParams } from "../google-api.js";
7
+ import { allOf } from "../output.js";
8
+ import { examples, GOOGLE_READ, GOOGLE_WRITE } from "../registry.js";
9
+ import { requestSchema } from "../schema.js";
9
10
  const API_METHOD_QUERY = {
10
11
  entity: "api_method",
11
12
  backend: "native",
@@ -39,17 +40,12 @@ export const installRemoteCommands = (program, helpers) => {
39
40
  .option("--limit <n>", "how many items one page holds", positive, 100)
40
41
  .option("--cursor <cursor>", "continue from page.next_cursor of the previous answer");
41
42
  const fileArgument = "file id or Google Drive URL";
42
- const api = program.command("api").description("discover and call the official Drive, Docs and Activity API methods");
43
- withQuery(examples(api.command("list").description("list the Google API methods drive can call"), [
44
- "drive api list",
45
- "drive api list service:docs",
46
- ]), API_METHOD_QUERY).action((words) => output(allOf(apiMethods(queryTerms(words, API_METHOD_QUERY, "api list").get("service")))));
47
- examples(api
48
- .command("show")
43
+ const api = annotate(program.command("api"), { effects: LOCAL_READ }).description("discover and call the official Drive, Docs and Activity API methods");
44
+ withQuery(examples(annotate(api.command("list"), { effects: NO_EFFECTS }).description("list the Google API methods drive can call"), ["drive api list", "drive api list service:docs"]), API_METHOD_QUERY).action((words) => output(allOf(apiMethods(queryTerms(words, API_METHOD_QUERY, "api list").get("service")))));
45
+ examples(annotate(api.command("show"), { effects: NO_EFFECTS })
49
46
  .description("show one method's request schema and contract, without calling Google")
50
47
  .argument("<method>", "Google method name, as api list prints it"), ["drive api show docs.documents.batchUpdate --json"]).action((method) => output(itemOf({ operation: operationOf(method), request_schema: requestSchema(method) })));
51
- examples(api
52
- .command("call")
48
+ examples(annotate(api.command("call"), { effects: GOOGLE_WRITE })
53
49
  .description("call one Google API method by name with JSON parameters")
54
50
  .argument("<method>", "Google method name, as api list prints it"), [
55
51
  `drive personal api call drive.files.get --params '{"fileId":"FILE_ID"}'`,
@@ -60,17 +56,7 @@ export const installRemoteCommands = (program, helpers) => {
60
56
  .option("--allow-writes", "allow a method that changes Google data")
61
57
  .option("--allow-delete", "allow a method that deletes for good or empties the trash")
62
58
  .action(async (name, args) => {
63
- const method = apiMethod(name);
64
59
  validateApiParams(args.params);
65
- if (method.mutates && !args.allowWrites)
66
- throw new CliError("permission_error", "this method changes Google data; pass --allow-writes", {
67
- reason: "write.not-allowed",
68
- });
69
- if (method.destructive && !args.allowDelete)
70
- throw new CliError("permission_error", "this method permanently deletes Google data; pass --allow-delete", {
71
- reason: "delete.not-allowed",
72
- });
73
- validateRequest(name, args.params, args.body);
74
60
  output(itemOf(await call(name, args.params, args.body)));
75
61
  });
76
62
  const generated = generatedApiCommand({
@@ -82,11 +68,8 @@ export const installRemoteCommands = (program, helpers) => {
82
68
  });
83
69
  for (const child of generated.commands)
84
70
  api.addCommand(child);
85
- const files = program.command("files").description("read and change files in Google Drive; nothing is imported");
86
- page(examples(files.command("list").description("list files in Google Drive, one page at a time"), [
87
- "drive personal files list --parent FOLDER_ID",
88
- `drive personal files list "name contains 'plan'" --limit 20`,
89
- ]))
71
+ const files = annotate(program.command("files"), { effects: GOOGLE_READ }).description("read and change files in Google Drive; nothing is imported");
72
+ page(examples(annotate(files.command("list"), { effects: GOOGLE_READ }).description("list files in Google Drive, one page at a time"), ["drive personal files list --parent FOLDER_ID", `drive personal files list "name contains 'plan'" --limit 20`]))
90
73
  .argument("[query...]", "Google Drive query the files match; trashed = false when omitted")
91
74
  .option("--parent <id>", "only the files directly inside this folder id")
92
75
  .action(async (words, args) => {
@@ -100,19 +83,21 @@ export const installRemoteCommands = (program, helpers) => {
100
83
  fields: "nextPageToken,incompleteSearch,files(*)",
101
84
  }), "files", args.limit, { query, parent: args.parent }));
102
85
  });
103
- examples(files.command("get").description("show one file's Google Drive metadata").argument("<file>", fileArgument), [
104
- "drive personal files get FILE_ID",
105
- ]).action(async (id) => output(itemOf(await call("drive.files.get", { fileId: fileId(id), fields: "*", supportsAllDrives: true }))));
106
- examples(files.command("copy").description("copy a file in Google Drive").argument("<file>", fileArgument), [
107
- `drive personal files copy FILE_ID --name "Plan copy" --parent FOLDER_ID`,
108
- ])
86
+ examples(annotate(files.command("get"), { effects: GOOGLE_READ })
87
+ .description("show one file's Google Drive metadata")
88
+ .argument("<file>", fileArgument), ["drive personal files get FILE_ID"]).action(async (id) => output(itemOf(await call("drive.files.get", { fileId: fileId(id), fields: "*", supportsAllDrives: true }))));
89
+ examples(annotate(files.command("copy"), { effects: GOOGLE_WRITE })
90
+ .description("copy a file in Google Drive")
91
+ .argument("<file>", fileArgument), [`drive personal files copy FILE_ID --name "Plan copy" --parent FOLDER_ID`])
109
92
  .option("--name <name>", "name of the copy; Google's default when omitted")
110
93
  .option("--parent <id>", "folder id to put the copy in")
111
94
  .action(async (id, args) => output(itemOf(await call("drive.files.copy", { fileId: fileId(id), supportsAllDrives: true }, {
112
95
  ...(args.name ? { name: args.name } : {}),
113
96
  ...(args.parent ? { parents: [fileId(args.parent)] } : {}),
114
97
  }))));
115
- examples(files.command("move").description("move a file to another Google Drive folder").argument("<file>", fileArgument), ["drive personal files move FILE_ID --parent NEW_FOLDER_ID --old-parent OLD_FOLDER_ID"])
98
+ examples(annotate(files.command("move"), { effects: GOOGLE_WRITE })
99
+ .description("move a file to another Google Drive folder")
100
+ .argument("<file>", fileArgument), ["drive personal files move FILE_ID --parent NEW_FOLDER_ID --old-parent OLD_FOLDER_ID"])
116
101
  .requiredOption("--parent <id>", "folder id to move the file into")
117
102
  .option("--old-parent <id>", "folder id to take the file out of")
118
103
  .action(async (id, args) => output(itemOf(await call("drive.files.update", {
@@ -121,23 +106,25 @@ export const installRemoteCommands = (program, helpers) => {
121
106
  ...(args.oldParent ? { removeParents: fileId(args.oldParent) } : {}),
122
107
  supportsAllDrives: true,
123
108
  }, {}))));
124
- examples(files.command("update").description("change a file's Google Drive metadata").argument("<file>", fileArgument), [`drive personal files update FILE_ID --body '{"name":"Renamed"}'`])
109
+ examples(annotate(files.command("update"), { effects: GOOGLE_WRITE })
110
+ .description("change a file's Google Drive metadata")
111
+ .argument("<file>", fileArgument), [`drive personal files update FILE_ID --body '{"name":"Renamed"}'`])
125
112
  .requiredOption("--body <json>", "the metadata fields to change, as a JSON object", jsonObject)
126
113
  .action(async (id, args) => output(itemOf(await call("drive.files.update", { fileId: fileId(id), supportsAllDrives: true }, args.body))));
127
114
  for (const name of ["trash", "restore"])
128
- examples(files
129
- .command(name)
115
+ examples(annotate(files.command(name), { effects: GOOGLE_WRITE })
130
116
  .description(name === "trash" ? "move a file to the Google Drive trash" : "take a file out of the trash")
131
117
  .argument("<file>", fileArgument), [`drive personal files ${name} FILE_ID`]).action(async (id) => output(itemOf(await call("drive.files.update", { fileId: fileId(id), supportsAllDrives: true }, { trashed: name === "trash" }))));
132
- examples(files.command("mkdir").description("create an empty folder in Google Drive").argument("<name>", "folder name"), ["drive personal files mkdir Reports --parent FOLDER_ID"])
118
+ examples(annotate(files.command("mkdir"), { effects: GOOGLE_WRITE })
119
+ .description("create an empty folder in Google Drive")
120
+ .argument("<name>", "folder name"), ["drive personal files mkdir Reports --parent FOLDER_ID"])
133
121
  .option("--parent <id>", "folder id to create it in; My Drive when omitted")
134
122
  .action(async (name, args) => output(itemOf(await call("drive.files.create", { supportsAllDrives: true }, {
135
123
  name,
136
124
  mimeType: "application/vnd.google-apps.folder",
137
125
  ...(args.parent ? { parents: [fileId(args.parent)] } : {}),
138
126
  }))));
139
- examples(files
140
- .command("upload")
127
+ examples(annotate(files.command("upload"), { effects: GOOGLE_WRITE })
141
128
  .description("upload a local file to Google Drive; an interrupted upload resumes")
142
129
  .argument("<path>", "local file to upload"), ["drive personal files upload ./backup.db.zst --parent FOLDER_ID"])
143
130
  .option("--parent <id>", "folder id to put it in; My Drive when omitted")
@@ -148,23 +135,20 @@ export const installRemoteCommands = (program, helpers) => {
148
135
  }))));
149
136
  const documents = program.commands.find((command) => command.name() === "documents");
150
137
  const documentArgument = "document id or Google Docs URL";
151
- examples(documents
152
- .command("get")
138
+ examples(annotate(documents.command("get"), { effects: GOOGLE_READ })
153
139
  .argument("<document>", documentArgument)
154
140
  .description("read a document live from Google Docs, as JSON with every tab"), ["drive personal documents get DOC_ID --json"]).action(async (id) => output(itemOf(await call("docs.documents.get", { documentId: fileId(id), includeTabsContent: true }))));
155
- examples(documents.command("create").description("create an empty Google Doc"), [
141
+ examples(annotate(documents.command("create"), { effects: GOOGLE_WRITE }).description("create an empty Google Doc"), [
156
142
  `drive personal documents create --title "Meeting notes"`,
157
143
  ])
158
144
  .requiredOption("--title <title>", "title of the new document")
159
145
  .action(async (args) => output(itemOf(await call("docs.documents.create", {}, { title: args.title }))));
160
- examples(documents
161
- .command("update")
146
+ examples(annotate(documents.command("update"), { effects: GOOGLE_WRITE })
162
147
  .description("change a Google Doc with a Docs batchUpdate request")
163
148
  .argument("<document>", documentArgument), [`drive personal documents update DOC_ID --body '{"requests":[]}'`])
164
149
  .requiredOption("--body <json>", "Docs batchUpdate body: requests and an optional writeControl", jsonObject)
165
150
  .action(async (id, args) => output(itemOf(await call("docs.documents.batchUpdate", { documentId: fileId(id) }, args.body))));
166
- page(examples(documents
167
- .command("history")
151
+ page(examples(annotate(documents.command("history"), { effects: GOOGLE_READ })
168
152
  .description("list the revisions Google kept, or who did what with --activity")
169
153
  .argument("<document>", documentArgument), ["drive personal documents history DOC_ID", "drive personal documents history DOC_ID --activity"]))
170
154
  .option("--activity", "list activity events instead of revisions; needs session start --grant activity")
@@ -189,18 +173,17 @@ export const installRemoteCommands = (program, helpers) => {
189
173
  });
190
174
  for (const resource of ["comments", "permissions", "revisions"]) {
191
175
  const one = resource.slice(0, -1);
192
- const group = program.command(resource).description(`read the ${resource} of a file in Google Drive`);
193
- page(examples(group.command("list").description(`list a file's ${resource}`).argument("<file>", fileArgument), [
194
- `drive personal ${resource} list FILE_ID`,
195
- ])).action(async (id, args) => output(pageOf(`${resource} list`, await call(`drive.${resource}.list`, {
176
+ const group = annotate(program.command(resource), { effects: GOOGLE_READ }).description(`read the ${resource} of a file in Google Drive`);
177
+ page(examples(annotate(group.command("list"), { effects: GOOGLE_READ })
178
+ .description(`list a file's ${resource}`)
179
+ .argument("<file>", fileArgument), [`drive personal ${resource} list FILE_ID`])).action(async (id, args) => output(pageOf(`${resource} list`, await call(`drive.${resource}.list`, {
196
180
  fileId: fileId(id),
197
181
  pageSize: args.limit,
198
182
  ...(args.cursor ? { pageToken: args.cursor } : {}),
199
183
  fields: "*",
200
184
  ...(resource === "permissions" ? { supportsAllDrives: true } : {}),
201
185
  }), resource, args.limit, { file: id })));
202
- examples(group
203
- .command("get")
186
+ examples(annotate(group.command("get"), { effects: GOOGLE_READ })
204
187
  .description(`show one ${one} of a file`)
205
188
  .argument("<file>", fileArgument)
206
189
  .argument(`<${one}-id>`, `${one} id, as ${resource} list prints it`), [`drive personal ${resource} get FILE_ID ${one.toUpperCase()}_ID`]).action(async (file, id) => output(itemOf(await call(`drive.${resource}.get`, {
@@ -210,12 +193,10 @@ export const installRemoteCommands = (program, helpers) => {
210
193
  ...(resource === "permissions" ? { supportsAllDrives: true } : {}),
211
194
  }))));
212
195
  }
213
- page(examples(program.command("shared-drives").description("list the shared drives this account can open"), [
214
- "drive personal shared-drives",
215
- ])).action(async (args) => output(pageOf("shared-drives", await call("drive.drives.list", {
196
+ page(examples(annotate(program.command("shared-drives"), { effects: GOOGLE_READ }).description("list the shared drives this account can open"), ["drive personal shared-drives"])).action(async (args) => output(pageOf("shared-drives", await call("drive.drives.list", {
216
197
  pageSize: args.limit,
217
198
  ...(args.cursor ? { pageToken: args.cursor } : {}),
218
199
  fields: "*",
219
200
  }), "drives", args.limit, {})));
220
201
  };
221
- //# sourceMappingURL=remote-commands.js.map
202
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/commands/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EACL,YAAY,EAEZ,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EAEN,UAAU,EACV,MAAM,EACN,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,GACV,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,C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X,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnE,CAAC,CACH,CACF,CACF,CAAA;IACH,CAAC;IACD,IAAI,CACF,QAAQ,CACN,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,CAC9E,8CAA8C,CAC/C,EACD,CAAC,8BAA8B,CAAC,CACjC,CACF,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CACtB,MAAM,CACJ,MAAM,CACJ,eAAe,EACf,MAAM,IAAI,CAAC,mBAAmB,EAAE;QAC9B,QAAQ,EAAE,IAAI,CAAC,KAAK;QACpB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,MAAM,EAAE,GAAG;KACZ,CAAC,EACF,QAAQ,EACR,IAAI,CAAC,KAAK,EACV,EAAE,CACH,CACF,CACF,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import { type CommandContext } from "./context.js";
3
+ export declare const installSearchCommand: (program: Command, { env, selected, output, withIndex }: CommandContext) => void;
4
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,cAAc,CAAA;AAE5D,eAAO,MAAM,oBAAoB,YAAa,OAAO,wCAAwC,cAAc,SAwB1G,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { annotate } from "@wirecat/cli-base/commands";
2
+ import { itemOf, LOCAL_READ } from "@wirecat/cli-core/cli";
3
+ import { activeProfile, pictureSearch } from "../config.js";
4
+ import { examples } from "../registry.js";
5
+ import { positive } from "./context.js";
6
+ export const installSearchCommand = (program, { env, selected, output, withIndex }) => {
7
+ examples(annotate(program.command("search"), { effects: LOCAL_READ })
8
+ .argument("<query>", "words to look for")
9
+ .description("search imported documents by words, and by meaning when indexed"), ["drive personal search budget", `drive personal search "quarterly plan" --exact --limit 5`])
10
+ .option("--limit <n>", "how many results to return", positive, 20)
11
+ .option("--page <n>", "which page to return", positive, 1)
12
+ .option("--exact", "match the words exactly: no word forms, no meaning")
13
+ .action(async (query, { page, ...args }) => output(itemOf(await withIndex((index) => index.search(activeProfile(env, selected()).principal, query, {
14
+ ...args,
15
+ offset: (page - 1) * args.limit,
16
+ exact: args.exact ?? false,
17
+ ...(pictureSearch(env, selected()) ? { pictures: true } : {}),
18
+ })))));
19
+ };
20
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAuB,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAkB,EAAE,EAAE;IAC7G,QAAQ,CACN,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;SACzD,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;SACxC,WAAW,CAAC,iEAAiE,CAAC,EACjF,CAAC,8BAA8B,EAAE,0DAA0D,CAAC,CAC7F;SACE,MAAM,CAAC,aAAa,EAAE,4BAA4B,EAAE,QAAQ,EAAE,EAAE,CAAC;SACjE,MAAM,CAAC,YAAY,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC,CAAC;SACzD,MAAM,CAAC,SAAS,EAAE,oDAAoD,CAAC;SACvE,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,EAAoD,EAAE,EAAE,CACnG,MAAM,CACJ,MAAM,CACJ,MAAM,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE;QAC5D,GAAG,IAAI;QACP,MAAM,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK;QAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,KAAK;QAC1B,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D,CAAC,CACH,CACF,CACF,CACF,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { CommandContext } from "./context.js";
3
+ export declare const installSessionCommands: (program: Command, context: CommandContext) => void;
4
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAYlD,eAAO,MAAM,sBAAsB,YAAa,OAAO,WAAW,cAAc,SA2E/E,CAAA"}