@jahanxu/code-flow 0.1.0 → 0.1.2
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 +88 -0
- package/package.json +1 -1
- package/src/adapters/claude/CLAUDE.md +23 -0
- package/src/cli.js +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# code-flow
|
|
2
|
+
|
|
3
|
+
一个用于快速初始化与管理项目规范的命令行工具。通过全局安装后执行 `code-flow init`,自动生成项目约定文件与目录结构,帮助团队统一流程并提升协作效率。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -g @jahanxu/code-flow
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
pnpm:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add -g @jahanxu/code-flow
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 升级
|
|
20
|
+
|
|
21
|
+
npm:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm i -g @jahanxu/code-flow@latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
pnpm:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add -g @jahanxu/code-flow@latest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 卸载
|
|
34
|
+
|
|
35
|
+
npm:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm rm -g @jahanxu/code-flow
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
pnpm:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm remove -g @jahanxu/code-flow
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 基本用法
|
|
48
|
+
|
|
49
|
+
初始化:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
code-flow init
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
查看帮助:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
code-flow --help
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 生成的目录与文件
|
|
62
|
+
|
|
63
|
+
运行 `code-flow init` 后,将在项目根目录生成(或更新)以下结构:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
.code-flow/
|
|
67
|
+
.claude/
|
|
68
|
+
CLAUDE.md
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 依赖说明
|
|
72
|
+
|
|
73
|
+
- 需要 `python3` 版本 3.9 及以上
|
|
74
|
+
- 需要安装 `pyyaml`(`cf_init` 会尝试自动安装,失败会提示手动处理)
|
|
75
|
+
|
|
76
|
+
## 常见问题
|
|
77
|
+
|
|
78
|
+
- EOTP(`--otp`)
|
|
79
|
+
- 原因:启用了 npm/pnpm 的一次性密码或 2FA。
|
|
80
|
+
- 处理:按提示输入 OTP,或使用 `--otp` 重新执行安装命令。
|
|
81
|
+
|
|
82
|
+
- E402(`--access=public`)
|
|
83
|
+
- 原因:发布/安装时访问级别不匹配或权限不足。
|
|
84
|
+
- 处理:必要时使用 `--access=public` 重新发布或检查权限配置。
|
|
85
|
+
|
|
86
|
+
- name 冲突
|
|
87
|
+
- 原因:本地或全局已有同名命令/包。
|
|
88
|
+
- 处理:先卸载冲突包或更换名称后再安装。
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Project Guidelines
|
|
2
|
+
|
|
3
|
+
## Team Identity
|
|
4
|
+
- Team: [team name]
|
|
5
|
+
- Project: [project name]
|
|
6
|
+
- Language: [primary language]
|
|
7
|
+
|
|
8
|
+
## Core Principles
|
|
9
|
+
- All changes must include tests
|
|
10
|
+
- Single responsibility per function (<= 50 lines)
|
|
11
|
+
- No loose typing or silent exception handling
|
|
12
|
+
- Handle errors explicitly
|
|
13
|
+
|
|
14
|
+
## Forbidden Patterns
|
|
15
|
+
- Hard-coded secrets or credentials
|
|
16
|
+
- Unparameterized SQL
|
|
17
|
+
- Network calls inside tight loops
|
|
18
|
+
|
|
19
|
+
## Spec Loading
|
|
20
|
+
This project uses the code-flow layered spec system.
|
|
21
|
+
Specs live in .code-flow/specs/ and are injected on demand.
|
|
22
|
+
|
|
23
|
+
## Learnings
|
package/src/cli.js
CHANGED
|
@@ -66,7 +66,7 @@ function runInit() {
|
|
|
66
66
|
const adaptersDir = path.join(baseDir, 'adapters');
|
|
67
67
|
|
|
68
68
|
copyDirRecursive(path.join(coreDir, 'code-flow'), path.join(cwd, '.code-flow'));
|
|
69
|
-
copyFileIfMissing(path.join(
|
|
69
|
+
copyFileIfMissing(path.join(adaptersDir, 'claude', 'CLAUDE.md'), path.join(cwd, 'CLAUDE.md'));
|
|
70
70
|
copyDirRecursive(path.join(adaptersDir, 'claude'), path.join(cwd, '.claude'));
|
|
71
71
|
|
|
72
72
|
const result = spawnSync(
|