Skip to content

fix(doctor): guide users to publish kept docs mirror edits - #1862

Merged
SaulMoro merged 1 commit into
Tencent:mainfrom
XY-code1:fix/doctor-docs-mirror-guidance
Nov 14, 2026
Merged

SaulMoro merged 1 commit into
Tencent:mainfrom
XY-code1:fix/doctor-docs-mirror-guidance

Conversation

@XY-code1

Copy link
Copy Markdown
Collaborator

Summary

When doctor finds a kept edit to a delivered docs-mirror file, explain why a plain push does not find it and point to the explicit file proposal restored in #1855. Leave the mirror, pull behavior, and default push scan unchanged. Only offer the hint for regular files on both sides of a writable team source, not for blocking directories, symlinks, or read-only HTTP teams.

Test plan

  • npx tsc --noEmit
  • npm run build
  • npx vitest run src/__tests__/doctor-delivery.test.ts -t "team docs" (18 passed). The new regression covers unchanged files, kept edits, a blocking directory, and preservation of the edited bytes.
  • The full test file has two unrelated Hermes home failures on this Windows host; both also fail on unmodified main (e6f1ec4).
  • The repository's npm run verify:world exits before creating a world on Windows (POSIX required). See the Windows CLI record below; this is not a verify-world run.

Related issue

Refs #1851. This PR only improves diagnosis and does not add mirror scanning or two-way synchronization.

AI-assisted.

Windows real-CLI record

Built dist/cli.js with Node 24.18.0 and used a temporary home, project, and bare Git remote.

  1. teamai init <fixture-url> --provider git --agent codex --scope project --force and teamai pull exited 0; pull synced one doc into knowledge-base.
  2. teamai doctor exited 0 and did not show the hint before editing knowledge-base/guide.md.
  3. After the edit, teamai doctor exited 1, named the kept file and team destination, and showed the explicit push hint.
  4. teamai push --file knowledge-base/guide.md --path docs/guide.md --dry-run (absolute local path in the run) exited 0 and printed “Would propose … as docs/guide.md” and “Dry run — no changes made.” The edited bytes were unchanged after both doctor and the preview. The temporary fixture was removed.

@XY-code1

Copy link
Copy Markdown
Collaborator Author

Local lint follow-up: the Oxlint stage passed; the Windows documentation-check stage reported stale generated references and did not find fenced workflow examples. I did not regenerate unrelated docs in this PR. The PR description records the focused test and real CLI dry-run results.

@github-actions

Copy link
Copy Markdown

No confident findings in the specified PR diff.

The description documents sufficient testing: a representative Windows real-CLI run covers the unchanged mirror, kept edit, explicit push preview, and byte preservation. It explicitly identifies the verify-world limitation.

Review was read-only; I did not run, build, or install anything from the PR.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Approving at c8a0f66.

What I checked

  • Red on main, green here. With main's doctor-delivery.ts under this head's test, the new case fails because the hint is missing. With the PR's version, all 68 tests in doctor-delivery.test.ts pass.

  • Real CLI on macOS, in a verify world built from this head. Claude, git team repo, workspace scope, one team doc docs/guide.md:

    • after teamai pull, teamai doctor reports Team docs delivered passing, with no hint;
    • after editing .teamai/docs/guide.md, doctor fails, names the kept file and docs/guide.md, and shows the new hint;
    • teamai push --file .teamai/docs/guide.md --path docs/guide.md --dry-run prints Would propose … as docs/guide.md and Dry run — no changes made;
    • the edited bytes are unchanged after doctor and the preview.

    The world reported two leftovers. Both come from my fixture, not this PR: the clone I used to seed the team doc, and .teamai/ holding the member's edited file, which uninstall keeps on main too.

  • Read-only teams. The hint is skipped when repo.kind === 'http', the same condition assertNotReadOnly uses to refuse push. So doctor never suggests a command that would refuse. Self mode keeps the hint, and push --file accepts self mode (read in the code, not run).

  • Scope. One message in doctor, nothing else. Pull, push and the mirror behave as before. Refs #1851, which stays open for the mirror question itself.

[P3 nit]

  • The kept file's team path is already known here, so the hint could print the exact command for each kept file instead of placeholders, for example teamai push --file "<that file>" --path "docs/guide.md". The member could then copy it as is. Optional.
  • On the kept-file line just before it, main's wording says the file is "not teamai's" and to "Rename or delete it". Next to the new hint, that reads as two different instructions for the same file. Not from this PR.

CI review. No findings, and it accepts the Windows real-CLI record. We agree, and the verify world above covers the run on macOS.

Merge risk. Low. One extra sentence in a doctor message, behind a check that only reads the file types.

@SaulMoro
SaulMoro merged commit 94a7514 into Tencent:main Nov 14, 2026
20 checks passed
Walternater added a commit to Walternater/teamai-cli that referenced this pull request Nov 15, 2026
`status` and `push` only scanned the team clone's checkout, which `pull`
keeps clean, so an edit a member made in the docs mirror
(`sharing.docs.localDir`) was invisible while `doctor` skipped those files
as copies (Tencent#1851). Scan the mirror too, at team paths `docs/<rel>`, and
only for docs the team already has: the user-scope mirror is machine-wide,
so a file for a doc the team does not have stays where it is. A mirror
file matching a version in the team history is a copy, not an edit, so a
stale copy never proposes to overwrite the team's newer file. An edit in
the checkout still wins for the same path.

Since plain `push` now offers the edit, drop the `status` section and the
`doctor` sentence from Tencent#1871/Tencent#1862 that said it does not: they would tell
a member the opposite of what `push` does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants