@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
package/README.md CHANGED
@@ -44,6 +44,8 @@ Or add scripts to your `package.json`:
44
44
 
45
45
  ## Commands
46
46
 
47
+ > **Tip:** In any multi-step command, press **Escape** to go back to the previous step.
48
+
47
49
  ### `devflow init`
48
50
 
49
51
  Interactive setup wizard that configures your entire project. Walks you through:
@@ -116,15 +118,18 @@ The `!` after the ticket indicates a breaking change.
116
118
  Create or update a pull request with an auto-filled template.
117
119
 
118
120
  **Flow:**
119
- 1. Checks if a PR already exists for the current branch (offers to update)
121
+ 1. Checks if a PR already exists for the current branch:
122
+ - **Open** — offers to update it
123
+ - **Merged** — asks whether to create a new PR
124
+ - **Closed** — asks to reopen and update, or create a new PR
120
125
  2. Infers the base branch (closest remote branch by merge-base)
121
126
  3. Enter PR title (pre-filled from branch description)
122
127
  4. Enter optional summary
123
128
  5. Preview PR body with template
124
- 6. Confirm and create/update
129
+ 6. Confirm and create/update/reopen
125
130
 
126
131
  **Features:**
127
- - Auto-detects existing PRs and offers update flow
132
+ - Auto-detects existing PRs; handles open, merged, and closed states
128
133
  - Infers base branch using `git merge-base` comparison
129
134
  - Pre-fills commit list in the summary
130
135
  - Auto-labels from branch type (feat → `feature`, fix → `bug`, etc.)
@@ -449,6 +454,7 @@ eval "$(devflow completions --shell bash)"
449
454
  | `devflow status` | `devflow s` |
450
455
  | `devflow test-plan` | `devflow tp` |
451
456
  | `devflow lint-config` | `devflow lint` |
457
+ | `devflow update` | `devflow up` |
452
458
 
453
459
  ## Global Options
454
460
 
@@ -0,0 +1 @@
1
+ export declare function runCommand(fn: () => Promise<void> | void): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import { red } from "./colors.js";
2
+ export async function runCommand(fn) {
3
+ try {
4
+ await fn();
5
+ }
6
+ catch (error) {
7
+ if (error?.name === "ExitPromptError") {
8
+ console.log("\nCancelled.");
9
+ process.exit(0);
10
+ }
11
+ const message = error?.message;
12
+ if (message) {
13
+ console.error(`${red("✗")} ${message}`);
14
+ }
15
+ process.exit(1);
16
+ }
17
+ }
package/dist/colors.d.ts CHANGED
@@ -6,4 +6,3 @@ export declare const red: (text: string) => string;
6
6
  export declare const cyan: (text: string) => string;
7
7
  export declare const gray: (text: string) => string;
8
8
  export declare const magenta: (text: string) => string;
9
- //# sourceMappingURL=colors.d.ts.map
package/dist/colors.js CHANGED
@@ -10,4 +10,3 @@ export const red = wrap(31, 39);
10
10
  export const cyan = wrap(36, 39);
11
11
  export const gray = wrap(90, 39);
12
12
  export const magenta = wrap(35, 39);
13
- //# sourceMappingURL=colors.js.map
@@ -7,4 +7,3 @@ export interface AmendOptions {
7
7
  yes?: boolean;
8
8
  }
9
9
  export declare function amendCommand(options?: AmendOptions): Promise<void>;
10
- //# sourceMappingURL=amend.d.ts.map
@@ -1,4 +1,3 @@
1
- import { confirm } from "@inquirer/prompts";
2
1
  import { execSync } from "child_process";
3
2
  import { loadConfig } from "../config.js";
4
3
  import { inferTicket } from "../git.js";
@@ -45,10 +44,12 @@ export async function amendCommand(options = {}) {
45
44
  editMessage = hasEditFlags;
46
45
  }
47
46
  else {
48
- editMessage = await confirm({
47
+ const editResult = await confirmWithBack({
49
48
  message: "Edit commit message?",
50
49
  default: true,
50
+ showBack: false,
51
51
  });
52
+ editMessage = editResult === true;
52
53
  }
53
54
  let newMessage = lastMessage;
54
55
  if (editMessage) {
@@ -239,4 +240,3 @@ export async function amendCommand(options = {}) {
239
240
  process.exit(1);
240
241
  }
241
242
  }
242
- //# sourceMappingURL=amend.js.map
@@ -13,4 +13,3 @@ export interface BranchOptions {
13
13
  yes?: boolean;
14
14
  }
15
15
  export declare function branchCommand(options?: BranchOptions): Promise<void>;
16
- //# sourceMappingURL=branch.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { select, input } from "@inquirer/prompts";
2
- import { execSync } from "child_process";
2
+ import { execFileSync } from "child_process";
3
3
  import { loadConfig } from "../config.js";
4
4
  import { bold, dim, green, cyan, gray } from "../colors.js";
5
5
  import { setTestPlan } from "../test-plan.js";
@@ -254,7 +254,7 @@ export async function branchCommand(options = {}) {
254
254
  // Check if branch already exists
255
255
  let branchExists = false;
256
256
  try {
257
- execSync(`git rev-parse --verify ${branchName}`, { stdio: "pipe" });
257
+ execFileSync("git", ["rev-parse", "--verify", branchName], { stdio: "pipe" });
258
258
  branchExists = true;
259
259
  }
260
260
  catch {
@@ -270,7 +270,7 @@ export async function branchCommand(options = {}) {
270
270
  ],
271
271
  });
272
272
  if (action === "checkout") {
273
- execSync(`git checkout ${branchName}`, { stdio: "inherit" });
273
+ execFileSync("git", ["checkout", branchName], { stdio: "inherit" });
274
274
  console.log(green(`✓ Checked out existing branch: ${branchName}`));
275
275
  }
276
276
  else if (action === "new") {
@@ -283,7 +283,7 @@ export async function branchCommand(options = {}) {
283
283
  }
284
284
  }
285
285
  else {
286
- execSync(`git checkout -b ${branchName}`, { stdio: "inherit" });
286
+ execFileSync("git", ["checkout", "-b", branchName], { stdio: "inherit" });
287
287
  console.log(green(`✓ Branch created: ${branchName}`));
288
288
  }
289
289
  // Handle test plan from flag or prompt
@@ -356,4 +356,3 @@ export async function branchCommand(options = {}) {
356
356
  process.exit(1);
357
357
  }
358
358
  }
359
- //# sourceMappingURL=branch.js.map
@@ -4,4 +4,3 @@ export interface ChangelogOptions {
4
4
  yes?: boolean;
5
5
  }
6
6
  export declare function changelogCommand(options?: ChangelogOptions): Promise<void>;
7
- //# sourceMappingURL=changelog.d.ts.map
@@ -251,4 +251,3 @@ function bumpVersion(tag, entries) {
251
251
  }
252
252
  return parts.join(".");
253
253
  }
254
- //# sourceMappingURL=changelog.js.map
@@ -6,4 +6,3 @@ export interface CleanupOptions {
6
6
  yes?: boolean;
7
7
  }
8
8
  export declare function cleanupCommand(options?: CleanupOptions): Promise<void>;
9
- //# sourceMappingURL=cleanup.d.ts.map
@@ -1,14 +1,16 @@
1
1
  import { execSync } from "child_process";
2
2
  import { bold, dim, green, red, yellow, gray } from "../colors.js";
3
3
  import { deleteTestPlan } from "../test-plan.js";
4
+ import { getRepoDefaultBranch } from "../git.js";
4
5
  import { checkboxWithBack, confirmWithBack, BACK_VALUE } from "../prompts.js";
5
6
  function getMergedBranches() {
6
7
  try {
7
- const result = execSync("git branch --merged main", { encoding: "utf-8" }).trim();
8
+ const defaultBranch = getRepoDefaultBranch();
9
+ const result = execSync(`git branch --merged ${defaultBranch}`, { encoding: "utf-8" }).trim();
8
10
  return result
9
11
  .split("\n")
10
12
  .map((b) => b.trim())
11
- .filter((b) => b && !b.startsWith("*") && b !== "main" && b !== "master");
13
+ .filter((b) => b && !b.startsWith("*") && b !== defaultBranch);
12
14
  }
13
15
  catch {
14
16
  return [];
@@ -147,4 +149,3 @@ export async function cleanupCommand(options = {}) {
147
149
  process.exit(1);
148
150
  }
149
151
  }
150
- //# sourceMappingURL=cleanup.js.map
@@ -3,4 +3,3 @@ export declare function commentsCommand(opts: {
3
3
  resolved?: boolean;
4
4
  unresolved?: boolean;
5
5
  }): Promise<void>;
6
- //# sourceMappingURL=comments.d.ts.map
@@ -263,4 +263,3 @@ export async function commentsCommand(opts) {
263
263
  console.log(`${dim("───")} ${parts.join(dim(" · "))} ${dim("───")}\n`);
264
264
  }
265
265
  }
266
- //# sourceMappingURL=comments.js.map
@@ -21,4 +21,3 @@ export interface CommitOptions {
21
21
  yes?: boolean;
22
22
  }
23
23
  export declare function commitCommand(options?: CommitOptions): Promise<void>;
24
- //# sourceMappingURL=commit.d.ts.map
@@ -476,4 +476,3 @@ export async function commitCommand(options = {}) {
476
476
  process.exit(1);
477
477
  }
478
478
  }
479
- //# sourceMappingURL=commit.js.map
@@ -1,2 +1 @@
1
1
  export declare function doctorCommand(): Promise<void>;
2
- //# sourceMappingURL=doctor.d.ts.map
@@ -119,4 +119,3 @@ export async function doctorCommand() {
119
119
  process.exit(1);
120
120
  }
121
121
  }
122
- //# sourceMappingURL=doctor.js.map
@@ -7,4 +7,3 @@ export interface FixupOptions {
7
7
  yes?: boolean;
8
8
  }
9
9
  export declare function fixupCommand(options?: FixupOptions): Promise<void>;
10
- //# sourceMappingURL=fixup.d.ts.map
@@ -1,4 +1,4 @@
1
- import { execSync } from "child_process";
1
+ import { execSync, execFileSync } from "child_process";
2
2
  import { bold, dim, green, cyan } from "../colors.js";
3
3
  import { getDefaultBase, getBranch } from "../git.js";
4
4
  import { selectWithBack, confirmWithBack, checkboxWithBack, BACK_VALUE, } from "../prompts.js";
@@ -146,7 +146,7 @@ export async function fixupCommand(options = {}) {
146
146
  return;
147
147
  }
148
148
  // Create fixup commit
149
- execSync(`git commit --fixup=${target}`, { stdio: "inherit" });
149
+ execFileSync("git", ["commit", `--fixup=${target}`], { stdio: "inherit" });
150
150
  console.log(green("✓ Fixup commit created."));
151
151
  // Handle auto-squash from flag or prompt
152
152
  let autoSquash;
@@ -165,7 +165,7 @@ export async function fixupCommand(options = {}) {
165
165
  autoSquash = squashResult === true;
166
166
  }
167
167
  if (autoSquash) {
168
- execSync(`GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash ${base}`, {
168
+ execFileSync("git", ["rebase", "-i", "--autosquash", base], {
169
169
  stdio: "inherit",
170
170
  env: { ...process.env, GIT_SEQUENCE_EDITOR: "true" },
171
171
  });
@@ -190,4 +190,3 @@ export async function fixupCommand(options = {}) {
190
190
  process.exit(1);
191
191
  }
192
192
  }
193
- //# sourceMappingURL=fixup.js.map
@@ -1,2 +1 @@
1
1
  export declare function initCommand(): Promise<void>;
2
- //# sourceMappingURL=init.d.ts.map
@@ -1,9 +1,10 @@
1
1
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
2
2
  import { resolve } from "path";
3
3
  import { confirm, input, select } from "@inquirer/prompts";
4
- import { execSync } from "child_process";
4
+ import { execSync, execFileSync } from "child_process";
5
5
  import { PRESETS } from "../config.js";
6
6
  import { writeVersionInfo, getCliVersion } from "../devflow-version.js";
7
+ import { isGhInstalled } from "../git.js";
7
8
  import { selectWithBack, inputWithBack, confirmWithBack, BACK_VALUE, } from "../prompts.js";
8
9
  const DEFAULT_CHECKLIST = [
9
10
  "Code follows project conventions",
@@ -84,7 +85,7 @@ function getRepoLinkedProjects(repo) {
84
85
  }
85
86
  }
86
87
  }`;
87
- const result = execSync(`gh api graphql -f query='${query}'`, {
88
+ const result = execFileSync("gh", ["api", "graphql", "-f", `query=${query}`], {
88
89
  encoding: "utf-8",
89
90
  stdio: ["pipe", "pipe", "pipe"],
90
91
  }).trim();
@@ -114,18 +115,10 @@ function refreshProjectScopes() {
114
115
  }
115
116
  function createAndLinkProject(repo, title) {
116
117
  try {
117
- // Create the project
118
- const createResult = execSync(`gh project create --owner ${repo.owner} --title "${title}" --format json`, {
119
- encoding: "utf-8",
120
- stdio: ["pipe", "pipe", "pipe"],
121
- }).trim();
118
+ const createResult = execFileSync("gh", ["project", "create", "--owner", repo.owner, "--title", title, "--format", "json"], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
122
119
  const project = JSON.parse(createResult);
123
120
  const projectNumber = project.number;
124
- // Link it to the repo
125
- execSync(`gh project link ${projectNumber} --owner ${repo.owner} --repo ${repo.name}`, {
126
- encoding: "utf-8",
127
- stdio: ["pipe", "pipe", "pipe"],
128
- });
121
+ execFileSync("gh", ["project", "link", String(projectNumber), "--owner", repo.owner, "--repo", repo.name], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
129
122
  return { number: projectNumber, title };
130
123
  }
131
124
  catch {
@@ -227,6 +220,12 @@ export async function initCommand() {
227
220
  break;
228
221
  }
229
222
  case "projectSetup": {
223
+ if (!isGhInstalled()) {
224
+ console.log("⚠ GitHub CLI (gh) is not installed — skipping project integration.");
225
+ console.log(" Install it with: brew install gh\n");
226
+ currentStep = "scopes";
227
+ break;
228
+ }
230
229
  // Check if we have project scopes
231
230
  const hasScopes = hasProjectScopes();
232
231
  if (!hasScopes) {
@@ -734,6 +733,52 @@ devflow amend # If you need to add more changes
734
733
  }
735
734
  }
736
735
  }
736
+ // Generate Claude Code skill wrapper that points to AI_INSTRUCTIONS.md
737
+ const skillDir = resolve(cwd, ".claude/skills/devflow-usage");
738
+ mkdirSync(skillDir, { recursive: true });
739
+ const claudeSkill = `---
740
+ name: devflow-usage
741
+ 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.
742
+ ---
743
+
744
+ # DevFlow Usage
745
+
746
+ This repo uses [devflow](https://github.com/alejandrochvs/devflow-cli) for Git workflow automation. Apply these rules whenever making changes.
747
+
748
+ ## Core rules
749
+
750
+ 1. **Never push directly to main.** All changes go through pull requests, even small fixes.
751
+ 2. **Use devflow commands, not raw git/gh:**
752
+ - Branches: \`devflow branch\` (not \`git checkout -b\`)
753
+ - Commits: \`devflow commit\` (not \`git commit\`)
754
+ - PRs: \`devflow pr\` (not \`gh pr create\`)
755
+ - Issues: \`devflow issue\` / \`devflow issues\` (not \`gh issue ...\`)
756
+ 3. **Issue-first workflow** (when a project board is configured):
757
+ - \`devflow issues\` to see Todo / In Progress
758
+ - \`devflow issues --work --issue <N> --yes\` to start work
759
+ 4. **Commit format:** \`${commitFormat}\` — e.g. \`feat[123](auth): add OAuth2 login\`.
760
+ 5. **Branch format:** \`${branchFormat}\` — e.g. \`feat/123_add-login\`.
761
+ 6. **Press \`Escape\`** to go back a step in any multi-step prompt.
762
+ 7. **Use \`--dry-run\`** to preview any command without executing.
763
+
764
+ ## Non-interactive mode for AI agents
765
+
766
+ Append \`--yes\` to skip all confirmation prompts. Each command also accepts content flags so prompts can be skipped entirely:
767
+
768
+ \`\`\`bash
769
+ devflow branch --type feat --ticket 123 --description "add-login" --yes
770
+ devflow commit --type feat --scope auth --message "add login" --all --yes
771
+ devflow pr --title "Add login" --summary "Implements login UI" --yes
772
+ \`\`\`
773
+
774
+ Full per-command non-interactive examples live in \`.devflow/AI_INSTRUCTIONS.md\`.
775
+
776
+ ## Full reference
777
+
778
+ 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.
779
+ `;
780
+ writeFileSync(resolve(skillDir, "SKILL.md"), claudeSkill);
781
+ console.log("✓ Created .claude/skills/devflow-usage/SKILL.md");
737
782
  }
738
783
  // 10. Write .devflow/config.json
739
784
  const config = {
@@ -790,4 +835,3 @@ devflow amend # If you need to add more changes
790
835
  process.exit(1);
791
836
  }
792
837
  }
793
- //# sourceMappingURL=init.js.map
@@ -9,4 +9,3 @@ export interface IssueOptions {
9
9
  yes?: boolean;
10
10
  }
11
11
  export declare function issueCommand(options?: IssueOptions): Promise<void>;
12
- //# sourceMappingURL=issue.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { select, input, confirm, editor } from "@inquirer/prompts";
2
- import { execSync } from "child_process";
2
+ import { execSync, execFileSync } from "child_process";
3
3
  import { loadConfig } from "../config.js";
4
4
  import { bold, dim, green, cyan, gray } from "../colors.js";
5
5
  import { checkGhInstalled } from "../git.js";
@@ -198,35 +198,20 @@ async function collectIssueData(issueType) {
198
198
  function ensureLabelsExist(labels) {
199
199
  for (const label of labels) {
200
200
  try {
201
- // Check if label exists
202
- execSync(`gh label list --search "${label}" --json name`, {
203
- encoding: "utf-8",
204
- stdio: ["pipe", "pipe", "pipe"],
205
- });
206
- // Parse results to see if exact match exists
207
- const result = execSync(`gh label list --search "${label}" --json name`, {
208
- encoding: "utf-8",
209
- });
201
+ const result = execFileSync("gh", ["label", "list", "--search", label, "--json", "name"], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
210
202
  const existingLabels = JSON.parse(result);
211
203
  const exactMatch = existingLabels.some((l) => l.name.toLowerCase() === label.toLowerCase());
212
204
  if (!exactMatch) {
213
- // Create the label with a default color
214
205
  console.log(dim(`Creating label "${label}"...`));
215
- execSync(`gh label create "${label}" --color "0e8a16" --force`, {
216
- stdio: ["pipe", "pipe", "pipe"],
217
- });
206
+ execFileSync("gh", ["label", "create", label, "--color", "0e8a16", "--force"], { stdio: ["pipe", "pipe", "pipe"] });
218
207
  }
219
208
  }
220
209
  catch {
221
- // Label doesn't exist or error checking, try to create it
222
210
  try {
223
211
  console.log(dim(`Creating label "${label}"...`));
224
- execSync(`gh label create "${label}" --color "0e8a16" --force`, {
225
- stdio: ["pipe", "pipe", "pipe"],
226
- });
212
+ execFileSync("gh", ["label", "create", label, "--color", "0e8a16", "--force"], { stdio: ["pipe", "pipe", "pipe"] });
227
213
  }
228
214
  catch {
229
- // If we can't create the label, we'll let the issue creation fail with the original error
230
215
  console.warn(dim(`Warning: Could not create label "${label}"`));
231
216
  }
232
217
  }
@@ -504,7 +489,7 @@ export async function issueCommand(options = {}) {
504
489
  }
505
490
  }
506
491
  // Create the branch
507
- execSync(`git checkout -b ${branchName}`, { stdio: "inherit" });
492
+ execFileSync("git", ["checkout", "-b", branchName], { stdio: "inherit" });
508
493
  console.log(green(`✓ Branch created: ${branchName}`));
509
494
  // Skip test plan prompts if --yes is provided
510
495
  if (!options.yes) {
@@ -593,4 +578,3 @@ export async function issueCommand(options = {}) {
593
578
  throw error;
594
579
  }
595
580
  }
596
- //# sourceMappingURL=issue.js.map
@@ -8,4 +8,3 @@ export interface IssuesOptions {
8
8
  yes?: boolean;
9
9
  }
10
10
  export declare function issuesCommand(options?: IssuesOptions): Promise<void>;
11
- //# sourceMappingURL=issues.d.ts.map
@@ -1,4 +1,4 @@
1
- import { execSync } from "child_process";
1
+ import { execFileSync } from "child_process";
2
2
  import { loadConfig } from "../config.js";
3
3
  import { bold, dim, green, cyan, yellow, gray } from "../colors.js";
4
4
  import { checkGhInstalled } from "../git.js";
@@ -331,7 +331,7 @@ async function startWork(options, config, ctx) {
331
331
  }
332
332
  // 3. Create branch
333
333
  try {
334
- execSync(`git checkout -b ${branchName}`, { stdio: "inherit" });
334
+ execFileSync("git", ["checkout", "-b", branchName], { stdio: "inherit" });
335
335
  console.log(green(`✓ Branch created: ${branchName}`));
336
336
  }
337
337
  catch {
@@ -376,4 +376,3 @@ export async function issuesCommand(options = {}) {
376
376
  throw error;
377
377
  }
378
378
  }
379
- //# sourceMappingURL=issues.js.map
@@ -1,2 +1 @@
1
1
  export declare function lintConfigCommand(): void;
2
- //# sourceMappingURL=lint-config.d.ts.map
@@ -88,4 +88,3 @@ export function lintConfigCommand() {
88
88
  }
89
89
  console.log("");
90
90
  }
91
- //# sourceMappingURL=lint-config.js.map
@@ -1,2 +1 @@
1
1
  export declare function logCommand(): Promise<void>;
2
- //# sourceMappingURL=log.d.ts.map
@@ -1,4 +1,4 @@
1
- import { execSync } from "child_process";
1
+ import { execSync, execFileSync } from "child_process";
2
2
  import { bold, dim, green, cyan } from "../colors.js";
3
3
  import { getDefaultBase, getBranch } from "../git.js";
4
4
  import { selectWithBack, BACK_VALUE } from "../prompts.js";
@@ -82,22 +82,22 @@ export async function logCommand() {
82
82
  }
83
83
  switch (action) {
84
84
  case "cherry-pick":
85
- execSync(`git cherry-pick ${selectedHash}`, { stdio: "inherit" });
85
+ execFileSync("git", ["cherry-pick", selectedHash], { stdio: "inherit" });
86
86
  console.log(green(`✓ Cherry-picked ${entry.shortHash}`));
87
87
  currentStep = "done";
88
88
  break;
89
89
  case "revert":
90
- execSync(`git revert ${selectedHash}`, { stdio: "inherit" });
90
+ execFileSync("git", ["revert", selectedHash], { stdio: "inherit" });
91
91
  console.log(green(`✓ Reverted ${entry.shortHash}`));
92
92
  currentStep = "done";
93
93
  break;
94
94
  case "fixup":
95
- execSync(`git commit --fixup=${selectedHash}`, { stdio: "inherit" });
95
+ execFileSync("git", ["commit", `--fixup=${selectedHash}`], { stdio: "inherit" });
96
96
  console.log(green(`✓ Created fixup for ${entry.shortHash}`));
97
97
  currentStep = "done";
98
98
  break;
99
99
  case "diff": {
100
- const diff = execSync(`git show ${selectedHash}`, { encoding: "utf-8" });
100
+ const diff = execFileSync("git", ["show", selectedHash], { encoding: "utf-8" });
101
101
  console.log(diff);
102
102
  // Stay on action step to allow choosing another action
103
103
  break;
@@ -121,4 +121,3 @@ export async function logCommand() {
121
121
  process.exit(1);
122
122
  }
123
123
  }
124
- //# sourceMappingURL=log.js.map
@@ -4,4 +4,3 @@ export interface MergeOptions {
4
4
  yes?: boolean;
5
5
  }
6
6
  export declare function mergeCommand(options?: MergeOptions): Promise<void>;
7
- //# sourceMappingURL=merge.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { execSync } from "child_process";
2
2
  import { bold, dim, green, cyan } from "../colors.js";
3
- import { getBranch, checkGhInstalled } from "../git.js";
3
+ import { getBranch, checkGhInstalled, getRepoDefaultBranch } from "../git.js";
4
4
  import { deleteTestPlan } from "../test-plan.js";
5
5
  import { selectWithBack, confirmWithBack, BACK_VALUE, } from "../prompts.js";
6
6
  function getPrForBranch() {
@@ -123,14 +123,14 @@ export async function mergeCommand(options = {}) {
123
123
  console.log(green(`\n✓ PR #${pr.number} merged via ${method}.`));
124
124
  if (deleteBranch) {
125
125
  deleteTestPlan(branch);
126
- // Switch to main after merge
126
+ const defaultBranch = getRepoDefaultBranch();
127
127
  try {
128
- execSync("git checkout main", { stdio: "inherit" });
128
+ execSync(`git checkout ${defaultBranch}`, { stdio: "inherit" });
129
129
  execSync("git pull", { stdio: "inherit" });
130
- console.log(green("✓ Switched to main and pulled latest."));
130
+ console.log(green(`✓ Switched to ${defaultBranch} and pulled latest.`));
131
131
  }
132
132
  catch {
133
- // May not have main locally
133
+ // May not have default branch locally
134
134
  }
135
135
  }
136
136
  }
@@ -142,4 +142,3 @@ export async function mergeCommand(options = {}) {
142
142
  process.exit(1);
143
143
  }
144
144
  }
145
- //# sourceMappingURL=merge.js.map
@@ -7,4 +7,3 @@ export interface PrOptions {
7
7
  ready?: boolean;
8
8
  }
9
9
  export declare function prCommand(options?: PrOptions): Promise<void>;
10
- //# sourceMappingURL=pr.d.ts.map