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,135 @@
1
+ import {
2
+ isJsonOutput,
3
+ output
4
+ } from "./chunk-5IX3ASXH.js";
5
+ import {
6
+ formatBytes,
7
+ formatTable
8
+ } from "./chunk-FZGOTXTE.js";
9
+ import {
10
+ createStow
11
+ } from "./chunk-5LU25QZK.js";
12
+ import "./chunk-TOADDO2F.js";
13
+
14
+ // src/commands/search.ts
15
+ async function textSearch(query, options) {
16
+ const stow = createStow();
17
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
18
+ const data = await stow.search.text({
19
+ query,
20
+ ...options.bucket ? { bucket: options.bucket } : {},
21
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
22
+ });
23
+ if (data.results.length === 0) {
24
+ if (isJsonOutput() || options.json) {
25
+ output(data);
26
+ } else {
27
+ console.log("No results found.");
28
+ }
29
+ return;
30
+ }
31
+ output(
32
+ data,
33
+ () => {
34
+ const rows = data.results.map((r) => [
35
+ r.key,
36
+ formatBytes(r.size),
37
+ r.similarity.toFixed(3)
38
+ ]);
39
+ return formatTable(["Key", "Size", "Similarity"], rows);
40
+ },
41
+ { json: options.json }
42
+ );
43
+ }
44
+ async function similarSearch(options) {
45
+ const stow = createStow();
46
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
47
+ const data = await stow.search.similar({
48
+ fileKey: options.file,
49
+ ...options.bucket ? { bucket: options.bucket } : {},
50
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
51
+ });
52
+ if (data.results.length === 0) {
53
+ if (isJsonOutput() || options.json) {
54
+ output(data);
55
+ } else {
56
+ console.log("No similar files found.");
57
+ }
58
+ return;
59
+ }
60
+ output(
61
+ data,
62
+ () => {
63
+ const rows = data.results.map((r) => [
64
+ r.key,
65
+ formatBytes(r.size),
66
+ r.similarity.toFixed(3)
67
+ ]);
68
+ return formatTable(["Key", "Size", "Similarity"], rows);
69
+ },
70
+ { json: options.json }
71
+ );
72
+ }
73
+ async function colorSearch(options) {
74
+ const stow = createStow();
75
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
76
+ const data = await stow.search.color({
77
+ hex: options.hex,
78
+ ...options.bucket ? { bucket: options.bucket } : {},
79
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
80
+ });
81
+ if (data.results.length === 0) {
82
+ if (isJsonOutput() || options.json) {
83
+ output(data);
84
+ } else {
85
+ console.log("No results found.");
86
+ }
87
+ return;
88
+ }
89
+ output(
90
+ data,
91
+ () => {
92
+ const rows = data.results.map((r) => [
93
+ r.key,
94
+ r.contentType,
95
+ r.colorDistance.toFixed(3)
96
+ ]);
97
+ return formatTable(["Key", "Type", "Distance"], rows);
98
+ },
99
+ { json: options.json }
100
+ );
101
+ }
102
+ async function diverseSearch(options) {
103
+ const stow = createStow();
104
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
105
+ const data = await stow.search.diverse({
106
+ ...options.bucket ? { bucket: options.bucket } : {},
107
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
108
+ });
109
+ if (data.results.length === 0) {
110
+ if (isJsonOutput() || options.json) {
111
+ output(data);
112
+ } else {
113
+ console.log("No results found.");
114
+ }
115
+ return;
116
+ }
117
+ output(
118
+ data,
119
+ () => {
120
+ const rows = data.results.map((r) => [
121
+ r.key,
122
+ formatBytes(r.size),
123
+ r.similarity.toFixed(3)
124
+ ]);
125
+ return formatTable(["Key", "Size", "Similarity"], rows);
126
+ },
127
+ { json: options.json }
128
+ );
129
+ }
130
+ export {
131
+ colorSearch,
132
+ diverseSearch,
133
+ similarSearch,
134
+ textSearch
135
+ };
@@ -0,0 +1,135 @@
1
+ import {
2
+ isJsonOutput,
3
+ output
4
+ } from "./chunk-5BVMPHKH.js";
5
+ import {
6
+ formatBytes,
7
+ formatTable
8
+ } from "./chunk-FZGOTXTE.js";
9
+ import {
10
+ createStow
11
+ } from "./chunk-5LU25QZK.js";
12
+ import "./chunk-TOADDO2F.js";
13
+
14
+ // src/commands/search.ts
15
+ async function textSearch(query, options) {
16
+ const stow = createStow();
17
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
18
+ const data = await stow.search.text({
19
+ query,
20
+ ...options.bucket ? { bucket: options.bucket } : {},
21
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
22
+ });
23
+ if (data.results.length === 0) {
24
+ if (isJsonOutput() || options.json) {
25
+ output(data);
26
+ } else {
27
+ console.log("No results found.");
28
+ }
29
+ return;
30
+ }
31
+ output(
32
+ data,
33
+ () => {
34
+ const rows = data.results.map((r) => [
35
+ r.key,
36
+ formatBytes(r.size),
37
+ r.similarity.toFixed(3)
38
+ ]);
39
+ return formatTable(["Key", "Size", "Similarity"], rows);
40
+ },
41
+ { json: options.json }
42
+ );
43
+ }
44
+ async function similarSearch(options) {
45
+ const stow = createStow();
46
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
47
+ const data = await stow.search.similar({
48
+ fileKey: options.file,
49
+ ...options.bucket ? { bucket: options.bucket } : {},
50
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
51
+ });
52
+ if (data.results.length === 0) {
53
+ if (isJsonOutput() || options.json) {
54
+ output(data);
55
+ } else {
56
+ console.log("No similar files found.");
57
+ }
58
+ return;
59
+ }
60
+ output(
61
+ data,
62
+ () => {
63
+ const rows = data.results.map((r) => [
64
+ r.key,
65
+ formatBytes(r.size),
66
+ r.similarity.toFixed(3)
67
+ ]);
68
+ return formatTable(["Key", "Size", "Similarity"], rows);
69
+ },
70
+ { json: options.json }
71
+ );
72
+ }
73
+ async function colorSearch(options) {
74
+ const stow = createStow();
75
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
76
+ const data = await stow.search.color({
77
+ hex: options.hex,
78
+ ...options.bucket ? { bucket: options.bucket } : {},
79
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
80
+ });
81
+ if (data.results.length === 0) {
82
+ if (isJsonOutput() || options.json) {
83
+ output(data);
84
+ } else {
85
+ console.log("No results found.");
86
+ }
87
+ return;
88
+ }
89
+ output(
90
+ data,
91
+ () => {
92
+ const rows = data.results.map((r) => [
93
+ r.key,
94
+ r.contentType,
95
+ r.colorDistance.toFixed(3)
96
+ ]);
97
+ return formatTable(["Key", "Type", "Distance"], rows);
98
+ },
99
+ { json: options.json }
100
+ );
101
+ }
102
+ async function diverseSearch(options) {
103
+ const stow = createStow();
104
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
105
+ const data = await stow.search.diverse({
106
+ ...options.bucket ? { bucket: options.bucket } : {},
107
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
108
+ });
109
+ if (data.results.length === 0) {
110
+ if (isJsonOutput() || options.json) {
111
+ output(data);
112
+ } else {
113
+ console.log("No results found.");
114
+ }
115
+ return;
116
+ }
117
+ output(
118
+ data,
119
+ () => {
120
+ const rows = data.results.map((r) => [
121
+ r.key,
122
+ formatBytes(r.size),
123
+ r.similarity.toFixed(3)
124
+ ]);
125
+ return formatTable(["Key", "Size", "Similarity"], rows);
126
+ },
127
+ { json: options.json }
128
+ );
129
+ }
130
+ export {
131
+ colorSearch,
132
+ diverseSearch,
133
+ similarSearch,
134
+ textSearch
135
+ };
@@ -0,0 +1,135 @@
1
+ import {
2
+ isJsonOutput,
3
+ output
4
+ } from "./chunk-RH4BOSYB.js";
5
+ import {
6
+ formatBytes,
7
+ formatTable
8
+ } from "./chunk-FZGOTXTE.js";
9
+ import {
10
+ createStow
11
+ } from "./chunk-5LU25QZK.js";
12
+ import "./chunk-TOADDO2F.js";
13
+
14
+ // src/commands/search.ts
15
+ async function textSearch(query, options) {
16
+ const stow = createStow();
17
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
18
+ const data = await stow.search.text({
19
+ query,
20
+ ...options.bucket ? { bucket: options.bucket } : {},
21
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
22
+ });
23
+ if (data.results.length === 0) {
24
+ if (isJsonOutput() || options.json) {
25
+ output(data);
26
+ } else {
27
+ console.log("No results found.");
28
+ }
29
+ return;
30
+ }
31
+ output(
32
+ data,
33
+ () => {
34
+ const rows = data.results.map((r) => [
35
+ r.key,
36
+ formatBytes(r.size),
37
+ r.similarity.toFixed(3)
38
+ ]);
39
+ return formatTable(["Key", "Size", "Similarity"], rows);
40
+ },
41
+ { json: options.json }
42
+ );
43
+ }
44
+ async function similarSearch(options) {
45
+ const stow = createStow();
46
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
47
+ const data = await stow.search.similar({
48
+ fileKey: options.file,
49
+ ...options.bucket ? { bucket: options.bucket } : {},
50
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
51
+ });
52
+ if (data.results.length === 0) {
53
+ if (isJsonOutput() || options.json) {
54
+ output(data);
55
+ } else {
56
+ console.log("No similar files found.");
57
+ }
58
+ return;
59
+ }
60
+ output(
61
+ data,
62
+ () => {
63
+ const rows = data.results.map((r) => [
64
+ r.key,
65
+ formatBytes(r.size),
66
+ r.similarity.toFixed(3)
67
+ ]);
68
+ return formatTable(["Key", "Size", "Similarity"], rows);
69
+ },
70
+ { json: options.json }
71
+ );
72
+ }
73
+ async function colorSearch(options) {
74
+ const stow = createStow();
75
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
76
+ const data = await stow.search.color({
77
+ hex: options.hex,
78
+ ...options.bucket ? { bucket: options.bucket } : {},
79
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
80
+ });
81
+ if (data.results.length === 0) {
82
+ if (isJsonOutput() || options.json) {
83
+ output(data);
84
+ } else {
85
+ console.log("No results found.");
86
+ }
87
+ return;
88
+ }
89
+ output(
90
+ data,
91
+ () => {
92
+ const rows = data.results.map((r) => [
93
+ r.key,
94
+ r.contentType,
95
+ r.colorDistance.toFixed(3)
96
+ ]);
97
+ return formatTable(["Key", "Type", "Distance"], rows);
98
+ },
99
+ { json: options.json }
100
+ );
101
+ }
102
+ async function diverseSearch(options) {
103
+ const stow = createStow();
104
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
105
+ const data = await stow.search.diverse({
106
+ ...options.bucket ? { bucket: options.bucket } : {},
107
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
108
+ });
109
+ if (data.results.length === 0) {
110
+ if (isJsonOutput() || options.json) {
111
+ output(data);
112
+ } else {
113
+ console.log("No results found.");
114
+ }
115
+ return;
116
+ }
117
+ output(
118
+ data,
119
+ () => {
120
+ const rows = data.results.map((r) => [
121
+ r.key,
122
+ formatBytes(r.size),
123
+ r.similarity.toFixed(3)
124
+ ]);
125
+ return formatTable(["Key", "Size", "Similarity"], rows);
126
+ },
127
+ { json: options.json }
128
+ );
129
+ }
130
+ export {
131
+ colorSearch,
132
+ diverseSearch,
133
+ similarSearch,
134
+ textSearch
135
+ };
@@ -0,0 +1,119 @@
1
+ import {
2
+ isJsonOutput,
3
+ output
4
+ } from "./chunk-KPIQZBTO.js";
5
+ import {
6
+ formatBytes,
7
+ formatTable
8
+ } from "./chunk-PE6V3MVP.js";
9
+ import {
10
+ createStow
11
+ } from "./chunk-5LU25QZK.js";
12
+ import "./chunk-TOADDO2F.js";
13
+
14
+ // src/commands/search.ts
15
+ async function textSearch(query, options) {
16
+ const stow = createStow();
17
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
18
+ const data = await stow.search.text({
19
+ query,
20
+ ...options.bucket ? { bucket: options.bucket } : {},
21
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
22
+ });
23
+ if (data.results.length === 0) {
24
+ if (isJsonOutput() || options.json) {
25
+ output(data);
26
+ } else {
27
+ console.log("No results found.");
28
+ }
29
+ return;
30
+ }
31
+ output(
32
+ data,
33
+ () => {
34
+ const rows = data.results.map((r) => [r.key, formatBytes(r.size), r.similarity.toFixed(3)]);
35
+ return formatTable(["Key", "Size", "Similarity"], rows);
36
+ },
37
+ { json: options.json }
38
+ );
39
+ }
40
+ async function similarSearch(options) {
41
+ const stow = createStow();
42
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
43
+ const data = await stow.search.similar({
44
+ fileKey: options.file,
45
+ ...options.bucket ? { bucket: options.bucket } : {},
46
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
47
+ });
48
+ if (data.results.length === 0) {
49
+ if (isJsonOutput() || options.json) {
50
+ output(data);
51
+ } else {
52
+ console.log("No similar files found.");
53
+ }
54
+ return;
55
+ }
56
+ output(
57
+ data,
58
+ () => {
59
+ const rows = data.results.map((r) => [r.key, formatBytes(r.size), r.similarity.toFixed(3)]);
60
+ return formatTable(["Key", "Size", "Similarity"], rows);
61
+ },
62
+ { json: options.json }
63
+ );
64
+ }
65
+ async function colorSearch(options) {
66
+ const stow = createStow();
67
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
68
+ const data = await stow.search.color({
69
+ hex: options.hex,
70
+ ...options.bucket ? { bucket: options.bucket } : {},
71
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
72
+ });
73
+ if (data.results.length === 0) {
74
+ if (isJsonOutput() || options.json) {
75
+ output(data);
76
+ } else {
77
+ console.log("No results found.");
78
+ }
79
+ return;
80
+ }
81
+ output(
82
+ data,
83
+ () => {
84
+ const rows = data.results.map((r) => [r.key, r.contentType, r.colorDistance.toFixed(3)]);
85
+ return formatTable(["Key", "Type", "Distance"], rows);
86
+ },
87
+ { json: options.json }
88
+ );
89
+ }
90
+ async function diverseSearch(options) {
91
+ const stow = createStow();
92
+ const parsedLimit = options.limit ? Number.parseInt(options.limit, 10) : null;
93
+ const data = await stow.search.diverse({
94
+ ...options.bucket ? { bucket: options.bucket } : {},
95
+ ...parsedLimit && parsedLimit > 0 ? { limit: parsedLimit } : {}
96
+ });
97
+ if (data.results.length === 0) {
98
+ if (isJsonOutput() || options.json) {
99
+ output(data);
100
+ } else {
101
+ console.log("No results found.");
102
+ }
103
+ return;
104
+ }
105
+ output(
106
+ data,
107
+ () => {
108
+ const rows = data.results.map((r) => [r.key, formatBytes(r.size), r.similarity.toFixed(3)]);
109
+ return formatTable(["Key", "Size", "Similarity"], rows);
110
+ },
111
+ { json: options.json }
112
+ );
113
+ }
114
+ export {
115
+ colorSearch,
116
+ diverseSearch,
117
+ similarSearch,
118
+ textSearch
119
+ };
@@ -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-5BVMPHKH.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-AHBVZRDR.js";
4
+ import {
5
+ validateInput
6
+ } from "./chunk-533UGNLM.js";
7
+ import {
8
+ isJsonOutput,
9
+ output
10
+ } from "./chunk-RH4BOSYB.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
+ };