New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@master0071/tfs-cli

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@master0071/tfs-cli

TFS (tf.exe) 命令行包装工具,为 AI Agent 提供结构化 JSON 输出、自动签出/冲突检测、凭证管理。

npmnpm
Version
1.0.1
Version published
Weekly downloads
5
-58.33%
Maintainers
1
Weekly downloads
 
Created
Source

tfs-cli

TFS (tf.exe) 命令行包装工具,为 AI Agent + 人类 协作场景设计。

# 安装
npm install -g @master0071/tfs-cli

# 初始化
tfs-cli init -U http://tfs:8080/tfs/ASS -u alice
TFS_PASSWORD=secret tfs-cli init -U http://tfs:8080/tfs/ASS -u alice   # 非交互

# 编辑前自动签出 + 冲突检测
tfs-cli edit src/Program.cs   # exit 0 → 可编辑;exit 2 → 被他人签出

# 注入 AI Agent 规则
tfs-cli inject                  # 自动检测 agent
tfs-cli inject --trae --claude  # 指定 agent

命令

命令用途
init初始化配置 + 凭证库
config show|set|reset配置管理
checkout <path>签出文件
undo <path>撤销签出
edit <path>编辑前自动签出 + 冲突检测
add <path>加入源代码管理
getlatest [path]获取最新版本
status [path]待定更改
diff [path]差异对比
history [path]历史记录(缓存 5 分钟)
test测试连接
inject写入 AI Agent 规则

history flags:--today / --since <date> / --range Dx~Dy / --user / --mine / --limit <N> / -r

输出

所有命令默认输出 compact JSON(AI 直接 JSON.parse),加 --text 切换人类可读。

{"ok":true,"action":"checkout","path":"C:\\Projects\\Program.cs","data":{"status":"checked_out"},"error":null,"meta":{"tf_exit":0,"duration_ms":235}}

失败时 error.code 字段:

code含义退出码
CONFLICT文件被他人签出(edit)2
CONFIG_MISSING需先 tfs-cli init3
TF_NOT_FOUNDtf.exe 未安装4
AUTH_FAILED / PATH_NOT_IN_WORKSPACE / CREDENTIAL_MISSING / INVALID_ARGS / INTERNAL_ERROR通用错误1

配置与凭证

  • 配置:~/.config/tfs-cli/config.json,存 server/username/domain/workspace/collection
  • 凭证:Windows 凭据管理器(cmdkey + PowerShell CredReadW),密码不落盘
  • config set 可改 server/domain/workspace/collection,不可改 username(防凭证引用失效)
  • 密码不能含逗号或分号(tf.exe /login 不支持转义)

AI Agent 集成

tfs-cli inject 把规则写入项目(--trae --claude --opencode --codebuddy --kilo --qoder 或 -a all):

文件适用
AGENTS.mdopencode / kilo / qoder
CLAUDE.mdclaude-code
.trae/rules/tfs-command.mdtrae
.codebuddy/rules/tfs-command.mdcodebuddy

注入逻辑:不存在→创建,有 marker→替换,无 marker→追加(--force 强制覆盖)。

Keywords

tfs

FAQs

Package last updated on 20 Jul 2026

Related posts