pantheon-opencode 2.0.0-beta.2 → 2.0.0-beta.4

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.
@@ -24,7 +24,7 @@ import {
24
24
  writeFileSync,
25
25
  } from 'node:fs'
26
26
  import { dirname, join } from 'node:path'
27
- import type { SettingsRow, SettingsSection } from './pantheon-settings-state.ts'
27
+ import type { SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
28
28
 
29
29
  /** Mirrors routing.yml `presets:` — drift-pinned against loadPresetDefs(). */
30
30
  export const PRESET_NAMES: readonly string[] = Object.freeze([
@@ -111,33 +111,32 @@ export interface PresetSectionInput {
111
111
  projectName: string | null
112
112
  }
113
113
 
114
- export function buildPresetSection(input: PresetSectionInput): SettingsSection {
115
- const rows: SettingsRow[] = PRESET_NAMES.map((name) => ({
116
- id: `preset.${name}`,
117
- title: name,
118
- description: input.globalName === name ? 'active (global)' : 'enter: activate globally',
119
- disabled: input.globalName === name,
120
- }))
121
- rows.push({
122
- id: 'preset.none',
123
- title: 'none',
124
- description: 'clear the global marker — opencode defaults',
125
- disabled: input.globalName === null,
126
- marker: input.globalName === null ? '[x]' : '[ ]',
127
- })
114
+ /** The staged value 'none' means: delete the global marker (the CLI contract). */
115
+ export const PRESET_NONE = 'none'
116
+
117
+ export const PRESET_CYCLE: readonly string[] = Object.freeze([PRESET_NONE, ...PRESET_NAMES])
118
+
119
+ export function buildPresetTab(input: PresetSectionInput): SettingsTab {
120
+ const rows: SettingsRow[] = [
121
+ {
122
+ id: 'preset',
123
+ name: 'Preset',
124
+ value: input.globalName ?? PRESET_NONE,
125
+ cycle: PRESET_CYCLE,
126
+ note: 'global marker · atomic write, .bak backup · none = opencode defaults',
127
+ },
128
+ ]
128
129
  if (input.projectName !== null) {
129
130
  rows.push({
130
131
  id: 'preset.project',
131
- title: `${input.projectName} (project)`,
132
- description: `${projectActivePresetPath()} wins over the global marker`,
133
- marker: '[!]',
134
- selectable: false,
132
+ name: 'Project',
133
+ value: input.projectName,
134
+ note: `${projectActivePresetPath()} wins over the global marker — read-only here`,
135
135
  })
136
136
  }
137
137
  return {
138
138
  id: 'preset',
139
- title: 'Model Preset',
140
- rows,
141
- hint: 'enter: activate globally · writes <config>/opencode/.pantheon/active-preset.json',
139
+ title: 'Preset',
140
+ groups: [{ title: 'Model preset', rows }],
142
141
  }
143
142
  }
@@ -7,12 +7,8 @@
7
7
  * whole thing is testable without network.
8
8
  */
9
9
 
10
- import type { SettingsRow, SettingsSection } from './pantheon-settings-state.ts'
11
- import {
12
- comparePantheonVersions,
13
- UPDATE_CHECK_TTL_MS,
14
- type UpdateCheckState,
15
- } from './update-notice.ts'
10
+ import type { SettingsRow, SettingsTab } from './pantheon-settings-state.ts'
11
+ import { comparePantheonVersions, type UpdateCheckState } from './update-notice.ts'
16
12
 
17
13
  export type UpdateChannel = 'stable' | 'beta'
18
14
 
@@ -47,7 +43,7 @@ export interface UpdatesSectionInput {
47
43
  nowMs?: number
48
44
  }
49
45
 
50
- export function buildUpdatesSection(input: UpdatesSectionInput): SettingsSection {
46
+ export function buildUpdatesTab(input: UpdatesSectionInput): SettingsTab {
51
47
  const nowMs = input.nowMs ?? Date.now()
52
48
  const channel = updateChannelFor(input.currentVersion)
53
49
  const lastCheckMs = input.state.lastCheckMs
@@ -56,20 +52,20 @@ export function buildUpdatesSection(input: UpdatesSectionInput): SettingsSection
56
52
  const rows: SettingsRow[] = [
57
53
  {
58
54
  id: 'update.channel',
59
- title: `Channel: ${channel}`,
60
- description: 'stable tracks npm `latest`; beta tracks npm `beta`',
61
- selectable: false,
55
+ name: 'Channel',
56
+ value: channel,
57
+ note: 'stable tracks npm `latest`; beta tracks npm `beta`',
62
58
  },
63
59
  {
64
60
  id: 'update.check',
65
- title: 'Check now',
66
- description: input.checking
61
+ name: 'Check now',
62
+ value: input.checking
67
63
  ? 'checking…'
68
64
  : lastCheckMs
69
65
  ? `last check ${formatAgo(nowMs - lastCheckMs)}`
70
66
  : 'never checked',
71
- marker: ' → ',
72
- selectable: true,
67
+ action: 'update-check',
68
+ note: 'enter probes the registry for the running channel',
73
69
  },
74
70
  ]
75
71
 
@@ -82,17 +78,15 @@ export function buildUpdatesSection(input: UpdatesSectionInput): SettingsSection
82
78
  !(stable(input.currentVersion) && !stable(latest))
83
79
  rows.push({
84
80
  id: 'update.latest',
85
- title: newer ? `Update available: v${latest}` : `Up to date (latest seen v${latest})`,
86
- description: newer ? 'adopt with `pantheon-opencode update`' : 'checked against the registry',
87
- marker: newer ? '[!]' : '[✓]',
88
- selectable: false,
81
+ name: 'Registry',
82
+ value: newer ? `v${latest} available` : 'up to date',
83
+ note: newer ? 'adopt with `pantheon-opencode update`' : 'no newer compatible version',
89
84
  })
90
85
  }
91
86
 
92
87
  return {
93
88
  id: 'updates',
94
89
  title: 'Updates',
95
- hint: `refresh = \`pantheon-opencode update\` · notice TTL ${UPDATE_CHECK_TTL_MS / 3_600_000}h`,
96
- rows,
90
+ groups: [{ title: 'Updates', rows }],
97
91
  }
98
92
  }