fix: Phase 4 structural refactor — reduce lint findings from 28 to 5
cyclop (5→0): extract subcommand/case bodies in codesearch, subprocess, Telegram, indexing funlen (5→3): extract memory action handlers, tool provider startup gocognit (7→2): extract config finalize/loadDirInto helpers, release announcer, capture tool validation, Telegram gateway (200→108), archie-agent main loop (35→0) nestif (8→0): extract identity validation, container validation, conf.d scanning, email multipart parsing, Telegram model/update parsing, build-no-changes closure interfacebloat (3→0): split Forge/IssueForge/PRForge/RepoForge, SessionStore/SessionLifecycle/MessageHistory, TaskStore/TaskLifecycle/TaskQueries/TaskEvents Remaining: daemon process, workflow Feasibility/TDD/AgentStage, archied main.go run (108→30 remaining). These require deeper refactoring best done per-function in follow-up beads. Updated contract tests and archied wiring tests to check both main.go and the new telegram_setup.go.
This commit is contained in:
1 parent
676ad3fe48
commit
712388dc6c
24 files changed
+1090
-886
No files matched your search
+17
-11
@@ -54,17 +54,7 @@ func StageCommit(name string, message func(*TaskContext) string) Stage {
|
||||
func StageCommitPush(message func(*TaskContext) string) Stage {
|
||||
return Stage{Name: "commit-push", Run: func(ctx context.Context, tc *TaskContext) error {
|
||||
if tc.BuildNoChanges {
|
||||
if tc.Task.IsForgeBacked() {
|
||||
body := fmt.Sprintf("**archie closed this issue -- no changes required.**\n\n%s", tc.BuildSummary)
|
||||
if _, err := tc.Forge.Comment(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, body); err != nil {
|
||||
tc.Log.Warn("no-op close comment failed", "err", err)
|
||||
}
|
||||
if err := tc.Forge.CloseIssue(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
tc.Outcome = Outcome{Status: store.StatusMerged, Detail: "completed -- no changes required"}
|
||||
return nil
|
||||
return closeNoChangesIssue(ctx, tc)
|
||||
}
|
||||
commit := StageCommit("commit-push", message)
|
||||
if err := commit.Run(ctx, tc); err != nil {
|
||||
@@ -74,6 +64,22 @@ func StageCommitPush(message func(*TaskContext) string) Stage {
|
||||
}}
|
||||
}
|
||||
|
||||
func closeNoChangesIssue(ctx context.Context, tc *TaskContext) error {
|
||||
if !tc.Task.IsForgeBacked() {
|
||||
tc.Outcome = Outcome{Status: store.StatusMerged, Detail: "completed -- no changes required"}
|
||||
return nil
|
||||
}
|
||||
body := fmt.Sprintf("**archie closed this issue -- no changes required.**\n\n%s", tc.BuildSummary)
|
||||
if _, err := tc.Forge.Comment(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, body); err != nil {
|
||||
tc.Log.Warn("no-op close comment failed", "err", err)
|
||||
}
|
||||
if err := tc.Forge.CloseIssue(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
tc.Outcome = Outcome{Status: store.StatusMerged, Detail: "completed -- no changes required"}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StageDiffCap parks tasks whose diff exceeds the configured line cap --
|
||||
// oversized changes need human pre-approval, not an auto-opened PR.
|
||||
func StageDiffCap() Stage {
|
||||
|
||||
Reference in new issue
Block a user