fix(qmd): skip git-ignored paths in repository collections

The daemon passes `git ls-files --others --ignored --directory` as
escaped ignore globs to addCollection. QMD's YAML write-through drops
`ignore` and index.yml wins on every re-sync, so the list is also
written into index.yml and re-synced whenever it changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian lechnerandClaude Opus 5.5 committed 2026-10-08 12:45:27 +02:00
1 parent abface2293
commit 691ad6a69f
4 files changed
+102 -9

No files matched your search

+11 -1
View File
@@ -1,4 +1,4 @@
// shared/qmd/qmd-config.mjs — edits only the models: block of QMD's index.yml.
// shared/qmd/qmd-config.mjs — edits only the models: block and setup-owned collection ignore lists in QMD's index.yml.
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
@@ -33,6 +33,16 @@ export function unsetModels(text, YAML) {
return document.contents === null || document.contents.items?.length === 0 ? '' : document.toString();
}
// Returns the new text, or null when index.yml has no such collection (QMD's write-through always creates it).
export function setCollectionIgnore(text, YAML, name, ignore) {
const document = YAML.parseDocument(text || '');
if (document.errors.length) throw new Error(`index.yml cannot be parsed: ${document.errors[0].message}`);
if (!document.hasIn(['collections', name])) return null;
if (ignore.length) document.setIn(['collections', name, 'ignore'], document.createNode(ignore));
else document.deleteIn(['collections', name, 'ignore']);
return document.toString();
}
async function main(action, argument) {
if (!['set-models', 'unset-models', 'restore-models'].includes(action)) throw new Error('usage: qmd-config.mjs set-models|unset-models|restore-models <json>');
const YAML = await import(pathToFileURL(join(qmdPackageDir(), 'node_modules', 'yaml', 'dist', 'index.js')).href);