opencode-navigator 0.27.0 → 0.27.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/CHANGELOG.md +14 -0
- package/HOST_API.md +29 -3
- package/README.md +24 -3
- package/dist/gui-experimental.cjs +1212 -608
- package/dist/navigator-updates.js +85 -29
- package/dist/tui.js +155 -76
- package/package.json +1 -1
- package/scripts/update-local-snapshot.mjs +13 -1
|
@@ -81,6 +81,9 @@ export async function updateLocalSnapshot(wrapper, target, operations = {}) {
|
|
|
81
81
|
if (!/^\d+\.\d+\.\d+$/.test(target)) throw new Error('Invalid Navigator update version')
|
|
82
82
|
|
|
83
83
|
const { root, version, source } = await pinnedSnapshot(resolve(wrapper))
|
|
84
|
+
const progress = operations.progress ?? (() => {})
|
|
85
|
+
|
|
86
|
+
progress({ phase: 'preparing' })
|
|
84
87
|
const previous = join(root, 'releases', `v${version}`)
|
|
85
88
|
const next = join(root, 'releases', `v${target}`)
|
|
86
89
|
|
|
@@ -98,6 +101,7 @@ export async function updateLocalSnapshot(wrapper, target, operations = {}) {
|
|
|
98
101
|
|
|
99
102
|
try {
|
|
100
103
|
if (existsSync(next)) {
|
|
104
|
+
progress({ phase: 'verifying' })
|
|
101
105
|
await validate(next, target)
|
|
102
106
|
|
|
103
107
|
await (operations.verify ? operations.verify(next) : verifySnapshot(next))
|
|
@@ -106,6 +110,7 @@ export async function updateLocalSnapshot(wrapper, target, operations = {}) {
|
|
|
106
110
|
|
|
107
111
|
if (operations.stage) await operations.stage(staging, target)
|
|
108
112
|
else {
|
|
113
|
+
progress({ phase: 'downloading' })
|
|
109
114
|
await command('npm', ['pack', `opencode-navigator@${target}`, '--pack-destination', staging, '--silent'])
|
|
110
115
|
await command('tar', [
|
|
111
116
|
'-xzf',
|
|
@@ -138,6 +143,7 @@ export async function updateLocalSnapshot(wrapper, target, operations = {}) {
|
|
|
138
143
|
}),
|
|
139
144
|
)
|
|
140
145
|
|
|
146
|
+
progress({ phase: 'installing' })
|
|
141
147
|
await (operations.install
|
|
142
148
|
? operations.install(staging)
|
|
143
149
|
: command('npm', [
|
|
@@ -150,6 +156,7 @@ export async function updateLocalSnapshot(wrapper, target, operations = {}) {
|
|
|
150
156
|
'--legacy-peer-deps',
|
|
151
157
|
]))
|
|
152
158
|
|
|
159
|
+
progress({ phase: 'verifying' })
|
|
153
160
|
await validate(staging, target)
|
|
154
161
|
|
|
155
162
|
await (operations.verify ? operations.verify(staging) : verifySnapshot(staging, verifier))
|
|
@@ -160,6 +167,7 @@ export async function updateLocalSnapshot(wrapper, target, operations = {}) {
|
|
|
160
167
|
if ((await readFile(wrapper, 'utf8')) !== source)
|
|
161
168
|
throw new Error('Navigator source changed during the update; restart OpenCode and retry')
|
|
162
169
|
|
|
170
|
+
progress({ phase: 'installing' })
|
|
163
171
|
await writeFile(replacement, `export { default } from "./releases/v${target}/dist/tui.js";\n`)
|
|
164
172
|
await rename(replacement, wrapper)
|
|
165
173
|
} finally {
|
|
@@ -170,7 +178,11 @@ export async function updateLocalSnapshot(wrapper, target, operations = {}) {
|
|
|
170
178
|
|
|
171
179
|
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
172
180
|
try {
|
|
173
|
-
await updateLocalSnapshot(process.argv[2], process.argv[3]
|
|
181
|
+
await updateLocalSnapshot(process.argv[2], process.argv[3], {
|
|
182
|
+
progress: process.argv.includes('--progress-json')
|
|
183
|
+
? (value) => process.stdout.write(`navigator-update-progress:${JSON.stringify(value)}\n`)
|
|
184
|
+
: undefined,
|
|
185
|
+
})
|
|
174
186
|
} catch (error) {
|
|
175
187
|
console.error(error instanceof Error ? error.message : String(error))
|
|
176
188
|
process.exitCode = 1
|