测试助手
- 作者仓库星标 10
- 许可证 MIT
- 作者更新于 实时读取
- 作者仓库 shannon
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 94 / 100 · 已通过审计
- 作者 / 版本 / 许可
- @shannonshell · MIT
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: merge-upstream
description: Merge new upstream releases of nushell and reedline into Shannon Shannon tracks nushell and reed…
category: 通用
runtime: 无特殊运行时
---
# merge-upstream 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Why the script alone doesn't work / Shannon's fork surface (the only 10 files we preserve) / The reliable procedure”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Why the script alone doesn't work / Shannon's fork surface (the only 10 files we preserve) / The reliable procedure”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/tmp`、`/users` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“Why the script alone doesn't work / Shannon's fork surface (the only 10 files we preserve) / The reliable procedure”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: merge-upstream
description: Merge new upstream releases of nushell and reedline into Shannon Shannon tracks nushell and reed…
category: 通用
source: shannonshell/shannon
---
# merge-upstream
## 什么时候使用
- 用于组织测试、定位失败并形成修复闭环 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要额外 API Key…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Why the script alone doesn't work / Shannon's fork surface (the only 10 files we preserve) / The reliable procedure」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "merge-upstream" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Why the script alone doesn't work / Shannon's fork surface (the only 10 files we preserve) / The reliable procedure
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Merge Upstream
Shannon tracks nushell and reedline as git subtrees under nushell/ and
reedline/. Every few nushell releases, we pull upstream to pick up new
features and fixes. This skill captures what actually works — because
scripts/sync-upstream.sh alone is not enough when upstream has drifted.
Why the script alone doesn't work
scripts/sync-upstream.sh runs git subtree pull for nushell and reedline,
then cargo build && cargo test. That's fine for tiny drifts. For real
upstream releases it fails because:
- Subtree auto-merge is noisy. A hundred or more files will conflict — most of them files Shannon never touched. The auto-merger gets confused by rename chains and workspace-wide edits.
- Auto-merged files end up half-upstream, half-fork. Even files that
don't show conflicts can end up with stale content that references
removed APIs. You won't see this until
cargo buildfails deep innu-protocolornu-parser. - New upstream files get missed. When auto-merge fights with the subtree prefix, new files upstream added may not appear in our tree at all — the build will complain about missing modules.
- Shannon's own
src/lags upstream API.src/main.rsandsrc/run.rsare copied from nushell's binary and drift every release. - Root
Cargo.tomlversion pins don't auto-bump. The Shannon crate still references the old0.N.0nu-* versions. - Reedline must move in lockstep. Nushell's workspace pins a specific reedline version; if you only pull nushell, the build fails because our vendored reedline is stale.
Shannon's fork surface (the only 10 files we preserve)
Keep these exact files across upgrades. Everything else in nushell/ should
come from upstream verbatim:
nushell/Cargo.toml— workspace reedline path dep, shannon package renames (shannon-nu-cli,shannon-nu-lsp), shannon crate versionsnushell/crates/nu-cli/Cargo.toml—name = "shannon-nu-cli", tree-sitter deps forBashHighlighternushell/crates/nu-cli/src/bash_highlight.rs— NEW, tree-sitter-based bash syntax highlighternushell/crates/nu-cli/src/mode_dispatcher.rs— NEW,ModeDispatchertraitnushell/crates/nu-cli/src/lib.rs— declaresmod bash_highlight,mod mode_dispatcher, and re-exportsBashHighlighter,ModeDispatcher,ModeResultnushell/crates/nu-cli/src/repl.rs— dispatch hook inloop_iteration()that forwards toModeDispatcher::execute()when$env.SHANNON_MODEis not"nu"; also a few smaller tweaksnushell/crates/nu-cli/src/nu_highlight.rs— small tweaknushell/crates/nu-command/src/platform/input/input_.rs— small tweaknushell/crates/nu-lsp/Cargo.toml—name = "shannon-nu-lsp", referencesshannon-nu-cli
Verify this list against the current state before you start:
git diff --stat <last-nushell-import-commit>..HEAD -- nushell/
If new Shannon-modified files appear, add them to the preserve list below.
The reliable procedure
Work on a branch — never on main.
1. Preflight
Clean working tree. Fetch upstream. Count the drift.
git status # must be clean
git fetch upstream-nushell upstream-reedline
git log --oneline <last-merge-base>..upstream-nushell/main | wc -l
Large drifts (100+ commits) are the norm — that's fine, just plan for conflicts.
2. Branch off
git checkout -b upgrade/nushell-$(date +%Y-%m-%d)
3. Pull nushell (expect conflicts)
git subtree pull --prefix nushell upstream-nushell main \
-m "Merge nushell upstream $(date +%Y-%m-%d)"
This will fail with "Automatic merge failed". That is expected.
4. Save Shannon's fork files to /tmp
Before doing anything destructive:
mkdir -p /tmp/shannon_patches
cp nushell/Cargo.toml /tmp/shannon_patches/Cargo.toml
cp nushell/crates/nu-cli/Cargo.toml /tmp/shannon_patches/nu-cli-Cargo.toml
cp nushell/crates/nu-cli/src/bash_highlight.rs /tmp/shannon_patches/bash_highlight.rs
cp nushell/crates/nu-cli/src/mode_dispatcher.rs /tmp/shannon_patches/mode_dispatcher.rs
cp nushell/crates/nu-cli/src/lib.rs /tmp/shannon_patches/lib.rs
cp nushell/crates/nu-cli/src/nu_highlight.rs /tmp/shannon_patches/nu_highlight.rs
cp nushell/crates/nu-cli/src/repl.rs /tmp/shannon_patches/repl.rs
cp nushell/crates/nu-command/src/platform/input/input_.rs /tmp/shannon_patches/input_.rs
cp nushell/crates/nu-lsp/Cargo.toml /tmp/shannon_patches/nu-lsp-Cargo.toml
The unresolved conflict markers in those files are fine — they're snapshots, not for reuse. What you actually need from them is the Shannon side of each hunk, which you'll recreate by hand in step 7. In practice the easier workflow is: commit the broken merge first (step 5), then re-export clean Shannon versions from the main branch:
git show main:nushell/Cargo.toml > /tmp/shannon_patches/Cargo.toml
# ... and so on
5. Commit the busted merge so you have a clean slate
Don't try to hand-resolve 100+ conflicts. Just stage whatever's there and commit it — you're about to overwrite the tree anyway.
git checkout --theirs -- $(git diff --name-only --diff-filter=U)
git add -A
git -c core.editor=true commit --no-edit
6. Wholesale-replace the nushell/ tree with upstream
This is the step that makes everything else tractable. Wipe nushell/ and
re-populate from upstream-nushell/main:
git rm -rqf nushell/
mkdir -p nushell
git archive upstream-nushell/main | tar -x -C nushell/
You now have a pristine copy of upstream's tree at nushell/, free of any
auto-merge weirdness.
7. Re-apply Shannon's fork files
cp /tmp/shannon_patches/Cargo.toml nushell/Cargo.toml
cp /tmp/shannon_patches/nu-cli-Cargo.toml nushell/crates/nu-cli/Cargo.toml
cp /tmp/shannon_patches/bash_highlight.rs nushell/crates/nu-cli/src/bash_highlight.rs
cp /tmp/shannon_patches/mode_dispatcher.rs nushell/crates/nu-cli/src/mode_dispatcher.rs
cp /tmp/shannon_patches/lib.rs nushell/crates/nu-cli/src/lib.rs
cp /tmp/shannon_patches/nu_highlight.rs nushell/crates/nu-cli/src/nu_highlight.rs
cp /tmp/shannon_patches/repl.rs nushell/crates/nu-cli/src/repl.rs
cp /tmp/shannon_patches/input_.rs nushell/crates/nu-command/src/platform/input/input_.rs
cp /tmp/shannon_patches/nu-lsp-Cargo.toml nushell/crates/nu-lsp/Cargo.toml
Then update the Shannon files for upstream API churn:
nushell/Cargo.toml— bump allversion = "0.OLD.0"entries in the[dependencies]block to match the new upstream version. Keep theshannon-nu-cli/shannon-nu-lsppackage renames and Shannon crate versions. Bumpreedlinein[workspace.dependencies]to the new version and keeppath = "../reedline". The[workspace.package]and[[test]]blocks may be new from upstream — preserve them.nushell/crates/nu-cli/Cargo.toml— bump allversion = "0.OLD.0"in both[dev-dependencies]and[dependencies]. Addrust-version.workspace = trueandautotests = falseif upstream introduced them.nushell/crates/nu-lsp/Cargo.toml— same pattern.
8. Pull reedline
git subtree pull --prefix reedline upstream-reedline main \
-m "Merge reedline upstream $(date +%Y-%m-%d)"
# Resolve Cargo.lock conflict by taking upstream:
git checkout --theirs -- reedline/Cargo.lock
git add reedline/Cargo.lock
git -c core.editor=true commit --no-edit
Reedline has no Shannon-side changes, so conflicts are minimal (usually just
Cargo.lock).
9. Regenerate Cargo.lock files
rm nushell/Cargo.lock
(cd nushell && cargo generate-lockfile)
The root Cargo.lock regenerates on the next cargo build.
10. Bump root Cargo.toml
In /Users/ryan/dev/shannon/Cargo.toml, update:
- Every
nu-* = { version = "0.OLD.0", ... }to the new version reedline = { version = "0.OLD.0", ... }to the new version
A sed one-liner works if the old version is unique:
sed -i '' 's/version = "0.111.0"/version = "0.112.2"/g' Cargo.toml
sed -i '' 's/version = "0.46.0"/version = "0.47.0"/g' Cargo.toml
(macOS sed uses -i ''. Linux: sed -i.)
11. Update Shannon's src/main.rs and src/run.rs for API churn
Shannon's src/ is copied from nushell's binary and drifts every release.
Diff against upstream to find what changed:
diff src/main.rs nushell/src/main.rs
diff src/run.rs nushell/src/run.rs
Common changes:
std::time::Instant→nu_utils::time::Instant. Nushell migrated to its ownInstantwrapper. Replace everywhere in Shannon'ssrc/.nu_protocol::location!()removed. Calls toIoError::new_internal_with_path(err, msg, location!(), path)now take only(err, msg, path)— drop thelocation!()argument.ShellError::GenericError→ShellError::Generic. (Currently emits deprecation warnings; not a build failure yet.)evaluate_replsignature changes. Check the argument list against upstream if you get a type mismatch.
The diff against upstream's equivalent file is the fastest way to find all call sites that need updating.
12. Build
cargo build
First build errors will usually be in nu-parser or nu-protocol complaining
about missing exports. If you see this after a wholesale tree replace, it's
almost always stale incremental compilation artifacts from an earlier
failed build. Force a rebuild of the affected crate:
touch nushell/crates/nu-experimental/src/lib.rs # or whichever crate is stuck
cargo build
Avoid cargo clean — per nushell/CLAUDE.md, it just wastes compile time.
Once nushell/ compiles, the next errors will be in shannonshell itself
(src/main.rs, src/run.rs) — those are the API-churn fixes from step 11.
13. Smoke test
./target/debug/shannon --version
./target/debug/shannon
In the interactive shell:
- Type a nushell command (e.g.
ls) — verify nu mode works - Press
Shift+Tab— verify mode switches to bash - Type a bash command (e.g.
echo $HOME) — verify bash mode works - Press
Shift+Tab— verify it switches back to nu - Verify env vars propagate across the switch (e.g.
cd /tmpin bash, then back to nu and checkpwd)
The build passing is not sufficient — Shannon's ModeDispatcher hook
lives in repl.rs, which upstream rewrites frequently. A merge can
compile fine but silently break the dispatcher.
14. Commit the work
At this point you should have on the branch:
- The busted-merge commit (nushell subtree pull)
- The reedline merge commit
- One or two commits for the wholesale tree replace + Shannon fork
re-application + root
Cargo.toml/src/API updates
Merge to main when ready:
git checkout main
git merge --no-ff upgrade/nushell-$(date +%Y-%m-%d)
Things that will bite you
- Don't use
--squashwithgit subtree. Shannon'sCLAUDE.mdexplicitly forbids it. Full history across merged projects must be preserved for blame/log/bisect. - Don't hand-resolve 100+ conflicts. Wholesale replace is faster and correct. Conflict-by-conflict resolution leaves stale auto-merged content in files you don't notice until build time.
- Don't forget reedline. Pull both or the build will fail on version pinning.
- Don't forget the root
Cargo.toml. Bumping onlynushell/Cargo.tomlis not enough. - Don't skip the interactive smoke test.
cargo builddoes not exercise the dispatcher hook. - The
scripts/sync-upstream.shscript is not the source of truth. This skill is. Update the script if you want, but don't rely on it alone for real upgrades.
After the upgrade
Consider opening an issue under issues/ to track any cleanup work —
deprecation warnings to address, features upstream added that Shannon
could expose (e.g. ExternalHinter in repl.rs), or new commands that
should be wired up.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核