qaify-playwright-reporter 0.10.1 → 0.10.2

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/fix.js CHANGED
@@ -438,9 +438,11 @@ export async function fixSubmit(client, fixId, claudeOutput, patch, workDir, opt
438
438
  return send({
439
439
  status: 'failed',
440
440
  ...(usage ? { usage } : {}),
441
- reason: agentError
442
- ? `Agen AI gagal: ${agentError}`
443
- : 'Agen AI tidak menghasilkan hasil perbaikan terstruktur. Cek log step "Perbaiki dengan Claude Code" / "Perbaiki dengan Qaify Agent" di workflow perbaikan: secret CLAUDE_CODE_OAUTH_TOKEN dan kuota langganan, atau API key, saldo & model di Setelan → Agen AI, atau batas giliran.',
441
+ reason: usage?.error_code === 'ai_not_logged_in'
442
+ ? `Claude Code belum login di runner (${agentError ?? 'tanpa kredensial'}): secret CLAUDE_CODE_OAUTH_TOKEN di repo runner kosong atau kedaluwarsa. Jalankan \`claude setup-token\` lalu isi secret itu, atau pakai API key di Setelan → Agen AI.`
443
+ : agentError
444
+ ? `Agen AI gagal: ${agentError}`
445
+ : 'Agen AI tidak menghasilkan hasil perbaikan terstruktur. Cek log step "Perbaiki dengan Claude Code" / "Perbaiki dengan Qaify Agent" di workflow perbaikan: secret CLAUDE_CODE_OAUTH_TOKEN dan kuota langganan, atau API key, saldo & model di Setelan → Agen AI, atau batas giliran.',
444
446
  });
445
447
  }
446
448
  const stats = patchStats(patch);
package/dist/usage.d.ts CHANGED
@@ -14,7 +14,7 @@ export interface ClaudeUsage {
14
14
  /** claude_code | qaify_agent (reporter ≥ 0.10; output Qaify Agent membawa engine & provider) */
15
15
  engine?: string;
16
16
  provider?: string;
17
- /** ai_key_invalid | ai_credit_low | model_no_tools | max_turns | …: Qaify tidak mengeskalasi galat key / saldo */
17
+ /** ai_not_logged_in | ai_key_invalid | ai_credit_low | model_no_tools | max_turns | …: Qaify tidak mengeskalasi galat login / key / saldo */
18
18
  error_code?: string;
19
19
  }
20
20
  /** Dari objek hasil `claude -p` yang sudah di-parse; null bila tidak ada data pemakaian sama sekali. */
package/dist/usage.js CHANGED
@@ -2,6 +2,8 @@
2
2
  // Sisa kuota resmi langganan tidak ada di output ini; yang tercatat hanya pemakaian per panggilan + tanda kena limit.
3
3
  // "Claude AI usage limit reached|1762160400", "5-hour limit reached ∙ resets 3pm", "You've hit your limit · resets …"
4
4
  const LIMIT_PATTERN = /usage limit|limit reached|hit your (?:usage )?limit|rate[ _-]?limit|resets? (?:at )?\d/i;
5
+ // Claude Code tanpa kredensial (secret CLAUDE_CODE_OAUTH_TOKEN kosong) / token OAuth kedaluwarsa atau dicabut
6
+ const NOT_LOGGED_IN = /not logged in|please run \/login|oauth token (?:has )?(?:expired|been revoked)|invalid oauth/i;
5
7
  // API key (Claude Code + ANTHROPIC_API_KEY): key salah / saldo habis bukan limit langganan
6
8
  const KEY_INVALID = /invalid (?:x-)?api[ _-]?key|authentication_error|invalid bearer token|unauthorized/i;
7
9
  const CREDIT_LOW = /credit balance is too low|insufficient (?:credits|balance|quota)|billing/i;
@@ -25,7 +27,17 @@ export function parseClaudeUsage(parsed) {
25
27
  // modelUsage: { "<model-id>": {...} }; ambil model dengan token keluaran terbanyak
26
28
  const models = Object.entries((parsed.modelUsage ?? {}));
27
29
  const model = models.sort(([, a], [, b]) => (b.outputTokens ?? 0) - (a.outputTokens ?? 0))[0]?.[0] ?? null;
28
- const errorCode = typeof parsed.error_code === 'string' ? parsed.error_code : isError && KEY_INVALID.test(text) ? 'ai_key_invalid' : isError && CREDIT_LOW.test(text) ? 'ai_credit_low' : null;
30
+ const errorCode = typeof parsed.error_code === 'string'
31
+ ? parsed.error_code
32
+ : !isError
33
+ ? null
34
+ : NOT_LOGGED_IN.test(text)
35
+ ? 'ai_not_logged_in'
36
+ : KEY_INVALID.test(text)
37
+ ? 'ai_key_invalid'
38
+ : CREDIT_LOW.test(text)
39
+ ? 'ai_credit_low'
40
+ : null;
29
41
  return {
30
42
  model,
31
43
  input_tokens: Number(u?.input_tokens ?? 0) + Number(u?.cache_creation_input_tokens ?? 0) + Number(u?.cache_read_input_tokens ?? 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qaify-playwright-reporter",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Reporter Playwright untuk QA Factory (Qaify): kirim hasil test dan artefak ke /api/ingest, tanpa pernah menggagalkan test.",
5
5
  "license": "MIT",
6
6
  "author": "ahmdkenz",
@@ -100,6 +100,12 @@ jobs:
100
100
  MODEL: ${{ steps.ai.outputs.model || steps.ctx.outputs.model }}
101
101
  CI: 'true'
102
102
  run: |
103
+ # tanpa secret langganan dan tanpa API key: Claude Code pasti "Not logged in"; catat penyebabnya, jangan dipasang
104
+ if [ ! -f "$RUNNER_TEMP/qaify-ai.env" ] && [ -z "$CLAUDE_CODE_OAUTH_TOKEN" ]; then
105
+ echo '::error::Secret CLAUDE_CODE_OAUTH_TOKEN kosong di repo ini dan engineer tidak memakai API key. Jalankan "claude setup-token" lalu isi secret-nya, atau pakai API key di Qaify (Setelan, Agen AI).'
106
+ printf '%s' '{"type":"result","subtype":"error_qaify","is_error":true,"error_code":"ai_not_logged_in","result":"Not logged in (secret CLAUDE_CODE_OAUTH_TOKEN kosong)"}' > ../.qaify/claude.json
107
+ exit 1
108
+ fi
103
109
  npm install -g @anthropic-ai/claude-code
104
110
  # API key Anthropic dari Qaify menggantikan langganan
105
111
  if [ -f "$RUNNER_TEMP/qaify-ai.env" ]; then
@@ -100,6 +100,12 @@ jobs:
100
100
  CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
101
101
  MODEL: ${{ steps.ai.outputs.model || steps.ctx.outputs.model }}
102
102
  run: |
103
+ # tanpa secret langganan dan tanpa API key: Claude Code pasti "Not logged in"; catat penyebabnya, jangan dipasang
104
+ if [ ! -f "$RUNNER_TEMP/qaify-ai.env" ] && [ -z "$CLAUDE_CODE_OAUTH_TOKEN" ]; then
105
+ echo '::error::Secret CLAUDE_CODE_OAUTH_TOKEN kosong di repo runner ini dan engineer tidak memakai API key. Jalankan "claude setup-token" lalu isi secret-nya, atau pakai API key di Qaify (Setelan, Agen AI).'
106
+ printf '%s' '{"type":"result","subtype":"error_qaify","is_error":true,"error_code":"ai_not_logged_in","result":"Not logged in (secret CLAUDE_CODE_OAUTH_TOKEN kosong)"}' > ../.qaify/claude.json
107
+ exit 1
108
+ fi
103
109
  npm install -g @anthropic-ai/claude-code
104
110
  # API key Anthropic dari Qaify menggantikan langganan
105
111
  if [ -f "$RUNNER_TEMP/qaify-ai.env" ]; then