feat: remove legacy OpenCode runtime

Cut product flows over to Coding/Pi and retain only the migration-owned v1 boundary. Promote supported native optional packages because electron-builder omitted pnpm transitive optional closure from the packaged ASAR.
This commit is contained in:
2026-08-24 12:17:43 +08:00
parent 61fede2b4d
commit 5a275b93a7
199 changed files with 1330 additions and 64725 deletions

View File

@@ -4,9 +4,9 @@ import { tmpdir } from 'node:os';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import {
createMemoryProjectStorage,
createProjectStore,
} from '@electron/opencode/project-store';
createMemoryCodingProjectStorage,
createCodingProjectStore,
} from '@electron/coding-projects/project-store';
import {
createProjectProgressSync,
mergeProjectProgressDocuments,
@@ -95,7 +95,7 @@ describe('project progress compliance synchronization', () => {
const localPath = await createProjectDirectory('local');
await writeGameDocuments(serverPath, '# server gdd', '# server tasks');
await writeGameDocuments(localPath, '# local gdd', '# local tasks');
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const serverProject = await projectStore.rememberProject(serverPath);
const localProject = await projectStore.rememberProject(localPath);
await projectStore.setActiveProject(localProject.id);
@@ -157,7 +157,7 @@ describe('project progress compliance synchronization', () => {
const productOverview = '# 产品运营介绍\n\n一句话价值:让玩家在三分钟内完成一次太空清洁任务。';
await writeGameDocuments(projectPath, '# gdd', '# tasks');
await writeProductOverview(projectPath, productOverview);
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const project = await projectStore.rememberProject(projectPath);
await writeFile(
join(projectPath, 'works-cloud-deploy.json'),
@@ -191,7 +191,7 @@ describe('project progress compliance synchronization', () => {
await writeGameDocuments(projectPath, '# gdd', '# tasks');
await writeProductOverview(projectPath, productOverview);
await writeLegacyPromotionPlan(projectPath, '# 旧运营宣传计划\n\n不应覆盖新文档');
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const project = await projectStore.rememberProject(projectPath);
await writeFile(
join(projectPath, 'works-cloud-deploy.json'),
@@ -220,7 +220,7 @@ describe('project progress compliance synchronization', () => {
const legacyPromotionPlan = '# 旧运营宣传计划\n\n卖点:用简单操作理解环保行动。';
await writeGameDocuments(projectPath, '# gdd', '# tasks');
await writeLegacyPromotionPlan(projectPath, legacyPromotionPlan);
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const project = await projectStore.rememberProject(projectPath);
await writeFile(
join(projectPath, 'works-cloud-deploy.json'),
@@ -250,7 +250,7 @@ describe('project progress compliance synchronization', () => {
await writeGameDocuments(projectPath, '# gdd', '# tasks');
await writeProductOverview(projectPath, productOverview);
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const project = await projectStore.rememberProject(projectPath);
const harness = createWatcherHarness();
const fetchMock = vi.fn().mockResolvedValue(new Response('{}', { status: 200 }));
@@ -289,7 +289,7 @@ describe('project progress compliance synchronization', () => {
const secondOverview = '# 更新后的产品运营介绍\n\n新增真实试玩证据。';
await writeGameDocuments(projectPath, '# gdd', '# tasks');
await writeProductOverview(projectPath, firstOverview);
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const project = await projectStore.rememberProject(projectPath);
await writeFile(
join(projectPath, 'works-cloud-deploy.json'),
@@ -324,7 +324,7 @@ describe('project progress compliance synchronization', () => {
it('retries a pending initial sync after authentication becomes available', async () => {
const projectPath = await createProjectDirectory('auth');
await writeGameDocuments(projectPath, '# gdd', '# tasks');
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const project = await projectStore.rememberProject(projectPath);
const harness = createWatcherHarness();
const fetchMock = vi.fn().mockResolvedValue(new Response('{}', { status: 200 }));
@@ -353,7 +353,7 @@ describe('project progress compliance synchronization', () => {
it('keeps failed content pending and retries it on a later file change', async () => {
const projectPath = await createProjectDirectory('retry');
await writeGameDocuments(projectPath, '# first gdd', '# first tasks');
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
await projectStore.rememberProject(projectPath);
const harness = createWatcherHarness();
const fetchMock = vi.fn()
@@ -383,7 +383,7 @@ describe('project progress compliance synchronization', () => {
});
it('attaches a watcher only after a project becomes active', async () => {
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const harness = createWatcherHarness();
const fetchMock = vi.fn().mockResolvedValue(new Response('{}', { status: 200 }));
const sync = createProjectProgressSync(projectStore, {
@@ -411,7 +411,7 @@ describe('project progress compliance synchronization', () => {
it('closes project watchers when a project is removed or synchronization stops', async () => {
const projectPath = await createProjectDirectory('lifecycle');
await writeGameDocuments(projectPath, '# gdd', '# tasks');
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
const project = await projectStore.rememberProject(projectPath);
const harness = createWatcherHarness();
const sync = createProjectProgressSync(projectStore, {
@@ -435,7 +435,7 @@ describe('project progress compliance synchronization', () => {
it('does not expose document content in error logs or request URLs', async () => {
const projectPath = await createProjectDirectory('request-shape');
await writeGameDocuments(projectPath, 'secret gdd content', 'secret task content');
const projectStore = createProjectStore(createMemoryProjectStorage());
const projectStore = createCodingProjectStore(createMemoryCodingProjectStorage());
await projectStore.rememberProject(projectPath);
const harness = createWatcherHarness();
const fetchMock = vi.fn().mockResolvedValue(new Response('{}', { status: 200 }));