kspec 1.0.22 → 1.0.24

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +51 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kspec",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Spec-driven development workflow for Kiro CLI",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -459,10 +459,20 @@ No active spec. Run: \`kspec spec "Feature Name"\`
459
459
  const currentTask = getCurrentTask(current);
460
460
  const stale = isSpecStale(current);
461
461
 
462
- // Read spec-lite if exists
462
+ // Read spec-lite if exists, or fall back to spec.md if stale
463
463
  const specLiteFile = path.join(current, 'spec-lite.md');
464
+ const specFile = path.join(current, 'spec.md');
464
465
  let specLite = '';
465
- if (fs.existsSync(specLiteFile)) {
466
+ let usingSpecFallback = false;
467
+
468
+ if (stale && fs.existsSync(specFile)) {
469
+ // Use spec.md directly when stale (truncate if too long)
470
+ const specContent = fs.readFileSync(specFile, 'utf8');
471
+ specLite = specContent.length > 3000
472
+ ? specContent.slice(0, 3000) + '\n\n... (truncated, run `kspec refresh` for full summary)'
473
+ : specContent;
474
+ usingSpecFallback = true;
475
+ } else if (fs.existsSync(specLiteFile)) {
466
476
  specLite = fs.readFileSync(specLiteFile, 'utf8');
467
477
  }
468
478
 
@@ -493,8 +503,8 @@ Path: \`${current}\`
493
503
 
494
504
  if (stale) {
495
505
  content += `
496
- **WARNING: spec.md has been modified since spec-lite.md was generated.**
497
- Run \`kspec refresh\` to update spec-lite.md with latest changes.
506
+ **NOTE: spec.md was modified. Using spec.md directly for context.**
507
+ Run \`kspec refresh\` to generate optimized spec-lite.md summary.
498
508
 
499
509
  `;
500
510
  } else {
@@ -1215,6 +1225,11 @@ Report:
1215
1225
  },
1216
1226
 
1217
1227
  async refresh(args) {
1228
+ // Parse --force flag
1229
+ const forceIndex = args.indexOf('--force');
1230
+ const force = forceIndex !== -1;
1231
+ if (force) args.splice(forceIndex, 1);
1232
+
1218
1233
  const folder = getOrSelectSpec(args.join(' '));
1219
1234
  const specFile = path.join(folder, 'spec.md');
1220
1235
  const specLiteFile = path.join(folder, 'spec-lite.md');
@@ -1224,37 +1239,52 @@ Report:
1224
1239
  }
1225
1240
 
1226
1241
  const stale = isSpecStale(folder);
1227
- if (!stale && !args.includes('--force')) {
1242
+ if (!stale && !force) {
1228
1243
  log('spec-lite.md is up to date with spec.md');
1229
1244
  log('Use --force to regenerate anyway');
1230
1245
  return;
1231
1246
  }
1232
1247
 
1248
+ // Read the current spec.md content
1249
+ const specContent = fs.readFileSync(specFile, 'utf8');
1250
+
1233
1251
  log(`Refreshing spec-lite.md from ${folder}/spec.md...`);
1234
1252
 
1235
- await chat(`Regenerate spec-lite.md from the updated spec.md.
1253
+ await chat(`URGENT: Regenerate spec-lite.md NOW.
1236
1254
 
1237
- Spec folder: ${folder}
1255
+ TARGET FILE: ${specLiteFile}
1238
1256
 
1239
- WORKFLOW:
1240
- 1. Read ${specFile} carefully - this is the source of truth
1241
- 2. Create a NEW ${specLiteFile} that:
1242
- - Summarizes ALL key requirements (under 500 words)
1243
- - Captures the current tech stack and versions
1244
- - Includes critical constraints and acceptance criteria
1245
- - Preserves any Jira issue references
1246
- 3. This spec-lite.md will be used for context restoration after AI compression
1257
+ CURRENT spec.md CONTENT (source of truth):
1258
+ ---
1259
+ ${specContent}
1260
+ ---
1247
1261
 
1248
- IMPORTANT:
1249
- - Read the FULL spec.md before generating spec-lite.md
1250
- - Ensure ALL tech stack details are captured (versions matter!)
1251
- - This replaces the old spec-lite.md completely
1262
+ YOUR TASK:
1263
+ 1. Write a NEW ${specLiteFile} file immediately
1264
+ 2. Summarize the above spec.md content (under 500 words)
1265
+ 3. MUST include:
1266
+ - All tech stack with EXACT versions (e.g., Next.js 16+, NOT 14+)
1267
+ - Key requirements and acceptance criteria
1268
+ - Any Jira references
1252
1269
 
1253
- After updating, confirm what changed.`, 'kspec-spec');
1270
+ DO THIS NOW:
1271
+ - Use your write tool to create ${specLiteFile}
1272
+ - Copy the tech stack details EXACTLY as shown above
1273
+ - Do not read the old spec-lite.md, replace it completely
1274
+
1275
+ After writing, show me what you wrote.`, 'kspec-spec');
1276
+
1277
+ // Verify spec-lite.md was updated
1278
+ if (isSpecStale(folder)) {
1279
+ console.log('\n⚠️ spec-lite.md may not have been updated correctly.');
1280
+ console.log(' Please verify the file was written with updated content.\n');
1281
+ } else {
1282
+ log('spec-lite.md updated successfully');
1283
+ }
1254
1284
 
1255
1285
  // Update CONTEXT.md with new spec-lite
1256
1286
  refreshContext();
1257
- log('Context refreshed with updated spec');
1287
+ log('Context refreshed');
1258
1288
  },
1259
1289
 
1260
1290
  async done(args) {