gsc-scaffolding
v1.0.4
Published
GSC Basic Scaffolding CLI.
Readme
gsc-scaffolding
Lenovo GSC Basic 的项目脚手架 CLI。
它用于快速拉取基础仓库并初始化工作区,支持 frontend、backend、fullstack 三种模式。
相比传统脚手架,gsc-scaffolding 默认集成 AI 资产安装流程:帮助团队在项目落地后直接进入 AI 辅助开发状态。
核心价值:用同一条初始化链路同时完成“代码工作区 + AI 能力基建”的准备。
主要能力
- 交互式初始化流程(语言、项目类型、目录、Git 配置)
- 支持一键非交互执行(
--yes) - 支持受保护目录检测与显式清空(
--force-clear) - 默认浅克隆(
--depth 1),并自动清理源仓库.git - 默认执行 Git bootstrap(init、add remote、commit、push)
- 克隆后自动安装 AI 资产(
gsc-skills)
安装与使用
一次性执行(推荐):
# npx -y 跳过 Ok to proceed? (y),直接安装并执行
npx -y gsc-scaffolding help
npx gsc-scaffolding init
npx gsc-scaffolding ai install --dir .使用别名(gsc-sf)时:
# 方式 1:通过包名调用(推荐)
npx gsc-scaffolding init
# 方式 2:显式指定包后使用别名
npx -p gsc-scaffolding gsc-sf init全局安装后执行:
npm i -g gsc-scaffolding
gsc-scaffolding init
gsc-scaffolding ai install --dir .
gsc-sf init命令
gsc-scaffolding help
gsc-scaffolding init [options]
gsc-scaffolding ai install [options]
gsc-scaffolding ai update [options]
gsc-scaffolding --version说明:
- 无参数默认等价于
help --help显示顶层帮助init --help仅显示init参数ai --help显示ai子命令概览ai install --help仅显示ai install参数ai update --help仅显示ai update参数
init 参数
--help, -h
--version, -v
--yes, -y
--force-clear
--lang <zh|en>
--type, -t <frontend|backend|fullstack>
--dir, -d <dir>
--repo <url>
--agent <agent>
--ai-hook-strict
--git-init
--git-remote <url>
--git-commit-message <msg>
--git-push
--git-branch <name>参数规则:
fullstack模式不支持--repo--agent可选值:github-copilot、claude-code、openclaw、cursor、gemini-cli、kimi-cli、opencode、qwen-code--ai-hook-strict启用 AI 资产 hook 严格模式(hook 失败则初始化失败)--git-push需要有有效远程地址(--git-remote)- 当前版本默认执行
git init;--git-init仅用于兼容历史脚本 - 不接受位置参数(如
gsc-scaffolding init my-app)
ai install 参数
--help, -h
--version, -v
--yes, -y
--lang <zh|en>
--dir, -d <dir>
--agent <agent>
--ai-hook-strict参数规则:
ai install用于已有项目,仅安装 AI 资产,不执行仓库克隆或 Git bootstrap--dir默认为当前目录;目录不存在时会自动创建--agent可选值:github-copilot、claude-code、openclaw、cursor、gemini-cli、kimi-cli、opencode、qwen-code--ai-hook-strict启用 AI 资产 hook 严格模式(hook 失败则安装失败)- 不接受位置参数(如
gsc-scaffolding ai install my-project)
ai update 参数
--help, -h
--version, -v
--yes, -y
--lang <zh|en>
--dir, -d <dir>
--agent <agent>
--ai-hook-strict参数规则:
ai update用于已有项目,刷新 AI 资产并同步最新 instructions / MCP 配置- 当前实现会按固定的 GSC AI 资产源重新执行一次刷新流程,并补跑内置 hook
- 之所以不直接调用裸
gsc-skills update,是因为gsc-scaffolding还需要同步instructions/与.vscode/mcp.json --dir默认为当前目录;目录不存在时会自动创建--agent可选值:github-copilot、claude-code、openclaw、cursor、gemini-cli、kimi-cli、opencode、qwen-code--ai-hook-strict启用 AI 资产 hook 严格模式(hook 失败则更新失败)- 不接受位置参数(如
gsc-scaffolding ai update my-project)
默认仓库
- frontend:
https://gitlab.xpaas.lenovo.com/gsc-basic-group/gsc-basic-frontend-template.git - backend:
https://gitlab.xpaas.lenovo.com/gsc-basic-group/gsc-backend-template.git - fullstack: 同时拉取 frontend + backend(到
<dir>/frontend与<dir>/backend)
执行流程(init)
- 解析参数与语言
- 确认仓库访问权限
- 选择项目类型与目标目录
- 展示执行前确认并二次确认
- 克隆仓库并清理
.git - 安装 AI 资产
- 执行 Git bootstrap
- 输出结果与支持信息
AI 资产安装
对于新项目,init 会在克隆完成后自动安装 AI 资产。
对于已有项目,也可以单独执行:
npx gsc-scaffolding ai install --dir ./existing-project --agent github-copilot
npx gsc-scaffolding ai update --dir ./existing-project --agent github-copilotinit 内部默认复用 ai install 语义,会在目标目录执行:
npx --registry https://registry.npmmirror.com gsc-skills add gsc-basic-group/gsc-basic-skills --skills * --agent <selected-agent> --project -y --post-install-hook "node <internal-sync-assets-hook>"说明:
gsc-skills安装技能后,会通过内置 hook 同步额外 AI 资产。instructions/会复制到目标项目.github/instructions/。mcp/模板会合并到目标项目.vscode/mcp.json。
目录安全与 --force-clear
当目标目录包含以下受保护条目时,不会直接提供清空选项:
.gitnode_modulespackages
如果确认覆盖,请重新执行并显式传入 --force-clear。
开发
pnpm --dir packages/gsc-scaffolding build
pnpm --dir packages/gsc-scaffolding test
pnpm --dir packages/gsc-scaffolding type-checkLicense
LicenseRef-Proprietary
