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.
- package/AGENTS.global.md +7 -2
- package/AGENTS.md +8 -8
- package/CHANGELOG.md +99 -0
- package/README.md +171 -510
- package/README.pt-BR.md +179 -149
- package/bin/pantheon-init.mjs +14 -1
- package/commands/pantheon-audit.md +1 -1
- package/commands/pantheon-deepwork.md +7 -2
- package/commands/pantheon-optimize.md +41 -63
- package/commands/pantheon.md +10 -5
- package/package.json +4 -3
- package/plugin.json +2 -2
- package/prompts/optimize-database.prompt.md +5 -5
- package/prompts/orchestrate-with-zeus.prompt.md +82 -290
- package/prompts/plan-architecture.prompt.md +6 -6
- package/prompts/subtask.prompt.md +1 -1
- package/pyproject.toml +1 -1
- package/scripts/build-agents-md.mjs +10 -10
- package/scripts/build-plugin.mjs +26 -0
- package/scripts/doctor.mjs +27 -11
- package/scripts/hooks/format-multi-language.sh +30 -48
- package/scripts/install/opencode-version.mjs +17 -5
- package/scripts/install/opencode.mjs +8 -1
- package/scripts/jev-live-probe.mjs +1 -1
- package/scripts/optimize.mjs +322 -0
- package/scripts/prune.mjs +105 -14
- package/scripts/release-gates.mjs +19 -5
- package/scripts/skill-search.mjs +27 -3
- package/scripts/test-opencode-sandbox.sh +44 -15
- package/scripts/update.mjs +29 -17
- package/skills-lock.json +15 -13
- package/src/agents/aphrodite.md +17 -14
- package/src/agents/apollo.md +10 -207
- package/src/agents/athena.md +30 -34
- package/src/agents/demeter.md +2 -0
- package/src/agents/hephaestus.md +1 -0
- package/src/agents/hermes.md +21 -95
- package/src/agents/iris.md +3 -0
- package/src/agents/mnemosyne.md +1 -1
- package/src/agents/nyx.md +2 -1
- package/src/agents/prometheus.md +2 -203
- package/src/agents/talos.md +5 -0
- package/src/agents/themis.md +93 -84
- package/src/agents/zeus.md +44 -263
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/instructions/memory-protocol.instructions.md +5 -1
- package/src/instructions/test-economy.instructions.md +1 -0
- package/src/instructions/zeus-anti-stall.instructions.md +3 -3
- package/src/instructions/zeus-communication-rules.instructions.md +1 -1
- package/src/instructions/zeus-council-synthesis.instructions.md +15 -3
- package/src/instructions/zeus-timeout-retry.instructions.md +10 -10
- package/src/pantheon/model-command.ts +12 -12
- package/src/pantheon/pantheon-decision-catalog.ts +8 -0
- package/src/pantheon/skill-search-tool.ts +193 -0
- package/src/pantheon/tools.ts +6 -0
- package/src/pantheon/tui-version-check.ts +1 -1
- package/src/pantheon/update-notifier.ts +13 -8
- package/src/pantheon/vision.ts +20 -20
- package/src/plugin/index.js +14594 -0
- package/src/plugins/tui/dist/tui.d.ts +15 -5
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +1761 -556
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/autonomy-state.ts +28 -16
- package/src/plugins/tui/src/context-gauge.ts +64 -5
- package/src/plugins/tui/src/decision-router-state.ts +49 -2
- package/src/plugins/tui/src/index.tsx +69 -26
- package/src/plugins/tui/src/pantheon-settings-state.ts +99 -0
- package/src/plugins/tui/src/pantheon-settings.tsx +771 -125
- package/src/plugins/tui/src/tui-prefs.ts +266 -12
- package/src/plugins/tui/src/update-notice.ts +9 -6
- package/src/plugins/tui/src/update-status.ts +27 -8
- package/src/plugins/tui/src/whats-new-open.ts +4 -4
- package/src/plugins/tui/src/whats-new.tsx +119 -17
- package/src/routing.yml +9 -0
- package/src/skills/README.md +35 -25
- package/src/skills/agent-coordination/SKILL.md +6 -6
- package/src/skills/artifact-management/SKILL.md +43 -39
- package/src/skills/artifact-management/references/artifact-templates.md +103 -48
- package/src/skills/auto-continue/references/auto-continue-details.md +13 -13
- package/src/skills/code-review-checklist/SKILL.md +6 -6
- package/src/skills/fast-path-execution/SKILL.md +54 -0
- package/src/skills/incremental-implementation/SKILL.md +13 -13
- package/src/skills/memory-bank/references/anti-patterns.md +3 -3
- package/src/skills/prompt-refinery/SKILL.md +51 -65
- package/src/skills/spec-driven-development/SKILL.md +12 -14
- package/src/skills/tdd-with-agents/SKILL.md +23 -10
- package/src/skills/test-slicing/SKILL.md +56 -0
- package/src/skills/verification-planning/SKILL.md +4 -3
- package/src/skills/visual-review-pipeline/SKILL.md +1 -1
- package/src/skills/visual-review-pipeline/references/workflow-steps.md +1 -1
package/scripts/prune.mjs
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
import { execSync } from 'node:child_process'
|
|
34
34
|
import { existsSync, readdirSync, readFileSync, rmSync, statSync } from 'node:fs'
|
|
35
35
|
import { homedir } from 'node:os'
|
|
36
|
-
import { dirname, join, resolve } from 'node:path'
|
|
36
|
+
import { basename, dirname, join, resolve } from 'node:path'
|
|
37
37
|
import { fileURLToPath } from 'node:url'
|
|
38
38
|
|
|
39
39
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
@@ -232,28 +232,104 @@ export function findLegacyInstallDir(configDir) {
|
|
|
232
232
|
)
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
// Deepwork & Worktrees prune
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
|
|
239
|
+
export function findStaleDeepwork(repoDir, maxAgeDays, deepworkFlag = false) {
|
|
240
|
+
const deepworkDir = join(repoDir, '.pantheon', 'deepwork')
|
|
241
|
+
if (!existsSync(deepworkDir)) return
|
|
242
|
+
try {
|
|
243
|
+
const entries = readdirSync(deepworkDir, { withFileTypes: true })
|
|
244
|
+
const now = Date.now()
|
|
245
|
+
const maxAgeMs = maxAgeDays * 86_400_000
|
|
246
|
+
for (const entry of entries) {
|
|
247
|
+
if (!entry.isDirectory()) continue
|
|
248
|
+
const targetDir = join(deepworkDir, entry.name)
|
|
249
|
+
const st = statSync(targetDir)
|
|
250
|
+
const ageDays = Math.round((now - st.mtimeMs) / 86_400_000)
|
|
251
|
+
const isStale = now - st.mtimeMs > maxAgeMs
|
|
252
|
+
if (isStale || deepworkFlag) {
|
|
253
|
+
add(
|
|
254
|
+
'deepwork',
|
|
255
|
+
targetDir,
|
|
256
|
+
`deepwork session directory (${ageDays}d old)`,
|
|
257
|
+
deepworkFlag ? 'remove' : 'list',
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
} catch {
|
|
262
|
+
// best-effort
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function findStaleWorktrees(repoDir, worktreesFlag = false) {
|
|
267
|
+
const repoParent = dirname(resolve(repoDir))
|
|
268
|
+
const repoBase = basename(resolve(repoDir))
|
|
269
|
+
const worktreeParent = join(repoParent, '.pantheon-worktrees', repoBase)
|
|
270
|
+
if (!existsSync(worktreeParent)) return
|
|
271
|
+
try {
|
|
272
|
+
const entries = readdirSync(worktreeParent, { withFileTypes: true })
|
|
273
|
+
for (const entry of entries) {
|
|
274
|
+
if (!entry.isDirectory()) continue
|
|
275
|
+
const targetDir = join(worktreeParent, entry.name)
|
|
276
|
+
add(
|
|
277
|
+
'worktree',
|
|
278
|
+
targetDir,
|
|
279
|
+
`worktree directory for task '${entry.name}'`,
|
|
280
|
+
worktreesFlag ? 'remove' : 'list',
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
} catch {
|
|
284
|
+
// best-effort
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
235
288
|
// ---------------------------------------------------------------------------
|
|
236
289
|
// Actions
|
|
237
290
|
// ---------------------------------------------------------------------------
|
|
238
291
|
|
|
239
292
|
function format(f) {
|
|
240
|
-
const
|
|
241
|
-
f.action === 'remove'
|
|
242
|
-
|
|
293
|
+
const marker =
|
|
294
|
+
f.action === 'remove'
|
|
295
|
+
? '[-]'
|
|
296
|
+
: f.action === 'suggest'
|
|
297
|
+
? '[?]'
|
|
298
|
+
: f.action === 'keep'
|
|
299
|
+
? '[+]'
|
|
300
|
+
: '[*]'
|
|
301
|
+
return `${marker} [${f.type}] ${f.target} — ${f.detail}`
|
|
243
302
|
}
|
|
244
303
|
|
|
245
|
-
export function runPrune({
|
|
304
|
+
export function runPrune({
|
|
305
|
+
configDir,
|
|
306
|
+
repoDir,
|
|
307
|
+
maxAgeDays,
|
|
308
|
+
apply,
|
|
309
|
+
removeDirs,
|
|
310
|
+
deepwork,
|
|
311
|
+
worktrees,
|
|
312
|
+
}) {
|
|
313
|
+
findings.length = 0
|
|
246
314
|
findLegacyGlobalInstalls()
|
|
247
315
|
findStaleBackups(configDir, maxAgeDays)
|
|
248
316
|
findLegacyDirs(configDir)
|
|
249
317
|
findLegacyInstallDir(configDir)
|
|
318
|
+
if (deepwork || repoDir) {
|
|
319
|
+
findStaleDeepwork(repoDir || _ROOT, maxAgeDays, deepwork)
|
|
320
|
+
}
|
|
321
|
+
if (worktrees || repoDir) {
|
|
322
|
+
findStaleWorktrees(repoDir || _ROOT, worktrees)
|
|
323
|
+
}
|
|
250
324
|
|
|
251
325
|
console.log(`Pantheon prune — config dir: ${configDir}`)
|
|
252
|
-
console.log(
|
|
326
|
+
console.log(
|
|
327
|
+
` mode: ${apply ? 'APPLY' : 'DRY-RUN'}${removeDirs ? ' + REMOVE-DIRS' : ''}${deepwork ? ' + DEEPWORK' : ''}${worktrees ? ' + WORKTREES' : ''}`,
|
|
328
|
+
)
|
|
253
329
|
console.log('')
|
|
254
330
|
|
|
255
331
|
if (findings.length === 0) {
|
|
256
|
-
console.log('
|
|
332
|
+
console.log(' Nothing to clean.')
|
|
257
333
|
return { removed: 0, remain: 0 }
|
|
258
334
|
}
|
|
259
335
|
|
|
@@ -263,12 +339,12 @@ export function runPrune({ configDir, maxAgeDays, apply, removeDirs }) {
|
|
|
263
339
|
console.log(` ${format(f)}`)
|
|
264
340
|
if (f.action === 'remove' && apply) {
|
|
265
341
|
try {
|
|
266
|
-
rmSync(f.target, { force: true })
|
|
267
|
-
console.log(
|
|
342
|
+
rmSync(f.target, { recursive: true, force: true })
|
|
343
|
+
console.log(' → removed')
|
|
268
344
|
removed++
|
|
269
345
|
continue
|
|
270
346
|
} catch (err) {
|
|
271
|
-
console.log(` →
|
|
347
|
+
console.log(` → failed: ${err.message}`)
|
|
272
348
|
remain++
|
|
273
349
|
continue
|
|
274
350
|
}
|
|
@@ -281,11 +357,11 @@ export function runPrune({ configDir, maxAgeDays, apply, removeDirs }) {
|
|
|
281
357
|
if (f.action === 'list' && apply && removeDirs) {
|
|
282
358
|
try {
|
|
283
359
|
rmSync(f.target, { recursive: true, force: true })
|
|
284
|
-
console.log(
|
|
360
|
+
console.log(' → removed (--remove-dirs)')
|
|
285
361
|
removed++
|
|
286
362
|
continue
|
|
287
363
|
} catch (err) {
|
|
288
|
-
console.log(` →
|
|
364
|
+
console.log(` → failed: ${err.message}`)
|
|
289
365
|
remain++
|
|
290
366
|
continue
|
|
291
367
|
}
|
|
@@ -323,7 +399,10 @@ Options:
|
|
|
323
399
|
--apply Remove stale backups (default: dry-run, list only)
|
|
324
400
|
--remove-dirs With --apply, also remove legacy directories
|
|
325
401
|
(explicit confirmation; default: list only)
|
|
402
|
+
--deepwork Find and remove stale deepwork session artifacts
|
|
403
|
+
--worktrees Find and clean up detached worktree directories
|
|
326
404
|
--target <dir> Override the config directory (XDG-aware by default)
|
|
405
|
+
--repo <dir> Override the project repository directory
|
|
327
406
|
--age <days> Backup age threshold in days (default: ${DEFAULT_BACKUP_AGE_DAYS})
|
|
328
407
|
--help Show this help
|
|
329
408
|
|
|
@@ -344,17 +423,29 @@ function main() {
|
|
|
344
423
|
|
|
345
424
|
const apply = args.includes('--apply') || args.includes('-y')
|
|
346
425
|
const removeDirs = args.includes('--remove-dirs')
|
|
426
|
+
const deepwork = args.includes('--deepwork')
|
|
427
|
+
const worktrees = args.includes('--worktrees')
|
|
347
428
|
const targetIdx = args.indexOf('--target')
|
|
348
429
|
const target = targetIdx >= 0 ? args[targetIdx + 1] : undefined
|
|
430
|
+
const repoIdx = args.indexOf('--repo')
|
|
431
|
+
const repoDir = repoIdx >= 0 ? args[repoIdx + 1] : undefined
|
|
349
432
|
const ageIdx = args.indexOf('--age')
|
|
350
433
|
const age = ageIdx >= 0 ? Number(args[ageIdx + 1]) : DEFAULT_BACKUP_AGE_DAYS
|
|
351
434
|
if (!Number.isFinite(age) || age < 0) {
|
|
352
|
-
console.error('
|
|
435
|
+
console.error('ERROR: --age must be a non-negative number of days')
|
|
353
436
|
process.exit(2)
|
|
354
437
|
}
|
|
355
438
|
|
|
356
439
|
const configDir = resolveConfigDir(target)
|
|
357
|
-
const result = runPrune({
|
|
440
|
+
const result = runPrune({
|
|
441
|
+
configDir,
|
|
442
|
+
repoDir,
|
|
443
|
+
maxAgeDays: age,
|
|
444
|
+
apply,
|
|
445
|
+
removeDirs,
|
|
446
|
+
deepwork,
|
|
447
|
+
worktrees,
|
|
448
|
+
})
|
|
358
449
|
|
|
359
450
|
// 0 = clean/cleaned; 1 = findings remain; 2 = usage error (handled above)
|
|
360
451
|
process.exit(result.remain > 0 ? 1 : 0)
|
|
@@ -301,8 +301,22 @@ function hostGate(options) {
|
|
|
301
301
|
const tarball = singleTarball(options)
|
|
302
302
|
const matrix = matrixFromEnv()
|
|
303
303
|
validateMatrix(matrix)
|
|
304
|
+
// PANTHEON_RELEASE_HOST_ONLY lets the workflow run the matrix CONCURRENTLY
|
|
305
|
+
// (one invocation per host — the sandbox roots and ports are already
|
|
306
|
+
// per-index disjoint). The full matrix is validated first; the filter only
|
|
307
|
+
// chooses which rows THIS invocation executes.
|
|
308
|
+
const only = process.env.PANTHEON_RELEASE_HOST_ONLY ?? ''
|
|
309
|
+
const selected = only ? matrix.filter((row) => row.host === only) : matrix
|
|
310
|
+
if (only && selected.length === 0) {
|
|
311
|
+
throw new Error(`PANTHEON_RELEASE_HOST_ONLY="${only}" matches no matrix row`)
|
|
312
|
+
}
|
|
304
313
|
const checks = []
|
|
305
|
-
|
|
314
|
+
selected.forEach((row) => {
|
|
315
|
+
// Port derives from the ORIGINAL matrix index — the concurrent
|
|
316
|
+
// PANTHEON_RELEASE_HOST_ONLY invocations each re-run this gate, and a
|
|
317
|
+
// filtered forEach index would collide both sandboxes on 49380 (field
|
|
318
|
+
// evidence: MCP-handshake timeout on the split-host CI run).
|
|
319
|
+
const matrixIndex = matrix.indexOf(row)
|
|
306
320
|
const root = join(runnerTemp(), `pantheon-release-host-${safeName(row.host)}`)
|
|
307
321
|
rmSync(root, { recursive: true, force: true })
|
|
308
322
|
checks.push(
|
|
@@ -311,12 +325,12 @@ function hostGate(options) {
|
|
|
311
325
|
'bash',
|
|
312
326
|
['scripts/test-opencode-sandbox.sh', '--prepare', '--run', 'v2'],
|
|
313
327
|
{
|
|
314
|
-
env: sandboxEnv(root, row.host, tarball, 49380 +
|
|
328
|
+
env: sandboxEnv(root, row.host, tarball, 49380 + matrixIndex),
|
|
315
329
|
},
|
|
316
330
|
),
|
|
317
331
|
)
|
|
318
332
|
})
|
|
319
|
-
const measuredFamilies = [...new Set(
|
|
333
|
+
const measuredFamilies = [...new Set(selected.map((row) => row.line))]
|
|
320
334
|
const unmeasuredFamilies = SUPPORTED_FAMILIES.filter(
|
|
321
335
|
(family) => !measuredFamilies.includes(family),
|
|
322
336
|
)
|
|
@@ -513,7 +527,7 @@ function metadataGate(options) {
|
|
|
513
527
|
throw new Error(`--version ${options.version} does not match package.json`)
|
|
514
528
|
}
|
|
515
529
|
const stable = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
|
|
516
|
-
const beta = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-beta\.[1-9]\d*$/
|
|
530
|
+
const beta = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-(?:beta|rc)\.[1-9]\d*$/
|
|
517
531
|
if (!['stable', 'beta'].includes(options.channel)) {
|
|
518
532
|
throw new Error(`unknown channel ${options.channel}`)
|
|
519
533
|
}
|
|
@@ -521,7 +535,7 @@ function metadataGate(options) {
|
|
|
521
535
|
throw new Error(`stable channel requires X.Y.Z, found ${options.version}`)
|
|
522
536
|
}
|
|
523
537
|
if (options.channel === 'beta' && !beta.test(options.version)) {
|
|
524
|
-
throw new Error(`beta channel requires X.Y.Z-beta.N, found ${options.version}`)
|
|
538
|
+
throw new Error(`beta channel requires X.Y.Z-beta.N or X.Y.Z-rc.N, found ${options.version}`)
|
|
525
539
|
}
|
|
526
540
|
const checks = [
|
|
527
541
|
run('version-manifests', 'node', ['scripts/version-check.mjs']),
|
package/scripts/skill-search.mjs
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import { spawnSync } from 'node:child_process'
|
|
24
24
|
import { pathToFileURL } from 'node:url'
|
|
25
25
|
|
|
26
|
-
const FIND_TIMEOUT_MS =
|
|
26
|
+
const FIND_TIMEOUT_MS = 15_000
|
|
27
27
|
const DEFAULT_LIMIT = 5
|
|
28
28
|
/** SGR escape sequences are matched via the ESC codepoint (lint-clean, same semantics). */
|
|
29
29
|
const ANSI_SGR = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, 'g')
|
|
@@ -119,7 +119,7 @@ export function searchSkills(query, { limit = DEFAULT_LIMIT, owner, spawn = spaw
|
|
|
119
119
|
return { ok: true, entries, raw, emptyIsAmbiguous: false }
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
const GITHUB_TIMEOUT_MS =
|
|
122
|
+
const GITHUB_TIMEOUT_MS = 10_000
|
|
123
123
|
const ANTHROPIC_SKILLS_REPO = 'anthropics/skills'
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -220,10 +220,26 @@ export function searchGithubSkills(query, { limit = DEFAULT_LIMIT, spawn = spawn
|
|
|
220
220
|
*/
|
|
221
221
|
export const SKILL_SEARCH_SOURCES = Object.freeze(['anthropic', 'skills-sh', 'github'])
|
|
222
222
|
|
|
223
|
+
const SEARCH_CACHE = new Map()
|
|
224
|
+
const CACHE_TTL_MS = 24 * 60 * 60 * 1000 // 24 hours
|
|
225
|
+
|
|
223
226
|
export function searchSkillSources(
|
|
224
227
|
query,
|
|
225
228
|
{ limit = DEFAULT_LIMIT, owner, sources = SKILL_SEARCH_SOURCES, spawn = spawnSync } = {},
|
|
226
229
|
) {
|
|
230
|
+
const cacheKey = JSON.stringify({
|
|
231
|
+
query: String(query).toLowerCase().trim(),
|
|
232
|
+
limit,
|
|
233
|
+
owner,
|
|
234
|
+
sources,
|
|
235
|
+
})
|
|
236
|
+
if (spawn === spawnSync && SEARCH_CACHE.has(cacheKey)) {
|
|
237
|
+
const cached = SEARCH_CACHE.get(cacheKey)
|
|
238
|
+
if (Date.now() - cached.timestamp < CACHE_TTL_MS) {
|
|
239
|
+
return cached.result
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
227
243
|
const perTier = Math.max(1, Math.ceil(limit / sources.length))
|
|
228
244
|
const out = []
|
|
229
245
|
const failures = []
|
|
@@ -259,7 +275,15 @@ export function searchSkillSources(
|
|
|
259
275
|
if (tier !== 0) return tier
|
|
260
276
|
return installsWeight(left) - installsWeight(right)
|
|
261
277
|
})
|
|
262
|
-
|
|
278
|
+
const finalResult = {
|
|
279
|
+
ok: failures.length < sources.length,
|
|
280
|
+
entries: out.slice(0, limit),
|
|
281
|
+
failures,
|
|
282
|
+
}
|
|
283
|
+
if (spawn === spawnSync && finalResult.ok) {
|
|
284
|
+
SEARCH_CACHE.set(cacheKey, { timestamp: Date.now(), result: finalResult })
|
|
285
|
+
}
|
|
286
|
+
return finalResult
|
|
263
287
|
}
|
|
264
288
|
|
|
265
289
|
function main(args = process.argv.slice(2)) {
|
|
@@ -310,7 +310,7 @@ wait_for_v2_mcp_registrations() {
|
|
|
310
310
|
print_v2_diagnostics
|
|
311
311
|
return 1
|
|
312
312
|
fi
|
|
313
|
-
if SERVICE_LOG="$V2_SERVER_LOG" RUNTIME_DIR="$runtime_dir" MCP_PYTHON="$python_bin" \
|
|
313
|
+
if SERVICE_LOG="$V2_SERVER_LOG" RUNTIME_DIR="$runtime_dir" MCP_PYTHON="$python_bin" RUNTIME_LOG="$LOG_PATH" \
|
|
314
314
|
python3 - <<'PY'
|
|
315
315
|
import os
|
|
316
316
|
import re
|
|
@@ -319,7 +319,7 @@ from pathlib import Path
|
|
|
319
319
|
try:
|
|
320
320
|
log = Path(os.environ["SERVICE_LOG"]).read_text(encoding="utf-8")
|
|
321
321
|
except OSError:
|
|
322
|
-
|
|
322
|
+
log = ""
|
|
323
323
|
expected = {
|
|
324
324
|
"code_mode.py",
|
|
325
325
|
"memory_mcp.py",
|
|
@@ -335,8 +335,8 @@ pattern = re.compile(
|
|
|
335
335
|
re.DOTALL,
|
|
336
336
|
)
|
|
337
337
|
records = list(pattern.finditer(log))
|
|
338
|
-
runtime_dir = os.environ
|
|
339
|
-
python_bin = os.environ
|
|
338
|
+
runtime_dir = os.environ.get("RUNTIME_DIR", "")
|
|
339
|
+
python_bin = os.environ.get("MCP_PYTHON", "")
|
|
340
340
|
registered = set()
|
|
341
341
|
for record in records:
|
|
342
342
|
command = record.group("command")
|
|
@@ -345,11 +345,24 @@ for record in records:
|
|
|
345
345
|
if command != python_bin or cwd != runtime_dir or script not in expected:
|
|
346
346
|
raise SystemExit(1)
|
|
347
347
|
registered.add(script)
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if
|
|
352
|
-
|
|
348
|
+
if registered == expected:
|
|
349
|
+
raise SystemExit(0)
|
|
350
|
+
runtime_log_path = os.environ.get("RUNTIME_LOG")
|
|
351
|
+
if runtime_log_path and Path(runtime_log_path).is_file():
|
|
352
|
+
try:
|
|
353
|
+
rlog = Path(runtime_log_path).read_text(encoding="utf-8")
|
|
354
|
+
expected_servers = {
|
|
355
|
+
"pantheon-code-mode",
|
|
356
|
+
"pantheon-memory",
|
|
357
|
+
"pantheon-persistence",
|
|
358
|
+
"pantheon-resources",
|
|
359
|
+
"pantheon-vision",
|
|
360
|
+
}
|
|
361
|
+
if all(f'message="mcp connected" server={s}' in rlog for s in expected_servers):
|
|
362
|
+
raise SystemExit(0)
|
|
363
|
+
except OSError:
|
|
364
|
+
pass
|
|
365
|
+
raise SystemExit(1)
|
|
353
366
|
PY
|
|
354
367
|
then
|
|
355
368
|
return 0
|
|
@@ -717,7 +730,7 @@ wait_for_v2_mcp_registrations() {
|
|
|
717
730
|
print_v2_diagnostics
|
|
718
731
|
return 1
|
|
719
732
|
fi
|
|
720
|
-
if SERVICE_LOG="$V2_SERVER_LOG" RUNTIME_DIR="$runtime_dir" MCP_PYTHON="$python_bin" \
|
|
733
|
+
if SERVICE_LOG="$V2_SERVER_LOG" RUNTIME_DIR="$runtime_dir" MCP_PYTHON="$python_bin" RUNTIME_LOG="$LOG_PATH" \
|
|
721
734
|
python3 - <<'PY'
|
|
722
735
|
import os
|
|
723
736
|
import re
|
|
@@ -726,7 +739,7 @@ from pathlib import Path
|
|
|
726
739
|
try:
|
|
727
740
|
log = Path(os.environ["SERVICE_LOG"]).read_text(encoding="utf-8")
|
|
728
741
|
except OSError:
|
|
729
|
-
|
|
742
|
+
log = ""
|
|
730
743
|
expected = {
|
|
731
744
|
"code_mode.py",
|
|
732
745
|
"memory_mcp.py",
|
|
@@ -742,8 +755,8 @@ pattern = re.compile(
|
|
|
742
755
|
re.DOTALL,
|
|
743
756
|
)
|
|
744
757
|
records = list(pattern.finditer(log))
|
|
745
|
-
runtime_dir = os.environ
|
|
746
|
-
python_bin = os.environ
|
|
758
|
+
runtime_dir = os.environ.get("RUNTIME_DIR", "")
|
|
759
|
+
python_bin = os.environ.get("MCP_PYTHON", "")
|
|
747
760
|
registered = set()
|
|
748
761
|
for record in records:
|
|
749
762
|
command = record.group("command")
|
|
@@ -752,8 +765,24 @@ for record in records:
|
|
|
752
765
|
if command != python_bin or cwd != runtime_dir or script not in expected:
|
|
753
766
|
raise SystemExit(1)
|
|
754
767
|
registered.add(script)
|
|
755
|
-
if
|
|
756
|
-
raise SystemExit(
|
|
768
|
+
if registered == expected:
|
|
769
|
+
raise SystemExit(0)
|
|
770
|
+
runtime_log_path = os.environ.get("RUNTIME_LOG")
|
|
771
|
+
if runtime_log_path and Path(runtime_log_path).is_file():
|
|
772
|
+
try:
|
|
773
|
+
rlog = Path(runtime_log_path).read_text(encoding="utf-8")
|
|
774
|
+
expected_servers = {
|
|
775
|
+
"pantheon-code-mode",
|
|
776
|
+
"pantheon-memory",
|
|
777
|
+
"pantheon-persistence",
|
|
778
|
+
"pantheon-resources",
|
|
779
|
+
"pantheon-vision",
|
|
780
|
+
}
|
|
781
|
+
if all(f'message="mcp connected" server={s}' in rlog for s in expected_servers):
|
|
782
|
+
raise SystemExit(0)
|
|
783
|
+
except OSError:
|
|
784
|
+
pass
|
|
785
|
+
raise SystemExit(1)
|
|
757
786
|
PY
|
|
758
787
|
then
|
|
759
788
|
return 0
|
package/scripts/update.mjs
CHANGED
|
@@ -6,11 +6,15 @@ import { assertNoSymlinkAncestors } from './install/verify.mjs'
|
|
|
6
6
|
function parseVersion(version) {
|
|
7
7
|
const match = String(version)
|
|
8
8
|
.trim()
|
|
9
|
-
.match(/^(\d+)\.(\d+)\.(\d+)(?:-beta\.(\d+))?$/)
|
|
9
|
+
.match(/^(\d+)\.(\d+)\.(\d+)(?:-(beta|rc)\.(\d+))?$/)
|
|
10
10
|
if (!match) return null
|
|
11
|
+
const stage = match[4]
|
|
12
|
+
const stageNum = match[5] !== undefined ? +match[5] : 0
|
|
13
|
+
const stageRank = stage === 'beta' ? 1 : stage === 'rc' ? 2 : 3
|
|
11
14
|
return {
|
|
12
15
|
core: [+match[1], +match[2], +match[3]],
|
|
13
|
-
|
|
16
|
+
stageRank,
|
|
17
|
+
stageNum: stage ? stageNum : Number.POSITIVE_INFINITY,
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -21,7 +25,8 @@ function compareVersions(left, right) {
|
|
|
21
25
|
for (let index = 0; index < 3; index += 1) {
|
|
22
26
|
if (a.core[index] !== b.core[index]) return a.core[index] - b.core[index]
|
|
23
27
|
}
|
|
24
|
-
return a.
|
|
28
|
+
if (a.stageRank !== b.stageRank) return a.stageRank - b.stageRank
|
|
29
|
+
return a.stageNum - b.stageNum
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
/** Update only the authorized global installation, then refresh its config. */
|
|
@@ -36,7 +41,7 @@ export function runUpdate(
|
|
|
36
41
|
refresh,
|
|
37
42
|
},
|
|
38
43
|
) {
|
|
39
|
-
const channel = args.includes('--stable') ? 'latest' : 'beta'
|
|
44
|
+
const channel = args.includes('--stable') ? 'latest' : args.includes('--rc') ? 'rc' : 'beta'
|
|
40
45
|
const globalRootResult = spawnSync('npm', ['root', '-g'], {
|
|
41
46
|
encoding: 'utf8',
|
|
42
47
|
timeout: 10_000,
|
|
@@ -87,7 +92,7 @@ export function runUpdate(
|
|
|
87
92
|
runningScriptPath !== path.join(globalPackageRoot, 'bin', 'pantheon-init.mjs')
|
|
88
93
|
) {
|
|
89
94
|
console.error(
|
|
90
|
-
'
|
|
95
|
+
'[ERROR] update is available only from the global Pantheon installation; local, workspace, and npx copies are refused. ' +
|
|
91
96
|
'Install globally with `npm install -g pantheon-opencode@beta`, then run `pantheon-opencode update`.',
|
|
92
97
|
)
|
|
93
98
|
return 1
|
|
@@ -101,14 +106,14 @@ export function runUpdate(
|
|
|
101
106
|
const latest = (view.stdout || '').trim().split('\n').filter(Boolean).pop()
|
|
102
107
|
if (view.status !== 0 || !latest) {
|
|
103
108
|
console.error(
|
|
104
|
-
|
|
109
|
+
`[ERROR] Could not reach the npm registry: ${(view.stderr || view.stdout || '').trim() || 'no version returned'}`,
|
|
105
110
|
)
|
|
106
111
|
return 1
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
if (compareVersions(latest, currentVersion) <= 0) {
|
|
110
115
|
console.log(
|
|
111
|
-
|
|
116
|
+
`[OK] Already up to date (installed v${currentVersion}; ${channel} channel: v${latest}).`,
|
|
112
117
|
)
|
|
113
118
|
return 0
|
|
114
119
|
}
|
|
@@ -116,15 +121,15 @@ export function runUpdate(
|
|
|
116
121
|
// A stable installation never jumps to a prerelease silently (you stay
|
|
117
122
|
// in charge): the jump needs explicit opt-in via --allow-prerelease. The
|
|
118
123
|
// remedy is printed, never guessed.
|
|
119
|
-
const isPrerelease = (version) => /-beta\.\d+$/.test(version)
|
|
124
|
+
const isPrerelease = (version) => /-(?:beta|rc)\.\d+$/.test(version)
|
|
120
125
|
const crossingToPrerelease = isPrerelease(latest) && !isPrerelease(currentVersion)
|
|
121
126
|
if (crossingToPrerelease && !args.includes('--allow-prerelease')) {
|
|
122
127
|
console.error(
|
|
123
|
-
'
|
|
128
|
+
'[ERROR] v' +
|
|
124
129
|
latest +
|
|
125
|
-
' is a
|
|
130
|
+
' is a prerelease and your installed v' +
|
|
126
131
|
currentVersion +
|
|
127
|
-
' is stable. A stable
|
|
132
|
+
' is stable. A stable->prerelease jump needs explicit opt-in: rerun with `update --allow-prerelease`, or stay on the stable line with `update --stable`.',
|
|
128
133
|
)
|
|
129
134
|
return 1
|
|
130
135
|
}
|
|
@@ -135,7 +140,7 @@ export function runUpdate(
|
|
|
135
140
|
})
|
|
136
141
|
if (install.status !== 0) {
|
|
137
142
|
console.error(
|
|
138
|
-
'
|
|
143
|
+
'[ERROR] npm install failed; npm global replacement is not atomic and may have partially changed the package. ' +
|
|
139
144
|
'Verify the global install with `pantheon-opencode --version` or reinstall the package.',
|
|
140
145
|
)
|
|
141
146
|
return install.status ?? 1
|
|
@@ -165,21 +170,28 @@ export function runUpdate(
|
|
|
165
170
|
}
|
|
166
171
|
if (refreshedVersion !== latest || !refreshedPackageRoot) {
|
|
167
172
|
console.error(
|
|
168
|
-
|
|
173
|
+
`[ERROR] npm reported success, but the global package is v${refreshedVersion ?? 'unknown'} (expected v${latest}); config refresh was not run.`,
|
|
169
174
|
)
|
|
170
175
|
return 1
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
const globalEntry = path.join(refreshedPackageRoot, 'bin', 'pantheon-init.mjs')
|
|
179
|
+
const forwardedFlags = []
|
|
180
|
+
if (args.includes('--project')) forwardedFlags.push('--project')
|
|
181
|
+
if (args.includes('--no-mcp')) forwardedFlags.push('--no-mcp')
|
|
182
|
+
if (args.includes('--verbose')) forwardedFlags.push('--verbose')
|
|
183
|
+
|
|
174
184
|
const init = refresh
|
|
175
|
-
? refresh(globalEntry)
|
|
176
|
-
: spawnSync(execPath, [globalEntry, 'init', '--yes', '--headless'], {
|
|
185
|
+
? refresh(globalEntry, forwardedFlags)
|
|
186
|
+
: spawnSync(execPath, [globalEntry, 'init', '--yes', '--headless', ...forwardedFlags], {
|
|
187
|
+
stdio: 'inherit',
|
|
188
|
+
})
|
|
177
189
|
if (init.status !== 0 || init.error) {
|
|
178
190
|
console.error(
|
|
179
|
-
'
|
|
191
|
+
'[WARN] Updated, but the config refresh did not complete — run `npx pantheon-opencode init` manually.',
|
|
180
192
|
)
|
|
181
193
|
return init.status ?? 1
|
|
182
194
|
}
|
|
183
|
-
console.log(
|
|
195
|
+
console.log(`[OK] Updated to v${latest}.`)
|
|
184
196
|
return 0
|
|
185
197
|
}
|
package/skills-lock.json
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
"src/skills/agent-coordination/SKILL.md": "
|
|
2
|
+
"src/skills/agent-coordination/SKILL.md": "0b002b322c2b35bf11bc3beb56de37a9614311d3883f0fa399f6dcbc5c8758af",
|
|
3
3
|
"src/skills/agent-forge/SKILL.md": "cbe09946a59fa45b471828d9de6e7bc5c4b2fa29e0ce48e21d188593ece6c046",
|
|
4
|
-
"src/skills/artifact-management/references/artifact-templates.md": "
|
|
5
|
-
"src/skills/artifact-management/SKILL.md": "
|
|
6
|
-
"src/skills/auto-continue/references/auto-continue-details.md": "
|
|
4
|
+
"src/skills/artifact-management/references/artifact-templates.md": "d1a5d082266311c362e63e097f461fe993a4eac7485c4a445fba7993c404e1c7",
|
|
5
|
+
"src/skills/artifact-management/SKILL.md": "d11bc6a9968758294bd9ae56dfa8df43090c5f1f7c4f706861687d8ac3bb88a2",
|
|
6
|
+
"src/skills/auto-continue/references/auto-continue-details.md": "3064ee565c9e6dd2724d1170404888a65d700aaec0058d3aa2be1acce4771e72",
|
|
7
7
|
"src/skills/auto-continue/SKILL.md": "7bfddd84f96b657043074a35ef2f524913ccbed2689fc8a26ad425167f4b77c5",
|
|
8
8
|
"src/skills/clonedeps/SKILL.md": "3e0b43cf96da98c83699dc48db3fd58fbfda84b9022bb70d3747875c81c3e124",
|
|
9
9
|
"src/skills/code-review-checklist/references/review-checklists.md": "ca5e8059e46052b88489cdc3ffcd009fa2b33f6bcff0493ded47a3ae12c6b94e",
|
|
10
|
-
"src/skills/code-review-checklist/SKILL.md": "
|
|
10
|
+
"src/skills/code-review-checklist/SKILL.md": "b34c95ae935c2e57b302b68a42606e52d43d078276ad1dbaf0af15ad9ef6d2f8",
|
|
11
11
|
"src/skills/codemap/SKILL.md": "d21b3fa66b931b29dcf1ec0f0fcf1ec28514642a9f33f96e4b2901a0be74c72d",
|
|
12
12
|
"src/skills/context-compression/SKILL.md": "4d8368309ec72fefac69ad5cddd43650647d0bc684b6f8bf3cacc004edb56ef5",
|
|
13
|
+
"src/skills/fast-path-execution/SKILL.md": "040bb97ac5d930dcee47d5d0e2fc1ef637a4762998990475d876ec7f17977c69",
|
|
13
14
|
"src/skills/git-workflow-and-versioning/SKILL.md": "685a94041f1b4ce2a430301f517b89102055696267c369a7e8fb191606659276",
|
|
14
|
-
"src/skills/incremental-implementation/SKILL.md": "
|
|
15
|
+
"src/skills/incremental-implementation/SKILL.md": "28157b3cbb728055d4298ed54e02b7e9c93f13da7bd39ec0bb8806eb96803e03",
|
|
15
16
|
"src/skills/instruction-forge/references/agents-md-doctrine.md": "23623cc40e830ba5f2f11b7b005e85b3f4d260428f1c31cb9840e7b9baa81360",
|
|
16
17
|
"src/skills/instruction-forge/references/eval-doctrine.md": "87412d9c9afb16a0cc9eab145df45518805d0e967fe736d65bae9f5cd6a19782",
|
|
17
18
|
"src/skills/instruction-forge/references/skill-doctrine.md": "9ad4f1c249595f934bd6397afd36017a6a61068c1c21ee0bee11952cb14dc4a1",
|
|
18
19
|
"src/skills/instruction-forge/SKILL.md": "e6d45074f959033359010c936346d6718c50b4700e98566bf9ca6ab36bd60951",
|
|
19
20
|
"src/skills/loop-engineering/SKILL.md": "f804e545821b9cca8fe0ec517307ed902446f28c2ca8ff9194c0f987cf7229e3",
|
|
20
|
-
"src/skills/memory-bank/references/anti-patterns.md": "
|
|
21
|
+
"src/skills/memory-bank/references/anti-patterns.md": "f44615f724ba4fcf43035dd43693b2629ba2005d1402a08f916178c4505ee66e",
|
|
21
22
|
"src/skills/memory-bank/references/product-adoption.md": "56a0608d757090e51596e484a8a9fb0cc72c9ca3b204afb803fbec4a993acd3d",
|
|
22
23
|
"src/skills/memory-bank/references/storage-model.md": "728a9e5f2055ce0f74c759405072a6fe57f65587bdb7b9e5e7fa90b60528b085",
|
|
23
24
|
"src/skills/memory-bank/references/structure-and-frequency.md": "09caedf905870c688401a2e58b2776a9c6187fe724c576019c58c3b80fe1b98f",
|
|
24
25
|
"src/skills/memory-bank/SKILL.md": "047b3049c27e908b1d79afb14f79336e32f775385ba23956771166d445944f2f",
|
|
25
|
-
"src/skills/prompt-refinery/SKILL.md": "
|
|
26
|
+
"src/skills/prompt-refinery/SKILL.md": "1efbe6700dbcf357c1eab38662ff9572b163abb262915ce615694829682922c5",
|
|
26
27
|
"src/skills/reflect/SKILL.md": "297c374f1fbc8e15d3848f51e811e0614d4a008c7d0e1daf88bbb240d605b8a8",
|
|
27
28
|
"src/skills/security-hardening/SKILL.md": "6d637e122421f7bc3b751f04854ad343a5a5d35249458bc8939233138fd3f20d",
|
|
28
29
|
"src/skills/session-goal/references/goal-format.md": "071f6f8f12cfbc26d4703cd5f34f839f91e586a3b969bf5f81a74b961c254a83",
|
|
29
30
|
"src/skills/session-goal/references/session-reuse.md": "38b9bc7b47cf8bdd47721bd5e501df420982776ce25b155228fd81795d7d0ef2",
|
|
30
31
|
"src/skills/session-goal/SKILL.md": "fda6e39c731ab803a980a213086758d55fedcdbd8cf6dd2ce095047da9226f5a",
|
|
31
32
|
"src/skills/simplify/SKILL.md": "1f3c06f4f856cbc8cdefcfe7fd260ad7382a441d8d9d9162671b17dc33aa6edd",
|
|
32
|
-
"src/skills/spec-driven-development/SKILL.md": "
|
|
33
|
+
"src/skills/spec-driven-development/SKILL.md": "2f39bb21528f05ccb1a1e854c5797f5f1ba40377806fbd88ae5714ab584a3487",
|
|
33
34
|
"src/skills/tdd-with-agents/references/advanced-testing-patterns.md": "4aac82748bb670a61d67732168f8a265d5e66895a9183029e3da03de8e024788",
|
|
34
35
|
"src/skills/tdd-with-agents/references/testing-by-layer.md": "545291301661e57d846b2db2acca1edb1219a102dce4aad7e0c3cc1a250b570a",
|
|
35
|
-
"src/skills/tdd-with-agents/SKILL.md": "
|
|
36
|
-
"src/skills/
|
|
36
|
+
"src/skills/tdd-with-agents/SKILL.md": "107495b0473a561dd570d2c25420329d68712776524a736ccc415171f7aa6c00",
|
|
37
|
+
"src/skills/test-slicing/SKILL.md": "ff70cddc66261049250b82f7aeabbfd6bcd00f9abe34cc8d5f20aa35333b1590",
|
|
38
|
+
"src/skills/verification-planning/SKILL.md": "6a3c6cb5bd5076862d369885bf0b3ba086b625495fe7a42f3f5116d07b470f3e",
|
|
37
39
|
"src/skills/visual-review-pipeline/references/findings-schema.md": "776511757c0d8387fab232fced8ac9ce031a03f62b6ca539e3c38b0d45035c8e",
|
|
38
|
-
"src/skills/visual-review-pipeline/references/workflow-steps.md": "
|
|
39
|
-
"src/skills/visual-review-pipeline/SKILL.md": "
|
|
40
|
+
"src/skills/visual-review-pipeline/references/workflow-steps.md": "13796a32076dd4d04d37a50927169929ba44a332302bd98f72ec61482ceedc09",
|
|
41
|
+
"src/skills/visual-review-pipeline/SKILL.md": "f218252c0773c2f880a736493d7e0630e7d0678fe27beb9687053e6db6054e27",
|
|
40
42
|
"src/skills/worktrees/SKILL.md": "9cf2b036e90d9ff7c6deb786ad7bab2cb78d6bf39166a67d5cbeafc29f593c6e"
|
|
41
43
|
}
|