@dtlabs/ai-toolkit 0.2.0 → 0.2.2
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.
|
@@ -123,6 +123,8 @@ For each document with gaps, invoke the corresponding agent with a **targeted re
|
|
|
123
123
|
|
|
124
124
|
## Phase 6 — Write Validation Report
|
|
125
125
|
|
|
126
|
+
**Always execute this phase**, regardless of whether gaps were found. The report is required even when validation is clean.
|
|
127
|
+
|
|
126
128
|
Write `{PREFIX}-Validation-Report.md` in the same directory:
|
|
127
129
|
|
|
128
130
|
```markdown
|
|
@@ -113,8 +113,9 @@ for (let cycle = 1; cycle <= MAX_CYCLES; cycle++) {
|
|
|
113
113
|
tokenLedger.push({ agent: `validate-feature-docs (cycle ${cycle})`, model: 'haiku', phase_delta_tokens: valTokens })
|
|
114
114
|
|
|
115
115
|
// valResult is the agent's text output — check for gap indicators
|
|
116
|
+
// Use only 'MISSING:' as the gap signal: 'gaps found' also matches 'ZERO GAPS FOUND'
|
|
116
117
|
const resultText = typeof valResult === 'string' ? valResult : JSON.stringify(valResult)
|
|
117
|
-
const hasGaps = resultText.includes('MISSING:')
|
|
118
|
+
const hasGaps = resultText.includes('MISSING:')
|
|
118
119
|
|
|
119
120
|
if (!hasGaps) {
|
|
120
121
|
validationSummary = `0 gaps (clean on cycle ${cycle})`
|
|
@@ -138,6 +139,46 @@ for (let cycle = 1; cycle <= MAX_CYCLES; cycle++) {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
// ── Write process-log (phase 1 snapshot) ─────────────────────────────────────
|
|
143
|
+
const reqEntry = tokenLedger.find(e => e.agent === 'generate-requirements')
|
|
144
|
+
const specEntry = tokenLedger.find(e => e.agent === 'generate-tech-spec')
|
|
145
|
+
const valEntries = tokenLedger.filter(e => e.agent.startsWith('validate-feature-docs'))
|
|
146
|
+
const phase1Events = [
|
|
147
|
+
`pm-phase1 START — documentation phase`,
|
|
148
|
+
reqEntry
|
|
149
|
+
? `Agent DONE: generate-requirements — tokens: ${reqEntry.phase_delta_tokens}`
|
|
150
|
+
: `generate-requirements: skipped (fresh)`,
|
|
151
|
+
specEntry
|
|
152
|
+
? `Agent DONE: generate-tech-spec — tokens: ${specEntry.phase_delta_tokens}`
|
|
153
|
+
: `generate-tech-spec: skipped (fresh)`,
|
|
154
|
+
...valEntries.map(e => `Agent DONE: ${e.agent} — tokens: ${e.phase_delta_tokens}`),
|
|
155
|
+
`Validation result: ${validationSummary}`,
|
|
156
|
+
`APPROVAL REQUESTED — Gate 1`,
|
|
157
|
+
].join('\n')
|
|
158
|
+
|
|
159
|
+
await agent(
|
|
160
|
+
`Create the process-log file for this feature delivery run.
|
|
161
|
+
|
|
162
|
+
File path: ${feature_dir}/${prefix}-process-log.txt
|
|
163
|
+
|
|
164
|
+
Steps:
|
|
165
|
+
1. Get current UTC datetime via Bash: run \`date -u +"%Y-%m-%dT%H:%M:%S"\`
|
|
166
|
+
2. Read feature.md at: ${featurePath} — extract the feature title (first H1 heading after the frontmatter).
|
|
167
|
+
3. Write the file using the Write tool. Use the datetime from step 1 for ALL timestamps.
|
|
168
|
+
Format each event line as: [{datetime}] {event text}
|
|
169
|
+
|
|
170
|
+
File structure:
|
|
171
|
+
════════════════════════════════════════════════════════
|
|
172
|
+
RUN STARTED — {datetime}
|
|
173
|
+
Feature: ${prefix} — {title from step 2}
|
|
174
|
+
════════════════════════════════════════════════════════
|
|
175
|
+
{one line per event below, each prefixed with [{datetime}]}
|
|
176
|
+
|
|
177
|
+
Events to log:
|
|
178
|
+
${phase1Events}`,
|
|
179
|
+
{ label: 'write-process-log', phase: 'Validation' }
|
|
180
|
+
)
|
|
181
|
+
|
|
141
182
|
// ── Build gate1_payload ───────────────────────────────────────────────────────
|
|
142
183
|
const gate1Payload = {
|
|
143
184
|
prefix,
|
|
@@ -92,6 +92,33 @@ Return the extracted metrics as structured output.`,
|
|
|
92
92
|
log(`WB parsed: ${metrics.user_stories} US, ${metrics.total_tasks} tasks, ${metrics.implementation_phases} phases`)
|
|
93
93
|
log(`Effort-Estimate written: ${metrics.effort_estimate_path}`)
|
|
94
94
|
|
|
95
|
+
// ── Append to process-log (phase 2 events) ───────────────────────────────────
|
|
96
|
+
const wbEntry = tokenLedger.find(e => e.agent === 'generate-work-breakdown')
|
|
97
|
+
const phase2Events = [
|
|
98
|
+
`APPROVAL GRANTED by user — Gate 1`,
|
|
99
|
+
`pm-phase2 START — work breakdown phase`,
|
|
100
|
+
`Agent DONE: generate-work-breakdown — tokens: ${wbEntry ? wbEntry.phase_delta_tokens : 'N/A'}`,
|
|
101
|
+
`Written: ${metrics.prefix}-Work-Breakdown.md (${metrics.user_stories} US, ${metrics.total_tasks} tasks, ${metrics.implementation_phases} phases)`,
|
|
102
|
+
`Written: ${metrics.prefix}-Effort-Estimate.md`,
|
|
103
|
+
`pm-phase2 COMPLETE`,
|
|
104
|
+
`APPROVAL REQUESTED — Gate 2`,
|
|
105
|
+
].join('\n')
|
|
106
|
+
|
|
107
|
+
await agent(
|
|
108
|
+
`Append phase 2 events to the process-log for this feature delivery run.
|
|
109
|
+
|
|
110
|
+
Process-log path: ${metrics.feature_dir}/${metrics.prefix}-process-log.txt
|
|
111
|
+
|
|
112
|
+
Steps:
|
|
113
|
+
1. Get current UTC datetime via Bash: run \`date -u +"%Y-%m-%dT%H:%M:%S"\`
|
|
114
|
+
2. Append the following lines to the existing file. Use the datetime from step 1 for ALL event lines.
|
|
115
|
+
Format each event line as: [{datetime}] {event text}
|
|
116
|
+
|
|
117
|
+
Events to append:
|
|
118
|
+
${phase2Events}`,
|
|
119
|
+
{ label: 'append-process-log', phase: 'Effort Estimate' }
|
|
120
|
+
)
|
|
121
|
+
|
|
95
122
|
return {
|
|
96
123
|
prefix: metrics.prefix,
|
|
97
124
|
feature_path: featurePath,
|
|
@@ -297,6 +297,41 @@ const actualsTokens = budget.spent() - beforeActuals
|
|
|
297
297
|
tokenLedger.push({ agent: 'write-actuals', model: 'sonnet', phase_delta_tokens: actualsTokens })
|
|
298
298
|
log(`Actuals written | phase delta: ${actualsTokens} tokens`)
|
|
299
299
|
|
|
300
|
+
// ── Append to process-log (phase 3 events + RUN COMPLETE) ────────────────────
|
|
301
|
+
const usPassed = (implResult.us_passed || []).join(', ') || 'none'
|
|
302
|
+
const usEscalated = (implResult.us_escalated || []).join(', ') || 'none'
|
|
303
|
+
const phase3Events = [
|
|
304
|
+
`APPROVAL GRANTED by user — Gate 2`,
|
|
305
|
+
`pm-phase3 START — implementation phase — branch: ${branch || '(current)'}`,
|
|
306
|
+
`Implementation DONE — ${implResult.phases_done} phases | US passed: ${usPassed} | US escalated: ${usEscalated}`,
|
|
307
|
+
issuesFixed + issuesDeferred > 0
|
|
308
|
+
? `Remediation: ${issuesFixed} fixed, ${issuesDeferred} deferred`
|
|
309
|
+
: `Remediation: skipped (no open issues)`,
|
|
310
|
+
`PR created: ${prResult.pr_url}`,
|
|
311
|
+
`Actuals written: Token-Estimate.md + Effort-Estimate.md`,
|
|
312
|
+
`RUN COMPLETE`,
|
|
313
|
+
`════════════════════════════════════════════════════════`,
|
|
314
|
+
].join('\n')
|
|
315
|
+
|
|
316
|
+
// feature_dir is not directly available in pm-phase3; derive from featurePath
|
|
317
|
+
const featureDir3 = featurePath.replace(/\/[^/]+$/, '')
|
|
318
|
+
|
|
319
|
+
await agent(
|
|
320
|
+
`Append phase 3 events to the process-log for this feature delivery run.
|
|
321
|
+
|
|
322
|
+
Process-log path: ${featureDir3}/${prefix}-process-log.txt
|
|
323
|
+
|
|
324
|
+
Steps:
|
|
325
|
+
1. Get current UTC datetime via Bash: run \`date -u +"%Y-%m-%dT%H:%M:%S"\`
|
|
326
|
+
2. Append the following lines to the existing file. Use the datetime from step 1 for ALL event lines.
|
|
327
|
+
Format each event line as: [{datetime}] {event text}
|
|
328
|
+
The final line (════…) is a separator — append it as-is, without a timestamp prefix.
|
|
329
|
+
|
|
330
|
+
Events to append:
|
|
331
|
+
${phase3Events}`,
|
|
332
|
+
{ label: 'finalize-process-log', phase: 'Actuals' }
|
|
333
|
+
)
|
|
334
|
+
|
|
300
335
|
return {
|
|
301
336
|
pr_url: prResult.pr_url,
|
|
302
337
|
token_ledger: tokenLedger,
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
## 0.1.4 (2026-07-21)
|
|
2
|
+
## [0.2.2](https://github.com/dtlab-tech/ai-toolkit/compare/v0.2.1...v0.2.2) (2026-07-28)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* restore process-log trace across pm-phase1/2/3 workflow scripts ([6748cf9](https://github.com/dtlab-tech/ai-toolkit/commit/6748cf9aab94efc76aa41c6c97cfe9493bc8db92))
|
|
8
|
+
* restore process-log trace across pm-phase1/2/3 workflow scripts ([844965a](https://github.com/dtlab-tech/ai-toolkit/commit/844965abe5f0486cc5915819e5879b0486a3e993))
|
|
9
|
+
|
|
10
|
+
## [0.2.1](https://github.com/dtlab-tech/ai-toolkit/compare/v0.2.0...v0.2.1) (2026-07-27)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* validate-feature-docs always writes report; fix false-positive gap detection ([68caf3e](https://github.com/dtlab-tech/ai-toolkit/commit/68caf3e25214bcb219df1654c4b3ede5cc42eb3b))
|
|
16
|
+
* validate-feature-docs always writes report; fix false-positive gap detection in pm-phase1 ([d99fdb3](https://github.com/dtlab-tech/ai-toolkit/commit/d99fdb39be1663539bd0ed7e6ca4facc2c53fd76))
|
|
17
|
+
|
|
2
18
|
## [0.2.0](https://github.com/dtlab-tech/ai-toolkit/compare/v0.1.7...v0.2.0) (2026-07-27)
|
|
3
19
|
|
|
4
20
|
|