stow-cli 2.2.0 → 2.2.3

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 (70) hide show
  1. package/README.md +10 -10
  2. package/dist/app-ZIHTOHXL.js +255 -0
  3. package/dist/backfill-BG65X4TP.js +65 -0
  4. package/dist/backfill-JCNPLFJU.js +67 -0
  5. package/dist/backfill-KW46AEAL.js +67 -0
  6. package/dist/backfill-VAORMLMY.js +67 -0
  7. package/dist/buckets-AFNX7FV3.js +137 -0
  8. package/dist/buckets-FPMMPRR2.js +130 -0
  9. package/dist/buckets-JJBWUVKF.js +137 -0
  10. package/dist/buckets-VYI2QVLO.js +137 -0
  11. package/dist/chunk-533UGNLM.js +42 -0
  12. package/dist/chunk-5BVMPHKH.js +147 -0
  13. package/dist/chunk-5IX3ASXH.js +153 -0
  14. package/dist/chunk-AHBVZRDR.js +29 -0
  15. package/dist/chunk-KPIQZBTO.js +151 -0
  16. package/dist/chunk-MYFLRBWC.js +312 -0
  17. package/dist/chunk-NBHBVKP5.js +54 -0
  18. package/dist/chunk-PE6V3MVP.js +46 -0
  19. package/dist/chunk-RH4BOSYB.js +153 -0
  20. package/dist/chunk-XVKIRHTX.js +29 -0
  21. package/dist/cli.js +184 -200
  22. package/dist/delete-3UDS4RMH.js +34 -0
  23. package/dist/delete-CQJEGLP3.js +34 -0
  24. package/dist/describe-CU5FBHZS.js +79 -0
  25. package/dist/describe-HSEHMJVD.js +79 -0
  26. package/dist/describe-NH3K3LLW.js +79 -0
  27. package/dist/describe-W3ED4VW3.js +79 -0
  28. package/dist/drops-XO4CZ4BH.js +39 -0
  29. package/dist/files-BIMA5L2G.js +206 -0
  30. package/dist/files-CFOTEASC.js +206 -0
  31. package/dist/files-SQURZ7VO.js +194 -0
  32. package/dist/files-XU6MDPP4.js +206 -0
  33. package/dist/health-3U3RHXFS.js +56 -0
  34. package/dist/health-SH6T6DZS.js +61 -0
  35. package/dist/health-TIJU6U2D.js +61 -0
  36. package/dist/health-YLNNKAFP.js +61 -0
  37. package/dist/jobs-HUW6Z6A7.js +87 -0
  38. package/dist/jobs-KK5IZYO5.js +99 -0
  39. package/dist/jobs-RMRGXLAA.js +90 -0
  40. package/dist/jobs-ROJFRPMR.js +90 -0
  41. package/dist/jobs-SX7DIN6T.js +90 -0
  42. package/dist/jobs-TND5AHCL.js +102 -0
  43. package/dist/jobs-TOLVGN6K.js +102 -0
  44. package/dist/jobs-XUAXWUAK.js +102 -0
  45. package/dist/maintenance-6XNJ56LL.js +79 -0
  46. package/dist/maintenance-7UBKZOR3.js +79 -0
  47. package/dist/maintenance-US3PUKFF.js +79 -0
  48. package/dist/maintenance-V2TXPXQE.js +79 -0
  49. package/dist/mcp-TUZZB2C7.js +189 -0
  50. package/dist/profiles-FOLKZZRU.js +53 -0
  51. package/dist/profiles-MB3TZQE4.js +53 -0
  52. package/dist/profiles-NVCJCYXR.js +53 -0
  53. package/dist/profiles-XXVM3UKI.js +53 -0
  54. package/dist/queues-AUGTAFBT.js +61 -0
  55. package/dist/queues-MTA2RWUP.js +56 -0
  56. package/dist/queues-NR25TGT7.js +61 -0
  57. package/dist/queues-X6IU3KBZ.js +61 -0
  58. package/dist/search-ETC2EXKM.js +135 -0
  59. package/dist/search-ICJO264J.js +135 -0
  60. package/dist/search-ULMFDWHE.js +135 -0
  61. package/dist/search-UWLK4OL2.js +119 -0
  62. package/dist/tags-75SSHS26.js +90 -0
  63. package/dist/tags-OFZQ2XCX.js +90 -0
  64. package/dist/tags-TBFPDHIQ.js +90 -0
  65. package/dist/tags-V43DCLPQ.js +90 -0
  66. package/dist/upload-F5I2SJRB.js +126 -0
  67. package/dist/upload-N7NAVN3Q.js +126 -0
  68. package/dist/whoami-WUQDFC5P.js +28 -0
  69. package/package.json +20 -20
  70. package/LICENSE +0 -21
@@ -0,0 +1,90 @@
1
+ import {
2
+ parseJsonInput
3
+ } from "./chunk-3BLL5SQJ.js";
4
+ import {
5
+ validateInput
6
+ } from "./chunk-PLZFHPLC.js";
7
+ import {
8
+ isJsonOutput,
9
+ output
10
+ } from "./chunk-5IX3ASXH.js";
11
+ import {
12
+ formatTable
13
+ } from "./chunk-FZGOTXTE.js";
14
+ import {
15
+ createStow
16
+ } from "./chunk-5LU25QZK.js";
17
+ import "./chunk-TOADDO2F.js";
18
+
19
+ // src/commands/tags.ts
20
+ async function listTags(options) {
21
+ const stow = createStow();
22
+ const data = await stow.tags.list();
23
+ if (data.tags.length === 0) {
24
+ if (isJsonOutput() || options.json) {
25
+ output(data);
26
+ } else {
27
+ console.log("No tags yet. Create one with: stow tags create <name>");
28
+ }
29
+ return;
30
+ }
31
+ output(data, () => {
32
+ const rows = data.tags.map((t) => [t.name, t.slug, t.color ?? "\u2014", t.id]);
33
+ return formatTable(["Name", "Slug", "Color", "ID"], rows);
34
+ });
35
+ }
36
+ async function createTag(name, options) {
37
+ const input = parseJsonInput(
38
+ options.inputJson,
39
+ { name, color: options.color }
40
+ );
41
+ validateInput(input.name, "tag name");
42
+ if (options.dryRun) {
43
+ console.log(
44
+ JSON.stringify(
45
+ {
46
+ dryRun: true,
47
+ action: "createTag",
48
+ details: {
49
+ name: input.name,
50
+ color: input.color ?? null
51
+ }
52
+ },
53
+ null,
54
+ 2
55
+ )
56
+ );
57
+ return;
58
+ }
59
+ const stow = createStow();
60
+ const tag = await stow.tags.create({
61
+ name: input.name,
62
+ ...input.color ? { color: input.color } : {}
63
+ });
64
+ output(tag, () => `Created tag: ${tag.name}`);
65
+ }
66
+ async function deleteTag(id, options = {}) {
67
+ validateInput(id, "tag id");
68
+ if (options.dryRun) {
69
+ console.log(
70
+ JSON.stringify(
71
+ {
72
+ dryRun: true,
73
+ action: "deleteTag",
74
+ details: { id }
75
+ },
76
+ null,
77
+ 2
78
+ )
79
+ );
80
+ return;
81
+ }
82
+ const stow = createStow();
83
+ await stow.tags.delete(id);
84
+ console.log(`Deleted tag: ${id}`);
85
+ }
86
+ export {
87
+ createTag,
88
+ deleteTag,
89
+ listTags
90
+ };
@@ -0,0 +1,90 @@
1
+ import {
2
+ parseJsonInput
3
+ } from "./chunk-XVKIRHTX.js";
4
+ import {
5
+ validateInput
6
+ } from "./chunk-NBHBVKP5.js";
7
+ import {
8
+ isJsonOutput,
9
+ output
10
+ } from "./chunk-KPIQZBTO.js";
11
+ import {
12
+ formatTable
13
+ } from "./chunk-PE6V3MVP.js";
14
+ import {
15
+ createStow
16
+ } from "./chunk-5LU25QZK.js";
17
+ import "./chunk-TOADDO2F.js";
18
+
19
+ // src/commands/tags.ts
20
+ async function listTags(options) {
21
+ const stow = createStow();
22
+ const data = await stow.tags.list();
23
+ if (data.tags.length === 0) {
24
+ if (isJsonOutput() || options.json) {
25
+ output(data);
26
+ } else {
27
+ console.log("No tags yet. Create one with: stow tags create <name>");
28
+ }
29
+ return;
30
+ }
31
+ output(data, () => {
32
+ const rows = data.tags.map((t) => [t.name, t.slug, t.color ?? "\u2014", t.id]);
33
+ return formatTable(["Name", "Slug", "Color", "ID"], rows);
34
+ });
35
+ }
36
+ async function createTag(name, options) {
37
+ const input = parseJsonInput(options.inputJson, {
38
+ name,
39
+ color: options.color
40
+ });
41
+ validateInput(input.name, "tag name");
42
+ if (options.dryRun) {
43
+ console.log(
44
+ JSON.stringify(
45
+ {
46
+ dryRun: true,
47
+ action: "createTag",
48
+ details: {
49
+ name: input.name,
50
+ color: input.color ?? null
51
+ }
52
+ },
53
+ null,
54
+ 2
55
+ )
56
+ );
57
+ return;
58
+ }
59
+ const stow = createStow();
60
+ const tag = await stow.tags.create({
61
+ name: input.name,
62
+ ...input.color ? { color: input.color } : {}
63
+ });
64
+ output(tag, () => `Created tag: ${tag.name}`);
65
+ }
66
+ async function deleteTag(id, options = {}) {
67
+ validateInput(id, "tag id");
68
+ if (options.dryRun) {
69
+ console.log(
70
+ JSON.stringify(
71
+ {
72
+ dryRun: true,
73
+ action: "deleteTag",
74
+ details: { id }
75
+ },
76
+ null,
77
+ 2
78
+ )
79
+ );
80
+ return;
81
+ }
82
+ const stow = createStow();
83
+ await stow.tags.delete(id);
84
+ console.log(`Deleted tag: ${id}`);
85
+ }
86
+ export {
87
+ createTag,
88
+ deleteTag,
89
+ listTags
90
+ };
@@ -0,0 +1,126 @@
1
+ import {
2
+ validateBucketName
3
+ } from "./chunk-533UGNLM.js";
4
+ import {
5
+ formatBytes
6
+ } from "./chunk-FZGOTXTE.js";
7
+ import {
8
+ createStow
9
+ } from "./chunk-5LU25QZK.js";
10
+ import "./chunk-TOADDO2F.js";
11
+
12
+ // src/commands/upload.ts
13
+ import { existsSync, readFileSync, statSync } from "fs";
14
+ import { basename, resolve } from "path";
15
+ var CONTENT_TYPES = {
16
+ png: "image/png",
17
+ jpg: "image/jpeg",
18
+ jpeg: "image/jpeg",
19
+ gif: "image/gif",
20
+ webp: "image/webp",
21
+ svg: "image/svg+xml",
22
+ ico: "image/x-icon",
23
+ avif: "image/avif",
24
+ pdf: "application/pdf",
25
+ mp4: "video/mp4",
26
+ webm: "video/webm",
27
+ mov: "video/quicktime",
28
+ mp3: "audio/mpeg",
29
+ wav: "audio/wav",
30
+ ogg: "audio/ogg",
31
+ zip: "application/zip",
32
+ tar: "application/x-tar",
33
+ gz: "application/gzip",
34
+ txt: "text/plain",
35
+ json: "application/json",
36
+ xml: "application/xml",
37
+ html: "text/html",
38
+ css: "text/css",
39
+ js: "application/javascript"
40
+ };
41
+ function getContentType(filename) {
42
+ const ext = filename.toLowerCase().split(".").pop();
43
+ return CONTENT_TYPES[ext || ""] || "application/octet-stream";
44
+ }
45
+ function readFile(filePath) {
46
+ const resolvedPath = resolve(filePath);
47
+ if (!existsSync(resolvedPath)) {
48
+ console.error(`Error: File not found: ${filePath}`);
49
+ process.exit(1);
50
+ }
51
+ const buffer = readFileSync(resolvedPath);
52
+ const filename = basename(resolvedPath);
53
+ const contentType = getContentType(filename);
54
+ return { buffer, filename, contentType };
55
+ }
56
+ function printUploadResult(url, options, opts) {
57
+ if (options.quiet) {
58
+ console.log(url);
59
+ return;
60
+ }
61
+ console.error(opts?.deduped ? "Done! (deduped)" : "Done!");
62
+ console.log("");
63
+ console.log(url);
64
+ }
65
+ async function uploadDrop(filePath, options) {
66
+ const { buffer, filename, contentType } = readFile(filePath);
67
+ if (!options.quiet) {
68
+ console.error(`Uploading ${filename} (${formatBytes(buffer.length)})...`);
69
+ }
70
+ const stow = createStow();
71
+ const result = await stow.drop(buffer, {
72
+ filename,
73
+ contentType
74
+ });
75
+ printUploadResult(result.url, options);
76
+ }
77
+ async function uploadFile(filePath, options) {
78
+ if (options.bucket) {
79
+ validateBucketName(options.bucket);
80
+ }
81
+ const resolvedPath = resolve(filePath);
82
+ if (!existsSync(resolvedPath)) {
83
+ console.error(`Error: File not found: ${filePath}`);
84
+ process.exit(1);
85
+ }
86
+ const filename = basename(resolvedPath);
87
+ const contentType = getContentType(filename);
88
+ const size = statSync(resolvedPath).size;
89
+ if (options.dryRun) {
90
+ console.log(
91
+ JSON.stringify(
92
+ {
93
+ dryRun: true,
94
+ action: "upload",
95
+ details: {
96
+ file: resolvedPath,
97
+ filename,
98
+ contentType,
99
+ size,
100
+ bucket: options.bucket ?? null
101
+ }
102
+ },
103
+ null,
104
+ 2
105
+ )
106
+ );
107
+ return;
108
+ }
109
+ const buffer = readFileSync(resolvedPath);
110
+ if (!options.quiet) {
111
+ console.error(`Uploading ${filename} (${formatBytes(buffer.length)})...`);
112
+ }
113
+ const stow = createStow();
114
+ const result = await stow.uploadFile(buffer, {
115
+ ...options.bucket ? { bucket: options.bucket } : {},
116
+ filename,
117
+ contentType
118
+ });
119
+ printUploadResult(result.url ?? result.key, options, {
120
+ deduped: result.deduped
121
+ });
122
+ }
123
+ export {
124
+ uploadDrop,
125
+ uploadFile
126
+ };
@@ -0,0 +1,126 @@
1
+ import {
2
+ validateBucketName
3
+ } from "./chunk-NBHBVKP5.js";
4
+ import {
5
+ formatBytes
6
+ } from "./chunk-PE6V3MVP.js";
7
+ import {
8
+ createStow
9
+ } from "./chunk-5LU25QZK.js";
10
+ import "./chunk-TOADDO2F.js";
11
+
12
+ // src/commands/upload.ts
13
+ import { existsSync, readFileSync, statSync } from "fs";
14
+ import { basename, resolve } from "path";
15
+ var CONTENT_TYPES = {
16
+ png: "image/png",
17
+ jpg: "image/jpeg",
18
+ jpeg: "image/jpeg",
19
+ gif: "image/gif",
20
+ webp: "image/webp",
21
+ svg: "image/svg+xml",
22
+ ico: "image/x-icon",
23
+ avif: "image/avif",
24
+ pdf: "application/pdf",
25
+ mp4: "video/mp4",
26
+ webm: "video/webm",
27
+ mov: "video/quicktime",
28
+ mp3: "audio/mpeg",
29
+ wav: "audio/wav",
30
+ ogg: "audio/ogg",
31
+ zip: "application/zip",
32
+ tar: "application/x-tar",
33
+ gz: "application/gzip",
34
+ txt: "text/plain",
35
+ json: "application/json",
36
+ xml: "application/xml",
37
+ html: "text/html",
38
+ css: "text/css",
39
+ js: "application/javascript"
40
+ };
41
+ function getContentType(filename) {
42
+ const ext = filename.toLowerCase().split(".").pop();
43
+ return CONTENT_TYPES[ext || ""] || "application/octet-stream";
44
+ }
45
+ function readFile(filePath) {
46
+ const resolvedPath = resolve(filePath);
47
+ if (!existsSync(resolvedPath)) {
48
+ console.error(`Error: File not found: ${filePath}`);
49
+ process.exit(1);
50
+ }
51
+ const buffer = readFileSync(resolvedPath);
52
+ const filename = basename(resolvedPath);
53
+ const contentType = getContentType(filename);
54
+ return { buffer, filename, contentType };
55
+ }
56
+ function printUploadResult(url, options, opts) {
57
+ if (options.quiet) {
58
+ console.log(url);
59
+ return;
60
+ }
61
+ console.error(opts?.deduped ? "Done! (deduped)" : "Done!");
62
+ console.log("");
63
+ console.log(url);
64
+ }
65
+ async function uploadDrop(filePath, options) {
66
+ const { buffer, filename, contentType } = readFile(filePath);
67
+ if (!options.quiet) {
68
+ console.error(`Uploading ${filename} (${formatBytes(buffer.length)})...`);
69
+ }
70
+ const stow = createStow();
71
+ const result = await stow.drop(buffer, {
72
+ filename,
73
+ contentType
74
+ });
75
+ printUploadResult(result.url, options);
76
+ }
77
+ async function uploadFile(filePath, options) {
78
+ if (options.bucket) {
79
+ validateBucketName(options.bucket);
80
+ }
81
+ const resolvedPath = resolve(filePath);
82
+ if (!existsSync(resolvedPath)) {
83
+ console.error(`Error: File not found: ${filePath}`);
84
+ process.exit(1);
85
+ }
86
+ const filename = basename(resolvedPath);
87
+ const contentType = getContentType(filename);
88
+ const { size } = statSync(resolvedPath);
89
+ if (options.dryRun) {
90
+ console.log(
91
+ JSON.stringify(
92
+ {
93
+ dryRun: true,
94
+ action: "upload",
95
+ details: {
96
+ file: resolvedPath,
97
+ filename,
98
+ contentType,
99
+ size,
100
+ bucket: options.bucket ?? null
101
+ }
102
+ },
103
+ null,
104
+ 2
105
+ )
106
+ );
107
+ return;
108
+ }
109
+ const buffer = readFileSync(resolvedPath);
110
+ if (!options.quiet) {
111
+ console.error(`Uploading ${filename} (${formatBytes(buffer.length)})...`);
112
+ }
113
+ const stow = createStow();
114
+ const result = await stow.uploadFile(buffer, {
115
+ ...options.bucket ? { bucket: options.bucket } : {},
116
+ filename,
117
+ contentType
118
+ });
119
+ printUploadResult(result.url ?? result.key, options, {
120
+ deduped: result.deduped
121
+ });
122
+ }
123
+ export {
124
+ uploadDrop,
125
+ uploadFile
126
+ };
@@ -0,0 +1,28 @@
1
+ import {
2
+ formatBytes
3
+ } from "./chunk-PE6V3MVP.js";
4
+ import {
5
+ createStow
6
+ } from "./chunk-5LU25QZK.js";
7
+ import "./chunk-TOADDO2F.js";
8
+
9
+ // src/commands/whoami.ts
10
+ async function whoami() {
11
+ const stow = createStow();
12
+ const data = await stow.whoami();
13
+ console.log(`Account: ${data.user.email}`);
14
+ console.log("");
15
+ console.log(`Buckets: ${data.stats.bucketCount}`);
16
+ console.log(`Files: ${data.stats.totalFiles}`);
17
+ console.log(`Storage: ${formatBytes(data.stats.totalBytes)}`);
18
+ if (data.key) {
19
+ console.log("");
20
+ console.log(`API Key: ${data.key.name}`);
21
+ console.log(`Scope: ${data.key.scope}`);
22
+ const perms = Object.entries(data.key.permissions).filter(([, v]) => v).map(([k]) => k);
23
+ console.log(`Perms: ${perms.join(", ")}`);
24
+ }
25
+ }
26
+ export {
27
+ whoami
28
+ };
package/package.json CHANGED
@@ -1,28 +1,35 @@
1
1
  {
2
2
  "name": "stow-cli",
3
- "version": "2.2.0",
4
- "type": "module",
3
+ "version": "2.2.3",
5
4
  "description": "CLI for Stow file storage",
5
+ "keywords": [
6
+ "cli",
7
+ "file-storage",
8
+ "stow",
9
+ "upload"
10
+ ],
11
+ "homepage": "https://stow.sh",
6
12
  "license": "MIT",
7
13
  "repository": {
8
14
  "type": "git",
9
15
  "url": "git+https://github.com/howells/stow.git",
10
16
  "directory": "packages/stow-cli"
11
17
  },
12
- "homepage": "https://stow.sh",
13
- "keywords": [
14
- "stow",
15
- "file-storage",
16
- "cli",
17
- "upload"
18
- ],
19
18
  "bin": {
20
19
  "stow": "./dist/cli.js"
21
20
  },
22
21
  "files": [
23
22
  "dist"
24
23
  ],
24
+ "type": "module",
25
+ "scripts": {
26
+ "build": "tsup src/cli.ts --format esm --shims",
27
+ "dev": "tsup src/cli.ts --format esm --shims --watch",
28
+ "test": "vp test run",
29
+ "test:watch": "vp test"
30
+ },
25
31
  "dependencies": {
32
+ "@howells/stow-server": "workspace:*",
26
33
  "@modelcontextprotocol/sdk": "^1.27.1",
27
34
  "clipboardy": "^5.3.1",
28
35
  "commander": "^14.0.3",
@@ -32,21 +39,14 @@
32
39
  "ink-text-input": "^6.0.0",
33
40
  "open": "^11.0.0",
34
41
  "react": "^19.2.4",
35
- "zod": "^4.3.6",
36
- "@howells/stow-server": "2.2.0"
42
+ "zod": "^4.3.6"
37
43
  },
38
44
  "devDependencies": {
45
+ "@stow/typescript-config": "workspace:*",
39
46
  "@types/node": "^25.5.0",
40
47
  "@types/react": "19.2.14",
41
48
  "tsup": "^8.5.1",
42
49
  "typescript": "^5.9.3",
43
- "vitest": "^4.1.0",
44
- "@stow/typescript-config": "0.0.0"
45
- },
46
- "scripts": {
47
- "build": "tsup src/cli.ts --format esm --shims",
48
- "dev": "tsup src/cli.ts --format esm --shims --watch",
49
- "test": "vitest run",
50
- "test:watch": "vitest"
50
+ "vite-plus": "catalog:"
51
51
  }
52
- }
52
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Stow
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.