@vinsonw2/asset-compound 0.0.0-stage → 0.1.1

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 CHANGED
@@ -1,3 +1,245 @@
1
- # Temporary Holding Version
1
+ # @vinsonw2/asset-compound
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 编辑器无关的 Node.js 20+ / TypeScript npm 包:把真实项目材料沉淀为 `docs/可读化/` 下可增量、可追溯、可验收的资产。
4
+
5
+ 核心 CLI、schema、templates、中文 prompts 和通用 protocol 不依赖 Cursor,也不读取 `~/.cursor`。Cursor Skill 是显式安装的可选适配器。
6
+
7
+ ## 包名
8
+
9
+ 公开发布名为 `@vinsonw2/asset-compound`,bin 保持 `asset-compound`:
10
+
11
+ ```bash
12
+ npx @vinsonw2/asset-compound --help
13
+ ```
14
+
15
+ 2026-11-10 查询 npm registry 时,该 scoped 名称返回 404,表示当时尚未注册;发布前必须再次执行:
16
+
17
+ ```bash
18
+ npm view @vinsonw2/asset-compound name version
19
+ ```
20
+
21
+ 包名可被其他账户抢先注册。发布 scoped public package 要求发布账号拥有 `@vinsonw2` scope 权限,且 `publishConfig.access` 为 `public`。
22
+
23
+ ## npx 快速开始
24
+
25
+ 初始化编辑器无关工作区(默认 `~/.asset-compound`):
26
+
27
+ ```bash
28
+ npx @vinsonw2/asset-compound init
29
+ ```
30
+
31
+ 建议为每个真实项目指定仓库外目录:
32
+
33
+ ```bash
34
+ npx @vinsonw2/asset-compound init \
35
+ --output "$HOME/.asset-compound/my-react-project" \
36
+ --base-branch main
37
+ ```
38
+
39
+ 生成:
40
+
41
+ ```text
42
+ <output>/
43
+ ├── README.md
44
+ ├── run.yaml
45
+ ├── prompts/asset-analysis.zh-CN.md
46
+ ├── protocol/README.zh-CN.md
47
+ └── schemas/
48
+ ├── analysis-input.schema.json
49
+ └── analysis-output.schema.json
50
+ ```
51
+
52
+ 这些文件构成任意 AI 编辑器都能读取的文件协议;本项目不宣称存在跨编辑器统一 Skill 标准。
53
+
54
+ ## 通用编辑器模式
55
+
56
+ 假设:
57
+
58
+ ```bash
59
+ export REPO="/absolute/path/to/real-react-project"
60
+ export WORK="$HOME/.asset-compound/my-react-project"
61
+ ```
62
+
63
+ 在目标仓库独立分支上运行:
64
+
65
+ ```bash
66
+ npx @vinsonw2/asset-compound plan --repo "$REPO" --config "$WORK/run.yaml"
67
+ npx @vinsonw2/asset-compound scan --repo "$REPO" --config "$WORK/run.yaml" > "$WORK/scan.json"
68
+ npx @vinsonw2/asset-compound prepare --repo "$REPO" --config "$WORK/run.yaml" > "$WORK/prepared.json"
69
+ cp "$WORK/prepared.json" "$WORK/enriched.json"
70
+ ```
71
+
72
+ 让任意 AI 编辑器按以下文件编辑 `enriched.json`:
73
+
74
+ - `$WORK/prompts/asset-analysis.zh-CN.md`
75
+ - `$WORK/protocol/README.zh-CN.md`
76
+ - `$WORK/schemas/analysis-output.schema.json`
77
+
78
+ 然后:
79
+
80
+ ```bash
81
+ npx @vinsonw2/asset-compound validate --input "$WORK/enriched.json"
82
+ npx @vinsonw2/asset-compound finalize \
83
+ --repo "$REPO" \
84
+ --config "$WORK/run.yaml" \
85
+ --assets "$WORK/enriched.json"
86
+ npx @vinsonw2/asset-compound verify --repo "$REPO" --config "$WORK/run.yaml"
87
+ ```
88
+
89
+ 命令名、代码标识符和 JSON/schema 字段保持英文稳定契约;面向验收者的文档和 CLI 提示为中文。
90
+
91
+ ## 可选 Cursor 适配器
92
+
93
+ 只有显式执行下列命令时才访问 Cursor Skill 目录:
94
+
95
+ ```bash
96
+ npx @vinsonw2/asset-compound install-skill --editor cursor
97
+ ```
98
+
99
+ 默认安装到:
100
+
101
+ ```text
102
+ ~/.cursor/skills/asset-compounding/SKILL.md
103
+ ```
104
+
105
+ 覆盖已有安装:
106
+
107
+ ```bash
108
+ npx @vinsonw2/asset-compound install-skill --editor cursor --force
109
+ ```
110
+
111
+ 自定义目录:
112
+
113
+ ```bash
114
+ npx @vinsonw2/asset-compound install-skill \
115
+ --editor cursor \
116
+ --target /custom/path/asset-compounding
117
+ ```
118
+
119
+ ## 命令
120
+
121
+ ```text
122
+ init 初始化通用配置、提示协议和 schema
123
+ install-skill 安装可选编辑器适配器
124
+ plan 校验输入并输出执行计划
125
+ scan 发现来源并计算内容指纹
126
+ prepare 输出 schema 合法的四维分析基线
127
+ validate 校验增强资产 JSON
128
+ render 执行完整管线并渲染文档
129
+ finalize 与 render 等价:执行、验证并输出最终结果
130
+ run finalize 的别名
131
+ verify 验证写入范围;带 --config 时验证二次零差异
132
+ ```
133
+
134
+ 完整参数:
135
+
136
+ ```bash
137
+ npx @vinsonw2/asset-compound <command> --help
138
+ ```
139
+
140
+ ## 能力与安全边界
141
+
142
+ - 强制至少两种不同、真实、非空的来源类型。
143
+ - 支持 `requirement`、`design`、`ai-artifact` 文件来源和 `git` 历史。
144
+ - 生成稳定 SHA-256 ID、来源 revision、四维分析、增量 state、冲突报告和验收报告。
145
+ - 只写目标仓库 `docs/可读化/**`。
146
+ - 拒绝路径穿越、输出符号链接、敏感信息和人工编辑静默覆盖。
147
+ - 相同输入第二次运行输出 `secondRunZeroDiff: true`,业务产物零 diff。
148
+ - CLI 不创建分支、不提交、不 push、不创建 PR。
149
+ - fixture 只能验证工具,不能作为 V1/V2 真实验收数据。
150
+
151
+ ## npm 包内容和库导出
152
+
153
+ tarball 包含:
154
+
155
+ - `dist/`:CLI、库入口和 `.d.ts`
156
+ - `schemas/`
157
+ - `templates/`
158
+ - `prompts/`
159
+ - `protocol/`
160
+ - `skill/asset-compounding/`:可选 Cursor 适配器
161
+ - `artifacts/`:从 npm 官方 registry 获取的 `0.1.0` tarball、SHA-256 清单和中文说明
162
+
163
+ ## 0.1.0 离线 tarball
164
+
165
+ `artifacts/asset-compound-0.1.0.tgz` 是 npm 官方 registry 已发布
166
+ `@vinsonw2/asset-compound@0.1.0` 的原始 tarball,不是从当前工作树重新打包的。
167
+ 固定 SHA-256 记录在 `artifacts/SHA256SUMS`。
168
+
169
+ 在其他平台完成文件同步或下载后,先核对 SHA-256,再在 tarball 所在目录安装:
170
+
171
+ ```bash
172
+ npm install ./asset-compound-0.1.0.tgz
173
+ npx asset-compound --version
174
+ npx asset-compound --help
175
+ ```
176
+
177
+ 完整来源、校验和离线使用方式见 `artifacts/README.zh-CN.md`。生成当前外层包时应将
178
+ `npm pack` 输出到仓库外的临时目录,不得把 `0.1.1` tarball 放入 `artifacts/`,
179
+ 以免递归打包。
180
+
181
+ ESM 库入口:
182
+
183
+ ```js
184
+ import {
185
+ runPipeline,
186
+ verifySecondRun,
187
+ initGenericWorkspace,
188
+ } from "@vinsonw2/asset-compound";
189
+ ```
190
+
191
+ 资源子路径通过 `exports` 暴露,例如:
192
+
193
+ ```text
194
+ @vinsonw2/asset-compound/prompts/asset-analysis.zh-CN.md
195
+ @vinsonw2/asset-compound/protocol/README.zh-CN.md
196
+ @vinsonw2/asset-compound/schemas/analysis-output.schema.json
197
+ @vinsonw2/asset-compound/cursor-skill
198
+ ```
199
+
200
+ ## 本地开发
201
+
202
+ ```bash
203
+ corepack enable
204
+ pnpm install --frozen-lockfile
205
+ pnpm run typecheck
206
+ pnpm run test
207
+ pnpm run build
208
+ pnpm run smoke
209
+ pnpm run smoke:packed
210
+ pnpm audit --prod
211
+ ```
212
+
213
+ `smoke:packed` 会:
214
+
215
+ 1. 从 `npm pack` tarball 创建全新 npx 环境;
216
+ 2. 不使用源码目录的 bin 或 node_modules link;
217
+ 3. 执行 `init`、`plan`、`scan`、`prepare`、`validate`、`finalize`、`verify`、`run`;
218
+ 4. 安装可选 Cursor adapter;
219
+ 5. 证明第二次运行零增量。
220
+
221
+ ## npm 发布
222
+
223
+ 发布前:
224
+
225
+ ```bash
226
+ npm login
227
+ npm whoami
228
+ npm view @vinsonw2/asset-compound name version
229
+ pnpm install --frozen-lockfile
230
+ npm run check
231
+ npm run smoke
232
+ npm run smoke:packed
233
+ npm audit --prod
234
+ npm pack --dry-run
235
+ ```
236
+
237
+ `prepack` 会自动执行 `npm run check`。确认 tarball 含 `dist`、schemas、templates、prompts、protocol 和可选 adapter 后,由有权限的用户执行:
238
+
239
+ ```bash
240
+ npm publish
241
+ ```
242
+
243
+ 本 PR 不执行真实发布,也不需要 npm token。建议在受保护 CI 中使用 npm trusted publishing;需要 provenance 时由支持的 CI 执行 `npm publish --provenance`。不在 `publishConfig` 中强制 provenance,以免本地凭证发布在不支持的环境中失败。
244
+
245
+ `package.json.name` 固定为 `@vinsonw2/asset-compound`,`publishConfig.access` 为 `public`,registry 为 `https://registry.npmjs.org/`。bin 仍为 `asset-compound`。
@@ -0,0 +1,47 @@
1
+ # `asset-compound` 0.1.0 离线安装包
2
+
3
+ `asset-compound-0.1.0.tgz` 来自 npm 官方 registry 已公开发布的
4
+ `@vinsonw2/asset-compound@0.1.0`。本仓库通过以下命令下载原始 tarball,
5
+ 没有从工作树重新打包旧版本:
6
+
7
+ ```bash
8
+ npm pack @vinsonw2/asset-compound@0.1.0 \
9
+ --registry=https://registry.npmjs.org/
10
+ ```
11
+
12
+ ## 校验
13
+
14
+ 同目录的 `SHA256SUMS` 记录了固定 SHA-256。Linux 或 macOS 可在本目录运行:
15
+
16
+ ```bash
17
+ sha256sum -c SHA256SUMS
18
+ ```
19
+
20
+ 在 PowerShell 中可运行:
21
+
22
+ ```powershell
23
+ (Get-FileHash .\asset-compound-0.1.0.tgz -Algorithm SHA256).Hash.ToLower()
24
+ ```
25
+
26
+ 结果必须与 `SHA256SUMS` 中的值完全一致。
27
+
28
+ ## 同步到其他平台后安装
29
+
30
+ 将 `asset-compound-0.1.0.tgz` 下载或同步到目标平台,校验 SHA-256 后,在
31
+ tarball 所在目录执行:
32
+
33
+ ```bash
34
+ npm install ./asset-compound-0.1.0.tgz
35
+ npx asset-compound --version
36
+ npx asset-compound --help
37
+ ```
38
+
39
+ 也可以直接执行本地包中的 CLI:
40
+
41
+ ```bash
42
+ npx --yes --package ./asset-compound-0.1.0.tgz asset-compound --help
43
+ ```
44
+
45
+ 该文件固定保存已发布的 `0.1.0`,外层 npm 包版本升级不会改变其内容。生成外层
46
+ tarball 时必须把输出写到仓库外的临时目录,禁止把外层包复制进 `artifacts/`,
47
+ 以免递归打包。
@@ -0,0 +1 @@
1
+ 7b234a4aa40712b77c4754714f0fecc3015af30497efcb509003e31d5ab01992 asset-compound-0.1.0.tgz