
Step 0: Check if Already in an Isolated Workspace【免费下载链接】superpowersAn agentic skills framework software development methodology that works.项目地址: https://gitcode.com/GitHub_Trending/su/superpowersBefore creating a worktree, check if one already exists:GIT_DIR$(cd $(git rev-parse --git-dir) 2/dev/null pwd -P) GIT_COMMON$(cd $(git rev-parse --git-common-dir) 2/dev/null pwd -P) BRANCH$(git branch --show-current)IfGIT_DIRdiffers fromGIT_COMMON:You are already inside a linked worktree (created by the Codex App, Claude Codes Agent tool, a previous skill run, or the user). Do NOT create another worktree. Instead:Run project setup (auto-detect package manager as in Run Project Setup below)Verify clean baseline (run tests as in Verify Clean Baseline below)Report with branch state:On a branch: Already in an isolated workspace atpathon branchname. Tests passing. Ready to implement.Detached HEAD: Already in an isolated workspace atpath(detached HEAD, externally managed). Tests passing. Note: branch creation needed at finish time. Ready to implement.After reporting, STOP. Do not continue to Directory Selection or Creation Steps.IfGIT_DIRequalsGIT_COMMON:Proceed with the full worktree creation flow below.Sandbox fallback:If you proceed to Creation Steps butgit worktree add -bfails with a permission error (e.g., Operation not permitted), treat this as a late-detected restricted environment. Fall back to the behavior above — run setup and baseline tests in the current directory, report accordingly, and STOP.设计文档补充了两个细节其一依赖安装npm install 等是幂等的即使工作区已存在也值得跑一遍以保安全其二Step 0 命中时跳过 Safety Verification.gitignore 检查因为对外部创建的工作区而言该检查无意义。 **沙箱回退Sandbox fallback** 是这里的关键防御如果检测显示普通仓库GIT_DIR GIT_COMMON且技能继续走到创建步骤但 git worktree add -b 因沙箱拒绝而失败例如 Seatbelt 报 Operation not permitted则将其视为迟到的受限环境发现退回到 Step 0 的已在隔离工作区行为——在当前目录跑安装与基线测试并如实汇报。设计文档中的手动测试场景 5Sandbox fallback in Local thread专门验证这条路径期望 agent 优雅降级而不打印原始 Seatbelt 错误、不盲目重试、不输出令人困惑的报错。 ## Task 2更新 using-git-worktrees 的 Integration 描述 技能间的集成契约必须与新的检测优先语义一致。计划要求把 Integration Called by 下的三条描述从总是创建改写为确保存在 改前 markdown - **brainstorming** (Phase 4) - REQUIRED when design is approved and implementation follows - **subagent-driven-development** - REQUIRED before executing any tasks - **executing-plans** - REQUIRED before executing any tasks改后- **brainstorming** - REQUIRED: Ensures isolated workspace (creates one or verifies existing) - **subagent-driven-development** - REQUIRED: Ensures isolated workspace (creates one or verifies existing) - **executing-plans** - REQUIRED: Ensures isolated workspace (creates one or verifies existing)Task 3为finishing-a-development-branch增加 Step 1.5改动位置在 Step 1Verify Tests与 Step 2Determine Base Branch之间插入环境检测分支包含三条路径### Step 1.5: Detect Environment 执行上述三条只读检测命令 **Path A — GIT_DIR 不等于 GIT_COMMON 且 BRANCH 为空 外部管理 worktreedetached HEAD** 先确保所有工作已暂存并提交git add git commit。 然后向用户呈现以下内容不要呈现 4 选项菜单 Implementation complete. All tests passing. Current HEAD: full-commit-sha This workspace is externally managed (detached HEAD). I cannot create branches, push, or open PRs from here. ⚠ These commits are on a detached HEAD. If you do not create a branch, they may be lost when this workspace is cleaned up. If your host application provides these controls: - Create branch — to name a branch, then commit/push/PR - Hand off to local — to move changes to your local checkout Suggested branch name: ticket-id/short-description Suggested commit message: summary-of-work 分支名推导规则有工单 ID 就用工单 ID如 pri-823/codex-compat 否则把计划标题前 5 个词 slugify否则省略建议。 分支名中避免包含敏感内容漏洞描述、客户名等。 跳到 Step 5清理为 no-op —— 见下方守卫。 **Path B — GIT_DIR 不等于 GIT_COMMON 且 BRANCH 存在 外部管理 worktree命名分支** 进入 Step 2正常呈现 4 选项菜单。 **Path C — GIT_DIR 等于 GIT_COMMON普通环境** 进入 Step 2 正常呈现 4 选项菜单。Path A 的设计要点值得注意交接载荷handoff payload替代了 4 选项菜单。因为 Codex App 的收尾控件操作的是已提交的工作所以第一步必须是git addgit commitpayload 中携带完整 commit SHA 与数据丢失警告并把 Create branch / Hand off to local 两个 App 原生控件作为用户可用操作列出同时由 agent 输出建议的分支名、提交信息供用户复制——agent 在沙箱内仍可以跑测试、暂存文件、产出文本建议只是不能代替用户执行分支/推送操作。Task 4Step 5 清理守卫收尾技能的清理阶段需要独立再检测一次而不能复用会话早期的输出——因为收尾技能可能运行在另一个会话中。计划要求把 Step 5Cleanup Worktree替换为### Step 5: Cleanup Worktree **First, check if worktree is externally managed:** GIT_DIR$(cd $(git rev-parse --git-dir) 2/dev/null pwd -P) GIT_COMMON$(cd $(git rev-parse --git-common-dir) 2/dev/null pwd -P) If GIT_DIR differs from GIT_COMMON: skip worktree removal — the host environment owns this workspace. **Otherwise, for Options 1 and 4:** Check if in worktree: git worktree list | grep $(git branch --show-current) If yes: git worktree remove worktree-path **For Option 3:** Keep worktree.计划文档还顺手修正了一处既有不一致原文 Step 5 写的是 For Options 1, 2, 4但同一文件的 Quick Reference 表与 Common Mistakes 节都说只有 Options 1 4 触发清理——这次改动将三者对齐。Task 5同步 SDD 与 executing-plans 的 Integration 行两个计划执行技能的 Integration 段各有一行相同文案需要更新计划中标注的行号为skills/subagent-driven-development/SKILL.md:268与skills/executing-plans/SKILL.md:68-- superpowers:using-git-worktrees - REQUIRED: Set up isolated workspace before starting - **superpowers:using-git-worktrees** - REQUIRED: Ensures isolated workspace (creates one or verifies existing)这与 Task 2 是同一语义变更的呼应工作区确保存在创建或验证已有的而非总是创建。Task 6在codex-tools.md沉淀检测文档计划要求在 skills/using-superpowers/references/codex-tools.md 末尾追加两节把检测模式沉淀为平台参考文档## Environment Detection Skills that create worktrees or finish branches should detect their environment with read-only git commands before proceeding: 三条检测命令 - GIT_DIR ! GIT_COMMON → already in a linked worktree (skip creation) - BRANCH empty → detached HEAD (cannot branch/push/PR from sandbox) See using-git-worktrees Step 0 and finishing-a-development-branch Step 1.5 for how each skill uses these signals. ## Codex App Finishing When the sandbox blocks branch/push operations (detached HEAD in an externally managed worktree), the agent commits all work and informs the user to use the Apps native controls: - **Create branch** — names the branch, then commit/push/PR via App UI - **Hand off to local** — transfers work to the users local checkout The agent can still run tests, stage files, and output suggested branch names, commit messages, and PR descriptions for the user to copy.【免费下载链接】superpowersAn agentic skills framework software development methodology that works.项目地址: https://gitcode.com/GitHub_Trending/su/superpowers创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考