jioogen 0.2.19 → 0.3.0
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/authoring-pack/agent/core.md +1 -1
- package/authoring-pack/agent/discovery.md +1 -1
- package/authoring-pack/agent/prd.md +6 -1
- package/authoring-pack/agent/specs.md +1 -1
- package/authoring-pack/agent/tasks.md +1 -1
- package/authoring-pack/knowledge/catalog.generated.json +4 -1
- package/authoring-pack/knowledge/library/prd/prd-standard.md +7 -0
- package/authoring-pack/knowledge/library/prd/self-check.md +6 -0
- package/authoring-pack/manifest.json +10 -10
- package/authoring-pack/skills/prd-authoring/SKILL.md +1 -1
- package/dist/index.js +398 -155
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9774,7 +9774,7 @@ Urutan otoritas: keamanan/a11y inti > PRD/specs > file di sini > default generik
|
|
|
9774
9774
|
var EXECUTION_SIDECAR_PATH = "tasks/.execution/state.json";
|
|
9775
9775
|
var EXECUTION_SIDECAR_VERSION = 1;
|
|
9776
9776
|
var EXECUTION_SIDECAR_VERSION_V2 = 2;
|
|
9777
|
-
var HANDOFF_PROMPT_VERSION =
|
|
9777
|
+
var HANDOFF_PROMPT_VERSION = 29;
|
|
9778
9778
|
var HANDOFF_AGENT_TOKEN_TTL_SECONDS = 30 * 24 * 3600;
|
|
9779
9779
|
var HandoffPayloadSchema = external_exports.object({
|
|
9780
9780
|
promptVersion: external_exports.literal(HANDOFF_PROMPT_VERSION),
|
|
@@ -10183,12 +10183,12 @@ var ApiClient = class {
|
|
|
10183
10183
|
// src/commands.ts
|
|
10184
10184
|
import { spawn as spawn2 } from "node:child_process";
|
|
10185
10185
|
import { existsSync as existsSync3 } from "node:fs";
|
|
10186
|
-
import { mkdir as
|
|
10186
|
+
import { mkdir as mkdir11, readdir as readdir8, readFile as readFile12, stat as stat8, writeFile as writeFile11 } from "node:fs/promises";
|
|
10187
10187
|
import { join as join13, resolve as resolve6 } from "node:path";
|
|
10188
10188
|
|
|
10189
10189
|
// src/align.ts
|
|
10190
10190
|
import { spawn } from "node:child_process";
|
|
10191
|
-
import { mkdir as
|
|
10191
|
+
import { mkdir as mkdir6, readFile as readFile7, rm as rm4, stat as stat4, writeFile as writeFile6 } from "node:fs/promises";
|
|
10192
10192
|
import { join as join8 } from "node:path";
|
|
10193
10193
|
|
|
10194
10194
|
// src/authoring.ts
|
|
@@ -11109,13 +11109,13 @@ async function appendApprovalNote(bundleDir, input) {
|
|
|
11109
11109
|
|
|
11110
11110
|
// src/drift.ts
|
|
11111
11111
|
import { createHash as createHash2 } from "node:crypto";
|
|
11112
|
-
import { mkdir as
|
|
11113
|
-
import { dirname as
|
|
11112
|
+
import { mkdir as mkdir5, readdir as readdir5, readFile as readFile6, rm as rm3, stat as stat3, writeFile as writeFile5 } from "node:fs/promises";
|
|
11113
|
+
import { dirname as dirname5, isAbsolute as isAbsolute2, join as join7 } from "node:path";
|
|
11114
11114
|
|
|
11115
11115
|
// src/tasks.ts
|
|
11116
11116
|
import { readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
11117
|
-
import { readdir as readdir4, readFile as readFile5, stat as stat2 } from "node:fs/promises";
|
|
11118
|
-
import { isAbsolute, join as join6 } from "node:path";
|
|
11117
|
+
import { mkdir as mkdir4, readdir as readdir4, readFile as readFile5, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
|
|
11118
|
+
import { dirname as dirname4, isAbsolute, join as join6 } from "node:path";
|
|
11119
11119
|
|
|
11120
11120
|
// src/sidecar.ts
|
|
11121
11121
|
import { randomUUID } from "node:crypto";
|
|
@@ -11610,11 +11610,22 @@ function renderActiveTask(task, context) {
|
|
|
11610
11610
|
);
|
|
11611
11611
|
const checklist = renderQualityChecklist(task.layer, context);
|
|
11612
11612
|
if (checklist.length > 0) lines.push("", ...checklist);
|
|
11613
|
-
const
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11613
|
+
const persistedChecklist = context?.bundleDir !== void 0 ? readBreakdownChecklistLines(context.bundleDir, task.id) : [];
|
|
11614
|
+
if (persistedChecklist.length > 0) {
|
|
11615
|
+
lines.push(
|
|
11616
|
+
"",
|
|
11617
|
+
BREAKDOWN_HEADING,
|
|
11618
|
+
...BREAKDOWN_RULES,
|
|
11619
|
+
`Checklist tersimpan: .jioogen/breakdown/${task.id}.md`,
|
|
11620
|
+
...persistedChecklist
|
|
11621
|
+
);
|
|
11622
|
+
} else {
|
|
11623
|
+
const breakdown = buildTaskBreakdown(task);
|
|
11624
|
+
const breakdownLines = [...breakdown.authored, ...breakdown.derived];
|
|
11625
|
+
if (breakdownLines.length > 0) {
|
|
11626
|
+
lines.push("", BREAKDOWN_HEADING, ...BREAKDOWN_RULES);
|
|
11627
|
+
for (const item of breakdownLines) lines.push(`- [ ] ${item}`);
|
|
11628
|
+
}
|
|
11618
11629
|
}
|
|
11619
11630
|
lines.push("", "--- ISI TASK (otoritas scope) ---", task.content, "--- AKHIR ISI TASK ---");
|
|
11620
11631
|
if (context?.bundleDir !== void 0) {
|
|
@@ -11671,6 +11682,93 @@ function buildTaskBreakdown(task) {
|
|
|
11671
11682
|
}
|
|
11672
11683
|
return { authored, derived };
|
|
11673
11684
|
}
|
|
11685
|
+
var BREAKDOWN_DIR = ".jioogen/breakdown";
|
|
11686
|
+
var BREAKDOWN_CHECKBOX_RE = /^\s*-\s*\[( |x|X)\]\s*(.*)$/;
|
|
11687
|
+
var BREAKDOWN_ID_RE = /^([A-Z]+-\d+)\s*[—:-]?\s*(.*)$/;
|
|
11688
|
+
function breakdownPath(bundleDir, ref) {
|
|
11689
|
+
return join6(bundleDir, BREAKDOWN_DIR, `${ref}.md`);
|
|
11690
|
+
}
|
|
11691
|
+
function breakdownItems(task) {
|
|
11692
|
+
const breakdown = buildTaskBreakdown(task);
|
|
11693
|
+
const items = [];
|
|
11694
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11695
|
+
const push = (prefix, index, text2) => {
|
|
11696
|
+
const key = text2.trim().toLowerCase();
|
|
11697
|
+
if (key.length === 0 || seen.has(key)) return;
|
|
11698
|
+
seen.add(key);
|
|
11699
|
+
items.push({ id: `${prefix}-${String(index + 1).padStart(2, "0")}`, text: text2.trim() });
|
|
11700
|
+
};
|
|
11701
|
+
breakdown.authored.forEach((text2, index) => {
|
|
11702
|
+
push("SUB", index, text2);
|
|
11703
|
+
});
|
|
11704
|
+
breakdown.derived.forEach((text2, index) => {
|
|
11705
|
+
push("BD", index, text2);
|
|
11706
|
+
});
|
|
11707
|
+
return items;
|
|
11708
|
+
}
|
|
11709
|
+
function renderBreakdownScaffold(task) {
|
|
11710
|
+
const items = breakdownItems(task);
|
|
11711
|
+
const section3 = items.map((item) => `- [ ] ${item.id} \u2014 ${item.text}`).join("\n");
|
|
11712
|
+
return `${[
|
|
11713
|
+
`# Breakdown ${task.id} \u2014 ${task.title}`,
|
|
11714
|
+
"",
|
|
11715
|
+
"## Breakdown",
|
|
11716
|
+
"",
|
|
11717
|
+
section3,
|
|
11718
|
+
"",
|
|
11719
|
+
"> Checklist ini mengikat. Kerjakan dan centang setiap item; `task complete` menolak selama masih ada `- [ ]`.",
|
|
11720
|
+
"> File ini milik eksekusi (`.jioogen/`), bukan kontrak. Jangan menyalinnya ke `tasks/`."
|
|
11721
|
+
].join("\n")}
|
|
11722
|
+
`;
|
|
11723
|
+
}
|
|
11724
|
+
async function writeBreakdownScaffold(bundleDir, task) {
|
|
11725
|
+
const path = breakdownPath(bundleDir, task.id);
|
|
11726
|
+
await mkdir4(dirname4(path), { recursive: true });
|
|
11727
|
+
await writeFile4(path, renderBreakdownScaffold(task), "utf8");
|
|
11728
|
+
return path;
|
|
11729
|
+
}
|
|
11730
|
+
async function ensureBreakdownScaffold(bundleDir, task) {
|
|
11731
|
+
const path = breakdownPath(bundleDir, task.id);
|
|
11732
|
+
try {
|
|
11733
|
+
const content = await readFile5(path, "utf8");
|
|
11734
|
+
if (content.trim().length > 0) return path;
|
|
11735
|
+
} catch {
|
|
11736
|
+
}
|
|
11737
|
+
return writeBreakdownScaffold(bundleDir, task);
|
|
11738
|
+
}
|
|
11739
|
+
async function readBreakdownChecklist(bundleDir, ref) {
|
|
11740
|
+
const path = breakdownPath(bundleDir, ref);
|
|
11741
|
+
let content;
|
|
11742
|
+
try {
|
|
11743
|
+
content = await readFile5(path, "utf8");
|
|
11744
|
+
} catch {
|
|
11745
|
+
return null;
|
|
11746
|
+
}
|
|
11747
|
+
let total = 0;
|
|
11748
|
+
const unchecked = [];
|
|
11749
|
+
for (const line of content.split(/\r?\n/)) {
|
|
11750
|
+
const match = BREAKDOWN_CHECKBOX_RE.exec(line);
|
|
11751
|
+
if (match === null) continue;
|
|
11752
|
+
total += 1;
|
|
11753
|
+
if (match[1] !== " ") continue;
|
|
11754
|
+
const body = (match[2] ?? "").trim();
|
|
11755
|
+
const withId = BREAKDOWN_ID_RE.exec(body);
|
|
11756
|
+
if (withId === null) {
|
|
11757
|
+
unchecked.push({ id: `ITEM-${String(total).padStart(2, "0")}`, text: body });
|
|
11758
|
+
continue;
|
|
11759
|
+
}
|
|
11760
|
+
unchecked.push({ id: withId[1] ?? "", text: (withId[2] ?? "").trim() });
|
|
11761
|
+
}
|
|
11762
|
+
return { path, total, unchecked };
|
|
11763
|
+
}
|
|
11764
|
+
function readBreakdownChecklistLines(bundleDir, ref) {
|
|
11765
|
+
try {
|
|
11766
|
+
const content = readFileSync2(breakdownPath(bundleDir, ref), "utf8");
|
|
11767
|
+
return content.split(/\r?\n/).filter((line) => BREAKDOWN_CHECKBOX_RE.test(line)).map((line) => line.trim());
|
|
11768
|
+
} catch {
|
|
11769
|
+
return [];
|
|
11770
|
+
}
|
|
11771
|
+
}
|
|
11674
11772
|
function renderQualityChecklist(layer, context) {
|
|
11675
11773
|
if (context === void 0 || layer === void 0) return [];
|
|
11676
11774
|
const items = [...LAYER_CHECKLISTS[layer] ?? []];
|
|
@@ -12084,8 +12182,8 @@ async function acknowledgeDrift(bundleDir, flags = {}, note, now = /* @__PURE__
|
|
|
12084
12182
|
const mergedNote = note ?? existing?.note;
|
|
12085
12183
|
if (mergedNote !== void 0) merged.note = mergedNote;
|
|
12086
12184
|
const target = join7(contractRoot(bundleDir), "tasks", ".execution", "acknowledged.json");
|
|
12087
|
-
await
|
|
12088
|
-
await
|
|
12185
|
+
await mkdir5(dirname5(target), { recursive: true });
|
|
12186
|
+
await writeFile5(target, `${JSON.stringify(merged, null, 2)}
|
|
12089
12187
|
`, "utf8");
|
|
12090
12188
|
return merged;
|
|
12091
12189
|
}
|
|
@@ -12127,8 +12225,8 @@ async function readBaseline(bundleDir) {
|
|
|
12127
12225
|
}
|
|
12128
12226
|
async function writeBaseline(bundleDir, baseline) {
|
|
12129
12227
|
const target = baselinePath(bundleDir);
|
|
12130
|
-
await
|
|
12131
|
-
await
|
|
12228
|
+
await mkdir5(dirname5(target), { recursive: true });
|
|
12229
|
+
await writeFile5(target, `${JSON.stringify(baseline, null, 2)}
|
|
12132
12230
|
`, "utf8");
|
|
12133
12231
|
}
|
|
12134
12232
|
async function clearBaseline(bundleDir) {
|
|
@@ -12245,6 +12343,18 @@ function formatDrift(finding) {
|
|
|
12245
12343
|
const files = finding.files.length === 0 ? "" : ` (${finding.files.slice(0, 4).join(", ")}${finding.files.length > 4 ? ", \u2026" : ""})`;
|
|
12246
12344
|
return `${finding.severity === "warn" ? "\u26A0" : "\u2139"} ${label}: ${finding.message}${files}`;
|
|
12247
12345
|
}
|
|
12346
|
+
async function latestTargetMtime(bundleDir, patterns) {
|
|
12347
|
+
let latest = null;
|
|
12348
|
+
for (const pattern of patterns) {
|
|
12349
|
+
const resolved = await expandPattern(bundleDir, pattern);
|
|
12350
|
+
for (const file of resolved) {
|
|
12351
|
+
const info = await statMaybe(join7(bundleDir, file));
|
|
12352
|
+
if (info === null || !info.isFile()) continue;
|
|
12353
|
+
if (latest === null || info.mtimeMs > latest) latest = info.mtimeMs;
|
|
12354
|
+
}
|
|
12355
|
+
}
|
|
12356
|
+
return latest;
|
|
12357
|
+
}
|
|
12248
12358
|
async function targetHashes(bundleDir, patterns) {
|
|
12249
12359
|
const files = /* @__PURE__ */ new Set();
|
|
12250
12360
|
let truncated = false;
|
|
@@ -12659,8 +12769,8 @@ async function pullContract(deps, bundleDir) {
|
|
|
12659
12769
|
}
|
|
12660
12770
|
for (const [path, content] of contents) {
|
|
12661
12771
|
const target = resolveProjectPath(bundleDir, path);
|
|
12662
|
-
await
|
|
12663
|
-
await
|
|
12772
|
+
await mkdir6(join8(target, ".."), { recursive: true });
|
|
12773
|
+
await writeFile6(target, content, "utf8");
|
|
12664
12774
|
}
|
|
12665
12775
|
await clearBaseline(bundleDir).catch(() => {
|
|
12666
12776
|
});
|
|
@@ -12771,9 +12881,9 @@ function runAuthoringAttempt(bin, args, configPath, bundleDir, label, stage, tim
|
|
|
12771
12881
|
async function runLocalAuthoring(stage, bundleDir, issues) {
|
|
12772
12882
|
const configDir2 = join8(bundleDir, ".jioogen", "align");
|
|
12773
12883
|
const configPath = join8(configDir2, "generated.json");
|
|
12774
|
-
await
|
|
12884
|
+
await mkdir6(configDir2, { recursive: true });
|
|
12775
12885
|
const config = await buildAuthoringOpencodeConfig(bundledAuthoringPackDir());
|
|
12776
|
-
await
|
|
12886
|
+
await writeFile6(configPath, `${JSON.stringify(config, null, 2)}
|
|
12777
12887
|
`, "utf8");
|
|
12778
12888
|
const bin = process.env.OPENCODE_BIN?.trim() || "opencode";
|
|
12779
12889
|
const chain = authoringModelChain();
|
|
@@ -13040,10 +13150,146 @@ function formatAlign(result) {
|
|
|
13040
13150
|
return lines.join("\n");
|
|
13041
13151
|
}
|
|
13042
13152
|
|
|
13153
|
+
// src/completion-gate.ts
|
|
13154
|
+
var FRESH_TOLERANCE_MS = 2e3;
|
|
13155
|
+
function parseAt(value) {
|
|
13156
|
+
if (value === void 0) return void 0;
|
|
13157
|
+
const parsed = Date.parse(value);
|
|
13158
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
13159
|
+
}
|
|
13160
|
+
function latestVerificationAt(task) {
|
|
13161
|
+
const times = (task.evidence ?? []).filter((entry) => entry.type === "verification" && entry.exitCode === 0).map((entry) => parseAt(entry.at)).filter((value) => value !== void 0);
|
|
13162
|
+
if (times.length === 0) return void 0;
|
|
13163
|
+
return Math.max(...times);
|
|
13164
|
+
}
|
|
13165
|
+
async function evaluateCompletionGate(input) {
|
|
13166
|
+
const findings = [];
|
|
13167
|
+
const { definition, stateTask } = input;
|
|
13168
|
+
const targetFiles = targetFilesFromContent(definition.content);
|
|
13169
|
+
const declared = verificationCommandFromContent(definition.content);
|
|
13170
|
+
if (declared === null) {
|
|
13171
|
+
findings.push({
|
|
13172
|
+
code: "VERIFICATION_COMMAND_MISSING",
|
|
13173
|
+
message: "Task tidak punya verificationCommand. Lengkapi kontrak task lebih dulu (align/seed); `task complete` tidak punya jalur legacy."
|
|
13174
|
+
});
|
|
13175
|
+
} else if (stateTask === void 0 || stateTask.verification === void 0) {
|
|
13176
|
+
findings.push({
|
|
13177
|
+
code: "VERIFICATION_MISSING",
|
|
13178
|
+
message: "Belum ada bukti verifikasi. Jalankan `npx jioogen task verify <ref>`."
|
|
13179
|
+
});
|
|
13180
|
+
} else if (stateTask.verification.exitCode !== 0) {
|
|
13181
|
+
findings.push({
|
|
13182
|
+
code: "VERIFICATION_FAILED",
|
|
13183
|
+
message: `Verifikasi terakhir exit ${stateTask.verification.exitCode}; perbaiki sampai exit 0.`
|
|
13184
|
+
});
|
|
13185
|
+
} else {
|
|
13186
|
+
const proofCommand = stateTask.verification.command === void 0 ? null : normalizeVerificationCommand(stateTask.verification.command);
|
|
13187
|
+
const expected = normalizeVerificationCommand(declared);
|
|
13188
|
+
if (proofCommand !== expected && input.lenient !== true) {
|
|
13189
|
+
findings.push({
|
|
13190
|
+
code: "VERIFICATION_COMMAND_MISMATCH",
|
|
13191
|
+
message: "Bukti verifikasi milik command yang berbeda dari kontrak task. Jalankan `task verify` lagi."
|
|
13192
|
+
});
|
|
13193
|
+
}
|
|
13194
|
+
const proofAt = latestVerificationAt(stateTask);
|
|
13195
|
+
const latestFileAt = await latestTargetMtime(input.bundleDir, targetFiles);
|
|
13196
|
+
if (proofAt === void 0) {
|
|
13197
|
+
findings.push({
|
|
13198
|
+
code: "VERIFICATION_STALE",
|
|
13199
|
+
message: "Bukti verifikasi tidak punya timestamp. Jalankan `task verify` lagi."
|
|
13200
|
+
});
|
|
13201
|
+
} else if (latestFileAt !== null && latestFileAt > proofAt + FRESH_TOLERANCE_MS) {
|
|
13202
|
+
findings.push({
|
|
13203
|
+
code: "VERIFICATION_STALE",
|
|
13204
|
+
message: "File target berubah setelah verifikasi terakhir. Jalankan `task verify` lagi."
|
|
13205
|
+
});
|
|
13206
|
+
}
|
|
13207
|
+
}
|
|
13208
|
+
const checklist = await readBreakdownChecklist(input.bundleDir, definition.id);
|
|
13209
|
+
if (checklist === null) {
|
|
13210
|
+
findings.push({
|
|
13211
|
+
code: "BREAKDOWN_INCOMPLETE",
|
|
13212
|
+
message: "Checklist breakdown belum ada. Jalankan `task start` (atau `task expand --write`) lalu kerjakan itemnya."
|
|
13213
|
+
});
|
|
13214
|
+
} else if (checklist.total === 0) {
|
|
13215
|
+
findings.push({
|
|
13216
|
+
code: "BREAKDOWN_INCOMPLETE",
|
|
13217
|
+
message: `Checklist ${checklist.path} tidak berisi item. Regenerate dengan \`task expand --write\`.`
|
|
13218
|
+
});
|
|
13219
|
+
} else if (checklist.unchecked.length > 0) {
|
|
13220
|
+
const refs = checklist.unchecked.map((item) => item.id);
|
|
13221
|
+
const shown = refs.slice(0, 6).join(", ");
|
|
13222
|
+
findings.push({
|
|
13223
|
+
code: "BREAKDOWN_INCOMPLETE",
|
|
13224
|
+
message: `${checklist.unchecked.length} item belum tercentang (${shown}${refs.length > 6 ? ", \u2026" : ""}). Kerjakan lalu centang di ${checklist.path}.`,
|
|
13225
|
+
refs
|
|
13226
|
+
});
|
|
13227
|
+
}
|
|
13228
|
+
if (definition.layer === "frontend_mock") {
|
|
13229
|
+
if (stateTask?.designReview === void 0) {
|
|
13230
|
+
findings.push({
|
|
13231
|
+
code: "DESIGN_REVIEW_MISSING",
|
|
13232
|
+
message: 'Task UI belum punya design review. Jalankan `task verify --visual "<catatan>"` sebelum complete.'
|
|
13233
|
+
});
|
|
13234
|
+
} else if (stateTask.designReview.passed !== true) {
|
|
13235
|
+
findings.push({
|
|
13236
|
+
code: "DESIGN_REVIEW_FAILED",
|
|
13237
|
+
message: "Design review terakhir gagal. Perbaiki lalu verifikasi visual ulang."
|
|
13238
|
+
});
|
|
13239
|
+
} else {
|
|
13240
|
+
const reviewAt = parseAt(stateTask.designReview.at);
|
|
13241
|
+
const latestFileAt = await latestTargetMtime(input.bundleDir, targetFiles);
|
|
13242
|
+
if (reviewAt !== void 0 && latestFileAt !== null && latestFileAt > reviewAt + FRESH_TOLERANCE_MS) {
|
|
13243
|
+
findings.push({
|
|
13244
|
+
code: "DESIGN_REVIEW_STALE",
|
|
13245
|
+
message: "File target berubah setelah design review. Jalankan `task verify --visual` lagi."
|
|
13246
|
+
});
|
|
13247
|
+
}
|
|
13248
|
+
}
|
|
13249
|
+
}
|
|
13250
|
+
const byRef = new Map(input.state.tasks.map((entry) => [entry.ref.toUpperCase(), entry]));
|
|
13251
|
+
const unmet = [];
|
|
13252
|
+
for (const dependency of definition.dependsOn) {
|
|
13253
|
+
const dependencyState = byRef.get(dependency.toUpperCase());
|
|
13254
|
+
const verifiedProof = dependencyState?.verification?.exitCode === 0 && latestVerificationAt(dependencyState) !== void 0;
|
|
13255
|
+
if (dependencyState === void 0 || dependencyState.status !== "done" || isAdoptedTask(dependencyState) || !verifiedProof) {
|
|
13256
|
+
unmet.push(dependency);
|
|
13257
|
+
}
|
|
13258
|
+
}
|
|
13259
|
+
if (unmet.length > 0) {
|
|
13260
|
+
findings.push({
|
|
13261
|
+
code: "DEPENDENCY_UNVERIFIED",
|
|
13262
|
+
message: `Dependency belum terverifikasi: ${unmet.join(", ")}. Selesaikan lewat harness (bukan --force/adopt) sebelum complete.`,
|
|
13263
|
+
refs: unmet
|
|
13264
|
+
});
|
|
13265
|
+
}
|
|
13266
|
+
const drift = await detectDrift(input.bundleDir, input.definitions, input.state, {
|
|
13267
|
+
focusRef: definition.id,
|
|
13268
|
+
includeInfo: false
|
|
13269
|
+
});
|
|
13270
|
+
if (drift.some((finding) => finding.code === "BUNDLE_DRIFT")) {
|
|
13271
|
+
findings.push({
|
|
13272
|
+
code: "CONTRACT_DRIFT",
|
|
13273
|
+
message: "PRD.md/specs/tasks berubah di luar alur align. Jalankan `jioogen align` (bila disengaja) atau kembalikan file kontrak."
|
|
13274
|
+
});
|
|
13275
|
+
}
|
|
13276
|
+
return { ok: findings.length === 0, findings };
|
|
13277
|
+
}
|
|
13278
|
+
function formatCompletionGateFailure(ref, result) {
|
|
13279
|
+
const lines = [`Task ${ref} belum boleh ditandai done:`];
|
|
13280
|
+
for (const finding of result.findings) {
|
|
13281
|
+
lines.push(`- ${finding.code}: ${finding.message}`);
|
|
13282
|
+
}
|
|
13283
|
+
lines.push(
|
|
13284
|
+
"Gate ini otomatis dan milik agent. Perbaiki di giliran ini, jalankan `task verify` bila perlu, lalu `task complete` lagi. `--force` tidak melewati gate ini."
|
|
13285
|
+
);
|
|
13286
|
+
return lines.join("\n");
|
|
13287
|
+
}
|
|
13288
|
+
|
|
13043
13289
|
// src/config.ts
|
|
13044
|
-
import { chmod, mkdir as
|
|
13290
|
+
import { chmod, mkdir as mkdir7, readFile as readFile8, rm as rm5, writeFile as writeFile7 } from "node:fs/promises";
|
|
13045
13291
|
import { homedir } from "node:os";
|
|
13046
|
-
import { dirname as
|
|
13292
|
+
import { dirname as dirname6, join as join9, resolve as resolve2 } from "node:path";
|
|
13047
13293
|
|
|
13048
13294
|
// src/types.ts
|
|
13049
13295
|
var UI_QUALITY_MODES = ["auto", "on", "off"];
|
|
@@ -13111,9 +13357,9 @@ async function readCredentials() {
|
|
|
13111
13357
|
}
|
|
13112
13358
|
async function writeCredentials(credentials) {
|
|
13113
13359
|
const directory = configDir();
|
|
13114
|
-
await
|
|
13360
|
+
await mkdir7(directory, { recursive: true, mode: 448 });
|
|
13115
13361
|
const target = credentialsPath();
|
|
13116
|
-
await
|
|
13362
|
+
await writeFile7(target, `${JSON.stringify(credentials, null, 2)}
|
|
13117
13363
|
`, {
|
|
13118
13364
|
encoding: "utf8",
|
|
13119
13365
|
mode: 384
|
|
@@ -13217,15 +13463,15 @@ async function findProjectLink(startDir) {
|
|
|
13217
13463
|
for (; ; ) {
|
|
13218
13464
|
const link = await readProjectLink(directory);
|
|
13219
13465
|
if (link !== null) return link;
|
|
13220
|
-
const parent =
|
|
13466
|
+
const parent = dirname6(directory);
|
|
13221
13467
|
if (parent === directory) return null;
|
|
13222
13468
|
directory = parent;
|
|
13223
13469
|
}
|
|
13224
13470
|
}
|
|
13225
13471
|
async function writeProjectLink(bundleDir, link) {
|
|
13226
13472
|
const directory = join9(resolve2(bundleDir), PROJECT_DIR);
|
|
13227
|
-
await
|
|
13228
|
-
await
|
|
13473
|
+
await mkdir7(directory, { recursive: true });
|
|
13474
|
+
await writeFile7(
|
|
13229
13475
|
join9(directory, PROJECT_FILE),
|
|
13230
13476
|
`${JSON.stringify(
|
|
13231
13477
|
{
|
|
@@ -13275,8 +13521,8 @@ import { join as join12 } from "node:path";
|
|
|
13275
13521
|
|
|
13276
13522
|
// src/recovery.ts
|
|
13277
13523
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
13278
|
-
import { mkdir as
|
|
13279
|
-
import { dirname as
|
|
13524
|
+
import { mkdir as mkdir8, readFile as readFile9, rename as rename2, rm as rm6, writeFile as writeFile8 } from "node:fs/promises";
|
|
13525
|
+
import { dirname as dirname7, join as join10 } from "node:path";
|
|
13280
13526
|
var RECOVERY_PATH = "tasks/.execution/recovery.json";
|
|
13281
13527
|
var RECOVERY_BUDGET = { maxAttempts: 3 };
|
|
13282
13528
|
var RECOVERY_BASE_ATTEMPTS = 3;
|
|
@@ -13336,10 +13582,10 @@ function classifyFailure(input) {
|
|
|
13336
13582
|
}
|
|
13337
13583
|
async function writeRecovery(bundleDir, journal) {
|
|
13338
13584
|
const target = recoveryPath(bundleDir);
|
|
13339
|
-
await
|
|
13585
|
+
await mkdir8(dirname7(target), { recursive: true });
|
|
13340
13586
|
const temp = `${target}.${process.pid}.${randomUUID2()}.tmp`;
|
|
13341
13587
|
try {
|
|
13342
|
-
await
|
|
13588
|
+
await writeFile8(temp, `${JSON.stringify(journal, null, 2)}
|
|
13343
13589
|
`, "utf8");
|
|
13344
13590
|
await rename2(temp, target);
|
|
13345
13591
|
} catch (error) {
|
|
@@ -13427,9 +13673,9 @@ function describeRecovery(entry) {
|
|
|
13427
13673
|
|
|
13428
13674
|
// src/skills.ts
|
|
13429
13675
|
import { createHash as createHash3 } from "node:crypto";
|
|
13430
|
-
import { cp as cp2, mkdir as
|
|
13676
|
+
import { cp as cp2, mkdir as mkdir9, readdir as readdir6, readFile as readFile10, rename as rename3, rm as rm7, stat as stat5, writeFile as writeFile9 } from "node:fs/promises";
|
|
13431
13677
|
import { homedir as homedir2 } from "node:os";
|
|
13432
|
-
import { dirname as
|
|
13678
|
+
import { dirname as dirname8, join as join11, resolve as resolve3 } from "node:path";
|
|
13433
13679
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
13434
13680
|
var EXECUTION_SKILL_NAME = "jioogen-execution";
|
|
13435
13681
|
var AGENT_SKILL_DIRS = [
|
|
@@ -13555,11 +13801,11 @@ var JIOOGEN_AGENTS_MD = `${MARKER}
|
|
|
13555
13801
|
|
|
13556
13802
|
## 2. Alur per giliran
|
|
13557
13803
|
1. \`npx jioogen task next\` \u2014 baca blok **TASK AKTIF**, **BREAKDOWN WAJIB**, + isi file task.
|
|
13558
|
-
2.
|
|
13559
|
-
3.
|
|
13804
|
+
2. \`npx jioogen task start <ref>\` \u2014 CLI menulis checklist ke \`.jioogen/breakdown/<ref>.md\`.
|
|
13805
|
+
3. Kerjakan dan centang setiap item checklist sebelum lanjut edit.
|
|
13560
13806
|
4. Implementasikan **hanya** task itu sampai semua Acceptance Criteria dan item breakdown terpenuhi.
|
|
13561
|
-
5. Jalankan \`npx jioogen task verify <ref>\` \u2014 CLI menjalankan \`verificationCommand\` dan mencatat bukti exit code.
|
|
13562
|
-
6. \`npx jioogen task complete <ref>\`
|
|
13807
|
+
5. Jalankan \`npx jioogen task verify <ref>\` \u2014 CLI menjalankan \`verificationCommand\` dan mencatat bukti exit code. Task UI: tambah \`--visual "<catatan>"\`.
|
|
13808
|
+
6. \`npx jioogen task complete <ref>\` \u2014 gate otomatis menolak item belum tercentang, bukti basi, dependency belum terverifikasi, atau kontrak berubah. Perbaiki di giliran itu juga, lalu ulangi. Setelah lolos, buat satu commit git kecil.
|
|
13563
13809
|
7. \`npx jioogen sync\`, lalu kembali ke langkah 1.
|
|
13564
13810
|
|
|
13565
13811
|
## 2b. Pekerjaan yang dibangun di luar harness
|
|
@@ -13627,19 +13873,25 @@ ringkasan; jangan dipecah menjadi banyak task.
|
|
|
13627
13873
|
Task parent bersifat naratif. \`task next\` menyuntik \`## BREAKDOWN WAJIB\` yang
|
|
13628
13874
|
diturunkan dari AC, subfeature, flow/step, lifecycle, engine, UI states,
|
|
13629
13875
|
\`targetFiles\`, dan \`verificationCommand\`. Wajib:
|
|
13630
|
-
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13876
|
+
- \`task start\` menulis checklist ke \`.jioogen/breakdown/<ref>.md\` (execution-owned,
|
|
13877
|
+
bukan kontrak). \`task expand <ref> --write\` membuatnya bila belum ada.
|
|
13878
|
+
- Kerjakan dan centang setiap item di file itu sebelum mulai edit; item tidak boleh dilewati.
|
|
13633
13879
|
- Breakdown bukan task baru; jangan menambah task atau mengubah
|
|
13634
|
-
\`PRD.md\`/\`specs/\`/\`tasks/\` (task baru hanya pada \`--mode seed\`).
|
|
13635
|
-
|
|
13636
|
-
|
|
13880
|
+
\`PRD.md\`/\`specs/\`/\`tasks/\` (task baru hanya pada \`--mode seed\`). Jangan menyalin
|
|
13881
|
+
checklist ke file task.
|
|
13882
|
+
- \`task complete\` menolak selama masih ada \`- [ ]\`. Selesai bila semua item,
|
|
13883
|
+
\`targetFiles\`, AC, dan \`verificationCommand\` terpenuhi.
|
|
13637
13884
|
|
|
13638
13885
|
## 4. Verifikasi jujur
|
|
13639
13886
|
- Pakai test runner yang dideklarasikan di \`specs/\` atau dibuat task scaffold.
|
|
13640
13887
|
- Dilarang \`--passWithNoTests\` atau flag yang membuat command exit 0 tanpa test nyata.
|
|
13641
13888
|
- Kalau test belum ada, task belum selesai.
|
|
13642
|
-
- Bukti verifikasi dicatat CLI lewat \`npx jioogen task verify <ref>\`; \`task complete\` menolak tanpa bukti exit 0.
|
|
13889
|
+
- Bukti verifikasi dicatat CLI lewat \`npx jioogen task verify <ref>\`; \`task complete\` menolak tanpa bukti exit 0 yang lebih baru dari perubahan terakhir.
|
|
13890
|
+
- Task UI wajib \`npx jioogen task verify <ref> --visual "<catatan>"\`; design review yang hilang/gagal/basi menolak \`task complete\`.
|
|
13891
|
+
- Gate \`task complete\` tidak punya \`--force\`: perbaiki temuan di giliran yang sama, jangan lanjutkan task berikutnya.
|
|
13892
|
+
- Bila task sudah \`done\` tetapi ternyata partial: reopen dengan \`npx jioogen task start <ref>\`
|
|
13893
|
+
(history append-only), lengkapi item yang dilewati, \`task verify\`, lalu \`task complete\`
|
|
13894
|
+
lagi. Jangan cukup mencatat "partial" di note.
|
|
13643
13895
|
|
|
13644
13896
|
## 5. Berhenti sebentar untuk konfirmasi
|
|
13645
13897
|
Berhenti setelah satu bagian besar selesai, sebelum beralih ke bagian berikutnya,
|
|
@@ -13737,12 +13989,15 @@ atas ide, refactor, perbaikan, atau fitur lain.
|
|
|
13737
13989
|
## 2. Siklus per giliran
|
|
13738
13990
|
|
|
13739
13991
|
1. \`npx jioogen task next\` \u2014 baca TASK AKTIF, BREAKDOWN WAJIB, + isi file task.
|
|
13740
|
-
2.
|
|
13741
|
-
3.
|
|
13992
|
+
2. \`npx jioogen task start <ref>\`.
|
|
13993
|
+
3. Buka \`.jioogen/breakdown/<ref>.md\`; kerjakan dan centang setiap item sebelum lanjut edit.
|
|
13742
13994
|
4. Implementasikan **hanya** task itu sampai semua Acceptance Criteria dan item breakdown terpenuhi.
|
|
13743
13995
|
5. Jalankan \`npx jioogen task verify <ref>\` sampai exit 0; CLI mencatat buktinya.
|
|
13744
|
-
|
|
13745
|
-
|
|
13996
|
+
Task UI: juga \`npx jioogen task verify <ref> --visual "<catatan>"\`.
|
|
13997
|
+
6. \`npx jioogen task complete <ref>\` \u2014 gate otomatis menolak bila ada item belum
|
|
13998
|
+
tercentang, bukti basi, dependency belum terverifikasi, atau kontrak berubah.
|
|
13999
|
+
Perbaiki di giliran itu juga, lalu ulangi. Setelah lolos, buat **satu commit git kecil**
|
|
14000
|
+
untuk task itu (lewati bila folder bukan repo git).
|
|
13746
14001
|
7. \`npx jioogen sync\`, lalu kembali ke langkah 1.
|
|
13747
14002
|
|
|
13748
14003
|
## 2b. Pekerjaan yang dibangun di luar harness
|
|
@@ -13817,13 +14072,14 @@ ringkasan; jangan dipecah menjadi banyak task.
|
|
|
13817
14072
|
Task parent bersifat naratif. \`task next\` menyuntik \`## BREAKDOWN WAJIB\` yang
|
|
13818
14073
|
diturunkan dari AC, subfeature, flow/step, lifecycle, engine, UI states,
|
|
13819
14074
|
\`targetFiles\`, dan \`verificationCommand\`. Wajib:
|
|
13820
|
-
-
|
|
13821
|
-
|
|
13822
|
-
|
|
14075
|
+
- \`task start\` menulis checklist ke \`.jioogen/breakdown/<ref>.md\` (execution-owned,
|
|
14076
|
+
bukan kontrak). \`task expand <ref> --write\` membuatnya bila belum ada.
|
|
14077
|
+
- Kerjakan dan centang setiap item di file itu sebelum mulai edit; item tidak boleh dilewati.
|
|
13823
14078
|
- Breakdown bukan task baru; jangan menambah task atau mengubah
|
|
13824
|
-
\`PRD.md\`/\`specs/\`/\`tasks/\` (task baru hanya pada \`--mode seed\`).
|
|
13825
|
-
|
|
13826
|
-
|
|
14079
|
+
\`PRD.md\`/\`specs/\`/\`tasks/\` (task baru hanya pada \`--mode seed\`). Jangan menyalin
|
|
14080
|
+
checklist ke file task.
|
|
14081
|
+
- \`task complete\` menolak selama masih ada \`- [ ]\`. Selesai bila semua item,
|
|
14082
|
+
\`targetFiles\`, AC, dan \`verificationCommand\` terpenuhi.
|
|
13827
14083
|
|
|
13828
14084
|
## 3e. Anti-Bloat & Code Health
|
|
13829
14085
|
|
|
@@ -13866,9 +14122,14 @@ Tanya: "Apakah senior engineer bilang ini overcomplicated?" Bila ya, sederhanaka
|
|
|
13866
14122
|
- **Dilarang** \`--passWithNoTests\` atau flag sejenis yang membuat command exit 0
|
|
13867
14123
|
tanpa menjalankan test nyata.
|
|
13868
14124
|
- Kalau test belum ada, task belum selesai.
|
|
13869
|
-
- Bukti verifikasi dicatat CLI lewat \`npx jioogen task verify <ref>\`; \`task complete\` menolak tanpa bukti exit 0.
|
|
14125
|
+
- Bukti verifikasi dicatat CLI lewat \`npx jioogen task verify <ref>\`; \`task complete\` menolak tanpa bukti exit 0 yang lebih baru dari perubahan terakhir.
|
|
13870
14126
|
- Task yang menyentuh UI: jalankan juga \`npx jioogen task verify <ref> --visual\`
|
|
13871
|
-
(design review); \`task complete\` menolak design review yang gagal.
|
|
14127
|
+
(design review); \`task complete\` menolak design review yang hilang, gagal, atau basi.
|
|
14128
|
+
- Gate \`task complete\` tidak punya \`--force\`: perbaiki temuan di giliran yang sama,
|
|
14129
|
+
jangan lanjutkan task berikutnya.
|
|
14130
|
+
- Bila task sudah \`done\` tetapi ternyata partial: reopen dengan \`npx jioogen task start <ref>\`
|
|
14131
|
+
(history append-only), lengkapi item yang dilewati, \`task verify\`, lalu \`task complete\`
|
|
14132
|
+
lagi. Jangan cukup mencatat "partial" di note.
|
|
13872
14133
|
- Task \`layer: verification\` menjalankan semua \`verificationCommand\`, smoke test
|
|
13873
14134
|
route/navigasi, cek UI states + responsive, dan verifikasi AC.
|
|
13874
14135
|
|
|
@@ -13895,8 +14156,12 @@ menampilkan perintah itu sebagai pertanyaan ke user.
|
|
|
13895
14156
|
- Jangan menunda entrypoint/scaffold ke fase backend.
|
|
13896
14157
|
- Jangan mengganti ownership/consistency boundary tanpa memperbarui spec.
|
|
13897
14158
|
- Jangan menandai \`done\` sebelum verification exit 0.
|
|
13898
|
-
- **
|
|
13899
|
-
|
|
14159
|
+
- **Gate \`task complete\` tidak bisa dilewati.** Item breakdown belum tercentang,
|
|
14160
|
+
bukti verifikasi hilang/basi, design review UI hilang/gagal, dependency belum
|
|
14161
|
+
terverifikasi, atau kontrak berubah = perbaiki dulu di giliran yang sama.
|
|
14162
|
+
\`--force\`/\`--lenient\` tidak membuka gate ini.
|
|
14163
|
+
- **Jangan loop pada warning CLI non-gate.** Warning seperti ID task duplikat atau
|
|
14164
|
+
drift bukan BLOCKER: baca pesannya, tandai di note, lanjut.
|
|
13900
14165
|
Perintah CLI yang sama tidak boleh diulang demi hasil yang sama; kalau tetap
|
|
13901
14166
|
gagal setelah 1 ulangan, tandai \`fail\` + alasan singkat.
|
|
13902
14167
|
- **Project dihapus = dead end.** CLI sudah melepas link otomatis; jangan ulangi
|
|
@@ -13914,11 +14179,11 @@ Jangan menebak scope baru.
|
|
|
13914
14179
|
async function ensureCustomScaffold(root) {
|
|
13915
14180
|
const base = join11(root, ".jioogen", "custom");
|
|
13916
14181
|
for (const dir of CUSTOM_SCAFFOLD_DIRS) {
|
|
13917
|
-
await
|
|
14182
|
+
await mkdir9(join11(base, dir), { recursive: true });
|
|
13918
14183
|
}
|
|
13919
14184
|
const readme = join11(root, CUSTOM_SCAFFOLD_README_PATH);
|
|
13920
14185
|
if (await readFileSafe(readme) !== void 0) return [];
|
|
13921
|
-
await
|
|
14186
|
+
await writeFile9(readme, CUSTOM_SCAFFOLD_README, "utf8");
|
|
13922
14187
|
return [CUSTOM_SCAFFOLD_README_PATH];
|
|
13923
14188
|
}
|
|
13924
14189
|
async function readFileSafe(path) {
|
|
@@ -14028,8 +14293,8 @@ async function readHarnessManifest(bundleDir) {
|
|
|
14028
14293
|
}
|
|
14029
14294
|
async function writeHarnessManifest(bundleDir, manifest) {
|
|
14030
14295
|
const path = join11(resolve3(bundleDir), HARNESS_MANIFEST_PATH);
|
|
14031
|
-
await
|
|
14032
|
-
await
|
|
14296
|
+
await mkdir9(dirname8(path), { recursive: true });
|
|
14297
|
+
await writeFile9(path, `${JSON.stringify(manifest, null, 2)}
|
|
14033
14298
|
`, "utf8");
|
|
14034
14299
|
return path;
|
|
14035
14300
|
}
|
|
@@ -14060,7 +14325,7 @@ function packsForProduct(productKind, uiQuality = "auto") {
|
|
|
14060
14325
|
return packs;
|
|
14061
14326
|
}
|
|
14062
14327
|
function cliPackageRoot2() {
|
|
14063
|
-
return resolve3(
|
|
14328
|
+
return resolve3(dirname8(fileURLToPath2(import.meta.url)), "..");
|
|
14064
14329
|
}
|
|
14065
14330
|
function skillSourceCandidates(pack, name) {
|
|
14066
14331
|
const candidates = [];
|
|
@@ -14109,7 +14374,7 @@ async function hashSkillDirectory(directory) {
|
|
|
14109
14374
|
}
|
|
14110
14375
|
async function replaceDirectory(source, target) {
|
|
14111
14376
|
await rm7(target, { recursive: true, force: true });
|
|
14112
|
-
await
|
|
14377
|
+
await mkdir9(dirname8(target), { recursive: true });
|
|
14113
14378
|
await cp2(source, target, { recursive: true });
|
|
14114
14379
|
}
|
|
14115
14380
|
function packNamesInCanonicalOrder(names) {
|
|
@@ -14272,7 +14537,7 @@ async function ensureBundleGitignore(root) {
|
|
|
14272
14537
|
const path = join11(resolve3(root), ".gitignore");
|
|
14273
14538
|
const existing = await readFileSafe(path);
|
|
14274
14539
|
if (existing === void 0) {
|
|
14275
|
-
await
|
|
14540
|
+
await writeFile9(path, GITIGNORE_BLOCK, "utf8");
|
|
14276
14541
|
return ".gitignore";
|
|
14277
14542
|
}
|
|
14278
14543
|
const start = existing.indexOf(GITIGNORE_START);
|
|
@@ -14280,7 +14545,7 @@ async function ensureBundleGitignore(root) {
|
|
|
14280
14545
|
const next = start >= 0 && end > start ? `${existing.slice(0, start)}${GITIGNORE_BLOCK}${existing.slice(end + GITIGNORE_END.length).replace(/^\n/, "")}` : `${existing.replace(/\n*$/, "\n")}
|
|
14281
14546
|
${GITIGNORE_BLOCK}`;
|
|
14282
14547
|
if (next === existing) return null;
|
|
14283
|
-
await
|
|
14548
|
+
await writeFile9(path, next, "utf8");
|
|
14284
14549
|
return ".gitignore";
|
|
14285
14550
|
}
|
|
14286
14551
|
async function installAgentSkills(bundleDir, options = {}) {
|
|
@@ -14292,7 +14557,7 @@ async function installAgentSkills(bundleDir, options = {}) {
|
|
|
14292
14557
|
const agentsPath = join11(root, "AGENTS.md");
|
|
14293
14558
|
const existing = await readFileSafe(agentsPath);
|
|
14294
14559
|
if (existing === void 0 || existing.includes(MARKER_PREFIX)) {
|
|
14295
|
-
await
|
|
14560
|
+
await writeFile9(agentsPath, JIOOGEN_AGENTS_MD, "utf8");
|
|
14296
14561
|
written.push("AGENTS.md");
|
|
14297
14562
|
} else {
|
|
14298
14563
|
preserved.push("AGENTS.md");
|
|
@@ -14300,8 +14565,8 @@ async function installAgentSkills(bundleDir, options = {}) {
|
|
|
14300
14565
|
for (const dir of AGENT_SKILL_DIRS) {
|
|
14301
14566
|
const relative3 = `${dir}/${EXECUTION_SKILL_NAME}/SKILL.md`;
|
|
14302
14567
|
const target = join11(root, relative3);
|
|
14303
|
-
await
|
|
14304
|
-
await
|
|
14568
|
+
await mkdir9(dirname8(target), { recursive: true });
|
|
14569
|
+
await writeFile9(target, JIOOGEN_EXECUTION_SKILL, "utf8");
|
|
14305
14570
|
written.push(relative3);
|
|
14306
14571
|
}
|
|
14307
14572
|
const gitignore = await ensureBundleGitignore(root);
|
|
@@ -15460,8 +15725,8 @@ function isMissingFile7(error) {
|
|
|
15460
15725
|
|
|
15461
15726
|
// src/zip.ts
|
|
15462
15727
|
var import_adm_zip = __toESM(require_adm_zip(), 1);
|
|
15463
|
-
import { mkdir as
|
|
15464
|
-
import { dirname as
|
|
15728
|
+
import { mkdir as mkdir10, writeFile as writeFile10 } from "node:fs/promises";
|
|
15729
|
+
import { dirname as dirname9, resolve as resolve5, sep } from "node:path";
|
|
15465
15730
|
var IGNORED_PREFIXES = [
|
|
15466
15731
|
".git/",
|
|
15467
15732
|
"node_modules/",
|
|
@@ -15502,10 +15767,10 @@ async function extractBundle(bytes, targetDir) {
|
|
|
15502
15767
|
if (!destination.startsWith(`${root}${sep}`)) {
|
|
15503
15768
|
throw new Error(`Path bundle keluar dari direktori target: ${entry.entryName}`);
|
|
15504
15769
|
}
|
|
15505
|
-
await
|
|
15770
|
+
await mkdir10(dirname9(destination), { recursive: true });
|
|
15506
15771
|
const raw = entry.getData();
|
|
15507
15772
|
const data = relative3.endsWith(".md") ? Buffer.from(sanitizeMarkdown(raw.toString("utf8")), "utf8") : raw;
|
|
15508
|
-
await
|
|
15773
|
+
await writeFile10(destination, data);
|
|
15509
15774
|
written.push(relative3);
|
|
15510
15775
|
}
|
|
15511
15776
|
return written;
|
|
@@ -16410,55 +16675,18 @@ async function taskExpandCommand(ref, options) {
|
|
|
16410
16675
|
);
|
|
16411
16676
|
if (definition === void 0) throw new Error(`Task ${ref} tidak ditemukan.`);
|
|
16412
16677
|
const cap = /^\s*cap:\s*(CAP-[A-Z0-9-]+)/im.exec(definition.content)?.[1];
|
|
16413
|
-
const breakdown = buildTaskBreakdown(definition);
|
|
16414
|
-
const authored = breakdown.authored;
|
|
16415
|
-
const items = authored.length > 0 ? authored : breakdown.derived;
|
|
16416
|
-
if (items.length === 0) {
|
|
16417
|
-
console.log(
|
|
16418
|
-
`Task ${definition.id} belum punya metadata breakdown. Tambahkan \`subtasks\`, \`acceptance\`, atau \`targetFiles\`.`
|
|
16419
|
-
);
|
|
16420
|
-
return;
|
|
16421
|
-
}
|
|
16422
|
-
const prefix = authored.length > 0 ? "SUB" : "BD";
|
|
16423
|
-
const section3 = `## ${authored.length > 0 ? "Subtasks" : "Breakdown"}
|
|
16424
|
-
|
|
16425
|
-
${items.map((item, index) => `- [ ] ${prefix}-${String(index + 1).padStart(2, "0")} \u2014 ${item}`).join("\n")}
|
|
16426
|
-
`;
|
|
16427
16678
|
console.log(`Task ${definition.id} \u2014 ${definition.title}`);
|
|
16428
16679
|
if (cap !== void 0) console.log(`CAP: ${cap}`);
|
|
16429
|
-
console.log(
|
|
16680
|
+
console.log(renderBreakdownScaffold(definition));
|
|
16430
16681
|
if (options.write !== true) {
|
|
16431
16682
|
console.log(
|
|
16432
|
-
"Preview saja. Tambahkan `--write` untuk menyimpan checklist
|
|
16683
|
+
"Preview saja. Tambahkan `--write` untuk menyimpan checklist ke `.jioogen/breakdown/<ref>.md`."
|
|
16433
16684
|
);
|
|
16434
16685
|
return;
|
|
16435
16686
|
}
|
|
16436
|
-
|
|
16437
|
-
const path2 = join13(contractRoot(local.bundleDir), "tasks", definition.file);
|
|
16438
|
-
const current = await readFile12(path2, "utf8");
|
|
16439
|
-
const stripped = current.replace(/\n##\s+Subtasks\b[\s\S]*?(?=\n##\s|$)/i, "").replace(/\n{3,}/g, "\n\n");
|
|
16440
|
-
await writeFile10(path2, `${stripped.trimEnd()}
|
|
16441
|
-
|
|
16442
|
-
${section3}`, "utf8");
|
|
16443
|
-
console.log(
|
|
16444
|
-
`Ditulis ke tasks/${definition.file}. Parent task tetap satu; checklist tidak menambah task count.`
|
|
16445
|
-
);
|
|
16446
|
-
return;
|
|
16447
|
-
}
|
|
16448
|
-
const dir = join13(local.bundleDir, ".jioogen", "breakdown");
|
|
16449
|
-
const path = join13(dir, `${definition.id}.md`);
|
|
16450
|
-
await mkdir10(dir, { recursive: true });
|
|
16451
|
-
await writeFile10(
|
|
16452
|
-
path,
|
|
16453
|
-
`# Breakdown ${definition.id} \u2014 ${definition.title}
|
|
16454
|
-
|
|
16455
|
-
${section3}
|
|
16456
|
-
> Scaffold deterministik dari metadata task. Boleh ditambah detail, tapi item di atas tidak boleh dilewati.
|
|
16457
|
-
`,
|
|
16458
|
-
"utf8"
|
|
16459
|
-
);
|
|
16687
|
+
const path = await ensureBreakdownScaffold(local.bundleDir, definition);
|
|
16460
16688
|
console.log(
|
|
16461
|
-
`
|
|
16689
|
+
`Checklist siap di .jioogen/breakdown/${definition.id}.md (${path}). File kontrak tasks/*.md tidak disentuh; task count tidak berubah.`
|
|
16462
16690
|
);
|
|
16463
16691
|
}
|
|
16464
16692
|
async function taskStartCommand(ref, options) {
|
|
@@ -16485,8 +16713,8 @@ async function taskStartCommand(ref, options) {
|
|
|
16485
16713
|
const ledger = await readContractLedger(local.bundleDir);
|
|
16486
16714
|
const pinned = ledger?.server?.revision;
|
|
16487
16715
|
if (pinned !== void 0 && pinned !== null) updated.revision = pinned;
|
|
16488
|
-
await writeState(local.bundleDir, updated);
|
|
16489
16716
|
const definition = local.definitions.find((entry) => entry.id.toUpperCase() === key);
|
|
16717
|
+
await writeState(local.bundleDir, updated);
|
|
16490
16718
|
if (definition !== void 0) {
|
|
16491
16719
|
await captureTaskBaseline(local.bundleDir, definition).catch(() => {
|
|
16492
16720
|
});
|
|
@@ -16496,54 +16724,68 @@ async function taskStartCommand(ref, options) {
|
|
|
16496
16724
|
context: local
|
|
16497
16725
|
};
|
|
16498
16726
|
});
|
|
16727
|
+
const startedDefinition = context.definitions.find((entry) => entry.id.toUpperCase() === key);
|
|
16728
|
+
if (startedDefinition !== void 0) {
|
|
16729
|
+
await ensureBreakdownScaffold(context.bundleDir, startedDefinition);
|
|
16730
|
+
}
|
|
16499
16731
|
await pushSidecarBestEffort(options, context);
|
|
16500
|
-
console.log(
|
|
16732
|
+
console.log(
|
|
16733
|
+
`Started ${task?.ref ?? ref} (attempt ${task?.attempt ?? 1}). Checklist: .jioogen/breakdown/${task?.ref ?? ref}.md`
|
|
16734
|
+
);
|
|
16501
16735
|
}
|
|
16502
16736
|
async function finishTask(ref, options, extra = {}) {
|
|
16503
16737
|
return withLocalState(options, async (local) => {
|
|
16738
|
+
const adopted = extra.source !== void 0;
|
|
16504
16739
|
const resolvedState = await resolveOrAssertDependencies(
|
|
16505
16740
|
ref,
|
|
16506
16741
|
local.definitions,
|
|
16507
16742
|
local.state,
|
|
16508
16743
|
local.bundleDir,
|
|
16509
16744
|
options,
|
|
16510
|
-
"complete"
|
|
16745
|
+
"complete",
|
|
16746
|
+
adopted ? {} : { autoAdopt: false, allowForce: false }
|
|
16511
16747
|
);
|
|
16512
16748
|
const key = ref.trim().toUpperCase();
|
|
16513
16749
|
const definition = local.definitions.find((entry) => entry.id.toUpperCase() === key);
|
|
16514
|
-
|
|
16750
|
+
if (definition === void 0) {
|
|
16751
|
+
throw new Error(`Task ${ref} tidak ditemukan di bundle.`);
|
|
16752
|
+
}
|
|
16515
16753
|
const stateTask = resolvedState.tasks.find((entry) => entry.ref.toUpperCase() === key);
|
|
16516
|
-
if (
|
|
16517
|
-
|
|
16518
|
-
|
|
16519
|
-
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
const expectedCommand = normalizeVerificationCommand(verificationCommand);
|
|
16525
|
-
const commandMatches = proofCommand !== void 0 && (proofCommand === expectedCommand || options.lenient === true);
|
|
16526
|
-
if (proof === void 0 || proof.exitCode !== 0 || !commandMatches) {
|
|
16527
|
-
throw new Error(`Task ${ref} belum diverifikasi. Jalankan \`jioogen task verify ${ref}\`.`);
|
|
16528
|
-
}
|
|
16529
|
-
if (stateTask?.designReview?.passed === false) {
|
|
16530
|
-
throw new Error(
|
|
16531
|
-
`Task ${ref} punya design review yang gagal. Perbaiki lalu verifikasi ulang dengan \`jioogen task verify ${ref} --visual "<catatan>"\`.`
|
|
16532
|
-
);
|
|
16533
|
-
}
|
|
16534
|
-
} else {
|
|
16535
|
-
if (verificationCommand !== null) {
|
|
16754
|
+
if (adopted) {
|
|
16755
|
+
const verificationCommand = verificationCommandFromContent(definition.content);
|
|
16756
|
+
if (options.force !== true) {
|
|
16757
|
+
if (verificationCommand === null) {
|
|
16758
|
+
throw new Error(
|
|
16759
|
+
`Task ${ref} tidak punya verificationCommand. Gunakan --force untuk jalur legacy.`
|
|
16760
|
+
);
|
|
16761
|
+
}
|
|
16536
16762
|
const proof = stateTask?.verification;
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16763
|
+
if (proof === void 0 || proof.exitCode !== 0) {
|
|
16764
|
+
throw new Error(
|
|
16765
|
+
`Task ${ref} belum diverifikasi. Jalankan \`jioogen task adopt ${ref}\`.`
|
|
16766
|
+
);
|
|
16541
16767
|
}
|
|
16542
16768
|
if (stateTask?.designReview?.passed === false) {
|
|
16543
|
-
|
|
16769
|
+
throw new Error(
|
|
16770
|
+
`Task ${ref} punya design review yang gagal. Perbaiki lalu verifikasi ulang dengan \`jioogen task verify ${ref} --visual "<catatan>"\`.`
|
|
16771
|
+
);
|
|
16544
16772
|
}
|
|
16545
|
-
}
|
|
16546
|
-
|
|
16773
|
+
}
|
|
16774
|
+
} else {
|
|
16775
|
+
await ensureBreakdownScaffold(local.bundleDir, definition);
|
|
16776
|
+
const gate = await evaluateCompletionGate({
|
|
16777
|
+
bundleDir: local.bundleDir,
|
|
16778
|
+
definition,
|
|
16779
|
+
stateTask,
|
|
16780
|
+
definitions: local.definitions,
|
|
16781
|
+
state: resolvedState,
|
|
16782
|
+
lenient: options.lenient
|
|
16783
|
+
});
|
|
16784
|
+
if (!gate.ok) {
|
|
16785
|
+
if (options.force === true) {
|
|
16786
|
+
console.warn("Warning: --force tidak melewati gate completion task.");
|
|
16787
|
+
}
|
|
16788
|
+
throw new Error(formatCompletionGateFailure(ref, gate));
|
|
16547
16789
|
}
|
|
16548
16790
|
}
|
|
16549
16791
|
let completed = withStatus(resolvedState, ref, "done", {
|
|
@@ -17412,7 +17654,7 @@ function unmetDependencies(ref, definitions, states) {
|
|
|
17412
17654
|
(dependency) => byRef.get(dependency.toUpperCase())?.status !== "done"
|
|
17413
17655
|
);
|
|
17414
17656
|
}
|
|
17415
|
-
async function resolveOrAssertDependencies(ref, definitions, state, bundleDir, options, action) {
|
|
17657
|
+
async function resolveOrAssertDependencies(ref, definitions, state, bundleDir, options, action, policy = {}) {
|
|
17416
17658
|
const key = ref.toUpperCase();
|
|
17417
17659
|
const definition = definitions.find((task) => task.id.toUpperCase() === key);
|
|
17418
17660
|
if (definition === void 0) return state;
|
|
@@ -17423,7 +17665,7 @@ async function resolveOrAssertDependencies(ref, definitions, state, bundleDir, o
|
|
|
17423
17665
|
for (const depId of missing) {
|
|
17424
17666
|
const depDef = definitions.find((task) => task.id.toUpperCase() === depId.toUpperCase());
|
|
17425
17667
|
const filesExist = depDef !== void 0 ? await taskTargetFilesExist(bundleDir, depDef) : false;
|
|
17426
|
-
if (options.lenient === true || filesExist) {
|
|
17668
|
+
if (policy.autoAdopt !== false && (options.lenient === true || filesExist)) {
|
|
17427
17669
|
const reason = filesExist ? `target files terdeteksi di disk (diperlukan oleh ${ref})` : `auto-adopted via --lenient (diperlukan oleh ${ref})`;
|
|
17428
17670
|
currentState = withStatus(currentState, depId, "done", {
|
|
17429
17671
|
note: reason,
|
|
@@ -17442,10 +17684,11 @@ async function resolveOrAssertDependencies(ref, definitions, state, bundleDir, o
|
|
|
17442
17684
|
stillMissing.push(depId);
|
|
17443
17685
|
}
|
|
17444
17686
|
}
|
|
17445
|
-
if (stillMissing.length > 0 && options.force !== true) {
|
|
17687
|
+
if (stillMissing.length > 0 && (options.force !== true || policy.allowForce === false)) {
|
|
17446
17688
|
const verb = action === "start" ? "memulai" : action === "adopt" ? "mengadopsi" : "menyelesaikan";
|
|
17689
|
+
const hint = policy.allowForce === false ? "Dependency itu harus selesai lewat harness dan terverifikasi; `--force`/`--lenient` tidak berlaku untuk `task complete`." : "Selesaikan dependency itu lebih dulu, atau gunakan --lenient / --force bila disengaja.";
|
|
17447
17690
|
throw new Error(
|
|
17448
|
-
`Tidak bisa ${verb} ${ref}: dependency belum selesai (${stillMissing.join(", ")}).
|
|
17691
|
+
`Tidak bisa ${verb} ${ref}: dependency belum selesai (${stillMissing.join(", ")}). ${hint}`
|
|
17449
17692
|
);
|
|
17450
17693
|
}
|
|
17451
17694
|
return currentState;
|
|
@@ -17516,9 +17759,9 @@ async function scaffoldCustomLayer(bundleDir) {
|
|
|
17516
17759
|
const stackDir = join13(bundleDir, ".jioogen", "custom", "stack");
|
|
17517
17760
|
const knowledgeDir = join13(bundleDir, ".jioogen", "custom", "knowledge");
|
|
17518
17761
|
const designDir = join13(bundleDir, ".jioogen", "custom", "design");
|
|
17519
|
-
await
|
|
17520
|
-
await
|
|
17521
|
-
await
|
|
17762
|
+
await mkdir11(stackDir, { recursive: true });
|
|
17763
|
+
await mkdir11(knowledgeDir, { recursive: true });
|
|
17764
|
+
await mkdir11(designDir, { recursive: true });
|
|
17522
17765
|
const exampleFile = join13(stackDir, "STACK.md.example");
|
|
17523
17766
|
try {
|
|
17524
17767
|
await stat8(exampleFile);
|
|
@@ -17535,7 +17778,7 @@ async function scaffoldCustomLayer(bundleDir) {
|
|
|
17535
17778
|
"- Testing Runner: Vitest (bukan Jest)",
|
|
17536
17779
|
""
|
|
17537
17780
|
].join("\n");
|
|
17538
|
-
await
|
|
17781
|
+
await writeFile11(exampleFile, template, "utf8").catch(() => {
|
|
17539
17782
|
});
|
|
17540
17783
|
}
|
|
17541
17784
|
}
|
|
@@ -17757,7 +18000,7 @@ async function readLine() {
|
|
|
17757
18000
|
}
|
|
17758
18001
|
|
|
17759
18002
|
// src/index.ts
|
|
17760
|
-
var VERSION = "0.
|
|
18003
|
+
var VERSION = "0.3.0";
|
|
17761
18004
|
function parseTaskModeOption(value) {
|
|
17762
18005
|
if (value === void 0) return void 0;
|
|
17763
18006
|
const parsed = TaskModeSchema.safeParse(value);
|
|
@@ -17811,7 +18054,7 @@ Usage:
|
|
|
17811
18054
|
jioogen handoff [--project <id>] [--json]
|
|
17812
18055
|
jioogen task next [--json] [--lenient]
|
|
17813
18056
|
jioogen task start <ref> [--lenient]
|
|
17814
|
-
jioogen task complete <ref> [--note <text>] [--lenient]
|
|
18057
|
+
jioogen task complete <ref> [--note <text>] [--lenient]
|
|
17815
18058
|
jioogen task adopt <ref> [--note <text>] [--visual <catatan>] [--lenient] [--force]
|
|
17816
18059
|
jioogen task verify <ref> [--dir <dir>] [--json]
|
|
17817
18060
|
jioogen task expand <ref> [--write]
|