refactor(git): share the info/exclude writer with the findings store
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using ClaudeDo.Worker.Git;
|
||||
|
||||
namespace ClaudeDo.Worker.Findings;
|
||||
|
||||
@@ -21,7 +22,8 @@ public sealed class FindingsStore : IFindingsStore
|
||||
public static string TrapsDir(string workingDir) => Path.Combine(StoreDir(workingDir), "traps");
|
||||
public static string IndexPath(string workingDir) => Path.Combine(StoreDir(workingDir), "INDEX.md");
|
||||
|
||||
public async Task<SaveFindingOutcome> SaveAsync(string workingDir, FindingInput input, CancellationToken ct)
|
||||
public async Task<SaveFindingOutcome> SaveAsync(
|
||||
string workingDir, FindingInput input, CancellationToken ct, bool tracked = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input.Slug) || input.Slug.Length > 60 || !SlugPattern.IsMatch(input.Slug))
|
||||
throw new ArgumentException(
|
||||
@@ -35,6 +37,9 @@ public sealed class FindingsStore : IFindingsStore
|
||||
var trapsDir = TrapsDir(workingDir);
|
||||
Directory.CreateDirectory(trapsDir);
|
||||
|
||||
if (!tracked)
|
||||
await GitExcludeWriter.AppendLineAsync(workingDir, "/.claudedo/", ct);
|
||||
|
||||
var path = Path.Combine(trapsDir, input.Slug + ".md");
|
||||
var created = !File.Exists(path);
|
||||
|
||||
|
||||
@@ -18,5 +18,5 @@ public sealed record SaveFindingOutcome(
|
||||
|
||||
public interface IFindingsStore
|
||||
{
|
||||
Task<SaveFindingOutcome> SaveAsync(string workingDir, FindingInput input, CancellationToken ct);
|
||||
Task<SaveFindingOutcome> SaveAsync(string workingDir, FindingInput input, CancellationToken ct, bool tracked = false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user