@letterstory/cli 0.175.15 → 0.175.17
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/lib/cli.mjs +1 -1
- package/lib/commands/vary.mjs +17 -3
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
} from "./commands.mjs";
|
|
79
79
|
|
|
80
80
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
81
|
-
export const VERSION = "0.175.
|
|
81
|
+
export const VERSION = "0.175.17";
|
|
82
82
|
|
|
83
83
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
84
84
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
package/lib/commands/vary.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// `vary` — Variationals from a terminal: A/B tests of a page's words and images on your own site
|
|
2
2
|
// (docs/architecture/variationals.md). Thin wrappers over the variationals tools (list_variationals,
|
|
3
3
|
// get_variational, create_variational, update_variational, save_variational_variant,
|
|
4
|
-
// remove_variational_variant, delete_variational), the same lib functions the app calls.
|
|
4
|
+
// remove_variational_variant, delete_variational, ship_variational_winner), the same lib functions the app calls.
|
|
5
5
|
//
|
|
6
6
|
// letterstory vary list [--status running]
|
|
7
7
|
// letterstory vary create --page https://acme.com/pricing [--name "Pricing headline"] [--goals-file goals.json]
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// letterstory vary weights <id> a=50,b=50
|
|
14
14
|
// letterstory vary goals <id> --goals-file goals.json
|
|
15
15
|
// letterstory vary start <id> | pause <id> | end <id> [--winner b]
|
|
16
|
+
// letterstory vary ship <id> [--variant b] the winner written into the site's code, as a pull request
|
|
16
17
|
// letterstory vary remove-variant <id> <key>
|
|
17
18
|
// letterstory vary delete <id>
|
|
18
19
|
|
|
@@ -62,7 +63,10 @@ export const ARGS = {
|
|
|
62
63
|
site_id: "site",
|
|
63
64
|
status: { flag: "status", enum: ["draft", "running", "paused", "ended"] },
|
|
64
65
|
},
|
|
65
|
-
get_variational: {
|
|
66
|
+
get_variational: {
|
|
67
|
+
variational_id: variationalId,
|
|
68
|
+
with_results: { internal: "vary get shows where the test stands, so it always reads results" },
|
|
69
|
+
},
|
|
66
70
|
read_variational_page: { variational_id: variationalId },
|
|
67
71
|
create_variational: {
|
|
68
72
|
page_url: { flag: "page", required: true },
|
|
@@ -70,6 +74,10 @@ export const ARGS = {
|
|
|
70
74
|
name: "name",
|
|
71
75
|
goals: jsonFile("goals-file", "goals"),
|
|
72
76
|
},
|
|
77
|
+
ship_variational_winner: {
|
|
78
|
+
variational_id: variationalId,
|
|
79
|
+
variant: "variant",
|
|
80
|
+
},
|
|
73
81
|
update_variational: {
|
|
74
82
|
variational_id: variationalId,
|
|
75
83
|
name: "name",
|
|
@@ -148,6 +156,12 @@ export async function cmdVary(ctx) {
|
|
|
148
156
|
}
|
|
149
157
|
case "remove-variant":
|
|
150
158
|
return varyShow(rest, await call(rest, "remove_variational_variant"));
|
|
159
|
+
case "ship": {
|
|
160
|
+
refuseUnknownFlags(rest, ARGS.ship_variational_winner, []);
|
|
161
|
+
const result = await call(rest, "ship_variational_winner");
|
|
162
|
+
printResult(rest.io, rest.flags, result, (r) => r.message);
|
|
163
|
+
return 0;
|
|
164
|
+
}
|
|
151
165
|
case "delete": {
|
|
152
166
|
const result = await call(rest, "delete_variational");
|
|
153
167
|
printResult(rest.io, rest.flags, result, (r) => `Deleted ${r.deleted}.`);
|
|
@@ -155,7 +169,7 @@ export async function cmdVary(ctx) {
|
|
|
155
169
|
}
|
|
156
170
|
default:
|
|
157
171
|
throw new CliError(
|
|
158
|
-
"Usage: vary [list|get|page|create|update|weights|goals|start|pause|end|save-variant|remove-variant|delete]"
|
|
172
|
+
"Usage: vary [list|get|page|create|update|weights|goals|start|pause|end|save-variant|remove-variant|ship|delete]"
|
|
159
173
|
);
|
|
160
174
|
}
|
|
161
175
|
}
|