Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(cindy-make): refine personal version lifecycle

MagicLizi48b68c37020c
diff --git a/apps/desktop/src/main/bootstrap-electron.ts b/apps/desktop/src/main/bootstrap-electron.ts
index 2ef7fb9141..3b4c5a0e1f 100644
--- a/apps/desktop/src/main/bootstrap-electron.ts
+++ b/apps/desktop/src/main/bootstrap-electron.ts
@@ -1,7 +1,10 @@
import { listWorktreeRecycleStatus, controlWorktreeRecycle } from './worktree/recycleControls';
import { registerFilePeerIpc } from './device-link/filePeer';
import { registerLoginItemIpc } from './login-item-ipc.js';
-import { createLatestSourceVersionReader } from './cindy-make/latestSourceVersion.js';
+import {
+ createLatestSourceVersionReader,
+ sourceChannel,
+} from './cindy-make/latestSourceVersion.js';
import { refreshCindySourceStatus } from './cindy-make/sourceStatusRefresh.js';
import {
configureUpstreamMerge,
@@ -17,6 +20,10 @@ import {
openHistoryPersonalBuild,
stopMakeHistoryBuild,
} from './cindy-make/historyRuntime.js';
+import {
+ readCindyMakeSettings,
+ writeCindyMakeSyncLatestBeforeBuild,
+} from './cindy-make/settingsStore.js';
import { retainProviderPresentationAfterAuthChange } from './maker-host/provider-presentation-store.js';
import { codexAccountState } from './maker-host/codex-account-auth.js';
import { syncSubscriptionAccountUsage } from './usage/subscriptionAccountUsage.js';
@@ -349,6 +356,7 @@ import {
subscribeCindySourceStatus,
} from './cindy-make/sourcePreparation.js';
import { broadcastCindyMakeSourceStatus } from './cindy-make/sourceStatusBroadcast.js';
+import { broadcastCindyMakeHistoryChanged } from './cindy-make/historyBroadcast.js';
import { cindyMakeManager } from './cindy-make/manager.js';
import { broadcastCindyMakeState } from './cindy-make/stateBroadcast.js';
import {
@@ -7530,7 +7538,7 @@ const registerIpcHandlers = () => {
}
return readCurrentCindySourceStatus(root, env);
},
- readLatest: (source) => readLatestSourceVersion(source, channel),
+ readLatest: (source) => readLatestSourceVersion(source, sourceChannel(source, channel)),
});
});
// 源码准备是全局单例:进度广播给所有窗口,任意窗口都能停止它。
@@ -7545,10 +7553,27 @@ const registerIpcHandlers = () => {
});
configureCindyMakeTestRuntime(
(id) => getMakerIfReady()?.getSession(id)?.isTurnRunning() ?? false,
+ broadcastCindyMakeHistoryChanged,
);
configureCindyMakeEditingGuard((id) => cindyMakeTestController.isUsingSession(id));
registerMakeRemoteResources((id) => getMakerIfReady()?.getSession(id)?.isTurnRunning() ?? false);
- configureMakeHistory((id) => getMakerIfReady()?.getSession(id)?.isTurnRunning() ?? false);
+ configureMakeHistory(
+ (id) => getMakerIfReady()?.getSession(id)?.isTurnRunning() ?? false,
+ broadcastCindyMakeHistoryChanged,
+ );
+ ipcMain.handle('app:get-cindy-make-settings', (event) => {
+ assertTrustedAppRendererEvent(event);
+ return readCindyMakeSettings();
+ });
+ ipcMain.handle(
+ 'app:set-cindy-make-sync-latest-before-build',
+ (event, enabled: unknown) => {
+ assertTrustedAppRendererEvent(event);
+ if (typeof enabled !== 'boolean')
+ throwIpcError('INVALID_PARAMS', 'Invalid Cindy Make setting');
+ return writeCindyMakeSyncLatestBeforeBuild(enabled);
+ },
+ );
ipcMain.handle('app:cindy-make-history', async (event, selected?: unknown) => {
assertTrustedAppRendererEvent(event);
if (
diff --git a/apps/desktop/src/main/cindy-make/__tests__/historyBroadcast.test.ts b/apps/desktop/src/main/cindy-make/__tests__/historyBroadcast.test.ts
new file mode 100644
index 0000000000..3c87924f6c
--- /dev/null
+++ b/apps/desktop/src/main/cindy-make/__tests__/historyBroadcast.test.ts
@@ -0,0 +1,40 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import {
+ broadcastCindyMakeHistoryChanged,
+ CINDY_MAKE_HISTORY_CHANGED,
+} from '../historyBroadcast.js';
+
+const windows = [
+ { isDestroyed: vi.fn(() => false), webContents: { send: vi.fn() } },
+ { isDestroyed: vi.fn(() => true), webContents: { send: vi.fn() } },
+];
+const ownerStamp = { dataOwnerId: 'owner-a', ownerGeneration: 3 };
+
+vi.mock('electron', () => ({
+ BrowserWindow: {
+ getAllWindows: vi.fn(() => windows),
+ },
+}));
+vi.mock('../../device-link/broadcast-tap.js', () => ({
+ captureDataOwnerBroadcastScope: () => ({ ownerStamp }),
+}));
+
+describe('Cindy Make history broadcast', () => {
+ beforeEach(() => {
+ for (const window of windows) {
+ window.isDestroyed.mockClear();
+ window.webContents.send.mockClear();
+ }
+ });
+
+ it('invalidates history in every live window for the current owner', () => {
+ broadcastCindyMakeHistoryChanged();
+
+ expect(windows[0].webContents.send).toHaveBeenCalledWith(
+ CINDY_MAKE_HISTORY_CHANGED,
+ ownerStamp,
+ );
+ expect(windows[1].webContents.send).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.ts
index 3990e1cb3f..792f8a506d 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.ts
@@ -18,6 +18,8 @@ const h = vi.hoisted(() => ({
merge: vi.fn(),
waitForMerge: vi.fn(),
finishCleanup: vi.fn(),
+ syncBuild: vi.fn(),
+ syncBeforeBuild: false,
git: vi.fn(),
end: vi.fn(),
saved: vi.fn(),
@@ -32,6 +34,7 @@ const h = vi.hoisted(() => ({
testAction: vi.fn(),
stopTest: vi.fn(),
retryMerge: vi.fn(),
+ historyChanged: vi.fn(),
}));
const store = {
readBuildRollback: () => [],
@@ -97,6 +100,10 @@ vi.mock('../upstreamMergeRuntime.js', () => ({
actUpstreamMerge: h.retryMerge,
waitForMakeHistoryMerge: h.waitForMerge,
finishMakeHistoryCleanup: h.finishCleanup,
+ syncSourceBeforeCindyMakeBuild: h.syncBuild,
+}));
+vi.mock('../settingsStore.js', () => ({
+ readCindyMakeSettings: () => ({ syncLatestBeforeBuild: h.syncBeforeBuild }),
}));
vi.mock('../taskManagement.js', () => ({ manageCindyMakeTask: h.end }));
vi.mock('../testRuntime.js', () => ({
@@ -188,6 +195,10 @@ beforeEach(() => {
h.merge.mockReset();
h.waitForMerge.mockReset().mockResolvedValue(undefined);
h.finishCleanup.mockReset().mockResolvedValue(undefined);
+ h.syncBuild.mockReset().mockImplementation(async (_signal, publish) => {
+ await publish({ status: 'syncing', syncLatestSource: true });
+ });
+ h.syncBeforeBuild = false;
h.git
.mockReset()
.mockImplementation(async (_env: unknown, args: string[]) =>
@@ -205,7 +216,7 @@ beforeEach(() => {
vi.spyOn(cindyMakeManager, 'hasActiveWork').mockImplementation(
() => h.busy || realHasActiveWork(),
);
- configureMakeHistory(() => h.running);
+ configureMakeHistory(() => h.running, h.historyChanged);
h.rows = [
{
id: 'session',
@@ -469,6 +480,35 @@ describe('history Main admission and owner boundary', () => {
expect(state.items[0].actions).toContain('integrate');
cindyMakeManager.forgetTask(runId);
});
+ it('separates retained source conflicts from work that blocks version switching', async () => {
+ h.state.upstreamMerge = { id: 'update', status: 'conflict', hasWorkspace: true };
+ expect(await getCindyMakeHistory('aaaa')).toMatchObject({
+ busy: true,
+ activeWork: false,
+ canBuild: false,
+ });
+ await expect(generateHistoryPersonalVersion()).rejects.toThrow('busy');
+ expect(h.build).not.toHaveBeenCalled();
+ h.busy = true;
+ expect(await getCindyMakeHistory('aaaa')).toMatchObject({
+ busy: true,
+ activeWork: true,
+ canBuild: false,
+ });
+ h.busy = false;
+ h.testUsing = true;
+ expect(await getCindyMakeHistory('aaaa')).toMatchObject({
+ busy: true,
+ activeWork: true,
+ canBuild: false,
+ });
+ h.testUsing = false;
+ expect(await getCindyMakeHistory('aaaa')).toMatchObject({
+ busy: true,
+ activeWork: false,
+ canBuild: false,
+ });
+ });
it('keeps builds and integrations blocked until cancellation finishes even if its directory is gone', async () => {
h.state.upstreamMerge = {
id: 'update',
@@ -525,8 +565,27 @@ describe('history Main admission and owner boundary', () => {
build: { status: 'failed', error: 'checksFailed' },
});
});
+ expect(h.historyChanged).toHaveBeenCalledOnce();
expect(JSON.stringify(buildState)).not.toContain('private test output');
});
+ it('syncs the latest official source before a global build only when the setting is on', async () => {
+ let buildState: CindyMakePersonalBuildState | undefined;
+ store.readBuild.mockImplementation(() => buildState);
+ store.saveBuild.mockImplementation((value) => {
+ buildState = value;
+ });
+ h.syncBeforeBuild = true;
+ h.build.mockResolvedValueOnce({ commit: 'b'.repeat(40), tree: 'd'.repeat(40) });
+
+ await generateHistoryPersonalVersion();
+ await vi.waitFor(() => expect(h.build).toHaveBeenCalledOnce());
+ await vi.waitFor(() => expect(buildState?.status).toBe('ready'));
+
+ expect(h.syncBuild).toHaveBeenCalledOnce();
+ expect(h.syncBuild.mock.invocationCallOrder[0]).toBeLessThan(h.build.mock.invocationCallOrder[0]);
+ expect(buildState).toMatchObject({ syncLatestSource: true });
+ expect(buildState?.logs?.map((entry) => entry.step)).toContain('syncing');
+ });
it('keeps the originating history session visibly running for a source build', async () => {
let finish!: (value: { commit: string; tree: string }) => void;
h.build.mockImplementationOnce(
@@ -873,6 +932,7 @@ describe('one personal version from selected history', () => {
{ runId: 'bbbb', operationId: 'merge-bbbb' },
],
});
+ expect(h.historyChanged).toHaveBeenCalledOnce();
expect(store.version).toHaveBeenCalledTimes(2);
});
it('validates every selected workspace before merging any of them', async () => {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/historyStore.test.ts b/apps/desktop/src/main/cindy-make/__tests__/historyStore.test.ts
index 3b314b6bf7..5e1a6179eb 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/historyStore.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/historyStore.test.ts
@@ -78,7 +78,13 @@ it('preserves real checking stages and known failures while filtering private or
}
store.saveBuild({ status: 'merging', mergeStep: 'private-output' as never });
expect(store.readBuild()).toEqual({ status: 'merging' });
- for (const error of ['checksFailed', 'missingShell', 'baselineChanged', 'interrupted'] as const) {
+ for (const error of [
+ 'checksFailed',
+ 'missingShell',
+ 'sourceSyncFailed',
+ 'baselineChanged',
+ 'interrupted',
+ ] as const) {
store.saveBuild({ status: 'failed', error });
expect(store.readBuild()).toEqual({ status: 'failed', error });
}
@@ -93,6 +99,8 @@ it('preserves real checking stages and known failures while filtering private or
}
store.saveBuild({ status: 'checking' });
expect(store.readBuild()).toEqual({ status: 'checking' });
+ store.saveBuild({ status: 'syncing', syncLatestSource: true });
+ expect(store.readBuild()).toEqual({ status: 'syncing', syncLatestSource: true });
});
it('keeps only bounded known build log entries and preparation stages', () => {
const dir = mkdtempSync(path.join(os.tmpdir(), 'make-build-log-'));
diff --git a/apps/desktop/src/main/cindy-make/__tests__/latestSourceVersion.test.ts b/apps/desktop/src/main/cindy-make/__tests__/latestSourceVersion.test.ts
index c2a9cb8bf7..4c839e0498 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/latestSourceVersion.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/latestSourceVersion.test.ts
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { MakeSourceStatus } from '../../../shared/cindyMakeDoctor.js';
-import { createLatestSourceVersionReader } from '../latestSourceVersion.js';
+import { createLatestSourceVersionReader, sourceChannel } from '../latestSourceVersion.js';
const local = 'a'.repeat(40);
const remote = 'b'.repeat(40);
@@ -23,6 +23,12 @@ const comparison = { base_commit: { sha: local }, ahead_by: 7, behind_by: 2 };
afterEach(() => vi.useRealTimers());
describe('latest Cindy source version', () => {
+ it('uses the managed source channel even when the running Dev app is packaged', () => {
+ expect(sourceChannel({ channel: 'dev', ref: 'main' }, 'release')).toBe('dev');
+ expect(sourceChannel({ channel: undefined, ref: 'main' }, 'release')).toBe('dev');
+ expect(sourceChannel({ channel: 'release', ref: 'v1.2.3' }, 'dev')).toBe('release');
+ });
+
it('queries live main and reports the local main difference in the correct direction', async () => {
const fetch = vi
.fn()
diff --git a/apps/desktop/src/main/cindy-make/__tests__/personalBuild.git-integration.test.ts b/apps/desktop/src/main/cindy-make/__tests__/personalBuild.git-integration.test.ts
index b50487c7a2..41b39bdcbe 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/personalBuild.git-integration.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/personalBuild.git-integration.test.ts
@@ -3,6 +3,13 @@ import { access, mkdir, mkdtemp, readFile, rename, rm, writeFile } from 'node:fs
import os from 'node:os';
import path from 'node:path';
import { expect, it, vi } from 'vitest';
+import { brandExecutableName } from '@cindy/maker-shared/brand-identity';
+import {
+ personalVersionId,
+ readPersonalVersion,
+ runnableBundlePaths,
+ versionDirectory,
+} from '../versionStore';
import {
buildCindyPersonal,
personalArtifactPath,
@@ -243,6 +250,115 @@ it('rolls back failed generations, preserves concurrent edits and keeps successf
}
}, 90_000);
+it('builds the latest cindy-personal HEAD after acquiring the project lock, even from an old completion', async () => {
+ const h = await fixture();
+ try {
+ const first = await h.run();
+ let latest = '';
+ h.packageCommand.mockImplementationOnce(async (...args) => {
+ expect(await h.git(['rev-parse', 'HEAD'], args[2])).toBe(latest);
+ expect(await readFile(path.join(args[2], 'latest.txt'), 'utf8')).toBe(
+ 'newer personal change',
+ );
+ await h.pack(args[0], args[1], args[2]);
+ });
+ const next = await buildCindyPersonal(
+ { mode: 'personal', userData: h.userData, completionId: h.task.completionId },
+ process.execPath,
+ h.env,
+ 'global',
+ h.signal,
+ async () => {},
+ () => {},
+ async (run) => {
+ // Another completed modification can arrive while this build waits for the source lock.
+ await writeFile(path.join(h.source, 'latest.txt'), 'newer personal change');
+ await h.git(['add', 'latest.txt']);
+ await h.git(['commit', '-s', '-m', 'another personal change']);
+ latest = await h.git(['rev-parse', 'cindy-personal']);
+ return run();
+ },
+ { pnpm: h.pnpm, packageCommand: h.packageCommand },
+ );
+ expect(latest).not.toBe(first.commit);
+ expect(next.commit).toBe(latest);
+ expect(next.tree).toBe(await h.git(['rev-parse', 'cindy-personal^{tree}']));
+ expect(await h.git(['rev-parse', 'HEAD'], h.workingDir)).toBe(h.task.commit);
+ expect(await h.git(['status', '--porcelain'])).toBe('');
+ } finally {
+ await rm(h.userData, { recursive: true, force: true });
+ }
+}, 90_000);
+
+it('replaces the single personal application only after a successful build and retains it on later failure', async () => {
+ const h = await fixture();
+ try {
+ await writeFile(
+ path.join(h.source, '.gitignore'),
+ 'apps/desktop/release/\napps/desktop/out/\n',
+ );
+ const appName = brandExecutableName('global');
+ h.packageCommand.mockImplementation(async (...args) => {
+ await h.pack(args[0], args[1], args[2]);
+ const packaged = path.join(
+ h.source,
+ 'apps',
+ 'desktop',
+ 'out',
+ `${appName}-${process.platform}-${process.arch}`,
+ );
+ const bundle =
+ process.platform === 'darwin' ? path.join(packaged, appName + '.app') : packaged;
+ const { executable, resources } = runnableBundlePaths(bundle, appName);
+ await mkdir(path.dirname(executable), { recursive: true });
+ await mkdir(path.join(resources, 'drizzle'), { recursive: true });
+ await writeFile(executable, 'fixture executable');
+ await writeFile(path.join(resources, 'app.asar'), 'fixture application');
+ await writeFile(path.join(resources, 'drizzle', '0000_base.sql'), 'SELECT 1;');
+ await writeFile(
+ path.join(resources, 'cindy-version-protocol.json'),
+ JSON.stringify({ version: 1 }),
+ );
+ await writeFile(
+ path.join(resources, 'cindy-source.json'),
+ JSON.stringify({
+ sourceCommit: await h.git(['rev-parse', 'HEAD']),
+ builtAt: '2026-09-22T12:00:00+08:00',
+ }),
+ );
+ });
+ const run = () =>
+ buildCindyPersonal(
+ { ...h.task, profile: { userData: h.userData, appName, region: 'global', passive: false } },
+ process.execPath,
+ h.env,
+ 'global',
+ h.signal,
+ async () => {},
+ () => {},
+ async (operation) => operation(),
+ { pnpm: h.pnpm, packageCommand: h.packageCommand },
+ );
+ const first = await run();
+ expect(personalVersionId(h.userData)).toBe(first.versionId);
+ h.packageCommand.mockRejectedValueOnce(new Error('packaging failed'));
+ await expect(run()).rejects.toThrow('packaging failed');
+ expect(personalVersionId(h.userData)).toBe(first.versionId);
+ expect(readPersonalVersion(h.userData, first.versionId!).commit).toBe(first.commit);
+ const second = await run();
+ expect(second.versionId).not.toBe(first.versionId);
+ expect(personalVersionId(h.userData)).toBe(second.versionId);
+ expect(readPersonalVersion(h.userData, second.versionId!).commit).toBe(
+ await h.git(['rev-parse', 'cindy-personal']),
+ );
+ await expect(
+ access(path.join(versionDirectory(h.userData, first.versionId!), 'runtime')),
+ ).rejects.toThrow();
+ } finally {
+ await rm(h.userData, { recursive: true, force: true });
+ }
+}, 90_000);
+
it('converts a retained file-only completion into committed personal history and keeps retries idempotent', async () => {
const h = await fixture();
try {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/remoteProvider.test.ts b/apps/desktop/src/main/cindy-make/__tests__/remoteProvider.test.ts
index 1a6e8578a4..c9c60347b1 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/remoteProvider.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/remoteProvider.test.ts
@@ -142,7 +142,10 @@ describe('portable Cindy Make cards', () => {
state.recoverable = true;
const resumed = project(state, dictionary);
expect(resumed.blocks?.[0].data).toMatchObject({ input: 'available' });
- expect(resumed.actions?.map((action) => action.id)).toEqual(['resume:revision']);
+ expect(resumed.actions?.map((action) => action.id)).toEqual([
+ 'resume:revision:start',
+ 'resume:revision:build',
+ ]);
},
);
@@ -231,9 +234,9 @@ describe('host validates portable task actions', () => {
const h = harness();
h.state.completion = undefined;
h.state.recoverable = true;
- await expect(h.invoke('resume:old')).rejects.toThrow('Task changed');
+ await expect(h.invoke('resume:old:start')).rejects.toThrow('Task changed');
h.changeOwner();
- await expect(h.invoke('resume:revision')).rejects.toThrow('Task changed');
+ await expect(h.invoke('resume:revision:start')).rejects.toThrow('Task changed');
expect(h.act).not.toHaveBeenCalled();
});
it('coalesces two controllers and returns only invalidation effects', async () => {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/remoteRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/remoteRuntime.test.ts
index 57379d3472..8e566addca 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/remoteRuntime.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/remoteRuntime.test.ts
@@ -139,13 +139,10 @@ describe('Cindy Make mobile host adapter', () => {
const card = await get();
expect(card.actions?.[0].id).toMatch(/^resume:/);
await invoke(card.actions![0].id);
- expect(h.send).toHaveBeenCalledWith(
- 'task',
- 'ja:cindyMake.test.resume.request',
- expect.objectContaining({ model: 'chosen', agentKind: 'codex', workingDir: '/managed/task' }),
- expect.any(Function),
- expect.any(String),
- );
+ expect(h.test).toHaveBeenCalledWith('task', 'reply', 'resume-start');
+ await invoke(card.actions![1].id);
+ expect(h.test).toHaveBeenCalledWith('task', 'reply', 'resume-build');
+ expect(h.send).not.toHaveBeenCalled();
h.rows[0].agentMeta = JSON.stringify({ turnCompleted: false });
expect((await get()).actions).toEqual([]);
});
@@ -192,14 +189,26 @@ describe('Cindy Make mobile host adapter', () => {
task: { sessionId: 'task', phase: 'dependencies' },
};
expect((await get()).actions?.[0].id).toBe('prepare:run:retry');
- h.history.mockResolvedValue({ items: [{
- runId: 'run', sessionId: 'task', request: 'original request', title: 'Original task',
- actions: ['retry-prepare'],
- }] });
+ h.history.mockResolvedValue({
+ items: [
+ {
+ runId: 'run',
+ sessionId: 'task',
+ request: 'original request',
+ title: 'Original task',
+ actions: ['retry-prepare'],
+ },
+ ],
+ });
await invoke('prepare:run:retry');
- expect(h.start).toHaveBeenCalledWith({
- runId: 'run', request: 'original request', title: 'Original task',
- }, 0);
+ expect(h.start).toHaveBeenCalledWith(
+ {
+ runId: 'run',
+ request: 'original request',
+ title: 'Original task',
+ },
+ 0,
+ );
h.history.mockImplementationOnce(async () => {
h.owner += 1;
return { items: [] };
diff --git a/apps/desktop/src/main/cindy-make/__tests__/settingsStore.test.ts b/apps/desktop/src/main/cindy-make/__tests__/settingsStore.test.ts
new file mode 100644
index 0000000000..3720c4f523
--- /dev/null
+++ b/apps/desktop/src/main/cindy-make/__tests__/settingsStore.test.ts
@@ -0,0 +1,48 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+
+const paths = vi.hoisted(() => ({ userData: '' }));
+vi.mock('electron', () => ({ app: { getPath: () => paths.userData } }));
+
+import {
+ __testing,
+ readCindyMakeSettings,
+ resetCindyMakeSettings,
+ writeCindyMakeSyncLatestBeforeBuild,
+} from '../settingsStore.js';
+
+describe('Cindy Make settings store', () => {
+ beforeEach(() => {
+ paths.userData = fs.mkdtempSync(path.join(os.tmpdir(), 'cindy-make-settings-'));
+ });
+
+ afterEach(() => {
+ fs.rmSync(paths.userData, { recursive: true, force: true });
+ });
+
+ it('defaults build-time source sync to off', () => {
+ expect(readCindyMakeSettings()).toEqual({ syncLatestBeforeBuild: false });
+ expect(__testing.normalize({ syncLatestBeforeBuild: 'true' })).toEqual({
+ syncLatestBeforeBuild: false,
+ });
+ });
+
+ it('persists explicit on and off choices until reset', () => {
+ expect(writeCindyMakeSyncLatestBeforeBuild(true)).toEqual({
+ syncLatestBeforeBuild: true,
+ });
+ expect(writeCindyMakeSyncLatestBeforeBuild(false)).toEqual({
+ syncLatestBeforeBuild: false,
+ });
+ expect(
+ JSON.parse(
+ fs.readFileSync(path.join(paths.userData, 'cindy-make-settings.json'), 'utf8'),
+ ),
+ ).toEqual({ syncLatestBeforeBuild: false });
+
+ expect(resetCindyMakeSettings()).toEqual({ syncLatestBeforeBuild: false });
+ expect(fs.existsSync(path.join(paths.userData, 'cindy-make-settings.json'))).toBe(false);
+ });
+});
diff --git a/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts
index 3c7740f086..548bc0995a 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts
@@ -17,6 +17,7 @@ const harness = vi.hoisted(() => ({
environment: vi.fn(),
source: vi.fn(),
prepareSource: vi.fn(),
+ syncSource: vi.fn(),
workspace: vi.fn(),
install: vi.fn(),
send: vi.fn(),
@@ -45,6 +46,9 @@ vi.mock('../taskWorkspace.js', () => ({
createCindyMakeWorktree: harness.workspace,
installCindyMakeWorktree: harness.install,
}));
+vi.mock('../upstreamMergeRuntime.js', () => ({
+ syncSourceBeforeCindyMakeTask: harness.syncSource,
+}));
vi.mock('../../localDb/client/current.js', () => ({ getDbClient: () => client }));
vi.mock('../../localDb/ipc/messages.js', () => ({
createMessage: harness.createMessage,
@@ -168,6 +172,7 @@ beforeEach(() => {
return report;
});
harness.source.mockResolvedValue({ status: 'ready', path: '/source', branch: 'cindy-personal' });
+ harness.syncSource.mockResolvedValue(undefined);
harness.workspace.mockImplementation(async (userData, runId) => ({
path: sourcePaths.makeTaskWorktreePath(userData, runId),
branch: 'cindy-make/' + runId,
@@ -179,6 +184,61 @@ beforeEach(() => {
});
describe('Cindy Make task runtime', () => {
+ it('updates the personal source before creating the task worktree', async () => {
+ const start = input();
+ initialReads();
+ await startCindyMakeTask(start, 1);
+ await cindyMakeManager.waitForTask(start.runId);
+ expect(harness.syncSource).toHaveBeenCalledWith(
+ expect.any(AbortSignal),
+ expect.objectContaining({ agentKind: 'codex', model: 'origin-model' }),
+ );
+ expect(harness.syncSource.mock.invocationCallOrder[0]).toBeLessThan(
+ harness.workspace.mock.invocationCallOrder[0],
+ );
+ expect(harness.send).toHaveBeenCalledOnce();
+ });
+
+ it('publishes a distinct personal source update phase while the task waits', async () => {
+ const start = input();
+ initialReads();
+ let finishSync!: () => void;
+ harness.syncSource.mockImplementationOnce(
+ () =>
+ new Promise<void>((resolve) => {
+ finishSync = resolve;
+ }),
+ );
+ await startCindyMakeTask(start, 1);
+ await vi.waitFor(() =>
+ expect(cindyMakeManager.taskReport(start.runId)).toMatchObject({
+ status: 'running',
+ task: { phase: 'updatingSource' },
+ }),
+ );
+ expect(harness.workspace).not.toHaveBeenCalled();
+ finishSync();
+ await cindyMakeManager.waitForTask(start.runId);
+ expect(harness.send).toHaveBeenCalledOnce();
+ });
+
+ it('does not create a worktree or start the task when source update fails', async () => {
+ const start = input();
+ initialReads();
+ harness.syncSource.mockRejectedValueOnce(
+ Object.assign(new Error('conflict'), { code: 'busy' }),
+ );
+ await startCindyMakeTask(start, 1);
+ await cindyMakeManager.waitForTask(start.runId);
+ expect(harness.workspace).not.toHaveBeenCalled();
+ expect(harness.install).not.toHaveBeenCalled();
+ expect(harness.send).not.toHaveBeenCalled();
+ expect(cindyMakeManager.taskReport(start.runId)).toMatchObject({
+ status: 'failed',
+ task: { phase: 'updatingSource' },
+ });
+ });
+
it.each([false, true])(
'retries from history without origin identity after restart=%s',
async (restart) => {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/testController.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testController.test.ts
index bc7fac18a2..ecbf657ee6 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/testController.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/testController.test.ts
@@ -34,6 +34,7 @@ function harness(initial: Partial<CindyMakeCompletionMeta> = {}) {
},
);
const openBuild = vi.fn(async () => {});
+ const buildSettled = vi.fn();
const stop = vi.fn(() => {
ready.reject(makeTestError('interrupted'));
closed.resolve();
@@ -62,6 +63,7 @@ function harness(initial: Partial<CindyMakeCompletionMeta> = {}) {
launch,
build,
openBuild,
+ onBuildSettled: buildSettled,
now: () => 123,
withUse: async (_context, run) => {
leased = true;
@@ -77,6 +79,7 @@ function harness(initial: Partial<CindyMakeCompletionMeta> = {}) {
launch,
build,
openBuild,
+ buildSettled,
artifact,
save,
ready,
@@ -334,6 +337,7 @@ describe('personal build completion choices', () => {
await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));
expect(h.meta().personal).toMatchObject({ buildId: id, status: 'ready', ...installer });
expect(h.meta().personal?.stopping).toBeUndefined();
+ expect(h.buildSettled).toHaveBeenCalledOnce();
});
it('preserves cleanup failures instead of reporting a completed cancellation', async () => {
const h = harness();
@@ -347,6 +351,7 @@ describe('personal build completion choices', () => {
await h.controller.cancelBuild(h.meta().personal!.buildId!);
await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));
expect(h.meta().personal).toMatchObject({ status: 'failed', error: 'cleanupFailed' });
+ expect(h.buildSettled).toHaveBeenCalledOnce();
});
it('stops only the current build, keeps cleanup leased, and gives retry a new identity', async () => {
const h = harness();
diff --git a/apps/desktop/src/main/cindy-make/__tests__/testRecovery.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testRecovery.test.ts
new file mode 100644
index 0000000000..7e73eac62c
--- /dev/null
+++ b/apps/desktop/src/main/cindy-make/__tests__/testRecovery.test.ts
@@ -0,0 +1,188 @@
+import os from 'node:os';
+import path from 'node:path';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+const h = vi.hoisted(() => ({
+ owner: 1,
+ busy: false,
+ preparing: false,
+ profile: '',
+ session: {} as Record<string, unknown>,
+ anchor: {} as Record<string, unknown>,
+ collect: vi.fn(),
+ create: vi.fn(),
+ capture: vi.fn(),
+ broadcast: vi.fn(),
+ project: vi.fn(),
+}));
+vi.mock('electron', () => ({ app: { getPath: () => h.profile } }));
+vi.mock('../../localDb/client/current.js', () => ({ getDbClient: () => client }));
+vi.mock('../../device-link/broadcast-tap.js', () => ({
+ captureDataOwnerBroadcastScope: () => h.owner,
+ isDataOwnerBroadcastScopeCurrent: (owner: number) => owner === h.owner,
+}));
+vi.mock('../../localDb/ipc/messages.js', () => ({ createMessage: h.create }));
+vi.mock('../completion.js', () => ({ collectCindyMakeChanges: h.collect }));
+vi.mock('../manager.js', () => ({
+ cindyMakeManager: { isTaskPreparing: () => h.preparing, withProject: h.project },
+}));
+vi.mock('../toolchainEnvironment.js', () => ({
+ createMakeToolchainEnvironment: async () => ({}),
+ resolveMakeToolEnvironment: async () => ({}),
+}));
+vi.mock('../historyOwner.js', () => ({ captureMakeHistoryStore: () => ({}) }));
+vi.mock('../historyCapture.js', () => ({ captureMakeHistoryCompletion: h.capture }));
+vi.mock('../remoteBroadcast.js', () => ({ broadcastMakeRemoteChanged: h.broadcast }));
+import { sessions } from '../../localDb/schema';
+import { setSessionRouteLockImplementation } from '../../localDb/sessionRouteLock';
+import { prepareCindyMakeTest } from '../testRecovery';
+const client = {
+ drizzle: {
+ select: () => {
+ let session = false;
+ const query = {
+ from: (table: unknown) => {
+ session = table === sessions;
+ return query;
+ },
+ where: () => query,
+ orderBy: () => query,
+ limit: async () => [structuredClone(session ? h.session : h.anchor)],
+ };
+ return query;
+ },
+ },
+};
+const prepare = () => prepareCindyMakeTest('task', 'reply', () => h.busy);
+beforeEach(() => {
+ vi.resetAllMocks();
+ h.owner = 1;
+ h.busy = false;
+ h.preparing = false;
+ h.profile = path.join(os.tmpdir(), 'make-recovery-test');
+ h.session = {
+ id: 'task',
+ source: 'cindy-make',
+ status: 'active',
+ workingDir: path.join(h.profile, 'cindy-make', 'worktrees', 'run'),
+ clearedAt: null,
+ };
+ h.anchor = {
+ clientId: 'reply',
+ role: 'assistant',
+ createdAt: 100,
+ agentMeta: JSON.stringify({ turnCompleted: true }),
+ };
+ h.project.mockImplementation(async (_root, run) => run());
+ h.collect.mockResolvedValue({ commit: 'b'.repeat(40), tree: 'c'.repeat(40), changedFiles: 2 });
+ h.create.mockImplementation(async (_id, body) => {
+ h.anchor = { ...body, agentMeta: JSON.stringify(body.agentMeta) };
+ });
+ let tail = Promise.resolve();
+ setSessionRouteLockImplementation((_id, run) => {
+ const task = tail.then(run);
+ tail = task.then(
+ () => {},
+ () => {},
+ );
+ return task;
+ });
+});
+afterEach(() => setSessionRouteLockImplementation(null));
+
+describe('native on-demand Make snapshot', () => {
+ it.each(['reply', 'continued'])(
+ 'captures current files for an explicit action on a %s result',
+ async (kind) => {
+ if (kind === 'continued')
+ h.anchor.agentMeta = JSON.stringify({
+ cindyMakeCompletion: {
+ reportedAt: 1,
+ continuedAt: 2,
+ commit: 'a'.repeat(40),
+ personal: { status: 'ready' },
+ },
+ });
+ const result = await prepare();
+ expect(result.completionId).not.toBe('reply');
+ expect(h.collect).toHaveBeenCalledExactlyOnceWith(
+ expect.any(Function),
+ h.profile,
+ h.session.workingDir,
+ );
+ expect(h.create).toHaveBeenCalledWith(
+ 'task',
+ expect.objectContaining({
+ content: '',
+ clientId: result.completionId,
+ agentMeta: {
+ cindyMakeCompletion: {
+ reportedAt: expect.any(Number),
+ commit: 'b'.repeat(40),
+ tree: 'c'.repeat(40),
+ changedFiles: 2,
+ },
+ },
+ }),
+ expect.objectContaining({ expectedClearBoundaryMs: null, broadcastOwnerScope: 1 }),
+ );
+ expect(h.capture).toHaveBeenCalledOnce();
+ expect(h.broadcast).toHaveBeenCalledWith('task', 1);
+ },
+ );
+ it('does not duplicate a snapshot when two controls click the same old result', async () => {
+ const results = await Promise.allSettled([prepare(), prepare()]);
+ expect(results.map((r) => r.status)).toEqual(['fulfilled', 'rejected']);
+ expect(h.collect).toHaveBeenCalledOnce();
+ expect(h.create).toHaveBeenCalledOnce();
+ });
+ it.each([
+ { source: 'chat' },
+ { status: 'archived' },
+ { remoteHostId: 'ssh' },
+ { workingDir: '/other' },
+ { clearedAt: 100 },
+ ])('rejects an ineligible task: %s', async (patch) => {
+ Object.assign(h.session, patch);
+ await expect(prepare()).rejects.toMatchObject({ code: 'unavailable' });
+ expect(h.collect).not.toHaveBeenCalled();
+ expect(h.create).not.toHaveBeenCalled();
+ });
+ it.each([
+ { role: 'user' },
+ { clientId: 'newer-reply' },
+ { agentMeta: JSON.stringify({ turnCompleted: false }) },
+ { agentMeta: '{}' },
+ { agentMeta: '{invalid' },
+ ])('rejects a superseded or unfinished result: %s', async (patch) => {
+ Object.assign(h.anchor, patch);
+ await expect(prepare()).rejects.toMatchObject({ code: 'unavailable' });
+ expect(h.collect).not.toHaveBeenCalled();
+ });
+ it.each(['owner', 'message', 'workdir', 'busy', 'clear'])(
+ 'rechecks %s after collecting files and never publishes stale facts',
+ async (change) => {
+ h.collect.mockImplementationOnce(async () => {
+ if (change === 'owner') h.owner++;
+ if (change === 'message') h.anchor.clientId = 'new-message';
+ if (change === 'workdir')
+ h.session.workingDir = path.join(h.profile, 'cindy-make', 'worktrees', 'other');
+ if (change === 'busy') h.busy = true;
+ if (change === 'clear') h.session.clearedAt = 50;
+ return { commit: 'a'.repeat(40) };
+ });
+ await expect(prepare()).rejects.toMatchObject({ code: 'unavailable' });
+ expect(h.create).not.toHaveBeenCalled();
+ expect(h.capture).not.toHaveBeenCalled();
+ },
+ );
+ it.each(['busy', 'preparing'])('does not capture while the task is %s', async (state) => {
+ h[state as 'busy' | 'preparing'] = true;
+ await expect(prepare()).rejects.toMatchObject({ code: 'unavailable' });
+ expect(h.collect).not.toHaveBeenCalled();
+ });
+ it('leaves editing untouched when files cannot be checked', async () => {
+ h.collect.mockRejectedValueOnce(new Error('Git failed'));
+ await expect(prepare()).rejects.toThrow('Git failed');
+ expect(h.create).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts
index 27d9aa3975..2f2fc7fa42 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts
@@ -14,6 +14,7 @@ const h = vi.hoisted(() => ({
launch: vi.fn(),
probe: vi.fn(),
verify: vi.fn(),
+ prepare: vi.fn(),
build: vi.fn(),
saveBuild: vi.fn(),
artifactPath: vi.fn(),
@@ -24,6 +25,9 @@ const h = vi.hoisted(() => ({
publishedCommit: vi.fn(() => true),
pendingRollback: false,
historyIntegrate: vi.fn(),
+ syncBuild: vi.fn(),
+ syncBeforeBuild: false,
+ historyChanged: vi.fn(),
history: vi.fn(async () => ({ items: [{ runId: 'run', integration: 'integrated' }] })),
}));
vi.mock('../historyOwner.js', () => ({
@@ -40,6 +44,13 @@ vi.mock('../historyRuntime.js', () => ({
integrateCompletionForBuild: h.historyIntegrate,
recoverHistoryBuildRollback: h.recoverBuild,
}));
+vi.mock('../testRecovery.js', () => ({ prepareCindyMakeTest: h.prepare }));
+vi.mock('../settingsStore.js', () => ({
+ readCindyMakeSettings: () => ({ syncLatestBeforeBuild: h.syncBeforeBuild }),
+}));
+vi.mock('../upstreamMergeRuntime.js', () => ({
+ syncSourceBeforeCindyMakeBuild: h.syncBuild,
+}));
vi.mock('../buildRollback.js', () => ({
historyBuildRollback: (...args: [unknown, unknown, (commit: string) => boolean]) => {
h.rollbackGuard = args[2];
@@ -159,6 +170,10 @@ beforeEach(() => {
h.build.mockReset().mockResolvedValue(installer);
h.recoverBuild.mockReset().mockResolvedValue(undefined);
h.historyIntegrate.mockReset().mockResolvedValue(undefined);
+ h.syncBuild.mockReset().mockImplementation(async (_signal, publish) => {
+ await publish({ status: 'syncing', syncLatestSource: true });
+ });
+ h.syncBeforeBuild = false;
h.artifactPath.mockReset().mockResolvedValue(path.join(os.tmpdir(), 'installer.exe'));
h.current = true;
h.pendingRollback = false;
@@ -184,11 +199,58 @@ beforeEach(() => {
cindyMakeCompletion: { reportedAt: 123, changedFiles: 2, commit: 'a'.repeat(40) },
}),
};
- configureCindyMakeTestRuntime(() => false);
+ configureCindyMakeTestRuntime(() => false, h.historyChanged);
});
afterEach(() => cindyMakeTestController.stopAll());
describe('Cindy Make test IPC ownership and persistence', () => {
+ it.each(['start', 'build'] as const)(
+ 'prepares a fresh result and directly runs the requested %s action',
+ async (action) => {
+ h.prepare.mockImplementationOnce(async () => {
+ h.card.clientId = 'fresh-completion';
+ return { completionId: 'fresh-completion', isCurrent: () => h.current };
+ });
+ if (action === 'start')
+ h.launch.mockResolvedValueOnce({
+ stop: vi.fn(),
+ ready: Promise.resolve(),
+ closed: Promise.resolve(),
+ });
+ const next = await actCindyMakeTest('session', 'reply', 'resume-' + action);
+ expect(h.prepare).toHaveBeenCalledWith('session', 'reply', expect.any(Function));
+ expect(next.lastAction).toBe(action === 'start' ? 'test' : 'build');
+ if (action === 'start') await vi.waitFor(() => expect(h.verify).toHaveBeenCalledOnce());
+ else await vi.waitFor(() => expect(h.historyIntegrate).toHaveBeenCalledOnce());
+ await vi.waitFor(() => expect(cindyMakeTestController.hasActiveJobs()).toBe(false));
+ expect(h.historyChanged).toHaveBeenCalledTimes(action === 'build' ? 1 : 0);
+ },
+ );
+ it('runs the enabled latest-source step before integrating and packaging a completion', async () => {
+ h.syncBeforeBuild = true;
+
+ await actCindyMakeTest('session', 'completion', 'build');
+ await vi.waitFor(() => expect(cindyMakeTestController.hasActiveJobs()).toBe(false));
+
+ expect(h.syncBuild).toHaveBeenCalledOnce();
+ expect(h.syncBuild.mock.invocationCallOrder[0]).toBeLessThan(
+ h.historyIntegrate.mock.invocationCallOrder[0],
+ );
+ expect(h.historyIntegrate.mock.invocationCallOrder[0]).toBeLessThan(
+ h.build.mock.invocationCallOrder[0],
+ );
+ const personal = JSON.parse(String(h.card.agentMeta)).cindyMakeCompletion.personal;
+ expect(personal.syncLatestSource).toBe(true);
+ expect(personal.logs.map((entry: { step: string }) => entry.step)).toContain('syncing');
+ });
+ it('rejects recovery generation before capturing files while a source conflict is pending', async () => {
+ h.history.mockResolvedValueOnce({ busy: true, items: [] } as never);
+ await expect(actCindyMakeTest('session', 'reply', 'resume-build')).rejects.toThrow(
+ 'unavailable',
+ );
+ expect(h.prepare).not.toHaveBeenCalled();
+ expect(h.build).not.toHaveBeenCalled();
+ });
it('keeps the card building through conflict resolution and cleanup, then packages once', async () => {
let resolved!: () => void;
let cleaned!: () => void;
@@ -247,6 +309,18 @@ describe('Cindy Make test IPC ownership and persistence', () => {
error: 'cancelled',
});
});
+ it('rejects a completion build when history retains a source conflict without active work', async () => {
+ h.history.mockResolvedValueOnce({
+ items: [],
+ busy: true,
+ activeWork: false,
+ canBuild: false,
+ } as Awaited<ReturnType<typeof h.history>>);
+ await expect(actCindyMakeTest('session', 'completion', 'build')).rejects.toThrow('unavailable');
+ expect(h.historyIntegrate).not.toHaveBeenCalled();
+ expect(h.build).not.toHaveBeenCalled();
+ expect(h.saveBuild).not.toHaveBeenCalled();
+ });
it('reports a stop failure without inspecting or modifying personal source', async () => {
const stop = vi
.spyOn(cindyMakeTestController, 'stopTestForBuild')
diff --git a/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.git-integration.test.ts b/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.git-integration.test.ts
index d51a4de17b..6b4179dbce 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.git-integration.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.git-integration.test.ts
@@ -88,6 +88,44 @@ async function fixture(conflict: boolean) {
}
}
+it.each(['ahead', 'diverged'] as const)(
+ 'keeps local main and personal files when main is %s of the sync target',
+ async (relation) => {
+ const h = await fixture(false);
+ try {
+ // Ahead reproduces a Dev main accidentally compared with an older release.
+ if (relation === 'ahead') {
+ await h.git(['fetch', h.remote, h.state.upstreamCommit], h.source);
+ await h.git(['branch', '--force', 'main', h.state.upstreamCommit], h.source);
+ } else {
+ await h.commit(h.source, 'local main changes');
+ await h.git(['branch', '--force', 'main', 'HEAD'], h.source);
+ await writeFile(path.join(h.source, 'feature.txt'), 'keep uncommitted edits\n');
+ }
+ const beforeMain = await h.git(['rev-parse', 'main'], h.source);
+ const beforePersonal = await h.git(['rev-parse', 'cindy-personal'], h.source);
+ const beforeFiles = await readFile(path.join(h.source, 'feature.txt'), 'utf8');
+ await expect(
+ prepareUpstreamMerge(
+ h.userData,
+ {
+ ...h.state,
+ upstreamCommit: relation === 'ahead' ? h.baselineCommit : h.state.upstreamCommit,
+ },
+ h.git,
+ async () => {},
+ ),
+ ).rejects.toMatchObject({ code: relation === 'ahead' ? 'localMainAhead' : 'localMain' });
+ expect(await h.git(['rev-parse', 'main'], h.source)).toBe(beforeMain);
+ expect(await h.git(['rev-parse', 'cindy-personal'], h.source)).toBe(beforePersonal);
+ expect(await readFile(path.join(h.source, 'feature.txt'), 'utf8')).toBe(beforeFiles);
+ expect(await h.git(['branch', '--list', mergeBranch(h.state.id)], h.source)).toBe('');
+ } finally {
+ await h.clean();
+ }
+ },
+);
+
it.each([false, true])(
'discards only the confirmed feature candidate and keeps original changes (partial Windows residue=%s)',
async (residue) => {
@@ -147,6 +185,56 @@ it.each([false, true])(
30_000,
);
+it.each([true, false])(
+ 'cancels only the task-owned source candidate and preserves source and task files (conflict=%s)',
+ async (conflict) => {
+ const h = await fixture(conflict);
+ try {
+ const task = path.join(h.userData, 'original-task');
+ await h.git(['worktree', 'add', '-b', 'original-task', task, h.baselineCommit], h.source);
+ await writeFile(path.join(task, 'task-edit.txt'), 'keep task edits');
+ const state = await prepareUpstreamMerge(
+ h.userData,
+ { ...h.state, taskOwned: true },
+ h.git,
+ async () => {},
+ );
+ expect(state).toMatchObject({ taskOwned: true, status: conflict ? 'conflict' : 'merged' });
+ const worktree = mergeWorktree(h.userData, state.id);
+ if (conflict) expect(await h.git(['branch', '--show-current'], worktree)).toBe('');
+ await writeFile(path.join(worktree, 'resolver-edit.txt'), 'disposable resolver edits');
+ await writeFile(path.join(h.source, 'personal-edit.txt'), 'keep new personal edits');
+ const head = await h.git(['rev-parse', 'HEAD'], h.source);
+ expect(await discardFeatureMerge(h.userData, state, h.git, () => true)).toBe(false);
+ const stopped = { ...state, sessionId: 'resolver', cancellationRequested: true };
+ expect(await discardFeatureMerge(h.userData, stopped, h.git, () => false)).toBe(false);
+ expect(await readFile(path.join(worktree, 'resolver-edit.txt'), 'utf8')).toBe(
+ 'disposable resolver edits',
+ );
+ expect(await discardFeatureMerge(h.userData, stopped, h.git, () => true)).toBe(true);
+ expect(await discardFeatureMerge(h.userData, stopped, h.git, () => true)).toBe(true);
+ await expect(stat(worktree)).rejects.toMatchObject({ code: 'ENOENT' });
+ expect(await h.git(['branch', '--list', mergeBranch(state.id)], h.source)).toBe('');
+ expect(await h.git(['rev-parse', 'HEAD'], h.source)).toBe(head);
+ expect(await h.git(['rev-parse', 'HEAD'], task)).toBe(h.baselineCommit);
+ expect(await readFile(path.join(task, 'task-edit.txt'), 'utf8')).toBe('keep task edits');
+ expect(await readFile(path.join(h.source, 'personal-edit.txt'), 'utf8')).toBe(
+ 'keep new personal edits',
+ );
+ expect(await readFile(path.join(h.source, 'feature.txt'), 'utf8')).toBe('local feature\n');
+ if (!conflict) {
+ expect(await h.git(['rev-parse', PERSONAL_UPSTREAM_REF], h.source)).toBe(
+ h.state.upstreamCommit,
+ );
+ expect(await readFile(path.join(h.source, 'upstream.txt'), 'utf8')).toBe('upstream fix\n');
+ }
+ } finally {
+ await h.clean();
+ }
+ },
+ 30_000,
+);
+
it('does not force through a lock on a stopped feature candidate', async () => {
const h = await fixture(true);
try {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.test.ts b/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.test.ts
index d7a585ec6c..8fa548c998 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.test.ts
@@ -65,6 +65,28 @@ beforeEach(() => {
});
});
describe('upstream merge protection', () => {
+ it('stops automatic source preparation after an account switch before changing refs', async () => {
+ let current = true;
+ const original = git.getMockImplementation()!;
+ git.mockImplementation(async (args, cwd) => {
+ if (args[0] === 'fetch') current = false;
+ return original(args, cwd);
+ });
+ await expect(
+ prepareUpstreamMerge(
+ userData,
+ { ...state, taskOwned: true },
+ git,
+ async () => {},
+ () => current,
+ ),
+ ).rejects.toMatchObject({ code: 'busy' });
+ expect(
+ git.mock.calls.some(([args]) =>
+ ['update-ref', 'worktree', 'rebase', 'reset'].includes(args[0]),
+ ),
+ ).toBe(false);
+ });
it('rejects cancellation of an assigned task or invalid operation before touching Git', async () => {
for (const candidate of [
{ ...state, status: 'conflict' as const, sessionId: 'existing-task' },
@@ -133,7 +155,8 @@ describe('upstream merge protection', () => {
const original = git.getMockImplementation()!;
git.mockImplementation(async (args, cwd) => {
if (args.join(' ') === 'rev-parse --verify refs/heads/main^{commit}') return 'd'.repeat(40);
- if (args[0] === 'merge-base') throw new Error('not ancestor');
+ if (args[0] === 'merge-base')
+ throw Object.assign(new Error('not ancestor'), { exitCode: 1 });
return original(args, cwd);
});
await expect(prepareUpstreamMerge(userData, state, git, async () => {})).rejects.toMatchObject({
@@ -141,6 +164,38 @@ describe('upstream merge protection', () => {
});
expect(git.mock.calls.some(([args]) => args.includes('--force'))).toBe(false);
});
+ it('reports a newer main separately from a divergent main', async () => {
+ const original = git.getMockImplementation()!;
+ let ancestryChecks = 0;
+ git.mockImplementation(async (args, cwd) => {
+ if (args.join(' ') === 'rev-parse --verify refs/heads/main^{commit}') return 'd'.repeat(40);
+ if (args[0] === 'merge-base' && args[1] === '--is-ancestor') {
+ ancestryChecks += 1;
+ if (ancestryChecks === 2) return '';
+ throw Object.assign(new Error('not ancestor'), { exitCode: 1 });
+ }
+ return original(args, cwd);
+ });
+ await expect(prepareUpstreamMerge(userData, state, git, async () => {})).rejects.toMatchObject({
+ code: 'localMainAhead',
+ });
+ expect(git.mock.calls.some(([args]) => ['update-ref', 'branch', 'worktree'].includes(args[0]) && args[1] !== '--show-current')).toBe(false);
+ });
+ it.each([1, 2])('does not report divergence when ancestry check %s fails to run', async (check) => {
+ const original = git.getMockImplementation()!;
+ const failure = Object.assign(new Error('Git object unavailable'), { exitCode: 128 });
+ let ancestryChecks = 0;
+ git.mockImplementation(async (args, cwd) => {
+ if (args.join(' ') === 'rev-parse --verify refs/heads/main^{commit}') return 'd'.repeat(40);
+ if (args[0] === 'merge-base' && args[1] === '--is-ancestor') {
+ if (++ancestryChecks === check) throw failure;
+ throw Object.assign(new Error('not ancestor'), { exitCode: 1 });
+ }
+ return original(args, cwd);
+ });
+ await expect(prepareUpstreamMerge(userData, state, git, async () => {})).rejects.toBe(failure);
+ expect(git.mock.calls.some(([args]) => args.includes('--force'))).toBe(false);
+ });
it('does not call a generic merge failure a conflict', async () => {
const original = git.getMockImplementation()!;
git.mockImplementation(async (args, cwd) => {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeController.test.ts b/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeController.test.ts
index 378d1fd90c..321e785bef 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeController.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeController.test.ts
@@ -83,6 +83,78 @@ function harness(initial?: SavedUpstreamMerge, actualWorkspace = !!initial?.stat
};
}
describe('upstream merge lifecycle', () => {
+ it('automatically resolves a task-owned source conflict and waits for adoption and cleanup', async () => {
+ const h = harness();
+ h.deps.prepare = vi.fn(async (state) => {
+ h.setWorkspace(true);
+ return { ...state, status: 'conflict', hasWorkspace: true };
+ });
+ const abort = new AbortController();
+ const options = { agentKind: 'codex' as const, model: 'selected-model' };
+ const state = await h.controller.update(options, abort.signal);
+ expect(state).toMatchObject({
+ status: 'resolving',
+ taskOwned: true,
+ sessionId: 'merge-session',
+ });
+ expect(h.deps.session).toHaveBeenCalledWith(
+ expect.objectContaining({ taskOwned: true }),
+ options,
+ expect.any(Function),
+ expect.any(Function),
+ );
+ let done = false;
+ const waiting = h.controller.waitForCompletion(state!.id, abort.signal).then((result) => {
+ done = true;
+ return result;
+ });
+ await Promise.resolve();
+ expect(done).toBe(false);
+ h.controller.prepareTurn('merge-session')();
+ await h.controller.finish('merge-session');
+ expect(await waiting).toMatchObject({ status: 'merged', hasWorkspace: false });
+ expect(h.deps.cleanup).toHaveBeenCalledOnce();
+ });
+ it('stops and cleans up a task-owned source resolver without cancelling manual updates', async () => {
+ const h = harness({
+ state: { ...candidate, taskOwned: true, sessionId: 'resolver' },
+ sessionOwner: 'alice',
+ });
+ const abort = new AbortController();
+ const waiting = h.controller
+ .waitForCompletion(candidate.id, abort.signal)
+ .catch((error) => error);
+ abort.abort(Object.assign(new Error('cancelled'), { code: 'cancelled' }));
+ expect(await waiting).toMatchObject({ code: 'cancelled' });
+ expect(h.deps.discard).toHaveBeenCalledOnce();
+ expect(h.saved()?.state).toMatchObject({ status: 'cancelled', hasWorkspace: false });
+ const manual = harness({ state: candidate, sessionOwner: 'alice' });
+ await expect(
+ manual.controller.update(undefined, new AbortController().signal),
+ ).rejects.toMatchObject({ code: 'busy' });
+ expect(manual.deps.discard).not.toHaveBeenCalled();
+ expect(manual.deps.latest).not.toHaveBeenCalled();
+ });
+ it('cancels during a source fetch without dispatching a resolver or adopting a candidate', async () => {
+ const h = harness();
+ let release!: () => void;
+ h.deps.latest = vi.fn(async () => {
+ await new Promise<void>((resolve) => {
+ release = resolve;
+ });
+ return { ref: 'main', commit: 'a'.repeat(40) };
+ });
+ const abort = new AbortController();
+ const updating = h.controller.update(undefined, abort.signal);
+ await vi.waitFor(() => expect(release).toBeTypeOf('function'));
+ abort.abort(Object.assign(new Error('cancelled'), { code: 'cancelled' }));
+ release();
+ await updating;
+ expect(h.deps.prepare).not.toHaveBeenCalled();
+ expect(h.deps.session).not.toHaveBeenCalled();
+ expect(h.deps.discard).toHaveBeenCalledOnce();
+ expect(h.saved()?.state).toMatchObject({ status: 'cancelled', hasWorkspace: false });
+ });
it('retains an unresolved feature step in the same task instead of dispatching another resolver', async () => {
const h = harness({
state: {
@@ -386,22 +458,31 @@ describe('upstream merge lifecycle', () => {
expect(h.deps.discard).toHaveBeenCalledOnce();
expect(h.saved()?.state.hasWorkspace).toBe(false);
});
- it('does not cancel an older candidate when a new build stops while waiting for the Git lock', async () => {
- const initial = { ...candidate, feature, status: 'merged' as const, hasWorkspace: false };
- const h = harness({ state: initial, sessionOwner: 'alice' });
- const abort = new AbortController();
- h.deps.prepareFeature = vi.fn();
- h.deps.exclusive = async (run) => {
- abort.abort(Object.assign(new Error('cancelled'), { code: 'cancelled' }));
- return run();
- };
- await expect(h.controller.feature(feature, undefined, abort.signal)).rejects.toMatchObject({
- code: 'cancelled',
- });
- expect(h.deps.prepareFeature).not.toHaveBeenCalled();
- expect(h.deps.discard).not.toHaveBeenCalled();
- expect(h.saved()?.state).toEqual(initial);
- });
+ it.each(['feature', 'source'] as const)(
+ 'does not cancel an older candidate when a %s build stops while waiting for the Git lock',
+ async (kind) => {
+ const initial = { ...candidate, feature, status: 'merged' as const, hasWorkspace: false };
+ const h = harness({ state: initial, sessionOwner: 'alice' });
+ const abort = new AbortController();
+ h.deps.prepareFeature = vi.fn();
+ h.deps.exclusive = async (run) => {
+ abort.abort(Object.assign(new Error('cancelled'), { code: 'cancelled' }));
+ return run();
+ };
+ const updating =
+ kind === 'feature'
+ ? h.controller.feature(feature, undefined, abort.signal)
+ : h.controller.update(undefined, abort.signal);
+ await expect(updating).rejects.toMatchObject({
+ code: 'cancelled',
+ });
+ expect(h.deps.prepareFeature).not.toHaveBeenCalled();
+ expect(h.deps.prepare).not.toHaveBeenCalled();
+ expect(h.deps.latest).not.toHaveBeenCalled();
+ expect(h.deps.discard).not.toHaveBeenCalled();
+ expect(h.saved()?.state).toEqual(initial);
+ },
+ );
it('finishes an in-flight adoption receipt before cancelling so the build can roll it back', async () => {
const h = harness({
state: { ...candidate, feature, sessionId: 'resolver', status: 'resolving' },
@@ -428,11 +509,16 @@ describe('upstream merge lifecycle', () => {
expect(h.deps.discard).toHaveBeenCalledOnce();
expect(h.saved()?.state.status).toBe('cancelled');
});
- it.each([false, true])(
- 'retains failed build cancellation for retry after restart (directory remains=%s)',
- async (workspace) => {
+ it.each([
+ { workspace: false, operation: { feature } },
+ { workspace: true, operation: { feature } },
+ { workspace: false, operation: { taskOwned: true } },
+ { workspace: true, operation: { taskOwned: true } },
+ ])(
+ 'retains failed build cancellation for retry after restart (%j)',
+ async ({ workspace, operation }) => {
const h = harness({
- state: { ...candidate, feature, sessionId: 'resolver' },
+ state: { ...candidate, ...operation, sessionId: 'resolver' },
sessionOwner: 'alice',
});
h.deps.discard = vi.fn(async () => {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeRuntime.test.ts
index 2dc9adc2c2..079ca5bf24 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeRuntime.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/upstreamMergeRuntime.test.ts
@@ -4,6 +4,7 @@ import { beforeEach, expect, it, vi } from 'vitest';
import type { CindyMakeMergeState } from '../../../shared/cindyMakeMerge';
import type { CindyMakeHistoryRecord, MakeFeatureReceipt } from '../../../shared/cindyMakeHistory';
import type { MakeBuildRollbackEntry } from '../historyStore';
+import type { MakeSourceStatus } from '../../../shared/cindyMakeDoctor';
const h = vi.hoisted(() => ({
saved: null as string | null,
workspace: false,
@@ -26,10 +27,21 @@ const h = vi.hoisted(() => ({
tree: 'd'.repeat(40),
dirty: false,
projected: undefined as CindyMakeMergeState | undefined,
+ source: {
+ status: 'ready',
+ path: 'managed-source',
+ channel: 'dev',
+ ref: 'main',
+ } as MakeSourceStatus,
+ fetch: vi.fn(),
}));
vi.mock('electron', () => ({
- app: { getPath: () => path.join(os.tmpdir(), 'make-cancel-unit-no-io') },
- net: {},
+ app: {
+ getPath: () => path.join(os.tmpdir(), 'make-cancel-unit-no-io'),
+ isPackaged: true,
+ getVersion: () => '1.2.3',
+ },
+ net: { fetch: h.fetch },
}));
vi.mock('node:fs', async (importOriginal) => ({
...(await importOriginal<typeof import('node:fs')>()),
@@ -82,8 +94,7 @@ vi.mock('../toolchainEnvironment.js', () => ({
createMakeToolchainEnvironment: async () => ({}),
resolveMakeToolEnvironment: async () => ({}),
}));
-vi.mock('../sourcePreparation.js', () => ({ readCurrentCindySourceStatus: async () => ({}) }));
-vi.mock('../latestSourceVersion.js', () => ({ createLatestSourceVersionReader: vi.fn() }));
+vi.mock('../sourcePreparation.js', () => ({ readCurrentCindySourceStatus: async () => h.source }));
vi.mock('../sourceGit.js', () => ({
runSourceGit: async (_env: unknown, args: string[]) => h.git(args),
}));
@@ -145,6 +156,11 @@ vi.mock('../upstreamMerge.js', async (importOriginal) => {
return {
...actual,
verifyMergeWorktree: async () => {},
+ prepareUpstreamMerge: async (_root: string, state: CindyMakeMergeState) => ({
+ ...state,
+ status: 'merged',
+ hasWorkspace: false,
+ }),
prepareFeatureMerge: async (_root: string, state: CindyMakeMergeState) => {
h.workspace = true;
return {
@@ -178,6 +194,8 @@ import {
integrateMakeHistory,
waitForMakeHistoryMerge,
actUpstreamMerge,
+ syncSourceBeforeCindyMakeBuild,
+ syncSourceBeforeCindyMakeTask,
prepareUpstreamMergeTurn,
interruptUpstreamMergeTurn,
} from '../upstreamMergeRuntime';
@@ -190,6 +208,8 @@ beforeEach(() => {
h.current = 'owner';
h.phase = [];
h.projected = undefined;
+ h.source = { status: 'ready', path: 'managed-source', channel: 'dev', ref: 'main' };
+ h.fetch.mockReset();
h.head = 'c'.repeat(40);
h.tree = 'd'.repeat(40);
h.dirty = false;
@@ -254,6 +274,67 @@ beforeEach(() => {
});
configureUpstreamMerge(() => h.running);
});
+it.each(['dev', 'beta', 'release'] as const)(
+ 'syncs a packaged personal version using its recorded %s source channel',
+ async (channel) => {
+ const ref = channel === 'dev' ? 'main' : channel === 'beta' ? 'v2.0.0-beta.1' : 'v2.0.0';
+ h.source = { ...h.source, channel, ref };
+ if (channel !== 'dev') {
+ const release = { draft: false, prerelease: channel === 'beta', tag_name: ref };
+ h.fetch.mockResolvedValueOnce(
+ new Response(JSON.stringify(channel === 'beta' ? [release] : release)),
+ );
+ }
+ h.fetch.mockResolvedValueOnce(new Response(JSON.stringify({ sha: 'f'.repeat(40) })));
+ expect(await actUpstreamMerge({ action: 'update' })).toMatchObject({
+ status: 'merged',
+ ref,
+ upstreamCommit: 'f'.repeat(40),
+ });
+ const api = 'https://api.github.com/repos/makecindy/cindy';
+ expect(h.fetch.mock.calls.map(([url]) => url)).toEqual([
+ ...(channel === 'dev'
+ ? []
+ : [channel === 'beta' ? `${api}/releases?per_page=100&page=1` : `${api}/releases/latest`]),
+ `${api}/commits/${ref}`,
+ ]);
+ },
+);
+it('uses the same fresh official sync before a task worktree is created', async () => {
+ h.fetch.mockResolvedValueOnce(new Response(JSON.stringify({ sha: 'f'.repeat(40) })));
+ await syncSourceBeforeCindyMakeTask(new AbortController().signal);
+ expect(h.fetch).toHaveBeenCalledOnce();
+ expect(h.projected).toMatchObject({
+ status: 'merged',
+ taskOwned: true,
+ upstreamCommit: 'f'.repeat(40),
+ });
+});
+it('stops task preparation when latest source cannot be fetched', async () => {
+ h.fetch.mockRejectedValue(new Error('offline'));
+ await expect(syncSourceBeforeCindyMakeTask(new AbortController().signal)).rejects.toMatchObject({
+ code: 'unavailable',
+ });
+});
+it('publishes source sync as a distinct personal build step', async () => {
+ h.fetch.mockResolvedValueOnce(new Response(JSON.stringify({ sha: 'f'.repeat(40) })));
+ const publish = vi.fn(async () => {});
+ await syncSourceBeforeCindyMakeBuild(new AbortController().signal, publish);
+ expect(publish).toHaveBeenCalledWith({ status: 'syncing', syncLatestSource: true });
+ expect(h.projected).toMatchObject({
+ status: 'merged',
+ taskOwned: true,
+ upstreamCommit: 'f'.repeat(40),
+ });
+});
+it('reports optional build source sync failures separately from packaging failures', async () => {
+ h.fetch.mockRejectedValue(new Error('offline'));
+ const publish = vi.fn(async () => {});
+ await expect(
+ syncSourceBeforeCindyMakeBuild(new AbortController().signal, publish),
+ ).rejects.toMatchObject({ code: 'sourceSyncFailed' });
+ expect(publish).toHaveBeenCalledWith({ status: 'syncing', syncLatestSource: true });
+});
async function conflict() {
return (await integrateMakeHistory({
runId: 'run',
diff --git a/apps/desktop/src/main/cindy-make/__tests__/versionService.test.ts b/apps/desktop/src/main/cindy-make/__tests__/versionService.test.ts
index 702b07bf13..fd19792132 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/versionService.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/versionService.test.ts
@@ -34,6 +34,31 @@ import { actCindyVersion, configureCindyVersions, getCindyVersions } from '../ve
import { versionsRoot, versionDirectory, writeVersionJson } from '../versionStore';
import { CindyMakeManager } from '../manager';
const id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
+const latestId = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb';
+const setPersonal = (target = id) =>
+ writeVersionJson(path.join(versionsRoot(h.profile), 'personal.json'), { id: target });
+async function seedPersonal(target: string, commit: string) {
+ const directory = versionDirectory(h.profile, target);
+ const runtime = path.join(directory, 'runtime');
+ await mkdir(path.join(runtime, 'resources'), { recursive: true });
+ await writeFile(path.join(runtime, 'Cindy.exe'), 'application');
+ writeVersionJson(path.join(directory, 'version.json'), {
+ protocol: 1,
+ id: target,
+ profile: h.original.profile,
+ title: 'Old task title',
+ version: `Cindy Make ${target.slice(0, 8)}`,
+ commit,
+ builtAt: '2026-09-22T12:00:00+08:00',
+ platform: process.platform,
+ arch: process.arch,
+ executable: path.join('runtime', 'Cindy.exe'),
+ resources: path.join('runtime', 'resources'),
+ executableHash: 'a'.repeat(64),
+ applicationHash: 'a'.repeat(64),
+ migrationHash: 'a'.repeat(64),
+ });
+}
beforeEach(async () => {
vi.clearAllMocks();
h.profile = await mkdtemp(path.join(os.tmpdir(), 'cindy-version-service-'));
@@ -63,6 +88,7 @@ afterEach(async () => {
});
describe('version management main boundary', () => {
it('allows switching and returning to original after preparation settles in the real manager', async () => {
+ setPersonal();
const manager = new CindyMakeManager();
configureCindyVersions(() => manager.hasActiveWork());
let release!: () => void;
@@ -97,6 +123,24 @@ describe('version management main boundary', () => {
await actCindyVersion('switch', 'original');
expect(h.handoff).toHaveBeenLastCalledWith('original', expect.any(Function));
});
+ it('switches away from a personal version without consuming its retained source conflict', async () => {
+ const manager = new CindyMakeManager();
+ const conflict = {
+ id: 'source-update',
+ status: 'conflict' as const,
+ ref: 'main',
+ upstreamCommit: 'a'.repeat(40),
+ hasWorkspace: true,
+ };
+ manager.setUpstreamMerge(conflict);
+ configureCindyVersions(() => manager.hasActiveWork());
+ h.currentId = id;
+ await actCindyVersion('switch', 'original');
+ expect(h.handoff).toHaveBeenCalledWith('original', expect.any(Function));
+ expect(manager.getState().upstreamMerge).toEqual(conflict);
+ h.busy = true;
+ await expect(actCindyVersion('switch', 'original')).rejects.toThrow('busy');
+ });
it('projects Dev as the original without creating a registry on a read', async () => {
expect(await getCindyVersions()).toMatchObject({
currentId: 'original',
@@ -137,6 +181,7 @@ describe('version management main boundary', () => {
expect(h.handoff).not.toHaveBeenCalled();
});
it('blocks switching during build or other running work and never quits on a failed handoff', async () => {
+ setPersonal();
configureCindyVersions(() => true);
await expect(actCindyVersion('switch', id)).rejects.toThrow('busy');
configureCindyVersions(() => false);
@@ -150,6 +195,7 @@ describe('version management main boundary', () => {
expect(h.quit).not.toHaveBeenCalled();
});
it('uses normal quit only after the host-owned handoff accepts the current owner', async () => {
+ setPersonal();
h.handoff.mockImplementationOnce(async (_id, current: () => Promise<boolean>) => {
expect(await current()).toBe(true);
});
@@ -164,9 +210,9 @@ describe('version management main boundary', () => {
expect(h.quit).not.toHaveBeenCalled();
});
it('deletes only an inactive selected snapshot, retaining source and user data', async () => {
+ setPersonal();
const directory = versionDirectory(h.profile, id);
- await mkdir(directory, { recursive: true });
- await writeFile(path.join(directory, 'application'), 'snapshot');
+ await seedPersonal(id, 'a'.repeat(40));
await writeFile(path.join(h.profile, 'keep.db'), 'keep data');
h.currentId = id;
await expect(actCindyVersion('remove', id)).rejects.toThrow('busy');
@@ -175,7 +221,41 @@ describe('version management main boundary', () => {
await expect(actCindyVersion('remove', id)).rejects.toThrow('busy');
writeVersionJson(path.join(versionsRoot(h.profile), 'selected.json'), { id: 'original' });
await actCindyVersion('remove', id);
- await expect(access(directory)).rejects.toThrow();
+ await expect(access(path.join(directory, 'runtime'))).rejects.toThrow();
+ await expect(access(path.join(directory, 'version.json'))).resolves.toBeUndefined();
await expect(access(path.join(h.profile, 'keep.db'))).resolves.toBeUndefined();
+ expect((await getCindyVersions()).versions.map((version) => version.id)).toEqual(['original']);
+ });
+ it('exposes just original and personal, with current metadata while a newer generation awaits restart', async () => {
+ await seedPersonal(id, 'a'.repeat(40));
+ await seedPersonal(latestId, 'b'.repeat(40));
+ setPersonal(latestId);
+ writeVersionJson(path.join(versionsRoot(h.profile), 'original.json'), h.original);
+ h.currentId = id;
+ const state = await getCindyVersions();
+ expect(state.versions.map((version) => version.id)).toEqual(['original', 'personal']);
+ expect(state.currentId).toBe('personal');
+ expect(state.currentVersion?.commit).toBe('a'.repeat(40));
+ expect(state.versions[1].commit).toBe('b'.repeat(40));
+ expect(state.versions[1].title).toBeUndefined();
+ expect(state.versions[1].version).toBeUndefined();
+ expect(state.personalUpdateAvailable).toBe(true);
+ h.currentId = latestId;
+ expect((await getCindyVersions()).personalUpdateAvailable).toBe(false);
+ });
+ it.each(['personal', id])(
+ 'switches %s to the current personal slot, including old completion UUIDs',
+ async (target) => {
+ setPersonal(latestId);
+ await actCindyVersion('switch', target);
+ expect(h.handoff).toHaveBeenCalledWith(latestId, expect.any(Function));
+ },
+ );
+ it('rejects stale deletion and a switch after the personal version has been removed', async () => {
+ setPersonal(latestId);
+ await expect(actCindyVersion('remove', id)).rejects.toThrow('unavailable');
+ writeVersionJson(path.join(versionsRoot(h.profile), 'personal.json'), { id: null });
+ await expect(actCindyVersion('switch', id)).rejects.toThrow('unavailable');
+ expect(h.handoff).not.toHaveBeenCalled();
});
});
diff --git a/apps/desktop/src/main/cindy-make/__tests__/versionStore.test.ts b/apps/desktop/src/main/cindy-make/__tests__/versionStore.test.ts
index 96203f8726..a7ec307246 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/versionStore.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/versionStore.test.ts
@@ -5,6 +5,7 @@ import os from 'node:os';
import { afterEach, describe, expect, it, vi } from 'vitest';
import {
listPersonalVersions,
+ personalVersionId,
hasPublishedPersonalVersionCommit,
migrationIdentity,
publishPersonalVersion,
@@ -23,6 +24,7 @@ import {
type OriginalVersion,
type VersionProfile,
} from '../versionStore';
+import { cleanupPersonalVersions } from '../personalVersionCleanup';
vi.mock('../../logger', () => ({
createLogger: () => ({ debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() }),
}));
@@ -113,9 +115,15 @@ describe('local Cindy version snapshots', () => {
const a = await verifyPersonalVersion(h.userData, first, h.original);
expect(a.builtAt).toBe(h.builtAt);
expect(a.version).toBe(`Cindy Make ${first.slice(0, 8)}`);
- expect(
- listPersonalVersions(h.userData, h.original).find((item) => item.id === first)?.version,
- ).toBe(`Cindy Make ${first.slice(0, 8)}`);
+ expect(listPersonalVersions(h.userData, h.original)).toEqual([
+ expect.objectContaining({
+ id: first,
+ commit: h.commit,
+ builtAt: h.builtAt,
+ }),
+ ]);
+ expect(listPersonalVersions(h.userData, h.original)[0].title).toBeUndefined();
+ expect(listPersonalVersions(h.userData, h.original)[0].version).toBeUndefined();
await writeFile(path.join(h.resources, 'app.asar'), 'application B');
const second = (await h.retain())!;
expect(second).not.toBe(first);
@@ -126,13 +134,115 @@ describe('local Cindy version snapshots', () => {
'utf8',
),
).toBe('application A');
- expect(listPersonalVersions(h.userData, h.original)).toHaveLength(2);
+ expect(listPersonalVersions(h.userData, h.original).map((item) => item.id)).toEqual([second]);
expect(selectedVersion(h.userData)).toBe('original');
// Clearing Make source cannot erase the runnable versions.
await mkdir(path.join(h.userData, 'cindy-make', 'source'), { recursive: true });
await rm(path.join(h.userData, 'cindy-make'), { recursive: true });
expect(await verifyPersonalVersion(h.userData, first, h.original)).toMatchObject({ id: first });
});
+ it('keeps only the latest personal slot while staging and preserves running files and publication facts', async () => {
+ const h = await fixture();
+ const first = (await h.retain())!;
+ publishPersonalVersion(h.userData, first);
+ await selectVersion(h.userData, first);
+ writeVersionJson(path.join(versionsRoot(h.userData), 'active.json'), {
+ id: first,
+ pid: process.pid,
+ });
+ const secondCommit = 'b'.repeat(40);
+ await writeFile(
+ path.join(h.resources, 'cindy-source.json'),
+ JSON.stringify({
+ sourceCommit: secondCommit,
+ builtAt: h.builtAt,
+ }),
+ );
+ const second = (await retainPersonalVersion({
+ profile: h.profile,
+ sourceDirectory: h.source,
+ appName: 'Cindy',
+ title: 'Another task',
+ commit: secondCommit,
+ }))!;
+ // Even with identical build timestamps, staging cannot replace the last good version.
+ expect(personalVersionId(h.userData)).toBe(first);
+ await cleanupPersonalVersions(h.userData);
+ expect(fs.existsSync(path.join(versionDirectory(h.userData, second), 'runtime'))).toBe(true);
+ publishPersonalVersion(h.userData, second);
+ await cleanupPersonalVersions(h.userData);
+ expect(personalVersionId(h.userData)).toBe(second);
+ expect(await verifyPersonalVersion(h.userData, first, h.original)).toMatchObject({ id: first });
+ await selectVersion(h.userData, second);
+ writeVersionJson(path.join(versionsRoot(h.userData), 'active.json'), {
+ id: second,
+ pid: process.pid,
+ });
+ await cleanupPersonalVersions(h.userData);
+ expect(fs.existsSync(path.join(versionDirectory(h.userData, first), 'runtime'))).toBe(false);
+ expect(hasPublishedPersonalVersionCommit(h.userData, h.commit)).toBe(true);
+ expect(hasPublishedPersonalVersionCommit(h.userData, secondCommit)).toBe(true);
+ expect(await verifyPersonalVersion(h.userData, second, h.original)).toMatchObject({
+ id: second,
+ });
+ expect(listPersonalVersions(h.userData, h.original)).toHaveLength(1);
+ });
+ it('adopts only the newest legacy application and never resurrects it after explicit deletion', async () => {
+ const h = await fixture();
+ const first = (await h.retain())!;
+ publishPersonalVersion(h.userData, first);
+ await writeFile(
+ path.join(h.resources, 'cindy-source.json'),
+ JSON.stringify({
+ sourceCommit: h.commit,
+ builtAt: '2026-09-18T01:00:00.000+08:00',
+ }),
+ );
+ const second = (await h.retain())!;
+ publishPersonalVersion(h.userData, second);
+ await rm(path.join(versionsRoot(h.userData), 'personal.json'));
+ expect(personalVersionId(h.userData)).toBe(second);
+ expect(listPersonalVersions(h.userData, h.original)).toHaveLength(1);
+ writeVersionJson(path.join(versionsRoot(h.userData), 'personal.json'), { id: null });
+ expect(personalVersionId(h.userData)).toBeUndefined();
+ expect(listPersonalVersions(h.userData, h.original)).toEqual([]);
+ });
+ it('retains the fallback bundle until the handoff helper has really exited', async () => {
+ const h = await fixture();
+ const first = (await h.retain())!;
+ publishPersonalVersion(h.userData, first);
+ const second = (await h.retain())!;
+ publishPersonalVersion(h.userData, second);
+ const launch = path.join(versionsRoot(h.userData), 'launches', 'a'.repeat(36) + '.json');
+ writeVersionJson(launch, {
+ state: 'ready',
+ helperPid: process.pid,
+ targetId: second,
+ fallbackId: first,
+ });
+ await cleanupPersonalVersions(h.userData);
+ expect(fs.existsSync(path.join(versionDirectory(h.userData, first), 'runtime'))).toBe(true);
+ await rm(launch);
+ await cleanupPersonalVersions(h.userData);
+ expect(fs.existsSync(path.join(versionDirectory(h.userData, first), 'runtime'))).toBe(false);
+ });
+ it('never follows a replaced runtime junction while retiring old application files', async () => {
+ const h = await fixture();
+ const first = (await h.retain())!;
+ publishPersonalVersion(h.userData, first);
+ const second = (await h.retain())!;
+ publishPersonalVersion(h.userData, second);
+ const runtime = path.join(versionDirectory(h.userData, first), 'runtime');
+ await rm(runtime, { recursive: true, force: true });
+ const outside = path.join(h.root, 'outside');
+ await mkdir(outside);
+ await writeFile(path.join(outside, 'keep'), 'unrelated data');
+ await symlink(outside, runtime, process.platform === 'win32' ? 'junction' : 'dir');
+ await cleanupPersonalVersions(h.userData);
+ expect(await readFile(path.join(outside, 'keep'), 'utf8')).toBe('unrelated data');
+ expect(fs.lstatSync(runtime).isSymbolicLink()).toBe(true);
+ expect(personalVersionId(h.userData)).toBe(second);
+ });
it('rejects modified applications and mismatched database migrations before launch', async () => {
const h = await fixture();
const id = (await h.retain())!;
diff --git a/apps/desktop/src/main/cindy-make/historyBroadcast.ts b/apps/desktop/src/main/cindy-make/historyBroadcast.ts
new file mode 100644
index 0000000000..77ccc72285
--- /dev/null
+++ b/apps/desktop/src/main/cindy-make/historyBroadcast.ts
@@ -0,0 +1,18 @@
+import { BrowserWindow } from 'electron';
+
+import { captureDataOwnerBroadcastScope } from '../device-link/broadcast-tap.js';
+
+export const CINDY_MAKE_HISTORY_CHANGED = 'cindy-make:history-changed';
+
+/** Invalidate local Settings history after a background build reaches a terminal state. */
+export function broadcastCindyMakeHistoryChanged(): void {
+ const ownerStamp = captureDataOwnerBroadcastScope().ownerStamp;
+ for (const window of BrowserWindow.getAllWindows()) {
+ if (window.isDestroyed()) continue;
+ try {
+ window.webContents.send(CINDY_MAKE_HISTORY_CHANGED, ownerStamp);
+ } catch {
+ // A closing renderer must not affect the completed build.
+ }
+ }
+}
diff --git a/apps/desktop/src/main/cindy-make/historyRuntime.ts b/apps/desktop/src/main/cindy-make/historyRuntime.ts
index e1976fe3db..90e8ce676e 100644
--- a/apps/desktop/src/main/cindy-make/historyRuntime.ts
+++ b/apps/desktop/src/main/cindy-make/historyRuntime.ts
@@ -23,6 +23,7 @@ import {
actUpstreamMerge,
waitForMakeHistoryMerge,
finishMakeHistoryCleanup,
+ syncSourceBeforeCindyMakeBuild,
} from './upstreamMergeRuntime.js';
import type { CindyMakeMergeState } from '../../shared/cindyMakeMerge.js';
import type { MakeTestContext } from './testController.js';
@@ -51,6 +52,7 @@ import {
} from './personalBuild.js';
import { currentVersionProfile, rememberOriginalVersion } from './versionStartup.js';
import { hasPublishedPersonalVersionCommit } from './versionStore.js';
+import { readCindyMakeSettings } from './settingsStore.js';
import { CURRENT_CINDY_REGION } from '../../shared/brandRegion.js';
import { isSyntheticTriggerText } from '../../shared/interruptedTurn.js';
import {
@@ -73,6 +75,7 @@ const ID = /^[A-Za-z0-9-]{1,128}$/;
const HASH = /^[a-f0-9]{40,64}$/i;
const log = createLogger('cindy-make');
let running: (id: string) => boolean = () => true;
+let notifyHistoryChanged: () => void = () => {};
/** Owns a source build, including its ordered history merges, independently of Settings. */
interface HistoryBuildJob {
id: string;
@@ -125,8 +128,12 @@ function latestUserPromptBefore(
return;
}
-export function configureMakeHistory(probe: typeof running): void {
+export function configureMakeHistory(
+ probe: typeof running,
+ notify: () => void = () => {},
+): void {
running = probe;
+ notifyHistoryChanged = notify;
}
export function stopMakeHistoryBuild(): void {
buildJob?.abort.abort();
@@ -377,7 +384,7 @@ async function readCindyMakeHistory(
row?.status === 'active' &&
completion &&
(['starting', 'ready'].includes(completion.test?.status ?? '') ||
- ['waiting', 'checking', 'merging', 'packaging', 'publishing'].includes(
+ ['waiting', 'syncing', 'checking', 'merging', 'packaging', 'publishing'].includes(
completion.personal?.status ?? '',
))
) {
@@ -635,6 +642,7 @@ async function readCindyMakeHistory(
return {
items,
busy: globalBusy || !!pendingMerge,
+ activeWork: globalBusy,
canBuild: buildSourceAvailable && !globalBusy && !pendingMerge,
build,
batch: buildJob?.current() ? buildJob.batch : undefined,
@@ -1011,6 +1019,7 @@ export async function generateHistoryPersonalVersion(
const abort = new AbortController();
const buildId = randomUUID();
const startedAt = Date.now();
+ const syncLatestSource = readCindyMakeSettings().syncLatestBeforeBuild;
const publish = async (build: CindyMakePersonalBuildState) => {
h.check();
// A late step notification must not erase a requested stop.
@@ -1028,7 +1037,7 @@ export async function generateHistoryPersonalVersion(
};
buildJob = job;
try {
- await publish({ status: 'waiting' });
+ await publish({ status: 'waiting', syncLatestSource });
} catch (error) {
if (buildJob === job) buildJob = undefined;
releaseBuild();
@@ -1051,6 +1060,10 @@ export async function generateHistoryPersonalVersion(
await publish({ status: 'waiting', preparationStep: 'original' });
await rememberOriginalVersion(node.path);
const buildEnvironment = await personalBuildEnvironment(env, git.path);
+ if (syncLatestSource) {
+ await syncSourceBeforeCindyMakeBuild(abort.signal, publish);
+ h.check();
+ }
if (selection) {
if (h.store.readBuildRollback().length) await recoverHistoryBuildRollback();
const candidates: CindyMakeHistoryItem[] = [];
@@ -1169,6 +1182,7 @@ export async function generateHistoryPersonalVersion(
.finally(() => {
if (buildJob === job) buildJob = undefined;
releaseBuild();
+ if (h.current()) notifyHistoryChanged();
});
return getCindyMakeHistory();
}
diff --git a/apps/desktop/src/main/cindy-make/historyStore.ts b/apps/desktop/src/main/cindy-make/historyStore.ts
index e84b61eecc..bfc038f91b 100644
--- a/apps/desktop/src/main/cindy-make/historyStore.ts
+++ b/apps/desktop/src/main/cindy-make/historyStore.ts
@@ -127,7 +127,16 @@ export class CindyMakeHistoryStore {
const value = JSON.parse(raw);
if (
!value ||
- !['waiting', 'checking', 'merging', 'packaging', 'publishing', 'ready', 'failed'].includes(
+ ![
+ 'waiting',
+ 'syncing',
+ 'checking',
+ 'merging',
+ 'packaging',
+ 'publishing',
+ 'ready',
+ 'failed',
+ ].includes(
value.status,
)
)
@@ -150,6 +159,9 @@ export class CindyMakeHistoryStore {
...(value.status === 'waiting' && ['environment', 'original'].includes(value.preparationStep)
? { preparationStep: value.preparationStep }
: {}),
+ ...(typeof value.syncLatestSource === 'boolean'
+ ? { syncLatestSource: value.syncLatestSource }
+ : {}),
...(value.stopping === true ? { stopping: true } : {}),
...(Number.isFinite(value.startedAt) && value.startedAt > 0
? { startedAt: value.startedAt }
diff --git a/apps/desktop/src/main/cindy-make/latestSourceVersion.ts b/apps/desktop/src/main/cindy-make/latestSourceVersion.ts
index 1353d36615..8d3e929adc 100644
--- a/apps/desktop/src/main/cindy-make/latestSourceVersion.ts
+++ b/apps/desktop/src/main/cindy-make/latestSourceVersion.ts
@@ -2,8 +2,20 @@ import type { MakeSourceLatestVersion, MakeSourceStatus } from '../../shared/cin
import { untilAborted } from './doctor.js';
const API = 'https://api.github.com/repos/makecindy/cindy';
-type Channel = MakeSourceLatestVersion['channel'];
+export type Channel = MakeSourceLatestVersion['channel'];
type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
+
+/**
+ * The managed checkout records the official line a personal version came
+ * from. A packaged Dev build still has app.isPackaged set, so the Electron
+ * packaging state cannot choose the source update channel reliably.
+ */
+export function sourceChannel(
+ source: Pick<MakeSourceStatus, 'channel' | 'ref'>,
+ fallback: Channel,
+): Channel {
+ return source.channel ?? (source.ref === 'main' ? 'dev' : fallback);
+}
const isCommit = (value: unknown): value is string =>
typeof value === 'string' && /^[0-9a-f]{40}$/i.test(value);
const record = (value: unknown): Record<string, unknown> =>
diff --git a/apps/desktop/src/main/cindy-make/personalBuild.ts b/apps/desktop/src/main/cindy-make/personalBuild.ts
index c7f6f982b8..512b928821 100644
--- a/apps/desktop/src/main/cindy-make/personalBuild.ts
+++ b/apps/desktop/src/main/cindy-make/personalBuild.ts
@@ -10,6 +10,7 @@ import {
publishPersonalVersion,
versionDirectory,
assertVersionDirectory,
+ withVersionStore,
type VersionProfile,
} from './versionStore.js';
import { defaultPtySpawn, type PtySpawnFn } from '../terminal/ptyFactory.js';
@@ -32,6 +33,7 @@ import {
import type { CindyMakePersonalBuildState } from '../../shared/cindyMakeSession.js';
import { commitLocalFiles, commitPersonalFiles, MAKE_GIT_IDENTITY } from './localHistory.js';
import { createPersonalBuildCleanup } from './personalBuildCleanup.js';
+import { cleanupPersonalVersions } from './personalVersionCleanup.js';
import { createMakeBuildOutput, makeBuildErrorDiagnostic } from './buildDiagnostic.js';
import { createMakeBuildLineOutput, runMakeBuildStep } from './buildProgress.js';
import type { CindyMakeBuildDiagnostic } from '../../shared/cindyMakeBuildDiagnostic.js';
@@ -521,8 +523,15 @@ export async function buildCindyPersonal(
await cleanup.clean();
await assertSource(candidateTree);
check();
- if (versionId) publishPersonalVersion(task.userData, versionId);
+ if (versionId) {
+ const id = versionId;
+ await withVersionStore(task.userData, async () => {
+ check();
+ publishPersonalVersion(task.userData, id);
+ });
+ }
published = true;
+ if (versionId) await cleanupPersonalVersions(task.userData);
return artifact;
} finally {
let cleanupFailed = false;
diff --git a/apps/desktop/src/main/cindy-make/personalVersionCleanup.ts b/apps/desktop/src/main/cindy-make/personalVersionCleanup.ts
new file mode 100644
index 0000000000..15b415fcc2
--- /dev/null
+++ b/apps/desktop/src/main/cindy-make/personalVersionCleanup.ts
@@ -0,0 +1,97 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import originalFs from 'original-fs';
+import { createLogger } from '../logger.js';
+import {
+ assertVersionDirectory,
+ personalVersionId,
+ readPersonalVersionRecord,
+ readVersionJson,
+ selectedVersion,
+ versionDirectory,
+ versionsRoot,
+ VERSION_ID,
+ withVersionStore,
+} from './versionStore.js';
+
+const log = createLogger('cindy-versions');
+const alive = (pid: number) => {
+ if (!Number.isSafeInteger(pid) || pid <= 0) return false;
+ try {
+ process.kill(pid, 0);
+ return true;
+ } catch (error) {
+ return (error as NodeJS.ErrnoException).code !== 'ESRCH';
+ }
+};
+const validId = (id: unknown) =>
+ typeof id === 'string' && (id === 'original' || VERSION_ID.test(id));
+
+/** Retire replaced binaries, retaining publication receipts and every live handoff dependency. */
+export async function cleanupPersonalVersions(profile: string): Promise<void> {
+ try {
+ await withVersionStore(profile, async () => {
+ const root = versionsRoot(profile);
+ const keep = new Set([personalVersionId(profile), selectedVersion(profile)]);
+ const active = readVersionJson<{ id: string; pid: number }>(path.join(root, 'active.json'));
+ if (active && (!validId(active.id) || !Number.isSafeInteger(active.pid) || active.pid <= 0))
+ return;
+ if (active && alive(active.pid)) keep.add(active.id);
+ const pending = readVersionJson<{ id: string; pid: number }>(path.join(root, 'pending.json'));
+ if (pending && alive(pending.pid)) {
+ if (!VERSION_ID.test(pending.id)) return;
+ const launch = readVersionJson<{ targetId: string; fallbackId: string }>(
+ path.join(root, 'launches', pending.id + '.json'),
+ );
+ // An incomplete live handoff is not evidence that any generation is disposable.
+ if (!launch || !validId(launch.targetId) || !validId(launch.fallbackId)) return;
+ keep.add(launch.targetId);
+ keep.add(launch.fallbackId);
+ }
+ // Ready clears pending.json before the helper actually exits. On Windows that
+ // helper still runs from the fallback bundle; it must remain intact too.
+ const launches = path.join(root, 'launches');
+ if (fs.existsSync(launches)) {
+ assertVersionDirectory(profile, launches);
+ for (const file of fs.readdirSync(launches)) {
+ if (!file.endsWith('.json') || !VERSION_ID.test(file.slice(0, -5))) continue;
+ const launch = readVersionJson<{
+ helperPid?: number;
+ targetId: string;
+ fallbackId: string;
+ }>(path.join(launches, file));
+ if (launch?.helperPid && alive(launch.helperPid)) {
+ if (!validId(launch.targetId) || !validId(launch.fallbackId)) return;
+ keep.add(launch.targetId);
+ keep.add(launch.fallbackId);
+ }
+ }
+ }
+ const versions = path.join(root, 'versions');
+ if (!fs.existsSync(versions)) return;
+ assertVersionDirectory(profile, versions);
+ for (const id of fs.readdirSync(versions)) {
+ if (!VERSION_ID.test(id) || keep.has(id)) continue;
+ try {
+ // Never touch unpublished builds or unknown directories. The small record stays
+ // usable by history rollback after its bulky runtime has been retired.
+ readPersonalVersionRecord(profile, id);
+ const runtime = path.join(versionDirectory(profile, id), 'runtime');
+ if (!fs.existsSync(runtime)) continue;
+ assertVersionDirectory(profile, runtime);
+ await originalFs.promises.rm(runtime, {
+ recursive: true,
+ force: true,
+ maxRetries: 3,
+ retryDelay: 200,
+ });
+ } catch {
+ log.warn('Could not retire a replaced personal application');
+ }
+ }
+ });
+ } catch {
+ // Publishing/launching has already succeeded. Retry housekeeping on the next build or switch.
+ log.warn('Personal application cleanup deferred');
+ }
+}
diff --git a/apps/desktop/src/main/cindy-make/remoteProjection.ts b/apps/desktop/src/main/cindy-make/remoteProjection.ts
index 87a1c9dfd7..259e8cc1fd 100644
--- a/apps/desktop/src/main/cindy-make/remoteProjection.ts
+++ b/apps/desktop/src/main/cindy-make/remoteProjection.ts
@@ -23,6 +23,7 @@ export interface MakeRemoteSnapshot {
completion?: { id: string; meta: CindyMakeCompletionMeta };
sharedBuild?: CindyMakePersonalBuildState;
recoverable: boolean;
+ sourceMergePending?: boolean;
}
type Translate = (key: string, values?: Record<string, string>) => string;
@@ -107,7 +108,9 @@ export function projectMakeRemoteCard(source: MakeRemoteSnapshot, t: Translate):
: (shared ?? meta.personal);
const building =
!!personal &&
- ['waiting', 'checking', 'merging', 'packaging', 'publishing'].includes(personal.status);
+ ['waiting', 'syncing', 'checking', 'merging', 'packaging', 'publishing'].includes(
+ personal.status,
+ );
const starting = testStatus === 'starting';
const buildMode =
!starting &&
@@ -185,7 +188,11 @@ export function projectMakeRemoteCard(source: MakeRemoteSnapshot, t: Translate):
testStatus === 'ready' ? 'cindyMake.test.started' : 'cindyMake.test.start',
starting || building || testStatus === 'ready' || !meta.commit,
);
- action(`test:${id}:build`, 'cindyMake.personal.generate', starting || building || !meta.commit);
+ action(
+ `test:${id}:build`,
+ 'cindyMake.personal.generate',
+ starting || building || !meta.commit || source.sourceMergePending,
+ );
if (building && personal?.buildId)
actions.push({
id: `build:${personal.buildId}:stop`,
@@ -199,9 +206,13 @@ export function projectMakeRemoteCard(source: MakeRemoteSnapshot, t: Translate):
},
});
} else if (!source.busy && source.recoverable) {
- title = t('cindyMake.test.resume.title');
- description = t('cindyMake.test.resume.description');
- action(`resume:${source.revision}`, 'cindyMake.test.resume.action');
+ title = t('cindyMake.test.title');
+ action(`resume:${source.revision}:start`, 'cindyMake.test.start');
+ action(
+ `resume:${source.revision}:build`,
+ 'cindyMake.personal.generate',
+ source.sourceMergePending,
+ );
}
const fallbackMarkdown = [title, description, ...details].filter(Boolean).join('\n\n');
return {
diff --git a/apps/desktop/src/main/cindy-make/remoteRuntime.ts b/apps/desktop/src/main/cindy-make/remoteRuntime.ts
index f3edf349d3..12ce3ea0bc 100644
--- a/apps/desktop/src/main/cindy-make/remoteRuntime.ts
+++ b/apps/desktop/src/main/cindy-make/remoteRuntime.ts
@@ -1,4 +1,4 @@
-import { createHash, randomUUID } from 'node:crypto';
+import { createHash } from 'node:crypto';
import { and, desc, eq, gt, isNull, or, sql } from 'drizzle-orm';
import { getDbClient } from '../localDb/client/current.js';
import { sessions, messages } from '../localDb/schema.js';
@@ -11,7 +11,6 @@ import {
RemoteResourceRegistryError,
} from '../device-link/remoteResourceRegistry.js';
import { resolvePreferredSystemLocale } from '../../shared/locale.js';
-import { dbToMakerAgentKind } from '../../shared/agentKindConversion.js';
import { t } from '../i18n.js';
import { cindyMakeManager } from './manager.js';
import { actCindyMakeTest } from './testRuntime.js';
@@ -20,7 +19,7 @@ import {
cancelHistoryPersonalVersion,
readCindyMakeBuildState,
} from './historyRuntime.js';
-import { dispatchCindyMakeTask, restoreCindyMakeTaskState, startCindyMakeTask } from './taskRuntime.js';
+import { restoreCindyMakeTaskState, startCindyMakeTask } from './taskRuntime.js';
import { createMakeRemoteProvider } from './remoteProvider.js';
import { broadcastMakeRemoteChanged } from './remoteBroadcast.js';
import { projectMakeRemoteCard, type MakeRemoteSnapshot } from './remoteProjection.js';
@@ -93,6 +92,7 @@ export function registerMakeRemoteResources(isRunning: (id: string) => boolean):
if (!isCurrent()) throw unavailable();
let completion: MakeRemoteSnapshot['completion'];
let recoverable = false;
+ let recoveryId: string | undefined;
let sawTurnEnd = false;
for (const row of rows) {
const meta = parse(row.agentMeta);
@@ -101,12 +101,16 @@ export function registerMakeRemoteResources(isRunning: (id: string) => boolean):
const done = meta.cindyMakeCompletion as CindyMakeCompletionMeta | undefined;
if (done && typeof done.reportedAt === 'number' && Number.isFinite(done.reportedAt)) {
completion = { id: row.clientId, meta: done };
- if (!sawTurnEnd) recoverable = typeof done.continuedAt === 'number';
+ if (!sawTurnEnd) {
+ recoverable = typeof done.continuedAt === 'number';
+ if (recoverable) recoveryId = row.clientId;
+ }
break;
}
if (!sawTurnEnd && typeof meta.turnCompleted === 'boolean') {
sawTurnEnd = true;
recoverable = meta.turnCompleted;
+ if (recoverable) recoveryId = row.clientId;
}
}
if (completion && !completion.meta.continuedAt) {
@@ -117,6 +121,7 @@ export function registerMakeRemoteResources(isRunning: (id: string) => boolean):
(report) => report.task?.sessionId === sessionId,
);
const sharedBuild = readCindyMakeBuildState();
+ const merge = cindyMakeManager.getState().upstreamMerge;
const snapshot: MakeRemoteSnapshot = {
sessionId,
revision: '',
@@ -130,12 +135,14 @@ export function registerMakeRemoteResources(isRunning: (id: string) => boolean):
? sharedBuild
: undefined,
recoverable,
+ sourceMergePending:
+ !!merge && merge.status !== 'merged' && (merge.hasWorkspace || merge.cancellationRequested),
};
snapshot.revision = createHash('sha256')
.update(JSON.stringify([snapshot, rows[0]?.clientId, session.clearedAt]))
.digest('hex')
.slice(0, 24);
- return { snapshot, session, isCurrent, scope };
+ return { snapshot, session, isCurrent, scope, recoveryId };
};
remoteResourceRegistry.register(
createMakeRemoteProvider({
@@ -146,7 +153,7 @@ export function registerMakeRemoteResources(isRunning: (id: string) => boolean):
text = text.replaceAll(`{{${name}}}`, value);
return text;
},
- async act(sessionId, actionId, isCurrent, locale) {
+ async act(sessionId, actionId, isCurrent) {
const state = await load(sessionId);
if (
!isCurrent() ||
@@ -164,34 +171,28 @@ export function registerMakeRemoteResources(isRunning: (id: string) => boolean):
else if (kind === 'prepare' && action === 'retry') {
const history = await getCindyMakeHistory(id);
const item = history.items.find((entry) => entry.runId === id);
- if (!isCurrent() || !state.isCurrent() || item?.sessionId !== sessionId ||
- !item.actions.includes('retry-prepare')) throw unavailable();
- await startCindyMakeTask({
- runId: item.runId, request: item.request, title: item.title.slice(0, 200),
- }, 0);
- }
- else if (kind === 'resume' && id === state.snapshot.revision) {
- const row = state.session;
- await dispatchCindyMakeTask(
- sessionId,
- t(
- 'cindyMake.test.resume.request',
- locale ? resolvePreferredSystemLocale([locale]) : undefined,
- ),
+ if (
+ !isCurrent() ||
+ !state.isCurrent() ||
+ item?.sessionId !== sessionId ||
+ !item.actions.includes('retry-prepare')
+ )
+ throw unavailable();
+ await startCindyMakeTask(
{
- id: sessionId,
- agentKind: dbToMakerAgentKind(row.agentKind),
- workingDir: row.workingDir,
- model: row.model,
- effort: row.effort,
- providerId: row.providerId,
- fastMode: row.fastMode,
- permissionMode: row.permissionMode,
- planMode: row.planModeEnabled,
+ runId: item.runId,
+ request: item.request,
+ title: item.title.slice(0, 200),
},
- () => isCurrent() && state.isCurrent(),
- randomUUID(),
+ 0,
);
+ } else if (
+ kind === 'resume' &&
+ id === state.snapshot.revision &&
+ state.recoveryId &&
+ (action === 'start' || action === 'build')
+ ) {
+ await actCindyMakeTest(sessionId, state.recoveryId, `resume-${action}`);
} else throw unavailable();
broadcastMakeRemoteChanged(sessionId, state.scope);
},
diff --git a/apps/desktop/src/main/cindy-make/settingsStore.ts b/apps/desktop/src/main/cindy-make/settingsStore.ts
new file mode 100644
index 0000000000..d5383e1ddc
--- /dev/null
+++ b/apps/desktop/src/main/cindy-make/settingsStore.ts
@@ -0,0 +1,55 @@
+import { app } from 'electron';
+import path from 'node:path';
+
+import { desktopMakerLogger } from '../maker-host/logger-adapter.js';
+import { createOverrideSettingsFile } from '../maker-host/override-settings-file.js';
+import {
+ DEFAULT_CINDY_MAKE_SETTINGS,
+ type CindyMakeSettings,
+} from '../../shared/cindyMakeSettings.js';
+
+const log = desktopMakerLogger.child('cindy-make-settings-store');
+
+function settingsFilePath(): string {
+ return path.join(app.getPath('userData'), 'cindy-make-settings.json');
+}
+
+function normalize(raw: unknown): CindyMakeSettings {
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
+ return { ...DEFAULT_CINDY_MAKE_SETTINGS };
+ }
+ const value = raw as Record<string, unknown>;
+ return {
+ syncLatestBeforeBuild:
+ typeof value.syncLatestBeforeBuild === 'boolean'
+ ? value.syncLatestBeforeBuild
+ : DEFAULT_CINDY_MAKE_SETTINGS.syncLatestBeforeBuild,
+ };
+}
+
+const store = createOverrideSettingsFile<CindyMakeSettings>({
+ filePath: settingsFilePath,
+ defaults: DEFAULT_CINDY_MAKE_SETTINGS,
+ normalize,
+ log,
+ label: 'cindy-make',
+});
+
+export function readCindyMakeSettings(): CindyMakeSettings {
+ return store.read();
+}
+
+export function writeCindyMakeSyncLatestBeforeBuild(
+ syncLatestBeforeBuild: boolean,
+): CindyMakeSettings {
+ // An explicit OFF remains an override if the product default changes later.
+ store.writePatch({ syncLatestBeforeBuild }, { preserveDefaults: true });
+ log.info('Cindy Make build sync setting written', { syncLatestBeforeBuild });
+ return store.read();
+}
+
+export function resetCindyMakeSettings(): CindyMakeSettings {
+ return store.reset();
+}
+
+export const __testing = { normalize };
diff --git a/apps/desktop/src/main/cindy-make/taskNote.ts b/apps/desktop/src/main/cindy-make/taskNote.ts
index 478ffb95aa..290dce737e 100644
--- a/apps/desktop/src/main/cindy-make/taskNote.ts
+++ b/apps/desktop/src/main/cindy-make/taskNote.ts
@@ -17,7 +17,7 @@ export function buildCindyMakeTaskNote(): string {
'不要自行提交或推送,也不要改动版本号或打包配置;完成回报后由 Cindy 在本任务分支创建带签名的本地提交,生成个人版时再合入个人分支,永不自动推送。' +
'每轮修改完成并通过仓库要求的提交前检查后,都必须调用 cindy_make 的 report_complete 工具(无需参数),再给出完成说明;' +
'用户点击“继续修改”后的新一轮也必须重新调用,之前的完成回报不能代替本轮。' +
- '用户要求恢复或继续测试流程时,先核对当前修改与检查结果,满足完成条件后重新回报;不要让用户输入工具名。' +
- '只有完成回报才能恢复测试与生成个人版的卡片;仅回复“已完成”不会恢复卡片。检查失败或仍需用户补充信息时不要回报完成。'
+ '测试与生成个人版由用户点击界面按钮后执行,继续修改不需要额外确认;不要要求用户发送检查指令或输入工具名来恢复按钮。' +
+ '检查失败或仍需用户补充信息时不要回报完成。'
);
}
diff --git a/apps/desktop/src/main/cindy-make/taskRuntime.ts b/apps/desktop/src/main/cindy-make/taskRuntime.ts
index 394ec0035b..3437989e97 100644
--- a/apps/desktop/src/main/cindy-make/taskRuntime.ts
+++ b/apps/desktop/src/main/cindy-make/taskRuntime.ts
@@ -31,6 +31,7 @@ import { getSessionRuntimeControlSnapshot } from '../maker-ipc/sessionRuntimeCon
import { normalizeWorkingDirForStorage } from '../../shared/workingDir.js';
import {
isMakeEnvironmentReady,
+ type CindyMakeTaskOptions,
type CindyMakeTaskStart,
type MakeDoctorReport,
type MakeTaskWorkspace,
@@ -257,6 +258,19 @@ export async function startCindyMakeTask(raw: unknown, sender: number): Promise<
? await db.select().from(sessions).where(eq(sessions.id, input.originSessionId)).limit(1)
: [];
checkCurrent();
+ const effective = origin
+ ? getSessionRuntimeControlSnapshot(origin.id).effectiveOverride
+ : undefined;
+ const preferences = origin ?? input.createOptions ?? {};
+ const taskOptions: CindyMakeTaskOptions = {
+ agentKind: normalizeDbAgentKind(effective?.agentKind ?? preferences.agentKind),
+ model: effective?.model ?? preferences.model ?? undefined,
+ effort: effective ? (effective.effort ?? '') : preferences.effort,
+ providerId: effective ? effective.providerId : preferences.providerId,
+ fastMode: effective?.fastMode ?? preferences.fastMode,
+ planModeEnabled: preferences.planModeEnabled,
+ permissionMode: preferences.permissionMode,
+ };
const userData = app.getPath('userData');
const root = makeSourceRoot(userData);
const clientId = 'cindy-make-preparation-' + input.runId;
@@ -406,10 +420,6 @@ export async function startCindyMakeTask(raw: unknown, sender: number): Promise<
throwIpcError('NOT_FOUND', 'Origin task is unavailable');
if (origin?.remoteHostId)
throwIpcError('UNSUPPORTED_CAPABILITY', 'Cindy Make requires a local task');
- const effective = origin
- ? getSessionRuntimeControlSnapshot(origin.id).effectiveOverride
- : undefined;
- const preferences = origin ?? input.createOptions ?? {};
sessionId = createBusinessSessionId();
const row = sessionCreateToRow(
sessionId,
@@ -418,13 +428,7 @@ export async function startCindyMakeTask(raw: unknown, sender: number): Promise<
workingDir: makeTaskWorktreePath(userData, input.runId),
workspaceKind: 'project',
source: 'cindy-make',
- agentKind: normalizeDbAgentKind(effective?.agentKind ?? preferences.agentKind),
- model: effective?.model ?? preferences.model,
- effort: effective ? (effective.effort ?? '') : preferences.effort,
- providerId: effective ? effective.providerId : preferences.providerId,
- fastMode: effective?.fastMode ?? preferences.fastMode,
- planModeEnabled: preferences.planModeEnabled,
- permissionMode: preferences.permissionMode,
+ ...taskOptions,
},
Date.now(),
);
@@ -532,6 +536,16 @@ export async function startCindyMakeTask(raw: unknown, sender: number): Promise<
signal.throwIfAborted();
report = { ...report, source };
cindyMakeManager.setSourceStatus(source);
+ // The task worktree must branch from the latest verified personal source.
+ // Keep the visible task shell while this runs so conflicts and Stop remain recoverable.
+ phase('updatingSource', publish);
+ const { syncSourceBeforeCindyMakeTask } = await import('./upstreamMergeRuntime.js');
+ await syncSourceBeforeCindyMakeTask(signal, taskOptions);
+ checkPreparationCurrent();
+ signal.throwIfAborted();
+ source = await readCurrentCindySourceStatus(root, env);
+ report = { ...report, source };
+ publish(report);
phase('workspace', publish);
await untilAborted(
cindyMakeManager.withProject(
diff --git a/apps/desktop/src/main/cindy-make/testController.ts b/apps/desktop/src/main/cindy-make/testController.ts
index d343a889f3..58b6992aaf 100644
--- a/apps/desktop/src/main/cindy-make/testController.ts
+++ b/apps/desktop/src/main/cindy-make/testController.ts
@@ -39,6 +39,8 @@ export interface MakeTestControllerDeps {
openBuild?(context: MakeTestContext): Promise<void>;
/** Publish the same build receipt to Settings and the completion card. */
onBuildState?(context: MakeTestContext, state: CindyMakePersonalBuildState): void;
+ /** Invalidate Settings after the terminal receipt is saved and the build lease is released. */
+ onBuildSettled?(context: MakeTestContext): void;
claimBuild?(context: MakeTestContext): () => void;
now?: () => number;
}
@@ -200,6 +202,12 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {
clearInterval(ownerWatch);
if (jobs.get(context.sessionId) === job) jobs.delete(context.sessionId);
job.releaseBuild?.();
+ if (
+ job.kind === 'build' &&
+ context.isCurrent() &&
+ ['ready', 'failed'].includes(context.meta.personal?.status ?? '')
+ )
+ deps.onBuildSettled?.(context);
}
};
return {
@@ -275,7 +283,7 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {
if (['starting', 'ready'].includes(context.meta.test?.status ?? ''))
patch.test = { ...context.meta.test, status: 'stopped', error: 'interrupted' };
if (
- ['waiting', 'checking', 'merging', 'packaging', 'publishing'].includes(
+ ['waiting', 'syncing', 'checking', 'merging', 'packaging', 'publishing'].includes(
context.meta.personal?.status ?? '',
)
)
diff --git a/apps/desktop/src/main/cindy-make/testRecovery.ts b/apps/desktop/src/main/cindy-make/testRecovery.ts
new file mode 100644
index 0000000000..7e304ff852
--- /dev/null
+++ b/apps/desktop/src/main/cindy-make/testRecovery.ts
@@ -0,0 +1,152 @@
+import path from 'node:path';
+import { randomUUID } from 'node:crypto';
+import { and, desc, eq, isNull, or, sql } from 'drizzle-orm';
+import { app } from 'electron';
+import { getDbClient } from '../localDb/client/current.js';
+import { messages, sessions } from '../localDb/schema.js';
+import { createMessage } from '../localDb/ipc/messages.js';
+import { withSessionRouteLock } from '../localDb/sessionRouteLock.js';
+import {
+ captureDataOwnerBroadcastScope,
+ isDataOwnerBroadcastScopeCurrent,
+} from '../device-link/broadcast-tap.js';
+import { collectCindyMakeChanges } from './completion.js';
+import { cindyMakeManager } from './manager.js';
+import { isCindyMakeWorktreePath, makeSourceRoot } from './sourcePaths.js';
+import {
+ createMakeToolchainEnvironment,
+ resolveMakeToolEnvironment,
+} from './toolchainEnvironment.js';
+import { runSourceGit } from './sourceGit.js';
+import { makeTestError } from './testRunner.js';
+import { captureMakeHistoryStore } from './historyOwner.js';
+import { captureMakeHistoryCompletion } from './historyCapture.js';
+import { broadcastMakeRemoteChanged } from './remoteBroadcast.js';
+
+/** Capture current files only for an explicit test/build click, never on opening the editor. */
+export async function prepareCindyMakeTest(
+ sessionId: string,
+ messageId: string,
+ isBusy: (sessionId: string) => boolean,
+) {
+ const client = getDbClient();
+ const scope = captureDataOwnerBroadcastScope();
+ const history = captureMakeHistoryStore();
+ const userData = app.getPath('userData');
+ const isCurrent = () => isDataOwnerBroadcastScopeCurrent(scope) && getDbClient() === client;
+ const check = () => {
+ if (!isCurrent() || isBusy(sessionId) || cindyMakeManager.isTaskPreparing(sessionId))
+ throw makeTestError('unavailable');
+ };
+ return withSessionRouteLock(sessionId, async () => {
+ const read = async () => {
+ check();
+ const [session] = await client.drizzle
+ .select()
+ .from(sessions)
+ .where(eq(sessions.id, sessionId))
+ .limit(1);
+ if (
+ !session ||
+ session.source !== 'cindy-make' ||
+ session.remoteHostId ||
+ session.status !== 'active' ||
+ !session.workingDir ||
+ !isCindyMakeWorktreePath(userData, session.workingDir)
+ )
+ throw makeTestError('unavailable');
+ const safeMeta = sql`CASE WHEN json_valid(${messages.agentMeta}) THEN ${messages.agentMeta} ELSE '{}' END`;
+ const [anchor] = await client.drizzle
+ .select()
+ .from(messages)
+ .where(
+ and(
+ eq(messages.sessionId, sessionId),
+ isNull(messages.rewindAt),
+ or(eq(messages.role, 'user'), eq(messages.role, 'assistant')),
+ sql`json_extract(${safeMeta}, '$.parentUuid') IS NULL`,
+ ),
+ )
+ .orderBy(desc(messages.createdAt), sql`rowid DESC`)
+ .limit(1);
+ check();
+ if (
+ !anchor ||
+ anchor.clientId !== messageId ||
+ anchor.role !== 'assistant' ||
+ (session.clearedAt && anchor.createdAt <= session.clearedAt)
+ )
+ throw makeTestError('unavailable');
+ let meta;
+ try {
+ meta = JSON.parse(anchor.agentMeta ?? '{}');
+ } catch {
+ throw makeTestError('unavailable');
+ }
+ const completion = meta.cindyMakeCompletion;
+ if (
+ !(
+ completion &&
+ Number.isFinite(completion.reportedAt) &&
+ typeof completion.continuedAt === 'number'
+ ) &&
+ meta.turnCompleted !== true
+ )
+ throw makeTestError('unavailable');
+ return { session, anchor };
+ };
+ const initial = await read();
+ const workingDir = initial.session.workingDir!;
+ return cindyMakeManager.withProject(makeSourceRoot(userData), async () => {
+ const signal = AbortSignal.timeout(60_000);
+ const environment = await createMakeToolchainEnvironment(userData);
+ const env = await resolveMakeToolEnvironment(environment, ['git'], signal);
+ const fresh = await read();
+ if (
+ fresh.session.workingDir !== workingDir ||
+ fresh.session.clearedAt !== initial.session.clearedAt
+ )
+ throw makeTestError('unavailable');
+ const facts = await collectCindyMakeChanges(
+ (args, cwd, indexFile) => {
+ check();
+ return runSourceGit(
+ { ...env, ...(indexFile ? { GIT_INDEX_FILE: indexFile } : {}) },
+ args,
+ cwd,
+ signal,
+ );
+ },
+ userData,
+ workingDir,
+ );
+ const current = await read();
+ if (
+ current.session.workingDir !== workingDir ||
+ current.session.clearedAt !== initial.session.clearedAt
+ )
+ throw makeTestError('unavailable');
+ const completionId = randomUUID();
+ const meta = { ...facts, reportedAt: Date.now() };
+ await createMessage(
+ sessionId,
+ {
+ clientId: completionId,
+ role: 'assistant',
+ content: '',
+ agentMeta: { cindyMakeCompletion: meta },
+ createdAt: Math.max(meta.reportedAt, initial.anchor.createdAt + 1),
+ },
+ {
+ expectedClearBoundaryMs: initial.session.clearedAt,
+ broadcastOwnerScope: scope,
+ shouldBroadcast: isCurrent,
+ },
+ );
+ check();
+ captureMakeHistoryCompletion(history, path.basename(workingDir), completionId, meta);
+ broadcastMakeRemoteChanged(sessionId, scope);
+ return { completionId, isCurrent };
+ });
+ });
+}
diff --git a/apps/desktop/src/main/cindy-make/testRuntime.ts b/apps/desktop/src/main/cindy-make/testRuntime.ts
index 5203d93f10..340540dda9 100644
--- a/apps/desktop/src/main/cindy-make/testRuntime.ts
+++ b/apps/desktop/src/main/cindy-make/testRuntime.ts
@@ -44,11 +44,19 @@ import { hasPublishedPersonalVersionCommit } from './versionStore.js';
import { captureMakeHistoryStore } from './historyOwner.js';
import { captureMakeHistoryCompletion } from './historyCapture.js';
import { broadcastMakeRemoteChanged } from './remoteBroadcast.js';
+import { prepareCindyMakeTest } from './testRecovery.js';
+import { readCindyMakeSettings } from './settingsStore.js';
+import { syncSourceBeforeCindyMakeBuild } from './upstreamMergeRuntime.js';
let isRunning: (sessionId: string) => boolean = () => true;
+let notifyHistoryChanged: () => void = () => {};
const log = createLogger('cindy-make-test');
-export function configureCindyMakeTestRuntime(probe: typeof isRunning): void {
+export function configureCindyMakeTestRuntime(
+ probe: typeof isRunning,
+ notify: () => void = () => {},
+): void {
isRunning = probe;
+ notifyHistoryChanged = notify;
}
interface StoredContext extends MakeTestContext {
@@ -232,6 +240,9 @@ export const cindyMakeTestController = createMakeTestController({
});
}
},
+ onBuildSettled: (context) => {
+ if (context.isCurrent()) notifyHistoryChanged();
+ },
withUse: (context, run) => cindyMakeManager.withProjectUse(makeSourceRoot(context.userData), run),
build: (context, signal, publish) => {
let entered = false;
@@ -272,6 +283,10 @@ export const cindyMakeTestController = createMakeTestController({
const buildEnv = await personalBuildEnvironment(env, git.path);
await publish({ status: 'waiting', preparationStep: 'original' });
await rememberOriginalVersion(node.path);
+ if (readCindyMakeSettings().syncLatestBeforeBuild) {
+ await syncSourceBeforeCindyMakeBuild(signal, publish);
+ if (!context.isCurrent()) throw makeTestError('unavailable');
+ }
await integrateCompletionForBuild(context, signal, publish);
signal.throwIfAborted();
if (!context.isCurrent()) throw makeTestError('unavailable');
@@ -409,13 +424,38 @@ export async function actCindyMakeTest(
typeof completionId !== 'string' ||
!/^[A-Za-z0-9-]{1,128}$/.test(completionId) ||
typeof action !== 'string' ||
- !['start', 'continue', 'status', 'build', 'open-build'].includes(action)
+ ![
+ 'start',
+ 'continue',
+ 'status',
+ 'build',
+ 'open-build',
+ 'resume-start',
+ 'resume-build',
+ ].includes(action)
)
throwIpcError('INVALID_PARAMS', 'Invalid Cindy Make test action');
+ let targetCompletionId = completionId;
try {
+ if (action === 'resume-start' || action === 'resume-build') {
+ const scope = captureDataOwnerBroadcastScope();
+ const client = getDbClient();
+ if (action === 'resume-build' && (await getCindyMakeHistory()).busy)
+ throw makeTestError('unavailable');
+ if (!isDataOwnerBroadcastScopeCurrent(scope) || getDbClient() !== client)
+ throw makeTestError('unavailable');
+ const prepared = await prepareCindyMakeTest(
+ sessionId,
+ completionId,
+ (id) => isRunning(id) || cindyMakeTestController.isUsingSession(id),
+ );
+ if (!prepared.isCurrent()) throw makeTestError('unavailable');
+ targetCompletionId = prepared.completionId;
+ action = action === 'resume-build' ? 'build' : 'start';
+ }
if (action === 'build' && !cindyMakeTestController.isBuilding(sessionId)) {
await cindyMakeTestController.stopTestForBuild(sessionId);
- const context = await load(sessionId, completionId);
+ const context = await load(sessionId, targetCompletionId);
let history = await getCindyMakeHistory(context.runId);
if (!context.isCurrent()) throw makeTestError('unavailable');
if (history.busy) throw makeTestError('unavailable');
@@ -427,7 +467,7 @@ export async function actCindyMakeTest(
}
return await cindyMakeTestController.act(
sessionId,
- completionId,
+ targetCompletionId,
action as CindyMakeTestAction,
);
} catch (error) {
diff --git a/apps/desktop/src/main/cindy-make/upstreamMerge.ts b/apps/desktop/src/main/cindy-make/upstreamMerge.ts
index ebf413cf80..01ffe468e0 100644
--- a/apps/desktop/src/main/cindy-make/upstreamMerge.ts
+++ b/apps/desktop/src/main/cindy-make/upstreamMerge.ts
@@ -280,7 +280,8 @@ export async function discardFeatureMerge(
git: MergeGit,
canCleanup: () => boolean,
): Promise<boolean> {
- if (!state.feature || !state.cancellationRequested || !canCleanup()) return false;
+ if (!(state.feature || state.taskOwned) || !state.cancellationRequested || !canCleanup())
+ return false;
git = ownedGit(git, canCleanup);
const source = await assertSource(userData, git);
const worktree = mergeWorktree(userData, state.id);
@@ -616,7 +617,9 @@ export async function prepareUpstreamMerge(
initial: CindyMakeMergeState,
git: MergeGit,
publish: (state: CindyMakeMergeState) => Promise<void>,
+ isCurrent: () => boolean = () => true,
): Promise<CindyMakeMergeState> {
+ git = ownedGit(git, isCurrent);
const worktree = mergeWorktree(userData, initial.id);
if (!COMMIT.test(initial.upstreamCommit)) throw mergeError('unavailable');
const source = await assertSource(userData, git);
@@ -631,11 +634,21 @@ export async function prepareUpstreamMerge(
() => '',
);
if (main.trim()) {
- // A customized local main is never reset behind the user's back.
+ // A customized local main is never reset behind the user's back. Distinguish
+ // a main that is simply newer than the selected target from a divergent one:
+ // the former is normal when a Dev checkout is compared with an older release.
try {
await git(['merge-base', '--is-ancestor', main.trim(), initial.upstreamCommit], source);
- } catch {
- throw mergeError('localMain');
+ } catch (error) {
+ // Git exit 1 means "not an ancestor"; other failures cannot prove divergence.
+ if ((error as { exitCode?: number }).exitCode !== 1) throw error;
+ try {
+ await git(['merge-base', '--is-ancestor', initial.upstreamCommit, main.trim()], source);
+ } catch (error) {
+ if ((error as { exitCode?: number }).exitCode !== 1) throw error;
+ throw mergeError('localMain');
+ }
+ throw mergeError('localMainAhead');
}
await git(['update-ref', `refs/cindy-make/backups/${initial.id}/main`, main.trim()], source);
}
@@ -708,5 +721,5 @@ export async function prepareUpstreamMerge(
}
// Rebase does not replay edits introduced only in a merge commit. Never silently adopt their loss.
if (state.rebaseReview) return { ...state, status: 'conflict' };
- return applyUpstreamMerge(userData, state, git);
+ return applyUpstreamMerge(userData, state, git, isCurrent);
}
diff --git a/apps/desktop/src/main/cindy-make/upstreamMergeController.ts b/apps/desktop/src/main/cindy-make/upstreamMergeController.ts
index 5423b682d2..21a4e7c1d8 100644
--- a/apps/desktop/src/main/cindy-make/upstreamMergeController.ts
+++ b/apps/desktop/src/main/cindy-make/upstreamMergeController.ts
@@ -33,6 +33,8 @@ export function parseSavedUpstreamMerge(raw: string, userData: string): SavedUps
(state.cancellationRequested !== undefined &&
typeof state.cancellationRequested !== 'boolean') ||
(state.cleanupPending !== undefined && typeof state.cleanupPending !== 'boolean') ||
+ (state.taskOwned !== undefined &&
+ (typeof state.taskOwned !== 'boolean' || (state.taskOwned && !saved.sessionOwner))) ||
(state.feature !== undefined && (!validFeaturePlan(state.feature) || !saved.sessionOwner)) ||
(state.tree !== undefined && !/^[0-9a-f]{40,64}$/i.test(state.tree)) ||
(state.baselineCommit !== undefined && !/^[0-9a-f]{40}$/i.test(state.baselineCommit)) ||
@@ -77,6 +79,7 @@ export interface UpstreamMergeDependencies {
prepare: (
state: CindyMakeMergeState,
publish: (state: CindyMakeMergeState) => Promise<void>,
+ isCurrent: () => boolean,
) => Promise<CindyMakeMergeState>;
apply: (
state: CindyMakeMergeState,
@@ -111,6 +114,7 @@ const errors = new Set([
'busy',
'dirty',
'localMain',
+ 'localMainAhead',
'unavailable',
'gitFailed',
'baselineChanged',
@@ -196,10 +200,10 @@ export class UpstreamMergeController {
} catch (error) {
return finish(undefined, error);
}
- // A deliberate later message may resume the task, never the stopped build.
+ // A deliberate later message may resume the resolver, never the stopped operation.
interrupted ||=
this.stopGeneration !== stopGeneration || this.interruption?.operationId === operationId;
- // Adoption and cleanup share the active operation. Do not resume a build between them.
+ // Adoption and cleanup share the active operation. Do not resume its caller between them.
if (this.active) return;
if (interrupted) finish(undefined, mergeError('interrupted'));
else if (state.status === 'merged') finish(state);
@@ -210,8 +214,8 @@ export class UpstreamMergeController {
signal.addEventListener('abort', check, { once: true });
check();
}).catch(async (error) => {
- // Only Stop Making carries this reason. Shutdown and ordinary task Stop
- // preserve the resolver for a later visit. Keep the build waiting for cleanup.
+ // Only an owning preparation/build Stop carries this reason. Shutdown and an ordinary
+ // resolver-task Stop preserve the resolver for a later visit and keep the caller waiting.
if (signal.aborted && (signal.reason as { code?: string })?.code === 'cancelled')
await this.cancelBuild(operationId);
throw error;
@@ -286,7 +290,7 @@ export class UpstreamMergeController {
}
async finishPreviousCleanup(): Promise<void> {
const state = this.saved?.state;
- if (state?.feature && state.cancellationRequested) {
+ if ((state?.feature || state?.taskOwned) && state.cancellationRequested) {
await this.cancelBuild(state.id);
return;
}
@@ -329,27 +333,99 @@ export class UpstreamMergeController {
}
return this.status();
}
- async update(_options?: CindyMakeTaskOptions): Promise<CindyMakeMergeState | undefined> {
+ async update(
+ options?: CindyMakeTaskOptions,
+ signal?: AbortSignal,
+ ): Promise<CindyMakeMergeState | undefined> {
+ signal?.throwIfAborted();
await this.finishPreviousCleanup();
const owner = this.deps.owner();
- return this.run(async () => {
- if (
+ // Task preparation may only wait on or cancel the source update it actually started.
+ if (
+ signal &&
+ (!owner ||
+ this.active ||
this.saved?.state.cancellationRequested ||
- (this.saved?.state.hasWorkspace && this.saved.state.status !== 'merged')
+ (this.saved?.state.hasWorkspace && this.saved.state.status !== 'merged'))
+ )
+ throw mergeError('busy');
+ let operationId: string | undefined;
+ const markCancelled = () => {
+ if (
+ operationId &&
+ this.saved?.state.id === operationId &&
+ this.deps.owner() === owner &&
+ (signal?.reason as { code?: string })?.code === 'cancelled'
+ ) {
+ try {
+ this.save({ ...this.saved.state, cancellationRequested: true });
+ this.interruption = { operationId };
+ } catch {
+ // The awaited cancellation path retries the durable decision.
+ }
+ }
+ };
+ try {
+ const result = await this.run(async () => {
+ // A request stopped while waiting for the Git lock owns no new operation.
+ // Leave any previous result intact.
+ if (signal && (signal.aborted || this.deps.owner() !== owner)) return;
+ if (
+ this.saved?.state.cancellationRequested ||
+ (this.saved?.state.hasWorkspace && this.saved.state.status !== 'merged')
+ )
+ return;
+ this.saved = {
+ sessionOwner: owner || undefined,
+ state: {
+ id: randomUUID(),
+ status: 'fetching',
+ ref: '',
+ upstreamCommit: '',
+ ...(signal ? { taskOwned: true } : {}),
+ },
+ };
+ this.save(this.saved.state);
+ operationId = this.saved.state.id;
+ signal?.addEventListener('abort', markCancelled, { once: true });
+ markCancelled();
+ signal?.throwIfAborted();
+ const latest = await this.deps.latest();
+ signal?.throwIfAborted();
+ if (signal && this.deps.owner() !== owner) throw mergeError('busy');
+ this.save({ ...this.saved!.state, ref: latest.ref, upstreamCommit: latest.commit });
+ // An in-flight adoption may finish on Stop, but never under another account.
+ const result = await this.deps.prepare(
+ this.saved!.state,
+ async (next) => this.save(next),
+ () => !signal || this.deps.owner() === owner,
+ );
+ this.save(result);
+ // Task preparation authorizes its existing dedicated conflict task.
+ // Manual Settings updates still wait for the explicit resolve decision.
+ if (
+ signal &&
+ !signal.aborted &&
+ this.deps.owner() === owner &&
+ result.status === 'conflict'
+ )
+ await this.createResolutionTask(options, owner, signal);
+ await this.deps.refresh().catch(() => undefined);
+ });
+ if (signal && !operationId) {
+ signal.throwIfAborted();
+ throw mergeError('busy');
+ }
+ return result;
+ } finally {
+ signal?.removeEventListener('abort', markCancelled);
+ if (
+ operationId &&
+ signal?.aborted &&
+ (signal.reason as { code?: string })?.code === 'cancelled'
)
- return;
- this.saved = {
- sessionOwner: owner || undefined,
- state: { id: randomUUID(), status: 'fetching', ref: '', upstreamCommit: '' },
- };
- this.save(this.saved.state);
- const latest = await this.deps.latest();
- this.save({ ...this.saved!.state, ref: latest.ref, upstreamCommit: latest.commit });
- const result = await this.deps.prepare(this.saved!.state, async (next) => this.save(next));
- this.save(result);
- // Conflicts wait for an explicit resolve/cancel decision before any Agent task exists.
- await this.deps.refresh().catch(() => undefined);
- });
+ await this.cancelBuild(operationId);
+ }
}
async resolve(
options?: CindyMakeTaskOptions,
@@ -399,7 +475,11 @@ export class UpstreamMergeController {
}
async cancel(operationId: string): Promise<CindyMakeMergeState | undefined> {
const state = this.saved?.state;
- if (state?.id === operationId && state.feature && state.cancellationRequested)
+ if (
+ state?.id === operationId &&
+ (state.feature || state.taskOwned) &&
+ state.cancellationRequested
+ )
return this.cancelBuild(operationId);
const owner = this.deps.owner();
if (
@@ -433,12 +513,12 @@ export class UpstreamMergeController {
await this.deps.refresh().catch(() => undefined);
});
}
- /** Bound to a build-owned operation, never used for an ordinary session Stop or app exit. */
+ /** Bound to task preparation, never used for an ordinary session Stop or app exit. */
async cancelBuild(operationId: string): Promise<CindyMakeMergeState | undefined> {
const state = this.saved?.state;
const owner = this.deps.owner();
if (
- !state?.feature ||
+ !(state?.feature || state?.taskOwned) ||
state.id !== operationId ||
this.saved?.sessionOwner !== owner ||
!this.deps.discard
diff --git a/apps/desktop/src/main/cindy-make/upstreamMergeRuntime.ts b/apps/desktop/src/main/cindy-make/upstreamMergeRuntime.ts
index 9a14849162..bf9b05b57e 100644
--- a/apps/desktop/src/main/cindy-make/upstreamMergeRuntime.ts
+++ b/apps/desktop/src/main/cindy-make/upstreamMergeRuntime.ts
@@ -19,7 +19,7 @@ import {
resolveMakeToolEnvironment,
} from './toolchainEnvironment.js';
import { readCurrentCindySourceStatus } from './sourcePreparation.js';
-import { createLatestSourceVersionReader } from './latestSourceVersion.js';
+import { createLatestSourceVersionReader, sourceChannel } from './latestSourceVersion.js';
import { runSourceGit } from './sourceGit.js';
import { cindyMakeManager } from './manager.js';
import { validateCindyMakeTaskStart } from './taskRuntime.js';
@@ -173,11 +173,12 @@ export function configureUpstreamMerge(isRunning: (id: string) => boolean): void
latest: async () => {
const env = await createMakeToolchainEnvironment(userData);
const source = await readCurrentCindySourceStatus(root, env);
- const channel = !app.isPackaged
+ const fallbackChannel = !app.isPackaged
? 'dev'
: /-beta(?:\.|$)/i.test(app.getVersion())
? 'beta'
: 'release';
+ const channel = sourceChannel(source, fallbackChannel);
// An explicit update gets a fresh pin rather than the Settings display cache.
const { latestVersion } = await createLatestSourceVersionReader((url, init) =>
net.fetch(url, init),
@@ -185,8 +186,8 @@ export function configureUpstreamMerge(isRunning: (id: string) => boolean): void
if (latestVersion?.status !== 'ready') throw mergeError('unavailable');
return latestVersion;
},
- prepare: async (state, publish) =>
- prepareUpstreamMerge(userData, state, await git(), publish),
+ prepare: async (state, publish, isCurrent) =>
+ prepareUpstreamMerge(userData, state, await git(), publish, isCurrent),
prepareFeature: async (state, plan, publish, isCurrent) => {
if (!isCurrent() || isRunning(plan.taskSessionId)) throw mergeError('busy');
return prepareFeatureMerge(userData, state, plan, await git(), publish, isCurrent);
@@ -225,9 +226,13 @@ export function configureUpstreamMerge(isRunning: (id: string) => boolean): void
return cindyMakeManager.withProject(root, async () => {
// Recover before deleting the candidate: the durable after ref
// covers crashes between source adoption and state/receipt writes.
- await recoverAppliedMergeReceipt(userData, state, command, canCleanup);
+ if (state.feature)
+ await recoverAppliedMergeReceipt(userData, state, command, canCleanup);
if (!(await discardFeatureMerge(userData, state, command, canCleanup))) return false;
if (!canCleanup()) return false;
+ // A completed official sync stays adopted, just like a manual Settings sync.
+ // Only provisional feature receipts participate in build rollback.
+ if (!state.feature) return true;
// Keep the cancellation receipt until both reclaim and rollback finish.
// A restart/cleanup retry must undo the same unpublished prefix too.
await rollbackUnbuiltHistory(
@@ -344,6 +349,38 @@ export function assertUpstreamMergeTaskWritable(sessionId: string): void {
throwIpcError('PRECONDITION_FAILED', 'Upstream merge is being applied');
}
+/** Update the personal baseline before its task branch is created. */
+export async function syncSourceBeforeCindyMakeTask(
+ signal: AbortSignal,
+ options?: CindyMakeTaskOptions,
+): Promise<void> {
+ signal.throwIfAborted();
+ if (!controller || unavailable) throw mergeError('unavailable');
+ const state = await controller.update(options, signal);
+ if (!state) throw mergeError('unavailable');
+ const result = await controller.waitForCompletion(state.id, signal);
+ signal.throwIfAborted();
+ if (result.hasWorkspace || result.cleanupPending) throw mergeError('cancelFailed');
+}
+
+/** Optional build preflight: expose source sync as one build step and keep its errors localizable. */
+export async function syncSourceBeforeCindyMakeBuild(
+ signal: AbortSignal,
+ publish: (state: CindyMakePersonalBuildState) => Promise<void>,
+): Promise<void> {
+ await publish({ status: 'syncing', syncLatestSource: true });
+ try {
+ await syncSourceBeforeCindyMakeTask(signal);
+ } catch (error) {
+ if (signal.aborted) throw error;
+ throw personalBuildError(
+ (error as { code?: unknown })?.code === 'cancelFailed'
+ ? 'cleanupFailed'
+ : 'sourceSyncFailed',
+ );
+ }
+}
+
/** Wait without holding a Git or task route lock: the resolution task needs both to finish. */
export async function waitForMakeHistoryMerge(
state: CindyMakeMergeState | undefined,
diff --git a/apps/desktop/src/main/cindy-make/versionService.ts b/apps/desktop/src/main/cindy-make/versionService.ts
index c0bdb210ad..9c51ba038f 100644
--- a/apps/desktop/src/main/cindy-make/versionService.ts
+++ b/apps/desktop/src/main/cindy-make/versionService.ts
@@ -2,7 +2,11 @@ import { app } from 'electron';
import fs from 'node:fs';
import path from 'node:path';
import originalFs from 'original-fs';
-import type { CindyVersionsState } from '../../shared/cindyVersions.js';
+import {
+ CINDY_PERSONAL_VERSION,
+ type CindyVersionInfo,
+ type CindyVersionsState,
+} from '../../shared/cindyVersions.js';
import { isIpcError } from '../../shared/ipc-errors.js';
import { throwIpcError } from '../utils/ipcValidate.js';
import {
@@ -18,7 +22,9 @@ import {
} from './versionStartup.js';
import {
assertVersionDirectory,
+ describePersonalVersion,
listPersonalVersions,
+ personalVersionId,
readOriginalVersion,
readVersionJson,
selectedVersion,
@@ -26,7 +32,9 @@ import {
versionsRoot,
VERSION_ID,
withVersionStore,
+ writeVersionJson,
} from './versionStore.js';
+import { cleanupPersonalVersions } from './personalVersionCleanup.js';
let makeBusy: () => boolean = () => true;
export function configureCindyVersions(probe: () => boolean): void {
@@ -46,30 +54,38 @@ export async function getCindyVersions(): Promise<CindyVersionsState> {
)?.version;
} catch {}
}
+ const originalInfo: CindyVersionInfo = {
+ id: 'original',
+ kind: 'original',
+ development: Boolean(original?.development),
+ version: typeof version === 'string' ? version : undefined,
+ commit: typeof original?.commit === 'string' ? original.commit : undefined,
+ dirty: original?.dirty === true,
+ available: !!original && fs.existsSync(original.executable),
+ compatible: true,
+ };
+ const personal = listPersonalVersions(profile, original)[0];
+ const publicId = (id: string) => (id === 'original' ? id : CINDY_PERSONAL_VERSION);
return {
- currentId,
- selectedId: selectedVersion(profile),
+ currentId: publicId(currentId),
+ selectedId: publicId(selectedVersion(profile)),
switching: isCindyVersionSwitching(),
- versions: [
- {
- id: 'original',
- kind: 'original',
- development: Boolean(original?.development),
- version: typeof version === 'string' ? version : undefined,
- commit: typeof original?.commit === 'string' ? original.commit : undefined,
- dirty: original?.dirty === true,
- available: !!original && fs.existsSync(original.executable),
- compatible: true,
- },
- ...listPersonalVersions(profile, original),
- ],
+ versions: [originalInfo, ...(personal ? [{ ...personal, id: CINDY_PERSONAL_VERSION }] : [])],
+ currentVersion:
+ currentId === 'original'
+ ? originalInfo
+ : {
+ ...describePersonalVersion(profile, currentId, original),
+ id: CINDY_PERSONAL_VERSION,
+ },
+ personalUpdateAvailable: currentId !== 'original' && !!personal && personal.id !== currentId,
};
}
export async function actCindyVersion(action: unknown, id: unknown): Promise<CindyVersionsState> {
if (
(action !== 'switch' && action !== 'remove') ||
typeof id !== 'string' ||
- (id !== 'original' && !VERSION_ID.test(id))
+ (id !== 'original' && id !== CINDY_PERSONAL_VERSION && !VERSION_ID.test(id))
)
throwIpcError('INVALID_PARAMS', 'Invalid version action');
const scope = captureDataOwnerBroadcastScope();
@@ -79,29 +95,40 @@ export async function actCindyVersion(action: unknown, id: unknown): Promise<Cin
try {
if (makeBusy() || isCindyVersionSwitching()) throwIpcError('PRECONDITION_FAILED', 'busy');
if (action === 'switch') {
- if (getCurrentCindyVersionId() === id) return getCindyVersions();
+ // Old completion cards carry generation UUIDs. They now address the same personal
+ // slot instead of resurrecting the application built for that historical task.
+ const targetId = id === 'original' ? id : personalVersionId(profile);
+ if (!targetId) throwIpcError('PRECONDITION_FAILED', 'unavailable');
+ if (getCurrentCindyVersionId() === targetId) return getCindyVersions();
if ((await readRelaunchBlockingActivity()).busy || !current())
throwIpcError('PRECONDITION_FAILED', 'busy');
await startVersionHandoff(
- id,
- async () => current() && !makeBusy() && !(await readRelaunchBlockingActivity()).busy,
+ targetId,
+ async () =>
+ current() &&
+ !makeBusy() &&
+ (targetId === 'original' || personalVersionId(profile) === targetId) &&
+ !(await readRelaunchBlockingActivity()).busy,
);
if (!current()) throwIpcError('PRECONDITION_FAILED', 'busy');
// Normal quit awaits the existing Maker, plugin, credential and DB disposers.
setImmediate(() => app.quit());
} else {
await withVersionStore(profile, async () => {
+ const targetId = personalVersionId(profile);
if (
!current() ||
id === 'original' ||
- id === getCurrentCindyVersionId() ||
- id === selectedVersion(profile)
+ getCurrentCindyVersionId() !== 'original' ||
+ selectedVersion(profile) !== 'original'
)
throwIpcError('PRECONDITION_FAILED', 'busy');
+ if (!targetId || (id !== CINDY_PERSONAL_VERSION && id !== targetId))
+ throwIpcError('PRECONDITION_FAILED', 'unavailable');
const active = readVersionJson<{ id: string; pid: number }>(
path.join(versionsRoot(profile), 'active.json'),
);
- if (active?.id === id) {
+ if (active && active.id !== 'original') {
try {
process.kill(active.pid, 0);
throwIpcError('PRECONDITION_FAILED', 'busy');
@@ -109,15 +136,22 @@ export async function actCindyVersion(action: unknown, id: unknown): Promise<Cin
if ((error as NodeJS.ErrnoException).code !== 'ESRCH') throw error;
}
}
- const directory = versionDirectory(profile, id);
+ const directory = versionDirectory(profile, targetId);
assertVersionDirectory(profile, directory);
- await originalFs.promises.rm(directory, {
- recursive: true,
- force: true,
- maxRetries: 3,
- retryDelay: 200,
- });
+ const runtime = path.join(directory, 'runtime');
+ if (fs.existsSync(runtime)) {
+ assertVersionDirectory(profile, runtime);
+ await originalFs.promises.rm(runtime, {
+ recursive: true,
+ force: true,
+ maxRetries: 3,
+ retryDelay: 200,
+ });
+ }
+ // Explicit deletion must not rediscover an older generation from the legacy registry.
+ writeVersionJson(path.join(versionsRoot(profile), 'personal.json'), { id: null });
});
+ await cleanupPersonalVersions(profile);
}
return getCindyVersions();
} catch (error) {
diff --git a/apps/desktop/src/main/cindy-make/versionStartup.ts b/apps/desktop/src/main/cindy-make/versionStartup.ts
index 9ae4601cf9..782d26d78e 100644
--- a/apps/desktop/src/main/cindy-make/versionStartup.ts
+++ b/apps/desktop/src/main/cindy-make/versionStartup.ts
@@ -11,6 +11,7 @@ import { observeDesktopStartupResult } from '../devStartupStatus.js';
import { defaultPtySpawn } from '../terminal/ptyFactory.js';
import { makeTestEnvironment } from './testRunner.js';
import { getMakeRuntimeSourceIdentity } from './runtimeVersion.js';
+import { cleanupPersonalVersions } from './personalVersionCleanup.js';
import { versionEntryArguments } from './versionLaunchArguments.js';
import {
getCindyVersionLockScope,
@@ -771,4 +772,6 @@ export async function markCindyVersionReady(): Promise<void> {
const pending = path.join(versionsRoot(request!.profile.userData), 'pending.json');
if (readVersionJson<{ id: string }>(pending)?.id === request!.id) fs.unlinkSync(pending);
});
+ // Retire older applications; cleanup keeps the helper's bundle until it exits.
+ await cleanupPersonalVersions(request.profile.userData);
}
diff --git a/apps/desktop/src/main/cindy-make/versionStore.ts b/apps/desktop/src/main/cindy-make/versionStore.ts
index b155daeb61..1bf8617f99 100644
--- a/apps/desktop/src/main/cindy-make/versionStore.ts
+++ b/apps/desktop/src/main/cindy-make/versionStore.ts
@@ -129,7 +129,8 @@ export function readOriginalVersion(profile: string): OriginalVersion | null {
throw versionError('unavailable');
return value;
}
-export function readPersonalVersion(profile: string, id: string): PersonalVersion {
+/** Publication facts outlive retired application files and still protect build rollback. */
+export function readPersonalVersionRecord(profile: string, id: string): PersonalVersion {
const directory = versionDirectory(profile, id);
assertVersionDirectory(profile, directory);
const item = readVersionJson<PersonalVersion>(path.join(directory, 'version.json'));
@@ -163,6 +164,13 @@ export function readPersonalVersion(profile: string, id: string): PersonalVersio
for (const rel of [item.executable, item.resources]) {
if (typeof rel !== 'string' || path.isAbsolute(rel) || rel.split(/[\/\\]/).includes('..'))
throw versionError('unavailable');
+ }
+ return item;
+}
+export function readPersonalVersion(profile: string, id: string): PersonalVersion {
+ const item = readPersonalVersionRecord(profile, id);
+ const directory = versionDirectory(profile, id);
+ for (const rel of [item.executable, item.resources]) {
const full = path.join(directory, rel);
if (!sameVersionPath(fs.realpathSync(full), path.join(fs.realpathSync(directory), rel)))
throw versionError('unavailable');
@@ -177,7 +185,7 @@ export function hasPublishedPersonalVersionCommit(profile: string, commit: strin
return fs.readdirSync(root).some((id) => {
if (!VERSION_ID.test(id) || !fs.existsSync(path.join(root, id, 'version.json'))) return false;
try {
- return readPersonalVersion(profile, id).commit === commit;
+ return readPersonalVersionRecord(profile, id).commit === commit;
} catch {
return false;
}
@@ -249,6 +257,9 @@ export function publishPersonalVersion(profile: string, id: string): void {
const staged = readVersionJson<PersonalVersion>(path.join(directory, 'staged.json'));
if (!staged || staged.id !== id) throw versionError('unavailable');
writeVersionJson(path.join(directory, 'version.json'), staged);
+ // The slot changes only after the complete application has been saved. UUIDs are
+ // private immutable generations, not additional user-selectable personal versions.
+ writeVersionJson(path.join(versionsRoot(profile), 'personal.json'), { id });
try {
fs.unlinkSync(path.join(directory, 'staged.json'));
} catch {}
@@ -338,41 +349,62 @@ export function listPersonalVersions(
profile: string,
original: OriginalVersion | null,
): CindyVersionInfo[] {
+ const id = personalVersionId(profile);
+ return id ? [describePersonalVersion(profile, id, original)] : [];
+}
+
+/** Old registries have no slot yet; adopt their newest runnable generation on read. */
+export function personalVersionId(profile: string): string | undefined {
+ const slot = readVersionJson<{ id: string | null }>(
+ path.join(versionsRoot(profile), 'personal.json'),
+ );
+ if (slot) {
+ if (slot.id === null) return undefined;
+ if (typeof slot.id !== 'string' || !VERSION_ID.test(slot.id)) throw versionError('unavailable');
+ return slot.id;
+ }
const root = path.join(versionsRoot(profile), 'versions');
- if (!fs.existsSync(root)) return [];
+ if (!fs.existsSync(root)) return undefined;
assertVersionDirectory(profile, root);
- let fingerprint: string | undefined;
- try {
- if (original)
- fingerprint =
- original.migrationHash ?? migrationIdentity(path.join(original.resources, 'drizzle'));
- } catch {}
return fs
.readdirSync(root)
.filter((id) => VERSION_ID.test(id))
- .flatMap<CindyVersionInfo>((id) => {
- if (!fs.existsSync(path.join(root, id, 'version.json'))) return [];
+ .flatMap((id) => {
try {
- const item = readPersonalVersion(profile, id);
- return [
- {
- id,
- kind: 'personal' as const,
- ...(item.version ? { version: item.version } : {}),
- title: item.title,
- commit: item.commit,
- builtAt: item.builtAt,
- available: true,
- compatible:
- item.migrationHash === fingerprint &&
- item.profile.region === original?.profile.region,
- },
- ];
+ return [readPersonalVersion(profile, id)];
} catch {
- return [{ id, kind: 'personal' as const, available: false, compatible: false }];
+ return [];
}
})
- .sort((a, b) => (b.builtAt ?? '').localeCompare(a.builtAt ?? ''));
+ .sort((a, b) => Date.parse(b.builtAt) - Date.parse(a.builtAt) || b.id.localeCompare(a.id))[0]
+ ?.id;
+}
+
+export function describePersonalVersion(
+ profile: string,
+ id: string,
+ original: OriginalVersion | null,
+): CindyVersionInfo {
+ let fingerprint: string | undefined;
+ try {
+ if (original)
+ fingerprint =
+ original.migrationHash ?? migrationIdentity(path.join(original.resources, 'drizzle'));
+ } catch {}
+ try {
+ const item = readPersonalVersion(profile, id);
+ return {
+ id,
+ kind: 'personal',
+ commit: item.commit,
+ builtAt: item.builtAt,
+ available: true,
+ compatible:
+ item.migrationHash === fingerprint && item.profile.region === original?.profile.region,
+ };
+ } catch {
+ return { id, kind: 'personal', available: false, compatible: false };
+ }
}
/** Copy the complete signed bundle unchanged; macOS framework symlinks stay inside it. */
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index 05e6008cc1..c1f93437d9 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -3866,6 +3866,12 @@ contextBridge.exposeInMainWorld('electronAPI', {
input: import('../shared/cindyMakeMerge').CindyMakeMergeRequest,
): Promise<import('../shared/cindyMakeMerge').CindyMakeMergeState | undefined> =>
ipcRenderer.invoke('app:cindy-make-merge', input),
+ getCindyMakeSettings: (): Promise<import('../shared/cindyMakeSettings').CindyMakeSettings> =>
+ ipcRenderer.invoke('app:get-cindy-make-settings'),
+ setCindyMakeSyncLatestBeforeBuild: (
+ enabled: boolean,
+ ): Promise<import('../shared/cindyMakeSettings').CindyMakeSettings> =>
+ ipcRenderer.invoke('app:set-cindy-make-sync-latest-before-build', enabled),
getCindyMakeHistory: (
selected?: string,
): Promise<import('../shared/cindyMakeHistory').CindyMakeHistoryState> =>
@@ -3914,6 +3920,15 @@ contextBridge.exposeInMainWorld('electronAPI', {
ipcRenderer.on('maker:cindy-make:state-changed', wrapped);
return () => ipcRenderer.removeListener('maker:cindy-make:state-changed', wrapped);
},
+ onCindyMakeHistoryChanged: (
+ listener: (ownerStamp?: DataOwnerPushStamp) => void,
+ ): (() => void) => {
+ const wrapped = (_event: Electron.IpcRendererEvent, ownerStamp: unknown) => {
+ if (ownerStamp === undefined || isDataOwnerPushStamp(ownerStamp)) listener(ownerStamp);
+ };
+ ipcRenderer.on('cindy-make:history-changed', wrapped);
+ return () => ipcRenderer.removeListener('cindy-make:history-changed', wrapped);
+ },
openCindyMakeSourceDir: (): Promise<{ success: boolean }> =>
ipcRenderer.invoke('app:open-cindy-make-source-dir'),
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeBuildProgress.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeBuildProgress.tsx
index 5ef2e17603..bf8ca8cea4 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeBuildProgress.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeBuildProgress.tsx
@@ -15,9 +15,17 @@ export function CindyMakeBuildProgress({ build }: { build?: CindyMakePersonalBui
const conflicts =
build.mergeStep === 'conflicts' ||
build.logs?.some((entry) => entry.step === 'resolving-conflicts');
- const cleanup = !!build.mergeStep || build.logs?.some((entry) => entry.step === 'cleaning-merge');
+ const cleanup =
+ build.mergeStep === 'cleanup' ||
+ build.mergeStep === 'conflicts' ||
+ build.logs?.some((entry) => entry.step === 'cleaning-merge');
+ const syncing =
+ build.syncLatestSource === true ||
+ build.status === 'syncing' ||
+ build.logs?.some((entry) => entry.step === 'syncing');
const steps = [
'waiting',
+ ...(syncing ? ['syncing'] : []),
'merging',
...(conflicts ? ['conflicts'] : []),
...(cleanup ? ['cleanup'] : []),
@@ -52,10 +60,10 @@ export function CindyMakeBuildProgress({ build }: { build?: CindyMakePersonalBui
</span>
{t(
step === 'conflicts'
- ? 'cindyMake.personal.buildLog.steps.resolving-conflicts'
- : step === 'cleanup'
- ? 'cindyMake.personal.buildLog.steps.cleaning-merge'
- : 'cindyMake.history.progress.' + step,
+ ? 'cindyMake.personal.buildLog.steps.resolving-conflicts'
+ : step === 'cleanup'
+ ? 'cindyMake.personal.buildLog.steps.cleaning-merge'
+ : 'cindyMake.history.progress.' + step,
)}
</li>
);
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeEditingActions.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeEditingActions.tsx
new file mode 100644
index 0000000000..e25dbe7ea9
--- /dev/null
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeEditingActions.tsx
@@ -0,0 +1,85 @@
+import { useEffect, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Button } from '@/components/ui/button';
+import { useCindyMakeState } from '@/lib/cindyMakeState';
+import {
+ getDataOwnerGeneration,
+ isDataOwnerGenerationCurrent,
+} from '@/contexts/dataOwnerGeneration';
+import { getStickySessionDeviceId } from '@/features/device-link/stickySessionOrigin';
+import { extractIpcError } from '@/utils/ipcError';
+
+/** Optional actions above the ordinary editor; nothing runs until clicked. */
+export function CindyMakeEditingActions({
+ sessionId,
+ messageId,
+}: {
+ sessionId: string;
+ messageId: string;
+}) {
+ const { t } = useTranslation();
+ const { upstreamMerge } = useCindyMakeState();
+ const sourceMergePending =
+ !!upstreamMerge &&
+ upstreamMerge.status !== 'merged' &&
+ (upstreamMerge.hasWorkspace || upstreamMerge.cancellationRequested);
+ const owner = getDataOwnerGeneration();
+ const [pending, setPending] = useState<'start' | 'build'>();
+ const [error, setError] = useState<string>();
+ const busy = useRef(false);
+ const active = useRef(true);
+ const current = () =>
+ active.current && isDataOwnerGenerationCurrent(owner) && !getStickySessionDeviceId(sessionId);
+ useEffect(() => {
+ active.current = true;
+ return () => {
+ active.current = false;
+ };
+ }, []);
+ const act = async (action: 'start' | 'build') => {
+ if (busy.current || !current() || (action === 'build' && sourceMergePending)) return;
+ busy.current = true;
+ setPending(action);
+ setError(undefined);
+ try {
+ await window.electronAPI.cindyMakeTest(sessionId, messageId, `resume-${action}`);
+ } catch (error) {
+ if (current()) {
+ const code = extractIpcError(error)?.message.replace(/^\[PRECONDITION_FAILED\]\s*/, '');
+ setError(
+ code === 'changed' || code === 'environment' || code === 'stopFailed'
+ ? code
+ : 'unavailable',
+ );
+ }
+ } finally {
+ busy.current = false;
+ if (current()) setPending(undefined);
+ }
+ };
+ return (
+ <div className="flex flex-wrap items-center justify-end gap-2">
+ {error && (
+ <p role="alert" className="mr-auto text-12 text-[var(--error-fg)]">
+ {t('cindyMake.test.errors.' + error)}
+ </p>
+ )}
+ <Button
+ variant="secondary"
+ disabled={!!pending}
+ loading={pending === 'start'}
+ onClick={() => void act('start')}
+ >
+ {t('cindyMake.test.start')}
+ </Button>
+ <Button
+ variant="secondary"
+ disabled={!!pending || sourceMergePending}
+ loading={pending === 'build'}
+ onClick={() => void act('build')}
+ >
+ {t('cindyMake.personal.generate')}
+ </Button>
+ </div>
+ );
+}
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx
index 57565a79dd..71d81f2d82 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx
@@ -33,9 +33,11 @@ type Filter = 'all' | 'pending' | 'integrated' | 'ended';
/** Historical facts and allowed actions come from Main; an old button cannot authorize a write. */
export function CindyMakeHistoryPanel({
active = true,
+ hasPersonalVersion = false,
onState,
}: {
active?: boolean;
+ hasPersonalVersion?: boolean;
onState?: (state: CindyMakeHistoryState) => void;
}) {
const { t, i18n } = useTranslation();
@@ -118,6 +120,12 @@ export function CindyMakeHistoryPanel({
void refresh();
});
}, [active, owner, refresh]);
+ useEffect(() => {
+ if (!active) return;
+ return window.electronAPI.onCindyMakeHistoryChanged?.((stamp) => {
+ if (isDataOwnerGenerationCurrent(owner) && isDataOwnerPushCurrent(stamp)) void refresh();
+ });
+ }, [active, owner, refresh]);
useEffect(() => {
if (state) onState?.(state);
}, [state, onState]);
@@ -173,13 +181,15 @@ export function CindyMakeHistoryPanel({
state?.build?.status === 'failed' &&
!!state.build.buildId &&
selectedBuild?.buildId === state.build.buildId;
+ const building = !!state?.build && !['ready', 'failed'].includes(state.build.status);
const selectedActions: MakeHistoryAction[] = selected
? (
[
- 'build',
'test',
'continue',
'open',
+ 'revert',
+ 'reapply',
'resolve',
'retry',
'retry-prepare',
@@ -343,7 +353,35 @@ export function CindyMakeHistoryPanel({
}
}
};
- const building = !!state?.build && !['ready', 'failed'].includes(state.build.status);
+ const rebuildPersonal = async () => {
+ if (
+ acting.current ||
+ !hasPersonalVersion ||
+ !state?.canBuild ||
+ building ||
+ !isDataOwnerGenerationCurrent(owner)
+ )
+ return;
+ acting.current = true;
+ request.current += 1;
+ const actionId = ++actionGeneration.current;
+ setPending('rebuild-personal');
+ try {
+ const next = await window.electronAPI.generateCindyMakePersonal();
+ if (!isDataOwnerGenerationCurrent(owner)) return;
+ update(next);
+ } catch {
+ if (isDataOwnerGenerationCurrent(owner)) {
+ toast.error(t('cindyMake.history.actionFailed'));
+ await refresh();
+ }
+ } finally {
+ if (actionId === actionGeneration.current) {
+ acting.current = false;
+ if (isDataOwnerGenerationCurrent(owner)) setPending(undefined);
+ }
+ }
+ };
const buildSelected = async () => {
if (acting.current || !checked.length || !isDataOwnerGenerationCurrent(owner)) return;
const pins: MakeHistoryBuildSelection[] = checked.map((item) => ({
@@ -442,8 +480,19 @@ export function CindyMakeHistoryPanel({
<div className="space-y-2 border-b border-[var(--border-default)] p-4">
<div className="flex flex-wrap items-center justify-between gap-3">
<h3 className="font-medium">
- {t('cindyMake.history.title')} · {items.length}
+ {t('cindyMake.history.title')} ·{' '}
+ {t('cindyMake.history.taskCount', { count: items.length })}
</h3>
+ {hasPersonalVersion && (
+ <Button
+ variant="secondary"
+ disabled={!!pending || failed || !state?.canBuild || building}
+ loading={pending === 'rebuild-personal'}
+ onClick={() => void rebuildPersonal()}
+ >
+ {t('cindyMake.history.regeneratePersonal')}
+ </Button>
+ )}
</div>
{!building && (
<>
@@ -756,7 +805,7 @@ export function CindyMakeHistoryPanel({
{selectedActions.map((action) => (
<Button
key={action}
- variant={action === 'build' || action === 'retry' ? 'primary' : 'secondary'}
+ variant={action === 'retry' ? 'primary' : 'secondary'}
disabled={!!pending || failed}
loading={pending === action}
onClick={() => void act(action)}
@@ -764,13 +813,11 @@ export function CindyMakeHistoryPanel({
{t(
action === 'hide'
? 'cindyMake.history.cleanTask'
- : action === 'retry'
- ? 'cindyMake.history.actions.build'
- : action === 'test'
- ? selected.test?.status === 'ready'
- ? 'cindyMake.history.batch.restartTest'
- : 'cindyMake.test.start'
- : 'cindyMake.history.actions.' + action,
+ : action === 'test'
+ ? selected.test?.status === 'ready'
+ ? 'cindyMake.history.batch.restartTest'
+ : 'cindyMake.test.start'
+ : 'cindyMake.history.actions.' + action,
)}
</Button>
))}
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeMergeNotice.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeMergeNotice.tsx
index 31371ffcbf..bf88a8fa21 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeMergeNotice.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeMergeNotice.tsx
@@ -1,3 +1,4 @@
+import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
import { Tip } from '@/components/ui/tooltip';
@@ -32,17 +33,44 @@ function ResolveMergeButton({
);
}
+/** Source updates keep recovery in the same action slot as their normal update button. */
+export function CindyMakeMergeActions({
+ state,
+ busy,
+ children,
+}: {
+ state?: CindyMakeMergeState;
+ busy?: boolean;
+ children?: ReactNode;
+}) {
+ if (!state || state.ownedByAnotherAccount) return children;
+ const active = ['fetching', 'merging', 'checking'].includes(state.status);
+ const canResolve =
+ (!state.sessionId || (state.status === 'failed' && state.error !== 'interrupted')) &&
+ !active &&
+ (state.hasWorkspace || state.cancellationRequested || state.error === 'cancelFailed') &&
+ state.status !== 'merged' &&
+ state.status !== 'cancelled';
+ if (!state.sessionId && !canResolve) return children;
+ return (
+ <>
+ {state.sessionId && <CindyMakeMergeTaskLink sessionId={state.sessionId} />}
+ {canResolve && <ResolveMergeButton state={state} disabled={busy} />}
+ </>
+ );
+}
+
export function CindyMakeMergeNotice({
state,
busy,
+ showActions = true,
}: {
state: CindyMakeMergeState;
busy?: boolean;
+ showActions?: boolean;
}) {
const { t } = useTranslation();
const active = ['fetching', 'merging', 'checking'].includes(state.status);
- const canResolve =
- !state.sessionId || (state.status === 'failed' && state.error !== 'interrupted');
return (
<div className="flex flex-wrap items-center justify-between gap-3 border-t border-[var(--border-default)] px-4 py-3 text-12">
<div className="min-w-0 flex-1 space-y-1 text-[var(--text-secondary)]" role="status">
@@ -55,15 +83,7 @@ export function CindyMakeMergeNotice({
)}
{state.ownedByAnotherAccount && <p>{t('cindyMake.merge.otherAccount')}</p>}
</div>
- {state.sessionId && !state.ownedByAnotherAccount && (
- <CindyMakeMergeTaskLink sessionId={state.sessionId} />
- )}
- {canResolve &&
- !active &&
- (state.hasWorkspace || state.cancellationRequested || state.error === 'cancelFailed') &&
- state.status !== 'merged' &&
- state.status !== 'cancelled' &&
- !state.ownedByAnotherAccount && <ResolveMergeButton state={state} disabled={busy} />}
+ {showActions && <CindyMakeMergeActions state={state} busy={busy} />}
</div>
);
}
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeSourceDetails.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeSourceDetails.tsx
index 0102a3ced9..c0badc4431 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeSourceDetails.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeSourceDetails.tsx
@@ -159,7 +159,7 @@ export function CindyMakeSourceDetails({
)}
</dd>
</div>
- <div className="flex flex-wrap items-baseline gap-x-3 gap-y-1">
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
<dt>
<Tip text={showComparison ? personalStatusDescription : undefined}>
<span
@@ -185,10 +185,7 @@ export function CindyMakeSourceDetails({
</span>
</Tip>
</dt>
- <dd className="flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-1">
- <span className="font-mono" title={source.commit}>
- {source.commit?.slice(0, 12) ?? unknown}
- </span>
+ <dd className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1">
{showComparison && personalDetail && <span className="text-12">{personalDetail}</span>}
</dd>
</div>
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTaskCard.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTaskCard.tsx
index e7aee4ec79..c984c66310 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTaskCard.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTaskCard.tsx
@@ -10,7 +10,14 @@ import { formatCindyMakeTitle } from '@/lib/cindyMakeTitle';
import { getStickySessionDeviceId } from '@/features/device-link/stickySessionOrigin';
import type { MakeDoctorReport } from '../../../shared/cindyMakeDoctor';
-const phases = ['environment', 'source', 'workspace', 'dependencies', 'starting'] as const;
+const phases = [
+ 'environment',
+ 'source',
+ 'updatingSource',
+ 'workspace',
+ 'dependencies',
+ 'starting',
+] as const;
export function CindyMakeTaskCard({
report,
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx
index 831d0c5ec8..00835c36c2 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
import { makerChatStore } from '@/lib/makerChatStore';
import { useCindyVersions } from '@/lib/useCindyVersions';
+import { useCindyMakeState } from '@/lib/cindyMakeState';
import {
getDataOwnerGeneration,
isDataOwnerGenerationCurrent,
@@ -30,89 +31,18 @@ type CompletedTestProps = {
onContinue?: () => void;
};
-type RecoveryTestProps = {
- sessionId: string;
- recovery: { onCheck: () => Promise<boolean | void>; onContinue: () => void };
-};
-
-/** Completion and missing-report recovery occupy the same composer card. */
-export function CindyMakeTestCard(props: CompletedTestProps | RecoveryTestProps) {
- return 'recovery' in props ? (
- <CindyMakeTestRecovery {...props} />
- ) : (
- <CindyMakeCompletedTest {...props} />
- );
-}
-
-function CindyMakeTestRecovery({ sessionId, recovery }: RecoveryTestProps) {
- const { t } = useTranslation();
- const owner = getDataOwnerGeneration();
- const [pending, setPending] = useState(false);
- const [failed, setFailed] = useState(false);
- const busy = useRef(false);
- const active = useRef(true);
- const current = () =>
- active.current && isDataOwnerGenerationCurrent(owner) && !getStickySessionDeviceId(sessionId);
- useEffect(() => {
- active.current = true;
- return () => {
- active.current = false;
- };
- }, []);
- const check = async () => {
- if (busy.current || !current()) return;
- busy.current = true;
- setPending(true);
- setFailed(false);
- try {
- const accepted = await recovery.onCheck();
- if (current() && accepted === false) setFailed(true);
- } catch {
- if (current()) setFailed(true);
- } finally {
- busy.current = false;
- if (current()) setPending(false);
- }
- };
- return (
- <CindyMakeCompleteCard
- composer
- needsCheck
- busy={pending}
- failed={failed}
- heading={t('cindyMake.test.resume.title')}
- description={t('cindyMake.test.resume.description')}
- >
- {failed && (
- <p role="alert" className="text-12 text-[var(--error-fg)]">
- {t('cindyMake.test.resume.failed')}
- </p>
- )}
- <div className="flex flex-wrap justify-end gap-2">
- <Button
- variant="secondary"
- disabled={pending}
- onClick={() => {
- if (!busy.current && current()) recovery.onContinue();
- }}
- >
- {t('cindyMake.test.continue')}
- </Button>
- <Button
- variant="secondary"
- disabled={pending}
- loading={pending}
- onClick={() => void check()}
- >
- {t('cindyMake.test.resume.action')}
- </Button>
- </div>
- </CindyMakeCompleteCard>
- );
-}
-
-function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: CompletedTestProps) {
+export function CindyMakeTestCard({
+ sessionId,
+ completionId,
+ meta,
+ onContinue,
+}: CompletedTestProps) {
const { t } = useTranslation();
+ const { upstreamMerge } = useCindyMakeState();
+ const sourceMergePending =
+ !!upstreamMerge &&
+ upstreamMerge.status !== 'merged' &&
+ (upstreamMerge.hasWorkspace || upstreamMerge.cancellationRequested);
const owner = getDataOwnerGeneration();
const [pending, setPending] = useState<Exclude<CindyMakeTestAction, 'status'>>();
const [buildSnapshot, setBuildSnapshot] = useState<{
@@ -211,7 +141,7 @@ function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: C
};
}, [sessionId, completionId, owner.dataOwnerId, owner.generation]);
const act = async (action: Exclude<CindyMakeTestAction, 'status'>) => {
- if (busy.current || !current()) return;
+ if (busy.current || !current() || (action === 'build' && sourceMergePending)) return;
busy.current = true;
version.current += 1;
setPending(action);
@@ -256,7 +186,7 @@ function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: C
const displayBuild: CindyMakePersonalBuildState | undefined =
pending === 'build' ? { status: 'waiting' } : personal;
const buildStatus = displayBuild?.status;
- const building = ['waiting', 'checking', 'merging', 'packaging', 'publishing'].includes(
+ const building = ['waiting', 'syncing', 'checking', 'merging', 'packaging', 'publishing'].includes(
buildStatus ?? '',
);
const starting = testStatus === 'starting';
@@ -279,7 +209,22 @@ function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: C
);
};
const switching = !!versions.pending || versions.state?.switching === true;
- const usingPersonal = !!personal?.versionId && versions.state?.currentId === personal.versionId;
+ const personalVersion = versions.state?.versions.find((version) => version.kind === 'personal');
+ const generatesPersonal =
+ personal?.status !== 'ready' || (!!personal.versionId && !!versions.state && !personalVersion);
+ const usingPersonal =
+ personal?.status === 'ready' &&
+ !!personal.versionId &&
+ !!personalVersion &&
+ versions.state?.currentId === personalVersion.id &&
+ !versions.state?.personalUpdateAvailable;
+ const personalReadyHint = usingPersonal
+ ? 'cindyMake.versions.usingHint'
+ : versions.state?.personalUpdateAvailable
+ ? 'cindyMake.versions.updateHint'
+ : versions.state && !personalVersion
+ ? 'cindyMake.versions.empty'
+ : 'cindyMake.versions.readyHint';
const working = buildMode ? building : starting;
const errorCode =
error?.code ??
@@ -301,7 +246,7 @@ function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: C
description={t(
buildMode && buildStatus === 'ready'
? personal?.versionId
- ? 'cindyMake.versions.readyHint'
+ ? personalReadyHint
: 'cindyMake.personal.readyHint'
: buildMode && building
? 'cindyMake.personal.description'
@@ -367,12 +312,22 @@ function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: C
</Button>
<Button
variant="secondary"
- disabled={!!pending || building || starting || switching || usingPersonal || !meta.commit}
+ disabled={
+ !!pending ||
+ building ||
+ starting ||
+ switching ||
+ usingPersonal ||
+ (generatesPersonal && sourceMergePending) ||
+ !meta.commit ||
+ (personal?.status === 'ready' && !!personal.versionId && !versions.state)
+ }
loading={building || switching || pending === 'open-build'}
onClick={() => {
- if (personal?.status === 'ready' && personal.versionId)
- void versions.act('switch', personal.versionId);
- else void act(personal?.status === 'ready' ? 'open-build' : 'build');
+ if (personal?.status === 'ready' && personal.versionId) {
+ if (personalVersion) void versions.act('switch', personalVersion.id);
+ else if (versions.state) void act('build');
+ } else void act(personal?.status === 'ready' ? 'open-build' : 'build');
}}
>
{t(
@@ -380,11 +335,25 @@ function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: C
? usingPersonal
? 'cindyMake.versions.using'
: personal.versionId
- ? 'cindyMake.versions.switchPersonal'
+ ? personalVersion || !versions.state
+ ? versions.state?.personalUpdateAvailable
+ ? 'cindyMake.versions.updatePersonal'
+ : 'cindyMake.versions.switchPersonal'
+ : 'cindyMake.personal.generate'
: 'cindyMake.personal.open'
: 'cindyMake.personal.generate',
)}
</Button>
+ {personal?.status === 'ready' && (
+ <Button
+ variant="secondary"
+ disabled={!!pending || building || starting || switching || sourceMergePending || !meta.commit}
+ loading={building || pending === 'build'}
+ onClick={() => void act('build')}
+ >
+ {t('cindyMake.history.regeneratePersonal')}
+ </Button>
+ )}
</div>
</CindyMakeCompleteCard>
);
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsx
index 17d5aa325e..2d08780245 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeVersionsPanel.tsx
@@ -1,21 +1,23 @@
-import { useId, useState, type ReactNode } from 'react';
+import { useEffect, useId, useState, type ReactNode } from 'react';
import { ChevronDown, ChevronUp } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
import { useConfirmDialog } from '@/components/ui/confirm-dialog-provider';
import { useCindyVersions } from '@/lib/useCindyVersions';
-import type { CindyVersionInfo } from '../../../shared/cindyVersions';
+import type { CindyVersionInfo, CindyVersionsState } from '../../../shared/cindyVersions';
/** One overview: the running app first, followed by its personal source. */
export function CindyMakeVersionsPanel({
active = true,
busy = false,
refreshKey,
+ onState,
children,
}: {
active?: boolean;
busy?: boolean;
refreshKey?: string;
+ onState?: (state?: CindyVersionsState) => void;
children?: ReactNode;
}) {
const { t, i18n } = useTranslation();
@@ -25,19 +27,47 @@ export function CindyMakeVersionsPanel({
const listId = useId();
const disabled = busy || !!versions.pending || versions.state?.switching;
const supported = typeof window.electronAPI.getCindyVersions === 'function';
- const current = versions.state?.versions.find(
- (version) => version.id === versions.state?.currentId,
- );
+ useEffect(() => onState?.(versions.state), [onState, versions.state]);
+ const current =
+ versions.state?.currentVersion ??
+ versions.state?.versions.find((version) => version.id === versions.state?.currentId);
const alternatives =
versions.state?.versions.filter((version) => version.id !== versions.state?.currentId) ?? [];
const title = (version: CindyVersionInfo) =>
version.kind === 'original'
? t('cindyMake.versions.original')
- : version.title || t('cindyMake.versions.personal');
+ : t('cindyMake.versions.personal');
+ const personal = versions.state?.versions.find((version) => version.kind === 'personal');
+ const switchBlockedReason = (version: CindyVersionInfo) => {
+ if (disabled) return 'busy' as const;
+ if (!version.available) return 'unavailable' as const;
+ if (!version.compatible) return 'incompatible' as const;
+ return undefined;
+ };
+ const switchBlockedLabel = (version: CindyVersionInfo) => {
+ const reason = switchBlockedReason(version);
+ if (!reason) return undefined;
+ return t(reason === 'busy' ? 'cindyMake.versions.errors.busy' : 'cindyMake.versions.' + reason);
+ };
+ const renderSwitchButton = (version: CindyVersionInfo, actionLabel: string) => {
+ const blockedLabel = switchBlockedLabel(version);
+ return (
+ <Button
+ variant="secondary"
+ disabled={!!switchBlockedReason(version)}
+ loading={versions.pending === version.id}
+ onClick={() => void versions.act('switch', version.id)}
+ title={blockedLabel}
+ aria-label={blockedLabel ?? actionLabel}
+ >
+ {blockedLabel ?? actionLabel}
+ </Button>
+ );
+ };
const metadata = (version: CindyVersionInfo, includeDate = false) =>
[
version.development ? t('cindyMake.versions.development') : null,
- version.version,
+ version.kind === 'original' ? version.version : null,
version.commit?.slice(0, 12),
version.dirty ? t('cindyMake.versions.localChanges') : null,
includeDate && version.builtAt && Number.isFinite(Date.parse(version.builtAt))
@@ -66,11 +96,6 @@ export function CindyMakeVersionsPanel({
: title(current)}
</span>
)}
- {current?.kind === 'personal' && current.title && (
- <span className="break-words text-12 text-[var(--text-secondary)]">
- {current.title}
- </span>
- )}
</h3>
{current ? (
<p className="mt-1 break-words text-12 text-[var(--text-secondary)]">
@@ -105,6 +130,23 @@ export function CindyMakeVersionsPanel({
</p>
)}
</div>
+ {versions.state?.personalUpdateAvailable && personal && (
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="text-12 text-[var(--text-secondary)]">
+ <p>{metadata(personal, true)}</p>
+ {(!personal.available || !personal.compatible) && (
+ <p>
+ {t(
+ !personal.available
+ ? 'cindyMake.versions.unavailable'
+ : 'cindyMake.versions.incompatible',
+ )}
+ </p>
+ )}
+ </div>
+ {renderSwitchButton(personal, t('cindyMake.versions.updatePersonal'))}
+ </div>
+ )}
{versions.error && (
<p role="alert" className="text-12 text-[var(--error-fg)]">
{t('cindyMake.versions.errors.' + versions.error)}
@@ -137,14 +179,7 @@ export function CindyMakeVersionsPanel({
)}
</div>
<div className="flex flex-wrap gap-2">
- <Button
- variant="secondary"
- disabled={disabled || !version.available || !version.compatible}
- loading={versions.pending === version.id}
- onClick={() => void versions.act('switch', version.id)}
- >
- {t('cindyMake.versions.switch')}
- </Button>
+ {renderSwitchButton(version, t('cindyMake.versions.switch'))}
{version.kind === 'personal' && (
<Button
variant="secondary"
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeBuildParity.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeBuildParity.test.tsx
index ed889ec813..ca357c57a5 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeBuildParity.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeBuildParity.test.tsx
@@ -63,6 +63,17 @@ it('replaces the single live line on progress, falls back at stage changes, and
expect(screen.queryByRole('status')).toBeNull();
});
+it('adds the optional latest-source step only to builds that captured the enabled setting', () => {
+ const { rerender } = render(
+ <CindyMakeBuildProgress build={{ status: 'syncing', syncLatestSource: true }} />,
+ );
+ expect(screen.getByText('cindyMake.history.progress.syncing')).toBeTruthy();
+ expect(screen.getByRole('status').textContent).toBe('cindyMake.personal.status.syncing');
+
+ rerender(<CindyMakeBuildProgress build={{ status: 'merging' }} />);
+ expect(screen.queryByText('cindyMake.history.progress.syncing')).toBeNull();
+});
+
it.each(['merging', 'failed', 'ready'] as const)(
'shows live status only during an active build, without a merge navigation button: %s',
(status) => {
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeComposerMask.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeComposerMask.test.tsx
index 96cc7d72c2..2806fb3036 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeComposerMask.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeComposerMask.test.tsx
@@ -38,7 +38,7 @@ describe('Cindy Make input replacement', () => {
const cancel = vi.fn(async () => ({ success: true }));
vi.stubGlobal('electronAPI', { cancelCindyMakeTask: cancel });
const view = render(<CindyMakeComposerMask phase="dependencies" report={report} />);
- expect(screen.getAllByRole('listitem')).toHaveLength(5);
+ expect(screen.getAllByRole('listitem')).toHaveLength(6);
expect(screen.getByText('[make] Personal Cindy')).toBeTruthy();
expect(screen.getByText('cindyMake.code.dependencyActivity.starting')).toBeTruthy();
expect(screen.queryByText('cindyMake.code.inputLocked.hint')).toBeNull();
@@ -117,7 +117,7 @@ describe('Cindy Make input replacement', () => {
readOnly
/>,
);
- expect(screen.getAllByRole('listitem')).toHaveLength(5);
+ expect(screen.getAllByRole('listitem')).toHaveLength(6);
expect(screen.queryByRole('button')).toBeNull();
},
);
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeEditingActions.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeEditingActions.test.tsx
new file mode 100644
index 0000000000..abb5eaa020
--- /dev/null
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeEditingActions.test.tsx
@@ -0,0 +1,159 @@
+// @vitest-environment jsdom
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
+import { CindyMakeEditingActions } from '../CindyMakeEditingActions';
+import { getCindyMakePendingTest, getCindyMakeTestRecovery } from '@/lib/cindyMakeComposer';
+import type { ChatMessage } from '@/lib/makerChatStore';
+import type { CindyMakeMergeState } from '../../../../shared/cindyMakeMerge';
+
+const h = vi.hoisted(() => ({
+ api: vi.fn(),
+ merge: undefined as CindyMakeMergeState | undefined,
+ remote: undefined as string | undefined,
+}));
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('@/lib/cindyMakeState', () => ({ useCindyMakeState: () => ({ upstreamMerge: h.merge }) }));
+vi.mock('@/features/device-link/stickySessionOrigin', () => ({
+ getStickySessionDeviceId: () => h.remote,
+}));
+beforeEach(() => {
+ vi.resetAllMocks();
+ h.merge = undefined;
+ h.remote = undefined;
+ setDataOwnerGeneration('make-owner');
+ vi.stubGlobal('electronAPI', { cindyMakeTest: h.api });
+});
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+const button = (action = 'start') =>
+ screen.getByRole('button', {
+ name: action === 'start' ? 'cindyMake.test.start' : 'cindyMake.personal.generate',
+ });
+const actions = (key = 'task') => (
+ <CindyMakeEditingActions key={key} sessionId={key} messageId="result" />
+);
+
+describe('on-demand Cindy Make checks', () => {
+ it.each(['start', 'build'] as const)(
+ 'checks only when %s is clicked, coalesces double clicks and allows retry',
+ async (action) => {
+ let fail!: (error: Error) => void;
+ h.api
+ .mockImplementationOnce(
+ () =>
+ new Promise((_resolve, reject) => {
+ fail = reject;
+ }),
+ )
+ .mockResolvedValue({});
+ render(actions());
+ expect(h.api).not.toHaveBeenCalled();
+ fireEvent.click(button(action));
+ fireEvent.click(button(action));
+ fireEvent.click(button(action === 'start' ? 'build' : 'start'));
+ expect(h.api).toHaveBeenCalledExactlyOnceWith('task', 'result', 'resume-' + action);
+ await act(async () => fail(new Error('failed')));
+ expect(screen.getByRole('alert').textContent).toBe('cindyMake.test.errors.unavailable');
+ fireEvent.click(button(action));
+ await waitFor(() => expect(screen.queryByRole('alert')).toBeNull());
+ expect(h.api).toHaveBeenCalledTimes(2);
+ },
+ );
+ it.each(['owner', 'remote'])('rejects an old action after switching %s', (change) => {
+ render(actions());
+ if (change === 'owner') setDataOwnerGeneration('another-owner');
+ else h.remote = 'another-device';
+ fireEvent.click(button());
+ expect(h.api).not.toHaveBeenCalled();
+ });
+ it('does not put a late failure onto the next task', async () => {
+ let fail!: (error: Error) => void;
+ h.api.mockImplementationOnce(
+ () =>
+ new Promise((_resolve, reject) => {
+ fail = reject;
+ }),
+ );
+ const view = render(actions('old-task'));
+ fireEvent.click(button());
+ view.rerender(actions('new-task'));
+ await act(async () => fail(new Error('late')));
+ expect(screen.queryByRole('alert')).toBeNull();
+ expect(button().hasAttribute('disabled')).toBe(false);
+ });
+ it('blocks generation during a source conflict while retaining isolated testing', async () => {
+ h.merge = {
+ id: 'merge',
+ status: 'conflict',
+ ref: 'main',
+ upstreamCommit: 'a'.repeat(40),
+ hasWorkspace: true,
+ };
+ render(actions());
+ expect(button('build').hasAttribute('disabled')).toBe(true);
+ fireEvent.click(button('build'));
+ expect(h.api).not.toHaveBeenCalled();
+ fireEvent.click(button());
+ await waitFor(() => expect(h.api).toHaveBeenCalledWith('task', 'result', 'resume-start'));
+ });
+});
+
+describe('continued editing retains input', () => {
+ const session = {
+ id: 'make-task',
+ source: 'cindy-make' as const,
+ status: 'active' as const,
+ clearedAt: null,
+ };
+ const continued: ChatMessage = {
+ clientId: 'done',
+ role: 'assistant',
+ content: '',
+ systemCardType: 'cindy-make-complete',
+ systemCardData: { reportedAt: 1, continuedAt: 2 },
+ };
+ function Composer({ messages }: { messages: ChatMessage[] }) {
+ const pending = getCindyMakePendingTest({ session, messages, busy: false });
+ const recoveryId = getCindyMakeTestRecovery({
+ session,
+ messages,
+ busy: false,
+ historyLoaded: true,
+ });
+ return pending ? (
+ <div>completion</div>
+ ) : (
+ <>
+ {recoveryId && (
+ <CindyMakeEditingActions key={recoveryId} sessionId={session.id} messageId={recoveryId} />
+ )}
+ <textarea aria-label="editor" />
+ </>
+ );
+ }
+ it('allows typing immediately, after reopening, and after a reply without a completion report', () => {
+ const view = render(<Composer messages={[continued]} />);
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'Keep editing' } });
+ expect((screen.getByRole('textbox') as HTMLTextAreaElement).value).toBe('Keep editing');
+ expect(screen.queryByText('cindyMake.test.resume.action')).toBeNull();
+ expect(button()).toBeDefined();
+ view.unmount();
+ const reopened = render(<Composer messages={[continued]} />);
+ expect(screen.getByRole('textbox')).toBeDefined();
+ reopened.rerender(
+ <Composer
+ messages={[
+ continued,
+ { clientId: 'user', role: 'user', content: 'Edit' },
+ { clientId: 'reply', role: 'assistant', content: 'Done', turnCompleted: true },
+ ]}
+ />,
+ );
+ expect(screen.getByRole('textbox')).toBeDefined();
+ expect(button()).toBeDefined();
+ expect(h.api).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.i18n.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.i18n.test.tsx
index b8e1f9715e..ce68731755 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.i18n.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.i18n.test.tsx
@@ -26,51 +26,51 @@ const cases = [
{
locale: 'en',
resource: en,
- title: 'Make history',
+ title: 'Make history · Tasks: 1',
conflict: 'Resolving conflicts…',
- build: 'Generate personal version',
+ build: 'Rebuild personal version',
integrate: 'Integrate into personal version',
- counts: '1 total · 1 pending integration · 0 integrated',
+ counts: '1 make tasks · 1 pending integration · 0 integrated',
script: /[a-z]/i,
},
{
locale: 'zh-CN',
resource: zhCN,
- title: '制作历史',
+ title: '制作历史 · 1 个任务',
conflict: '正在处理冲突…',
- build: '生成个人版',
+ build: '重新生成个人版',
integrate: '合入个人版',
- counts: '共 1 次 · 待合入 1 次 · 已合入 0 次',
+ counts: '共 1 个制作任务 · 待合入 1 个 · 已合入 0 个',
script: /\p{Script=Han}/u,
},
{
locale: 'zh-TW',
resource: zhTW,
- title: '製作歷史',
+ title: '製作歷史 · 1 個任務',
conflict: '正在處理衝突…',
- build: '產生個人版',
+ build: '重新產生個人版',
integrate: '合入個人版',
- counts: '共 1 次 · 待合入 1 次 · 已合入 0 次',
+ counts: '共 1 個製作任務 · 待合入 1 個 · 已合入 0 個',
script: /\p{Script=Han}/u,
},
{
locale: 'ja',
resource: ja,
- title: '制作履歴',
+ title: '制作履歴 · 1 件のタスク',
conflict: '競合を解決中…',
- build: '個人版を生成',
+ build: '個人版を再生成',
integrate: '個人版に取り込む',
- counts: '合計 1 件 · 未取り込み 1 件 · 取り込み済み 0 件',
+ counts: '制作タスク 1 件 · 取り込み待ち 1 件 · 取り込み済み 0 件',
script: /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/u,
},
{
locale: 'ko',
resource: ko,
- title: '제작 기록',
+ title: '제작 기록 · 작업 1개',
conflict: '충돌 해결 중…',
- build: '개인 버전 생성',
+ build: '개인 버전 다시 생성',
integrate: '개인 버전에 반영',
- counts: '전체 1회 · 반영 대기 1회 · 반영 완료 0회',
+ counts: '제작 작업 1개 · 반영 대기 1개 · 반영 완료 0개',
script: /\p{Script=Hangul}/u,
},
];
@@ -139,7 +139,7 @@ describe('Cindy Make history with real translations', () => {
const view = render(
<MemoryRouter>
<I18nextProvider i18n={i18n}>
- <CindyMakeHistoryPanel />
+ <CindyMakeHistoryPanel hasPersonalVersion />
</I18nextProvider>
</MemoryRouter>,
);
@@ -197,7 +197,7 @@ describe('Cindy Make history with real translations', () => {
const view = render(
<MemoryRouter>
<I18nextProvider i18n={i18n}>
- <CindyMakeHistoryPanel />
+ <CindyMakeHistoryPanel hasPersonalVersion />
</I18nextProvider>
</MemoryRouter>,
);
@@ -233,11 +233,11 @@ describe('Cindy Make history with real translations', () => {
render(
<MemoryRouter>
<I18nextProvider i18n={i18n}>
- <CindyMakeHistoryPanel />
+ <CindyMakeHistoryPanel hasPersonalVersion />
</I18nextProvider>
</MemoryRouter>,
);
- expect(await screen.findByRole('heading', { name: title + ' · 1' })).toBeTruthy();
+ expect(await screen.findByRole('heading', { name: title })).toBeTruthy();
expect(screen.getByRole('button', { name: build })).toBeTruthy();
expect(screen.queryByRole('button', { name: integrate })).toBeNull();
expect(screen.getByText(counts)).toBeTruthy();
@@ -301,7 +301,7 @@ describe('Cindy Make history with real translations', () => {
<MemoryRouter>
<I18nextProvider i18n={i18n}>
<CindyMakeVersionsPanel />
- <CindyMakeHistoryPanel />
+ <CindyMakeHistoryPanel hasPersonalVersion />
<CindyMakeMergeNotice
state={{
id: 'merge',
@@ -316,7 +316,7 @@ describe('Cindy Make history with real translations', () => {
</MemoryRouter>,
);
expect(
- await screen.findByRole('button', { name: resource.cindyMake.history.actions.build }),
+ await screen.findByRole('button', { name: resource.cindyMake.history.regeneratePersonal }),
).toBeTruthy();
expect(
await screen.findByText(
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.test.tsx
index 72c678d9d6..c59c5fef95 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeHistoryPanel.test.tsx
@@ -1,7 +1,7 @@
// @vitest-environment jsdom
import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
+import { getDataOwnerGeneration, setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
import type { ConfirmOptions } from '@/components/ui/confirm-dialog-provider';
import type { SelectProps } from '@/components/ui/select';
import type {
@@ -72,12 +72,20 @@ function harness(items = [item()]) {
const build = vi.fn(async () => state);
const cancel = vi.fn(async () => state);
let onMessage: ((event?: { sessionId?: string; message?: unknown }) => void) | undefined;
+ let onHistoryChanged:
+ | ((stamp?: { dataOwnerId: string | null; ownerGeneration: number }) => void)
+ | undefined;
const unsubscribe = vi.fn();
+ const unsubscribeHistory = vi.fn();
vi.stubGlobal('electronAPI', {
getCindyMakeHistory: read,
actCindyMakeHistory: execute,
generateCindyMakePersonal: build,
cancelCindyMakePersonal: cancel,
+ onCindyMakeHistoryChanged: (callback: typeof onHistoryChanged) => {
+ onHistoryChanged = callback;
+ return unsubscribeHistory;
+ },
localDb: {
messages: {
onCreated: (callback: () => void) => {
@@ -97,7 +105,15 @@ function harness(items = [item()]) {
sessionId: items[0]?.sessionId,
message: { agentMeta: { cindyMakeCompletion: {} } },
}),
+ historyChanged: () => {
+ const owner = getDataOwnerGeneration();
+ onHistoryChanged?.({
+ dataOwnerId: owner.dataOwnerId,
+ ownerGeneration: owner.generation,
+ });
+ },
unsubscribe,
+ unsubscribeHistory,
set: (next: CindyMakeHistoryState) => {
state = next;
},
@@ -157,12 +173,12 @@ describe('Make history controls', () => {
expect(f.read).toHaveBeenCalled();
});
- it('uses Generate Personal Version for a failed integration too', async () => {
+ it('keeps an explicit retry for a failed integration without presenting it as generation', async () => {
const f = harness([item({ actions: ['open', 'retry'], operationError: 'checksFailed' })]);
render(<CindyMakeHistoryPanel />);
- fireEvent.click(await screen.findByRole('button', { name: 'cindyMake.history.actions.build' }));
+ fireEvent.click(await screen.findByRole('button', { name: 'cindyMake.history.actions.retry' }));
await waitFor(() => expect(f.execute).toHaveBeenCalledWith('aaaa', 'retry'));
- expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.retry' })).toBeNull();
+ expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.build' })).toBeNull();
});
it('shares test failure, retry, live progress and exit state with the completion broadcast', async () => {
const failed = item({ test: { status: 'failed', step: 'launching', error: 'launchFailed' } });
@@ -197,20 +213,20 @@ describe('Make history controls', () => {
await screen.findByRole('button', { name: 'cindyMake.test.start' });
view.unmount();
expect(f.unsubscribe).toHaveBeenCalled();
+ expect(f.unsubscribeHistory).toHaveBeenCalled();
});
- it('refreshes a task-triggered build through checking steps to failure and allows retry', async () => {
- const task = item({ integration: 'integrated', actions: ['open', 'build'], needsBuild: true });
+ it('refreshes a task-triggered build immediately through its terminal state', async () => {
+ const task = item({ integration: 'integrated', actions: ['open'], needsBuild: true });
const f = harness([task]);
- render(<CindyMakeHistoryPanel />);
- const build = await screen.findByRole('button', { name: 'cindyMake.history.actions.build' });
- await waitFor(() => expect(build.hasAttribute('disabled')).toBe(false));
+ render(<CindyMakeHistoryPanel hasPersonalVersion />);
+ await screen.findByRole('button', { name: 'cindyMake.history.regeneratePersonal' });
f.set({
items: [{ ...task, actions: ['open'] }],
busy: true,
canBuild: false,
build: { status: 'checking', checkStep: 'dependencies', buildId: 'build-1' },
});
- fireEvent.click(build);
+ act(() => f.historyChanged());
expect(await screen.findAllByText('cindyMake.personal.checkStep.dependencies')).toHaveLength(2);
const stop = screen.getByRole('button', { name: 'cindyMake.history.stop' });
expect(stop.hasAttribute('disabled')).toBe(false);
@@ -229,14 +245,15 @@ describe('Make history controls', () => {
canBuild: true,
build: { status: 'failed', error: 'checksFailed' },
});
- fireEvent(window, new Event('focus'));
+ act(() => f.historyChanged());
expect((await screen.findByRole('alert')).textContent).toBe(
'cindyMake.personal.errors.checksFailedcindyMake.personal.diagnostic.unavailable',
);
- fireEvent.click(screen.getByRole('button', { name: 'cindyMake.history.actions.build' }));
- await waitFor(() => expect(f.execute).toHaveBeenCalledTimes(2));
- expect(f.execute).toHaveBeenLastCalledWith('aaaa', 'build');
- expect(f.build).not.toHaveBeenCalled();
+ expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.build' })).toBeNull();
+ fireEvent.click(
+ screen.getByRole('button', { name: 'cindyMake.history.regeneratePersonal' }),
+ );
+ await waitFor(() => expect(f.build).toHaveBeenCalledWith());
});
it('shows the actual task build stage while removing mutation controls', async () => {
const building = item({
@@ -254,7 +271,7 @@ describe('Make history controls', () => {
).toBeNull();
expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.end' })).toBeNull();
});
- it('keeps Generate Personal Version as the action on a failed ended record', async () => {
+ it('does not attach personal-version generation to a failed ended record', async () => {
const failed = item({
lifecycle: 'ended',
integration: 'integrated',
@@ -262,9 +279,12 @@ describe('Make history controls', () => {
actions: ['build'],
});
const f = harness([failed]);
- render(<CindyMakeHistoryPanel />);
- fireEvent.click(await screen.findByRole('button', { name: 'cindyMake.history.actions.build' }));
- await waitFor(() => expect(f.execute).toHaveBeenCalledWith('aaaa', 'build'));
+ render(<CindyMakeHistoryPanel hasPersonalVersion />);
+ expect(
+ await screen.findByRole('button', { name: 'cindyMake.history.regeneratePersonal' }),
+ ).toBeTruthy();
+ expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.build' })).toBeNull();
+ expect(f.execute).not.toHaveBeenCalled();
});
it('offers the verified installer fallback when the source cannot produce a managed switchable version', async () => {
const f = harness([]);
@@ -282,56 +302,44 @@ describe('Make history controls', () => {
expect(screen.getByText('cindyMake.history.buildStatus.installerReady')).toBeTruthy();
expect(screen.queryByText('cindyMake.history.buildStatus.ready')).toBeNull();
});
- it('uses one generation action and one failure explanation without integration controls or duplicate navigation', async () => {
- const f = harness();
- render(<CindyMakeHistoryPanel />);
+ it('keeps regeneration global and exposes plain-language removal for an integrated task', async () => {
+ const f = harness([
+ item({
+ integration: 'integrated',
+ actions: ['open', 'continue', 'test', 'build', 'end', 'revert'],
+ canHide: true,
+ needsBuild: true,
+ title: '[aaaa] Blue background',
+ request: 'Blue background',
+ }),
+ ]);
+ render(<CindyMakeHistoryPanel hasPersonalVersion />);
expect(screen.getByRole('combobox', { name: 'cindyMake.history.filterLabel' })).toBeTruthy();
expect((await screen.findByRole('button', { name: /Blue background/ })).className).toContain(
'settings-menu-bg-selected',
);
- const generate = await screen.findByRole('button', {
- name: 'cindyMake.history.actions.build',
- });
- f.set({
- items: [
- item({
- integration: 'integrated',
- actions: ['open', 'continue', 'test', 'build', 'end', 'revert'],
- canHide: true,
- needsBuild: true,
- build: { status: 'failed', error: 'checksFailed', buildId: 'failed-build' },
- title: '[aaaa] Blue background',
- request: 'Blue background',
- }),
- ],
- busy: false,
- canBuild: true,
- build: { status: 'failed', error: 'checksFailed', buildId: 'failed-build' },
- });
- fireEvent.click(generate);
- expect(f.execute).toHaveBeenCalledWith('aaaa', 'build');
- expect((await screen.findByRole('alert')).textContent).toBe(
- 'cindyMake.personal.errors.checksFailedcindyMake.personal.diagnostic.unavailable',
- );
expect(screen.queryByText('Blue background')).toBeNull();
- expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.revert' })).toBeNull();
+ const remove = screen.getByRole('button', { name: 'cindyMake.history.actions.revert' });
expect(
screen.queryByRole('button', { name: 'cindyMake.history.actions.integrate' }),
).toBeNull();
expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.reapply' })).toBeNull();
+ expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.build' })).toBeNull();
expect(screen.queryByRole('button', { name: 'cindyMake.history.actions.open' })).toBeNull();
expect(screen.getByRole('button', { name: 'cindyMake.history.actions.continue' })).toBeTruthy();
expect(screen.getByRole('button', { name: 'cindyMake.test.start' })).toBeTruthy();
- expect(screen.getByRole('button', { name: 'cindyMake.history.actions.build' })).toBeTruthy();
- expect(screen.queryByText(/cindyMake.history.versionPending/)).toBeNull();
- expect(screen.queryByText('cindyMake.history.needsBuild')).toBeNull();
- expect(
- screen.queryByRole('button', { name: 'cindyMake.history.actions.retryBuild' }),
- ).toBeNull();
- await waitFor(() => expect(generate.hasAttribute('disabled')).toBe(false));
- fireEvent.click(generate);
- await waitFor(() => expect(f.execute).toHaveBeenCalledTimes(2));
- expect(f.execute).toHaveBeenLastCalledWith('aaaa', 'build');
+ fireEvent.click(remove);
+ await waitFor(() => expect(f.execute).toHaveBeenCalledWith('aaaa', 'revert'));
+ expect(h.confirm).toHaveBeenCalledWith(
+ expect.objectContaining({
+ title: 'cindyMake.history.actions.revert',
+ description: 'cindyMake.history.revertConfirm',
+ }),
+ );
+ fireEvent.click(
+ screen.getByRole('button', { name: 'cindyMake.history.regeneratePersonal' }),
+ );
+ await waitFor(() => expect(f.build).toHaveBeenCalledWith());
});
it('hands off the selected completion only after Main accepts Continue Editing', async () => {
const f = harness([item({ completionId: 'done-a' })]);
@@ -384,8 +392,8 @@ describe('Make history controls', () => {
expect(h.navigate).toHaveBeenCalledWith('/cc-agent/task-a');
expect(f.execute).not.toHaveBeenCalled();
});
- it('keeps finished history with navigation and cleanup, without technical integration controls', async () => {
- harness([
+ it('keeps finished history removable, navigable and cleanable', async () => {
+ const f = harness([
item({
lifecycle: 'ended',
integration: 'integrated',
@@ -395,14 +403,35 @@ describe('Make history controls', () => {
]);
render(<CindyMakeHistoryPanel />);
await screen.findByRole('button', { name: 'cindyMake.history.actions.open' });
- expect(screen.getByRole('heading', { name: 'cindyMake.history.title · 1' })).toBeTruthy();
- for (const action of ['end', 'test', 'continue', 'integrate', 'revert', 'reapply'])
+ expect(
+ screen.getByRole('heading', {
+ name: 'cindyMake.history.title · cindyMake.history.taskCount',
+ }),
+ ).toBeTruthy();
+ for (const action of ['end', 'test', 'continue', 'integrate', 'reapply', 'build'])
expect(
screen.queryByRole('button', { name: 'cindyMake.history.actions.' + action }),
).toBeNull();
expect(screen.getByRole('button', { name: 'cindyMake.history.actions.open' })).toBeTruthy();
+ fireEvent.click(screen.getByRole('button', { name: 'cindyMake.history.actions.revert' }));
+ await waitFor(() => expect(f.execute).toHaveBeenCalledWith('aaaa', 'revert'));
expect(screen.getByRole('button', { name: 'cindyMake.history.cleanTask' })).toBeTruthy();
});
+ it('offers adding a previously removed task back to the personal version', async () => {
+ const f = harness([
+ item({
+ lifecycle: 'ended',
+ integration: 'reverted',
+ actions: ['open', 'reapply'],
+ }),
+ ]);
+ render(<CindyMakeHistoryPanel />);
+ fireEvent.click(
+ await screen.findByRole('button', { name: 'cindyMake.history.actions.reapply' }),
+ );
+ await waitFor(() => expect(f.execute).toHaveBeenCalledWith('aaaa', 'reapply'));
+ expect(h.confirm).not.toHaveBeenCalled();
+ });
it('opens the dedicated resolution task and does not offer unrelated integration actions during a conflict', async () => {
const f = harness([
item({ conflict: true, resolutionSessionId: 'conflict-task', actions: ['open', 'resolve'] }),
@@ -423,7 +452,11 @@ describe('Make history controls', () => {
await act(async () => fireEvent.click(clean));
await waitFor(() => expect(h.confirm).toHaveBeenCalledOnce());
expect(f.execute).not.toHaveBeenCalled();
- expect(screen.getByRole('heading', { name: 'cindyMake.history.title · 1' })).toBeTruthy();
+ expect(
+ screen.getByRole('heading', {
+ name: 'cindyMake.history.title · cindyMake.history.taskCount',
+ }),
+ ).toBeTruthy();
const confirmation = h.confirm.mock.calls[0][0];
expect(confirmation).toMatchObject({
title: 'cindyMake.history.cleanTitle',
@@ -473,7 +506,9 @@ describe('Make history controls', () => {
await waitFor(() => expect(f.read).toHaveBeenLastCalledWith(remaining ? 'bbbb' : undefined));
expect(screen.queryByRole('button', { name: /Blue background/ })).toBeNull();
expect(
- screen.getByRole('heading', { name: 'cindyMake.history.title · ' + remaining }),
+ screen.getByRole('heading', {
+ name: 'cindyMake.history.title · cindyMake.history.taskCount',
+ }),
).toBeTruthy();
if (remaining) {
expect(screen.getByRole('button', { name: /Next task/ }).getAttribute('aria-pressed')).toBe(
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeMergeNotice.i18n.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeMergeNotice.i18n.test.tsx
index 031ded1a91..ef26aebed4 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeMergeNotice.i18n.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeMergeNotice.i18n.test.tsx
@@ -29,6 +29,37 @@ afterEach(() => {
});
describe('source conflict confirmation translations', () => {
+ it.each(locales)('renders distinct local main errors in %s', async (locale, resource) => {
+ const i18n = createInstance();
+ await i18n.init({
+ lng: locale,
+ fallbackLng: false,
+ resources: { [locale]: { translation: resource } },
+ });
+ const renderError = (error: 'localMain' | 'localMainAhead') => (
+ <MemoryRouter>
+ <I18nextProvider i18n={i18n}>
+ <CindyMakeMergeNotice
+ state={{
+ id: 'merge',
+ status: 'failed',
+ ref: 'v1.2.3',
+ upstreamCommit: 'a'.repeat(40),
+ error,
+ hasWorkspace: false,
+ }}
+ />
+ </I18nextProvider>
+ </MemoryRouter>
+ );
+ const view = render(renderError('localMain'));
+ expect(screen.getByRole('status').textContent).toContain(resource.cindyMake.merge.errors.localMain);
+ view.rerender(renderError('localMainAhead'));
+ expect(screen.getByRole('status').textContent).toContain(resource.cindyMake.merge.errors.localMainAhead);
+ expect(screen.queryByText(resource.cindyMake.merge.errors.localMain)).toBeNull();
+ expect(screen.getByRole('status').textContent).toContain('Cindy Make');
+ expect(screen.getByRole('status').textContent).not.toMatch(/cindyMake[.]|[?]{2,}|�/);
+ });
it.each(locales)(
'opens retained task records in %s without recreating a cleaned workspace',
async (locale, resource) => {
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeSourceDetails.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeSourceDetails.test.tsx
index 2bc7508ccb..09650dbd1a 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeSourceDetails.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeSourceDetails.test.tsx
@@ -48,9 +48,9 @@ afterEach(cleanup);
describe('Cindy Make source summary', () => {
it.each([
[0, 0, '与本地 main 的 SHA 相同'],
- [0, 6, '尚缺本地 main 的 6 条修改记录'],
- [2, 0, '已包含本地 main,另有 2 条个人修改记录'],
- [2, 6, '尚缺本地 main 的 6 条修改记录,另有 2 条个人修改记录'],
+ [0, 6, '尚缺本地 main 中的 6 条修改记录'],
+ [2, 0, '已包含本地 main,个人版源码中另有 2 条修改记录'],
+ [2, 6, '尚缺本地 main 中的 6 条修改记录,个人版源码中另有 2 条修改记录'],
[undefined, undefined, 'SHA 与本地 main 不同,差距未知'],
] as const)(
'summarizes the verified local comparison (%s ahead, %s behind)',
@@ -66,7 +66,7 @@ describe('Cindy Make source summary', () => {
'cindy-personal · 版本状态未确认',
);
expect(screen.getByRole('status').className).not.toContain('--status-success');
- expect(screen.getAllByTitle(commit!).length).toBeGreaterThan(0);
+ expect(screen.queryByTitle(source.commit!)).toBeNull();
expect(screen.getAllByTitle(source.mainCommit!).length).toBeGreaterThan(0);
expect(screen.queryByText(source.baseCommit!.slice(0, 12))).toBeNull();
expect(screen.queryByText(source.currentBranch!)).toBeNull();
@@ -122,7 +122,7 @@ describe('Cindy Make source summary', () => {
expect(screen.getAllByTitle(source.mainCommit!)).toHaveLength(1);
expect(screen.getByText('本地 main').className).toContain('--status-success');
expect(hash.closest('dd')?.querySelector('svg')).toBeNull();
- expect(screen.getByText('与线上 main 一致,落后 0 条修改记录')).toBeTruthy();
+ expect(screen.getByText('与GitHub main 一致,落后 0 条修改记录')).toBeTruthy();
expect(screen.queryByText(/main 落后/)).toBeNull();
});
@@ -148,7 +148,8 @@ describe('Cindy Make source summary', () => {
).toBeTruthy();
expect(screen.getByText(copy.personalChanges.replace('{{ahead}}', '1'))).toBeTruthy();
expect(screen.getByText('cindy-personal').closest('dt')).toBe(status.closest('dt'));
- expect(screen.getByTitle(source.commit!).closest('dd')).toBe(
+ expect(screen.queryByTitle(source.commit!)).toBeNull();
+ expect(screen.getByText(copy.personalChanges.replace('{{ahead}}', '1')).closest('dd')).toBe(
status.closest('dt')?.nextElementSibling,
);
expect(container.textContent).not.toMatch(/cindyMake[.]|[{][{]|[?][?]|�/);
@@ -292,13 +293,14 @@ describe('Cindy Make source summary', () => {
expect(labels[0].textContent).toBe(locales[locale].cindyMake.overview.localMain);
expect(within(labels[1]).getByText(locales[locale].cindyMake.overview.personal)).toBeTruthy();
expect(within(labels[1]).getByRole('status')).toBeTruthy();
+ expect(labels[1].parentElement?.className).toContain('items-center');
+ expect(labels[1].nextElementSibling?.className).toContain('items-center');
expect(container.querySelectorAll('dl > div > dd')).toHaveLength(2);
expect(
screen.getByText(locales[locale].cindyMake.source.details.latest.dev).closest('dd'),
).toBe(screen.getByTitle(source.mainCommit!).closest('dd'));
- for (const commit of [source.commit!, source.mainCommit!]) {
- expect(screen.getByText(commit.slice(0, 12)).title).toBe(commit);
- }
+ expect(screen.getByText(source.mainCommit!.slice(0, 12)).title).toBe(source.mainCommit);
+ expect(screen.queryByText(source.commit!.slice(0, 12))).toBeNull();
expect(screen.getByText('cindy-personal').closest('dt')).toBe(labels[1]);
expect(screen.queryByText('personal')).toBeNull();
for (const hidden of [
@@ -322,7 +324,11 @@ describe('Cindy Make source summary', () => {
behind: 23,
});
expect(screen.getByRole('status', { name: 'cindy-personal · 有更新' })).toBeTruthy();
- expect(screen.getByText('尚缺本地 main 的 2 条修改记录,另有 3 条个人修改记录')).toBeTruthy();
+ expect(
+ screen.getByText(
+ '尚缺本地 main 中的 2 条修改记录,个人版源码中另有 3 条修改记录',
+ ),
+ ).toBeTruthy();
const online = screen.getByText('e'.repeat(12)).closest('dd')!;
expect(online.textContent).toContain('本地 main 落后 23 条修改记录');
expect(within(online).queryByText(/领先 2/)).toBeNull();
@@ -344,7 +350,7 @@ describe('Cindy Make source summary', () => {
expect(screen.getByText('本地 main').nextElementSibling?.firstElementChild?.textContent).toBe(
'未读取',
);
- expect(screen.getByText(source.commit!.slice(0, 12))).toBeTruthy();
+ expect(screen.queryByText(source.commit!.slice(0, 12))).toBeNull();
expect(screen.queryByText(source.baseCommit!.slice(0, 12))).toBeNull();
expect(screen.queryByText(source.mainRemoteCommit!.slice(0, 12))).toBeNull();
expect(screen.queryByText(/与线上 main 一致/)).toBeNull();
@@ -358,7 +364,7 @@ describe('Cindy Make source summary', () => {
commit: source.mainCommit!,
});
expect(screen.getByRole('status', { name: 'cindy-personal · 已是最新' })).toBeTruthy();
- expect(screen.getByText('与线上 main 一致,落后 0 条修改记录')).toBeTruthy();
+ expect(screen.getByText('与GitHub main 一致,落后 0 条修改记录')).toBeTruthy();
});
it('does not claim different hashes match because of inconsistent zero counts', async () => {
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTaskCard.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTaskCard.test.tsx
index 23b0efb97c..e85334d725 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTaskCard.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTaskCard.test.tsx
@@ -84,11 +84,19 @@ describe('Cindy Make preparation card', () => {
);
it('shows all stages and real dependency counts without a fake overall percentage', () => {
render(<CindyMakeTaskCard report={report} request="original request" />);
- expect(screen.getAllByRole('listitem')).toHaveLength(5);
+ expect(screen.getAllByRole('listitem')).toHaveLength(6);
expect(screen.getByRole('status').textContent).toBe('cindyMake.code.phases.dependencies');
expect(screen.getByText(/dependencyProgress/).textContent).toContain('"downloaded":7');
expect(screen.queryByRole('progressbar')).toBeNull();
});
+ it('shows personal source updating as its own preparation step', () => {
+ render(
+ <CindyMakeTaskCard
+ report={{ ...report, task: { ...report.task!, phase: 'updatingSource' } }}
+ />,
+ );
+ expect(screen.getByRole('status').textContent).toBe('cindyMake.code.phases.updatingSource');
+ });
it('shows startup and script activity even when no package counts have arrived', () => {
const initial = { ...report, task: { ...report.task!, dependencies: undefined } };
const view = render(<CindyMakeTaskCard report={initial} />);
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.i18n.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.i18n.test.tsx
new file mode 100644
index 0000000000..2cf9c7cb3c
--- /dev/null
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.i18n.test.tsx
@@ -0,0 +1,105 @@
+// @vitest-environment jsdom
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { createInstance } from 'i18next';
+import { I18nextProvider, initReactI18next } from 'react-i18next';
+import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
+import en from '@/i18n/locales/en/common.json';
+import zhCN from '@/i18n/locales/zh-CN/common.json';
+import zhTW from '@/i18n/locales/zh-TW/common.json';
+import ja from '@/i18n/locales/ja/common.json';
+import ko from '@/i18n/locales/ko/common.json';
+import type { CindyMakeCompletionMeta } from '../../../../shared/cindyMakeSession';
+import type { CindyVersionsState } from '../../../../shared/cindyVersions';
+import { CindyMakeTestCard } from '../CindyMakeTestCard';
+
+vi.mock('@/components/ui/confirm-dialog-provider', () => ({
+ useConfirmDialog: () => ({ confirm: async () => false }),
+}));
+vi.mock('@/lib/makerChatStore', () => ({ makerChatStore: { updateSystemCardData: vi.fn() } }));
+vi.mock('@/features/device-link/stickySessionOrigin', () => ({
+ getStickySessionDeviceId: () => undefined,
+}));
+
+const cases = [
+ { locale: 'en', resource: en },
+ { locale: 'zh-CN', resource: zhCN },
+ { locale: 'zh-TW', resource: zhTW },
+ { locale: 'ja', resource: ja },
+ { locale: 'ko', resource: ko },
+];
+
+beforeEach(() => setDataOwnerGeneration('test-card-real-locales'));
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+describe.each(cases)('Cindy Make completion actions in $locale', ({ locale, resource }) => {
+ it.each([
+ { currentId: 'original', personalUpdateAvailable: false, hint: 'readyHint', disabled: false },
+ { currentId: 'personal', personalUpdateAvailable: true, hint: 'updateHint', disabled: false },
+ { currentId: 'personal', personalUpdateAvailable: false, hint: 'usingHint', disabled: true },
+ ] as const)(
+ 'shows $hint for $currentId and targets the single personal version',
+ async ({ currentId, personalUpdateAvailable, hint, disabled }) => {
+ const state: CindyVersionsState = {
+ currentId,
+ selectedId: currentId,
+ switching: false,
+ personalUpdateAvailable,
+ versions: [
+ { id: 'original', kind: 'original', available: true, compatible: true },
+ { id: 'personal', kind: 'personal', available: true, compatible: true },
+ ],
+ };
+ const meta: CindyMakeCompletionMeta = {
+ reportedAt: 123,
+ commit: 'a'.repeat(40),
+ changedFiles: 2,
+ lastAction: 'build',
+ personal: { status: 'ready', versionId: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' },
+ };
+ const switchVersion = vi.fn().mockResolvedValue({ ...state, switching: true });
+ const testAction = vi.fn().mockResolvedValue(meta);
+ vi.stubGlobal('electronAPI', {
+ cindyMakeTest: testAction,
+ getCindyVersions: async () => state,
+ actCindyVersion: switchVersion,
+ });
+ const i18n = createInstance();
+ await i18n.use(initReactI18next).init({
+ lng: locale,
+ fallbackLng: false,
+ defaultNS: 'common',
+ resources: { [locale]: { common: resource } },
+ interpolation: { escapeValue: false },
+ });
+ const { container } = render(
+ <I18nextProvider i18n={i18n}>
+ <CindyMakeTestCard sessionId="session" completionId="completion" meta={meta} />
+ </I18nextProvider>,
+ );
+ const label = disabled
+ ? resource.cindyMake.versions.using
+ : personalUpdateAvailable
+ ? resource.cindyMake.versions.updatePersonal
+ : resource.cindyMake.versions.switchPersonal;
+ const button = await screen.findByRole('button', { name: label });
+ await waitFor(() => expect((button as HTMLButtonElement).disabled).toBe(disabled));
+ expect(screen.getByText(resource.cindyMake.versions[hint])).toBeTruthy();
+ for (const otherHint of ['readyHint', 'updateHint', 'usingHint'] as const) {
+ if (otherHint !== hint)
+ expect(screen.queryByText(resource.cindyMake.versions[otherHint])).toBeNull();
+ }
+ expect(container.textContent).not.toMatch(/cindyMake\.|\{\{|\?{2,}|\uFFFD/);
+ fireEvent.click(button);
+ if (disabled) expect(switchVersion).not.toHaveBeenCalled();
+ else
+ await waitFor(() =>
+ expect(switchVersion).toHaveBeenCalledExactlyOnceWith('switch', 'personal'),
+ );
+ expect(testAction).toHaveBeenCalledExactlyOnceWith('session', 'completion', 'status');
+ },
+ );
+});
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx
index 463297ce14..911fd63e5a 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx
@@ -44,6 +44,29 @@ afterEach(() => {
});
describe('completion card in the input area', () => {
+ it.each(['conflict', 'resolving', 'failed'] as const)(
+ 'blocks generation while source update is %s and unlocks after resolution',
+ async (status) => {
+ h.merge = {
+ id: 'source-update',
+ status,
+ ref: 'main',
+ upstreamCommit: 'a'.repeat(40),
+ hasWorkspace: true,
+ };
+ const { rerender } = view();
+ await waitFor(() => expect(h.api).toHaveBeenCalledOnce());
+ const generate = screen.getByRole('button', { name: 'cindyMake.personal.generate' });
+ expect(generate.hasAttribute('disabled')).toBe(true);
+ fireEvent.click(generate);
+ expect(h.api).toHaveBeenCalledExactlyOnceWith('session', 'completion', 'status');
+ h.merge = { ...h.merge, status: 'merged', hasWorkspace: false };
+ rerender(<CindyMakeTestCard sessionId="session" completionId="completion" meta={meta} />);
+ expect(generate.hasAttribute('disabled')).toBe(false);
+ fireEvent.click(generate);
+ await waitFor(() => expect(h.api).toHaveBeenCalledWith('session', 'completion', 'build'));
+ },
+ );
it.each(['matching', 'other-task', 'other-round', 'other-account'])(
'does not restore a legacy merge button in the build progress area: %s',
async (binding) => {
@@ -569,7 +592,32 @@ describe('completion card in the input area', () => {
.disabled,
).toBe(false);
});
- it('replaces the generation action with the shared version switch for a runnable snapshot', async () => {
+ it('offers personal regeneration after a personal version is ready', async () => {
+ render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{
+ ...meta,
+ lastAction: 'build',
+ personal: { status: 'ready', versionId: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' },
+ }}
+ />,
+ );
+ const regenerate = await screen.findByRole('button', {
+ name: 'cindyMake.history.regeneratePersonal',
+ });
+ fireEvent.click(regenerate);
+ await waitFor(() => expect(h.api).toHaveBeenCalledWith('session', 'completion', 'build'));
+ });
+ it('uses the single personal version from an old completion instead of switching to its historical build', async () => {
+ h.merge = {
+ id: 'source-update',
+ status: 'conflict',
+ ref: 'main',
+ upstreamCommit: 'a'.repeat(40),
+ hasWorkspace: true,
+ };
const switchVersion = vi.fn().mockResolvedValue({
currentId: 'original',
selectedId: 'original',
@@ -581,7 +629,7 @@ describe('completion card in the input area', () => {
getCindyVersions: vi.fn().mockResolvedValue({
currentId: 'original',
selectedId: 'original',
- versions: [],
+ versions: [{ id: 'personal', kind: 'personal', available: true, compatible: true }],
switching: false,
}),
actCindyVersion: switchVersion,
@@ -600,9 +648,78 @@ describe('completion card in the input area', () => {
fireEvent.click(
await screen.findByRole('button', { name: 'cindyMake.versions.switchPersonal' }),
);
- await waitFor(() =>
- expect(switchVersion).toHaveBeenCalledWith('switch', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'),
- );
+ await waitFor(() => expect(switchVersion).toHaveBeenCalledWith('switch', 'personal'));
expect(h.api.mock.calls.some(([, , action]) => action === 'open-build')).toBe(false);
});
+ it('offers regeneration after the personal version was deleted instead of reviving a historical build', async () => {
+ vi.stubGlobal('electronAPI', {
+ cindyMakeTest: h.api,
+ getCindyVersions: vi.fn().mockResolvedValue({
+ currentId: 'original',
+ selectedId: 'original',
+ switching: false,
+ versions: [{ id: 'original', kind: 'original', available: true, compatible: true }],
+ }),
+ actCindyVersion: vi.fn(),
+ });
+ render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{
+ ...meta,
+ lastAction: 'build',
+ personal: { status: 'ready', versionId: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' },
+ }}
+ />,
+ );
+ const generate = await screen.findByRole('button', { name: 'cindyMake.personal.generate' });
+ expect(screen.getByText('cindyMake.versions.empty')).toBeTruthy();
+ fireEvent.click(generate);
+ await waitFor(() => expect(h.api).toHaveBeenCalledWith('session', 'completion', 'build'));
+ expect(window.electronAPI.actCindyVersion).not.toHaveBeenCalled();
+ });
+ it('allows a new completion to generate after the previous personal build is already in use', async () => {
+ vi.stubGlobal('electronAPI', {
+ cindyMakeTest: h.api,
+ getCindyVersions: vi.fn().mockResolvedValue({
+ currentId: 'personal',
+ selectedId: 'personal',
+ personalUpdateAvailable: false,
+ switching: false,
+ versions: [{ id: 'personal', kind: 'personal', available: true, compatible: true }],
+ }),
+ actCindyVersion: vi.fn(),
+ });
+ const { rerender } = render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{
+ ...meta,
+ lastAction: 'build',
+ personal: { status: 'ready', versionId: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' },
+ }}
+ />,
+ );
+ expect(
+ (
+ (await screen.findByRole('button', {
+ name: 'cindyMake.versions.using',
+ })) as HTMLButtonElement
+ ).disabled,
+ ).toBe(true);
+ rerender(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="next-completion"
+ meta={{ ...meta, commit: 'b'.repeat(40) }}
+ />,
+ );
+ const generate = screen.getByRole('button', { name: 'cindyMake.personal.generate' });
+ expect((generate as HTMLButtonElement).disabled).toBe(false);
+ fireEvent.click(generate);
+ await waitFor(() => expect(h.api).toHaveBeenCalledWith('session', 'next-completion', 'build'));
+ expect(window.electronAPI.actCindyVersion).not.toHaveBeenCalled();
+ });
});
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestRecovery.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestRecovery.test.tsx
deleted file mode 100644
index 7c7dc18efd..0000000000
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestRecovery.test.tsx
+++ /dev/null
@@ -1,133 +0,0 @@
-// @vitest-environment jsdom
-import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
-import { useState } from 'react';
-import { CindyMakeTestCard } from '../CindyMakeTestCard';
-import { getCindyMakeTestRecovery } from '@/lib/cindyMakeComposer';
-import type { ChatMessage } from '@/lib/makerChatStore';
-
-vi.mock('react-i18next', () => ({
- useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'en' } }),
-}));
-vi.mock('@/lib/makerChatStore', () => ({ makerChatStore: { updateSystemCardData: vi.fn() } }));
-vi.mock('@/features/device-link/stickySessionOrigin', () => ({
- getStickySessionDeviceId: () => undefined,
-}));
-beforeEach(() => setDataOwnerGeneration('make-owner'));
-afterEach(cleanup);
-const button = () => screen.getByRole('button', { name: 'cindyMake.test.resume.action' });
-const card = (onCheck: () => Promise<boolean | void>, key = 'task') => (
- <CindyMakeTestCard key={key} sessionId={key} recovery={{ onCheck, onContinue: vi.fn() }} />
-);
-
-describe('Cindy Make resume checks', () => {
- it('sends one request during repeated clicks and permits retry after rejection', async () => {
- let finish!: (accepted: boolean) => void;
- const resume = vi.fn(
- () =>
- new Promise<boolean>((resolve) => {
- finish = resolve;
- }),
- );
- render(card(resume));
- fireEvent.click(button());
- fireEvent.click(button());
- expect(resume).toHaveBeenCalledOnce();
- expect((button() as HTMLButtonElement).disabled).toBe(true);
- await act(async () => finish(false));
- expect(screen.getByRole('alert').textContent).toBe('cindyMake.test.resume.failed');
- fireEvent.click(button());
- expect(resume).toHaveBeenCalledTimes(2);
- await act(async () => finish(true));
- expect(screen.queryByRole('alert')).toBeNull();
- });
-
- it('shows send failures without losing the recovery action', async () => {
- const resume = vi.fn().mockRejectedValueOnce(new Error('send failed')).mockResolvedValue(true);
- render(card(resume));
- fireEvent.click(button());
- await waitFor(() => expect(screen.getByRole('alert')).toBeDefined());
- fireEvent.click(button());
- await waitFor(() => expect(screen.queryByRole('alert')).toBeNull());
- expect(resume).toHaveBeenCalledTimes(2);
- });
-
- it('does not dispatch an old card after an account switch', () => {
- const resume = vi.fn().mockResolvedValue(true);
- render(card(resume));
- setDataOwnerGeneration('another-owner');
- fireEvent.click(button());
- expect(resume).not.toHaveBeenCalled();
- });
-
- it('does not put a late failure onto the next task', async () => {
- let finish!: (accepted: boolean) => void;
- const resume = () =>
- new Promise<boolean>((resolve) => {
- finish = resolve;
- });
- const view = render(card(resume, 'old-task'));
- fireEvent.click(button());
- view.rerender(card(async () => true, 'new-task'));
- await act(async () => finish(false));
- expect(screen.queryByRole('alert')).toBeNull();
- expect((button() as HTMLButtonElement).disabled).toBe(false);
- });
-});
-
-describe('recovery uses the existing input-area flow card', () => {
- const session = {
- id: 'make-task',
- source: 'cindy-make' as const,
- status: 'active' as const,
- clearedAt: null,
- };
- const reply = (clientId: string): ChatMessage => ({
- clientId,
- role: 'assistant',
- content: 'Done',
- turnCompleted: true,
- });
- function Composer({ messages }: { messages: ChatMessage[] }) {
- const [dismissedId, dismiss] = useState<string>();
- const recoveryId = getCindyMakeTestRecovery({
- session,
- messages,
- busy: false,
- historyLoaded: true,
- dismissedId,
- });
- return recoveryId ? (
- <CindyMakeTestCard
- sessionId={session.id}
- recovery={{
- onCheck: async () => true,
- onContinue: () => dismiss(recoveryId),
- }}
- />
- ) : (
- <textarea aria-label="editor" />
- );
- }
-
- it('replaces input, releases it for editing, and restores the same card after the next reply', () => {
- const view = render(<Composer messages={[reply('first')]} />);
- const region = screen.getByRole('region', { name: 'cindyMake.test.title' });
- expect(region.className).toContain('w-full');
- expect(region.className).toContain('bg-[var(--chat-input-bg)]');
- expect(screen.getAllByRole('region')).toHaveLength(1);
- expect(screen.queryByRole('textbox')).toBeNull();
- // No stale snapshot or successful verification is claimed in recovery.
- expect(screen.queryByText(/changedFiles|commit/)).toBeNull();
- expect(screen.queryByRole('button', { name: 'cindyMake.test.start' })).toBeNull();
- fireEvent.click(screen.getByRole('button', { name: 'cindyMake.test.continue' }));
- expect(screen.getByRole('textbox')).toBeDefined();
- expect(screen.queryByRole('region')).toBeNull();
- view.rerender(<Composer messages={[reply('first')]} />);
- expect(screen.getByRole('textbox')).toBeDefined();
- view.rerender(<Composer messages={[reply('first'), reply('second')]} />);
- expect(screen.queryByRole('textbox')).toBeNull();
- expect(screen.getByRole('region', { name: 'cindyMake.test.title' })).toBeDefined();
- });
-});
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.i18n.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.i18n.test.tsx
index 82658d49fa..5e9ea7fe61 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.i18n.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.i18n.test.tsx
@@ -23,6 +23,7 @@ const cases = [
title: 'My Versions',
switchLabel: 'Switch and Restart',
remove: 'Delete Version',
+ update: 'Restart to Update',
},
{
locale: 'zh-CN',
@@ -30,6 +31,7 @@ const cases = [
title: '我的版本',
switchLabel: '切换并重启',
remove: '删除版本',
+ update: '重启更新',
},
{
locale: 'zh-TW',
@@ -37,6 +39,7 @@ const cases = [
title: '我的版本',
switchLabel: '切換並重新啟動',
remove: '刪除版本',
+ update: '重新啟動以更新',
},
{
locale: 'ja',
@@ -44,6 +47,7 @@ const cases = [
title: 'マイバージョン',
switchLabel: '切り替えて再起動',
remove: 'バージョンを削除',
+ update: '再起動して更新',
},
{
locale: 'ko',
@@ -51,6 +55,7 @@ const cases = [
title: '내 버전',
switchLabel: '전환 후 다시 시작',
remove: '버전 삭제',
+ update: '다시 시작하여 업데이트',
},
];
@@ -77,6 +82,48 @@ afterEach(() => {
});
describe('Cindy Make versions with real translations', () => {
+ it.each(cases)(
+ 'renders the personal update action in $locale',
+ async ({ locale, resource, update }) => {
+ const state: CindyVersionsState = {
+ currentId: 'personal',
+ selectedId: 'personal',
+ switching: false,
+ personalUpdateAvailable: true,
+ versions: [
+ { id: 'original', kind: 'original', available: true, compatible: true },
+ {
+ id: 'personal',
+ kind: 'personal',
+ title: 'Legacy task title',
+ available: true,
+ compatible: true,
+ },
+ ],
+ };
+ vi.stubGlobal('electronAPI', {
+ getCindyVersions: async () => state,
+ actCindyVersion: async () => state,
+ });
+ const i18n = createInstance();
+ await i18n.use(initReactI18next).init({
+ lng: locale,
+ fallbackLng: false,
+ defaultNS: 'common',
+ resources: { [locale]: { common: resource } },
+ interpolation: { escapeValue: false },
+ });
+ const { container } = render(
+ <I18nextProvider i18n={i18n}>
+ <CindyMakeVersionsPanel />
+ </I18nextProvider>,
+ );
+ expect(await screen.findByRole('button', { name: update })).toBeTruthy();
+ expect(screen.getAllByText(resource.cindyMake.versions.personal)).toHaveLength(1);
+ expect(screen.queryByText('Legacy task title')).toBeNull();
+ expect(container.textContent).not.toMatch(/cindyMake\.|\{\{|\?{2,}|\uFFFD/);
+ },
+ );
it.each(cases)(
'renders $locale labels without missing translations or damaged characters',
async ({ locale, resource, switchLabel, remove }) => {
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.test.tsx
index c536fae53c..b1d131dd17 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeVersionsPanel.test.tsx
@@ -44,10 +44,17 @@ afterEach(() => {
vi.unstubAllGlobals();
});
describe('Cindy Make local versions', () => {
+ it('reports the current version inventory to its parent', async () => {
+ const onState = vi.fn();
+ render(<CindyMakeVersionsPanel onState={onState} />);
+ await waitFor(() => expect(onState).toHaveBeenLastCalledWith(versions));
+ });
+
it('leads with the running version and reveals alternatives only on request', async () => {
h.get.mockResolvedValue({ ...versions, currentId: 'personal', selectedId: 'personal' });
render(<CindyMakeVersionsPanel />);
- expect(await screen.findByText('Blue background')).toBeTruthy();
+ expect(await screen.findByText('cindyMake.versions.personal')).toBeTruthy();
+ expect(screen.queryByText('Blue background')).toBeNull();
expect(screen.queryByText('cindyMake.versions.original')).toBeNull();
expect(screen.queryByRole('button', { name: 'cindyMake.versions.using' })).toBeNull();
const toggle = screen.getByRole('button', { name: 'cindyMake.overview.switchVersion' });
@@ -62,7 +69,8 @@ describe('Cindy Make local versions', () => {
fireEvent.click(
await screen.findByRole('button', { name: 'cindyMake.overview.switchVersion' }),
);
- await screen.findByText('Blue background');
+ await screen.findByText('cindyMake.versions.personal');
+ expect(screen.queryByText('Blue background')).toBeNull();
expect(screen.getByText('cindyMake.versions.original')).toBeDefined();
expect(
screen.getByText('cindyMake.versions.development · 0.1.99 · aaaaaaaaaaaa'),
@@ -94,10 +102,76 @@ describe('Cindy Make local versions', () => {
fireEvent.click(
await screen.findByRole('button', { name: 'cindyMake.overview.switchVersion' }),
);
- await screen.findByText('cindyMake.versions.incompatible');
- expect(
- (screen.getByRole('button', { name: 'cindyMake.versions.switch' }) as HTMLButtonElement)
- .disabled,
- ).toBe(true);
+ const switchButton = await screen.findByRole('button', {
+ name: 'cindyMake.versions.incompatible',
+ });
+ expect(screen.getAllByText('cindyMake.versions.incompatible')).toHaveLength(2);
+ expect((switchButton as HTMLButtonElement).disabled).toBe(true);
+ });
+ it('updates the same personal version without adding a second personal row', async () => {
+ h.get.mockResolvedValue({
+ ...versions,
+ currentId: 'personal',
+ selectedId: 'personal',
+ personalUpdateAvailable: true,
+ currentVersion: { ...versions.versions[1], commit: 'b'.repeat(40) },
+ versions: [versions.versions[0], { ...versions.versions[1], commit: 'c'.repeat(40) }],
+ });
+ render(<CindyMakeVersionsPanel />);
+ const update = await screen.findByRole('button', { name: 'cindyMake.versions.updatePersonal' });
+ expect(screen.getByText('bbbbbbbbbbbb')).toBeTruthy();
+ expect(screen.getByText('cccccccccccc')).toBeTruthy();
+ expect(screen.getAllByText('cindyMake.versions.personal')).toHaveLength(1);
+ fireEvent.click(screen.getByRole('button', { name: 'cindyMake.overview.switchVersion' }));
+ expect(screen.getAllByRole('listitem')).toHaveLength(1);
+ expect(screen.getByText('cindyMake.versions.original')).toBeTruthy();
+ expect(screen.queryByRole('button', { name: 'cindyMake.versions.remove' })).toBeNull();
+ fireEvent.click(update);
+ await waitFor(() => expect(h.act).toHaveBeenCalledWith('switch', 'personal'));
+ });
+ it('explains why an updated personal application cannot replace the running one', async () => {
+ h.get.mockResolvedValue({
+ ...versions,
+ currentId: 'personal',
+ selectedId: 'personal',
+ personalUpdateAvailable: true,
+ currentVersion: versions.versions[1],
+ versions: [versions.versions[0], { ...versions.versions[1], compatible: false }],
+ });
+ render(<CindyMakeVersionsPanel />);
+ const update = await screen.findByRole('button', {
+ name: 'cindyMake.versions.incompatible',
+ });
+ expect(screen.getAllByText('cindyMake.versions.incompatible')).toHaveLength(2);
+ expect((update as HTMLButtonElement).disabled).toBe(true);
+ });
+ it('shows unavailable as the update action state when a personal version cannot be read', async () => {
+ h.get.mockResolvedValue({
+ ...versions,
+ currentId: 'personal',
+ selectedId: 'personal',
+ personalUpdateAvailable: true,
+ versions: [versions.versions[0], { ...versions.versions[1], available: false }],
+ });
+ render(<CindyMakeVersionsPanel />);
+ const update = await screen.findByRole('button', {
+ name: 'cindyMake.versions.unavailable',
+ });
+ expect((update as HTMLButtonElement).disabled).toBe(true);
+ expect(update.getAttribute('title')).toBe('cindyMake.versions.unavailable');
+ });
+ it('shows the busy reason while another Make operation blocks switching', async () => {
+ h.get.mockResolvedValue({
+ ...versions,
+ currentId: 'personal',
+ selectedId: 'personal',
+ personalUpdateAvailable: true,
+ });
+ render(<CindyMakeVersionsPanel busy />);
+ const update = await screen.findByRole('button', {
+ name: 'cindyMake.versions.errors.busy',
+ });
+ expect((update as HTMLButtonElement).disabled).toBe(true);
+ expect(update.getAttribute('title')).toBe('cindyMake.versions.errors.busy');
});
});
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/useCindyMakeEditing.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/useCindyMakeEditing.test.tsx
index f2fd27e3eb..5fd7725a8b 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/useCindyMakeEditing.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/useCindyMakeEditing.test.tsx
@@ -23,18 +23,19 @@ function Visit({ messages, enabled = true }: { messages: ChatMessage[]; enabled?
messages,
busy: false,
historyLoaded: true,
- dismissedId,
});
return (
<>
- <output data-testid="composer">{recovery ?? 'input'}</output>
+ <output data-testid="composer">input</output>
+ <output data-testid="actions">{recovery}</output>
+ <output data-testid="editing">{dismissedId}</output>
<output data-testid="navigation">{JSON.stringify(location.state)}</output>
<button onClick={() => continueEditing(recovery!)}>continue</button>
</>
);
}
-it('opens input on a History continuation, consumes the intent, and recovers the next turn', async () => {
+it('consumes History continuation while keeping input and optional actions available', async () => {
const view = (messages: ChatMessage[]) => (
<MemoryRouter
initialEntries={[
@@ -58,17 +59,20 @@ it('opens input on a History continuation, consumes the intent, and recovers the
{ clientId: 'next', role: 'assistant', content: 'Done', turnCompleted: true },
];
result.rerender(view(messages));
- expect(screen.getByTestId('composer').textContent).toBe('next');
+ expect(screen.getByTestId('composer').textContent).toBe('input');
+ expect(screen.getByTestId('actions').textContent).toBe('next');
fireEvent.click(screen.getByText('continue'));
expect(screen.getByTestId('composer').textContent).toBe('input');
- // A new visit has no stored intent: unfinished testing is recoverable again.
+ expect(screen.getByTestId('editing').textContent).toBe('next');
+ // Reopening preserves input without needing a navigation intent.
result.unmount();
render(
<MemoryRouter initialEntries={['/cc-agent/task']}>
<Visit messages={[completion]} />
</MemoryRouter>,
);
- expect(screen.getByTestId('composer').textContent).toBe('completion');
+ expect(screen.getByTestId('composer').textContent).toBe('input');
+ expect(screen.getByTestId('actions').textContent).toBe('completion');
});
it.each([
@@ -89,6 +93,6 @@ it.each([
<Visit messages={[completion]} enabled={enabled} />
</MemoryRouter>,
);
- expect(screen.getByTestId('composer').textContent).toBe('completion');
+ expect(screen.getByTestId('editing').textContent).toBe('');
},
);
diff --git a/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx b/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx
index 57cb86cad0..18bba51f4d 100644
--- a/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx
@@ -1,5 +1,5 @@
import { useEffect, useId, useRef, useState } from 'react';
-import { FolderOpen, Download, Plus, Trash2, Wrench } from 'lucide-react';
+import { FolderOpen, Download, Trash2, Wrench } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Switch } from '@/components/ui/switch';
@@ -13,7 +13,10 @@ import { CindyMakeCreateDialog } from '@/components/cindy-make/CindyMakeCreateDi
import { CindyMakeDependencyProgress } from '@/components/cindy-make/CindyMakeDependencyProgress';
import { CindyMakeHistoryPanel } from '@/components/cindy-make/CindyMakeHistoryPanel';
import { CindyMakeVersionsPanel } from '@/components/cindy-make/CindyMakeVersionsPanel';
-import { CindyMakeMergeNotice } from '@/components/cindy-make/CindyMakeMergeNotice';
+import {
+ CindyMakeMergeActions,
+ CindyMakeMergeNotice,
+} from '@/components/cindy-make/CindyMakeMergeNotice';
import { useCindyMakeMergeResolution } from '@/components/cindy-make/useCindyMakeMergeResolution';
import {
getDataOwnerGeneration,
@@ -21,6 +24,7 @@ import {
} from '@/contexts/dataOwnerGeneration';
import type { CindyMakeMergeState } from '../../../shared/cindyMakeMerge';
import type { CindyMakeHistoryState } from '../../../shared/cindyMakeHistory';
+import type { CindyVersionsState } from '../../../shared/cindyVersions';
import { useCindyMakeState } from '@/lib/cindyMakeState';
import { cancelMakeDoctor, startMakeDoctor } from '@/lib/cindyMakeDoctor';
import { useCindyMakeSettings } from '@/lib/cindyMakeSettings';
@@ -38,10 +42,14 @@ export function CindyMakeSection() {
const tabId = useId();
const tabButtons = useRef<Array<HTMLButtonElement | null>>([]);
const { forceManagedTools, setForceManagedTools } = useCindyMakeSettings();
+ const [syncLatestBeforeBuild, setSyncLatestBeforeBuild] = useState(false);
+ const [syncLatestSettingLoaded, setSyncLatestSettingLoaded] = useState(false);
+ const [syncLatestSettingPending, setSyncLatestSettingPending] = useState(false);
const [createOpen, setCreateOpen] = useState(false);
const [report, setReport] = useState<MakeDoctorReport>();
const makeState = useCindyMakeState();
const [historyState, setHistoryState] = useState<CindyMakeHistoryState>();
+ const [versionsState, setVersionsState] = useState<CindyVersionsState>();
const [dismissedPreparationId, setDismissedPreparationId] = useState<string>();
const [trackedPreparationId, setTrackedPreparationId] = useState<string>();
const [checkVersion, setCheckVersion] = useState(0);
@@ -120,6 +128,25 @@ export function CindyMakeSection() {
useEffect(() => {
void window.electronAPI.getCindyMakeSourceStatus?.().catch(() => undefined);
}, []);
+ useEffect(() => {
+ const load = window.electronAPI.getCindyMakeSettings;
+ if (!load) {
+ setSyncLatestSettingLoaded(true);
+ return;
+ }
+ let current = true;
+ void load()
+ .then((settings) => {
+ if (current) setSyncLatestBeforeBuild(settings.syncLatestBeforeBuild);
+ })
+ .catch(() => undefined)
+ .finally(() => {
+ if (current) setSyncLatestSettingLoaded(true);
+ });
+ return () => {
+ current = false;
+ };
+ }, []);
const previousSourceStatus = useRef(sourceStatus?.status);
useEffect(() => {
const previous = previousSourceStatus.current;
@@ -343,13 +370,44 @@ export function CindyMakeSection() {
hidden={activeTab !== 'versions'}
>
<div className="flex flex-col gap-[18px]">
+ <div className="flex items-start justify-between gap-4 rounded-xl border border-[var(--settings-theme-card-border)] bg-[var(--settings-theme-card-bg)] p-5">
+ <div className="min-w-0">
+ <p className="text-13 font-medium text-[var(--settings-section-sublabel)]">
+ {t('settings.cindyMake.syncBeforeBuild.title')}
+ </p>
+ <p className="mt-1 text-12 leading-[1.45] text-[var(--settings-section-desc)]">
+ {t('settings.cindyMake.syncBeforeBuild.description')}
+ </p>
+ </div>
+ <Switch
+ checked={syncLatestBeforeBuild}
+ disabled={!syncLatestSettingLoaded || syncLatestSettingPending}
+ onCheckedChange={(checked) => {
+ if (syncLatestSettingPending) return;
+ const previous = syncLatestBeforeBuild;
+ setSyncLatestBeforeBuild(checked);
+ setSyncLatestSettingPending(true);
+ void window.electronAPI
+ .setCindyMakeSyncLatestBeforeBuild(checked)
+ .then((settings) => {
+ setSyncLatestBeforeBuild(settings.syncLatestBeforeBuild);
+ })
+ .catch(() => {
+ setSyncLatestBeforeBuild(previous);
+ toast.error(t('settings.cindyMake.syncBeforeBuild.saveFailed'));
+ })
+ .finally(() => setSyncLatestSettingPending(false));
+ }}
+ aria-label={t('settings.cindyMake.syncBeforeBuild.ariaLabel')}
+ />
+ </div>
<Button className="self-start" onClick={() => setCreateOpen(true)}>
- <Plus size={14} aria-hidden="true" />
{t('settings.cindyMake.create.title')}
</Button>
<CindyMakeVersionsPanel
active={activeTab === 'versions'}
- busy={historyState?.busy}
+ busy={historyState?.activeWork ?? historyState?.busy}
+ onState={setVersionsState}
refreshKey={
historyState?.build?.status === 'ready'
? String(
@@ -397,7 +455,13 @@ export function CindyMakeSection() {
}}
/>
</CindyMakeVersionsPanel>
- <CindyMakeHistoryPanel active={activeTab === 'versions'} onState={setHistoryState} />
+ <CindyMakeHistoryPanel
+ active={activeTab === 'versions'}
+ hasPersonalVersion={versionsState?.versions.some(
+ (version) => version.kind === 'personal',
+ )}
+ onState={setHistoryState}
+ />
</div>
</div>
</div>
@@ -475,20 +539,24 @@ function CindyMakeSourceStatusCard({
/>
)}
</div>
- {status?.status === 'ready' && onPrepare && (
- <Tip text={t('cindyMake.merge.updateHint')}>
- <Button
- variant="secondary"
- className="ml-auto gap-2"
- disabled={preparing || mergeBlocked}
- loading={updating}
- onClick={onPrepare}
- >
- {!updating && <Download size={14} aria-hidden />}
- <span className="relative top-px">{t('cindyMake.merge.getLatest')}</span>
- </Button>
- </Tip>
- )}
+ <div className="ml-auto flex flex-wrap justify-end gap-2">
+ <CindyMakeMergeActions state={displayMerge} busy={updating}>
+ {status?.status === 'ready' && onPrepare && (
+ <Tip text={t('cindyMake.merge.updateHint')}>
+ <Button
+ variant="secondary"
+ className="gap-2"
+ disabled={preparing || mergeBlocked}
+ loading={updating}
+ onClick={onPrepare}
+ >
+ {!updating && <Download size={14} aria-hidden />}
+ <span className="relative top-px">{t('cindyMake.merge.getLatest')}</span>
+ </Button>
+ </Tip>
+ )}
+ </CindyMakeMergeActions>
+ </div>
</div>
{status && (
<div className="border-t border-[var(--border-default)] pt-3">
@@ -536,7 +604,7 @@ function CindyMakeSourceStatusCard({
)}
</div>
{displayMerge ? (
- <CindyMakeMergeNotice state={displayMerge} busy={updating} />
+ <CindyMakeMergeNotice state={displayMerge} showActions={false} />
) : status && (preparing || updating || status.status !== 'ready') ? (
<div className="flex flex-wrap items-center justify-between gap-3 border-t border-[var(--border-default)] px-4 py-3">
<div className={`min-w-0 flex-1 space-y-1 text-13 ${statusClass}`} role="status">
diff --git a/apps/desktop/src/renderer/components/settings/__tests__/CindyMakeSection.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/CindyMakeSection.test.tsx
index a169079b47..1a19573ad8 100644
--- a/apps/desktop/src/renderer/components/settings/__tests__/CindyMakeSection.test.tsx
+++ b/apps/desktop/src/renderer/components/settings/__tests__/CindyMakeSection.test.tsx
@@ -45,13 +45,17 @@ type Api = Parameters<typeof startMakeDoctor>[1];
type Listener = Parameters<NonNullable<Api>['onDesktopCommandTriggered']>[0];
type Result = Awaited<ReturnType<NonNullable<Api>['executeDesktopCommand']>>;
-function harness() {
+function harness(history: { busy: boolean; activeWork?: boolean } = { busy: false }) {
const listeners = new Set<Listener>();
const sourceListeners = new Set<(status: MakeSourceStatus) => void>();
const stateListeners = new Set<(state: CindyMakeGlobalState) => void>();
let globalState: CindyMakeGlobalState = {};
const runs = new Map<string, (result: Result) => void>();
const api = {
+ getCindyMakeSettings: vi.fn(async () => ({ syncLatestBeforeBuild: false })),
+ setCindyMakeSyncLatestBeforeBuild: vi.fn(async (enabled: boolean) => ({
+ syncLatestBeforeBuild: enabled,
+ })),
cindyMakeMerge: vi.fn(
async (_request: CindyMakeMergeRequest): Promise<CindyMakeMergeState | undefined> =>
undefined,
@@ -91,7 +95,7 @@ function harness() {
};
vi.stubGlobal('electronAPI', {
getCindyMakeHistory: async () => ({
- busy: false,
+ ...history,
canBuild: false,
items: Object.values(globalState.tasks ?? {})
.filter((report) => report.task)
@@ -111,6 +115,8 @@ function harness() {
actions: ['open'],
})),
}),
+ getCindyMakeSettings: api.getCindyMakeSettings,
+ setCindyMakeSyncLatestBeforeBuild: api.setCindyMakeSyncLatestBeforeBuild,
cindyMakeMerge: api.cindyMakeMerge,
maker: api,
getCindyMakeState: api.getCindyMakeState,
@@ -223,14 +229,18 @@ describe('Settings > Cindy Make', () => {
{ name: 'settings.cindyMake.source.title' },
),
).toBeTruthy();
- expect(screen.queryByRole('switch')).toBeNull();
+ const syncBeforeBuild = await screen.findByRole('switch', {
+ name: 'settings.cindyMake.syncBeforeBuild.ariaLabel',
+ });
+ expect(syncBeforeBuild.getAttribute('aria-checked')).toBe('false');
expect(await screen.findByText('0.1.99')).toBeTruthy();
- expect(
+ const create =
within(screen.getByRole('tabpanel', { name: 'settings.cindyMake.tabs.versions' })).getByRole(
'button',
{ name: 'settings.cindyMake.create.title' },
- ),
- ).toBeTruthy();
+ );
+ expect(create).toBeTruthy();
+ expect(create.querySelector('svg')).toBeNull();
const source = screen.getByRole('region', { name: 'settings.cindyMake.source.title' });
expect(
source.parentElement?.contains(
@@ -263,6 +273,20 @@ describe('Settings > Cindy Make', () => {
await waitFor(() => expect(getVersions).toHaveBeenCalledTimes(3));
expect(h.starts()).toHaveLength(1);
});
+ it('persists the opt-in build-time source sync and updates the switch immediately', async () => {
+ const h = harness();
+ renderVersions(<CindyMakeSection />);
+ const toggle = await screen.findByRole('switch', {
+ name: 'settings.cindyMake.syncBeforeBuild.ariaLabel',
+ });
+
+ fireEvent.click(toggle);
+
+ expect(toggle.getAttribute('aria-checked')).toBe('true');
+ await waitFor(() =>
+ expect(h.api.setCindyMakeSyncLatestBeforeBuild).toHaveBeenCalledWith(true),
+ );
+ });
it('keeps background preparation, expansion and task search intact while switching tabs', async () => {
const h = harness();
renderVersions(
@@ -399,9 +423,10 @@ describe('Settings > Cindy Make', () => {
);
const card = screen.getByRole('region', { name: 'settings.cindyMake.source.title' });
const expectVersionsVisible = (region: HTMLElement) => {
- for (const commit of ['a', 'b', 'c']) {
+ for (const commit of ['a', 'c']) {
expect(within(region).getByText(commit.repeat(12)).title).toBe(commit.repeat(40));
}
+ expect(within(region).queryByText('b'.repeat(12))).toBeNull();
expect(within(region).getByText('cindyMake.source.details.latest.dev')).toBeTruthy();
expect(within(region).getByText(/cindyMake.source.details.latest.behind/)).toBeTruthy();
};
@@ -522,16 +547,16 @@ describe('Settings > Cindy Make', () => {
await waitFor(() =>
expect(within(card).getByRole('status').textContent).toBe('cindyMake.merge.status.fetching'),
);
- expect(within(card).queryByText('cindyMake.merge.status.merged')).toBeNull();
- expect(within(card).queryByText('settings.cindyMake.source.status.ready')).toBeNull();
+ expect(within(card).queryByText('cindyMake.merge.status.merged')).toBeNull();
+ expect(within(card).queryByText('settings.cindyMake.source.status.ready')).toBeNull();
for (const status of ['fetching', 'merging', 'checking', 'conflict', 'resolving'] as const) {
await h.pushState({
source,
upstreamMerge: { ...merge, status, hasWorkspace: true },
});
- expect(within(card).getByText('b'.repeat(12))).toBeTruthy();
expect(within(card).getByText('c'.repeat(12))).toBeTruthy();
+ expect(within(card).queryByText('b'.repeat(12))).toBeNull();
expect(within(card).getByRole('status').textContent).toBe(`cindyMake.merge.status.${status}`);
expect(within(card).queryByText('cindyMake.overview.comparison.mainAhead')).toBeNull();
}
@@ -539,7 +564,7 @@ describe('Settings > Cindy Make', () => {
source: { ...source, commit: 'd'.repeat(40), mainCommit: 'd'.repeat(40), personalBehind: 0 },
upstreamMerge: { ...merge, status: 'merged' },
});
- expect(within(card).getAllByText('d'.repeat(12))).toHaveLength(2);
+ expect(within(card).getAllByText('d'.repeat(12))).toHaveLength(1);
expect(within(card).queryByText('b'.repeat(12))).toBeNull();
expect(within(card).queryByText('c'.repeat(12))).toBeNull();
expect(within(card).getByRole('status').getAttribute('aria-label')).toBe(
@@ -668,7 +693,11 @@ describe('Settings > Cindy Make', () => {
confirmed ? '/cc-agent/merge-task' : '/',
);
if (!confirmed) {
- expect(update.hasAttribute('disabled')).toBe(false);
+ expect(
+ screen
+ .getByRole('button', { name: 'cindyMake.merge.getLatest' })
+ .hasAttribute('disabled'),
+ ).toBe(false);
expect(screen.queryByText('cindyMake.merge.status.conflict')).toBeNull();
expect(screen.queryByRole('button', { name: 'cindyMake.merge.resolve' })).toBeNull();
}
@@ -703,6 +732,49 @@ describe('Settings > Cindy Make', () => {
expect(h.api.cindyMakeMerge).toHaveBeenCalledTimes(1);
},
);
+ it('allows version switching with retained conflicts but disables it during active work', async () => {
+ const history = { busy: true, activeWork: false };
+ const h = harness(history);
+ const versions = {
+ currentId: 'personal',
+ selectedId: 'personal',
+ switching: false,
+ versions: [
+ { id: 'original', kind: 'original', available: true, compatible: true },
+ { id: 'personal', kind: 'personal', available: true, compatible: true },
+ ],
+ };
+ const switchVersion = vi.fn(async () => versions);
+ vi.stubGlobal('electronAPI', {
+ ...window.electronAPI,
+ getCindyVersions: async () => versions,
+ actCindyVersion: switchVersion,
+ });
+ renderVersions(<CindyMakeSection />);
+ const source: MakeSourceStatus = { status: 'ready', path: '/managed/source', ref: 'main' };
+ const conflict: CindyMakeMergeState = {
+ id: 'update',
+ status: 'conflict',
+ ref: 'main',
+ upstreamCommit: 'a'.repeat(40),
+ hasWorkspace: true,
+ };
+ await h.pushState({ source, upstreamMerge: conflict });
+ fireEvent.click(
+ await screen.findByRole('button', { name: 'cindyMake.overview.switchVersion' }),
+ );
+ const button = screen.getByRole('button', { name: 'cindyMake.versions.switch' });
+ expect(button.hasAttribute('disabled')).toBe(false);
+ fireEvent.click(button);
+ await waitFor(() => expect(switchVersion).toHaveBeenCalledWith('switch', 'original'));
+ history.activeWork = true;
+ await h.pushState({ source, upstreamMerge: { ...conflict } });
+ await waitFor(() => expect(button.hasAttribute('disabled')).toBe(true));
+ history.activeWork = false;
+ await h.pushState({ source, upstreamMerge: { ...conflict } });
+ await waitFor(() => expect(button.hasAttribute('disabled')).toBe(false));
+ expect(screen.getByRole('button', { name: 'cindyMake.merge.resolve' })).toBeTruthy();
+ });
it('offers conflict resolution only after a conflict and creates a task only on confirmation', async () => {
const h = harness();
const source: MakeSourceStatus = { status: 'ready', path: '/managed/source', ref: 'main' };
@@ -723,9 +795,16 @@ describe('Settings > Cindy Make', () => {
expect(within(card).getByRole('status').textContent).toBe('cindyMake.merge.status.conflict');
expect(within(card).queryByText('settings.cindyMake.source.status.ready')).toBeNull();
expect(h.api.cindyMakeMerge).not.toHaveBeenCalled();
+ expect(screen.queryByRole('button', { name: 'cindyMake.merge.getLatest' })).toBeNull();
+ const resolve = screen.getByRole('button', { name: 'cindyMake.merge.resolve' });
+ expect(resolve.hasAttribute('disabled')).toBe(false);
+ expect(within(card).getAllByRole('button', { name: 'cindyMake.merge.resolve' })).toHaveLength(
+ 1,
+ );
expect(
- screen.getByRole('button', { name: 'cindyMake.merge.getLatest' }).hasAttribute('disabled'),
- ).toBe(true);
+ resolve.compareDocumentPosition(within(card).getByText('settings.cindyMake.source.path')) &
+ Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
await h.pushSource({ ...source, status: 'failed', error: 'dirty' });
expect(within(card).getByRole('status').textContent).toBe('cindyMake.merge.status.conflict');
expect(
@@ -757,8 +836,7 @@ describe('Settings > Cindy Make', () => {
};
renderVersions(<CindyMakeSection />);
await h.pushState({ source, upstreamMerge: merge });
- const update = screen.getByRole('button', { name: 'cindyMake.merge.getLatest' });
- expect(update.hasAttribute('disabled')).toBe(true);
+ expect(screen.queryByRole('button', { name: 'cindyMake.merge.getLatest' })).toBeNull();
expect(screen.queryByRole('button', { name: 'cindyMake.merge.resolve' })).toBeNull();
await h.pushSource({ ...source, status: 'failed', error: 'dirty' });
const cancelled: CindyMakeMergeState = {
@@ -802,7 +880,11 @@ describe('Settings > Cindy Make', () => {
);
expect(await screen.findByRole('button', { name: 'cindyMake.merge.openTask' })).toBeTruthy();
fireEvent.click(screen.getByRole('tab', { name: 'settings.cindyMake.tabs.versions' }));
- expect(screen.getByRole('heading', { name: 'cindyMake.history.title · 0' })).toBeTruthy();
+ expect(
+ screen.getByRole('heading', {
+ name: 'cindyMake.history.title · cindyMake.history.taskCount',
+ }),
+ ).toBeTruthy();
const report: MakeDoctorReport = {
runId: 'make-run',
platform: 'win32',
@@ -819,7 +901,9 @@ describe('Settings > Cindy Make', () => {
await h.pushState({ upstreamMerge: merge, tasks: { 'make-run': report } });
const panel = screen.getByRole('region', { name: 'cindyMake.history.title' });
expect(
- await within(panel).findByRole('heading', { name: 'cindyMake.history.title · 1' }),
+ await within(panel).findByRole('heading', {
+ name: 'cindyMake.history.title · cindyMake.history.taskCount',
+ }),
).toBeTruthy();
expect(within(panel).getByRole('button', { name: /Personal feature/ })).toBeTruthy();
expect(within(panel).queryByText('cindyMake.merge.taskTitle')).toBeNull();
@@ -1122,6 +1206,7 @@ describe('Settings > Cindy Make', () => {
h.api.getCindyMakeSourceStatus = vi.fn(async () => source);
h.api.openCindyMakeSourceDir = vi.fn(async () => ({ success: true }));
vi.stubGlobal('electronAPI', {
+ ...window.electronAPI,
cindyMakeMerge: h.api.cindyMakeMerge,
maker: h.api,
getCindyMakeState: h.api.getCindyMakeState,
@@ -1135,7 +1220,7 @@ describe('Settings > Cindy Make', () => {
renderVersions(<CindyMakeSection />);
await waitFor(() => expect(screen.getByText('c'.repeat(12))).toBeTruthy());
const sourceCard = screen.getByRole('region', { name: 'settings.cindyMake.source.title' });
- expect(within(sourceCard).getByText('0123456789ab')).toBeTruthy();
+ expect(within(sourceCard).queryByText('0123456789ab')).toBeNull();
expect(within(sourceCard).getByText(source.path)).toBeTruthy();
expect(within(sourceCard).queryByText(source.baseCommit!.slice(0, 12))).toBeNull();
const openButton = within(sourceCard).getByRole('button', {
@@ -1255,6 +1340,7 @@ describe('Settings > Cindy Make', () => {
};
h.api.getCindyMakeSourceStatus = vi.fn(async () => source);
vi.stubGlobal('electronAPI', {
+ ...window.electronAPI,
cindyMakeMerge: h.api.cindyMakeMerge,
maker: h.api,
getCindyMakeState: h.api.getCindyMakeState,
@@ -1281,6 +1367,7 @@ describe('Settings > Cindy Make', () => {
};
h.api.getCindyMakeSourceStatus = vi.fn(async () => source);
vi.stubGlobal('electronAPI', {
+ ...window.electronAPI,
cindyMakeMerge: h.api.cindyMakeMerge,
maker: h.api,
getCindyMakeState: h.api.getCindyMakeState,
@@ -1303,6 +1390,7 @@ describe('Settings > Cindy Make', () => {
const ready: MakeSourceStatus = { ...source, status: 'ready', commit: '0123456789abcdef' };
h.api.getCindyMakeSourceStatus = vi.fn(async () => ready);
vi.stubGlobal('electronAPI', {
+ ...window.electronAPI,
cindyMakeMerge: h.api.cindyMakeMerge,
maker: h.api,
getCindyMakeState: h.api.getCindyMakeState,
@@ -1337,6 +1425,7 @@ describe('Settings > Cindy Make', () => {
};
h.api.getCindyMakeSourceStatus = vi.fn(async () => source);
vi.stubGlobal('electronAPI', {
+ ...window.electronAPI,
cindyMakeMerge: h.api.cindyMakeMerge,
maker: h.api,
getCindyMakeState: h.api.getCindyMakeState,
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
index df1f9951fd..da5855bd3d 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
@@ -69,6 +69,7 @@ import {
getCindyMakePreparation,
} from '@/lib/cindyMakeComposer';
import { CindyMakeTestCard } from '@/components/cindy-make/CindyMakeTestCard';
+import { CindyMakeEditingActions } from '@/components/cindy-make/CindyMakeEditingActions';
import { useCindyMakeEditing } from '@/components/cindy-make/useCindyMakeEditing';
import { useCindyMakeState } from '@/lib/cindyMakeState';
import { resolveLearnDesktopCommandFeedback } from '@/features/learn/desktopCommandFeedback';
@@ -1819,11 +1820,10 @@ export function CCAgentSessionView({
messages,
busy: isAgentBusy,
historyLoaded,
- dismissedId: cindyMakeEditing.dismissedId,
})
: null;
const cindyMakeInputLocked = Boolean(
- cindyMakeComposerPhase || cindyMakePendingTest || cindyMakeRecoveryId,
+ cindyMakeComposerPhase || cindyMakePendingTest,
);
useEffect(() => {
if (!sessionId || !isOrcaLeadSessionView || !historyLoaded) return;
@@ -3441,16 +3441,10 @@ export function CCAgentSessionView({
slashCommandRanges?: SlashCommandRange[];
onRemoteOptimisticFailure?: (clientId: string, error?: unknown) => void;
onDeferredAccepted?: () => void;
- cindyMakeRecovery?: boolean;
},
) => {
if (readOnly) return false;
- if (
- cindyMakeComposerPhase ||
- cindyMakePendingTest ||
- (cindyMakeRecoveryId && !opts?.cindyMakeRecovery)
- )
- return false;
+ if (cindyMakeComposerPhase || cindyMakePendingTest) return false;
const deliveryMode = opts?.deliveryMode ?? 'queue';
const originalMessage = message;
const navigationRequestVersion =
@@ -3735,7 +3729,6 @@ export function CCAgentSessionView({
sessionHandoffPreparing,
cindyMakeComposerPhase,
cindyMakePendingTest,
- cindyMakeRecoveryId,
],
);
@@ -5263,27 +5256,15 @@ export function CCAgentSessionView({
barWidth={inputWidth}
getContentWidth={getMessageWidth}
/>
- ) : cindyMakeRecoveryId && session ? (
- <CindyMakeTestCard
- key={`${session.id}:${cindyMakeRecoveryId}`}
- sessionId={session.id}
- recovery={{
- onContinue: () =>
- cindyMakeEditing.continueEditing(cindyMakeRecoveryId),
- onCheck: () =>
- handleSend(
- t('cindyMake.test.resume.request'),
- session.model,
- session.effort as Effort,
- session.permissionMode as PermissionMode,
- undefined,
- undefined,
- { cindyMakeRecovery: true },
- ),
- }}
- />
) : (
<ChatInput
+ topSlot={cindyMakeRecoveryId && session ? (
+ <CindyMakeEditingActions
+ key={`${session.id}:${cindyMakeRecoveryId}`}
+ sessionId={session.id}
+ messageId={cindyMakeRecoveryId}
+ />
+ ) : undefined}
onSend={handleSend}
onBeforeVoiceInputStart={handleBeforeVoiceInputStart}
sessionId={sessionId}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 672cb403a4..332003bfa0 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -5789,6 +5789,12 @@
},
"description": "The card below checks this computer and lets you install missing portable tools. Native compiler prerequisites show an official installation guide.",
"checking": "Checking environment…",
+ "syncBeforeBuild": {
+ "title": "Sync latest source before building",
+ "description": "When enabled, each personal-version build first syncs the latest official source for the current channel. Off by default.",
+ "ariaLabel": "Sync latest source before building",
+ "saveFailed": "Could not save the pre-build sync setting. Try again."
+ },
"forceManaged": {
"title": "Test Installation: Ignore System Tools",
"description": "Development builds only. Check portable tools in Cindy-managed copies and simulate missing Windows compiler tools. This switch only rechecks the environment; it does not start installation.",
@@ -12954,7 +12960,7 @@
"details": {
"unknown": "Not read",
"latest": {
- "dev": "Online main",
+ "dev": "GitHub main",
"beta": "Latest Beta",
"release": "Latest Release",
"same": "Matches {{target}}, 0 change records behind",
@@ -12981,6 +12987,7 @@
"waiting": "Waiting for project preparation",
"environment": "Preparing the environment",
"source": "Preparing personal project source",
+ "updatingSource": "Updating personal version source",
"workspace": "Creating the task branch and worktree",
"dependencies": "Installing task dependencies",
"starting": "Starting your request",
@@ -13028,13 +13035,13 @@
"updateAvailable": "Update Available",
"unverified": "Version Status Unverified",
"upToDateDescription": "Personal source includes all updates from {{target}}",
- "personalChanges": "Personal change records: {{ahead}}"
+ "personalChanges": "Personal source has {{ahead}} additional change records"
},
"comparison": {
"same": "Same SHA as local main",
- "personalAhead": "Includes local main · personal change records: {{ahead}}",
- "mainAhead": "Local main change records not yet included: {{behind}}",
- "diverged": "Local main change records not yet included: {{behind}} · personal change records: {{ahead}}",
+ "personalAhead": "Includes local main · personal source has {{ahead}} additional change records",
+ "mainAhead": "Local main has {{behind}} change records not yet included",
+ "diverged": "Local main has {{behind}} change records not yet included · personal source has {{ahead}} additional change records",
"different": "Different SHA from local main; difference unknown",
"unknown": "Difference from local main unknown"
},
@@ -13048,6 +13055,7 @@
"development": "Development Environment",
"current": "Current",
"using": "In Use",
+ "updatePersonal": "Restart to Update",
"switch": "Switch and Restart",
"switchPersonal": "Switch to This Personal Version",
"remove": "Delete Version",
@@ -13057,6 +13065,8 @@
"unavailable": "The application files for this version are unavailable.",
"incompatible": "This version is incompatible with the current data. Rebuild it from the current original version.",
"readyHint": "Your personal version is ready. Switching restarts Cindy and keeps your accounts, settings and tasks.",
+ "updateHint": "New personal version content is ready. Restart to use it while keeping your accounts, settings and tasks.",
+ "usingHint": "You are using the latest personal version.",
"errors": {
"busy": "Tasks, tests or builds are still running. Finish them before switching or deleting a version.",
"incompatible": "The data structures differ. Rebuild your personal version from the current original version before switching.",
@@ -13093,6 +13103,7 @@
},
"status": {
"waiting": "Waiting to Build Personal Version…",
+ "syncing": "Syncing Latest Source…",
"merging": "Merging Changes…",
"checking": "Checking Personal Version…",
"packaging": "Packaging Personal Version…",
@@ -13107,6 +13118,7 @@
"cleaning-merge": "Clean up merge files",
"environment": "Prepare build environment",
"original": "Check current version",
+ "syncing": "Sync latest source",
"merging": "Merge changes",
"checking-dependencies": "Install build dependencies",
"checking-tests": "Run automated tests",
@@ -13123,6 +13135,7 @@
"changed": "The task directory or code has changed. Finish editing before building again.",
"environment": "Build tools are not ready. Check the Cindy Make environment and retry.",
"missingShell": "Automated checks require Git Bash. Install Git for Windows and retry.",
+ "sourceSyncFailed": "The latest source could not be synced, so packaging did not start. Check the network or resolve the sync conflict, then retry.",
"checksFailed": "The merged code did not pass checks. Continue editing before building again.",
"conflict": "These changes conflict with the current personal version. Continue editing to resolve the conflict.",
"baselineChanged": "The personal version changed during the build. Build again to include the latest changes.",
@@ -13177,6 +13190,7 @@
},
"history": {
"title": "Make history",
+ "taskCount": "Tasks: {{count}}",
"batch": {
"make": "Make Personal Version",
"selected": "Build {{count}} Selected Changes",
@@ -13190,6 +13204,7 @@
"restartTest": "Restart Isolated Version"
},
"build": "Generate personal version",
+ "regeneratePersonal": "Rebuild personal version",
"buildDescription": "Generate a new version from the current personal source. Changes not yet integrated are excluded.",
"building": "Generating personal version…",
"stop": "Stop making",
@@ -13200,6 +13215,7 @@
"stopping": "Stopping…",
"progress": {
"waiting": "Waiting to start",
+ "syncing": "Syncing latest source",
"merging": "Merging changes",
"checking": "Running checks",
"packaging": "Packaging personal version",
@@ -13214,7 +13230,7 @@
"busy": "Another making operation or check is running. Try again when it finishes.",
"checking": "This making record is still being checked. Try again shortly."
},
- "counts": "{{total}} total · {{pending}} pending integration · {{integrated}} integrated",
+ "counts": "{{total}} make tasks · {{pending}} pending integration · {{integrated}} integrated",
"filterLabel": "Filter make history",
"mergeTaskTitle": "Resolve Integration Conflicts",
"revertTaskTitle": "Resolve Undo Integration Conflicts",
@@ -13247,7 +13263,7 @@
"cleanWorkspace": "Any remaining task branch and worktree will be removed. Uncommitted changes will be lost.",
"cleanKeep": "Changes already integrated into your personal version and generated app versions will be kept.",
"endConfirm": "End this build and remove its working directory? Make history and retained changes will remain available.",
- "revertConfirm": "Undo the changes from this build in the personal source? Other builds and generated applications will be kept.",
+ "revertConfirm": "Remove this build's changes from the personal version? A new reverse change will record the removal without rewriting history. Other builds and generated applications will be kept.",
"lifecycle": {
"preparing": "Preparing",
"running": "Making changes",
@@ -13270,8 +13286,8 @@
"continue": "Continue editing",
"test": "Launch isolated test build",
"integrate": "Integrate into personal version",
- "revert": "Undo integration",
- "reapply": "Reapply integration",
+ "revert": "Remove from personal version",
+ "reapply": "Add back to personal version",
"resolve": "Resolve conflicts",
"retry": "Retry",
"build": "Generate personal version",
@@ -13325,7 +13341,8 @@
"errors": {
"busy": "Another operation is running. Wait and retry.",
"dirty": "The source has uncommitted changes. Save them before retrying.",
- "localMain": "The main branch has local commits. Check them before updating.",
+ "localMain": "The local main branch in the Cindy Make source has diverged from the target version. Review the differences before syncing.",
+ "localMainAhead": "The local main branch in the Cindy Make source is ahead of the target version and cannot be moved back directly. Check the sync target.",
"unavailable": "The source or operation record is unavailable. Refresh and retry.",
"gitFailed": "Git could not finish the operation. Please retry.",
"baselineChanged": "The personal source has changed. Retry using its latest state.",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 2b3e6b1020..19571d2855 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -5787,6 +5787,12 @@
},
"description": "下のカードで本機の環境を確認し、不足するポータブルツールをインストールできます。ネイティブなコンパイラが不足している場合は公式の案内を表示します。",
"checking": "環境を確認中…",
+ "syncBeforeBuild": {
+ "title": "ビルド前に最新のソースを同期",
+ "description": "オンにすると、個人版を生成または再生成する前に、現在のチャンネルの最新公式ソースを個人版へ同期します。既定ではオフです。",
+ "ariaLabel": "ビルド前に最新のソースを同期",
+ "saveFailed": "ビルド前の同期設定を保存できませんでした。もう一度お試しください。"
+ },
"forceManaged": {
"title": "インストールテスト:システムのツールを無視",
"description": "開発版のみ。ポータブルツールは Cindy 管理のコピーを確認し、Windows のコンパイラが不足した状態を再現します。切り替えは再確認のみで、インストールは開始しません。",
@@ -12937,7 +12943,7 @@
"details": {
"unknown": "未取得",
"latest": {
- "dev": "オンラインの main",
+ "dev": "GitHub main",
"beta": "最新の beta",
"release": "最新の正式版",
"same": "{{target}} と一致、変更履歴の遅れは 0 件",
@@ -12964,6 +12970,7 @@
"waiting": "プロジェクトの準備を待っています",
"environment": "環境を準備しています",
"source": "個人用プロジェクトのソースを準備しています",
+ "updatingSource": "個人版のソースを更新しています",
"workspace": "タスクのブランチと作業ディレクトリを作成しています",
"dependencies": "タスクの依存関係をインストールしています",
"starting": "タスクを自動で開始しています",
@@ -13011,13 +13018,13 @@
"updateAvailable": "更新あり",
"unverified": "バージョン状態は未確認",
"upToDateDescription": "個人版のコードには{{target}}の更新がすべて含まれています",
- "personalChanges": "個人版の変更履歴が {{ahead}} 件追加"
+ "personalChanges": "個人版ソースに変更履歴が {{ahead}} 件追加"
},
"comparison": {
"same": "ローカル main と同じ SHA",
- "personalAhead": "ローカル main を含み、個人版の変更履歴が {{ahead}} 件追加",
+ "personalAhead": "ローカル main を含み、個人版ソースに変更履歴が {{ahead}} 件追加",
"mainAhead": "ローカル main の変更履歴が {{behind}} 件未反映",
- "diverged": "ローカル main の変更履歴が {{behind}} 件未反映、個人版の変更履歴が {{ahead}} 件追加",
+ "diverged": "ローカル main の変更履歴が {{behind}} 件未反映、個人版ソースに変更履歴が {{ahead}} 件追加",
"different": "ローカル main と SHA が異なり、差分は不明",
"unknown": "ローカル main との差分は不明"
},
@@ -13031,6 +13038,7 @@
"development": "開発環境",
"current": "現在使用中",
"using": "使用中",
+ "updatePersonal": "再起動して更新",
"switch": "切り替えて再起動",
"switchPersonal": "この個人版に切り替える",
"remove": "バージョンを削除",
@@ -13040,6 +13048,8 @@
"unavailable": "このバージョンのアプリファイルを利用できません。",
"incompatible": "現在のデータと互換性がありません。現在のオリジナル版から再度ビルドしてください。",
"readyHint": "個人版の準備ができました。切り替えると Cindy が再起動し、アカウント、設定、タスクを引き継ぎます。",
+ "updateHint": "個人版に新しい内容があります。再起動すると、アカウント、設定、タスクを引き継いで最新版を使用できます。",
+ "usingHint": "最新の個人版を使用しています。",
"errors": {
"busy": "タスク、テスト、ビルドが実行中です。終了してから切り替えまたは削除してください。",
"incompatible": "データ構造が異なります。現在のオリジナル版から個人版を再度ビルドしてください。",
@@ -13076,6 +13086,7 @@
},
"status": {
"waiting": "個人版のビルド待ち…",
+ "syncing": "最新のソースを同期中…",
"merging": "変更をマージ中…",
"checking": "個人版を確認中…",
"packaging": "個人版をパッケージ化中…",
@@ -13090,6 +13101,7 @@
"cleaning-merge": "マージ用ファイルを削除",
"environment": "ビルド環境を準備",
"original": "現在のバージョンを確認",
+ "syncing": "最新のソースを同期",
"merging": "変更を統合",
"checking-dependencies": "ビルドの依存関係をインストール",
"checking-tests": "自動テストを実行",
@@ -13106,6 +13118,7 @@
"changed": "作業ディレクトリまたはコードが変更されています。編集を完了してから再度ビルドしてください。",
"environment": "ビルドツールの準備ができていません。Cindy Make の環境を確認し、再試行してください。",
"missingShell": "自動チェックには Git Bash が必要です。Git for Windows をインストールして再試行してください。",
+ "sourceSyncFailed": "最新のソースを同期できなかったため、パッケージ化を開始しませんでした。ネットワークを確認するか同期の競合を解決してから、再試行してください。",
"checksFailed": "マージ後のコードがチェックに通りませんでした。編集を続けてから再度ビルドしてください。",
"conflict": "現在の個人版と変更が競合しています。編集を続けて競合を解決してください。",
"baselineChanged": "ビルド中に個人版が更新されました。最新の変更を含めるため、再度ビルドしてください。",
@@ -13160,6 +13173,7 @@
},
"history": {
"title": "制作履歴",
+ "taskCount": "{{count}} 件のタスク",
"batch": {
"make": "個人版を作成",
"selected": "選択した {{count}} 件で作成",
@@ -13173,6 +13187,7 @@
"restartTest": "隔離版を再起動"
},
"build": "個人版を生成",
+ "regeneratePersonal": "個人版を再生成",
"buildDescription": "現在の個人版ソースから新しいバージョンを生成します。未取り込みの過去の変更は含まれません。",
"building": "個人版を生成中…",
"stop": "制作を停止",
@@ -13183,6 +13198,7 @@
"stopping": "停止中…",
"progress": {
"waiting": "開始を待機中",
+ "syncing": "最新のソースを同期中",
"merging": "変更を統合中",
"checking": "チェックを実行中",
"packaging": "個人版をパッケージ中",
@@ -13197,7 +13213,7 @@
"busy": "別の制作またはチェックが実行中です。完了後に再試行してください。",
"checking": "この制作記録を確認中です。しばらくしてから再試行してください。"
},
- "counts": "合計 {{total}} 件 · 未取り込み {{pending}} 件 · 取り込み済み {{integrated}} 件",
+ "counts": "制作タスク {{total}} 件 · 取り込み待ち {{pending}} 件 · 取り込み済み {{integrated}} 件",
"filterLabel": "制作履歴を絞り込む",
"mergeTaskTitle": "取り込み時の競合を解決",
"revertTaskTitle": "取り込み取り消し時の競合を解決",
@@ -13230,7 +13246,7 @@
"cleanWorkspace": "残っている制作ブランチと作業ディレクトリを削除します。未コミットの変更は失われます。",
"cleanKeep": "個人版に取り込まれた変更と生成済みのアプリバージョンは保持されます。",
"endConfirm": "この制作を終了し、作業ディレクトリを削除しますか?制作履歴と保存済みの変更は保持されます。",
- "revertConfirm": "この制作から個人ソースに取り込んだ変更を取り消しますか?他の制作と生成済みアプリは保持されます。",
+ "revertConfirm": "この制作の変更を個人版から削除しますか?履歴を書き換えず、新しい逆方向の変更として記録します。他の制作と生成済みアプリは保持されます。",
"lifecycle": {
"preparing": "準備中",
"running": "変更中",
@@ -13253,8 +13269,8 @@
"continue": "編集を続ける",
"test": "隔離テスト版を起動",
"integrate": "個人版に取り込む",
- "revert": "取り込みを取り消す",
- "reapply": "再度取り込む",
+ "revert": "個人版から削除",
+ "reapply": "個人版に再追加",
"resolve": "競合を解決",
"retry": "再試行",
"build": "個人版を生成",
@@ -13306,7 +13322,8 @@
"errors": {
"busy": "別の操作が実行中です。しばらくしてから再試行してください。",
"dirty": "ソースに未コミットの変更があります。保存してから再試行してください。",
- "localMain": "main ブランチにローカルコミットがあります。確認してから更新してください。",
+ "localMain": "Cindy Make ソース内のローカル main と対象バージョンの履歴が分岐しています。差分を確認してから同期してください。",
+ "localMainAhead": "Cindy Make ソース内のローカル main は対象バージョンより先に進んでいるため、直接戻せません。同期対象を確認してください。",
"unavailable": "ソースまたは操作記録を利用できません。更新して再試行してください。",
"gitFailed": "Git の操作を完了できませんでした。再試行してください。",
"baselineChanged": "個人ソースが変更されました。最新の状態で再試行してください。",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 443710597e..1a0bb05a22 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -5787,6 +5787,12 @@
},
"description": "아래 카드에서 이 컴퓨터의 환경을 확인하고 필요한 휴대용 도구를 설치할 수 있습니다. 네이티브 컴파일 도구가 없으면 공식 설치 안내를 표시합니다.",
"checking": "환경 확인 중…",
+ "syncBeforeBuild": {
+ "title": "빌드 전 최신 소스 동기화",
+ "description": "켜면 개인 버전을 생성하거나 다시 생성하기 전에 현재 채널의 최신 공식 소스를 개인 버전에 먼저 동기화합니다. 기본값은 꺼짐입니다.",
+ "ariaLabel": "빌드 전 최신 소스 동기화",
+ "saveFailed": "빌드 전 동기화 설정을 저장하지 못했습니다. 다시 시도하세요."
+ },
"forceManaged": {
"title": "설치 테스트: 시스템 도구 무시",
"description": "개발 버전 전용입니다. 휴대용 도구는 Cindy 관리 복사본만 확인하고 Windows 컴파일 도구가 없는 상태를 재현합니다. 스위치를 바꾸면 다시 확인만 하며 설치는 시작하지 않습니다.",
@@ -12937,7 +12943,7 @@
"details": {
"unknown": "미확인",
"latest": {
- "dev": "온라인 main",
+ "dev": "GitHub main",
"beta": "최신 beta",
"release": "최신 정식 버전",
"same": "최신 상태 ({{target}}), 뒤처진 변경 기록 0개",
@@ -12964,6 +12970,7 @@
"waiting": "프로젝트 준비 대기 중",
"environment": "환경 준비 중",
"source": "개인 프로젝트 소스 준비 중",
+ "updatingSource": "개인 버전 소스 업데이트 중",
"workspace": "작업 브랜치와 작업 디렉터리 생성 중",
"dependencies": "작업 의존성 설치 중",
"starting": "작업 자동 시작 중",
@@ -13011,13 +13018,13 @@
"updateAvailable": "업데이트 있음",
"unverified": "버전 상태 미확인",
"upToDateDescription": "개인 버전 코드에 {{target}}의 모든 업데이트가 포함되어 있습니다",
- "personalChanges": "개인 변경 기록 {{ahead}}개 추가"
+ "personalChanges": "개인 소스에 변경 기록 {{ahead}}개 추가"
},
"comparison": {
"same": "로컬 main과 SHA가 같음",
- "personalAhead": "로컬 main을 포함하며 개인 변경 기록 {{ahead}}개 추가",
+ "personalAhead": "로컬 main을 포함하며 개인 소스에 변경 기록 {{ahead}}개 추가",
"mainAhead": "로컬 main의 변경 기록 {{behind}}개가 아직 반영되지 않음",
- "diverged": "로컬 main의 변경 기록 {{behind}}개 미반영, 개인 변경 기록 {{ahead}}개 추가",
+ "diverged": "로컬 main의 변경 기록 {{behind}}개 미반영, 개인 소스에 변경 기록 {{ahead}}개 추가",
"different": "로컬 main과 SHA가 다름, 차이 알 수 없음",
"unknown": "로컬 main과의 차이 알 수 없음"
},
@@ -13031,6 +13038,7 @@
"development": "개발 환경",
"current": "현재 사용",
"using": "사용 중",
+ "updatePersonal": "다시 시작하여 업데이트",
"switch": "전환 후 다시 시작",
"switchPersonal": "이 개인 버전으로 전환",
"remove": "버전 삭제",
@@ -13040,6 +13048,8 @@
"unavailable": "이 버전의 앱 파일을 사용할 수 없습니다.",
"incompatible": "현재 데이터와 호환되지 않습니다. 현재 기본 버전에서 다시 빌드하세요.",
"readyHint": "개인 버전이 준비되었습니다. 전환하면 Cindy가 다시 시작되며 계정, 설정, 작업은 유지됩니다.",
+ "updateHint": "개인 버전에 새 내용이 있습니다. 다시 시작하면 계정, 설정, 작업을 유지한 채 최신 버전을 사용합니다.",
+ "usingHint": "최신 개인 버전을 사용 중입니다.",
"errors": {
"busy": "작업, 테스트 또는 빌드가 진행 중입니다. 완료한 후 버전을 전환하거나 삭제하세요.",
"incompatible": "데이터 구조가 다릅니다. 현재 기본 버전에서 개인 버전을 다시 빌드하세요.",
@@ -13076,6 +13086,7 @@
},
"status": {
"waiting": "개인 버전 빌드 대기 중…",
+ "syncing": "최신 소스 동기화 중…",
"merging": "수정 사항 병합 중…",
"checking": "개인 버전 검사 중…",
"packaging": "개인 버전 패키징 중…",
@@ -13090,6 +13101,7 @@
"cleaning-merge": "병합 파일 정리",
"environment": "빌드 환경 준비",
"original": "현재 버전 확인",
+ "syncing": "최신 소스 동기화",
"merging": "수정 사항 병합",
"checking-dependencies": "빌드 의존성 설치",
"checking-tests": "자동 테스트 실행",
@@ -13106,6 +13118,7 @@
"changed": "작업 디렉터리나 코드가 변경되었습니다. 수정을 완료한 후 다시 빌드하세요.",
"environment": "빌드 도구가 준비되지 않았습니다. Cindy Make 환경을 확인한 후 다시 시도하세요.",
"missingShell": "자동 검사에는 Git Bash가 필요합니다. Git for Windows를 설치한 후 다시 시도하세요.",
+ "sourceSyncFailed": "최신 소스를 동기화하지 못해 패키징을 시작하지 않았습니다. 네트워크를 확인하거나 동기화 충돌을 해결한 후 다시 시도하세요.",
"checksFailed": "병합한 코드가 검사를 통과하지 못했습니다. 수정을 계속한 후 다시 빌드하세요.",
"conflict": "현재 개인 버전과 수정 사항이 충돌합니다. 편집을 계속하여 충돌을 해결하세요.",
"baselineChanged": "빌드 중에 개인 버전이 변경되었습니다. 최신 수정 사항을 포함하려면 다시 빌드하세요.",
@@ -13160,6 +13173,7 @@
},
"history": {
"title": "제작 기록",
+ "taskCount": "작업 {{count}}개",
"batch": {
"make": "개인 버전 만들기",
"selected": "선택한 변경 {{count}}개로 만들기",
@@ -13173,6 +13187,7 @@
"restartTest": "격리 버전 다시 시작"
},
"build": "개인 버전 생성",
+ "regeneratePersonal": "개인 버전 다시 생성",
"buildDescription": "현재 개인 소스로 새 버전을 생성합니다. 아직 반영하지 않은 이전 변경 사항은 포함되지 않습니다.",
"building": "개인 버전 생성 중…",
"stop": "제작 중지",
@@ -13183,6 +13198,7 @@
"stopping": "중지 중…",
"progress": {
"waiting": "시작 대기 중",
+ "syncing": "최신 소스 동기화 중",
"merging": "변경 사항 병합 중",
"checking": "검사 실행 중",
"packaging": "개인 버전 패키징 중",
@@ -13197,7 +13213,7 @@
"busy": "다른 제작 또는 검사가 진행 중입니다. 완료 후 다시 시도하세요.",
"checking": "이 제작 기록을 확인하는 중입니다. 잠시 후 다시 시도하세요."
},
- "counts": "전체 {{total}}회 · 반영 대기 {{pending}}회 · 반영 완료 {{integrated}}회",
+ "counts": "제작 작업 {{total}}개 · 반영 대기 {{pending}}개 · 반영 완료 {{integrated}}개",
"filterLabel": "제작 기록 필터",
"mergeTaskTitle": "반영 충돌 해결",
"revertTaskTitle": "반영 취소 충돌 해결",
@@ -13230,7 +13246,7 @@
"cleanWorkspace": "남아 있는 제작 브랜치와 작업 폴더를 삭제합니다. 커밋하지 않은 변경 사항은 사라집니다.",
"cleanKeep": "개인 버전에 반영된 변경 사항과 생성된 앱 버전은 유지됩니다.",
"endConfirm": "이 제작을 종료하고 작업 폴더를 정리할까요? 제작 기록과 저장된 변경 사항은 유지됩니다.",
- "revertConfirm": "이 제작에서 개인 소스에 반영한 변경 사항을 취소할까요? 다른 제작과 생성된 앱은 유지됩니다.",
+ "revertConfirm": "이 제작의 변경 사항을 개인 버전에서 제거할까요? 기록을 다시 쓰지 않고 새로운 역방향 변경으로 남깁니다. 다른 제작과 생성된 앱은 유지됩니다.",
"lifecycle": {
"preparing": "준비 중",
"running": "수정 중",
@@ -13253,8 +13269,8 @@
"continue": "수정 계속",
"test": "격리 테스트 버전 실행",
"integrate": "개인 버전에 반영",
- "revert": "반영 취소",
- "reapply": "다시 반영",
+ "revert": "개인 버전에서 제거",
+ "reapply": "개인 버전에 다시 추가",
"resolve": "충돌 해결",
"retry": "다시 시도",
"build": "개인 버전 생성",
@@ -13306,7 +13322,8 @@
"errors": {
"busy": "다른 작업이 진행 중입니다. 잠시 후 다시 시도해 주세요.",
"dirty": "소스에 커밋되지 않은 변경 사항이 있습니다. 저장한 후 다시 시도해 주세요.",
- "localMain": "main 브랜치에 로컬 커밋이 있습니다. 확인한 후 업데이트해 주세요.",
+ "localMain": "Cindy Make 소스의 로컬 main과 대상 버전의 이력이 갈라졌습니다. 차이를 확인한 후 동기화해 주세요.",
+ "localMainAhead": "Cindy Make 소스의 로컬 main이 대상 버전보다 앞서 있어 직접 되돌릴 수 없습니다. 동기화 대상을 확인해 주세요.",
"unavailable": "소스 또는 작업 기록을 사용할 수 없습니다. 새로 고친 후 다시 시도해 주세요.",
"gitFailed": "Git 작업을 완료하지 못했습니다. 다시 시도해 주세요.",
"baselineChanged": "개인 소스가 변경되었습니다. 최신 상태에서 다시 시도해 주세요.",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index bfe67a911d..4786bb8bcd 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -5787,6 +5787,12 @@
},
"description": "下方卡片会检查本机环境,并可安装缺少的便携工具。原生编译工具缺失时会显示官方下载指引。",
"checking": "正在检查环境…",
+ "syncBeforeBuild": {
+ "title": "生成前同步最新源码",
+ "description": "开启后,每次生成或重新生成个人版前,会先把当前渠道的最新官方源码同步到个人版。默认关闭。",
+ "ariaLabel": "生成前同步最新源码",
+ "saveFailed": "未能保存生成前同步设置,请重试。"
+ },
"forceManaged": {
"title": "测试安装:忽略系统工具",
"description": "仅开发版可用。便携工具只检查 Cindy 管理的副本,并模拟 Windows 原生编译工具缺失。切换开关只重新检查,不会开始安装。",
@@ -12937,7 +12943,7 @@
"details": {
"unknown": "未读取",
"latest": {
- "dev": "线上 main",
+ "dev": "GitHub main",
"beta": "最新 beta",
"release": "最新正式版",
"same": "与{{target}} 一致,落后 0 条修改记录",
@@ -12964,6 +12970,7 @@
"waiting": "等待准备项目",
"environment": "正在准备环境",
"source": "正在准备个人项目源码",
+ "updatingSource": "正在更新个人版源码",
"workspace": "正在创建任务分支和工作目录",
"dependencies": "正在安装任务依赖",
"starting": "正在自动开始任务",
@@ -13011,13 +13018,13 @@
"updateAvailable": "有更新",
"unverified": "版本状态未确认",
"upToDateDescription": "个人版代码已包含{{target}}的全部更新",
- "personalChanges": "另有 {{ahead}} 条个人修改记录"
+ "personalChanges": "个人版源码中另有 {{ahead}} 条修改记录"
},
"comparison": {
"same": "与本地 main 的 SHA 相同",
- "personalAhead": "已包含本地 main,另有 {{ahead}} 条个人修改记录",
- "mainAhead": "尚缺本地 main 的 {{behind}} 条修改记录",
- "diverged": "尚缺本地 main 的 {{behind}} 条修改记录,另有 {{ahead}} 条个人修改记录",
+ "personalAhead": "已包含本地 main,个人版源码中另有 {{ahead}} 条修改记录",
+ "mainAhead": "尚缺本地 main 中的 {{behind}} 条修改记录",
+ "diverged": "尚缺本地 main 中的 {{behind}} 条修改记录,个人版源码中另有 {{ahead}} 条修改记录",
"different": "SHA 与本地 main 不同,差距未知",
"unknown": "与本地 main 的差距未知"
},
@@ -13031,6 +13038,7 @@
"development": "开发环境",
"current": "当前使用",
"using": "正在使用",
+ "updatePersonal": "重启更新",
"switch": "切换并重启",
"switchPersonal": "切换到此个人版",
"remove": "删除版本",
@@ -13040,6 +13048,8 @@
"unavailable": "此版本的应用文件已不可用。",
"incompatible": "此版本与当前数据不兼容,请基于当前原版重新生成。",
"readyHint": "个人版已准备好。切换后会重启 Cindy,并保留当前账号、设置和任务。",
+ "updateHint": "个人版已有新内容。重启后会使用最新个人版,并保留当前账号、设置和任务。",
+ "usingHint": "正在使用最新个人版。",
"errors": {
"busy": "还有任务、测试或构建正在进行,请结束后再切换或删除版本。",
"incompatible": "数据结构不同,暂时不能切换到这份版本。请基于当前原版重新生成个人版。",
@@ -13076,6 +13086,7 @@
},
"status": {
"waiting": "等待生成个人版…",
+ "syncing": "正在同步最新源码…",
"merging": "正在合并修改…",
"checking": "正在检查个人版…",
"packaging": "正在打包个人版…",
@@ -13090,6 +13101,7 @@
"cleaning-merge": "清理合并文件",
"environment": "准备生成环境",
"original": "检查当前版本",
+ "syncing": "同步最新源码",
"merging": "合入修改",
"checking-dependencies": "安装构建依赖",
"checking-tests": "运行自动测试",
@@ -13106,6 +13118,7 @@
"changed": "制作目录或代码已有变化,请完成修改后重新生成。",
"environment": "构建工具尚未就绪,请检查 Cindy Make 环境后重试。",
"missingShell": "自动检查需要 Git Bash,请安装 Git for Windows 后重试。",
+ "sourceSyncFailed": "最新源码同步失败,尚未开始打包。请检查网络或处理同步冲突后重试。",
"checksFailed": "合并后的代码未通过检查,请继续修改后重新生成。",
"conflict": "与当前个人版的修改有冲突,请继续修改并解决冲突。",
"baselineChanged": "生成期间个人版已有更新,请重新生成以包含最新修改。",
@@ -13160,6 +13173,7 @@
},
"history": {
"title": "制作历史",
+ "taskCount": "{{count}} 个任务",
"batch": {
"make": "制作个人版",
"selected": "制作所选 {{count}} 项",
@@ -13173,6 +13187,7 @@
"restartTest": "重新启动隔离版"
},
"build": "生成个人版",
+ "regeneratePersonal": "重新生成个人版",
"buildDescription": "将当前个人源码生成新版本,未合入的历史改动不会包含在内。",
"building": "正在生成个人版…",
"stop": "停止制作",
@@ -13183,6 +13198,7 @@
"stopping": "正在停止…",
"progress": {
"waiting": "等待开始",
+ "syncing": "正在同步最新源码",
"merging": "正在合入修改",
"checking": "正在运行检查",
"packaging": "正在打包个人版",
@@ -13197,7 +13213,7 @@
"busy": "另一个制作或检查正在进行,请稍后再试。",
"checking": "正在核对这条制作记录,请稍后再试。"
},
- "counts": "共 {{total}} 次 · 待合入 {{pending}} 次 · 已合入 {{integrated}} 次",
+ "counts": "共 {{total}} 个制作任务 · 待合入 {{pending}} 个 · 已合入 {{integrated}} 个",
"filterLabel": "筛选制作历史",
"mergeTaskTitle": "处理合入冲突",
"revertTaskTitle": "处理撤销合入冲突",
@@ -13230,7 +13246,7 @@
"cleanWorkspace": "删除仍存在的制作分支和工作目录,其中未提交的改动将丢失。",
"cleanKeep": "保留已合入个人版的改动和已生成的应用版本。",
"endConfirm": "结束这次制作并清理工作目录?制作历史与已保存的改动会保留。",
- "revertConfirm": "撤销这次制作合入个人源码的改动?其他制作和已生成的应用会保留。",
+ "revertConfirm": "从个人版移除这次制作的改动?系统会新增一条反向修改记录,不会改写历史;其他制作和已生成的应用会保留。",
"lifecycle": {
"preparing": "准备中",
"running": "正在修改",
@@ -13253,8 +13269,8 @@
"continue": "继续修改",
"test": "启动隔离测试版",
"integrate": "合入个人版",
- "revert": "撤销合入",
- "reapply": "重新合入",
+ "revert": "从个人版移除",
+ "reapply": "重新加入个人版",
"resolve": "处理冲突",
"retry": "重试",
"build": "生成个人版",
@@ -13306,7 +13322,8 @@
"errors": {
"busy": "其他操作正在进行,请稍后重试。",
"dirty": "源码有未提交的改动,请先保存再重试。",
- "localMain": "main 分支存在本地提交,请检查后再更新。",
+ "localMain": "Cindy Make 源码中的本地 main 与目标版本的历史已分叉,请检查差异后再同步",
+ "localMainAhead": "Cindy Make 源码中的本地 main 已领先目标版本,无法直接回退,请检查同步目标",
"unavailable": "源码或操作记录不可用,请刷新后重试。",
"gitFailed": "Git 未能完成操作,请重试。",
"baselineChanged": "个人源码已发生变化,请基于最新状态重试。",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 01a595fe1e..7f5ea33296 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -5787,6 +5787,12 @@
},
"description": "下方卡片會檢查本機環境,並可安裝缺少的可攜工具。原生編譯工具缺失時會顯示官方下載指引。",
"checking": "正在檢查環境…",
+ "syncBeforeBuild": {
+ "title": "產生前同步最新原始碼",
+ "description": "開啟後,每次產生或重新產生個人版前,會先把目前管道的最新官方原始碼同步到個人版。預設關閉。",
+ "ariaLabel": "產生前同步最新原始碼",
+ "saveFailed": "未能儲存產生前同步設定,請重試。"
+ },
"forceManaged": {
"title": "測試安裝:忽略系統工具",
"description": "僅開發版可用。可攜式工具只檢查 Cindy 管理的副本,並模擬 Windows 原生編譯工具缺失。切換開關只重新檢查,不會開始安裝。",
@@ -12937,7 +12943,7 @@
"details": {
"unknown": "尚未讀取",
"latest": {
- "dev": "線上 main",
+ "dev": "GitHub main",
"beta": "最新 beta",
"release": "最新正式版",
"same": "與{{target}} 一致,落後 0 筆修改記錄",
@@ -12964,6 +12970,7 @@
"waiting": "等待準備專案",
"environment": "正在準備環境",
"source": "正在準備個人專案原始碼",
+ "updatingSource": "正在更新個人版原始碼",
"workspace": "正在建立任務分支和工作目錄",
"dependencies": "正在安裝任務相依套件",
"starting": "正在自動開始任務",
@@ -13011,13 +13018,13 @@
"updateAvailable": "有更新",
"unverified": "版本狀態未確認",
"upToDateDescription": "個人版程式碼已包含{{target}}的全部更新",
- "personalChanges": "另有 {{ahead}} 筆個人修改記錄"
+ "personalChanges": "個人版原始碼中另有 {{ahead}} 筆修改記錄"
},
"comparison": {
"same": "與本機 main 的 SHA 相同",
- "personalAhead": "已包含本機 main,另有 {{ahead}} 筆個人修改記錄",
- "mainAhead": "尚缺本機 main 的 {{behind}} 筆修改記錄",
- "diverged": "尚缺本機 main 的 {{behind}} 筆修改記錄,另有 {{ahead}} 筆個人修改記錄",
+ "personalAhead": "已包含本機 main,個人版原始碼中另有 {{ahead}} 筆修改記錄",
+ "mainAhead": "尚缺本機 main 中的 {{behind}} 筆修改記錄",
+ "diverged": "尚缺本機 main 中的 {{behind}} 筆修改記錄,個人版原始碼中另有 {{ahead}} 筆修改記錄",
"different": "SHA 與本機 main 不同,差距未知",
"unknown": "與本機 main 的差距未知"
},
@@ -13031,6 +13038,7 @@
"development": "開發環境",
"current": "目前使用",
"using": "使用中",
+ "updatePersonal": "重新啟動以更新",
"switch": "切換並重新啟動",
"switchPersonal": "切換至此個人版",
"remove": "刪除版本",
@@ -13040,6 +13048,8 @@
"unavailable": "此版本的應用程式檔案已無法使用。",
"incompatible": "此版本與目前資料不相容,請以目前原版重新產生。",
"readyHint": "個人版已就緒。切換後會重新啟動 Cindy,並保留目前帳號、設定和任務。",
+ "updateHint": "個人版已有新內容。重新啟動後會使用最新個人版,並保留目前帳號、設定和任務。",
+ "usingHint": "正在使用最新個人版。",
"errors": {
"busy": "仍有任務、測試或建置正在進行,請結束後再切換或刪除版本。",
"incompatible": "資料結構不同,暫時無法切換至此版本。請以目前原版重新產生個人版。",
@@ -13076,6 +13086,7 @@
},
"status": {
"waiting": "等待產生個人版…",
+ "syncing": "正在同步最新原始碼…",
"merging": "正在合併修改…",
"checking": "正在檢查個人版…",
"packaging": "正在打包個人版…",
@@ -13090,6 +13101,7 @@
"cleaning-merge": "清理合併檔案",
"environment": "準備產生環境",
"original": "檢查目前版本",
+ "syncing": "同步最新原始碼",
"merging": "合入修改",
"checking-dependencies": "安裝建置相依套件",
"checking-tests": "執行自動測試",
@@ -13106,6 +13118,7 @@
"changed": "製作目錄或程式碼已有變更,請完成修改後重新產生。",
"environment": "建置工具尚未就緒,請檢查 Cindy Make 環境後重試。",
"missingShell": "自動檢查需要 Git Bash,請安裝 Git for Windows 後重試。",
+ "sourceSyncFailed": "最新原始碼同步失敗,尚未開始打包。請檢查網路或處理同步衝突後重試。",
"checksFailed": "合併後的程式碼未通過檢查,請繼續修改後重新產生。",
"conflict": "與目前個人版的修改有衝突,請繼續修改並解決衝突。",
"baselineChanged": "產生期間個人版已有更新,請重新產生以包含最新修改。",
@@ -13160,6 +13173,7 @@
},
"history": {
"title": "製作歷史",
+ "taskCount": "{{count}} 個任務",
"batch": {
"make": "製作個人版",
"selected": "製作所選 {{count}} 項",
@@ -13173,6 +13187,7 @@
"restartTest": "重新啟動隔離版"
},
"build": "產生個人版",
+ "regeneratePersonal": "重新產生個人版",
"buildDescription": "將目前的個人原始碼產生為新版本,尚未合入的歷史改動不會包含在內。",
"building": "正在產生個人版…",
"stop": "停止製作",
@@ -13183,6 +13198,7 @@
"stopping": "正在停止…",
"progress": {
"waiting": "等待開始",
+ "syncing": "正在同步最新原始碼",
"merging": "正在合併修改",
"checking": "正在執行檢查",
"packaging": "正在打包個人版",
@@ -13197,7 +13213,7 @@
"busy": "其他製作或檢查正在進行,請稍後再試。",
"checking": "正在核對這筆製作記錄,請稍後再試。"
},
- "counts": "共 {{total}} 次 · 待合入 {{pending}} 次 · 已合入 {{integrated}} 次",
+ "counts": "共 {{total}} 個製作任務 · 待合入 {{pending}} 個 · 已合入 {{integrated}} 個",
"filterLabel": "篩選製作歷史",
"mergeTaskTitle": "處理合入衝突",
"revertTaskTitle": "處理撤銷合入衝突",
@@ -13230,7 +13246,7 @@
"cleanWorkspace": "刪除仍存在的製作分支和工作目錄,其中尚未提交的改動將會遺失。",
"cleanKeep": "保留已合入個人版的改動和已產生的應用程式版本。",
"endConfirm": "結束這次製作並清理工作目錄?製作歷史與已儲存的改動會保留。",
- "revertConfirm": "撤銷這次製作合入個人原始碼的改動?其他製作和已產生的應用程式會保留。",
+ "revertConfirm": "從個人版移除這次製作的改動?系統會新增一筆反向修改記錄,不會改寫歷史;其他製作和已產生的應用程式會保留。",
"lifecycle": {
"preparing": "準備中",
"running": "正在修改",
@@ -13253,8 +13269,8 @@
"continue": "繼續修改",
"test": "啟動隔離測試版",
"integrate": "合入個人版",
- "revert": "撤銷合入",
- "reapply": "重新合入",
+ "revert": "從個人版移除",
+ "reapply": "重新加入個人版",
"resolve": "處理衝突",
"retry": "重試",
"build": "產生個人版",
@@ -13306,7 +13322,8 @@
"errors": {
"busy": "其他操作正在進行,請稍後重試。",
"dirty": "原始碼有未提交的改動,請先儲存再重試。",
- "localMain": "main 分支存在本機提交,請檢查後再更新。",
+ "localMain": "Cindy Make 原始碼中的本機 main 與目標版本的歷史已分歧,請檢查差異後再同步",
+ "localMainAhead": "Cindy Make 原始碼中的本機 main 已領先目標版本,無法直接回退,請檢查同步目標",
"unavailable": "原始碼或操作記錄無法使用,請重新整理後重試。",
"gitFailed": "Git 未能完成操作,請重試。",
"baselineChanged": "個人原始碼已發生變化,請依最新狀態重試。",
diff --git a/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts b/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts
index 4c5225c946..8dd28052ac 100644
--- a/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts
+++ b/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts
@@ -165,34 +165,23 @@ describe('Cindy Make test flow recovery', () => {
}
});
- it('does not reclaim input after Continue Editing until a new result arrives', () => {
+ it('keeps optional actions available after Continue Editing and follows the latest result', () => {
const base = {
session: { ...session, status: 'active' as const },
busy: false,
historyLoaded: true,
};
- expect(
- getCindyMakeTestRecovery({ ...base, messages: [continued], dismissedId: continued.clientId }),
- ).toBeNull();
+ expect(getCindyMakeTestRecovery({ ...base, messages: [continued] })).toBe(continued.clientId);
expect(
getCindyMakeTestRecovery({
...base,
messages: [continued, request, reply],
- dismissedId: continued.clientId,
}),
).toBe(reply.clientId);
- expect(
- getCindyMakeTestRecovery({
- ...base,
- messages: [continued, request, reply],
- dismissedId: reply.clientId,
- }),
- ).toBeNull();
expect(
getCindyMakeTestRecovery({
...base,
messages: [continued, request, reply, request, { ...reply, clientId: 'next-reply' }],
- dismissedId: reply.clientId,
}),
).toBe('next-reply');
});
diff --git a/apps/desktop/src/renderer/lib/cindyMakeComposer.ts b/apps/desktop/src/renderer/lib/cindyMakeComposer.ts
index 4ab179e429..68266e27bf 100644
--- a/apps/desktop/src/renderer/lib/cindyMakeComposer.ts
+++ b/apps/desktop/src/renderer/lib/cindyMakeComposer.ts
@@ -48,7 +48,7 @@ export function getCindyMakePendingTest({
/**
* Keep a way back to testing after Continue Editing, including when a later
- * reply omitted report_complete. This offers verification, not a completion:
+ * reply omitted report_complete. This offers inline actions, never an input lock:
* an ended assistant reply alone cannot certify the current workspace.
*/
export function getCindyMakeTestRecovery({
@@ -56,14 +56,11 @@ export function getCindyMakeTestRecovery({
messages,
busy,
historyLoaded,
- dismissedId,
}: {
session: Pick<Session, 'id' | 'source' | 'status' | 'clearedAt'> | null;
messages: readonly ChatMessage[];
busy: boolean;
historyLoaded: boolean;
- /** Continue Editing dismisses only this result, never a later editing turn. */
- dismissedId?: string;
}): string | null {
if (
session?.source !== CINDY_MAKE_SESSION_SOURCE ||
@@ -77,7 +74,7 @@ export function getCindyMakeTestRecovery({
for (let i = messages.length - 1; i >= 0; i -= 1) {
const message = messages[i];
if (message.parentToolUseId) continue;
- if (message.role === 'user' || message.clientId === dismissedId) return null;
+ if (message.role === 'user') return null;
if (isCindyMakeCompletionMessage(message)) {
return typeof message.systemCardData?.continuedAt === 'number' ? message.clientId : null;
}
diff --git a/apps/desktop/src/renderer/vite-env.d.ts b/apps/desktop/src/renderer/vite-env.d.ts
index d6c2b8d60a..842ce31d2f 100644
--- a/apps/desktop/src/renderer/vite-env.d.ts
+++ b/apps/desktop/src/renderer/vite-env.d.ts
@@ -3020,6 +3020,10 @@ interface ElectronAPI {
cindyMakeMerge: (
input: import('../shared/cindyMakeMerge').CindyMakeMergeRequest,
) => Promise<import('../shared/cindyMakeMerge').CindyMakeMergeState | undefined>;
+ getCindyMakeSettings: () => Promise<import('../shared/cindyMakeSettings').CindyMakeSettings>;
+ setCindyMakeSyncLatestBeforeBuild: (
+ enabled: boolean,
+ ) => Promise<import('../shared/cindyMakeSettings').CindyMakeSettings>;
getCindyMakeHistory: (
selected?: string,
) => Promise<import('../shared/cindyMakeHistory').CindyMakeHistoryState>;
@@ -3050,6 +3054,10 @@ interface ElectronAPI {
onCindyMakeState: (
listener: (state: import('../shared/cindyMakeDoctor').CindyMakeGlobalState) => void,
) => () => void;
+ /** A local Cindy Make build finished; Settings should refresh history and versions. */
+ onCindyMakeHistoryChanged: (
+ listener: (ownerStamp?: import('../shared/dataOwnerPush').DataOwnerPushStamp) => void,
+ ) => () => void;
/** Live global source status (Settings and the workflow share one operation). */
onCindyMakeSourceStatus: (
listener: (status: import('../shared/cindyMakeDoctor').MakeSourceStatus) => void,
diff --git a/apps/desktop/src/shared/cindyMakeAttention.ts b/apps/desktop/src/shared/cindyMakeAttention.ts
index f0b27a2c14..f337046254 100644
--- a/apps/desktop/src/shared/cindyMakeAttention.ts
+++ b/apps/desktop/src/shared/cindyMakeAttention.ts
@@ -44,7 +44,7 @@ export function getCindyMakeMessageAttention(message: {
if (state.status === 'ready') return { kind: 'done', key };
if (state.status === 'stopped') return { kind: 'none', key };
if (
- ['starting', 'waiting', 'merging', 'checking', 'packaging', 'publishing'].includes(
+ ['starting', 'waiting', 'syncing', 'merging', 'checking', 'packaging', 'publishing'].includes(
String(state.status),
)
)
diff --git a/apps/desktop/src/shared/cindyMakeDoctor.ts b/apps/desktop/src/shared/cindyMakeDoctor.ts
index 4525c0391f..2db19f162f 100644
--- a/apps/desktop/src/shared/cindyMakeDoctor.ts
+++ b/apps/desktop/src/shared/cindyMakeDoctor.ts
@@ -64,7 +64,14 @@ export interface CindyMakeTaskPreparation {
sessionId: string;
originSessionId?: string;
phase:
- 'waiting' | 'environment' | 'source' | 'workspace' | 'dependencies' | 'starting' | 'completed';
+ | 'waiting'
+ | 'environment'
+ | 'source'
+ | 'updatingSource'
+ | 'workspace'
+ | 'dependencies'
+ | 'starting'
+ | 'completed';
dependencies?: MakeDependencyProgress;
/** Settings projection; preparation completion is not production completion. */
sessionStatus?: 'active' | 'archived' | 'deleted';
diff --git a/apps/desktop/src/shared/cindyMakeHistory.ts b/apps/desktop/src/shared/cindyMakeHistory.ts
index eb890939c8..78915a3f50 100644
--- a/apps/desktop/src/shared/cindyMakeHistory.ts
+++ b/apps/desktop/src/shared/cindyMakeHistory.ts
@@ -96,6 +96,8 @@ export interface MakeHistoryBuildSelection {
export interface CindyMakeHistoryState {
items: CindyMakeHistoryItem[];
busy: boolean;
+ /** Running work only; a retained source conflict does not block version switching. */
+ activeWork?: boolean;
canBuild: boolean;
build?: CindyMakePersonalBuildState;
batch?: { current: number; total: number; runId: string; title: string };
diff --git a/apps/desktop/src/shared/cindyMakeMerge.ts b/apps/desktop/src/shared/cindyMakeMerge.ts
index 27e80aa529..4bcd8d7749 100644
--- a/apps/desktop/src/shared/cindyMakeMerge.ts
+++ b/apps/desktop/src/shared/cindyMakeMerge.ts
@@ -22,6 +22,7 @@ export type CindyMakeMergeError =
| 'busy'
| 'dirty'
| 'localMain'
+ | 'localMainAhead'
| 'unavailable'
| 'gitFailed'
| 'baselineChanged'
@@ -51,6 +52,8 @@ export interface CindyMakeMergeState {
rebaseReview?: boolean;
/** Native feature integration/undo shares the same retained conflict lifecycle. */
feature?: MakeFeatureMergePlan;
+ /** Source sync started while preparing a task; stopping preparation owns its candidate. */
+ taskOwned?: boolean;
tree?: string;
commit?: string;
sessionId?: string;
diff --git a/apps/desktop/src/shared/cindyMakeSession.ts b/apps/desktop/src/shared/cindyMakeSession.ts
index 3e1e63ffae..7335544896 100644
--- a/apps/desktop/src/shared/cindyMakeSession.ts
+++ b/apps/desktop/src/shared/cindyMakeSession.ts
@@ -67,11 +67,21 @@ export type CindyMakeTestStep =
'waiting' | 'environment' | 'workspace' | 'stopping' | 'dependencies' | 'assets' | 'launching';
export interface CindyMakePersonalBuildState {
- status: 'waiting' | 'checking' | 'merging' | 'packaging' | 'publishing' | 'ready' | 'failed';
+ status:
+ | 'waiting'
+ | 'syncing'
+ | 'checking'
+ | 'merging'
+ | 'packaging'
+ | 'publishing'
+ | 'ready'
+ | 'failed';
/** Retained for navigation after the disposable merge workspace is reclaimed. */
mergeSessionId?: string;
/** Optional preparation detail; older clients still display waiting. */
preparationStep?: 'environment' | 'original';
+ /** Snapshot of the build preference; later progress updates retain it. */
+ syncLatestSource?: boolean;
/** Native conflict handling and cleanup remain part of the same build. */
mergeStep?: 'conflicts' | 'cleanup';
/** Optional detail within checking; old records/clients retain the broad status. */
@@ -103,6 +113,7 @@ export interface CindyMakePersonalBuildState {
| 'changed'
| 'environment'
| 'missingShell'
+ | 'sourceSyncFailed'
| 'checksFailed'
| 'conflict'
| 'baselineChanged'
@@ -115,6 +126,7 @@ export interface CindyMakePersonalBuildState {
export type CindyMakeBuildLogStep =
| 'environment'
| 'original'
+ | 'syncing'
| 'merging'
| 'resolving-conflicts'
| 'cleaning-merge'
@@ -135,6 +147,7 @@ export interface CindyMakeBuildLogEntry {
const CINDY_MAKE_BUILD_LOG_STEPS = new Set<CindyMakeBuildLogStep>([
'environment',
'original',
+ 'syncing',
'merging',
'resolving-conflicts',
'cleaning-merge',
@@ -180,6 +193,13 @@ export function appendCindyMakeBuildLog(
previous.mergeSessionId
)
next = { ...next, mergeSessionId: previous.mergeSessionId };
+ if (
+ next.buildId &&
+ next.buildId === previous?.buildId &&
+ next.syncLatestSource === undefined &&
+ previous.syncLatestSource !== undefined
+ )
+ next = { ...next, syncLatestSource: previous.syncLatestSource };
const step: CindyMakeBuildLogStep | undefined =
next.status === 'waiting'
? next.preparationStep
@@ -214,6 +234,7 @@ export function parseCindyMakeBuildError(
case 'changed':
case 'environment':
case 'missingShell':
+ case 'sourceSyncFailed':
case 'checksFailed':
case 'conflict':
case 'baselineChanged':
@@ -226,4 +247,5 @@ export function parseCindyMakeBuildError(
}
}
-export type CindyMakeTestAction = 'start' | 'continue' | 'status' | 'build' | 'open-build';
+export type CindyMakeTestAction =
+ 'start' | 'continue' | 'status' | 'build' | 'open-build' | 'resume-start' | 'resume-build';
diff --git a/apps/desktop/src/shared/cindyMakeSettings.ts b/apps/desktop/src/shared/cindyMakeSettings.ts
new file mode 100644
index 0000000000..c937ca8a8b
--- /dev/null
+++ b/apps/desktop/src/shared/cindyMakeSettings.ts
@@ -0,0 +1,9 @@
+/** Device-local Cindy Make preferences shared across Main, preload and Settings. */
+export interface CindyMakeSettings {
+ /** Fetch and adopt the latest official source before a personal build starts. */
+ syncLatestBeforeBuild: boolean;
+}
+
+export const DEFAULT_CINDY_MAKE_SETTINGS: CindyMakeSettings = {
+ syncLatestBeforeBuild: false,
+};
diff --git a/apps/desktop/src/shared/cindyVersions.ts b/apps/desktop/src/shared/cindyVersions.ts
index 867e0e51b6..38bc3d479a 100644
--- a/apps/desktop/src/shared/cindyVersions.ts
+++ b/apps/desktop/src/shared/cindyVersions.ts
@@ -17,8 +17,12 @@ export interface CindyVersionsState {
selectedId: string;
switching: boolean;
versions: CindyVersionInfo[];
+ /** Running binary metadata may lag the single personal slot until the user restarts. */
+ currentVersion?: CindyVersionInfo;
+ personalUpdateAvailable?: boolean;
}
export type CindyVersionAction = 'switch' | 'remove';
export const CINDY_ORIGINAL_VERSION = 'original';
+export const CINDY_PERSONAL_VERSION = 'personal';
export const CINDY_VERSION_PROTOCOL = 1;
diff --git a/docs/cindy-make-upstream.md b/docs/cindy-make-upstream.md
index af6ab14ca9..cb6bb5e8e1 100644
--- a/docs/cindy-make-upstream.md
+++ b/docs/cindy-make-upstream.md
@@ -43,11 +43,15 @@ Main 负责网络和 Git,UI 只消费报告;运行版本摘要在结果详
### 文件与分支边界(2026-09-18 用户更新裁决)
用户选择本地提交、合并与 rebase,替代此前只应用文件且永不提交的模型。`main` 只包含
-官方提交,Cindy Make 永不推送远端。模型在任务 worktree 修改、验证并回报完成后,宿主在
+官方提交,永不推送到官方仓。Cindy Make 对远端的唯一写操作是「个人 fork 同步」一节
+允许的推送:仅 `cindy-personal` 与其官方基线记录,仅推到用户自己显式绑定的 fork
+(2026-09-22 用户裁决,替代此前“永不推送远端”)。模型在任务 worktree 修改、验证并回报完成后,宿主在
该任务分支创建带 DCO 签名的本地提交;未成功结束的轮次不提交或生成完成卡。没有新改动
不制造空提交。通用自动保存点仍跳过托管目录,避免在明确完成边界之外提交。
-生成个人版时先把功能分支的提交合入 `cindy-personal`,再从这个实际源码目录安装依赖、
+生成个人版是否先同步最新官方源码,由设置页「生成前同步最新源码」控制,默认关闭。开启时先
+复用既有官方源码同步流程,同步完成后把功能分支的提交合入 `cindy-personal`;关闭时直接使用
+当前 `cindy-personal`。随后都从这个实际源码目录安装依赖、
检查、构建。临时目录用于检测冲突并形成候选合并提交,不在那里构建。成功合入后的
个人源码工作区保持干净。按 2026-09-20 用户裁决,生成失败/取消时自动撤回尚未生成成功版本的
连续合入,恢复此前个人源码,保留任务分支、每轮修改与已经生成的版本;再次生成会自动重新合入。
@@ -59,21 +63,41 @@ Main 负责网络和 Git,UI 只消费报告;运行版本摘要在结果详
获取官方更新时先固定当前渠道目标、更新本地 main,再在独立分支/worktree 中把个人提交
rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)。无冲突自动采纳;有冲突
-先弹窗询问,确认后才创建独立任务并沿用当前模型设置;取消则放弃本次合入、保留个人版。冲突解决并完整结束 rebase、校验个人源码未并发
+手动同步时先弹窗询问,确认后才创建独立任务并沿用当前模型设置;取消则放弃本次合入、保留个人版。冲突解决并完整结束 rebase、校验个人源码未并发
变化后,才更新 cindy-personal。结果是“最新 main + 个人提交”,不是要求两者 hash 相等;
-官方更新不再堆积在未提交列表中。旧版遗留冲突现场仍可完成并迁移,新旧路径均不推送。
+官方更新不再堆积在未提交列表中。旧版遗留冲突现场仍可完成并迁移,新旧路径均不推送官方仓;
+采纳后若已开启 fork 同步,由宿主按「个人 fork 同步」一节推送 `cindy-personal`。
实现见 [localHistory](../apps/desktop/src/main/cindy-make/localHistory.ts) 与
[真实 Git 回归](../apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.git-integration.test.ts)。
+每次创建制作任务时,在创建任务分支和工作目录之前,必须沿用当前源码渠道重新获取官方目标,
+并把 `cindy-personal` 更新到最新官方基线(2026-09-22 用户裁决)。有冲突时进入既有独立
+处理任务,源码准备等待冲突解决、采纳与清理完成;同步失败、取消或账号切换均不创建任务
+worktree。停止准备会停止本次准备所拥有的冲突任务并清理候选目录,已经完成的官方同步保留。
+同步成功后才从更新后的 `cindy-personal` 创建任务分支,因此任务从一开始就在最新个人版源码上
+修改。制作任务准备卡在“准备个人项目源码”和“创建任务分支和工作目录”之间单独显示
+“正在更新个人版源码”;发生冲突时该步骤保持进行中,直到独立冲突任务完成采纳与清理。
+Settings 的手动“同步最新源码”继续可用。创建制作任务前的同步仍为固定流程;另设的
+“生成前同步最新源码”开关只控制打包入场,默认关闭。
+
+生成个人版时,若“生成前同步最新源码”已开启,则先把 `cindy-personal` 更新到当前渠道的最新
+官方基线;该步骤在进度中单独显示,冲突沿用既有独立处理任务,完成后才继续合入修改和打包。
+开关关闭时把任务修改合入当前个人版基线后直接检查和打包。后续生成失败只撤回未生成成功版本的功能
+合入。手机/远程资源沿用主机翻译后的准备状态和既有动作。实现与回归见
+[任务准备](../apps/desktop/src/main/cindy-make/taskRuntime.ts)、
+[同步运行时](../apps/desktop/src/main/cindy-make/upstreamMergeRuntime.ts) 和
+[创建顺序测试](../apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts)。
+
- 环境、个人版源码、任务分支和工作目录统一由 Main 的 `CindyMakeManager` 管理。
源码准备/清理、任务工作目录创建/依赖安装、完成后的 Git 写操作共用项目队列,
不再由 Settings、消息卡片或创建弹窗各自维护后台作业。发送入场与源码清理互斥,
已进入发送事务或运行中的任务禁止清理源码;清理已开始时拒绝新的发送。
- Settings → Cindy Make 分为“版本控制”和“环境检查”两个页签,版本控制排在首位并默认打开。
工具检查和 Dev 测试开关归环境检查;个人版源码、我的版本和制作历史归版本控制。
- 创建个人版本入口保留在版本控制页签内、概览卡上方。
- 当前使用版本、切换入口和个人版源码合为一张概览卡,制作历史紧随其后。切换只改变可见面板,保留检查/准备作业、版本列表展开状态与
- 制作搜索内容;进入版本控制时重新读取版本列表。页签支持方向键、Home/End 及独立面板标识。
+ 创建个人版本入口保留在版本控制页签内、概览卡上方,使用纯文字按钮,不显示加号。
+ 当前使用版本、切换入口和个人版源码合为一张概览卡,下方显示制作历史。切换只改变可见面板,保留检查/准备作业、版本列表展开状态与
+ 制作搜索内容;进入版本控制时立即重新读取版本、源码与制作历史。后台生成到达成功、失败或取消终态时,
+ Main 主动通知设置页重读历史与版本,5 秒轮询只作异常兜底,不作为正常完成反馈。页签支持方向键、Home/End 及独立面板标识。
- 输入 /cindy-make 需求后,在当前页面弹窗检查环境、准备个人版源码并查询上游;
这段前置流程不创建任务、不创建 worktree;源码准备与 Settings 共用同一流程,
准备 Git 内容后按锁文件预热依赖缓存,不生成个人分支的依赖目录或执行安装脚本。
@@ -84,8 +108,9 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
检查完成后,「继续制作个人版」只显示在弹窗底部,不在报告卡中重复;关闭确认期间暂时禁用。
实现与确认边界回归见 [CindyMakePreflightDialog](../apps/desktop/src/renderer/components/cindy-make/CindyMakePreflightDialog.tsx)
及其[测试](../apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakePreflightDialog.test.tsx)。
-- 选择「继续制作个人版」后,先创建带需求标题的任务并保存准备消息,再复核环境、
- 个人项目源码、任务分支/工作目录和依赖。历史卡片缺少源码时也先创建任务,
+- 选择「继续制作个人版」后,先创建带需求标题的任务并保存准备消息,再复核环境和
+ 个人项目源码;把 `cindy-personal` 更新到最新官方基线并处理完冲突后,才创建任务分支/
+ 工作目录并安装依赖。历史卡片缺少源码时也先创建任务,
不让用户等待依赖安装结束才看到任务。首页和 Settings 直接创建这一个制作任务,
不再为前置检查另建容器任务;已有任务入口继续继承来源任务的运行配置。
- Settings、消息卡片/弹窗和侧栏读取同一个 Main 快照;准备卡显示实际阶段、工具下载量、
@@ -95,6 +120,10 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
Settings 源码准备和更新共用一个状态区域:区分等待其他工程操作、Git 检查、上游版本查询和本地源码检查。
源码目录直接显示,打开和删除按钮在路径行最右侧对齐,不提供源码详情折叠入口。
源码准备失败或停止时保留结果和原因,按钮为「重试准备」;更新失败或冲突时显示原因及处理入口。
+ 源码更新操作共用一个位置:正常显示“同步最新源码”,待处理冲突时替换为“处理冲突”,
+ 已有处理任务时在同处提供查看入口;底部只显示状态与原因,不重复摆放操作按钮。
+ 待处理冲突禁止生成个人版,但不阻止切换已经生成的应用版本;版本切换仅沿用正在执行的
+ 准备、构建、测试及其它运行工作的重启保护。制作任务卡与设置页均遵守此边界。
更新成功只提示一次,随后显示个人版与 main 的版本差距,不再常驻「源码改动已合入」或
「个人版源码已准备好」。旧更新回执不遮挡后续源码准备与重试;仍有未处理更新工作区时保留冲突处理入口。
卡片进入页面即显示,先发布本机保存的源码摘要,再补 Git 版本与联网查询结果;
@@ -131,12 +160,12 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
底栏提供“继续修改”“启动隔离版测试”和“生成个人版”。同一完成记录
不再重复出现在本机消息流。继续修改需 Main 确认并持久化,重载不恢复已收起的旧卡;
新的用户消息或下一次完成回报会取代旧结果。提问、计划和权限交互保持原有优先级。
-- 修改回复结束但缺少新的完成回报,或重新打开待恢复任务时,本机任务复用原有输入区
- 流程卡的“继续测试”状态,与输入框互斥,不在输入框上方另建卡片。点击“检查并继续”沿用本任务的正常发送
- 流程核对当前修改,检查通过并重新回报后恢复测试/生成个人版卡片,不需要用户输入工具名。
- 点击“继续修改”收起当前流程卡并恢复输入,同一结果不立即抢回输入;下一轮结束后再次显示。
- 恢复状态不把旧完成记录或一条成功回复当作当前代码已完成的凭据,
- 不自动启动测试或生成个人版;发送失败可以重试,运行、排队或等待交互时不抢占原流程。
+- 点击“继续修改”直接恢复输入框,重新打开任务也不再出现“继续测试/检查并继续”的拦截卡。
+ 输入框上沿保留“启动隔离测试版”和“生成个人版”两个轻量按钮,修改回复结束但缺少完成回报时也可使用。
+ 只有点击按钮后,Main 才核对账号、任务、最新回复和托管目录,登记当前源码快照并直接执行所选操作;
+ 不额外发送 Agent 检查消息,也不增加一次确认。新的快照不继承旧测试或旧生成成功状态,
+ 原有的源码一致性检查、测试启动检查和生成检查继续执行。新消息、目录变更或账号切换会拒绝过期操作。
+ 检查失败可重试;打开任务不自动启动测试或生成,运行、排队或等待交互时不抢占原流程。
- 测试必须由用户点击启动。Main 只接受当前账号的本机制作任务及最新完成记录,检查
工作目录仍属于托管 worktree、没有链接替换、分支与原有 HEAD 匹配,且文件内容与完成
时的 tree 一致,然后经既有开发版启动器启动独立命名的隔离实例。旧完成记录沿用干净
@@ -187,8 +216,9 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
应用保存成独立快照(Windows 完整目录、macOS 完整 .app),保留签名、执行权限与
包内相对链接;外部链接拒绝进入快照。成品位于独立的 `userData/cindy-versions`,清理
源码不删除成品。检查、打包与保存完成后才登记到版本列表,生成不自动启用、安装或发布。
- 新源码声明启动协议后,完成卡按钮变成“切换到此个人版”;旧源码/旧完成记录继续保留
- “查看安装包”,不声称不具备协议的旧程序能够接管当前数据。
+ 新源码声明启动协议后,完成卡按当前使用状态提供“切换到个人版”或“重启更新”,
+ 已使用最新内容时显示“正在使用”;不具备启动协议的旧源码/旧完成记录继续保留
+ “查看安装包”,不声称旧程序能够接管当前数据。
- 桌面制作任务内的准备、测试与生成结果复用现有任务红绿点:失败或中断显示红点,成功且未查看
显示绿点;取消与正常关闭测试不算失败。打开任务不会清除失败红点,重试或继续修改后收敛。
红点从持久卡片恢复,重启后尚未打开的制作任务也能显示;旧卡片的迟到更新不能覆盖新的结果,
@@ -198,7 +228,7 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
构建;文件合入已经开始时先完成合入记录,再执行失败清理,成品登记完成时保留成功产物及
回执。运行与清理完成前保持工作目录占用,避免误删。应用重启不自动重放启动或构建,
旧在途状态按已中断呈现,可显式重试。手机在已有 Cindy Make 任务中显示同一份准备、测试与生成状态,
- 包括测试启动步骤、失败重试、继续修改及缺少完成登记时的“检查并继续”。操作由被控电脑执行;
+ 包括测试启动步骤、失败重试、继续修改,以及保留输入框的按需测试/生成入口。操作由被控电脑执行;
手机通过 Remote Resource 通道读取状态、调用已登记操作,不新增业务 invoke 白名单。
个人版创建入口、成品启用/切换仍在本机 Desktop;远端 Desktop 保留完成记录与输入框。
设置页制作历史在生成期间收敛为一个状态卡,显示合并、检查(依赖/测试/类型)、打包和保存步骤,
@@ -212,7 +242,20 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
[personalBuild](../apps/desktop/src/main/cindy-make/personalBuild.ts) 及其
[真实 Git 回归](../apps/desktop/src/main/cindy-make/__tests__/personalBuild.git-integration.test.ts) 和
[CindyMakeTestCard](../apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx)。
-- 本机版本只有“原版”和“个人版”两类。Dev 与正式安装版都属于原版,只在启动方法上
+- 本机始终只有“原版”和唯一的“个人版”(2026-09-22 用户裁决)。制作历史记录修改,
+ 不各自拥有可切换的应用。每次生成都在项目锁内读取最新 `cindy-personal` 的实际 HEAD
+ 和文件树;从历史或完成卡生成时先合入所选修改,再从该分支打包,不使用历史成品或
+ 旧完成快照作为整个应用的构建基线。检查、打包、保存全部完成才更新同一个个人版入口,
+ 失败继续保留上次成功的个人版。历史完成卡的旧成品 ID 也只切换到当前个人版。
+ 旧版多成品记录自动收敛为最新生成的一项;明确删除个人版后不会复活更旧成品。
+ 新旧应用仅作为内部交接暂存:保留正在使用、已选择和启动恢复所需的文件,在后续成功
+ 生成或切换后清理无占用的旧应用,保留生成事实供历史与失败回退核验。正在使用个人版时
+ 生成新内容不强制重启,显示“重启更新”;当前信息仍描述实际运行的文件。任务卡片在原版
+ 显示“切换到个人版”,个人版有新内容时显示“重启更新”,已使用最新内容时显示不可点击的
+ “正在使用”;说明文字与这三个状态保持一致。
+ 回归见 [versionStore.test.ts](../apps/desktop/src/main/cindy-make/__tests__/versionStore.test.ts)
+ 和 [versionService.test.ts](../apps/desktop/src/main/cindy-make/__tests__/versionService.test.ts)。
+ Dev 与正式安装版都属于原版,只在启动方法上
分别恢复 Forge/Vite 与安装应用;Dev 同样记住选择。从哪个原版进入,就沿用它的账号、
设置、任务、设备身份和钥匙串身份,不能从 Dev 误跳到另一份正式数据目录。Dev 本地/
自定义端点按已校验的公共配置保存给个人版,不能把本地登录凭证送往线上;恢复 Dev
@@ -262,10 +305,12 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
老任务从准备卡、完成事实与实际 Git 合入提交核验回填;缺少证据时不伪造撤销依据。
选中记录时核验源码、完成快照与保留的 Git 对象;Main 在操作入场再检查一次。
可以安全清理的历史记录提供“清理任务”入口;它只隐藏该条列表并沿用 Main 的任务清理管线,保留归档交流、
- 已合入提交和历史回执。当前正在制作的内容变更只提供查看,完成后提供生成个人版、隔离测试与继续修改;
- 可继续修改时不重复提供“打开任务”。主操作区不暴露合入、撤销合入和重新合入按钮,
- 生成失败的撤回由失败清理负责。冲突仍提供处理入口。
- 已结束不再显示编辑、测试和重复的“结束制作”,但仍可隐藏历史。
+ 已合入提交和历史回执。当前正在制作的内容变更只提供查看,完成后提供隔离测试与继续修改;
+ 可继续修改时不重复提供“打开任务”。单条历史不提供“生成个人版”或独立“合入修改”:
+ 已加入个人版的记录提供“从个人版移除”,已移除的记录提供“重新加入个人版”。移除通过新的
+ 反向提交实现,不 reset、不改写历史;重新加入同样形成新提交。两者只改变个人源码,需再用历史卡
+ 右上角的全局“重新生成个人版”更新应用成品。冲突仍提供处理入口。
+ 已结束不再显示编辑、测试和重复的“结束制作”,但仍可移除/重新加入并隐藏历史。
所有按钮复用统一边框。
Main 区分全局忙碌与目标任务忙碌:当前任务仍在准备、运行、测试、冲突处理或清理时,清理请求
立即返回 busy,详情保留原因提示;另一个任务占用项目资源时,空闲历史任务仍保留结束/重试清理,
@@ -276,8 +321,10 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
目录,原个人源码保留。官方 rebase 改写 hash 后仍通过保留的文件差异处理,不能依据旧
commit 的祖先关系误判已经撤销或无法撤销。Git 采纳和历史写入之间中断可显式重试,
历史回执按操作 ID 去重;重启不静默重放写操作。
-- 制作历史的「生成个人版」自动合入所选任务已经完成的修改,再从当前个人源码构建;
- 筛选「待合入」时,工具栏右侧另提供「制作个人版」进入多选;支持全选当前搜索列表,
+- 制作历史卡右上角的「重新生成个人版」是全局动作,只构建当前本地 `cindy-personal`,不使用
+ 某条历史快照,也不自动加入尚未合入的任务。设置页「生成前同步最新源码」开启时,它与完成卡、
+ 批量制作共用同一前置同步步骤;关闭时不访问 GitHub,默认关闭。
+ 筛选「待合入」时,工具栏右侧保留「制作个人版」进入多选;支持全选当前搜索列表,
二次确认按创建时间从老到新列出所选记录。Main 固定已确认的完成记录、commit 与文件树,
先停止所选记录正在运行的隔离测试,再核验全部选择,逐条合入并且只在全部成功后生成一次。
合入期间显示当前条目与总数;离开设置不取消流程。冲突或取消停止后续合入与打包,
@@ -285,11 +332,12 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
没有待处理冲突工作区时,失败清理沿用下述撤回规则。不在重启后重放批量操作。
每条可测试的待合入记录沿用同一隔离测试控制器;已启动时提供「重新启动隔离版」,
等待旧进程真实退出后才重新启动,停止失败保留原状态。
- 当前完成轮复用任务完成卡的同一生成流程。已结束的任务可使用保留的完成快照,无需仍存在
- 的制作工作目录,也不创建虚假的任务。生成时在源码锁内记录实际包含的操作,成功后刷新版本列表。
- 按钮始终叫「生成个人版」,失败后保持同一入口,不另设「重新生成」。失败或取消自动撤回
+ 当前完成轮复用任务完成卡的同一生成流程;任务卡点击「生成个人版」时先加入该任务修改再生成。
+ 已结束的任务可通过待合入多选使用保留的完成快照,无需仍存在的制作工作目录,也不创建虚假的任务。
+ 生成时在源码锁内记录实际包含的操作,成功后立即刷新版本列表。任务完成卡按钮始终叫
+ 「生成个人版」,失败后保持同一入口;历史卡的全局入口明确叫「重新生成个人版」。失败或取消自动撤回
尚未成功生成的合入,保留任务修改与原有应用成品;清理未完成时显示原因,再次生成前继续清理。
- 独立的全局生成入口仍只构建当前个人源码,不自动加入其它历史任务。检查期间分别显示安装依赖、
+ 全局重新生成入口仍只构建当前个人源码,不自动加入其它历史任务。检查期间分别显示安装依赖、
自动测试和类型检查,加载时保留可见按钮文字,失败保留已知原因。旧记录缺少检查子阶段时
回退到检查中,不改变已有状态含义。
未声明托管版本启动协议的旧源码仍提供「查看安装包」,不声称可在版本列表中切换。
@@ -350,9 +398,10 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
待核对原功能并补回遗漏后再采纳。
- 冲突任务使用独立 source `cindy-make-merge`,归入 Cindy Make 侧栏分组,标题使用
工作目录的四位标记。它不继承普通制作任务的每轮说明、完成回报工具、隔离测试或
- 生成个人版卡片。首条用户需求由 Main 固定组装,要求理解双方修改、保留本地功能、
+ 生成个人版卡片。 首条用户需求由 Main 固定组装,要求理解双方修改、保留本地功能、
安全解决冲突,并按仓库规则验证。允许暂存并继续现有 rebase,不重新开始、不跳过个人
- 提交、不修改其他目录,也不推送;结束后宿主提交必要的附加修复。
+ 提交、不修改其他目录,也不推送;结束后宿主提交必要的附加修复。任务本身永不推送;
+ 采纳后向 fork 的推送只由宿主按「个人 fork 同步」一节执行。
- 正常执行结束后,Main 核验目录归属、分支身份、原有 HEAD、文件冲突状态及
`git diff --check`,再应用结果。自动检查不代表功能测试已通过;功能验证由解决冲突的
任务执行并如实说明。个人版期间发生变化则停止应用并保留现场;中断、失败或
@@ -406,3 +455,139 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
[独立任务](../apps/desktop/src/main/cindy-make/upstreamMergeSession.ts);
[真实 Git 回归](../apps/desktop/src/main/cindy-make/__tests__/upstreamMerge.git-integration.test.ts)
覆盖无冲突自动应用、冲突隔离与期间新增未提交个人改动的保护。
+
+## 个人 fork 同步(2026-09-22 用户裁决,设计稿,尚未实现)
+
+目标:本机检测到可用的个人 GitHub 身份时,个人版源码以用户自己 fork 出来的
+`<login>/cindy` 作为「个人版远端仓库」。`cindy-personal` 仍是唯一的个人版分支,仍在本机
+记录、合入与生成;区别只是它同时被推送到 fork,换一台机器、同一 GitHub 账号即可取回,
+fork 也为日后向官方仓提 PR 留出入口。没有可用身份时,行为与本节之前完全一致。
+
+### 身份来源与凭证边界
+
+- 第一阶段只接受 GitHub CLI 的登录态,复用
+ [ghCliTokenSource](../apps/desktop/src/main/git-context/ghCliTokenSource.ts):`gh` 未安装、
+ 未登录、超时都视为“没有身份”,源码与生成逻辑走原路径。身份只在「首次选择」一步和
+ Settings 的「开启同步」处被询问;不在其他时机弹窗、不自动安装 gh。
+ git credential helper、SSH key、粘贴 PAT 与 Cindy 内置 GitHub 登录(OAuth Device Flow)
+ 都不在第一阶段范围;后者需要仓外注册 OAuth App,用户裁决本轮不做。
+- token 只在内存,沿用 ghCliTokenSource 的缓存。Git 访问 fork 时用进程环境
+ `GIT_CONFIG_COUNT/KEY/VALUE` 注入 `http.https://github.com/<login>/<repo>.git.extraheader`
+ (Basic `x-access-token:<token>`),不写 `.git/config`、不进 argv、不落盘、不进日志;
+ 不依赖用户是否配置过 `gh auth setup-git`。remote URL 本身不带凭证。
+ 错误输出沿用 `sourceGit` 的脱敏;主日志只记阶段、结果码与 ahead/behind 数。
+- 绑定的是 login,不是 token:确认开启时用 `GET /user` 取 login,连同 fork 仓库名
+ 写入 `cindy-make-settings.json`(非秘密:`personalRemote: { login, repository, confirmedAt }`)。
+ 之后每次操作先核对当前 gh 登录的 login 与绑定一致;不一致时停止推送与拉取,Settings 显示
+ “当前 GitHub CLI 登录账号与已绑定的 fork 不一致”,不自动改绑、不推到另一账号的仓库。
+- Renderer 只传动作与版本 ID,不传 login、URL 或 token;fork 名、URL 与凭证一律由 Main 解析。
+
+### Fork 的发现、创建与确认
+
+- 首次选择(2026-09-22 用户裁决):本机还没有托管源码、且 `cindy-make-settings.json` 没有
+ 记录存放方式时,两个会触发首次源码准备的入口(Settings 版本控制页的准备入口、`/cindy-make`
+ 前置弹窗)在 clone 开始前插入一步“个人版存放方式”,两个选项:
+ - 「存到我的 GitHub(`<login>/cindy`)」:gh 已登录时默认选中;说明将使用的账号、fork 名、
+ **fork 公开可见**(`makecindy/cindy` 为公开仓,GitHub 不允许其 fork 设为私有,因此个人版
+ 的修改会公开)、只推送 `cindy-personal` 及其官方基线记录、可随时关闭。
+ - 「只存这台电脑」:gh 不可用时默认选中,此时上一项置灰并说明“安装并登录 GitHub CLI
+ (`gh auth login`)后可用,换电脑也能取回个人版”,提供「我已配置好,重新检测」按钮,
+ 重新检测绕过 ghCliTokenSource 的负缓存。
+ 选择结果持久化后开始准备,之后不再询问;改主意在 Settings「开启/关闭同步」。选择
+ 「存到 GitHub」即构成建 fork 这一外部写操作的显式授权,不再另设第二个确认弹窗。
+ 已有托管源码的老用户不经过这一步,只能从 Settings 开启。若准备由其他路径触发而没有记录
+ (例如旧版残留状态),按「只存这台电脑」处理。
+- 选择「存到 GitHub」或从 Settings 开启后,先 `GET /repos/<login>/cindy`:存在且 `fork === true`
+ 且 `parent.full_name === 'makecindy/cindy'` 才视为可用;不存在则
+ `POST /repos/makecindy/cindy/forks` 并轮询直到可 `ls-remote`;存在但不是官方仓的 fork
+ (用户自己的同名仓)则拒绝并说明,不覆盖、不改名,允许用户手填 `<login>/<name>` 指定已有
+ fork,同样校验 `parent` 后才绑定。
+- 首次选择时若 fork 存在且远端已有 `cindy-personal`(换机器场景),该步直接在「存到 GitHub」
+ 选项下说明“你的 GitHub 上已有个人版(基于官方 vX、N 个个人提交),将以它作为这台电脑的
+ 起点”,不再单独弹窗;准备时按下节从 fork 恢复基线。选「只存这台电脑」则按原逻辑从官方
+ ref 建基线,之后开启同步时按分叉流程处理。
+- 本机已有 `cindy-personal`(此前无 gh 或未开启)、后来从 Settings 开启同步:这是就地
+ 转换,不重新 clone、不改 `origin`、不动任务分支/worktree/依赖/制作历史/已生成版本。
+ 步骤与失败语义:① 先按 `commitPersonalFiles` 把遗留未提交内容转成本地提交(旧 HEAD、
+ 暂存区、文件树先备份到 `refs/cindy-make/history-backups/*`),失败则一切未变;② 检查/
+ 创建 fork,纯远端操作,失败只提示原因、可重试;③ `remote add personal`;④ fork 上没有
+ `cindy-personal` 时按显式 refspec 初始推送本机 tip 与 `personal-upstream`,只向远端追加,
+ 失败标“待推送”、本地照常可用。fork 上已有另一台机器的个人版时,确认弹窗额外显示两边的
+ 官方基线与个人提交数,默认操作为「合并并开启同步」,走下节分叉流程(候选目录内 rebase、
+ `refs/cindy-make/backups/<ID>/personal` 备份、成功才采纳),冲突则建任务,成功后才推送;
+ 同时提供「以 fork 为准」「以本机为准」两个备份后覆盖的兜底,均需二次确认。
+ 确认弹窗须写明现有个人版的官方基线、个人提交数、将被整理的未提交修改数,以及“本机源码、
+ 任务和已生成的版本不会改动”。开启同步排在项目队列中,与准备、测试、生成互斥,等待时显示
+ “等待其他工程操作”。首次选择之后 gh 可用性再变化不主动弹窗,只在 Settings 概览卡出现
+ 「开启同步」;选过「只存这台电脑」的用户,概览卡保留一行“安装并登录 GitHub CLI 后可将
+ 个人版同步到你的 GitHub”。
+
+### 本地仓库布局与推送内容
+
+- `origin` 仍指向官方仓,所有官方逻辑(`origin/main` 语义、`clearOnly` 的 URL 校验、
+ 运行版本查询、迁移基线计算)不变;新增名为 `personal` 的 remote 指向 fork(不带凭证的
+ HTTPS URL)。常量放在 `sourcePaths`。清理源码时一并删除 `personal` remote 与
+ `refs/remotes/personal/*`;关闭同步只删 remote 与远端跟踪 ref,不删 fork、不删本地分支。
+ 用户可见的说法始终是“个人版源码仓库 = 你的 fork”,不暴露 remote 名。
+- 只推送两个 ref:`refs/heads/cindy-personal` 与 `refs/cindy-make/personal-upstream`
+ (推到 fork 的同名 ref)。不推 `main`、任务分支 `cindy-make/*`、`cindy-merge/*`,也不推
+ `refs/cindy-make/tasks|features|backups|failed-builds|history-backups/*`——这些是本机的
+ 工作快照与恢复引用,另一台机器无法复用。
+- 推送时机只有三个,都在 `cindy-personal` 已成为**最终状态**之后:
+ 1. 个人版生成成功并登记到版本列表之后(`buildCindyPersonal` 发布、`onBuildState` 进入
+ `ready` 之后),推送该次生成实际使用的 commit(`artifact.commit`),而不是分支当前名下
+ 可能已经变化的 tip。功能合入采纳的那一刻**不推送**:合入在生成成功前是临时的,检查或
+ 打包失败会撤回;若此时已推,远端会保留本地已撤回的提交,下次同步会把本机误快进回去。
+ 2. 官方更新采纳之后(Settings 手动同步或创建制作任务前的自动同步)。官方更新的采纳不参与失败回退,
+ 属于最终状态,可以立即推送。
+ 3. 首次开启同步时的一次初始推送。
+ 推送在项目锁外、当次操作的 Git 采纳与版本登记全部完成后进行,失败不改变本地结果,
+ 只在状态里记“待推送”,完成卡与 Settings 的生成结果显示“已同步到 fork/未同步”,
+ Settings 提供「立即同步」;重启不自动重放推送,下一次让 `cindy-personal` 前进的操作
+ 入场时作为可见的前置步骤补推。
+- 一律以显式 refspec 推送已核验的 commit:
+ `push personal <commit>:refs/heads/cindy-personal --force-with-lease=refs/heads/cindy-personal:<refs/remotes/personal/cindy-personal>`
+ (`personal-upstream` 同样按 commit 推)。官方更新 rebase 会改写历史,普通 push 必被拒;
+ lease 保证不覆盖另一台机器已推送的内容。推送前核验该 commit 仍是本地 `cindy-personal`
+ 的 tip 或其祖先,否则放弃本次推送并标记待推送。lease 失败即视为分叉,进入下节流程,
+ 绝不追加 `--force`。
+
+### 多机同步:拉取、快进与分叉(阶段 2)
+
+- 任何让 `cindy-personal` 前进的操作(合入、官方更新、生成、「立即同步」)入场时,若身份可用,
+ 先 `fetch personal cindy-personal personal-upstream`。网络失败不阻止本地操作,但本次标记
+ “远端状态未知、未推送”。
+- 比较本地与远端 `cindy-personal`:相同则无事;远端是本地祖先则本地领先,直接推送;本地是远端
+ 祖先则先 `commitPersonalFiles` 保证工作区干净,再 `reset --keep` 快进本地并采用远端的
+ `personal-upstream`,任务 worktree 不受影响。
+- 两边分叉时自动处理,复用官方更新的机制(`merge-worktrees/<ID>` 候选目录、`cindy-merge/<ID>`
+ 分支、`refs/cindy-make/backups/<ID>/*` 备份、同一确认弹窗与 `cindy-make-merge` 任务):
+ 1. 先统一官方基线。读取两边的 `personal-upstream`(缺失时以 `merge-base(cindy-personal,
+ origin/main)` 代替),取较新者为目标基线;落后的一侧先用既有官方更新 rebase 抬到该基线
+ (远端一侧在候选目录内完成,不改动 fork)。两个基线互不为祖先时不自动处理,见下。
+ 2. 再把本机独有的个人提交 rebase 到远端个人版之上(`rebase --onto <远端 tip> <目标基线>`,
+ Git 按 patch-id 跳过两边已相同的提交),`--no-update-refs --signoff` 与官方更新一致。
+ 3. 无冲突:核验后 `reset --keep` 到结果、更新 `personal-upstream`、推送;有冲突:与官方更新
+ 相同,先弹窗确认,确认后创建冲突任务,取消则保留本机个人版、本次不推送、远端不动。
+- 无法自动处理的情况(基线互不为祖先、远端 `cindy-personal` 不含任何官方提交、fork 不再是
+ 官方仓的 fork 等)只报告原因,并提供两个明确操作:「以远端为准」把本地 `cindy-personal`
+ 备份到 `refs/cindy-make/backups/*` 后重置为远端;「以本机为准」先把远端旧 tip 推到 fork 的
+ `refs/cindy-make/backups/*` 再强推。两者都要二次确认,都不删除任务分支与已生成版本。
+- 同步期间与其他 Git 写操作共用项目队列;分叉处理占用的候选目录与冲突任务沿用现有清理、
+ 取消与重启恢复规则。手机端只读投影同步状态,不新增远控写操作。
+
+### Settings 呈现
+
+- 版本控制页概览卡在个人版 hash 行下新增一行“个人版远端”:未开启/`<login>/cindy` 已同步/
+ 待推送/分叉(本机领先 a、远端领先 b)/账号不一致/远端状态未知。状态字段进
+ `MakeSourceStatus.personalRemote`,与源码状态同一刷新代次,迟到结果不能覆盖较新状态。
+- 操作只放同一处:未开启显示「开启同步」,待推送或分叉显示「立即同步」,已开启时提供「关闭
+ 同步」;分叉无法自动处理时在此处展开「以远端为准」「以本机为准」。文案走 i18n,术语先查
+ `i18n/GLOSSARY.md`(fork、个人版、同步)。
+
+### 不做与待定
+
+- 第一阶段不做:其他身份通道、向官方仓提 PR、同步任务分支或制作历史。
+- 提 PR(阶段 3)前必须先解决作者身份:`commitLocalFiles` 当前以
+ `Cindy Make <[email protected]>` 作者并 signoff,官方仓 DCO 要求 sign-off 与
+ author 一致且为真实身份,所以贡献路径需要以用户身份重做提交,届时另立裁决。
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index 39014e1225..960b9c0282 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -38,7 +38,7 @@
| `desktop.overlay.toast` | desktop | Toast | App 常驻 ToastContainer(用户可见出口,不展开业务逻辑) | Toast, ToastContainer | apps/desktop/src/renderer/components/ui/toast/Toast.tsx, apps/desktop/src/renderer/components/ui/toast/ToastContainer.tsx, apps/desktop/src/renderer/components/ui/toast/index.ts | 8 | 4 | 4 |
| `desktop.plugins.app-main` | desktop | 插件主视图 | hash `/apps/:ghostId`(GhostMainViewFeatureLayout) | GhostMainViewFeatureLayout, GhostMainViewHost | apps/desktop/src/renderer/features/plugin/GhostMainViewFeatureLayout.tsx, apps/desktop/src/renderer/features/plugin/GhostMainViewHost.tsx | 0 | 0 | 0 |
| `desktop.plugins.installed` | desktop | 已装插件 | hash `/plugins`(GhostPluginPage) | AddMarketplaceDialog, GhostPluginDetailView, GhostPluginPage, MarketPluginDetailView, MyPublishesSection, PluginManagementLayout, PluginScopePicker, UpdateAllDialog | apps/desktop/src/renderer/features/plugin/AddMarketplaceDialog.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx, apps/desktop/src/renderer/features/plugin/MarketPluginDetailView.tsx, apps/desktop/src/renderer/features/plugin/MyPublishesSection.tsx, apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/plugin/PluginScopePicker.tsx, apps/desktop/src/renderer/features/plugin/UpdateAllDialog.tsx, apps/desktop/src/renderer/features/plugin/plugin-motion.css | 44 | 0 | 79 |
-| `desktop.settings` | desktop | 设置 | hash `/settings`(SettingsView;tab 含 general / personalization / providers / billing / usage / voice-input / im-bot / shortcuts / agent-island / import / remote-control / ghosts / builtin-tools / computer-use / help / about) | SettingsView | apps/desktop/src/renderer/components/settings/AboutSection.tsx, apps/desktop/src/renderer/components/settings/AccountDeletionSection.tsx, apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx, apps/desktop/src/renderer/components/settings/AgentIslandSection.tsx, apps/desktop/src/renderer/components/settings/AgentResourceSection.tsx, apps/desktop/src/renderer/components/settings/AppearanceSection.tsx, apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx, apps/desktop/src/renderer/components/settings/BetaChannelCell.tsx, apps/desktop/src/renderer/components/settings/BrowserBackendSubsection.tsx, apps/desktop/src/renderer/components/settings/BrowserRealProfileSubsection.tsx, apps/desktop/src/renderer/components/settings/BuiltinToolsSection.tsx, apps/desktop/src/renderer/components/settings/ChatEmbeddingCell.tsx, apps/desktop/src/renderer/components/settings/ChipMetricsSection.tsx, apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx, apps/desktop/src/renderer/components/settings/CollaborationSection.tsx, apps/desktop/src/renderer/components/settings/CompactionSection.tsx, apps/desktop/src/renderer/components/settings/ComposerSendShortcutSection.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionRow.tsx, apps/desktop/src/renderer/components/settings/ComputerUseSection.tsx, apps/desktop/src/renderer/components/settings/CustomProviderRuntimeFillOverlay.tsx, apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx, apps/desktop/src/renderer/components/settings/DialogueDirectorySection.tsx, apps/desktop/src/renderer/components/settings/DingTalkBotSection.tsx, apps/desktop/src/renderer/components/settings/DiscordBotSection.tsx, apps/desktop/src/renderer/components/settings/DownloadMeter.tsx, apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotNotificationSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotSection.tsx, apps/desktop/src/renderer/components/settings/FontFamilyPicker.tsx, apps/desktop/src/renderer/components/settings/GenericGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/GitSafetySection.tsx, apps/desktop/src/renderer/components/settings/HelpAssistantPanel.tsx, apps/desktop/src/renderer/components/settings/HelpSection.tsx, apps/desktop/src/renderer/components/settings/HelpThreadView.tsx, apps/desktop/src/renderer/components/settings/HookConnectionsSection.tsx, apps/desktop/src/renderer/components/settings/HookWorkspacePrefsEditor.tsx, apps/desktop/src/renderer/components/settings/ImBotSection.tsx, apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx, apps/desktop/src/renderer/components/settings/ImDefaultSettingsSection.tsx, apps/desktop/src/renderer/components/settings/ImLifecycleAnnouncementSection.tsx, apps/desktop/src/renderer/components/settings/InputDeviceConnectionStatus.tsx, apps/desktop/src/renderer/components/settings/JoyConGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx, apps/desktop/src/renderer/components/settings/LanguageSection.tsx, apps/desktop/src/renderer/components/settings/LayoutResetControl.tsx, apps/desktop/src/renderer/components/settings/LinkOpenSection.tsx, apps/desktop/src/renderer/components/settings/LocalOllamaInstall.tsx, apps/desktop/src/renderer/components/settings/LocalPackagingTag.tsx, apps/desktop/src/renderer/components/settings/LogoutSection.tsx, apps/desktop/src/renderer/components/settings/LspBetaCell.tsx, apps/desktop/src/renderer/components/settings/McpServerDialog.tsx, apps/desktop/src/renderer/components/settings/McpServersSection.tsx, apps/desktop/src/renderer/components/settings/MemorySection.tsx, apps/desktop/src/renderer/components/settings/MessageNavRailCell.tsx, apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsx, apps/desktop/src/renderer/components/settings/ModelPriceOverrideDialog.tsx, apps/desktop/src/renderer/components/settings/MyDevicesPanel.tsx, apps/desktop/src/renderer/components/settings/NotificationSection.tsx, apps/desktop/src/renderer/components/settings/OAuthDeviceCodeCard.tsx, apps/desktop/src/renderer/components/settings/OllamaProviderDetail.tsx, apps/desktop/src/renderer/components/settings/PiPackagesSection.tsx, apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/ProfileEditDialog.tsx, apps/desktop/src/renderer/components/settings/ProviderConnectionDialog.tsx, apps/desktop/src/renderer/components/settings/ProviderImportDialog.tsx, apps/desktop/src/renderer/components/settings/ProvidersSection.tsx, apps/desktop/src/renderer/components/settings/RemoteControlSection.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopPermissions.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopSetting.tsx, apps/desktop/src/renderer/components/settings/RemoteHostDetail.tsx, apps/desktop/src/renderer/components/settings/RemoteSection.tsx, apps/desktop/src/renderer/components/settings/SessionImportSection.tsx, apps/desktop/src/renderer/components/settings/SessionRuntimeFallbackCell.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/settings/SettingsCatalogPanel.tsx, apps/desktop/src/renderer/components/settings/SettingsSidebarNav.tsx, apps/desktop/src/renderer/components/settings/SettingsTextInput.tsx, apps/desktop/src/renderer/components/settings/SettingsView.tsx, apps/desktop/src/renderer/components/settings/SilentEncryptedRetryCell.tsx, apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx, apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx, apps/desktop/src/renderer/components/settings/StreamFadeSection.tsx, apps/desktop/src/renderer/components/settings/SubagentModelSection.tsx, apps/desktop/src/renderer/components/settings/SwitchProGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/TelegramBehaviorSettings.tsx, apps/desktop/src/renderer/components/settings/TelegramBotSection.tsx, apps/desktop/src/renderer/components/settings/TelegramRemoteDevices.tsx, apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx, apps/desktop/src/renderer/components/settings/TipsSection.tsx, apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx, apps/desktop/src/renderer/components/settings/UserProfileCard.tsx, apps/desktop/src/renderer/components/settings/UserPromptSection.tsx, apps/desktop/src/renderer/components/settings/VisionBridgeSection.tsx, apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx, apps/desktop/src/renderer/components/settings/WechatBotSection.tsx, apps/desktop/src/renderer/components/settings/WecomBotSection.tsx, apps/desktop/src/renderer/components/settings/WindowBehaviorSection.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeyboardLayout.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeycapGlyphs.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx, apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.tsx, apps/desktop/src/renderer/components/settings/XUsageGuide.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx, apps/desktop/src/renderer/components/settings/androidStatusPresentation.ts, apps/desktop/src/renderer/components/settings/billingVisibility.ts, apps/desktop/src/renderer/components/settings/browserOpenForLoginError.ts, apps/desktop/src/renderer/components/settings/cindyMakeVisibility.ts, apps/desktop/src/renderer/components/settings/computerPermissionFlow.ts, apps/desktop/src/renderer/components/settings/contacts/ContactDetailPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsImportDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsListPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsManagerDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsSection.tsx, apps/desktop/src/renderer/components/settings/contacts/startContactsAiSession.ts, apps/desktop/src/renderer/components/settings/dialogueDirectoryDisplay.ts, apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts, apps/desktop/src/renderer/components/settings/feishuBotPresentation.ts, apps/desktop/src/renderer/components/settings/fontFamilyValue.ts, apps/desktop/src/renderer/components/settings/gamepadLayoutPrimitives.tsx, apps/desktop/src/renderer/components/settings/gamepadSilhouetteGeom.ts, apps/desktop/src/renderer/components/settings/hookWorkspacePrefsLogic.ts, apps/desktop/src/renderer/components/settings/imBotVisibility.ts, apps/desktop/src/renderer/components/settings/imDefaultSettingsLogic.ts, apps/desktop/src/renderer/components/settings/joyConSilhouette.ts, apps/desktop/src/renderer/components/settings/modelManagementPresentation.ts, apps/desktop/src/renderer/components/settings/modelManagementState.ts, apps/desktop/src/renderer/components/settings/myDevicesModel.ts, apps/desktop/src/renderer/components/settings/providerAssetModule.ts, apps/desktop/src/renderer/components/settings/realProfilePermissionGuide.ts, apps/desktop/src/renderer/components/settings/switchProSilhouette.ts, apps/desktop/src/renderer/components/settings/ultimateC1Silhouette.ts, apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx, apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx, apps/desktop/src/renderer/components/settings/usage/UsageStatRow.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTokenBars.tsx, apps/desktop/src/renderer/components/settings/usage/formatUsagePercent.ts, apps/desktop/src/renderer/components/settings/usage/usageCharts.css, apps/desktop/src/renderer/components/settings/usage/usageHistoryColors.ts, apps/desktop/src/renderer/components/settings/usage/usageHistoryStats.ts, apps/desktop/src/renderer/components/settings/usageVisibility.ts, apps/desktop/src/renderer/components/settings/useProviderSubscriptionCard.ts, apps/desktop/src/renderer/components/settings/wizardRecommend.ts, apps/desktop/src/renderer/components/settings/workLouderCodexCommandCopy.ts, apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts, apps/desktop/src/renderer/styles/sortable.css | 151 | 109 | 716 |
+| `desktop.settings` | desktop | 设置 | hash `/settings`(SettingsView;tab 含 general / personalization / providers / billing / usage / voice-input / im-bot / shortcuts / agent-island / import / remote-control / ghosts / builtin-tools / computer-use / help / about) | SettingsView | apps/desktop/src/renderer/components/settings/AboutSection.tsx, apps/desktop/src/renderer/components/settings/AccountDeletionSection.tsx, apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx, apps/desktop/src/renderer/components/settings/AgentIslandSection.tsx, apps/desktop/src/renderer/components/settings/AgentResourceSection.tsx, apps/desktop/src/renderer/components/settings/AppearanceSection.tsx, apps/desktop/src/renderer/components/settings/AuxiliaryModelSection.tsx, apps/desktop/src/renderer/components/settings/BetaChannelCell.tsx, apps/desktop/src/renderer/components/settings/BrowserBackendSubsection.tsx, apps/desktop/src/renderer/components/settings/BrowserRealProfileSubsection.tsx, apps/desktop/src/renderer/components/settings/BuiltinToolsSection.tsx, apps/desktop/src/renderer/components/settings/ChatEmbeddingCell.tsx, apps/desktop/src/renderer/components/settings/ChipMetricsSection.tsx, apps/desktop/src/renderer/components/settings/CindyMakeSection.tsx, apps/desktop/src/renderer/components/settings/CollaborationSection.tsx, apps/desktop/src/renderer/components/settings/CompactionSection.tsx, apps/desktop/src/renderer/components/settings/ComposerSendShortcutSection.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionGuideWindow.tsx, apps/desktop/src/renderer/components/settings/ComputerPermissionRow.tsx, apps/desktop/src/renderer/components/settings/ComputerUseSection.tsx, apps/desktop/src/renderer/components/settings/CustomProviderRuntimeFillOverlay.tsx, apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx, apps/desktop/src/renderer/components/settings/DialogueDirectorySection.tsx, apps/desktop/src/renderer/components/settings/DingTalkBotSection.tsx, apps/desktop/src/renderer/components/settings/DiscordBotSection.tsx, apps/desktop/src/renderer/components/settings/DownloadMeter.tsx, apps/desktop/src/renderer/components/settings/ExperimentalSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotNotificationSection.tsx, apps/desktop/src/renderer/components/settings/FeishuBotSection.tsx, apps/desktop/src/renderer/components/settings/FontFamilyPicker.tsx, apps/desktop/src/renderer/components/settings/GenericGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/GitSafetySection.tsx, apps/desktop/src/renderer/components/settings/HelpAssistantPanel.tsx, apps/desktop/src/renderer/components/settings/HelpSection.tsx, apps/desktop/src/renderer/components/settings/HelpThreadView.tsx, apps/desktop/src/renderer/components/settings/HookConnectionsSection.tsx, apps/desktop/src/renderer/components/settings/HookWorkspacePrefsEditor.tsx, apps/desktop/src/renderer/components/settings/ImBotSection.tsx, apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx, apps/desktop/src/renderer/components/settings/ImDefaultSettingsSection.tsx, apps/desktop/src/renderer/components/settings/ImLifecycleAnnouncementSection.tsx, apps/desktop/src/renderer/components/settings/InputDeviceConnectionStatus.tsx, apps/desktop/src/renderer/components/settings/JoyConGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx, apps/desktop/src/renderer/components/settings/LanguageSection.tsx, apps/desktop/src/renderer/components/settings/LayoutResetControl.tsx, apps/desktop/src/renderer/components/settings/LinkOpenSection.tsx, apps/desktop/src/renderer/components/settings/LocalOllamaInstall.tsx, apps/desktop/src/renderer/components/settings/LocalPackagingTag.tsx, apps/desktop/src/renderer/components/settings/LogoutSection.tsx, apps/desktop/src/renderer/components/settings/LspBetaCell.tsx, apps/desktop/src/renderer/components/settings/McpServerDialog.tsx, apps/desktop/src/renderer/components/settings/McpServersSection.tsx, apps/desktop/src/renderer/components/settings/MemorySection.tsx, apps/desktop/src/renderer/components/settings/MessageNavRailCell.tsx, apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsx, apps/desktop/src/renderer/components/settings/ModelPriceOverrideDialog.tsx, apps/desktop/src/renderer/components/settings/MyDevicesPanel.tsx, apps/desktop/src/renderer/components/settings/NotificationSection.tsx, apps/desktop/src/renderer/components/settings/OAuthDeviceCodeCard.tsx, apps/desktop/src/renderer/components/settings/OllamaProviderDetail.tsx, apps/desktop/src/renderer/components/settings/PiPackagesSection.tsx, apps/desktop/src/renderer/components/settings/PlayStationGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/ProfileEditDialog.tsx, apps/desktop/src/renderer/components/settings/ProviderConnectionDialog.tsx, apps/desktop/src/renderer/components/settings/ProviderImportDialog.tsx, apps/desktop/src/renderer/components/settings/ProvidersSection.tsx, apps/desktop/src/renderer/components/settings/RemoteControlSection.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopPermissions.tsx, apps/desktop/src/renderer/components/settings/RemoteDesktopSetting.tsx, apps/desktop/src/renderer/components/settings/RemoteHostDetail.tsx, apps/desktop/src/renderer/components/settings/RemoteSection.tsx, apps/desktop/src/renderer/components/settings/SessionImportSection.tsx, apps/desktop/src/renderer/components/settings/SessionRuntimeFallbackCell.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/settings/SettingsCatalogPanel.tsx, apps/desktop/src/renderer/components/settings/SettingsSidebarNav.tsx, apps/desktop/src/renderer/components/settings/SettingsTextInput.tsx, apps/desktop/src/renderer/components/settings/SettingsView.tsx, apps/desktop/src/renderer/components/settings/SilentEncryptedRetryCell.tsx, apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx, apps/desktop/src/renderer/components/settings/StorageManagementCard.tsx, apps/desktop/src/renderer/components/settings/StreamFadeSection.tsx, apps/desktop/src/renderer/components/settings/SubagentModelSection.tsx, apps/desktop/src/renderer/components/settings/SwitchProGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/TelegramBehaviorSettings.tsx, apps/desktop/src/renderer/components/settings/TelegramBotSection.tsx, apps/desktop/src/renderer/components/settings/TelegramRemoteDevices.tsx, apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx, apps/desktop/src/renderer/components/settings/TipsSection.tsx, apps/desktop/src/renderer/components/settings/UnifiedModelList.tsx, apps/desktop/src/renderer/components/settings/UserProfileCard.tsx, apps/desktop/src/renderer/components/settings/UserPromptSection.tsx, apps/desktop/src/renderer/components/settings/VisionBridgeSection.tsx, apps/desktop/src/renderer/components/settings/VoiceInputSection.tsx, apps/desktop/src/renderer/components/settings/WechatBotSection.tsx, apps/desktop/src/renderer/components/settings/WecomBotSection.tsx, apps/desktop/src/renderer/components/settings/WindowBehaviorSection.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeyboardLayout.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexKeycapGlyphs.tsx, apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx, apps/desktop/src/renderer/components/settings/WorktreeRecycleCard.tsx, apps/desktop/src/renderer/components/settings/XUsageGuide.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadLayout.tsx, apps/desktop/src/renderer/components/settings/XboxGamepadSettings.tsx, apps/desktop/src/renderer/components/settings/androidStatusPresentation.ts, apps/desktop/src/renderer/components/settings/billingVisibility.ts, apps/desktop/src/renderer/components/settings/browserOpenForLoginError.ts, apps/desktop/src/renderer/components/settings/cindyMakeVisibility.ts, apps/desktop/src/renderer/components/settings/computerPermissionFlow.ts, apps/desktop/src/renderer/components/settings/contacts/ContactDetailPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsImportDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsListPane.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsManagerDialog.tsx, apps/desktop/src/renderer/components/settings/contacts/ContactsSection.tsx, apps/desktop/src/renderer/components/settings/contacts/startContactsAiSession.ts, apps/desktop/src/renderer/components/settings/dialogueDirectoryDisplay.ts, apps/desktop/src/renderer/components/settings/dualSenseSilhouette.ts, apps/desktop/src/renderer/components/settings/feishuBotPresentation.ts, apps/desktop/src/renderer/components/settings/fontFamilyValue.ts, apps/desktop/src/renderer/components/settings/gamepadLayoutPrimitives.tsx, apps/desktop/src/renderer/components/settings/gamepadSilhouetteGeom.ts, apps/desktop/src/renderer/components/settings/hookWorkspacePrefsLogic.ts, apps/desktop/src/renderer/components/settings/imBotVisibility.ts, apps/desktop/src/renderer/components/settings/imDefaultSettingsLogic.ts, apps/desktop/src/renderer/components/settings/joyConSilhouette.ts, apps/desktop/src/renderer/components/settings/modelManagementPresentation.ts, apps/desktop/src/renderer/components/settings/modelManagementState.ts, apps/desktop/src/renderer/components/settings/myDevicesModel.ts, apps/desktop/src/renderer/components/settings/providerAssetModule.ts, apps/desktop/src/renderer/components/settings/realProfilePermissionGuide.ts, apps/desktop/src/renderer/components/settings/switchProSilhouette.ts, apps/desktop/src/renderer/components/settings/ultimateC1Silhouette.ts, apps/desktop/src/renderer/components/settings/usage/UsageBreakdownTables.tsx, apps/desktop/src/renderer/components/settings/usage/UsageHistorySection.tsx, apps/desktop/src/renderer/components/settings/usage/UsageStatRow.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTaskTable.tsx, apps/desktop/src/renderer/components/settings/usage/UsageTokenBars.tsx, apps/desktop/src/renderer/components/settings/usage/formatUsagePercent.ts, apps/desktop/src/renderer/components/settings/usage/usageCharts.css, apps/desktop/src/renderer/components/settings/usage/usageHistoryColors.ts, apps/desktop/src/renderer/components/settings/usage/usageHistoryStats.ts, apps/desktop/src/renderer/components/settings/usageVisibility.ts, apps/desktop/src/renderer/components/settings/useProviderSubscriptionCard.ts, apps/desktop/src/renderer/components/settings/wizardRecommend.ts, apps/desktop/src/renderer/components/settings/workLouderCodexCommandCopy.ts, apps/desktop/src/renderer/components/settings/xboxSeriesSilhouette.ts, apps/desktop/src/renderer/styles/sortable.css | 151 | 109 | 717 |
| `desktop.shell.main-layout` | desktop | 主窗口壳(标题栏 / 左右栏 / 内容区) | main BrowserWindow → renderer/index.tsx → main-entry.tsx → App → MainLayout (`#/` 受保护壳) | ChromeActions, DeviceSectionHeader, FeishuConflictDialogHost, GhostMediaLightboxHost, MainLayout, ProjectsSection, RightSidebar, RightSidebarShell, SessionShareImportWizard, Sidebar, UpdateNoticeDialog, WindowControls | apps/desktop/src/renderer/cindy-brain/GhostMediaLightboxHost.tsx, apps/desktop/src/renderer/components/UpdateNoticeDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialog.tsx, apps/desktop/src/renderer/components/feishuBot/FeishuConflictDialogHost.tsx, apps/desktop/src/renderer/components/layout/AppBadgeAttentionSync.tsx, apps/desktop/src/renderer/components/layout/BrowserWebviewPool.tsx, apps/desktop/src/renderer/components/layout/ChromeActions.tsx, apps/desktop/src/renderer/components/layout/ContentHeader.tsx, apps/desktop/src/renderer/components/layout/CredentialStoreBanner.tsx, apps/desktop/src/renderer/components/layout/FadeSwitcher.tsx, apps/desktop/src/renderer/components/layout/GhostPanelWindowLayout.tsx, apps/desktop/src/renderer/components/layout/GlobalDropImportListener.tsx, apps/desktop/src/renderer/components/layout/MainEntryRedirect.tsx, apps/desktop/src/renderer/components/layout/MainLayout.tsx, apps/desktop/src/renderer/components/layout/RightSidebar.tsx, apps/desktop/src/renderer/components/layout/RightSidebarDetach.tsx, apps/desktop/src/renderer/components/layout/RightSidebarMaximize.tsx, apps/desktop/src/renderer/components/layout/RightSidebarToggle.tsx, apps/desktop/src/renderer/components/layout/SidebarWindowLayout.tsx, apps/desktop/src/renderer/components/layout/chromeActionsGeometry.ts, apps/desktop/src/renderer/components/layout/chromeActionsLayout.ts, apps/desktop/src/renderer/components/layout/railChromeActions.ts, apps/desktop/src/renderer/components/layout/windowDrag.tsx, apps/desktop/src/renderer/components/settings/SessionShareImportWizard.tsx, apps/desktop/src/renderer/components/sidebar/AccountSwitcherDialog.tsx, apps/desktop/src/renderer/components/sidebar/AttentionDot.tsx, apps/desktop/src/renderer/components/sidebar/DatabaseSizeWarningBanner.tsx, apps/desktop/src/renderer/components/sidebar/GhostMainViewNavEntries.tsx, apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx, apps/desktop/src/renderer/components/sidebar/Sidebar.tsx, apps/desktop/src/renderer/components/sidebar/SidebarIconButton.tsx, apps/desktop/src/renderer/components/sidebar/SidebarTopNav.tsx, apps/desktop/src/renderer/components/sidebar/SortableList.tsx, apps/desktop/src/renderer/components/sidebar/UpdateBanner.tsx, apps/desktop/src/renderer/components/sidebar/UserInfoSection.tsx, apps/desktop/src/renderer/components/sidebar/VendorIcon.tsx, apps/desktop/src/renderer/components/sidebar/VendorReadinessBadge.tsx, apps/desktop/src/renderer/components/sidebar/WorktreeBadge.tsx, apps/desktop/src/renderer/components/title-bar/ChromeIconButton.tsx, apps/desktop/src/renderer/components/title-bar/MenuButton.tsx, apps/desktop/src/renderer/components/title-bar/WindowControls.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/DeviceSectionHeader.tsx, apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx, apps/desktop/src/renderer/features/right-sidebar/AddTabDropdown.tsx, apps/desktop/src/renderer/features/right-sidebar/EmptyState.tsx, apps/desktop/src/renderer/features/right-sidebar/RightSidebarShell.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBar.tsx, apps/desktop/src/renderer/features/right-sidebar/TabBodyErrorBoundary.tsx, apps/desktop/src/renderer/features/right-sidebar/hooks/useBrowserWebview.ts, apps/desktop/src/renderer/features/right-sidebar/hooks/useNativePopupSurface.ts, apps/desktop/src/renderer/features/right-sidebar/iosSimulatorPluginAvailability.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserPartition.ts, apps/desktop/src/renderer/features/right-sidebar/lib/browserWebviewPool.ts, apps/desktop/src/renderer/features/right-sidebar/lib/detachedSidebarRouting.ts, apps/desktop/src/renderer/features/right-sidebar/lib/executeSidebarCommand.ts, apps/desktop/src/renderer/features/right-sidebar/lib/iosSimulatorFocusBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/lastTurnChangedFiles.ts, apps/desktop/src/renderer/features/right-sidebar/lib/nativePopupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openBackgroundTasksTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openInSidebarFileBrowser.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openRoutinesTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openSubagentsTab.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTerminalShortcut.ts, apps/desktop/src/renderer/features/right-sidebar/lib/openTurnReview.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupRouter.ts, apps/desktop/src/renderer/features/right-sidebar/lib/popupTabs.ts, apps/desktop/src/renderer/features/right-sidebar/lib/rsbBrowserBridge.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarCommands.ts, apps/desktop/src/renderer/features/right-sidebar/lib/sidebarHostSession.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/BackgroundTasksBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowAgentStrip.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/WorkflowProgressTree.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/chatTaskFocusIntent.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/listSessionTasks.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/background-tasks/workflowProgressModel.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/CindyMakeTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/cindy-make/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.css, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/FileBrowserBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/dropExternalFile.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/fileTreeImagePreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/file-browser/useSessionScopedTreeWidth.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/index.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorInstanceGrid.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/IOSSimulatorTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/ios-simulator/iosSimulatorH264Decoder.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersAttentionIcon.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/OrcaWorkersTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/actions.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/closeDecision.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/orca-workers/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/ResourceUsageBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/resource-usage.css, apps/desktop/src/renderer/features/right-sidebar/plugins/resource-usage/subscription.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/ImageDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/MarkdownDiffPreview.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/PlainUnifiedDiff.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/diffRows.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/highlight.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/inlineDiff.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/DiffViewer/useDiffHighlights.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/ReviewTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/diffExpansionPreference.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/fileTree.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/gitApplyCommand.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/review/markdownPreview.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useLastTurnFilter.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewGitState.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/review/useReviewSource.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/routines/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/ConversationStream.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/DetailView.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/RunList.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentToolCard.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/SubagentsBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentChangeFence.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentConversation.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/subagents/subagentFormat.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/TerminalTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/terminal/lib/xtermPool.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserChrome.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserCommentPopover.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/BrowserTabBody.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/browserCommentEditorDraft.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/index.tsx, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/lib/parseOmnibox.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useBrowserComment.ts, apps/desktop/src/renderer/features/right-sidebar/plugins/web-browser/useLocalHtmlAutoReload.ts, apps/desktop/src/renderer/features/right-sidebar/registry.ts, apps/desktop/src/renderer/features/right-sidebar/store.ts, apps/desktop/src/renderer/features/right-sidebar/types.ts, apps/desktop/src/renderer/layout/LayoutRoot.tsx, apps/desktop/src/renderer/layout/PanelDragController.tsx, apps/desktop/src/renderer/layout/PanelDragPrototype.tsx, apps/desktop/src/renderer/layout/collapsePrefs.ts, apps/desktop/src/renderer/layout/layoutDevTools.ts, apps/desktop/src/renderer/layout/panePlacement.tsx, apps/desktop/src/renderer/layout/paneWidths.tsx, apps/desktop/src/renderer/layout/panelMaximize.tsx, apps/desktop/src/renderer/styles/generated/tokens.css, apps/desktop/src/renderer/styles/globals.css | 151 | 46 | 295 |
| `desktop.skillhub.local` | desktop | SkillHub 本地技能 | hash `/skillhub/local` 及统一详情 `/skillhub/detail`(旧详情链接重定向) | InstallTargetPicker, PluginManagementLayout, SkillDetailLayout, SkillhubDetailRoute, SkillhubDetailView, SkillhubFeatureLayout, SkillhubHomeView, SkillhubLocalLayout, SkillhubMarketDetailView | apps/desktop/src/renderer/features/plugin/PluginManagementLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubDetailRoute.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubFeatureLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubHomeView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubLocalLayout.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketDetailView.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillDetailLayout.tsx | 45 | 0 | 60 |
| `desktop.skillhub.market` | desktop | SkillHub 市场 | hash `/skillhub/market`(SkillhubMarketListView) | InstallTargetPicker, MarketCard, MarketInfoEditDialog, SkillhubMarketDetailView, SkillhubMarketListView, VisibilityEditorDialog | apps/desktop/src/renderer/features/skillhub/SkillhubMarketDetailView.tsx, apps/desktop/src/renderer/features/skillhub/SkillhubMarketListView.tsx, apps/desktop/src/renderer/features/skillhub/components/HomeMarketCard.tsx, apps/desktop/src/renderer/features/skillhub/components/InstallTargetPicker.tsx, apps/desktop/src/renderer/features/skillhub/components/LocalSkillControls.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketCard.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketInfoEditDialog.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketInstallStatus.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketListError.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketLocalSkills.tsx, apps/desktop/src/renderer/features/skillhub/components/MarketPreviewTree.tsx, apps/desktop/src/renderer/features/skillhub/components/OfficialSkillBadge.tsx, apps/desktop/src/renderer/features/skillhub/components/PlatformTagSelector.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillCategoryFilterBar.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillDetailLayout.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillIcon.tsx, apps/desktop/src/renderer/features/skillhub/components/SkillTagList.tsx, apps/desktop/src/renderer/features/skillhub/components/TeamScopePicker.tsx, apps/desktop/src/renderer/features/skillhub/components/VisibilityEditorDialog.tsx | 52 | 0 | 60 |
diff --git a/i18n/GLOSSARY.md b/i18n/GLOSSARY.md
index d63430fd41..84a60a64f0 100644
--- a/i18n/GLOSSARY.md
+++ b/i18n/GLOSSARY.md
@@ -211,13 +211,13 @@ Cindy AI 个人账号的免费会员身份标签。只在服务端明确下发 a
Cindy Make 设置中保留全部制作、修改轮次与合入记录的列表;结束制作及清理工作目录后仍可回看。
-### Reapply integration
+### Add back to personal version
重新应用之前明确撤销的制作改动,区别于把尚未合入的新修改首次加入个人源码。
-### Undo integration
+### Remove from personal version
-撤销单次制作已合入个人源码的全部改动,保留其他制作与已有应用成品;通过新的反向提交实现。
+从个人版移除单次制作已经加入的全部改动,保留其他制作与已有应用成品;底层通过新的反向提交实现,不改写 Git 历史。
### Version Control
diff --git a/i18n/glossary.json b/i18n/glossary.json
index 58c04c1069..f25b6d811c 100644
--- a/i18n/glossary.json
+++ b/i18n/glossary.json
@@ -33,24 +33,24 @@
{
"id": "cindy-make-undo-integration",
"status": "proposed",
- "en": "Undo integration",
+ "en": "Remove from personal version",
"translations": {
- "zh-CN": "撤销合入",
- "zh-TW": "撤銷合入",
- "ja": "取り込みを取り消す",
- "ko": "반영 취소"
+ "zh-CN": "从个人版移除",
+ "zh-TW": "從個人版移除",
+ "ja": "個人版から削除",
+ "ko": "개인 버전에서 제거"
},
- "note": "撤销单次制作已合入个人源码的全部改动,保留其他制作与已有应用成品;通过新的反向提交实现。"
+ "note": "从个人版移除单次制作已经加入的全部改动,保留其他制作与已有应用成品;底层通过新的反向提交实现,不改写 Git 历史。"
},
{
"id": "cindy-make-reapply-integration",
"status": "proposed",
- "en": "Reapply integration",
+ "en": "Add back to personal version",
"translations": {
- "zh-CN": "重新合入",
- "zh-TW": "重新合入",
- "ja": "再度取り込む",
- "ko": "다시 반영"
+ "zh-CN": "重新加入个人版",
+ "zh-TW": "重新加入個人版",
+ "ja": "個人版に再追加",
+ "ko": "개인 버전에 다시 추가"
},
"note": "重新应用之前明确撤销的制作改动,区别于把尚未合入的新修改首次加入个人源码。"
},
diff --git a/scripts/__tests__/restart-desktop-remote.test.mjs b/scripts/__tests__/restart-desktop-remote.test.mjs
index 5c60c58431..456272cce8 100644
--- a/scripts/__tests__/restart-desktop-remote.test.mjs
+++ b/scripts/__tests__/restart-desktop-remote.test.mjs
@@ -952,6 +952,17 @@ test("devEnvPrefix passes harness envs through on Windows cmd with quote strippi
);
});
+test("devEnvPrefix carries the Cindy Make test-window marker through restart", () => {
+ assert.equal(
+ devEnvPrefix({ XDT_CINDY_MAKE_TEST: "1" }, "darwin"),
+ "XDT_CINDY_MAKE_TEST='1' CINDY_CUA_SMOKE='0' ",
+ );
+ assert.equal(
+ devEnvPrefix({ XDT_CINDY_MAKE_TEST: "1" }, "win32"),
+ 'set "XDT_CINDY_MAKE_TEST=1" && set "CINDY_CUA_SMOKE=0" && ',
+ );
+});
+
test("devEnvPrefix overrides a stale Computer Use smoke flag in the target shell", () => {
for (const value of [undefined, "", "0", "1", "cursor-goal", "invalid"]) {
const env = value === undefined ? {} : { CINDY_CUA_SMOKE: value };
diff --git a/scripts/restart-desktop-remote.mjs b/scripts/restart-desktop-remote.mjs
index 5cd266d0bb..e46e0da592 100644
--- a/scripts/restart-desktop-remote.mjs
+++ b/scripts/restart-desktop-remote.mjs
@@ -871,6 +871,9 @@ export function devEnvPrefix(env = process.env, platform = process.platform) {
['XDT_SCHEDULER_PASSIVE', env.XDT_SCHEDULER_PASSIVE],
['XDT_ISOLATED', env.XDT_ISOLATED],
['XDT_ISOLATED_NAME', env.XDT_ISOLATED_NAME],
+ // Cindy Make 测试窗口标记必须穿过 restart → dev-env → Forge,
+ // 否则测试进程会退化成普通开发窗口(数据虽隔离,关闭/前台行为却不再是测试版)。
+ ['XDT_CINDY_MAKE_TEST', env.XDT_CINDY_MAKE_TEST],
// 沙箱凭证隔离(--isolated-auth):不与 ~/.codex 共享 auth 硬链,auth-adapters 消费。
['XDT_ISOLATED_AUTH', env.XDT_ISOLATED_AUTH],
['XDT_ALLOW_DEV_OAUTH_WRITE', env.XDT_ALLOW_DEV_OAUTH_WRITE],