Repository navigation
feat(review): add read-only health checks for pushed branches - #1058
Conversation
`teamai review --branch <name>` checks a branch `teamai push` created (`teamai/push/<user>/<timestamp>`) without checking anything out, and reports findings at three levels: fail (must fix), warn (needs a human decision) and info (context). It answers the gap Tencent#776 names: when the Git host cannot open a PR/MR, a human merging by hand had no signal about whether the new resources are usable. `--json` prints the same result for CI to gate on. The checks reuse pull's own code paths rather than re-implementing them: structure (SKILL.md at the skill root; the namespace declared on the resource type's NAMESPACE_AXIS), naming (path segments; frontmatter name vs directory), duplicates (the same name in two co-active namespaces), format (skill frontmatter and description; agent spec via parseAgentYaml) and leaks (utils/redact credential shapes, plus internal addresses). Refs Tencent#776
Testing: The PR description includes a representative real-CLI verification record, satisfying the review requirement. No missing-e2e finding applies. I did not run, build, or install PR code. |
What
teamai review --branch <name>runs read-only health checks over a branchteamai pushcreated (teamai/push/<user>/<timestamp>) and reports findings at three levels —fail(must fix),warn(needs a human decision),info(context).--jsonprints the same object for CI, and the command exits non-zero when anyfailfinding exists.Fixes #776 (the "Add Skill health checks / validation" pair from the roadmap in #647, labelled
help wanted).Why
When the Git host cannot open a PR/MR (a plain
ssh://remote, for example),teamai pushstill lands new resources on a push branch, but nothing tells the human who merges by hand whether those resources are usable. This closes that gap.How
Strictly read-only: the branch tree is read out of git's object store (
git ls-tree/git show, via the existinglistFilesAtRev/getFileContentAtRev) into a temp dir and is never checked out into the team repo; nothing is written back.The checks reuse pull's own code paths instead of re-implementing them —
scanTeamForPull(what counts as a resource),loadRolesManifestIfPresent/loadProjectsManifest,NAMESPACE_AXIS,parseAgentYaml,splitFrontmatter,isSafeNamespaceSegmentandutils/redact— so a branch this command calls clean is onepullreads the same way.Checks implemented:
SKILL.mdat the skill root; the namespace is declared on the resource type's axis (NAMESPACE_AXIS)namematches the directory/file namepullfail)descriptionexplains when to use the skill; agent specs parse viaparseAgentYamlutils/redact, plus internal addresses (RFC 1918 /.internal/.corp/.lan)Surface note
The issue proposed
teamai review <branch>.teamai review [id]already exists for.teamai/pending-review.jsonl, so following the repo convention of extending an existing command this adds a--branch <name>option to it. The existing pending-review behaviour is unchanged — it only diverts when--branchis present. Happy to move it to a positional argument or a separate command if you prefer.Testing
vitest run src/__tests__/review-branch.test.ts→ 11 passed: clean branch passes; missingSKILL.mdfails; resource in a namespace no role/project declares fails; co-active duplicate fails and the never-co-active case does not; frontmatter/directory name mismatch fails; missingdescriptionwarns; credential and internal address fail; agent name mismatch fails;--jsonshape.tsc --noEmit→ clean.oxlinton the touched files → 0 warnings / 0 errors.teamai/push/...branch: 4 fail / 1 warn reported,--jsonemitted the documented object, an unknown branch exits 1, and the team repo was left clean onmain(git status --porcelainempty).Deferred (a reviewer may want these)
conventionschecks (the issue said they stay off by default)format/namingcoverage for rules is thinner than for skills/agentsadditionalRolescan still produce a false negative, never a false positivegit cat-file --batchwould cut I/O on large repossrc/__tests__/e2e/yet (the real CLI record is above)