-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathonboard_render.py
More file actions
65 lines (50 loc) · 1.83 KB
/
onboard_render.py
File metadata and controls
65 lines (50 loc) · 1.83 KB
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
"""Turn collected answers into a PREFERENCES.md string. Pure function, no I/O."""
import datetime
VERSION = "0.8.0"
_DEFAULTS = {
"name": "",
"languages": "unspecified",
"style": "concise",
"tests": "test-after",
"commits": "conventional commits",
"review": "critical issues only",
}
def _section(title, bullets):
"""Return a markdown section string, omitting any blank bullets."""
kept = [f"- {b}" for b in bullets if b and b != "unspecified"]
if not kept:
kept = ["- _(edit me)_"]
return f"## {title}\n" + "\n".join(kept)
def render(raw: dict) -> str:
a = {**_DEFAULTS, **{k: v for k, v in raw.items() if v}}
now = datetime.datetime.now().isoformat(timespec="seconds")
identity = _section("Identity", [
f"Name: {a['name']}" if a["name"] else "",
])
code = _section("Code style", [
f"Language(s): {a['languages']}",
f"Explanations: {a['style']}",
])
workflow = _section("Workflow", [
f"Test strategy: {a['tests']}",
f"Commit style: {a['commits']}",
])
comms = _section("Communication", [
f"Review depth: {a['review']}",
"Tone: direct, skip pleasantries",
"Surface tradeoffs: always",
])
constraints = _section("Constraints", [
"_(edit me: primary stack, deployment targets, off-limits patterns)_",
])
# Only include Identity if a name was given
sections = ([identity] if a["name"] else []) + [code, workflow, comms, constraints]
body = "\n\n".join(sections)
return f"""\
# Personal Preferences
<!-- generated by agentic-stack onboard v{VERSION} on {now} -->
<!-- re-run: agentic-stack <harness> --reconfigure to update -->
> **This file is yours.** Edit it any time — it's the first thing your AI
> reads at the start of every session.
{body}
"""