mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 02:30:47 -08:00
Fix/start error (#654)
* fix: lint
* chore: upgrade electron-ipc-cat to add try catch but useless
IPC Server: Sending response {
channel: 'ContextChannel',
request: { type: 'apply', propKey: 'get', args: [ 'supportedLanguagesMap' ] },
correlationId: '0.36061460136077916',
result: {}
}
Error sending from webFrameMain: Error: Failed to serialize arguments
at WebFrameMain.s.send (node:electron/js2c/browser_init:2:94282)
at WebContents.b.send (node:electron/js2c/browser_init:2:78703)
at I:\github\TidGi-Desktop.vite\build\main-BW_u7Pqi.js:39200:28
IPC Server: Sending response {
channel: 'ContextChannel',
request: { type: 'apply', propKey: 'get', args: [ 'supportedLanguagesMap' ] },
correlationId: '0.7064988939670734',
result: {}
}
Error sending from webFrameMain: Error: Failed to serialize arguments
at WebFrameMain.s.send (node:electron/js2c/browser_init:2:94282)
at WebContents.b.send (node:electron/js2c/browser_init:2:78703)
at I:\github\TidGi-Desktop.vite\build\main-BW_u7Pqi.js:39200:28
Proxy 对象不能被序列化
* fix: process.resourcesPath changes during app initialization, need to wait for it when start with scheme
* fix: Realign workspace view when reopening window to ensure browser view is properly positioned
fixes #626
* feat: api for git-sync-js to get deleted files
* fix: wikiWorker methods should be async
* log debug not info
* fix: database should init frist before i18n
* fix: better error log when workspace config error
* chore: add maker-msix for windows
* fix: window.meta is not a function when view on browser
* feat: add more git services
* fix: discard file content cause lots of logs
fixes #653
* Update wiki
* test: Git Log window auto-refreshes when files change (only when window is open)
* test: use test id to wait and make test id debug log
* update i18n
* i18n
* lint
* Update test.yml
* Update test.yml
* Update index.tsx
This commit is contained in:
parent
99c6d78078
commit
0e96d94809
54 changed files with 1416 additions and 600 deletions
|
|
@ -38,6 +38,7 @@ export class Git implements IGitService {
|
|||
@inject(serviceIdentifier.Preference) private readonly preferenceService: IPreferenceService,
|
||||
@inject(serviceIdentifier.Authentication) private readonly authService: IAuthenticationService,
|
||||
@inject(serviceIdentifier.NativeService) private readonly nativeService: INativeService,
|
||||
@inject(serviceIdentifier.Window) private readonly windowService: IWindowService,
|
||||
) {}
|
||||
|
||||
private notifyGitStateChange(wikiFolderLocation: string, type: IGitStateChange['type']): void {
|
||||
|
|
@ -48,6 +49,26 @@ export class Git implements IGitService {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Public method to notify file system changes
|
||||
* Called by watch-fs plugin when files are modified
|
||||
*/
|
||||
public notifyFileChange(wikiFolderLocation: string, options?: { onlyWhenGitLogOpened?: boolean }): void {
|
||||
const { onlyWhenGitLogOpened = true } = options ?? {};
|
||||
|
||||
// If we should only notify when git log is open, check if the window exists
|
||||
if (onlyWhenGitLogOpened) {
|
||||
const gitLogWindow = this.windowService.get(WindowNames.gitHistory);
|
||||
|
||||
// If no git log window is open, skip notification
|
||||
if (!gitLogWindow) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.notifyGitStateChange(wikiFolderLocation, 'file-change');
|
||||
}
|
||||
|
||||
public async initialize(): Promise<void> {
|
||||
await this.initWorker();
|
||||
// Register menu items after initialization
|
||||
|
|
@ -206,7 +227,7 @@ export class Git implements IGitService {
|
|||
.subscribe(this.getWorkerMessageObserver(wikiFolderPath, resolve, reject));
|
||||
});
|
||||
// Log for e2e test detection - indicates initial git setup and commits are complete
|
||||
logger.info(`[test-id-git-init-complete]`, { wikiFolderPath });
|
||||
logger.debug(`[test-id-git-init-complete]`, { wikiFolderPath });
|
||||
}
|
||||
|
||||
public async commitAndSync(workspace: IWorkspace, configs: ICommitAndSyncConfigs): Promise<boolean> {
|
||||
|
|
@ -230,19 +251,19 @@ export class Git implements IGitService {
|
|||
// Generate AI commit message if not provided and settings allow
|
||||
let finalConfigs = configs;
|
||||
if (!configs.commitMessage) {
|
||||
logger.info('No commit message provided, attempting to generate AI commit message');
|
||||
logger.debug('No commit message provided, attempting to generate AI commit message');
|
||||
const { generateAICommitMessage } = await import('./aiCommitMessage');
|
||||
const aiCommitMessage = await generateAICommitMessage(workspace.wikiFolderLocation);
|
||||
if (aiCommitMessage) {
|
||||
finalConfigs = { ...configs, commitMessage: aiCommitMessage };
|
||||
logger.info('Using AI-generated commit message', { commitMessage: aiCommitMessage });
|
||||
logger.debug('Using AI-generated commit message', { commitMessage: aiCommitMessage });
|
||||
} else {
|
||||
// If AI generation fails or times out, use default message
|
||||
logger.info('AI commit message generation returned undefined, using default message');
|
||||
logger.debug('AI commit message generation returned undefined, using default message');
|
||||
finalConfigs = { ...configs, commitMessage: i18n.t('LOG.CommitBackupMessage') };
|
||||
}
|
||||
} else {
|
||||
logger.info('Commit message already provided, skipping AI generation', { commitMessage: configs.commitMessage });
|
||||
logger.debug('Commit message already provided, skipping AI generation', { commitMessage: configs.commitMessage });
|
||||
}
|
||||
|
||||
const observable = this.gitWorker?.commitAndSyncWiki(workspace, finalConfigs, getErrorMessageI18NDict());
|
||||
|
|
@ -252,7 +273,7 @@ export class Git implements IGitService {
|
|||
const changeType = configs.commitOnly ? 'commit' : 'sync';
|
||||
this.notifyGitStateChange(workspace.wikiFolderLocation, changeType);
|
||||
// Log for e2e test detection
|
||||
logger.info(`[test-id-git-${changeType}-complete]`, { wikiFolderLocation: workspace.wikiFolderLocation });
|
||||
logger.debug(`[test-id-git-${changeType}-complete]`, { wikiFolderLocation: workspace.wikiFolderLocation });
|
||||
return hasChanges;
|
||||
} catch (error: unknown) {
|
||||
const error_ = error as Error;
|
||||
|
|
@ -363,7 +384,7 @@ export class Git implements IGitService {
|
|||
// Notify git state change
|
||||
this.notifyGitStateChange(wikiFolderPath, 'checkout');
|
||||
// Log for e2e test detection
|
||||
logger.info(`[test-id-git-checkout-complete]`, { wikiFolderPath, commitHash });
|
||||
logger.debug(`[test-id-git-checkout-complete]`, { wikiFolderPath, commitHash });
|
||||
}
|
||||
|
||||
public async revertCommit(wikiFolderPath: string, commitHash: string, commitMessage?: string): Promise<void> {
|
||||
|
|
@ -372,7 +393,7 @@ export class Git implements IGitService {
|
|||
// Notify git state change
|
||||
this.notifyGitStateChange(wikiFolderPath, 'revert');
|
||||
// Log for e2e test detection
|
||||
logger.info(`[test-id-git-revert-complete]`, { wikiFolderPath, commitHash });
|
||||
logger.debug(`[test-id-git-revert-complete]`, { wikiFolderPath, commitHash });
|
||||
} catch (error) {
|
||||
logger.error('revertCommit failed', { error, wikiFolderPath, commitHash, commitMessage });
|
||||
throw error;
|
||||
|
|
@ -404,4 +425,12 @@ export class Git implements IGitService {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async getDeletedTiddlersSinceDate(wikiFolderPath: string, sinceDate: Date): Promise<string[]> {
|
||||
return await gitOperations.getDeletedTiddlersSinceDate(wikiFolderPath, sinceDate);
|
||||
}
|
||||
|
||||
public async getTiddlerAtTime(wikiFolderPath: string, tiddlerTitle: string, beforeDate: Date): Promise<{ fields: Record<string, unknown>; text: string } | null> {
|
||||
return await gitOperations.getTiddlerAtTime(wikiFolderPath, tiddlerTitle, beforeDate);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue