agjan 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/guide.md +42 -7
- package/kit/hooks/guard.mjs +124 -15
- package/kit/skills/agjan-build/SKILL.md +1 -1
- package/kit/skills/agjan-design/SKILL.md +4 -3
- package/kit/skills/agjan-fix/SKILL.md +1 -1
- package/kit/skills/agjan-map/SKILL.md +1 -1
- package/kit/skills/agjan-spec/SKILL.md +4 -1
- package/kit/skills/agjan-verify/SKILL.md +10 -4
- package/kit/skills/cap-developer/SKILL.md +4 -0
- package/kit/skills/cap-developer/references/handlers.md +61 -4
- package/kit/skills/cap-developer/references/modeling.md +33 -1
- package/kit/skills/cap-developer/references/project-setup.md +87 -0
- package/kit/skills/cap-developer/references/services.md +32 -1
- package/kit/skills/cap-developer/references/testing.md +46 -14
- package/kit/skills/cap-developer/references/validation-security.md +66 -2
- package/kit/skills/fiori-developer/SKILL.md +1 -0
- package/kit/skills/fiori-developer/references/app-setup.md +127 -0
- package/kit/skills/fiori-developer/references/elements.md +110 -5
- package/kit/skills/fiori-developer/references/ui5-basics.md +3 -2
- package/kit/skills/solution-reviewer/SKILL.md +13 -3
- package/kit/templates/agents-block.md +5 -1
- package/kit/templates/progress.html +343 -0
- package/kit/templates/project.md +5 -0
- package/package.json +1 -1
- package/schemas/reviews.schema.json +2 -1
- package/src/adapters/claude-code.mjs +16 -12
- package/src/cli.mjs +12 -4
- package/src/commands/check.mjs +3 -1
- package/src/commands/gates.mjs +2 -2
- package/src/commands/progress.mjs +40 -0
- package/src/commands/setup.mjs +118 -24
- package/src/commands/status.mjs +76 -6
- package/src/log.mjs +12 -0
- package/src/mcp.mjs +5 -0
- package/src/plan.mjs +8 -4
- package/src/progress-view.mjs +455 -0
- package/src/review.mjs +26 -13
- package/src/terminal.mjs +5 -3
- package/src/ui.mjs +26 -22
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>agjan progress</title>
|
|
7
|
+
<style>
|
|
8
|
+
/* Generated by agjan progress. A work log: project overview (one row per unit), then the
|
|
9
|
+
selected unit: now -> figures -> swim-lane timeline -> review loops -> findings, tasks, people.
|
|
10
|
+
Self-contained: no external fonts, scripts or images. */
|
|
11
|
+
:root {
|
|
12
|
+
color-scheme: light;
|
|
13
|
+
--bg: #f4f7fa; --surface: #ffffff; --ink: #142030; --muted: #5a6b7c; --line: #dde4eb;
|
|
14
|
+
--accent: #0a6fe0; --accent-bg: #e5f0fd; --teal: #0e9f80;
|
|
15
|
+
--pass: #1f8f4e; --pass-bg: #e6f4ec; --notes: #b77a00; --notes-bg: #fbf1dc;
|
|
16
|
+
--blocked: #cc2f27; --blocked-bg: #fbe5e3; --human: #6d4fd0; --human-bg: #eeeafb;
|
|
17
|
+
--brand-ink: #101c2c; --brand-teal: #0e9f80;
|
|
18
|
+
--font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
|
|
19
|
+
--mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
20
|
+
--r: 8px;
|
|
21
|
+
}
|
|
22
|
+
@media (prefers-color-scheme: dark) {
|
|
23
|
+
:root {
|
|
24
|
+
color-scheme: dark;
|
|
25
|
+
--bg: #0d1319; --surface: #141c25; --ink: #e4ebf2; --muted: #93a2b2; --line: #243140;
|
|
26
|
+
--accent: #58a6ff; --accent-bg: #0f2a4a; --teal: #2ec4a0;
|
|
27
|
+
--pass: #4cc47a; --pass-bg: #12301f; --notes: #e8b84a; --notes-bg: #33290f;
|
|
28
|
+
--blocked: #f2675f; --blocked-bg: #3a1714; --human: #a891f5; --human-bg: #251d45;
|
|
29
|
+
--brand-ink: #f2f5f7; --brand-teal: #2ec4a0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
* { box-sizing: border-box; }
|
|
33
|
+
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); padding: 0 max(16px, 3vw) 48px; }
|
|
34
|
+
.wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 28px; }
|
|
35
|
+
h1, h2, h3 { margin: 0; text-wrap: balance; }
|
|
36
|
+
h2 { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
|
|
37
|
+
h3 { font-size: 17px; font-weight: 600; }
|
|
38
|
+
.mono { font-family: var(--mono); font-size: .9em; }
|
|
39
|
+
.muted { color: var(--muted); }
|
|
40
|
+
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
|
|
41
|
+
header.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px; border-bottom: 1px solid var(--line); }
|
|
42
|
+
.brand { display: flex; align-items: center; gap: 12px; }
|
|
43
|
+
.wordmark { height: 30px; width: auto; display: block; }
|
|
44
|
+
.wordmark .ink { stroke: var(--brand-ink); } .wordmark .teal { stroke: var(--brand-teal); } .wordmark .dot { fill: var(--brand-teal); }
|
|
45
|
+
.brand span { color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
|
|
46
|
+
.gen { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
|
|
47
|
+
.gen code { font-family: var(--mono); background: var(--surface); border: 1px solid var(--line); padding: 2px 6px; border-radius: 5px; color: var(--ink); }
|
|
48
|
+
.units { display: grid; gap: 8px; }
|
|
49
|
+
.unit { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(300px, 2.4fr) minmax(170px, 1.3fr); gap: 16px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; text-align: left; color: inherit; font: inherit; width: 100%; }
|
|
50
|
+
.unit[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
|
|
51
|
+
.unit .name { display: grid; gap: 2px; min-width: 0; }
|
|
52
|
+
.unit .key { font-family: var(--mono); font-weight: 500; font-size: 13px; color: var(--accent); }
|
|
53
|
+
.unit .slug { font-weight: 600; overflow-wrap: anywhere; }
|
|
54
|
+
.unit .kind { font-size: 12px; color: var(--muted); }
|
|
55
|
+
.track { display: flex; align-items: center; min-width: 0; }
|
|
56
|
+
.track .st { display: flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
|
|
57
|
+
.track .dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 2px solid var(--line); color: var(--muted); background: var(--surface); flex: none; }
|
|
58
|
+
.track .done .dot { background: var(--pass); border-color: var(--pass); color: var(--surface); }
|
|
59
|
+
.track .now .dot { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
|
|
60
|
+
.track .now.you .dot { border-color: var(--human); background: var(--human-bg); color: var(--human); }
|
|
61
|
+
.track .now { color: var(--accent); font-weight: 600; } .track .now.you { color: var(--human); }
|
|
62
|
+
.track .bar { flex: 1 1 14px; min-width: 10px; height: 2px; background: var(--line); margin-inline: 6px; }
|
|
63
|
+
.track .done + .bar { background: var(--pass); }
|
|
64
|
+
.unit .turn { display: grid; gap: 2px; font-size: 13px; justify-items: start; }
|
|
65
|
+
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
|
|
66
|
+
.pill.you { color: var(--human); background: var(--human-bg); } .pill.agent { color: var(--accent); background: var(--accent-bg); } .pill.merged { color: var(--pass); background: var(--pass-bg); }
|
|
67
|
+
section.detail { display: grid; gap: 22px; }
|
|
68
|
+
.headline { display: grid; gap: 8px; }
|
|
69
|
+
.headline h1 { font-size: 26px; font-weight: 700; letter-spacing: -.015em; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
|
|
70
|
+
.headline h1 .key { font-family: var(--mono); font-weight: 500; font-size: 21px; color: var(--accent); }
|
|
71
|
+
.now-box { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
|
|
72
|
+
.now-box.you { background: var(--human-bg); border-color: color-mix(in srgb, var(--human) 35%, transparent); }
|
|
73
|
+
.now-box.merged, .now-box.done { background: var(--pass-bg); }
|
|
74
|
+
.now-box ul { margin: 6px 0 0; padding-left: 18px; }
|
|
75
|
+
.now-box .opt { display: block; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
|
|
76
|
+
.now-box .ico { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--surface); display: grid; place-items: center; font-weight: 700; }
|
|
77
|
+
.now-box.you .ico { background: var(--human); } .now-box.merged .ico, .now-box.done .ico { background: var(--pass); }
|
|
78
|
+
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
|
|
79
|
+
.stat { background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; }
|
|
80
|
+
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
81
|
+
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
|
|
82
|
+
.stat .l { font-size: 12px; color: var(--muted); }
|
|
83
|
+
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 14px; min-width: 0; align-content: start; }
|
|
84
|
+
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
|
|
85
|
+
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
|
|
86
|
+
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
|
|
87
|
+
.scroll { overflow-x: auto; }
|
|
88
|
+
svg text { font-family: var(--font); }
|
|
89
|
+
.t-lane { fill: var(--ink); font-size: 12px; font-weight: 600; } .t-sub { fill: var(--muted); font-size: 10.5px; }
|
|
90
|
+
.t-tick { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); } .t-bar { fill: var(--ink); font-size: 11px; font-weight: 500; }
|
|
91
|
+
.loops { display: grid; gap: 10px; }
|
|
92
|
+
.loop { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: center; }
|
|
93
|
+
.loop .step { font-family: var(--mono); font-size: 13px; }
|
|
94
|
+
.loop .step small { display: block; font-family: var(--font); color: var(--muted); font-size: 11.5px; }
|
|
95
|
+
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
|
96
|
+
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 12.5px var(--font); padding: 5px 10px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; color: var(--ink); }
|
|
97
|
+
.chip .r { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
|
|
98
|
+
.chip.pass { background: var(--pass-bg); } .chip.pass b { color: var(--pass); }
|
|
99
|
+
.chip.notes { background: var(--notes-bg); } .chip.notes b { color: var(--notes); }
|
|
100
|
+
.chip.blocked { background: var(--blocked-bg); } .chip.blocked b { color: var(--blocked); }
|
|
101
|
+
.chip[aria-pressed="true"] { border-color: var(--ink); }
|
|
102
|
+
.arrow { color: var(--muted); font-size: 12px; }
|
|
103
|
+
.newloop { font-size: 11px; color: var(--muted); border-left: 2px dashed var(--line); padding-left: 8px; margin-left: 4px; }
|
|
104
|
+
.cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
|
|
105
|
+
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
|
|
106
|
+
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--line); }
|
|
107
|
+
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
108
|
+
tr:last-child td { border-bottom: 0; }
|
|
109
|
+
.sev { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; }
|
|
110
|
+
.sev.blocker { color: var(--blocked); background: var(--blocked-bg); } .sev.major { color: var(--notes); background: var(--notes-bg); } .sev.minor { color: var(--muted); background: var(--bg); }
|
|
111
|
+
.status { font-size: 12px; font-weight: 600; }
|
|
112
|
+
.status.open { color: var(--notes); } .status.resolved { color: var(--pass); } .status.accepted { color: var(--human); }
|
|
113
|
+
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
114
|
+
.filters button { font: 500 12.5px var(--font); padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
|
|
115
|
+
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
|
|
116
|
+
.findings { max-height: 460px; overflow: auto; }
|
|
117
|
+
.findings tr.hl td { background: var(--accent-bg); }
|
|
118
|
+
.where { font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: block; margin-top: 2px; overflow-wrap: anywhere; }
|
|
119
|
+
.people { display: grid; gap: 10px; }
|
|
120
|
+
.who { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; }
|
|
121
|
+
.av { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
|
|
122
|
+
.av.w { background: var(--accent-bg); color: var(--accent); } .av.r { background: color-mix(in srgb, var(--teal) 18%, var(--surface)); color: var(--teal); } .av.h { background: var(--human-bg); color: var(--human); }
|
|
123
|
+
.who small { color: var(--muted); display: block; font-size: 12px; }
|
|
124
|
+
.empty { color: var(--muted); font-size: 13.5px; }
|
|
125
|
+
footer { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
|
|
126
|
+
@media (max-width: 860px) { .unit { grid-template-columns: 1fr; gap: 10px; } .cols { grid-template-columns: 1fr; } .loop { grid-template-columns: 1fr; gap: 6px; } }
|
|
127
|
+
@media (prefers-reduced-motion: no-preference) { .pulse { animation: pulse 2.4s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .45; } } }
|
|
128
|
+
</style>
|
|
129
|
+
</head>
|
|
130
|
+
<body>
|
|
131
|
+
<div class="wrap">
|
|
132
|
+
<header class="top">
|
|
133
|
+
<div class="brand">
|
|
134
|
+
<svg class="wordmark" viewBox="-14 -153.36 576 217.36" role="img" aria-label="agjan" fill="none" stroke-width="16">
|
|
135
|
+
<path class="ink" d="M91.7 -45.01 A42 42 0 0 1 33.47 -11.39"/><path class="ink" d="M24.83 -16.38 A42 42 0 0 1 24.83 -83.62"/><path class="ink" d="M33.47 -88.61 A42 42 0 0 1 91.7 -54.99"/><path class="teal" d="M92 -100 V0"/>
|
|
136
|
+
<path class="ink" d="M217.7 -45.01 A42 42 0 0 1 159.47 -11.39"/><path class="ink" d="M150.83 -16.38 A42 42 0 0 1 150.83 -83.62"/><path class="ink" d="M159.47 -88.61 A42 42 0 0 1 217.7 -54.99"/><path class="ink" d="M218 -100 V16 A26 26 0 0 1 192 42 H184"/>
|
|
137
|
+
<path class="ink" d="M284 -100 V16 A26 26 0 0 1 258 42 H250"/><circle class="dot" cx="284" cy="-126.88" r="12.48" stroke="none"/>
|
|
138
|
+
<circle class="ink" cx="372" cy="-50" r="42"/><path class="ink" d="M414 -100 V0"/>
|
|
139
|
+
<path class="ink" d="M456 -100 V0"/><path class="ink" d="M456 -50 A42 42 0 0 1 540 -50 V0"/>
|
|
140
|
+
</svg>
|
|
141
|
+
<span id="project">progress</span>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="gen"><span id="generated"></span><span>refresh: <code>npx agjan progress --open</code></span></div>
|
|
144
|
+
</header>
|
|
145
|
+
<section aria-labelledby="ov">
|
|
146
|
+
<div class="panel-head" style="margin-bottom:10px"><h2 id="ov">Project</h2><span class="legend"><span><i style="background:var(--human)"></i>your turn</span><span><i style="background:var(--accent)"></i>agent working</span><span><i style="background:var(--pass)"></i>done or merged</span></span></div>
|
|
147
|
+
<div class="units" id="units"></div>
|
|
148
|
+
</section>
|
|
149
|
+
<section class="detail" id="detail" aria-live="polite"></section>
|
|
150
|
+
<footer>Generated by <span class="mono">agjan progress</span> from <span class="mono">docs/agjan/<unit>/</span> (log.jsonl, reviews.json, approvals.json, tasks.md) and the unit's commits. A static file: it shows the state when it was generated. Every agjan command regenerates it. Times in UTC.</footer>
|
|
151
|
+
</div>
|
|
152
|
+
<script>
|
|
153
|
+
const DATA = /*AGJAN_PROGRESS_DATA*/null;
|
|
154
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
155
|
+
const ms = (at) => Date.parse(at);
|
|
156
|
+
const hm = (at) => at.slice(11, 16);
|
|
157
|
+
const dhm = (at) => `${at.slice(5, 10)} ${at.slice(11, 16)}`;
|
|
158
|
+
const VERDICT = { pass: ['pass', '✓', 'pass'], 'pass-with-notes': ['notes', '●', 'notes'], blocked: ['blocked', '✕', 'blocked'] };
|
|
159
|
+
const KIND = { feature: 'feature', fix: 'fix', map: 'map run' };
|
|
160
|
+
function dur(m) {
|
|
161
|
+
if (m < 60000) return `${Math.max(Math.round(m / 1000), 0)} s`;
|
|
162
|
+
const min = Math.round(m / 60000);
|
|
163
|
+
if (min < 60) return `${min} min`;
|
|
164
|
+
const h = Math.floor(min / 60);
|
|
165
|
+
return h < 48 ? `${h} h ${min % 60} min` : `${Math.floor(h / 24)} d ${h % 24} h`;
|
|
166
|
+
}
|
|
167
|
+
function severities(ids, f) {
|
|
168
|
+
const c = {};
|
|
169
|
+
for (const id of ids) if (f[id]) c[f[id].severity] = (c[f[id].severity] || 0) + 1;
|
|
170
|
+
return ['blocker', 'major', 'minor'].filter((k) => c[k]).map((k) => `${c[k]} ${k}`).join(', ');
|
|
171
|
+
}
|
|
172
|
+
function turnPill(u) {
|
|
173
|
+
if (u.turn === 'you') return `<span class="pill you"><span class="pulse">●</span> Your turn</span>`;
|
|
174
|
+
if (u.turn === 'merged') return `<span class="pill merged">✓ Merged</span>`;
|
|
175
|
+
if (u.turn === 'done') return `<span class="pill merged">✓ Done</span>`;
|
|
176
|
+
return `<span class="pill agent">Agent working</span>`;
|
|
177
|
+
}
|
|
178
|
+
function trackHtml(u) {
|
|
179
|
+
return u.stages.map((s, i) => {
|
|
180
|
+
const finished = u.turn === 'done' || u.turn === 'merged';
|
|
181
|
+
const cls = i < u.at || finished ? 'done' : i === u.at ? `now ${u.turn === 'you' ? 'you' : ''}` : '';
|
|
182
|
+
const markc = i < u.at || finished ? '✓' : i === u.at ? (u.turn === 'you' ? '!' : '…') : '';
|
|
183
|
+
return `<span class="st ${cls}"><span class="dot">${markc}</span>${esc(s)}</span>`;
|
|
184
|
+
}).join('<span class="bar"></span>');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
let selected = null, filter = 'open', focusReview = null;
|
|
188
|
+
|
|
189
|
+
function renderUnits() {
|
|
190
|
+
const box = document.getElementById('units');
|
|
191
|
+
box.innerHTML = '';
|
|
192
|
+
if (!DATA.units.length) { box.innerHTML = '<p class="empty">No features, fixes or map runs yet. Start one with /agjan-spec, /agjan-fix or /agjan-map.</p>'; return; }
|
|
193
|
+
for (const u of DATA.units) {
|
|
194
|
+
const b = document.createElement('button');
|
|
195
|
+
b.type = 'button'; b.className = 'unit'; b.setAttribute('aria-pressed', String(u.slug === selected));
|
|
196
|
+
const kind = `${KIND[u.kind] || u.kind}${u.mode ? ` · ${u.mode} mode` : ''}${u.host ? ` · ${u.host}` : ''}`;
|
|
197
|
+
b.innerHTML = `<span class="name"><span class="key">${esc(u.key)}</span><span class="slug">${esc(u.slug)}</span><span class="kind">${esc(kind)}</span></span>
|
|
198
|
+
<span class="track">${trackHtml(u)}</span>
|
|
199
|
+
<span class="turn">${turnPill(u)}<span class="muted">${esc(u.turn === 'merged' || u.turn === 'done' ? `${u.stats.reviews} review${u.stats.reviews === 1 ? '' : 's'} · last ${dhm(u.last)}` : u.now)}</span></span>`;
|
|
200
|
+
b.addEventListener('click', () => { selected = u.slug; filter = 'open'; focusReview = null; renderUnits(); renderDetail(); });
|
|
201
|
+
box.append(b);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function ticks(t0, t1) {
|
|
206
|
+
const span = t1 - t0, steps = [1, 2, 5, 10, 15, 30, 60, 120, 360, 720, 1440, 2880, 10080].map((m) => m * 60000);
|
|
207
|
+
const step = steps.find((s) => span / s <= 12) || steps.at(-1);
|
|
208
|
+
const out = [];
|
|
209
|
+
for (let t = Math.ceil(t0 / step) * step; t <= t1; t += step) out.push(t);
|
|
210
|
+
return { out, days: span > 20 * 3600000 };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function timeline(u) {
|
|
214
|
+
const W = 1000, L = 150, R = 20;
|
|
215
|
+
// An open wait after the last activity does not stretch the axis: it is cut a little
|
|
216
|
+
// after the last activity, and the open bar runs to the edge with its full duration.
|
|
217
|
+
const t0 = ms(u.start), last = ms(u.last);
|
|
218
|
+
const t1 = Math.max(Math.min(ms(u.end), last + Math.max((last - t0) * 0.25, 120000)), t0 + 60000);
|
|
219
|
+
const pad = (t1 - t0) * 0.02;
|
|
220
|
+
const a = t0 - pad, z = t1 + pad;
|
|
221
|
+
const x = (at) => L + ((ms(at) - a) / (z - a)) * (W - L - R);
|
|
222
|
+
const writer = u.host ? `${u.host}` : 'writer agent';
|
|
223
|
+
let s = `<svg viewBox="0 0 ${W} 214" width="100%" style="min-width:760px" role="img" aria-label="Timeline of ${esc(u.key)}">`;
|
|
224
|
+
const tk = ticks(a, z);
|
|
225
|
+
for (const t of tk.out) {
|
|
226
|
+
const xx = L + ((t - a) / (z - a)) * (W - L - R);
|
|
227
|
+
const iso = new Date(t).toISOString();
|
|
228
|
+
s += `<line x1="${xx}" y1="14" x2="${xx}" y2="188" stroke="var(--line)" stroke-width="1"/><text class="t-tick" x="${xx}" y="206" text-anchor="middle">${tk.days ? dhm(iso) : hm(iso)}</text>`;
|
|
229
|
+
}
|
|
230
|
+
s += `<text class="t-lane" x="0" y="42">Writer</text><text class="t-sub" x="0" y="56">${esc(writer)}</text>`;
|
|
231
|
+
s += `<text class="t-lane" x="0" y="102">Reviewers</text><text class="t-sub" x="0" y="116">isolated agents</text>`;
|
|
232
|
+
s += `<text class="t-lane" x="0" y="162">People</text><text class="t-sub" x="0" y="176">gates in a terminal</text>`;
|
|
233
|
+
for (const w of u.writer) {
|
|
234
|
+
const p = x(w.from), q = x(w.to);
|
|
235
|
+
s += `<rect x="${p}" y="26" width="${Math.max(q - p, 3)}" height="26" rx="4" fill="var(--accent-bg)" stroke="var(--accent)"><title>${esc(w.label)}: ${hm(w.from)}–${hm(w.to)}</title></rect>`;
|
|
236
|
+
if (q - p > 60) s += `<text class="t-bar" x="${p + 6}" y="43">${esc(w.label)}</text>`;
|
|
237
|
+
}
|
|
238
|
+
for (const c of u.commits) s += `<path d="M${x(c.at)} 56 l4 6 h-8 z" fill="var(--accent)"><title>commit ${esc(c.sha)} · ${esc(c.subject)} · ${hm(c.at)}</title></path>`;
|
|
239
|
+
for (const r of u.reviews) {
|
|
240
|
+
const color = r.verdict === 'pass' ? 'var(--pass)' : r.verdict === 'blocked' ? 'var(--blocked)' : 'var(--notes)';
|
|
241
|
+
s += `<circle cx="${x(r.at)}" cy="${r.tier === 'deep' ? 92 : 112}" r="7" fill="${color}"><title>${esc(r.id)} · ${esc(r.step)} round ${r.round} · ${esc(r.verdict)} · ${r.findings.length} finding(s) · ${r.tier} reviewer · ${hm(r.at)}</title></circle>`;
|
|
242
|
+
}
|
|
243
|
+
s += `<text class="t-sub" x="${W - R}" y="95" text-anchor="end">deep</text><text class="t-sub" x="${W - R}" y="115" text-anchor="end">balanced</text>`;
|
|
244
|
+
for (const g of u.gates) {
|
|
245
|
+
const p = x(g.from), q = Math.min(x(g.to), W - R);
|
|
246
|
+
const wait = dur(ms(g.to) - ms(g.from));
|
|
247
|
+
s += `<rect x="${p}" y="148" width="${Math.max(q - p, 3)}" height="24" rx="4" fill="var(--human-bg)" stroke="var(--human)" ${g.open ? '' : 'stroke-dasharray="3 2"'}><title>waiting for a human: ${esc(g.label)} · ${wait}${g.open ? ' (open)' : ''}</title></rect>`;
|
|
248
|
+
if (q - p > 50) s += `<text class="t-bar" x="${p + 5}" y="164" style="fill:var(--human)">${esc(g.label)}${g.open ? ` · ${wait} →` : ''}</text>`;
|
|
249
|
+
}
|
|
250
|
+
for (const d of u.decisions) s += `<path d="M${x(d.at)} 144 v32" stroke="var(--human)" stroke-width="2"><title>${esc(d.what)} · ${esc(d.by)} · ${hm(d.at)}</title></path>`;
|
|
251
|
+
return s + '</svg>';
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function loops(u) {
|
|
255
|
+
const steps = [...new Set(u.reviews.map((r) => r.step))];
|
|
256
|
+
if (!steps.length) return '<p class="empty">No reviews yet.</p>';
|
|
257
|
+
return steps.map((st) => {
|
|
258
|
+
const rs = u.reviews.filter((r) => r.step === st);
|
|
259
|
+
const chips = rs.map((r, i) => {
|
|
260
|
+
const [cls, sym, word] = VERDICT[r.verdict];
|
|
261
|
+
const counts = r.findings.length ? ` · ${severities(r.findings, u.findings)}` : '';
|
|
262
|
+
const pre = i && r.round === 1 ? '<span class="newloop">new loop</span>' : i ? '<span class="arrow">→</span>' : '';
|
|
263
|
+
return `${pre}<button type="button" class="chip ${cls}" data-review="${esc(r.id)}" aria-pressed="${r.id === focusReview}"><span class="r">${esc(r.id)} · round ${r.round}</span><b>${sym} ${word}</b>${esc(counts)}</button>`;
|
|
264
|
+
}).join('');
|
|
265
|
+
const tier = rs[0].tier === 'deep' ? 'deep reviewer' : 'reviewer';
|
|
266
|
+
return `<div class="loop"><span class="step">${esc(st)}<small>${tier} · ${rs.length} review${rs.length > 1 ? 's' : ''}</small></span><span class="chips">${chips}</span></div>`;
|
|
267
|
+
}).join('');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function findingRows(u) {
|
|
271
|
+
const focus = focusReview && u.reviews.find((r) => r.id === focusReview);
|
|
272
|
+
const ids = Object.keys(u.findings).filter((id) => (filter === 'all' || u.findings[id].status === filter) && (!focus || focus.findings.includes(id) || focus.resolves.includes(id)));
|
|
273
|
+
if (!ids.length) return '<tr><td colspan="3" class="empty">No findings in this view.</td></tr>';
|
|
274
|
+
return ids.map((id) => {
|
|
275
|
+
const f = u.findings[id];
|
|
276
|
+
const st = f.status === 'resolved' ? `resolved by ${esc(f.resolvedBy || '')}` : f.status === 'accepted' ? `accepted: ${esc(f.acceptReason)}` : 'open';
|
|
277
|
+
const hl = focus && focus.resolves.includes(id) ? ' class="hl"' : '';
|
|
278
|
+
const ev = f.evidence ? `<span class="where">evidence: ${esc(f.evidence)}</span>` : '';
|
|
279
|
+
return `<tr${hl}><td class="mono" style="white-space:nowrap">${esc(id)}<br><span class="sev ${esc(f.severity)}">${esc(f.severity)}</span></td><td>${esc(f.issue)}<span class="where">${f.file ? `${esc(f.file)} · ` : ''}raised in ${esc(f.raisedBy)}</span>${ev}</td><td><span class="status ${esc(f.status)}">${st}</span></td></tr>`;
|
|
280
|
+
}).join('');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function renderDetail() {
|
|
284
|
+
const u = DATA.units.find((x) => x.slug === selected);
|
|
285
|
+
const d = document.getElementById('detail');
|
|
286
|
+
if (!u) { d.innerHTML = ''; return; }
|
|
287
|
+
const s = u.stats;
|
|
288
|
+
const count = (st) => Object.values(u.findings).filter((f) => st === 'all' || f.status === st).length;
|
|
289
|
+
const icon = u.turn === 'you' ? '!' : u.turn === 'merged' || u.turn === 'done' ? '✓' : '…';
|
|
290
|
+
const who = u.turn === 'you' ? 'Your turn' : u.turn === 'merged' ? 'Merged' : u.turn === 'done' ? 'Done' : 'The agent is working';
|
|
291
|
+
const optional = (u.optional || []).length ? `<span class="opt">Optional next steps</span><ul>${u.optional.map((o) => `<li>${esc(o)}</li>`).join('')}</ul>` : '';
|
|
292
|
+
const acs = u.acs ? `<div class="stat"><span class="v">${u.acs.passing ?? u.acs.withTests}/${u.acs.automated}</span><span class="l">ACs with ${u.acs.passing === null ? '' : 'passing '}tests${u.acs.manual.length ? ` · ${u.acs.manual.length} manual` : ''}</span></div>` : '';
|
|
293
|
+
const tasks = u.tasks.length ? `<div class="stat"><span class="v">${u.tasks.filter((t) => t.done).length}/${u.tasks.length}</span><span class="l">tasks committed</span></div>` : '';
|
|
294
|
+
const taskRows = u.tasks.map((t) => `<tr><td><span class="mono">${esc(t.id)}</span> <span class="muted">${esc(t.area)}</span><br>${esc(t.title)}<br><span class="muted">covers ${esc(t.covers.join(', '))}</span></td><td class="mono">${t.commits.map(esc).join('<br>') || '–'}</td><td class="mono">${t.reviews.map(esc).join(', ') || '–'}</td></tr>`).join('');
|
|
295
|
+
const reviewers = u.reviewers.map((r) => `<div class="who"><span class="av r">${r.tier === 'deep' ? 'D' : 'R'}</span><span><b>${esc(r.name)}</b> · ${esc(r.tier)} · ${esc(r.model)}<small>${r.count} review${r.count > 1 ? 's' : ''}: ${esc(r.steps.join(', '))}${r.isolated ? ' · isolated' : ''}</small></span></div>`).join('');
|
|
296
|
+
const people = u.humans.map((h) => {
|
|
297
|
+
const acts = u.decisions.filter((x) => x.by === h).map((x) => `${x.what} ${hm(x.at)}`).join(' · ');
|
|
298
|
+
return `<div class="who"><span class="av h">${esc(h.slice(0, 2).toUpperCase())}</span><span><b>${esc(h)}</b> · human<small>${esc(acts)}</small></span></div>`;
|
|
299
|
+
}).join('');
|
|
300
|
+
d.innerHTML = `
|
|
301
|
+
<div class="headline"><h2>${esc(KIND[u.kind] || u.kind)}</h2><h1><span class="key">${esc(u.key)}</span>${esc(u.title)}</h1>
|
|
302
|
+
<span class="muted"><span class="mono">docs/agjan/${esc(u.slug)}/</span>${u.mode ? ` · ${esc(u.mode)} mode` : ''}${u.areas.length ? ` · areas ${esc(u.areas.join(', '))}` : ''} · started ${dhm(u.start)}</span></div>
|
|
303
|
+
<div class="now-box ${esc(u.turn)}" role="status"><span class="ico" aria-hidden="true">${icon}</span><span><b>${who}:</b> ${esc(u.now)}${u.turn !== 'done' && u.acs && u.acs.manual.length ? ` · check by hand: ${esc(u.acs.manual.join(', '))}` : ''}${optional}</span></div>
|
|
304
|
+
<div class="stats">
|
|
305
|
+
<div class="stat"><span class="v">${dur(s.activeMs)}</span><span class="l">agent work</span></div>
|
|
306
|
+
<div class="stat"><span class="v">${dur(s.waitingMs)}</span><span class="l">waiting for a human</span></div>
|
|
307
|
+
${tasks}${acs}
|
|
308
|
+
<div class="stat"><span class="v">${s.reviews} <small>${s.blocked} blocked</small></span><span class="l">reviews</span></div>
|
|
309
|
+
<div class="stat"><span class="v">${s.openFindings} <small>/ ${s.totalFindings}</small></span><span class="l">findings open · ${s.openBlockers} blocker(s)</span></div>
|
|
310
|
+
</div>
|
|
311
|
+
<div class="panel"><div class="panel-head"><h3>Timeline</h3><span class="legend"><span><i style="background:var(--accent)"></i>writer step · ▲ commit</span><span><i style="background:var(--pass)"></i>pass</span><span><i style="background:var(--notes)"></i>notes</span><span><i style="background:var(--blocked)"></i>blocked</span><span><i style="background:var(--human)"></i>waiting for a human · | decision</span></span></div>
|
|
312
|
+
<div class="scroll">${timeline(u)}</div></div>
|
|
313
|
+
<div class="panel"><div class="panel-head"><h3>Review loops</h3><span class="muted" style="font-size:12.5px">Up to ${u.roundLimit} rounds per loop. Select a round to see what it raised and resolved.</span></div><div class="loops">${loops(u)}</div></div>
|
|
314
|
+
<div class="cols">
|
|
315
|
+
<div class="panel"><div class="panel-head"><h3>Findings</h3><div class="filters" role="group" aria-label="Filter findings">
|
|
316
|
+
${['open', 'resolved', 'accepted', 'all'].map((f) => `<button type="button" data-f="${f}" aria-pressed="${f === filter}">${f[0].toUpperCase() + f.slice(1)} · ${count(f)}</button>`).join('')}
|
|
317
|
+
</div></div><div class="findings"><table><thead><tr><th>Id</th><th>Issue</th><th>Status</th></tr></thead><tbody id="ftable">${findingRows(u)}</tbody></table></div></div>
|
|
318
|
+
<div style="display:grid;gap:16px;align-content:start">
|
|
319
|
+
${u.tasks.length ? `<div class="panel"><h3>Tasks</h3><table><thead><tr><th>Task</th><th>Commits</th><th>Reviews</th></tr></thead><tbody>${taskRows}</tbody></table></div>` : ''}
|
|
320
|
+
<div class="panel"><h3>Who worked on it</h3><div class="people">
|
|
321
|
+
${u.host ? `<div class="who"><span class="av w">W</span><span><b>Writer</b> · ${esc(u.host)}<small>${u.writer.length} step${u.writer.length === 1 ? '' : 's'} · ${u.commits.length} commit${u.commits.length === 1 ? '' : 's'}</small></span></div>` : ''}
|
|
322
|
+
${reviewers}${people}
|
|
323
|
+
${!u.host && !reviewers && !people ? '<p class="empty">Nobody yet.</p>' : ''}
|
|
324
|
+
</div></div>
|
|
325
|
+
</div>
|
|
326
|
+
</div>`;
|
|
327
|
+
d.querySelectorAll('.filters button').forEach((b) => b.addEventListener('click', () => {
|
|
328
|
+
filter = b.dataset.f; focusReview = null; renderDetail();
|
|
329
|
+
}));
|
|
330
|
+
d.querySelectorAll('.chip').forEach((c) => c.addEventListener('click', () => {
|
|
331
|
+
focusReview = focusReview === c.dataset.review ? null : c.dataset.review;
|
|
332
|
+
filter = focusReview ? 'all' : 'open'; renderDetail();
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
document.getElementById('project').textContent = `progress · ${DATA.project}`;
|
|
337
|
+
document.getElementById('generated').textContent = `agjan ${DATA.kit} · generated ${DATA.generatedAt.replace('T', ' ').replace('Z', ' UTC')}`;
|
|
338
|
+
selected = (DATA.units[0] || {}).slug || null;
|
|
339
|
+
renderUnits();
|
|
340
|
+
renderDetail();
|
|
341
|
+
</script>
|
|
342
|
+
</body>
|
|
343
|
+
</html>
|
package/kit/templates/project.md
CHANGED
|
@@ -17,6 +17,11 @@ Each application: its folder, `app_type` (elements or freestyle), the service it
|
|
|
17
17
|
|
|
18
18
|
Runtime, BTP services, deployment targets.
|
|
19
19
|
|
|
20
|
+
## Run locally
|
|
21
|
+
|
|
22
|
+
How to start the application and try it: the command (for example `npx cds watch`),
|
|
23
|
+
the URLs of the apps, and the test users with their roles and passwords.
|
|
24
|
+
|
|
20
25
|
## Conventions
|
|
21
26
|
|
|
22
27
|
Naming, tests, lint.
|
package/package.json
CHANGED
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"file": { "type": "string" },
|
|
57
57
|
"line": { "type": "integer", "minimum": 1 },
|
|
58
58
|
"issue": { "type": "string" },
|
|
59
|
-
"suggestion": { "type": "string" }
|
|
59
|
+
"suggestion": { "type": "string" },
|
|
60
|
+
"evidence": { "type": "string" }
|
|
60
61
|
},
|
|
61
62
|
"additionalProperties": false
|
|
62
63
|
}
|
|
@@ -43,20 +43,26 @@ export const GUARD_HOOK = {
|
|
|
43
43
|
const GUARD_PATH = 'node_modules/agjan/kit/hooks/guard.mjs';
|
|
44
44
|
|
|
45
45
|
/** A guard entry written by an earlier agjan version (for example the exec form). */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
/** The tools the guard sees: the shell, and the file edit tools (records, allow_edits). */
|
|
47
|
+
export const GUARD_MATCHER = 'Bash|Edit|Write|MultiEdit|NotebookEdit';
|
|
48
|
+
|
|
49
|
+
const isGuard = (hook) => JSON.stringify(hook).includes(GUARD_PATH);
|
|
50
|
+
const isCurrent = (hook) => JSON.stringify(hook) === JSON.stringify(GUARD_HOOK);
|
|
50
51
|
|
|
52
|
+
/** The current guard, in a group with the current matcher, and no other guard entry. */
|
|
51
53
|
function hasGuard(data) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
+
const groups = data.hooks?.PreToolUse ?? [];
|
|
55
|
+
const guards = groups.flatMap((group) => (group.hooks ?? []).filter(isGuard).map((hook) => ({ group, hook })));
|
|
56
|
+
return guards.length === 1 && isCurrent(guards[0].hook) && guards[0].group.matcher === GUARD_MATCHER;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
59
|
+
/**
|
|
60
|
+
* PreToolUse without any guard entry (earlier forms, or the current one under an older
|
|
61
|
+
* matcher such as 'Bash'); a group left empty is dropped. The caller adds the current one.
|
|
62
|
+
*/
|
|
63
|
+
function withoutGuards(groups) {
|
|
58
64
|
return groups
|
|
59
|
-
.map((group) => (group.hooks?.some(
|
|
65
|
+
.map((group) => (group.hooks?.some(isGuard) ? { ...group, hooks: group.hooks.filter((h) => !isGuard(h)) } : group))
|
|
60
66
|
.filter((group) => !Array.isArray(group.hooks) || group.hooks.length > 0);
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -106,9 +112,7 @@ export function plan(config, skills) {
|
|
|
106
112
|
const deny = [...new Set([...(data.permissions?.deny ?? []), ...DENY_RULES])];
|
|
107
113
|
let hooks = data.hooks ?? {};
|
|
108
114
|
if (!hasGuard(data)) {
|
|
109
|
-
|
|
110
|
-
const current = groups.some((g) => (g.hooks ?? []).some((h) => JSON.stringify(h) === JSON.stringify(GUARD_HOOK)));
|
|
111
|
-
hooks = { ...hooks, PreToolUse: current ? groups : [...groups, { matcher: 'Bash', hooks: [GUARD_HOOK] }] };
|
|
115
|
+
hooks = { ...hooks, PreToolUse: [...withoutGuards(hooks.PreToolUse ?? []), { matcher: GUARD_MATCHER, hooks: [GUARD_HOOK] }] };
|
|
112
116
|
}
|
|
113
117
|
return { ...data, permissions: { ...(data.permissions ?? {}), deny }, hooks };
|
|
114
118
|
},
|
package/src/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, pkg } from './context.mjs';
|
|
2
2
|
import { AgjanError } from './errors.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { createStyle, mark } from './ui.mjs';
|
|
4
4
|
import * as newCommand from './commands/new.mjs';
|
|
5
5
|
import * as gates from './commands/gates.mjs';
|
|
6
6
|
import * as check from './commands/check.mjs';
|
|
@@ -13,6 +13,9 @@ import * as report from './commands/report.mjs';
|
|
|
13
13
|
import * as fix from './commands/fix.mjs';
|
|
14
14
|
import * as mapCommand from './commands/map.mjs';
|
|
15
15
|
import * as branch from './commands/branch.mjs';
|
|
16
|
+
import * as progress from './commands/progress.mjs';
|
|
17
|
+
import { onEvent } from './log.mjs';
|
|
18
|
+
import { refreshAfterEvent } from './progress-view.mjs';
|
|
16
19
|
|
|
17
20
|
const COMMANDS = {
|
|
18
21
|
init: setup.init,
|
|
@@ -20,6 +23,7 @@ const COMMANDS = {
|
|
|
20
23
|
doctor: setup.doctor,
|
|
21
24
|
hook: setup.hook,
|
|
22
25
|
branch: branch.run,
|
|
26
|
+
progress: progress.run,
|
|
23
27
|
new: newCommand.run,
|
|
24
28
|
scaffold: newCommand.scaffold,
|
|
25
29
|
status: status.run,
|
|
@@ -58,6 +62,8 @@ Agent and human:
|
|
|
58
62
|
git.branch.create "confirm": a human, who may edit the name)
|
|
59
63
|
new <slug> --key <KEY> create a feature folder with approvals.json and spec.md
|
|
60
64
|
scaffold design create design.md and tasks.md from the templates
|
|
65
|
+
progress [--open] regenerate the progress pages and show the overview
|
|
66
|
+
(.agjan/progress.html, docs/agjan/<unit>/progress.md)
|
|
61
67
|
status [--feature <s> | --all]
|
|
62
68
|
show the state of the changed (or every) feature
|
|
63
69
|
check [--staged | --ci] [--base <ref>]
|
|
@@ -101,13 +107,13 @@ export async function main(args, options = {}) {
|
|
|
101
107
|
|
|
102
108
|
if (command === undefined || command === '--help' || command === '-h' || command === 'help') {
|
|
103
109
|
const s = createStyle(stdout);
|
|
104
|
-
if (!s.
|
|
110
|
+
if (!s.brand) {
|
|
105
111
|
stdout.write(HELP);
|
|
106
112
|
return 0;
|
|
107
113
|
}
|
|
108
|
-
// On a terminal: the
|
|
114
|
+
// On a terminal: the agjan mark instead of the first line, and bold section headings.
|
|
109
115
|
const body = HELP.split('\n').slice(1).map((l) => (/^\S.*:$/.test(l) ? s.bold(l) : l));
|
|
110
|
-
stdout.write(`${[...
|
|
116
|
+
stdout.write(`${[...mark(s, pkg.version), ...body.slice(1)].join('\n')}`);
|
|
111
117
|
return 0;
|
|
112
118
|
}
|
|
113
119
|
if (command === '--version' || command === '-v' || command === 'version') {
|
|
@@ -115,6 +121,8 @@ export async function main(args, options = {}) {
|
|
|
115
121
|
return 0;
|
|
116
122
|
}
|
|
117
123
|
|
|
124
|
+
// Every recorded event regenerates the progress pages (docs/agjan/<unit>/progress.md, .agjan/).
|
|
125
|
+
onEvent((unitDir) => refreshAfterEvent(unitDir, pkg.version));
|
|
118
126
|
const handler = COMMANDS[command];
|
|
119
127
|
if (!handler) {
|
|
120
128
|
stderr.write(`agjan: unknown command '${command}'. Run 'agjan --help'.\n`);
|
package/src/commands/check.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { FIX_FILE, fixRules, freshReview } from '../fix.mjs';
|
|
|
13
13
|
import { BASELINE_FILE, baselineDrift, projectProblems } from '../baseline.mjs';
|
|
14
14
|
import { UsageError } from '../errors.mjs';
|
|
15
15
|
import { readJson } from '../json-file.mjs';
|
|
16
|
-
import { verdictColor } from '../ui.mjs';
|
|
16
|
+
import { markLine, verdictColor } from '../ui.mjs';
|
|
17
17
|
import { planStatus } from '../managed.mjs';
|
|
18
18
|
import { buildPlan } from '../plan.mjs';
|
|
19
19
|
|
|
@@ -290,6 +290,8 @@ function checkPolicy(report, root, config, files, base) {
|
|
|
290
290
|
|
|
291
291
|
function print(ctx, report, level, slugs) {
|
|
292
292
|
const s = ctx.style;
|
|
293
|
+
// Not in the pre-commit hook (--staged): it runs on every commit.
|
|
294
|
+
if (level !== 'staged') for (const line of markLine(s, ctx.kit, level === 'ci' ? 'check --ci' : 'check')) ctx.out(line);
|
|
293
295
|
for (const item of report.items) {
|
|
294
296
|
const label = item.level === 'error' ? s.bold(s.red('error')) : s.bold(s.yellow('warn '));
|
|
295
297
|
ctx.out(`${label} ${s.cyan(item.scope)}: ${item.message}`);
|
package/src/commands/gates.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { appendLog, readLog } from '../log.mjs';
|
|
|
6
6
|
import { APPROVALS_FILE, FEATURES_DIR, gateReview, loadFeature, selectFeature } from '../feature.mjs';
|
|
7
7
|
import { documentProblems, designProblems } from '../validate.mjs';
|
|
8
8
|
import { AgjanError, UsageError } from '../errors.mjs';
|
|
9
|
-
import { tone } from '../ui.mjs';
|
|
9
|
+
import { mark, tone } from '../ui.mjs';
|
|
10
10
|
import { git } from '../git.mjs';
|
|
11
11
|
|
|
12
12
|
function short(hash) {
|
|
@@ -25,7 +25,7 @@ function save(ctx, feature, event, fields) {
|
|
|
25
25
|
/** Shows what is being approved and asks the human to type the feature key (design 9.4). */
|
|
26
26
|
function confirmGate(ctx, feature, title, lines) {
|
|
27
27
|
const summary = [
|
|
28
|
-
'',
|
|
28
|
+
...(ctx.style.brand ? mark(ctx.style, ctx.kit, 'a human decision, recorded with your name') : ['']),
|
|
29
29
|
ctx.style.bold(`agjan: ${title}`),
|
|
30
30
|
` feature ${ctx.style.bold(feature.slug)} (${ctx.style.cyan(feature.key)})`,
|
|
31
31
|
...lines.map((l) => ` ${l}`),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { relative } from 'node:path';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { writeProgress } from '../progress-view.mjs';
|
|
5
|
+
import { markLine, tone } from '../ui.mjs';
|
|
6
|
+
|
|
7
|
+
/** Opens a file with the system's default application; failures are reported, not thrown. */
|
|
8
|
+
function openFile(file) {
|
|
9
|
+
const [cmd, args] = process.platform === 'win32' ? ['cmd', ['/c', 'start', '""', file]] : [process.platform === 'darwin' ? 'open' : 'xdg-open', [file]];
|
|
10
|
+
try {
|
|
11
|
+
const child = spawn(cmd, args, { stdio: 'ignore', detached: true });
|
|
12
|
+
child.on('error', () => {});
|
|
13
|
+
child.unref();
|
|
14
|
+
return true;
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** agjan progress [--open]: regenerates the progress pages and prints the overview. */
|
|
21
|
+
export function run(ctx, argv) {
|
|
22
|
+
const { values } = parseArgs({ args: argv, options: { open: { type: 'boolean' } } });
|
|
23
|
+
const s = ctx.style;
|
|
24
|
+
const result = writeProgress(ctx, { now: Date.parse(ctx.now()) });
|
|
25
|
+
for (const line of markLine(s, ctx.kit, 'progress')) ctx.out(line);
|
|
26
|
+
if (!result) {
|
|
27
|
+
ctx.err('agjan progress: the pages could not be generated; run npx agjan check for details');
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
if (!result.models.length) ctx.out('no features, fixes or map runs yet');
|
|
31
|
+
for (const m of result.models) {
|
|
32
|
+
const turn = m.turn === 'you' ? s.violet('your turn') : m.turn === 'merged' ? tone(s, 'merged') : s.cyan('agent working');
|
|
33
|
+
const stage = m.stages[Math.min(m.at, m.stages.length - 1)];
|
|
34
|
+
ctx.out(`${s.bold(m.key.padEnd(6))} ${m.slug.padEnd(34)} ${stage.padEnd(15)} ${turn}${m.turn === 'merged' ? '' : s.gray(` · ${m.now}`)}`);
|
|
35
|
+
}
|
|
36
|
+
const html = relative(ctx.root, result.html).split('\\').join('/');
|
|
37
|
+
ctx.out('', `${s.gray('overview')} ${html} ${s.gray('· per unit: docs/agjan/<unit>/progress.md')}`);
|
|
38
|
+
if (values.open && !openFile(result.html)) ctx.out(`open ${html} in a browser`);
|
|
39
|
+
return 0;
|
|
40
|
+
}
|