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 +1 -1
- package/src/config.js +4 -3
- package/src/review-runner.js +3 -0
package/package.json
CHANGED
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
|
-
|
|
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
|
|
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 (
|
|
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
|
package/src/review-runner.js
CHANGED
|
@@ -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
|
}
|