File size: 1,551 Bytes
b67a1e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import json, subprocess, shutil
from pathlib import Path
PROJECT=Path('/home/smlflg/Projekte/ACT-agentcommandotower')
COMMAND='git status --short && test -e README.md || test -e README'

def run(cmd, timeout=60):
    try:
        p=subprocess.run(cmd, cwd=PROJECT, shell=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
        return {'cmd':cmd,'exit_code':p.returncode,'stdout':p.stdout[-4000:],'stderr':p.stderr[-4000:]}
    except Exception as e:
        return {'cmd':cmd,'exit_code':124,'stdout':'','stderr':str(e)}

def main():
    checks=[]; failures=[]; warnings=[]
    if not PROJECT.exists():
        failures.append('project path missing')
    if not (PROJECT/'.git').exists():
        warnings.append('no .git marker')
    checks.append(run('git status --short', timeout=20))
    # Main smoke command. Non-destructive; no install.
    checks.append(run(COMMAND, timeout=90))
    status='passed'
    for c in checks:
        if c['exit_code'] not in (0,):
            status='needs_human' if 'not found' in (c.get('stderr','')+c.get('stdout','')).lower() else 'failed'
            failures.append(f"{c['cmd']} exit={c['exit_code']}")
    result={'status':status,'project_path':str(PROJECT),'verifier_kind':'generic','checks':checks,'failures':failures,'warnings':warnings,'next_action':'If failed/needs_human, inspect stderr and decide dependency/test setup.'}
    print(json.dumps(result,indent=2))
    raise SystemExit(0 if status=='passed' else 1)
if __name__=='__main__': main()