File size: 3,027 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
from intake_common import *


def next_actions(p):
    actions = []
    if p.get("git_status", {}).get("dirty"):
        actions.append("Review tracked dirty work and decide: continue, park, or archive. Do not commit without owner approval.")
    if p.get("todo_fixme_count", 0):
        actions.append("Cluster TODO/FIXME/WIP hints into one bounded next action.")
    if p.get("plan_hit_count", 0):
        actions.append("Read plan/backlog artifacts and extract current unfinished thread.")
    if not p.get("readme_summary"):
        actions.append("Classify purpose from filenames only; ask owner before writing project README.")
    if "agent" in p.get("technologies", []) or "hermes-async" in p.get("technologies", []):
        actions.append("Inspect agent handoff/async state read-only and summarize stale/running/done work.")
    actions.append("Produce a handoff artifact under ProjectIntakeTower/jobs/done/<job_id>/.")
    return actions[:5]


def main():
    ensure_dirs()
    clear_generated_files(CARDS, "*.md")
    projects = load_jsonl(INV / "projects.jsonl")
    for p in projects:
        pid = p["project_id"]
        card = CARDS / f"{pid}.md"
        todos = p.get("todo_fixme_snippets", [])
        body = [
            f"# {p['name']}",
            "",
            f"- Project ID: `{pid}`",
            f"- Path: `{p['path']}`",
            f"- Last modified: `{p.get('last_modified','')}`",
            f"- Git repo: {'yes' if p.get('is_git_repo') else 'no'}",
            f"- Git status: {'dirty' if p.get('git_status',{}).get('dirty') else 'clean/unknown'} ({p.get('git_status',{}).get('dirty_tracked_count',0)} tracked changes)",
            f"- Branch: `{p.get('git_status',{}).get('branch','')}`",
            f"- Technologies: {', '.join(p.get('technologies', []))}",
            f"- Triage status: `{p.get('triage_status')}`",
            f"- Risk level: `{p.get('risk_level')}`",
            f"- Score: `{p.get('score')}` — {', '.join(p.get('score_reasons', []))}",
            f"- Evidence: `{p.get('evidence_file')}`",
            "",
            "## README summary",
            "",
            p.get("readme_summary") or "No safe README summary found.",
            "",
            "## TODO/FIXME/WIP hints",
            "",
        ]
        if todos:
            for t in todos[:10]:
                body.append(f"- `{t.get('file')}`:{t.get('line')} — {t.get('text')}")
        else:
            body.append("- No safe TODO/FIXME/WIP snippets found.")
        body += ["", "## Possible next actions", ""]
        for i, a in enumerate(next_actions(p), 1):
            body.append(f"{i}. {a}")
        body += ["", "## Safety note", "", "Read-only intake only. Do not modify this project from an intake job unless Samuel explicitly changes the job mode.", ""]
        card.write_text("\n".join(body), encoding="utf-8")
    print(json.dumps({"status": "succeeded", "project_cards": len(list(CARDS.glob('*.md')))}, indent=2))

if __name__ == "__main__":
    main()