eliteforge-agent-doctor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

EliteForge Agent Doctor

EliteForge Agent Doctor

触发门槛

Trigger Threshold

仅当用户明确说明当前项目遵守
璀璨工坊规范
eliteforge specification
时,才使用本技能。若用户未做出该项目级声明,不要启用本技能;按通用能力处理。
Only use this skill when the user explicitly states that the current project complies with the
璀璨工坊规范
(Bright Workshop Specification) or
eliteforge specification
. If the user does not make this project-level declaration, do not enable this skill; handle it according to general capabilities.

目标

Objectives

只做一件事:判断当前机器能否继续执行相关开发任务;如果不能,就基于当前系统已有能力尽量自动补齐。
Do only one thing: Determine whether the current machine can continue to execute relevant development tasks; if not, try to automatically complete the configurations as much as possible based on the current system's existing capabilities.

基础版本要求

Minimum Version Requirements

  • Java/Javac:主版本必须为 25 或以上。
  • Maven:必须为 3.9.10 或以上。
  • Java/Javac: Major version must be 25 or above.
  • Maven: Must be 3.9.10 or above.

必须先确认

Must Confirm First

在写入 hosts 前,必须问清用户的办公地:
  • 重庆办公:使用
    references/cq-required-hosts.txt
    ,脚本参数为
    --office cq
  • 北京办公:使用
    references/bj-required-hosts.txt
    ,脚本参数为
    --office bj
如果用户没有确认办公地,只允许做诊断和非 hosts 修复,不要猜测 hosts 配置。
Before writing to hosts, you must ask the user for their office location:
  • Chongqing Office: Use
    references/cq-required-hosts.txt
    , script parameter is
    --office cq
  • Beijing Office: Use
    references/bj-required-hosts.txt
    , script parameter is
    --office bj
If the user does not confirm the office location, only diagnosis and non-hosts fixes are allowed; do not guess the hosts configuration.

工作流

Workflow

  1. 先确认用户是重庆办公还是北京办公。
  2. 运行
    report
    模式,只诊断不写入。
    report
    返回码为
    2
    表示环境未就绪,不代表脚本异常。
bash
python3 scripts/bootstrap_env.py --mode report --office cq
python3 scripts/bootstrap_env.py --mode report --office bj
  1. 如果报告显示环境不完整,向用户确认是否自动修复后,运行
    apply
    模式。
bash
python3 scripts/bootstrap_env.py --mode apply --office cq
python3 scripts/bootstrap_env.py --mode apply --office bj
  1. 如果自动安装被系统权限阻塞,报告缺失项和需要用户处理的权限条件。不要伪造安装成功。
  2. 只有后续任务确实要操作内部平台时,才安装内部 CLI。
bash
python3 scripts/bootstrap_env.py --mode apply --office cq --install-internal-clis
  1. 修复后再运行一次
    report
    ,输出最终状态。
  1. First confirm whether the user works in Chongqing or Beijing.
  2. Run in
    report
    mode, only diagnose without writing. A return code of
    2
    from
    report
    indicates the environment is not ready, not a script exception.
bash
python3 scripts/bootstrap_env.py --mode report --office cq
python3 scripts/bootstrap_env.py --mode report --office bj
  1. If the report shows the environment is incomplete, after confirming with the user whether to automatically fix it, run in
    apply
    mode.
bash
python3 scripts/bootstrap_env.py --mode apply --office cq
python3 scripts/bootstrap_env.py --mode apply --office bj
  1. If automatic installation is blocked by system permissions, report the missing items and permission conditions that require user handling. Do not fake a successful installation.
  2. Only install internal CLIs when subsequent tasks actually need to operate internal platforms.
bash
python3 scripts/bootstrap_env.py --mode apply --office cq --install-internal-clis
  1. After fixing, run
    report
    again to output the final status.

脚本负责的内容

Content Handled by the Script

  • 识别系统信息:操作系统、平台、架构、Shell、PATH、home 目录、hosts 文件路径。
  • 识别系统工具:
    git
    python3
    node
    npm
    npx
    pipx
    jq
    rg
    mvn
    pnpm
    java
    javac
    curl
    wget
    sudo
    等。
  • 识别 SDKMAN 与包管理器:SDKMAN、
    brew
    apt-get
    dnf
    yum
    pacman
    zypper
    winget
    choco
  • 默认只扫描每个
    skills/eliteforge-*/SKILL.md
    顶层文件中的
    ## Environment Variables
    章节,并按
    eliteforge-skill-spec
    规定的
    `VAR_NAME,SCREAMING_SNAKE_CASE` [optional|required|conditional] desc
    格式识别 skill 环境变量;只报告变量名和缺失状态,不打印变量值。
  • 尝试安装必备命令:
    git
    python3
    node
    npm
    npx
    pipx
    jq
    rg
    pnpm
    、Java/Javac 25 及以上、Maven 3.9.10 及以上。
  • 自动安装 Java/Javac 与 Maven 时,若当前机器已安装并可初始化 SDKMAN,必须优先通过 SDKMAN 安装;SDKMAN 不可用或安装失败时,再退回系统包管理器。
  • 通过
    pipx
    安装必备 Python CLI 包:
    pre-commit
  • 配置
    ~/.npmrc
    的 npm 私有源。
  • 配置
    ~/.pip/pip.conf
    的 pip 私有源。
  • 检查 Git 全局配置:
    • user.name
      必须已配置且不能是占位符;建议使用个人中文姓名,但不以中文字符作为就绪门禁。
    • user.email
      必须已配置且不能是占位符;建议使用有效的公司邮箱。
    • init.defaultBranch=master
    • color.ui=auto
    • pager.branch=false
    • pager.status=false
    • core.quotePath=false
    • http.https://git.cisdigital.cn.proxy=
      空值
  • git.cisdigital.cn
    的 SSH 地址重写为 HTTPS。
  • 按已确认办公地维护
    /etc/hosts
  • Identify system information: Operating system, platform, architecture, Shell, PATH, home directory, hosts file path.
  • Identify system tools:
    git
    ,
    python3
    ,
    node
    ,
    npm
    ,
    npx
    ,
    pipx
    ,
    jq
    ,
    rg
    ,
    mvn
    ,
    pnpm
    ,
    java
    ,
    javac
    ,
    curl
    ,
    wget
    ,
    sudo
    , etc.
  • Identify SDKMAN and package managers: SDKMAN,
    brew
    ,
    apt-get
    ,
    dnf
    ,
    yum
    ,
    pacman
    ,
    zypper
    ,
    winget
    ,
    choco
    .
  • By default, only scan the
    ## Environment Variables
    section in the top-level
    skills/eliteforge-*/SKILL.md
    files, and identify skill environment variables according to the format
    `VAR_NAME,SCREAMING_SNAKE_CASE` [optional|required|conditional] desc
    specified by
    eliteforge-skill-spec
    ; only report variable names and missing status, do not print variable values.
  • Attempt to install essential commands:
    git
    ,
    python3
    ,
    node
    ,
    npm
    ,
    npx
    ,
    pipx
    ,
    jq
    ,
    rg
    ,
    pnpm
    , Java/Javac 25+, Maven 3.9.10+.
  • When automatically installing Java/Javac and Maven, if SDKMAN is already installed and can be initialized on the current machine, prioritize installation via SDKMAN; if SDKMAN is unavailable or installation fails, fall back to the system package manager.
  • Install essential Python CLI packages via
    pipx
    :
    pre-commit
    .
  • Configure the npm private source in
    ~/.npmrc
    .
  • Configure the pip private source in
    ~/.pip/pip.conf
    .
  • Check Git global configurations:
    • user.name
      must be configured and cannot be a placeholder; it is recommended to use the user's personal Chinese name, but Chinese characters are not required as a readiness gate.
    • user.email
      must be configured and cannot be a placeholder; it is recommended to use a valid corporate email.
    • init.defaultBranch=master
    • color.ui=auto
    • pager.branch=false
    • pager.status=false
    • core.quotePath=false
    • http.https://git.cisdigital.cn.proxy=
      empty value
  • Rewrite the SSH address of
    git.cisdigital.cn
    to HTTPS.
  • Maintain
    /etc/hosts
    according to the confirmed office location.

安全规则

Security Rules

  • 不要把密码、Token、共享凭据硬编码、提交入仓或直接打印。
  • 私有源凭据以在线“必知必会”文档为准,脚本只维护非敏感的源地址配置,不要求也不读取本地私有源凭据环境变量。
  • Git 个人身份配置必须由用户手动执行
    git config --global user.name "你的姓名"
    git config --global user.email "公司邮箱"
    完成;脚本不自动写入。
    user.name
    /
    user.email
    的就绪判断以"已配置且非占位符"为准;非中文姓名或非标准邮箱只作为建议提示,不作为阻塞项。
  • 需要私有源认证信息时,提示用户按在线“必知必会”文档自行写入本地配置;不要要求用户在对话中明文发送密码或 Token。
  • 如果
    /etc/hosts
    中同一域名已指向其他 IP,不要覆盖,必须报告冲突。
  • 写 hosts 只维护脚本标记块,不要清空用户已有内容。
  • 系统安装和 hosts 写入只做“可自动完成”的尝试;需要交互式 sudo、管理员权限、账号开通或项目授权时,报告阻塞。
  • git.cisdigital.cn
    优先使用 HTTPS,禁止要求用户改用 SSH 克隆。
  • Do not hardcode, commit to the repository, or directly print passwords, Tokens, or shared credentials.
  • Private source credentials are subject to the online "Must-Know" documentation; the script only maintains non-sensitive source address configurations, and does not require or read local private source credential environment variables.
  • Git personal identity configurations must be completed by the user manually executing
    git config --global user.name "Your Name"
    and
    git config --global user.email "Corporate Email"
    ; the script does not write them automatically. The readiness judgment for
    user.name
    /
    user.email
    is based on "configured and not a placeholder"; non-Chinese names or non-standard emails are only suggested prompts, not blocking items.
  • When private source authentication information is required, prompt the user to write it to the local configuration according to the online "Must-Know" documentation; do not ask the user to send passwords or Tokens in plain text in the conversation.
  • If the same domain name in
    /etc/hosts
    already points to another IP, do not overwrite it; must report the conflict.
  • When writing to hosts, only maintain the script-marked blocks; do not clear the user's existing content.
  • System installation and hosts writing only attempt "automatically completable" operations; when interactive sudo, administrator privileges, account activation, or project authorization are required, report the block.
  • git.cisdigital.cn
    prioritizes HTTPS; prohibit requiring users to switch to SSH cloning.

脚本参数

Script Parameters

  • --mode report|apply
    report
    只检查;
    apply
    写入安全修复并尝试安装缺失依赖。
  • --office cq|bj
    :必填业务参数,由用户确认;重庆用
    cq
    ,北京用
    bj
  • --package-manager auto|brew|apt-get|dnf|yum|pacman|zypper|winget|choco
    :自动探测不准时强制指定。该参数只控制系统包管理器回退路径;Java/Javac 与 Maven 仍优先尝试 SDKMAN。
  • --home-dir
    --hosts-file
    :可指向临时路径做验证,不污染真实机器。
  • --skills-root
    :指定
    eliteforge-*
    skill 所在目录;默认按脚本位置推断为仓库
    skills
    目录。
  • --skip-install
    :跳过工具安装,但仍应用配置文件修复。
  • --install-internal-clis
    :通过
    pipx
    安装或升级内部 Python CLI。
  • --mode report|apply
    :
    report
    only checks;
    apply
    writes security fixes and attempts to install missing dependencies.
  • --office cq|bj
    : Required business parameter, confirmed by the user; use
    cq
    for Chongqing,
    bj
    for Beijing.
  • --package-manager auto|brew|apt-get|dnf|yum|pacman|zypper|winget|choco
    : Force specify when automatic detection is inaccurate. This parameter only controls the fallback path of the system package manager; Java/Javac and Maven still prioritize SDKMAN.
  • --home-dir
    and
    --hosts-file
    : Can point to temporary paths for verification without polluting the real machine.
  • --skills-root
    : Specify the directory where
    eliteforge-*
    skills are located; default is inferred as the repository's
    skills
    directory based on the script's location.
  • --skip-install
    : Skip tool installation, but still apply configuration file fixes.
  • --install-internal-clis
    : Install or upgrade internal Python CLIs via
    pipx
    .

输出规则

Output Rules

  • 汇总要短、可执行,至少覆盖:
    system
    SDKMAN
    package manager
    tools
    hosts
    npm/pip mirrors
    git global config
    git https rewrite
    pipx packages
    skill_env_vars
    remaining blockers
  • 如果运行了
    apply
    ,必须明确说明改了哪些文件、执行了哪些安装命令、哪些项被权限或账号阻塞。
  • skill_env_vars
    必须拆分报告
    missing_required
    missing_conditional
    optional_unset
    三类;只有
    missing_required
    与已触发的
    missing_conditional
    是环境就绪阻塞项。
  • 如果
    skill_env_vars.missing_required
    skill_env_vars.missing_conditional
    非空,必须提示用户配置对应环境变量;不要要求用户在对话中明文发送密码或 Token。
  • 对仍需人处理的事项,指出具体条件或文件,不要整段转抄参考资料。
  • Summaries should be concise and actionable, covering at least:
    system
    ,
    SDKMAN
    ,
    package manager
    ,
    tools
    ,
    hosts
    ,
    npm/pip mirrors
    ,
    git global config
    ,
    git https rewrite
    ,
    pipx packages
    ,
    skill_env_vars
    ,
    remaining blockers
    .
  • If
    apply
    is run, clearly state which files were modified, which installation commands were executed, and which items were blocked by permissions or accounts.
  • skill_env_vars
    must be reported in three categories:
    missing_required
    ,
    missing_conditional
    ,
    optional_unset
    ; only
    missing_required
    and triggered
    missing_conditional
    are environment readiness blockers.
  • If
    skill_env_vars.missing_required
    or
    skill_env_vars.missing_conditional
    is not empty, must prompt the user to configure the corresponding environment variables; do not ask the user to send passwords or Tokens in plain text in the conversation.
  • For items that still require manual handling, specify the specific conditions or files, do not copy the reference materials in full.

参考资料

Reference Materials

  • references/onboarding-checklist.md
    :人类前置项、私有源凭据、安全边界。
  • references/cq-required-hosts.txt
    :重庆办公 hosts。
  • references/bj-required-hosts.txt
    :北京办公 hosts。
  • references/onboarding-checklist.md
    : Human pre-requisites, private source credentials, security boundaries.
  • references/cq-required-hosts.txt
    : Chongqing office hosts.
  • references/bj-required-hosts.txt
    : Beijing office hosts.