mintree 0.2.2 → 0.2.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.
|
@@ -98,11 +98,15 @@ function kebabize(title) {
|
|
|
98
98
|
* Default prompt seeded into the overlay's Prompt field when the user opens
|
|
99
99
|
* `w` for an issue. Single-line on purpose — `ink-text-input` is one-line,
|
|
100
100
|
* so multi-line templates render weirdly when the user tabs in to edit.
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
101
|
+
* Provider-aware: GitHub issues get the `#<n>` + `gh issue view` form;
|
|
102
|
+
* Plane work items (id like `DSGN-1`) get the bare id + the issue URL,
|
|
103
|
+
* since `gh` can't read Plane and `#` isn't Plane's notation.
|
|
104
104
|
*/
|
|
105
|
-
function defaultPromptForIssue(id, title) {
|
|
105
|
+
function defaultPromptForIssue(id, title, url) {
|
|
106
|
+
const isPlane = /^[A-Z][A-Z0-9_]*-\d+$/.test(id);
|
|
107
|
+
if (isPlane) {
|
|
108
|
+
return `Empezá a trabajar el ticket ${id} (${title}). Abrí ${url} para leer el contexto completo y seguí las convenciones del repo.`;
|
|
109
|
+
}
|
|
106
110
|
return `Empezá a trabajar el issue #${id} (${title}). Usá \`gh issue view ${id}\` para leer el contexto completo y seguí las convenciones del repo.`;
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
@@ -879,7 +883,7 @@ export default function Dashboard() {
|
|
|
879
883
|
currentBranch: root ? getCurrentBranch(root) : null,
|
|
880
884
|
type: "feat",
|
|
881
885
|
desc: kebabize(issue.issue.title) || `issue-${issue.issue.id}`,
|
|
882
|
-
prompt: defaultPromptForIssue(issue.issue.id, issue.issue.title),
|
|
886
|
+
prompt: defaultPromptForIssue(issue.issue.id, issue.issue.title, issue.issue.url),
|
|
883
887
|
field: "branchMode",
|
|
884
888
|
error: null,
|
|
885
889
|
conventionDoc: root ? findBranchConventionDoc(root) : null,
|
|
@@ -972,6 +976,26 @@ export default function Dashboard() {
|
|
|
972
976
|
async function confirmCreate(overlay) {
|
|
973
977
|
if (state.phase !== "ready")
|
|
974
978
|
return;
|
|
979
|
+
// Validate first so we don't flash a spinner just to immediately show
|
|
980
|
+
// a sync-fail message.
|
|
981
|
+
if (overlay.branchMode === "new" && !overlay.desc.trim()) {
|
|
982
|
+
setState({
|
|
983
|
+
...state,
|
|
984
|
+
overlay: { ...overlay, error: "Description is required." },
|
|
985
|
+
});
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
// Surface the spinner BEFORE the heavy sync work. runCreate /
|
|
989
|
+
// runCreateDetached both block the event loop (execSync: git fetch +
|
|
990
|
+
// worktree add + optional .mintree/init.sh — easily several seconds on
|
|
991
|
+
// slow remotes or a repo with a real init script). Without the
|
|
992
|
+
// setImmediate yield Ink wouldn't get to paint the spinner until after
|
|
993
|
+
// that work finished, leaving the user staring at a frozen overlay.
|
|
994
|
+
setState({
|
|
995
|
+
...state,
|
|
996
|
+
overlay: { ...overlay, error: null, pending: "Creating worktree..." },
|
|
997
|
+
});
|
|
998
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
975
999
|
const prompt = overlay.prompt.trim();
|
|
976
1000
|
const issueId = overlay.issue.issue.id;
|
|
977
1001
|
let result;
|
|
@@ -989,13 +1013,6 @@ export default function Dashboard() {
|
|
|
989
1013
|
}
|
|
990
1014
|
else {
|
|
991
1015
|
const desc = overlay.desc.trim();
|
|
992
|
-
if (!desc) {
|
|
993
|
-
setState({
|
|
994
|
-
...state,
|
|
995
|
-
overlay: { ...overlay, error: "Description is required." },
|
|
996
|
-
});
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
1016
|
const branch = `${overlay.type}/${issueId}-${desc}`;
|
|
1000
1017
|
result = runCreate(branch, {
|
|
1001
1018
|
work: true,
|
|
@@ -1005,7 +1022,11 @@ export default function Dashboard() {
|
|
|
1005
1022
|
if (!result.ok) {
|
|
1006
1023
|
setState({
|
|
1007
1024
|
...state,
|
|
1008
|
-
overlay: {
|
|
1025
|
+
overlay: {
|
|
1026
|
+
...overlay,
|
|
1027
|
+
pending: null,
|
|
1028
|
+
error: result.message + (result.hint ? ` — ${result.hint}` : ""),
|
|
1029
|
+
},
|
|
1009
1030
|
});
|
|
1010
1031
|
return;
|
|
1011
1032
|
}
|
|
@@ -362,7 +362,7 @@ function mapWorkItemToProviderIssue(project, workspaceSlug, wi) {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
const state = normaliseState(wi.state);
|
|
365
|
-
const url = `https://app.plane.so/${workspaceSlug}/
|
|
365
|
+
const url = `https://app.plane.so/${workspaceSlug}/browse/${project.identifier}-${wi.sequence_id}/`;
|
|
366
366
|
return {
|
|
367
367
|
id: toIssueId(project, wi.sequence_id),
|
|
368
368
|
title: wi.name,
|
package/package.json
CHANGED