Просмотр исходного кода

Remove legacy --pull flag and git-specific update code

Removed all git repository detection, git pull, and git status logic
from updateCollections(). Users should now use the update: key in YAML
to specify update commands (like 'git pull').

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Tobi Lutke 5 месяцев назад
Родитель
Сommit
47f58c6c14
2 измененных файлов с 3 добавлено и 54 удалено
  1. 1 0
      .beads/issues.jsonl
  2. 2 54
      src/qmd.ts

+ 1 - 0
.beads/issues.jsonl

@@ -33,4 +33,5 @@
 {"id":"qmd-vro","title":"Update 'qmd get' to support virtual paths","description":"Allow qmd get to accept both virtual paths (qmd://journals/...) and filesystem paths, plus fuzzy matching by filename.","status":"closed","priority":0,"issue_type":"task","created_at":"2025-12-12T15:29:53.963113-05:00","updated_at":"2025-12-12T15:47:29.178955-05:00","closed_at":"2025-12-12T15:47:29.178955-05:00","dependencies":[{"issue_id":"qmd-vro","depends_on_id":"qmd-ama","type":"discovered-from","created_at":"2025-12-12T15:29:53.963641-05:00","created_by":"daemon"}]}
 {"id":"qmd-x19","title":"Update 'qmd add-context' for collection-scoped contexts","description":"Update add-context to work with collections:\n- qmd add-context \u003ccollection\u003e/\u003cpath\u003e \"context description\"\n- Support both virtual and filesystem paths\n- Update to use new path_contexts schema","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-12T15:29:38.142575-05:00","updated_at":"2025-12-12T15:53:00.525001-05:00","closed_at":"2025-12-12T15:53:00.525001-05:00"}
 {"id":"qmd-x64","title":"for each collection, on update, check if there is a .git directory, if so write out the git status, add --pull as a qmd update --pull parameter which also executes git pull before reindexing\n","description":"","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-12T17:04:15.994054-05:00","updated_at":"2025-12-12T17:14:40.107181-05:00","closed_at":"2025-12-12T17:14:40.107181-05:00"}
+{"id":"qmd-yzj","title":"Add optional update: command support to collections YAML","description":"Collections can now specify an optional 'update:' key with a bash command that will be executed during 'qmd update' before indexing files. Runs in cwd, prints output, stops on error.","status":"open","priority":2,"issue_type":"feature","created_at":"2025-12-13T11:16:32.527608-05:00","updated_at":"2025-12-13T11:16:32.527608-05:00"}
 {"id":"qmd-zin","title":"Improve qmd ls command to be more like ls -l with colors","description":"Make qmd ls more Unix-like:\n1. Format like ls -l with columns (permissions, size, date, name)\n2. Add colors (directories, files, etc.)\n3. Dim the qmd:// prefix to show it's optional\n4. Show file sizes in human-readable format\n5. Show modification times\n6. Consider adding -l flag for long format","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-13T09:44:48.703843-05:00","updated_at":"2025-12-13T09:48:22.298822-05:00","closed_at":"2025-12-13T09:48:22.298822-05:00"}

+ 2 - 54
src/qmd.ts

@@ -522,7 +522,7 @@ function showStatus(): void {
   closeDb();
 }
 
-async function updateCollections(pullFirst: boolean = false): Promise<void> {
+async function updateCollections(): Promise<void> {
   const db = getDb();
   cleanupDuplicateCollections(db);
 
@@ -578,58 +578,6 @@ async function updateCollections(pullFirst: boolean = false): Promise<void> {
       }
     }
 
-    // Check if this is a git repository (for legacy support)
-    const gitDir = `${col.pwd}/.git`;
-    let isGitRepo = false;
-
-    try {
-      const stat = await Bun.file(gitDir).exists();
-      isGitRepo = stat;
-    } catch {
-      // Not a git repo or can't access
-      isGitRepo = false;
-    }
-
-    if (isGitRepo) {
-      console.log(`${c.dim}    Git repository detected${c.reset}`);
-
-      // Execute git pull if requested via --pull flag
-      if (pullFirst && !yamlCol?.update) {
-        console.log(`${c.dim}    Running git pull...${c.reset}`);
-        try {
-          const result = await $`cd ${col.pwd} && git pull`.quiet();
-          if (result.exitCode === 0) {
-            const output = result.stdout.toString().trim();
-            if (output) {
-              // Show output but dimmed
-              console.log(`${c.dim}    ${output.split('\n').join('\n    ')}${c.reset}`);
-            }
-          } else {
-            const stderr = result.stderr.toString().trim();
-            console.log(`${c.yellow}    Warning: git pull failed: ${stderr}${c.reset}`);
-          }
-        } catch (err) {
-          console.log(`${c.yellow}    Warning: git pull failed: ${err}${c.reset}`);
-        }
-      }
-
-      // Show git status
-      try {
-        const statusResult = await $`cd ${col.pwd} && git status --short`.quiet();
-        if (statusResult.exitCode === 0) {
-          const statusOutput = statusResult.stdout.toString().trim();
-          if (statusOutput) {
-            console.log(`${c.dim}    Git status:${c.reset}`);
-            console.log(`${c.dim}    ${statusOutput.split('\n').join('\n    ')}${c.reset}`);
-          } else {
-            console.log(`${c.dim}    Git status: clean${c.reset}`);
-          }
-        }
-      } catch (err) {
-        // Silently ignore git status errors
-      }
-    }
-
     await indexFiles(col.pwd, col.glob_pattern);
     console.log("");
   }
@@ -2678,7 +2626,7 @@ switch (cli.command) {
     break;
 
   case "update":
-    await updateCollections(cli.values.pull || false);
+    await updateCollections();
     break;
 
   case "embed":