check-post 0.1.0 → 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.
Files changed (40) hide show
  1. package/README.md +66 -60
  2. package/dist/cli.js +18 -18
  3. package/dist/commands/init.js +37 -36
  4. package/dist/commands/list.js +1 -1
  5. package/dist/commands/run.js +8 -8
  6. package/dist/commands/shared.js +2 -2
  7. package/dist/commands/status.js +3 -3
  8. package/dist/core/adapters/claude-code.js +12 -12
  9. package/dist/core/adapters/index.js +2 -2
  10. package/dist/core/discovery.js +8 -8
  11. package/dist/core/gate.js +13 -13
  12. package/dist/core/process.js +2 -2
  13. package/dist/core/project.js +5 -5
  14. package/dist/core/runners/ai.js +9 -9
  15. package/dist/core/runners/command.js +3 -3
  16. package/dist/core/scheduler.js +11 -10
  17. package/dist/core/stage-file.js +4 -4
  18. package/dist/core/types.js +4 -2
  19. package/dist/ui/format.js +1 -1
  20. package/dist/ui/plain.js +2 -2
  21. package/dist/ui/tui/App.js +112 -50
  22. package/package.json +2 -2
  23. package/presets/angular/04-security/01-secrets.md +12 -12
  24. package/presets/angular/04-security/02-xss-audit.md +9 -9
  25. package/presets/angular/04-security/03-env-audit.md +7 -7
  26. package/presets/angular/04-security/_group.md +1 -1
  27. package/presets/angular/05-code-standard.md +8 -8
  28. package/presets/angular/context.md +2 -2
  29. package/presets/nextjs/04-security/01-secrets.md +12 -12
  30. package/presets/nextjs/04-security/02-xss-audit.md +8 -8
  31. package/presets/nextjs/04-security/03-env-audit.md +7 -7
  32. package/presets/nextjs/04-security/_group.md +1 -1
  33. package/presets/nextjs/05-code-standard.md +8 -8
  34. package/presets/nextjs/context.md +1 -1
  35. package/presets/node/04-security/01-secrets.md +12 -12
  36. package/presets/node/04-security/02-injection-audit.md +7 -7
  37. package/presets/node/04-security/03-env-audit.md +7 -7
  38. package/presets/node/04-security/_group.md +1 -1
  39. package/presets/node/05-code-standard.md +8 -8
  40. package/presets/node/context.md +1 -1
@@ -2,7 +2,7 @@ import { execa } from 'execa';
2
2
  import path from 'node:path';
3
3
  import { killTree } from '../process.js';
4
4
  const READ_TOOLS = ['Read', 'Grep', 'Glob'];
5
- /** Ubah glob sensitive_paths menjadi aturan permission deny Claude Code. */
5
+ /** Turn sensitive_paths globs into Claude Code permission deny rules. */
6
6
  export function denyRules(globs) {
7
7
  const rules = [];
8
8
  for (const glob of globs) {
@@ -16,11 +16,11 @@ function describeToolUse(name, input, cwd) {
16
16
  const rel = (p) => (typeof p === 'string' ? path.relative(cwd, p) || p : '');
17
17
  switch (name) {
18
18
  case 'Read':
19
- return `membaca ${rel(input.file_path)}`;
19
+ return `reading ${rel(input.file_path)}`;
20
20
  case 'Grep':
21
- return `mencari "${String(input.pattern ?? '')}"${input.path ? ` di ${rel(input.path)}` : ''}`;
21
+ return `searching "${String(input.pattern ?? '')}"${input.path ? ` in ${rel(input.path)}` : ''}`;
22
22
  case 'Glob':
23
- return `mencari file ${String(input.pattern ?? '')}`;
23
+ return `finding files ${String(input.pattern ?? '')}`;
24
24
  default:
25
25
  return name;
26
26
  }
@@ -51,8 +51,8 @@ export function createClaudeCodeAdapter(bin = 'claude') {
51
51
  '--permission-mode',
52
52
  'dontAsk',
53
53
  '--no-session-persistence',
54
- // Konteks seminimal mungkin: tanpa MCP, plugin, dan setting user. Ini menekan biaya
55
- // per stage dari dolar ke sen.
54
+ // Minimal context: no MCP servers, plugins, or user settings. This cuts the cost
55
+ // per stage from dollars to cents.
56
56
  '--strict-mcp-config',
57
57
  '--setting-sources',
58
58
  'project',
@@ -113,7 +113,7 @@ export function createClaudeCodeAdapter(bin = 'claude') {
113
113
  }
114
114
  }
115
115
  catch {
116
- /* stream ditutup paksa saat proses dihentikan */
116
+ /* stream closed when the process is killed */
117
117
  }
118
118
  const done = await child;
119
119
  clearTimeout(timer);
@@ -121,14 +121,14 @@ export function createClaudeCodeAdapter(bin = 'claude') {
121
121
  if (!final) {
122
122
  const stderr = Array.isArray(done.stderr) ? done.stderr.join('\n') : String(done.stderr ?? '');
123
123
  const reason = canceled
124
- ? 'dibatalkan'
124
+ ? 'cancelled'
125
125
  : timedOut
126
- ? `timeout setelah ${Math.round(o.timeoutMs / 1000)}s`
127
- : stderr.trim() || `claude keluar dengan kode ${done.exitCode}`;
128
- throw new Error(`Claude Code gagal: ${reason}`);
126
+ ? `timed out after ${Math.round(o.timeoutMs / 1000)}s`
127
+ : stderr.trim() || `claude exited with code ${done.exitCode}`;
128
+ throw new Error(`Claude Code failed: ${reason}`);
129
129
  }
130
130
  if (final.is_error) {
131
- throw new Error(`Claude Code error: ${String(final.result ?? final.subtype ?? 'tidak diketahui')}`);
131
+ throw new Error(`Claude Code error: ${String(final.result ?? final.subtype ?? 'unknown')}`);
132
132
  }
133
133
  const denials = final.permission_denials ?? [];
134
134
  return {
@@ -7,8 +7,8 @@ export const AGENTS = {
7
7
  export function getAdapter(id) {
8
8
  const agent = AGENTS[id];
9
9
  if (!agent)
10
- throw new Error(`Agent "${id}" tidak dikenal. Pilihan: ${Object.keys(AGENTS).join(', ')}`);
10
+ throw new Error(`Unknown agent "${id}". Options: ${Object.keys(AGENTS).join(', ')}`);
11
11
  if (!agent.create)
12
- throw new Error(`Agent "${agent.label}" belum didukung. Gunakan claude-code untuk saat ini.`);
12
+ throw new Error(`Agent "${agent.label}" is not supported yet. Use claude-code for now.`);
13
13
  return agent.create();
14
14
  }
@@ -28,7 +28,7 @@ function listEntries(dir, isRoot) {
28
28
  if (fsName.startsWith('.'))
29
29
  continue;
30
30
  if (fsName.startsWith('_'))
31
- continue; // termasuk _group.md, dibaca terpisah
31
+ continue; // includes _group.md, which is read separately
32
32
  if (isRoot && fsName === PIPELINE_FILE)
33
33
  continue;
34
34
  const full = path.join(dir, fsName);
@@ -42,7 +42,7 @@ function listEntries(dir, isRoot) {
42
42
  export function discoverPipeline(root, dirName = PIPELINE_DIR) {
43
43
  const dir = path.join(root, dirName);
44
44
  if (!existsSync(dir) || !statSync(dir).isDirectory()) {
45
- throw new DefinitionError([`Folder ${dirName}/ tidak ditemukan di ${root}. Jalankan "checkpost init" dulu.`]);
45
+ throw new DefinitionError([`Folder ${dirName}/ not found in ${root}. Run "checkpost init" first.`]);
46
46
  }
47
47
  const problems = [];
48
48
  const rel = (p) => path.relative(root, p);
@@ -72,7 +72,7 @@ export function discoverPipeline(root, dirName = PIPELINE_DIR) {
72
72
  continue;
73
73
  const other = seen.get(e.prefix);
74
74
  if (other)
75
- problems.push(`${rel(current) || '.'}: prefix ${e.prefix} dipakai dua kali (${other} dan ${e.fsName})`);
75
+ problems.push(`${rel(current) || '.'}: prefix ${e.prefix} is used twice (${other} and ${e.fsName})`);
76
76
  else
77
77
  seen.set(e.prefix, e.fsName);
78
78
  }
@@ -101,7 +101,7 @@ export function discoverPipeline(root, dirName = PIPELINE_DIR) {
101
101
  continue;
102
102
  const children = walk(e.full, groupContext, false);
103
103
  if (children.length === 0) {
104
- problems.push(`${rel(e.full)}/: grup kosong (tidak ada stage .md yang aktif)`);
104
+ problems.push(`${rel(e.full)}/: empty group (no enabled .md stages)`);
105
105
  continue;
106
106
  }
107
107
  const group = {
@@ -122,7 +122,7 @@ export function discoverPipeline(root, dirName = PIPELINE_DIR) {
122
122
  continue;
123
123
  const type = stageTypeOf(data.run, body);
124
124
  if (!type) {
125
- problems.push(`${rel(e.full)}: stage kosong. Isi "run:" di frontmatter, instruksi AI di body, atau keduanya.`);
125
+ problems.push(`${rel(e.full)}: empty stage. Add "run:" to the frontmatter, AI instructions to the body, or both.`);
126
126
  continue;
127
127
  }
128
128
  const stage = {
@@ -148,13 +148,13 @@ export function discoverPipeline(root, dirName = PIPELINE_DIR) {
148
148
  };
149
149
  const children = walk(dir, rootContext, true);
150
150
  if (problems.length === 0 && children.length === 0) {
151
- problems.push(`${dirName}/: belum ada stage. Tambahkan file seperti 01-build.md.`);
151
+ problems.push(`${dirName}/: no stages yet. Add a file such as 01-build.md.`);
152
152
  }
153
153
  if (problems.length)
154
154
  throw new DefinitionError(problems);
155
155
  return { root, dir, config: pipelineConfig, children };
156
156
  }
157
- /** Semua stage dalam urutan tampil, beserta kedalamannya. */
157
+ /** Every node in display order, with its depth. */
158
158
  export function flatten(nodes, depth = 0) {
159
159
  const out = [];
160
160
  for (const node of nodes) {
@@ -169,7 +169,7 @@ export function allStages(nodes) {
169
169
  .map((x) => x.node)
170
170
  .filter((n) => n.kind === 'stage');
171
171
  }
172
- /** Cari node berdasarkan id persis, id tanpa prefix, atau nama. */
172
+ /** Find a node by exact id, id without prefixes, or name. */
173
173
  export function findNode(nodes, query) {
174
174
  const q = query.replace(/\.md$/i, '').replace(/\/+$/, '');
175
175
  const all = flatten(nodes).map((x) => x.node);
package/dist/core/gate.js CHANGED
@@ -6,7 +6,7 @@ import { allStages } from './discovery.js';
6
6
  import { isBlockingFailure } from './scheduler.js';
7
7
  export const STATE_DIR = '.checkpost';
8
8
  const LAST_RUN = 'last-run.json';
9
- /** Path milik checkpost sendiri tidak dihitung sebagai perubahan project. */
9
+ /** checkpost's own paths do not count as project changes. */
10
10
  const isOwnPath = (file) => file.startsWith(`${STATE_DIR}/`) || file.startsWith('checkpost/') || file === '.claude/commands/checkpost.md';
11
11
  export async function readGitState(cwd) {
12
12
  try {
@@ -18,7 +18,7 @@ export async function readGitState(cwd) {
18
18
  return { isRepo: false, sha: null, branch: null, dirtyFiles: [] };
19
19
  }
20
20
  const sha = await execa('git', ['rev-parse', 'HEAD'], { cwd, reject: false });
21
- // symbolic-ref juga bekerja di repo yang belum punya commit (rev-parse HEAD gagal di sana).
21
+ // symbolic-ref also works in a repo with no commits (rev-parse HEAD fails there).
22
22
  const branch = await execa('git', ['symbolic-ref', '--short', '-q', 'HEAD'], { cwd, reject: false });
23
23
  const status = await execa('git', ['status', '--porcelain', '--untracked-files=all'], { cwd });
24
24
  const dirtyFiles = status.stdout
@@ -33,7 +33,7 @@ export async function readGitState(cwd) {
33
33
  dirtyFiles,
34
34
  };
35
35
  }
36
- /** Hash dari seluruh definisi stage, supaya edit file .md membatalkan hasil lama. */
36
+ /** Hash of every stage definition, so editing a .md file invalidates old results. */
37
37
  export function definitionsHash(pipeline) {
38
38
  const h = createHash('sha256');
39
39
  h.update(JSON.stringify(pipeline.config));
@@ -58,8 +58,8 @@ export function readLastRun(root) {
58
58
  }
59
59
  }
60
60
  /**
61
- * Simpan hasil run. Run parsial (satu stage/grup) digabung dengan hasil sebelumnya
62
- * selama commit dan definisi stage masih sama.
61
+ * Save run results. A partial run (one stage/group) is merged into the previous results
62
+ * as long as the commit and stage definitions are unchanged.
63
63
  */
64
64
  export function saveRun(pipeline, git, results, partial) {
65
65
  const hash = definitionsHash(pipeline);
@@ -83,29 +83,29 @@ export async function evaluateGate(pipeline) {
83
83
  const lastRun = readLastRun(pipeline.root);
84
84
  const reasons = [];
85
85
  if (!lastRun) {
86
- reasons.push('pipeline belum pernah dijalankan');
86
+ reasons.push('pipeline has never been run');
87
87
  return { green: false, reasons, lastRun, git };
88
88
  }
89
89
  if (git.isRepo && lastRun.sha !== git.sha) {
90
- reasons.push(`hasil terakhir untuk commit ${lastRun.sha?.slice(0, 7) ?? '?'}, HEAD sekarang ${git.sha?.slice(0, 7) ?? '?'}`);
90
+ reasons.push(`last results are for commit ${lastRun.sha?.slice(0, 7) ?? '?'}, HEAD is now ${git.sha?.slice(0, 7) ?? '?'}`);
91
91
  }
92
92
  if (lastRun.definitionsHash !== definitionsHash(pipeline)) {
93
- reasons.push('definisi stage berubah sejak run terakhir');
93
+ reasons.push('stage definitions changed since the last run');
94
94
  }
95
95
  if (pipeline.config.require_clean_tree && git.isRepo) {
96
96
  if (git.dirtyFiles.length)
97
- reasons.push(`working tree kotor (${git.dirtyFiles.length} file belum di-commit)`);
97
+ reasons.push(`working tree is dirty (${git.dirtyFiles.length} uncommitted file${git.dirtyFiles.length === 1 ? '' : 's'})`);
98
98
  else if (lastRun.dirtyAtRun.length)
99
- reasons.push('run terakhir dilakukan saat working tree kotor');
99
+ reasons.push('the last run happened on a dirty working tree');
100
100
  }
101
101
  for (const stage of allStages(pipeline.children)) {
102
102
  const r = lastRun.results[stage.id];
103
103
  if (!r)
104
- reasons.push(`stage ${stage.id} belum dijalankan`);
104
+ reasons.push(`stage ${stage.id} has not run`);
105
105
  else if (isBlockingFailure(r))
106
- reasons.push(`stage ${stage.id} ${r.status === 'error' ? 'error' : 'gagal'}`);
106
+ reasons.push(`stage ${stage.id} ${r.status === 'error' ? 'errored' : 'failed'}`);
107
107
  else if (r.status === 'skipped' || r.status === 'pending' || r.status === 'running')
108
- reasons.push(`stage ${stage.id} tidak selesai (${r.status})`);
108
+ reasons.push(`stage ${stage.id} did not finish (${r.status})`);
109
109
  }
110
110
  return { green: reasons.length === 0, reasons, lastRun, git };
111
111
  }
@@ -1,4 +1,4 @@
1
- /** Hentikan seluruh process group (SIGTERM, lalu SIGKILL bila masih hidup). */
1
+ /** Stop a whole process group (SIGTERM, then SIGKILL if still alive). */
2
2
  export function killTree(pid, graceMs = 3000) {
3
3
  if (!pid)
4
4
  return;
@@ -11,7 +11,7 @@ export function killTree(pid, graceMs = 3000) {
11
11
  process.kill(pid, signal);
12
12
  }
13
13
  catch {
14
- /* sudah mati */
14
+ /* already dead */
15
15
  }
16
16
  }
17
17
  };
@@ -12,7 +12,7 @@ export function detectProject(root) {
12
12
  deps = { ...pkg.dependencies, ...pkg.devDependencies };
13
13
  }
14
14
  catch {
15
- /* package.json rusak: perlakukan sebagai project tanpa script */
15
+ /* broken package.json: treat as a project without scripts */
16
16
  }
17
17
  }
18
18
  const docs = ['AGENTS.md', 'CLAUDE.md', '.claude/CLAUDE.md', 'CONTRIBUTING.md'].filter((f) => existsSync(path.join(root, f)));
@@ -25,9 +25,9 @@ export function detectProject(root) {
25
25
  }
26
26
  if (existsSync(pkgFile))
27
27
  return { kind: 'node', label: 'Node.js', scripts, docs };
28
- return { kind: 'unknown', label: 'tidak dikenali', scripts, docs };
28
+ return { kind: 'unknown', label: 'unknown', scripts, docs };
29
29
  }
30
- /** Script npm yang dibutuhkan sebuah perintah `run`, atau null bila bukan perintah npm. */
30
+ /** npm script required by a `run` command, or null if it is not an npm command. */
31
31
  export function npmScriptOf(run) {
32
32
  const m = run.trim().match(/^npm\s+(?:run(?:-script)?\s+([\w:.-]+)|(test|start))\b/);
33
33
  return m ? (m[1] ?? m[2]) : null;
@@ -41,8 +41,8 @@ export async function isIgnored(root, rel) {
41
41
  return res.exitCode === 0;
42
42
  }
43
43
  /**
44
- * Tambahkan pola ke `.git/info/exclude` (hanya lokal) atau `.gitignore` (dibagikan),
45
- * hanya bila belum diabaikan git.
44
+ * Add patterns to `.git/info/exclude` (local only) or `.gitignore` (shared),
45
+ * only when git does not already ignore them.
46
46
  */
47
47
  export async function ignorePaths(root, patterns, where) {
48
48
  const added = [];
@@ -1,15 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import { AiVerdictSchema, SEVERITIES, severityRank } from '../types.js';
3
3
  /**
4
- * JSON Schema yang dikirim ke AI; harus sejalan dengan AiVerdictSchema.
5
- * Field `$schema` dibuang karena Claude Code menolak referensi draft 2020-12.
4
+ * JSON Schema sent to the AI; must stay in sync with AiVerdictSchema.
5
+ * The `$schema` key is dropped because Claude Code rejects the draft 2020-12 reference.
6
6
  */
7
7
  export const VERDICT_JSON_SCHEMA = (() => {
8
8
  const { $schema: _ignored, ...schema } = z.toJSONSchema(AiVerdictSchema);
9
9
  return schema;
10
10
  })();
11
11
  const MAX_COMMAND_OUTPUT_CHARS = 30_000;
12
- export function buildSystemPrompt(sensitivePaths) {
12
+ export function buildSystemPrompt(sensitivePaths, language = 'English') {
13
13
  return [
14
14
  'You are an automated stage in a local CI pipeline. You audit a software project and report findings.',
15
15
  'Rules:',
@@ -21,7 +21,7 @@ export function buildSystemPrompt(sensitivePaths) {
21
21
  '- Severity scale: critical (exploitable now / leaked secret), high (likely exploitable or serious bug), ' +
22
22
  'medium (should be fixed soon), low (minor / hardening), info (observation, not a problem).',
23
23
  '- If nothing is wrong, return an empty findings array.',
24
- '- Write summary, message and suggestion in the same language as the stage instructions.',
24
+ `- Write summary, message and suggestion in ${language}, regardless of the language of the code or instructions.`,
25
25
  '- Your final answer MUST be the structured output object: { summary, findings[] }.',
26
26
  ].join('\n');
27
27
  }
@@ -35,7 +35,7 @@ export function buildStagePrompt(stage, command) {
35
35
  }
36
36
  if (command) {
37
37
  const out = command.output.length > MAX_COMMAND_OUTPUT_CHARS
38
- ? '[... output awal dipotong ...]\n' + command.output.slice(-MAX_COMMAND_OUTPUT_CHARS)
38
+ ? '[... earlier output truncated ...]\n' + command.output.slice(-MAX_COMMAND_OUTPUT_CHARS)
39
39
  : command.output;
40
40
  parts.push('## Command result', `Command: \`${command.run}\``, `Exit code: ${command.exitCode ?? 'unknown'}`, 'Output:', '```', out.trimEnd(), '```', 'Review this command result according to the stage instructions below. If the command failed because of a real problem, report it as a finding.');
41
41
  }
@@ -48,9 +48,9 @@ export function isBlocking(finding, failOn) {
48
48
  export function sortFindings(findings) {
49
49
  return [...findings].sort((a, b) => severityRank(a.severity) - severityRank(b.severity));
50
50
  }
51
- /** Jalankan stage AI; minta ulang sekali bila jawaban tidak sesuai schema. */
51
+ /** Run an AI stage; ask again once if the answer does not match the schema. */
52
52
  export async function runAiStage(adapter, stage, opts) {
53
- const systemPrompt = buildSystemPrompt(opts.sensitivePaths);
53
+ const systemPrompt = buildSystemPrompt(opts.sensitivePaths, opts.language);
54
54
  let prompt = buildStagePrompt(stage, opts.command);
55
55
  let cost = 0;
56
56
  const denied = [];
@@ -82,10 +82,10 @@ export async function runAiStage(adapter, stage, opts) {
82
82
  if (parsed.success) {
83
83
  return { verdict: { ...parsed.data, findings: sortFindings(parsed.data.findings) }, costUsd: cost, deniedReads: denied };
84
84
  }
85
- opts.onLog(`[AI] jawaban tidak sesuai format (percobaan ${attempt}/2)`);
85
+ opts.onLog(`[AI] answer did not match the required format (attempt ${attempt}/2)`);
86
86
  prompt =
87
87
  buildStagePrompt(stage, opts.command) +
88
88
  `\n\nIMPORTANT: your previous answer was not valid. Return ONLY the structured object with "summary" and "findings" (severity one of ${SEVERITIES.join(', ')}).`;
89
89
  }
90
- throw new Error('AI tidak mengembalikan jawaban dengan format yang valid setelah 2 percobaan');
90
+ throw new Error('AI did not return a validly formatted answer after 2 attempts');
91
91
  }
@@ -2,8 +2,8 @@ import { execa } from 'execa';
2
2
  import { killTree } from '../process.js';
3
3
  const MAX_KEPT_OUTPUT = 200_000;
4
4
  export async function runCommand(command, opts) {
5
- // detached: proses jadi pemimpin process group, sehingga timeout/batal bisa menghentikan
6
- // seluruh turunannya (mis. `ng test` yang memanggil browser), bukan hanya shell-nya.
5
+ // detached: the process leads its own process group, so a timeout or cancel can stop
6
+ // every descendant (e.g. `ng test` spawning a browser), not just the shell.
7
7
  const child = execa(command, {
8
8
  shell: true,
9
9
  cwd: opts.cwd,
@@ -39,7 +39,7 @@ export async function runCommand(command, opts) {
39
39
  }
40
40
  }
41
41
  catch {
42
- /* stream ditutup paksa saat proses dihentikan */
42
+ /* stream closed when the process is killed */
43
43
  }
44
44
  const done = await child;
45
45
  clearTimeout(timer);
@@ -3,11 +3,11 @@ import path from 'node:path';
3
3
  import { runAiStage, isBlocking } from './runners/ai.js';
4
4
  import { runCommand } from './runners/command.js';
5
5
  import { parseDuration } from './stage-file.js';
6
- // Sama dengan STATE_DIR di gate.ts (tidak diimpor untuk menghindari import melingkar).
6
+ // Same as STATE_DIR in gate.ts (not imported, to avoid a circular import).
7
7
  const STATE_DIR_NAME = '.checkpost';
8
8
  const DEFAULT_COMMAND_TIMEOUT_MS = 15 * 60_000;
9
9
  const DEFAULT_AI_TIMEOUT_MS = 10 * 60_000;
10
- /** Stage/grup dianggap menghalangi pipeline bila gagal dan tidak allow_failure. */
10
+ /** A stage/group blocks the pipeline when it failed and is not allow_failure. */
11
11
  export const isBlockingFailure = (r) => (r.status === 'failed' || r.status === 'error') && !r.allowFailure;
12
12
  function stagesIn(node) {
13
13
  return node.kind === 'stage' ? [node] : node.children.flatMap(stagesIn);
@@ -67,7 +67,7 @@ export async function runPipeline(pipeline, opts) {
67
67
  onLine: emit,
68
68
  });
69
69
  if (res.canceled)
70
- return finish({ status: 'skipped', summary: 'dibatalkan', exitCode: res.exitCode });
70
+ return finish({ status: 'skipped', summary: 'cancelled', exitCode: res.exitCode });
71
71
  if (res.timedOut)
72
72
  return finish({ status: 'error', error: 'timeout', exitCode: res.exitCode });
73
73
  if (stage.type === 'command') {
@@ -78,13 +78,14 @@ export async function runPipeline(pipeline, opts) {
78
78
  });
79
79
  }
80
80
  command = { run, exitCode: res.exitCode, output: res.output };
81
- emit(`[AI] meninjau hasil perintah (exit code ${res.exitCode})…`);
81
+ emit(`[AI] reviewing the command result (exit code ${res.exitCode})…`);
82
82
  }
83
83
  if (!opts.adapter)
84
- throw new Error('Stage AI butuh agent, tetapi agent tidak tersedia');
84
+ throw new Error('AI stage needs an agent, but none is available');
85
85
  const outcome = await runAiStage(opts.adapter, stage, {
86
86
  cwd: pipeline.root,
87
87
  model: pipeline.config.model,
88
+ language: pipeline.config.language,
88
89
  sensitivePaths: pipeline.config.sensitive_paths,
89
90
  maxBudgetUsd: pipeline.config.max_budget_usd,
90
91
  timeoutMs: parseDuration(stage.config.timeout, DEFAULT_AI_TIMEOUT_MS),
@@ -93,7 +94,7 @@ export async function runPipeline(pipeline, opts) {
93
94
  command,
94
95
  });
95
96
  for (const denied of outcome.deniedReads)
96
- emit(`[AI] akses diblokir: ${denied}`);
97
+ emit(`[AI] access blocked: ${denied}`);
97
98
  const blocking = outcome.verdict.findings.filter((f) => isBlocking(f, stage.config.fail_on));
98
99
  emit(`[AI] ${outcome.verdict.summary}`);
99
100
  return finish({
@@ -106,13 +107,13 @@ export async function runPipeline(pipeline, opts) {
106
107
  }
107
108
  catch (err) {
108
109
  if (opts.signal?.aborted)
109
- return finish({ status: 'skipped', summary: 'dibatalkan' });
110
+ return finish({ status: 'skipped', summary: 'cancelled' });
110
111
  const message = err.message;
111
112
  emit(`ERROR: ${message}`);
112
113
  return finish({ status: 'error', error: message });
113
114
  }
114
115
  };
115
- /** Mengembalikan true bila node berakhir dengan kegagalan yang menghalangi. */
116
+ /** Returns true when the node ended in a blocking failure. */
116
117
  const runNode = async (node, failFast) => {
117
118
  if (node.kind === 'stage')
118
119
  return isBlockingFailure(await runStage(node));
@@ -136,13 +137,13 @@ export async function runPipeline(pipeline, opts) {
136
137
  let failed = false;
137
138
  for (let i = 0; i < nodes.length; i++) {
138
139
  if (opts.signal?.aborted) {
139
- skip(nodes.slice(i), 'dibatalkan');
140
+ skip(nodes.slice(i), 'cancelled');
140
141
  break;
141
142
  }
142
143
  if (await runNode(nodes[i], failFast)) {
143
144
  failed = true;
144
145
  if (failFast) {
145
- skip(nodes.slice(i + 1), 'dilewati: stage sebelumnya gagal');
146
+ skip(nodes.slice(i + 1), 'skipped: an earlier stage failed');
146
147
  break;
147
148
  }
148
149
  }
@@ -7,15 +7,15 @@ export class DefinitionError extends Error {
7
7
  this.name = 'DefinitionError';
8
8
  }
9
9
  }
10
- /** Parse frontmatter YAML + body Markdown, lalu validasi frontmatter dengan schema. */
10
+ /** Parse YAML frontmatter + Markdown body, then validate the frontmatter against a schema. */
11
11
  export function parseMarkdown(source, schema, fileLabel) {
12
12
  let parsed;
13
13
  try {
14
- // Tanpa cache: gray-matter meng-cache berdasarkan isi string, yang mengacaukan test.
14
+ // No cache: gray-matter caches by input string, which breaks tests.
15
15
  parsed = matter(source, {});
16
16
  }
17
17
  catch (err) {
18
- throw new DefinitionError([`${fileLabel}: frontmatter YAML tidak valid (${err.message})`]);
18
+ throw new DefinitionError([`${fileLabel}: invalid YAML frontmatter (${err.message})`]);
19
19
  }
20
20
  const result = schema.safeParse(parsed.data ?? {});
21
21
  if (!result.success) {
@@ -38,7 +38,7 @@ export function stageTypeOf(run, body) {
38
38
  return 'ai';
39
39
  return null;
40
40
  }
41
- /** Ubah `30s`, `5m`, `1h`, `500ms`, atau angka (detik) menjadi milidetik. */
41
+ /** Convert `30s`, `5m`, `1h`, `500ms`, or a number (seconds) to milliseconds. */
42
42
  export function parseDuration(value, fallbackMs) {
43
43
  if (value === undefined)
44
44
  return fallbackMs;
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  export const SEVERITIES = ['critical', 'high', 'medium', 'low', 'info'];
3
- /** Peringkat severity: angka lebih kecil = lebih parah. */
3
+ /** Severity rank: lower number = more severe. */
4
4
  export const severityRank = (s) => SEVERITIES.indexOf(s);
5
5
  const duration = z.union([z.number().positive(), z.string().regex(/^\d+(\.\d+)?\s*(ms|s|m|h)?$/)]);
6
6
  export const StageConfigSchema = z
7
7
  .object({
8
8
  name: z.string().optional(),
9
- // YAML membaca `run: true` atau `run: 123` sebagai boolean/angka; perlakukan sebagai perintah.
9
+ // YAML reads `run: true` or `run: 123` as a boolean/number; treat it as a command.
10
10
  run: z.union([z.string(), z.number(), z.boolean()]).transform(String).optional(),
11
11
  timeout: duration.optional(),
12
12
  fail_on: z.enum(SEVERITIES).default('high'),
@@ -42,6 +42,8 @@ export const PipelineConfigSchema = z
42
42
  name: z.string().optional(),
43
43
  agent: z.string().default('claude-code'),
44
44
  model: z.string().default('sonnet'),
45
+ /** Language for AI summaries and findings, e.g. English or Indonesian. */
46
+ language: z.string().min(1).default('English'),
45
47
  fail_fast: z.boolean().default(true),
46
48
  require_clean_tree: z.boolean().default(true),
47
49
  sensitive_paths: z.array(z.string()).default([]),
package/dist/ui/format.js CHANGED
@@ -32,7 +32,7 @@ export function formatDuration(ms) {
32
32
  }
33
33
  export function typeLabel(node) {
34
34
  if (node.kind === 'group')
35
- return node.config.parallel ? 'grup paralel' : 'grup';
35
+ return node.config.parallel ? 'parallel group' : 'group';
36
36
  if (node.type === 'ai')
37
37
  return 'AI';
38
38
  if (node.type === 'command+ai')
package/dist/ui/plain.js CHANGED
@@ -2,7 +2,7 @@ import pc from 'picocolors';
2
2
  import { isBlocking } from '../core/runners/ai.js';
3
3
  import { formatDuration, findingLocation } from './format.js';
4
4
  const colorBySeverity = { critical: pc.magenta, high: pc.red, medium: pc.yellow, low: pc.cyan, info: pc.gray };
5
- /** Renderer untuk CI / non-TTY: satu baris per kejadian, log stage diberi prefix. */
5
+ /** Renderer for CI / non-TTY: one line per event, stage logs prefixed. */
6
6
  export function createPlainRenderer(stages, opts) {
7
7
  const write = opts.write ?? ((s) => process.stdout.write(s + '\n'));
8
8
  return (e) => {
@@ -23,7 +23,7 @@ export function createPlainRenderer(stages, opts) {
23
23
  if (r.status === 'passed')
24
24
  write(pc.green(`✔ ${label}`));
25
25
  else if (r.status === 'skipped')
26
- write(pc.gray(`– ${e.id} (${r.summary ?? 'dilewati'})`));
26
+ write(pc.gray(`– ${e.id} (${r.summary ?? 'skipped'})`));
27
27
  else {
28
28
  const tag = r.allowFailure ? pc.yellow(' [allow_failure]') : '';
29
29
  write(pc.red(`✖ ${label}`) + tag + (r.error ? pc.red(` · ${r.error}`) : r.summary ? pc.dim(` · ${r.summary}`) : ''));