jioogen 0.2.6 → 0.2.7
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/index.js +283 -11
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2978,6 +2978,7 @@ var ApiClient = class {
|
|
|
2978
2978
|
};
|
|
2979
2979
|
|
|
2980
2980
|
// src/commands.ts
|
|
2981
|
+
import { spawn } from "node:child_process";
|
|
2981
2982
|
import { readdir as readdir5, readFile as readFile8 } from "node:fs/promises";
|
|
2982
2983
|
import { join as join8, resolve as resolve5 } from "node:path";
|
|
2983
2984
|
|
|
@@ -7363,6 +7364,65 @@ function lintRequirementAcceptance(markdown) {
|
|
|
7363
7364
|
}
|
|
7364
7365
|
return { ok: issues.length === 0, issues, sectionsAccounted: 0 };
|
|
7365
7366
|
}
|
|
7367
|
+
var VERIFICATION_LABEL_RE = /^\s*(?:[-*]\s*)?\*{0,2}verificationCommand\*{0,2}\s*:\s*(.+)$/im;
|
|
7368
|
+
var VERIFICATION_HEADING_RE = /^#{1,6}\s*verification command\s*$/im;
|
|
7369
|
+
var TARGET_FILES_LABEL_RE = /^\s*(?:[-*]\s*)?\*{0,2}targetFiles\*{0,2}\s*:\s*(.*)$/im;
|
|
7370
|
+
var TARGET_FILES_HEADING_RE = /^#{1,6}\s*target files\s*$/im;
|
|
7371
|
+
var ACCEPTANCE_HEADING_RE = /^#{1,6}\s*acceptance criteria\s*$/im;
|
|
7372
|
+
function cleanCommand(value) {
|
|
7373
|
+
return value.replace(/^[-*]\s+/, "").replace(/[`"']/g, "").trim();
|
|
7374
|
+
}
|
|
7375
|
+
function followingBlock(content, headingRe) {
|
|
7376
|
+
const lines = content.split(/\r?\n/);
|
|
7377
|
+
const index = lines.findIndex((line) => headingRe.test(line));
|
|
7378
|
+
if (index === -1) return "";
|
|
7379
|
+
const rest = [];
|
|
7380
|
+
for (let i = index + 1; i < lines.length; i += 1) {
|
|
7381
|
+
const line = lines[i] ?? "";
|
|
7382
|
+
if (/^#{1,6}\s+/.test(line)) break;
|
|
7383
|
+
rest.push(line);
|
|
7384
|
+
}
|
|
7385
|
+
return rest.join("\n").trim();
|
|
7386
|
+
}
|
|
7387
|
+
function taskVerificationCommand(content) {
|
|
7388
|
+
const inline = content.match(VERIFICATION_LABEL_RE)?.[1];
|
|
7389
|
+
if (inline !== void 0) {
|
|
7390
|
+
const cleaned2 = cleanCommand(inline);
|
|
7391
|
+
return cleaned2.length === 0 ? null : cleaned2;
|
|
7392
|
+
}
|
|
7393
|
+
const block = followingBlock(content, VERIFICATION_HEADING_RE);
|
|
7394
|
+
if (block.length === 0) return null;
|
|
7395
|
+
const first = block.split(/\r?\n/).find((line) => line.trim().length > 0);
|
|
7396
|
+
if (first === void 0) return null;
|
|
7397
|
+
const cleaned = cleanCommand(first);
|
|
7398
|
+
return cleaned.length === 0 || /^n\/?a$|^—+$|^-+$/i.test(cleaned) ? null : cleaned;
|
|
7399
|
+
}
|
|
7400
|
+
function taskTargetFiles(content) {
|
|
7401
|
+
const lines = content.split(/\r?\n/);
|
|
7402
|
+
const labelIndex = lines.findIndex((line) => TARGET_FILES_LABEL_RE.test(line));
|
|
7403
|
+
let source = [];
|
|
7404
|
+
if (labelIndex !== -1) {
|
|
7405
|
+
const inline = (lines[labelIndex]?.match(TARGET_FILES_LABEL_RE)?.[1] ?? "").trim();
|
|
7406
|
+
if (inline.length > 0 && inline !== "[]") {
|
|
7407
|
+
source = inline.split(",");
|
|
7408
|
+
} else {
|
|
7409
|
+
for (let i = labelIndex + 1; i < lines.length; i += 1) {
|
|
7410
|
+
const line = lines[i] ?? "";
|
|
7411
|
+
if (line.trim().length === 0) continue;
|
|
7412
|
+
const item = /^\s*-\s+(.+?)\s*$/.exec(line);
|
|
7413
|
+
if (item === null) break;
|
|
7414
|
+
source.push(item[1] ?? "");
|
|
7415
|
+
}
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7418
|
+
if (source.length === 0) {
|
|
7419
|
+
source = followingBlock(content, TARGET_FILES_HEADING_RE).split(/\r?\n/);
|
|
7420
|
+
}
|
|
7421
|
+
return source.map((item) => cleanCommand(item).replace(/^[-*]\s+/, "")).map((item) => item.replace(/[[\]]/g, "").trim()).filter((item) => item.length > 0);
|
|
7422
|
+
}
|
|
7423
|
+
function taskAcceptance(content) {
|
|
7424
|
+
return followingBlock(content, ACCEPTANCE_HEADING_RE);
|
|
7425
|
+
}
|
|
7366
7426
|
function lintTaskBundle(files) {
|
|
7367
7427
|
const issues = [];
|
|
7368
7428
|
for (const file of files) {
|
|
@@ -7385,6 +7445,41 @@ function lintTaskBundle(files) {
|
|
|
7385
7445
|
message: `Task "${file.path}" tidak merujuk requirement mana pun (FR/NFR/BR/REQ) dan bukan foundation`
|
|
7386
7446
|
});
|
|
7387
7447
|
}
|
|
7448
|
+
const command = taskVerificationCommand(file.content);
|
|
7449
|
+
if (command !== null && /--passWithNoTests|--pass-with-no-tests/i.test(command)) {
|
|
7450
|
+
issues.push({
|
|
7451
|
+
code: "VERIFICATION_FAKE_FLAG",
|
|
7452
|
+
where: file.path,
|
|
7453
|
+
message: `Task "${file.path}" memakai --passWithNoTests pada verificationCommand (verifikasi palsu)`
|
|
7454
|
+
});
|
|
7455
|
+
}
|
|
7456
|
+
const acceptance = taskAcceptance(file.content);
|
|
7457
|
+
const mentionsTests = /\b(test|tests|testing)\b/i.test(acceptance);
|
|
7458
|
+
const mentionsVerification = /\b(test|tests|verifikasi|typecheck|lint)\b/i.test(acceptance);
|
|
7459
|
+
const coversAllCommands = /\b(semua|all)\s+verificationCommand/i.test(acceptance);
|
|
7460
|
+
if (mentionsVerification && !coversAllCommands && command !== null) {
|
|
7461
|
+
const runsVerification = /test|vitest|jest|pytest|go test|cargo test|typecheck|\btsc\b|biome|eslint|lint/i.test(
|
|
7462
|
+
command
|
|
7463
|
+
);
|
|
7464
|
+
if (!runsVerification) {
|
|
7465
|
+
issues.push({
|
|
7466
|
+
code: "VERIFICATION_MISSING_AC_COMMAND",
|
|
7467
|
+
where: file.path,
|
|
7468
|
+
message: `Task "${file.path}" AC menyebut test/verifikasi tetapi verificationCommand tidak menjalankannya`
|
|
7469
|
+
});
|
|
7470
|
+
}
|
|
7471
|
+
}
|
|
7472
|
+
if (mentionsTests) {
|
|
7473
|
+
const targets = taskTargetFiles(file.content);
|
|
7474
|
+
const hasTestTarget = targets.some((target) => /test|spec|__tests__/i.test(target));
|
|
7475
|
+
if (targets.length > 0 && !hasTestTarget) {
|
|
7476
|
+
issues.push({
|
|
7477
|
+
code: "TARGET_FILES_MISSING_TEST",
|
|
7478
|
+
where: file.path,
|
|
7479
|
+
message: `Task "${file.path}" AC menyebut test tetapi targetFiles tidak memuat file test`
|
|
7480
|
+
});
|
|
7481
|
+
}
|
|
7482
|
+
}
|
|
7388
7483
|
}
|
|
7389
7484
|
return { ok: issues.length === 0, issues, sectionsAccounted: 0 };
|
|
7390
7485
|
}
|
|
@@ -8804,8 +8899,8 @@ var JIOOGEN_AGENTS_MD = `${MARKER}
|
|
|
8804
8899
|
1. \`npx jioogen task next\` \u2014 baca blok **TASK AKTIF** + isi file task.
|
|
8805
8900
|
2. \`npx jioogen task start <ref>\`.
|
|
8806
8901
|
3. Implementasikan **hanya** task itu sampai semua Acceptance Criteria terpenuhi.
|
|
8807
|
-
4. Jalankan \`verificationCommand\`
|
|
8808
|
-
5. \`npx jioogen task complete <ref
|
|
8902
|
+
4. Jalankan \`npx jioogen task verify <ref>\` \u2014 CLI menjalankan \`verificationCommand\` dan mencatat bukti exit code.
|
|
8903
|
+
5. \`npx jioogen task complete <ref>\` (ditolak bila belum ada bukti exit 0), lalu buat satu commit git kecil.
|
|
8809
8904
|
6. \`npx jioogen sync\`, lalu kembali ke langkah 1.
|
|
8810
8905
|
|
|
8811
8906
|
## 3. Batas scope
|
|
@@ -8824,6 +8919,7 @@ var JIOOGEN_AGENTS_MD = `${MARKER}
|
|
|
8824
8919
|
- Pakai test runner yang dideklarasikan di \`specs/\` atau dibuat task scaffold.
|
|
8825
8920
|
- Dilarang \`--passWithNoTests\` atau flag yang membuat command exit 0 tanpa test nyata.
|
|
8826
8921
|
- Kalau test belum ada, task belum selesai.
|
|
8922
|
+
- Bukti verifikasi dicatat CLI lewat \`npx jioogen task verify <ref>\`; \`task complete\` menolak tanpa bukti exit 0.
|
|
8827
8923
|
|
|
8828
8924
|
## 5. Checkpoint
|
|
8829
8925
|
Berhenti dan minta konfirmasi user bila task berikutnya berpindah layer, nomor
|
|
@@ -8871,8 +8967,8 @@ atas ide, refactor, perbaikan, atau fitur lain.
|
|
|
8871
8967
|
1. \`npx jioogen task next\` \u2014 baca TASK AKTIF + isi file task.
|
|
8872
8968
|
2. \`npx jioogen task start <ref>\`.
|
|
8873
8969
|
3. Implementasikan **hanya** task itu sampai semua Acceptance Criteria terpenuhi.
|
|
8874
|
-
4. Jalankan \`
|
|
8875
|
-
5. \`npx jioogen task complete <ref
|
|
8970
|
+
4. Jalankan \`npx jioogen task verify <ref>\` sampai exit 0; CLI mencatat buktinya.
|
|
8971
|
+
5. \`npx jioogen task complete <ref>\` (wajib bukti), lalu buat **satu commit git kecil** untuk
|
|
8876
8972
|
task itu (lewati bila folder bukan repo git).
|
|
8877
8973
|
6. \`npx jioogen sync\`, lalu kembali ke langkah 1.
|
|
8878
8974
|
|
|
@@ -8901,6 +8997,7 @@ atas ide, refactor, perbaikan, atau fitur lain.
|
|
|
8901
8997
|
- **Dilarang** \`--passWithNoTests\` atau flag sejenis yang membuat command exit 0
|
|
8902
8998
|
tanpa menjalankan test nyata.
|
|
8903
8999
|
- Kalau test belum ada, task belum selesai.
|
|
9000
|
+
- Bukti verifikasi dicatat CLI lewat \`npx jioogen task verify <ref>\`; \`task complete\` menolak tanpa bukti exit 0.
|
|
8904
9001
|
- Task \`layer: verification\` menjalankan semua \`verificationCommand\`, smoke test
|
|
8905
9002
|
route/navigasi, cek UI states + responsive, dan verifikasi AC.
|
|
8906
9003
|
|
|
@@ -10185,16 +10282,16 @@ function isBoundary(previous, next) {
|
|
|
10185
10282
|
return previous.phase !== void 0 && next.phase !== previous.phase;
|
|
10186
10283
|
}
|
|
10187
10284
|
var RISKY_TASK_RE = /\b(migrat(?:e|ion|ions)?|migrasi|prisma|schema|rls|auth|permission|payment|checkout|webhook|secret|deploy|drop)\b/i;
|
|
10188
|
-
var
|
|
10285
|
+
var TARGET_FILES_LABEL_RE2 = /^\s*(?:[-*]\s*)?\*{0,2}targetFiles\*{0,2}\s*:\s*(.*)$/i;
|
|
10189
10286
|
function isRiskyTask(task) {
|
|
10190
10287
|
const targetFiles = task.targetFiles ?? targetFilesFromContent(task.content);
|
|
10191
10288
|
return RISKY_TASK_RE.test([task.id, task.title, ...targetFiles].join("\n"));
|
|
10192
10289
|
}
|
|
10193
10290
|
function targetFilesFromContent(content) {
|
|
10194
10291
|
const lines = content.split(/\r?\n/);
|
|
10195
|
-
const index = lines.findIndex((line) =>
|
|
10292
|
+
const index = lines.findIndex((line) => TARGET_FILES_LABEL_RE2.test(line));
|
|
10196
10293
|
if (index === -1) return [];
|
|
10197
|
-
const inline = (lines[index]?.match(
|
|
10294
|
+
const inline = (lines[index]?.match(TARGET_FILES_LABEL_RE2)?.[1] ?? "").trim();
|
|
10198
10295
|
if (inline.length > 0) return splitTargetFiles(inline);
|
|
10199
10296
|
const items = [];
|
|
10200
10297
|
for (let cursor = index + 1; cursor < lines.length; cursor += 1) {
|
|
@@ -10213,6 +10310,36 @@ function splitTargetFiles(value) {
|
|
|
10213
10310
|
function cleanTargetFile(value) {
|
|
10214
10311
|
return value.replace(/^[-*\s]+/, "").trim();
|
|
10215
10312
|
}
|
|
10313
|
+
function verificationCommandFromContent(content) {
|
|
10314
|
+
const inline = content.match(
|
|
10315
|
+
/^\s*(?:[-*]\s*)?\*{0,2}verificationCommand\*{0,2}\s*:\s*(.+?)\s*$/im
|
|
10316
|
+
);
|
|
10317
|
+
if (inline?.[1] !== void 0) {
|
|
10318
|
+
const value = stripVerificationBackticks(inline[1].trim());
|
|
10319
|
+
if (isVerificationPlaceholder(value)) return null;
|
|
10320
|
+
if (value.length > 0) return value;
|
|
10321
|
+
}
|
|
10322
|
+
const lines = content.split(/\r?\n/);
|
|
10323
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
10324
|
+
const heading = lines[i]?.trim() ?? "";
|
|
10325
|
+
if (!/^#{1,6}\s+Verification(?:\s+Command)?\s*$/i.test(heading)) continue;
|
|
10326
|
+
for (let j = i + 1; j < lines.length; j += 1) {
|
|
10327
|
+
const next = (lines[j] ?? "").trim();
|
|
10328
|
+
if (next.length === 0) continue;
|
|
10329
|
+
if (/^#{1,6}\s/.test(next)) break;
|
|
10330
|
+
const value = stripVerificationBackticks(next);
|
|
10331
|
+
if (isVerificationPlaceholder(value)) return null;
|
|
10332
|
+
return value.length > 0 ? value : null;
|
|
10333
|
+
}
|
|
10334
|
+
}
|
|
10335
|
+
return null;
|
|
10336
|
+
}
|
|
10337
|
+
function stripVerificationBackticks(value) {
|
|
10338
|
+
return value.replace(/^`+/, "").replace(/`+$/, "").trim();
|
|
10339
|
+
}
|
|
10340
|
+
function isVerificationPlaceholder(value) {
|
|
10341
|
+
return /^(?:n\/a|—+|-+|none)$/i.test(value.trim());
|
|
10342
|
+
}
|
|
10216
10343
|
function isMissingFile5(error) {
|
|
10217
10344
|
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
10218
10345
|
}
|
|
@@ -10845,6 +10972,35 @@ async function taskCompleteCommand(ref, options) {
|
|
|
10845
10972
|
options,
|
|
10846
10973
|
async (local) => {
|
|
10847
10974
|
assertCompleteDependencies(ref, local.definitions, local.state.tasks, options.force === true);
|
|
10975
|
+
const definition = local.definitions.find(
|
|
10976
|
+
(entry) => entry.id.toUpperCase() === ref.trim().toUpperCase()
|
|
10977
|
+
);
|
|
10978
|
+
const verificationCommand = definition === void 0 ? null : verificationCommandFromContent(definition.content);
|
|
10979
|
+
const stateTask = local.state.tasks.find(
|
|
10980
|
+
(entry) => entry.ref.toUpperCase() === ref.trim().toUpperCase()
|
|
10981
|
+
);
|
|
10982
|
+
if (options.force !== true) {
|
|
10983
|
+
if (verificationCommand === null) {
|
|
10984
|
+
throw new Error(
|
|
10985
|
+
`Task ${ref} tidak punya verificationCommand. Gunakan --force untuk jalur legacy.`
|
|
10986
|
+
);
|
|
10987
|
+
}
|
|
10988
|
+
const proof = stateTask?.verification;
|
|
10989
|
+
if (proof === void 0 || proof.exitCode !== 0 || proof.command !== verificationCommand) {
|
|
10990
|
+
throw new Error(
|
|
10991
|
+
`Task ${ref} belum diverifikasi. Jalankan \`jioogen task verify ${ref}\`.`
|
|
10992
|
+
);
|
|
10993
|
+
}
|
|
10994
|
+
} else {
|
|
10995
|
+
if (verificationCommand !== null) {
|
|
10996
|
+
const proof = stateTask?.verification;
|
|
10997
|
+
if (proof === void 0 || proof.exitCode !== 0 || proof.command !== verificationCommand) {
|
|
10998
|
+
console.warn(`Warning: bypass verification requirement for ${ref}.`);
|
|
10999
|
+
}
|
|
11000
|
+
} else {
|
|
11001
|
+
console.warn(`Warning: task ${ref} has no verificationCommand (legacy bypass).`);
|
|
11002
|
+
}
|
|
11003
|
+
}
|
|
10848
11004
|
const completed = withStatus(local.state, ref, "done", {
|
|
10849
11005
|
note: options.note ?? "",
|
|
10850
11006
|
awaitingCheckpoint: false
|
|
@@ -10853,9 +11009,6 @@ async function taskCompleteCommand(ref, options) {
|
|
|
10853
11009
|
(entry) => entry.ref.toUpperCase() === ref.toUpperCase()
|
|
10854
11010
|
);
|
|
10855
11011
|
const next2 = selectNext(local.definitions, completed.tasks);
|
|
10856
|
-
const definition = local.definitions.find(
|
|
10857
|
-
(entry) => entry.id.toUpperCase() === ref.toUpperCase()
|
|
10858
|
-
);
|
|
10859
11012
|
const risky = definition !== void 0 && isRiskyTask(definition);
|
|
10860
11013
|
const boundary = completedTask2 !== void 0 && (next2 !== null && isBoundary(completedTask2, next2.task) || risky);
|
|
10861
11014
|
if (boundary && completedTask2 !== void 0) {
|
|
@@ -10890,6 +11043,121 @@ async function taskCompleteCommand(ref, options) {
|
|
|
10890
11043
|
}
|
|
10891
11044
|
if (next !== null) console.log(`Berikutnya: ${next.task.id} \u2014 ${next.task.title}`);
|
|
10892
11045
|
}
|
|
11046
|
+
async function taskVerifyCommand(ref, options) {
|
|
11047
|
+
const context = await resolveLocalBundle(options);
|
|
11048
|
+
const definitions = await loadTasks(context.bundleDir);
|
|
11049
|
+
const definition = definitions.find((task) => task.id.toUpperCase() === ref.trim().toUpperCase());
|
|
11050
|
+
if (definition === void 0) {
|
|
11051
|
+
throw new Error(`Task ${ref} tidak ditemukan.`);
|
|
11052
|
+
}
|
|
11053
|
+
const command = verificationCommandFromContent(definition.content);
|
|
11054
|
+
if (command === null) {
|
|
11055
|
+
throw new Error(
|
|
11056
|
+
`Task ${ref} tidak punya verificationCommand. Jalankan \`jioogen task verify\` tidak dapat dilanjutkan.`
|
|
11057
|
+
);
|
|
11058
|
+
}
|
|
11059
|
+
const timeoutMs = verifyTimeoutMs();
|
|
11060
|
+
const startedAt = Date.now();
|
|
11061
|
+
const result = await runVerification(command, context.bundleDir, timeoutMs);
|
|
11062
|
+
const durationMs = Date.now() - startedAt;
|
|
11063
|
+
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
11064
|
+
await withStateLock(context.bundleDir, async () => {
|
|
11065
|
+
const existing = await readState(context.bundleDir);
|
|
11066
|
+
const state = existing === null ? createState(context.projectId, definitions) : mergeTasks(existing, definitions);
|
|
11067
|
+
const index = state.tasks.findIndex(
|
|
11068
|
+
(task) => task.ref.toUpperCase() === ref.trim().toUpperCase()
|
|
11069
|
+
);
|
|
11070
|
+
if (index === -1) {
|
|
11071
|
+
throw new Error(`Task ${ref} tidak ada di sidecar.`);
|
|
11072
|
+
}
|
|
11073
|
+
const updatedTask = {
|
|
11074
|
+
...state.tasks[index],
|
|
11075
|
+
verification: { command, exitCode: result.exitCode, at, durationMs }
|
|
11076
|
+
};
|
|
11077
|
+
const tasks = state.tasks.map(
|
|
11078
|
+
(task, i) => i === index ? updatedTask : task
|
|
11079
|
+
);
|
|
11080
|
+
await writeState(context.bundleDir, { ...state, tasks });
|
|
11081
|
+
});
|
|
11082
|
+
const payload = {
|
|
11083
|
+
ref: definition.id,
|
|
11084
|
+
command,
|
|
11085
|
+
exitCode: result.exitCode,
|
|
11086
|
+
durationMs,
|
|
11087
|
+
at,
|
|
11088
|
+
timedOut: result.timedOut,
|
|
11089
|
+
stdout: result.stdout,
|
|
11090
|
+
stderr: result.stderr
|
|
11091
|
+
};
|
|
11092
|
+
if (options.json === true) {
|
|
11093
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
11094
|
+
} else {
|
|
11095
|
+
console.log(`Verify ${definition.id}: exit ${result.exitCode} (${durationMs}ms)`);
|
|
11096
|
+
if (result.stdout.trim().length > 0) {
|
|
11097
|
+
console.log(result.stdout.trimEnd());
|
|
11098
|
+
}
|
|
11099
|
+
if (result.stderr.trim().length > 0) {
|
|
11100
|
+
console.error(result.stderr.trimEnd());
|
|
11101
|
+
}
|
|
11102
|
+
}
|
|
11103
|
+
if (result.exitCode !== 0) {
|
|
11104
|
+
throw new Error(`Verification gagal (exit ${result.exitCode}).`);
|
|
11105
|
+
}
|
|
11106
|
+
}
|
|
11107
|
+
function verifyTimeoutMs() {
|
|
11108
|
+
const raw = process.env.JIOOGEN_VERIFY_TIMEOUT_MS;
|
|
11109
|
+
if (raw === void 0 || raw.trim().length === 0) return 9e5;
|
|
11110
|
+
const value = Number(raw);
|
|
11111
|
+
if (!Number.isFinite(value) || value < 0) return 9e5;
|
|
11112
|
+
return value;
|
|
11113
|
+
}
|
|
11114
|
+
function runVerification(command, cwd, timeoutMs) {
|
|
11115
|
+
return new Promise((resolve6) => {
|
|
11116
|
+
const child = spawn("sh", ["-c", command], { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
11117
|
+
let stdout = "";
|
|
11118
|
+
let stderr = "";
|
|
11119
|
+
let timedOut = false;
|
|
11120
|
+
let settled = false;
|
|
11121
|
+
let timer;
|
|
11122
|
+
const finish = (exitCode) => {
|
|
11123
|
+
if (settled) return;
|
|
11124
|
+
settled = true;
|
|
11125
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
11126
|
+
resolve6({
|
|
11127
|
+
exitCode,
|
|
11128
|
+
stdout: tailText(stdout),
|
|
11129
|
+
stderr: tailText(stderr),
|
|
11130
|
+
timedOut
|
|
11131
|
+
});
|
|
11132
|
+
};
|
|
11133
|
+
child.stdout.on("data", (chunk) => {
|
|
11134
|
+
stdout += chunk.toString();
|
|
11135
|
+
});
|
|
11136
|
+
child.stderr.on("data", (chunk) => {
|
|
11137
|
+
stderr += chunk.toString();
|
|
11138
|
+
});
|
|
11139
|
+
child.on("error", () => finish(1));
|
|
11140
|
+
child.on("close", (code, signal) => {
|
|
11141
|
+
if (timedOut) {
|
|
11142
|
+
finish(124);
|
|
11143
|
+
return;
|
|
11144
|
+
}
|
|
11145
|
+
finish(code ?? (signal !== null ? 1 : 0));
|
|
11146
|
+
});
|
|
11147
|
+
if (timeoutMs > 0) {
|
|
11148
|
+
timer = setTimeout(() => {
|
|
11149
|
+
timedOut = true;
|
|
11150
|
+
try {
|
|
11151
|
+
child.kill("SIGKILL");
|
|
11152
|
+
} catch {
|
|
11153
|
+
}
|
|
11154
|
+
}, timeoutMs);
|
|
11155
|
+
}
|
|
11156
|
+
});
|
|
11157
|
+
}
|
|
11158
|
+
function tailText(value) {
|
|
11159
|
+
return value.length <= 2e3 ? value : value.slice(-2e3);
|
|
11160
|
+
}
|
|
10893
11161
|
async function taskFailCommand(ref, reasonParts, options) {
|
|
10894
11162
|
const reason = reasonParts.join(" ").trim() || options.note || "";
|
|
10895
11163
|
const key = ref.trim().toUpperCase();
|
|
@@ -11219,7 +11487,7 @@ function isMissingFile7(error) {
|
|
|
11219
11487
|
}
|
|
11220
11488
|
|
|
11221
11489
|
// src/index.ts
|
|
11222
|
-
var VERSION = "0.2.
|
|
11490
|
+
var VERSION = "0.2.7";
|
|
11223
11491
|
var USAGE = `jioogen \u2014 CLI JiooGen (task selection lokal, server read-only)
|
|
11224
11492
|
|
|
11225
11493
|
Usage:
|
|
@@ -11243,6 +11511,7 @@ Usage:
|
|
|
11243
11511
|
jioogen task next [--json]
|
|
11244
11512
|
jioogen task start <ref>
|
|
11245
11513
|
jioogen task complete <ref> [--note <text>] [--force]
|
|
11514
|
+
jioogen task verify <ref> [--dir <dir>] [--json]
|
|
11246
11515
|
jioogen task fail <ref> [reason...] [--note <text>]
|
|
11247
11516
|
jioogen task reset <ref> [reason...] [--note <text>]
|
|
11248
11517
|
jioogen status [--remote] [--json]
|
|
@@ -11449,6 +11718,9 @@ async function dispatchTask(rest, options) {
|
|
|
11449
11718
|
case "start":
|
|
11450
11719
|
await taskStartCommand(requireRef(ref, "start"), options);
|
|
11451
11720
|
return;
|
|
11721
|
+
case "verify":
|
|
11722
|
+
await taskVerifyCommand(requireRef(ref, "verify"), options);
|
|
11723
|
+
return;
|
|
11452
11724
|
case "complete":
|
|
11453
11725
|
await taskCompleteCommand(requireRef(ref, "complete"), options);
|
|
11454
11726
|
return;
|