@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.
Files changed (150) hide show
  1. package/README.md +9 -3
  2. package/dist/cli-runner.d.ts +1 -0
  3. package/dist/cli-runner.js +17 -0
  4. package/dist/colors.d.ts +0 -1
  5. package/dist/colors.js +0 -1
  6. package/dist/commands/amend.d.ts +0 -1
  7. package/dist/commands/amend.js +3 -3
  8. package/dist/commands/branch.d.ts +0 -1
  9. package/dist/commands/branch.js +4 -5
  10. package/dist/commands/changelog.d.ts +0 -1
  11. package/dist/commands/changelog.js +0 -1
  12. package/dist/commands/cleanup.d.ts +0 -1
  13. package/dist/commands/cleanup.js +4 -3
  14. package/dist/commands/comments.d.ts +0 -1
  15. package/dist/commands/comments.js +0 -1
  16. package/dist/commands/commit.d.ts +0 -1
  17. package/dist/commands/commit.js +0 -1
  18. package/dist/commands/doctor.d.ts +0 -1
  19. package/dist/commands/doctor.js +0 -1
  20. package/dist/commands/fixup.d.ts +0 -1
  21. package/dist/commands/fixup.js +3 -4
  22. package/dist/commands/init.d.ts +0 -1
  23. package/dist/commands/init.js +57 -13
  24. package/dist/commands/issue.d.ts +0 -1
  25. package/dist/commands/issue.js +5 -21
  26. package/dist/commands/issues.d.ts +0 -1
  27. package/dist/commands/issues.js +2 -3
  28. package/dist/commands/lint-config.d.ts +0 -1
  29. package/dist/commands/lint-config.js +0 -1
  30. package/dist/commands/log.d.ts +0 -1
  31. package/dist/commands/log.js +5 -6
  32. package/dist/commands/merge.d.ts +0 -1
  33. package/dist/commands/merge.js +5 -6
  34. package/dist/commands/pr.d.ts +0 -1
  35. package/dist/commands/pr.js +68 -17
  36. package/dist/commands/release.d.ts +0 -1
  37. package/dist/commands/release.js +0 -1
  38. package/dist/commands/review.d.ts +0 -1
  39. package/dist/commands/review.js +0 -1
  40. package/dist/commands/stash.d.ts +1 -1
  41. package/dist/commands/stash.js +26 -12
  42. package/dist/commands/stats.d.ts +0 -1
  43. package/dist/commands/stats.js +0 -1
  44. package/dist/commands/status.d.ts +0 -1
  45. package/dist/commands/status.js +4 -2
  46. package/dist/commands/test-plan.d.ts +0 -1
  47. package/dist/commands/test-plan.js +0 -1
  48. package/dist/commands/undo.d.ts +0 -1
  49. package/dist/commands/undo.js +4 -5
  50. package/dist/commands/update.d.ts +0 -1
  51. package/dist/commands/update.js +71 -1
  52. package/dist/commands/worktree.d.ts +1 -1
  53. package/dist/commands/worktree.js +30 -21
  54. package/dist/config.d.ts +0 -1
  55. package/dist/config.js +0 -1
  56. package/dist/devflow-version.d.ts +1 -1
  57. package/dist/devflow-version.js +1 -1
  58. package/dist/git.d.ts +2 -1
  59. package/dist/git.js +30 -1
  60. package/dist/index.d.ts +0 -1
  61. package/dist/index.js +28 -25
  62. package/dist/monorepo.d.ts +0 -1
  63. package/dist/monorepo.js +0 -1
  64. package/dist/output.d.ts +3 -0
  65. package/dist/output.js +13 -0
  66. package/dist/plugins.d.ts +0 -1
  67. package/dist/plugins.js +0 -1
  68. package/dist/prompts.d.ts +0 -1
  69. package/dist/prompts.js +0 -1
  70. package/dist/providers/projects.d.ts +0 -1
  71. package/dist/providers/projects.js +3 -10
  72. package/dist/providers/tickets.d.ts +0 -1
  73. package/dist/providers/tickets.js +0 -1
  74. package/dist/test-plan.d.ts +0 -1
  75. package/dist/test-plan.js +0 -1
  76. package/dist/update-notifier.d.ts +0 -1
  77. package/dist/update-notifier.js +33 -26
  78. package/package.json +1 -1
  79. package/dist/colors.d.ts.map +0 -1
  80. package/dist/colors.js.map +0 -1
  81. package/dist/commands/amend.d.ts.map +0 -1
  82. package/dist/commands/amend.js.map +0 -1
  83. package/dist/commands/branch.d.ts.map +0 -1
  84. package/dist/commands/branch.js.map +0 -1
  85. package/dist/commands/changelog.d.ts.map +0 -1
  86. package/dist/commands/changelog.js.map +0 -1
  87. package/dist/commands/cleanup.d.ts.map +0 -1
  88. package/dist/commands/cleanup.js.map +0 -1
  89. package/dist/commands/comments.d.ts.map +0 -1
  90. package/dist/commands/comments.js.map +0 -1
  91. package/dist/commands/commit.d.ts.map +0 -1
  92. package/dist/commands/commit.js.map +0 -1
  93. package/dist/commands/doctor.d.ts.map +0 -1
  94. package/dist/commands/doctor.js.map +0 -1
  95. package/dist/commands/fixup.d.ts.map +0 -1
  96. package/dist/commands/fixup.js.map +0 -1
  97. package/dist/commands/init.d.ts.map +0 -1
  98. package/dist/commands/init.js.map +0 -1
  99. package/dist/commands/issue.d.ts.map +0 -1
  100. package/dist/commands/issue.js.map +0 -1
  101. package/dist/commands/issues.d.ts.map +0 -1
  102. package/dist/commands/issues.js.map +0 -1
  103. package/dist/commands/lint-config.d.ts.map +0 -1
  104. package/dist/commands/lint-config.js.map +0 -1
  105. package/dist/commands/log.d.ts.map +0 -1
  106. package/dist/commands/log.js.map +0 -1
  107. package/dist/commands/merge.d.ts.map +0 -1
  108. package/dist/commands/merge.js.map +0 -1
  109. package/dist/commands/pr.d.ts.map +0 -1
  110. package/dist/commands/pr.js.map +0 -1
  111. package/dist/commands/release.d.ts.map +0 -1
  112. package/dist/commands/release.js.map +0 -1
  113. package/dist/commands/review.d.ts.map +0 -1
  114. package/dist/commands/review.js.map +0 -1
  115. package/dist/commands/stash.d.ts.map +0 -1
  116. package/dist/commands/stash.js.map +0 -1
  117. package/dist/commands/stats.d.ts.map +0 -1
  118. package/dist/commands/stats.js.map +0 -1
  119. package/dist/commands/status.d.ts.map +0 -1
  120. package/dist/commands/status.js.map +0 -1
  121. package/dist/commands/test-plan.d.ts.map +0 -1
  122. package/dist/commands/test-plan.js.map +0 -1
  123. package/dist/commands/undo.d.ts.map +0 -1
  124. package/dist/commands/undo.js.map +0 -1
  125. package/dist/commands/update.d.ts.map +0 -1
  126. package/dist/commands/update.js.map +0 -1
  127. package/dist/commands/worktree.d.ts.map +0 -1
  128. package/dist/commands/worktree.js.map +0 -1
  129. package/dist/config.d.ts.map +0 -1
  130. package/dist/config.js.map +0 -1
  131. package/dist/devflow-version.d.ts.map +0 -1
  132. package/dist/devflow-version.js.map +0 -1
  133. package/dist/git.d.ts.map +0 -1
  134. package/dist/git.js.map +0 -1
  135. package/dist/index.d.ts.map +0 -1
  136. package/dist/index.js.map +0 -1
  137. package/dist/monorepo.d.ts.map +0 -1
  138. package/dist/monorepo.js.map +0 -1
  139. package/dist/plugins.d.ts.map +0 -1
  140. package/dist/plugins.js.map +0 -1
  141. package/dist/prompts.d.ts.map +0 -1
  142. package/dist/prompts.js.map +0 -1
  143. package/dist/providers/projects.d.ts.map +0 -1
  144. package/dist/providers/projects.js.map +0 -1
  145. package/dist/providers/tickets.d.ts.map +0 -1
  146. package/dist/providers/tickets.js.map +0 -1
  147. package/dist/test-plan.d.ts.map +0 -1
  148. package/dist/test-plan.js.map +0 -1
  149. package/dist/update-notifier.d.ts.map +0 -1
  150. package/dist/update-notifier.js.map +0 -1
@@ -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
- if (existingPr && !options.yes) {
117
- console.log(`\n${cyan(`PR #${existingPr.number}`)} already exists: ${existingPr.url}`);
118
- const shouldUpdate = await confirmWithBack({
119
- message: "Update this PR?",
120
- default: true,
121
- showBack: false,
122
- });
123
- if (shouldUpdate !== true) {
124
- process.exit(0);
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 (existingPr) {
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: existingPr
261
- ? `Update PR #${existingPr.number}?`
262
- : "Create this PR?",
309
+ message: confirmMessage,
263
310
  choices: [
264
- { value: "yes", name: existingPr ? "Yes, update PR" : "Yes, create PR" },
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 (existingPr) {
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
@@ -5,4 +5,3 @@ export interface ReleaseOptions {
5
5
  yes?: boolean;
6
6
  }
7
7
  export declare function releaseCommand(options?: ReleaseOptions): Promise<void>;
8
- //# sourceMappingURL=release.d.ts.map
@@ -246,4 +246,3 @@ export async function releaseCommand(options = {}) {
246
246
  process.exit(1);
247
247
  }
248
248
  }
249
- //# sourceMappingURL=release.js.map
@@ -4,4 +4,3 @@ export interface ReviewOptions {
4
4
  comment?: string;
5
5
  }
6
6
  export declare function reviewCommand(options?: ReviewOptions): Promise<void>;
7
- //# sourceMappingURL=review.d.ts.map
@@ -198,4 +198,3 @@ export async function reviewCommand(options = {}) {
198
198
  process.exit(1);
199
199
  }
200
200
  }
201
- //# sourceMappingURL=review.js.map
@@ -4,6 +4,6 @@ export interface StashOptions {
4
4
  index?: string;
5
5
  includeUntracked?: boolean;
6
6
  yes?: boolean;
7
+ dryRun?: boolean;
7
8
  }
8
9
  export declare function stashCommand(options?: StashOptions): Promise<void>;
9
- //# sourceMappingURL=stash.d.ts.map
@@ -121,10 +121,15 @@ export async function stashCommand(options = {}) {
121
121
  includeUntracked = untrackedResult === true;
122
122
  }
123
123
  const untrackedFlag = includeUntracked ? " --include-untracked" : "";
124
- execSync(`git stash push -m ${JSON.stringify(stashMessage)}${untrackedFlag}`, {
125
- stdio: "inherit",
126
- });
127
- console.log(green(`✓ Stashed: ${stashMessage}`));
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
- try {
145
- execSync(`git stash ${selectedAction} stash@{${stashTarget}}`, { stdio: "inherit" });
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
- catch {
149
- console.log(yellow("⚠ Stash could not be applied cleanly. Resolve conflicts manually."));
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
- execSync(`git stash drop stash@{${stashTarget}}`, { stdio: "ignore" });
177
- console.log(green(`✓ Dropped stash@{${stashTarget}}`));
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
@@ -1,2 +1 @@
1
1
  export declare function statsCommand(): void;
2
- //# sourceMappingURL=stats.d.ts.map
@@ -95,4 +95,3 @@ export function statsCommand() {
95
95
  }
96
96
  console.log("");
97
97
  }
98
- //# sourceMappingURL=stats.js.map
@@ -1,2 +1 @@
1
1
  export declare function statusCommand(): Promise<void>;
2
- //# sourceMappingURL=status.d.ts.map
@@ -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
@@ -5,4 +5,3 @@ export interface TestPlanOptions {
5
5
  show?: boolean;
6
6
  }
7
7
  export declare function testPlanCommand(options?: TestPlanOptions): Promise<void>;
8
- //# sourceMappingURL=test-plan.d.ts.map
@@ -158,4 +158,3 @@ async function collectSteps(startIndex) {
158
158
  }
159
159
  return steps;
160
160
  }
161
- //# sourceMappingURL=test-plan.js.map
@@ -3,4 +3,3 @@ export interface UndoOptions {
3
3
  yes?: boolean;
4
4
  }
5
5
  export declare function undoCommand(options?: UndoOptions): Promise<void>;
6
- //# sourceMappingURL=undo.d.ts.map
@@ -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 confirm({
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 (!confirmed) {
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
@@ -3,4 +3,3 @@ export interface UpdateOptions {
3
3
  dryRun?: boolean;
4
4
  }
5
5
  export declare function updateCommand(options?: UpdateOptions): Promise<void>;
6
- //# sourceMappingURL=update.d.ts.map
@@ -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
@@ -3,6 +3,6 @@ export interface WorktreeOptions {
3
3
  branch?: string;
4
4
  path?: string;
5
5
  yes?: boolean;
6
+ dryRun?: boolean;
6
7
  }
7
8
  export declare function worktreeCommand(options?: WorktreeOptions): Promise<void>;
8
- //# sourceMappingURL=worktree.d.ts.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
- try {
148
- execSync(`git worktree add ${JSON.stringify(worktreePath.trim())} ${createFlag}${branchName.trim()}`, {
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
- catch {
155
- console.log(red("✗ Failed to create worktree"));
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
- try {
203
- execSync(`git worktree remove ${JSON.stringify(selected)}`, { stdio: "inherit" });
204
- console.log(green("✓ Worktree removed"));
207
+ if (options.dryRun) {
208
+ console.log(dim(`[dry-run] Would remove worktree at ${selected}`));
205
209
  }
206
- catch {
207
- const force = options.yes || await confirmWithBack({
208
- message: "Worktree has changes. Force remove?",
209
- default: false,
210
- showBack: false,
211
- });
212
- if (force === true) {
213
- execSync(`git worktree remove --force ${JSON.stringify(selected)}`, { stdio: "inherit" });
214
- console.log(yellow("✓ Force removed worktree"));
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
@@ -83,4 +83,3 @@ export interface ConfigWarning {
83
83
  }
84
84
  export declare function validateConfig(raw: Record<string, unknown>): ConfigWarning[];
85
85
  export declare function loadConfig(cwd?: string): DevflowConfig;
86
- //# sourceMappingURL=config.d.ts.map
package/dist/config.js CHANGED
@@ -452,4 +452,3 @@ export function loadConfig(cwd = process.cwd()) {
452
452
  return DEFAULT_CONFIG;
453
453
  }
454
454
  }
455
- //# sourceMappingURL=config.js.map
@@ -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
@@ -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
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env node
2
2
  export {};
3
- //# sourceMappingURL=index.d.ts.map