@johngaynor/entourage 0.0.0-stage → 0.1.2

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.
@@ -0,0 +1,207 @@
1
+ {
2
+ "id": "root",
3
+ "cloned_from": {
4
+ "name": "main",
5
+ "version": "0.1.18"
6
+ },
7
+ "type": "row",
8
+ "children": [
9
+ {
10
+ "id": "sidebar",
11
+ "type": "column",
12
+ "children": [
13
+ {
14
+ "id": "brand",
15
+ "type": "block",
16
+ "content": {
17
+ "mod": "workspace-chrome"
18
+ },
19
+ "size": {
20
+ "px": 46
21
+ },
22
+ "window_drag": true
23
+ },
24
+ {
25
+ "id": "layout-switch",
26
+ "type": "block",
27
+ "size": {
28
+ "px": 40
29
+ },
30
+ "content": {
31
+ "mod": "layout-switch"
32
+ }
33
+ },
34
+ {
35
+ "id": "sidebar-lists",
36
+ "type": "column",
37
+ "children": [
38
+ {
39
+ "id": "spaces",
40
+ "type": "block",
41
+ "content": {
42
+ "mod": "spaces"
43
+ },
44
+ "size": {
45
+ "weight": 1
46
+ },
47
+ "min": 90
48
+ },
49
+ {
50
+ "id": "agents",
51
+ "type": "block",
52
+ "content": {
53
+ "mod": "agents"
54
+ },
55
+ "size": {
56
+ "weight": 1
57
+ },
58
+ "min": 90
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "id": "cpu",
64
+ "type": "block",
65
+ "size": {
66
+ "px": 64
67
+ },
68
+ "content": {
69
+ "mod": "cpu"
70
+ }
71
+ },
72
+ {
73
+ "id": "sidebar-footer",
74
+ "type": "block",
75
+ "content": {
76
+ "mod": "workspace-chrome",
77
+ "props": {
78
+ "footer": true
79
+ }
80
+ },
81
+ "size": {
82
+ "px": 69
83
+ }
84
+ }
85
+ ],
86
+ "size": {
87
+ "px": 268
88
+ },
89
+ "min": 44,
90
+ "max": 480,
91
+ "background": "chrome",
92
+ "resizable": false
93
+ },
94
+ {
95
+ "id": "work",
96
+ "type": "column",
97
+ "children": [
98
+ {
99
+ "id": "tabs",
100
+ "type": "block",
101
+ "content": {
102
+ "mod": "tabs"
103
+ },
104
+ "size": {
105
+ "px": 42
106
+ },
107
+ "window_drag": true
108
+ },
109
+ {
110
+ "id": "work-body",
111
+ "type": "row",
112
+ "children": [
113
+ {
114
+ "id": "main",
115
+ "type": "block",
116
+ "content": {
117
+ "tab": "active",
118
+ "pane": {
119
+ "header": {
120
+ "content": {
121
+ "mod": "pane"
122
+ },
123
+ "reveal": "always",
124
+ "height": 30,
125
+ "position": "top"
126
+ },
127
+ "background": "background",
128
+ "border": {
129
+ "width": 1,
130
+ "color": "border"
131
+ },
132
+ "focus": {
133
+ "width": 1,
134
+ "color": "accent"
135
+ },
136
+ "radius": 10,
137
+ "gap": 8,
138
+ "lone": true
139
+ }
140
+ }
141
+ },
142
+ {
143
+ "id": "panel",
144
+ "type": "column",
145
+ "children": [
146
+ {
147
+ "id": "panel-body",
148
+ "type": "stack",
149
+ "children": [
150
+ {
151
+ "id": "files",
152
+ "type": "block",
153
+ "content": {
154
+ "mod": "files"
155
+ }
156
+ },
157
+ {
158
+ "id": "changes",
159
+ "type": "block",
160
+ "content": {
161
+ "mod": "changes"
162
+ }
163
+ }
164
+ ],
165
+ "active": "files"
166
+ }
167
+ ],
168
+ "size": {
169
+ "px": 368
170
+ },
171
+ "min": 280,
172
+ "max": 900,
173
+ "hidden": true
174
+ }
175
+ ],
176
+ "padding": 8,
177
+ "gap": 8
178
+ },
179
+ {
180
+ "id": "status",
181
+ "type": "block",
182
+ "content": {
183
+ "mod": "workspace-status"
184
+ },
185
+ "size": {
186
+ "px": 28
187
+ }
188
+ }
189
+ ],
190
+ "resizable": false
191
+ }
192
+ ],
193
+ "background": "canvas",
194
+ "terminal_padding": [
195
+ 14,
196
+ 12
197
+ ],
198
+ "divider": {
199
+ "width": 1,
200
+ "color": "border"
201
+ },
202
+ "titlebar": "none",
203
+ "traffic_lights": [
204
+ 12,
205
+ 16
206
+ ]
207
+ }
@@ -0,0 +1,90 @@
1
+ // Live CPU usage, drawn as a scrolling history like Activity Monitor's.
2
+ // macOS only: it reads the "CPU usage" line that /usr/bin/top prints.
3
+ import { View, div } from "gpui-kit";
4
+ import { h_flex, v_flex } from "gpui-base";
5
+ import { exec, theme, window, checking, settings } from "herdr";
6
+
7
+ const SAMPLE_MS = 2000; // one reading every two seconds
8
+ const BAR = 3; // px per reading
9
+ const GAP = 1;
10
+ const KEEP = 600; // readings kept, enough for a very wide panel
11
+
12
+ export default class Cpu extends View {
13
+ init(_props, cx) {
14
+ this.samples = [];
15
+ this.busy = false;
16
+ this.error = null;
17
+ this.graph = { width: 240, height: 40 };
18
+ if (checking()) return;
19
+ cx.timer.every(SAMPLE_MS, (cx) => this.sample(cx));
20
+ this.sample(cx);
21
+ }
22
+
23
+ sample(cx) {
24
+ // Skip while a reading is in flight or nobody can see the window.
25
+ if (this.busy || window()?.visible === false) return;
26
+ this.busy = true;
27
+ cx.spawn(async (cx) => {
28
+ try {
29
+ // top's first sample averages since boot; the second covers the last second.
30
+ const r = await exec("/usr/bin/top", ["-l", "2", "-n", "0", "-s", "1"], { timeout: 10000 });
31
+ const line = r.stdout.split("\n").filter((l) => l.startsWith("CPU usage:")).at(-1);
32
+ const m = line?.match(/([\d.]+)% user, ([\d.]+)% sys/);
33
+ if (m) {
34
+ this.samples.push({ user: Number(m[1]), sys: Number(m[2]) });
35
+ if (this.samples.length > KEEP) this.samples.shift();
36
+ this.error = null;
37
+ } else {
38
+ this.error = "no CPU reading from top";
39
+ }
40
+ } catch (e) {
41
+ this.error = String(e?.message ?? e);
42
+ }
43
+ this.busy = false;
44
+ cx.notify();
45
+ });
46
+ }
47
+
48
+ render() {
49
+ const t = theme();
50
+ const userColor = t.ansi4;
51
+ const sysColor = t.ansi1;
52
+ const last = this.samples.at(-1);
53
+ const total = last ? Math.round(last.user + last.sys) : null;
54
+
55
+ const fit = Math.max(1, Math.floor(this.graph.width / (BAR + GAP)));
56
+ const shown = this.samples.slice(-fit);
57
+ const h = Math.max(1, this.graph.height);
58
+ const px = (pct) => Math.round((Math.min(100, pct) / 100) * h);
59
+
60
+ const legend = (color, text) =>
61
+ h_flex().gap(5).items_center().child(div().size(6).rounded(3).bg(color)).child(text);
62
+
63
+ const readout = v_flex().flex_none().w(132).gap(2).justify_center()
64
+ .child(h_flex().gap(8).items_end()
65
+ .child(div().text_size(11).text_color(t.muted).child("CPU"))
66
+ .child(div().text_size(20).font_semibold().text_color(t.foreground).child(total === null ? "–" : `${total}%`)))
67
+ .child(this.error
68
+ ? div().text_size(11).text_color(t.blocked).truncate().child(this.error)
69
+ : h_flex().gap(10).text_size(11).text_color(t.muted)
70
+ .child(legend(userColor, last ? `user ${Math.round(last.user)}%` : "user"))
71
+ .child(legend(sysColor, last ? `sys ${Math.round(last.sys)}%` : "sys")));
72
+
73
+ const bars = h_flex().id("cpu-graph").flex_1().h_full().min_w(0).overflow_hidden()
74
+ .items_end().justify_end().gap(GAP).rounded(4).bg(t.surface)
75
+ .on_size_change((size, cx) => {
76
+ const zoom = Number(settings().zoom) || 1;
77
+ this.graph = { width: size.width / zoom, height: size.height / zoom };
78
+ cx.notify();
79
+ })
80
+ .children(shown.map((s) =>
81
+ v_flex().flex_none().w(BAR)
82
+ .child(div().h(px(s.sys)).bg(sysColor))
83
+ .child(div().h(px(s.user)).bg(userColor))));
84
+
85
+ return h_flex().size_full().px(14).py(8).gap(12).items_center()
86
+ .bg(t.chrome).border_t(1).border_color(t.border)
87
+ .child(readout)
88
+ .child(bars);
89
+ }
90
+ }
@@ -0,0 +1 @@
1
+ { "place": "bottom", "size": 64 }
@@ -0,0 +1,48 @@
1
+ // A dropdown that shows the current layout and switches to another.
2
+ // One mod, two faces: the button a layout places, and the popup list it opens
3
+ // (the same mod again, with props { menu: true }).
4
+ import { View, div } from "gpui-kit";
5
+ import { v_flex, h_flex } from "gpui-base";
6
+ import { layouts, shared, run, theme, props, openOverlay, closeOverlay } from "herdr";
7
+
8
+ const ROW = 28;
9
+
10
+ export default class LayoutSwitch extends View {
11
+ render() {
12
+ return props()?.menu ? this.menu() : this.button();
13
+ }
14
+
15
+ button() {
16
+ const t = theme();
17
+ const current = shared("layout") ?? "main";
18
+ return h_flex().size_full().px(12).items_center().bg(t.chrome).child(
19
+ h_flex().id("layout-switch").flex_1().min_w(0).h(ROW).px(10).gap(8).items_center()
20
+ .rounded(6).border(1).border_color(t.border).bg(t.surface)
21
+ .text_size(12).hover((s) => s.bg(t.hover))
22
+ .on_click(() =>
23
+ openOverlay({
24
+ mod: "layout-switch", kind: "popup", width: 220,
25
+ height: layouts().length * ROW + 10, props: { menu: true },
26
+ }))
27
+ .child(div().flex_none().text_color(t.muted).child("Layout"))
28
+ .child(div().flex_1().min_w(0).truncate().text_color(t.foreground).child(String(current)))
29
+ .child(div().flex_none().text_color(t.dim).child("▾")));
30
+ }
31
+
32
+ menu() {
33
+ const t = theme();
34
+ const current = shared("layout") ?? "main";
35
+ const pick = (name) => {
36
+ closeOverlay(props().overlay);
37
+ if (name !== current) run("layout.switch", { name });
38
+ };
39
+ return v_flex().size_full().p(4).bg(t.popover).text_size(12).children(
40
+ layouts().map((name) =>
41
+ h_flex().id(`layout-${name}`).h(ROW).px(8).gap(8).items_center().rounded(4)
42
+ .hover((s) => s.bg(t.hover))
43
+ .on_click(() => pick(name))
44
+ .child(div().w(12).flex_none().text_color(t.accent).child(name === current ? "✓" : ""))
45
+ .child(div().flex_1().min_w(0).truncate()
46
+ .text_color(name === current ? t.foreground : t.muted).child(name))));
47
+ }
48
+ }
@@ -0,0 +1 @@
1
+ { "place": "none" }
@@ -0,0 +1,19 @@
1
+ <!-- entourage:template -->
2
+ <!-- Delete the line above once this doc is filled in. `entourage status` reports the project as unfinished until then. -->
3
+
4
+ # __NAME__
5
+
6
+ One paragraph: what this project is, who it is for, and what "done" usually
7
+ looks like for a piece of work in it.
8
+
9
+ ## Repos
10
+
11
+ One section per repo in this project. An agent reads this to decide which
12
+ repo a piece of work belongs in, so be specific.
13
+
14
+ ### example-repo
15
+
16
+ - **Owns:** what lives here and nowhere else.
17
+ - **Does not own:** things people expect to find here but that live in
18
+ another repo, and which repo that is.
19
+ - **Run and test:** how to set it up and how to run its tests.
package/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "@johngaynor/entourage",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.2",
4
+ "description": "A software factory: agent skills and the Herdr setup to run them, installed with one command.",
5
+ "bin": {
6
+ "entourage": "cli/entourage"
7
+ },
8
+ "files": [
9
+ "cli/entourage",
10
+ "cli/lib/",
11
+ "herdr/",
12
+ "prompts/",
13
+ "skills/"
14
+ ],
15
+ "scripts": {
16
+ "test": "test/run.sh"
17
+ },
18
+ "os": [
19
+ "darwin",
20
+ "linux"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/johngaynor/entourage.git"
25
+ }
26
+ }
@@ -0,0 +1,14 @@
1
+ Write up Linear card {card} so that it is ready to build. This session is in the entourage project `{project}`.
2
+
3
+ Use these three skills, in this order: sdlc-define, then sdlc-plan, then sdlc-breakdown.
4
+
5
+ - Do all three yourself, in this session. Don't hand a step to a subagent.
6
+ - Finish each skill's section on the card before you start the next skill.
7
+ - When a skill tells you to report and stop, carry on to the next skill instead. I only need to hear from you when a skill says to ask me something, and at the end.
8
+ - sdlc-breakdown ends by asking me to approve the card. Wait for my answer.
9
+
10
+ Once I approve, give me the command that starts the work, and don't run it yourself:
11
+
12
+ entourage task start {project} <type>/<card-id>-<short-name>
13
+
14
+ Use the type you set on the card, the card's ID in lowercase, and two to four words from its title, in lowercase with hyphens. If the card was sliced, give the command for the first sub-issue.
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: sdlc-breakdown
3
+ description: Decide whether a planned Linear card is one piece or several, by cutting it into thin end-to-end slices (elephant carpaccio) where it can be cut, then, once John approves, creating each slice as a sub-issue. Use this after plan on every card, and whenever asked to break down, slice or split a card, or to judge whether a card is too big for one pull request.
4
+ ---
5
+
6
+ # Break down a card
7
+
8
+ Breakdown is the third step of the lifecycle. Define said what is wanted and plan said how. Breakdown decides whether the card is built as one piece or as several, and if several, what each piece is.
9
+
10
+ The method is elephant carpaccio: cut the work into slices so thin that each one is small, yet each still works end to end. The aim is the earliest usable slice, followed by slices that extend it. Useful comes before done.
11
+
12
+ Thin slices matter more when an agent is building. Each slice can be checked end to end as soon as it merges, a mistake stays inside one small pull request, and if the third slice never ships, the first two still work.
13
+
14
+ This skill has two parts. Proposing, and asking John to approve, happens on every card. Creating sub-issues happens only after he approves a card that was sliced.
15
+
16
+ ## Before you write anything
17
+
18
+ 1. Read the card with the Linear tools: the Specification and the Plan.
19
+ 2. If either is missing, the earlier step hasn't run. Say so and stop.
20
+ 3. If the card is itself a sub-issue, don't slice it again. Slices go one level deep. If it looks too big, tell John.
21
+ 4. If the card already has a Breakdown section, don't write a second one. Tell John and ask whether he wants it revised.
22
+
23
+ ## Part 1: Propose
24
+
25
+ ### First, is it already small?
26
+
27
+ Look at the plan's Changes. If the whole card is one agent, one sitting and one quick pull request, it stands as one piece, even if you could cut it further. Every slice costs John a review and a merge, so don't slice for its own sake.
28
+
29
+ ### If it is too big, try to cut it
30
+
31
+ Cut along behaviour, using Done when as the map. Use the plan only to judge size and order.
32
+
33
+ A piece is a slice only if it passes all four checks:
34
+
35
+ 1. **Vertical.** It carries one narrow piece of behaviour through every layer it needs. "The database part" and "the API part" are layers, not slices.
36
+ 2. **Testable end to end.** Once it merges, there is something to click, read or call, and its own Done when can be checked without the later slices.
37
+ 3. **Mergeable alone.** It is safe on main if nothing after it ever ships. Feature flags aren't available, so a slice has to be acceptable for users to see as it is.
38
+ 4. **Small.** One agent, one sitting, one quick pull request.
39
+
40
+ Ways to make a slice thinner while keeping it end to end:
41
+
42
+ - One case before many.
43
+ - A fixed choice before a configurable one.
44
+ - Reading before writing.
45
+ - The main path before the rare ones.
46
+ - One kind of user before the others.
47
+
48
+ Permission and safety checks are not something to thin out. They go in the first slice that exposes the thing they protect, because a slice that ships an unprotected endpoint isn't mergeable alone.
49
+
50
+ Then check the set:
51
+
52
+ - **The first slice is the thinnest path that works.** Each later slice extends the one before.
53
+ - **Nothing is lost.** Every Done when item on the card is covered by a slice, whole or narrowed across more than one.
54
+ - **Nothing is added.** Slices divide the Specification. They don't grow it.
55
+ - **Each slice has its own Done when**, one to four outcomes written by the same rules as the card's.
56
+ - **The slices run in order.** Each builds on the last.
57
+
58
+ Two to five slices is usual. If you need more than six, the card is probably several cards. Propose what you have and say so when you finish.
59
+
60
+ ### If it can't be cut
61
+
62
+ Some work has no cut that passes the checks. A refactor may have nothing to click halfway through. A migration may have to land together. A first slice may not be acceptable for users to see without the rest.
63
+
64
+ Then the card stands as one piece, however large it is. Don't force a cut that fails a check. A horizontal slice is worse than a large card, because it merges something nobody can test. Say in one line why it can't be cut, and if it is large, tell John when you finish.
65
+
66
+ ### Write it to the card
67
+
68
+ Append a Breakdown section below the Plan. Leave it open, not collapsible, because it is what John reads to approve the card. Change nothing above it.
69
+
70
+ For one piece:
71
+
72
+ ```
73
+ ## Breakdown
74
+ One piece. <one line on why: already small, or why it can't be cut>
75
+ ```
76
+
77
+ For slices:
78
+
79
+ ```
80
+ ## Breakdown
81
+ 1. **<slice name: a short phrase for the behaviour>**
82
+ - [ ] <its Done when>
83
+ - [ ] …
84
+ 2. **<slice name>**
85
+ - [ ] …
86
+ ```
87
+
88
+ Create nothing else in Linear yet. A proposal John turns down should leave nothing behind to clean up.
89
+
90
+ ### Ask John to approve
91
+
92
+ Breakdown is the last step before building, so it ends by asking John to approve the whole card: the Specification, the Plan and the Breakdown together. This happens on every card, sliced or not.
93
+
94
+ Give him a summary he can answer from without opening Linear:
95
+
96
+ - The type.
97
+ - The Done when list.
98
+ - The approach, in a sentence or two.
99
+ - Whether it is one piece or several, and why. If several, the slice names in order.
100
+
101
+ Then ask him to approve or say what to change, and wait.
102
+
103
+ | John says | Then |
104
+ |---|---|
105
+ | Change the breakdown | Revise the Breakdown section and ask again |
106
+ | Change the Specification or the Plan | Make the change by that section's own skill, `sdlc-define` or `sdlc-plan`. Then re-check every section below the one that changed, because a new Done when item can make the Plan and the Breakdown wrong. Ask again |
107
+ | Yes, and the card is one piece | Tell him the card is approved and ready to build. Setup and build aren't built yet, so stop there |
108
+ | Yes, and the card is sliced | Go on to part 2 |
109
+
110
+ ## Part 2: Create the sub-issues
111
+
112
+ Do this only when John has approved the card in this session, and only when the breakdown has more than one slice.
113
+
114
+ For each slice, in order, create a sub-issue of the card:
115
+
116
+ - **Title.** The slice name.
117
+ - **Type.** The parent's type, set as the label. Slices don't get a type of their own.
118
+ - **Description.** One or two sentences saying what this slice delivers, then its own sections in the same form as any card:
119
+ - A collapsed Specification, with the parent's Why narrowed to this slice, and the slice's Done when.
120
+ - A collapsed Plan, with the approach in a sentence or two, only the files this slice touches, and the Tests lines for its Done when items.
121
+ - A Breakdown section that reads `One piece. Slice <n> of <total>.`
122
+ - **Order.** Mark it as blocked by the slice before it. The first slice is blocked by nothing.
123
+
124
+ A sub-issue has to stand alone. The build step will open it in a fresh session and see only that card, so anything it needs from the parent goes into it.
125
+
126
+ Then update the parent's Breakdown list so each slice name carries its sub-issue's ID. The parent is not built. It stays as the record of the whole.
127
+
128
+ Read the parent and each sub-issue back. Tell John what was created, in order, and which slice is first. Setup and build aren't built yet, so stop there.
129
+
130
+ ## If something goes wrong
131
+
132
+ | When this happens | Do this |
133
+ |---|---|
134
+ | The card ID doesn't resolve | Ask John for the ID. Don't pick a card because its title looks similar |
135
+ | The Linear tools aren't available | Stop and say so. Show the finished section in the session so the work isn't lost. Don't save it somewhere else and report the step as done |
136
+ | A write to the card fails | Read the card before doing anything else. Retry once, and only if the section isn't there, so it can't be added twice |
137
+ | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell John |
138
+ | Creating the sub-issues stops partway | Don't start over. List the sub-issues the card already has, create only the missing ones, then set the blocking order |
139
+ | A blocking relation can't be set | Tell John. The order is still on the parent's Breakdown list, so it isn't lost |
140
+ | John's answer isn't a clear yes | Treat it as a change request. Ask what he wants changed, then ask for approval again |
141
+
142
+ If something fails that isn't on this list, stop and tell John what happened. Don't work around it.
143
+
144
+ ## Examples
145
+
146
+ **One piece.** The card "Export orders as CSV" has a plan that touches four files and delivers one behaviour.
147
+
148
+ ```
149
+ ## Breakdown
150
+ One piece. Four files and one behaviour, small enough for a single pull request.
151
+ ```
152
+
153
+ **Sliced.** The card "Order notes" asks that staff can add notes to an order, edit and delete them, and mark some as visible to the customer. The plan touches the database, the API, the staff app and the customer app.
154
+
155
+ ```
156
+ ## Breakdown
157
+ 1. **Staff can add a note to an order**
158
+ - [ ] On an order, a staff member can type a note and save it.
159
+ - [ ] Saved notes show on the order, newest first, with the author and time.
160
+ - [ ] Someone who is not staff can neither add nor see notes.
161
+ 2. **Staff can edit and delete their own notes**
162
+ - [ ] A staff member can edit a note they wrote, and the note shows it was edited.
163
+ - [ ] A staff member can delete a note they wrote, after confirming.
164
+ - [ ] A staff member cannot edit or delete someone else's note.
165
+ 3. **A note can be shown to the customer**
166
+ - [ ] A staff member can mark a note as visible to the customer.
167
+ - [ ] The customer sees those notes, and only those, on their order page.
168
+ ```
169
+
170
+ **The wrong cut** for the same card:
171
+
172
+ ```
173
+ 1. Notes table and migration
174
+ 2. Notes API
175
+ 3. Notes in the staff app
176
+ ```
177
+
178
+ Nothing can be clicked until the third piece merges, so the first two can't be tested by anyone, and a mistake in the first surfaces two pull requests later.