Skip to content

Commit 4a5608e

Browse files
hyperpolymathclaude
andcommitted
chore(v-ecosystem): move panic-attack V-lang API binding here
V-lang banned estate-wide 2026-04-10. panic_attack.v moved from hyperpolymath/panic-attack api/v/ per V-sources-MOVE-not-delete policy. MIGRATION.md explains replacement path (Zig FFI, planned). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent baac619 commit 4a5608e

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
3+
# panic-attack V-lang API — Migration Notice
4+
5+
`panic_attack.v` was moved here from `hyperpolymath/panic-attack` repository
6+
(`api/v/panic_attack.v`) as part of the V-lang → Zig migration (2026-04-10).
7+
8+
V-lang is banned estate-wide. This file is preserved in `v-ecosystem` per the
9+
V-sources-MOVE-not-delete policy.
10+
11+
**Replacement:** `hyperpolymath/panic-attack` `ffi/zig/src/panic_attack.zig`
12+
(Zig FFI binding with identical C ABI surface). Status: planned.
13+
14+
The V-lang binding exposed:
15+
- `Severity` enum (info/warning/error/critical)
16+
- `ScanOp` enum (assail/ambush/abduct/adjudicate/axial)
17+
- `Finding` struct (file, line, severity, message, rule_id)
18+
- C FFI procs: `panic_severity_compare`, `panic_severity_meets`, `panic_valid_lang`
19+
- Pub fns: `severity_meets()`, `is_supported_lang()`
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
//
4+
// panic-attack V-lang API — Static analysis scanner client.
5+
module panic_attack
6+
7+
pub enum Severity {
8+
info
9+
warning
10+
@error
11+
critical
12+
}
13+
14+
pub enum ScanOp {
15+
assail
16+
ambush
17+
abduct
18+
adjudicate
19+
axial
20+
}
21+
22+
pub struct Finding {
23+
pub:
24+
file string
25+
line int
26+
severity Severity
27+
message string
28+
rule_id string
29+
}
30+
31+
fn C.panic_severity_compare(a int, b int) int
32+
fn C.panic_severity_meets(severity int, threshold int) int
33+
fn C.panic_valid_lang(lang_id int) int
34+
35+
// severity_meets checks if a finding meets a minimum severity threshold.
36+
pub fn severity_meets(severity Severity, threshold Severity) bool {
37+
return C.panic_severity_meets(int(severity), int(threshold)) == 1
38+
}
39+
40+
// is_supported_lang checks if a language ID is supported (0-46).
41+
pub fn is_supported_lang(lang_id int) bool {
42+
return C.panic_valid_lang(lang_id) == 1
43+
}

0 commit comments

Comments
 (0)