@namewta/speculo 1.0.1 → 1.0.3
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 +8 -3
- package/package.json +2 -2
- package/template/AGENTS.md +14 -1
- package/template/canonical/canonical-specdev-goal-plan.md +758 -217
- package/template/canonical/canonical-specdev-grill-with-docs.md +222 -127
- package/template/canonical/canonical-specdev-spec.md +79 -2
- package/template/canonical/canonical-specdev-tickets.md +691 -255
- package/template/canonical/canonical-specdev-wayfinder.md +331 -107
- package/template/commands/archive-and-consolidate.md +1 -2
- package/template/commands/docs-sync.md +1 -1
- package/template/commands/git-repository-audit.md +4 -603
- package/template/commands/handoff.md +1 -1
- package/template/commands/references/git-repository-audit-procedure.md +608 -0
- package/template/commands/retro.md +1 -1
- package/template/commands/status.md +1 -1
- package/template/skills/archive-and-consolidate/SKILL.md +9 -168
- package/template/skills/archive-and-consolidate/references/entry-procedure.md +170 -0
- package/template/skills/docs-sync/SKILL.md +9 -11
- package/template/skills/docs-sync/references/entry-procedure.md +18 -0
- package/template/skills/engineering-standards-builder/SKILL.md +9 -148
- package/template/skills/engineering-standards-builder/references/entry-procedure.md +154 -0
- package/template/skills/git-history-squash/SKILL.md +9 -88
- package/template/skills/git-history-squash/references/entry-procedure.md +94 -0
- package/template/skills/github-npm-ops/SKILL.md +9 -18
- package/template/skills/github-npm-ops/references/entry-procedure.md +25 -0
- package/template/skills/optimize-codex-config/SKILL.md +12 -72
- package/template/skills/optimize-codex-config/references/entry-procedure.md +78 -0
- package/template/skills/source-code-zip/SKILL.md +10 -559
- package/template/skills/source-code-zip/references/entry-procedure.md +565 -0
- package/template/skills/speculo-retro/SKILL.md +9 -16
- package/template/skills/speculo-retro/references/entry-procedure.md +23 -0
- package/template/skills/upstream-fork-sync/SKILL.md +10 -72
- package/template/skills/upstream-fork-sync/references/entry-procedure.md +78 -0
- package/template/skills/writing-great-skills/SKILL.md +10 -72
- package/template/skills/writing-great-skills/references/document-contract.md +23 -0
- package/template/skills/writing-great-skills/references/entry-procedure.md +79 -0
- package/template/workflows/learning/A-archive/A-archive.md +7 -0
- package/template/workflows/learning/A-assess-and-plan/A-assess-and-plan.md +7 -0
- package/template/workflows/learning/C-consolidate/C-consolidate.md +7 -0
- package/template/workflows/learning/H-homework/H-homework.md +8 -1
- package/template/workflows/learning/I-init-setup/I-init-setup.md +7 -0
- package/template/workflows/learning/INDEX.md +2 -0
- package/template/workflows/learning/L-lesson/L-lesson.md +7 -0
- package/template/workflows/learning/R-review/R-review.md +8 -1
- package/template/workflows/learning/README.md +3 -1
- package/template/workflows/learning/common/rules/activation-and-memory.md +24 -0
- package/template/workflows/ops/A-archive-and-learn/A-archive-and-learn.md +7 -0
- package/template/workflows/ops/E-execute-and-stabilize/E-execute-and-stabilize.md +8 -1
- package/template/workflows/ops/I-intake-and-assess/I-intake-and-assess.md +7 -0
- package/template/workflows/ops/INDEX.md +2 -0
- package/template/workflows/ops/P-plan-and-approve/P-plan-and-approve.md +8 -1
- package/template/workflows/ops/README.md +3 -0
- package/template/workflows/ops/common/rules/activation-and-memory.md +24 -0
- package/template/workflows/person/INDEX.md +2 -0
- package/template/workflows/person/M-mao-zedong-cognitive-os/M-mao-zedong-cognitive-os.md +9 -0
- package/template/workflows/person/M-mao-zedong-cognitive-os/books/README.md +1 -1
- package/template/workflows/person/S-steelman-deliberation/S-steelman-deliberation.md +7 -0
- package/template/workflows/person/common/rules/activation-and-memory.md +24 -0
- package/template/workflows/specdev/A-archive-and-consolidate/A-archive-and-consolidate.md +7 -0
- package/template/workflows/specdev/C-code-review/C-code-review.md +7 -0
- package/template/workflows/specdev/D-diagnose-bugs/D-diagnose-bugs.md +7 -0
- package/template/workflows/specdev/G-grill-with-docs/G-grill-with-docs.md +14 -130
- package/template/workflows/specdev/G-grill-with-docs/references/interview-procedure.md +134 -0
- package/template/workflows/specdev/I-implement/I-implement.md +16 -183
- package/template/workflows/specdev/I-implement/evidence-template.md +12 -0
- package/template/workflows/specdev/I-implement/execution-preflight.md +2 -2
- package/template/workflows/specdev/I-implement/references/implementation-procedure.md +192 -0
- package/template/workflows/specdev/I-init-setup/I-init-setup.md +7 -0
- package/template/workflows/specdev/INDEX.md +2 -0
- package/template/workflows/specdev/L-learn-change/L-learn-change.md +7 -0
- package/template/workflows/specdev/P-goal-plan/P-goal-plan.md +29 -135
- package/template/workflows/specdev/P-goal-plan/completion-control.md +1 -1
- package/template/workflows/specdev/P-goal-plan/references/goal-lifecycle.md +35 -0
- package/template/workflows/specdev/P-goal-plan/references/goal-tickets-map-template.md +15 -0
- package/template/workflows/specdev/P-goal-plan/references/map-control.md +28 -0
- package/template/workflows/specdev/{O-orchestrate-implementation/O-orchestrate-implementation.md → P-goal-plan/references/multi-change-plan.md} +25 -28
- package/template/workflows/specdev/P-goal-plan/references/replan-and-recovery.md +21 -0
- package/template/workflows/specdev/P-goal-plan/references/single-change-plan.md +149 -0
- package/template/workflows/specdev/P-prototype/P-prototype.md +7 -0
- package/template/workflows/specdev/R-review-architecture/R-review-architecture.md +52 -50
- package/template/workflows/specdev/R-review-architecture/architecture-review-template.md +19 -10
- package/template/workflows/specdev/R-review-architecture/proposal-to-ticket.md +3 -1
- package/template/workflows/specdev/R-review-architecture/review-rubric.md +52 -0
- package/template/workflows/specdev/README.md +37 -214
- package/template/workflows/specdev/S-spec/S-spec.md +7 -0
- package/template/workflows/specdev/T-tickets/T-tickets.md +20 -224
- package/template/workflows/specdev/T-tickets/references/planning-procedure.md +233 -0
- package/template/workflows/specdev/T-tickets/ticket-template.md +18 -2
- package/template/workflows/specdev/T-tickets/tickets-map-template.md +15 -1
- package/template/workflows/specdev/T-triage/T-triage.md +10 -1
- package/template/workflows/specdev/W-wayfinder/W-wayfinder.md +25 -112
- package/template/workflows/specdev/W-wayfinder/references/initiative-discovery.md +29 -0
- package/template/workflows/specdev/W-wayfinder/references/initiative-template.json +8 -0
- package/template/workflows/specdev/W-wayfinder/references/map-traversal.md +120 -0
- package/template/workflows/specdev/W-wayfinder/wayfinder-map-template.md +4 -0
- package/template/workflows/specdev/common/README.md +2 -1
- package/template/workflows/specdev/common/rules/activation-and-memory.md +24 -0
- package/template/workflows/specdev/common/rules/artifact-contract.md +10 -2
- package/template/workflows/specdev/common/rules/operating-governance.md +38 -0
- package/template/workflows/specdev/common/rules/parent-implementation-orchestration.md +6 -2
- package/template/workflows/specdev/common/rules/skill-invocation.md +27 -0
- package/template/workflows/specdev/common/rules/workflow-routing.md +24 -0
- package/template/workflows/specdev/common/rules/workflow-state-and-lifecycle.md +93 -0
- package/template/workflows/specdev/common/schemas/goal-tickets-map.schema.json +33 -0
- package/template/workflows/specdev/common/schemas/initiative.schema.json +94 -0
- package/template/workflows/specdev/common/schemas/ticket.schema.json +168 -1
- package/template/workflows/specdev/common/schemas/tickets-map.schema.json +74 -6
- package/template/workflows/specdev/common/skills/code-review/SKILL.md +3 -2
- package/template/workflows/specdev/common/skills/code-review/references/risk-review.md +25 -0
- package/template/workflows/specdev/common/skills/plan-quality-review/SKILL.md +10 -0
- package/template/workflows/specdev/common/skills/plan-quality-review/references/checklist.md +13 -0
- package/template/workflows/specdev/common/skills/subagent-delivery/SKILL.md +5 -83
- package/template/workflows/specdev/common/skills/subagent-delivery/references/dispatch-and-accept.md +87 -0
- package/template/workflows/specdev/common/tools/README.md +14 -2
- package/template/workflows/specdev/common/tools/plan-contract.mjs +256 -0
- package/template/workflows/specdev/common/tools/ticket-control.mjs +251 -0
- package/template/workflows/specdev/common/tools/validate-specdev.mjs +58 -40
- package/template/workflows/specdev/manifest.json +97 -1
- package/template/canonical/canonical-specdev-orchestrate-implementation.md +0 -2823
- package/template/workflows/specdev/O-orchestrate-implementation/implementation-evidence-template.md +0 -39
- package/template/workflows/specdev/O-orchestrate-implementation/implementation-map-template.md +0 -50
- package/template/workflows/specdev/O-orchestrate-implementation/implementation-plan-template.md +0 -61
- package/template/workflows/specdev/R-review-architecture/architecture-report-contract.md +0 -123
- package/template/workflows/specdev/R-review-architecture/architecture-review-report-template.html +0 -106
- /package/template/workflows/specdev/{O-orchestrate-implementation/conflict-and-drift.md → P-goal-plan/references/multi-conflict-and-drift.md} +0 -0
- /package/template/workflows/specdev/{O-orchestrate-implementation/execution-loop.md → P-goal-plan/references/multi-execution-loop.md} +0 -0
- /package/template/workflows/specdev/{O-orchestrate-implementation/input-readiness.md → P-goal-plan/references/multi-input-readiness.md} +0 -0
- /package/template/workflows/specdev/{O-orchestrate-implementation/super-dag.md → P-goal-plan/references/multi-super-dag.md} +0 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
# Entry procedure
|
|
2
|
+
|
|
3
|
+
# Source Code ZIP
|
|
4
|
+
|
|
5
|
+
把一个目录压缩为安全、精简、主要只包含源码的 ZIP。实际执行逻辑位于:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
scripts/zip_source_code.js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
该实现只有一个 JavaScript 文件,只使用 Node.js 内置模块:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
fs
|
|
15
|
+
path
|
|
16
|
+
os
|
|
17
|
+
crypto
|
|
18
|
+
zlib
|
|
19
|
+
stream
|
|
20
|
+
util
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
不需要:
|
|
24
|
+
|
|
25
|
+
- `npm install`
|
|
26
|
+
- `package.json`
|
|
27
|
+
- `node_modules`
|
|
28
|
+
- Python 或 `uv`
|
|
29
|
+
- 系统 `zip` 命令
|
|
30
|
+
- 任何第三方 JavaScript 包
|
|
31
|
+
|
|
32
|
+
建议使用 Node.js 14 或更高版本。
|
|
33
|
+
|
|
34
|
+
## 必须遵循的运行方式
|
|
35
|
+
|
|
36
|
+
始终先确认 `node` 可用:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
node --version
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
然后直接运行:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
node scripts/zip_source_code.js "/path/to/project"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Windows PowerShell:
|
|
49
|
+
|
|
50
|
+
```powershell
|
|
51
|
+
node scripts/zip_source_code.js "C:\path\to\project"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
少数 Linux 发行版可能只提供 `nodejs` 命令;只有 `node` 确实不存在时,才回退为:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
nodejs scripts/zip_source_code.js "/path/to/project"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
不要为了运行本 SKILL 创建 npm 项目,也不要执行:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
npm install
|
|
64
|
+
pnpm install
|
|
65
|
+
yarn install
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
脚本没有第三方依赖,上述操作没有必要,还可能额外生成需要被排除的依赖目录和锁文件。
|
|
69
|
+
|
|
70
|
+
在 macOS 或 Linux 上,也可以把脚本设为可执行文件后直接运行:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
chmod +x scripts/zip_source_code.js
|
|
74
|
+
./scripts/zip_source_code.js "/path/to/project"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 标准工作流
|
|
78
|
+
|
|
79
|
+
1. 确认用户提供的是目录路径,不是单个文件;路径含空格时必须加引号。
|
|
80
|
+
2. 先确认 `node --version` 能正常执行。
|
|
81
|
+
3. 默认先运行一次 `--dry-run`;目录较大、规则刚修改或可能包含敏感信息时,同时添加 `--verbose`。
|
|
82
|
+
4. 检查预览结果,确认 `.env`、YAML、依赖目录、构建产物、归档文件和密钥没有被纳入。
|
|
83
|
+
5. 正式创建 ZIP。
|
|
84
|
+
6. 报告 ZIP 的绝对路径、纳入文件数、输入总大小和生成结果。
|
|
85
|
+
7. 除非用户明确理解风险并提出要求,不得使用 `--no-default-ignore`。
|
|
86
|
+
|
|
87
|
+
推荐预览:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
node scripts/zip_source_code.js "/path/to/project" --dry-run
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
查看每个项目被排除的原因:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
node scripts/zip_source_code.js "/path/to/project" \
|
|
97
|
+
--dry-run \
|
|
98
|
+
--verbose
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
正式创建:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
node scripts/zip_source_code.js "/path/to/project"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
默认输出在源目录旁边:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
<目录名>.code.zip
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
例如:
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
源目录:/work/my-app
|
|
117
|
+
输出: /work/my-app.code.zip
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 默认过滤行为
|
|
121
|
+
|
|
122
|
+
脚本采用两层过滤:
|
|
123
|
+
|
|
124
|
+
1. `IGNORE` 正则先排除危险、庞大或明确不需要的内容。
|
|
125
|
+
2. 默认源码白名单只纳入常见代码扩展名、特殊构建脚本名,以及带 shebang 的无扩展名脚本。
|
|
126
|
+
|
|
127
|
+
内置 `IGNORE` 默认排除:
|
|
128
|
+
|
|
129
|
+
- `.git`、`.hg`、`.svn`。
|
|
130
|
+
- `.idea`、`.vscode` 和常见系统元数据。
|
|
131
|
+
- `node_modules`、`node_module`、`vendor` 和常见依赖目录。
|
|
132
|
+
- Python 虚拟环境、测试缓存、编译缓存和通用缓存目录。
|
|
133
|
+
- `dist`、`build`、`target`、`out`、覆盖率目录和常见前端框架缓存。
|
|
134
|
+
- `.env`、`.env.local`、`.env.production` 等环境变量文件。
|
|
135
|
+
- `.yml` 和 `.yaml`。
|
|
136
|
+
- ZIP、RAR、7z、TAR、GZ、JAR、WHL 等归档文件。
|
|
137
|
+
- 可执行文件、动态库、目标文件、字节码和 WebAssembly 产物。
|
|
138
|
+
- 证书、私钥、keystore 和常见 SSH 密钥文件名。
|
|
139
|
+
- 图片、音频、视频、PDF 和 Office 文件。
|
|
140
|
+
- 数据库、日志、临时文件和备份文件。
|
|
141
|
+
- 常见依赖锁文件。
|
|
142
|
+
- `.min.js`、`.bundle.js`、`.min.css`、`.bundle.css` 等压缩或打包产物。
|
|
143
|
+
|
|
144
|
+
默认源码白名单包括但不限于:
|
|
145
|
+
|
|
146
|
+
- JavaScript、TypeScript、JSX、TSX。
|
|
147
|
+
- Python、Java、Kotlin、Scala、Go、Rust、C、C++、C#、Swift。
|
|
148
|
+
- Shell、PowerShell、Ruby、PHP、Perl、Lua。
|
|
149
|
+
- HTML、CSS、SCSS、Vue、Svelte、Astro、MDX。
|
|
150
|
+
- SQL、GraphQL、Protocol Buffers、Terraform、HCL、Nix。
|
|
151
|
+
- Dockerfile、Makefile、CMakeLists.txt、Jenkinsfile、Bazel 和 Meson 构建文件。
|
|
152
|
+
- 带 `#!` shebang 的无扩展名脚本。
|
|
153
|
+
|
|
154
|
+
`README.md`、`package.json`、`pyproject.toml` 等普通项目文件默认不会进入 ZIP;需要时使用 `--include`。
|
|
155
|
+
|
|
156
|
+
## IGNORE 正则字段
|
|
157
|
+
|
|
158
|
+
脚本顶部包含可直接编辑的字段:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
const IGNORE = [
|
|
162
|
+
String.raw`(^|/)\.git(?:/|$)`,
|
|
163
|
+
String.raw`(^|/)node_modules(?:/|$)`,
|
|
164
|
+
String.raw`\.zip$`,
|
|
165
|
+
String.raw`(^|/)\.env(?:\..*)?$`,
|
|
166
|
+
String.raw`\.ya?ml$`,
|
|
167
|
+
];
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
实际脚本中的默认列表更完整。
|
|
171
|
+
|
|
172
|
+
匹配规则:
|
|
173
|
+
|
|
174
|
+
- 匹配对象是相对于源目录的路径。
|
|
175
|
+
- 路径分隔符统一为 `/`,即使在 Windows 上也是如此。
|
|
176
|
+
- 路径开头没有 `/`。
|
|
177
|
+
- 脚本使用 `new RegExp(pattern, "i")`,默认不区分大小写。
|
|
178
|
+
- 使用的是 JavaScript 正则表达式,不是 Git `.gitignore` glob。
|
|
179
|
+
- 不要使用 Python 独有的正则语法。
|
|
180
|
+
- 忽略规则优先于 `--include`。
|
|
181
|
+
- 被忽略的目录不会继续遍历。
|
|
182
|
+
|
|
183
|
+
显示全部默认规则:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
node scripts/zip_source_code.js --show-defaults
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
临时追加一个忽略正则,不修改脚本:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
node scripts/zip_source_code.js ./project \
|
|
193
|
+
--ignore '(^|/)fixtures?(/|$)'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
追加多个正则:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
node scripts/zip_source_code.js ./project \
|
|
200
|
+
--ignore '(^|/)fixtures?(/|$)' \
|
|
201
|
+
--ignore '(^|/)generated(/|$)'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
也可以从 UTF-8 文本文件读取正则。每行一个规则,空行和以 `#` 开头的行会被忽略:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
node scripts/zip_source_code.js ./project \
|
|
208
|
+
--ignore-from ./custom-ignore.regex
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
规则文件示例:
|
|
212
|
+
|
|
213
|
+
```text
|
|
214
|
+
# 测试夹具
|
|
215
|
+
(^|/)fixtures?(/|$)
|
|
216
|
+
|
|
217
|
+
# 自动生成代码
|
|
218
|
+
(^|/)generated(/|$)
|
|
219
|
+
\.gen\.[a-z0-9]+$
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`--ignore-from` 可以重复使用。
|
|
223
|
+
|
|
224
|
+
## 纳入额外项目文件
|
|
225
|
+
|
|
226
|
+
默认只纳入源码。需要额外打包 `package.json` 时:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
node scripts/zip_source_code.js ./project \
|
|
230
|
+
--include '(^|/)package\.json$'
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
同时纳入多个项目清单:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
node scripts/zip_source_code.js ./project \
|
|
237
|
+
--include '(^|/)package\.json$' \
|
|
238
|
+
--include '(^|/)pyproject\.toml$' \
|
|
239
|
+
--include '(^|/)Cargo\.toml$'
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`--include` 只绕过源码扩展名白名单,不会绕过 `IGNORE`。例如,下列内容即使被 `--include` 匹配,仍会被默认安全规则排除:
|
|
243
|
+
|
|
244
|
+
```text
|
|
245
|
+
.env
|
|
246
|
+
config.yml
|
|
247
|
+
private.key
|
|
248
|
+
archive.zip
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
需要纳入所有未被 `IGNORE` 排除的普通文件时:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
node scripts/zip_source_code.js ./project --all-files
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
只有用户明确要求并理解风险时,才可同时禁用默认过滤:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
node scripts/zip_source_code.js ./project \
|
|
261
|
+
--all-files \
|
|
262
|
+
--no-default-ignore
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
该组合可能把凭据、依赖目录、密钥、大型二进制文件和已有归档打包,不得作为默认方案。
|
|
266
|
+
|
|
267
|
+
## 输出控制
|
|
268
|
+
|
|
269
|
+
指定输出位置:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
node scripts/zip_source_code.js ./project \
|
|
273
|
+
--output ./artifacts/project-source.zip
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
`-o` 是 `--output` 的缩写:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
node scripts/zip_source_code.js ./project \
|
|
280
|
+
-o ./artifacts/project-source.zip
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
输出名称没有 `.zip` 后缀时,脚本会自动补上:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
node scripts/zip_source_code.js ./project -o ./artifacts/project-source
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
实际输出:
|
|
290
|
+
|
|
291
|
+
```text
|
|
292
|
+
./artifacts/project-source.zip
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
默认拒绝覆盖已有 ZIP。确认允许覆盖后使用:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
node scripts/zip_source_code.js ./project \
|
|
299
|
+
-o ./artifacts/project-source.zip \
|
|
300
|
+
--force
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
默认 ZIP 内保留一个顶层目录:
|
|
304
|
+
|
|
305
|
+
```text
|
|
306
|
+
project/src/main.js
|
|
307
|
+
project/tests/main.test.js
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
需要把源目录内容直接放到 ZIP 根目录时:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
node scripts/zip_source_code.js ./project --contents-only
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
此时 ZIP 内路径类似:
|
|
317
|
+
|
|
318
|
+
```text
|
|
319
|
+
src/main.js
|
|
320
|
+
tests/main.test.js
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## 压缩级别
|
|
324
|
+
|
|
325
|
+
压缩级别范围为 `0` 到 `9`,默认是 `9`:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
node scripts/zip_source_code.js ./project \
|
|
329
|
+
--compression-level 6
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
含义:
|
|
333
|
+
|
|
334
|
+
- `0`:仅存储,不执行 Deflate 压缩。
|
|
335
|
+
- `1`:压缩更快。
|
|
336
|
+
- `9`:通常压缩率更高,但运行时间可能更长。
|
|
337
|
+
|
|
338
|
+
脚本使用 Node.js 内置 `zlib`,不调用外部压缩程序。
|
|
339
|
+
|
|
340
|
+
## 预览和输出模式
|
|
341
|
+
|
|
342
|
+
只预览,不创建 ZIP:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
node scripts/zip_source_code.js ./project --dry-run
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
预览并显示每个排除原因:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
node scripts/zip_source_code.js ./project \
|
|
352
|
+
--dry-run \
|
|
353
|
+
--verbose
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
适合自动化脚本的安静模式;成功时只输出 ZIP 绝对路径:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
archive_path="$(node scripts/zip_source_code.js ./project --quiet)"
|
|
360
|
+
printf '%s\n' "$archive_path"
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Windows PowerShell:
|
|
364
|
+
|
|
365
|
+
```powershell
|
|
366
|
+
$archivePath = node scripts/zip_source_code.js "C:\work\project" --quiet
|
|
367
|
+
$archivePath
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
`--verbose` 与 `--quiet` 不能同时使用。
|
|
371
|
+
|
|
372
|
+
## 完整命令示例
|
|
373
|
+
|
|
374
|
+
安全预览:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
node scripts/zip_source_code.js "/work/my app" \
|
|
378
|
+
--dry-run \
|
|
379
|
+
--verbose
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
打包源码并额外纳入 Node 项目清单:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
node scripts/zip_source_code.js "/work/my app" \
|
|
386
|
+
--include '(^|/)package\.json$' \
|
|
387
|
+
--include '(^|/)tsconfig\.json$' \
|
|
388
|
+
-o "/work/artifacts/my-app-source.zip"
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
排除测试夹具和自动生成目录:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
node scripts/zip_source_code.js ./project \
|
|
395
|
+
--ignore '(^|/)fixtures?(/|$)' \
|
|
396
|
+
--ignore '(^|/)generated(/|$)'
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
纳入所有非敏感普通文件,但仍保留默认安全排除:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
node scripts/zip_source_code.js ./project \
|
|
403
|
+
--all-files \
|
|
404
|
+
--dry-run
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
直接将内容写入 ZIP 根目录,并设置中等压缩级别:
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
node scripts/zip_source_code.js ./project \
|
|
411
|
+
--contents-only \
|
|
412
|
+
--compression-level 6
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
目录名以 `-` 开头时,在选项后使用 `--`:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
node scripts/zip_source_code.js -- ./-special-project
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## 空目录行为
|
|
422
|
+
|
|
423
|
+
默认情况下,没有任何匹配文件时脚本会报错,避免误生成看似成功但没有内容的 ZIP。
|
|
424
|
+
|
|
425
|
+
确认需要空 ZIP 时:
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
node scripts/zip_source_code.js ./empty-project \
|
|
429
|
+
--allow-empty
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
可以结合 `--dry-run` 检查为什么没有文件被纳入:
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
node scripts/zip_source_code.js ./empty-project \
|
|
436
|
+
--dry-run \
|
|
437
|
+
--verbose \
|
|
438
|
+
--allow-empty
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## 安全与可靠性约束
|
|
442
|
+
|
|
443
|
+
- 默认跳过所有符号链接,不跟随到源目录之外。
|
|
444
|
+
- 忽略规则在额外纳入规则之前执行。
|
|
445
|
+
- 默认拒绝覆盖已有 ZIP。
|
|
446
|
+
- 输出 ZIP 位于源目录内部时,会排除该输出文件本身。
|
|
447
|
+
- ZIP 先写入同目录的临时文件,完整写入并同步后才安装到最终路径。
|
|
448
|
+
- 未使用 `--force` 时,最终安装采用“不覆盖已有目标”的方式,降低并发竞态造成误覆盖的风险。
|
|
449
|
+
- 源文件逐个流式读取和压缩,不会一次性把整个目录或整个 ZIP 放入内存。
|
|
450
|
+
- 脚本自行计算 CRC32,并生成标准 ZIP 中央目录。
|
|
451
|
+
- 脚本支持 ZIP64 元数据,可处理中央目录偏移或条目数量超过普通 ZIP 字段范围的情况。
|
|
452
|
+
- 若文件在扫描后变成符号链接或不再是普通文件,脚本会中止。
|
|
453
|
+
- 默认不创建空 ZIP;需要时必须显式使用 `--allow-empty`。
|
|
454
|
+
- 收到中断信号时会尝试删除临时 ZIP。
|
|
455
|
+
- 修改 `IGNORE` 后,正式打包前必须重新运行 `--dry-run --verbose`。
|
|
456
|
+
|
|
457
|
+
## 常见问题
|
|
458
|
+
|
|
459
|
+
### node 命令不存在
|
|
460
|
+
|
|
461
|
+
先确认是否只有 `nodejs` 命令:
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
nodejs --version
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
若存在,可运行:
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
nodejs scripts/zip_source_code.js ./project
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
若两个命令都不存在,需要先按当前系统或组织规定安装 Node.js。不要因此执行 `npm install`;npm 不能代替 Node.js 运行时。
|
|
474
|
+
|
|
475
|
+
### Node.js 版本过低
|
|
476
|
+
|
|
477
|
+
脚本会显示当前版本和最低要求。升级到 Node.js 14 或更高版本后重新执行。
|
|
478
|
+
|
|
479
|
+
### 没有找到可打包文件
|
|
480
|
+
|
|
481
|
+
先查看默认规则:
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
node scripts/zip_source_code.js --show-defaults
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
再预览全部未被忽略的普通文件:
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
node scripts/zip_source_code.js ./project \
|
|
491
|
+
--all-files \
|
|
492
|
+
--dry-run
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
若只缺少少量项目文件,使用 `--include`,不要直接禁用默认忽略规则。
|
|
496
|
+
|
|
497
|
+
### package.json 没有进入 ZIP
|
|
498
|
+
|
|
499
|
+
这是默认行为,因为 JSON 不属于默认源码扩展名。显式添加:
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
node scripts/zip_source_code.js ./project \
|
|
503
|
+
--include '(^|/)package\.json$'
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### YAML 没有进入 ZIP
|
|
507
|
+
|
|
508
|
+
这是默认安全规则,也是本 SKILL 的明确过滤要求。`--include` 不会绕过该规则。
|
|
509
|
+
|
|
510
|
+
只有用户明确要求改变这一行为时,才编辑脚本顶部的 `IGNORE`,或使用风险更高的 `--no-default-ignore` 并重新补充其他安全规则。
|
|
511
|
+
|
|
512
|
+
### 输出文件已存在
|
|
513
|
+
|
|
514
|
+
指定新文件名,或确认覆盖安全后添加:
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
--force
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### 正则无效
|
|
521
|
+
|
|
522
|
+
脚本会指出无效的命令行正则,或 `--ignore-from` 文件中的具体行号。
|
|
523
|
+
|
|
524
|
+
规则必须符合 JavaScript `RegExp` 语法。例如,Python 的某些内联标志或专用结构不能直接使用。
|
|
525
|
+
|
|
526
|
+
### ZIP 内多了一层项目目录
|
|
527
|
+
|
|
528
|
+
这是默认行为。需要直接写入目录内容时添加:
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
--contents-only
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### 需要查看所有命令参数
|
|
535
|
+
|
|
536
|
+
```bash
|
|
537
|
+
node scripts/zip_source_code.js --help
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
版本信息:
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
node scripts/zip_source_code.js --version
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
## 参数速查
|
|
547
|
+
|
|
548
|
+
```text
|
|
549
|
+
-o, --output <ZIP> 指定输出路径
|
|
550
|
+
-f, --force 覆盖已有输出
|
|
551
|
+
--ignore <REGEX> 追加忽略规则,可重复
|
|
552
|
+
--ignore-from <FILE> 从文件读取忽略规则,可重复
|
|
553
|
+
--include <REGEX> 额外纳入文件,可重复
|
|
554
|
+
--all-files 关闭源码白名单
|
|
555
|
+
--no-default-ignore 禁用默认忽略规则
|
|
556
|
+
--contents-only ZIP 根目录直接放内容
|
|
557
|
+
--compression-level <0-9> 压缩级别
|
|
558
|
+
--dry-run 仅预览
|
|
559
|
+
--allow-empty 允许空 ZIP
|
|
560
|
+
-v, --verbose 显示跳过原因
|
|
561
|
+
-q, --quiet 成功时只输出路径
|
|
562
|
+
--show-defaults 显示默认规则
|
|
563
|
+
--version 显示版本
|
|
564
|
+
-h, --help 显示帮助
|
|
565
|
+
```
|
|
@@ -2,27 +2,20 @@
|
|
|
2
2
|
id: speculo-retro
|
|
3
3
|
type: skill
|
|
4
4
|
name: Speculo Retro
|
|
5
|
-
description:
|
|
5
|
+
description: Extract and deduplicate friction from Speculo evidence into issue proposals; do not create issues without command confirmation.
|
|
6
|
+
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Speculo Retro
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- 当前对话与本次使用的 commands/workflows。
|
|
13
|
-
- `commands/<command>/*.md` 报告、active change 状态、archive 和 `INDEX.md` 声明的知识 store。
|
|
14
|
-
- 可选已有 issues,用于语义去重。
|
|
15
|
-
|
|
16
|
-
## 流程
|
|
11
|
+
This file is the routing entry. Read [`references/entry-procedure.md`](references/entry-procedure.md) only after this skill is selected. Read a named reference there only for the active branch.
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
2. 按 bug、friction、missing-capability、doc-gap、ergonomics 归类,合并同一根因。完成标准:每项只属于一个根因簇,合并关系可追溯。
|
|
20
|
-
3. 评估影响与频率,过滤一次性噪声;低信号项标为丢弃或仅记教训。完成标准:每项都有优先级和处置理由。
|
|
21
|
-
4. 读取 `references/issue-drafting-sop.md`,生成 issue-ready 提案并与已有 issue 去重。完成标准:标题、证据、问题、建议、验收、影响资产和去重结论齐全。
|
|
13
|
+
## Scope
|
|
22
14
|
|
|
23
|
-
|
|
15
|
+
- Trigger: Extract and deduplicate friction from Speculo evidence into issue proposals; do not create issues without command confirmation.
|
|
16
|
+
- Output and write owner remain those declared by the entry procedure and the owning command/workflow.
|
|
17
|
+
- Do not infer missing scope, credentials, target, or authorization.
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
- 合并/丢弃说明和调用方执行 `gh` 所需字段。
|
|
19
|
+
## Stop
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
Stop before side effects when the required input, owner, reference, confirmation, schema, or recovery evidence is missing; report the exact blocker and preserve any dry-run evidence.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Entry procedure
|
|
2
|
+
|
|
3
|
+
# Speculo Retro
|
|
4
|
+
|
|
5
|
+
## 输入
|
|
6
|
+
|
|
7
|
+
- 当前对话与本次使用的 commands/workflows。
|
|
8
|
+
- `commands/<command>/*.md` 报告、active change 状态、archive 和 `INDEX.md` 声明的知识 store。
|
|
9
|
+
- 可选已有 issues,用于语义去重。
|
|
10
|
+
|
|
11
|
+
## 流程
|
|
12
|
+
|
|
13
|
+
1. 读取 `references/friction-taxonomy.md`,穷尽扫描可用证据并列出原始摩擦。完成标准:每项都有来源路径或对话节点。
|
|
14
|
+
2. 按 bug、friction、missing-capability、doc-gap、ergonomics 归类,合并同一根因。完成标准:每项只属于一个根因簇,合并关系可追溯。
|
|
15
|
+
3. 评估影响与频率,过滤一次性噪声;低信号项标为丢弃或仅记教训。完成标准:每项都有优先级和处置理由。
|
|
16
|
+
4. 读取 `references/issue-drafting-sop.md`,生成 issue-ready 提案并与已有 issue 去重。完成标准:标题、证据、问题、建议、验收、影响资产和去重结论齐全。
|
|
17
|
+
|
|
18
|
+
## 输出
|
|
19
|
+
|
|
20
|
+
- 按优先级排序的 `file-issue | lesson-only | discard | duplicate` 提案。
|
|
21
|
+
- 合并/丢弃说明和调用方执行 `gh` 所需字段。
|
|
22
|
+
|
|
23
|
+
本 skill 不写文件、不调用外部 API;command 负责报告、确认和 issue 创建。
|