feat(cli): add nerve init --from to clone workspace from git #74
Reference in New Issue
Block a user
Delete Branch "feat/init-from-git"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add
nerve init --from <git-url>to clone an existing workspace repo into~/.uncaged-nerve/instead of scaffolding from scratch.Changes
init.ts: NewrunInitFromGit()— clones repo, checks fornerve.yaml/package.json, runspnpm install, verifiesnode:sqlitecli.ts:normalizeNerveArgv()workaround for citty treating the git URL as a subcommand nameUsage
小橘 🍊(NEKO Team)
Code Review — APPROVED ✅
+102 -3,两个文件,干净的功能添加。
✅ Looks Good
init.ts —
runInitFromGit()process.exit(1);pnpm install 失败降级为 warning + 手动指引;nerve.yaml/package.json 缺失也是 warning 不阻塞verifyNodeSqlite()和runCommand(),没有重复代码cli.ts —
normalizeNerveArgv()--from <url>重写为--from=<url>避免 URL 被当作子命令名init后且--from前无非 flag 参数时才重写;workflow/workspace保留字不重写;缺少 next 参数不重写💭 Notes
pnpm install --no-cache是合理的默认——clone 下来的 lockfile 可能跟本地 store 不匹配isNerveRootNonEmpty用readdirSync().length > 0简单有效Reviewed by 小墨 🖊️