@swipt/cli 0.1.0-nightly.97 → 0.1.0-nightly.99

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 (247) hide show
  1. package/dist/availability.d.ts +3 -1
  2. package/dist/availability.js +173 -151
  3. package/dist/availability.js.map +1 -1
  4. package/dist/cli/cli.js +52 -66
  5. package/dist/cli/cli.js.map +1 -1
  6. package/dist/cli/command.d.ts +9 -0
  7. package/dist/cli/command.js.map +1 -1
  8. package/dist/cli/commands/data/clear.js +2 -2
  9. package/dist/cli/commands/data/clear.js.map +1 -1
  10. package/dist/cli/commands/data/data.js +2 -2
  11. package/dist/cli/commands/data/data.js.map +1 -1
  12. package/dist/cli/commands/data/list.js +3 -3
  13. package/dist/cli/commands/data/list.js.map +1 -1
  14. package/dist/cli/commands/data/operand.js.map +1 -1
  15. package/dist/cli/commands/data/read.js +4 -7
  16. package/dist/cli/commands/data/read.js.map +1 -1
  17. package/dist/cli/commands/data/remove.js +3 -3
  18. package/dist/cli/commands/data/remove.js.map +1 -1
  19. package/dist/cli/commands/data/write.js +2 -2
  20. package/dist/cli/commands/data/write.js.map +1 -1
  21. package/dist/cli/commands/device/add.js +2 -2
  22. package/dist/cli/commands/device/add.js.map +1 -1
  23. package/dist/cli/commands/device/device.js +2 -2
  24. package/dist/cli/commands/device/device.js.map +1 -1
  25. package/dist/cli/commands/device/list.js +2 -2
  26. package/dist/cli/commands/device/list.js.map +1 -1
  27. package/dist/cli/commands/device/logs.js +44 -46
  28. package/dist/cli/commands/device/logs.js.map +1 -1
  29. package/dist/cli/commands/device/remove.js +2 -2
  30. package/dist/cli/commands/device/remove.js.map +1 -1
  31. package/dist/cli/commands/device/stop.js +3 -3
  32. package/dist/cli/commands/device/stop.js.map +1 -1
  33. package/dist/cli/commands/driver/driver.js +6 -6
  34. package/dist/cli/commands/driver/driver.js.map +1 -1
  35. package/dist/cli/commands/flags.js +9 -9
  36. package/dist/cli/commands/flags.js.map +1 -1
  37. package/dist/cli/commands/index.js +2 -2
  38. package/dist/cli/commands/index.js.map +1 -1
  39. package/dist/cli/commands/project/build.js +2 -2
  40. package/dist/cli/commands/project/build.js.map +1 -1
  41. package/dist/cli/commands/project/create.js +3 -3
  42. package/dist/cli/commands/project/create.js.map +1 -1
  43. package/dist/cli/commands/project/deploy.js +2 -2
  44. package/dist/cli/commands/project/deploy.js.map +1 -1
  45. package/dist/cli/commands/project/develop.js +19 -19
  46. package/dist/cli/commands/project/develop.js.map +1 -1
  47. package/dist/cli/commands/project/project.js +2 -2
  48. package/dist/cli/commands/project/project.js.map +1 -1
  49. package/dist/cli/commands/project/source.js +62 -37
  50. package/dist/cli/commands/project/source.js.map +1 -1
  51. package/dist/cli/commands/repl/api.js +2 -2
  52. package/dist/cli/commands/repl/api.js.map +1 -1
  53. package/dist/cli/commands/repl/repl.js +4 -4
  54. package/dist/cli/commands/repl/repl.js.map +1 -1
  55. package/dist/cli/commands/repl/reset.js +2 -2
  56. package/dist/cli/commands/repl/reset.js.map +1 -1
  57. package/dist/cli/commands/repl/run.js +5 -5
  58. package/dist/cli/commands/repl/run.js.map +1 -1
  59. package/dist/cli/commands/sideload/install.js +4 -4
  60. package/dist/cli/commands/sideload/install.js.map +1 -1
  61. package/dist/cli/commands/sideload/setup.js +3 -3
  62. package/dist/cli/commands/sideload/setup.js.map +1 -1
  63. package/dist/cli/commands/sideload/sideload.js +2 -2
  64. package/dist/cli/commands/sideload/sideload.js.map +1 -1
  65. package/dist/cli/commands/sideload/uninstall.js +2 -2
  66. package/dist/cli/commands/sideload/uninstall.js.map +1 -1
  67. package/dist/cli/commands/sideload/update.js +3 -3
  68. package/dist/cli/commands/sideload/update.js.map +1 -1
  69. package/dist/cli/commands/swiplet/call.js +6 -6
  70. package/dist/cli/commands/swiplet/call.js.map +1 -1
  71. package/dist/cli/commands/swiplet/install.js +3 -3
  72. package/dist/cli/commands/swiplet/install.js.map +1 -1
  73. package/dist/cli/commands/swiplet/list.js +8 -8
  74. package/dist/cli/commands/swiplet/list.js.map +1 -1
  75. package/dist/cli/commands/swiplet/remove.js +3 -3
  76. package/dist/cli/commands/swiplet/remove.js.map +1 -1
  77. package/dist/cli/commands/swiplet/service/disable.js +3 -3
  78. package/dist/cli/commands/swiplet/service/disable.js.map +1 -1
  79. package/dist/cli/commands/swiplet/service/enable.js +3 -3
  80. package/dist/cli/commands/swiplet/service/enable.js.map +1 -1
  81. package/dist/cli/commands/swiplet/service/service.js +2 -2
  82. package/dist/cli/commands/swiplet/service/service.js.map +1 -1
  83. package/dist/cli/commands/swiplet/service/services.js +2 -2
  84. package/dist/cli/commands/swiplet/service/services.js.map +1 -1
  85. package/dist/cli/commands/swiplet/service/watch.js +2 -2
  86. package/dist/cli/commands/swiplet/service/watch.js.map +1 -1
  87. package/dist/cli/commands/swiplet/show.js +6 -6
  88. package/dist/cli/commands/swiplet/show.js.map +1 -1
  89. package/dist/cli/commands/swiplet/swiplet.js +4 -4
  90. package/dist/cli/commands/swiplet/swiplet.js.map +1 -1
  91. package/dist/cli/commands/version/version.js +2 -2
  92. package/dist/cli/commands/version/version.js.map +1 -1
  93. package/dist/cli/deploy.js +9 -7
  94. package/dist/cli/deploy.js.map +1 -1
  95. package/dist/cli/session.js.map +1 -1
  96. package/dist/client.d.ts +145 -7
  97. package/dist/client.js +20 -22
  98. package/dist/client.js.map +1 -1
  99. package/dist/connection.d.ts +292 -25
  100. package/dist/connection.js +36 -35
  101. package/dist/connection.js.map +1 -1
  102. package/dist/driver.d.ts +62 -23
  103. package/dist/driver.js +29 -33
  104. package/dist/driver.js.map +1 -1
  105. package/dist/i18n.d.ts +2 -5
  106. package/dist/i18n.js +15 -13
  107. package/dist/i18n.js.map +1 -1
  108. package/dist/i18next.d.ts +7 -0
  109. package/dist/ignore.d.ts +14 -7
  110. package/dist/ignore.js +13 -14
  111. package/dist/ignore.js.map +1 -1
  112. package/dist/mdns.d.ts +2 -2
  113. package/dist/mdns.js +1 -1
  114. package/dist/mdns.js.map +1 -1
  115. package/dist/metro.d.ts +19 -5
  116. package/dist/metro.js +61 -63
  117. package/dist/metro.js.map +1 -1
  118. package/dist/output.d.ts +29 -14
  119. package/dist/output.js +17 -15
  120. package/dist/output.js.map +1 -1
  121. package/dist/passcode.d.ts +12 -8
  122. package/dist/passcode.js +18 -18
  123. package/dist/passcode.js.map +1 -1
  124. package/dist/project.d.ts +20 -10
  125. package/dist/project.js +72 -49
  126. package/dist/project.js.map +1 -1
  127. package/dist/proto/common_pb.d.ts +240 -0
  128. package/dist/proto/common_pb.js +7 -2
  129. package/dist/proto/common_pb.js.map +1 -1
  130. package/dist/proto/logs_pb.d.ts +38 -0
  131. package/dist/proto/repl_pb.d.ts +96 -0
  132. package/dist/proto/swiplets_pb.d.ts +361 -0
  133. package/dist/proto/swiplets_pb.js +7 -2
  134. package/dist/proto/swiplets_pb.js.map +1 -1
  135. package/dist/proto/system_pb.d.ts +33 -0
  136. package/dist/resources.d.ts +400 -0
  137. package/dist/serve.d.ts +9 -1
  138. package/dist/serve.js +17 -16
  139. package/dist/serve.js.map +1 -1
  140. package/dist/sideload.d.ts +27 -14
  141. package/dist/sideload.js +102 -89
  142. package/dist/sideload.js.map +1 -1
  143. package/dist/swipt-app.d.ts +19 -9
  144. package/dist/swipt-app.js +1 -1
  145. package/dist/swipt-app.js.map +1 -1
  146. package/locales/ar/translation.json +413 -0
  147. package/locales/bg/translation.json +397 -0
  148. package/locales/bn/translation.json +397 -0
  149. package/locales/ca/translation.json +401 -0
  150. package/locales/cs/translation.json +405 -0
  151. package/locales/da/translation.json +397 -0
  152. package/locales/de/translation.json +397 -0
  153. package/locales/el/translation.json +397 -0
  154. package/locales/en/translation.json +397 -0
  155. package/locales/es/translation.json +401 -0
  156. package/locales/es-419/translation.json +401 -0
  157. package/locales/fi/translation.json +397 -0
  158. package/locales/fr/translation.json +401 -0
  159. package/locales/fr-CA/translation.json +401 -0
  160. package/locales/gu/translation.json +397 -0
  161. package/locales/he/translation.json +401 -0
  162. package/locales/hi/translation.json +397 -0
  163. package/locales/hr/translation.json +401 -0
  164. package/locales/hu/translation.json +397 -0
  165. package/locales/id/translation.json +393 -0
  166. package/locales/it/translation.json +401 -0
  167. package/locales/ja/translation.json +393 -0
  168. package/locales/kk/translation.json +397 -0
  169. package/locales/kn/translation.json +397 -0
  170. package/locales/ko/translation.json +393 -0
  171. package/locales/lt/translation.json +405 -0
  172. package/locales/ml/translation.json +397 -0
  173. package/locales/mr/translation.json +397 -0
  174. package/locales/ms/translation.json +393 -0
  175. package/locales/nb/translation.json +397 -0
  176. package/locales/nl/translation.json +397 -0
  177. package/locales/or/translation.json +397 -0
  178. package/locales/pa/translation.json +397 -0
  179. package/locales/pl/translation.json +405 -0
  180. package/locales/pt-BR/translation.json +401 -0
  181. package/locales/pt-PT/translation.json +401 -0
  182. package/locales/ro/translation.json +401 -0
  183. package/locales/ru/translation.json +405 -0
  184. package/locales/sk/translation.json +405 -0
  185. package/locales/sl/translation.json +405 -0
  186. package/locales/sv/translation.json +397 -0
  187. package/locales/ta/translation.json +397 -0
  188. package/locales/te/translation.json +397 -0
  189. package/locales/th/translation.json +393 -0
  190. package/locales/tr/translation.json +397 -0
  191. package/locales/uk/translation.json +405 -0
  192. package/locales/ur/translation.json +397 -0
  193. package/locales/vi/translation.json +397 -0
  194. package/locales/zh-HK/translation.json +393 -0
  195. package/locales/zh-Hans/translation.json +393 -0
  196. package/locales/zh-Hant/translation.json +393 -0
  197. package/package.json +14 -9
  198. package/locales/ar.json +0 -311
  199. package/locales/bg.json +0 -295
  200. package/locales/bn.json +0 -295
  201. package/locales/ca.json +0 -299
  202. package/locales/cs.json +0 -303
  203. package/locales/da.json +0 -295
  204. package/locales/de.json +0 -295
  205. package/locales/el.json +0 -295
  206. package/locales/es-419.json +0 -299
  207. package/locales/es.json +0 -299
  208. package/locales/fi.json +0 -295
  209. package/locales/fr-CA.json +0 -299
  210. package/locales/fr.json +0 -299
  211. package/locales/gu.json +0 -295
  212. package/locales/he.json +0 -299
  213. package/locales/hi.json +0 -295
  214. package/locales/hr.json +0 -299
  215. package/locales/hu.json +0 -295
  216. package/locales/id.json +0 -283
  217. package/locales/it.json +0 -299
  218. package/locales/ja.json +0 -283
  219. package/locales/kk.json +0 -295
  220. package/locales/kn.json +0 -295
  221. package/locales/ko.json +0 -283
  222. package/locales/lt.json +0 -303
  223. package/locales/ml.json +0 -295
  224. package/locales/mr.json +0 -295
  225. package/locales/ms.json +0 -283
  226. package/locales/nb.json +0 -295
  227. package/locales/nl.json +0 -295
  228. package/locales/or.json +0 -295
  229. package/locales/pa.json +0 -295
  230. package/locales/pl.json +0 -303
  231. package/locales/pt-BR.json +0 -299
  232. package/locales/pt-PT.json +0 -299
  233. package/locales/ro.json +0 -299
  234. package/locales/ru.json +0 -303
  235. package/locales/sk.json +0 -303
  236. package/locales/sl.json +0 -303
  237. package/locales/sv.json +0 -295
  238. package/locales/ta.json +0 -295
  239. package/locales/te.json +0 -295
  240. package/locales/th.json +0 -283
  241. package/locales/tr.json +0 -295
  242. package/locales/uk.json +0 -303
  243. package/locales/ur.json +0 -295
  244. package/locales/vi.json +0 -295
  245. package/locales/zh-HK.json +0 -283
  246. package/locales/zh-Hans.json +0 -283
  247. package/locales/zh-Hant.json +0 -283
@@ -1,5 +1,5 @@
1
1
  import { UsageError } from "../../../client.js";
2
- import { tr } from "../../../i18n.js";
2
+ import { t } from "../../../i18n.js";
3
3
  import { defineCommand } from "../../command.js";
4
4
  import { session } from "../../session.js";
5
5
  import { operandCount } from "./operand.js";
@@ -39,10 +39,7 @@ var FileSink = class {
39
39
  for (const file of this.files.values()) fs.closeSync(file);
40
40
  }
41
41
  };
42
- const printSaved = (target, count) => console.error(tr({
43
- one: "saved {count} file to {path}",
44
- other: "saved {count} files to {path}"
45
- }, {
42
+ const printSaved = (target, count) => console.error(t("commands.data.read.saved", {
46
43
  count,
47
44
  path: target
48
45
  }));
@@ -108,12 +105,12 @@ const read = (operand, target) => {
108
105
  return defineCommand({
109
106
  name: "read",
110
107
  use: `read ${operand}PATH`,
111
- short: tr("Read a data file or directory"),
108
+ short: t("commands.data.read.description"),
112
109
  args: [before + 1, before + 1],
113
110
  options: { output: {
114
111
  type: "string",
115
112
  value: "PATH",
116
- help: tr("destination")
113
+ help: t("commands.data.read.output")
117
114
  } },
118
115
  run: readFile(target)
119
116
  });
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","names":[],"sources":["../../../../src/cli/commands/data/read.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { UsageError } from \"../../../client\";\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { operandCount } from \"./operand\";\n\nclass FileSink {\n declare root: string;\n files = new Map();\n saved = 0;\n\n constructor(root) {\n this.root = root;\n }\n\n target(name) {\n const target = path.resolve(this.root, ...name.split(\"/\"));\n const relative = path.relative(path.resolve(this.root), target);\n if (\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ) {\n throw new Error(\n `the server sent the path ${name}, which leaves the output directory`,\n );\n }\n return target;\n }\n\n begin(name, directory) {\n const target = this.target(name);\n if (directory) {\n fs.mkdirSync(target, { recursive: true });\n return;\n }\n fs.mkdirSync(path.dirname(target), { recursive: true });\n const previous = this.files.get(name);\n if (previous !== undefined) {\n fs.closeSync(previous);\n }\n this.files.set(name, fs.openSync(target, \"w\"));\n this.saved++;\n }\n\n write(name, offset, data) {\n const file = this.files.get(name);\n if (file === undefined) {\n throw new Error(`the server sent data for ${name} before announcing it`);\n }\n fs.writeSync(file, data, 0, data.length, Number(offset));\n }\n\n close() {\n for (const file of this.files.values()) {\n fs.closeSync(file);\n }\n }\n}\n\nconst printSaved = (target, count) =>\n console.error(\n tr(\n {\n one: \"saved {count} file to {path}\",\n other: \"saved {count} files to {path}\",\n },\n { count, path: target },\n ),\n );\n\nconst readFile = (target) => (context) =>\n session(context, async (client) => {\n const {\n id,\n wholeDirectory,\n subdirectory,\n args: [given],\n } = target(context.args);\n const output = context.options.output ?? \"\";\n const requested = path.posix\n .normalize(`/${given}`)\n .replace(/^\\/+|\\/+$/g, \"\");\n const printing = output === \"\" || output === \"-\";\n const directory = () =>\n new UsageError(\n requested === \"\"\n ? wholeDirectory(JSON.stringify(given))\n : subdirectory(JSON.stringify(requested)),\n );\n const relativeTo = (name) =>\n name.slice(requested.length).replace(/^\\//, \"\");\n let sink;\n let single;\n const contents = [];\n try {\n for await (const response of client.swiplets.readDataFile(\n { swipletId: id, path: given },\n { signal: context.signal },\n )) {\n if (response.part.case === \"file\") {\n const file = response.part.value;\n if (file.path === requested && !file.directory) {\n single = file;\n continue;\n }\n if (!sink) {\n if (printing) {\n throw directory();\n }\n sink = new FileSink(output);\n }\n sink.begin(relativeTo(file.path), file.directory);\n } else if (response.part.case === \"chunk\") {\n const chunk = response.part.value;\n if (single && chunk.path === single.path) {\n contents.push(chunk.data);\n continue;\n }\n if (!sink) {\n throw new Error(\n `the server sent data for ${chunk.path} before announcing it`,\n );\n }\n sink.write(relativeTo(chunk.path), chunk.offset, chunk.data);\n }\n }\n } finally {\n sink?.close();\n }\n if (sink) {\n printSaved(sink.root, sink.saved);\n return;\n }\n if (!single) {\n if (printing) {\n throw directory();\n }\n fs.mkdirSync(output, { recursive: true });\n printSaved(output, 0);\n return;\n }\n const data = Buffer.concat(contents);\n if (printing) {\n process.stdout.write(data);\n return;\n }\n let destination = output;\n if (fs.existsSync(destination) && fs.statSync(destination).isDirectory()) {\n destination = path.join(destination, path.posix.basename(single.path));\n }\n fs.writeFileSync(destination, data);\n printSaved(destination, 1);\n });\n\nexport const read = (operand, target) => {\n const before = operandCount(operand);\n return defineCommand({\n name: \"read\",\n use: `read ${operand}PATH`,\n short: tr(\"Read a data file or directory\"),\n args: [before + 1, before + 1],\n options: {\n output: { type: \"string\", value: \"PATH\", help: tr(\"destination\") },\n },\n run: readFile(target),\n });\n};\n"],"mappings":";;;;;;;;AASA,IAAM,WAAN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,WAAW,KAAK,MAAM,KAAK,KAAK;EAChC;CACF;CACA,IAAI,CAAC,QAAQ;EACX,IAAI,UACF,MAAM,UAAU;EAElB,GAAG,UAAU,QAAQ,EAAE,WAAW,KAAK,CAAC;EACxC,WAAW,QAAQ,CAAC;EACpB;CACF;CACA,MAAM,OAAO,OAAO,OAAO,QAAQ;CACnC,IAAI,UAAU;EACZ,QAAQ,OAAO,MAAM,IAAI;EACzB;CACF;CACA,IAAI,cAAc;CAClB,IAAI,GAAG,WAAW,WAAW,KAAK,GAAG,SAAS,WAAW,CAAC,CAAC,YAAY,GACrE,cAAc,KAAK,KAAK,aAAa,KAAK,MAAM,SAAS,OAAO,IAAI,CAAC;CAEvE,GAAG,cAAc,aAAa,IAAI;CAClC,WAAW,aAAa,CAAC;AAC3B,CAAC;AAEH,MAAa,QAAQ,SAAS,WAAW;CACvC,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,cAAc;EACnB,MAAM;EACN,KAAK,QAAQ,QAAQ;EACrB,OAAO,GAAG,+BAA+B;EACzC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;EAC7B,SAAS,EACP,QAAQ;GAAE,MAAM;GAAU,OAAO;GAAQ,MAAM,GAAG,aAAa;EAAE,EACnE;EACA,KAAK,SAAS,MAAM;CACtB,CAAC;AACH"}
1
+ {"version":3,"file":"read.js","names":[],"sources":["../../../../src/cli/commands/data/read.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { UsageError } from \"../../../client\";\nimport { t } from \"../../../i18n\";\nimport type { FileInfo } from \"../../../proto/common_pb\";\nimport { type Context, defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { type ResolveTarget, operandCount } from \"./operand\";\n\nclass FileSink {\n declare root: string;\n files = new Map<string, number>();\n saved = 0;\n\n constructor(root: string) {\n this.root = root;\n }\n\n target(name: string) {\n const target = path.resolve(this.root, ...name.split(\"/\"));\n const relative = path.relative(path.resolve(this.root), target);\n if (\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ) {\n throw new Error(\n `the server sent the path ${name}, which leaves the output directory`,\n );\n }\n return target;\n }\n\n begin(name: string, directory: boolean) {\n const target = this.target(name);\n if (directory) {\n fs.mkdirSync(target, { recursive: true });\n return;\n }\n fs.mkdirSync(path.dirname(target), { recursive: true });\n const previous = this.files.get(name);\n if (previous !== undefined) {\n fs.closeSync(previous);\n }\n this.files.set(name, fs.openSync(target, \"w\"));\n this.saved++;\n }\n\n write(name: string, offset: bigint, data: Uint8Array) {\n const file = this.files.get(name);\n if (file === undefined) {\n throw new Error(`the server sent data for ${name} before announcing it`);\n }\n fs.writeSync(file, data, 0, data.length, Number(offset));\n }\n\n close() {\n for (const file of this.files.values()) {\n fs.closeSync(file);\n }\n }\n}\n\nconst printSaved = (target: string, count: number) =>\n console.error(t(\"commands.data.read.saved\", { count, path: target }));\n\nconst readFile =\n (target: ResolveTarget) =>\n (context: Context<{ device?: string; output?: string }>) =>\n session(context, async (client) => {\n const {\n id,\n wholeDirectory,\n subdirectory,\n args: [given],\n } = target(context.args);\n const output = context.options.output ?? \"\";\n const requested = path.posix\n .normalize(`/${given}`)\n .replace(/^\\/+|\\/+$/g, \"\");\n const printing = output === \"\" || output === \"-\";\n const directory = () =>\n new UsageError(\n requested === \"\"\n ? wholeDirectory(JSON.stringify(given))\n : subdirectory(JSON.stringify(requested)),\n );\n const relativeTo = (name: string) =>\n name.slice(requested.length).replace(/^\\//, \"\");\n let sink: FileSink | undefined;\n let single: FileInfo | undefined;\n const contents: Uint8Array[] = [];\n try {\n for await (const response of client.swiplets.readDataFile(\n { swipletId: id, path: given },\n { signal: context.signal },\n )) {\n if (response.part.case === \"file\") {\n const file = response.part.value;\n if (file.path === requested && !file.directory) {\n single = file;\n continue;\n }\n if (!sink) {\n if (printing) {\n throw directory();\n }\n sink = new FileSink(output);\n }\n sink.begin(relativeTo(file.path), file.directory);\n } else if (response.part.case === \"chunk\") {\n const chunk = response.part.value;\n if (single && chunk.path === single.path) {\n contents.push(chunk.data);\n continue;\n }\n if (!sink) {\n throw new Error(\n `the server sent data for ${chunk.path} before announcing it`,\n );\n }\n sink.write(relativeTo(chunk.path), chunk.offset, chunk.data);\n }\n }\n } finally {\n sink?.close();\n }\n if (sink) {\n printSaved(sink.root, sink.saved);\n return;\n }\n if (!single) {\n if (printing) {\n throw directory();\n }\n fs.mkdirSync(output, { recursive: true });\n printSaved(output, 0);\n return;\n }\n const data = Buffer.concat(contents);\n if (printing) {\n process.stdout.write(data);\n return;\n }\n let destination = output;\n if (\n fs.existsSync(destination) &&\n fs.statSync(destination).isDirectory()\n ) {\n destination = path.join(destination, path.posix.basename(single.path));\n }\n fs.writeFileSync(destination, data);\n printSaved(destination, 1);\n });\n\nexport const read = (operand: string, target: ResolveTarget) => {\n const before = operandCount(operand);\n return defineCommand({\n name: \"read\",\n use: `read ${operand}PATH`,\n short: t(\"commands.data.read.description\"),\n args: [before + 1, before + 1],\n options: {\n output: {\n type: \"string\",\n value: \"PATH\",\n help: t(\"commands.data.read.output\"),\n },\n },\n run: readFile(target),\n });\n};\n"],"mappings":";;;;;;;;AAUA,IAAM,WAAN,MAAe;CAEb,wBAAQ,IAAI,IAAoB;CAChC,QAAQ;CAER,YAAY,MAAc;EACxB,KAAK,OAAO;CACd;CAEA,OAAO,MAAc;EACnB,MAAM,SAAS,KAAK,QAAQ,KAAK,MAAM,GAAG,KAAK,MAAM,GAAG,CAAC;EACzD,MAAM,WAAW,KAAK,SAAS,KAAK,QAAQ,KAAK,IAAI,GAAG,MAAM;EAC9D,IACE,aAAa,QACb,SAAS,WAAW,KAAK,KAAK,KAAK,KACnC,KAAK,WAAW,QAAQ,GAExB,MAAM,IAAI,MACR,4BAA4B,KAAK,oCACnC;EAEF,OAAO;CACT;CAEA,MAAM,MAAc,WAAoB;EACtC,MAAM,SAAS,KAAK,OAAO,IAAI;EAC/B,IAAI,WAAW;GACb,GAAG,UAAU,QAAQ,EAAE,WA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SAAiB,WAA0B;CAC9D,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,cAAc;EACnB,MAAM;EACN,KAAK,QAAQ,QAAQ;EACrB,OAAO,EAAE,gCAAgC;EACzC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;EAC7B,SAAS,EACP,QAAQ;GACN,MAAM;GACN,OAAO;GACP,MAAM,EAAE,2BAA2B;EACrC,EACF;EACA,KAAK,SAAS,MAAM;CACtB,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import { tr } from "../../../i18n.js";
1
+ import { t } from "../../../i18n.js";
2
2
  import { defineCommand } from "../../command.js";
3
3
  import { session } from "../../session.js";
4
4
  import { operandCount } from "./operand.js";
@@ -16,11 +16,11 @@ const remove = (operand, target) => {
16
16
  return defineCommand({
17
17
  name: "remove",
18
18
  use: `remove ${operand}PATH`,
19
- short: tr("Remove a data file"),
19
+ short: t("commands.data.remove.description"),
20
20
  args: [before + 1, before + 1],
21
21
  options: { recursive: {
22
22
  type: "boolean",
23
- help: tr("include directory contents")
23
+ help: t("commands.data.remove.recursive")
24
24
  } },
25
25
  run: removeFile(target)
26
26
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove.js","names":[],"sources":["../../../../src/cli/commands/data/remove.ts"],"sourcesContent":["import { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { operandCount } from \"./operand\";\n\nconst removeFile = (target) => (context) =>\n session(context, async (client) => {\n const {\n id,\n args: [name],\n } = target(context.args);\n await client.swiplets.removeDataFile(\n { swipletId: id, path: name, recursive: context.options.recursive },\n { signal: context.signal },\n );\n });\n\nexport const remove = (operand, target) => {\n const before = operandCount(operand);\n return defineCommand({\n name: \"remove\",\n use: `remove ${operand}PATH`,\n short: tr(\"Remove a data file\"),\n args: [before + 1, before + 1],\n options: {\n recursive: {\n type: \"boolean\",\n help: tr(\"include directory contents\"),\n },\n },\n run: removeFile(target),\n });\n};\n"],"mappings":";;;;;AAKA,MAAM,cAAc,YAAY,YAC9B,QAAQ,SAAS,OAAO,WAAW;CACjC,MAAM,EACJ,IACA,MAAM,CAAC,UACL,OAAO,QAAQ,IAAI;CACvB,MAAM,OAAO,SAAS,eACpB;EAAE,WAAW;EAAI,MAAM;EAAM,WAAW,QAAQ,QAAQ;CAAU,GAClE,EAAE,QAAQ,QAAQ,OAAO,CAC3B;AACF,CAAC;AAEH,MAAa,UAAU,SAAS,WAAW;CACzC,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,cAAc;EACnB,MAAM;EACN,KAAK,UAAU,QAAQ;EACvB,OAAO,GAAG,oBAAoB;EAC9B,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;EAC7B,SAAS,EACP,WAAW;GACT,MAAM;GACN,MAAM,GAAG,4BAA4B;EACvC,EACF;EACA,KAAK,WAAW,MAAM;CACxB,CAAC;AACH"}
1
+ {"version":3,"file":"remove.js","names":[],"sources":["../../../../src/cli/commands/data/remove.ts"],"sourcesContent":["import { t } from \"../../../i18n\";\nimport { type Context, defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { type ResolveTarget, operandCount } from \"./operand\";\n\nconst removeFile =\n (target: ResolveTarget) =>\n (context: Context<{ device?: string; recursive?: boolean }>) =>\n session(context, async (client) => {\n const {\n id,\n args: [name],\n } = target(context.args);\n await client.swiplets.removeDataFile(\n { swipletId: id, path: name, recursive: context.options.recursive },\n { signal: context.signal },\n );\n });\n\nexport const remove = (operand: string, target: ResolveTarget) => {\n const before = operandCount(operand);\n return defineCommand({\n name: \"remove\",\n use: `remove ${operand}PATH`,\n short: t(\"commands.data.remove.description\"),\n args: [before + 1, before + 1],\n options: {\n recursive: {\n type: \"boolean\",\n help: t(\"commands.data.remove.recursive\"),\n },\n },\n run: removeFile(target),\n });\n};\n"],"mappings":";;;;;AAKA,MAAM,cACH,YACA,YACC,QAAQ,SAAS,OAAO,WAAW;CACjC,MAAM,EACJ,IACA,MAAM,CAAC,UACL,OAAO,QAAQ,IAAI;CACvB,MAAM,OAAO,SAAS,eACpB;EAAE,WAAW;EAAI,MAAM;EAAM,WAAW,QAAQ,QAAQ;CAAU,GAClE,EAAE,QAAQ,QAAQ,OAAO,CAC3B;AACF,CAAC;AAEL,MAAa,UAAU,SAAiB,WAA0B;CAChE,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,cAAc;EACnB,MAAM;EACN,KAAK,UAAU,QAAQ;EACvB,OAAO,EAAE,kCAAkC;EAC3C,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;EAC7B,SAAS,EACP,WAAW;GACT,MAAM;GACN,MAAM,EAAE,gCAAgC;EAC1C,EACF;EACA,KAAK,WAAW,MAAM;CACxB,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import { tr } from "../../../i18n.js";
1
+ import { t } from "../../../i18n.js";
2
2
  import { defineCommand } from "../../command.js";
3
3
  import { readStdin, uploadChunk } from "../../io.js";
4
4
  import { session } from "../../session.js";
@@ -27,7 +27,7 @@ const write = (operand, target) => {
27
27
  return defineCommand({
28
28
  name: "write",
29
29
  use: `write ${operand}PATH [FILE | -]`,
30
- short: tr("Write a data file"),
30
+ short: t("commands.data.write.description"),
31
31
  args: [before + 1, before + 2],
32
32
  run: writeFile(target)
33
33
  });
@@ -1 +1 @@
1
- {"version":3,"file":"write.js","names":[],"sources":["../../../../src/cli/commands/data/write.ts"],"sourcesContent":["import fs from \"node:fs\";\n\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { readStdin, uploadChunk } from \"../../io\";\nimport { session } from \"../../session\";\nimport { operandCount } from \"./operand\";\n\nconst writeFile = (target) => (context) =>\n session(context, async (client) => {\n const {\n id,\n args: [name, file],\n } = target(context.args);\n const data =\n file === undefined || file === \"-\" ? readStdin() : fs.readFileSync(file);\n await client.swiplets.writeDataFile(\n (async function* () {\n yield {\n part: { case: \"header\", value: { swipletId: id, path: name } },\n };\n for (let offset = 0; offset < data.length; offset += uploadChunk) {\n yield {\n part: {\n case: \"data\",\n value: data.subarray(offset, offset + uploadChunk),\n },\n };\n }\n })(),\n { signal: context.signal },\n );\n });\n\nexport const write = (operand, target) => {\n const before = operandCount(operand);\n return defineCommand({\n name: \"write\",\n use: `write ${operand}PATH [FILE | -]`,\n short: tr(\"Write a data file\"),\n args: [before + 1, before + 2],\n run: writeFile(target),\n });\n};\n"],"mappings":";;;;;;;AAQA,MAAM,aAAa,YAAY,YAC7B,QAAQ,SAAS,OAAO,WAAW;CACjC,MAAM,EACJ,IACA,MAAM,CAAC,MAAM,UACX,OAAO,QAAQ,IAAI;CACvB,MAAM,OACJ,SAAS,KAAA,KAAa,SAAS,MAAM,UAAU,IAAI,GAAG,aAAa,IAAI;CACzE,MAAM,OAAO,SAAS,eACnB,mBAAmB;EAClB,MAAM,EACJ,MAAM;GAAE,MAAM;GAAU,OAAO;IAAE,WAAW;IAAI,MAAM;GAAK;EAAE,EAC/D;EACA,KAAK,IAAI,SAAS,GAAG,SAAS,KAAK,QAAQ,UAAU,aACnD,MAAM,EACJ,MAAM;GACJ,MAAM;GACN,OAAO,KAAK,SAAS,QAAQ,SAAS,WAAW;EACnD,EACF;CAEJ,EAAA,CAAG,GACH,EAAE,QAAQ,QAAQ,OAAO,CAC3B;AACF,CAAC;AAEH,MAAa,SAAS,SAAS,WAAW;CACxC,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,cAAc;EACnB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,OAAO,GAAG,mBAAmB;EAC7B,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;EAC7B,KAAK,UAAU,MAAM;CACvB,CAAC;AACH"}
1
+ {"version":3,"file":"write.js","names":[],"sources":["../../../../src/cli/commands/data/write.ts"],"sourcesContent":["import fs from \"node:fs\";\n\nimport { t } from \"../../../i18n\";\nimport { type Context, defineCommand } from \"../../command\";\nimport { readStdin, uploadChunk } from \"../../io\";\nimport { session } from \"../../session\";\nimport { type ResolveTarget, operandCount } from \"./operand\";\n\nconst writeFile =\n (target: ResolveTarget) => (context: Context<{ device?: string }>) =>\n session(context, async (client) => {\n const {\n id,\n args: [name, file],\n } = target(context.args);\n const data =\n file === undefined || file === \"-\"\n ? readStdin()\n : fs.readFileSync(file);\n await client.swiplets.writeDataFile(\n (async function* () {\n yield {\n part: { case: \"header\", value: { swipletId: id, path: name } },\n };\n for (let offset = 0; offset < data.length; offset += uploadChunk) {\n yield {\n part: {\n case: \"data\",\n value: data.subarray(offset, offset + uploadChunk),\n },\n };\n }\n })(),\n { signal: context.signal },\n );\n });\n\nexport const write = (operand: string, target: ResolveTarget) => {\n const before = operandCount(operand);\n return defineCommand({\n name: \"write\",\n use: `write ${operand}PATH [FILE | -]`,\n short: t(\"commands.data.write.description\"),\n args: [before + 1, before + 2],\n run: writeFile(target),\n });\n};\n"],"mappings":";;;;;;;AAQA,MAAM,aACH,YAA2B,YAC1B,QAAQ,SAAS,OAAO,WAAW;CACjC,MAAM,EACJ,IACA,MAAM,CAAC,MAAM,UACX,OAAO,QAAQ,IAAI;CACvB,MAAM,OACJ,SAAS,KAAA,KAAa,SAAS,MAC3B,UAAU,IACV,GAAG,aAAa,IAAI;CAC1B,MAAM,OAAO,SAAS,eACnB,mBAAmB;EAClB,MAAM,EACJ,MAAM;GAAE,MAAM;GAAU,OAAO;IAAE,WAAW;IAAI,MAAM;GAAK;EAAE,EAC/D;EACA,KAAK,IAAI,SAAS,GAAG,SAAS,KAAK,QAAQ,UAAU,aACnD,MAAM,EACJ,MAAM;GACJ,MAAM;GACN,OAAO,KAAK,SAAS,QAAQ,SAAS,WAAW;EACnD,EACF;CAEJ,EAAA,CAAG,GACH,EAAE,QAAQ,QAAQ,OAAO,CAC3B;AACF,CAAC;AAEL,MAAa,SAAS,SAAiB,WAA0B;CAC/D,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,cAAc;EACnB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,OAAO,EAAE,iCAAiC;EAC1C,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;EAC7B,KAAK,UAAU,MAAM;CACvB,CAAC;AACH"}
@@ -1,11 +1,11 @@
1
1
  import { add as add$1 } from "../../../connection.js";
2
- import { tr } from "../../../i18n.js";
2
+ import { t } from "../../../i18n.js";
3
3
  import { defineCommand } from "../../command.js";
4
4
  // src/cli/commands/device/add.ts
5
5
  const add = defineCommand({
6
6
  name: "add",
7
7
  use: "add URL",
8
- short: tr("Add a device by its URL; needed when it's remote or requires a token"),
8
+ short: t("commands.device.add.description"),
9
9
  args: [1, 1],
10
10
  run: add$1
11
11
  });
@@ -1 +1 @@
1
- {"version":3,"file":"add.js","names":["connection.add"],"sources":["../../../../src/cli/commands/device/add.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const add = defineCommand({\n name: \"add\",\n use: \"add URL\",\n short: tr(\n \"Add a device by its URL; needed when it's remote or requires a token\",\n ),\n args: [1, 1],\n run: connection.add,\n});\n"],"mappings":";;;;AAIA,MAAa,MAAM,cAAc;CAC/B,MAAM;CACN,KAAK;CACL,OAAO,GACL,sEACF;CACA,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
1
+ {"version":3,"file":"add.js","names":["connection.add"],"sources":["../../../../src/cli/commands/device/add.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { t } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const add = defineCommand({\n name: \"add\",\n use: \"add URL\",\n short: t(\"commands.device.add.description\"),\n args: [1, 1],\n run: connection.add,\n});\n"],"mappings":";;;;AAIA,MAAa,MAAM,cAAc;CAC/B,MAAM;CACN,KAAK;CACL,OAAO,EAAE,iCAAiC;CAC1C,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
@@ -1,4 +1,4 @@
1
- import { tr } from "../../../i18n.js";
1
+ import { t } from "../../../i18n.js";
2
2
  import { defineCommand } from "../../command.js";
3
3
  import { add } from "./add.js";
4
4
  import { list } from "./list.js";
@@ -8,7 +8,7 @@ import { stop } from "./stop.js";
8
8
  // src/cli/commands/device/device.ts
9
9
  const device = defineCommand({
10
10
  name: "device",
11
- short: tr("Manage the devices and read their logs"),
11
+ short: t("commands.device.description"),
12
12
  commands: [
13
13
  list,
14
14
  add,
@@ -1 +1 @@
1
- {"version":3,"file":"device.js","names":[],"sources":["../../../../src/cli/commands/device/device.ts"],"sourcesContent":["import { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { add } from \"./add\";\nimport { list } from \"./list\";\nimport { logs } from \"./logs\";\nimport { remove } from \"./remove\";\nimport { stop } from \"./stop\";\n\nexport const device = defineCommand({\n name: \"device\",\n short: tr(\"Manage the devices and read their logs\"),\n commands: [list, add, remove, stop, logs],\n});\n"],"mappings":";;;;;;;;AAQA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,OAAO,GAAG,wCAAwC;CAClD,UAAU;EAAC;EAAM;EAAK;EAAQ;EAAM;CAAI;AAC1C,CAAC"}
1
+ {"version":3,"file":"device.js","names":[],"sources":["../../../../src/cli/commands/device/device.ts"],"sourcesContent":["import { t } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { add } from \"./add\";\nimport { list } from \"./list\";\nimport { logs } from \"./logs\";\nimport { remove } from \"./remove\";\nimport { stop } from \"./stop\";\n\nexport const device = defineCommand({\n name: \"device\",\n short: t(\"commands.device.description\"),\n commands: [list, add, remove, stop, logs],\n});\n"],"mappings":";;;;;;;;AAQA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,OAAO,EAAE,6BAA6B;CACtC,UAAU;EAAC;EAAM;EAAK;EAAQ;EAAM;CAAI;AAC1C,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { list as list$1 } from "../../../connection.js";
2
- import { tr } from "../../../i18n.js";
2
+ import { t } from "../../../i18n.js";
3
3
  import { defineCommand } from "../../command.js";
4
4
  // src/cli/commands/device/list.ts
5
5
  const list = defineCommand({
6
6
  name: "list",
7
- short: tr("List the devices, adding the ones found on the local network"),
7
+ short: t("commands.device.list.description"),
8
8
  args: [0, 0],
9
9
  run: list$1
10
10
  });
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","names":["connection.list"],"sources":["../../../../src/cli/commands/device/list.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const list = defineCommand({\n name: \"list\",\n short: tr(\"List the devices, adding the ones found on the local network\"),\n args: [0, 0],\n run: connection.list,\n});\n"],"mappings":";;;;AAIA,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,GAAG,8DAA8D;CACxE,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
1
+ {"version":3,"file":"list.js","names":["connection.list"],"sources":["../../../../src/cli/commands/device/list.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { t } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const list = defineCommand({\n name: \"list\",\n short: t(\"commands.device.list.description\"),\n args: [0, 0],\n run: connection.list,\n});\n"],"mappings":";;;;AAIA,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,EAAE,kCAAkC;CAC3C,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
@@ -1,102 +1,100 @@
1
1
  import { UsageError } from "../../../client.js";
2
- import { tr } from "../../../i18n.js";
2
+ import { t } from "../../../i18n.js";
3
3
  import { printLog } from "../../../output.js";
4
+ import { LogEntrySchema } from "../../../proto/common_pb.js";
4
5
  import { defineCommand } from "../../command.js";
5
6
  import { session } from "../../session.js";
6
7
  import { deviceOption } from "../flags.js";
8
+ import { create } from "@bufbuild/protobuf";
7
9
  import { timestampFromMs } from "@bufbuild/protobuf/wkt";
8
10
  // src/cli/commands/device/logs.ts
9
- const durationUnits = {
10
- ns: 1e-6,
11
- us: .001,
12
- µs: .001,
13
- ms: 1,
14
- s: 1e3,
15
- m: 6e4,
16
- h: 36e5
17
- };
11
+ const durationUnits = /* @__PURE__ */ new Map([
12
+ ["ns", 1e-6],
13
+ ["us", .001],
14
+ ["µs", .001],
15
+ ["ms", 1],
16
+ ["s", 1e3],
17
+ ["m", 6e4],
18
+ ["h", 36e5]
19
+ ]);
20
+ const levels = /* @__PURE__ */ new Map([
21
+ ["error", 1],
22
+ ["warn", 2],
23
+ ["info", 3],
24
+ ["debug", 4]
25
+ ]);
18
26
  function parseDuration(text, option) {
19
27
  if (text === void 0) return 0;
20
28
  if (/^-?\d+$/.test(text) && Number(text) === 0) return 0;
21
29
  let total = 0;
22
30
  let rest = text;
23
31
  while (rest !== "") {
24
- const match = /^(\d+(?:\.\d*)?|\.\d+)(ns|us|µs|ms|s|m|h)/.exec(rest);
25
- if (!match) throw new UsageError(tr("invalid argument {value} for {option}: it's a duration such as 30s or 1m30s", {
32
+ const match = /^(\d+(?:\.\d*)?|\.\d+)([^\d.]+)/.exec(rest);
33
+ const unit = match === null ? void 0 : durationUnits.get(match[2]);
34
+ if (match === null || unit === void 0) throw new UsageError(t("commands.device.logs.invalidDuration", {
26
35
  value: JSON.stringify(text),
27
36
  option
28
37
  }));
29
- total += Number(match[1]) * durationUnits[match[2]];
38
+ total += Number(match[1]) * unit;
30
39
  rest = rest.slice(match[0].length);
31
40
  }
32
41
  return total;
33
42
  }
34
43
  function parseCount(text, option) {
35
44
  if (text === void 0) return;
36
- if (!/^\d+$/.test(text) || Number(text) > 4294967295) throw new UsageError(tr("invalid argument {value} for {option}: it's a number", {
45
+ if (!/^\d+$/.test(text) || Number(text) > 4294967295) throw new UsageError(t("commands.device.logs.invalidNumber", {
37
46
  value: JSON.stringify(text),
38
47
  option
39
48
  }));
40
49
  return Number(text);
41
50
  }
42
- const readLogs = (context) => session(context, async (client) => {
51
+ async function readLogs(context) {
43
52
  const { options } = context;
44
- const index = [
45
- "error",
46
- "warn",
47
- "info",
48
- "debug"
49
- ].indexOf(options.level);
50
- if (index < 0) throw new UsageError(tr("--level is error, warn, info or debug"));
51
- const request = {
52
- follow: options.follow,
53
- tail: options.tail ?? 100,
54
- swipletId: options.swiplet ?? "",
55
- level: index + 1
56
- };
57
- if (options.since > 0) {
58
- request.since = timestampFromMs(Date.now() - options.since);
59
- if (options.tail === void 0) request.tail = 4294967295;
60
- }
61
- for await (const response of client.logs.readLogs(request, { signal: context.signal })) printLog(response.entry, true);
62
- });
53
+ const tail = parseCount(options.tail, "--tail");
54
+ const since = parseDuration(options.since, "--since");
55
+ const level = levels.get(options.level ?? "info");
56
+ if (level === void 0) throw new UsageError(t("commands.device.logs.invalidLevel"));
57
+ await session(context, async (client) => {
58
+ for await (const response of client.logs.readLogs({
59
+ follow: options.follow,
60
+ tail: tail ?? (since > 0 ? 4294967295 : 100),
61
+ swipletId: options.swiplet ?? "",
62
+ level,
63
+ since: since > 0 ? timestampFromMs(Date.now() - since) : void 0
64
+ }, { signal: context.signal })) printLog(response.entry ?? create(LogEntrySchema), true);
65
+ });
66
+ }
63
67
  const logs = defineCommand({
64
68
  name: "logs",
65
- short: tr("Print the logs"),
69
+ short: t("commands.device.logs.description"),
66
70
  args: [0, 0],
67
71
  options: {
68
72
  ...deviceOption,
69
73
  follow: {
70
74
  type: "boolean",
71
- help: tr("follow new entries")
75
+ help: t("commands.device.logs.follow")
72
76
  },
73
77
  tail: {
74
78
  type: "string",
75
79
  value: "COUNT",
76
- help: tr("number of past entries (default 100)")
80
+ help: t("commands.device.logs.count")
77
81
  },
78
82
  since: {
79
83
  type: "string",
80
84
  value: "DURATION",
81
- help: tr("maximum age")
85
+ help: t("commands.device.logs.since")
82
86
  },
83
87
  level: {
84
88
  type: "string",
85
89
  value: "LEVEL",
86
- help: tr("minimum level (default info)")
90
+ help: t("commands.device.logs.level")
87
91
  },
88
92
  swiplet: {
89
93
  type: "string",
90
94
  value: "ID",
91
- help: tr("swiplet ID")
95
+ help: t("commands.device.logs.swiplet")
92
96
  }
93
97
  },
94
- parse: (options) => ({
95
- ...options,
96
- tail: parseCount(options.tail, "--tail"),
97
- since: parseDuration(options.since, "--since"),
98
- level: options.level ?? "info"
99
- }),
100
98
  run: readLogs
101
99
  });
102
100
  export { logs };
@@ -1 +1 @@
1
- {"version":3,"file":"logs.js","names":[],"sources":["../../../../src/cli/commands/device/logs.ts"],"sourcesContent":["import { timestampFromMs } from \"@bufbuild/protobuf/wkt\";\n\nimport { UsageError } from \"../../../client\";\nimport { tr } from \"../../../i18n\";\nimport { printLog } from \"../../../output\";\nimport { defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { deviceOption } from \"../flags\";\n\nconst durationUnits = {\n ns: 1e-6,\n us: 1e-3,\n µs: 1e-3,\n ms: 1,\n s: 1000,\n m: 60_000,\n h: 3_600_000,\n};\n\nfunction parseDuration(text, option) {\n if (text === undefined) {\n return 0;\n }\n if (/^-?\\d+$/.test(text) && Number(text) === 0) {\n return 0;\n }\n let total = 0;\n let rest = text;\n while (rest !== \"\") {\n const match = /^(\\d+(?:\\.\\d*)?|\\.\\d+)(ns|us|µs|ms|s|m|h)/.exec(rest);\n if (!match) {\n throw new UsageError(\n tr(\n \"invalid argument {value} for {option}: it's a duration such as 30s or 1m30s\",\n { value: JSON.stringify(text), option },\n ),\n );\n }\n total += Number(match[1]) * durationUnits[match[2]];\n rest = rest.slice(match[0].length);\n }\n return total;\n}\n\nfunction parseCount(text, option) {\n if (text === undefined) {\n return undefined;\n }\n if (!/^\\d+$/.test(text) || Number(text) > 0xffffffff) {\n throw new UsageError(\n tr(\"invalid argument {value} for {option}: it's a number\", {\n value: JSON.stringify(text),\n option,\n }),\n );\n }\n return Number(text);\n}\n\nconst readLogs = (context) =>\n session(context, async (client) => {\n const { options } = context;\n const levels = [\"error\", \"warn\", \"info\", \"debug\"];\n const index = levels.indexOf(options.level);\n if (index < 0) {\n throw new UsageError(tr(\"--level is error, warn, info or debug\"));\n }\n const request: Record<string, any> = {\n follow: options.follow,\n tail: options.tail ?? 100,\n swipletId: options.swiplet ?? \"\",\n level: index + 1,\n };\n if (options.since > 0) {\n request.since = timestampFromMs(Date.now() - options.since);\n if (options.tail === undefined) {\n request.tail = 0xffffffff;\n }\n }\n for await (const response of client.logs.readLogs(request, {\n signal: context.signal,\n })) {\n printLog(response.entry, true);\n }\n });\n\nexport const logs = defineCommand({\n name: \"logs\",\n short: tr(\"Print the logs\"),\n args: [0, 0],\n options: {\n ...deviceOption,\n follow: { type: \"boolean\", help: tr(\"follow new entries\") },\n tail: {\n type: \"string\",\n value: \"COUNT\",\n help: tr(\"number of past entries (default 100)\"),\n },\n since: { type: \"string\", value: \"DURATION\", help: tr(\"maximum age\") },\n level: {\n type: \"string\",\n value: \"LEVEL\",\n help: tr(\"minimum level (default info)\"),\n },\n swiplet: { type: \"string\", value: \"ID\", help: tr(\"swiplet ID\") },\n },\n parse: (options) => ({\n ...options,\n tail: parseCount(options.tail, \"--tail\"),\n since: parseDuration(options.since, \"--since\"),\n level: options.level ?? \"info\",\n }),\n run: readLogs,\n});\n"],"mappings":";;;;;;;;AASA,MAAM,gBAAgB;CACpB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;AACL;AAEA,SAAS,cAAc,MAAM,QAAQ;CACnC,IAAI,SAAS,KAAA,GACX,OAAO;CAET,IAAI,UAAU,KAAK,IAAI,KAAK,OAAO,IAAI,MAAM,GAC3C,OAAO;CAET,IAAI,QAAQ;CACZ,IAAI,OAAO;CACX,OAAO,SAAS,IAAI;EAClB,MAAM,QAAQ,4CAA4C,KAAK,IAAI;EACnE,IAAI,CAAC,OACH,MAAM,IAAI,WACR,GACE,+EACA;GAAE,OAAO,KAAK,UAAU,IAAI;GAAG;EAAO,CACxC,CACF;EAEF,SAAS,OAAO,MAAM,EAAE,IAAI,cAAc,MAAM;EAChD,OAAO,KAAK,MAAM,MAAM,EAAE,CAAC,MAAM;CACnC;CACA,OAAO;AACT;AAEA,SAAS,WAAW,MAAM,QAAQ;CAChC,IAAI,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AAY;EAAE;CACjE;CACA,QAAQ,aAAa;EACnB,GAAG;EACH,MAAM,WAAW,QAAQ,MAAM,QAAQ;EACvC,OAAO,cAAc,QAAQ,OAAO,SAAS;EAC7C,OAAO,QAAQ,SAAS;CAC1B;CACA,KAAK;AACP,CAAC"}
1
+ {"version":3,"file":"logs.js","names":[],"sources":["../../../../src/cli/commands/device/logs.ts"],"sourcesContent":["import { create } from \"@bufbuild/protobuf\";\nimport { timestampFromMs } from \"@bufbuild/protobuf/wkt\";\n\nimport { UsageError } from \"../../../client\";\nimport { t } from \"../../../i18n\";\nimport { printLog } from \"../../../output\";\nimport { LogEntrySchema, LogLevel } from \"../../../proto/common_pb\";\nimport { type Context, defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { deviceOption } from \"../flags\";\n\nconst durationUnits = new Map([\n [\"ns\", 1e-6],\n [\"us\", 1e-3],\n [\"µs\", 1e-3],\n [\"ms\", 1],\n [\"s\", 1000],\n [\"m\", 60_000],\n [\"h\", 3_600_000],\n]);\n\nconst levels = new Map([\n [\"error\", LogLevel.ERROR],\n [\"warn\", LogLevel.WARN],\n [\"info\", LogLevel.INFO],\n [\"debug\", LogLevel.DEBUG],\n]);\n\nfunction parseDuration(text: string | undefined, option: string) {\n if (text === undefined) {\n return 0;\n }\n if (/^-?\\d+$/.test(text) && Number(text) === 0) {\n return 0;\n }\n let total = 0;\n let rest = text;\n while (rest !== \"\") {\n const match = /^(\\d+(?:\\.\\d*)?|\\.\\d+)([^\\d.]+)/.exec(rest);\n const unit = match === null ? undefined : durationUnits.get(match[2]);\n if (match === null || unit === undefined) {\n throw new UsageError(\n t(\"commands.device.logs.invalidDuration\", {\n value: JSON.stringify(text),\n option,\n }),\n );\n }\n total += Number(match[1]) * unit;\n rest = rest.slice(match[0].length);\n }\n return total;\n}\n\nfunction parseCount(text: string | undefined, option: string) {\n if (text === undefined) {\n return undefined;\n }\n if (!/^\\d+$/.test(text) || Number(text) > 0xffffffff) {\n throw new UsageError(\n t(\"commands.device.logs.invalidNumber\", {\n value: JSON.stringify(text),\n option,\n }),\n );\n }\n return Number(text);\n}\n\nasync function readLogs(\n context: Context<{\n device?: string;\n follow?: boolean;\n tail?: string;\n since?: string;\n level?: string;\n swiplet?: string;\n }>,\n) {\n const { options } = context;\n const tail = parseCount(options.tail, \"--tail\");\n const since = parseDuration(options.since, \"--since\");\n const level = levels.get(options.level ?? \"info\");\n if (level === undefined) {\n throw new UsageError(t(\"commands.device.logs.invalidLevel\"));\n }\n await session(context, async (client) => {\n for await (const response of client.logs.readLogs(\n {\n follow: options.follow,\n tail: tail ?? (since > 0 ? 0xffffffff : 100),\n swipletId: options.swiplet ?? \"\",\n level,\n since: since > 0 ? timestampFromMs(Date.now() - since) : undefined,\n },\n { signal: context.signal },\n )) {\n printLog(response.entry ?? create(LogEntrySchema), true);\n }\n });\n}\n\nexport const logs = defineCommand({\n name: \"logs\",\n short: t(\"commands.device.logs.description\"),\n args: [0, 0],\n options: {\n ...deviceOption,\n follow: { type: \"boolean\", help: t(\"commands.device.logs.follow\") },\n tail: {\n type: \"string\",\n value: \"COUNT\",\n help: t(\"commands.device.logs.count\"),\n },\n since: {\n type: \"string\",\n value: \"DURATION\",\n help: t(\"commands.device.logs.since\"),\n },\n level: {\n type: \"string\",\n value: \"LEVEL\",\n help: t(\"commands.device.logs.level\"),\n },\n swiplet: {\n type: \"string\",\n value: \"ID\",\n help: t(\"commands.device.logs.swiplet\"),\n },\n },\n run: readLogs,\n});\n"],"mappings":";;;;;;;;;;AAWA,MAAM,gCAAgB,IAAI,IAAI;CAC5B,CAAC,MAAM,IAAI;CACX,CAAC,MAAM,IAAI;CACX,CAAC,MAAM,IAAI;CACX,CAAC,MAAM,CAAC;CACR,CAAC,KAAK,GAAI;CACV,CAAC,KAAK,GAAM;CACZ,CAAC,KAAK,IAAS;AACjB,CAAC;AAED,MAAM,yBAAS,IAAI,IAAI;CACrB,CAAC,SAAA,CAAuB;CACxB,CAAC,QAAA,CAAqB;CACt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ACxC,WAAW,QAAQ,WAAW;GAC9B;GACA,OAAO,QAAQ,IAAI,gBAAgB,KAAK,IAAI,IAAI,KAAK,IAAI,KAAA;EAC3D,GACA,EAAE,QAAQ,QAAQ,OAAO,CAC3B,GACE,SAAS,SAAS,SAAS,OAAO,cAAc,GAAG,IAAI;CAE3D,CAAC;AACH;AAEA,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,EAAE,kCAAkC;CAC3C,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;EACP,GAAG;EACH,QAAQ;GAAE,MAAM;GAAW,MAAM,EAAE,6BAA6B;EAAE;EAClE,MAAM;GACJ,MAAM;GACN,OAAO;GACP,MAAM,EAAE,4BAA4B;EACtC;EACA,OAAO;GACL,MAAM;GACN,OAAO;GACP,MAAM,EAAE,4BAA4B;EACtC;EACA,OAAO;GACL,MAAM;GACN,OAAO;GACP,MAAM,EAAE,4BAA4B;EACtC;EACA,SAAS;GACP,MAAM;GACN,OAAO;GACP,MAAM,EAAE,8BAA8B;EACxC;CACF;CACA,KAAK;AACP,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { remove as remove$1 } from "../../../connection.js";
2
- import { tr } from "../../../i18n.js";
2
+ import { t } from "../../../i18n.js";
3
3
  import { defineCommand } from "../../command.js";
4
4
  // src/cli/commands/device/remove.ts
5
5
  const remove = defineCommand({
6
6
  name: "remove",
7
7
  use: "remove NAME",
8
- short: tr("Forget a device"),
8
+ short: t("commands.device.remove.description"),
9
9
  args: [1, 1],
10
10
  run: remove$1
11
11
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove.js","names":["connection.remove"],"sources":["../../../../src/cli/commands/device/remove.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const remove = defineCommand({\n name: \"remove\",\n use: \"remove NAME\",\n short: tr(\"Forget a device\"),\n args: [1, 1],\n run: connection.remove,\n});\n"],"mappings":";;;;AAIA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,KAAK;CACL,OAAO,GAAG,iBAAiB;CAC3B,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
1
+ {"version":3,"file":"remove.js","names":["connection.remove"],"sources":["../../../../src/cli/commands/device/remove.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { t } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const remove = defineCommand({\n name: \"remove\",\n use: \"remove NAME\",\n short: t(\"commands.device.remove.description\"),\n args: [1, 1],\n run: connection.remove,\n});\n"],"mappings":";;;;AAIA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,KAAK;CACL,OAAO,EAAE,oCAAoC;CAC7C,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
@@ -1,15 +1,15 @@
1
- import { tr } from "../../../i18n.js";
1
+ import { t } from "../../../i18n.js";
2
2
  import { defineCommand } from "../../command.js";
3
3
  import { session } from "../../session.js";
4
4
  import { deviceOption } from "../flags.js";
5
5
  // src/cli/commands/device/stop.ts
6
6
  const stopServing = (context) => session(context, async (client) => {
7
7
  await client.system.shutdown({}, { signal: context.signal });
8
- console.log(tr("stopped"));
8
+ console.log(t("commands.device.stop.stopped"));
9
9
  });
10
10
  const stop = defineCommand({
11
11
  name: "stop",
12
- short: tr("Stop serving the Swipt API"),
12
+ short: t("commands.device.stop.description"),
13
13
  args: [0, 0],
14
14
  options: deviceOption,
15
15
  run: stopServing
@@ -1 +1 @@
1
- {"version":3,"file":"stop.js","names":[],"sources":["../../../../src/cli/commands/device/stop.ts"],"sourcesContent":["import { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { deviceOption } from \"../flags\";\n\nconst stopServing = (context) =>\n session(context, async (client) => {\n await client.system.shutdown({}, { signal: context.signal });\n console.log(tr(\"stopped\"));\n });\n\nexport const stop = defineCommand({\n name: \"stop\",\n short: tr(\"Stop serving the Swipt API\"),\n args: [0, 0],\n options: deviceOption,\n run: stopServing,\n});\n"],"mappings":";;;;;AAKA,MAAM,eAAe,YACnB,QAAQ,SAAS,OAAO,WAAW;CACjC,MAAM,OAAO,OAAO,SAAS,CAAC,GAAG,EAAE,QAAQ,QAAQ,OAAO,CAAC;CAC3D,QAAQ,IAAI,GAAG,SAAS,CAAC;AAC3B,CAAC;AAEH,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,GAAG,4BAA4B;CACtC,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;CACT,KAAK;AACP,CAAC"}
1
+ {"version":3,"file":"stop.js","names":[],"sources":["../../../../src/cli/commands/device/stop.ts"],"sourcesContent":["import { t } from \"../../../i18n\";\nimport { type Context, defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { deviceOption } from \"../flags\";\n\nconst stopServing = (context: Context<{ device?: string }>) =>\n session(context, async (client) => {\n await client.system.shutdown({}, { signal: context.signal });\n console.log(t(\"commands.device.stop.stopped\"));\n });\n\nexport const stop = defineCommand({\n name: \"stop\",\n short: t(\"commands.device.stop.description\"),\n args: [0, 0],\n options: deviceOption,\n run: stopServing,\n});\n"],"mappings":";;;;;AAKA,MAAM,eAAe,YACnB,QAAQ,SAAS,OAAO,WAAW;CACjC,MAAM,OAAO,OAAO,SAAS,CAAC,GAAG,EAAE,QAAQ,QAAQ,OAAO,CAAC;CAC3D,QAAQ,IAAI,EAAE,8BAA8B,CAAC;AAC/C,CAAC;AAEH,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,EAAE,kCAAkC;CAC3C,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;CACT,KAAK;AACP,CAAC"}
@@ -1,24 +1,24 @@
1
1
  import { run } from "../../../serve.js";
2
- import { tr } from "../../../i18n.js";
2
+ import { t } from "../../../i18n.js";
3
3
  import { defineCommand } from "../../command.js";
4
4
  import { passcodeOptions, udidDeviceOption } from "../flags.js";
5
5
  // src/cli/commands/driver/driver.ts
6
6
  const driver = defineCommand({
7
7
  name: "driver",
8
- short: tr("Serve the Swipt API and MCP for a device from this computer"),
9
- description: [tr("Only one can control the device at a time: Swipt on it, or the driver on one computer.")],
8
+ short: t("commands.driver.description"),
9
+ description: [t("commands.driver.details")],
10
10
  args: [0, 0],
11
11
  options: {
12
12
  ...udidDeviceOption,
13
- ...passcodeOptions(tr("passcode to unlock the device automatically; empty turns that off")),
13
+ ...passcodeOptions(t("commands.driver.passcode")),
14
14
  token: {
15
15
  type: "string",
16
16
  value: "TOKEN",
17
- help: tr("require this token from API clients")
17
+ help: t("commands.driver.token")
18
18
  },
19
19
  "random-token": {
20
20
  type: "boolean",
21
- help: tr("require a random token from API clients")
21
+ help: t("commands.driver.randomToken")
22
22
  }
23
23
  },
24
24
  run
@@ -1 +1 @@
1
- {"version":3,"file":"driver.js","names":["serving.run"],"sources":["../../../../src/cli/commands/driver/driver.ts"],"sourcesContent":["import * as serving from \"../../../serve\";\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { passcodeOptions, udidDeviceOption } from \"../flags\";\n\nexport const driver = defineCommand({\n name: \"driver\",\n short: tr(\"Serve the Swipt API and MCP for a device from this computer\"),\n description: [\n tr(\n \"Only one can control the device at a time: Swipt on it, or the driver on one computer.\",\n ),\n ],\n args: [0, 0],\n options: {\n ...udidDeviceOption,\n ...passcodeOptions(\n tr(\"passcode to unlock the device automatically; empty turns that off\"),\n ),\n token: {\n type: \"string\",\n value: \"TOKEN\",\n help: tr(\"require this token from API clients\"),\n },\n \"random-token\": {\n type: \"boolean\",\n help: tr(\"require a random token from API clients\"),\n },\n },\n run: serving.run,\n});\n"],"mappings":";;;;;AAKA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,OAAO,GAAG,6DAA6D;CACvE,aAAa,CACX,GACE,wFACF,CACF;CACA,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;EACP,GAAG;EACH,GAAG,gBACD,GAAG,mEAAmE,CACxE;EACA,OAAO;GACL,MAAM;GACN,OAAO;GACP,MAAM,GAAG,qCAAqC;EAChD;EACA,gBAAgB;GACd,MAAM;GACN,MAAM,GAAG,yCAAyC;EACpD;CACF;CACKA;AACP,CAAC"}
1
+ {"version":3,"file":"driver.js","names":["serving.run"],"sources":["../../../../src/cli/commands/driver/driver.ts"],"sourcesContent":["import * as serving from \"../../../serve\";\nimport { t } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { passcodeOptions, udidDeviceOption } from \"../flags\";\n\nexport const driver = defineCommand({\n name: \"driver\",\n short: t(\"commands.driver.description\"),\n description: [t(\"commands.driver.details\")],\n args: [0, 0],\n options: {\n ...udidDeviceOption,\n ...passcodeOptions(t(\"commands.driver.passcode\")),\n token: {\n type: \"string\",\n value: \"TOKEN\",\n help: t(\"commands.driver.token\"),\n },\n \"random-token\": {\n type: \"boolean\",\n help: t(\"commands.driver.randomToken\"),\n },\n },\n run: serving.run,\n});\n"],"mappings":";;;;;AAKA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,OAAO,EAAE,6BAA6B;CACtC,aAAa,CAAC,EAAE,yBAAyB,CAAC;CAC1C,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;EACP,GAAG;EACH,GAAG,gBAAgB,EAAE,0BAA0B,CAAC;EAChD,OAAO;GACL,MAAM;GACN,OAAO;GACP,MAAM,EAAE,uBAAuB;EACjC;EACA,gBAAgB;GACd,MAAM;GACN,MAAM,EAAE,6BAA6B;EACvC;CACF;CACKA;AACP,CAAC"}
@@ -1,23 +1,23 @@
1
- import { tr } from "../../i18n.js";
1
+ import { t } from "../../i18n.js";
2
2
  // src/cli/commands/flags.ts
3
3
  const deviceOption = { device: {
4
4
  type: "string",
5
5
  short: "d",
6
6
  value: "NAME|URL",
7
- help: tr("the device to use")
7
+ help: t("flags.device")
8
8
  } };
9
9
  const udidDeviceOption = { device: {
10
10
  type: "string",
11
11
  short: "d",
12
12
  value: "NAME|UDID",
13
- help: tr("the device to use")
13
+ help: t("flags.device")
14
14
  } };
15
15
  const sideloadOptions = {
16
16
  ...udidDeviceOption,
17
17
  team: {
18
18
  type: "string",
19
19
  value: "ID",
20
- help: tr("team ID, required if more than one")
20
+ help: t("flags.team")
21
21
  }
22
22
  };
23
23
  const passcodeOptions = (help) => ({
@@ -29,27 +29,27 @@ const passcodeOptions = (help) => ({
29
29
  "passcode-type": {
30
30
  type: "string",
31
31
  value: "TYPE",
32
- help: tr("pin (4 or 6 digits, default), numeric or alphanumeric")
32
+ help: t("flags.passcodeType")
33
33
  }
34
34
  });
35
35
  const nightlyOption = { nightly: {
36
36
  type: "boolean",
37
- help: tr("use nightly build")
37
+ help: t("flags.nightly")
38
38
  } };
39
39
  const setupStepOptions = {
40
40
  "no-setup-pair": {
41
41
  type: "boolean",
42
- help: tr("don't pair Swipt")
42
+ help: t("flags.noSetupPair")
43
43
  },
44
44
  "no-setup-api": {
45
45
  type: "boolean",
46
- help: tr("don't publish the API to the local network")
46
+ help: t("flags.noSetupAPI")
47
47
  }
48
48
  };
49
49
  const setupOptions = {
50
50
  "no-setup": {
51
51
  type: "boolean",
52
- help: tr("don't pair Swipt, trust its developer or publish its API")
52
+ help: t("flags.noSetup")
53
53
  },
54
54
  ...setupStepOptions
55
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"flags.js","names":[],"sources":["../../../src/cli/commands/flags.ts"],"sourcesContent":["import { tr } from \"../../i18n\";\nimport type { Options } from \"../command\";\n\nexport const deviceOption: Options = {\n device: {\n type: \"string\",\n short: \"d\",\n value: \"NAME|URL\",\n help: tr(\"the device to use\"),\n },\n};\n\nexport const udidDeviceOption: Options = {\n device: {\n type: \"string\",\n short: \"d\",\n value: \"NAME|UDID\",\n help: tr(\"the device to use\"),\n },\n};\n\nexport const sideloadOptions: Options = {\n ...udidDeviceOption,\n team: {\n type: \"string\",\n value: \"ID\",\n help: tr(\"team ID, required if more than one\"),\n },\n};\n\nexport const passcodeOptions = (help): Options => ({\n passcode: { type: \"string\", value: \"CODE\", help },\n \"passcode-type\": {\n type: \"string\",\n value: \"TYPE\",\n help: tr(\"pin (4 or 6 digits, default), numeric or alphanumeric\"),\n },\n});\n\nexport const nightlyOption: Options = {\n nightly: { type: \"boolean\", help: tr(\"use nightly build\") },\n};\n\nexport const setupStepOptions: Options = {\n \"no-setup-pair\": { type: \"boolean\", help: tr(\"don't pair Swipt\") },\n \"no-setup-api\": {\n type: \"boolean\",\n help: tr(\"don't publish the API to the local network\"),\n },\n};\n\nexport const setupOptions: Options = {\n \"no-setup\": {\n type: \"boolean\",\n help: tr(\"don't pair Swipt, trust its developer or publish its API\"),\n },\n ...setupStepOptions,\n};\n"],"mappings":";;AAGA,MAAa,eAAwB,EACnC,QAAQ;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,MAAM,GAAG,mBAAmB;AAC9B,EACF;AAEA,MAAa,mBAA4B,EACvC,QAAQ;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,MAAM,GAAG,mBAAmB;AAC9B,EACF;AAEA,MAAa,kBAA2B;CACtC,GAAG;CACH,MAAM;EACJ,MAAM;EACN,OAAO;EACP,MAAM,GAAG,oCAAoC;CAC/C;AACF;AAEA,MAAa,mBAAmB,UAAmB;CACjD,UAAU;EAAE,MAAM;EAAU,OAAO;EAAQ;CAAK;CAChD,iBAAiB;EACf,MAAM;EACN,OAAO;EACP,MAAM,GAAG,uDAAuD;CAClE;AACF;AAEA,MAAa,gBAAyB,EACpC,SAAS;CAAE,MAAM;CAAW,MAAM,GAAG,mBAAmB;AAAE,EAC5D;AAEA,MAAa,mBAA4B;CACvC,iBAAiB;EAAE,MAAM;EAAW,MAAM,GAAG,kBAAkB;CAAE;CACjE,gBAAgB;EACd,MAAM;EACN,MAAM,GAAG,4CAA4C;CACvD;AACF;AAEA,MAAa,eAAwB;CACnC,YAAY;EACV,MAAM;EACN,MAAM,GAAG,0DAA0D;CACrE;CACA,GAAG;AACL"}
1
+ {"version":3,"file":"flags.js","names":[],"sources":["../../../src/cli/commands/flags.ts"],"sourcesContent":["import { t } from \"../../i18n\";\nimport type { Options } from \"../command\";\n\nexport const deviceOption: Options = {\n device: {\n type: \"string\",\n short: \"d\",\n value: \"NAME|URL\",\n help: t(\"flags.device\"),\n },\n};\n\nexport const udidDeviceOption: Options = {\n device: {\n type: \"string\",\n short: \"d\",\n value: \"NAME|UDID\",\n help: t(\"flags.device\"),\n },\n};\n\nexport const sideloadOptions: Options = {\n ...udidDeviceOption,\n team: {\n type: \"string\",\n value: \"ID\",\n help: t(\"flags.team\"),\n },\n};\n\nexport const passcodeOptions = (help: string): Options => ({\n passcode: { type: \"string\", value: \"CODE\", help },\n \"passcode-type\": {\n type: \"string\",\n value: \"TYPE\",\n help: t(\"flags.passcodeType\"),\n },\n});\n\nexport const nightlyOption: Options = {\n nightly: { type: \"boolean\", help: t(\"flags.nightly\") },\n};\n\nexport const setupStepOptions: Options = {\n \"no-setup-pair\": { type: \"boolean\", help: t(\"flags.noSetupPair\") },\n \"no-setup-api\": {\n type: \"boolean\",\n help: t(\"flags.noSetupAPI\"),\n },\n};\n\nexport const setupOptions: Options = {\n \"no-setup\": {\n type: \"boolean\",\n help: t(\"flags.noSetup\"),\n },\n ...setupStepOptions,\n};\n"],"mappings":";;AAGA,MAAa,eAAwB,EACnC,QAAQ;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,MAAM,EAAE,cAAc;AACxB,EACF;AAEA,MAAa,mBAA4B,EACvC,QAAQ;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,MAAM,EAAE,cAAc;AACxB,EACF;AAEA,MAAa,kBAA2B;CACtC,GAAG;CACH,MAAM;EACJ,MAAM;EACN,OAAO;EACP,MAAM,EAAE,YAAY;CACtB;AACF;AAEA,MAAa,mBAAmB,UAA2B;CACzD,UAAU;EAAE,MAAM;EAAU,OAAO;EAAQ;CAAK;CAChD,iBAAiB;EACf,MAAM;EACN,OAAO;EACP,MAAM,EAAE,oBAAoB;CAC9B;AACF;AAEA,MAAa,gBAAyB,EACpC,SAAS;CAAE,MAAM;CAAW,MAAM,EAAE,eAAe;AAAE,EACvD;AAEA,MAAa,mBAA4B;CACvC,iBAAiB;EAAE,MAAM;EAAW,MAAM,EAAE,mBAAmB;CAAE;CACjE,gBAAgB;EACd,MAAM;EACN,MAAM,EAAE,kBAAkB;CAC5B;AACF;AAEA,MAAa,eAAwB;CACnC,YAAY;EACV,MAAM;EACN,MAAM,EAAE,eAAe;CACzB;CACA,GAAG;AACL"}
@@ -1,4 +1,4 @@
1
- import { tr } from "../../i18n.js";
1
+ import { t } from "../../i18n.js";
2
2
  import { defineCommand } from "../command.js";
3
3
  import { device } from "./device/device.js";
4
4
  import "./device/index.js";
@@ -17,7 +17,7 @@ import "./version/index.js";
17
17
  // src/cli/commands/index.ts
18
18
  const root = defineCommand({
19
19
  name: "swipt",
20
- short: tr("Swipt CLI"),
20
+ short: t("commands.description"),
21
21
  commands: [
22
22
  project,
23
23
  device,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["import { tr } from \"../../i18n\";\nimport { defineCommand } from \"../command\";\nimport { device } from \"./device\";\nimport { driver } from \"./driver\";\nimport { project } from \"./project\";\nimport { repl } from \"./repl\";\nimport { sideload } from \"./sideload\";\nimport { swiplet } from \"./swiplet\";\nimport { version } from \"./version\";\n\nexport const root = defineCommand({\n name: \"swipt\",\n short: tr(\"Swipt CLI\"),\n commands: [project, device, swiplet, repl, driver, sideload, version],\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,GAAG,WAAW;CACrB,UAAU;EAAC;EAAS;EAAQ;EAAS;EAAM;EAAQ;EAAU;CAAO;AACtE,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["import { t } from \"../../i18n\";\nimport { defineCommand } from \"../command\";\nimport { device } from \"./device\";\nimport { driver } from \"./driver\";\nimport { project } from \"./project\";\nimport { repl } from \"./repl\";\nimport { sideload } from \"./sideload\";\nimport { swiplet } from \"./swiplet\";\nimport { version } from \"./version\";\n\nexport const root = defineCommand({\n name: \"swipt\",\n short: t(\"commands.description\"),\n commands: [project, device, swiplet, repl, driver, sideload, version],\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,EAAE,sBAAsB;CAC/B,UAAU;EAAC;EAAS;EAAQ;EAAS;EAAM;EAAQ;EAAU;CAAO;AACtE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { tr } from "../../../i18n.js";
1
+ import { t } from "../../../i18n.js";
2
2
  import { buildProject } from "../../../project.js";
3
3
  import { defineCommand } from "../../command.js";
4
4
  import path from "node:path";
@@ -6,7 +6,7 @@ import path from "node:path";
6
6
  const build = defineCommand({
7
7
  name: "build",
8
8
  use: "build [PROJECT]",
9
- short: tr("Bundle the project into dist/<swiplet.id>.swiplet"),
9
+ short: t("commands.project.build.description"),
10
10
  args: [0, 1],
11
11
  run: async ({ args }) => {
12
12
  const { archive } = await buildProject(path.resolve(args[0] ?? "."));