Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.
JavaScript agent-orchestrationagentic-workflowai-agentsai-codingclaude-codecode-reviewcodebuddycodexcoding-agentscursordeveloper-toolshuman-on-the-loopllmmcpmulti-agentsdlcself-hostedsopworkflow-automationworkflow-engine
【架构优化】archivedWorkspaceFiles 复用 artifactOutputFiles 并拆出 hasHiddenPathSegment (#540) (#541)
fx-kurumi0f998573658e
diff --git a/internal/engine/workspace_artifacts.go b/internal/engine/workspace_artifacts.goindex dfeef49f..c4c0543e 100644--- a/internal/engine/workspace_artifacts.go+++ b/internal/engine/workspace_artifacts.go@@ -7,6 +7,7 @@ import ("encoding/json""fmt""path/filepath"+ "slices""sort""strings")@@ -30,16 +31,8 @@ func archivedWorkspaceFiles(run domain.Run, executingNode string) []domain.Worksif !excluded[n.ID] {continue}- for _, out := range n.ArtifactOutputs {- if normalizeExecutionScope(n.ExecutionScope) == domain.ExecutionScopeRepositories {- for _, rc := range run.RepositoryContexts() {- if p, ok := artifactRelPath(rc.WorkspaceDir, out.Path); ok {- excludedPaths[p] = true- }- }- } else if p, ok := artifactRelPath("", out.Path); ok {- excludedPaths[p] = true- }+ for _, p := range artifactOutputFiles(run, n) {+ excludedPaths[p] = true}}latest := map[string]domain.Artifact{}@@ -62,13 +55,7 @@ func archivedWorkspaceFiles(run domain.Run, executingNode string) []domain.Worksif rel == "." || filepath.IsAbs(rel) || rel == ".." || strings.HasPrefix(rel, "../") {continue}- hidden := false- for _, part := range strings.Split(rel, "/") {- if strings.HasPrefix(part, ".") {- hidden = true- }- }- if hidden {+ if hasHiddenPathSegment(rel) {continue}old, exists := latest[rel]@@ -93,6 +80,14 @@ func archivedWorkspaceFiles(run domain.Run, executingNode string) []domain.Worksreturn files}+// hasHiddenPathSegment reports whether any slash-separated segment of rel+// starts with "." (dotfiles and dot-directories are never refilled).+func hasHiddenPathSegment(rel string) bool {+ return slices.ContainsFunc(strings.Split(rel, "/"), func(part string) bool {+ return strings.HasPrefix(part, ".")+ })+}+func (e *Engine) restoreArchivedWorkspaceFiles(ctx context.Context, run domain.Run) ([]string, error) {return e.restoreWorkspaceFiles(ctx, run, archivedWorkspaceFiles(run, ""))}diff --git a/internal/engine/workspace_artifacts_hidden_test.go b/internal/engine/workspace_artifacts_hidden_test.gonew file mode 100644index 00000000..41e419ca--- /dev/null+++ b/internal/engine/workspace_artifacts_hidden_test.go@@ -0,0 +1,42 @@+package engine++import (+ "agentflow/internal/domain"+ "testing"+ "time"+)++func TestHasHiddenPathSegment(t *testing.T) {+ t.Parallel()+ cases := map[string]bool{+ "report.md": false,+ "docs/design.md": false,+ "docs/v1.0/notes.md": false,+ ".env": true,+ ".git/config": true,+ "docs/.cache/out.md": true,+ "backend/docs/.hidden": true,+ }+ for rel, want := range cases {+ if got := hasHiddenPathSegment(rel); got != want {+ t.Errorf("hasHiddenPathSegment(%q) = %v, want %v", rel, got, want)+ }+ }+}++func TestArchivedFilesSkipHiddenPaths(t *testing.T) {+ t.Parallel()+ now := time.Now()+ r := domain.Run{+ Nodes: map[string]*domain.NodeRun{"a": {Status: "succeeded"}},+ Artifacts: []domain.Artifact{+ archivedTestFile("a", "docs/report.md", "kept", now),+ archivedTestFile("a", ".env", "secret", now),+ archivedTestFile("a", "docs/.cache/tmp.md", "cache", now),+ },+ }+ files := archivedWorkspaceFiles(r, "")+ if len(files) != 1 || files[0].Path != "docs/report.md" {+ t.Fatalf("hidden paths should be skipped: %+v", files)+ }+}