การติดตั้ง
ข้อกำหนดเบื้องต้น
- Node.js 20.19.0 ขึ้นไป — ตรวจสอบเวอร์ชันของคุณ:
node --version
ติดตั้งด้วย AI Assistant ของคุณ
ไม่ต้องการทำด้วยมือเอง? วางคำสั่งด้านล่างลงใน coding assistant ใดก็ได้ที่สามารถรัน shell commands ได้ — Claude Code, Codex, Cursor, Gemini CLI, Copilot และเครื่องมืออื่น ๆ ที่ รองรับ มันจะติดตั้ง CLI, เริ่มต้นโปรเจกต์นี้ และรายงานสิ่งที่เกิดขึ้นจริง
ขั้นตอนด้วยมือด้านล่างคือแหล่งข้อมูลอ้างอิงหลัก — คำสั่งเพียงรันขั้นตอนเหล่านั้นแทนคุณเท่านั้น หาก assistant หยุดและคืนข้อมูลบางอย่างมาให้ นั่นคือการทำงานตามแผน: มันจะถามก่อนดำเนินการใด ๆ ที่ต้องการสิทธิ์พิเศษ และไม่แก้ไขไฟล์ shell startup ของคุณเอง คุณต้องดำเนินการส่วนที่เหลือด้วยตัวเองด้วย Package Managers และ Troubleshooting
Install OpenSpec in this project and set it up for me. Follow these steps in
order, and stop where a step tells you to stop.
1. RUNTIME. Run `node --version`. OpenSpec needs Node.js 20.19.0 or higher. If
Node is missing or older, say so and stop — don't install Node, switch
versions, or reconfigure my version manager for me.
2. INSTALL. Use whichever package manager is already on my PATH, preferring npm:
npm install -g @fission-ai/openspec@latest
pnpm add -g @fission-ai/openspec@latest
bun add -g @fission-ai/openspec@latest
yarn global add @fission-ai/openspec@latest (Yarn 1.x only)
Don't pick based on this project's lockfile — a global install has nothing to
do with how this repo's own dependencies are installed. If none of those four
is available, stop and tell me — don't improvise an install. (If I'm on Nix,
point me at the Nix section of the OpenSpec installation docs instead.)
Show me the exact command and let me confirm before you run it; this installs
software outside the project, and I may want a different package manager to
own it.
Stop and ask me again if the install needs sudo or admin rights, fails with a
permissions error, or reports that its global bin directory is missing or
unconfigured. Never edit my shell startup files (.bashrc, .zshrc, .profile,
fish, PowerShell profile), and never run a setup command that edits them for
me — show me the change and let me make it.
3. PATH. Run `openspec --version`. If the command isn't found, it may just be
missing from this shell: tell me where the package manager installed it and
how to add that directory to PATH for my shell and OS, then stop until I
confirm. If it prints an older version than the one the install just
reported, an earlier copy is shadowing it on PATH — tell me both versions
instead of continuing. If I use a version manager, say so rather than editing
PATH around it: with nvm or fnm the CLI is tied to the Node version that was
active when you installed it, and with asdf or volta a shim may need
regenerating.
4. INITIALIZE. Ask me which AI coding tool or tools I use and map each to an id
from `openspec init --help` (Copilot is `github-copilot`, Zoo Code is
`roocode`). `--tools` takes a comma-separated list, so name all of them.
`openspec init --tools <ids>` deletes leftovers from older OpenSpec versions
automatically, without asking — including `opsx-*.md` prompt files in my home
directory (Codex keeps them in ~/.codex/prompts). Before you run it, look for
those: `.../commands/openspec/` folders, OpenSpec marker blocks in files like
CLAUDE.md or AGENTS.md, and home-directory `opsx-*.md` prompts. List whatever
you find and wait for my go-ahead; if you find nothing, say so and carry on
without asking. An existing `openspec/` folder is not a problem — init
refreshes it and leaves my specs and changes alone.
Confirm I'm in the right folder too: init creates `openspec/` wherever it
runs, including inside a monorepo package.
Then run: openspec init --tools <ids>
5. REPORT. Don't assume what should exist — tell me what init actually printed:
how many skills and/or commands it created and where, the config file line,
any "Setup required" note, and what to restart or reload. Some tools are
skills-only and correctly create zero command files, so missing commands is
not a failure on its own. If init said nothing was generated, relay the fix
it suggested instead of retrying. Finish by telling me how to invoke OpenSpec
in my tool, and take the exact spelling from the files init created rather
than from its summary line: the punctuation differs per tool (/opsx:propose
in some, /opsx-propose in others, @opsx-propose in Amazon Q), and tools that
get skills instead of commands are invoked by skill name (/openspec-propose,
or $openspec-propose in Codex, or /skill:openspec-propose in Kimi Code).ไม่มีอะไรในคำสั่งนี้ที่ผูกกับ vendor เฉพาะ: เป็นเพียงคำแนะนำทั่วไปพร้อมคำสั่งเดียวกันกับที่บันทึกไว้ในหน้านี้ มันทำงานบน macOS, Linux และ Windows และหยุดโดยเจตนาแทนที่จะด้นสดเมื่อขั้นตอนใดต้องการการอนุญาตของคุณ Assistant ของคุณต้องสามารถรัน shell commands ได้ — การบูรณาการ IDE บางอย่างไม่สามารถทำได้
Package Managers
npm
npm install -g @fission-ai/openspec@latestpnpm
pnpm add -g @fission-ai/openspec@latestyarn
yarn global add @fission-ai/openspec@latestYarn 2 ขึ้นไป (Berry) ได้ลบคำสั่ง global ออกไป ในเวอร์ชันเหล่านั้น ให้ติดตั้ง OpenSpec ด้วย npm, pnpm หรือ bun แทน — CLI แบบ global ไม่จำเป็นต้องใช้ package manager เดียวกันกับโปรเจกต์ของคุณ
deno
Deno บางครั้งมีปัญหาในการ parse แท็ก @latest แต่เราสามารถระบุเวอร์ชันได้ขณะติดตั้งครั้งแรก หากเกิดกรณีนั้น คุณสามารถลองเปลี่ยนแท็ก @latest เป็นเวอร์ชัน เช่น @^1.3.1
deno install --global \
--allow-read --allow-write --allow-env --allow-sys=cpus,homedir --allow-net=edge.openspec.dev \
npm:@fission-ai/openspec@latest
# or
deno install --global \
--allow-read --allow-write --allow-env --allow-sys=cpus,homedir --allow-net=edge.openspec.dev \
npm:@fission-ai/openspec@^1.3.1หมายเหตุ: หาก subcommands ของคุณเรียกเครื่องมือภายนอก เช่น config edit, feedback หรือ workspace open คุณอาจต้องการใช้ scoped --allow-run=<program>
bun
Bun สามารถติดตั้ง OpenSpec แบบ global ได้ แต่ OpenSpec ทำงานบน Node.js ในปัจจุบัน คุณยังคงต้องมี Node.js 20.19.0 ขึ้นไปพร้อมใช้งานบน PATH
bun add -g @fission-ai/openspec@latestNix
รัน OpenSpec โดยตรงโดยไม่ต้องติดตั้ง:
nix run github:Fission-AI/OpenSpec -- initหรือติดตั้งลงใน profile ของคุณ:
nix profile install github:Fission-AI/OpenSpecหรือเพิ่มลงใน development environment ใน flake.nix:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
openspec.url = "github:Fission-AI/OpenSpec";
};
outputs = { nixpkgs, openspec, ... }: {
devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell {
buildInputs = [ openspec.packages.x86_64-linux.default ];
};
};
}ตรวจสอบการติดตั้ง
openspec --versionการอัปเดต
อัปเกรด package แล้วรีเฟรชไฟล์ที่สร้างในแต่ละโปรเจกต์:
npm install -g @fission-ai/openspec@latest # or pnpm/yarn/bun equivalent
openspec update # run inside each projectopenspec update จะสร้างไฟล์ skill และ command ใหม่สำหรับเครื่องมือที่คุณกำหนดค่าไว้ เพื่อให้ slash commands ของคุณเป็นปัจจุบันกับเวอร์ชันที่ติดตั้งอยู่ นอกจากนี้ยังตรวจสอบว่ามีการเผยแพร่ CLI เวอร์ชันใหม่หรือไม่และเสนอให้อัปเกรด เนื่องจากอัปเกรดคือสิ่งที่ทำให้ workflow ใหม่พร้อมใช้งานในที่สุด — ดู CLI Reference
การถอนการติดตั้ง
ไม่มีคำสั่ง openspec uninstall เนื่องจาก OpenSpec เป็นเพียง package แบบ global พร้อมไฟล์บางส่วนในโปรเจกต์ของคุณ การลบออกต้องทำด้วยมือไม่กี่ขั้นตอน และไม่มีอะไรในนี้ที่แตะโค้ดต้นฉบับของคุณ
1. ลบ package แบบ global:
npm uninstall -g @fission-ai/openspec # or: pnpm rm -g / yarn global remove / bun rm -g2. ลบ OpenSpec ออกจากโปรเจกต์ (ไม่บังคับ) ลบโฟลเดอร์ openspec/ หากไม่ต้องการ specs และ changes ของมันอีกต่อไป:
rm -rf openspec/คิดก่อนทำสิ่งนี้: openspec/specs/ และ openspec/changes/archive/ คือบันทึกของคุณว่าระบบทำงานอย่างไรและทำไมถึงมีการเปลี่ยนแปลง หากคุณอาจต้องการประวัติเหล่านั้น ให้เก็บโฟลเดอร์ไว้ (หรือเก็บไว้ใน git) แม้หลังการถอนการติดตั้ง
3. ลบไฟล์ AI tool ที่สร้างไว้ (ไม่บังคับ) OpenSpec เขียนไฟล์ skill และ command ลงในโฟลเดอร์เฉพาะเครื่องมือ เช่น .claude/skills/openspec-*/, .cursor/commands/opsx-* เป็นต้น ลบ skills openspec-* และ commands opsx-* สำหรับเครื่องมือที่คุณกำหนดค่าไว้ เส้นทางที่แน่นอนสำหรับแต่ละเครื่องมือมีอยู่ใน Supported Tools
หากคุณมี OpenSpec marker blocks ในไฟล์เช่น CLAUDE.md หรือ AGENTS.md ให้ลบ blocks เหล่านั้นด้วยมือ เนื้อหาของคุณเองในไฟล์เหล่านั้นเป็นของคุณที่จะเก็บไว้
ขั้นตอนต่อไป
หลังติดตั้ง ให้เริ่มต้น OpenSpec ในโปรเจกต์ของคุณ:
cd your-project
openspec initดู Getting Started สำหรับขั้นตอนทั้งหมด