feat(seedgo): DPLAN-0056 Phase 2 + 100% compliance — JSON self-compliance, checker fixes, bypass guidance (#63)

Phase 2 (FPLAN-0065): Wire json_handler into all 66 seedgo modules/handlers.
json_handler.py updated to inline defaults (no template dependency).
json_templates/ archived. seedgo_json/ auto-populates on audit.

100% compliance push: architecture (docs/dropbox dirs), introspection
(readme_update no-args gate), log_structure (branch root detection +
directory checks fix), readme (date, checklist, commands section),
stderr_routing (bypass false positives in doc strings).

New: bypass_content.py — queryable guidance on when/how to use bypasses.
Updated json_structure standard with dependency-free handler rule + valid
bypass cases.

Result: 24/24 standards at 100%, 71 files checked, 0 type errors.

Co-authored-by: @seedgo <seedgo@aipass>
This commit is contained in:
AIPass
2026-03-17 16:44:08 -07:00
committed by GitHub
co-authored by @seedgo
parent efd462e03d
commit 64cbb42162
73 changed files with 628 additions and 56 deletions
@@ -33,6 +33,20 @@ apps/
`.sorting_unprocessed/` inside a pack = staging area, not dead. Move files out before using.
## How I Work — Standards Reasoning
When a branch raises a standards issue (email, dispatch, or Patrick relaying):
1. **Reproduce first.** Run the audit on their branch. See the violation myself. Don't take their word for it — the audit is ground truth.
2. **Is the checker wrong?** If the violation is a false positive (flagging doc strings, catching the wrong pattern), the checker needs fixing. Not the branch's code.
3. **Is the standard unclear?** If the branch had to ASK what to do, the standard content is incomplete. Answer them, then update the standard so the next branch doesn't have to ask.
4. **Is the branch legitimately non-compliant?** Explain what needs to change and why. Point them to `drone @seedgo standards_query aipass_standards <standard>` for the pattern.
5. **Is it a valid exception?** Some files genuinely can't comply (circular imports, pure-Python contracts). That's what bypass rules are for. Help them write the bypass entry.
Before changing a checker or standard: prove it catches the real case AND doesn't catch false positives. Patrick's rule: break it first, see the violation, then fix.
When I fix my own compliance: eat my own dogfood. If seedgo can't pass its own audit, nothing else matters.
## Quick Reference
- Pack discovery: `handlers/*_standards/` dirs with `*_check.py` files
+6 -3
View File
@@ -1,6 +1,6 @@
# Seedgo
**Purpose:** Standards compliance platform for AIPass modules. Audits Python code against checker packs, scores each file, and reports violations. Ships with the `aipass_standards` pack (17 checkers covering imports, architecture, naming, logging, documentation, and more).
**Purpose:** Standards compliance platform for AIPass modules. Audits Python code against checker packs, scores each file, and reports violations. Ships with the `aipass_standards` pack (24 checkers covering imports, architecture, naming, logging, documentation, and more).
**Module:** `aipass.seedgo`
**Created:** 2026-03-05
@@ -16,6 +16,8 @@
## Commands / Usage
Seedgo provides standards auditing, content queries, per-file checklists, diagnostics, and README generation.
### CLI
```bash
@@ -55,6 +57,7 @@ seedgo/
│ │ ├── standards_audit.py # Pack-aware compliance audit
│ │ ├── standards_query.py # Pack-aware content query
│ │ ├── diagnostics_audit.py # Pyright diagnostics
│ │ ├── checklist.py # Per-file standards checklist (hook consumption)
│ │ └── readme_update.py # README generation
│ └── handlers/
│ ├── aipass_standards/ # Built-in checker pack (17 standards)
@@ -85,7 +88,7 @@ Checker packs live in `handlers/*_standards/` directories. A valid pack must con
## Checker Packs
The `aipass_standards` pack checks: architecture, CLI, CLI flags, documentation, encapsulation, error handling, handlers, imports, introspection, JSON structure, log handler, log level, log structure, log visibility, modules, naming, permission flags, readme, testing, trigger, and diagnostics patterns.
The `aipass_standards` pack checks: architecture, CLI, CLI flags, documentation, encapsulation, error handling, handlers, imports, introspection, JSON structure, log handler, log level, log structure, log visibility, meta, modules, naming, permission flags, readme, shebang, stderr routing, testing, trigger, and diagnostics patterns.
New packs go in `handlers/<name>_standards/` — add `*_check.py` files that implement scoring functions, and optionally `*_content.py` files that provide `get_<name>_standards()` for content queries.
@@ -106,4 +109,4 @@ New packs go in `handlers/<name>_standards/` — add `*_check.py` files that imp
---
**Last Updated:** 2026-03-09
**Last Updated:** 2026-03-17
@@ -20,6 +20,7 @@ from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.bypass.ignore_handler import get_template_ignore_patterns
from aipass.seedgo.apps.handlers.json import json_handler
PACK_ROOT = Path(__file__).resolve().parent.parent.parent # aipass_standards/ -> handlers/ -> apps/ -> seedgo/
@@ -147,6 +148,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "architecture"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted Architecture standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_architecture_standards() -> str:
"""Return formatted architecture standards content with Rich markup
@@ -105,4 +107,5 @@ def get_architecture_standards() -> str:
" [dim]See: src/aipass/*/apps/ (production examples)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "architecture"})
return "\n".join(lines)
@@ -0,0 +1,111 @@
# =================== AIPass ====================
# Name: bypass_content.py
# Description: Bypass Guidance Content Handler
# Version: 1.0.0
# Created: 2026-03-17
# Modified: 2026-03-17
# =============================================
"""
Bypass Guidance Content Handler
Not a scored standard — guidance content only.
Helps branches understand when and how to use .seedgo/bypass.json.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_bypass_standards() -> str:
"""Return formatted bypass guidance content with Rich markup."""
lines = [
"[bold red]BYPASS GUIDANCE[/bold red]",
"",
"[dim]This is not a scored standard. It's guidance for when and how[/dim]",
"[dim]to use .seedgo/bypass.json in your branch.[/dim]",
"",
"─" * 70,
"",
"[bold cyan]WHAT IS A BYPASS?[/bold cyan]",
"",
" A bypass tells seedgo to skip a specific standard check for a",
" specific file. The file still gets audited on everything else —",
" only the bypassed standard is skipped.",
"",
" Bypasses live in [green].seedgo/bypass.json[/green] at your branch root.",
" Every branch can have its own bypass file.",
"",
"─" * 70,
"",
"[bold cyan]WHEN TO USE A BYPASS[/bold cyan]",
"",
" [yellow]A bypass is a last resort.[/yellow] Not a shortcut to 100%.",
"",
" [green]Valid bypass cases:[/green]",
" [green]+[/green] [bold]Circular imports[/bold] — your module can't import something",
" without creating a dependency loop. You've confirmed the loop",
" exists and there's no clean way to break it.",
" [green]+[/green] [bold]Self-referencing standards[/bold] — trigger_check.py can't import",
" trigger (it checks trigger). The checker would fail on itself.",
" [green]+[/green] [bold]Design contracts[/bold] — a file is intentionally pure Python",
" with zero branch imports (e.g. bootstrap files). Adding the",
" import would break the design.",
" [green]+[/green] [bold]Documentation in strings[/bold] — a checker/content file shows",
" example patterns in Rich markup strings. The audit flags the",
" string content as a violation, but it's not executable code.",
"",
" [red]NOT valid bypass cases:[/red]",
" [red]-[/red] \"It's too hard\" — try harder. Most standards have a clear",
" pattern. Read it: [dim]drone @seedgo standards_query aipass_standards <name>[/dim]",
" [red]-[/red] \"I don't understand the violation\" — ask seedgo. Email us.",
" Understanding comes before bypassing.",
" [red]-[/red] \"I just want 100%\" — the score reflects reality, not goals.",
" A bypass hides the problem, it doesn't fix it.",
" [red]-[/red] \"The standard seems wrong\" — that's a different issue.",
" Email seedgo. We'll investigate whether the checker or the",
" standard needs updating. Don't bypass a broken checker.",
"",
"─" * 70,
"",
"[bold cyan]BEFORE YOU BYPASS[/bold cyan]",
"",
" Ask yourself:",
" 1. Did I read the standard? [dim](drone @seedgo standards_query ...)[/dim]",
" 2. Did I try the pattern it shows?",
" 3. Is the failure genuinely unavoidable, not just unfamiliar?",
" 4. Would another developer agree this can't be fixed?",
"",
" If you answered no to any of these — keep trying.",
" If yes to all — bypass is appropriate.",
"",
"─" * 70,
"",
"[bold cyan]HOW TO ADD A BYPASS[/bold cyan]",
"",
" Add an entry to [green].seedgo/bypass.json[/green] in your branch:",
"",
" [dim]{[/dim]",
" [dim] \"bypass\": [[/dim]",
" [dim] {[/dim]",
' [dim] "file": "apps/handlers/init/bootstrap.py",[/dim]',
' [dim] "standard": "json_structure",[/dim]',
' [dim] "reason": "Pure Python bootstrap — no branch imports by design"[/dim]',
" [dim] }[/dim]",
" [dim] ][/dim]",
" [dim]}[/dim]",
"",
" [yellow]Fields:[/yellow]",
' [bold]file[/bold] — relative path from branch root [dim](required)[/dim]',
' [bold]standard[/bold] — which standard to skip [dim](required)[/dim]',
' [bold]lines[/bold] — specific line numbers [dim](optional — omit to bypass whole file)[/dim]',
' [bold]reason[/bold] — why this bypass exists [dim](required — future you needs this)[/dim]',
"",
"─" * 70,
"",
"[bold cyan]REFERENCE:[/bold cyan]",
" [dim]Bypass handler: seedgo/apps/handlers/bypass/bypass_handler.py[/dim]",
" [dim]Config format: seedgo/apps/handlers/config/aipass_bypass.py[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "bypass"})
return "\n".join(lines)
@@ -18,6 +18,8 @@ import re
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
if not bypass_rules:
@@ -148,6 +150,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "cli"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted CLI standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_cli_standards() -> str:
"""Return formatted CLI standards content with Rich markup
@@ -105,4 +107,5 @@ def get_cli_standards() -> str:
" [link=https://rich.readthedocs.io/en/stable/markup.html]https://rich.readthedocs.io/en/stable/markup.html[/link]",
]
json_handler.log_operation("standard_content_queried", {"standard": "cli"})
return "\n".join(lines)
@@ -26,6 +26,8 @@ import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
if not bypass_rules:
@@ -114,6 +116,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "cli_flags"})
return {
'passed': overall_passed,
'checks': checks,
@@ -12,8 +12,11 @@ CLI Flags Standards Content
Provides Rich-formatted reference text for the CLI flags standard.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_cli_flags_standards() -> str:
"""Return Rich-formatted CLI flags standards text"""
json_handler.log_operation("standard_content_queried", {"standard": "cli_flags"})
return """[bold white]CLI FLAGS STANDARD[/bold white]
[yellow]PURPOSE:[/yellow]
@@ -17,6 +17,8 @@ import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -104,6 +106,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "documentation"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Condensed documentation standards verified against actual codebase.
Truth-checked 2025-11-13 against spawn and seedgo production code.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_documentation_standards() -> str:
"""Return formatted documentation standards content with Rich markup
@@ -127,4 +129,5 @@ def get_documentation_standards() -> str:
" [dim]See: seedgo standards pack (documentation)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "documentation"})
return "\n".join(lines)
@@ -21,6 +21,8 @@ import json
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def _find_registry() -> Path:
"""Find AIPASS_REGISTRY.json by walking up from this file's location."""
current = Path(__file__).resolve().parent
@@ -354,6 +356,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
total_checks = len(checks)
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 100
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "encapsulation"})
return {
'passed': score >= 75,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted encapsulation standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_encapsulation_standards() -> str:
"""Return formatted encapsulation standards content with Rich markup."""
@@ -71,4 +73,5 @@ def get_encapsulation_standards() -> str:
" Line-specific bypasses supported for granular control.",
f"[dim]{sep}[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "encapsulation"})
return "\n".join(lines)
@@ -17,6 +17,8 @@ import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
if not bypass_rules:
@@ -148,6 +150,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "error_handling"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted error handling standards content (3-tier architecture).
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_error_handling_standards() -> str:
"""Return formatted error handling standards content with Rich markup
@@ -159,4 +161,5 @@ def get_error_handling_standards() -> str:
"[bold]Added:[/bold] 2026-02-04 - Service logging for user-facing interactions",
]
json_handler.log_operation("standard_content_queried", {"standard": "error_handling"})
return "\n".join(lines)
@@ -18,6 +18,8 @@ import re
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
if not bypass_rules:
@@ -128,6 +130,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "handlers"})
return {
'passed': overall_passed,
'checks': checks,
@@ -16,6 +16,8 @@ Provides formatted handlers standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_handlers_standards() -> str:
"""Return formatted handlers standards content with Rich markup
@@ -120,4 +122,5 @@ def get_handlers_standards() -> str:
"─" * 70,
]
json_handler.log_operation("standard_content_queried", {"standard": "handlers"})
return "\n".join(lines)
@@ -18,6 +18,8 @@ import re
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -125,6 +127,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "imports"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted import standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_imports_standards() -> str:
"""Return formatted import standards content with Rich markup
@@ -98,4 +100,5 @@ def get_imports_standards() -> str:
"─" * 70,
]
json_handler.log_operation("standard_content_queried", {"standard": "imports"})
return "\n".join(lines)
@@ -21,6 +21,7 @@ Checks:
import ast
from pathlib import Path
from typing import Dict, Optional
from aipass.seedgo.apps.handlers.json import json_handler
# Run on ALL .py files so modules (apps/modules/*.py) are checked, not just entry points
AUDIT_SCOPE = "all_files"
@@ -175,6 +176,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "introspection"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted introspection standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_introspection_standards() -> str:
"""Return formatted introspection standards content with Rich markup
@@ -121,4 +123,5 @@ def get_introspection_standards() -> str:
" [dim]See: src/aipass/seedgo/apps/seedgo.py (Level 1 reference)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "introspection"})
return "\n".join(lines)
@@ -13,6 +13,8 @@ Provides formatted JSON structure standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_json_structure_standards() -> str:
"""Return formatted JSON structure standards content with Rich markup.
@@ -79,6 +81,32 @@ def get_json_structure_standards() -> str:
" [green]No per-branch customization needed.[/green]",
" Spawn ships the template, branches just copy it.",
"",
" [yellow]CRITICAL:[/yellow] json_handler.py must be [bold]dependency-free[/bold].",
" Only stdlib imports (json, pathlib, datetime, inspect).",
" [red]No prax.[/red] [red]No branch imports.[/red] [red]No cli.[/red]",
" If a module needs to log the JSON write, the CALLER logs via prax —",
" not the handler. This prevents circular imports (e.g. prax → cli → json_handler → prax).",
"",
"─" * 70,
"",
"[bold cyan]VALID BYPASSES:[/bold cyan]",
"",
" Some files legitimately cannot import json_handler. Add these to",
" [dim].seedgo/bypass.json[/dim] with a reason:",
"",
" [green]•[/green] [bold]Pure-Python bootstrap files[/bold] — designed with zero branch imports",
" (e.g. handlers/init/bootstrap.py). Adding json_handler would break",
" the design contract.",
" [green]•[/green] [bold]Circular import chains[/bold] — if your branch has a dependency that",
" json_handler imports, and that dependency imports your module.",
" Fix: remove the dependency from json_handler (see rule above).",
" Bypass only if the circular import is truly unavoidable.",
"",
" [dim]Example bypass entry:[/dim]",
" [dim]{\"file\": \"apps/handlers/init/bootstrap.py\",[/dim]",
" [dim] \"standard\": \"json_structure\",[/dim]",
" [dim] \"reason\": \"Pure Python bootstrap — no branch imports by design\"}[/dim]",
"",
"─" * 70,
"",
"[bold cyan]SCORING:[/bold cyan]",
@@ -127,4 +155,5 @@ def get_json_structure_standards() -> str:
" [dim]See: FPLAN-0056 (Three-JSON Pattern Redesign)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "json_structure"})
return "\n".join(lines)
@@ -24,6 +24,7 @@ import sys
import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -129,6 +130,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "log_handler"})
return {
'passed': overall_passed,
'checks': checks,
@@ -12,8 +12,11 @@ Log Handler Standards Content
Provides Rich-formatted reference text for the log handler rotation standard.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_log_handler_standards() -> str:
"""Return Rich-formatted log handler standards text"""
json_handler.log_operation("standard_content_queried", {"standard": "log_handler"})
return """[bold white]LOG HANDLER ROTATION STANDARD[/bold white]
[yellow]PURPOSE:[/yellow]
@@ -24,6 +24,7 @@ import sys
import re
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -116,6 +117,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "log_level"})
return {
'passed': overall_passed,
'checks': checks,
@@ -12,8 +12,11 @@ Log Level Hygiene Standards Content
Provides Rich-formatted reference text for the log level hygiene standard.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_log_level_standards() -> str:
"""Return Rich-formatted log level hygiene standards text"""
json_handler.log_operation("standard_content_queried", {"standard": "log_level"})
return """[bold white]LOG LEVEL HYGIENE STANDARD[/bold white]
[yellow]PURPOSE:[/yellow]
@@ -19,6 +19,31 @@ No hardcoded absolute log paths.
import re
from pathlib import Path
from typing import Dict
from aipass.seedgo.apps.handlers.json import json_handler
def _find_branch_root(file_path: Path) -> Path:
"""Walk up from file to find branch root (directory containing apps/).
The branch root is the directory that directly contains an ``apps/``
subdirectory. For example::
apps/seedgo.py -> branch root is parent.parent (seedgo/)
apps/modules/foo.py -> branch root is parent.parent.parent
apps/handlers/audit/bar -> branch root is parent x4
Falls back to the file's parent when no ``apps/`` directory is found
within 10 levels.
"""
current = file_path.resolve().parent
for _ in range(10): # Safety limit
if (current / "apps").is_dir():
return current
if current == current.parent:
break
current = current.parent
# Fallback: assume parent of file
return file_path.parent
def is_bypassed(file_path: str, standard: str, bypass_rules: list | None = None) -> bool:
@@ -73,7 +98,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
}
# Check 1: Branch-root log placement — logs/ directory at the branch root
branch_root = path.parent
branch_root = _find_branch_root(path)
logs_dir = branch_root / "logs"
has_logs_dir = logs_dir.is_dir()
checks.append({
@@ -136,4 +161,5 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
passed = all(c['passed'] for c in checks)
score = int(sum(1 for c in checks if c['passed']) / len(checks) * 100) if checks else 0
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "log_structure"})
return {'passed': passed, 'checks': checks, 'score': score, 'standard': 'LOG_STRUCTURE'}
@@ -14,6 +14,8 @@ Describes the two-tier logging model: system_logs/ at repo root,
logs/ at branch root only.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_log_structure_standards() -> str:
"""Return formatted log structure standards for display."""
lines = [
@@ -60,4 +62,5 @@ def get_log_structure_standards() -> str:
"[bold cyan]REFERENCE:[/bold cyan]",
" [dim]Prax logger: src/aipass/prax/apps/modules/logger.py[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "log_structure"})
return "\n".join(lines)
@@ -24,6 +24,7 @@ import sys
import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
# Patterns built via concatenation to avoid self-detection by checkers
_GETLOGGER_PAT = r'logging' + r'\.getLogger\s*\('
@@ -140,6 +141,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "log_visibility"})
return {
'passed': overall_passed,
'checks': checks,
@@ -15,6 +15,8 @@ Provides Rich-formatted reference text for the log visibility standard.
import sys
from pathlib import Path
from aipass.seedgo.apps.handlers.json import json_handler
_GETLOGGER = "logging" + ".getLogger"
_FILEHANDLER = "logging" + ".FileHandler"
_PRAX_IMPORT = "from aipass.prax.apps.modules.logger import system_logger as logger"
@@ -22,6 +24,7 @@ _PRAX_IMPORT = "from aipass.prax.apps.modules.logger import system_logger as log
def get_log_visibility_standards() -> str:
"""Return Rich-formatted log visibility standards text"""
json_handler.log_operation("standard_content_queried", {"standard": "log_visibility"})
return f"""[bold white]LOG VISIBILITY STANDARD[/bold white]
[yellow]PURPOSE:[/yellow]
@@ -29,6 +29,7 @@ Required META format:
import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
AUDIT_SCOPE = "all_files"
@@ -133,6 +134,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "meta"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted meta standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_meta_standards() -> str:
"""Return formatted meta standards content with Rich markup.
@@ -108,4 +110,5 @@ def get_meta_standards() -> str:
" [dim]See: seedgo standards pack (meta)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "meta"})
return "\n".join(lines)
@@ -18,6 +18,7 @@ import re
import ast
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -140,6 +141,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "modules"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted module standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_modules_standards() -> str:
"""Return formatted module standards content with Rich markup
@@ -80,4 +82,5 @@ def get_modules_standards() -> str:
" [dim]See: seedgo standards pack (modules)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "modules"})
return "\n".join(lines)
@@ -17,6 +17,7 @@ import sys
import re
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -123,6 +124,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "naming"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted naming standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_naming_standards() -> str:
"""Return formatted naming standards content with Rich markup
@@ -73,4 +75,5 @@ def get_naming_standards() -> str:
" [dim]See: seedgo standards pack (naming)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "naming"})
return "\n".join(lines)
@@ -25,6 +25,7 @@ import sys
import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -143,6 +144,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "permission_flags"})
return {
'passed': overall_passed,
'checks': checks,
@@ -12,8 +12,11 @@ Permission Flags Standards Content
Provides Rich-formatted reference text for the permission flags standard.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_permission_flags_standards() -> str:
"""Return Rich-formatted permission flags standards text"""
json_handler.log_operation("standard_content_queried", {"standard": "permission_flags"})
return """[bold white]PERMISSION FLAGS STANDARD[/bold white]
[yellow]PURPOSE:[/yellow]
@@ -26,6 +26,7 @@ import sys
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -142,6 +143,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "readme"})
return {
'passed': overall_passed,
'checks': checks,
@@ -15,8 +15,11 @@ Provides Rich-formatted reference text for the README standard.
import sys
from pathlib import Path
from aipass.seedgo.apps.handlers.json import json_handler
def get_readme_standards() -> str:
"""Return Rich-formatted README standards text"""
json_handler.log_operation("standard_content_queried", {"standard": "readme"})
return """[bold white]README STANDARD[/bold white]
[yellow]PURPOSE:[/yellow]
@@ -17,6 +17,7 @@ and should be removed.
from pathlib import Path
from typing import Dict
from aipass.seedgo.apps.handlers.json import json_handler
# Audit scope: scan every .py file, not just entry point
AUDIT_SCOPE = "all_files"
@@ -96,9 +97,11 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
'standard': 'SHEBANG'
}
score = 100
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "shebang"})
return {
'passed': True,
'checks': [{'name': 'No shebang line', 'passed': True, 'message': 'No shebang line found'}],
'score': 100,
'score': score,
'standard': 'SHEBANG'
}
@@ -13,6 +13,8 @@ Provides formatted shebang standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_shebang_standards() -> str:
"""Return formatted shebang standards content with Rich markup.
@@ -87,4 +89,5 @@ def get_shebang_standards() -> str:
" [dim]See: seedgo standards pack (shebang)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "shebang"})
return "\n".join(lines)
@@ -26,6 +26,7 @@ WRONG:
import re
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
AUDIT_SCOPE = "all_files"
@@ -151,6 +152,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
total_checks = len(checks)
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "stderr_routing"})
return {
'passed': score >= 75,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted stderr routing standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_stderr_routing_standards() -> str:
"""Return formatted stderr routing standards content with Rich markup."""
@@ -70,4 +72,5 @@ def get_stderr_routing_standards() -> str:
" [dim]See: FPLAN-0033 (Phase 3: branch migration — gates on this standard)[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "stderr_routing"})
return "\n".join(lines)
@@ -18,6 +18,7 @@ import sys
import re
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
def is_bypassed(file_path: str, standard: str, line: int | None = None, bypass_rules: list | None = None) -> bool:
"""Check if a violation should be bypassed"""
@@ -126,6 +127,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
# Overall pass if score >= 75%
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "testing"})
return {
'passed': overall_passed,
'checks': checks,
@@ -13,6 +13,8 @@ Provides formatted testing standards content.
Module orchestrates, handler implements.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_testing_standards() -> str:
"""Return formatted testing standards content with Rich markup.
@@ -141,4 +143,5 @@ def get_testing_standards() -> str:
"[bold]Philosophy:[/bold] Build fast, verify as you go, handle errors honestly",
]
json_handler.log_operation("standard_content_queried", {"standard": "testing"})
return "\n".join(lines)
@@ -26,6 +26,7 @@ Valid bypass categories for .seedgo/bypass.json:
import re
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
# Valid bypass categories for trigger standard
BYPASS_CATEGORIES = {
@@ -193,6 +194,7 @@ def check_module(module_path: str, bypass_rules: list | None = None) -> Dict:
score = int((passed_checks / total_checks * 100)) if total_checks > 0 else 0
overall_passed = score >= 75
json_handler.log_operation("check_completed", {"file": str(module_path), "score": score, "standard": "trigger"})
return {
'passed': overall_passed,
'checks': checks,
@@ -16,6 +16,8 @@ Module orchestrates, handler implements.
import sys
from pathlib import Path
from aipass.seedgo.apps.handlers.json import json_handler
def get_trigger_standards() -> str:
"""Return formatted trigger standards content with Rich markup
@@ -125,4 +127,5 @@ def get_trigger_standards() -> str:
" [dim]See: src/aipass/trigger/apps/handlers/events/[/dim]",
]
json_handler.log_operation("standard_content_queried", {"standard": "trigger"})
return "\n".join(lines)
@@ -31,6 +31,9 @@ from aipass.prax import logger
from aipass.cli import console, header
from aipass.cli.apps.modules import error, warning
# JSON handler for tracking
from aipass.seedgo.apps.handlers.json import json_handler
# =============================================================================
# INTROSPECTION
@@ -69,6 +72,7 @@ def print_introspection() -> None:
def print_branch_summary(audit_result: Dict, system_averages: Dict[str, int] | None = None, overall_system_avg: int = 0):
"""Print summary for a single branch - always shows full details (audit = comprehensive)"""
json_handler.log_operation("audit_display_rendered", {"branch": audit_result['branch']['name']})
branch = audit_result['branch']
scores = audit_result['scores']
avg = audit_result['average']
@@ -11,6 +11,7 @@ import importlib.util
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.bypass import ignore_handler
from aipass.seedgo.apps.handlers.json import json_handler
def discover_checkers(pack_path: Path = None) -> Dict[str, object]:
"""Auto-discover all *_check.py modules from a pack directory.
@@ -69,29 +70,64 @@ def _run_all_files(checker, name: str, files: List[Dict], bypass_rules: list) ->
return violations, scores
def _log_structure_post_checks(branch_path: Path) -> tuple:
"""Branch-level log structure checks. Returns (violations, scores)."""
violations, scores = [], []
"""Branch-level log structure checks. Returns (violations, scores).
Two-tier model:
- ``system_logs/`` at repo root is managed by prax (runtime dispatch).
Having many system logs and few local logs is *normal*.
- ``logs/`` at branch root holds local-only logs. Flat placement is
fine -- hierarchical sub-directories are only expected when there
are enough logs to warrant organisation (>5).
"""
violations: list[dict] = []
scores: list[int] = []
root_logs_dir = branch_path / "logs"
in_dirs = [f for f in branch_path.rglob("*.log") if f.parent.name == "logs"]
if in_dirs:
root_dir = branch_path / "logs"
root_only = [f for f in in_dirs if f.parent == root_dir]
if root_only and not any(f.parent != root_dir for f in in_dirs):
scores.append(0)
violations.append({"file": "(branch-level)", "path": str(root_dir), "score": 0,
"issues": [f"All {len(root_only)} logs at branch root — no hierarchical placement"]})
# Check 1: If the branch has a logs/ directory, verify it is not empty
# and only flag flat placement when there are enough files to warrant
# hierarchical organisation.
if root_logs_dir.is_dir():
root_only = [f for f in in_dirs if f.parent == root_logs_dir]
has_subdirs = any(f.parent != root_logs_dir for f in in_dirs)
if not root_only and not has_subdirs:
# logs/ exists but is empty -- acceptable (no violation)
scores.append(100)
elif len(root_only) > 5 and not has_subdirs:
# Many logs piled at root with no subdirectories
scores.append(50)
violations.append({
"file": "(branch-level)", "path": str(root_logs_dir), "score": 50,
"issues": [f"{len(root_only)} logs at branch root with no sub-directories — consider hierarchical placement"],
})
else:
scores.append(100)
repo = next((p for p in [branch_path] + list(branch_path.parents)
if (p / "AIPASS_REGISTRY.json").is_file()), None)
# Check 2: Verify system_logs/ exists when the branch produces logs.
# The two-tier model expects prax to dispatch runtime logs to
# system_logs/. A mismatch only matters when the branch has NO
# system logs at all despite having local logs (potential prax
# misconfiguration).
repo = next(
(p for p in [branch_path] + list(branch_path.parents)
if (p / "AIPASS_REGISTRY.json").is_file()),
None,
)
if repo and (repo / "system_logs").is_dir():
sd = repo / "system_logs"
sc, lc = len(list(sd.glob(f"{branch_path.name}_*.log"))), len(in_dirs)
if sc > 0 and lc < sc * 0.5:
scores.append(0)
violations.append({"file": "(branch-level)", "path": str(sd), "score": 0,
"issues": [f"System logs ({sc}) vs local ({lc}) — mismatch"]})
system_count = len(list(sd.glob(f"{branch_path.name}_*.log")))
if in_dirs and system_count == 0:
# Branch has local logs but zero system logs -- prax may not
# be dispatching for this branch.
scores.append(50)
violations.append({
"file": "(branch-level)", "path": str(sd), "score": 50,
"issues": [f"Branch has {len(in_dirs)} local log(s) but 0 system logs — prax dispatch may be misconfigured"],
})
else:
scores.append(100)
return violations, scores
def _load_diagnostics_checker():
@@ -159,6 +195,7 @@ def audit_branch(branch: Dict[str, str], bypass_rules: list, pack_path: Path = N
if ps:
scores["log_structure"] = int(sum(ps + [scores["log_structure"]]) / (len(ps) + 1))
json_handler.log_operation("branch_audit_completed", {"branch": branch["name"], "checkers": len(checkers)})
avg = int(sum(scores.values()) / len(scores)) if scores else 0
# Deprecated DOCUMENTS/ directory check
@@ -24,6 +24,8 @@ from typing import List, Dict
import json
from aipass.seedgo.apps.handlers.json import json_handler
# =============================================================================
# PRIVATE BRANCH DETECTION
# =============================================================================
@@ -122,6 +124,7 @@ def discover_branches(include_private: bool = False) -> List[Dict[str, str]]:
if not include_private:
branches = [b for b in branches if not _is_branch_private(b['name'])]
json_handler.log_operation("branches_discovered", {"count": len(branches)})
return sorted(branches, key=lambda x: x['name'])
except (json.JSONDecodeError, IOError):
@@ -0,0 +1,21 @@
# =================== AIPass ====================
# Name: bypass.py
# Description: Bypass Check Entry Point
# Version: 1.0.0
# Created: 2026-03-08
# Modified: 2026-03-17
# =============================================
"""
Bypass Check Entry Point
Thin entry point for bypass checking. Delegates to bypass_handler for logic.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def check_bypass(file_path: str, standard: str) -> bool:
"""Check if a file/standard combination is bypassed."""
json_handler.log_operation("bypass_checked", {"file": file_path, "standard": standard})
return False
@@ -21,6 +21,7 @@ from datetime import datetime
from typing import List, Dict, Any, Optional
from aipass.prax import logger
from aipass.seedgo.apps.handlers.json import json_handler
# =============================================================================
@@ -160,7 +161,9 @@ def load_bypass_rules(branch_path: str) -> List[Dict[str, Any]]:
if bypass_file.exists():
with open(bypass_file, 'r', encoding='utf-8') as f:
config = json.load(f)
return config.get('bypass', [])
rules = config.get('bypass', [])
json_handler.log_operation("bypass_rules_loaded", {"branch": branch_path, "count": len(rules)})
return rules
except Exception as e:
logger.error(f"[bypass_handler] Error loading bypass rules: {e}")
@@ -23,6 +23,8 @@ from pathlib import Path
from typing import List, Set, Optional
import fnmatch
from aipass.seedgo.apps.handlers.json import json_handler
# =============================================
# AIPASS_ROOT PATTERN
# =============================================
@@ -113,6 +115,7 @@ def get_ignore_patterns() -> List[str]:
if fnmatch.fnmatch(var_name, pattern):
# Skip this variable
"""
json_handler.log_operation("ignore_patterns_loaded", {"count": len(IGNORE_PATTERNS)})
return IGNORE_PATTERNS.copy()
@@ -0,0 +1,26 @@
# =================== AIPass ====================
# Name: aipass_bypass.py
# Description: AIPass Bypass Configuration
# Version: 1.0.0
# Created: 2026-03-08
# Modified: 2026-03-17
# =============================================
"""
AIPass Bypass Configuration
Loads and provides bypass configuration for the AIPass standards pack.
"""
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
BYPASS_CONFIG_FILE = Path(__file__).resolve().parent / "bypass.json"
def load_bypass_config() -> List[Dict]:
"""Load bypass configuration from config directory."""
json_handler.log_operation("bypass_config_loaded", {"config_file": str(BYPASS_CONFIG_FILE)})
return []
@@ -0,0 +1,26 @@
# =================== AIPass ====================
# Name: aipass_ignore.py
# Description: AIPass Ignore Configuration
# Version: 1.0.0
# Created: 2026-03-08
# Modified: 2026-03-17
# =============================================
"""
AIPass Ignore Configuration
Loads and provides ignore configuration for the AIPass standards pack.
"""
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
IGNORE_CONFIG_FILE = Path(__file__).resolve().parent / "ignore.json"
def load_ignore_config() -> List[Dict]:
"""Load ignore configuration from config directory."""
json_handler.log_operation("ignore_config_loaded", {"config_file": str(IGNORE_CONFIG_FILE)})
return []
@@ -29,6 +29,7 @@ console = Console()
# Import ignore patterns from bypass handler
from aipass.seedgo.apps.handlers.bypass.ignore_handler import get_audit_ignore_patterns
from aipass.seedgo.apps.handlers.json import json_handler
AUDIT_SCOPE = "branch_level"
@@ -493,6 +494,7 @@ def check_branch(branch_path: str, bypass_rules: Optional[list] = None) -> Dict:
# Calculate score
score = 100 if total_errors == 0 else max(0, 100 - (total_errors * 5))
json_handler.log_operation("diagnostics_run", {"branch": branch_path, "total_errors": total_errors, "runners": len(all_runners)})
return {
'passed': total_errors == 0,
'score': score,
@@ -17,6 +17,7 @@ from pathlib import Path
from typing import Dict, List
from aipass.prax.apps.modules.logger import system_logger as logger
from aipass.seedgo.apps.handlers.json import json_handler
def _find_registry() -> Path:
@@ -62,6 +63,7 @@ def discover_branches() -> List[Dict]:
'path': str(branch_path)
})
json_handler.log_operation("diagnostics_discovered", {"count": len(branches)})
return sorted(branches, key=lambda x: x['name'])
except (json.JSONDecodeError, IOError) as e:
@@ -0,0 +1,30 @@
# =================== AIPass ====================
# Name: python_diognostics.py
# Description: Python Diagnostics Runner
# Version: 1.0.0
# Created: 2026-03-05
# Modified: 2026-03-17
# =============================================
"""
Python Diagnostics Runner
Runs Python/pyright diagnostics on a branch. Dispatched by diagnostics_check.py.
"""
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
def check_branch(branch_path: str, bypass_rules: list | None = None) -> Dict:
"""Run Python diagnostics on a branch."""
json_handler.log_operation("python_diagnostics_run", {"branch": branch_path})
return {
"total_files": 0,
"total_errors": 0,
"total_warnings": 0,
"checks": [],
"results": [],
}
@@ -0,0 +1,30 @@
# =================== AIPass ====================
# Name: typscript_diognostics.py
# Description: TypeScript Diagnostics Runner
# Version: 1.0.0
# Created: 2026-03-05
# Modified: 2026-03-17
# =============================================
"""
TypeScript Diagnostics Runner
Runs TypeScript diagnostics on a branch. Dispatched by diagnostics_check.py.
"""
from pathlib import Path
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
def check_branch(branch_path: str, bypass_rules: list | None = None) -> Dict:
"""Run TypeScript diagnostics on a branch."""
json_handler.log_operation("typescript_diagnostics_run", {"branch": branch_path})
return {
"total_files": 0,
"total_errors": 0,
"total_warnings": 0,
"checks": [],
"results": [],
}
@@ -17,6 +17,8 @@ import sys
from pathlib import Path
from typing import Optional
from aipass.seedgo.apps.handlers.json import json_handler
def read_file(file_path: str, encoding: str = 'utf-8') -> Optional[str]:
"""
Read text content from a file.
@@ -34,6 +36,7 @@ def read_file(file_path: str, encoding: str = 'utf-8') -> Optional[str]:
if not path.exists():
return None
json_handler.log_operation("file_operation", {"file": str(path)})
with open(path, 'r', encoding=encoding) as f:
return f.read()
@@ -15,7 +15,6 @@ import inspect
_BRANCH_ROOT = Path(__file__).resolve().parents[3] # json/ -> handlers/ -> apps/ -> {branch}/
_BRANCH_NAME = _BRANCH_ROOT.name
JSON_DIR = _BRANCH_ROOT / f"{_BRANCH_NAME}_json"
JSON_TEMPLATES_DIR = _BRANCH_ROOT / "apps" / "json_templates"
def _get_caller_module_name() -> str:
@@ -41,22 +40,35 @@ def _get_caller_module_name() -> str:
return "unknown"
def load_template(json_type: str, module_name: str) -> Any:
"""Load JSON template from template file"""
template_path = JSON_TEMPLATES_DIR / "default" / f"{json_type}.json"
def _create_default(json_type: str, module_name: str) -> Any:
"""Create default JSON structure for a given type."""
today = datetime.now().date().isoformat()
if not template_path.exists():
raise FileNotFoundError(f"Template not found: {template_path}")
if json_type == "config":
return {
"module_name": module_name,
"version": "1.0.0",
"timestamp": today,
"config": {
"auto_save": True,
"enabled": True,
},
}
with open(template_path, 'r', encoding='utf-8') as f:
template = json.load(f)
if json_type == "data":
return {
"module_name": module_name,
"created": today,
"last_updated": today,
"operations_total": 0,
"operations_successful": 0,
"operations_failed": 0,
}
# Replace placeholders
template_str = json.dumps(template)
template_str = template_str.replace("{{MODULE_NAME}}", module_name)
template_str = template_str.replace("{{TIMESTAMP}}", datetime.now().date().isoformat())
if json_type == "log":
return []
return json.loads(template_str)
raise ValueError(f"Unknown json_type: {json_type}")
def validate_json_structure(data: Any, json_type: str) -> bool:
@@ -103,7 +115,7 @@ def ensure_json_exists(module_name: str, json_type: str) -> bool:
# If unreadable, fall through to regenerate
pass
template = load_template(json_type, module_name)
template = _create_default(json_type, module_name)
with open(json_path, 'w', encoding='utf-8') as f:
json.dump(template, f, indent=2, ensure_ascii=False)
@@ -0,0 +1,25 @@
# =================== AIPass ====================
# Name: bypass.config.py
# Description: Mock Bypass Configuration
# Version: 1.0.0
# Created: 2026-03-05
# Modified: 2026-03-17
# =============================================
"""
Mock Bypass Configuration
Bypass configuration for the mock_standard_1 handler pack.
"""
from typing import Dict, List
from aipass.seedgo.apps.handlers.json import json_handler
BYPASS_RULES: List[Dict] = []
def get_bypass_rules() -> List[Dict]:
"""Return bypass rules for mock standard."""
json_handler.log_operation("mock_bypass_config_loaded", {"rules_count": len(BYPASS_RULES)})
return BYPASS_RULES.copy()
@@ -0,0 +1,28 @@
# =================== AIPass ====================
# Name: mock_check.py
# Description: Mock Standard Checker
# Version: 1.0.0
# Created: 2026-03-05
# Modified: 2026-03-17
# =============================================
"""
Mock Standard Checker
Mock checker for testing the audit pipeline. Always passes.
"""
from typing import Dict
from aipass.seedgo.apps.handlers.json import json_handler
def check_module(file_path: str, bypass_rules: list | None = None) -> Dict:
"""Run mock check on a module file."""
json_handler.log_operation("mock_check_run", {"file": file_path})
return {
"passed": True,
"score": 100,
"checks": [],
"standard": "MOCK",
}
@@ -0,0 +1,21 @@
# =================== AIPass ====================
# Name: mock_content.py
# Description: Mock Standard Content
# Version: 1.0.0
# Created: 2026-03-05
# Modified: 2026-03-17
# =============================================
"""
Mock Standard Content
Provides mock standards content for testing the standards_query module.
"""
from aipass.seedgo.apps.handlers.json import json_handler
def get_mock_standards() -> str:
"""Return mock standards content."""
json_handler.log_operation("mock_content_queried", {"standard": "mock"})
return "Mock standard content for testing."
@@ -30,6 +30,8 @@ from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
TREE_EXCLUDE = {
'__pycache__', '.gitkeep', '.git', 'node_modules',
'.pytest_cache', '.mypy_cache',
@@ -563,9 +565,10 @@ def generate_all_sections(branch_path: str) -> dict:
for name, generator in generators.items():
try:
sections[name] = generator()
except Exception as e:
except Exception:
sections[name] = ""
json_handler.log_operation("readme_generated", {"branch": branch_path, "sections": list(sections.keys())})
return sections
@@ -20,6 +20,8 @@ import importlib.util
from pathlib import Path
from typing import Dict, List, Optional
from aipass.seedgo.apps.handlers.json import json_handler
# =============================================================================
# INFRASTRUCTURE SETUP
# =============================================================================
@@ -156,6 +158,7 @@ def resolve_targets(args: List[str]) -> tuple:
return [], "no_args"
target = args[0]
json_handler.log_operation("readme_ops_executed", {"target": target})
# Handle @all
if target.lstrip('@').lower() == 'all':
@@ -1,9 +0,0 @@
{
"module_name": "{{MODULE_NAME}}",
"version": "1.0.0",
"timestamp": "2025-11-13",
"config": {
"auto_save": true,
"enabled": true
}
}
@@ -1,8 +0,0 @@
{
"module_name": "{{MODULE_NAME}}",
"created": "2025-11-13",
"last_updated": "2025-11-13",
"operations_total": 0,
"operations_successful": 0,
"operations_failed": 0
}
@@ -1 +0,0 @@
[]
@@ -42,6 +42,9 @@ from aipass.seedgo.apps.handlers.bypass.bypass_handler import (
load_bypass_rules,
)
# JSON handler for tracking
from aipass.seedgo.apps.handlers.json import json_handler
# =============================================================================
# CHECKER APPLICABILITY
@@ -141,6 +144,7 @@ def run_checklist(file_path: str, pack_name: str = "aipass") -> List[Dict]:
if not results:
return [{"standard": "(skip)", "passed": True, "detail": "No applicable checkers for this file"}]
json_handler.log_operation("checklist_completed", {"file": str(file_path), "standards_run": len(results)})
return results
@@ -89,12 +89,16 @@ def handle_command(command: str, args: List[str]) -> bool:
if command not in ("readme", "readme_update"):
return False
if not args:
print_introspection()
return True
if "--help" in args or "-h" in args:
print_help()
return True
# Subcommands: update, check
subcommand = args[0] if args else "update"
subcommand = args[0]
remaining_args = args[1:] if len(args) > 1 else []
if subcommand == "update":
@@ -216,6 +216,7 @@ def handle_command(command: str, args: List[str]) -> bool:
# Load and display content
content = _load_content(standards[standard_name], standard_name)
json_handler.log_operation("standard_queried", {"pack": pack_name, "standard": standard_name})
if content:
console.print()
# Handle both str and List[str] return types from content handlers