Tencent / Tencent/teamai-cli

[feat] init --agent 时创建工具目录并做一次初始同步,修正 pull 的虚报计数

Open
#585 1 comment 0 reactions 1 assignee View on GitHub

@Morrowga is already working on this.

Since Sep 16, 2026.

bug help wanted
Dominant language
TypeScript
Stars
4.8k
Forks
342
Avg merge
13h 48m
Merged PRs (30d)
211

Description

关联 #574

背景

#574 反映:init 不做初始同步,pull 在工具目录不存在时静默跳过却打印 Synced N rule(s),新成员按文档走完看到「成功」但磁盘上没有任何规则文件。

改动

1. init --agent 触发建目录 + 初始同步

teamai init <repo> --agent claude,codex 已明确声明要用哪些 agent,此时:

  • enabledAgents(排除 disabledAgents)创建工具根目录,已存在则跳过;
  • 立即执行一次全量 pull,落盘 rules / CLAUDE.md / AGENTS.md
  • 收尾输出报告实际写盘内容,不再只说 "will auto-sync on each session start"。

user / project scope 均适用;--dry-run 只打印计划。
不带 --agent 时行为完全不变,不凭空建目录,仍由 SessionStart hook 驱动。

2. pull 不再虚报

Synced N 只计实际写盘数量;因工具目录不存在而跳过时,在默认日志级别可见并给出下一步。

3. --force 绕过 isToolInstalled

显式 --force 的语义是「无论如何都同步」。

实现要点

  • 复用 seedSelfModeToolDirssrc/known-agents.ts),重命名为 seedEnabledAgentDirs,在 src/init.ts 的 git / http 两条路径上,于 hooks + 内置 skill 之后调用。
  • seeding 建的是 skills 目录,其根目录即 isToolInstalled 的判定对象,无需逐资源建目录。
  • pull 失败只 warn,不让 init 退出非 0。

验收

  • 全新目录跑 init --agent claude,codex,不手工 mkdir,结束时 .claude/ .codex/ AGENTS.md CLAUDE.md 均在位;git / gitlab / github 三种 provider 各验一遍。
  • 不带 --agent 的 init 不产生任何目录(回归守护)。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.