@benglo/storu-cli 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-client.d.ts +5 -0
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +24 -0
- package/dist/api-client.js.map +1 -1
- package/dist/commands/apps.d.ts +2 -1
- package/dist/commands/apps.d.ts.map +1 -1
- package/dist/commands/apps.js +60 -49
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/epics.d.ts +2 -1
- package/dist/commands/epics.d.ts.map +1 -1
- package/dist/commands/epics.js +66 -61
- package/dist/commands/epics.js.map +1 -1
- package/dist/commands/labels.d.ts +2 -1
- package/dist/commands/labels.d.ts.map +1 -1
- package/dist/commands/labels.js +43 -37
- package/dist/commands/labels.js.map +1 -1
- package/dist/commands/releases.d.ts +2 -1
- package/dist/commands/releases.d.ts.map +1 -1
- package/dist/commands/releases.js +85 -82
- package/dist/commands/releases.js.map +1 -1
- package/dist/commands/stories.d.ts +2 -1
- package/dist/commands/stories.d.ts.map +1 -1
- package/dist/commands/stories.js +278 -162
- package/dist/commands/stories.js.map +1 -1
- package/dist/commands/subscribers.d.ts +2 -1
- package/dist/commands/subscribers.d.ts.map +1 -1
- package/dist/commands/subscribers.js +39 -33
- package/dist/commands/subscribers.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +25 -12
- package/dist/config.js.map +1 -1
- package/dist/helpers.d.ts +20 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +32 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.js +29 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/labels.js
CHANGED
|
@@ -1,64 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { shortId, output } from "../helpers.js";
|
|
2
|
+
export function registerLabelCommand(program, client, _getConfig) {
|
|
3
|
+
const labelCmd = program.command("label").description("Manage labels");
|
|
4
|
+
labelCmd
|
|
5
|
+
.command("list")
|
|
4
6
|
.description("List all labels")
|
|
5
|
-
.
|
|
7
|
+
.option("--json", "Output raw JSON")
|
|
8
|
+
.action(async (opts) => {
|
|
6
9
|
const result = await client.listLabels();
|
|
7
10
|
if (!result.success || !result.data) {
|
|
8
|
-
|
|
9
|
-
process.exit(1);
|
|
11
|
+
throw new Error(result.error ?? "Failed to list labels");
|
|
10
12
|
}
|
|
11
13
|
const rows = result.data;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
output(rows, opts, (data) => {
|
|
15
|
+
if (data.length === 0) {
|
|
16
|
+
process.stdout.write("No labels found.\n");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const tableData = data.map((label) => ({
|
|
20
|
+
ID: shortId(label.id),
|
|
21
|
+
Name: label.name,
|
|
22
|
+
Color: label.color ?? "",
|
|
23
|
+
}));
|
|
24
|
+
console.table(tableData);
|
|
25
|
+
});
|
|
22
26
|
});
|
|
23
|
-
const labelCmd = program.command("label").description("Manage labels");
|
|
24
27
|
labelCmd
|
|
25
28
|
.command("create")
|
|
26
29
|
.description("Create a new label")
|
|
27
30
|
.requiredOption("--name <name>", "Label name")
|
|
28
31
|
.option("--color <hex>", "Label color (hex, e.g. #ff0000)")
|
|
29
|
-
.
|
|
32
|
+
.option("--json", "Output raw JSON")
|
|
33
|
+
.action(async (opts) => {
|
|
30
34
|
const result = await client.createLabel({
|
|
31
|
-
name:
|
|
32
|
-
color:
|
|
35
|
+
name: opts.name,
|
|
36
|
+
color: opts.color,
|
|
33
37
|
});
|
|
34
38
|
if (!result.success || !result.data) {
|
|
35
|
-
|
|
36
|
-
process.exit(1);
|
|
39
|
+
throw new Error(result.error ?? "Failed to create label");
|
|
37
40
|
}
|
|
38
41
|
const label = result.data;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
output(label, opts, (data) => {
|
|
43
|
+
process.stdout.write(`Label created: ${data.id}\n`);
|
|
44
|
+
process.stdout.write(` Name: ${data.name}\n`);
|
|
45
|
+
if (data.color) {
|
|
46
|
+
process.stdout.write(` Color: ${data.color}\n`);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
44
49
|
});
|
|
45
50
|
labelCmd
|
|
46
|
-
.command("
|
|
51
|
+
.command("edit <id>")
|
|
47
52
|
.description("Update a label")
|
|
48
53
|
.option("--name <name>", "New name")
|
|
49
54
|
.option("--color <hex>", "New color (hex)")
|
|
50
|
-
.
|
|
55
|
+
.option("--json", "Output raw JSON")
|
|
56
|
+
.action(async (id, opts) => {
|
|
51
57
|
const result = await client.updateLabel(id, {
|
|
52
|
-
name:
|
|
53
|
-
color:
|
|
58
|
+
name: opts.name,
|
|
59
|
+
color: opts.color,
|
|
54
60
|
});
|
|
55
61
|
if (!result.success || !result.data) {
|
|
56
|
-
|
|
57
|
-
process.exit(1);
|
|
62
|
+
throw new Error(result.error ?? "Failed to update label");
|
|
58
63
|
}
|
|
59
64
|
const label = result.data;
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
output(label, opts, (data) => {
|
|
66
|
+
process.stdout.write(`Label updated: ${data.id}\n`);
|
|
67
|
+
process.stdout.write(` Name: ${data.name}\n`);
|
|
68
|
+
});
|
|
62
69
|
});
|
|
63
70
|
labelCmd
|
|
64
71
|
.command("delete <id>")
|
|
@@ -66,8 +73,7 @@ export function registerLabelsCommand(program, client) {
|
|
|
66
73
|
.action(async (id) => {
|
|
67
74
|
const result = await client.deleteLabel(id);
|
|
68
75
|
if (!result.success) {
|
|
69
|
-
|
|
70
|
-
process.exit(1);
|
|
76
|
+
throw new Error(result.error ?? "Failed to delete label");
|
|
71
77
|
}
|
|
72
78
|
process.stdout.write(`Label deleted: ${id}\n`);
|
|
73
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","sourceRoot":"","sources":["../../src/commands/labels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"labels.js","sourceRoot":"","sources":["../../src/commands/labels.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAShD,MAAM,UAAU,oBAAoB,CAClC,OAAgB,EAChB,MAAsB,EACtB,UAA6B;IAE7B,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAEvE,QAAQ;SACL,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,iBAAiB,CAAC;SAC9B,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;SACnC,MAAM,CAAC,KAAK,EAAE,IAAwB,EAAE,EAAE;QACzC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAEzC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,uBAAuB,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAkB,CAAC;QAEvC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,IAAgB,EAAE,EAAE;YACtC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBAC3C,OAAO;YACT,CAAC;YACD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACrC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrB,IAAI,EAAE,KAAK,CAAC,I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C5D,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { StoruApiClient } from "../api-client.js";
|
|
3
|
-
|
|
3
|
+
import type { StoruConfig } from "../config.js";
|
|
4
|
+
export declare function registerReleaseCommand(program: Command, client: StoruApiClient, getConfig: () => StoruConfig): void;
|
|
4
5
|
//# sourceMappingURL=releases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releases.d.ts","sourceRoot":"","sources":["../../src/commands/releases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"releases.d.ts","sourceRoot":"","sources":["../../src/commands/releases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgBhD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,WAAW,GAC3B,IAAI,CAqKN"}
|
|
@@ -1,141 +1,144 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { shortId, output, resolveApp } from "../helpers.js";
|
|
2
|
+
export function registerReleaseCommand(program, client, getConfig) {
|
|
3
|
+
const releaseCmd = program.command("release").description("Manage releases");
|
|
4
|
+
releaseCmd
|
|
5
|
+
.command("list")
|
|
4
6
|
.description("List releases for an application")
|
|
5
|
-
.
|
|
7
|
+
.option("--app <slug-or-id>", "Application UUID or slug")
|
|
6
8
|
.option("--status <status>", "Filter by status (draft|published)")
|
|
7
|
-
.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
9
|
+
.option("--json", "Output raw JSON")
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
const appId = await resolveApp(client, opts, getConfig());
|
|
12
|
+
const result = await client.listReleases({ app: appId, status: opts.status });
|
|
12
13
|
if (!result.success || !result.data) {
|
|
13
|
-
|
|
14
|
-
process.exit(1);
|
|
14
|
+
throw new Error(result.error ?? "Failed to list releases");
|
|
15
15
|
}
|
|
16
16
|
const rows = result.data;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
output(rows, opts, (data) => {
|
|
18
|
+
if (data.length === 0) {
|
|
19
|
+
process.stdout.write("No releases found.\n");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const tableData = data.map((r) => ({
|
|
23
|
+
ID: shortId(r.id),
|
|
24
|
+
Title: r.title,
|
|
25
|
+
Status: r.status,
|
|
26
|
+
Published: r.published_at ?? "",
|
|
27
|
+
}));
|
|
28
|
+
console.table(tableData);
|
|
29
|
+
});
|
|
28
30
|
});
|
|
29
|
-
const releaseCmd = program.command("release").description("Manage releases");
|
|
30
31
|
releaseCmd
|
|
31
|
-
.command("
|
|
32
|
+
.command("view <id>")
|
|
32
33
|
.description("Get full details for a release")
|
|
33
|
-
.
|
|
34
|
+
.option("--json", "Output raw JSON")
|
|
35
|
+
.action(async (id, opts) => {
|
|
34
36
|
const result = await client.getRelease(id);
|
|
35
37
|
if (!result.success || !result.data) {
|
|
36
|
-
|
|
37
|
-
process.exit(1);
|
|
38
|
+
throw new Error(result.error ?? "Failed to get release");
|
|
38
39
|
}
|
|
39
40
|
const release = result.data;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (release.description) {
|
|
49
|
-
process.stdout.write(`\nDescription:\n${release.description}\n`);
|
|
50
|
-
}
|
|
51
|
-
const stories = release.stories ?? release.story_ids ?? [];
|
|
52
|
-
if (Array.isArray(stories) && stories.length > 0) {
|
|
53
|
-
process.stdout.write(`\nStories (${stories.length}):\n`);
|
|
54
|
-
for (const s of stories) {
|
|
55
|
-
process.stdout.write(` - ${JSON.stringify(s)}\n`);
|
|
41
|
+
output(release, opts, (data) => {
|
|
42
|
+
process.stdout.write(`\nRelease: ${data.title}\n`);
|
|
43
|
+
process.stdout.write(`${"─".repeat(60)}\n`);
|
|
44
|
+
process.stdout.write(`ID: ${data.id}\n`);
|
|
45
|
+
process.stdout.write(`Status: ${data.status}\n`);
|
|
46
|
+
process.stdout.write(`App: ${data.application_id}\n`);
|
|
47
|
+
if (data.published_at) {
|
|
48
|
+
process.stdout.write(`Published: ${data.published_at}\n`);
|
|
56
49
|
}
|
|
57
|
-
|
|
50
|
+
if (data.description) {
|
|
51
|
+
process.stdout.write(`\nDescription:\n${data.description}\n`);
|
|
52
|
+
}
|
|
53
|
+
const stories = data.stories ?? data.story_ids ?? [];
|
|
54
|
+
if (Array.isArray(stories) && stories.length > 0) {
|
|
55
|
+
process.stdout.write(`\nStories (${stories.length}):\n`);
|
|
56
|
+
for (const s of stories) {
|
|
57
|
+
process.stdout.write(` - ${JSON.stringify(s)}\n`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
58
61
|
});
|
|
59
62
|
releaseCmd
|
|
60
63
|
.command("create")
|
|
61
64
|
.description("Create a new release")
|
|
62
|
-
.
|
|
65
|
+
.option("--app <slug-or-id>", "Application slug or UUID")
|
|
63
66
|
.requiredOption("--title <title>", "Release title")
|
|
64
67
|
.option("--description <text>", "Release description")
|
|
65
68
|
.option("--stories <ids>", "Comma-separated story UUIDs to include")
|
|
66
|
-
.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
.option("--json", "Output raw JSON")
|
|
70
|
+
.action(async (opts) => {
|
|
71
|
+
const appId = await resolveApp(client, opts, getConfig());
|
|
72
|
+
const storyIds = opts.stories
|
|
73
|
+
? opts.stories.split(",").map((s) => s.trim()).filter(Boolean)
|
|
69
74
|
: undefined;
|
|
70
|
-
const appId = await client.resolveAppId(options.app);
|
|
71
75
|
const result = await client.createRelease({
|
|
72
76
|
application_id: appId,
|
|
73
|
-
title:
|
|
74
|
-
description:
|
|
77
|
+
title: opts.title,
|
|
78
|
+
description: opts.description,
|
|
75
79
|
story_ids: storyIds,
|
|
76
80
|
});
|
|
77
81
|
if (!result.success || !result.data) {
|
|
78
|
-
|
|
79
|
-
process.exit(1);
|
|
82
|
+
throw new Error(result.error ?? "Failed to create release");
|
|
80
83
|
}
|
|
81
84
|
const release = result.data;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
output(release, opts, (data) => {
|
|
86
|
+
process.stdout.write(`Release created: ${data.id}\n`);
|
|
87
|
+
process.stdout.write(` Title: ${data.title}\n`);
|
|
88
|
+
process.stdout.write(` Status: ${data.status}\n`);
|
|
89
|
+
});
|
|
85
90
|
});
|
|
86
91
|
releaseCmd
|
|
87
|
-
.command("
|
|
92
|
+
.command("edit <id>")
|
|
88
93
|
.description("Update a release")
|
|
89
94
|
.option("--title <title>", "New title")
|
|
90
95
|
.option("--description <text>", "New description")
|
|
91
96
|
.option("--add-stories <ids>", "Comma-separated story UUIDs to add")
|
|
92
|
-
.
|
|
97
|
+
.option("--json", "Output raw JSON")
|
|
98
|
+
.action(async (id, opts) => {
|
|
93
99
|
const getResult = await client.getRelease(id);
|
|
94
100
|
if (!getResult.success || !getResult.data) {
|
|
95
|
-
|
|
96
|
-
process.exit(1);
|
|
101
|
+
throw new Error(getResult.error ?? "Release not found");
|
|
97
102
|
}
|
|
98
103
|
const current = getResult.data;
|
|
99
104
|
let storyIds;
|
|
100
|
-
if (
|
|
101
|
-
const existing = Array.isArray(current.story_ids)
|
|
102
|
-
|
|
103
|
-
: [];
|
|
104
|
-
const newIds = options.addStories
|
|
105
|
-
.split(",")
|
|
106
|
-
.map((s) => s.trim())
|
|
107
|
-
.filter(Boolean);
|
|
105
|
+
if (opts.addStories !== undefined) {
|
|
106
|
+
const existing = Array.isArray(current.story_ids) ? current.story_ids : [];
|
|
107
|
+
const newIds = opts.addStories.split(",").map((s) => s.trim()).filter(Boolean);
|
|
108
108
|
storyIds = [...new Set([...existing, ...newIds])];
|
|
109
109
|
}
|
|
110
110
|
const result = await client.updateRelease(id, {
|
|
111
111
|
version: current.version,
|
|
112
|
-
title:
|
|
113
|
-
description:
|
|
112
|
+
title: opts.title,
|
|
113
|
+
description: opts.description,
|
|
114
114
|
story_ids: storyIds,
|
|
115
115
|
});
|
|
116
116
|
if (!result.success || !result.data) {
|
|
117
|
-
|
|
118
|
-
process.exit(1);
|
|
117
|
+
throw new Error(result.error ?? "Failed to update release");
|
|
119
118
|
}
|
|
120
119
|
const release = result.data;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
output(release, opts, (data) => {
|
|
121
|
+
process.stdout.write(`Release updated: ${data.id}\n`);
|
|
122
|
+
process.stdout.write(` Title: ${data.title}\n`);
|
|
123
|
+
process.stdout.write(` Status: ${data.status}\n`);
|
|
124
|
+
});
|
|
124
125
|
});
|
|
125
126
|
releaseCmd
|
|
126
127
|
.command("publish <id>")
|
|
127
128
|
.description("Publish a draft release")
|
|
128
|
-
.
|
|
129
|
+
.option("--json", "Output raw JSON")
|
|
130
|
+
.action(async (id, opts) => {
|
|
129
131
|
const result = await client.publishRelease(id);
|
|
130
132
|
if (!result.success || !result.data) {
|
|
131
|
-
|
|
132
|
-
process.exit(1);
|
|
133
|
+
throw new Error(result.error ?? "Failed to publish release");
|
|
133
134
|
}
|
|
134
135
|
const release = result.data;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
output(release, opts, (data) => {
|
|
137
|
+
process.stdout.write(`Release published: ${data.id}\n`);
|
|
138
|
+
process.stdout.write(` Title: ${data.title}\n`);
|
|
139
|
+
process.stdout.write(` Status: ${data.status}\n`);
|
|
140
|
+
process.stdout.write(` Published at: ${data.published_at ?? "unknown"}\n`);
|
|
141
|
+
});
|
|
139
142
|
});
|
|
140
143
|
}
|
|
141
144
|
//# sourceMappingURL=releases.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releases.js","sourceRoot":"","sources":["../../src/commands/releases.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"releases.js","sourceRoot":"","sources":["../../src/commands/releases.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAe5D,MAAM,UAAU,sBAAsB,CACpC,OAAgB,EAChB,MAAsB,EACtB,SAA4B;IAE5B,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAE7E,UAAU;SACP,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,kCAAkC,CAAC;SAC/C,MAAM,CAAC,oBAAoB,EAAE,0BAA0B,CAAC;SACxD,MAAM,CAAC,mBAAmB,EAAE,oCAAoC,CAAC;SACjE,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;SACnC,MAAM,CAAC,KAAK,EAAE,IAAuD,EAAE,EAAE;QACxE,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAE9E,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EA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QAE/C,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,2BAA2B,CAAC,CAAC;QAC/D,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAkB,CAAC;QAE1C,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,IAAgB,EAAE,EAAE;YACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACxD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;YACxD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;YACzD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,YAAY,IAAI,SAAS,IAAI,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { StoruApiClient } from "../api-client.js";
|
|
3
|
-
|
|
3
|
+
import type { StoruConfig } from "../config.js";
|
|
4
|
+
export declare function registerStoryCommand(program: Command, client: StoruApiClient, getConfig: () => StoruConfig): void;
|
|
4
5
|
//# sourceMappingURL=stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../src/commands/stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../src/commands/stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAwEhD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,WAAW,GAC3B,IAAI,CAqZN"}
|