@activate-core/test-forge 0.9.2 → 0.9.4

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.
package/dist/cli/index.js CHANGED
@@ -69,6 +69,7 @@ function printUsage() {
69
69
  console.log(' testforge generate --basic Use the basic generator only');
70
70
  console.log(' testforge generate --force Regenerate everything');
71
71
  console.log(' testforge generate --journey <name> Generate just ONE journey');
72
+ console.log(' testforge generate --area <area> Generate a whole area (e.g. api)');
72
73
  console.log(' testforge discover Draft journey docs (asks: map or reference)');
73
74
  console.log(' testforge discover --journey <name> Draft just ONE journey doc');
74
75
  console.log(' testforge discover --reference <file|url> Base docs on a reference');
@@ -121,7 +122,7 @@ async function main() {
121
122
  console.log(useAI
122
123
  ? 'Generating tests with AI for changed journeys...\n'
123
124
  : 'Generating tests with the basic generator...\n');
124
- const results = await runGenerate('docs', useAI, force, flagValue('--journey'));
125
+ const results = await runGenerate('docs', useAI, force, flagValue('--journey'), flagValue('--area'));
125
126
  if (results.length === 0) {
126
127
  console.log('No journey files found in docs/. Add a .md file and try again.');
127
128
  }
@@ -197,7 +197,7 @@ function matchesJourney(file, journeyId, sel) {
197
197
  norm(stem).endsWith(`-${n}`) ||
198
198
  norm(stem).split('/').pop() === n);
199
199
  }
200
- export async function runGenerate(docsDir, useAI = true, force = false, only) {
200
+ export async function runGenerate(docsDir, useAI = true, force = false, only, areaOnly) {
201
201
  const files = findMarkdownFiles(docsDir);
202
202
  if (files.length === 0) {
203
203
  return [];
@@ -247,6 +247,9 @@ export async function runGenerate(docsDir, useAI = true, force = false, only) {
247
247
  // journeys in their own package instead of leaking into web/api.
248
248
  const area = file.split(/[\\/]/)[0] || undefined;
249
249
  const journey = parseJourney(markdown, area);
250
+ // --area <a>: only this area's journeys (e.g. do all of api first).
251
+ if (areaOnly && journey.area !== areaOnly)
252
+ continue;
250
253
  // --journey <x>: generate just the one matching journey.
251
254
  if (only && !matchesJourney(file, journey.id, only))
252
255
  continue;
@@ -346,12 +349,17 @@ export async function runGenerate(docsDir, useAI = true, force = false, only) {
346
349
  warnings.push(`seed generation failed after ${MAX_GEN_ATTEMPTS} attempts — no seed written`);
347
350
  }
348
351
  }
349
- cache[file] = hash;
350
- // Persist after EVERY journey so an interrupted run resumes cleanly:
351
- // re-running `generate` (no --force) skips the journeys already done
352
- // (cache hit) and only finishes the remaining ones — no wasted tokens
353
- // redoing completed work.
354
- saveCache(CACHE_PATH, cache);
352
+ // Only mark a journey "done" in the cache when it actually SUCCEEDED
353
+ // with AI (and its seed didn't fail). If a usage limit / error forced
354
+ // a fall back to the basic generator, or the seed failed, DON'T cache
355
+ // it — so a later `generate` (once the limit resets) RE-DOES it with
356
+ // AI instead of skipping it as "done". Persist per-journey so an
357
+ // interrupted run still resumes from where it stopped.
358
+ const degraded = useAI && (status === 'basic' || seedStatus === 'failed');
359
+ if (!degraded) {
360
+ cache[file] = hash;
361
+ saveCache(CACHE_PATH, cache);
362
+ }
355
363
  results.push({
356
364
  journeyName: journey.name,
357
365
  testDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activate-core/test-forge",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "AI-powered QA automation. Scans a project, drafts journey docs, and generates seeded Jest/Playwright tests. Works in any project, with any AI CLI.",
5
5
  "type": "module",
6
6
  "bin": {