chore(metaagent): рабочее пространство агента и заготовка тестов
CI / Lint & Test (push) Canceled after 0s
CI / Lint & Test (push) Canceled after 0s
- .agent/: контекст, запросы, роадмап, задачи, шаблоны и протоколы - заготовка тестовой инфраструктуры: vitest, eslint, prettier, ci-workflow
This commit is contained in:
1 parent
7443ec059f
commit
3e1d9776c3
66 files changed
+7150
-696
No files matched your search
@@ -40,10 +40,7 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
||||
);
|
||||
this.registerCleanup(() => plugin.app.workspace.offref(pasteRef));
|
||||
|
||||
const dropRef = plugin.app.workspace.on(
|
||||
'editor-drop',
|
||||
this.createDropHandler(rawSettings),
|
||||
);
|
||||
const dropRef = plugin.app.workspace.on('editor-drop', this.createDropHandler(rawSettings));
|
||||
this.registerCleanup(() => plugin.app.workspace.offref(dropRef));
|
||||
}
|
||||
|
||||
@@ -77,9 +74,7 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
||||
settings: AttachmentCleanPasteSettings,
|
||||
evt: ClipboardEvent | DragEvent,
|
||||
): Promise<void> {
|
||||
const matchingFiles = Array.from(files).filter((f) =>
|
||||
this.shouldProcess(f.name, settings),
|
||||
);
|
||||
const matchingFiles = Array.from(files).filter((f) => this.shouldProcess(f.name, settings));
|
||||
if (matchingFiles.length === 0) return;
|
||||
|
||||
evt.preventDefault();
|
||||
@@ -121,10 +116,7 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
||||
};
|
||||
}
|
||||
|
||||
private shouldProcess(
|
||||
filename: string,
|
||||
settings: AttachmentCleanPasteSettings,
|
||||
): boolean {
|
||||
private shouldProcess(filename: string, settings: AttachmentCleanPasteSettings): boolean {
|
||||
const dotIndex = filename.lastIndexOf('.');
|
||||
if (dotIndex === -1) return false;
|
||||
const ext = filename.slice(dotIndex + 1).toLowerCase();
|
||||
@@ -149,9 +141,7 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
||||
const filename = file.name;
|
||||
const nameWithoutExt = filename.replace(/\.[^/.]+$/, '');
|
||||
|
||||
let attachmentFolder = this.app.vault.getConfig(
|
||||
'attachmentFolderPath',
|
||||
) as string;
|
||||
let attachmentFolder = this.app.vault.getConfig('attachmentFolderPath') as string;
|
||||
if (!attachmentFolder) attachmentFolder = 'attachments';
|
||||
|
||||
const folderPath = normalizePath(attachmentFolder);
|
||||
@@ -162,10 +152,7 @@ export class AttachmentCleanPasteModule extends BaseModule {
|
||||
const ext = filename.slice(filename.lastIndexOf('.') + 1);
|
||||
const basePath = normalizePath(`${folderPath}/${nameWithoutExt}`);
|
||||
|
||||
const availablePath = await this.app.vault.getAvailablePath(
|
||||
basePath,
|
||||
ext,
|
||||
);
|
||||
const availablePath = await this.app.vault.getAvailablePath(basePath, ext);
|
||||
|
||||
await this.app.vault.createBinary(availablePath, arrayBuffer);
|
||||
|
||||
|
||||
@@ -28,9 +28,8 @@ export class PreserveLinkAliasesModule extends BaseModule {
|
||||
this.vault = plugin.app.vault;
|
||||
const rawSettings = moduleSettings as PreserveLinkAliasesSettings;
|
||||
|
||||
const renameRef = plugin.app.vault.on(
|
||||
'rename',
|
||||
(file: TFile, oldPath: string) => this.handleRename(file, oldPath, rawSettings),
|
||||
const renameRef = plugin.app.vault.on('rename', (file: TFile, oldPath: string) =>
|
||||
this.handleRename(file, oldPath, rawSettings),
|
||||
);
|
||||
this.registerCleanup(() => plugin.app.vault.offref(renameRef));
|
||||
}
|
||||
@@ -47,24 +46,20 @@ export class PreserveLinkAliasesModule extends BaseModule {
|
||||
.setName(loc.processEmbedsLabel)
|
||||
.setDesc(loc.processEmbedsDesc)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(s.processEmbeds)
|
||||
.onChange(async (value) => {
|
||||
s.processEmbeds = value;
|
||||
await saveSettings();
|
||||
}),
|
||||
toggle.setValue(s.processEmbeds).onChange(async (value) => {
|
||||
s.processEmbeds = value;
|
||||
await saveSettings();
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(loc.processCanvasLabel)
|
||||
.setDesc(loc.processCanvasDesc)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(s.processCanvas)
|
||||
.onChange(async (value) => {
|
||||
s.processCanvas = value;
|
||||
await saveSettings();
|
||||
}),
|
||||
toggle.setValue(s.processCanvas).onChange(async (value) => {
|
||||
s.processCanvas = value;
|
||||
await saveSettings();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -85,7 +80,13 @@ export class PreserveLinkAliasesModule extends BaseModule {
|
||||
|
||||
for (const f of files) {
|
||||
const content = await this.vault.read(f);
|
||||
const updated = this.processContent(content, newName, newBasename, oldBasename, settings);
|
||||
const updated = this.processContent(
|
||||
content,
|
||||
newName,
|
||||
newBasename,
|
||||
oldBasename,
|
||||
settings,
|
||||
);
|
||||
|
||||
if (updated !== content) {
|
||||
await this.vault.modify(f, updated);
|
||||
|
||||
Reference in new issue
Block a user