mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 12:23:22 +00:00
* fix(diff): compare extension agent outputs and apply target filters #392 taught status and doctor to recognise converted extension outputs, but diff (CLI) and the Sync tab (/api/diff) still compared the target directory's *.md files against the source name. A target whose extension renames the output (codex -> .toml) therefore listed every agent as pending after a sync. Both diff paths now use the same manifest-based check as status, and report tracked outputs whose source is gone as prune items. They also apply the target's include/exclude and the agents' frontmatter targets, so an agent that sync would skip is no longer shown as pending. Refs #391 * chore(release): request 0.24.6 The pending feat commits would make Release Please propose 0.25.0. This batch is meant to ship as the 0.24.6 patch, so ask for that version. Release-As: 0.24.6
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"skillshare/internal/config"
|
|
"skillshare/internal/resource"
|
|
"skillshare/internal/sync"
|
|
)
|
|
|
|
func TestComputeAgentDiff_ExtensionOutputInSync(t *testing.T) {
|
|
srcDir, targetDir := t.TempDir(), t.TempDir()
|
|
srcFile := filepath.Join(srcDir, "reviewer.md")
|
|
os.WriteFile(srcFile, []byte("# Reviewer"), 0644)
|
|
agents := []resource.DiscoveredResource{{FlatName: "reviewer.md", AbsPath: srcFile, RelPath: "reviewer.md"}}
|
|
spec := &sync.ExtensionSpec{Run: []string{"cat"}, Dir: srcDir, Name: "id", OutputExt: "toml"}
|
|
if _, err := sync.SyncAgentsTransform(agents, srcDir, targetDir, "copy", spec, false, false); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
r := computeAgentDiff("codex", targetDir, config.ResourceTargetConfig{Extension: "x"}, agents)
|
|
|
|
if !r.synced || len(r.items) != 0 {
|
|
t.Fatalf("expected converted output in sync, got %+v", r.items)
|
|
}
|
|
}
|
|
|
|
func TestComputeAgentDiff_ExcludedAgentIsNotPending(t *testing.T) {
|
|
agents := []resource.DiscoveredResource{{FlatName: "helper.md", AbsPath: "/src/helper.md", RelPath: "helper.md"}}
|
|
|
|
r := computeAgentDiff("claude", t.TempDir(), config.ResourceTargetConfig{Exclude: []string{"helper*"}}, agents)
|
|
|
|
if !r.synced || len(r.items) != 0 {
|
|
t.Fatalf("expected excluded agent to be skipped, got %+v", r.items)
|
|
}
|
|
}
|