@alejandrochaves/devflow-cli 1.7.0 → 1.8.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/README.md +9 -3
- package/dist/cli-runner.d.ts +1 -0
- package/dist/cli-runner.js +17 -0
- package/dist/colors.d.ts +0 -1
- package/dist/colors.js +0 -1
- package/dist/commands/amend.d.ts +0 -1
- package/dist/commands/amend.js +3 -3
- package/dist/commands/branch.d.ts +0 -1
- package/dist/commands/branch.js +4 -5
- package/dist/commands/changelog.d.ts +0 -1
- package/dist/commands/changelog.js +0 -1
- package/dist/commands/cleanup.d.ts +0 -1
- package/dist/commands/cleanup.js +4 -3
- package/dist/commands/comments.d.ts +0 -1
- package/dist/commands/comments.js +0 -1
- package/dist/commands/commit.d.ts +0 -1
- package/dist/commands/commit.js +0 -1
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/doctor.js +0 -1
- package/dist/commands/fixup.d.ts +0 -1
- package/dist/commands/fixup.js +3 -4
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +57 -13
- package/dist/commands/issue.d.ts +0 -1
- package/dist/commands/issue.js +5 -21
- package/dist/commands/issues.d.ts +0 -1
- package/dist/commands/issues.js +2 -3
- package/dist/commands/lint-config.d.ts +0 -1
- package/dist/commands/lint-config.js +0 -1
- package/dist/commands/log.d.ts +0 -1
- package/dist/commands/log.js +5 -6
- package/dist/commands/merge.d.ts +0 -1
- package/dist/commands/merge.js +5 -6
- package/dist/commands/pr.d.ts +0 -1
- package/dist/commands/pr.js +68 -17
- package/dist/commands/release.d.ts +0 -1
- package/dist/commands/release.js +0 -1
- package/dist/commands/review.d.ts +0 -1
- package/dist/commands/review.js +0 -1
- package/dist/commands/stash.d.ts +1 -1
- package/dist/commands/stash.js +26 -12
- package/dist/commands/stats.d.ts +0 -1
- package/dist/commands/stats.js +0 -1
- package/dist/commands/status.d.ts +0 -1
- package/dist/commands/status.js +4 -2
- package/dist/commands/test-plan.d.ts +0 -1
- package/dist/commands/test-plan.js +0 -1
- package/dist/commands/undo.d.ts +0 -1
- package/dist/commands/undo.js +4 -5
- package/dist/commands/update.d.ts +0 -1
- package/dist/commands/update.js +71 -1
- package/dist/commands/worktree.d.ts +1 -1
- package/dist/commands/worktree.js +30 -21
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -1
- package/dist/devflow-version.d.ts +1 -1
- package/dist/devflow-version.js +1 -1
- package/dist/git.d.ts +2 -1
- package/dist/git.js +30 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +28 -25
- package/dist/monorepo.d.ts +0 -1
- package/dist/monorepo.js +0 -1
- package/dist/output.d.ts +3 -0
- package/dist/output.js +13 -0
- package/dist/plugins.d.ts +0 -1
- package/dist/plugins.js +0 -1
- package/dist/prompts.d.ts +0 -1
- package/dist/prompts.js +0 -1
- package/dist/providers/projects.d.ts +0 -1
- package/dist/providers/projects.js +3 -10
- package/dist/providers/tickets.d.ts +0 -1
- package/dist/providers/tickets.js +0 -1
- package/dist/test-plan.d.ts +0 -1
- package/dist/test-plan.js +0 -1
- package/dist/update-notifier.d.ts +0 -1
- package/dist/update-notifier.js +33 -26
- package/package.json +1 -1
- package/dist/colors.d.ts.map +0 -1
- package/dist/colors.js.map +0 -1
- package/dist/commands/amend.d.ts.map +0 -1
- package/dist/commands/amend.js.map +0 -1
- package/dist/commands/branch.d.ts.map +0 -1
- package/dist/commands/branch.js.map +0 -1
- package/dist/commands/changelog.d.ts.map +0 -1
- package/dist/commands/changelog.js.map +0 -1
- package/dist/commands/cleanup.d.ts.map +0 -1
- package/dist/commands/cleanup.js.map +0 -1
- package/dist/commands/comments.d.ts.map +0 -1
- package/dist/commands/comments.js.map +0 -1
- package/dist/commands/commit.d.ts.map +0 -1
- package/dist/commands/commit.js.map +0 -1
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/fixup.d.ts.map +0 -1
- package/dist/commands/fixup.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/issue.d.ts.map +0 -1
- package/dist/commands/issue.js.map +0 -1
- package/dist/commands/issues.d.ts.map +0 -1
- package/dist/commands/issues.js.map +0 -1
- package/dist/commands/lint-config.d.ts.map +0 -1
- package/dist/commands/lint-config.js.map +0 -1
- package/dist/commands/log.d.ts.map +0 -1
- package/dist/commands/log.js.map +0 -1
- package/dist/commands/merge.d.ts.map +0 -1
- package/dist/commands/merge.js.map +0 -1
- package/dist/commands/pr.d.ts.map +0 -1
- package/dist/commands/pr.js.map +0 -1
- package/dist/commands/release.d.ts.map +0 -1
- package/dist/commands/release.js.map +0 -1
- package/dist/commands/review.d.ts.map +0 -1
- package/dist/commands/review.js.map +0 -1
- package/dist/commands/stash.d.ts.map +0 -1
- package/dist/commands/stash.js.map +0 -1
- package/dist/commands/stats.d.ts.map +0 -1
- package/dist/commands/stats.js.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/test-plan.d.ts.map +0 -1
- package/dist/commands/test-plan.js.map +0 -1
- package/dist/commands/undo.d.ts.map +0 -1
- package/dist/commands/undo.js.map +0 -1
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/worktree.d.ts.map +0 -1
- package/dist/commands/worktree.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/devflow-version.d.ts.map +0 -1
- package/dist/devflow-version.js.map +0 -1
- package/dist/git.d.ts.map +0 -1
- package/dist/git.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/monorepo.d.ts.map +0 -1
- package/dist/monorepo.js.map +0 -1
- package/dist/plugins.d.ts.map +0 -1
- package/dist/plugins.js.map +0 -1
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js.map +0 -1
- package/dist/providers/projects.d.ts.map +0 -1
- package/dist/providers/projects.js.map +0 -1
- package/dist/providers/tickets.d.ts.map +0 -1
- package/dist/providers/tickets.js.map +0 -1
- package/dist/test-plan.d.ts.map +0 -1
- package/dist/test-plan.js.map +0 -1
- package/dist/update-notifier.d.ts.map +0 -1
- package/dist/update-notifier.js.map +0 -1
package/dist/commands/pr.js
CHANGED
|
@@ -52,7 +52,7 @@ function ensureLabel(label) {
|
|
|
52
52
|
}
|
|
53
53
|
function getExistingPr() {
|
|
54
54
|
try {
|
|
55
|
-
const result = execSync("gh pr view --json url,number", {
|
|
55
|
+
const result = execSync("gh pr view --json url,number,state", {
|
|
56
56
|
encoding: "utf-8",
|
|
57
57
|
stdio: ["pipe", "pipe", "ignore"],
|
|
58
58
|
}).trim();
|
|
@@ -113,15 +113,52 @@ export async function prCommand(options = {}) {
|
|
|
113
113
|
const branch = getBranch();
|
|
114
114
|
const { type, ticket, description } = parseBranch(branch);
|
|
115
115
|
const existingPr = getExistingPr();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
let prAction = existingPr?.state === "OPEN" ? "update" : "create";
|
|
117
|
+
if (existingPr) {
|
|
118
|
+
if (existingPr.state === "OPEN" && !options.yes) {
|
|
119
|
+
console.log(`\n${cyan(`PR #${existingPr.number}`)} already exists: ${existingPr.url}`);
|
|
120
|
+
const shouldUpdate = await confirmWithBack({
|
|
121
|
+
message: "Update this PR?",
|
|
122
|
+
default: true,
|
|
123
|
+
showBack: false,
|
|
124
|
+
});
|
|
125
|
+
if (shouldUpdate !== true) {
|
|
126
|
+
process.exit(0);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (existingPr.state === "MERGED") {
|
|
130
|
+
if (!options.yes) {
|
|
131
|
+
console.log(`\n${cyan(`PR #${existingPr.number}`)} is already ${dim("merged")}: ${existingPr.url}`);
|
|
132
|
+
const proceed = await confirmWithBack({
|
|
133
|
+
message: "Create a new PR for this branch?",
|
|
134
|
+
default: true,
|
|
135
|
+
showBack: false,
|
|
136
|
+
});
|
|
137
|
+
if (proceed !== true) {
|
|
138
|
+
process.exit(0);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// prAction stays "create"
|
|
142
|
+
}
|
|
143
|
+
else if (existingPr.state === "CLOSED") {
|
|
144
|
+
if (!options.yes) {
|
|
145
|
+
console.log(`\n${cyan(`PR #${existingPr.number}`)} is ${dim("closed")}: ${existingPr.url}`);
|
|
146
|
+
const choice = await selectWithBack({
|
|
147
|
+
message: "What would you like to do?",
|
|
148
|
+
choices: [
|
|
149
|
+
{ value: "reopen", name: "Reopen and update existing PR" },
|
|
150
|
+
{ value: "new", name: "Create a new PR" },
|
|
151
|
+
{ value: "cancel", name: "Cancel" },
|
|
152
|
+
],
|
|
153
|
+
default: "new",
|
|
154
|
+
showBack: false,
|
|
155
|
+
});
|
|
156
|
+
if (choice === BACK_VALUE || choice === "cancel") {
|
|
157
|
+
process.exit(0);
|
|
158
|
+
}
|
|
159
|
+
prAction = choice === "reopen" ? "reopen" : "create";
|
|
160
|
+
}
|
|
161
|
+
// under --yes: prAction stays "create"
|
|
125
162
|
}
|
|
126
163
|
}
|
|
127
164
|
const defaultBase = getDefaultBase(branch);
|
|
@@ -237,9 +274,15 @@ export async function prCommand(options = {}) {
|
|
|
237
274
|
previewLabels.push(...previewScopes);
|
|
238
275
|
const uniquePreviewLabels = [...new Set(previewLabels)];
|
|
239
276
|
console.log(`\n${dim("───")} ${bold("PR Preview")} ${dim("───")}`);
|
|
240
|
-
if (
|
|
277
|
+
if (prAction === "update") {
|
|
241
278
|
console.log(gray(`(Updating existing PR #${existingPr.number})`));
|
|
242
279
|
}
|
|
280
|
+
else if (prAction === "reopen") {
|
|
281
|
+
console.log(gray(`(Reopening and updating PR #${existingPr.number})`));
|
|
282
|
+
}
|
|
283
|
+
else if (existingPr) {
|
|
284
|
+
console.log(gray(`(Creating new PR; previous PR #${existingPr.number} was ${existingPr.state.toLowerCase()})`));
|
|
285
|
+
}
|
|
243
286
|
console.log(`${dim("Title:")} ${bold(title)}`);
|
|
244
287
|
console.log(`${dim("Branch:")} ${cyan(branch)} → ${cyan(base.trim())}`);
|
|
245
288
|
console.log(`${dim("Labels:")} ${uniquePreviewLabels.length > 0 ? uniquePreviewLabels.join(", ") : "none"}`);
|
|
@@ -256,12 +299,16 @@ export async function prCommand(options = {}) {
|
|
|
256
299
|
}
|
|
257
300
|
// Confirm (skip if --yes)
|
|
258
301
|
if (!options.yes) {
|
|
302
|
+
const confirmMessage = prAction === "update" ? `Update PR #${existingPr.number}?` :
|
|
303
|
+
prAction === "reopen" ? `Reopen and update PR #${existingPr.number}?` :
|
|
304
|
+
"Create this PR?";
|
|
305
|
+
const confirmYesLabel = prAction === "update" ? "Yes, update PR" :
|
|
306
|
+
prAction === "reopen" ? "Yes, reopen and update" :
|
|
307
|
+
"Yes, create PR";
|
|
259
308
|
const confirmResult = await selectWithBack({
|
|
260
|
-
message:
|
|
261
|
-
? `Update PR #${existingPr.number}?`
|
|
262
|
-
: "Create this PR?",
|
|
309
|
+
message: confirmMessage,
|
|
263
310
|
choices: [
|
|
264
|
-
{ value: "yes", name:
|
|
311
|
+
{ value: "yes", name: confirmYesLabel },
|
|
265
312
|
{ value: "no", name: "No, abort" },
|
|
266
313
|
],
|
|
267
314
|
default: "yes",
|
|
@@ -305,7 +352,12 @@ export async function prCommand(options = {}) {
|
|
|
305
352
|
: "";
|
|
306
353
|
// Draft flag (unless --ready is specified)
|
|
307
354
|
const draftFlag = options.ready ? "" : " --draft";
|
|
308
|
-
if (
|
|
355
|
+
if (prAction === "reopen") {
|
|
356
|
+
execSync(`gh pr reopen ${existingPr.number}`, { stdio: "inherit" });
|
|
357
|
+
execSync(`gh pr edit ${existingPr.number} --title ${JSON.stringify(title)} --body-file -${labelFlag ? ` --add-label ${labelFlag}` : ""}`, { input: body, stdio: ["pipe", "inherit", "inherit"] });
|
|
358
|
+
console.log(green(`✓ PR #${existingPr.number} reopened and updated: ${existingPr.url}`));
|
|
359
|
+
}
|
|
360
|
+
else if (prAction === "update") {
|
|
309
361
|
execSync(`gh pr edit ${existingPr.number} --title ${JSON.stringify(title)} --body-file -${labelFlag ? ` --add-label ${labelFlag}` : ""}`, { input: body, stdio: ["pipe", "inherit", "inherit"] });
|
|
310
362
|
console.log(green(`✓ PR #${existingPr.number} updated: ${existingPr.url}`));
|
|
311
363
|
}
|
|
@@ -338,4 +390,3 @@ export async function prCommand(options = {}) {
|
|
|
338
390
|
process.exit(1);
|
|
339
391
|
}
|
|
340
392
|
}
|
|
341
|
-
//# sourceMappingURL=pr.js.map
|
package/dist/commands/release.js
CHANGED
package/dist/commands/review.js
CHANGED
package/dist/commands/stash.d.ts
CHANGED
package/dist/commands/stash.js
CHANGED
|
@@ -121,10 +121,15 @@ export async function stashCommand(options = {}) {
|
|
|
121
121
|
includeUntracked = untrackedResult === true;
|
|
122
122
|
}
|
|
123
123
|
const untrackedFlag = includeUntracked ? " --include-untracked" : "";
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
124
|
+
if (options.dryRun) {
|
|
125
|
+
console.log(dim(`[dry-run] Would stash with message: ${stashMessage}${includeUntracked ? " (incl. untracked)" : ""}`));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
execSync(`git stash push -m ${JSON.stringify(stashMessage)}${untrackedFlag}`, {
|
|
129
|
+
stdio: "inherit",
|
|
130
|
+
});
|
|
131
|
+
console.log(green(`✓ Stashed: ${stashMessage}`));
|
|
132
|
+
}
|
|
128
133
|
currentStep = "done";
|
|
129
134
|
break;
|
|
130
135
|
}
|
|
@@ -141,12 +146,17 @@ export async function stashCommand(options = {}) {
|
|
|
141
146
|
}
|
|
142
147
|
stashTarget = target;
|
|
143
148
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
console.log(green(`✓ ${selectedAction === "pop" ? "Popped" : "Applied"} stash@{${stashTarget}}`));
|
|
149
|
+
if (options.dryRun) {
|
|
150
|
+
console.log(dim(`[dry-run] Would ${selectedAction} stash@{${stashTarget}}`));
|
|
147
151
|
}
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
else {
|
|
153
|
+
try {
|
|
154
|
+
execSync(`git stash ${selectedAction} stash@{${stashTarget}}`, { stdio: "inherit" });
|
|
155
|
+
console.log(green(`✓ ${selectedAction === "pop" ? "Popped" : "Applied"} stash@{${stashTarget}}`));
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
console.log(yellow("⚠ Stash could not be applied cleanly. Resolve conflicts manually."));
|
|
159
|
+
}
|
|
150
160
|
}
|
|
151
161
|
currentStep = "done";
|
|
152
162
|
break;
|
|
@@ -173,8 +183,13 @@ export async function stashCommand(options = {}) {
|
|
|
173
183
|
break;
|
|
174
184
|
}
|
|
175
185
|
if (confirmed === true) {
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
if (options.dryRun) {
|
|
187
|
+
console.log(dim(`[dry-run] Would drop stash@{${stashTarget}}`));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
execSync(`git stash drop stash@{${stashTarget}}`, { stdio: "ignore" });
|
|
191
|
+
console.log(green(`✓ Dropped stash@{${stashTarget}}`));
|
|
192
|
+
}
|
|
178
193
|
}
|
|
179
194
|
currentStep = "done";
|
|
180
195
|
break;
|
|
@@ -233,4 +248,3 @@ async function selectStashWithBack(stashes, message, showBack) {
|
|
|
233
248
|
showBack,
|
|
234
249
|
});
|
|
235
250
|
}
|
|
236
|
-
//# sourceMappingURL=stash.js.map
|
package/dist/commands/stats.d.ts
CHANGED
package/dist/commands/stats.js
CHANGED
package/dist/commands/status.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execSync } from "child_process";
|
|
2
2
|
import { loadConfig } from "../config.js";
|
|
3
3
|
import { bold, dim, cyan, green, yellow, gray } from "../colors.js";
|
|
4
|
-
import { getBranch, parseBranch, getDefaultBase, getCommits } from "../git.js";
|
|
4
|
+
import { getBranch, parseBranch, getDefaultBase, getCommits, isGhInstalled } from "../git.js";
|
|
5
5
|
function getPrInfo() {
|
|
6
6
|
try {
|
|
7
7
|
const result = execSync("gh pr view --json url,number,state", {
|
|
@@ -71,6 +71,9 @@ export async function statusCommand() {
|
|
|
71
71
|
const stateColor = pr.state === "OPEN" ? green : pr.state === "MERGED" ? cyan : gray;
|
|
72
72
|
console.log(`\n${dim("PR:")} ${stateColor(`#${pr.number} (${pr.state.toLowerCase()})`)} ${dim(pr.url)}`);
|
|
73
73
|
}
|
|
74
|
+
else if (!isGhInstalled()) {
|
|
75
|
+
console.log(`\n${dim("PR:")} ${gray("gh not installed — install with: brew install gh")}`);
|
|
76
|
+
}
|
|
74
77
|
else {
|
|
75
78
|
console.log(`\n${dim("PR:")} ${gray("none")}`);
|
|
76
79
|
}
|
|
@@ -80,4 +83,3 @@ export async function statusCommand() {
|
|
|
80
83
|
}
|
|
81
84
|
console.log("");
|
|
82
85
|
}
|
|
83
|
-
//# sourceMappingURL=status.js.map
|
package/dist/commands/undo.d.ts
CHANGED
package/dist/commands/undo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { confirm } from "@inquirer/prompts";
|
|
2
1
|
import { execSync } from "child_process";
|
|
3
2
|
import { bold, dim, green, yellow } from "../colors.js";
|
|
3
|
+
import { confirmWithBack } from "../prompts.js";
|
|
4
4
|
export async function undoCommand(options = {}) {
|
|
5
5
|
try {
|
|
6
6
|
// Check if there are commits to undo
|
|
@@ -24,13 +24,13 @@ export async function undoCommand(options = {}) {
|
|
|
24
24
|
console.log(dim("[dry-run] No undo performed."));
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
// Confirm (skip if --yes)
|
|
28
27
|
if (!options.yes) {
|
|
29
|
-
const confirmed = await
|
|
28
|
+
const confirmed = await confirmWithBack({
|
|
30
29
|
message: "Undo this commit? (changes will remain staged)",
|
|
31
30
|
default: true,
|
|
31
|
+
showBack: false,
|
|
32
32
|
});
|
|
33
|
-
if (
|
|
33
|
+
if (confirmed !== true) {
|
|
34
34
|
console.log("Aborted.");
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -46,4 +46,3 @@ export async function undoCommand(options = {}) {
|
|
|
46
46
|
process.exit(1);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
//# sourceMappingURL=undo.js.map
|
package/dist/commands/update.js
CHANGED
|
@@ -4,6 +4,47 @@ import { bold, dim, green, yellow } from "../colors.js";
|
|
|
4
4
|
import { loadConfig } from "../config.js";
|
|
5
5
|
import { writeVersionInfo, getCliVersion } from "../devflow-version.js";
|
|
6
6
|
import { confirmWithBack, } from "../prompts.js";
|
|
7
|
+
const CLAUDE_SKILL_TEMPLATE = `---
|
|
8
|
+
name: devflow-usage
|
|
9
|
+
description: MANDATORY when working in any devflow-managed repo (one with a .devflow/config.json). Always use devflow commands instead of raw git/gh — \`devflow branch\` over \`git checkout -b\`, \`devflow commit\` over \`git commit\`, \`devflow pr\` over \`gh pr create\`. Never push directly to main; all changes go through PRs. Full command reference and non-interactive flag examples live in .devflow/AI_INSTRUCTIONS.md.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# DevFlow Usage
|
|
13
|
+
|
|
14
|
+
This repo uses [devflow](https://github.com/alejandrochvs/devflow-cli) for Git workflow automation. Apply these rules whenever making changes.
|
|
15
|
+
|
|
16
|
+
## Core rules
|
|
17
|
+
|
|
18
|
+
1. **Never push directly to main.** All changes go through pull requests, even small fixes.
|
|
19
|
+
2. **Use devflow commands, not raw git/gh:**
|
|
20
|
+
- Branches: \`devflow branch\` (not \`git checkout -b\`)
|
|
21
|
+
- Commits: \`devflow commit\` (not \`git commit\`)
|
|
22
|
+
- PRs: \`devflow pr\` (not \`gh pr create\`)
|
|
23
|
+
- Issues: \`devflow issue\` / \`devflow issues\` (not \`gh issue ...\`)
|
|
24
|
+
3. **Issue-first workflow** (when a project board is configured):
|
|
25
|
+
- \`devflow issues\` to see Todo / In Progress
|
|
26
|
+
- \`devflow issues --work --issue <N> --yes\` to start work
|
|
27
|
+
4. **Commit format:** \`{type}[{ticket}]{breaking}({scope}): {message}\` — e.g. \`feat[123](auth): add OAuth2 login\`.
|
|
28
|
+
5. **Branch format:** \`{type}/{ticket}_{description}\` — e.g. \`feat/123_add-login\`.
|
|
29
|
+
6. **Press \`Escape\`** to go back a step in any multi-step prompt.
|
|
30
|
+
7. **Use \`--dry-run\`** to preview any command without executing.
|
|
31
|
+
|
|
32
|
+
## Non-interactive mode for AI agents
|
|
33
|
+
|
|
34
|
+
Append \`--yes\` to skip all confirmation prompts. Each command also accepts content flags so prompts can be skipped entirely:
|
|
35
|
+
|
|
36
|
+
\`\`\`bash
|
|
37
|
+
devflow branch --type feat --ticket 123 --description "add-login" --yes
|
|
38
|
+
devflow commit --type feat --scope auth --message "add login" --all --yes
|
|
39
|
+
devflow pr --title "Add login" --summary "Implements login UI" --yes
|
|
40
|
+
\`\`\`
|
|
41
|
+
|
|
42
|
+
Full per-command non-interactive examples live in \`.devflow/AI_INSTRUCTIONS.md\`.
|
|
43
|
+
|
|
44
|
+
## Full reference
|
|
45
|
+
|
|
46
|
+
For everything beyond the basics above — Quick Reference table, all command flags, common workflows, edge cases like merged/closed PRs — read \`.devflow/AI_INSTRUCTIONS.md\`. Treat that file as canonical.
|
|
47
|
+
`;
|
|
7
48
|
const AI_INSTRUCTIONS_TEMPLATE = `# DevFlow - AI Agent Instructions
|
|
8
49
|
|
|
9
50
|
## Quick Reference
|
|
@@ -243,6 +284,36 @@ export async function updateCommand(options = {}) {
|
|
|
243
284
|
updates.push(aiInstructionsExists ? "Updated .devflow/AI_INSTRUCTIONS.md" : "Created .devflow/AI_INSTRUCTIONS.md");
|
|
244
285
|
}
|
|
245
286
|
}
|
|
287
|
+
// Update Claude Code wrapper skill
|
|
288
|
+
const skillDir = resolve(cwd, ".claude/skills/devflow-usage");
|
|
289
|
+
const skillPath = resolve(skillDir, "SKILL.md");
|
|
290
|
+
const skillExists = existsSync(skillPath);
|
|
291
|
+
let updateSkill = true;
|
|
292
|
+
if (skillExists && !options.yes) {
|
|
293
|
+
const result = await confirmWithBack({
|
|
294
|
+
message: "Update .claude/skills/devflow-usage/SKILL.md with latest template?",
|
|
295
|
+
default: true,
|
|
296
|
+
showBack: false,
|
|
297
|
+
});
|
|
298
|
+
updateSkill = result === true;
|
|
299
|
+
}
|
|
300
|
+
if (updateSkill) {
|
|
301
|
+
let skillTemplate = CLAUDE_SKILL_TEMPLATE;
|
|
302
|
+
if (config.commitFormat) {
|
|
303
|
+
skillTemplate = skillTemplate.replace("{type}[{ticket}]{breaking}({scope}): {message}", config.commitFormat);
|
|
304
|
+
}
|
|
305
|
+
if (config.branchFormat) {
|
|
306
|
+
skillTemplate = skillTemplate.replace("{type}/{ticket}_{description}", config.branchFormat);
|
|
307
|
+
}
|
|
308
|
+
if (options.dryRun) {
|
|
309
|
+
console.log(dim(`[dry-run] Would ${skillExists ? "update" : "create"} .claude/skills/devflow-usage/SKILL.md`));
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
mkdirSync(skillDir, { recursive: true });
|
|
313
|
+
writeFileSync(skillPath, skillTemplate);
|
|
314
|
+
updates.push(skillExists ? "Updated .claude/skills/devflow-usage/SKILL.md" : "Created .claude/skills/devflow-usage/SKILL.md");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
246
317
|
// Update CLAUDE.md
|
|
247
318
|
if (existsSync(claudeMdPath)) {
|
|
248
319
|
const claudeMd = readFileSync(claudeMdPath, "utf-8");
|
|
@@ -308,4 +379,3 @@ export async function updateCommand(options = {}) {
|
|
|
308
379
|
process.exit(1);
|
|
309
380
|
}
|
|
310
381
|
}
|
|
311
|
-
//# sourceMappingURL=update.js.map
|
|
@@ -144,15 +144,20 @@ export async function worktreeCommand(options = {}) {
|
|
|
144
144
|
// Branch doesn't exist
|
|
145
145
|
}
|
|
146
146
|
const createFlag = branchExists ? "" : "-b ";
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
stdio: "inherit",
|
|
150
|
-
});
|
|
151
|
-
console.log(green(`✓ Created worktree at ${worktreePath.trim()}`));
|
|
152
|
-
console.log(dim(` cd ${worktreePath.trim()}`));
|
|
147
|
+
if (options.dryRun) {
|
|
148
|
+
console.log(dim(`[dry-run] Would create worktree at ${worktreePath.trim()} for ${branchName.trim()}`));
|
|
153
149
|
}
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
else {
|
|
151
|
+
try {
|
|
152
|
+
execSync(`git worktree add ${JSON.stringify(worktreePath.trim())} ${createFlag}${branchName.trim()}`, {
|
|
153
|
+
stdio: "inherit",
|
|
154
|
+
});
|
|
155
|
+
console.log(green(`✓ Created worktree at ${worktreePath.trim()}`));
|
|
156
|
+
console.log(dim(` cd ${worktreePath.trim()}`));
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
console.log(red("✗ Failed to create worktree"));
|
|
160
|
+
}
|
|
156
161
|
}
|
|
157
162
|
currentStep = "done";
|
|
158
163
|
}
|
|
@@ -199,19 +204,24 @@ export async function worktreeCommand(options = {}) {
|
|
|
199
204
|
break;
|
|
200
205
|
}
|
|
201
206
|
if (confirmed === true) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
console.log(green("✓ Worktree removed"));
|
|
207
|
+
if (options.dryRun) {
|
|
208
|
+
console.log(dim(`[dry-run] Would remove worktree at ${selected}`));
|
|
205
209
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
else {
|
|
211
|
+
try {
|
|
212
|
+
execSync(`git worktree remove ${JSON.stringify(selected)}`, { stdio: "inherit" });
|
|
213
|
+
console.log(green("✓ Worktree removed"));
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
const force = options.yes || await confirmWithBack({
|
|
217
|
+
message: "Worktree has changes. Force remove?",
|
|
218
|
+
default: false,
|
|
219
|
+
showBack: false,
|
|
220
|
+
});
|
|
221
|
+
if (force === true) {
|
|
222
|
+
execSync(`git worktree remove --force ${JSON.stringify(selected)}`, { stdio: "inherit" });
|
|
223
|
+
console.log(yellow("✓ Force removed worktree"));
|
|
224
|
+
}
|
|
215
225
|
}
|
|
216
226
|
}
|
|
217
227
|
}
|
|
@@ -235,4 +245,3 @@ export async function worktreeCommand(options = {}) {
|
|
|
235
245
|
process.exit(1);
|
|
236
246
|
}
|
|
237
247
|
}
|
|
238
|
-
//# sourceMappingURL=worktree.js.map
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -3,6 +3,7 @@ interface DevflowVersionInfo {
|
|
|
3
3
|
generatedAt: string;
|
|
4
4
|
files: {
|
|
5
5
|
aiInstructions?: string;
|
|
6
|
+
claudeSkill?: string;
|
|
6
7
|
};
|
|
7
8
|
}
|
|
8
9
|
export declare function getVersionFilePath(cwd?: string): string;
|
|
@@ -15,4 +16,3 @@ export declare function getCliVersion(): string;
|
|
|
15
16
|
*/
|
|
16
17
|
export declare function checkForDevflowUpdates(cwd?: string): boolean;
|
|
17
18
|
export {};
|
|
18
|
-
//# sourceMappingURL=devflow-version.d.ts.map
|
package/dist/devflow-version.js
CHANGED
|
@@ -24,6 +24,7 @@ export function writeVersionInfo(cliVersion, cwd = process.cwd()) {
|
|
|
24
24
|
generatedAt: new Date().toISOString(),
|
|
25
25
|
files: {
|
|
26
26
|
aiInstructions: cliVersion,
|
|
27
|
+
claudeSkill: cliVersion,
|
|
27
28
|
},
|
|
28
29
|
};
|
|
29
30
|
writeFileSync(versionPath, JSON.stringify(info, null, 2) + "\n");
|
|
@@ -84,4 +85,3 @@ function compareVersions(a, b) {
|
|
|
84
85
|
}
|
|
85
86
|
return 0;
|
|
86
87
|
}
|
|
87
|
-
//# sourceMappingURL=devflow-version.js.map
|
package/dist/git.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export declare function inferScope(): string | undefined;
|
|
|
10
10
|
export declare function getCommits(base: string): string[];
|
|
11
11
|
export declare function getScopesFromCommits(commits: string[]): string[];
|
|
12
12
|
export declare function getDefaultBase(currentBranch: string): string;
|
|
13
|
+
export declare function getRepoDefaultBranch(): string;
|
|
14
|
+
export declare function isGhInstalled(): boolean;
|
|
13
15
|
export declare function checkGhInstalled(): void;
|
|
14
16
|
export declare function isProtectedBranch(branch?: string): boolean;
|
|
15
17
|
export {};
|
|
16
|
-
//# sourceMappingURL=git.d.ts.map
|
package/dist/git.js
CHANGED
|
@@ -119,6 +119,36 @@ export function getDefaultBase(currentBranch) {
|
|
|
119
119
|
return "main";
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
export function getRepoDefaultBranch() {
|
|
123
|
+
try {
|
|
124
|
+
const ref = execSync("git symbolic-ref refs/remotes/origin/HEAD", {
|
|
125
|
+
encoding: "utf-8",
|
|
126
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
127
|
+
}).trim();
|
|
128
|
+
return ref.replace(/^refs\/remotes\/origin\//, "");
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
for (const candidate of ["main", "master", "trunk", "develop"]) {
|
|
132
|
+
try {
|
|
133
|
+
execSync(`git rev-parse --verify ${candidate}`, { stdio: "ignore" });
|
|
134
|
+
return candidate;
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// try next
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return "main";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export function isGhInstalled() {
|
|
144
|
+
try {
|
|
145
|
+
execSync("gh --version", { stdio: "ignore" });
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
122
152
|
export function checkGhInstalled() {
|
|
123
153
|
try {
|
|
124
154
|
execSync("gh --version", { stdio: "ignore" });
|
|
@@ -134,4 +164,3 @@ export function isProtectedBranch(branch) {
|
|
|
134
164
|
const current = branch || getBranch();
|
|
135
165
|
return PROTECTED_BRANCHES.includes(current);
|
|
136
166
|
}
|
|
137
|
-
//# sourceMappingURL=git.js.map
|
package/dist/index.d.ts
CHANGED