跳到正文
cccskills
免费在 GitHub 公开

squad-version-check

Explains how Squad CLI records its installed version and handles upgrades, including which files it replaces or preserves. It also covers checking npm release channels and using cached version information when assessing available updates.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Internals of how @bradygaster/squad-cli stamps its version, how `squad upgrade` works (what it preserves vs overwrites), and how to probe the npm registry for the latest version from a coordinator prompt.

查看安装方法

适用场景

  • Checking the installed Squad CLI version
  • Reviewing files affected by an upgrade
  • Checking npm release channels
  • Interpreting cached update information

包含的文件(1)

  • SKILL.md6.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

SKILL: Squad CLI Internals — Version Stamping & Upgrade Mechanics

Confidence: medium Discovered by: Data Date: 2026-05-26 Validated in: Issue #1173 recon (bradygaster/squad)


What This Skill Covers

Reusable knowledge about how @bradygaster/squad-cli stamps its version into squad.agent.md, how squad upgrade works, what it preserves vs. overwrites, and how to probe the npm registry for the latest version from a coordinator prompt.


Package & Registry Facts

  • Package name: @bradygaster/squad-cli
  • Registry: npm (public)
  • CLI binary: squad (registered via package.json#bin.squad)
  • Node version requirement: Node ≥22.5.0 (ESM-only codebase)

Version Stamping Mechanism

Source file: dist/cli/core/version.js

Three functions:

getPackageVersion()

Walks up from the compiled JS file to find package.json. Returns pkg.version. Works from both dist/cli/core/version.js and a bundled root cli.js. Returns '0.0.0' as fallback if not found.

stampVersion(filePath, version)

Mutates squad.agent.md in three places:

  1. HTML comment: <!-- version: {version} --> (must be on the line immediately after frontmatter ---)
  2. Identity line: - **Version:** {version}
  3. Greeting instruction: backtick-quoted `Squad v{version}`

Called by: both init and upgrade — after copying the template to the destination.

readInstalledVersion(filePath)

Reads the stamped version back from squad.agent.md:

  1. First tries HTML comment format: /<!-- version: ([0-9.]+(?:-[a-z]+(?:\.\d+)?)?) -->/
  2. Falls back to old frontmatter format: /^version:\s*"([^"]+)"/m
  3. Returns '0.0.0' on any error

squad upgrade Behavior

Source file: dist/cli/core/upgrade.js

What gets overwritten:

  • squad.agent.md — full overwrite from template, then stampVersion()
  • Files with overwriteOnUpgrade: true in TEMPLATE_MANIFEST: casting JSON files, template .md files, copilot-instructions.md (if @copilot enabled)
  • GitHub Actions workflows — from templates/workflows/; non-npm projects get type-aware stubs
  • Runs runMigrations() after file copy

What is PRESERVED:

  • team.md, routing.md, decisions.md, ceremonies.md (user-owned)
  • agents/*/history.md (individual agent memory)
  • .squad/config.json — never touched; stateBackend survives intact
  • User-added files not in TEMPLATE_MANIFEST

Self-upgrade path (selfUpgradeCli()):

Detects npm/pnpm/yarn via npm_execpath and npm_config_user_agent. Runs:

  • npm: npm install -g @bradygaster/squad-cli@latest
  • pnpm: pnpm add -g @bradygaster/squad-cli@latest
  • yarn: yarn global add @bradygaster/squad-cli@latest Use @insider tag for insider builds.

compareSemver(a, b) utility (in upgrade.js):

Returns -1/0/1. Handles pre-release: strips pre-release for base comparison, then treats pre-release as less than release (e.g., 0.9.5-insider.1 < 0.9.5). Can be ported directly if needed in prompt logic.


.squad/config.json — What It Holds

{
  "version": 1,
  "stateBackend": "worktree"
}

Other optional fields added by the coordinator at runtime:

  • defaultModel — global model override for all agent spawns
  • agentModelOverrides.{agentName} — per-agent model override

The file is read-only from the upgrade path's perspective. Only the coordinator writes to it (for model preferences).


Version-Check Probe (npm Registry)

Use this one-liner from inside a coordinator prompt to fetch dist-tags:

npm view @bradygaster/squad-cli dist-tags --json
  • Timeout: 5 seconds. If no response within 5 seconds, abandon and show normal greeting.
  • On success: extract dist-tags[channel] (e.g., dist-tags["insider"]).
  • On any error (network failure, registry unreachable, parse error): show normal greeting.

Upstream OS-Specific Cache

The CLI (self-update.ts) writes latest version info to an OS-specific path with a 24h TTL.

One-liner to read the upstream cache:

node -e "const p=require('path'),o=require('os');const b=process.env.APPDATA||(process.platform==='darwin'?p.join(o.homedir(),'Library','Application Support'):p.join(o.homedir(),'.config'));const f=p.join(b,'squad-cli','update-check.json');try{const d=JSON.parse(require('fs').readFileSync(f,'utf8'));const age=Date.now()-d.checkedAt;if(age<86400000)console.log(JSON.stringify(d));else console.log('STALE')}catch{console.log('MISS')}"

Output semantics:

  • Valid JSON {"latestVersion":"X.Y.Z","checkedAt":N} → cache hit; use latestVersion
  • STALE → cache expired (older than 24h); treat as no data
  • MISS → cache missing or corrupt; treat as no data

OS-specific cache path:

  • Windows: %APPDATA%\squad-cli\update-check.json
  • Linux: ~/.config/squad-cli/update-check.json
  • macOS: ~/Library/Application Support/squad-cli/update-check.json

Repo-Local Cache Convention: .squad/.cache/version-check.json

Used by coordinator for insider/preview channels (the upstream cache only stores latest).

Schema:

{
  "checkedAt": "2026-05-26T14:13:28.492Z",
  "currentVersion": "0.9.6-insider.2",
  "channel": "insider",
  "channelVersion": "0.9.7-insider.1"
}

TTL: 24 hours from checkedAt. Gitignore: .squad/.cache/ is listed in .gitignore — cache files are never committed.


Key File Paths (installed CLI)

PurposePath
Version utilitiesdist/cli/core/version.js
Upgrade logicdist/cli/core/upgrade.js
Init logicdist/cli/core/init.js
Template manifestdist/cli/core/templates.js
Copilot install helperdist/cli/copilot-install.js
squad.agent.md templatetemplates/squad.agent.md.template
Session init referencetemplates/session-init-reference.md
All templatestemplates/

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Coordinate work across AI agents with shared rules for locating team files, recording decisions and their reasons, and requesting help. It also defines who owns revisions after a reviewer rejects an artifact.

中文简介正在准备中。当前显示英语简介。

  • Locate team files across separate working directories
  • Record decisions that affect other agents
  • Request input from another specialist
github/gh-aw54222026年10月19日 更新

Set shared development rules for an agent team: keep specific agent names out of product code, tests, and CI configuration, verify affected tests before finishing, and record lessons learned from mistakes.

中文简介正在准备中。当前显示英语简介。

  • Share development rules across multiple agents
  • Keep team-specific agent names out of code and tests
  • Check affected tests before declaring work complete
github/gh-aw54222026年10月19日 更新

Routes requests to design, create, update, debug, or upgrade GitHub Agentic Workflows to the appropriate instructions. It helps the agent select a workflow-specific procedure and apply any additional rules defined for the repository.

中文简介正在准备中。当前显示英语简介。

  • Designing a new workflow through questions
  • Investigating failed runs and recurring errors
  • Upgrading workflows and addressing deprecations
github/gh-aw54222026年10月19日 更新

Prepare architecture proposals before implementation so the team can agree on a direction. Organize evidence, technical choices, effects on existing work, risks, and the first release’s scope into a document with clear recommendations and decision owners.

中文简介正在准备中。当前显示英语简介。

  • Proposing a major architecture change
  • Replanning milestones after a foundation change
  • Comparing technical options before seeking approval
github/gh-aw54222026年10月19日 更新

Update the gh-aw-firewall version used by gh-aw, rebuild generated files, and review release notes and configuration schemas, which define valid settings. It guides related code and test updates while identifying follow-up work that remains.

中文简介正在准备中。当前显示英语简介。

  • Updating the firewall version used by gh-aw
  • Reviewing release notes for integration changes
  • Checking configuration schema differences
github/gh-aw54222026年10月19日 更新

Review git and gh operations in gh-aw workflows to check credential availability for each repository. Identify missing token handoffs, risky expansions of limited checkouts, and error handling needed where credentials are intentionally unavailable.

中文简介正在准备中。当前显示英语简介。

  • Reviewing git operations after repository checkout
  • Checking tokens for private cross-repository access
  • Reviewing sparse and shallow checkout changes
github/gh-aw54222026年10月19日 更新

查看 github 的全部技能

报告此技能的问题