Skip to content

Echo-aloha/asphalt-codex-skills-5 / skills/pfc5-fish

pfc5-fish

Verified

Author and audit PFC 5.0 FISH for asphalt cases, including def/end functions, globals and locals, callbacks, numbered histories, object traversal, command blocks, IO, and stop logic.

FileKindSize
SKILL.mdskill md2.2 KB
agents/openai.yamlconfig215 B
references/patterns.mdmarkdown3.0 KB
scripts/audit_pfc5_fish.pyscript2.4 KB

scripts/audit_pfc5_fish.py

View on GitHub
from __future__ import annotations

import argparse
import json
import re
from pathlib import Path


NEWER_MARKERS = [
    re.compile(r"\bfish\s+define\b", re.I),
    re.compile(r"\bfish\s+history\b", re.I),
    re.compile(r"^\s*model\s+history\b", re.I),
]


def audit(path: Path) -> list[dict[str, object]]:
    findings: list[dict[str, object]] = []
    function_stack: list[tuple[str, int]] = []
    command_depth = 0
    for line_no, raw in enumerate(path.read_text(encoding="utf-8-sig", errors="replace").splitlines(), 1):
        code = raw.split(";", 1)[0].strip()
        if not code:
            continue
        for pattern in NEWER_MARKERS:
            if pattern.search(code):
                findings.append({"line": line_no, "rule": "newer-major FISH marker", "text": raw.strip()})
        match = re.match(r"def(?:ine)?\s+([A-Za-z_][A-Za-z0-9_]*)\b", code, re.I)
        if match:
            function_stack.append((match.group(1), line_no))
        elif re.fullmatch(r"end", code, re.I):
            if function_stack:
                function_stack.pop()
            else:
                findings.append({"line": line_no, "rule": "unmatched function end", "text": raw.strip()})
        if re.fullmatch(r"command", code, re.I):
            command_depth += 1
        elif re.fullmatch(r"endcommand", code, re.I):
            command_depth -= 1
            if command_depth < 0:
                findings.append({"line": line_no, "rule": "unmatched endcommand", "text": raw.strip()})
                command_depth = 0
    for name, line_no in function_stack:
        findings.append({"line": line_no, "rule": f"unclosed function {name}", "text": ""})
    if command_depth:
        findings.append({"line": 0, "rule": "unclosed command block", "text": ""})
    return findings


def main() -> int:
    parser = argparse.ArgumentParser(description="Audit PFC5 FISH source structure")
    parser.add_argument("files", nargs="+", type=Path)
    args = parser.parse_args()
    report: dict[str, object] = {"syntax_family": "pfc5", "static_only": True, "files": {}}
    all_findings = 0
    for path in args.files:
        findings = audit(path)
        report["files"][str(path)] = findings  # type: ignore[index]
        all_findings += len(findings)
    report["ok"] = all_findings == 0
    print(json.dumps(report, ensure_ascii=False, indent=2))
    return 0 if all_findings == 0 else 1


if __name__ == "__main__":
    raise SystemExit(main())
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall