Repository navigation
fix(push): carry teamai.yaml config changes through push - #323
Merged
Merged
Conversation
`teamai source add` writes sources/publicSkills into the team repo's teamai.yaml without committing, then tells the user to run `teamai push`. But push did not handle teamai.yaml at all: 1. resetToCleanMaster's `git reset --hard` silently destroyed the uncommitted edit before it could be committed. 2. teamai.yaml was never in the commit file list (whitelist of resource dirs only), so even a surviving edit was ignored. 3. A config-only change (no resource edits) exited early with "No new or modified resources to push". Fixes: - Capture teamai.yaml working-tree content before reset, restore it on top of the freshly pulled branch (survives reset --hard). - Include teamai.yaml in gitFiles when the user edited it, so it rides along in the same PR as resources. - Add pushTeamConfigOnly() for the config-only case so `source add`'s "Run teamai push" advice actually propagates the change. All provider-agnostic (no github/gitlab/tgit special-casing); PR creation goes through the existing createPrWithFallback abstraction. Also fixes the docs claim that sources live in local config.yaml — they live in the team repo's teamai.yaml and are shared via push. Tested: - tsc --noEmit, npm run build, full vitest suite (2187 tests) green - New real-git integration test (push-team-config.test.ts): source-add edit survives real reset --hard and lands on the pushed branch - Real CLI e2e against git.woa.com: init e2e-test-repo, source add teamai-dev-repo, push --all → teamai.yaml with sources reached the remote branch; baseline master had none (test branch + MR cleaned up)
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
`teamai source add` writes sources/publicSkills into the team repo's teamai.yaml without committing, then tells the user to run `teamai push`. But push did not handle teamai.yaml at all: 1. resetToCleanMaster's `git reset --hard` silently destroyed the uncommitted edit before it could be committed. 2. teamai.yaml was never in the commit file list (whitelist of resource dirs only), so even a surviving edit was ignored. 3. A config-only change (no resource edits) exited early with "No new or modified resources to push". Fixes: - Capture teamai.yaml working-tree content before reset, restore it on top of the freshly pulled branch (survives reset --hard). - Include teamai.yaml in gitFiles when the user edited it, so it rides along in the same PR as resources. - Add pushTeamConfigOnly() for the config-only case so `source add`'s "Run teamai push" advice actually propagates the change. All provider-agnostic (no github/gitlab/tgit special-casing); PR creation goes through the existing createPrWithFallback abstraction. Also fixes the docs claim that sources live in local config.yaml — they live in the team repo's teamai.yaml and are shared via push. Tested: - tsc --noEmit, npm run build, full vitest suite (2187 tests) green - New real-git integration test (push-team-config.test.ts): source-add edit survives real reset --hard and lands on the pushed branch - Real CLI e2e against git.woa.com: init e2e-test-repo, source add teamai-dev-repo, push --all → teamai.yaml with sources reached the remote branch; baseline master had none (test branch + MR cleaned up)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
teamai source add(andsource remove) edits the team repo'steamai.yaml— writing thesources/publicSkillsa team subscribes to — and then prints "Runteamai pushto share this change with your team." Butteamai pushdid not handleteamai.yamlat all, so that advice was broken in three compounding ways:pushstarts by callingresetToCleanMaster, whosegit reset --hardsees the dirtyteamai.yamland silently discards the user'ssource addedit before anything is committed.gitFiles) is a whitelist of resource dirs (skills/,rules/,env/, …).teamai.yamlis never in it, so even a surviving edit would be ignored.teamai.yaml(no resource changes),pushreturns atallItems.length === 0with "No new or modified resources to push" — the change never leaves their machine.Net effect: subscribing to another team's public skill repo could not actually be shared with the team, and the attempt could destroy the edit.
Fix
All in
src/push.ts, on the normal dedicated-repo path (notselfmode):teamai.yamlbeforeresetToCleanMaster, then re-write it on top of the freshly pulled default branch.teamai.yamltogitFileswhen the user edited it, so config rides along in the same PR as any skills/rules.pushTeamConfigOnly()handles the "onlyteamai.yamlchanged" case sosource add's advice actually works.The change is provider-agnostic — no github/gitlab/tgit special-casing. PR/MR creation goes through the existing
createPrWithFallback→getProvider(...).createPullRequest(...)abstraction, so GitHub, GitLab, and TGit are all covered by the path that already ships skills.Docs: also corrected
docs/usage-guide.md/.zh-CN.md, which wrongly claimed subscriptions live in the localconfig.yaml. They live in the team repo'steamai.yamland are shared via push.Test Plan
npx tsc --noEmit— cleannpm run build— cleannpx vitest run— full suite green (163 files / 2187 tests), zero regressionssrc/__tests__/push-team-config.test.ts— drives realpush()against a local bare remote + clone (mocking only the provider PR call): asource add-style edit survives the realgit reset --hardand lands on the pushed branch; a no-op push creates no PR.git.woa.com(throwawayHOME, isolated from real~/.teamai):teamai init e2e-test-repo→teamai source add teamai-dev-repo→teamai push --all. The pushed remote branch'steamai.yamlcontainedsources: e2e-dev; baselineorigin/masterhad none. Test branch and the auto-created MR were cleaned up afterward.