pi-subagent-manager 0.3.1 → 0.3.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.
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/pi-subagent-manager.svg)](https://www.npmjs.com/package/pi-subagent-manager)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/pi-subagent-manager.svg)](https://www.npmjs.com/package/pi-subagent-manager)
5
5
  [![CI](https://github.com/championswimmer/pi-subagent-manager/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/championswimmer/pi-subagent-manager/actions/workflows/tests.yml)
6
+ [![codecov](https://codecov.io/gh/championswimmer/pi-subagent-manager/branch/main/graph/badge.svg)](https://codecov.io/gh/championswimmer/pi-subagent-manager)
6
7
 
7
8
  A pi extension for named, steerable subagent threads. Agent **types** describe a model's job; thread **paths** describe its ancestry.
8
9
 
@@ -236,6 +237,57 @@ The code is deliberately layered:
236
237
  - `ui.ts`: configuration dialogs and activity/thread UI.
237
238
  - `index.ts`: parent-session lifecycle and extension wiring.
238
239
 
240
+ ## Changelog
241
+
242
+ [CHANGELOG.md](CHANGELOG.md) is generated automatically when a version tag is pushed,
243
+ alongside a [GitHub Release](https://github.com/championswimmer/pi-subagent-manager/releases).
244
+ The [changelog workflow](.github/workflows/changelog.yml) runs independently of npm publishing.
245
+
246
+ - **Major** tags (`v1.0.0`): large `##` headings; optional handwritten highlights go in the GitHub Release.
247
+ - **Minor** tags (`v1.1.0`): smaller `###` headings under their major series.
248
+ - **Patch** tags (`v1.1.1`): `####` headings under their minor release.
249
+ - Missing initial tags get series headings (for example, `0.x` and `0.1.x`). Newer major/minor series appear first; each series starts with its initial release, followed by its patches newest-first.
250
+ - Prereleases are listed separately. Stable releases compare against the previous **stable ancestor tag**, so PRs from release candidates remain in the final release. Prereleases compare against the previous ancestor tag, including earlier prereleases.
251
+
252
+ GitHub's generated release notes list merged PRs and contributors without requiring labels
253
+ or Conventional Commits. The generator also checks **all pages** of closed PRs against the
254
+ Git commit range and adds missing merged PRs, including bots and squash/rebase merges.
255
+ A PR's merge commit must be reachable in the tagged history; unmerged PRs and later merges
256
+ are excluded. Direct commits are available through the full-history/compare links, not as PR bullets.
257
+ Dates are the tagged commit dates. Handwritten release highlights are preserved on reruns;
258
+ automatically generated sections are replaced rather than duplicated.
259
+
260
+ The workflow needs only the built-in `GITHUB_TOKEN` with `contents: write` and
261
+ `pull-requests: read`. It updates just `CHANGELOG.md` on the default branch without force
262
+ pushes. If branch protection is added, allow this automation to update that file or change
263
+ the publishing step to a changelog PR; otherwise the file update will fail, while the
264
+ GitHub Release and workflow artifact remain available.
265
+
266
+ Use **Actions → Publish changelog → Run workflow** to backfill the cumulative changelog.
267
+ Leave `tag` empty to rebuild only the file, or specify an existing tag to publish/repair
268
+ that release too. For a local preview (requires authenticated `gh` with repository contents-write
269
+ permission for GitHub's notes-generation endpoint, and fetched tags):
270
+
271
+ ```sh
272
+ git fetch origin --tags
273
+ GITHUB_REPOSITORY=championswimmer/pi-subagent-manager npm run changelog
274
+ ```
275
+
276
+ This rewrites the local `CHANGELOG.md` but does not publish anything. The workflow uses
277
+ `--publish` to publish the requested release and commit the generated file. Do not manually
278
+ edit generated entries; edit the GitHub Release and rerun the workflow instead.
279
+
280
+ ### Tool choice
281
+
282
+ We use [GitHub generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes)
283
+ plus a small tested renderer. [Release Drafter](https://github.com/release-drafter/release-drafter)
284
+ adds a draft lifecycle; [release-please](https://github.com/googleapis/release-please)
285
+ changes version/tag management and relies on Conventional Commits;
286
+ [git-cliff](https://git-cliff.org/docs/integration/github/) is primarily commit-oriented;
287
+ and [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator)
288
+ adds Ruby/Docker and needs heading postprocessing. Native notes fit the existing tag-based
289
+ npm release process without adding another release manager.
290
+
239
291
  ## Publishing
240
292
 
241
293
  Pushing a `v<version>` tag runs [`.github/workflows/release.yml`](.github/workflows/release.yml)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagent-manager",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Hierarchical, steerable subagent threads for pi",
5
5
  "type": "module",
6
6
  "engines": {
@@ -37,10 +37,12 @@
37
37
  },
38
38
  "scripts": {
39
39
  "check": "tsc --noEmit",
40
+ "changelog": "tsx .github/scripts/changelog.ts",
40
41
  "test": "tsx --test tests/*.test.ts",
42
+ "test:coverage": "mkdir -p coverage && tsx --test --experimental-test-coverage --test-coverage-include='src/**' --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info tests/*.test.ts",
41
43
  "prepublishOnly": "npm run check && npm test",
42
- "format": "prettier --write --print-width 100 src tests agents docs/default-agents.md README.md",
43
- "format:check": "prettier --check --print-width 100 src tests agents docs/default-agents.md README.md"
44
+ "format": "prettier --write --print-width 100 src tests agents .github docs/default-agents.md README.md",
45
+ "format:check": "prettier --check --print-width 100 src tests agents .github docs/default-agents.md README.md"
44
46
  },
45
47
  "dependencies": {
46
48
  "shell-quote": "^1.8.3",
@@ -59,8 +61,10 @@
59
61
  "@earendil-works/pi-coding-agent": "0.99.2",
60
62
  "@earendil-works/pi-tui": "^0.99.2",
61
63
  "@types/node": "^22.0.0",
64
+ "@types/semver": "^7.8.0",
62
65
  "@types/shell-quote": "^1.7.5",
63
66
  "prettier": "^3.9.9",
67
+ "semver": "^7.8.5",
64
68
  "tsx": "^4.20.0",
65
69
  "typebox": "1.3.27",
66
70
  "typescript": "^5.9.0"
package/src/dialog.ts CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  stripTerminalSequences,
15
15
  truncateToWidth,
16
16
  visibleWidth,
17
+ wrapTextWithAnsi,
17
18
  type Component,
18
19
  type TUI,
19
20
  } from "@earendil-works/pi-tui";
@@ -28,6 +29,9 @@ export interface DialogEditorHost extends DialogHost {
28
29
  export interface DialogRow {
29
30
  id: string;
30
31
  label: string;
32
+ labelPrefix?: { text: string; color: Parameters<Theme["fg"]>[0] };
33
+ /** Trusted formatter receives sanitized text; generated ANSI styling is kept when clipping. */
34
+ renderLabel?: (label: string, theme: Theme) => string;
31
35
  value?: string;
32
36
  help?: string;
33
37
  }
@@ -219,7 +223,12 @@ export class DialogMenu {
219
223
  invalidate(): void {}
220
224
  render(width: number): string[] {
221
225
  const height = dialogHeight(this.host);
222
- this.viewport = Math.max(1, height - 7);
226
+ const inner = Math.max(0, width - 4);
227
+ const help = wrapTextWithAnsi(
228
+ dialogText(this.rows[this.selected]?.help ?? ""),
229
+ Math.max(1, inner - 1),
230
+ ).slice(0, Math.max(1, height - 7));
231
+ this.viewport = Math.max(1, height - 6 - help.length);
223
232
  const start = Math.max(
224
233
  0,
225
234
  Math.min(
@@ -227,7 +236,6 @@ export class DialogMenu {
227
236
  this.rows.length - this.viewport,
228
237
  ),
229
238
  );
230
- const inner = Math.max(0, width - 4);
231
239
  const labelWidth = Math.min(28, Math.max(8, Math.floor(inner * 0.35)));
232
240
  const body = [
233
241
  this.theme.fg(
@@ -235,17 +243,26 @@ export class DialogMenu {
235
243
  ` ${this.rows.length ? this.selected + 1 : 0}/${this.rows.length} · Field / Value`,
236
244
  ),
237
245
  ...this.rows.slice(start, start + this.viewport).map((row, i) => {
238
- const label = truncateToWidth(dialogText(row.label), labelWidth, "");
239
- const text = `${start + i === this.selected ? "›" : " "} ${label}${" ".repeat(Math.max(0, labelWidth - visibleWidth(label)))} │ ${dialogText(row.value ?? "")}`;
240
- return start + i === this.selected
241
- ? this.theme.fg("accent", text)
242
- : text;
246
+ const selected = start + i === this.selected;
247
+ const color = (text: string) => selected ? this.theme.fg("accent", text) : text;
248
+ const prefix = row.labelPrefix
249
+ ? truncateToWidth(`${dialogText(row.labelPrefix.text)} `, labelWidth, "")
250
+ : "";
251
+ const plainLabel = dialogText(row.label);
252
+ const label = truncateToWidth(
253
+ row.renderLabel ? row.renderLabel(plainLabel, this.theme) : plainLabel,
254
+ labelWidth - visibleWidth(prefix),
255
+ "",
256
+ true,
257
+ );
258
+ const padding = " ".repeat(Math.max(0, labelWidth - visibleWidth(prefix) - visibleWidth(label)));
259
+ return color(`${selected ? "›" : " "} `)
260
+ + (row.labelPrefix ? this.theme.fg(row.labelPrefix.color, prefix) : "")
261
+ + (row.renderLabel ? label : color(label))
262
+ + color(`${padding} │ ${dialogText(row.value ?? "")}`);
243
263
  }),
244
264
  "",
245
- this.theme.fg(
246
- "muted",
247
- ` ${dialogText(this.rows[this.selected]?.help ?? "")}`,
248
- ),
265
+ ...help.map((line) => this.theme.fg("muted", ` ${line}`)),
249
266
  ];
250
267
  return frameDialog(
251
268
  this.theme,
@@ -322,7 +339,8 @@ export async function dialogInput(
322
339
  "",
323
340
  ...input.render(Math.max(1, width - 4)).map((line) => ` ${line}`),
324
341
  "",
325
- theme.fg("muted", ` ${dialogText(help)}`),
342
+ ...wrapTextWithAnsi(dialogText(help), Math.max(1, width - 5))
343
+ .map((line) => theme.fg("muted", ` ${line}`)),
326
344
  ],
327
345
  "Enter apply · Esc cancel",
328
346
  ),
@@ -17,24 +17,24 @@ const FIELDS = [
17
17
  {
18
18
  id: "maxLevels",
19
19
  label: "Maximum levels",
20
- help: "Includes the root (L1). Positive integer, at most 32.",
20
+ help: "How deep agents can delegate. Your main conversation is level 1; 3 allows an agent and its child. Positive integer, at most 32.",
21
21
  },
22
22
  {
23
23
  id: "maxConcurrent",
24
24
  label: "Concurrent agents",
25
- help: "Shared active-thread limit, including waiting parents. Positive safe integer.",
25
+ help: "How many agents can be active at once across all levels. Parents waiting for children also count. Positive safe integer.",
26
26
  },
27
27
  {
28
28
  id: "maxThreads",
29
29
  label: "Retained threads",
30
- help: "Maximum retained agent sessions. Positive safe integer.",
30
+ help: "How many agent sessions can be kept for follow-up work, including completed and paused agents. At the limit, new agents cannot start. Positive safe integer.",
31
31
  },
32
32
  ] as const;
33
33
 
34
34
  const SCOPED_MODEL_FILTERING = {
35
35
  id: "scopedModelFiltering",
36
36
  label: "Scoped model filtering",
37
- help: "On matches /scoped-models only. Off allows any available model. Draft only until save.",
37
+ help: "On: agents can use only models selected in /scoped-models. Off: agents can use any available model. Save and apply to activate changes.",
38
38
  } as const;
39
39
 
40
40
  export async function configureAgents(
@@ -84,7 +84,9 @@ async function configureAgentsDialog(
84
84
  id: "scope",
85
85
  label: "Save scope",
86
86
  value: scope === "user" ? "Global" : "Trusted project",
87
- help: "Project settings override global settings. Changes apply after saving.",
87
+ help: scope === "user"
88
+ ? "Global: save all values shown as your defaults for every project. Existing trusted-project settings still override them, including here. Switching scope only changes where you save, not the values shown."
89
+ : "Trusted project: save all values shown for this project only, overriding your global defaults here. Other projects are unchanged. Switching scope only changes where you save, not the values shown.",
88
90
  },
89
91
  {
90
92
  id: "types",
@@ -95,12 +97,13 @@ async function configureAgentsDialog(
95
97
  {
96
98
  id: "defaults",
97
99
  label: "Restore defaults",
98
- help: "Reset the draft only; save to apply.",
100
+ help: "Replace all values shown with built-in defaults. Nothing is saved until you choose Save and apply.",
99
101
  },
100
102
  {
101
103
  id: "save",
102
104
  label: "Save and apply",
103
- help: "Apply without interrupting existing agents or discarding retained sessions.",
105
+ labelPrefix: dirty ? { text: "(changes)", color: "warning" as const } : undefined,
106
+ help: "Save all values to the selected scope and reload settings now. Project overrides still take precedence. Running agents and retained sessions are kept.",
104
107
  },
105
108
  {
106
109
  id: "cancel",
package/src/ui.ts CHANGED
@@ -65,7 +65,7 @@ function agentColorToken(color: string | undefined): ThemeColor {
65
65
  : "accent";
66
66
  }
67
67
 
68
- /** Background pill with bold contrasting text. Label is sanitized; caller supplies brackets. */
68
+ /** Background pill with bold contrasting text and padding. Label is sanitized. */
69
69
  function contrastPill(
70
70
  label: string,
71
71
  color: string | undefined,
@@ -93,7 +93,7 @@ function agentTypeBadge(
93
93
  color: string | undefined,
94
94
  theme: AgentBadgeTheme,
95
95
  ): string {
96
- return contrastPill(`[${type}]`, color, theme);
96
+ return contrastPill(type, color, theme);
97
97
  }
98
98
 
99
99
  function agentPath(
@@ -1051,6 +1051,7 @@ async function editAgentTypesDialog(
1051
1051
  ...types.map((type) => ({
1052
1052
  id: type.name,
1053
1053
  label: type.name,
1054
+ renderLabel: (label: string, theme: Theme) => agentTypeBadge(label, type.color, theme),
1054
1055
  value: type.description,
1055
1056
  help: `${type.source ?? "user"} · ${type.filePath ?? ""}`,
1056
1057
  })),