@letterstory/cli 0.98.3 → 0.98.4
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/targets.mjs +27 -6
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
} from "./commands.mjs";
|
|
60
60
|
|
|
61
61
|
// Keep in sync with cli/package.json.
|
|
62
|
-
export const VERSION = "0.98.
|
|
62
|
+
export const VERSION = "0.98.4";
|
|
63
63
|
|
|
64
64
|
// Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
|
|
65
65
|
// can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
|
package/lib/commands/targets.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// routes and staff Fleet do.
|
|
9
9
|
|
|
10
10
|
import { CliError } from "../client.mjs";
|
|
11
|
-
import { flagStr, flagNum, printResult, argsFromFlags, refuseUnknownFlags, ok } from "./shared.mjs";
|
|
11
|
+
import { flagStr, flagNum, flagList, printResult, argsFromFlags, refuseUnknownFlags, ok } from "./shared.mjs";
|
|
12
12
|
|
|
13
13
|
const STATUSES = ["active", "inactive", "achieved", "retired"];
|
|
14
14
|
const PRIORITIES = ["high", "normal", "low"];
|
|
@@ -25,8 +25,9 @@ function readOffering(flags) {
|
|
|
25
25
|
}
|
|
26
26
|
const offering = { value: readOffering };
|
|
27
27
|
|
|
28
|
-
// `--priority high|normal|low|default`: how
|
|
29
|
-
// voice (high = 3
|
|
28
|
+
// `--priority high|normal|low|default`: how often the target's ground is written across target
|
|
29
|
+
// slots, and how much its questions count in share of voice (high = 3, normal = 2, low = 1);
|
|
30
|
+
// default = back to high, a target's default.
|
|
30
31
|
function readPriority(flags) {
|
|
31
32
|
const v = flagStr(flags.priority);
|
|
32
33
|
if (v === undefined) {
|
|
@@ -55,6 +56,8 @@ export const ARGS = {
|
|
|
55
56
|
mention_framing: "framing",
|
|
56
57
|
offering_id: offering,
|
|
57
58
|
priority,
|
|
59
|
+
// `--stance <text>`, repeatable: one point of view per flag.
|
|
60
|
+
stances: { flag: "stance", type: "list" },
|
|
58
61
|
},
|
|
59
62
|
update_ranking_target: {
|
|
60
63
|
target_id: { positional: 0, label: "target-id", required: true },
|
|
@@ -67,6 +70,14 @@ export const ARGS = {
|
|
|
67
70
|
offering_id: offering,
|
|
68
71
|
position: { flag: "position", type: "num" },
|
|
69
72
|
priority,
|
|
73
|
+
// `--stance <text>` (repeatable) REPLACES the list; `--clear-stances` empties it.
|
|
74
|
+
stances: {
|
|
75
|
+
value: (flags) => {
|
|
76
|
+
if (flags["clear-stances"] === true) return [];
|
|
77
|
+
const list = flagList(flags.stance);
|
|
78
|
+
return list.length ? list : undefined;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
70
81
|
},
|
|
71
82
|
set_ranking_target_cap: {
|
|
72
83
|
offering_id: {
|
|
@@ -117,8 +128,10 @@ export const ARGS = {
|
|
|
117
128
|
const USAGE = `Usage: targets <list|add|update|activate|deactivate|cap|suggest|subqueries|subquery>
|
|
118
129
|
targets list [--offering <offering-id|company>]
|
|
119
130
|
targets add <phrase> [--framing <f>] [--offering <offering-id|company>] [--priority high|normal|low]
|
|
131
|
+
[--stance <s>]... points of view held on this target's ground only
|
|
120
132
|
targets update <target-id> [--phrase <p>] [--framing <f> | --clear-framing] [--offering <offering-id|company>]
|
|
121
133
|
[--position <n>] [--state active|inactive|achieved|retired] [--priority high|normal|low|default]
|
|
134
|
+
[--stance <s>]... | --clear-stances replaces the target's stances
|
|
122
135
|
targets activate <target-id>
|
|
123
136
|
targets deactivate <target-id>
|
|
124
137
|
targets cap <offering-id|company> <n|default>
|
|
@@ -165,7 +178,8 @@ function formatScope(s) {
|
|
|
165
178
|
function formatTarget(t) {
|
|
166
179
|
const framing = t.mention_framing ? ` — as ${t.mention_framing}` : "";
|
|
167
180
|
const prio = t.priority ? ` (${t.priority} priority)` : "";
|
|
168
|
-
|
|
181
|
+
const stances = (t.stances ?? []).map((s) => `\n · ${s}`).join("");
|
|
182
|
+
return ` ${t.id} [${t.status}] ${t.phrase}${framing}${prio}${stances}`;
|
|
169
183
|
}
|
|
170
184
|
|
|
171
185
|
// Targets grouped under their scope, each headed by its cap and usage. A target on an
|
|
@@ -223,7 +237,7 @@ async function update(ctx, flags) {
|
|
|
223
237
|
const args = argsFromFlags(ARGS.update_ranking_target, flags, positionals);
|
|
224
238
|
if (Object.keys(args).length === 1) {
|
|
225
239
|
throw new CliError(
|
|
226
|
-
"Nothing to update — pass --phrase, --framing, --clear-framing, --offering, --position, --state or --priority."
|
|
240
|
+
"Nothing to update — pass --phrase, --framing, --clear-framing, --stance, --clear-stances, --offering, --position, --state or --priority."
|
|
227
241
|
);
|
|
228
242
|
}
|
|
229
243
|
const result = await client.callTool("update_ranking_target", args);
|
|
@@ -233,7 +247,14 @@ async function update(ctx, flags) {
|
|
|
233
247
|
}
|
|
234
248
|
|
|
235
249
|
async function targetsUpdate(ctx) {
|
|
236
|
-
refuseUnknownFlags(ctx, ARGS.update_ranking_target, [
|
|
250
|
+
refuseUnknownFlags(ctx, ARGS.update_ranking_target, [
|
|
251
|
+
"framing",
|
|
252
|
+
"clear-framing",
|
|
253
|
+
"stance",
|
|
254
|
+
"clear-stances",
|
|
255
|
+
"offering",
|
|
256
|
+
"priority",
|
|
257
|
+
]);
|
|
237
258
|
return update(ctx, ctx.flags);
|
|
238
259
|
}
|
|
239
260
|
|