create-yss-spec 2.1.14 → 2.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/package.json +1 -1
- package/src/cli.js +91 -4
- package/template.snapshot.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,18 @@ npm create yss-spec@latest
|
|
|
14
14
|
npx create-yss-spec@latest
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
查看用法、命令、参数和样例:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx create-yss-spec@latest --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
查看 CLI 版本:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx create-yss-spec@latest --version
|
|
27
|
+
```
|
|
28
|
+
|
|
17
29
|
## 当前支持
|
|
18
30
|
|
|
19
31
|
- 交互式收集 `projectName`、`businessDomain`、`targetDir`
|
|
@@ -33,7 +45,7 @@ npx create-yss-spec@latest
|
|
|
33
45
|
- 旧、新资产内容冲突或清单 schema / mode 非法时 fail closed
|
|
34
46
|
- 保留模板的共享 skill 投影;生成实例可在尚未 `git init` 时运行模板校验
|
|
35
47
|
|
|
36
|
-
本次模板适配按 `2.1.
|
|
48
|
+
本次模板适配按 `2.1.15` 发布。`templateCommit` 会写入实例 metadata;“最新模板”指用户执行的 `npx create-yss-spec@latest` 所携带的最新已发布快照,CLI 运行时不会拉取模板仓库。
|
|
37
49
|
|
|
38
50
|
## 接管已有项目
|
|
39
51
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -33,6 +33,8 @@ const TEMPLATE_METADATA_FILENAME = ".yss-template.json";
|
|
|
33
33
|
const TEMPLATE_MANIFEST_VERSION = sha256(TEMPLATE_MANIFEST_TEXT);
|
|
34
34
|
const TEMPLATE_SOURCE = "github:iloveZzz/yss-spec-project-template";
|
|
35
35
|
const METADATA_SCHEMA_VERSION = 2;
|
|
36
|
+
const HELP_FLAGS = new Set(["--help", "-h", "-help"]);
|
|
37
|
+
const VERSION_FLAGS = new Set(["--version", "-v", "-version"]);
|
|
36
38
|
const AGENT_SKILL_ROOTS = [
|
|
37
39
|
".agents/skills",
|
|
38
40
|
".claude/skills",
|
|
@@ -184,8 +186,10 @@ function parseArgs(argv) {
|
|
|
184
186
|
options.includeExampleDocs = true;
|
|
185
187
|
} else if (current === "--no-example-docs") {
|
|
186
188
|
options.includeExampleDocs = false;
|
|
187
|
-
} else if (current
|
|
189
|
+
} else if (HELP_FLAGS.has(current)) {
|
|
188
190
|
options.help = true;
|
|
191
|
+
} else if (VERSION_FLAGS.has(current)) {
|
|
192
|
+
options.version = true;
|
|
189
193
|
} else {
|
|
190
194
|
throw new Error(`不支持的参数:${current}`);
|
|
191
195
|
}
|
|
@@ -1539,6 +1543,10 @@ function runInit(argv = []) {
|
|
|
1539
1543
|
printHelp();
|
|
1540
1544
|
return;
|
|
1541
1545
|
}
|
|
1546
|
+
if (options.version) {
|
|
1547
|
+
printVersion();
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1542
1550
|
return promptForMissingOptions(options).then((promptedOptions) => {
|
|
1543
1551
|
assertRequiredOptions(promptedOptions, "init");
|
|
1544
1552
|
readTemplateSnapshot();
|
|
@@ -1592,6 +1600,10 @@ function runAttach(argv = []) {
|
|
|
1592
1600
|
printHelp();
|
|
1593
1601
|
return;
|
|
1594
1602
|
}
|
|
1603
|
+
if (options.version) {
|
|
1604
|
+
printVersion();
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1595
1607
|
assertRequiredOptions(options, "attach");
|
|
1596
1608
|
if (options.dryRun && options.apply) {
|
|
1597
1609
|
throw new Error("attach 的 --dry-run 与 --apply 互斥");
|
|
@@ -1692,6 +1704,10 @@ function runSync(argv = []) {
|
|
|
1692
1704
|
printHelp();
|
|
1693
1705
|
return;
|
|
1694
1706
|
}
|
|
1707
|
+
if (options.version) {
|
|
1708
|
+
printVersion();
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1695
1711
|
readTemplateSnapshot();
|
|
1696
1712
|
const targetDir = normalizeTargetDir(options.targetDir || ".");
|
|
1697
1713
|
inspectExistingTargetDir(targetDir);
|
|
@@ -1782,16 +1798,87 @@ function runSync(argv = []) {
|
|
|
1782
1798
|
console.log("3. 确认无误后提交本次模板同步结果");
|
|
1783
1799
|
}
|
|
1784
1800
|
|
|
1801
|
+
function argvIncludesFlag(argv, flags) {
|
|
1802
|
+
return argv.some((arg) => flags.has(arg));
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
function printVersion() {
|
|
1806
|
+
console.log(`create-yss-spec ${PACKAGE_MANIFEST.version}`);
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1785
1809
|
function printHelp() {
|
|
1786
1810
|
console.log(`create-yss-spec ${PACKAGE_MANIFEST.version}
|
|
1787
1811
|
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1812
|
+
USAGE
|
|
1813
|
+
$ create-yss-spec [COMMAND] [OPTIONS]
|
|
1814
|
+
|
|
1815
|
+
COMMANDS
|
|
1816
|
+
(default) 初始化新的模板实例仓库
|
|
1817
|
+
attach 向已有项目补齐受管研发管理资产
|
|
1818
|
+
sync 同步已有模板实例的受管资产
|
|
1819
|
+
|
|
1820
|
+
OPTIONS
|
|
1821
|
+
--project-name <name> 项目名称;init 不传则进入交互输入
|
|
1822
|
+
--business-domain <domain> 业务领域;init 不传则进入交互输入
|
|
1823
|
+
--team-size <size> 团队规模;init 不传则可留空,默认「待补充」
|
|
1824
|
+
--target-dir <dir> 目标目录;init 不传则进入交互输入,sync 默认为当前目录
|
|
1825
|
+
--issue-tracker github|gitlab 默认 issue tracker 偏好(默认 github)
|
|
1826
|
+
--dry-run 只预览计划,不写入文件
|
|
1827
|
+
--apply attach 确认执行写入;不能与 --dry-run 同时使用
|
|
1828
|
+
--force init:允许清空非空目录后重新生成
|
|
1829
|
+
attach / sync:覆盖受管冲突文件;unsafe 路径始终阻断
|
|
1830
|
+
--git-init 初始化完成后执行 git init
|
|
1831
|
+
--include-example-docs 显式保留示例文档(默认开启)
|
|
1832
|
+
--no-example-docs 不生成示例文档
|
|
1833
|
+
-h, --help 显示本帮助信息
|
|
1834
|
+
-v, --version 显示 CLI 版本
|
|
1835
|
+
|
|
1836
|
+
EXAMPLES
|
|
1837
|
+
$ npm create yss-spec@latest
|
|
1838
|
+
$ npx create-yss-spec@latest --help
|
|
1839
|
+
$ npx create-yss-spec@latest --version
|
|
1840
|
+
$ npx create-yss-spec@latest \\
|
|
1841
|
+
--project-name "Acme Spec Repo" \\
|
|
1842
|
+
--business-domain "Investment Research" \\
|
|
1843
|
+
--team-size "12" \\
|
|
1844
|
+
--target-dir "./acme-spec-repo" \\
|
|
1845
|
+
--issue-tracker github \\
|
|
1846
|
+
--git-init
|
|
1847
|
+
$ npx create-yss-spec@latest \\
|
|
1848
|
+
--project-name "Preview Repo" \\
|
|
1849
|
+
--business-domain "Data Platform" \\
|
|
1850
|
+
--target-dir "./preview-repo" \\
|
|
1851
|
+
--dry-run
|
|
1852
|
+
$ npx create-yss-spec@latest attach \\
|
|
1853
|
+
--target-dir . \\
|
|
1854
|
+
--project-name "Acme Application" \\
|
|
1855
|
+
--business-domain "Data Platform" \\
|
|
1856
|
+
--dry-run
|
|
1857
|
+
$ npx create-yss-spec@latest attach \\
|
|
1858
|
+
--target-dir . \\
|
|
1859
|
+
--project-name "Acme Application" \\
|
|
1860
|
+
--business-domain "Data Platform" \\
|
|
1861
|
+
--apply
|
|
1862
|
+
$ npx create-yss-spec@latest sync
|
|
1863
|
+
$ npx create-yss-spec@latest sync --dry-run
|
|
1864
|
+
$ npx create-yss-spec@latest sync --target-dir . --force
|
|
1865
|
+
|
|
1866
|
+
LEARN MORE
|
|
1867
|
+
仓库 README:https://github.com/iloveZzz/create-yss-spec#readme
|
|
1868
|
+
使用手册:https://github.com/iloveZzz/create-yss-spec/blob/main/docs/user-guide/create-yss-spec-cli-guide.md
|
|
1869
|
+
模板仓库:https://github.com/iloveZzz/yss-spec-project-template
|
|
1791
1870
|
`);
|
|
1792
1871
|
}
|
|
1793
1872
|
|
|
1794
1873
|
async function runCli(argv = []) {
|
|
1874
|
+
if (argvIncludesFlag(argv, HELP_FLAGS)) {
|
|
1875
|
+
printHelp();
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
if (argvIncludesFlag(argv, VERSION_FLAGS)) {
|
|
1879
|
+
printVersion();
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1795
1882
|
if (argv[0] === "sync") {
|
|
1796
1883
|
runSync(argv.slice(1));
|
|
1797
1884
|
return;
|
package/template.snapshot.json
CHANGED