@ycadence/cli 0.3.0 → 0.4.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/bin.js +31 -4
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -168,7 +168,7 @@ async function* paginate(fetchPage, options = {}) {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
// ../sdk/src/version.ts
|
|
171
|
-
var SDK_VERSION = "0.
|
|
171
|
+
var SDK_VERSION = "0.3.0";
|
|
172
172
|
|
|
173
173
|
// ../sdk/src/client.ts
|
|
174
174
|
var DEFAULT_RETRY = { retries: 2, baseDelayMs: 250, maxDelayMs: 8000 };
|
|
@@ -1685,6 +1685,17 @@ function closingState(states) {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
return done;
|
|
1687
1687
|
}
|
|
1688
|
+
async function resolveTypeId(client, projectId, value) {
|
|
1689
|
+
if (isUuid(value))
|
|
1690
|
+
return value;
|
|
1691
|
+
const { types: types2 } = await client.listTypes(projectId);
|
|
1692
|
+
const named = types2.filter((type) => typeof type.id === "string" && typeof type.name === "string");
|
|
1693
|
+
const match = named.find((type) => type.name.toLowerCase() === value.toLowerCase());
|
|
1694
|
+
if (match === undefined) {
|
|
1695
|
+
throw new CliError(`No work item type "${value}" in this project. Types: ${named.map((type) => type.name).join(", ")}.`, "validation_failed", EXIT.validation);
|
|
1696
|
+
}
|
|
1697
|
+
return match.id;
|
|
1698
|
+
}
|
|
1688
1699
|
var KEY_SCAN_LIMIT = 2000;
|
|
1689
1700
|
async function resolveWorkItemId(client, value, projectId) {
|
|
1690
1701
|
if (isUuid(value))
|
|
@@ -2226,7 +2237,7 @@ var configPathHandler = async (context) => {
|
|
|
2226
2237
|
};
|
|
2227
2238
|
|
|
2228
2239
|
// src/version.ts
|
|
2229
|
-
var CLI_VERSION = "0.
|
|
2240
|
+
var CLI_VERSION = "0.4.0";
|
|
2230
2241
|
|
|
2231
2242
|
// src/handlers/doctor.ts
|
|
2232
2243
|
function legacyNote(name, env) {
|
|
@@ -2627,6 +2638,12 @@ var WORK_FIELD_FLAGS = {
|
|
|
2627
2638
|
placeholder: "<name|id>",
|
|
2628
2639
|
description: "State, by name or id"
|
|
2629
2640
|
},
|
|
2641
|
+
type: {
|
|
2642
|
+
name: "type",
|
|
2643
|
+
type: "string",
|
|
2644
|
+
placeholder: "<name|id>",
|
|
2645
|
+
description: "Work item type, by name or id"
|
|
2646
|
+
},
|
|
2630
2647
|
parent: {
|
|
2631
2648
|
name: "parent",
|
|
2632
2649
|
type: "string",
|
|
@@ -2759,6 +2776,9 @@ var createWork = async (context) => {
|
|
|
2759
2776
|
if (stateValue !== undefined) {
|
|
2760
2777
|
body.stateId = isUuid(stateValue) ? stateValue : findState(await listStates(client, projectId), stateValue).id;
|
|
2761
2778
|
}
|
|
2779
|
+
const typeValue = str6(context.flags.type);
|
|
2780
|
+
if (typeValue !== undefined)
|
|
2781
|
+
body.typeId = await resolveTypeId(client, projectId, typeValue);
|
|
2762
2782
|
const assignees = list(context.flags.assignee);
|
|
2763
2783
|
for (const assignee of assignees) {
|
|
2764
2784
|
if (!isUuid(assignee)) {
|
|
@@ -2807,6 +2827,10 @@ var updateWork = async (context) => {
|
|
|
2807
2827
|
if (stateValue !== undefined) {
|
|
2808
2828
|
body.stateId = isUuid(stateValue) ? stateValue : findState(await listStates(client, await context.projectId()), stateValue).id;
|
|
2809
2829
|
}
|
|
2830
|
+
const typeValue = str6(context.flags.type);
|
|
2831
|
+
if (typeValue !== undefined) {
|
|
2832
|
+
body.typeId = isUuid(typeValue) ? typeValue : await resolveTypeId(client, await context.projectId(), typeValue);
|
|
2833
|
+
}
|
|
2810
2834
|
if (context.flags["no-parent"] === true)
|
|
2811
2835
|
body.parentId = null;
|
|
2812
2836
|
const parent = str6(context.flags.parent);
|
|
@@ -2819,7 +2843,7 @@ var updateWork = async (context) => {
|
|
|
2819
2843
|
if (targetDate !== undefined)
|
|
2820
2844
|
body.targetDate = targetDate;
|
|
2821
2845
|
if (Object.keys(body).length === 0) {
|
|
2822
|
-
throw new UsageError("Nothing to update. Pass at least one of --title, --description, --priority, --state, --parent, --start-date, --target-date.");
|
|
2846
|
+
throw new UsageError("Nothing to update. Pass at least one of --title, --description, --priority, --state, --type, --parent, --start-date, --target-date.");
|
|
2823
2847
|
}
|
|
2824
2848
|
const version = context.flags["expect-version"];
|
|
2825
2849
|
const updated = await client.updateWorkItem(id, body, context.mutationOptions(version === undefined ? {} : { expectedVersion: version }));
|
|
@@ -3012,6 +3036,7 @@ var TREE = {
|
|
|
3012
3036
|
WORK_FIELD_FLAGS.descriptionFile,
|
|
3013
3037
|
WORK_FIELD_FLAGS.priority,
|
|
3014
3038
|
WORK_FIELD_FLAGS.state,
|
|
3039
|
+
WORK_FIELD_FLAGS.type,
|
|
3015
3040
|
{
|
|
3016
3041
|
name: "assignee",
|
|
3017
3042
|
type: "string",
|
|
@@ -3032,7 +3057,8 @@ var TREE = {
|
|
|
3032
3057
|
],
|
|
3033
3058
|
examples: [
|
|
3034
3059
|
'ycadence work create --project <projectId> --title "Fix login redirect" --priority high',
|
|
3035
|
-
'ycadence work create --title "Spike" --description-file notes.md --idempotency-key spike-1'
|
|
3060
|
+
'ycadence work create --title "Spike" --description-file notes.md --idempotency-key spike-1',
|
|
3061
|
+
'ycadence work create --project <projectId> --title "Pick a billing provider" --type Decision --label decisions'
|
|
3036
3062
|
],
|
|
3037
3063
|
run: createWork
|
|
3038
3064
|
},
|
|
@@ -3047,6 +3073,7 @@ var TREE = {
|
|
|
3047
3073
|
WORK_FIELD_FLAGS.descriptionFile,
|
|
3048
3074
|
WORK_FIELD_FLAGS.priority,
|
|
3049
3075
|
WORK_FIELD_FLAGS.state,
|
|
3076
|
+
WORK_FIELD_FLAGS.type,
|
|
3050
3077
|
WORK_FIELD_FLAGS.parent,
|
|
3051
3078
|
{ name: "no-parent", type: "boolean", description: "Remove the parent" },
|
|
3052
3079
|
WORK_FIELD_FLAGS.startDate,
|