chief-clancy 0.6.0 → 0.7.1

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 (181) hide show
  1. package/README.md +3 -2
  2. package/dist/bundle/clancy-afk.js +6 -2
  3. package/dist/bundle/clancy-once.js +49 -48
  4. package/dist/installer/hook-installer/hook-installer.d.ts +2 -0
  5. package/dist/installer/hook-installer/hook-installer.d.ts.map +1 -1
  6. package/dist/installer/hook-installer/hook-installer.js +36 -1
  7. package/dist/installer/hook-installer/hook-installer.js.map +1 -1
  8. package/dist/installer/install.js +8 -0
  9. package/dist/installer/install.js.map +1 -1
  10. package/hooks/clancy-branch-guard.js +129 -0
  11. package/hooks/clancy-context-monitor.js +134 -46
  12. package/hooks/clancy-post-compact.js +53 -0
  13. package/hooks/package.json +3 -0
  14. package/package.json +7 -3
  15. package/src/agents/verification-gate.md +128 -0
  16. package/src/roles/setup/workflows/init.md +45 -0
  17. package/src/roles/setup/workflows/scaffold.md +30 -0
  18. package/src/roles/setup/workflows/settings.md +56 -0
  19. package/src/templates/.env.example.github +19 -1
  20. package/src/templates/.env.example.jira +25 -1
  21. package/src/templates/.env.example.linear +19 -1
  22. package/dist/schemas/bitbucket-pr.d.ts +0 -137
  23. package/dist/schemas/bitbucket-pr.d.ts.map +0 -1
  24. package/dist/schemas/bitbucket-pr.js +0 -75
  25. package/dist/schemas/bitbucket-pr.js.map +0 -1
  26. package/dist/schemas/env.d.ts +0 -150
  27. package/dist/schemas/env.d.ts.map +0 -1
  28. package/dist/schemas/env.js +0 -63
  29. package/dist/schemas/env.js.map +0 -1
  30. package/dist/schemas/github-issues.d.ts +0 -105
  31. package/dist/schemas/github-issues.d.ts.map +0 -1
  32. package/dist/schemas/github-issues.js +0 -54
  33. package/dist/schemas/github-issues.js.map +0 -1
  34. package/dist/schemas/gitlab-mr.d.ts +0 -73
  35. package/dist/schemas/gitlab-mr.d.ts.map +0 -1
  36. package/dist/schemas/gitlab-mr.js +0 -33
  37. package/dist/schemas/gitlab-mr.js.map +0 -1
  38. package/dist/schemas/jira.d.ts +0 -59
  39. package/dist/schemas/jira.d.ts.map +0 -1
  40. package/dist/schemas/jira.js +0 -56
  41. package/dist/schemas/jira.js.map +0 -1
  42. package/dist/schemas/linear.d.ts +0 -108
  43. package/dist/schemas/linear.d.ts.map +0 -1
  44. package/dist/schemas/linear.js +0 -84
  45. package/dist/schemas/linear.js.map +0 -1
  46. package/dist/scripts/afk/afk.d.ts +0 -21
  47. package/dist/scripts/afk/afk.d.ts.map +0 -1
  48. package/dist/scripts/afk/afk.js +0 -118
  49. package/dist/scripts/afk/afk.js.map +0 -1
  50. package/dist/scripts/board/github/github.d.ts +0 -104
  51. package/dist/scripts/board/github/github.d.ts.map +0 -1
  52. package/dist/scripts/board/github/github.js +0 -291
  53. package/dist/scripts/board/github/github.js.map +0 -1
  54. package/dist/scripts/board/jira/jira.d.ts +0 -139
  55. package/dist/scripts/board/jira/jira.d.ts.map +0 -1
  56. package/dist/scripts/board/jira/jira.js +0 -378
  57. package/dist/scripts/board/jira/jira.js.map +0 -1
  58. package/dist/scripts/board/linear/linear.d.ts +0 -129
  59. package/dist/scripts/board/linear/linear.d.ts.map +0 -1
  60. package/dist/scripts/board/linear/linear.js +0 -393
  61. package/dist/scripts/board/linear/linear.js.map +0 -1
  62. package/dist/scripts/once/board-ops/board-ops.d.ts +0 -26
  63. package/dist/scripts/once/board-ops/board-ops.d.ts.map +0 -1
  64. package/dist/scripts/once/board-ops/board-ops.js +0 -113
  65. package/dist/scripts/once/board-ops/board-ops.js.map +0 -1
  66. package/dist/scripts/once/deliver/deliver.d.ts +0 -37
  67. package/dist/scripts/once/deliver/deliver.d.ts.map +0 -1
  68. package/dist/scripts/once/deliver/deliver.js +0 -236
  69. package/dist/scripts/once/deliver/deliver.js.map +0 -1
  70. package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts +0 -22
  71. package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts.map +0 -1
  72. package/dist/scripts/once/fetch-ticket/fetch-ticket.js +0 -123
  73. package/dist/scripts/once/fetch-ticket/fetch-ticket.js.map +0 -1
  74. package/dist/scripts/once/git-token/git-token.d.ts +0 -13
  75. package/dist/scripts/once/git-token/git-token.d.ts.map +0 -1
  76. package/dist/scripts/once/git-token/git-token.js +0 -30
  77. package/dist/scripts/once/git-token/git-token.js.map +0 -1
  78. package/dist/scripts/once/once.d.ts +0 -12
  79. package/dist/scripts/once/once.d.ts.map +0 -1
  80. package/dist/scripts/once/once.js +0 -356
  81. package/dist/scripts/once/once.js.map +0 -1
  82. package/dist/scripts/once/pr-creation/pr-creation.d.ts +0 -11
  83. package/dist/scripts/once/pr-creation/pr-creation.d.ts.map +0 -1
  84. package/dist/scripts/once/pr-creation/pr-creation.js +0 -50
  85. package/dist/scripts/once/pr-creation/pr-creation.js.map +0 -1
  86. package/dist/scripts/once/rework/rework.d.ts +0 -32
  87. package/dist/scripts/once/rework/rework.d.ts.map +0 -1
  88. package/dist/scripts/once/rework/rework.js +0 -208
  89. package/dist/scripts/once/rework/rework.js.map +0 -1
  90. package/dist/scripts/once/types/types.d.ts +0 -13
  91. package/dist/scripts/once/types/types.d.ts.map +0 -1
  92. package/dist/scripts/once/types/types.js +0 -2
  93. package/dist/scripts/once/types/types.js.map +0 -1
  94. package/dist/scripts/shared/branch/branch.d.ts +0 -50
  95. package/dist/scripts/shared/branch/branch.d.ts.map +0 -1
  96. package/dist/scripts/shared/branch/branch.js +0 -61
  97. package/dist/scripts/shared/branch/branch.js.map +0 -1
  98. package/dist/scripts/shared/claude-cli/claude-cli.d.ts +0 -31
  99. package/dist/scripts/shared/claude-cli/claude-cli.d.ts.map +0 -1
  100. package/dist/scripts/shared/claude-cli/claude-cli.js +0 -60
  101. package/dist/scripts/shared/claude-cli/claude-cli.js.map +0 -1
  102. package/dist/scripts/shared/env-schema/env-schema.d.ts +0 -27
  103. package/dist/scripts/shared/env-schema/env-schema.d.ts.map +0 -1
  104. package/dist/scripts/shared/env-schema/env-schema.js +0 -47
  105. package/dist/scripts/shared/env-schema/env-schema.js.map +0 -1
  106. package/dist/scripts/shared/feasibility/feasibility.d.ts +0 -30
  107. package/dist/scripts/shared/feasibility/feasibility.d.ts.map +0 -1
  108. package/dist/scripts/shared/feasibility/feasibility.js +0 -68
  109. package/dist/scripts/shared/feasibility/feasibility.js.map +0 -1
  110. package/dist/scripts/shared/format/format.d.ts +0 -11
  111. package/dist/scripts/shared/format/format.d.ts.map +0 -1
  112. package/dist/scripts/shared/format/format.js +0 -18
  113. package/dist/scripts/shared/format/format.js.map +0 -1
  114. package/dist/scripts/shared/git-ops/git-ops.d.ts +0 -90
  115. package/dist/scripts/shared/git-ops/git-ops.d.ts.map +0 -1
  116. package/dist/scripts/shared/git-ops/git-ops.js +0 -190
  117. package/dist/scripts/shared/git-ops/git-ops.js.map +0 -1
  118. package/dist/scripts/shared/http/http.d.ts +0 -54
  119. package/dist/scripts/shared/http/http.d.ts.map +0 -1
  120. package/dist/scripts/shared/http/http.js +0 -76
  121. package/dist/scripts/shared/http/http.js.map +0 -1
  122. package/dist/scripts/shared/notify/notify.d.ts +0 -46
  123. package/dist/scripts/shared/notify/notify.d.ts.map +0 -1
  124. package/dist/scripts/shared/notify/notify.js +0 -88
  125. package/dist/scripts/shared/notify/notify.js.map +0 -1
  126. package/dist/scripts/shared/preflight/preflight.d.ts +0 -40
  127. package/dist/scripts/shared/preflight/preflight.d.ts.map +0 -1
  128. package/dist/scripts/shared/preflight/preflight.js +0 -96
  129. package/dist/scripts/shared/preflight/preflight.js.map +0 -1
  130. package/dist/scripts/shared/progress/progress.d.ts +0 -75
  131. package/dist/scripts/shared/progress/progress.d.ts.map +0 -1
  132. package/dist/scripts/shared/progress/progress.js +0 -210
  133. package/dist/scripts/shared/progress/progress.js.map +0 -1
  134. package/dist/scripts/shared/prompt/prompt.d.ts +0 -58
  135. package/dist/scripts/shared/prompt/prompt.d.ts.map +0 -1
  136. package/dist/scripts/shared/prompt/prompt.js +0 -123
  137. package/dist/scripts/shared/prompt/prompt.js.map +0 -1
  138. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts +0 -82
  139. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts.map +0 -1
  140. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js +0 -301
  141. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js.map +0 -1
  142. package/dist/scripts/shared/pull-request/github/github.d.ts +0 -72
  143. package/dist/scripts/shared/pull-request/github/github.d.ts.map +0 -1
  144. package/dist/scripts/shared/pull-request/github/github.js +0 -226
  145. package/dist/scripts/shared/pull-request/github/github.js.map +0 -1
  146. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts +0 -74
  147. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts.map +0 -1
  148. package/dist/scripts/shared/pull-request/gitlab/gitlab.js +0 -220
  149. package/dist/scripts/shared/pull-request/gitlab/gitlab.js.map +0 -1
  150. package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts +0 -31
  151. package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts.map +0 -1
  152. package/dist/scripts/shared/pull-request/post-pr/post-pr.js +0 -61
  153. package/dist/scripts/shared/pull-request/post-pr/post-pr.js.map +0 -1
  154. package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts +0 -40
  155. package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts.map +0 -1
  156. package/dist/scripts/shared/pull-request/pr-body/pr-body.js +0 -84
  157. package/dist/scripts/shared/pull-request/pr-body/pr-body.js.map +0 -1
  158. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts +0 -23
  159. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts.map +0 -1
  160. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js +0 -30
  161. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js.map +0 -1
  162. package/dist/scripts/shared/remote/remote.d.ts +0 -41
  163. package/dist/scripts/shared/remote/remote.d.ts.map +0 -1
  164. package/dist/scripts/shared/remote/remote.js +0 -227
  165. package/dist/scripts/shared/remote/remote.js.map +0 -1
  166. package/dist/types/board.d.ts +0 -13
  167. package/dist/types/board.d.ts.map +0 -1
  168. package/dist/types/board.js +0 -5
  169. package/dist/types/board.js.map +0 -1
  170. package/dist/types/index.d.ts +0 -4
  171. package/dist/types/index.d.ts.map +0 -1
  172. package/dist/types/index.js +0 -2
  173. package/dist/types/index.js.map +0 -1
  174. package/dist/types/remote.d.ts +0 -55
  175. package/dist/types/remote.d.ts.map +0 -1
  176. package/dist/types/remote.js +0 -5
  177. package/dist/types/remote.js.map +0 -1
  178. package/dist/utils/parse-json/parse-json.d.ts +0 -20
  179. package/dist/utils/parse-json/parse-json.d.ts.map +0 -1
  180. package/dist/utils/parse-json/parse-json.js +0 -27
  181. package/dist/utils/parse-json/parse-json.js.map +0 -1
@@ -1,236 +0,0 @@
1
- import { execFileSync } from 'node:child_process';
2
- import { formatDuration } from '../../../scripts/shared/format/format.js';
3
- import { branchExists, checkout, fetchRemoteBranch, pushBranch, remoteBranchExists, } from '../../../scripts/shared/git-ops/git-ops.js';
4
- import { appendProgress, findEntriesWithStatus, } from '../../../scripts/shared/progress/progress.js';
5
- import { buildEpicPrBody, buildPrBody, } from '../../../scripts/shared/pull-request/pr-body/pr-body.js';
6
- import { detectRemote } from '../../../scripts/shared/remote/remote.js';
7
- import { dim, green, red, yellow } from '../../../utils/ansi/ansi.js';
8
- import { sharedEnv, transitionToStatus } from '../board-ops/board-ops.js';
9
- import { attemptPrCreation, buildManualPrUrl, } from '../pr-creation/pr-creation.js';
10
- // ─── Epic branch management ─────────────────────────────────────────────────
11
- /**
12
- * Ensure the epic branch exists locally and on the remote.
13
- *
14
- * - If it exists on the remote, fetches it locally.
15
- * - If it only exists locally but not on the remote, refuses to overwrite
16
- * and prints migration instructions (safety guard for mid-upgrade users).
17
- * - If it doesn't exist at all, creates from `origin/{baseBranch}` and pushes.
18
- *
19
- * @param epicBranch - The epic branch name (e.g., `'epic/proj-100'`).
20
- * @param baseBranch - The base branch name (e.g., `'main'`).
21
- * @returns `true` if the branch is ready, `false` if creation was blocked.
22
- */
23
- export function ensureEpicBranch(epicBranch, baseBranch) {
24
- const existsOnRemote = remoteBranchExists(epicBranch);
25
- const existsLocally = branchExists(epicBranch);
26
- if (existsOnRemote) {
27
- const fetched = fetchRemoteBranch(epicBranch);
28
- if (!fetched) {
29
- console.log(yellow(`⚠ Epic branch ${epicBranch} exists on remote but could not be fetched.`));
30
- return false;
31
- }
32
- return true;
33
- }
34
- if (existsLocally) {
35
- // Local branch exists but not on remote — may have unpushed squash merges
36
- // from the old deliverViaEpicMerge flow. Refuse to overwrite.
37
- console.log(red(`✗ Epic branch ${epicBranch} exists locally but not on remote.`));
38
- console.log(yellow(' This may contain work from a previous Clancy version that squash-merged locally.'));
39
- console.log(dim(' To preserve this work, push it manually:'));
40
- console.log(dim(` git push -u origin ${epicBranch}`));
41
- console.log(dim(' Then re-run /clancy:once to continue.'));
42
- return false;
43
- }
44
- // Create fresh epic branch from latest remote base
45
- try {
46
- execFileSync('git', ['fetch', 'origin', baseBranch], {
47
- encoding: 'utf8',
48
- stdio: ['pipe', 'pipe', 'pipe'],
49
- timeout: 15_000,
50
- });
51
- execFileSync('git', ['checkout', '-b', epicBranch, `origin/${baseBranch}`], { encoding: 'utf8' });
52
- const pushed = pushBranch(epicBranch);
53
- if (!pushed) {
54
- console.log(yellow(`⚠ Created ${epicBranch} locally but could not push to origin.`));
55
- return false;
56
- }
57
- else {
58
- console.log(green(` ✓ Created epic branch ${epicBranch}`));
59
- }
60
- return true;
61
- }
62
- catch (err) {
63
- console.log(red(`✗ Could not create epic branch: ${err instanceof Error ? err.message : String(err)}`));
64
- return false;
65
- }
66
- }
67
- // ─── Delivery paths ──────────────────────────────────────────────────────────
68
- /**
69
- * PR flow: push branch to remote, create PR/MR, transition to In Review.
70
- *
71
- * @param parent - Optional parent key for progress logging (epic branch flow).
72
- * @returns `false` if the push failed (caller should handle early return).
73
- */
74
- export async function deliverViaPullRequest(config, ticket, ticketBranch, targetBranch, startTime, skipLog = false, parent) {
75
- const pushed = pushBranch(ticketBranch);
76
- if (!pushed) {
77
- console.log(yellow(`⚠ Could not push ${ticketBranch} to origin.`));
78
- console.log(dim(' The branch is still available locally. Push manually:'));
79
- console.log(dim(` git push -u origin ${ticketBranch}`));
80
- if (!skipLog)
81
- appendProgress(process.cwd(), ticket.key, ticket.title, 'PUSH_FAILED', undefined, parent);
82
- checkout(targetBranch);
83
- const elapsed = formatDuration(Date.now() - startTime);
84
- console.log('');
85
- console.log(yellow(`⚠ ${ticket.key} implemented but push failed`) +
86
- dim(` (${elapsed})`));
87
- return false;
88
- }
89
- console.log(green(` ✓ Pushed ${ticketBranch}`));
90
- // Attempt PR/MR creation
91
- const platformOverride = sharedEnv(config).CLANCY_GIT_PLATFORM;
92
- const remote = detectRemote(platformOverride);
93
- const prTitle = `feat(${ticket.key}): ${ticket.title}`;
94
- const prBody = buildPrBody(config, {
95
- key: ticket.key,
96
- title: ticket.title,
97
- description: ticket.description,
98
- provider: config.provider,
99
- }, targetBranch);
100
- if (remote.host !== 'none' &&
101
- remote.host !== 'unknown' &&
102
- remote.host !== 'azure') {
103
- const pr = await attemptPrCreation(config, remote, ticketBranch, targetBranch, prTitle, prBody);
104
- if (pr?.ok) {
105
- console.log(green(` ✓ PR created: ${pr.url}`));
106
- if (!skipLog)
107
- appendProgress(process.cwd(), ticket.key, ticket.title, 'PR_CREATED', pr.number, parent);
108
- }
109
- else if (pr && !pr.ok && pr.alreadyExists) {
110
- console.log(yellow(` ⚠ A PR/MR already exists for ${ticketBranch}. Branch pushed.`));
111
- if (!skipLog)
112
- appendProgress(process.cwd(), ticket.key, ticket.title, 'PUSHED', undefined, parent);
113
- }
114
- else if (pr && !pr.ok) {
115
- console.log(yellow(` ⚠ PR/MR creation failed: ${pr.error}`));
116
- const manualUrl = buildManualPrUrl(remote, ticketBranch, targetBranch);
117
- if (manualUrl) {
118
- console.log(dim(` Create one manually: ${manualUrl}`));
119
- }
120
- else {
121
- console.log(dim(' Branch pushed — create a PR/MR manually.'));
122
- }
123
- if (!skipLog)
124
- appendProgress(process.cwd(), ticket.key, ticket.title, 'PUSHED', undefined, parent);
125
- }
126
- else {
127
- // No token available for this platform
128
- const manualUrl = buildManualPrUrl(remote, ticketBranch, targetBranch);
129
- if (manualUrl) {
130
- console.log(dim(` Create a PR: ${manualUrl}`));
131
- }
132
- else {
133
- console.log(dim(' Branch pushed to remote. Create a PR/MR manually.'));
134
- }
135
- if (!skipLog)
136
- appendProgress(process.cwd(), ticket.key, ticket.title, 'PUSHED', undefined, parent);
137
- }
138
- }
139
- else if (remote.host === 'none') {
140
- console.log(yellow(`⚠ No git remote configured. Branch available locally: ${ticketBranch}`));
141
- if (!skipLog)
142
- appendProgress(process.cwd(), ticket.key, ticket.title, 'LOCAL', undefined, parent);
143
- }
144
- else {
145
- // Unknown or Azure remote — just note the push
146
- console.log(dim(' Branch pushed to remote. Create a PR/MR manually.'));
147
- if (!skipLog)
148
- appendProgress(process.cwd(), ticket.key, ticket.title, 'PUSHED', undefined, parent);
149
- }
150
- // Transition to In Review (not Done — PR hasn't been merged yet)
151
- // For GitHub Issues: do NOT close — PR body has "Closes #N" (or "Part of") for auto-close on merge
152
- if (config.provider !== 'github') {
153
- const statusReview = config.env.CLANCY_STATUS_REVIEW ?? config.env.CLANCY_STATUS_DONE;
154
- if (statusReview) {
155
- await transitionToStatus(config, ticket, statusReview);
156
- }
157
- }
158
- // Switch back to target branch
159
- checkout(targetBranch);
160
- return true;
161
- }
162
- // ─── Epic completion ──────────────────────────────────────────────────────────
163
- /**
164
- * Create the final PR from the epic branch to the base branch.
165
- *
166
- * Called when all children of an epic are done. Builds a PR body listing
167
- * all child tickets, creates the PR, and logs EPIC_PR_CREATED.
168
- *
169
- * @param config - The board configuration.
170
- * @param epicKey - The epic ticket key (e.g., `'PROJ-100'`).
171
- * @param epicTitle - The epic ticket title.
172
- * @param epicBranch - The epic branch name (e.g., `'epic/proj-100'`).
173
- * @param baseBranch - The base branch name (e.g., `'main'`).
174
- * @returns `true` if the PR was created successfully.
175
- */
176
- export async function deliverEpicToBase(config, epicKey, epicTitle, epicBranch, baseBranch) {
177
- console.log('');
178
- console.log(green(`🎉 All children of ${epicKey} are done!`));
179
- console.log(dim(` Creating epic PR: ${epicBranch} → ${baseBranch}`));
180
- // Gather child entries from progress.txt
181
- const allPrCreated = findEntriesWithStatus(process.cwd(), 'PR_CREATED');
182
- const allDone = findEntriesWithStatus(process.cwd(), 'DONE');
183
- const allReworked = findEntriesWithStatus(process.cwd(), 'REWORK');
184
- const allPushed = findEntriesWithStatus(process.cwd(), 'PUSHED');
185
- const childEntries = [
186
- ...allPrCreated,
187
- ...allDone,
188
- ...allReworked,
189
- ...allPushed,
190
- ].filter((e) => e.parent === epicKey);
191
- const platformOverride = sharedEnv(config).CLANCY_GIT_PLATFORM;
192
- const remote = detectRemote(platformOverride);
193
- const prTitle = `feat(${epicKey}): ${epicTitle}`;
194
- const prBody = buildEpicPrBody(epicKey, epicTitle, childEntries);
195
- if (remote.host === 'none' ||
196
- remote.host === 'unknown' ||
197
- remote.host === 'azure') {
198
- console.log(yellow(`⚠ Cannot create epic PR — no supported git remote detected.`));
199
- console.log(dim(` Push manually: git push origin ${epicBranch}`));
200
- console.log(dim(` Then create a PR targeting ${baseBranch}`));
201
- return false;
202
- }
203
- const pr = await attemptPrCreation(config, remote, epicBranch, baseBranch, prTitle, prBody);
204
- if (pr?.ok) {
205
- console.log(green(` ✓ Epic PR created: ${pr.url}`));
206
- appendProgress(process.cwd(), epicKey, epicTitle, 'EPIC_PR_CREATED', pr.number);
207
- // Transition epic ticket to Review
208
- if (config.provider !== 'github') {
209
- const statusReview = config.env.CLANCY_STATUS_REVIEW ?? config.env.CLANCY_STATUS_DONE;
210
- if (statusReview) {
211
- await transitionToStatus(config, {
212
- key: epicKey,
213
- title: epicTitle,
214
- description: '',
215
- parentInfo: 'none',
216
- blockers: 'None',
217
- }, statusReview);
218
- }
219
- }
220
- return true;
221
- }
222
- if (pr && !pr.ok && pr.alreadyExists) {
223
- console.log(yellow(` ⚠ An epic PR already exists for ${epicBranch}.`));
224
- appendProgress(process.cwd(), epicKey, epicTitle, 'EPIC_PR_CREATED');
225
- return true;
226
- }
227
- console.log(yellow(`⚠ Epic PR creation failed: ${pr?.error ?? 'unknown error'}`));
228
- console.log(dim(` Create it manually:`));
229
- console.log(dim(` Branch: ${epicBranch} → ${baseBranch}`));
230
- const manualUrl = buildManualPrUrl(remote, epicBranch, baseBranch);
231
- if (manualUrl) {
232
- console.log(dim(` ${manualUrl}`));
233
- }
234
- return false;
235
- }
236
- //# sourceMappingURL=deliver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deliver.js","sourceRoot":"","sources":["../../../../src/scripts/once/deliver/deliver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACV,kBAAkB,GACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,WAAW,GACZ,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAGvC,+EAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,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B,EACD,YAAY,CACb,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,qCAAqC,UAAU,GAAG,CAAC,CAAC,CAAC;QACxE,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,GAAG,CACT,MAAM,CAAC,8BAA8B,EAAE,EAAE,KAAK,IAAI,eAAe,EAAE,CAAC,CACrE,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,UAAU,MAAM,UAAU,EAAE,CAAC,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACnE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,SAAS,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,22 +0,0 @@
1
- import type { BoardConfig } from '../../../scripts/shared/env-schema/env-schema.js';
2
- import type { FetchedTicket } from '../types/types.js';
3
- /** Options for ticket fetching behaviour. */
4
- export type FetchTicketOptions = {
5
- /** If `true`, excludes tickets with the `clancy:hitl` label. */
6
- isAfk?: boolean;
7
- };
8
- /**
9
- * Fetch the next available unblocked ticket from the board.
10
- *
11
- * Fetches up to 5 candidate tickets and returns the first one that is not
12
- * blocked. If all candidates are blocked, returns `undefined`.
13
- *
14
- * In AFK mode (`CLANCY_AFK_MODE=1` or `opts.isAfk`), tickets with the
15
- * `clancy:hitl` label are excluded from the candidate pool.
16
- *
17
- * @param config - The board configuration.
18
- * @param opts - Optional fetch behaviour overrides.
19
- * @returns The first unblocked ticket, or `undefined` if none available.
20
- */
21
- export declare function fetchTicket(config: BoardConfig, opts?: FetchTicketOptions): Promise<FetchedTicket | undefined>;
22
- //# sourceMappingURL=fetch-ticket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-ticket.d.ts","sourceRoot":"","sources":["../../../../src/scripts/once/fetch-ticket/fetch-ticket.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAuIF;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE,kBAAkB,GACxB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAYpC"}
@@ -1,123 +0,0 @@
1
- import { fetchBlockerStatus as fetchGitHubBlockerStatus, fetchIssues as fetchGitHubIssues, resolveUsername, } from '../../../scripts/board/github/github.js';
2
- import { buildAuthHeader, fetchBlockerStatus as fetchJiraBlockerStatus, fetchTickets as fetchJiraTickets, } from '../../../scripts/board/jira/jira.js';
3
- import { fetchBlockerStatus as fetchLinearBlockerStatus, fetchIssues as fetchLinearIssues, } from '../../../scripts/board/linear/linear.js';
4
- /** Whether the current run is in AFK mode (set by the AFK runner). */
5
- function detectAfkMode(opts) {
6
- return opts?.isAfk ?? process.env.CLANCY_AFK_MODE === '1';
7
- }
8
- // ─── Board-specific candidate fetch ──────────────────────────────────────────
9
- /**
10
- * Fetch candidate tickets from the board.
11
- *
12
- * @param config - The board configuration.
13
- * @param excludeHitl - Whether to exclude `clancy:hitl` labelled tickets.
14
- * @returns Array of normalised candidate tickets.
15
- */
16
- async function fetchCandidates(config, excludeHitl) {
17
- switch (config.provider) {
18
- case 'jira': {
19
- const { env } = config;
20
- const auth = buildAuthHeader(env.JIRA_USER, env.JIRA_API_TOKEN);
21
- const tickets = await fetchJiraTickets(env.JIRA_BASE_URL, auth, env.JIRA_PROJECT_KEY, env.CLANCY_JQL_STATUS ?? 'To Do', env.CLANCY_JQL_SPRINT, env.CLANCY_LABEL, excludeHitl);
22
- return tickets.map((ticket) => {
23
- const blockerStr = ticket.blockers.length
24
- ? `Blocked by: ${ticket.blockers.join(', ')}`
25
- : 'None';
26
- return {
27
- key: ticket.key,
28
- title: ticket.title,
29
- description: ticket.description,
30
- parentInfo: ticket.epicKey ?? 'none',
31
- blockers: blockerStr,
32
- };
33
- });
34
- }
35
- case 'github': {
36
- const { env } = config;
37
- const username = await resolveUsername(env.GITHUB_TOKEN);
38
- const tickets = await fetchGitHubIssues(env.GITHUB_TOKEN, env.GITHUB_REPO, env.CLANCY_LABEL, username, excludeHitl);
39
- return tickets.map((ticket) => ({
40
- key: ticket.key,
41
- title: ticket.title,
42
- description: ticket.description,
43
- parentInfo: ticket.milestone ?? 'none',
44
- blockers: 'None',
45
- }));
46
- }
47
- case 'linear': {
48
- const { env } = config;
49
- const tickets = await fetchLinearIssues({
50
- LINEAR_API_KEY: env.LINEAR_API_KEY,
51
- LINEAR_TEAM_ID: env.LINEAR_TEAM_ID,
52
- CLANCY_LABEL: env.CLANCY_LABEL,
53
- }, excludeHitl);
54
- return tickets.map((ticket) => ({
55
- key: ticket.key,
56
- title: ticket.title,
57
- description: ticket.description,
58
- parentInfo: ticket.parentIdentifier ?? 'none',
59
- blockers: 'None',
60
- linearIssueId: ticket.issueId,
61
- issueId: ticket.issueId,
62
- }));
63
- }
64
- }
65
- }
66
- // ─── Blocker check ───────────────────────────────────────────────────────────
67
- /**
68
- * Check whether a ticket is blocked on the board.
69
- *
70
- * @param config - The board configuration.
71
- * @param ticket - The candidate ticket.
72
- * @returns `true` if the ticket is blocked.
73
- */
74
- async function isBlocked(config, ticket) {
75
- switch (config.provider) {
76
- case 'jira': {
77
- const { env } = config;
78
- const auth = buildAuthHeader(env.JIRA_USER, env.JIRA_API_TOKEN);
79
- return fetchJiraBlockerStatus(env.JIRA_BASE_URL, auth, ticket.key);
80
- }
81
- case 'github': {
82
- const { env } = config;
83
- const issueNumber = parseInt(ticket.key.replace('#', ''), 10);
84
- if (Number.isNaN(issueNumber))
85
- return false;
86
- return fetchGitHubBlockerStatus(env.GITHUB_TOKEN, env.GITHUB_REPO, issueNumber, ticket.description);
87
- }
88
- case 'linear': {
89
- const { env } = config;
90
- if (!ticket.issueId)
91
- return false;
92
- return fetchLinearBlockerStatus(env.LINEAR_API_KEY, ticket.issueId);
93
- }
94
- }
95
- }
96
- // ─── Board-specific fetch (blocker-aware) ────────────────────────────────────
97
- /**
98
- * Fetch the next available unblocked ticket from the board.
99
- *
100
- * Fetches up to 5 candidate tickets and returns the first one that is not
101
- * blocked. If all candidates are blocked, returns `undefined`.
102
- *
103
- * In AFK mode (`CLANCY_AFK_MODE=1` or `opts.isAfk`), tickets with the
104
- * `clancy:hitl` label are excluded from the candidate pool.
105
- *
106
- * @param config - The board configuration.
107
- * @param opts - Optional fetch behaviour overrides.
108
- * @returns The first unblocked ticket, or `undefined` if none available.
109
- */
110
- export async function fetchTicket(config, opts) {
111
- const excludeHitl = detectAfkMode(opts);
112
- const candidates = await fetchCandidates(config, excludeHitl);
113
- if (!candidates.length)
114
- return undefined;
115
- for (const candidate of candidates) {
116
- const blocked = await isBlocked(config, candidate);
117
- if (!blocked)
118
- return candidate;
119
- console.log(`Skipping ${candidate.key} — blocked`);
120
- }
121
- return undefined;
122
- }
123
- //# sourceMappingURL=fetch-ticket.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch-ticket.js","sourceRoot":"","sources":["../../../../src/scripts/once/fetch-ticket/fetch-ticket.ts"],"names":[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,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC;AAED,gFAAgF;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAmB,EACnB,IAAyB;IAEzB,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9D,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAEzC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,YAAY,SAAS,CAAC,GAAG,YAAY,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,13 +0,0 @@
1
- import type { BoardConfig } from '../../../scripts/shared/env-schema/env-schema.js';
2
- import type { RemoteInfo } from '../../../types/index.js';
3
- /**
4
- * Resolve a git host token from the board config's env.
5
- *
6
- * For GitHub boards, `GITHUB_TOKEN` is always present.
7
- * For Jira/Linear boards, check the shared optional vars.
8
- */
9
- export declare function resolveGitToken(config: BoardConfig, remote: RemoteInfo): {
10
- token: string;
11
- username?: string;
12
- } | undefined;
13
- //# sourceMappingURL=git-token.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-token.d.ts","sourceRoot":"","sources":["../../../../src/scripts/once/git-token/git-token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,UAAU,GACjB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAmBlD"}
@@ -1,30 +0,0 @@
1
- import { sharedEnv } from '../board-ops/board-ops.js';
2
- /**
3
- * Resolve a git host token from the board config's env.
4
- *
5
- * For GitHub boards, `GITHUB_TOKEN` is always present.
6
- * For Jira/Linear boards, check the shared optional vars.
7
- */
8
- export function resolveGitToken(config, remote) {
9
- const env = sharedEnv(config);
10
- switch (remote.host) {
11
- case 'github':
12
- if (env.GITHUB_TOKEN)
13
- return { token: env.GITHUB_TOKEN };
14
- break;
15
- case 'gitlab':
16
- if (env.GITLAB_TOKEN)
17
- return { token: env.GITLAB_TOKEN };
18
- break;
19
- case 'bitbucket':
20
- if (env.BITBUCKET_USER && env.BITBUCKET_TOKEN)
21
- return { token: env.BITBUCKET_TOKEN, username: env.BITBUCKET_USER };
22
- break;
23
- case 'bitbucket-server':
24
- if (env.BITBUCKET_TOKEN)
25
- return { token: env.BITBUCKET_TOKEN };
26
- break;
27
- }
28
- return undefined;
29
- }
30
- //# sourceMappingURL=git-token.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-token.js","sourceRoot":"","sources":["../../../../src/scripts/once/git-token/git-token.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAmB,EACnB,MAAkB;IAElB,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAE9B,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,IAAI,GAAG,CAAC,YAAY;gBAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC;YACzD,MAAM;QACR,KAAK,QAAQ;YACX,IAAI,GAAG,CAAC,YAAY;gBAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC;YACzD,MAAM;QACR,KAAK,WAAW;YACd,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,eAAe;gBAC3C,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,eAAe,EAAE,QAAQ,EAAE,GAAG,CAAC,cAAc,EAAE,CAAC;YACtE,MAAM;QACR,KAAK,kBAAkB;YACrB,IAAI,GAAG,CAAC,eAAe;gBAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC;YAC/D,MAAM;IACV,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Run the once orchestrator — full ticket lifecycle.
3
- *
4
- * @param argv - Process arguments (supports `--dry-run` flag).
5
- *
6
- * @example
7
- * ```ts
8
- * await run(process.argv);
9
- * ```
10
- */
11
- export declare function run(argv: string[]): Promise<void>;
12
- //# sourceMappingURL=once.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"once.d.ts","sourceRoot":"","sources":["../../../src/scripts/once/once.ts"],"names":[],"mappings":"AA4DA;;;;;;;;;GASG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqbvD"}