@wirecat/yandex-disk-cli 0.0.0-stage → 0.1.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 (235) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +204 -0
  3. package/README.md +243 -2
  4. package/contracts/wirecat.json +1554 -0
  5. package/dist/bin/ydisk.d.ts +3 -0
  6. package/dist/bin/ydisk.d.ts.map +1 -0
  7. package/dist/bin/ydisk.js +40 -0
  8. package/dist/bin/ydisk.js.map +1 -0
  9. package/dist/bundle/all-profiles-4OLZF3RT.js +279 -0
  10. package/dist/bundle/anthropic-DKB4OJXZ.js +91 -0
  11. package/dist/bundle/app-server-G4545SSV.js +247 -0
  12. package/dist/bundle/bun-RXEQKFED.js +169 -0
  13. package/dist/bundle/bun-sqlite-VHT5LN7U.js +76 -0
  14. package/dist/bundle/chunk-2BITUXGC.js +12289 -0
  15. package/dist/bundle/chunk-2CLWDQKA.js +39330 -0
  16. package/dist/bundle/chunk-2JFDOPKA.js +9575 -0
  17. package/dist/bundle/chunk-3GVI2MAO.js +106 -0
  18. package/dist/bundle/chunk-3SZBWBMI.js +131 -0
  19. package/dist/bundle/chunk-44VSEXW6.js +4054 -0
  20. package/dist/bundle/chunk-4YPRRQBE.js +95 -0
  21. package/dist/bundle/chunk-5COYRL5B.js +379 -0
  22. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  23. package/dist/bundle/chunk-5DM7DIZL.js +1402 -0
  24. package/dist/bundle/chunk-6R2DVTVZ.js +24 -0
  25. package/dist/bundle/chunk-762BS35H.js +2787 -0
  26. package/dist/bundle/chunk-AG64V7AB.js +1233 -0
  27. package/dist/bundle/chunk-BC5HGIXB.js +334 -0
  28. package/dist/bundle/chunk-BH7LFEX7.js +36 -0
  29. package/dist/bundle/chunk-BLNPGY7N.js +53 -0
  30. package/dist/bundle/chunk-CNIA2LJF.js +372 -0
  31. package/dist/bundle/chunk-COSXMDC7.js +230 -0
  32. package/dist/bundle/chunk-D72URWJE.js +532 -0
  33. package/dist/bundle/chunk-D7FO33KU.js +785 -0
  34. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  35. package/dist/bundle/chunk-DJH26PQ3.js +1396 -0
  36. package/dist/bundle/chunk-DJPT7IUC.js +64567 -0
  37. package/dist/bundle/chunk-DTMSCZDW.js +209 -0
  38. package/dist/bundle/chunk-E6LGZ5LX.js +16 -0
  39. package/dist/bundle/chunk-E6YRIHS5.js +92 -0
  40. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  41. package/dist/bundle/chunk-F3DDSZTF.js +78 -0
  42. package/dist/bundle/chunk-F4WWTQNL.js +188 -0
  43. package/dist/bundle/chunk-FDDAUASC.js +1028 -0
  44. package/dist/bundle/chunk-FMNPG6N2.js +170 -0
  45. package/dist/bundle/chunk-FOKJ4POB.js +274 -0
  46. package/dist/bundle/chunk-G22C7JG6.js +731 -0
  47. package/dist/bundle/chunk-GA442SYZ.js +161 -0
  48. package/dist/bundle/chunk-GEBSW7UK.js +6848 -0
  49. package/dist/bundle/chunk-GGRKWAOK.js +594 -0
  50. package/dist/bundle/chunk-HHINRNZA.js +788 -0
  51. package/dist/bundle/chunk-HUZCL33L.js +128 -0
  52. package/dist/bundle/chunk-IALSIQVT.js +142 -0
  53. package/dist/bundle/chunk-IOXR2QBX.js +398 -0
  54. package/dist/bundle/chunk-J5CXR6VX.js +63 -0
  55. package/dist/bundle/chunk-J5PWSTOX.js +82 -0
  56. package/dist/bundle/chunk-J7BVAEHR.js +364 -0
  57. package/dist/bundle/chunk-JH46HMZW.js +1334 -0
  58. package/dist/bundle/chunk-JOBO7F6W.js +52 -0
  59. package/dist/bundle/chunk-JXZ5B3L5.js +2333 -0
  60. package/dist/bundle/chunk-KBIAMDZN.js +66 -0
  61. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  62. package/dist/bundle/chunk-LNHTLSR5.js +288 -0
  63. package/dist/bundle/chunk-M24RAKMJ.js +58 -0
  64. package/dist/bundle/chunk-MDQ57Q3H.js +1197 -0
  65. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  66. package/dist/bundle/chunk-MLXQ4X5L.js +206 -0
  67. package/dist/bundle/chunk-NQAKARHE.js +54 -0
  68. package/dist/bundle/chunk-OF7VVUDQ.js +23 -0
  69. package/dist/bundle/chunk-OQVPE3XK.js +324 -0
  70. package/dist/bundle/chunk-OR3QG7UR.js +259 -0
  71. package/dist/bundle/chunk-OUUYVROP.js +76 -0
  72. package/dist/bundle/chunk-PQBAM64O.js +168 -0
  73. package/dist/bundle/chunk-PYVIA7WF.js +88 -0
  74. package/dist/bundle/chunk-Q6HK3PHE.js +72 -0
  75. package/dist/bundle/chunk-QB3KECV2.js +218 -0
  76. package/dist/bundle/chunk-QGWXSFYN.js +73 -0
  77. package/dist/bundle/chunk-RC5QAAAE.js +29 -0
  78. package/dist/bundle/chunk-RMJ26HLB.js +18 -0
  79. package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
  80. package/dist/bundle/chunk-T7ZUDA4C.js +72 -0
  81. package/dist/bundle/chunk-TRCSMVV5.js +72 -0
  82. package/dist/bundle/chunk-UD2BQEKA.js +46 -0
  83. package/dist/bundle/chunk-V4TL55GS.js +1068 -0
  84. package/dist/bundle/chunk-VJNWN5VU.js +4072 -0
  85. package/dist/bundle/chunk-VRRNBLMA.js +1227 -0
  86. package/dist/bundle/chunk-WUCMMNFJ.js +771 -0
  87. package/dist/bundle/chunk-XDESE3NY.js +44 -0
  88. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  89. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  90. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  91. package/dist/bundle/chunk-Z2QEON7B.js +2275 -0
  92. package/dist/bundle/chunk-ZMJ56GME.js +7 -0
  93. package/dist/bundle/chunk-ZTSB3D7Q.js +100 -0
  94. package/dist/bundle/chunk-ZVJWD3FK.js +38 -0
  95. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  96. package/dist/bundle/command-contract-YIOYGPJA.js +40 -0
  97. package/dist/bundle/command-server-entry-MHBQDXS4.js +169 -0
  98. package/dist/bundle/decode-NUGJIOUW.js +297 -0
  99. package/dist/bundle/definitions-AILHKEQT.js +2005 -0
  100. package/dist/bundle/dispatch-5LC4UEGY.js +411 -0
  101. package/dist/bundle/dist-4I2W6X2I.js +7577 -0
  102. package/dist/bundle/echarts-MHSH6PGC.js +42501 -0
  103. package/dist/bundle/embed-ZDXTHHYS.js +38 -0
  104. package/dist/bundle/embedder-XFEELFUL.js +111 -0
  105. package/dist/bundle/failure-5S7VPBYK.js +25 -0
  106. package/dist/bundle/first-run-JHCHT3RJ.js +29 -0
  107. package/dist/bundle/first-screen-FHGQ6QRV.js +40 -0
  108. package/dist/bundle/instructions-WKSMBUFX.js +11 -0
  109. package/dist/bundle/mcp-HS2ZDUVR.js +167 -0
  110. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  111. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  112. package/dist/bundle/meeting-combined-K4U4NYRZ.js +25 -0
  113. package/dist/bundle/meeting-model-KCEG6Y5O.js +26 -0
  114. package/dist/bundle/meeting-semantic-VYGSV3H6.js +22 -0
  115. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  116. package/dist/bundle/node-CM6NC6UE.js +176 -0
  117. package/dist/bundle/node-KM3CUABH.js +2340 -0
  118. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  119. package/dist/bundle/node-sqlite-5YDQ3LIJ.js +74 -0
  120. package/dist/bundle/notes-search-PGO7KM2U.js +62 -0
  121. package/dist/bundle/oauth-NY4C5UCK.js +20 -0
  122. package/dist/bundle/open-YNUTA6ZE.js +23 -0
  123. package/dist/bundle/openai-4CVT5PHH.js +241 -0
  124. package/dist/bundle/process-2XT3TL27.js +91 -0
  125. package/dist/bundle/program-FMIVF5T6.js +31904 -0
  126. package/dist/bundle/prompt-VNWY3H6S.js +17 -0
  127. package/dist/bundle/recognize-JS4PBPSZ.js +26 -0
  128. package/dist/bundle/remote-RCLFH4V2.js +32 -0
  129. package/dist/bundle/rerank-EG6VKYGO.js +52 -0
  130. package/dist/bundle/schemas-ED2LHKXK.js +645 -0
  131. package/dist/bundle/serve-AHG25QXB.js +199 -0
  132. package/dist/bundle/server-5FTB7WM3.js +78 -0
  133. package/dist/bundle/server-JNZVSAZE.js +209 -0
  134. package/dist/bundle/sqlite-runtime-XSZOAQPF.js +20 -0
  135. package/dist/bundle/state-XGVAJFF7.js +36 -0
  136. package/dist/bundle/store-OHSCWZEV.js +177 -0
  137. package/dist/bundle/store-PKSPKJXL.js +293 -0
  138. package/dist/bundle/store-maintenance-command-KAWGBSWK.js +69 -0
  139. package/dist/bundle/ydisk.js +183 -0
  140. package/dist/commands/api.d.ts +9 -0
  141. package/dist/commands/api.d.ts.map +1 -0
  142. package/dist/commands/api.js +59 -0
  143. package/dist/commands/api.js.map +1 -0
  144. package/dist/commands/comments.d.ts +3 -0
  145. package/dist/commands/comments.d.ts.map +1 -0
  146. package/dist/commands/comments.js +114 -0
  147. package/dist/commands/comments.js.map +1 -0
  148. package/dist/commands/files.d.ts +3 -0
  149. package/dist/commands/files.d.ts.map +1 -0
  150. package/dist/commands/files.js +272 -0
  151. package/dist/commands/files.js.map +1 -0
  152. package/dist/commands/library.d.ts +13 -0
  153. package/dist/commands/library.d.ts.map +1 -0
  154. package/dist/commands/library.js +118 -0
  155. package/dist/commands/library.js.map +1 -0
  156. package/dist/commands/session.d.ts +3 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +99 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +18 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +62 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +80 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +77 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/generated/definitions.d.ts +3 -0
  169. package/dist/generated/definitions.d.ts.map +1 -0
  170. package/dist/generated/definitions.js +2001 -0
  171. package/dist/generated/definitions.js.map +1 -0
  172. package/dist/generated/manifest.d.ts +6 -0
  173. package/dist/generated/manifest.d.ts.map +1 -0
  174. package/dist/generated/manifest.js +1473 -0
  175. package/dist/generated/manifest.js.map +1 -0
  176. package/dist/generated/schemas.d.ts +127 -0
  177. package/dist/generated/schemas.d.ts.map +1 -0
  178. package/dist/generated/schemas.js +545 -0
  179. package/dist/generated/schemas.js.map +1 -0
  180. package/dist/generated/types.d.ts +829 -0
  181. package/dist/generated/types.d.ts.map +1 -0
  182. package/dist/generated/types.js +5 -0
  183. package/dist/generated/types.js.map +1 -0
  184. package/dist/identity.d.ts +10 -0
  185. package/dist/identity.d.ts.map +1 -0
  186. package/dist/identity.js +33 -0
  187. package/dist/identity.js.map +1 -0
  188. package/dist/index.d.ts +3 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +3 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/program.d.ts +6 -0
  193. package/dist/program.d.ts.map +1 -0
  194. package/dist/program.js +65 -0
  195. package/dist/program.js.map +1 -0
  196. package/dist/sample/comments.d.ts +61 -0
  197. package/dist/sample/comments.d.ts.map +1 -0
  198. package/dist/sample/comments.js +39 -0
  199. package/dist/sample/comments.js.map +1 -0
  200. package/dist/sample/records.d.ts +16 -0
  201. package/dist/sample/records.d.ts.map +1 -0
  202. package/dist/sample/records.js +22 -0
  203. package/dist/sample/records.js.map +1 -0
  204. package/dist/sample/transport.d.ts +42 -0
  205. package/dist/sample/transport.d.ts.map +1 -0
  206. package/dist/sample/transport.js +153 -0
  207. package/dist/sample/transport.js.map +1 -0
  208. package/dist/version.d.ts +2 -0
  209. package/dist/version.d.ts.map +1 -0
  210. package/dist/version.js +2 -0
  211. package/dist/version.js.map +1 -0
  212. package/dist/wcat.d.ts +3 -0
  213. package/dist/wcat.d.ts.map +1 -0
  214. package/dist/wcat.js +4 -0
  215. package/dist/wcat.js.map +1 -0
  216. package/dist/yandex/source.d.ts +39 -0
  217. package/dist/yandex/source.d.ts.map +1 -0
  218. package/dist/yandex/source.js +189 -0
  219. package/dist/yandex/source.js.map +1 -0
  220. package/dist/yandex/transport.d.ts +41 -0
  221. package/dist/yandex/transport.d.ts.map +1 -0
  222. package/dist/yandex/transport.js +152 -0
  223. package/dist/yandex/transport.js.map +1 -0
  224. package/dist/yandex/writes.d.ts +27 -0
  225. package/dist/yandex/writes.d.ts.map +1 -0
  226. package/dist/yandex/writes.js +61 -0
  227. package/dist/yandex/writes.js.map +1 -0
  228. package/package.json +88 -4
  229. package/skills/yandex-disk-cli/SKILL.md +46 -0
  230. package/skills/yandex-disk-cli/references/api/api-disk-operations-operation-id.md +13 -0
  231. package/skills/yandex-disk-cli/references/api/api-disk-public-resources.md +50 -0
  232. package/skills/yandex-disk-cli/references/api/api-disk-resources.md +171 -0
  233. package/skills/yandex-disk-cli/references/api/api-disk-trash-resources.md +48 -0
  234. package/skills/yandex-disk-cli/references/api/api-disk.md +13 -0
  235. package/skills/yandex-disk-cli/references/api.md +17 -0
@@ -0,0 +1,118 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { annotate } from "@wirecat/cli-base/commands";
3
+ import { listOf, nextUsually, REMOTE_READ } from "@wirecat/cli-core/cli";
4
+ import { documentIngestion } from "@wirecat/cli-core/documents";
5
+ import { documentLibraryCommands } from "@wirecat/cli-core/documents/cli";
6
+ import { configuration } from "../config.js";
7
+ import { diskFor, tokenOf } from "../context.js";
8
+ import { IDENTITY, SERVICE } from "../identity.js";
9
+ import { diskPath, isFolder, PAGE, skipReason } from "../yandex/source.js";
10
+ export const PROVIDER = {
11
+ name: "yandex-disk",
12
+ kind: "documents",
13
+ aliases: [],
14
+ command: IDENTITY.command,
15
+ opens: { document: "documents show" },
16
+ };
17
+ const WORDS = {
18
+ app: IDENTITY.command,
19
+ remote: "disk",
20
+ provider: SERVICE,
21
+ source: PROVIDER.name,
22
+ text: {
23
+ documents: "read the Yandex Disk files synced to this computer",
24
+ documentsList: "list the synced files with their Disk paths",
25
+ documentArgument: "file id (resource_id) or a search hit's document: ref",
26
+ folders: "choose the Disk folders sync copies",
27
+ folderArgument: "Disk path to add, like /Documents; its id to remove",
28
+ folderToAdd: "/Documents",
29
+ syncLimit: "how many files to read from Yandex Disk in this run",
30
+ },
31
+ };
32
+ const external = (id) => `${id}.md`;
33
+ /** cli-core's shared documents set over Yandex Disk: folders, sync, status, documents, search, catalog, knowledge. */
34
+ export const libraryCommands = () => documentLibraryCommands({
35
+ app: IDENTITY,
36
+ resolveSettings: configuration.resolveSettings,
37
+ provider: PROVIDER,
38
+ words: WORDS,
39
+ service: SERVICE,
40
+ source: (command, events) => diskFor(command, events, tokenOf(command)),
41
+ // cli-core hands back the source that `source` above built, typed only as its documents part.
42
+ folder: (source, input) => source.byPath(diskPath(input)),
43
+ ingestion: (store) => documentIngestion(store, {
44
+ provider: PROVIDER.name,
45
+ externalId: external,
46
+ catalogInput: (file) => ({
47
+ externalId: external(file.id),
48
+ kind: isFolder(file) ? "folder" : "file",
49
+ name: file.name,
50
+ parents: file.parents.map(external),
51
+ url: file.url,
52
+ mime: file.mime,
53
+ ...(file.createdAt ? { createdAt: file.createdAt } : {}),
54
+ ...(file.modifiedAt ? { modifiedAt: file.modifiedAt } : {}),
55
+ metadata: { path: file.providerMetadata.path },
56
+ }),
57
+ frontMatter: ({ metadata }) => ({
58
+ source: PROVIDER.name,
59
+ sourceUrl: metadata.url,
60
+ resourceId: metadata.id,
61
+ path: metadata.providerMetadata.path,
62
+ modifiedAt: metadata.modifiedAt ?? null,
63
+ }),
64
+ }),
65
+ idOf: (input) => input.trim(),
66
+ isFolder,
67
+ skipReason,
68
+ row: (file, reference) => ({
69
+ id: file.id,
70
+ name: file.name,
71
+ path: file.providerMetadata.path,
72
+ url: file.url,
73
+ size: file.size ?? null,
74
+ modified_at: file.modifiedAt ?? null,
75
+ reference,
76
+ }),
77
+ browse: (folders, tools) => {
78
+ // A browsed folder is chosen with folders add; the store's commands do not know it yet.
79
+ nextUsually(annotate(folders.command("browse"), {
80
+ effects: REMOTE_READ,
81
+ offline: false,
82
+ output: { entity: "disk_item", view: "folder" },
83
+ examples: [
84
+ `${IDENTITY.command} personal folders browse`,
85
+ `${IDENTITY.command} personal folders browse --folder /Work --json`,
86
+ ],
87
+ })
88
+ .description("list Disk folders one level at a time, live, to choose one for folders add")
89
+ .option("--folder <folder>", "the Disk folder to list inside, by its path; the top of the Disk without it")
90
+ .option("--cursor <cursor>", "go on from where the last page stopped; page.next gives it, with the same --folder")
91
+ .action(async (args) => {
92
+ const path = diskPath(args.folder ?? "/");
93
+ const offset = args.cursor === undefined ? 0 : Number(args.cursor);
94
+ if (!Number.isSafeInteger(offset) || offset < 0)
95
+ throw new CliError("validation_error", "--cursor takes the value page.next gave", { param: "--cursor" });
96
+ const chosen = new Set(tools.roots());
97
+ // The source `source` above built, typed by cli-core only as its documents part.
98
+ const page = await tools.withSource((source) => source.page(path, offset));
99
+ tools.output(listOf("folders browse", {
100
+ items: page.files.filter(isFolder).map((file) => ({
101
+ id: file.id,
102
+ name: file.name,
103
+ path: file.providerMetadata.path,
104
+ added: chosen.has(file.id),
105
+ })),
106
+ limit: PAGE,
107
+ has_more: page.more,
108
+ paging: "cursor",
109
+ ...(page.more ? { cursor: String(offset + PAGE) } : {}),
110
+ args: { folder: path },
111
+ }));
112
+ }), { pin: ["folders add"] });
113
+ },
114
+ textLimit: 1_000_000,
115
+ maxEntries: 10_000,
116
+ coverage: "files in the chosen folders: PDF, docx, xlsx, CSV, TSV, text and Markdown are read; others by name",
117
+ });
118
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/commands/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,E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IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvD,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;aACvB,CAAC,CACH,CAAA;QACH,CAAC,CAAC,EACJ,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CACzB,CAAA;IACH,CAAC;IACD,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,oGAAoG;CAC/G,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const sessionCommand: () => Command;
3
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAqHnC,eAAO,MAAM,cAAc,QAAO,OAMJ,CAAA"}
@@ -0,0 +1,99 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { annotate } from "@wirecat/cli-base/commands";
3
+ import { readSecret } from "@wirecat/cli-core";
4
+ import { commandWords, environmentOf, FETCH, itemOf, LOCAL_READ, LOCAL_WRITE, listOf, logsInOrOut, outputFor, ProfileTokenStore, profileFree, profilesHere, REMOTE_READ, refuseCommandName, refuseUnderReadOnly, rememberAccount, renderAnswer, rootOf, secretInputOf, } from "@wirecat/cli-core/cli";
5
+ import { Command } from "commander";
6
+ import { configuration } from "../config.js";
7
+ import { contextOf, diskFor, refuseOffline, withDisk } from "../context.js";
8
+ import { IDENTITY, SERVICE } from "../identity.js";
9
+ // Yandex shows the OAuth token to the person in the browser (https://yandex.ru/dev/id/doc/en/tokens/debug-token), so
10
+ // `session start` takes it pasted, as an API token, rather than through cli-core's oauth module.
11
+ const CLI = IDENTITY.command;
12
+ const answer = (command, item) => renderAnswer(command, outputFor(command), itemOf(item));
13
+ const storageOf = (raw) => {
14
+ if (raw === "keyring" || raw === "file")
15
+ return raw;
16
+ throw new CliError("validation_error", `--credential-storage takes keyring or file; got ${raw}`);
17
+ };
18
+ const startCommand = () => logsInOrOut(annotate(new Command("start"), {
19
+ effects: FETCH,
20
+ lifetime: "interactive",
21
+ mcp: false,
22
+ examples: [`${CLI} personal session start`],
23
+ }))
24
+ .summary(`sign in to ${SERVICE} with an API token`)
25
+ .description(`sign this profile in: the ${SERVICE} API token is asked hidden or read from stdin, never taken as an ` +
26
+ "argument, checked against the service, and only then kept in the keyring, or in a private file")
27
+ .option("--credential-storage <storage>", "where the token is kept: keyring, which falls back to a private file by itself when no keyring works; file " +
28
+ "skips the keyring, so keep it for a computer that has none", storageOf, "keyring")
29
+ .action(async function (args) {
30
+ const { env, flags, profile, tokens, run } = contextOf(this);
31
+ refuseCommandName(profile, commandWords(rootOf(this)), CLI);
32
+ refuseOffline(flags);
33
+ // A secret is never an argument: it would land in shell history and in the run record (WC-SECR-5).
34
+ const token = (await readSecret(`${SERVICE} OAuth token: `, secretInputOf(this))).trim();
35
+ if (!token)
36
+ throw new CliError("validation_error", "no token was given");
37
+ const user = await run((events) => diskFor(this, events, token).account());
38
+ const storedIn = tokens.write(profile, token, args.credentialStorage);
39
+ rememberAccount(IDENTITY, profile, user.id, env);
40
+ answer(this, { profile, state: "saved", stored_in: storedIn, verified: true, user });
41
+ });
42
+ const statusCommand = () => annotate(new Command("status"), {
43
+ effects: REMOTE_READ,
44
+ examples: [`${CLI} personal session status`, `${CLI} personal session status --check --json`],
45
+ })
46
+ .summary("show where this profile's token comes from; never the token")
47
+ .description(`show where this profile's token comes from: ${IDENTITY.envPrefix}_TOKEN, the keyring or a file, never the token; ` +
48
+ `--check asks ${SERVICE} whose token it is`)
49
+ .option("--check", `ask ${SERVICE} whether the token still works, and whose it is`)
50
+ .action(async function (args) {
51
+ const { profile, tokens } = contextOf(this);
52
+ const saved = tokens.read(profile);
53
+ const status = { profile, state: saved ? "saved" : "missing", token_from: saved?.source ?? null };
54
+ if (!args.check || !saved)
55
+ return answer(this, { ...status, verified: false });
56
+ answer(this, { ...status, verified: true, user: await withDisk(this, (disk) => disk.account()) });
57
+ });
58
+ const endCommand = () => logsInOrOut(annotate(new Command("end"), {
59
+ effects: LOCAL_WRITE,
60
+ mcp: false,
61
+ examples: [`${CLI} personal session end`],
62
+ }))
63
+ .summary("forget this profile's token on this computer")
64
+ .description(`forget this profile's token on this computer; the token itself stays valid in ${SERVICE}`)
65
+ .action(function () {
66
+ refuseUnderReadOnly(this, "session end");
67
+ const { profile, tokens } = contextOf(this);
68
+ answer(this, { profile, ended: tokens.remove(profile) });
69
+ });
70
+ const listCommand = () => profileFree(annotate(new Command("list"), {
71
+ effects: LOCAL_READ,
72
+ examples: [`${CLI} session list`, `${CLI} session list --json`],
73
+ }))
74
+ .summary("list the profiles here and whether each is signed in")
75
+ .description("list the profiles on this computer and whether each has a token; picks none")
76
+ .action(function () {
77
+ const environment = environmentOf(this);
78
+ const env = environment.env ?? process.env;
79
+ // biome-ignore lint/plugin/no-own-settings: baseContext needs a profile, and this local read names none
80
+ const { configuredProfiles } = configuration.resolveSettings({}, { env, needsProfile: false });
81
+ const tokens = new ProfileTokenStore({
82
+ app: IDENTITY,
83
+ env,
84
+ ...(environment.keyring ? { keyring: environment.keyring } : {}),
85
+ warn: outputFor(this).renderer.warn,
86
+ });
87
+ const items = profilesHere(IDENTITY, configuredProfiles, env).map((profile) => {
88
+ const saved = tokens.read(profile);
89
+ return { profile, signed_in: saved !== undefined, token_from: saved?.source ?? null };
90
+ });
91
+ renderAnswer(this, outputFor(this), listOf("session list", { items, limit: Math.max(1, items.length), has_more: false }));
92
+ });
93
+ export const sessionCommand = () => annotate(new Command("session"), { effects: LOCAL_READ })
94
+ .description(`keep this profile's ${SERVICE} token in the OS keyring`)
95
+ .addCommand(startCommand())
96
+ .addCommand(statusCommand())
97
+ .addCommand(endCommand())
98
+ .addCommand(listCommand());
99
+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C,WAAW,EAAE,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { type Configuration } from "@wirecat/cli-core/cli";
2
+ /** The key every overwrite and permanent delete also checks, as the api group's `deletingFlags` do. */
3
+ export declare const DELETE_KEY = "files.delete";
4
+ /** A public link opens the file to anyone who has it. */
5
+ export declare const SHARE_KEY = "files.share";
6
+ export declare const LINK_OPERATIONS: string[];
7
+ export declare const API: {
8
+ manifest: {
9
+ servers: readonly import("@wirecat/cli-base/codegen").ApiServer[];
10
+ securitySchemes: Readonly<Record<string, import("@wirecat/cli-base/codegen").SecurityScheme>>;
11
+ security: readonly import("@wirecat/cli-base/codegen").SecurityRequirement[];
12
+ operations: import("@wirecat/cli-base/codegen").ManifestOperation[];
13
+ };
14
+ service: string;
15
+ };
16
+ export declare const permissions: import("@wirecat/cli-core/cli").CommandPermissions;
17
+ export declare const configuration: Configuration;
18
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAInB,MAAM,uBAAuB,CAAA;AAI9B,uGAAuG;AACvG,eAAO,MAAM,UAAU,iBAAiB,CAAA;AACxC,yDAAyD;AACzD,eAAO,MAAM,SAAS,gBAAgB,CAAA;AAKtC,eAAO,MAAM,eAAe,UAAwF,CAAA;AAkBpH,eAAO,MAAM,GAAG;;;;;;;;CAaf,CAAA;AAeD,eAAO,MAAM,WAAW,oDAStB,CAAA;AAEF,eAAO,MAAM,aAAa,EAAE,aAAsD,CAAA"}
package/dist/config.js ADDED
@@ -0,0 +1,62 @@
1
+ import { commandPermissions, serviceApiPermissions, settingsFor, } from "@wirecat/cli-core/cli";
2
+ import * as manifest from "./generated/manifest.js";
3
+ import { IDENTITY, SERVICE } from "./identity.js";
4
+ /** The key every overwrite and permanent delete also checks, as the api group's `deletingFlags` do. */
5
+ export const DELETE_KEY = "files.delete";
6
+ /** A public link opens the file to anyone who has it. */
7
+ export const SHARE_KEY = "files.share";
8
+ // The keys a delete or a share checks (`files.delete`, `files.share`) come from `permissions` in scripts/generate.ts.
9
+ // An operation that answers with a credential is left out: the CLI signs in through `session`, and the api group would
10
+ // drop it anyway.
11
+ export const LINK_OPERATIONS = ["GetResourceDownloadLink", "GetResourceUploadLink", "GetPublicResourceDownloadLink"];
12
+ /**
13
+ * The `files` command each raw operation does the same as. Its key is added to the operation's own, so `files.move`
14
+ * set to deny also stops `api resources-move`, and its `--dry-run` shows the key (WC-PERM-22).
15
+ */
16
+ const COMMAND_KEYS = {
17
+ "resources-copy": "files.copy",
18
+ "resources-move": "files.move",
19
+ "resources-create": "files.create",
20
+ "resources-publish": "files.publish",
21
+ "resources-unpublish": "files.unpublish",
22
+ "trash-resources-restore": "files.restore",
23
+ // Both put a file on the Disk: one from an address on the web, one from someone's public link.
24
+ "resources-upload-url": "files.upload",
25
+ "public-resources-save-to-disk": "files.upload",
26
+ };
27
+ export const API = {
28
+ // A download or upload link carries its own grant to the file, so it is never printed: files download and upload
29
+ // use it without showing it.
30
+ manifest: {
31
+ ...manifest,
32
+ operations: manifest.operations
33
+ .filter((operation) => !operation.response?.sensitive && !LINK_OPERATIONS.includes(operation.id))
34
+ .map((operation) => {
35
+ const key = COMMAND_KEYS[operation.command];
36
+ return key ? { ...operation, permissions: [...(operation.permissions ?? []), { key }] } : operation;
37
+ }),
38
+ },
39
+ service: SERVICE,
40
+ };
41
+ const REPLACES = { key: DELETE_KEY, when: "with --replace" };
42
+ /** What a `files` write checks beside its own key, so `--dry-run` shows the same keys as the run. */
43
+ const FILES_CHECKS = {
44
+ "files upload": [REPLACES],
45
+ "files copy": [REPLACES],
46
+ "files move": [REPLACES],
47
+ "files publish": [SHARE_KEY],
48
+ "files unpublish": [SHARE_KEY],
49
+ };
50
+ const api = serviceApiPermissions(API);
51
+ export const permissions = commandPermissions({
52
+ extra: api.extra,
53
+ alsoChecks: (path) => [...api.alsoChecks(path), ...(FILES_CHECKS[path.join(" ")] ?? [])],
54
+ defaults: {
55
+ ...api.defaults,
56
+ // The api group makes each of its keys `ask`; a command's own key keeps the command's level, as `files move`
57
+ // has it, on both paths.
58
+ ...Object.fromEntries(Object.values(COMMAND_KEYS).map((key) => [key, "allow"])),
59
+ },
60
+ });
61
+ export const configuration = settingsFor(IDENTITY, { permissions });
62
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,GACZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEjD,uGAAuG;AACvG,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAA;AACxC,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAA;AAEtC,sHAAsH;AACtH,uHAAuH;AACvH,kBAAkB;AAClB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,yBAAyB,EAAE,uBAAuB,EAAE,+BAA+B,CAAC,CAAA;AAEpH;;;GAGG;AACH,MAAM,YAAY,GAAqC;IACrD,gBAAgB,EAAE,YAAY;IAC9B,gBAAgB,EAAE,YAAY;IAC9B,kBAAkB,EAAE,cAAc;IAClC,mBAAmB,EAAE,eAAe;IACpC,qBAAqB,EAAE,iBAAiB;IACxC,yBAAyB,EAAE,eAAe;IAC1C,+FAA+F;IAC/F,sBAAsB,EAAE,cAAc;IACtC,+BAA+B,EAAE,cAAc;CAChD,CAAA;AAED,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,iHAAiH;IACjH,6BAA6B;IAC7B,QAAQ,EAAE;QACR,GAAG,QAAQ;QACX,UAAU,EAAE,QAAQ,CAAC,UAAU;aAC5B,MAAM,CAAC,CAAC,SAAS,E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GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;KAChF;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,aAAa,GAAkB,WAAW,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,CAAC,CAAA"}
@@ -0,0 +1,80 @@
1
+ import { type BaseEnvironment, type EventSink, type GlobalFlags, ProfileTokenStore } from "@wirecat/cli-core/cli";
2
+ import type { Command } from "commander";
3
+ /** What a test hands `run()` beside cli-core's own: the fake service in place of the network (WC-ARCH-10). */
4
+ export interface ServiceEnvironment extends BaseEnvironment {
5
+ fetch?: typeof fetch;
6
+ }
7
+ export declare const PACE: {
8
+ perMinute: number;
9
+ burst: number;
10
+ };
11
+ /**
12
+ * Settings, keyring and the run come from cli-core's `baseContext` and nowhere else: a command that resolves settings
13
+ * on its own skips `--timeout`, the run record and the profile's permissions (WC-LIFE-5, WC-LIFE-15).
14
+ */
15
+ export declare const contextOf: (command: Command) => {
16
+ settings: import("@wirecat/cli-core/cli").Settings;
17
+ renderer: import("@wirecat/cli-base").Renderer;
18
+ format: import("@wirecat/cli-base").RenderFormat;
19
+ color: boolean;
20
+ streams: import("@wirecat/cli-base").Streams;
21
+ compact?: boolean;
22
+ full?: boolean;
23
+ env: NodeJS.ProcessEnv;
24
+ keyring?: import("@wirecat/cli-base").KeyringStore;
25
+ run: <T>(body: (events: EventSink) => Promise<T>, options?: {
26
+ unbounded?: boolean;
27
+ name?: string;
28
+ }) => Promise<T>;
29
+ track: (closeable: import("@wirecat/cli-core/cli").Closeable) => void;
30
+ environment: ServiceEnvironment;
31
+ flags: GlobalFlags;
32
+ profile: string;
33
+ tokens: ProfileTokenStore;
34
+ };
35
+ export declare const refuseOffline: (flags: GlobalFlags) => void;
36
+ /** Download and upload links point away from the API; linkFetch never sends them the token. */
37
+ export declare const LINK_HOSTS: string[];
38
+ /** The Disk for one run, with the token it was given; `events` comes from `run()`, so each request is recorded. */
39
+ export declare const diskFor: (command: Command, events: EventSink | undefined, token: string) => {
40
+ identity(): Promise<string>;
41
+ metadata(id: string, known?: import("./yandex/source.js").DiskFile | undefined): Promise<import("./yandex/source.js").DiskFile>;
42
+ children(id: string, folder?: import("./yandex/source.js").DiskFile | undefined): Promise<import("./yandex/source.js").DiskFile[]>;
43
+ childrenPage?(id: string, cursor?: string, folder?: import("./yandex/source.js").DiskFile | undefined): Promise<{
44
+ files: import("./yandex/source.js").DiskFile[];
45
+ cursor?: string;
46
+ }>;
47
+ content(id: string, maxChars?: number, file?: import("./yandex/source.js").DiskFile | undefined): Promise<import("@wirecat/cli-core/documents").SourceContent<import("./yandex/source.js").DiskFile>>;
48
+ bytes(id: string, file?: import("./yandex/source.js").DiskFile | undefined): Promise<Uint8Array>;
49
+ download(id: string, file?: import("./yandex/source.js").DiskFile): Promise<Response>;
50
+ account(): Promise<{
51
+ id: string;
52
+ login: string | null;
53
+ name: string | null;
54
+ }>;
55
+ byPath(path: string): Promise<import("./yandex/source.js").DiskFile>;
56
+ page(path: string, offset: number): Promise<{
57
+ folder: import("./yandex/source.js").DiskFile;
58
+ files: import("./yandex/source.js").DiskFile[];
59
+ more: boolean;
60
+ }>;
61
+ createFolder: (path: string) => Promise<import("./yandex/writes.js").Outcome>;
62
+ trash: (path: string) => Promise<import("./yandex/writes.js").Outcome>;
63
+ restore: (trashPath: string) => Promise<import("./yandex/writes.js").Outcome>;
64
+ transfer: (kind: "copy" | "move", from: string, to: string, replace: boolean) => Promise<import("./yandex/writes.js").Outcome>;
65
+ publish: (path: string) => Promise<import("./yandex/writes.js").Outcome>;
66
+ unpublish: (path: string) => Promise<import("./yandex/writes.js").Outcome>;
67
+ publicUrl: (path: string) => Promise<string | undefined>;
68
+ upload: (path: string, body: Blob, replace: boolean) => Promise<{
69
+ status: "done" | "in-progress";
70
+ }>;
71
+ };
72
+ export type Disk = ReturnType<typeof diskFor>;
73
+ /** The profile's saved token, or an authentication error that says how to sign in. Read before any request. */
74
+ export declare const tokenOf: (command: Command) => string;
75
+ /**
76
+ * Every remote call goes through here: inside cli-core's run, so `--timeout` bounds it, a failure or `--record` keeps
77
+ * a run named after the command, and the transport's requests land in that run (WC-LIFE-5, WC-LIFE-15).
78
+ */
79
+ export declare const withDisk: <T>(command: Command, body: (disk: Disk) => Promise<T>) => Promise<T>;
80
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,SAAS,EAEd,KAAK,WAAW,EAEhB,iBAAiB,EAClB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOxC,8GAA8G;AAC9G,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CACrB;AAGD,eAAO,MAAM,IAAI;IAAK,SAAS;IAAO,KAAK;CAAM,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,SAAS,YAAa,OAAO;;;;;;;;;;;;;;;;;;;CAczC,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,WAAW,SAG/C,CAAA;AAED,+FAA+F;AAC/F,eAAO,MAAM,UAAU,UAAoE,CAAA;AAiB3F,mHAAmH;AACnH,eAAO,MAAM,OAAO,YAAa,OAAO,UAAU,SAAS,GAAG,SAAS,SAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBrF,CAAA;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;AAE7C,+GAA+G;AAC/G,eAAO,MAAM,OAAO,YAAa,OAAO,KAAG,MAI1C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,WAAW,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAGzF,CAAA"}
@@ -0,0 +1,77 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { baseContext, environmentOf, linkFetch, ProfileTokenStore, } from "@wirecat/cli-core/cli";
3
+ import { Pacer, pacePathFor } from "@wirecat/cli-core/sends";
4
+ import { configuration } from "./config.js";
5
+ import { API_HOSTS, DESKTOP, IDENTITY, SERVICE } from "./identity.js";
6
+ import { diskSource } from "./yandex/source.js";
7
+ import { transport } from "./yandex/transport.js";
8
+ import { diskWrites } from "./yandex/writes.js";
9
+ // Yandex's Disk API documentation names no rate limit; this pace stays well under what a person clicks.
10
+ export const PACE = { perMinute: 120, burst: 20 };
11
+ /**
12
+ * Settings, keyring and the run come from cli-core's `baseContext` and nowhere else: a command that resolves settings
13
+ * on its own skips `--timeout`, the run record and the profile's permissions (WC-LIFE-5, WC-LIFE-15).
14
+ */
15
+ export const contextOf = (command) => {
16
+ const base = baseContext(command, configuration.resolveSettings);
17
+ return {
18
+ ...base,
19
+ environment: environmentOf(command),
20
+ flags: command.optsWithGlobals(),
21
+ profile: base.settings.profile,
22
+ tokens: new ProfileTokenStore({
23
+ app: IDENTITY,
24
+ env: base.env,
25
+ ...(base.keyring ? { keyring: base.keyring } : {}),
26
+ warn: base.renderer.warn,
27
+ }),
28
+ };
29
+ };
30
+ export const refuseOffline = (flags) => {
31
+ if (flags.offline)
32
+ throw new CliError("permission_error", `this needs ${SERVICE}; leave out --offline`, { reason: "offline.refused" });
33
+ };
34
+ /** Download and upload links point away from the API; linkFetch never sends them the token. */
35
+ export const LINK_HOSTS = (DESKTOP.hosts ?? []).filter((host) => !API_HOSTS.includes(host));
36
+ /** A file moves at the link's own pace; the run's --timeout and stop still end it. */
37
+ const LINK_TIMEOUT_MS = 60 * 60_000;
38
+ /** The transport names no command (WC-ARCH-16); a refused token gets the words that sign this profile in again. */
39
+ const signInAgain = (api, profile) => ({
40
+ send: (request, answer) => api.send(request, answer).catch((error) => {
41
+ if (!(error instanceof CliError) || error.code !== "authentication_error")
42
+ throw error;
43
+ throw new CliError(error.code, `${error.message}; sign in again with ${IDENTITY.command} ${profile} session start`, error.details);
44
+ }),
45
+ });
46
+ /** The Disk for one run, with the token it was given; `events` comes from `run()`, so each request is recorded. */
47
+ export const diskFor = (command, events, token) => {
48
+ const { environment, env, profile } = contextOf(command);
49
+ const api = signInAgain(transport({
50
+ token,
51
+ ...(events ? { events } : {}),
52
+ signal: environment.signal,
53
+ ...(environment.fetch ? { fetch: environment.fetch } : {}),
54
+ pacer: new Pacer(pacePathFor(IDENTITY, profile, env), PACE),
55
+ }), profile);
56
+ const links = linkFetch({
57
+ hosts: LINK_HOSTS,
58
+ timeoutMs: LINK_TIMEOUT_MS,
59
+ ...(environment.fetch ? { fetch: environment.fetch } : {}),
60
+ });
61
+ return { ...diskSource(api, links, environment.signal), ...diskWrites(api, links, environment.signal) };
62
+ };
63
+ /** The profile's saved token, or an authentication error that says how to sign in. Read before any request. */
64
+ export const tokenOf = (command) => {
65
+ const { flags, profile, tokens } = contextOf(command);
66
+ refuseOffline(flags);
67
+ return tokens.need(profile);
68
+ };
69
+ /**
70
+ * Every remote call goes through here: inside cli-core's run, so `--timeout` bounds it, a failure or `--record` keeps
71
+ * a run named after the command, and the transport's requests land in that run (WC-LIFE-5, WC-LIFE-15).
72
+ */
73
+ export const withDisk = (command, body) => {
74
+ const token = tokenOf(command);
75
+ return contextOf(command).run((events) => body(diskFor(command, events, token)));
76
+ };
77
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAEL,WAAW,EAEX,aAAa,EAEb,SAAS,EACT,iBAAiB,GAClB,MAAM,uBAAuB,CA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AAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;AAClF,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { SchemaNode } from "@wirecat/cli-base/codegen";
2
+ export declare const definitions: Readonly<Record<string, SchemaNode>>;
3
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/generated/definitions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAE3D,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA68D5D,CAAA"}