@ship-cli/core 0.1.4 → 0.1.6
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 +145 -38
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -38265,6 +38265,29 @@ var modifyWorkspacesFile = (configRepo, modify7) => withWorkspaceLock(
|
|
|
38265
38265
|
);
|
|
38266
38266
|
|
|
38267
38267
|
// src/adapters/driving/cli/commands/init.ts
|
|
38268
|
+
var CREATE_NEW = "__create_new__";
|
|
38269
|
+
var NO_PROJECT = null;
|
|
38270
|
+
var formatApiError = (error4) => pipe(
|
|
38271
|
+
error4,
|
|
38272
|
+
value4,
|
|
38273
|
+
tag4("LinearApiError", (e2) => e2.message),
|
|
38274
|
+
tag4("TaskError", (e2) => e2.message),
|
|
38275
|
+
exhaustive2
|
|
38276
|
+
);
|
|
38277
|
+
var tryCreate = (effect3, spinner, successMsg, failureContext) => effect3.pipe(
|
|
38278
|
+
tap2((a) => sync4(() => spinner.stop(successMsg(a)))),
|
|
38279
|
+
map17(some2),
|
|
38280
|
+
catchAll2(
|
|
38281
|
+
(error4) => sync4(() => {
|
|
38282
|
+
spinner.stop(`Failed to create ${failureContext}`);
|
|
38283
|
+
M2.error(
|
|
38284
|
+
`Could not create ${failureContext}: ${formatApiError(error4)}
|
|
38285
|
+
You may not have permission to create ${failureContext}s.`
|
|
38286
|
+
);
|
|
38287
|
+
return none2();
|
|
38288
|
+
})
|
|
38289
|
+
)
|
|
38290
|
+
);
|
|
38268
38291
|
var teamOption = text8("team").pipe(
|
|
38269
38292
|
withAlias2("t"),
|
|
38270
38293
|
withDescription3("Team ID or key to use"),
|
|
@@ -38328,11 +38351,6 @@ Project: ${partial2.linear.value.projectId.value}` : ""}`,
|
|
|
38328
38351
|
tap2(() => sync4(() => teamSpinner.stop("Teams loaded"))),
|
|
38329
38352
|
tapError2(() => sync4(() => teamSpinner.stop("Failed to fetch teams")))
|
|
38330
38353
|
);
|
|
38331
|
-
if (teams.length === 0) {
|
|
38332
|
-
M2.error("No teams found. Please create a team in Linear first.");
|
|
38333
|
-
Se("Setup incomplete");
|
|
38334
|
-
return;
|
|
38335
|
-
}
|
|
38336
38354
|
let selectedTeam;
|
|
38337
38355
|
if (isSome2(team)) {
|
|
38338
38356
|
const found = teams.find((t) => t.id === team.value || t.key === team.value);
|
|
@@ -38348,14 +38366,61 @@ Project: ${partial2.linear.value.projectId.value}` : ""}`,
|
|
|
38348
38366
|
selectedTeam = teams[0];
|
|
38349
38367
|
M2.success(`Using team: ${selectedTeam.key} - ${selectedTeam.name}`);
|
|
38350
38368
|
} else {
|
|
38351
|
-
const
|
|
38352
|
-
|
|
38353
|
-
options: teams.map((t) => ({
|
|
38369
|
+
const teamOptions = [
|
|
38370
|
+
...teams.map((t) => ({
|
|
38354
38371
|
value: t.id,
|
|
38355
38372
|
label: `${t.key} - ${t.name}`
|
|
38356
|
-
}))
|
|
38373
|
+
})),
|
|
38374
|
+
{ value: CREATE_NEW, label: "Create new team..." }
|
|
38375
|
+
];
|
|
38376
|
+
const teamChoice = yield* prompts.select({
|
|
38377
|
+
message: "Select a team",
|
|
38378
|
+
options: teamOptions
|
|
38357
38379
|
});
|
|
38358
|
-
|
|
38380
|
+
if (teamChoice === CREATE_NEW) {
|
|
38381
|
+
const teamName = yield* prompts.text({
|
|
38382
|
+
message: "Team name",
|
|
38383
|
+
placeholder: "My Team",
|
|
38384
|
+
validate: (v2) => !v2 ? "Name is required" : void 0
|
|
38385
|
+
});
|
|
38386
|
+
const teamKey = yield* prompts.text({
|
|
38387
|
+
message: "Team key (short identifier, e.g. ENG)",
|
|
38388
|
+
placeholder: "ENG",
|
|
38389
|
+
validate: (v2) => {
|
|
38390
|
+
if (!v2) return "Key is required";
|
|
38391
|
+
if (!/^[A-Z]{2,5}$/.test(v2.toUpperCase())) return "Key must be 2-5 uppercase letters";
|
|
38392
|
+
return void 0;
|
|
38393
|
+
}
|
|
38394
|
+
});
|
|
38395
|
+
const createSpinner = Y2();
|
|
38396
|
+
createSpinner.start("Creating team...");
|
|
38397
|
+
const maybeTeam = yield* tryCreate(
|
|
38398
|
+
teamRepo.createTeam({ name: teamName, key: teamKey.toUpperCase() }),
|
|
38399
|
+
createSpinner,
|
|
38400
|
+
(t) => `Created team: ${t.key}`,
|
|
38401
|
+
"team"
|
|
38402
|
+
);
|
|
38403
|
+
if (isNone2(maybeTeam)) {
|
|
38404
|
+
if (teams.length === 0) {
|
|
38405
|
+
M2.error("No teams available and could not create one.");
|
|
38406
|
+
Se("Setup incomplete");
|
|
38407
|
+
return;
|
|
38408
|
+
}
|
|
38409
|
+
M2.info("Please select an existing team instead.");
|
|
38410
|
+
const fallbackChoice = yield* prompts.select({
|
|
38411
|
+
message: "Select a team",
|
|
38412
|
+
options: teams.map((t) => ({
|
|
38413
|
+
value: t.id,
|
|
38414
|
+
label: `${t.key} - ${t.name}`
|
|
38415
|
+
}))
|
|
38416
|
+
});
|
|
38417
|
+
selectedTeam = teams.find((t) => t.id === fallbackChoice);
|
|
38418
|
+
} else {
|
|
38419
|
+
selectedTeam = maybeTeam.value;
|
|
38420
|
+
}
|
|
38421
|
+
} else {
|
|
38422
|
+
selectedTeam = teams.find((t) => t.id === teamChoice);
|
|
38423
|
+
}
|
|
38359
38424
|
}
|
|
38360
38425
|
const projectSpinner = Y2();
|
|
38361
38426
|
projectSpinner.start("Fetching projects...");
|
|
@@ -38371,18 +38436,62 @@ Project: ${partial2.linear.value.projectId.value}` : ""}`,
|
|
|
38371
38436
|
`Project '${project2.value}' not found, continuing without project filter.`
|
|
38372
38437
|
);
|
|
38373
38438
|
}
|
|
38374
|
-
} else
|
|
38439
|
+
} else {
|
|
38440
|
+
const projectOptions = [
|
|
38441
|
+
{ value: NO_PROJECT, label: "No project filter", hint: "show all team tasks" },
|
|
38442
|
+
...projects.map((p4) => ({
|
|
38443
|
+
value: p4.id,
|
|
38444
|
+
label: p4.name
|
|
38445
|
+
})),
|
|
38446
|
+
{ value: CREATE_NEW, label: "Create new project..." }
|
|
38447
|
+
];
|
|
38375
38448
|
const projectChoice = yield* prompts.select({
|
|
38376
38449
|
message: "Select a project (optional)",
|
|
38377
|
-
options:
|
|
38378
|
-
{ value: null, label: "No project filter" },
|
|
38379
|
-
...projects.map((p4) => ({
|
|
38380
|
-
value: p4.id,
|
|
38381
|
-
label: p4.name
|
|
38382
|
-
}))
|
|
38383
|
-
]
|
|
38450
|
+
options: projectOptions
|
|
38384
38451
|
});
|
|
38385
|
-
if (projectChoice) {
|
|
38452
|
+
if (projectChoice === CREATE_NEW) {
|
|
38453
|
+
const projectName = yield* prompts.text({
|
|
38454
|
+
message: "Project name",
|
|
38455
|
+
placeholder: "My Project",
|
|
38456
|
+
validate: (v2) => !v2 ? "Name is required" : void 0
|
|
38457
|
+
});
|
|
38458
|
+
const projectDesc = yield* prompts.text({
|
|
38459
|
+
message: "Description (optional)",
|
|
38460
|
+
placeholder: "A brief description of the project"
|
|
38461
|
+
});
|
|
38462
|
+
const createSpinner = Y2();
|
|
38463
|
+
createSpinner.start("Creating project...");
|
|
38464
|
+
const createInput = {
|
|
38465
|
+
name: projectName,
|
|
38466
|
+
...projectDesc && { description: projectDesc }
|
|
38467
|
+
};
|
|
38468
|
+
const maybeProject = yield* tryCreate(
|
|
38469
|
+
projectRepo.createProject(selectedTeam.id, createInput),
|
|
38470
|
+
createSpinner,
|
|
38471
|
+
(p4) => `Created project: ${p4.name}`,
|
|
38472
|
+
"project"
|
|
38473
|
+
);
|
|
38474
|
+
if (isSome2(maybeProject)) {
|
|
38475
|
+
selectedProject = maybeProject.value;
|
|
38476
|
+
} else if (projects.length > 0) {
|
|
38477
|
+
M2.info("Please select an existing project instead, or continue without one.");
|
|
38478
|
+
const fallbackChoice = yield* prompts.select({
|
|
38479
|
+
message: "Select a project",
|
|
38480
|
+
options: [
|
|
38481
|
+
{ value: NO_PROJECT, label: "No project filter" },
|
|
38482
|
+
...projects.map((p4) => ({
|
|
38483
|
+
value: p4.id,
|
|
38484
|
+
label: p4.name
|
|
38485
|
+
}))
|
|
38486
|
+
]
|
|
38487
|
+
});
|
|
38488
|
+
if (fallbackChoice !== NO_PROJECT) {
|
|
38489
|
+
selectedProject = projects.find((p4) => p4.id === fallbackChoice);
|
|
38490
|
+
}
|
|
38491
|
+
} else {
|
|
38492
|
+
M2.info("Continuing without a project filter.");
|
|
38493
|
+
}
|
|
38494
|
+
} else if (projectChoice !== NO_PROJECT) {
|
|
38386
38495
|
selectedProject = projects.find((p4) => p4.id === projectChoice);
|
|
38387
38496
|
}
|
|
38388
38497
|
}
|
|
@@ -38437,7 +38546,7 @@ var loginCommand = make58(
|
|
|
38437
38546
|
);
|
|
38438
38547
|
|
|
38439
38548
|
// src/adapters/driving/cli/commands/team.ts
|
|
38440
|
-
var
|
|
38549
|
+
var CREATE_NEW2 = "__create_new__";
|
|
38441
38550
|
var teamCommand = make58(
|
|
38442
38551
|
"team",
|
|
38443
38552
|
{},
|
|
@@ -38468,14 +38577,14 @@ var teamCommand = make58(
|
|
|
38468
38577
|
...teams.map(
|
|
38469
38578
|
(t) => currentTeamId === t.id ? { value: t.id, label: `${t.key} - ${t.name}`, hint: "current" } : { value: t.id, label: `${t.key} - ${t.name}` }
|
|
38470
38579
|
),
|
|
38471
|
-
{ value:
|
|
38580
|
+
{ value: CREATE_NEW2, label: "Create new team..." }
|
|
38472
38581
|
];
|
|
38473
38582
|
const teamChoice = yield* prompts.select({
|
|
38474
38583
|
message: "Select a team",
|
|
38475
38584
|
options: teamOptions
|
|
38476
38585
|
});
|
|
38477
38586
|
let selectedTeam;
|
|
38478
|
-
if (teamChoice ===
|
|
38587
|
+
if (teamChoice === CREATE_NEW2) {
|
|
38479
38588
|
const teamName = yield* prompts.text({
|
|
38480
38589
|
message: "Team name",
|
|
38481
38590
|
placeholder: "My Team",
|
|
@@ -38520,8 +38629,8 @@ var teamCommand = make58(
|
|
|
38520
38629
|
);
|
|
38521
38630
|
|
|
38522
38631
|
// src/adapters/driving/cli/commands/project.ts
|
|
38523
|
-
var
|
|
38524
|
-
var
|
|
38632
|
+
var CREATE_NEW3 = "__create_new__";
|
|
38633
|
+
var NO_PROJECT2 = null;
|
|
38525
38634
|
var projectCommand = make58(
|
|
38526
38635
|
"project",
|
|
38527
38636
|
{},
|
|
@@ -38556,18 +38665,18 @@ var projectCommand = make58(
|
|
|
38556
38665
|
);
|
|
38557
38666
|
const currentProjectId = isSome2(currentConfig.projectId) ? currentConfig.projectId.value : null;
|
|
38558
38667
|
const projectOptions = [
|
|
38559
|
-
{ value:
|
|
38668
|
+
{ value: NO_PROJECT2, label: "No project filter", hint: "show all team tasks" },
|
|
38560
38669
|
...projects.map(
|
|
38561
38670
|
(p4) => currentProjectId === p4.id ? { value: p4.id, label: p4.name, hint: "current" } : { value: p4.id, label: p4.name }
|
|
38562
38671
|
),
|
|
38563
|
-
{ value:
|
|
38672
|
+
{ value: CREATE_NEW3, label: "Create new project..." }
|
|
38564
38673
|
];
|
|
38565
38674
|
const projectChoice = yield* prompts.select({
|
|
38566
38675
|
message: "Select a project",
|
|
38567
38676
|
options: projectOptions
|
|
38568
38677
|
});
|
|
38569
38678
|
let selectedProject;
|
|
38570
|
-
if (projectChoice ===
|
|
38679
|
+
if (projectChoice === CREATE_NEW3) {
|
|
38571
38680
|
const projectName = yield* prompts.text({
|
|
38572
38681
|
message: "Project name",
|
|
38573
38682
|
placeholder: "My Project",
|
|
@@ -38589,7 +38698,7 @@ var projectCommand = make58(
|
|
|
38589
38698
|
),
|
|
38590
38699
|
tapError2(() => sync4(() => createSpinner.stop("Failed to create project")))
|
|
38591
38700
|
);
|
|
38592
|
-
} else if (projectChoice !==
|
|
38701
|
+
} else if (projectChoice !== NO_PROJECT2) {
|
|
38593
38702
|
const found = projects.find((p4) => p4.id === projectChoice);
|
|
38594
38703
|
if (!found) {
|
|
38595
38704
|
M2.error("Selected project not found. Please try again.");
|
|
@@ -191123,7 +191232,7 @@ var command = ship.pipe(
|
|
|
191123
191232
|
prCommand
|
|
191124
191233
|
])
|
|
191125
191234
|
);
|
|
191126
|
-
var version = "0.1.
|
|
191235
|
+
var version = "0.1.6" ;
|
|
191127
191236
|
var run9 = run8(command, {
|
|
191128
191237
|
name: "ship",
|
|
191129
191238
|
version
|
|
@@ -194595,19 +194704,17 @@ var make72 = gen2(function* () {
|
|
|
194595
194704
|
new TaskError({ message: "Failed to create project" })
|
|
194596
194705
|
);
|
|
194597
194706
|
}
|
|
194598
|
-
|
|
194707
|
+
const projectId = result.projectId;
|
|
194708
|
+
if (!projectId) {
|
|
194599
194709
|
return yield* fail7(
|
|
194600
|
-
new TaskError({ message: "Project not returned after create" })
|
|
194710
|
+
new TaskError({ message: "Project ID not returned after create" })
|
|
194601
194711
|
);
|
|
194602
194712
|
}
|
|
194603
|
-
|
|
194604
|
-
|
|
194605
|
-
|
|
194606
|
-
|
|
194607
|
-
cause: e2
|
|
194608
|
-
})
|
|
194713
|
+
return new Project({
|
|
194714
|
+
id: projectId,
|
|
194715
|
+
name: input.name,
|
|
194716
|
+
teamId
|
|
194609
194717
|
});
|
|
194610
|
-
return mapProject(project2, teamId);
|
|
194611
194718
|
}),
|
|
194612
194719
|
"Creating project"
|
|
194613
194720
|
);
|