kodevu 0.1.43 → 0.1.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodevu",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Poll SVN revisions or Git commits, send each change diff to a reviewer CLI, and write configurable review reports.",
package/src/config.js CHANGED
@@ -161,7 +161,8 @@ export function parseCliArgs(argv) {
161
161
  }
162
162
 
163
163
  if (value === "--last" || value === "-n") {
164
- if (!hasNextValue) throw new Error(`Missing value for ${value}`);
164
+ const hasLastValue = nextValue !== undefined && /^-?\d+$/.test(nextValue);
165
+ if (!hasLastValue) throw new Error(`Missing value for ${value}`);
165
166
  args.last = nextValue;
166
167
  index += 1;
167
168
  continue;
@@ -258,7 +259,7 @@ export async function resolveConfig(cliArgs = {}) {
258
259
  config.last = Number(config.last);
259
260
  config.outputFormats = normalizeOutputFormats(config.outputFormats);
260
261
 
261
- if (!config.rev && (isNaN(config.last) || config.last <= 0)) {
262
+ if (!config.rev && (isNaN(config.last) || config.last === 0)) {
262
263
  config.last = 1;
263
264
  }
264
265
 
@@ -277,7 +278,7 @@ Options:
277
278
  --prompt, -p Additional instructions or @file.txt to read from file
278
279
  --lang, -l Output language (e.g. zh, en, auto)
279
280
  --rev, -v Review specific revision(s), hashes, branches or ranges (comma-separated)
280
- --last, -n Review the latest N revisions (ignored if --rev is provided) (default: 1)
281
+ --last, -n Review the latest N revisions; use negative (-N) to review only the Nth-from-last revision (default: 1)
281
282
  --output, -o Output directory (default: ~/.kodevu)
282
283
  --format, -f Output formats (markdown, json, comma-separated)
283
284
  --debug, -d Print extra debug information
@@ -159,6 +159,9 @@ export async function runReviewCycle(config) {
159
159
 
160
160
  if (config.rev) {
161
161
  changeIdsToReview = await backend.resolveChangeIds(config, targetInfo, config.rev);
162
+ } else if (config.last < 0) {
163
+ const candidates = await backend.getLatestChangeIds(config, targetInfo, Math.abs(config.last));
164
+ changeIdsToReview = candidates.length > 0 ? [candidates[0]] : [];
162
165
  } else {
163
166
  changeIdsToReview = await backend.getLatestChangeIds(config, targetInfo, config.last || 1);
164
167
  }