Applies the four-reviewer pass over the forge/dashboard-actions work. The through-line is that several capabilities were wired but inert, and one of them could cost real work. DUPLICATE WORK. "Closes #N" was dropped from PR bodies in favour of LinkBranch, which is sidebar linkage on Gitea and a no-op stub on GitHub -- neither closes anything, and nothing else did either. So a merged task left its issue open, labelled and assigned; the next poll re-enqueued it, and once the dashboard's Clear removed the task row that became a second implementation and a second PR for work already merged. reconcilePRs now closes the issue on merge, and a rejected task closes its issue too. A PR closed without merging deliberately leaves the issue open: that usually means "try again". MAX RETRIES. Configured, defaulted and reported by /api/config, and enforced nowhere -- markDead was unreachable and EffectiveMaxRetries had no callers, so the dashboard's retry incremented retry_count forever. The retry action now retires a task to dead at the cap. DEAD ON ARRIVAL. Tasks() never selected plan or source, so the "Decision required" panel could not render and chat tasks -- whose issue number is synthetic -- linked to forge issues that do not exist. COSMETIC FAILURE, FATAL RESULT. OpenPR failed the whole stage when LinkBranch errored, so the pull request was never opened and the task parked; a retry re-links the same branch, which Gitea answers with a conflict, so every retry parked again. It is best-effort now. INVISIBLE ACTIONS. Approve/retry/reject wrote store rows and nothing else, so the timeline and activity stream never showed that a human had intervened. They emit events now. Also: store write failures answer 500 rather than 409; the dashboard surfaces the server's actual reason instead of "409 Conflict"; action buttons stop propagation (acting on a task no longer also expands it), disable in flight, keep per-task errors instead of one shared string, and confirm before rejecting. Removed: the maybeRetryParked shim and markDead with their now-vacuous tests, WaitingTasks (no consumers; its tests were rewritten to assert the same routing through TaskByID), write-only Daemon.Runtime, and dir/dirs response bloat from /api/skills. skillSource checked workDir before sharedDir, mislabelling every shared skill when the two are equal. DefaultRoots now dedupes roots differing only by a trailing separator. The air build rule claiming to keep ui/dist current never ran -- it required one file to satisfy include_dir and include_file together, and ui/ is excluded from the walk. Deleted with the comment that promised it. task test:ui joins task check and CI; it ran nowhere before, so the dashboard suite could rot silently. Docs corrected where they described behaviour that no longer exists: parks no longer comment on the issue, state labels no longer drive retries, and forgerpc's doc claimed four proxied methods while listing three of five.
69 lines
2.2 KiB
Go
69 lines
2.2 KiB
Go
package webui
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/samcharles93/archie-core/internal/skill"
|
|
)
|
|
|
|
// SkillView is one catalogued skill as shown on the dashboard's Skills page:
|
|
// what it does, in plain language, and where it was discovered.
|
|
type SkillView struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Workflow string `json:"workflow,omitempty"`
|
|
Source string `json:"source"`
|
|
}
|
|
|
|
// handleSkills reports the skill catalogue -- what Archie can actually do,
|
|
// beyond what is in the source. It answers the same question a fresh
|
|
// operator would ask by reading internal/skill/, without the reading.
|
|
//
|
|
// The catalogue layers project, explicitly shared, and user-global skills.
|
|
// Earlier roots win when names collide. Missing roots are legitimate and
|
|
// produce an empty or partial catalogue rather than a failed dashboard.
|
|
func (s *Server) handleSkills(w http.ResponseWriter, r *http.Request) {
|
|
if s.Cfg == nil {
|
|
writeJSON(w, map[string]any{"skills": []SkillView{}})
|
|
return
|
|
}
|
|
|
|
roots := skill.DefaultRoots(s.Cfg.WorkDir, s.Cfg.SkillsDir)
|
|
catalog, err := skill.CatalogRoots(roots...)
|
|
if err != nil {
|
|
http.Error(w, "failed to read skill catalogue: "+err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
views := make([]SkillView, 0, len(catalog))
|
|
for _, entry := range catalog {
|
|
views = append(views, SkillView{
|
|
Name: entry.Name,
|
|
Description: entry.Description,
|
|
Workflow: entry.Workflow,
|
|
Source: skillSource(entry.Root, s.Cfg.WorkDir, s.Cfg.SkillsDir),
|
|
})
|
|
}
|
|
|
|
// Each skill already carries its own Source, which is what the page
|
|
// renders. A top-level dir/dirs pair had no consumer and implied the
|
|
// catalog came from one place when it is merged from several.
|
|
writeJSON(w, map[string]any{"skills": views})
|
|
}
|
|
|
|
// skillSource labels where a skill was loaded from.
|
|
//
|
|
// sharedDir is checked first: when it equals workDir the roots collapse to one
|
|
// entry, and matching workDir first labelled every shared skill as a project
|
|
// skill.
|
|
func skillSource(root, workDir, sharedDir string) string {
|
|
switch root {
|
|
case sharedDir:
|
|
return "shared skills"
|
|
case workDir:
|
|
return "project skills"
|
|
default:
|
|
return "user-global skills"
|
|
}
|
|
}
|