chief-clancy 0.7.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 (182) hide show
  1. package/README.md +1 -1
  2. package/dist/bundle/clancy-once.js +50 -50
  3. package/package.json +5 -2
  4. package/src/templates/.env.example.github +19 -1
  5. package/src/templates/.env.example.jira +25 -1
  6. package/src/templates/.env.example.linear +19 -1
  7. package/dist/schemas/bitbucket-pr.d.ts +0 -137
  8. package/dist/schemas/bitbucket-pr.d.ts.map +0 -1
  9. package/dist/schemas/bitbucket-pr.js +0 -75
  10. package/dist/schemas/bitbucket-pr.js.map +0 -1
  11. package/dist/schemas/env.d.ts +0 -170
  12. package/dist/schemas/env.d.ts.map +0 -1
  13. package/dist/schemas/env.js +0 -69
  14. package/dist/schemas/env.js.map +0 -1
  15. package/dist/schemas/github-issues.d.ts +0 -105
  16. package/dist/schemas/github-issues.d.ts.map +0 -1
  17. package/dist/schemas/github-issues.js +0 -54
  18. package/dist/schemas/github-issues.js.map +0 -1
  19. package/dist/schemas/gitlab-mr.d.ts +0 -73
  20. package/dist/schemas/gitlab-mr.d.ts.map +0 -1
  21. package/dist/schemas/gitlab-mr.js +0 -33
  22. package/dist/schemas/gitlab-mr.js.map +0 -1
  23. package/dist/schemas/jira.d.ts +0 -59
  24. package/dist/schemas/jira.d.ts.map +0 -1
  25. package/dist/schemas/jira.js +0 -56
  26. package/dist/schemas/jira.js.map +0 -1
  27. package/dist/schemas/linear.d.ts +0 -108
  28. package/dist/schemas/linear.d.ts.map +0 -1
  29. package/dist/schemas/linear.js +0 -84
  30. package/dist/schemas/linear.js.map +0 -1
  31. package/dist/scripts/afk/afk.d.ts +0 -21
  32. package/dist/scripts/afk/afk.d.ts.map +0 -1
  33. package/dist/scripts/afk/afk.js +0 -145
  34. package/dist/scripts/afk/afk.js.map +0 -1
  35. package/dist/scripts/afk/report/report.d.ts +0 -47
  36. package/dist/scripts/afk/report/report.d.ts.map +0 -1
  37. package/dist/scripts/afk/report/report.js +0 -194
  38. package/dist/scripts/afk/report/report.js.map +0 -1
  39. package/dist/scripts/board/github/github.d.ts +0 -104
  40. package/dist/scripts/board/github/github.d.ts.map +0 -1
  41. package/dist/scripts/board/github/github.js +0 -291
  42. package/dist/scripts/board/github/github.js.map +0 -1
  43. package/dist/scripts/board/jira/jira.d.ts +0 -139
  44. package/dist/scripts/board/jira/jira.d.ts.map +0 -1
  45. package/dist/scripts/board/jira/jira.js +0 -378
  46. package/dist/scripts/board/jira/jira.js.map +0 -1
  47. package/dist/scripts/board/linear/linear.d.ts +0 -129
  48. package/dist/scripts/board/linear/linear.d.ts.map +0 -1
  49. package/dist/scripts/board/linear/linear.js +0 -393
  50. package/dist/scripts/board/linear/linear.js.map +0 -1
  51. package/dist/scripts/once/board-ops/board-ops.d.ts +0 -26
  52. package/dist/scripts/once/board-ops/board-ops.d.ts.map +0 -1
  53. package/dist/scripts/once/board-ops/board-ops.js +0 -113
  54. package/dist/scripts/once/board-ops/board-ops.js.map +0 -1
  55. package/dist/scripts/once/cost/cost.d.ts +0 -10
  56. package/dist/scripts/once/cost/cost.d.ts.map +0 -1
  57. package/dist/scripts/once/cost/cost.js +0 -23
  58. package/dist/scripts/once/cost/cost.js.map +0 -1
  59. package/dist/scripts/once/deliver/deliver.d.ts +0 -37
  60. package/dist/scripts/once/deliver/deliver.d.ts.map +0 -1
  61. package/dist/scripts/once/deliver/deliver.js +0 -253
  62. package/dist/scripts/once/deliver/deliver.js.map +0 -1
  63. package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts +0 -22
  64. package/dist/scripts/once/fetch-ticket/fetch-ticket.d.ts.map +0 -1
  65. package/dist/scripts/once/fetch-ticket/fetch-ticket.js +0 -123
  66. package/dist/scripts/once/fetch-ticket/fetch-ticket.js.map +0 -1
  67. package/dist/scripts/once/git-token/git-token.d.ts +0 -13
  68. package/dist/scripts/once/git-token/git-token.d.ts.map +0 -1
  69. package/dist/scripts/once/git-token/git-token.js +0 -30
  70. package/dist/scripts/once/git-token/git-token.js.map +0 -1
  71. package/dist/scripts/once/lock/lock.d.ts +0 -17
  72. package/dist/scripts/once/lock/lock.d.ts.map +0 -1
  73. package/dist/scripts/once/lock/lock.js +0 -70
  74. package/dist/scripts/once/lock/lock.js.map +0 -1
  75. package/dist/scripts/once/once.d.ts +0 -12
  76. package/dist/scripts/once/once.d.ts.map +0 -1
  77. package/dist/scripts/once/once.js +0 -452
  78. package/dist/scripts/once/once.js.map +0 -1
  79. package/dist/scripts/once/pr-creation/pr-creation.d.ts +0 -11
  80. package/dist/scripts/once/pr-creation/pr-creation.d.ts.map +0 -1
  81. package/dist/scripts/once/pr-creation/pr-creation.js +0 -50
  82. package/dist/scripts/once/pr-creation/pr-creation.js.map +0 -1
  83. package/dist/scripts/once/resume/resume.d.ts +0 -24
  84. package/dist/scripts/once/resume/resume.d.ts.map +0 -1
  85. package/dist/scripts/once/resume/resume.js +0 -159
  86. package/dist/scripts/once/resume/resume.js.map +0 -1
  87. package/dist/scripts/once/rework/rework.d.ts +0 -32
  88. package/dist/scripts/once/rework/rework.d.ts.map +0 -1
  89. package/dist/scripts/once/rework/rework.js +0 -208
  90. package/dist/scripts/once/rework/rework.js.map +0 -1
  91. package/dist/scripts/once/types/types.d.ts +0 -13
  92. package/dist/scripts/once/types/types.d.ts.map +0 -1
  93. package/dist/scripts/once/types/types.js +0 -2
  94. package/dist/scripts/once/types/types.js.map +0 -1
  95. package/dist/scripts/shared/branch/branch.d.ts +0 -50
  96. package/dist/scripts/shared/branch/branch.d.ts.map +0 -1
  97. package/dist/scripts/shared/branch/branch.js +0 -61
  98. package/dist/scripts/shared/branch/branch.js.map +0 -1
  99. package/dist/scripts/shared/claude-cli/claude-cli.d.ts +0 -31
  100. package/dist/scripts/shared/claude-cli/claude-cli.d.ts.map +0 -1
  101. package/dist/scripts/shared/claude-cli/claude-cli.js +0 -60
  102. package/dist/scripts/shared/claude-cli/claude-cli.js.map +0 -1
  103. package/dist/scripts/shared/env-schema/env-schema.d.ts +0 -27
  104. package/dist/scripts/shared/env-schema/env-schema.d.ts.map +0 -1
  105. package/dist/scripts/shared/env-schema/env-schema.js +0 -47
  106. package/dist/scripts/shared/env-schema/env-schema.js.map +0 -1
  107. package/dist/scripts/shared/feasibility/feasibility.d.ts +0 -30
  108. package/dist/scripts/shared/feasibility/feasibility.d.ts.map +0 -1
  109. package/dist/scripts/shared/feasibility/feasibility.js +0 -68
  110. package/dist/scripts/shared/feasibility/feasibility.js.map +0 -1
  111. package/dist/scripts/shared/format/format.d.ts +0 -11
  112. package/dist/scripts/shared/format/format.d.ts.map +0 -1
  113. package/dist/scripts/shared/format/format.js +0 -23
  114. package/dist/scripts/shared/format/format.js.map +0 -1
  115. package/dist/scripts/shared/git-ops/git-ops.d.ts +0 -90
  116. package/dist/scripts/shared/git-ops/git-ops.d.ts.map +0 -1
  117. package/dist/scripts/shared/git-ops/git-ops.js +0 -190
  118. package/dist/scripts/shared/git-ops/git-ops.js.map +0 -1
  119. package/dist/scripts/shared/http/http.d.ts +0 -54
  120. package/dist/scripts/shared/http/http.d.ts.map +0 -1
  121. package/dist/scripts/shared/http/http.js +0 -76
  122. package/dist/scripts/shared/http/http.js.map +0 -1
  123. package/dist/scripts/shared/notify/notify.d.ts +0 -46
  124. package/dist/scripts/shared/notify/notify.d.ts.map +0 -1
  125. package/dist/scripts/shared/notify/notify.js +0 -88
  126. package/dist/scripts/shared/notify/notify.js.map +0 -1
  127. package/dist/scripts/shared/preflight/preflight.d.ts +0 -40
  128. package/dist/scripts/shared/preflight/preflight.d.ts.map +0 -1
  129. package/dist/scripts/shared/preflight/preflight.js +0 -96
  130. package/dist/scripts/shared/preflight/preflight.js.map +0 -1
  131. package/dist/scripts/shared/progress/progress.d.ts +0 -88
  132. package/dist/scripts/shared/progress/progress.d.ts.map +0 -1
  133. package/dist/scripts/shared/progress/progress.js +0 -210
  134. package/dist/scripts/shared/progress/progress.js.map +0 -1
  135. package/dist/scripts/shared/prompt/prompt.d.ts +0 -58
  136. package/dist/scripts/shared/prompt/prompt.d.ts.map +0 -1
  137. package/dist/scripts/shared/prompt/prompt.js +0 -123
  138. package/dist/scripts/shared/prompt/prompt.js.map +0 -1
  139. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts +0 -82
  140. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.d.ts.map +0 -1
  141. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js +0 -301
  142. package/dist/scripts/shared/pull-request/bitbucket/bitbucket.js.map +0 -1
  143. package/dist/scripts/shared/pull-request/github/github.d.ts +0 -72
  144. package/dist/scripts/shared/pull-request/github/github.d.ts.map +0 -1
  145. package/dist/scripts/shared/pull-request/github/github.js +0 -226
  146. package/dist/scripts/shared/pull-request/github/github.js.map +0 -1
  147. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts +0 -74
  148. package/dist/scripts/shared/pull-request/gitlab/gitlab.d.ts.map +0 -1
  149. package/dist/scripts/shared/pull-request/gitlab/gitlab.js +0 -220
  150. package/dist/scripts/shared/pull-request/gitlab/gitlab.js.map +0 -1
  151. package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts +0 -31
  152. package/dist/scripts/shared/pull-request/post-pr/post-pr.d.ts.map +0 -1
  153. package/dist/scripts/shared/pull-request/post-pr/post-pr.js +0 -61
  154. package/dist/scripts/shared/pull-request/post-pr/post-pr.js.map +0 -1
  155. package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts +0 -41
  156. package/dist/scripts/shared/pull-request/pr-body/pr-body.d.ts.map +0 -1
  157. package/dist/scripts/shared/pull-request/pr-body/pr-body.js +0 -93
  158. package/dist/scripts/shared/pull-request/pr-body/pr-body.js.map +0 -1
  159. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts +0 -23
  160. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.d.ts.map +0 -1
  161. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js +0 -30
  162. package/dist/scripts/shared/pull-request/rework-comment/rework-comment.js.map +0 -1
  163. package/dist/scripts/shared/remote/remote.d.ts +0 -41
  164. package/dist/scripts/shared/remote/remote.d.ts.map +0 -1
  165. package/dist/scripts/shared/remote/remote.js +0 -227
  166. package/dist/scripts/shared/remote/remote.js.map +0 -1
  167. package/dist/types/board.d.ts +0 -13
  168. package/dist/types/board.d.ts.map +0 -1
  169. package/dist/types/board.js +0 -5
  170. package/dist/types/board.js.map +0 -1
  171. package/dist/types/index.d.ts +0 -4
  172. package/dist/types/index.d.ts.map +0 -1
  173. package/dist/types/index.js +0 -2
  174. package/dist/types/index.js.map +0 -1
  175. package/dist/types/remote.d.ts +0 -55
  176. package/dist/types/remote.d.ts.map +0 -1
  177. package/dist/types/remote.js +0 -5
  178. package/dist/types/remote.js.map +0 -1
  179. package/dist/utils/parse-json/parse-json.d.ts +0 -20
  180. package/dist/utils/parse-json/parse-json.d.ts.map +0 -1
  181. package/dist/utils/parse-json/parse-json.js +0 -27
  182. package/dist/utils/parse-json/parse-json.js.map +0 -1
@@ -1,145 +0,0 @@
1
- /**
2
- * Clancy AFK runner — loop mode.
3
- *
4
- * Runs the board-specific `clancy-once` script up to `MAX_ITERATIONS` times.
5
- * Detects stop conditions by parsing the script's stdout output.
6
- * Does NOT know about boards — board logic lives entirely in the once script.
7
- */
8
- import { spawnSync } from 'node:child_process';
9
- import { existsSync } from 'node:fs';
10
- import { dirname, join, resolve } from 'node:path';
11
- import { setTimeout as sleep } from 'node:timers/promises';
12
- import { fileURLToPath } from 'node:url';
13
- import { formatDuration } from '../../scripts/shared/format/format.js';
14
- import { sendNotification } from '../../scripts/shared/notify/notify.js';
15
- import { bold, dim, green, red } from '../../utils/ansi/ansi.js';
16
- import { generateSessionReport } from './report/report.js';
17
- /** Stop condition patterns matched against script output. */
18
- const STOP_PATTERNS = {
19
- noTickets: /No tickets found|No issues found|All done/,
20
- skipped: /Ticket skipped/,
21
- preflightFail: /^✗ /m,
22
- };
23
- /**
24
- * Check whether the script output contains a stop condition.
25
- *
26
- * @param output - The captured stdout from a `clancy-once` run.
27
- * @returns An object with `stop` flag and optional `reason`.
28
- */
29
- export function checkStopCondition(output) {
30
- if (STOP_PATTERNS.noTickets.test(output)) {
31
- return { stop: true, reason: 'No more tickets — all done' };
32
- }
33
- if (STOP_PATTERNS.skipped.test(output)) {
34
- return {
35
- stop: true,
36
- reason: 'Ticket was skipped — update the ticket and re-run',
37
- };
38
- }
39
- if (STOP_PATTERNS.preflightFail.test(output)) {
40
- return { stop: true, reason: 'Preflight check failed' };
41
- }
42
- return { stop: false };
43
- }
44
- /**
45
- * Run the AFK loop.
46
- *
47
- * Executes the `clancy-once` script repeatedly up to `maxIterations` times,
48
- * checking for stop conditions after each run.
49
- *
50
- * @param scriptDir - The directory containing `clancy-once.js`.
51
- * @param maxIterations - Maximum number of iterations (default: 5).
52
- */
53
- export async function runAfkLoop(scriptDir, maxIterations = 5) {
54
- const onceScript = join(scriptDir, 'clancy-once.js');
55
- if (!existsSync(onceScript)) {
56
- console.error(red('✗ clancy-once.js not found in'), scriptDir);
57
- return;
58
- }
59
- console.log(dim('┌──────────────────────────────────────────────────────────┐'));
60
- console.log(dim('│') +
61
- bold(' 🤖 Clancy — AFK mode ') +
62
- dim('│'));
63
- console.log(dim('│') +
64
- dim(' "I\'m on it. Proceed to the abandoned warehouse." ') +
65
- dim('│'));
66
- console.log(dim('└──────────────────────────────────────────────────────────┘'));
67
- const loopStart = Date.now();
68
- for (let i = 1; i <= maxIterations; i++) {
69
- const iterStart = Date.now();
70
- console.log('');
71
- console.log(bold(`🔁 Iteration ${i}/${maxIterations}`));
72
- // stderr is inherited so errors are visible to the user in real time.
73
- // Exit codes are not checked — once.ts always exits 0 by design so that
74
- // a transient failure in one iteration does not halt the entire AFK run.
75
- // Stop conditions are explicit board-level signals parsed from stdout.
76
- const result = spawnSync('node', [onceScript], {
77
- encoding: 'utf8',
78
- stdio: ['inherit', 'pipe', 'inherit'],
79
- cwd: process.cwd(),
80
- env: { ...process.env, CLANCY_AFK_MODE: '1' },
81
- });
82
- const output = result.stdout ?? '';
83
- if (output) {
84
- process.stdout.write(output);
85
- }
86
- const iterElapsed = formatDuration(Date.now() - iterStart);
87
- if (result.error) {
88
- console.error(red(`✗ Failed to run clancy-once: ${result.error.message}`));
89
- return;
90
- }
91
- const condition = checkStopCondition(output);
92
- if (condition.stop) {
93
- const totalElapsed = formatDuration(Date.now() - loopStart);
94
- console.log('');
95
- console.log(dim(` Iteration ${i} took ${iterElapsed}`));
96
- console.log(`\n${condition.reason}`);
97
- console.log(dim(` Total: ${i} iteration${i > 1 ? 's' : ''} in ${totalElapsed}`));
98
- generateAndSendReport(loopStart);
99
- return;
100
- }
101
- console.log(dim(` Iteration ${i} took ${iterElapsed}`));
102
- // Brief pause between iterations
103
- if (i < maxIterations) {
104
- await sleep(2000);
105
- }
106
- }
107
- const totalElapsed = formatDuration(Date.now() - loopStart);
108
- console.log('');
109
- console.log(green(`🏁 Completed ${maxIterations} iterations`) +
110
- dim(` (${totalElapsed})`));
111
- console.log(dim(' "That\'s some good police work."'));
112
- console.log(dim(' Run clancy-afk again to continue.'));
113
- generateAndSendReport(loopStart);
114
- }
115
- /**
116
- * Generate a session report and optionally send a webhook notification.
117
- */
118
- function generateAndSendReport(loopStart) {
119
- try {
120
- const report = generateSessionReport(process.cwd(), loopStart, Date.now());
121
- console.log('');
122
- console.log(dim('─── Session Report ───'));
123
- console.log(report);
124
- const webhook = process.env.CLANCY_NOTIFY_WEBHOOK;
125
- if (webhook) {
126
- const lines = report.split('\n');
127
- const summaryLines = lines.filter((l) => l.startsWith('- Tickets') || l.startsWith('- Total'));
128
- const summary = `Clancy AFK: ${summaryLines.join('. ')}. Report: .clancy/session-report.md`;
129
- sendNotification(webhook, summary).catch(() => {
130
- // Best-effort — webhook failure shouldn't crash
131
- });
132
- }
133
- }
134
- catch {
135
- // Best-effort — report generation failure shouldn't crash the loop
136
- }
137
- }
138
- // Main guard — self-execute when run directly (e.g. node .clancy/clancy-afk.js)
139
- if (process.argv[1] &&
140
- fileURLToPath(import.meta.url) === resolve(process.argv[1])) {
141
- const scriptDir = dirname(fileURLToPath(import.meta.url));
142
- const maxIterations = parseInt(process.env.MAX_ITERATIONS ?? '5', 10) || 5;
143
- runAfkLoop(scriptDir, maxIterations);
144
- }
145
- //# sourceMappingURL=afk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"afk.js","sourceRoot":"","sources":["../../../src/scripts/afk/afk.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,6DAA6D;AAC7D,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,2CAA2C;IACtD,OAAO,EAAE,gBAAgB;IACzB,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAI/C,IAAI,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC;IAC9D,CAAC;IAED,IAAI,aAAa,CAAC,OAAO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
5
- duration: string;
6
- tokens: string;
7
- };
8
- /** A ticket in the session report. */
9
- export type SessionTicket = {
10
- key: string;
11
- summary: string;
12
- status: string;
13
- prNumber?: number;
14
- duration?: string;
15
- tokens?: string;
16
- };
17
- /**
18
- * Parse costs.log and return entries with ISO timestamp >= the given threshold.
19
- *
20
- * Each line is expected to follow the format:
21
- * `ISO-timestamp | KEY | Nmin | ~N tokens (estimated)`
22
- *
23
- * Lines that don't match are silently skipped.
24
- *
25
- * @param projectRoot - The project root directory.
26
- * @param sinceMs - Only include entries with timestamp >= this value (ms since epoch).
27
- * @returns Parsed cost entries from this session.
28
- */
29
- export declare function parseCostsLog(projectRoot: string, sinceMs: number): CostEntry[];
30
- /**
31
- * Convert a progress timestamp (`YYYY-MM-DD HH:MM`) to milliseconds since epoch.
32
- *
33
- * @param timestamp - The progress file timestamp string.
34
- * @returns Milliseconds since epoch, or `NaN` if the timestamp is invalid.
35
- */
36
- export declare function progressTimestampToMs(timestamp: string): number;
37
- /**
38
- * Generate a session report from progress.txt and costs.log entries
39
- * created during this AFK session.
40
- *
41
- * @param projectRoot - The project root directory.
42
- * @param loopStartTime - When the AFK loop started (Date.now()).
43
- * @param loopEndTime - When the AFK loop ended.
44
- * @returns The report markdown string.
45
- */
46
- export declare function generateSessionReport(projectRoot: string, loopStartTime: number, loopEndTime: number): string;
47
- //# sourceMappingURL=report.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/scripts/afk/report/report.ts"],"names":[],"mappings":"AAeA,0CAA0C;AAC1C,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,SAAS,EAAE,CAiCb;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK/D;AAcD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,MAAM,CA6HR"}
@@ -1,194 +0,0 @@
1
- /**
2
- * AFK session report generator.
3
- *
4
- * Reads progress.txt and costs.log entries created during the current
5
- * AFK session and generates a markdown report at `.clancy/session-report.md`.
6
- */
7
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
8
- import { join } from 'node:path';
9
- import { formatDuration } from '../../../scripts/shared/format/format.js';
10
- import { parseProgressFile, } from '../../../scripts/shared/progress/progress.js';
11
- /**
12
- * Parse costs.log and return entries with ISO timestamp >= the given threshold.
13
- *
14
- * Each line is expected to follow the format:
15
- * `ISO-timestamp | KEY | Nmin | ~N tokens (estimated)`
16
- *
17
- * Lines that don't match are silently skipped.
18
- *
19
- * @param projectRoot - The project root directory.
20
- * @param sinceMs - Only include entries with timestamp >= this value (ms since epoch).
21
- * @returns Parsed cost entries from this session.
22
- */
23
- export function parseCostsLog(projectRoot, sinceMs) {
24
- const filePath = join(projectRoot, '.clancy', 'costs.log');
25
- let content;
26
- try {
27
- content = readFileSync(filePath, 'utf8');
28
- }
29
- catch {
30
- return [];
31
- }
32
- const entries = [];
33
- for (const line of content.split('\n')) {
34
- const trimmed = line.trim();
35
- if (!trimmed)
36
- continue;
37
- const parts = trimmed.split(' | ');
38
- if (parts.length < 4)
39
- continue;
40
- const timestamp = parts[0];
41
- const entryTime = new Date(timestamp).getTime();
42
- if (Number.isNaN(entryTime) || entryTime < sinceMs)
43
- continue;
44
- entries.push({
45
- timestamp,
46
- key: parts[1],
47
- duration: parts[2],
48
- tokens: parts[3],
49
- });
50
- }
51
- return entries;
52
- }
53
- /**
54
- * Convert a progress timestamp (`YYYY-MM-DD HH:MM`) to milliseconds since epoch.
55
- *
56
- * @param timestamp - The progress file timestamp string.
57
- * @returns Milliseconds since epoch, or `NaN` if the timestamp is invalid.
58
- */
59
- export function progressTimestampToMs(timestamp) {
60
- // Progress timestamps are UTC: "YYYY-MM-DD HH:MM"
61
- // Validate format before parsing to avoid JS Date quirks with garbage input
62
- if (!/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(timestamp))
63
- return NaN;
64
- return new Date(timestamp.replace(' ', 'T') + ':00Z').getTime();
65
- }
66
- /** Statuses that indicate a successfully completed ticket. */
67
- const COMPLETED_STATUSES = new Set([
68
- 'DONE',
69
- 'PR_CREATED',
70
- 'PUSHED',
71
- 'EPIC_PR_CREATED',
72
- 'RESUMED',
73
- ]);
74
- /** Statuses that indicate a failed/skipped ticket. */
75
- const FAILED_STATUSES = new Set(['SKIPPED', 'PUSH_FAILED', 'TIME_LIMIT']);
76
- /**
77
- * Generate a session report from progress.txt and costs.log entries
78
- * created during this AFK session.
79
- *
80
- * @param projectRoot - The project root directory.
81
- * @param loopStartTime - When the AFK loop started (Date.now()).
82
- * @param loopEndTime - When the AFK loop ended.
83
- * @returns The report markdown string.
84
- */
85
- export function generateSessionReport(projectRoot, loopStartTime, loopEndTime) {
86
- // 1. Read progress.txt, filter entries with timestamp >= loopStart
87
- // Round loopStart down to the minute to match progress file precision (YYYY-MM-DD HH:MM)
88
- const loopStartMinute = Math.floor(loopStartTime / 60000) * 60000;
89
- const allProgress = parseProgressFile(projectRoot);
90
- const sessionEntries = allProgress.filter((entry) => {
91
- const entryMs = progressTimestampToMs(entry.timestamp);
92
- return !Number.isNaN(entryMs) && entryMs >= loopStartMinute;
93
- });
94
- // 2. Read costs.log, filter entries with timestamp >= loopStart
95
- const costEntries = parseCostsLog(projectRoot, loopStartTime);
96
- // 3. Build a cost lookup by ticket key
97
- const costByKey = new Map();
98
- for (const cost of costEntries) {
99
- costByKey.set(cost.key, cost);
100
- }
101
- // 4. Deduplicate progress entries — keep latest per key (for rework cycles)
102
- const latestByKey = new Map();
103
- for (const entry of sessionEntries) {
104
- latestByKey.set(entry.key, entry);
105
- }
106
- // 5. Build session tickets
107
- const tickets = [];
108
- for (const entry of latestByKey.values()) {
109
- const cost = costByKey.get(entry.key);
110
- tickets.push({
111
- key: entry.key,
112
- summary: entry.summary,
113
- status: entry.status,
114
- ...(entry.prNumber != null && { prNumber: entry.prNumber }),
115
- ...(cost && { duration: cost.duration, tokens: cost.tokens }),
116
- });
117
- }
118
- // 6. Count completed vs failed
119
- const completed = tickets.filter((t) => COMPLETED_STATUSES.has(t.status));
120
- const failed = tickets.filter((t) => FAILED_STATUSES.has(t.status));
121
- const totalDuration = formatDuration(loopEndTime - loopStartTime);
122
- // 7. Calculate total estimated tokens
123
- let totalTokens = 0;
124
- for (const cost of costEntries) {
125
- const match = cost.tokens.match(/~(\d[\d,]*)/);
126
- if (match) {
127
- totalTokens += parseInt(match[1].replace(/,/g, ''), 10);
128
- }
129
- }
130
- // 8. Format the date
131
- const date = new Date(loopStartTime);
132
- const dateStr = `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, '0')}-${String(date.getUTCDate()).padStart(2, '0')}`;
133
- // 9. Generate markdown
134
- const lines = [];
135
- lines.push(`# AFK Session Report — ${dateStr}`);
136
- lines.push('');
137
- lines.push('## Summary');
138
- lines.push(`- Tickets completed: ${completed.length}`);
139
- lines.push(`- Tickets failed: ${failed.length}`);
140
- lines.push(`- Total duration: ${totalDuration}`);
141
- if (totalTokens > 0) {
142
- lines.push(`- Estimated token usage: ${totalTokens.toLocaleString('en-US')}`);
143
- }
144
- lines.push('');
145
- lines.push('## Tickets');
146
- if (tickets.length === 0) {
147
- lines.push('');
148
- lines.push('No tickets were processed in this session.');
149
- }
150
- for (const ticket of tickets) {
151
- const isCompleted = COMPLETED_STATUSES.has(ticket.status);
152
- const icon = isCompleted ? '\u2713' : '\u2717';
153
- lines.push('');
154
- lines.push(`### ${icon} ${ticket.key} — ${ticket.summary}`);
155
- if (ticket.duration) {
156
- lines.push(`- Duration: ${ticket.duration}`);
157
- }
158
- if (ticket.tokens) {
159
- lines.push(`- Tokens: ${ticket.tokens}`);
160
- }
161
- if (ticket.prNumber != null) {
162
- lines.push(`- PR: #${ticket.prNumber}`);
163
- }
164
- lines.push(`- Status: ${ticket.status}`);
165
- }
166
- // 10. Next Steps
167
- const prNumbers = tickets
168
- .filter((t) => t.prNumber != null)
169
- .map((t) => `#${t.prNumber}`);
170
- const skippedKeys = failed.map((t) => t.key);
171
- if (prNumbers.length > 0 || skippedKeys.length > 0) {
172
- lines.push('');
173
- lines.push('## Next Steps');
174
- if (prNumbers.length > 0) {
175
- lines.push(`- Review PRs ${prNumbers.join(', ')}`);
176
- }
177
- for (const key of skippedKeys) {
178
- lines.push(`- ${key} needs manual intervention`);
179
- }
180
- }
181
- lines.push('');
182
- const report = lines.join('\n');
183
- // 11. Write to .clancy/session-report.md (best-effort)
184
- try {
185
- const reportPath = join(projectRoot, '.clancy', 'session-report.md');
186
- mkdirSync(join(projectRoot, '.clancy'), { recursive: true });
187
- writeFileSync(reportPath, report, 'utf8');
188
- }
189
- catch {
190
- // Best-effort — report is still returned for stdout
191
- }
192
- return report;
193
- }
194
- //# sourceMappingURL=report.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../../src/scripts/afk/report/report.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EA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 @@
1
- import type { PingResult } from '../../../scripts/shared/http/http.js';
2
- import type { Ticket } from '../../../types/index.js';
3
- /** Reset the cached username. Exported for testing only. */
4
- export declare function resetUsernameCache(): void;
5
- /**
6
- * Validate that a GitHub repo string is in `owner/repo` format.
7
- *
8
- * @param repo - The repository string to validate.
9
- * @returns `true` if the string matches `owner/repo` with safe characters.
10
- */
11
- export declare function isValidRepo(repo: string): boolean;
12
- /**
13
- * Ping the GitHub API to verify connectivity and credentials.
14
- *
15
- * @param token - The GitHub personal access token.
16
- * @param repo - The repository in `owner/repo` format.
17
- * @returns An object with `ok` and optional `error` message.
18
- */
19
- export declare function pingGitHub(token: string, repo: string): Promise<PingResult>;
20
- /**
21
- * Resolve the authenticated GitHub username from the token.
22
- *
23
- * Uses `GET /user` and caches the result for the lifetime of the process.
24
- * Falls back to `@me` if the API call fails (classic PATs support `@me`).
25
- *
26
- * Fine-grained PATs do NOT resolve `@me` in the Issues API `assignee` param,
27
- * so this function ensures we always have the real username.
28
- *
29
- * @param token - The GitHub personal access token.
30
- * @returns The GitHub username, or `@me` as a fallback.
31
- */
32
- export declare function resolveUsername(token: string, apiBase?: string): Promise<string>;
33
- /**
34
- * Fetch the next available issue from GitHub Issues.
35
- *
36
- * Requests extra results to account for PR pollution (GitHub Issues endpoint
37
- * returns PRs too), then filters to real issues only.
38
- *
39
- * @param token - The GitHub personal access token.
40
- * @param repo - The repository in `owner/repo` format.
41
- * @param label - Optional label to filter issues.
42
- * @param username - The GitHub username for assignee filtering (resolved via {@link resolveUsername}).
43
- * @returns The fetched ticket with optional milestone, or `undefined` if none available.
44
- */
45
- export declare function fetchIssue(token: string, repo: string, label?: string, username?: string): Promise<(Ticket & {
46
- milestone?: string;
47
- }) | undefined>;
48
- /** GitHub issue with optional milestone. */
49
- export type GitHubTicket = Ticket & {
50
- milestone?: string;
51
- };
52
- /**
53
- * Fetch multiple candidate issues from GitHub Issues.
54
- *
55
- * @param token - The GitHub personal access token.
56
- * @param repo - The repository in `owner/repo` format.
57
- * @param label - Optional label to filter issues.
58
- * @param username - The GitHub username for assignee filtering.
59
- * @param excludeHitl - If `true`, excludes issues with the `clancy:hitl` label (client-side).
60
- * @param limit - Maximum number of results to return (default: 5).
61
- * @returns Array of fetched tickets (may be empty).
62
- */
63
- export declare function fetchIssues(token: string, repo: string, label?: string, username?: string, excludeHitl?: boolean, limit?: number): Promise<GitHubTicket[]>;
64
- /**
65
- * Check whether a GitHub issue is blocked by unresolved blockers.
66
- *
67
- * Parses the issue body for `Blocked by #N` lines and checks if any
68
- * of those issues are still open.
69
- *
70
- * @param token - The GitHub personal access token.
71
- * @param repo - The repository in `owner/repo` format.
72
- * @param issueNumber - The issue number to check.
73
- * @param body - The issue body text.
74
- * @returns `true` if any blocker is unresolved, `false` otherwise.
75
- */
76
- export declare function fetchBlockerStatus(token: string, repo: string, issueNumber: number, body: string): Promise<boolean>;
77
- /** Result of checking children status for an epic/milestone. */
78
- export type ChildrenStatus = {
79
- total: number;
80
- incomplete: number;
81
- };
82
- /**
83
- * Fetch the children status of a GitHub parent issue (dual-mode).
84
- *
85
- * Tries the `Epic: #{parentNumber}` text convention first. If no results,
86
- * falls back to the native `Parent: #{parentNumber}` convention for
87
- * backward compatibility with pre-v0.6.0 children.
88
- *
89
- * @param token - The GitHub personal access token.
90
- * @param repo - The repository in `owner/repo` format.
91
- * @param parentNumber - The parent issue number.
92
- * @returns The children status, or `undefined` on failure.
93
- */
94
- export declare function fetchChildrenStatus(token: string, repo: string, parentNumber: number): Promise<ChildrenStatus | undefined>;
95
- /**
96
- * Close a GitHub issue.
97
- *
98
- * @param token - The GitHub personal access token.
99
- * @param repo - The repository in `owner/repo` format.
100
- * @param issueNumber - The issue number to close.
101
- * @returns `true` if the issue was closed successfully.
102
- */
103
- export declare function closeIssue(token: string, repo: string, issueNumber: number): Promise<boolean>;
104
- //# sourceMappingURL=github.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../src/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