pantheon-opencode 2.0.0-beta.6 → 2.0.0

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.
Files changed (93) hide show
  1. package/AGENTS.global.md +7 -2
  2. package/AGENTS.md +8 -8
  3. package/CHANGELOG.md +99 -0
  4. package/README.md +171 -510
  5. package/README.pt-BR.md +179 -149
  6. package/bin/pantheon-init.mjs +14 -1
  7. package/commands/pantheon-audit.md +1 -1
  8. package/commands/pantheon-deepwork.md +7 -2
  9. package/commands/pantheon-optimize.md +41 -63
  10. package/commands/pantheon.md +10 -5
  11. package/package.json +4 -3
  12. package/plugin.json +2 -2
  13. package/prompts/optimize-database.prompt.md +5 -5
  14. package/prompts/orchestrate-with-zeus.prompt.md +82 -290
  15. package/prompts/plan-architecture.prompt.md +6 -6
  16. package/prompts/subtask.prompt.md +1 -1
  17. package/pyproject.toml +1 -1
  18. package/scripts/build-agents-md.mjs +10 -10
  19. package/scripts/build-plugin.mjs +26 -0
  20. package/scripts/doctor.mjs +27 -11
  21. package/scripts/hooks/format-multi-language.sh +30 -48
  22. package/scripts/install/opencode-version.mjs +17 -5
  23. package/scripts/install/opencode.mjs +8 -1
  24. package/scripts/jev-live-probe.mjs +1 -1
  25. package/scripts/optimize.mjs +322 -0
  26. package/scripts/prune.mjs +105 -14
  27. package/scripts/release-gates.mjs +19 -5
  28. package/scripts/skill-search.mjs +27 -3
  29. package/scripts/test-opencode-sandbox.sh +44 -15
  30. package/scripts/update.mjs +29 -17
  31. package/skills-lock.json +15 -13
  32. package/src/agents/aphrodite.md +17 -14
  33. package/src/agents/apollo.md +10 -207
  34. package/src/agents/athena.md +30 -34
  35. package/src/agents/demeter.md +2 -0
  36. package/src/agents/hephaestus.md +1 -0
  37. package/src/agents/hermes.md +21 -95
  38. package/src/agents/iris.md +3 -0
  39. package/src/agents/mnemosyne.md +1 -1
  40. package/src/agents/nyx.md +2 -1
  41. package/src/agents/prometheus.md +2 -203
  42. package/src/agents/talos.md +5 -0
  43. package/src/agents/themis.md +93 -84
  44. package/src/agents/zeus.md +44 -263
  45. package/src/instructions/agent-return-format.instructions.md +1 -1
  46. package/src/instructions/memory-protocol.instructions.md +5 -1
  47. package/src/instructions/test-economy.instructions.md +1 -0
  48. package/src/instructions/zeus-anti-stall.instructions.md +3 -3
  49. package/src/instructions/zeus-communication-rules.instructions.md +1 -1
  50. package/src/instructions/zeus-council-synthesis.instructions.md +15 -3
  51. package/src/instructions/zeus-timeout-retry.instructions.md +10 -10
  52. package/src/pantheon/model-command.ts +12 -12
  53. package/src/pantheon/pantheon-decision-catalog.ts +8 -0
  54. package/src/pantheon/skill-search-tool.ts +193 -0
  55. package/src/pantheon/tools.ts +6 -0
  56. package/src/pantheon/tui-version-check.ts +1 -1
  57. package/src/pantheon/update-notifier.ts +13 -8
  58. package/src/pantheon/vision.ts +20 -20
  59. package/src/plugin/index.js +14594 -0
  60. package/src/plugins/tui/dist/tui.d.ts +15 -5
  61. package/src/plugins/tui/dist/tui.d.ts.map +1 -1
  62. package/src/plugins/tui/dist/tui.js +1761 -556
  63. package/src/plugins/tui/dist/tui.js.map +1 -1
  64. package/src/plugins/tui/package-lock.json +2 -2
  65. package/src/plugins/tui/package.json +1 -1
  66. package/src/plugins/tui/src/autonomy-state.ts +28 -16
  67. package/src/plugins/tui/src/context-gauge.ts +64 -5
  68. package/src/plugins/tui/src/decision-router-state.ts +49 -2
  69. package/src/plugins/tui/src/index.tsx +69 -26
  70. package/src/plugins/tui/src/pantheon-settings-state.ts +99 -0
  71. package/src/plugins/tui/src/pantheon-settings.tsx +771 -125
  72. package/src/plugins/tui/src/tui-prefs.ts +266 -12
  73. package/src/plugins/tui/src/update-notice.ts +9 -6
  74. package/src/plugins/tui/src/update-status.ts +27 -8
  75. package/src/plugins/tui/src/whats-new-open.ts +4 -4
  76. package/src/plugins/tui/src/whats-new.tsx +119 -17
  77. package/src/routing.yml +9 -0
  78. package/src/skills/README.md +35 -25
  79. package/src/skills/agent-coordination/SKILL.md +6 -6
  80. package/src/skills/artifact-management/SKILL.md +43 -39
  81. package/src/skills/artifact-management/references/artifact-templates.md +103 -48
  82. package/src/skills/auto-continue/references/auto-continue-details.md +13 -13
  83. package/src/skills/code-review-checklist/SKILL.md +6 -6
  84. package/src/skills/fast-path-execution/SKILL.md +54 -0
  85. package/src/skills/incremental-implementation/SKILL.md +13 -13
  86. package/src/skills/memory-bank/references/anti-patterns.md +3 -3
  87. package/src/skills/prompt-refinery/SKILL.md +51 -65
  88. package/src/skills/spec-driven-development/SKILL.md +12 -14
  89. package/src/skills/tdd-with-agents/SKILL.md +23 -10
  90. package/src/skills/test-slicing/SKILL.md +56 -0
  91. package/src/skills/verification-planning/SKILL.md +4 -3
  92. package/src/skills/visual-review-pipeline/SKILL.md +1 -1
  93. package/src/skills/visual-review-pipeline/references/workflow-steps.md +1 -1
@@ -12,8 +12,11 @@
12
12
  * sub-lines and gauge style, and the two Pantheon footer lines. Everything
13
13
  * defaults to on — the window exists to turn things OFF.
14
14
  */
15
+
15
16
  import type { Context } from '@opencode/plugin/tui/context'
16
- import type { SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
17
+ import type { Accessor, Setter } from 'solid-js'
18
+ import { createSignal } from 'solid-js'
19
+ import type { SettingsDraft, SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
17
20
 
18
21
  // ── The durable store handle (host storage, one per plugin) ────────────
19
22
  // Created once at setup and stashed under a globalThis symbol so
@@ -21,12 +24,40 @@ import type { SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
21
24
  // singleton doctrine as the plugin's SINGLETON guard).
22
25
 
23
26
  const PREFS_SYMBOL = Symbol.for('pantheon.tui.prefs.v1')
27
+ const DRAFT_PREVIEW_SYMBOL = Symbol.for('pantheon.tui.draft_preview.v1')
24
28
  type PrefsStore = readonly [TuiPrefs, (mutation: (draft: TuiPrefs) => void) => Promise<void>]
29
+ type DraftSignal = [Accessor<SettingsDraft | undefined>, Setter<SettingsDraft | undefined>]
25
30
 
26
31
  function stash(): PrefsStore | undefined {
27
32
  return (globalThis as Record<PropertyKey, unknown>)[PREFS_SYMBOL] as PrefsStore | undefined
28
33
  }
29
34
 
35
+ function getDraftPreviewSignal(): DraftSignal {
36
+ const g = globalThis as Record<PropertyKey, unknown>
37
+ if (!g[DRAFT_PREVIEW_SYMBOL]) {
38
+ g[DRAFT_PREVIEW_SYMBOL] = createSignal<SettingsDraft | undefined>(undefined)
39
+ }
40
+ return g[DRAFT_PREVIEW_SYMBOL] as DraftSignal
41
+ }
42
+
43
+ /** Set the active draft preview overlay (used by settings window to provide live preview). */
44
+ export function setTuiDraftPreview(draft: SettingsDraft | undefined): void {
45
+ const [, setDraft] = getDraftPreviewSignal()
46
+ setDraft(draft && Object.keys(draft).length > 0 ? { ...draft } : undefined)
47
+ }
48
+
49
+ /** Clear the active draft preview overlay. */
50
+ export function clearTuiDraftPreview(): void {
51
+ const [, setDraft] = getDraftPreviewSignal()
52
+ setDraft(undefined)
53
+ }
54
+
55
+ /** The active draft preview accessor. */
56
+ export function tuiDraftPreview(): SettingsDraft | undefined {
57
+ const [draft] = getDraftPreviewSignal()
58
+ return draft()
59
+ }
60
+
30
61
  /** Create (or reuse) the durable prefs store. Fail-open: without host
31
62
  * storage the consumers fall back to DEFAULT_TUI_PREFS (read-only). */
32
63
  export function initTuiPrefs(context: Context): void {
@@ -37,15 +68,73 @@ export function initTuiPrefs(context: Context): void {
37
68
  | undefined
38
69
  if (handle !== undefined) {
39
70
  ;(globalThis as unknown as Record<PropertyKey, unknown>)[PREFS_SYMBOL] = handle
71
+ // Self-heal: if store was persisted before layout existed, backfill missing top-level defaults
72
+ if (!handle[0]?.layout) {
73
+ handle[1]((draft: any) => {
74
+ if (!draft.layout) {
75
+ draft.layout = { ...DEFAULT_TUI_PREFS.layout }
76
+ }
77
+ }).catch(() => {})
78
+ }
40
79
  }
41
80
  } catch {
42
81
  /* no host storage — defaults stay read-only */
43
82
  }
44
83
  }
45
84
 
46
- /** The live reactive prefs (read properties inside memos/JSX — tracked). */
85
+ /** Deep clone and overlay staged settings draft onto base TuiPrefs. */
86
+ export function previewTuiPrefs(base: TuiPrefs, draft?: SettingsDraft): TuiPrefs {
87
+ if (!draft || Object.keys(draft).length === 0) return base
88
+ let hasTui = false
89
+ for (const k of Object.keys(draft)) {
90
+ if (k.startsWith('tui.')) {
91
+ hasTui = true
92
+ break
93
+ }
94
+ }
95
+ if (!hasTui) return base
96
+
97
+ const normalized = normalizeTuiPrefs(base)
98
+ const effective: TuiPrefs = {
99
+ version: 1,
100
+ layout: { ...normalized.layout },
101
+ sidebar: {
102
+ header: { ...normalized.sidebar.header },
103
+ blocks: { ...normalized.sidebar.blocks },
104
+ context: { ...normalized.sidebar.context },
105
+ },
106
+ footer: { ...normalized.footer },
107
+ }
108
+
109
+ for (const [id, value] of Object.entries(draft)) {
110
+ if (id.startsWith('tui.')) {
111
+ applyTuiRow(effective, id, value)
112
+ }
113
+ }
114
+ return effective
115
+ }
116
+
117
+ /** The raw persisted prefs from host storage (no draft overlay). */
118
+ export function savedTuiPrefs(): TuiPrefs {
119
+ const s = stash()?.[0]
120
+ if (!s) return DEFAULT_TUI_PREFS
121
+ if (!s.layout) {
122
+ return {
123
+ ...s,
124
+ layout: DEFAULT_TUI_PREFS.layout,
125
+ }
126
+ }
127
+ return s
128
+ }
129
+
130
+ /** The live reactive prefs (read properties inside memos/JSX — tracked).
131
+ * When a settings window has an active draft, preview overlays on top
132
+ * of durable storage in real time. */
47
133
  export function tuiPrefs(): TuiPrefs {
48
- return stash()?.[0] ?? DEFAULT_TUI_PREFS
134
+ const base = savedTuiPrefs()
135
+ const preview = tuiDraftPreview()
136
+ if (!preview) return base
137
+ return previewTuiPrefs(base, preview)
49
138
  }
50
139
 
51
140
  /** Stage a mutation against the durable store; resolves when persisted. */
@@ -58,15 +147,55 @@ export function mutateTuiPrefs(mutation: (draft: TuiPrefs) => void): Promise<voi
58
147
  export const GAUGE_STYLES: readonly string[] = Object.freeze(['both', 'bar', 'percent', 'off'])
59
148
  export const ENABLED_CYCLE: readonly string[] = Object.freeze(['enabled', 'disabled'])
60
149
 
150
+ export const BAR_SHAPES_CYCLE: readonly string[] = Object.freeze([
151
+ 'line',
152
+ 'block',
153
+ 'smooth',
154
+ 'ascii',
155
+ 'dots',
156
+ 'braille',
157
+ ])
158
+ export const BAR_WIDTHS_CYCLE: readonly string[] = Object.freeze([
159
+ 'standard',
160
+ 'compact',
161
+ 'wide',
162
+ 'full',
163
+ ])
164
+ export const LAYOUT_PRESETS_CYCLE: readonly string[] = Object.freeze(['comfortable', 'compact'])
165
+ export const SEPARATOR_STYLES_CYCLE: readonly string[] = Object.freeze([
166
+ 'spaces',
167
+ 'pipes',
168
+ 'dots',
169
+ 'slashes',
170
+ ])
171
+ export const SETTINGS_VIEW_MODES: readonly string[] = Object.freeze([
172
+ 'docked',
173
+ 'fullscreen',
174
+ 'dialog',
175
+ ])
176
+
61
177
  export type GaugeStyle = 'both' | 'bar' | 'percent' | 'off'
178
+ export type BarShapePref = 'line' | 'block' | 'smooth' | 'ascii' | 'dots' | 'braille'
179
+ export type BarWidthPref = 'standard' | 'compact' | 'wide' | 'full'
180
+ export type LayoutPresetPref = 'comfortable' | 'compact'
181
+ export type SeparatorStylePref = 'spaces' | 'pipes' | 'dots' | 'slashes'
182
+ export type SettingsViewModePref = 'docked' | 'fullscreen' | 'dialog'
62
183
 
63
184
  export interface TuiPrefs {
64
185
  version: 1
186
+ layout: {
187
+ preset: LayoutPresetPref
188
+ separator: SeparatorStylePref
189
+ settingsView?: SettingsViewModePref
190
+ }
65
191
  sidebar: {
66
192
  header: { version: boolean; preset: boolean; session: boolean }
67
193
  blocks: { context: boolean; git: boolean; todo: boolean; dispatch: boolean }
68
194
  context: {
69
195
  gauge: GaugeStyle
196
+ barShape: BarShapePref
197
+ barWidth: BarWidthPref
198
+ evenMark: boolean
70
199
  tokens: boolean
71
200
  spent: boolean
72
201
  modelUsage: boolean
@@ -79,11 +208,19 @@ export interface TuiPrefs {
79
208
 
80
209
  export const DEFAULT_TUI_PREFS: TuiPrefs = {
81
210
  version: 1,
211
+ layout: {
212
+ preset: 'comfortable',
213
+ separator: 'spaces',
214
+ settingsView: 'fullscreen',
215
+ },
82
216
  sidebar: {
83
217
  header: { version: true, preset: true, session: true },
84
218
  blocks: { context: true, git: true, todo: true, dispatch: true },
85
219
  context: {
86
220
  gauge: 'both',
221
+ barShape: 'line',
222
+ barWidth: 'standard',
223
+ evenMark: false,
87
224
  tokens: true,
88
225
  spent: true,
89
226
  modelUsage: true,
@@ -101,6 +238,9 @@ function asBool(value: unknown, fallback: boolean): boolean {
101
238
  /** Deep-merge stored JSON over the defaults; unknown keys and junk are ignored. */
102
239
  export function normalizeTuiPrefs(raw: unknown): TuiPrefs {
103
240
  const stored = (typeof raw === 'object' && raw !== null ? raw : {}) as Record<string, any>
241
+ const layout = (
242
+ typeof stored.layout === 'object' && stored.layout !== null ? stored.layout : {}
243
+ ) as Record<string, any>
104
244
  const sidebar = (
105
245
  typeof stored.sidebar === 'object' && stored.sidebar !== null ? stored.sidebar : {}
106
246
  ) as Record<string, any>
@@ -116,11 +256,35 @@ export function normalizeTuiPrefs(raw: unknown): TuiPrefs {
116
256
  const footer = (
117
257
  typeof stored.footer === 'object' && stored.footer !== null ? stored.footer : {}
118
258
  ) as Record<string, any>
259
+ const preset = LAYOUT_PRESETS_CYCLE.includes(layout.preset as string)
260
+ ? (layout.preset as LayoutPresetPref)
261
+ : DEFAULT_TUI_PREFS.layout.preset
262
+ const separator = SEPARATOR_STYLES_CYCLE.includes(layout.separator as string)
263
+ ? (layout.separator as SeparatorStylePref)
264
+ : DEFAULT_TUI_PREFS.layout.separator
265
+ const settingsView = (
266
+ SETTINGS_VIEW_MODES.includes(layout.settingsView as string)
267
+ ? layout.settingsView
268
+ : DEFAULT_TUI_PREFS.layout.settingsView
269
+ ) as SettingsViewModePref
119
270
  const gauge = GAUGE_STYLES.includes(context.gauge as string)
120
271
  ? (context.gauge as GaugeStyle)
121
272
  : DEFAULT_TUI_PREFS.sidebar.context.gauge
273
+ const barShape = BAR_SHAPES_CYCLE.includes(context.barShape as string)
274
+ ? (context.barShape as BarShapePref)
275
+ : DEFAULT_TUI_PREFS.sidebar.context.barShape
276
+ const barWidth = BAR_WIDTHS_CYCLE.includes(context.barWidth as string)
277
+ ? (context.barWidth as BarWidthPref)
278
+ : DEFAULT_TUI_PREFS.sidebar.context.barWidth
279
+ const evenMark = asBool(context.evenMark, DEFAULT_TUI_PREFS.sidebar.context.evenMark)
280
+
122
281
  return {
123
282
  version: 1,
283
+ layout: {
284
+ preset,
285
+ separator,
286
+ settingsView,
287
+ },
124
288
  sidebar: {
125
289
  header: {
126
290
  version: asBool(header.version, true),
@@ -135,6 +299,9 @@ export function normalizeTuiPrefs(raw: unknown): TuiPrefs {
135
299
  },
136
300
  context: {
137
301
  gauge,
302
+ barShape,
303
+ barWidth,
304
+ evenMark,
138
305
  tokens: asBool(context.tokens, true),
139
306
  spent: asBool(context.spent, true),
140
307
  modelUsage: asBool(context.modelUsage, true),
@@ -165,6 +332,64 @@ export function buildTuiTab(prefs: TuiPrefs): SettingsTab {
165
332
  id: 'tui',
166
333
  title: 'TUI',
167
334
  groups: [
335
+ {
336
+ title: 'Preset & Layout',
337
+ rows: [
338
+ {
339
+ id: 'tui.layout.preset',
340
+ name: 'Layout preset',
341
+ value: prefs.layout?.preset ?? DEFAULT_TUI_PREFS.layout.preset,
342
+ cycle: LAYOUT_PRESETS_CYCLE,
343
+ note: 'comfortable | compact — sets spacing & borders',
344
+ },
345
+ {
346
+ id: 'tui.layout.separator',
347
+ name: 'Separator',
348
+ value: prefs.layout?.separator ?? DEFAULT_TUI_PREFS.layout.separator,
349
+ cycle: SEPARATOR_STYLES_CYCLE,
350
+ note: 'spaces | pipes | dots | slashes — status line glyphs',
351
+ },
352
+ {
353
+ id: 'tui.layout.settingsView',
354
+ name: 'Settings surface',
355
+ value: tuiRowValue(prefs, 'tui.layout.settingsView') ?? 'docked',
356
+ cycle: SETTINGS_VIEW_MODES,
357
+ note: 'docked (above prompt) | fullscreen router page | dialog overlay',
358
+ },
359
+ ],
360
+ },
361
+ {
362
+ title: 'Bars & Gauges',
363
+ rows: [
364
+ {
365
+ id: 'tui.sidebar.context.barShape',
366
+ name: 'Bar shape',
367
+ value: prefs.sidebar.context.barShape,
368
+ cycle: BAR_SHAPES_CYCLE,
369
+ note: 'line (━─) | block (▰▱) | smooth (█░) | ascii (=) | dots (●○) | braille',
370
+ },
371
+ {
372
+ id: 'tui.sidebar.context.barWidth',
373
+ name: 'Bar width',
374
+ value: prefs.sidebar.context.barWidth,
375
+ cycle: BAR_WIDTHS_CYCLE,
376
+ note: 'standard (12) | compact (8) | wide (16) | full (20 cells)',
377
+ },
378
+ row(
379
+ 'tui.sidebar.context.evenMark',
380
+ 'Even-use mark',
381
+ prefs.sidebar.context.evenMark,
382
+ '| indicator at 50% midpoint in gauge bars',
383
+ ),
384
+ {
385
+ id: 'tui.sidebar.context.gauge',
386
+ name: 'Gauge style',
387
+ value: prefs.sidebar.context.gauge,
388
+ cycle: GAUGE_STYLES,
389
+ note: 'both | bar | percent | off — `▰▱ 42% of 200k`',
390
+ },
391
+ ],
392
+ },
168
393
  {
169
394
  title: 'Sidebar header',
170
395
  rows: [
@@ -220,13 +445,6 @@ export function buildTuiTab(prefs: TuiPrefs): SettingsTab {
220
445
  {
221
446
  title: 'Context block detail',
222
447
  rows: [
223
- {
224
- id: 'tui.sidebar.context.gauge',
225
- name: 'Gauge style',
226
- value: prefs.sidebar.context.gauge,
227
- cycle: GAUGE_STYLES,
228
- note: 'both | bar | percent | off — `▰▱ 42% of 200k`',
229
- },
230
448
  row(
231
449
  'tui.sidebar.context.tokens',
232
450
  'Tokens row',
@@ -237,7 +455,7 @@ export function buildTuiTab(prefs: TuiPrefs): SettingsTab {
237
455
  'tui.sidebar.context.spent',
238
456
  'Spent row',
239
457
  prefs.sidebar.context.spent,
240
- 'the `$… gasto na sessão` line',
458
+ 'the `$… spent in session` line',
241
459
  ),
242
460
  row(
243
461
  'tui.sidebar.context.modelUsage',
@@ -287,6 +505,33 @@ export function buildTuiTab(prefs: TuiPrefs): SettingsTab {
287
505
  export function applyTuiRow(draft: TuiPrefs, id: string, value: string): void {
288
506
  const enabled = value === 'enabled'
289
507
  switch (id) {
508
+ case 'tui.layout.preset':
509
+ if (LAYOUT_PRESETS_CYCLE.includes(value)) {
510
+ if (!draft.layout) draft.layout = { ...DEFAULT_TUI_PREFS.layout }
511
+ draft.layout.preset = value as LayoutPresetPref
512
+ }
513
+ return
514
+ case 'tui.layout.separator':
515
+ if (SEPARATOR_STYLES_CYCLE.includes(value)) {
516
+ if (!draft.layout) draft.layout = { ...DEFAULT_TUI_PREFS.layout }
517
+ draft.layout.separator = value as SeparatorStylePref
518
+ }
519
+ return
520
+ case 'tui.layout.settingsView':
521
+ if (SETTINGS_VIEW_MODES.includes(value)) {
522
+ if (!draft.layout) draft.layout = { ...DEFAULT_TUI_PREFS.layout }
523
+ draft.layout.settingsView = value as SettingsViewModePref
524
+ }
525
+ return
526
+ case 'tui.sidebar.context.barShape':
527
+ if (BAR_SHAPES_CYCLE.includes(value)) draft.sidebar.context.barShape = value as BarShapePref
528
+ return
529
+ case 'tui.sidebar.context.barWidth':
530
+ if (BAR_WIDTHS_CYCLE.includes(value)) draft.sidebar.context.barWidth = value as BarWidthPref
531
+ return
532
+ case 'tui.sidebar.context.evenMark':
533
+ draft.sidebar.context.evenMark = enabled
534
+ return
290
535
  case 'tui.sidebar.header.version':
291
536
  draft.sidebar.header.version = enabled
292
537
  return
@@ -337,9 +582,18 @@ export function applyTuiRow(draft: TuiPrefs, id: string, value: string): void {
337
582
  }
338
583
  }
339
584
 
340
- /** Read the current pref value for a row id ('enabled'/'disabled'/gauge). */
585
+ /** Read the current pref value for a row id ('enabled'/'disabled'/gauge/custom). */
341
586
  export function tuiRowValue(prefs: TuiPrefs, id: string): string | undefined {
587
+ if (id === 'tui.layout.preset') return prefs.layout?.preset ?? DEFAULT_TUI_PREFS.layout.preset
588
+ if (id === 'tui.layout.separator')
589
+ return prefs.layout?.separator ?? DEFAULT_TUI_PREFS.layout.separator
590
+ if (id === 'tui.layout.settingsView')
591
+ return prefs.layout?.settingsView ?? DEFAULT_TUI_PREFS.layout.settingsView ?? 'docked'
592
+ if (id === 'tui.sidebar.context.barShape') return prefs.sidebar.context.barShape
593
+ if (id === 'tui.sidebar.context.barWidth') return prefs.sidebar.context.barWidth
342
594
  if (id === 'tui.sidebar.context.gauge') return prefs.sidebar.context.gauge
595
+ if (id === 'tui.sidebar.context.evenMark')
596
+ return prefs.sidebar.context.evenMark ? 'enabled' : 'disabled'
343
597
  const enabled = (() => {
344
598
  switch (id) {
345
599
  case 'tui.sidebar.header.version':
@@ -29,17 +29,19 @@ export interface UpdateNotice {
29
29
  message: string
30
30
  }
31
31
 
32
- /** Semver-ish compare for X.Y.Z[-beta.N]; betas sort before their release. */
32
+ /** Semver-ish compare for X.Y.Z[-(beta|rc).N]; prereleases sort before their release. */
33
33
  export function comparePantheonVersions(left: string, right: string): number {
34
34
  const parse = (version: string) => {
35
35
  const match = String(version)
36
36
  .trim()
37
- .match(/^(\d+)\.(\d+)\.(\d+)(?:-beta\.(\d+))?$/)
37
+ .match(/^(\d+)\.(\d+)\.(\d+)(?:-(beta|rc)\.(\d+))?$/)
38
38
  if (!match) return null
39
- const [, major = '', minor = '', patch = '', beta = ''] = match
39
+ const [, major = '', minor = '', patch = '', stage = '', stageNum = ''] = match
40
+ const stageRank = stage === 'beta' ? 1 : stage === 'rc' ? 2 : 3
40
41
  return {
41
42
  core: [+major, +minor, +patch] as [number, number, number],
42
- beta: beta === '' ? Number.POSITIVE_INFINITY : +beta,
43
+ stageRank,
44
+ stageNum: stage !== '' ? +stageNum : Number.POSITIVE_INFINITY,
43
45
  }
44
46
  }
45
47
  const a = parse(left)
@@ -50,7 +52,8 @@ export function comparePantheonVersions(left: string, right: string): number {
50
52
  if (aMajor !== bMajor) return aMajor - bMajor
51
53
  if (aMinor !== bMinor) return aMinor - bMinor
52
54
  if (aPatch !== bPatch) return aPatch - bPatch
53
- return a.beta - b.beta
55
+ if (a.stageRank !== b.stageRank) return a.stageRank - b.stageRank
56
+ return a.stageNum - b.stageNum
54
57
  }
55
58
 
56
59
  export function pickUpdateNotice(input: UpdateNoticeInput): UpdateNotice | null {
@@ -61,7 +64,7 @@ export function pickUpdateNotice(input: UpdateNoticeInput): UpdateNotice | null
61
64
  if (nowMs - lastCheck < ttlMs) return null
62
65
  if (state.lastNotifiedVersion === latestVersion) return null
63
66
 
64
- const stable = (version: string) => !/-beta\.\d+$/.test(version)
67
+ const stable = (version: string) => !/-(?:beta|rc)\.\d+$/.test(version)
65
68
  // A stable install is never advertised a beta: the update guard owns that
66
69
  // crossing and requires explicit opt-in there.
67
70
  if (stable(currentVersion) && !stable(latestVersion)) return null
@@ -36,24 +36,35 @@ function formatAgo(ms: number): string {
36
36
  export interface UpdatesSectionInput {
37
37
  currentVersion: string
38
38
  state: UpdateCheckState
39
+ /** Selected channel (defaults to updateChannelFor(currentVersion)). */
40
+ selectedChannel?: UpdateChannel
39
41
  /** Latest version seen this session (a check-now inside this window). */
40
42
  lastCheckedVersion?: string
41
43
  /** A check-now is in flight (this window). */
42
44
  checking?: boolean
45
+ /** An update run is in flight (this window). */
46
+ updating?: boolean
43
47
  nowMs?: number
44
48
  }
45
49
 
46
50
  export function buildUpdatesTab(input: UpdatesSectionInput): SettingsTab {
47
51
  const nowMs = input.nowMs ?? Date.now()
48
- const channel = updateChannelFor(input.currentVersion)
52
+ const channel = input.selectedChannel ?? updateChannelFor(input.currentVersion)
49
53
  const lastCheckMs = input.state.lastCheckMs
50
54
  const latest = input.lastCheckedVersion ?? input.state.lastNotifiedVersion
51
55
 
56
+ const stable = (version: string) => !/-beta\.\d+$/.test(version)
57
+ const newer =
58
+ latest !== undefined &&
59
+ comparePantheonVersions(latest, input.currentVersion) > 0 &&
60
+ !(stable(input.currentVersion) && !stable(latest))
61
+
52
62
  const rows: SettingsRow[] = [
53
63
  {
54
64
  id: 'update.channel',
55
65
  name: 'Channel',
56
66
  value: channel,
67
+ cycle: ['stable', 'beta'] as const,
57
68
  note: 'stable tracks npm `latest`; beta tracks npm `beta`',
58
69
  },
59
70
  {
@@ -70,23 +81,31 @@ export function buildUpdatesTab(input: UpdatesSectionInput): SettingsTab {
70
81
  ]
71
82
 
72
83
  if (latest) {
73
- // Same guard as pickUpdateNotice: a stable install is never advertised a
74
- // beta — the update CLI owns that crossing (explicit opt-in).
75
- const stable = (version: string) => !/-beta\.\d+$/.test(version)
76
- const newer =
77
- comparePantheonVersions(latest, input.currentVersion) > 0 &&
78
- !(stable(input.currentVersion) && !stable(latest))
79
84
  rows.push({
80
85
  id: 'update.latest',
81
86
  name: 'Registry',
82
87
  value: newer ? `v${latest} available` : 'up to date',
83
88
  note: newer ? 'adopt with `pantheon-opencode update`' : 'no newer compatible version',
84
89
  })
90
+ rows.push({
91
+ id: 'update.run',
92
+ name: 'Update now',
93
+ value: input.updating ? 'updating…' : newer ? `install v${latest}` : 'reinstall / refresh',
94
+ action: 'update-run',
95
+ note: newer ? 'enter runs `pantheon-opencode update`' : 'enter refreshes installed copy',
96
+ })
85
97
  }
86
98
 
99
+ rows.push({
100
+ id: 'update.command',
101
+ name: 'CLI command',
102
+ value: channel === 'beta' ? 'pantheon-opencode update' : 'pantheon-opencode update --stable',
103
+ note: 'run in terminal or OpenCode Desktop terminal',
104
+ })
105
+
87
106
  return {
88
107
  id: 'updates',
89
108
  title: 'Updates',
90
- groups: [{ title: 'Updates', rows }],
109
+ groups: [{ title: 'Updates & Maintenance', rows }],
91
110
  }
92
111
  }
@@ -24,14 +24,14 @@ import {
24
24
  } from './whats-new-highlights.ts'
25
25
  import { markSeenWhatsNew, shouldShowWhatsNew } from './whats-new-state.ts'
26
26
 
27
- /** Muted footer hint teaching the dismiss bind (Portuguese, like the sidebar). */
28
- export const WHATS_NEW_CLOSE_HINT = 'esc/q fechar'
27
+ /** Muted footer hint teaching the dismiss bind. */
28
+ export const WHATS_NEW_CLOSE_HINT = 'esc/q close'
29
29
 
30
30
  /** Hint variant when the highlights span more than one page. */
31
- export const WHATS_NEW_PAGES_HINT = 'esc/q fechar · n próxima · p volta'
31
+ export const WHATS_NEW_PAGES_HINT = 'esc/q close · n next · p back'
32
32
 
33
33
  /** The CHANGELOG pointer shown under the highlights (the window summarizes; the file is complete). */
34
- export const WHATS_NEW_MORE_HINT = 'CHANGELOG completo: CHANGELOG.md no pacote'
34
+ export const WHATS_NEW_MORE_HINT = 'Full CHANGELOG: CHANGELOG.md in package'
35
35
 
36
36
  /** Rows per page — bounded so no changelog can overflow the terminal. */
37
37
  export const WHATS_NEW_PAGE_SIZE = 14