@leing2021/super-pi 0.25.0 → 0.25.1

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.
@@ -101,7 +101,7 @@ export class AskUserQuestionSelector extends Container {
101
101
 
102
102
  render(width: number): string[] {
103
103
  const lines: string[] = []
104
- const fg = this.theme.fg
104
+ const fg = this.theme.fg.bind(this.theme)
105
105
  const innerWidth = Math.max(20, width - 2)
106
106
 
107
107
  lines.push(truncateToWidth(fg("accent", "─".repeat(width)), width))
@@ -58,10 +58,16 @@ export function normalizeQuestionOptions(options: string[]): Map<string, string>
58
58
  const count = (labelCounts.get(baseLabel) ?? 0) + 1
59
59
  labelCounts.set(baseLabel, count)
60
60
 
61
- const label = count === 1 ? baseLabel : `${baseLabel} (#${count})`
62
- // Guard against the extremely unlikely suffix collision by re-checking.
63
- const finalLabel = labelToOriginal.has(label) ? `${label} (#${count})` : label
64
- labelToOriginal.set(finalLabel, original)
61
+ // Start from the count-based suffix, then keep appending (#n) until we find
62
+ // a label that is truly unused. This handles pathological inputs where an
63
+ // option's own text already ends in `(#k)` and would otherwise collide.
64
+ let label = count === 1 ? baseLabel : `${baseLabel} (#${count})`
65
+ let dedup = count
66
+ while (labelToOriginal.has(label)) {
67
+ dedup += 1
68
+ label = `${baseLabel} (#${dedup})`
69
+ }
70
+ labelToOriginal.set(label, original)
65
71
  }
66
72
 
67
73
  return labelToOriginal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leing2021/super-pi",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Pi-native Compound Engineering package for iterative development workflows",
@@ -36,10 +36,12 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@earendil-works/pi-coding-agent": ">=0.74.0",
39
+ "@earendil-works/pi-tui": ">=0.74.0",
39
40
  "typebox": ">=1.0.0"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@earendil-works/pi-coding-agent": "^0.76.0",
44
+ "@earendil-works/pi-tui": "^0.76.0",
43
45
  "bun-types": "^1.3.12"
44
46
  },
45
47
  "pi": {