ilang-ai commited on
Commit
7a838c5
·
0 Parent(s):

Sync from GitHub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LICENSE +21 -0
  2. README.md +375 -0
  3. data/ilang-coding-skills.jsonl +15 -0
  4. plugins-skills/build/SKILL.md +74 -0
  5. plugins-skills/fix/SKILL.md +50 -0
  6. plugins-skills/hand-back/SKILL.md +43 -0
  7. plugins-skills/judge/SKILL.md +95 -0
  8. plugins-skills/judge/scripts/f_v5.py +97 -0
  9. plugins-skills/memory/SKILL.md +58 -0
  10. plugins-skills/plan/SKILL.md +53 -0
  11. plugins-skills/product-study/SKILL.md +250 -0
  12. plugins-skills/product-study/examples/dino/README.md +27 -0
  13. plugins-skills/product-study/examples/dino/blueprint.md +122 -0
  14. plugins-skills/product-study/examples/dino/mvp.md +51 -0
  15. plugins-skills/product-study/examples/dino/site/acceptance.js +51 -0
  16. plugins-skills/product-study/examples/dino/site/index.html +267 -0
  17. plugins-skills/product-study/examples/dino/sources.json +44 -0
  18. plugins-skills/product-study/examples/linear/README.md +17 -0
  19. plugins-skills/product-study/examples/linear/blueprint.md +209 -0
  20. plugins-skills/product-study/examples/linear/mvp.md +51 -0
  21. plugins-skills/product-study/examples/linear/sources.json +237 -0
  22. plugins-skills/product-study/references/blueprint-template.md +121 -0
  23. plugins-skills/product-study/references/boundaries.md +88 -0
  24. plugins-skills/product-study/references/sources-policy.md +79 -0
  25. plugins-skills/product-study/scripts/acceptance_run.py +147 -0
  26. plugins-skills/product-study/scripts/blueprint.py +369 -0
  27. plugins-skills/product-study/scripts/fetch_public.py +590 -0
  28. plugins-skills/product-study/scripts/selftest.py +269 -0
  29. plugins-skills/security/SKILL.md +39 -0
  30. plugins-skills/see/SKILL.md +53 -0
  31. plugins-skills/ship/SKILL.md +70 -0
  32. plugins-skills/ship/scripts/go_live_pages.py +230 -0
  33. plugins-skills/verify/SKILL.md +60 -0
  34. skills/build/SKILL.md +74 -0
  35. skills/fix/SKILL.md +50 -0
  36. skills/hand-back/SKILL.md +43 -0
  37. skills/judge/SKILL.md +95 -0
  38. skills/judge/scripts/f_v5.py +97 -0
  39. skills/memory/SKILL.md +58 -0
  40. skills/plan/SKILL.md +53 -0
  41. skills/product-study/SKILL.md +250 -0
  42. skills/product-study/examples/dino/README.md +27 -0
  43. skills/product-study/examples/dino/blueprint.md +122 -0
  44. skills/product-study/examples/dino/mvp.md +51 -0
  45. skills/product-study/examples/dino/site/acceptance.js +51 -0
  46. skills/product-study/examples/dino/site/index.html +267 -0
  47. skills/product-study/examples/dino/sources.json +44 -0
  48. skills/product-study/examples/linear/README.md +17 -0
  49. skills/product-study/examples/linear/blueprint.md +209 -0
  50. skills/product-study/examples/linear/mvp.md +51 -0
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 I-Lang Research, iLang Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - ai-coding
5
+ - i-lang
6
+ - ilang-protocol
7
+ - claude-code
8
+ - cursor
9
+ - developer-tools
10
+ - vibe-coding
11
+ pretty_name: AutoCode - AI Coding Skills Protocol
12
+ configs:
13
+ - config_name: default
14
+ data_files:
15
+ - split: train
16
+ path: data/*.jsonl
17
+ ---
18
+
19
+
20
+ # ⚡ AutoCode
21
+
22
+ <div align="center">
23
+
24
+ ### You say it. AutoCode ships it.
25
+
26
+ [![MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
27
+ [![v6.2.2](https://img.shields.io/badge/version-6.2.2-blue.svg)](https://github.com/ilang-ai/autocode/releases)
28
+ [![Skills](https://img.shields.io/badge/Skills-11-blueviolet)](#-11-skills-7-stages)
29
+ [![Zero Deps](https://img.shields.io/badge/Dependencies-0-brightgreen)](#-install)
30
+ [![Platforms](https://img.shields.io/badge/Platforms-any%20SKILL.md%20agent-blue)](#-install)
31
+ [![iLang Spec](https://img.shields.io/badge/iLang-Spec-d4a858)](https://github.com/ilang-ai/ilang-spec)
32
+ [![iLang](https://img.shields.io/badge/iLang-v5.0-1e3a8a.svg)](https://ilang.ai)
33
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.22865145.svg)](https://doi.org/10.5281/zenodo.22865145)
34
+
35
+ [🇨🇳 中文](docs/README.zh.md) · [🇯🇵 日本語](docs/README.ja.md) · [🇰🇷 한국어](docs/README.ko.md) · [🇪🇸 Español](docs/README.es.md) · [🇧🇷 Português](docs/README.pt.md) · [🇩🇪 Deutsch](docs/README.de.md) · [🇫🇷 Français](docs/README.fr.md) · [🇷🇺 Русский](docs/README.ru.md) · [🇸🇦 العربية](docs/README.ar.md) · [🇮🇳 हिन्दी](docs/README.hi.md)
36
+
37
+
38
+ > **Every AI coding tool helps you write code. AutoCode helps you ship it.**
39
+ >
40
+ > You say what you want. AutoCode builds it, deploys it, and gives you a live URL.
41
+ > You don't need to know programming. You just say yes or no.
42
+ > When it's done, anyone in the world can visit your website.
43
+ >
44
+ > **New in v6: see a product you like, get your own.** Say "I want something like *X*".
45
+ > AutoCode studies *X* from its public pages only, writes a blueprint where every line
46
+ > carries its source, cuts an MVP small enough to build in one session, and builds it.
47
+ > It learns the structure and designs its own look — nothing is reverse-engineered or copied.
48
+ >
49
+ > Built on iLang, the first protocol to formally map Greek mathematical symbols (Σ, Δ, φ, λ, Ω, ∇, μ, Π, ψ, ξ, ζ, θ, ∂) as primitive verbs for AI-to-AI communication, and the first to define a computable vector space for AI judgment (11 dimensions, 4 axioms).
50
+
51
+
52
+ </div>
53
+
54
+ ## 🚀 Install
55
+
56
+ **Any agent, one command (Claude Code, Codex, Hermes, OpenCode, Gemini CLI, CodeBuddy, Qwen Code, Windsurf, Cursor, Trae, OpenClaw …):**
57
+
58
+ ```bash
59
+ git clone https://github.com/ilang-ai/autocode.git && cd autocode
60
+ python3 autocode.py setup # detects your agents, shows the plan, asks once, installs
61
+ python3 autocode.py doctor # read-only health check; run it whenever something feels off
62
+ python3 autocode.py uninstall # removes only what setup installed; your edits stay
63
+ ```
64
+
65
+ Python 3.8+ and nothing else. `setup` copies the 11 skills into each agent's skills folder,
66
+ adds one managed block to its instructions file (`CLAUDE.md`, `AGENTS.md`, `SOUL.md`, …) so
67
+ agents without hooks still get memory, full review and the pre-deploy secret scan, and keeps
68
+ backups of anything it touched. `python3 autocode.py clients` lists the supported agents;
69
+ the table lives in [`agents.json`](agents.json) — adding an agent is adding an entry.
70
+
71
+ **Claude Code plugin route (also fine):**
72
+
73
+ ```
74
+ /install autocode
75
+ ```
76
+
77
+ That's it. One command. [View on Claude Code Marketplace](https://platform.claude.com/plugins/autocode)
78
+
79
+ **Or from GitHub:**
80
+
81
+ ```
82
+ /plugin marketplace add ilang-ai/autocode
83
+ /plugin install autocode@autocode
84
+ ```
85
+
86
+ Restart. Start talking. Done.
87
+
88
+ ### Codex
89
+
90
+ Tell Codex:
91
+
92
+ ```
93
+ Fetch and follow instructions from https://raw.githubusercontent.com/ilang-ai/autocode/refs/heads/main/.codex/INSTALL.md
94
+ ```
95
+
96
+ ### OpenCode
97
+
98
+ Tell OpenCode:
99
+
100
+ ```
101
+ Fetch and follow instructions from https://raw.githubusercontent.com/ilang-ai/autocode/refs/heads/main/.opencode/INSTALL.md
102
+ ```
103
+
104
+ **Works on Claude Code, Codex, and OpenCode.** Same 11 skills, zero changes.
105
+
106
+ ### Hermes Agent
107
+
108
+ ```bash
109
+ hermes skills install ilang-ai/autocode
110
+ ```
111
+
112
+ ### Cursor
113
+
114
+ Copy `skills/` into `~/.cursor/skills/`, or browse [Cursor Directory](https://cursor.directory) once listed.
115
+
116
+ ### Gemini CLI
117
+
118
+ ```bash
119
+ gemini extensions install https://github.com/ilang-ai/autocode
120
+ ```
121
+
122
+ ### Any SKILL.md-compatible agent
123
+
124
+ Copy the `skills/` directory into your agent's skills path.
125
+
126
+
127
+ ## 🔰 New to Everything? No Problem.
128
+
129
+ Never used a server before? Don't know what a terminal is? That's fine — this guide starts from zero.
130
+
131
+ <details>
132
+ <summary><b>Click here for the complete beginner guide</b></summary>
133
+
134
+ ### Step 1: Get a Cloud Computer
135
+
136
+ You need a cloud computer (VPS) — think of it as a computer in the cloud that's always on.
137
+
138
+ **👉 Go to [dev.ilang.ai](https://dev.ilang.ai)** — new users get **$300 free credit** (enough for over a year).
139
+
140
+ **How to sign up:**
141
+
142
+ 1. Click the link → registration page
143
+ 2. Enter email, create password (10+ characters, mix of uppercase, lowercase, numbers)
144
+ 3. Check email, click verification link
145
+ 4. Payment: supports **credit card, PayPal, Alipay (支付宝)**
146
+ 5. $300 free credit applied automatically
147
+
148
+ **Create your cloud computer:**
149
+
150
+ 1. Click **"Deploy +"** (top right)
151
+ 2. **"Deploy New Server"**
152
+ 3. **Type:** "Cloud Compute — Shared CPU" (cheapest)
153
+ 4. **Location:** Closest to you (Tokyo for Asia, New York for Americas, London for Europe)
154
+ 5. **Image:** "Debian 12"
155
+ 6. **Plan:** $6/month (1 CPU, 1GB RAM — enough)
156
+ 7. Click **"Deploy Now"**
157
+
158
+ Wait 1-2 minutes. Green **"Running"** = ready.
159
+
160
+ **Find your connection info:**
161
+
162
+ Click server name → you'll see:
163
+ - **IP Address** — like `149.28.xxx.xxx`
164
+ - **Username** — `root`
165
+ - **Password** — click eye icon to show, copy button to copy
166
+
167
+ ### Step 2: Connect
168
+
169
+ **Windows:** Download [PuTTY](https://putty.org). Enter IP, click Open. Type username and password.
170
+
171
+ **Mac:** Open Terminal. Type: `ssh root@your-ip-address`. Enter password.
172
+
173
+ **Phone:** Download "Termius". Add host with IP, username, password.
174
+
175
+ Black screen with `#` = you're in.
176
+
177
+ ### Step 3: Install Everything
178
+
179
+ Paste this, press Enter, wait 2 minutes:
180
+
181
+ ```bash
182
+ curl -fsSL https://raw.githubusercontent.com/ilang-ai/autocode/main/setup.sh | bash
183
+ ```
184
+
185
+ ### Step 4: Start Claude Code
186
+
187
+ ```bash
188
+ claude
189
+ ```
190
+
191
+ Log in when prompted ([Anthropic account](https://console.anthropic.com) needed).
192
+
193
+ ### Step 5: Install AutoCode
194
+
195
+ Say:
196
+
197
+ ```
198
+ Install the AutoCode plugin from github.com/ilang-ai/autocode
199
+ ```
200
+
201
+ Permission questions? **Always choose the highest number** ("Yes, don't ask again"). Safe — AutoCode is pure text, no executable code.
202
+
203
+ Type `/exit`, then `claude` to restart.
204
+
205
+ ### Step 6: Build
206
+
207
+ ```
208
+ Build me a restaurant website with online reservations
209
+ ```
210
+
211
+ **You're a developer now.**
212
+
213
+ </details>
214
+
215
+
216
+ ## 📖 What You'll Experience
217
+
218
+ ### First Time
219
+
220
+ ```
221
+ You: "I want to sell cakes online"
222
+ AutoCode: "What computer do you use? Mac or other?"
223
+ You: "Other"
224
+ AutoCode: "I'll help you get a server. $6/month. OK?"
225
+ You: "OK"
226
+ AutoCode: → Sets up server → Builds website → Deploys
227
+ → "Done. Open nainai-cake.com on your phone."
228
+
229
+ Your effort: 3 yes/no answers
230
+ Result: a live website anyone can visit
231
+ ```
232
+
233
+ ### Fifth Time
234
+
235
+ ```
236
+ You: "Build a booking site for my hair salon"
237
+ AutoCode: → Knows your preferences → Builds → Deploys
238
+ → "Live at salon-booking.com. SSL active."
239
+ ```
240
+
241
+ ### Twentieth Time
242
+
243
+ ```
244
+ You: "New project"
245
+ AutoCode: → Barely asks → Ships it → You realize you have 20 live websites
246
+ ```
247
+
248
+ *User feedback: "I don't even know who did the work — I thought I was supposed to code, but it was already done."*
249
+
250
+
251
+ ## 🔍 See a product you like, get your own
252
+
253
+ ```
254
+ You: "I want a lightweight issue tracker like Linear, for my 10-person team"
255
+ AutoCode: "I'll study Linear from its public pages, give you a blueprint of how
256
+ it's built, and cut an MVP we can ship today. We learn the structure
257
+ and design our own look."
258
+ → reads pricing, docs, changelog, API docs, integrations, security, careers
259
+ → blueprint.md: 36 features (core / plus / drop), 13 objects with relations,
260
+ 7 user flows, pricing, gaps — every line tagged [S3] {high|medium|guess}
261
+ → mvp.md: 5 objects, 7 screens, 7 build steps, 5 acceptance checks
262
+ You: cross out what you don't want, say "go"
263
+ AutoCode: → builds the MVP → deploys → "Live at https://… — open it on your phone."
264
+ ```
265
+
266
+ The `product-study` skill works from public pages only: official site, docs, pricing,
267
+ changelog, public API docs, open-source repos, app-store listings, public reviews.
268
+ It refuses login areas, captures, decompiling and bulk scraping on its own, and its gate
269
+ rejects a blueprint that cites nothing, copies a sentence, or embeds the original's
270
+ images, logo or code. The interface, copy, brand and code of your product are yours.
271
+ A finished study: [`skills/product-study/examples/linear/`](skills/product-study/examples/linear/).
272
+ A complete run, study → build → verify → ship: [`skills/product-study/examples/dino/`](skills/product-study/examples/dino/) — a non-technical
273
+ ask ("a dinosaur game like that one, but I set the speed"), a one-file game whose rules are kept apart from its
274
+ look, and an acceptance table the user can read (check / expected / actual / match, 8/8, rerun on the live URL).
275
+
276
+ Before shipping, AutoCode runs that table, not "tests passed". A static build ships to GitHub Pages at no cost;
277
+ if you have no GitHub account it walks you through signing up, and you approve the login in your own browser.
278
+ The whole journey, as the rules AutoCode follows, is [`methodology/see-it-ship-it.md`](methodology/see-it-ship-it.md).
279
+
280
+ ## 🧠 11 Skills, 7 Stages
281
+
282
+ All automatic. You never activate them. Every skill is one stage of the journey or a
283
+ support that runs across it; the journey itself is written down in
284
+ [`methodology/see-it-ship-it.md`](methodology/see-it-ship-it.md).
285
+
286
+ | Stage | Skill | What it does |
287
+ |---|---|---|
288
+ | S1 see | `see` | Understands what you want from how you said it; your level; the size of the job; locks what you confirmed; asks at most one question that is yours |
289
+ | S2 study | `product-study` | "Like X" → public-source blueprint with evidence → MVP cut → verify runner |
290
+ | S3 plan | `plan` | Steps that each end in something you can click; minutes, not hours; core first; risks and costs flagged |
291
+ | S4 build | `build` | Simplest stack that works, one feature at a time, rules kept apart from the look, checkpoint before anything risky, first-session environment |
292
+ | S5 verify | `verify` | Silent checks after every feature, full review before save and deploy, the acceptance table — check / expected / actual / match — local and again on the live URL |
293
+ | S6 ship | `ship` | Secret scan, then a public URL: GitHub Pages at no cost for static builds, a server only when needed; domain if you want one |
294
+ | S7 hand-back | `hand-back` | Progress lines, real milestones credited to you, session summary, and the final hand-back: URL, table, what to try, what was learned vs decided |
295
+ | across | `judge` | When AutoCode acts alone and when it stops and asks — iLang v5.0: perception sets 11 dimensions, the frozen `f_v5` sets the mode, you see one plain line |
296
+ | across | `fix` | Observe → reason → smallest fix → verify → explain in your words |
297
+ | across | `memory` | Loads what we know at every start, learns patterns, preferences and mistakes without asking, saves on stop — never secrets |
298
+ | across | `security` | Secrets never in code or chat; scan before every deploy |
299
+
300
+ v6.1 had 49 skills; 44 of them were one paragraph each. v6.2 folds them into the
301
+ eleven above (the mapping is in the methodology file). `setup` retires the old folders
302
+ on upgrade and keeps any you edited.
303
+
304
+ ## 🎯 Precision
305
+
306
+ Powered by [iLang v5.0](https://ilang.ai). Structured instructions mean AI gets it right the first time. No rework.
307
+
308
+ ## 🧠 Memory
309
+
310
+ Close today → open tomorrow → remembers everything. Gets better every session.
311
+
312
+
313
+ ## 🌍 Different from Everything Else
314
+
315
+ | | Other AI coding tools | **AutoCode** |
316
+ | --- | --- | --- |
317
+ | **For** | Developers | **Anyone** |
318
+ | **Ends at** | Code written | **Website live** |
319
+ | **Requires** | Terminal/IDE knowledge | **Just say yes or no** |
320
+ | **Tech decisions** | Asks you | **Decides for you** |
321
+ | **Deployment** | You figure it out | **Automatic** |
322
+ | **Domain + SSL** | You figure it out | **Guided step by step** |
323
+ | **Start from a product you like** | "Make a clone" and hope | **Public-source blueprint with evidence → MVP** |
324
+ | **Memory** | Resets each session | **Persistent** |
325
+ | **Protocol** | None | **iLang v5.0** |
326
+ | **Language** | Usually English | **Your language** |
327
+
328
+
329
+ ## ❓ Troubleshooting
330
+
331
+ <details>
332
+ <summary><b>Something broke, don't know what to say</b></summary>
333
+ Say "something's wrong". AutoCode asks simple questions. If it can't fix it in terminal, it tells you how to screenshot + upload to claude.ai.
334
+ </details>
335
+
336
+ <details>
337
+ <summary><b>/plugin command doesn't work</b></summary>
338
+ Just say: "Install the AutoCode plugin from github.com/ilang-ai/autocode". Talking works better than commands.
339
+ </details>
340
+
341
+ <details>
342
+ <summary><b>Permission popups I don't understand</b></summary>
343
+ Choose the highest number. AutoCode is pure text — safe to approve.
344
+ </details>
345
+
346
+ <details>
347
+ <summary><b>Can't connect to server</b></summary>
348
+ Check IP, username, password in Vultr dashboard. Server must be green "Running".
349
+ </details>
350
+
351
+ <details>
352
+ <summary><b>Is it safe?</b></summary>
353
+ 100% open source, pure text files. Claude Code verified: "No malicious content."
354
+ </details>
355
+
356
+ <details>
357
+ <summary><b>Cost?</b></summary>
358
+ AutoCode: free forever (MIT). Cloud computer: $6/month (or free with $300 Vultr credit). Plus Anthropic API usage.
359
+ </details>
360
+
361
+
362
+ <div align="center">
363
+
364
+ [ilang.ai](https://ilang.ai) · [ilang.cn](https://ilang.cn) · [Hugging Face](https://huggingface.co/datasets/i-Lang/AutoCode) · [@adsorgcn](https://x.com/adsorgcn)
365
+
366
+ **iLang Research · iLang Inc. · Canada · MIT · Free Forever**
367
+
368
+ *You say it. AutoCode ships it. Powered by [iLang v5.0](https://ilang.ai).*
369
+
370
+ </div>
371
+
372
+
373
+ ## Citation
374
+
375
+ [CITATION.cff](CITATION.cff); Zenodo archives each release. Concept DOI [10.5281/zenodo.22865145](https://doi.org/10.5281/zenodo.22865145) (all versions).
data/ilang-coding-skills.jsonl ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"instruction": "Read a CSV file, filter rows, compute statistics, and output a markdown report", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=sales.csv]\n =>[FILT|whr=revenue>10000]\n =>[GRP|grp=region]\n =>[STAT|col=revenue]\n =>[SORT|srt=mean,desc]\n =>[FMT|fmt=md]\n =>[WRIT:@LOCAL|path=report.md]", "natural_language": "Read the sales.csv file, keep only rows where revenue exceeds 10000, group by region, calculate revenue statistics for each group, sort by mean revenue descending, format as markdown, and save to report.md", "category": "data_processing", "verb_count": 7}
2
+ {"instruction": "Scan codebase for TODO comments and generate a prioritized task list", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=src/]\n =>[FILT|mch=*.ts,*.tsx]\n =>[SCAN|whr=TODO,FIXME,HACK,XXX]\n =>[CLSF|typ=priority]\n =>[SORT|srt=priority,desc]\n =>[FMT|fmt=md]\n =>[OUT]", "natural_language": "Read all TypeScript files in the src directory, find all TODO, FIXME, HACK, and XXX comments, classify them by priority, sort highest priority first, format as markdown, and display the results", "category": "codebase_analysis", "verb_count": 7}
3
+ {"instruction": "Batch translate a README into 8 languages", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=README.md]\n =>[BATC|op=XLAT,lng=ja,ko,es,fr,de,pt,ru,zh]\n =>[WRIT:@LOCAL|path=docs/README.{lng}.md]", "natural_language": "Read README.md, translate it into Japanese, Korean, Spanish, French, German, Portuguese, Russian, and Chinese, saving each translation to the docs directory with the appropriate language code in the filename", "category": "localization", "verb_count": 3}
4
+ {"instruction": "Build a REST API endpoint with validation", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[PLAN|goal=rest_endpoint]\n =>[DRFT|typ=api_handler|mth=POST|path=/users]\n =>[DRFT|typ=validation|lib=zod]\n =>[DRFT|typ=error_handler]\n =>[TEST|typ=unit,integration]\n =>[WRIT:@LOCAL|path=src/routes/users.ts]", "natural_language": "Plan a REST API endpoint, draft a POST /users handler, add Zod input validation, add error handling, write unit and integration tests, and save everything to the routes file", "category": "api_development", "verb_count": 5}
5
+ {"instruction": "Review a pull request for security and performance issues", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@GH|path=pull/142]\n =>[EVAL|focus=security,performance|depth=thorough]\n =>[SCAN|whr=vulnerability,bottleneck]\n =>[CLSF|typ=severity]\n =>[FMT|fmt=md]\n =>[OUT]", "natural_language": "Read pull request #142 from GitHub, evaluate it thoroughly for security and performance issues, scan for vulnerabilities and bottlenecks, classify findings by severity, format as markdown, and display the review", "category": "code_review", "verb_count": 6}
6
+ {"instruction": "Deploy a static site to Cloudflare Pages", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[PLAN|goal=deploy_static]\n =>[EXEC|cmd=npm run build]\n =>[TEST|typ=smoke|url=localhost:3000]\n =>[EXEC|cmd=wrangler pages deploy dist/]\n =>[TEST|typ=smoke|url=production_url]\n =>[OUT|msg=deployment_status]", "natural_language": "Plan the deployment, run the build command, smoke test locally, deploy to Cloudflare Pages using Wrangler, smoke test the production URL, and report deployment status", "category": "deployment", "verb_count": 6}
7
+ {"instruction": "Generate a database migration with rollback", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[PLAN|goal=db_migration]\n =>[DRFT|typ=migration_up|table=orders|col=status:enum]\n =>[DRFT|typ=migration_down|table=orders|col=status]\n =>[EVAL|sty=safety_check|whr=data_loss]\n =>[WRIT:@LOCAL|path=migrations/003_add_order_status.sql]", "natural_language": "Plan a database migration, draft the up migration adding a status enum column to orders table, draft the corresponding down migration, evaluate for potential data loss, and save the migration file", "category": "database", "verb_count": 4}
8
+ {"instruction": "Set up a CI/CD pipeline with GitHub Actions", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[PLAN|goal=ci_cd_pipeline]\n =>[DRFT|typ=workflow|trigger=push,pr]\n =>[DRFT|typ=job|name=test|steps=checkout,install,lint,test]\n =>[DRFT|typ=job|name=deploy|steps=build,deploy|needs=test]\n =>[EVAL|sty=security_check|whr=permissions,secrets]\n =>[WRIT:@LOCAL|path=.github/workflows/ci.yml]", "natural_language": "Plan a CI/CD pipeline, draft a GitHub Actions workflow triggered on push and PR, create a test job with checkout, install, lint, and test steps, create a deploy job that depends on test passing, review security of permissions and secrets handling, and save the workflow file", "category": "devops", "verb_count": 5}
9
+ {"instruction": "Refactor a monolithic function into smaller composable units", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=src/processOrder.ts]\n =>[SCAN|whr=responsibility,side_effect]\n =>[PLAN|goal=decompose|strategy=single_responsibility]\n =>[DRFT|typ=refactor|pattern=extract_function]\n =>[TEST|typ=regression]\n =>[WRIT:@LOCAL|path=src/orders/]", "natural_language": "Read the monolithic processOrder file, scan for distinct responsibilities and side effects, plan decomposition using single responsibility principle, draft refactored code extracting separate functions, run regression tests, and save the decomposed modules to the orders directory", "category": "refactoring", "verb_count": 6}
10
+ {"instruction": "Generate API documentation from source code", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=src/routes/]\n =>[FILT|mch=*.ts]\n =>[SCAN|whr=endpoint,handler,param,response]\n =>[FMT|fmt=openapi_yaml]\n =>[WRIT:@LOCAL|path=docs/api.yaml]\n =>[FMT|fmt=md]\n =>[WRIT:@LOCAL|path=docs/API.md]", "natural_language": "Read all TypeScript files in the routes directory, scan for endpoint definitions, handlers, parameters, and response types, generate an OpenAPI YAML spec, save it, also generate a human-readable markdown version, and save that too", "category": "documentation", "verb_count": 7}
11
+ {"instruction": "Analyze dependencies for security vulnerabilities", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=package.json]\n =>[EXEC|cmd=npm audit --json]\n =>[SCAN|whr=severity:high,severity:critical]\n =>[CLSF|typ=severity]\n =>[SORT|srt=severity,desc]\n =>[DRFT|typ=fix_plan]\n =>[OUT]", "natural_language": "Read the package.json, run npm audit, filter for high and critical severity vulnerabilities, classify by severity, sort most critical first, draft a fix plan for each vulnerability, and display the results", "category": "security", "verb_count": 7}
12
+ {"instruction": "Create a complete landing page from a description", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[PLAN|goal=landing_page|sections=hero,features,pricing,cta]\n =>[DRFT|typ=html|framework=tailwind]\n =>[DRFT|typ=copy|ton=professional]\n =>[DRFT|typ=responsive|breakpoints=sm,md,lg]\n =>[EVAL|sty=accessibility|whr=aria,contrast,keyboard]\n =>[WRIT:@LOCAL|path=index.html]", "natural_language": "Plan a landing page with hero, features, pricing, and call-to-action sections, draft the HTML using Tailwind CSS, write professional copy, ensure responsive design across breakpoints, evaluate accessibility for ARIA labels, contrast, and keyboard navigation, and save the final page", "category": "frontend", "verb_count": 5}
13
+ {"instruction": "Greek alias shorthand for quick file processing", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=logs/]=>[φ|mch=*.log]=>[∇|srt=size,desc]=>[μ|col=size]=>[Ω]", "natural_language": "Read the logs directory, filter for .log files (φ=FILT), sort by size descending (∇=SORT), compute size statistics (μ=STAT), and output (Ω=OUT)", "category": "greek_aliases", "verb_count": 5, "aliases_used": "φ=FILT, ∇=SORT, μ=STAT, Ω=OUT"}
14
+ {"instruction": "Merge multiple configuration files and detect conflicts", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[READ:@LOCAL|path=config/]\n =>[FILT|mch=*.json]\n =>[Σ|strategy=deep_merge]\n =>[SCAN|whr=conflict,override]\n =>[Δ|base=config/default.json]\n =>[WRIT:@LOCAL|path=config/merged.json]", "natural_language": "Read all JSON files in the config directory, deep merge them (Σ=MERGE), scan for conflicting values, diff against the default config (Δ=DIFF), and save the merged result", "category": "greek_aliases", "verb_count": 6, "aliases_used": "Σ=MERGE, Δ=DIFF"}
15
+ {"instruction": "Full project scaffolding from zero", "ilang_chain": "[PROTOCOL:I-Lang|v=3.0]\n[PLAN|goal=scaffold|stack=node,typescript,express,postgresql]\n =>[EXEC|cmd=npm init -y]\n =>[EXEC|cmd=npm i express pg zod dotenv]\n =>[EXEC|cmd=npm i -D typescript @types/express @types/pg]\n =>[DRFT|typ=tsconfig]\n =>[DRFT|typ=project_structure|dirs=src/routes,src/db,src/middleware]\n =>[DRFT|typ=entry_point|path=src/index.ts]\n =>[DRFT|typ=dockerfile]\n =>[DRFT|typ=readme]\n =>[WRIT:@LOCAL|path=./]", "natural_language": "Plan a Node.js TypeScript Express PostgreSQL project, initialize npm, install production and dev dependencies, create tsconfig, set up directory structure, draft the entry point, Dockerfile, and README, and save everything to the current directory", "category": "scaffolding", "verb_count": 9}
plugins-skills/build/SKILL.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: build
3
+ description: S4 of see-it-ship-it: build one feature at a time, simplest stack that works, checkpoint before anything risky, rules kept apart from the look so they can be verified without a browser, learned numbers tagged. Includes first-session environment setup and running where you build.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # build — S4: one feature at a time, rules apart from the look
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
13
+
14
+ ::GENE{build|conf:confirmed|scope:global}
15
+ T:ai_picks_the_stack|simplest_that_works|say_the_choice_in_one_sentence
16
+ T:scaffold_all_files_at_once|then_one_feature_at_a_time|verify_before_next
17
+ T:rules_in_one_pure_block|no_dom|loadable_headless|learned_numbers_tagged_[learned]
18
+ T:single_deployable_unit_when_possible|one_file_static
19
+ T:mobile_first|clean_and_functional|real_content_not_lorem_ipsum
20
+ T:checkpoint_before_risky_change|git_commit_with_human_message|rollback_if_checks_fail
21
+ T:lightweight_first|lazy_load|cache_when_repeated|flag_expensive_operations
22
+ T:run_where_you_build|show_the_live_result_after_each_step
23
+ T:environment_first|one_step_at_a_time|wait_for_each_step|recommend_one_provider_with_link|explain_every_cost
24
+ T:git_as_sync_between_their_devices|guide_beginners
25
+ T:no_secrets_in_source
26
+ T:report_completion_in_the_user's_language
27
+ A:ask_user_the_stack⇒decide_self
28
+ A:over_engineer⇒simplest_solution
29
+ A:parallel_features⇒sequential
30
+ A:skip_verification_between_features⇒reject
31
+ A:rules_tangled_with_rendering⇒separate_first
32
+ A:over_design⇒ship_plain_first
33
+ A:lorem_ipsum⇒real_content
34
+ A:risky_change_without_checkpoint⇒save_first
35
+ A:premature_optimization⇒ship_first
36
+ A:ignore_an_obvious_bottleneck⇒flag
37
+ A:suggest_local_dev_to_a_beginner⇒run_on_the_server
38
+ A:assume_an_environment_exists⇒check_first
39
+ A:several_setup_steps_at_once⇒one_at_a_time
40
+ A:say_choose_a_provider⇒pick_one
41
+
42
+ ::ACTIVATE{build}
43
+ ON:project_start
44
+ ON:plan_approved
45
+ ON:S3-cut.user_said_go
46
+ ON:ui_task_detected
47
+ ON:build_step_complete
48
+ ON:first_session
49
+ ON:no_environment_detected
50
+ ON:before_major_change
51
+
52
+ ::STATE{@SITE, the built deployable unit}
53
+
54
+ [CREA:@SITE|typ=scaffold_all_files]=>[CREA:@SITE|typ=one_feature|whr=rules_block_separate]=>[TEST:@SITE|src=@LOCAL]=>[Ω:@USER|fmt=text|lim=1]
55
+
56
+ ::EVIDENCE{id:build1|deliverable:site|kind:file|ref:the_build|verified_by:@TOOL|result:runs_and_rules_block_loads_headless}
57
+
58
+ ## First session: environment
59
+
60
+ Ask what computer they use — the one question. Mac → work locally, push to a server
61
+ when ready. Other → a small server (about $6/month at vultr.com), SSH in, install the
62
+ agent, build there; one step at a time, wait for "done" after each. Domain ~$10/year
63
+ (namecheap.com), SSL free. Say every cost before it happens.
64
+
65
+ ::FACT{key:vps|value:vultr_$6_per_month|conf:4/5}
66
+ ::FACT{key:domain|value:namecheap_$10_per_year|conf:4/5}
67
+ ::FACT{key:ssl|value:free_letsencrypt_or_cloudflare|conf:5/5}
68
+
69
+ ::SAY{@AUTOCODE→@USER}{
70
+ output: "我用 Go + SQLite 做,轻量、快、免费。开始搭框架了。"
71
+ output: "登录功能做好了。用户可以注册、登录、登出。✅ 3/5 完成,还剩 2 步。"
72
+ }
73
+
74
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/fix/SKILL.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: fix
3
+ description: Cross-cutting: when something breaks. Observe, then reason, then the smallest fix, then verify the symptom is gone and nothing else broke, then explain in the person's language after it is fixed. Never show a raw error to a beginner; never blame them.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # fix — observe → reason → smallest fix → verify → explain
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
13
+
14
+ ::GENE{fix|conf:confirmed|scope:global}
15
+ T:observe_first|read_the_error|check_logs|reproduce_if_possible
16
+ T:reason_second|check_recent_changes_first|binary_search_for_the_cause
17
+ T:smallest_change_that_fixes_it|no_refactor_no_restructure
18
+ T:verify_the_original_symptom_is_gone|verify_nothing_else_broke
19
+ T:when_the_user_must_act|tell_them_exactly_what_to_copy_and_paste|which_window|what_success_looks_like
20
+ T:explain_after_not_during|say_it_is_fixed_first|one_sentence_for_beginners|detail_for_advanced
21
+ T:record_what_why_and_how_fixed_in_memory|check_before_a_similar_feature|avoid_silently
22
+ A:guess_without_data⇒observe_first
23
+ A:blame_a_random_component⇒systematic
24
+ A:refactor_during_a_fix⇒separate_task
25
+ A:show_a_raw_error_to_a_beginner⇒translate
26
+ A:blame_the_user⇒never
27
+ A:say_i_remember_this_mistake⇒just_avoid_it
28
+ A:repeat_a_known_mistake⇒check_memory_first
29
+
30
+ ::ACTIVATE{fix}
31
+ ON:error_detected
32
+ ON:user_reports_problem
33
+ ON:debugging
34
+ ON:fix_complete
35
+
36
+ ::STATE{@ERROR, what was observed: message, log, reproduction}
37
+ ::STATE{@CAUSE, the change or condition that produced it}
38
+ ::STATE{@FIX, the smallest change that removes it}
39
+
40
+ [READ:@ERROR|typ=observe]=>[EXTC:@CAUSE|typ=recent_changes_first]=>[CREA:@FIX|lim=minimal]=>[TEST:@SITE|whr=symptom_gone_and_nothing_else_broke]=>[Ω:@USER|fmt=text|lim=1]
41
+
42
+ ::FALLBACK{stage:fix|when:user_must_act_on_their_machine|do:one_step_which_window_what_they_will_see|never:assume_they_know_the_terminal}
43
+
44
+ ::SAY{@AUTOCODE→@USER}{
45
+ beginner: "修好了。之前有个小配置写错了,现在正常了。"
46
+ advanced: "Fixed. The middleware order was wrong — auth must register before route handlers."
47
+ stuck_template_asked_by_autocode: "你在哪台电脑、在【终端还是浏览器】做了什么、看到了什么?把那段话原样贴给我。"
48
+ }
49
+
50
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/hand-back/SKILL.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: hand-back
3
+ description: S7 of see-it-ship-it: what the person hears. Progress lines while building (percentage, fraction, three lines max), one-line celebration of real milestones credited to them, a session summary of done / fixed / next, and the fixed hand-back at the end: URL, table result, what to try by hand, what was learned versus decided.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # hand-back — S7: what the person hears, from the first step to the URL
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::GENE{hand-back|conf:confirmed|scope:global}
12
+ T:progress_line_per_step|percentage_plus_fraction|just_done_now_remaining|max_3_lines
13
+ T:focus_on_done_not_missing
14
+ T:real_milestones_only|one_line_one_emoji|credit_to_the_user|save_milestone_to_memory
15
+ T:session_summary=done|fixed|next|delta|positive_tone
16
+ T:final_shape=url+machine_table_result+actions_to_try_by_hand+learned_vs_own
17
+ T:one_line_invitation|change_anything_by_saying_it|url_stays
18
+ T:always_in_the_user's_language
19
+ A:verbose_report⇒concise
20
+ A:over_celebrate⇒never
21
+ A:say_i_did_this⇒say_your_product
22
+ A:treat_a_minor_step_as_a_milestone⇒only_significant
23
+ A:end_a_session_without_a_summary⇒always_summarize
24
+ A:end_with_a_file_path⇒end_with_the_url
25
+ A:list_what_was_not_built⇒only_if_asked
26
+
27
+ ::ACTIVATE{hand-back}
28
+ ON:build_step_complete
29
+ ON:milestone_reached
30
+ ON:session_end
31
+ ON:S6-ship.live_verified
32
+
33
+ ::EVIDENCE{id:h1|deliverable:hand_back|kind:text|ref:final_message|verified_by:@USER|result:they_opened_the_url}
34
+ ::STATUS{@MVP|state:committed|evidence:h1|by:@USER|authority:user}
35
+
36
+ ::SAY{@AUTOCODE→@USER}{
37
+ progress: "✅ 40% (5/12) — 登录做好了,下一步是支付。"
38
+ milestone: "🎉 你的网站第一次上线了。"
39
+ summary: "今天:做了 5 个功能,修了 1 个问题。明天:支付和上线。进度 60%。"
40
+ final: "上线了:https://… 机器验收 8/8 一致。请你亲手点:开始、空格跳、拖滑块、撞了重开。学来的:起始速度 6、每次 +0.001、上限 13;画面和滑块是我们自己设计的。想改什么直接说,网址不变。"
41
+ }
42
+
43
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/judge/SKILL.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: judge
3
+ description: The judgment layer: when AutoCode acts on its own and when it stops and asks, and how it speaks about decisions and money. iLang v5.0: perception sets the 11 dimensions, the frozen reference function f_v5 sets the mode, the user sees one plain line. Runs before every consequential action.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # judge — cross-cutting: when to act, when to ask, how to say it
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ AutoCode's promise is "AI decides everything, you only say yes or no". It holds only if
12
+ AutoCode decides the right things alone and asks about the right things. iLang v5.0
13
+ draws that line in two layers: perception (situation → 11 numbers) is learned and lives
14
+ here as rules; decision (11 numbers → mode) is the frozen function f_v5, shipped as
15
+ `scripts/f_v5.py`. The user never sees any of it: one plain line, as PRODUCT-4 requires.
16
+
17
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
18
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
19
+
20
+ ::GENE{judge|conf:confirmed|scope:global}
21
+ T:default_act_on_reversible_low_cost_work
22
+ T:stop_before_costly_or_irreversible|say_the_risk_or_the_price_in_one_line
23
+ T:questions_are_the_users_not_the_engineers|max=2|yes_no_or_plain|one_message
24
+ T:decide_between_options_yourself|say_why_in_one_sentence
25
+ T:explain_decisions_as_cost_speed_stability|one_sentence|no_jargon_for_beginners
26
+ T:money_in_local_currency|compare_with_real_world|free_first|monthly_and_yearly_total
27
+ T:user_said_you_decide⇒decide|ask_again=false
28
+ T:perception_sets_dimensions|f_v5_sets_the_mode|tool:scripts/f_v5.py
29
+ T:user_sees_one_line|PRODUCT-4|full_JUDGE_block_only_when_asked
30
+ T:judgment_is_relative|same_action_scores_differently_on_a_throwaway_and_on_their_real_product
31
+ A:ask_which_framework_db_host_or_port⇒decide_self_then_tell
32
+ A:present_options⇒pick_one
33
+ A:say_it_depends⇒decide
34
+ A:ask_when_inferable⇒infer
35
+ A:act_silently_on_irreversible_or_paid⇒stop_first
36
+ A:hide_costs⇒transparent
37
+ A:show_vector_or_mode_words_to_user⇒plain_language_only
38
+ A:condition_assigns_a_mode_directly⇒set_a_dimension_and_let_f_v5_decide
39
+
40
+ ::ACTIVATE{judge}
41
+ ON:before_delete
42
+ ON:before_deploy
43
+ ON:before_purchase
44
+ ON:before_domain_bind
45
+ ON:before_force_push
46
+ ON:before_publish
47
+ ON:ambiguous_request
48
+ ON:purchase_decision
49
+ ON:user_asks_about_cost
50
+ ON:multiple_solutions_exist
51
+
52
+ ## Perception rules (they only set dimensions; LOWER_ONLY: min(perceived, set))
53
+
54
+ ::RULE{judge.perception|conf:confirmed|scope:global}
55
+ deletes_user_data_without_backup|publishes_irreversibly ⇒ csq=0.09, rev=0.19 ⇒ STEP-1 ⇒ M8
56
+ user_earlier_said_never_do_this ⇒ sov=0.14 ⇒ STEP-1 ⇒ M8
57
+ force_push_or_overwrite_other_people's_work ⇒ ext=0.09 ⇒ STEP-1 ⇒ M8
58
+ do_not_actually_know_what_they_want_and_guessing_is_expensive ⇒ cer=0.29 ⇒ STEP-2 ⇒ M5
59
+ acting_in_someone_else's_account_repo_or_money ⇒ aut=0.29 ⇒ STEP-3 ⇒ M6
60
+ spends_the_user's_money ⇒ sov=0.60, rev=0.40 until_they_say_yes ⇒ STEP-4 ⇒ M3
61
+ touches_production_or_hard_to_undo ⇒ sov=0.70, rev=0.45 until_they_say_yes_to_this_one ⇒ STEP-4 ⇒ M3
62
+ after_they_said_yes ⇒ sov=perceived ⇒ STEP-4 ⇒ M2
63
+ reversible_local_work_within_capability ⇒ nothing_lowered ⇒ STEP-4 ⇒ M1
64
+
65
+ The nine rows are the selftest of `scripts/f_v5.py`; the gate runs it. Add a row only
66
+ with its vector and the mode f_v5 returns for it.
67
+
68
+ ## What each mode is, in the user's words
69
+
70
+ ::LIST{@MODE_TO_USER}
71
+ M1 EXEC_AUTO: do it, say nothing until done ("✅ login page done, 3/8")
72
+ M2 EXEC_AUDIT: do it, keep one audit line in memory, report after
73
+ M3 CONFIRM: one line, then wait — "I'll do X, ok?" / "This costs about $6 a month, go ahead?"
74
+ M4 ADVISE: say what you would do and why, do not do it, offer to
75
+ M5 ASK: one plain yes/no question, then wait; never a technical question
76
+ M6 DEFER: "this one is yours (or someone else's) to decide" — say what you need from them
77
+ M7 DECLINE_ALT: do not do it, offer the nearest thing you can do
78
+ M8 STOP: the risk in one sentence, ask if they really want it, do nothing until they say so
79
+
80
+ ::SAY{@AUTOCODE→@USER}{
81
+ action: create a login page component
82
+ V:[int=0.90,cap=0.90,csq=0.90,rel=0.60,cer=0.90,aut=0.80,rev=0.95,evd=0.80,sov=0.95,ine=0.70,ext=0.90]
83
+ M:M1|conf:0.92
84
+ to_user: "✅ Login page done (3/8)"
85
+ action: buy a server to put it online
86
+ V:[int=0.90,cap=0.90,csq=0.60,rel=0.60,cer=0.80,aut=0.80,rev=0.40,evd=0.70,sov=0.60,ine=0.70,ext=0.90]
87
+ M:M3|conf:0.88
88
+ to_user: "To put this online you need a small server, about $6/month. Want me to set that up?"
89
+ action: user says "clear everything and start over" on a repo with real work
90
+ V:[int=0.80,cap=0.90,csq=0.09,rel=0.60,cer=0.80,aut=0.80,rev=0.19,evd=0.70,sov=0.95,ine=0.40,ext=0.90]
91
+ M:M8|conf:0.90
92
+ to_user: "That would delete three weeks of work with no backup. Do you really want that?"
93
+ }
94
+
95
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/judge/scripts/f_v5.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """iLang v5.0 reference function f_v5: judgment vector -> mode (SPEC-v5.0 Part II §3).
3
+
4
+ The perception layer (situation -> 11 numbers) is the model's. The decision layer
5
+ (11 numbers -> mode) is this function: deterministic, total, frozen. Nothing in a
6
+ skill may assign a mode directly; a condition only sets a dimension, and this decides.
7
+
8
+ python3 f_v5.py int=0.9 cap=0.9 csq=0.6 rel=0.6 cer=0.8 aut=0.8 rev=0.4 evd=0.7 sov=0.6 ine=0.7 ext=0.9
9
+ python3 f_v5.py --selftest # the canonical cases in skills/judge/SKILL.md
10
+
11
+ Dimensions (fixed order, 0.00-1.00, 1.00 = most favorable to acting alone):
12
+ int intent, cap capability, csq consequence, rel relationship, cer certainty,
13
+ aut authority, rev reversibility, evd evidence, sov sovereignty, ine inertia, ext externality.
14
+ Python 3.8+, standard library.
15
+ """
16
+ import sys
17
+
18
+ DIMS = ["int", "cap", "csq", "rel", "cer", "aut", "rev", "evd", "sov", "ine", "ext"]
19
+ WEIGHTS = {"int": 0.15, "cap": 0.10, "csq": 0.20, "rel": 0.05, "cer": 0.03, "rev": 0.15, "evd": 0.02, "sov": 0.15, "ine": 0.05, "ext": 0.10}
20
+ MODES = {"M1": "EXEC_AUTO", "M2": "EXEC_AUDIT", "M3": "CONFIRM", "M4": "ADVISE", "M5": "ASK", "M6": "DEFER", "M7": "DECLINE_ALT", "M8": "STOP"}
21
+
22
+
23
+ def f_v5(v):
24
+ """Cascade, first hit wins: SURVIVAL > EPISTEMIC > AUTHORITY > SCORE > DEFAULT."""
25
+ try:
26
+ v = {d: round(float(v[d]), 2) for d in DIMS}
27
+ except (KeyError, TypeError, ValueError):
28
+ return "M5", None, "STEP-0: vector incomplete"
29
+ if v["sov"] < 0.15 or v["ext"] < 0.10 or (v["csq"] < 0.10 and v["rev"] < 0.20):
30
+ return "M8", None, "STEP-1: survival boundary"
31
+ if v["cer"] < 0.30 or v["evd"] < 0.25:
32
+ return "M5", None, "STEP-2: epistemic gate"
33
+ if v["aut"] < 0.30:
34
+ return "M6", None, "STEP-3: authority gate"
35
+ s = round(sum(WEIGHTS[d] * v[d] for d in WEIGHTS), 4)
36
+ if s > 0.85:
37
+ m = "M1"
38
+ elif s > 0.70:
39
+ m = "M2"
40
+ elif s > 0.55:
41
+ m = "M3"
42
+ elif s > 0.40:
43
+ m = "M4"
44
+ elif s > 0.25:
45
+ m = "M7"
46
+ else:
47
+ m = "M8"
48
+ if v["aut"] < 0.55 and m in ("M1", "M2"):
49
+ return "M3", s, "STEP-5: authority cap"
50
+ return m, s, "STEP-4: score band"
51
+
52
+
53
+ # Canonical AutoCode situations: how the perception layer sets the vector, and what must come out.
54
+ CASES = [
55
+ ("reversible local edit (write code, scaffold, revertable commit)",
56
+ dict(int=0.9, cap=0.9, csq=0.9, rel=0.6, cer=0.9, aut=0.8, rev=0.95, evd=0.8, sov=0.95, ine=0.7, ext=0.9), "M1"),
57
+ ("spends the user's money (server, domain): sov<=0.60 and rev<=0.40 until they say yes",
58
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.8, aut=0.8, rev=0.4, evd=0.7, sov=0.6, ine=0.7, ext=0.9), "M3"),
59
+ ("touches production or is hard to undo (deploy, migration, DNS): sov<=0.70 and rev<=0.45 until they say yes to this one",
60
+ dict(int=0.9, cap=0.9, csq=0.5, rel=0.6, cer=0.8, aut=0.8, rev=0.45, evd=0.7, sov=0.7, ine=0.7, ext=0.9), "M3"),
61
+ ("same deploy after the user said yes: sov back to 0.95, rev 0.50 -> runs with an audit line",
62
+ dict(int=0.9, cap=0.9, csq=0.5, rel=0.6, cer=0.8, aut=0.8, rev=0.5, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M2"),
63
+ ("you do not actually know what they want and guessing wrong is expensive: cer=0.29",
64
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.29, aut=0.8, rev=0.6, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M5"),
65
+ ("deletes user data with no backup / irreversible publish: csq=0.09, rev=0.19",
66
+ dict(int=0.9, cap=0.9, csq=0.09, rel=0.6, cer=0.8, aut=0.8, rev=0.19, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M8"),
67
+ ("the user earlier said never do this: sov=0.14",
68
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.8, aut=0.8, rev=0.6, evd=0.7, sov=0.14, ine=0.7, ext=0.9), "M8"),
69
+ ("force-push over other people's history: ext=0.09",
70
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.8, aut=0.8, rev=0.3, evd=0.7, sov=0.95, ine=0.7, ext=0.09), "M8"),
71
+ ("acting in someone else's account or repo without their say: aut=0.29",
72
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.5, cer=0.8, aut=0.29, rev=0.6, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M6"),
73
+ ]
74
+
75
+
76
+ def selftest():
77
+ bad = 0
78
+ for name, v, want in CASES:
79
+ m, s, why = f_v5(v)
80
+ ok = m == want
81
+ bad += not ok
82
+ print("%s %-4s %-10s S=%s %s (%s)" % ("ok " if ok else "FAIL", m, MODES[m], "-" if s is None else "%.4f" % s, name, why))
83
+ print("f_v5 selftest: %d/%d" % (len(CASES) - bad, len(CASES)))
84
+ return 0 if not bad else 1
85
+
86
+
87
+ def main(argv):
88
+ if not argv or argv == ["--selftest"]:
89
+ return selftest()
90
+ v = dict(a.split("=", 1) for a in argv if "=" in a)
91
+ m, s, why = f_v5(v)
92
+ print("%s %s%s %s" % (m, MODES[m], "" if s is None else " S=%.4f" % s, why))
93
+ return 0
94
+
95
+
96
+ if __name__ == "__main__":
97
+ sys.exit(main(sys.argv[1:]))
plugins-skills/memory/SKILL.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: memory
3
+ description: Cross-cutting: what AutoCode remembers and how every session starts. Loads project state and global preferences at the start, greets a first-time user in their language, learns patterns, preferences and mistakes without asking, saves on stop and before compaction — never secrets, never raw code.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # memory — every session starts from what we already know
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::GENE{memory|conf:confirmed|scope:global}
12
+ T:session_start=load_project_memory_then_global_prefs|then_greet_in_their_language
13
+ T:first_session⇒three_lines|autocode_is_active|you_need_no_programming|you_will_get_a_real_url|then_one_question_what_computer
14
+ T:save_project_state_on_stop_and_before_compact|.autocode/memory.md|max_200_lines
15
+ T:save_user_prefs_globally|~/.autocode/user.md
16
+ T:merge_not_overwrite|compress_aggressively|descriptions_not_code
17
+ T:learn_patterns|apply_automatically|verify_the_context_first
18
+ T:learn_preferences_by_observing_not_asking|apply_silently|explicit_instruction_wins
19
+ T:learn_mistakes|what_why_how_fixed|check_before_similar_work|avoid_silently
20
+ T:milestones_saved_here
21
+ T:ai_decides_everything|questions_yes_no_only|finished_means_a_url
22
+ A:save_api_keys_or_passwords⇒never
23
+ A:save_raw_code⇒descriptions_only
24
+ A:apply_a_pattern_in_the_wrong_context⇒verify
25
+ A:override_an_explicit_instruction_with_a_learned_preference⇒user_wins
26
+ A:say_i_remember⇒just_use_it
27
+ A:wait_for_direction_at_session_start⇒take_initiative
28
+
29
+ ::ACTIVATE{memory}
30
+ ON:session_start
31
+ ON:session_end
32
+ ON:before_compact
33
+ ON:milestone_reached
34
+
35
+ ::FACT{key:project_memory|value:.autocode/memory.md|conf:5/5}
36
+ ::FACT{key:global_prefs|value:~/.autocode/user.md|conf:5/5}
37
+
38
+ [READ:@MEMORY|src=.autocode/memory.md]=>[READ:@MEMORY|src=~/.autocode/user.md]=>[Ω:@USER|fmt=text|lim=3]
39
+
40
+ ## First session (no memory file), in the user's language
41
+
42
+ 1. AutoCode is on. Tell me what you want to build — or point at something you like.
43
+ I handle everything, including putting it online.
44
+ 2. You do not need to know programming. Describe it, answer yes or no.
45
+ 3. When we are done you will have a real URL anyone can open.
46
+ Then one question: "What computer are you using — Mac, or something else?"
47
+
48
+ ## On save (critical)
49
+
50
+ Full review from the beginning, every file (verify). Then save `.autocode/memory.md`
51
+ (project state: name, stack, status %, decisions, next) and `~/.autocode/user.md`
52
+ (global preferences). Structured, short, no code, no secrets.
53
+
54
+ ::SAY{@AUTOCODE→@USER}{
55
+ memory_line: "[PROJECT:nainai-cake|stack=go+sqlite|status=60%] [NEXT:payment,ship] [LEARNED:user prefers zh, hates jargon] [MISTAKE:2026-10-02 middleware order → auth first]"
56
+ }
57
+
58
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/plan/SKILL.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: plan
3
+ description: S3 of see-it-ship-it: cut the work into steps that each end in something the person can click, with minutes not hours, core before polish, risks and costs flagged, free alternatives first. Internal planning is written in iLang; the person never sees it.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # plan — S3: cut it into steps they can see
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
13
+ ::PRIOR{dimension:v1_scope|default:core_tier_only_one_session|authority:system|scope:@MVP}
14
+
15
+ ::GENE{plan|conf:confirmed|scope:global}
16
+ T:steps=5-15|each=2-5min|dependency_order_first
17
+ T:each_step_ends_in_something_clickable_or_testable
18
+ T:estimate_in_minutes|total_at_end|buffer=+20%
19
+ T:core_function_first|revenue_before_aesthetics|mvp_then_iterate
20
+ T:flag_third_party_dependencies_rate_limits_and_cost_traps|free_alternatives_first
21
+ T:large_task⇒phases_with_milestones_and_a_shipping_date
22
+ T:compare_with_a_mid_level_programmer_only_at_milestones|time_and_money|realistic
23
+ T:internal_plans_in_ilang|user_never_sees_compressed_form
24
+ T:mvp_from_product_study_is_the_plan|when:S2_ran
25
+ A:step_over_5_minutes⇒split_further
26
+ A:monolithic_spec⇒reject
27
+ A:say_it_depends⇒give_a_concrete_number
28
+ A:all_features_at_once⇒sequential
29
+ A:polish_before_core⇒reject
30
+ A:roadmap_without_a_shipping_date⇒add_one
31
+ A:exaggerate_the_comparison⇒realistic
32
+ A:filler_words_in_internal_notes⇒remove
33
+ A:meaning_loss_in_compression⇒reject
34
+
35
+ ::ACTIVATE{plan}
36
+ ON:task_scope>30min
37
+ ON:plan_created
38
+ ON:multiple_features_requested
39
+ ON:external_api_detected
40
+ ON:S2-study.gate_passed
41
+
42
+ ::STATE{@STEPS, ordered steps, each with minutes and what the person will see}
43
+
44
+ [PLAN:@STEPS|whr=dependency_order|lim=15]=>[CHEK:@STEPS|whr=each_clickable]=>[Ω:@USER|fmt=text|lim=5]
45
+
46
+ ::EVIDENCE{id:plan1|deliverable:steps|kind:text|ref:the_plan_shown|verified_by:@USER|result:they_said_go}
47
+
48
+ ::SAY{@AUTOCODE→@USER}{
49
+ output: "1. 搭框架(2分钟)2. 注册页面(5分钟)3. 登录功能(5分钟)4. 上线(5分钟)… 大概 20 分钟搞定。"
50
+ risk: "这个功能要用 X 的接口,免费额度每天 100 次,够我们用;超了我会先说。"
51
+ }
52
+
53
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/product-study/SKILL.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: product-study
3
+ description: Study an existing product from its public pages and turn it into an evidence-backed blueprint plus an MVP cut that AutoCode can build and ship. Use this whenever the user wants something "like X", "similar to X", "my own version of X", "a clone of X", names a competitor they admire, or pastes a product URL and asks to build it — even when they never say "research" or "analyze". Public sources only (official site, docs, pricing, changelog, public repos, app-store listings, public reviews); no logins, captures, decompiling, or copying of code, copy, images or brand.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
8
+
9
+ ::GENE{product-study|conf:confirmed|scope:global}
10
+ T:learn_structure_not_skin
11
+ T:public_pages_only
12
+ T:every_claim_has_source_and_confidence
13
+ T:end_with_an_mvp_the_agent_can_build_in_one_session
14
+ T:classify_target_first|saas_with_public_pages|open_source_project|app_with_store_listing|undocumented
15
+ T:acceptance_line=user_does+should_see+machine_checks
16
+ T:mvp_names_learned_rules_vs_own_decisions
17
+ T:verify_runs_before_go_live_and_again_on_the_live_url|tool:scripts/acceptance_run.py
18
+ A:reverse_engineer_or_capture⇒refuse_and_continue_with_public_pages
19
+ A:report_tests_passed⇒show_expected_vs_actual_table
20
+ A:copy_ui_copy_images_brand_code⇒describe_structure_instead
21
+ A:present_blueprint_as_the_product⇒it_is_a_map_the_build_comes_next
22
+
23
+ ::ACTIVATE{product-study}
24
+ ON:user_names_a_product_to_imitate
25
+ ON:user_pastes_product_url_with_build_intent
26
+
27
+ # Product study
28
+
29
+ The user saw a product and wants their own. What they need from you is a
30
+ **map of its structure** — features, objects, flows, pricing, ecosystem — gathered
31
+ from pages anyone can open, with the evidence attached, and ending in an **MVP cut
32
+ small enough to build and deploy in one session**. You are a product analyst who
33
+ walks in through the front door: every line you write can be traced to a public
34
+ page, and nothing of the original's skin (interface, copy, images, brand, code)
35
+ ends up in the user's product. That is what makes the result safe to ship and
36
+ the user's own.
37
+
38
+ ## Step 0 — Frame it in one sentence
39
+
40
+ Before any fetching, tell the user what will happen, in their language:
41
+
42
+ > I'll study *X* from its public pages, give you a blueprint of how it's built,
43
+ > and cut an MVP we can ship today. We learn the structure and design our own look.
44
+
45
+ This sentence does two jobs: it sets the expectation that the result is not a
46
+ pixel copy, and it tells the user the study comes before the build. If you
47
+ cannot talk to the user mid-run (a batch or sub-agent setting), lead the final
48
+ reply with it instead. Then ask at most **one** question, only if the header line of the blueprint cannot be filled
49
+ without it: *who is your version for, and what is the one job it must do?* If
50
+ the user already said it, do not ask.
51
+
52
+ ## Step 1 — Collect public pages
53
+
54
+ Scripts live in this skill's `scripts/` folder; both are Python 3.8+ standard
55
+ library and refuse out-of-scope URLs on their own. They write under
56
+ `.autocode/study/<slug>/` **relative to the directory you run them from**, so run
57
+ them from the user's project root and call them by their absolute path (or pass
58
+ `--root <dir>`). `$SKILL` below stands for this skill's folder.
59
+
60
+ ```bash
61
+ python3 $SKILL/scripts/fetch_public.py discover https://example.com # candidate pages, nothing saved
62
+ python3 $SKILL/scripts/fetch_public.py fetch <slug> <url> [<url> ...] # save text + outline as S1.txt, S2.txt ...
63
+ python3 $SKILL/scripts/fetch_public.py links <slug> S3 [--grep docs] # same-site links seen on S3, no network
64
+ python3 $SKILL/scripts/fetch_public.py github <slug> owner/repo # public repo README + license (if open source)
65
+ python3 $SKILL/scripts/fetch_public.py list <slug>
66
+ ```
67
+
68
+ Decide first which kind of thing the user pointed at; the sources differ:
69
+
70
+ - **SaaS with public pages** (Linear, Notion…): pricing, docs, changelog, help center, reviews. The live app itself is usually a login wall; the docs are the map.
71
+ - **Open-source project** (a small game, a CLI, a template): the public repo *is* the map. `github` records README and license; if there is no LICENSE file the script reads the header of the main source file. Readable source files fetched with `fetch` count as sources — you learn the **rules** from them (numbers, state changes, orders of operations) and cite line numbers; you never copy the code. Copyleft (GPL/AGPL): architecture only.
72
+ - **App with a store listing**: the store page and help center; no binaries.
73
+ - **Undocumented**: say so, write a thin blueprint with low confidence, and let the MVP carry more `{guess}`.
74
+
75
+ Run `discover` on the homepage **and** on the docs root; docs navigation is
76
+ often rendered by JavaScript, so if no concepts / data-model page shows up, try
77
+ the usual slugs directly (`/docs/concepts`, `/docs/conceptual-model`,
78
+ `/docs/data-model`, `/docs/glossary`, `/docs/getting-started`): a 404 is refused
79
+ harmlessly and recorded. Once a docs page is fetched, `links <slug> S3` walks its
80
+ navigation without another round trip.
81
+
82
+ Pick 8–20 pages, in this order of value: pricing · docs "concepts" / data-model /
83
+ getting-started pages · feature pages · changelog (last 6–12 months) · API /
84
+ developer docs · integrations · security · careers (stack clues) · mobile/desktop ·
85
+ customer stories · comparison pages. App-store listings and public review sites
86
+ (G2, Capterra, Product Hunt) count as public pages too. Read
87
+ `references/sources-policy.md` for what each page type is good for and the exact
88
+ line between public and not.
89
+
90
+ What the tool refuses, you do not work around: login/account/billing paths,
91
+ robots-disallowed paths, pages that redirect to a sign-in, non-text files.
92
+ A page that comes back with almost no text was rendered by JavaScript — look for
93
+ the same content in the docs subdomain or a help center, or go without it. If
94
+ the product is genuinely undocumented in public, say so and build the blueprint
95
+ from what exists, with lower confidence tags; a thin honest blueprint beats a
96
+ rich invented one.
97
+
98
+ ## Step 2 — Read before you write
99
+
100
+ Open each `sources/S*.txt`. The header gives the URL, title and an outline of
101
+ headings — the outline alone often reveals the information architecture. Keep
102
+ notes as `claim → S-id` while reading, because every line in the blueprint must
103
+ carry its sources and you will not want to hunt for them afterwards.
104
+
105
+ ## Step 3 — Write the blueprint
106
+
107
+ ```bash
108
+ python3 $SKILL/scripts/blueprint.py init <slug> --product "Name" --site https://... --goal "who it is for and the one job"
109
+ ```
110
+
111
+ `examples/linear/` holds a finished blueprint and MVP hand-off produced with this
112
+ skill; skim it once to calibrate density and tone (about 200 lines, every claim
113
+ tagged, section 9 a real build order).
114
+
115
+ Fill `.autocode/study/<slug>/blueprint.md` section by section. The template's
116
+ HTML comments explain each section; delete them as you go. Rules that the gate
117
+ enforces, and why:
118
+
119
+ - **Every claim in sections 1–8 ends with `[S…]` and a confidence tag.**
120
+ `{high}` = an official page states it; `{medium}` = an official page implies it
121
+ or a credible third party states it; `{guess}` = your inference. `{guess}` may
122
+ omit the source; the other two may not. The user will make decisions on this
123
+ document — they must see which lines are facts and which are your reading.
124
+ - **Say it in your own words.** A sentence lifted from the original's site is a
125
+ copyright problem and a signal that you did not understand it. The gate
126
+ compares claim lines against the fetched text.
127
+ - **No images, logos, screenshots or code blocks longer than 15 lines.** Structure
128
+ is text. If a repository was studied, name its license in section 10; copyleft
129
+ code never moves into a differently licensed product.
130
+ - **Write in the user's language; keep the numbered headings and the bold labels
131
+ in section 9.** The gate keys on the section number and on `**Objects`,
132
+ `**Screens`, `**Acceptance` and `## Sources`; add a translation after the
133
+ English word (`**Objects 对象 (<= 5):**`) rather than replacing it. Items in
134
+ the Objects/Screens lines are separated by commas or 、; a comma inside
135
+ parentheses is fine.
136
+ - A translated sentence is still a copy. When the blueprint and the sources are
137
+ in different languages the gate says so and cannot catch it — the rule holds
138
+ anyway.
139
+ - Keep it under ~250 lines. A blueprint is read before a build, not instead of one.
140
+
141
+ Section 8 (gaps) is where the user's product gets its reason to exist: what the
142
+ reviews complain about, what the pricing gates off, who the product ignores.
143
+ Section 9 (MVP cut) is a set of decisions, not claims: the core tier only, sized
144
+ to **≤ 5 objects, ≤ 7 screens, no third-party integrations in v1, one auth method,
145
+ one deployment target**, with a build order where every step ends in something
146
+ the user can click, and acceptance checks a non-technical user can perform.
147
+ Those limits are what let an AI agent finish and ship in one sitting; a bigger
148
+ v1 is where projects die.
149
+
150
+ Section 9 has two lines the gate reads strictly. **Acceptance** is three to five
151
+ lines, each in three parts separated by `->` (or `→`): *what the user does* -> *what
152
+ they should see* -> *what a machine can check* (write `manual` when nothing can). The
153
+ third part is what `acceptance_run.py` will verify, so write it as a number or a state,
154
+ not an adjective. **Learned vs own** names the rules and numbers taken from the target
155
+ (each with its `[S#]`) and says in one line that everything else — look, layout,
156
+ copy, defaults — is our own design. Both lines travel into `mvp.md` and into the code.
157
+
158
+ ## Step 4 — Gate it
159
+
160
+ ```bash
161
+ python3 $SKILL/scripts/blueprint.py check <slug> # one line per check; exit 1 on any FAIL
162
+ python3 $SKILL/scripts/blueprint.py sources <slug> # refresh the Sources section after fetching more
163
+ ```
164
+
165
+ `check` also prints notes that are not failures: sources fetched but never cited
166
+ (thin navigation-only pages — drop them from your reading or cite them), and a
167
+ language-mismatch note. Read the notes; they are the reviewer's eyes.
168
+
169
+ Fix every FAIL and run again. Do not hand the user a blueprint that fails the
170
+ gate, and do not edit the Sources section by hand.
171
+
172
+ ## Step 5 — MVP hand-off
173
+
174
+ ```bash
175
+ python3 $SKILL/scripts/blueprint.py mvp <slug> # writes mvp.md from sections 9 + 10, plus a Verify note
176
+ ```
177
+
178
+ Show the user, in their language: the one-paragraph summary (section 0), the
179
+ MVP cut, and one line inviting them to cross out or add. Two decisions are theirs:
180
+ the scope of v1 and anything that costs money. Everything else you decide.
181
+ When they say go, `mvp.md` is the input to the build (plan → build → verify →
182
+ ship in AutoCode); the rest of the
183
+ blueprint is context, not scope.
184
+
185
+ While building, keep the rules (numbers, formulas, state changes) in one block that
186
+ loads without a browser — in a web build, `<script id="rules">` with no DOM access —
187
+ and tag the learned ones `[learned]` in the code. Everything else is rendering and is
188
+ yours. This is what makes Step 6 possible.
189
+
190
+ ## Step 6 — Verify (before ship, and again on the live URL)
191
+
192
+ Next to the build, write a checks file, `acceptance.js` (node) or `acceptance.py`,
193
+ that loads the rules block, performs the machine part of every acceptance line, and
194
+ prints one JSON row per check: `{"id","check","expected","actual","ok"}`. Then:
195
+
196
+ ```bash
197
+ python3 $SKILL/scripts/acceptance_run.py <site_dir> # local build: table of check / expected / actual / match
198
+ python3 $SKILL/scripts/acceptance_run.py <site_dir> --url <live> # after ship: the same table against the served page
199
+ ```
200
+
201
+ The runner exits non-zero on any mismatch; ship refuses to continue on that. The
202
+ table is what the user sees — never "tests passed". The acceptance lines a machine
203
+ cannot check are handed to the user as actions to perform, in the hand-back. Worked
204
+ run: `examples/dino/` (8/8 match, including a floating-point boundary the original
205
+ has); the whole journey is written down in `methodology/see-it-ship-it.md`.
206
+
207
+ ## Boundaries
208
+
209
+ If the user asks for any of these, say in one sentence what you will do instead
210
+ and keep going — no lecture, no stopping the task:
211
+
212
+ - decompiling, unpacking, de-obfuscating, reading minified bundles for logic,
213
+ network capture, API probing → *"I work from the public pages; here is what
214
+ they tell us."*
215
+ - logging in to their account of the original and walking the UI → *"I don't use
216
+ account areas; if you describe what you see there, I can use that as a {medium}
217
+ source."* (A screenshot they took of their own account is fine to read for
218
+ structure; it is not a source of copy or design.)
219
+ - copying the interface, copy, images, logo, names, or code → *"We take the
220
+ structure and design our own; here is the list of what we won't copy."*
221
+ - leaked source, internal docs, beta material → not used, even if pasted in.
222
+
223
+ `references/boundaries.md` has the full list with the reasoning, for the cases
224
+ in between.
225
+
226
+ ## Output
227
+
228
+ ```
229
+ .autocode/study/<slug>/
230
+ sources.json what was fetched, what was refused and why, hashes, dates
231
+ sources/S1.txt … text + outline of each public page
232
+ blueprint.md sections 0–10 + generated Sources
233
+ mvp.md hand-off to the build
234
+ ```
235
+
236
+ ## Example
237
+
238
+ User: *我想做一个像 Linear 那样的工单工具,给我们十个人的团队用。*
239
+
240
+ 1. Reply in Chinese with the framing sentence; the goal is already stated, no question.
241
+ 2. `discover https://linear.app` and `discover https://linear.app/docs` → fetch
242
+ pricing, docs concepts, start guide, teams/projects/cycles/issues docs,
243
+ changelog, developers, integrations, security, careers, mobile (≈15 pages;
244
+ the finished run is in `examples/linear/`).
245
+ 3. Read; init with `--goal "十人软件团队的轻量工单工具,键盘优先"`; fill sections 0–10
246
+ in Chinese with `[S…] {高|中|推测}` tags; section 9 keeps Team / Project / Issue /
247
+ Cycle / Comment, seven screens, no GitHub/Slack integration in v1.
248
+ 4. `check` passes → `mvp` → show summary + MVP → user says go → build.
249
+
250
+ Powered by I-Lang v5.0 | ilang.ai
plugins-skills/product-study/examples/dino/README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Example: dino runner — the first end-to-end run of see-it-ship-it
2
+
3
+ Target: the Chrome offline dinosaur game, studied from a public open-source copy
4
+ (`wayou/t-rex-runner`). The user's ask, in a non-technical person's words: "a dinosaur
5
+ game like that one, but I can set the speed myself."
6
+
7
+ What is here, in the order the methodology produces it (methodology/see-it-ship-it.md):
8
+
9
+ | Stage | File | Evidence |
10
+ |---|---|---|
11
+ | S2 study | `blueprint.md`, `sources.json` | 28/28 gate checks; every rule number cites S2 with a line number |
12
+ | S3 cut | `mvp.md` | 5 objects, 2 screens, 7 build steps, 5 three-part acceptance lines, learned-vs-own |
13
+ | S4 build | `site/index.html` | one file; rules in `<script id="rules">`, learned numbers tagged `[learned]`; look is our own |
14
+ | S5 verify | `site/acceptance.js` | `python3 ../../scripts/acceptance_run.py site` → 8/8 match, including the 13.001 boundary |
15
+ | S6 ship | `skills/ship/scripts/go_live_pages.py site --name dino-runner --simulate` | GitHub Pages flow, verification rerun on the served page |
16
+
17
+ Learned from the target (rules only, no code): start speed 6, +0.001 per update while
18
+ below 13, gravity 0.6, jump velocity 12, wait for the first key, keep the best score on
19
+ restart. Everything else — look, shapes, slider 2–18, 60 updates/s, 1.5 s clear time,
20
+ spacing, copy — is our own design.
21
+
22
+ Reproduce the verification:
23
+
24
+ ```bash
25
+ python3 skills/product-study/scripts/blueprint.py check dino --root skills/product-study/examples
26
+ python3 skills/product-study/scripts/acceptance_run.py skills/product-study/examples/dino/site
27
+ ```
plugins-skills/product-study/examples/dino/blueprint.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Product blueprint: T-Rex Runner(Chrome 离线小恐龙)
2
+
3
+ Product: T-Rex Runner(Chrome 离线小恐龙) · Official site: https://wayou.github.io/t-rex-runner/ · Studied on: 2026-10-14 · Goal: 给不会编程的人一个自己的恐龙小游戏:能跳、有仙人掌、能自己调速度
4
+
5
+ Reading guide: this blueprint describes **structure** (what the product does, how its objects relate, what its users go through), gathered only from public pages listed under Sources. It is a map for building your own product. It does not carry the original's interface, copy, images or brand, and nothing in it is copied from a non-public source.
6
+
7
+ ## 0. 概要
8
+
9
+ T-Rex Runner 是 Chrome 浏览器断网页面上藏着的小恐龙跑酷游戏,被单独抽出来放在一个公开仓库里,用浏览器直接打开就能玩 [S1] {高}。玩家只做一件事:让恐龙跳过迎面而来的仙人掌和翼龙,活得越久分数越高,而游戏会随时间越来越快 [S2] {高}。没有账号、没有收费、没有关卡,核心体验就是「一个按键 + 越来越快」。
10
+
11
+ ## 1. 功能清单
12
+
13
+ | 功能 | 作用(一句话) | 层级 | 来源 | 置信度 |
14
+ |---|---|---|---|---|
15
+ | 跳跃 | 空格或上箭头让恐龙起跳,跳过障碍 | core | S2 | 高 |
16
+ | 障碍物 | 小仙人掌、大仙人掌、翼龙从右侧迎面而来 | core | S2 | 高 |
17
+ | 自动加速 | 每次游戏更新速度 +0.001,直到 13 为止,起始 6 | core | S2 | 高 |
18
+ | 碰撞判定与结束 | 撞上障碍即结束,显示重开按钮 | core | S2 | 高 |
19
+ | 重开 | 结束后按空格 / 回车 / 点击重新开始 | core | S2 | 高 |
20
+ | 距离计分与最高分 | 按跑过的距离计分,记录本次最高分 | core | S2 | 高 |
21
+ | 下蹲 | 下箭头让恐龙低头躲翼龙 | plus | S2 | 高 |
22
+ | 开局前的等待状态 | 第一次按键才开始,开始后 3 秒内没有障碍 | plus | S2 | 高 |
23
+ | 触屏支持 | 触屏设备点击整个画面即跳跃,并把速度上限乘 1.2 | plus | S2 | 高 |
24
+ | 云和地平线滚动 | 背景云朵和地面随速度滚动 | plus | S2 | 高 |
25
+ | 昼夜反转 | 每 700 距离单位翻转一次配色 | drop | S2 | 高 |
26
+ | 成就音效 | 每 100 距离单位闪烁一次并提示 | drop | S2 | 高 |
27
+ | 街机模式 | 画面上移进入全屏街机模式 | drop | S2 | 高 |
28
+ | 高清资源 | 按设备像素比切换两套精灵图 | drop | S2 | 高 |
29
+
30
+ ## 2. 信息架构
31
+
32
+ - 只有一个页面、一个画布,没有菜单、没有设置、没有登录 [S1] {高}
33
+ - 画布内部三层:背景(云、地平线)→ 障碍物 → 恐龙;画布外只有一个覆盖整屏的触控层 [S2] {高}
34
+ - 状态只有四种:等待开局、进行中、已撞毁、(移动端)街机模式 [S2] {高}
35
+
36
+ ## 3. 核心对象与数据模型(推断)
37
+
38
+ | 对象 | 关键字段 | 关系 | 来源 | 置信度 |
39
+ |---|---|---|---|---|
40
+ | Runner(一局游戏) | 当前速度、已跑距离、最高分、是否进行中、是否撞毁、运行时长 | 拥有 1 个恐龙、1 个地平线、1 个计分器 | S2 | 高 |
41
+ | TRex(恐龙) | 位置、跳跃速度、是否在跳、是否下蹲 | 属于 Runner | S2 | 高 |
42
+ | Obstacle(障碍物) | 类型(小仙人掌/大仙人掌/翼龙)、位置、宽度、与下一个的间隙 | Horizon 持有 0..N 个 | S2 | 高 |
43
+ | Horizon(地平线) | 滚动位置、云列表、障碍物列表 | 属于 Runner | S2 | 高 |
44
+ | DistanceMeter(计分器) | 当前距离、最高分、最多 5 位数字 | 属于 Runner | S2 | 高 |
45
+ | Config(规则表) | 起始速度 6、加速度 0.001、速度上限 13、重力 0.6、起跳速度 12、开局无障碍 3000 毫秒、间隙系数 0.6 | 全局常量 | S2 | 高 |
46
+
47
+ ## 4. 关键用户流程
48
+
49
+ - 流程 A(第一次玩):打开页面 → 画面静止、恐龙待命 → 按空格 → 恐龙起跳同时游戏开始 → 3 秒后出现第一个障碍 [S2] {高}
50
+ - 流程 B(一局之中):障碍从右向左移来 → 玩家按空格起跳 / 按下躲避 → 跳过则计分继续,速度每次更新 +0.001 → 撞上则画面定格 [S2] {高}
51
+ - 流程 C(结束与重开):撞毁后显示结束面板和重开按钮 → 按空格 / 回车 / 点击 → 速度回到 6、距离归零、最高分保留 [S2] {高}
52
+ - 流程 D(触屏):点击画面任意处等于按空格 [S2] {高}
53
+
54
+ ## 5. 技术线索
55
+
56
+ - 纯浏览器前端:HTML + 一个 JavaScript 文件 + 一张精灵图,没有后端 [S1] {高}
57
+ - 代码来自 Chromium 项目,文件头声明 BSD 风格许可;仓库本身没有附许可证文件 [S1][S2] {高}
58
+ - 游戏循环用 requestAnimationFrame 按帧推进,速度与时间差相乘换算距离 [S2] {高}
59
+
60
+ ## 6. 定价与商业模式
61
+
62
+ | 方案 | 价格 | 包含 | 来源 | 置信度 |
63
+ |---|---|---|---|---|
64
+ | 唯一方案 | 免费 | 全部功能,无账号、无广告 | S1 | 高 |
65
+
66
+ ## 7. 集成与生态
67
+
68
+ - 没有任何集成、API、导入导出或移动应用;它是浏览器彩蛋的独立复刻 [S1] {高}
69
+ - 存在于 Chrome 浏览器断网页面��原始出处)和若干公开仓库的复刻版本 [S1] {高}
70
+
71
+ ## 8. 缺口与差异化机会
72
+
73
+ - 速度只能越玩越快,玩家没法把速度固定在自己舒服的档位:孩子和初学者玩不长,老手又嫌起步太慢 {推测}
74
+ - 没有任何可调项(速度、跳跃高度、障碍密度),想练反应的人没有「练习模式」 {推测}
75
+ - 规则对玩家不可见:「为什么越来越快」要读代码才知道;一个把规则摆在台面上的版本本身就是差异 {推测}
76
+ - 分数只在当次会话里,关掉就没了;v1 不必解决,但是明显的后续方向 {推测}
77
+
78
+ ## 9. MVP 切分
79
+
80
+ **Users and the one job 用户与唯一任务:** 不会编程的人(和他们的孩子):打开一个网址就能玩的恐龙跳仙人掌,而且能用滑块把速度调到自己想要的档位。
81
+
82
+ **Objects 对象 (<= 5):** 一局游戏(速度、距离、状态)、恐龙、仙人掌、速度设置(滑块值、是否自动加速)、计分
83
+
84
+ **Screens 画面 (<= 7):** 游戏画面(含控制条:开始、跳跃、重开、速度滑块、自动加速开关)、结束提示(叠在游戏画面上)
85
+
86
+ **Dropped from v1 and why 不做的:** 翼龙和下蹲(多一种障碍和一种动作,v1 只要「跳」一个动作)、昼夜反转、成就音效、街机模式、高清精灵图、触屏(v1 先在电脑浏览器跑通,手机点击作为 v1.1)、最高分持久化。
87
+
88
+ **Build order 构建顺序 (each step ends in something the user can click):**
89
+ 1. 一个 HTML 文件:画布 + 恐龙方块 + 地面,点「开始」地面开始滚动——用户看到动起来。
90
+ 2. 空格 / 「跳跃」按钮让恐龙起跳落地(重力 0.6、起跳速度 12 的手感)——用户能跳。
91
+ 3. 仙人掌从右侧按间隙生成、碰撞即「游戏结束」、「重开」回到起点——用户能玩一整局。
92
+ 4. 速度滑块 2–18 和当前速度数字:拖动即生效,固定速度——用户能调快调慢。
93
+ 5. 「自动加速」开关:开启时从 6 开始,每次逻辑更新若速度 < 13 则 +0.001,逻辑更新固定每秒 60 次——用户能复现原版手感。
94
+ 6. 计分和本局最高分——用户有目标。
95
+ 7. 上线成一个网址(静态托管,零成本)——用户能把链接发给别人。
96
+
97
+ **Acceptance 验收 (v1 is done when):**
98
+ 1. 用户做:打开网址点「开始」 → 应看到:仙人掌从右边移过来 → 机器验:页面加载无报错,开始后 2 秒内生成了障碍。
99
+ 2. 用户做:按空格 → 应看到:恐龙跳起再落下,页面不滚动 → 机器验:跳跃后恐龙 y 值先减后回到地面;空格的默认行为被阻止。
100
+ 3. 用户做:把滑块从 3 拖到 12 → 应看到:仙人掌明显变快,旁边数字显示 12 → 机器验:滑块值变化后游戏速度等于滑块值。
101
+ 4. 用户做:撞到仙人掌,点「重开」 → 应看到:结束提示消失、又能玩 → 机器验:重开后距离为 0、速度回到设定值、状态为进行中。
102
+ 5. 用户做:打开「自动加速」看数字 → 应看到:从 6.000 开始慢慢涨,到 13 附近停 → 机器验:从 6 起跑 0 / 1000 / 4000 / 10000 次更新后速度为 6.000 / 7.000 / 10.000 / 13.001(三位小数)。
103
+
104
+ **Learned vs own 学来的 / 自己定的:**
105
+ - 学来的(只学规则,不抄代码):起始速度 6、每次更新 +0.001、上限 13(先判断再相加)、重力 0.6、起跳速度 12 [S2];开局前等待第一次按键、撞毁后重开保留最高分 [S2]。
106
+ - 自己定的:画面与配色、恐龙和仙人掌的形状、控制条和滑块(2–18)、每秒 60 次逻辑更新、开局 1.5 秒无障碍、障碍间隙公式、计分换算、所有文案。
107
+
108
+ ## 10. 我们不复制的东西
109
+
110
+ - 原版的界面、像素风精灵图、配色、字体和布局:恐龙、仙人掌、地面全部自己画。
111
+ - 原版的文案、截图、图片、音效,以及 Chrome / Chromium 的名字和标识。
112
+ - 原版仓库的任何代码:它的文件头声明 BSD 风格许可(宽松许可,非 copyleft),但我们只学了它的规则(起始 6、每次更新 +0.001、上限 13、重力 0.6、起跳 12、开局 3 秒无障碍),实现全部重写。
113
+ - 没有用任何非公开材料:没有登录、抓包、反编译或泄露资料。
114
+
115
+ ## Sources
116
+
117
+ - [S1] GitHub wayou/t-rex-runner README — https://github.com/wayou/t-rex-runner (fetched 2026-10-14, sha256 25f5671d666d · license unknown)
118
+ - [S2] /wayou/t-rex-runner/gh-pages/index.js — https://raw.githubusercontent.com/wayou/t-rex-runner/gh-pages/index.js (fetched 2026-10-14, sha256 867e8f6a2bec)
119
+
120
+ Refused or skipped (out of scope by policy, not used):
121
+
122
+ - https://wayou.github.io/t-rex-runner/ — page has almost no readable text (53 chars); likely rendered by JavaScript or empty
plugins-skills/product-study/examples/dino/mvp.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MVP hand-off
2
+
3
+ Product: T-Rex Runner(Chrome 离线小恐龙) · Official site: https://wayou.github.io/t-rex-runner/ · Studied on: 2026-10-14 · Goal: 给不会编程的人一个自己的恐龙小游戏:能跳、有仙人掌、能自己调速度
4
+
5
+ Source blueprint: blueprint.md (same folder). Build only what is below; the rest of the blueprint is context, not scope.
6
+
7
+ ## MVP cut
8
+
9
+ **Users and the one job 用户与唯一任务:** 不会编程的人(和他们的孩子):打开一个网址就能玩的恐龙跳仙人掌,而且能用滑块把速度调到自己想要的档位。
10
+
11
+ **Objects 对象 (<= 5):** 一局游戏(速度、距离、状态)、恐龙、仙人掌、速度设置(滑块值、是否自动加速)、计分
12
+
13
+ **Screens 画面 (<= 7):** 游戏画面(含控制条:开始、跳跃、重开、速度滑块、自动加速开关)、结束提示(叠在游戏画面上)
14
+
15
+ **Dropped from v1 and why 不做的:** 翼龙和下蹲(多一种障碍和一种动作,v1 只要「跳」一个动作)、昼夜反转、成就音效、街机模式、高清精灵图、触屏(v1 先在电脑浏览器跑通,手机点击作为 v1.1)、最高分持久化。
16
+
17
+ **Build order 构建顺序 (each step ends in something the user can click):**
18
+ 1. 一个 HTML 文件:画布 + 恐龙方块 + 地面,点「开始」地面开始滚动——用户看到动起来。
19
+ 2. 空格 / 「跳跃」按钮让恐龙起跳落地(重力 0.6、起跳速度 12 的手感)——用户能跳。
20
+ 3. 仙人掌从右侧按间隙生成、碰撞即「游戏结束」、「重开」回到起点——用户能玩一整局。
21
+ 4. 速度滑块 2–18 和当前速度数字:拖动即生效,固定速度——用户能调快调慢。
22
+ 5. 「自动加速」开关:开启时从 6 开始,每次逻辑更新若速度 < 13 则 +0.001,逻辑更新固定每秒 60 次——用户能复现原版手感。
23
+ 6. 计分和本局最高分——用户有目标。
24
+ 7. 上线成一个网址(静态托管,零成本)——用户能把链接发给别人。
25
+
26
+ **Acceptance 验收 (v1 is done when):**
27
+ 1. 用户做:打开网址点「开始」 → 应看到:仙人掌从右边移过来 → 机器验:页面加载无报错,开始后 2 秒内生成了障碍。
28
+ 2. 用户做:按空格 → 应看到:恐龙跳起再落下,页面不滚动 → 机器验:跳跃后恐龙 y 值先减后回到地面;空格的默认行为被阻止。
29
+ 3. 用户做:把滑块从 3 拖到 12 → 应看到:仙人掌明显变快,旁边数字显示 12 → 机器验:滑块值变化后游戏速度等于滑块值。
30
+ 4. 用户做:撞到仙人掌,点「重开」 → 应看到:结束提示消失、又能玩 → 机器验:重开后距离为 0、速度回到设定值、状态为进行中。
31
+ 5. 用户做:打开「自动加速」看数字 → 应看到:从 6.000 开始慢慢涨,到 13 附近停 → 机器验:从 6 起跑 0 / 1000 / 4000 / 10000 次更新后速度为 6.000 / 7.000 / 10.000 / 13.001(三位小数)。
32
+
33
+ **Learned vs own 学来的 / 自己定的:**
34
+ - 学来的(只学规则,不抄代码):起始速度 6、每次更新 +0.001、上限 13(先判断再相加)、重力 0.6、起跳速度 12 [S2];开局前等待第一次按键、撞毁后重开保留最高分 [S2]。
35
+ - 自己定的:画面与配色、恐龙和仙人掌的形状、控制条和滑块(2–18)、每秒 60 次逻辑更新、开局 1.5 秒无障碍、障碍间隙公式、计分换算、所有文案。
36
+
37
+
38
+ ## What we will not copy
39
+
40
+ - 原版的界面、像素风精灵图、配色、字体和布局:恐龙、仙人掌、地面全部自己画。
41
+ - 原版的文案、截图、图片、音效,以及 Chrome / Chromium 的名字和标识。
42
+ - 原版仓库的任何代码:它的文件头声明 BSD 风格许可(宽松许可,非 copyleft),但我们只学了它的规则(起始 6、每次更新 +0.001、上限 13、重力 0.6、起跳 12、开局 3 秒无障碍),实现全部重写。
43
+ - 没有用任何非公开材料:没有登录、抓包、反编译或泄露资料。
44
+
45
+
46
+ ## Verify
47
+
48
+ Keep the rules (numbers, formulas, state changes) in one block the acceptance runner can load without a browser; tag the learned ones [learned].
49
+ Ship a checks file next to the build (acceptance.js or acceptance.py) that prints one JSON row per machine check; run it with
50
+ `python3 <product-study>/scripts/acceptance_run.py <site_dir>` before go-live and again with `--url <live url>` after. The table it prints is what the user sees.
51
+ The remaining checks are actions the user performs; list them as actions, never as 'tests passed'.
plugins-skills/product-study/examples/dino/site/acceptance.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Acceptance for mvp.md — machine-checkable parts. Prints one JSON row per check (S5 convention).
2
+ // Run via: python3 skills/product-study/scripts/acceptance_run.py <site_dir> [--url <live>]
3
+ const fs = require('fs'), vm = require('vm');
4
+ const html = fs.readFileSync(process.argv[2] || 'index.html', 'utf8');
5
+ const rulesSrc = html.match(/<script id="rules">([\s\S]*?)<\/script>/)[1];
6
+ const sandbox = { module: { exports: {} } };
7
+ vm.runInNewContext(rulesSrc, sandbox);
8
+ const R = sandbox.module.exports;
9
+ const f3 = n => (Math.round(n * 1000) / 1000).toFixed(3);
10
+ const rows = [];
11
+ const check = (id, what, expected, actual, ok) => rows.push({ id, check: what, expected: String(expected), actual: String(actual), ok });
12
+
13
+ // 1. 开始后 2 秒内生成了障碍
14
+ {
15
+ const st = R.newState(); R.start(st);
16
+ let firstAt = null;
17
+ for (let i = 1; i <= 120; i++) { R.update(st); if (st.obstacles.length && firstAt === null) firstAt = i; }
18
+ check('1', '开始后 2 秒(120 次更新)内出现障碍', '≤ 120 次更新', firstAt === null ? '未出现' : firstAt + ' 次更新', firstAt !== null && firstAt <= 120);
19
+ }
20
+ // 2. 跳跃:y 先升后回到地面
21
+ {
22
+ const st = R.newState(); R.start(st); R.jump(st);
23
+ let peak = 0, landed = null;
24
+ for (let i = 1; i <= 120; i++) { R.update(st); peak = Math.max(peak, st.dinoY); if (!st.jumping && landed === null && i > 1) landed = i; }
25
+ check('2', '按空格后恐龙跳起再落地', '峰值 > 0 且落地', '峰值 ' + f3(peak) + ',' + (landed ? landed + ' 次更新后落地' : '未落地'), peak > 0 && landed !== null);
26
+ }
27
+ // 3. 滑块 3 → 12:速度等于滑块值,自动加速关闭
28
+ {
29
+ const st = R.newState(); R.setAuto(st, true); R.start(st);
30
+ R.setSliderSpeed(st, 3); const s3 = st.speed; R.setSliderSpeed(st, 12);
31
+ check('3', '滑块拖到 12 后游戏速度', '12.000(自动加速关)', f3(st.speed) + '(自动加速' + (st.auto ? '开' : '关') + ',之前 ' + f3(s3) + ')', st.speed === 12 && !st.auto && s3 === 3);
32
+ }
33
+ // 4. 重开:距离 0、速度回到设定、状态进行中
34
+ {
35
+ const st = R.newState(); R.start(st); R.setSliderSpeed(st, 9);
36
+ for (let i = 0; i < 400; i++) R.update(st);
37
+ st.status = 'crashed'; const dBefore = Math.floor(st.distance);
38
+ R.restart(st);
39
+ check('4', '撞毁后重开', '距离 0,速度 9.000,进行中', '距离 ' + Math.floor(st.distance) + '(之前 ' + dBefore + '),速度 ' + f3(st.speed) + ',' + (st.status === 'playing' ? '进行中' : st.status), st.distance === 0 && st.speed === 9 && st.status === 'playing');
40
+ }
41
+ // 5. 自动加速:0/1000/4000/10000 次更新后的速度
42
+ {
43
+ const ref = { 0: 6.000, 1000: 7.000, 4000: 10.000, 10000: 13.001 };
44
+ for (const n of Object.keys(ref)) {
45
+ const v = R.simulateAcceleration(Number(n));
46
+ check('5', '自动加速 ' + n + ' 次更新后速度', f3(ref[n]), f3(v), f3(v) === f3(ref[n]));
47
+ }
48
+ }
49
+
50
+ for (const r of rows) console.log(JSON.stringify(r));
51
+ process.exit(rows.some(r => !r.ok) ? 1 : 0);
plugins-skills/product-study/examples/dino/site/index.html ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
+ <title>小恐龙跑酷 · 自己调速度</title>
7
+ <style>
8
+ :root {
9
+ --bg: #f6f3ea; --fg: #2b2b2b; --muted: #6b6b6b; --panel: #ffffff; --line: #d9d4c7;
10
+ --accent: #2f7d5b; --accent-ink: #ffffff; --sky: #eaf4ff; --ground: #c9b48a; --dino: #2f7d5b; --cactus: #4e8f3a; --danger: #b43c2a;
11
+ box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
12
+ }
13
+ @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
14
+ --bg: #15171a; --fg: #ececec; --muted: #9a9a9a; --panel: #1f2328; --line: #343a40;
15
+ --accent: #4fb584; --accent-ink: #0d1a14; --sky: #1b2430; --ground: #6b5a3a; --dino: #4fb584; --cactus: #7cc45f; --danger: #e06a56; color-scheme: dark; } }
16
+ :root[data-theme="dark"] { --bg: #15171a; --fg: #ececec; --muted: #9a9a9a; --panel: #1f2328; --line: #343a40; --accent: #4fb584; --accent-ink: #0d1a14; --sky: #1b2430; --ground: #6b5a3a; --dino: #4fb584; --cactus: #7cc45f; --danger: #e06a56; }
17
+ html { scroll-padding-top: env(safe-area-inset-top, 0px); }
18
+ * { box-sizing: border-box; }
19
+ body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif; }
20
+ main { max-width: 820px; margin: 0 auto; padding: 20px 16px 40px; }
21
+ h1 { font-size: 22px; margin: 0 0 4px; }
22
+ .sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
23
+ .stage { position: relative; background: var(--sky); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
24
+ canvas { display: block; width: 100%; height: auto; }
25
+ .overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px; background: rgba(0,0,0,.35); color: #fff; font-weight: 600; font-size: 20px; }
26
+ .overlay.show { display: flex; }
27
+ .hud { position: absolute; top: 10px; right: 14px; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
28
+ .controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
29
+ .card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
30
+ .buttons { display: flex; gap: 8px; flex-wrap: wrap; }
31
+ button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; }
32
+ button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
33
+ button:disabled { opacity: .5; cursor: default; }
34
+ label { display: block; font-size: 14px; color: var(--muted); }
35
+ input[type=range] { width: 100%; }
36
+ .speedval { font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 600; }
37
+ .check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--fg); }
38
+ .help { font-size: 13px; color: var(--muted); margin-top: 12px; }
39
+ .help b { color: var(--fg); }
40
+ </style>
41
+ </head>
42
+ <body>
43
+ <main>
44
+ <h1>小恐龙跑酷 · 自己调速度</h1>
45
+ <p class="sub">空格或「跳跃」让恐龙跳过仙人掌。拖滑块定一个速度,或打开「自动加速」体验越跑越快。</p>
46
+
47
+ <div class="stage">
48
+ <canvas id="game" width="800" height="240" aria-label="游戏画面"></canvas>
49
+ <div class="hud" id="hud">距离 0 · 最高 0</div>
50
+ <div class="overlay" id="overlay"><div id="overlayText">按「开始」或空格</div></div>
51
+ </div>
52
+
53
+ <div class="controls">
54
+ <div class="card">
55
+ <label>操作</label>
56
+ <div class="buttons">
57
+ <button id="btnStart" class="primary">开始</button>
58
+ <button id="btnJump">跳跃</button>
59
+ <button id="btnRestart">重开</button>
60
+ </div>
61
+ </div>
62
+ <div class="card">
63
+ <label for="speed">速度 <span class="speedval" id="speedVal">6.000</span></label>
64
+ <input type="range" id="speed" min="2" max="18" step="0.5" value="6" aria-label="速度">
65
+ </div>
66
+ <div class="card">
67
+ <label>模式</label>
68
+ <div class="check"><input type="checkbox" id="auto"><label for="auto" style="margin:0;color:inherit">自动加速(从 6 开始,每次更新 +0.001,到 13 停)</label></div>
69
+ </div>
70
+ </div>
71
+
72
+ <p class="help"><b>学来的规则</b>:起始速度 6、每次逻辑更新加 0.001、上限 13、重力 0.6、起跳速度 12(来自公开的开源仓库)。<b>自己定的</b>:画面、恐龙和仙人掌的样子、每秒 60 次逻辑更新、开始后 1.5 秒无障碍、滑块范围 2–18。</p>
73
+ </main>
74
+
75
+ <!-- ======================================================================
76
+ RULES — pure functions, no DOM. The acceptance script runs this block
77
+ in node. Numbers marked [learned] come from the studied public repo;
78
+ everything else is our own design.
79
+ ====================================================================== -->
80
+ <script id="rules">
81
+ var Rules = (function () {
82
+ var C = {
83
+ START_SPEED: 6, // [learned]
84
+ ACCELERATION: 0.001, // [learned] per logic update
85
+ MAX_SPEED: 13, // [learned] accelerate only while below this
86
+ GRAVITY: 0.6, // [learned] per update
87
+ JUMP_VELOCITY: 12, // [learned] initial upward velocity
88
+ UPDATES_PER_SECOND: 60, // own: fixed logic timestep
89
+ CLEAR_TIME_UPDATES: 90, // own: 1.5 s without obstacles after start
90
+ MIN_SPEED: 2, MAX_SLIDER: 18, // own: slider range
91
+ GROUND_Y: 0, DINO_W: 34, DINO_H: 40, // own: geometry in game units (y grows upward)
92
+ MIN_GAP: 160, GAP_PER_SPEED: 26, // own: obstacle spacing
93
+ CACTUS_SIZES: [[18, 36], [26, 46], [40, 44]], // own: w,h variants
94
+ WORLD_W: 800
95
+ };
96
+
97
+ function accelerate(speed) { // [learned] check-then-add
98
+ if (speed < C.MAX_SPEED) return speed + C.ACCELERATION;
99
+ return speed;
100
+ }
101
+
102
+ function simulateAcceleration(updates) { // for acceptance: speed after n updates from START_SPEED
103
+ var s = C.START_SPEED;
104
+ for (var i = 0; i < updates; i++) s = accelerate(s);
105
+ return s;
106
+ }
107
+
108
+ function newState() {
109
+ return { status: 'waiting', speed: C.START_SPEED, auto: false, distance: 0, best: 0,
110
+ updates: 0, dinoY: 0, dinoVy: 0, jumping: false, obstacles: [], nextGap: 0, rng: 1 };
111
+ }
112
+
113
+ function rand(st) { st.rng = (st.rng * 1664525 + 1013904223) % 4294967296; return st.rng / 4294967296; }
114
+
115
+ function start(st) {
116
+ if (st.status === 'playing') return st;
117
+ if (st.status === 'crashed') restart(st);
118
+ st.status = 'playing';
119
+ if (st.auto) st.speed = C.START_SPEED;
120
+ return st;
121
+ }
122
+
123
+ function restart(st) {
124
+ var best = st.best, auto = st.auto, speed = auto ? C.START_SPEED : st.speed;
125
+ var fresh = newState();
126
+ fresh.best = best; fresh.auto = auto; fresh.speed = speed; fresh.status = 'playing';
127
+ for (var k in fresh) st[k] = fresh[k];
128
+ return st;
129
+ }
130
+
131
+ function setSliderSpeed(st, value) { // dragging the slider = fixed speed, auto off
132
+ var v = Math.max(C.MIN_SPEED, Math.min(C.MAX_SLIDER, Number(value)));
133
+ st.auto = false; st.speed = v;
134
+ return st;
135
+ }
136
+
137
+ function setAuto(st, on) {
138
+ st.auto = !!on;
139
+ if (st.auto) st.speed = C.START_SPEED;
140
+ return st;
141
+ }
142
+
143
+ function jump(st) {
144
+ if (st.status !== 'playing' || st.jumping) return st;
145
+ st.jumping = true; st.dinoVy = C.JUMP_VELOCITY;
146
+ return st;
147
+ }
148
+
149
+ function spawn(st) {
150
+ var size = C.CACTUS_SIZES[Math.floor(rand(st) * C.CACTUS_SIZES.length)];
151
+ st.obstacles.push({ x: C.WORLD_W + 10, w: size[0], h: size[1] });
152
+ st.nextGap = C.MIN_GAP + C.GAP_PER_SPEED * st.speed + rand(st) * 120;
153
+ }
154
+
155
+ function hits(st, o) {
156
+ var dx0 = 40, dx1 = 40 + C.DINO_W;
157
+ return o.x < dx1 - 4 && o.x + o.w > dx0 + 4 && st.dinoY < o.h - 4;
158
+ }
159
+
160
+ function update(st) { // one logic update (60 per second)
161
+ if (st.status !== 'playing') return st;
162
+ st.updates += 1;
163
+ if (st.jumping) {
164
+ st.dinoY += st.dinoVy; st.dinoVy -= C.GRAVITY;
165
+ if (st.dinoY <= 0) { st.dinoY = 0; st.dinoVy = 0; st.jumping = false; }
166
+ }
167
+ for (var i = st.obstacles.length - 1; i >= 0; i--) {
168
+ st.obstacles[i].x -= st.speed;
169
+ if (st.obstacles[i].x + st.obstacles[i].w < -20) st.obstacles.splice(i, 1);
170
+ }
171
+ if (st.updates > C.CLEAR_TIME_UPDATES) {
172
+ var last = st.obstacles[st.obstacles.length - 1];
173
+ if (!last || (C.WORLD_W - last.x) > st.nextGap) spawn(st);
174
+ }
175
+ for (var j = 0; j < st.obstacles.length; j++) {
176
+ if (hits(st, st.obstacles[j])) { st.status = 'crashed'; return st; }
177
+ }
178
+ st.distance += st.speed / 10;
179
+ if (st.distance > st.best) st.best = st.distance;
180
+ if (st.auto) st.speed = accelerate(st.speed);
181
+ return st;
182
+ }
183
+
184
+ return { C: C, accelerate: accelerate, simulateAcceleration: simulateAcceleration, newState: newState,
185
+ start: start, restart: restart, setSliderSpeed: setSliderSpeed, setAuto: setAuto, jump: jump, update: update };
186
+ })();
187
+ if (typeof module !== 'undefined') module.exports = Rules;
188
+ </script>
189
+
190
+ <!-- ============================ VIEW (our own look) ============================ -->
191
+ <script>
192
+ (function () {
193
+ var canvas = document.getElementById('game'), ctx = canvas.getContext('2d');
194
+ var overlay = document.getElementById('overlay'), overlayText = document.getElementById('overlayText');
195
+ var hud = document.getElementById('hud'), speedVal = document.getElementById('speedVal');
196
+ var slider = document.getElementById('speed'), auto = document.getElementById('auto');
197
+ var st = Rules.newState();
198
+ var css = function (name) { return getComputedStyle(document.documentElement).getPropertyValue(name).trim(); };
199
+ var GROUND = 200;
200
+
201
+ function fmt(n) { return (Math.round(n * 1000) / 1000).toFixed(3); }
202
+
203
+ function draw() {
204
+ var W = canvas.width, H = canvas.height;
205
+ ctx.clearRect(0, 0, W, H);
206
+ ctx.fillStyle = css('--sky'); ctx.fillRect(0, 0, W, H);
207
+ // ground band
208
+ ctx.fillStyle = css('--ground'); ctx.fillRect(0, GROUND, W, H - GROUND);
209
+ ctx.strokeStyle = 'rgba(0,0,0,.25)'; ctx.beginPath(); ctx.moveTo(0, GROUND + .5); ctx.lineTo(W, GROUND + .5); ctx.stroke();
210
+ // dino: rounded body, head, eye, legs — our own shape
211
+ var dx = 40, dy = GROUND - st.dinoY, C = Rules.C;
212
+ ctx.fillStyle = css('--dino');
213
+ rr(dx, dy - C.DINO_H, C.DINO_W, C.DINO_H - 8, 8);
214
+ rr(dx + 14, dy - C.DINO_H - 14, 28, 20, 6);
215
+ ctx.fillRect(dx + 6, dy - 8, 8, 8); ctx.fillRect(dx + 20, dy - 8, 8, 8);
216
+ ctx.fillStyle = css('--bg'); ctx.fillRect(dx + 32, dy - C.DINO_H - 8, 4, 4);
217
+ // cacti: columns with arms
218
+ ctx.fillStyle = css('--cactus');
219
+ st.obstacles.forEach(function (o) {
220
+ rr(o.x, GROUND - o.h, o.w, o.h, 6);
221
+ if (o.w > 20) { rr(o.x - 8, GROUND - o.h * .7, 8, o.h * .4, 4); rr(o.x + o.w, GROUND - o.h * .6, 8, o.h * .35, 4); }
222
+ });
223
+ hud.textContent = '距离 ' + Math.floor(st.distance) + ' · 最高 ' + Math.floor(st.best);
224
+ speedVal.textContent = fmt(st.speed);
225
+ }
226
+ function rr(x, y, w, h, r) { ctx.beginPath(); ctx.moveTo(x + r, y); ctx.arcTo(x + w, y, x + w, y + h, r); ctx.arcTo(x + w, y + h, x, y + h, r); ctx.arcTo(x, y + h, x, y, r); ctx.arcTo(x, y, x + w, y, r); ctx.closePath(); ctx.fill(); }
227
+
228
+ function showOverlay(text) { overlayText.textContent = text; overlay.classList.add('show'); }
229
+ function hideOverlay() { overlay.classList.remove('show'); }
230
+
231
+ // fixed 60 updates/second regardless of display refresh rate
232
+ var acc = 0, last = 0, STEP = 1000 / Rules.C.UPDATES_PER_SECOND;
233
+ function frame(now) {
234
+ if (!last) last = now;
235
+ acc += Math.min(now - last, 250); last = now;
236
+ while (acc >= STEP) {
237
+ Rules.update(st); acc -= STEP;
238
+ if (st.status === 'crashed') { showOverlay('游戏结束 · 距离 ' + Math.floor(st.distance) + ',按「重开」或空格再来'); break; }
239
+ }
240
+ draw();
241
+ requestAnimationFrame(frame);
242
+ }
243
+
244
+ function doStart() { Rules.start(st); hideOverlay(); syncSlider(); }
245
+ function doJump() { if (st.status === 'playing') Rules.jump(st); else if (st.status === 'waiting') doStart(); else if (st.status === 'crashed') doRestart(); }
246
+ function doRestart() { Rules.restart(st); hideOverlay(); syncSlider(); }
247
+ function syncSlider() { slider.value = Math.max(2, Math.min(18, st.speed)); }
248
+
249
+ document.getElementById('btnStart').addEventListener('click', doStart);
250
+ document.getElementById('btnJump').addEventListener('click', doJump);
251
+ document.getElementById('btnRestart').addEventListener('click', doRestart);
252
+ slider.addEventListener('input', function () { Rules.setSliderSpeed(st, slider.value); auto.checked = false; draw(); });
253
+ auto.addEventListener('change', function () { Rules.setAuto(st, auto.checked); syncSlider(); draw(); });
254
+ canvas.addEventListener('pointerdown', doJump);
255
+ document.addEventListener('keydown', function (e) {
256
+ if (e.code === 'Space' || e.code === 'ArrowUp') { e.preventDefault(); if (!e.repeat) doJump(); }
257
+ else if (e.code === 'Enter' && st.status === 'crashed') { e.preventDefault(); doRestart(); }
258
+ });
259
+
260
+ showOverlay('按「开始」或空格');
261
+ draw();
262
+ requestAnimationFrame(frame);
263
+ window.DinoGame = { state: st, Rules: Rules };
264
+ })();
265
+ </script>
266
+ </body>
267
+ </html>
plugins-skills/product-study/examples/dino/sources.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "slug": "dino",
3
+ "tool": "fetch_public.py 6.0.1",
4
+ "user_agent": "autocode-product-study/6.0.1 (+https://github.com/ilang-ai/autocode; public pages only)",
5
+ "policy": "public pages only; robots.txt honored; no login; no captures; no binaries",
6
+ "sources": [
7
+ {
8
+ "url": "https://github.com/wayou/t-rex-runner",
9
+ "fetched_at": "2026-10-14T00:09:49Z",
10
+ "final_url": "https://raw.githubusercontent.com/wayou/t-rex-runner/master/README.md",
11
+ "status": "ok",
12
+ "kind": "github",
13
+ "title": "GitHub wayou/t-rex-runner README",
14
+ "description": "",
15
+ "bytes": 119,
16
+ "sha256": "25f5671d666db10d51d115723b998ae8b8816cbc97d700d17cd4e0c262db6399",
17
+ "license": "unknown",
18
+ "repo_meta": {},
19
+ "id": "S1",
20
+ "file": "sources/S1.txt"
21
+ },
22
+ {
23
+ "url": "https://raw.githubusercontent.com/wayou/t-rex-runner/gh-pages/index.js",
24
+ "fetched_at": "2026-10-14T00:10:00Z",
25
+ "final_url": "https://raw.githubusercontent.com/wayou/t-rex-runner/gh-pages/index.js",
26
+ "status": "ok",
27
+ "kind": "text",
28
+ "title": "/wayou/t-rex-runner/gh-pages/index.js",
29
+ "description": "",
30
+ "bytes": 90241,
31
+ "sha256": "867e8f6a2beca3d720b4884a556067cf32601a051e7882a86ce54e9ff47f1c86",
32
+ "id": "S2",
33
+ "file": "sources/S2.txt"
34
+ }
35
+ ],
36
+ "skipped": [
37
+ {
38
+ "url": "https://wayou.github.io/t-rex-runner/",
39
+ "fetched_at": "2026-10-14T00:09:58Z",
40
+ "status": "skipped",
41
+ "reason": "page has almost no readable text (53 chars); likely rendered by JavaScript or empty"
42
+ }
43
+ ]
44
+ }
plugins-skills/product-study/examples/linear/README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Example: Linear → a lightweight issue tracker for a ten-person team
2
+
3
+ Produced on 2026-10-13 by an AI agent that had only this skill installed, from
4
+ the user message *"我想做一个像 Linear 那样的工单工具,给我们十个人的软件团队用,要键盘优先、轻量,不要企业那一堆东西。"*
5
+ It passed `blueprint.py check` on the first run (26 ok, 0 fail).
6
+
7
+ - `blueprint.md` — sections 0–10 in Chinese, 17 public pages cited, every claim tagged.
8
+ - `mvp.md` — the hand-off: 5 objects, 7 screens, 7 build steps, 5 acceptance checks.
9
+ - `sources.json` — what was fetched (URLs, dates, hashes) and the one URL that was refused (404).
10
+
11
+ The fetched page texts (`sources/S*.txt`) are not included: they are extracts of
12
+ Linear's own pages. Re-create them with
13
+ `fetch_public.py fetch linear <the urls in sources.json>`.
14
+
15
+ Linear is a trademark of Linear Orbit, Inc. This example describes the
16
+ product's public structure for study; nothing of its interface, copy, images,
17
+ brand or code is reproduced here, and none goes into a product built from it.
plugins-skills/product-study/examples/linear/blueprint.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Product blueprint: Linear
2
+
3
+ Product: Linear · Official site: https://linear.app · Studied on: 2026-10-13 · Goal: 十人软件团队的轻量工单工具,键盘优先,不要企业功能
4
+
5
+ 阅读说明:本蓝图只描述**结构**(产品做什么、对象之间怎么关联、用户走哪些流程),全部来自文末 Sources 列出的公开页面。它是一张用来设计我们自己产品的地图,不包含原产品的界面、文案、图片或品牌,也没有使用任何非公开来源。置信度标记:{高} = 官方页面明确写了;{中} = 官方页面暗示或由上下文推断;{推测} = 我的判断,没有页面直接说。
6
+
7
+ ## 0. 摘要 Summary
8
+
9
+ Linear 自称是"面向团队与 AI agent 的产品开发系统",核心对象是工单(issue)、团队(team)、工作区(workspace),往上用项目(project)和倡议(initiative)组织工作,横向用周期(cycle)做短期规划,用视图(view)从不同角度看同一批工单 [S1, S3]。它最强的地方是速度与专注:工单创建、改属性、分诊、跨团队移动都有单键或组合键快捷方式,并配有命令面板 [S17, S7, S6, S8]。定价按席位:免费版无限成员但限 2 个团队、250 条工单;Basic 每人每月 10 美元;Business 每人每月 16 美元解锁私有团队、分诊智能、洞察等;Enterprise 定制并提供 SAML/SCIM [S2]。近一年的更新几乎全在 AI agent、代码审查(diffs)、Loops 自动化和企业级管控上 [S8]——这些正是我们十人团队不需要的部分,也是我们的轻量版本得以存在的理由。
10
+
11
+ ## 1. 功能清单 Feature inventory
12
+
13
+ | Feature | What it does (one line) | Tier | Sources | Confidence |
14
+ |---|---|---|---|---|
15
+ | 工单 Issue | 工作的最小单位,必须属于一个团队,必须有标题和状态,按创建顺序分配编号 | core | S3, S17 | 高 |
16
+ | 工作流状态 Workflow | 每个团队自定义的一组有序状态,列表按它分组,看板按它分列,系统给默认流可改 | core | S3 | 高 |
17
+ | 团队 Team | 主要组织单位,拥有自己的状态流、周期、标签和工单集合;成员可同时属于多个团队 | core | S3, S5 | 高 |
18
+ | 工作区 Workspace | 一家公司的总容器,有唯一 URL,新建时自动生成同名团队 | core | S3, S5 | 高 |
19
+ | 项目 Project | 围绕一个结果把工单分组,可跨团队共享,但一条工单同时只能属于一个项目 | core | S3, S6 | 高 |
20
+ | 周期 Cycle | 团队重复的时间盒规划期,1 到 8 周,开启后自动生成后续周期 | core | S3, S16 | 高 |
21
+ | 视图 View | 对同一批工单的不同过滤/分组方式,不改变工单本身;可保存、可分享 URL | core | S3, S8 | 高 |
22
+ | 快捷键与命令面板 | 单键 C 新建工单,Shift P 加入项目,Cmd/Ctrl K 打开模糊搜索的命令面板,G 然后 T 跳到分诊 | core | S17, S6, S7, S8 | 高 |
23
+ | 优先级 Priority | 四档:紧急、高、中、低 | core | S17 | 高 |
24
+ | 标签 Label | 可按团队或工作区作用域,支持标签组 | core | S5 | 高 |
25
+ | 评论 Comment | 工单下的讨论,支持 @ 提及和反应 | core | S3, S17 | 中 |
26
+ | 负责人与指派 | 工单可指派给一个人,也可指派给其他团队的人 | core | S3, S5 | 高 |
27
+ | 里程碑 Milestone | 项目内部的阶段,带目标日期,按所属工单计算完成度 | plus | S3, S6 | 高 |
28
+ | 分诊 Triage | 团队的特殊收件箱,外部成员或集成建的工单先进这里,用 1/2/3/H 接受、拒绝、标重复、暂缓 | plus | S3, S7 | 高 |
29
+ | 父子工单 | 工单可拆成子工单,子工单可分到任意团队或成员 | plus | S5, S17 | 中 |
30
+ | 估点 Estimate | T 恤尺码映射到点数(XS=1 到 XXXL=21) | plus | S17 | 高 |
31
+ | 草稿 Drafts | 关掉弹窗可存为跨设备草稿,保留 6 个月;临时草稿只存本机 | plus | S17 | 高 |
32
+ | 模板 Template | 团队级工单/项目/文档模板,可生成预填 URL | plus | S5, S17 | 高 |
33
+ | 预填建单链接 | 通过 URL 参数预设标题、状态、团队、优先级、负责人、周期、标签、项目 | plus | S17 | 高 |
34
+ | 跨团队移动 | Cmd/Ctrl Shift M 把工单移到别的团队,生成新编号,旧链接仍可跳转 | plus | S17 | 高 |
35
+ | 批量选择与撤销 | Cmd/Ctrl A 全选列表,Cmd/Ctrl Z 撤销移动 | plus | S17 | 高 |
36
+ | 周期自动化 | 未完成工单自动滚入下一周期;活动中的无周期工单可自动加入当前周期 | plus | S16 | 高 |
37
+ | 周期容量 | 未开始的周期显示容量表盘,按前三个周期的速度估算 | plus | S16 | 高 |
38
+ | 通知收件箱 Inbox | 汇总需要你处理的通知,新增"优先"标签页把要紧的和可等的分开 | plus | S8, S13 | 高 |
39
+ | 项目列表/看板/时间线 | 团队和工作区都有项目页,可按状态、负责人、目标日期分组,可切时间线 | plus | S6 | 高 |
40
+ | 描述历史 | 可查看并恢复工单描述的早期版本 | plus | S17 | 高 |
41
+ | 团队退役与删除 | 退役后只读保留���史;删除有 30 天恢复期 | plus | S5 | 高 |
42
+ | 倡议 Initiative | 项目之上的战略层,可嵌套父子倡议 | drop | S3 | 高 |
43
+ | 周期性工单 | 按节奏自动重建的工单 | drop | S17 | 高 |
44
+ | 邮件建单与 Asks | 给团队或模板配邮箱地址,外部人发邮件即建单 | drop | S17, S7 | 高 |
45
+ | 文档 Documents | 项目内 Markdown 文档与外链资源 | drop | S6 | 高 |
46
+ | AI 与代码审查 | Linear Agent、编码会话、Loops、Diffs、引导式审查、分诊智能 | drop | S1, S8 | 高 |
47
+ | 洞察与仪表盘 | Insights、Dashboards、进度报告 | drop | S2 | 高 |
48
+ | 企业管控 | 私有团队、访客、SAML、SCIM、审计日志、IP 限制、域名认领 | drop | S2, S11 | 高 |
49
+ | 原生移动端 | iOS/Android 独立应用,推送与通知时段 | drop | S13 | 高 |
50
+
51
+ ## 2. 信息架构 Information architecture
52
+
53
+ - 容器嵌套:工作区 > 团队 > 工单;项目横跨一个或多个团队并聚合工单;里程碑挂在项目下;周期属于团队;倡议在项目之上 [S3, S5, S6] {高}
54
+ - 侧边栏以团队为单位:你加入的团队出现在侧边栏;浏览未加入的团队时它们临时出现在一个"探索中"分区 [S5] {高}
55
+ - 每个团队下固定几页:团队主页、分诊(可选开启)、工单、周期(可选开启)、项目、视图 [S5] {高}
56
+ - 工作区级也有一个项目总页和倡议页,用来跨团队看所有项目 [S6, S1] {高}
57
+ - 个人入口包括收件箱、我的工单、草稿、收藏 [S1, S17, S8] {中}
58
+ - 项目页由概览、工单两个固定标签加任意自定义视图标签组成;Cmd/Ctrl I 开关右侧属性栏 [S6] {高}
59
+ - 工单编号格式为"团队标识-序号",项目编号为"P-团队标识-序号" [S6, S17] {高}
60
+ - 团队设置分为:通用(名称、标识、时区、估点)、成员、标签、模板、状态与自动化、分诊、周期、周期性工单 [S5] {高}
61
+ - 命令面板(Cmd/Ctrl K)是跨页面的全局入口,可用来搜索、执行动作、复制预填链接 [S17, S8] {高}
62
+
63
+ ## 3. 核心对象与数据模型(推断)Core objects and data model (inferred)
64
+
65
+ | Object | Key fields | Relations | Sources | Confidence |
66
+ |---|---|---|---|---|
67
+ | 工作区 Workspace | 名称、URL 子路径 | 1:N 团队;N:M 用户(一人可在多个工作区有账号) | S3 | 高 |
68
+ | 团队 Team | 名称、标识符、时区、是否开启估点/周期/分诊 | N:1 工作区;1:N 工单;1:N 周期;1:N 状态;1:N 团队级标签;N:M 成员;N:M 项目 | S3, S5 | 高 |
69
+ | 状态 WorkflowStatus | 名称、顺序、类别(分诊/待办/未开始/进行中/已完成/已取消) | N:1 团队;1:N 工单 | S3, S7, S16 | 中 |
70
+ | 工单 Issue | 标题(必填)、Markdown 描述、状态(必填)、序号、优先级(4 档)、估点、创建时间 | N:1 团队;N:1 项目(可选);N:1 周期(可选);N:1 里程碑(可选);N:1 负责人;N:M 标签;N:1 父工单;1:N 评论;N:M 关联工单 | S3, S17, S6 | 高 |
71
+ | 项目 Project | 名称(必填)、状态(必填)、负责人、图标、概览、开始/目标日期(粒度可到年/半年/季/月/日)、编号 | N:M 团队(其中一个为主导团队);1:N 工单;1:N 里程碑;1:N 文档与外链;N:1 倡议 | S6, S3 | 高 |
72
+ | 里程碑 Milestone | 名称、目标日期、描述、顺序 | N:1 项目;1:N 工单 | S3, S6 | 高 |
73
+ | 周期 Cycle | 序号、名称、描述、开始/结束日期、时长(1–8 周)、冷却期 | N:1 团队;1:N 工单 | S16 | 高 |
74
+ | 标签 Label | 名称、作用域(团队或工作区)、所属标签组 | N:1 团队或工作区;N:M 工单 | S5 | 高 |
75
+ | 评论 Comment | 正文、作者、时间 | N:1 工单;N:1 用户 | S3, S17 | 中 |
76
+ | 用户/成员 User | 名称、角色(管理员/成员/访客)、显示名 | N:M 工作区;N:M 团队 | S3, S5, S2 | 中 |
77
+ | 倡议 Initiative | 名称、状态(含提议/取消)、优先级、标签 | 1:N 项目;父子倡议 | S3, S8 | 高 |
78
+ | 草稿 Draft | 内容、创建时间(6 个月后清理) | N:1 用户 | S17 | 高 |
79
+ | 模板 Template | 类型(工单/项目/文档)、预设属性、可选邮箱地址 | N:1 团队 | S5, S17 | 高 |
80
+
81
+ ## 4. 关键用户流程 Key user flows
82
+
83
+ - 流程 A 上手:先逛公开演示工作区看布局 → 用工作邮箱创建工作区 → 系统自动生成同名团队 → 官方建议小团队全员放一个团队、起步只建一两个团队 [S4, S5] {高}
84
+ - 流程 B 建单(键盘):按 C 弹出创建窗(Alt/Option C 走模板)→ 填标题 → 顺手设优先级/负责人/项目/周期/标签 → 创建后 3 分钟内的属性改动不记入活动日志 → 中途离开则保留临时草稿 [S17] {高}
85
+ - 流程 C 推进工单:在详情页直接点标题或描述内联编辑 → 工单沿团队状态流前进 → 需要时 Cmd/Ctrl Shift M 移到别的团队,状态映射到最接近的状态并换新编号 [S17, S3] {高}
86
+ - 流程 D 分诊:非本团队成员或集成创建的工单落入分诊队列 → G 然后 T 打开 → 1 接受(进入团队默认状态)/ 2 拒绝(变已取消)/ 3 标重复并合并到原单 / H 暂缓 → 可要求必须先设优先级才能离开分诊 [S7] {高}
87
+ - 流程 E 周期规划:团队设置里开启周期,选时长、起始星期、未来周期数(最多 15 个)→ 把工单放进当前或未来周期 → 周期结束未完成工单自动滚入下一周期,但移到待办/分诊/取消的不滚 → 未开始的周期按前三个周期速度显示容量 [S16] {高}
88
+ - 流程 F 项目协作:从团队或工作区项目页按 + 新建,只需名称和状态 → 选中工单 Shift P 加入项目,或在项目视图里按 C 直接建 → 项目页看概览、工单和自定义视图标签、里程碑与进度图 → 可多团队共享,但只有一个主导团队决定可用项目状态 [S6] {高}
89
+ - 流程 G 找东西:Cmd/Ctrl K 命令面板模糊搜索 → 用过滤条件做自定义视图 → 复制 URL(或 Cmd/Ctrl Shift C)把过滤后的视图分享给同事 [S17, S8, S3] {高}
90
+
91
+ ## 5. 技术栈线索 Technical stack clues
92
+
93
+ - 公开 API 是 GraphQL,认证支持 OAuth 2.0 和个人 API key;文档覆盖分页、过滤、限流、弃用、webhook、附件 [S9] {高}
94
+ - 官方提供 TypeScript SDK(强类型模型与操作),以及 CLI 导入器 [S9] {高}
95
+ - 对外提供 MCP 服务器,供 Cursor、Claude、ChatGPT、Windsurf 等 AI 客户端读写数据 [S10, S8] {高}
96
+ - 移动端用原生 Swift 与 Kotlin 编写,不是 WebView 套壳 [S13] {高}
97
+ - 存在桌面应用,部分快捷键和创建命令为桌面端专有 [S8] {高}
98
+ - 招聘页把"构建同步引擎"列为团队公开分享的工程主题,说明客户端与服务端之间有实时同步层 [S12] {中}
99
+ - 工单与项目描述、文档统一使用 Markdown [S6, S17] {高}
100
+ - 传输强制 HTTPS + TLS 1.2,静态数据 AES-256 加密;创建工作区时可选数据放在欧盟或美国 [S11] {高}
101
+ - 登录方式:Google SSO、邮箱验证码、Passkeys;SAML/SCIM 仅企业版 [S11, S2] {高}
102
+ - 支持通过 URL 查询参数预填新建工单(标题、团队、状态、优先级等) [S17, S9] {高}
103
+ - webhook 出口 IP 公布在站点的 .well-known 路径下 [S8] {高}
104
+ - 工单描述有版本历史并可回滚;文档支持作者归属标识 [S17, S8] {高}
105
+ - 在招岗位以全栈/产品工程师、移动端设计师、AI 产品工程师为主,公司全远程 [S12] {中}
106
+
107
+ ## 6. 定价与商业模式 Pricing and business model
108
+
109
+ | Plan | Price | What it unlocks | Sources | Confidence |
110
+ |---|---|---|---|---|
111
+ | Free | 0 美元 | 无限成员、2 个团队、250 条工单、10MB 文件上传、Agent 平台 | S2 | 高 |
112
+ | Basic | 每人每月 10 美元(年付) | 5 个团队、无限工单、无限上传、管理员角色 | S2 | 高 |
113
+ | Business | 每人每月 16 美元(年付) | 无限团队、私有团队与访客、分诊智能、Loops、代码智能、Insights、Asks、Zendesk/Intercom 集成 | S2 | 高 |
114
+ | Enterprise | 定制价,仅年付 | 发票/PO 付款、SAML 与 SCIM、细粒度管理、高级安全、组织建模、迁移与优先支持、客户经理 | S2 | 高 |
115
+
116
+ - 按席位计费,团队数量是各档的主要门槛:2 / 5 / 无限 / 无限 [S2, S5] {高}
117
+ - AI 相关功能(编码会话、Loops)在订阅之外另按 AI 额度计费,管理员可查看用量并设上限 [S2, S8] {高}
118
+ - 私有团队、团队级项目状态与项目标签、分诊自动化都从 Business 起 [S5, S6, S7] {高}
119
+ - 引导式代码审查在 2026 年 10 月下放到了 Basic 档 [S8] {高}
120
+ - 官网宣称超过 4 万家公司/产品团队在用 [S1, S2] {高}
121
+
122
+ ## 7. 集成与生态 Integrations and ecosystem
123
+
124
+ - 集成目录按用途分类:基础、Agent、AI 客户端、工程、缺陷上报、自动化、客户体验、安全合规、分析、协作、媒体设计 [S10] {高}
125
+ - 官方自建集成:GitHub、GitLab、Slack、Figma、Intercom、Zendesk、Front、Notion、Google Sheets、Zapier、Jira 迁移、邮件建单 [S10] {高}
126
+ - 编码 agent 可直接领取工单:Codex、Cursor、GitHub Copilot、Devin、Factory、Sentry [S10] {高}
127
+ - GitHub 集成覆盖 PR 自动化、在 Linear 内审代码、工单同步;状态流可配 git 自动化与分支命名 [S10, S5] {高}
128
+ - 分诊责任轮值可接 PagerDuty、OpsGenie、Rootly、incident.io 的排班 [S7] {高}
129
+ - 周期可订阅为日历(Google Calendar 或 .ics) [S16] {高}
130
+ - 数据进出:CSV 导出团队工单、从 Jira/GitHub 导入、工作区迁移、Airbyte/Fivetran 同步 [S5, S8, S10, S9] {高}
131
+ - 开发者入口:GraphQL API、webhook、TypeScript SDK、OAuth 应用、Agent 交互指南 [S9] {高}
132
+ - 移动端 iOS/Android 原生应用,支持实时推送与自定义通知时段 [S13] {高}
133
+
134
+ ## 8. 空白与差异化机会 Gaps and differentiation opportunities
135
+
136
+ - 免费版封顶 250 条工单、2 个团队 [S2] {高};一个活跃的十人软件团队几个月就会触顶,被迫付费 {推测}
137
+ - 近 12 个月的更新几乎都在 AI agent、编码会话、Loops���diffs 和企业管控 [S8] {高};产品重心已经偏向大组织和 AI 工作流,对只想要干净工单的小团队是噪音 {推测}
138
+ - 定价页上大部分高级能力(分诊智能、洞察、Asks、私有团队)都从 Business 起 [S2] {高};十人团队用不上,却要为整套系统的复杂度买单 {推测}
139
+ - 官方自己建议小团队全员一个团队最简单 [S5] {高};所以我们的 v1 可以直接把"一个工作区 = 一个团队"写死,省掉整层团队管理 {推测}
140
+ - 项目文档承认"持续性工作"没有好方案,只能靠无目标日期的项目或自定义状态绕 [S6] {高};轻量版可以给"长期事务"一个明确归属 {推测}
141
+ - 周期一次只能看一个团队 [S5] {高};单团队产品天然没有这个问题 {推测}
142
+ - 临时草稿只存本机,登出即丢 [S17] {高}
143
+ - 数据存放只能选欧盟或美国 [S11] {高};自托管或境内部署是留白,小团队可以用一个容器自己跑 {推测}
144
+ - 移动端是独立原生应用 [S13] {高};我们 v1 用响应式网页即可,不做原生 {推测}
145
+ - 状态流配置页公开文档取不到(404) [S8] {中};我们的状态类别只能从概念页和周期页侧面推断,v1 用固定五类状态即可 {推测}
146
+ - 快捷键体系是它的核心体验,但散落在各个文档页 [S17, S7, S6] {高};我们可以把快捷键表当作一等公民,在产品内一处可查 {推测}
147
+
148
+ ## 9. MVP 切分 MVP cut
149
+
150
+ **Users and the one job:** 一个十人软件团队,一个工作区就是一个团队;唯一要做好的事:不碰鼠标也能快速录入、推进、按周期规划工单。
151
+
152
+ **Objects 对象 (<= 5):** 成员(User)、工单(Issue)、项目(Project)、周期(Cycle)、评论(Comment)
153
+
154
+ **Screens 界面 (<= 7):** 登录页、工单列表(按状态分组)、工单详情(含评论)、新建工单弹窗(C 触发)、项目页(列表加单个项目的工单与进度)、周期页(当前/下一/历史)、设置页(团队名与成员邀请)
155
+
156
+ **Dropped from v1 and why:** 多团队与子团队(单团队写死,省掉整层管理);倡议、里程碑(十人团队用项目就够);分诊、模板、邮件建单、周期性工单(都是进件流程,v1 先由成员自己建单);草稿、描述历史、父子工单、估点(好用但可分离,v2 再加);GitHub/Slack 等任何第三方集成(v1 不做集成);AI、代码审查、Loops、洞察、仪表盘(不是轻量工单工具的事);私有团队、访客、SAML、SCIM、审计(企业功能,用户明确不要);原生移动端(响应式网页替代)。状态固定为五类:待办、未开始、进行中、已完成、已取消,不做自定义状态流;标签做成工单上的简单文本标签,不单独建对象;认证只用邮箱加密码;部署目标只有一个:一个 Docker 容器(Web 服务 + SQLite)跑在一台服务器上。
157
+
158
+ **Build order (each step ends in something the user can click):**
159
+ 1. 脚手架 + 邮箱密码登录 + 初始化单团队:登录后能看到一个空的工单列表和侧边栏。
160
+ 2. 工单主循环:按 C 弹出新建窗(标题必填)、列表按状态分组、j/k 上下移动、Enter 打开详情、详情页内联改标题和描述;工单编号为"团队标识-序号"。
161
+ 3. 工单属性与快捷键:状态五类、优先级四档、负责人、文本标签;在列表或详情里用单键改状态/优先级/负责人;Cmd/Ctrl K 命令面板可搜索工单和执行这些动作;产品内有一页快捷键表。
162
+ 4. 评论:详情页下方评论线程,支持 @ 提及成员。
163
+ 5. 项目:新建项目只需名称和状态;选中工单按 Shift P 加入项目;项目页显示该项目的工单和完成比例。
164
+ 6. 周期:设置里开启周期(选时长 1–4 周和起始星期),自动生成当前与下一个周期;工单可放入周期;周期到期时未完成的工单自动滚入下一个周期。
165
+ 7. 设置与上线:邀请成员(生成邀请链接)、改团队名与标识;打包为一个 Docker 容器部署到一台服务器,用 HTTPS 访问。
166
+
167
+ **Acceptance (v1 is done when):**
168
+ 1. 用户做:用邮箱和密码登录 → 应看到:团队的工单列表 → 机器验:登录后请求工单列表返回 200 且条数等于种子数据。
169
+ 2. 用户做:全程不用鼠标,按 C 新建、j/k 选中、Enter 打开、快捷键改为已完成 → 应看到:这条工单出现在「已完成」 → 机器验:该工单 status 字段为 done,且过程中没有鼠标事件。
170
+ 3. 用户做:在一条工单下留评论并 @ 另一名成员 → 应看到:对方刷新后看到评论 → 机器验:评论记录含被 @ 成员的 id。
171
+ 4. 用户做:新建一个项目,加入三条工单,完成其中一条 → 应看到:项目页显示 1/3 → 机器验:完成比例字段等于 0.333。
172
+ 5. 用户做:开启两周一轮的周期,放入工单,让周期到期 → 应看到:未完成的工单出现在下一个周期 → 机器验:到期后未完成工���的 cycle 字段指向下一周期。
173
+
174
+ **Learned vs own 学来的 / 自己定的:**
175
+ - 学来的:工单状态流、键盘优先的新建和导航(C / j / k / Enter)、周期(cycle)到期自动顺延、项目完成比例的概念 [S1][S2]。
176
+ - 自己定的:界面、配色、布局、全部文案、默认快捷键以外的交互、数据库结构、部署方式。
177
+
178
+ ## 10. 我们不会复制的东西 What we will not copy
179
+
180
+ - 原产品的界面外观、布局、配色、图标和字体:我们自己设计一套。
181
+ - 原产品的文案、截图、图片、Logo,以及属于商标的产品名和功能名。
182
+ - 原产品任何仓库或前端包里的代码(本次研究没有涉及任何代码仓库,也没有读取任何打包代码)。
183
+ - 任何不在公开页面上的东西:没有使用账号内页面、抓包、反编译或泄露材料。
184
+
185
+ ## Sources
186
+
187
+ <!-- Generated by `blueprint.py sources <slug>` from sources.json. Do not edit by hand. -->
188
+
189
+ - [S1] Linear – The system for product development — https://linear.app/ (fetched 2026-10-12, sha256 5803e801696a)
190
+ - [S2] Pricing – Linear — https://linear.app/pricing (fetched 2026-10-12, sha256 3a1d210e0b6f)
191
+ - [S3] Concepts – Linear Docs — https://linear.app/docs/conceptual-model (fetched 2026-10-12, sha256 87d1a6f62177)
192
+ - [S4] Start Guide – Linear Docs — https://linear.app/docs/start-guide (fetched 2026-10-12, sha256 bc3a11015a64)
193
+ - [S5] Teams – Linear Docs — https://linear.app/docs/teams (fetched 2026-10-12, sha256 cd981d791929)
194
+ - [S6] Projects – Linear Docs — https://linear.app/docs/projects (fetched 2026-10-12, sha256 7ab8146b84b8)
195
+ - [S7] Triage – Linear Docs — https://linear.app/docs/triage (fetched 2026-10-12, sha256 6e74cfc2f76e)
196
+ - [S8] Changelog – Linear — https://linear.app/changelog (fetched 2026-10-12, sha256 b4be4fc828ce)
197
+ - [S9] Linear Developers — https://linear.app/developers (fetched 2026-10-12, sha256 92d1f388b49b)
198
+ - [S10] Integrations – Linear — https://linear.app/integrations (fetched 2026-10-12, sha256 c507f72b63b9)
199
+ - [S11] Security – Linear — https://linear.app/security (fetched 2026-10-12, sha256 36258ee73036)
200
+ - [S12] We're hiring – Linear — https://linear.app/careers (fetched 2026-10-12, sha256 cc7b06d13369)
201
+ - [S13] Linear Mobile – Available for iOS and Android — https://linear.app/mobile (fetched 2026-10-12, sha256 4d89da62dc27)
202
+ - [S14] Linear Method – Practices for building — https://linear.app/method (fetched 2026-10-12, sha256 185ac408692b)
203
+ - [S15] An AI product system for modern enterprises — https://linear.app/enterprise (fetched 2026-10-12, sha256 f681f9490d60)
204
+ - [S16] Cycles – Linear Docs — https://linear.app/docs/use-cycles (fetched 2026-10-12, sha256 fb01973bd6c9)
205
+ - [S17] Issues – Linear Docs — https://linear.app/docs/creating-issues (fetched 2026-10-12, sha256 f3759e2581fe)
206
+
207
+ Refused or skipped (out of scope by policy, not used):
208
+
209
+ - https://linear.app/docs/configuring-workflows — HTTP 404
plugins-skills/product-study/examples/linear/mvp.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MVP hand-off
2
+
3
+ Product: Linear · Official site: https://linear.app · Studied on: 2026-10-13 · Goal: 十人软件团队的轻量工单工具,键盘优先,不要企业功能
4
+
5
+ Source blueprint: blueprint.md (same folder). Build only what is below; the rest of the blueprint is context, not scope.
6
+
7
+ ## MVP cut
8
+
9
+ **Users and the one job:** 一个十人软件团队,一个工作区就是一个团队;唯一要做好的事:不碰鼠标也能快速录入、推进、按周期规划工单。
10
+
11
+ **Objects 对象 (<= 5):** 成员(User)、工单(Issue)、项目(Project)、周期(Cycle)、评论(Comment)
12
+
13
+ **Screens 界面 (<= 7):** 登录页、工单列表(按状态分组)、工单详情(含评论)、新建工单弹窗(C 触发)、项目页(列表加单个项目的工单与进度)、周期页(当前/下一/历史)、设置页(团队名与成员邀请)
14
+
15
+ **Dropped from v1 and why:** 多团队与子团队(单团队写死,省掉整层管理);倡议、里程碑(十人团队用项目就够);分诊、模板、邮件建单、周期性工单(都是进件流程,v1 先由成员自己建单);草稿、描述历史、父子工单、估点(好用但可分离,v2 再加);GitHub/Slack 等任何第三方集成(v1 不做集成);AI、代码审查、Loops、洞察、仪表盘(不是轻量工单工具的事);私有团队、访客、SAML、SCIM、审计(企业功能,用户明确不要);原生移动端(响应式网页替代)。状态固定为五类:待办、未开始、进行中、已完成、已取消,不做自定义状态流;标签做成工单上的简单文本标签,不单独建对象;认证只用邮箱加密码;部署目标只有一个:一个 Docker 容器(Web 服务 + SQLite)跑在一台服务器上。
16
+
17
+ **Build order (each step ends in something the user can click):**
18
+ 1. 脚手架 + 邮箱密码登录 + 初始化单团队:登录后能看到一个空的工单列表和侧边栏。
19
+ 2. 工单主循环:按 C 弹出新建窗(标题必填)、列表按状态分组、j/k 上下移动、Enter 打开详情、详情页内联改标题和描述;工单编号为"团队标识-序号"。
20
+ 3. 工单属性与快捷键:状态五类、优先级四档、负责人、文本标签;在列表或详情里用单键改状态/优先级/负责人;Cmd/Ctrl K 命令面板可搜索工单和执行这些动作;产品内有一页快捷键表。
21
+ 4. 评论:详情页下方评论线程,支持 @ 提及成员。
22
+ 5. 项目:新建项目只需名称和状态;选中工单按 Shift P 加入项目;项目页显示该项目的工单和完成比例。
23
+ 6. 周期:设置里开启周期(选时长 1–4 周和起始星期),自动生成当前与下一个周期;工单可放入周期;周期到期时未完成的工单自动滚入下一个周期。
24
+ 7. 设置与上线:邀请成员(生成邀请链接)、改团队名与标识;打包为一个 Docker 容器部署到一台服务器,用 HTTPS 访问。
25
+
26
+ **Acceptance (v1 is done when):**
27
+ 1. 用户做:用邮箱和密码登录 → 应看到:团队的工单列表 → 机器验:登录后请求工单列表返回 200 且条数等于种子数据。
28
+ 2. 用户做:全程不用鼠标,按 C 新建、j/k 选中、Enter 打开、快捷键改为已完成 → 应看到:这条工单出现在「已完成」 → 机器验:该工单 status 字段为 done,且过程中没有鼠标事件。
29
+ 3. 用户做:在一条工单下留评论并 @ 另一名成员 → 应看到:对方刷新后看到评论 → 机器验:评论记录含被 @ 成员的 id。
30
+ 4. 用户做:新建一个项目,加入三条工单,完成其中一条 → 应看到:项目页显示 1/3 → 机器验:完成比例字段等于 0.333。
31
+ 5. 用户做:开启两周一轮的周期,放入工单,让周期到期 → 应看到:未完成的工单出现在下一个周期 → 机器验:到期后未完成工单的 cycle 字段指向下一周期。
32
+
33
+ **Learned vs own 学来的 / 自己定的:**
34
+ - 学来的:工单状态流、键盘优先的新建和导航(C / j / k / Enter)、周期(cycle)到期自动顺延、项目完成比例的概念 [S1][S2]。
35
+ - 自己定的:界面、配色、布局、全部文案、默认快捷键以外的交互、数据库结构、部署方式。
36
+
37
+
38
+ ## What we will not copy
39
+
40
+ - 原产品的界面外观、布局、配色、图标和字体:我们自己设计一套。
41
+ - 原产品的文案、截图、图片、Logo,以及属于商标的产品名和功能名。
42
+ - 原产品任何仓库或前端包里的代码(本次研究没有涉及任何代码仓库,也没有读取任何打包代码)。
43
+ - 任何不在公开页面上的东西:没有使用账号内页面、抓包、反编译或泄露材料。
44
+
45
+
46
+ ## Verify
47
+
48
+ Keep the rules (numbers, formulas, state changes) in one block the acceptance runner can load without a browser; tag the learned ones [learned].
49
+ Ship a checks file next to the build (acceptance.js or acceptance.py) that prints one JSON row per machine check; run it with
50
+ `python3 <product-study>/scripts/acceptance_run.py <site_dir>` before go-live and again with `--url <live url>` after. The table it prints is what the user sees.
51
+ The remaining checks are actions the user performs; list them as actions, never as 'tests passed'.
plugins-skills/product-study/examples/linear/sources.json ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "slug": "linear",
3
+ "tool": "fetch_public.py 6.0.0-pre.1",
4
+ "user_agent": "autocode-product-study/6.0.0-pre.1 (+https://github.com/ilang-ai/autocode; public pages only)",
5
+ "policy": "public pages only; robots.txt honored; no login; no captures; no binaries",
6
+ "sources": [
7
+ {
8
+ "url": "https://linear.app/",
9
+ "fetched_at": "2026-10-12T17:46:19Z",
10
+ "final_url": "https://linear.app/",
11
+ "status": "ok",
12
+ "kind": "html",
13
+ "title": "Linear – The system for product development",
14
+ "description": "Purpose-built for planning and building products with AI agents.",
15
+ "bytes": 1258854,
16
+ "sha256": "5803e801696a7129c615be05b9de7df5c4410d09eb5a496c923728dd191406a4",
17
+ "id": "S1",
18
+ "file": "sources/S1.txt"
19
+ },
20
+ {
21
+ "url": "https://linear.app/pricing",
22
+ "fetched_at": "2026-10-12T17:46:20Z",
23
+ "final_url": "https://linear.app/pricing",
24
+ "status": "ok",
25
+ "kind": "html",
26
+ "title": "Pricing – Linear",
27
+ "description": "Use Linear for free with your whole team. Upgrade to enable unlimited issues, enhanced security controls, and additional features.",
28
+ "bytes": 804636,
29
+ "sha256": "3a1d210e0b6f7ff5d9912f121125e9929a900a61722a7868e16193b8879c1d46",
30
+ "id": "S2",
31
+ "file": "sources/S2.txt"
32
+ },
33
+ {
34
+ "url": "https://linear.app/docs/conceptual-model",
35
+ "fetched_at": "2026-10-12T17:46:21Z",
36
+ "final_url": "https://linear.app/docs/conceptual-model",
37
+ "status": "ok",
38
+ "kind": "html",
39
+ "title": "Concepts – Linear Docs",
40
+ "description": "Linear is built around a few core concepts that provide rails for your organization’s work, from a simple bug fix to a company-wide initiative.",
41
+ "bytes": 554173,
42
+ "sha256": "87d1a6f62177668b384b7ec3c679c89c8e0526b26d5db887cbfe358ce83e53c3",
43
+ "id": "S3",
44
+ "file": "sources/S3.txt"
45
+ },
46
+ {
47
+ "url": "https://linear.app/docs/start-guide",
48
+ "fetched_at": "2026-10-12T17:46:22Z",
49
+ "final_url": "https://linear.app/docs/start-guide",
50
+ "status": "ok",
51
+ "kind": "html",
52
+ "title": "Start Guide – Linear Docs",
53
+ "description": "Linear is the product development system for teams and agents. This guide helps you move quickly from new workspace to getting work done.",
54
+ "bytes": 508221,
55
+ "sha256": "bc3a11015a64aa7c9a69164ee0b16f483cc7e3388f6ef15674e8cd43bb922044",
56
+ "id": "S4",
57
+ "file": "sources/S4.txt"
58
+ },
59
+ {
60
+ "url": "https://linear.app/docs/teams",
61
+ "fetched_at": "2026-10-12T17:46:23Z",
62
+ "final_url": "https://linear.app/docs/teams",
63
+ "status": "ok",
64
+ "kind": "html",
65
+ "title": "Teams – Linear Docs",
66
+ "description": "Create teams in your workspace to organize different types of work functions.",
67
+ "bytes": 631896,
68
+ "sha256": "cd981d7919291dc74d43ed62acd8bcffd2e95cb91883d02fdc8b0d46fb9a3cbf",
69
+ "id": "S5",
70
+ "file": "sources/S5.txt"
71
+ },
72
+ {
73
+ "url": "https://linear.app/docs/projects",
74
+ "fetched_at": "2026-10-12T17:46:24Z",
75
+ "final_url": "https://linear.app/docs/projects",
76
+ "status": "ok",
77
+ "kind": "html",
78
+ "title": "Projects – Linear Docs",
79
+ "description": "Create Projects for features or large units of work.",
80
+ "bytes": 606918,
81
+ "sha256": "7ab8146b84b815da065899a91377364d50bfb9778fb2acbf28da229f85ebfb66",
82
+ "id": "S6",
83
+ "file": "sources/S6.txt"
84
+ },
85
+ {
86
+ "url": "https://linear.app/docs/triage",
87
+ "fetched_at": "2026-10-12T17:46:26Z",
88
+ "final_url": "https://linear.app/docs/triage",
89
+ "status": "ok",
90
+ "kind": "html",
91
+ "title": "Triage – Linear Docs",
92
+ "description": "Manage issues created by other teams and customer support integrations.",
93
+ "bytes": 572774,
94
+ "sha256": "6e74cfc2f76e29edc64afb60ac3c80e594f228d488e91213226a6e0bd1f901d4",
95
+ "id": "S7",
96
+ "file": "sources/S7.txt"
97
+ },
98
+ {
99
+ "url": "https://linear.app/changelog",
100
+ "fetched_at": "2026-10-12T17:46:27Z",
101
+ "final_url": "https://linear.app/changelog",
102
+ "status": "ok",
103
+ "kind": "html",
104
+ "title": "Changelog – Linear",
105
+ "description": "New updates and improvements to Linear.",
106
+ "bytes": 1528215,
107
+ "sha256": "b4be4fc828ce27162c3fef69cca831414564020a4fe085ba5a0d1671ba8ddfef",
108
+ "id": "S8",
109
+ "file": "sources/S8.txt"
110
+ },
111
+ {
112
+ "url": "https://linear.app/developers",
113
+ "fetched_at": "2026-10-12T17:46:28Z",
114
+ "final_url": "https://linear.app/developers",
115
+ "status": "ok",
116
+ "kind": "html",
117
+ "title": "Linear Developers",
118
+ "description": "Learn about building apps and integrations for Linear using the GraphQL API and TypeScript SDK.",
119
+ "bytes": 444111,
120
+ "sha256": "92d1f388b49b198ac40164fa277c04c5f80091e148d91326f204e8b0451b2799",
121
+ "id": "S9",
122
+ "file": "sources/S9.txt"
123
+ },
124
+ {
125
+ "url": "https://linear.app/integrations",
126
+ "fetched_at": "2026-10-12T17:46:29Z",
127
+ "final_url": "https://linear.app/integrations",
128
+ "status": "ok",
129
+ "kind": "html",
130
+ "title": "Integrations – Linear",
131
+ "description": "Enhance your Linear workspace with hand-picked integrations.",
132
+ "bytes": 878182,
133
+ "sha256": "c507f72b63b9b2a11b111a2bcac9fc43c8e2fe6eecc01831c8c6640dbddb890d",
134
+ "id": "S10",
135
+ "file": "sources/S10.txt"
136
+ },
137
+ {
138
+ "url": "https://linear.app/security",
139
+ "fetched_at": "2026-10-12T17:46:30Z",
140
+ "final_url": "https://linear.app/security",
141
+ "status": "ok",
142
+ "kind": "html",
143
+ "title": "Security – Linear",
144
+ "description": "Everything in Linear is designed to keep your work safe and secure. Because your business is nobody else’s business.",
145
+ "bytes": 624919,
146
+ "sha256": "36258ee730368157eb6234923d6890753df3e75a49fa380fb0e54af61a897268",
147
+ "id": "S11",
148
+ "file": "sources/S11.txt"
149
+ },
150
+ {
151
+ "url": "https://linear.app/careers",
152
+ "fetched_at": "2026-10-12T17:46:31Z",
153
+ "final_url": "https://linear.app/careers",
154
+ "status": "ok",
155
+ "kind": "html",
156
+ "title": "We're hiring – Linear",
157
+ "description": "We are crafting the tool for teams who care about quality. Join us on our mission!",
158
+ "bytes": 449870,
159
+ "sha256": "cc7b06d1336935f0e1acc8911e5597965670db3a450f8f3cd7c9cfe5386e3420",
160
+ "id": "S12",
161
+ "file": "sources/S12.txt"
162
+ },
163
+ {
164
+ "url": "https://linear.app/mobile",
165
+ "fetched_at": "2026-10-12T17:46:32Z",
166
+ "final_url": "https://linear.app/mobile",
167
+ "status": "ok",
168
+ "kind": "html",
169
+ "title": "Linear Mobile – Available for iOS and Android",
170
+ "description": "Move product work forward, no matter where you are. Available for iOS and Android.",
171
+ "bytes": 590023,
172
+ "sha256": "4d89da62dc27cf9017ff7fb02fb2c9d77dfbc070e22ac04ed3833047569df76f",
173
+ "id": "S13",
174
+ "file": "sources/S13.txt"
175
+ },
176
+ {
177
+ "url": "https://linear.app/method",
178
+ "fetched_at": "2026-10-12T17:46:33Z",
179
+ "final_url": "https://linear.app/method",
180
+ "status": "ok",
181
+ "kind": "html",
182
+ "title": "Linear Method – Practices for building",
183
+ "description": "The quality of a product is driven by both the talent of its creators and how they feel while they’re crafting it. To bring back the right focus, these are the foundational and evolving ideas Linear is built on.",
184
+ "bytes": 397175,
185
+ "sha256": "185ac408692bae12e812e651f4ebec06a0c3167f6fb7b0cc5253cb57dd88b839",
186
+ "id": "S14",
187
+ "file": "sources/S14.txt"
188
+ },
189
+ {
190
+ "url": "https://linear.app/enterprise",
191
+ "fetched_at": "2026-10-12T17:46:34Z",
192
+ "final_url": "https://linear.app/enterprise",
193
+ "status": "ok",
194
+ "kind": "html",
195
+ "title": "An AI product system for modern enterprises",
196
+ "description": "Linear gives teams and agents shared context for planning and building products at scale.",
197
+ "bytes": 898174,
198
+ "sha256": "f681f9490d60faf1968e4a8af5d56ea5947f99abe2a2da75828b0f280a1a6367",
199
+ "id": "S15",
200
+ "file": "sources/S15.txt"
201
+ },
202
+ {
203
+ "url": "https://linear.app/docs/use-cycles",
204
+ "fetched_at": "2026-10-12T17:47:03Z",
205
+ "final_url": "https://linear.app/docs/use-cycles",
206
+ "status": "ok",
207
+ "kind": "html",
208
+ "title": "Cycles – Linear Docs",
209
+ "description": "Cycles are a practice to keep up your team's momentum, similar to commonly used agile-flavored sprints.",
210
+ "bytes": 595968,
211
+ "sha256": "fb01973bd6c9d3f9347e726431d94aaed35db6445a80c8e78ab3b3c33d9850e8",
212
+ "id": "S16",
213
+ "file": "sources/S16.txt"
214
+ },
215
+ {
216
+ "url": "https://linear.app/docs/creating-issues",
217
+ "fetched_at": "2026-10-12T17:47:04Z",
218
+ "final_url": "https://linear.app/docs/creating-issues",
219
+ "status": "ok",
220
+ "kind": "html",
221
+ "title": "Issues – Linear Docs",
222
+ "description": "Issues are the core unit of work and can represent anything a team needs to track, like bugs, feature work, follow-up tasks, or internal requests.",
223
+ "bytes": 685017,
224
+ "sha256": "f3759e2581fe18ac4f822f6d269b61b608a2ff1333602cb3ad29318147decdfd",
225
+ "id": "S17",
226
+ "file": "sources/S17.txt"
227
+ }
228
+ ],
229
+ "skipped": [
230
+ {
231
+ "url": "https://linear.app/docs/configuring-workflows",
232
+ "fetched_at": "2026-10-12T17:46:25Z",
233
+ "status": "skipped",
234
+ "reason": "HTTP 404"
235
+ }
236
+ ]
237
+ }
plugins-skills/product-study/references/blueprint-template.md ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Product blueprint: TODO product name
2
+
3
+ <!--
4
+ Write the body in the user's language. Keep the numbered headings exactly as
5
+ they are (the number is what `blueprint.py check` keys on; the words after it
6
+ may be translated). Delete every HTML comment and every TODO before `check`.
7
+
8
+ Claim lines: in sections 1-8 every bullet and every table row is a claim and
9
+ must end with a source tag and a confidence tag, for example
10
+ - Issues can be grouped into cycles of fixed length [S12] {high}
11
+ | Workspace -> Team -> Project -> Issue | S12, S13 | high |
12
+ Confidence: {high} = stated verbatim by an official page; {medium} = official
13
+ page implies it, or a credible third party states it; {guess} = your inference,
14
+ no page says it. {guess} lines may omit the source tag; the others may not.
15
+ Chinese tags {高} {中} {推测} are accepted too.
16
+ -->
17
+
18
+ Product: TODO name · Official site: TODO url · Studied on: TODO date · Goal: TODO one sentence on what the user wants to build and for whom
19
+
20
+ Reading guide: this blueprint describes **structure** (what the product does, how its objects relate, what its users go through), gathered only from public pages listed under Sources. It is a map for building your own product. It does not carry the original's interface, copy, images or brand, and nothing in it is copied from a non-public source.
21
+
22
+ ## 0. Summary
23
+
24
+ <!-- one paragraph: what it is, who it is for, the one thing it does best, the pricing shape. Plain words, no claims that are not in a source. -->
25
+
26
+ TODO
27
+
28
+ ## 1. Feature inventory
29
+
30
+ <!-- Every feature you can establish from the sources. Tier: core = the product is unusable without it; plus = valuable but separable; drop = you would not build it in your version. Group by area if there are more than ~15. -->
31
+
32
+ | Feature | What it does (one line) | Tier | Sources | Confidence |
33
+ |---|---|---|---|---|
34
+ | TODO | TODO | core | S1 | high |
35
+
36
+ ## 2. Information architecture
37
+
38
+ <!-- The nesting of containers and navigation as the user sees it (Workspace > Team > Project > Issue; sidebar sections; top-level pages). Bullets or a short tree in a code block. -->
39
+
40
+ - TODO [S1] {high}
41
+
42
+ ## 3. Core objects and data model (inferred)
43
+
44
+ <!-- Entities, their key fields, and relations. Most of this is inference from docs and screenshots, so expect {guess} and {medium}. Mark 1:N / N:M. -->
45
+
46
+ | Object | Key fields | Relations | Sources | Confidence |
47
+ |---|---|---|---|---|
48
+ | TODO | TODO | TODO | S1 | medium |
49
+
50
+ ## 4. Key user flows
51
+
52
+ <!-- 3 to 6 flows that define the product (onboarding, the main create/edit loop, collaboration, reporting). Numbered steps; each flow is one bullet with sub-steps or a short list. -->
53
+
54
+ - Flow A: TODO -> TODO -> TODO [S1] {medium}
55
+
56
+ ## 5. Technical stack clues
57
+
58
+ <!-- Only what public pages say: API style (REST/GraphQL), SDKs, webhooks, auth model, platforms, job postings naming languages/frameworks, open-source repo languages. No guessing from bundle names or network traffic: that is out of scope. -->
59
+
60
+ - TODO [S1] {high}
61
+
62
+ ## 6. Pricing and business model
63
+
64
+ <!-- Plans, what gates each plan, free tier limits, per-seat vs usage, enterprise extras. -->
65
+
66
+ | Plan | Price | What it unlocks | Sources | Confidence |
67
+ |---|---|---|---|---|
68
+ | TODO | TODO | TODO | S1 | high |
69
+
70
+ ## 7. Integrations and ecosystem
71
+
72
+ <!-- Native integrations, public API, import/export, marketplace, CLI, mobile/desktop apps. -->
73
+
74
+ - TODO [S1] {high}
75
+
76
+ ## 8. Gaps and differentiation opportunities
77
+
78
+ <!-- Where public reviews, comparison pages, roadmap or the docs themselves show a hole, a complaint, a market the product does not serve. This is where your product gets its reason to exist. Inference is fine, tag it {guess}. -->
79
+
80
+ - TODO {guess}
81
+
82
+ ## 9. MVP cut
83
+
84
+ <!--
85
+ The hand-off to the build phase. Only the core tier survives, sized for what an AI agent can build and deploy in one session:
86
+ at most 5 core objects, at most 7 screens, no third-party integrations in v1, one auth method, one deployment target.
87
+ Each line is a decision, not a claim: no source tags needed. Keep the user's goal from the header in view; the MVP serves their users, not the original's.
88
+ Keep the bold labels starting with the English words Objects / Screens / Acceptance / Learned (add a translation after them if you write in another language):
89
+ the gate finds them by those words. List items separated by commas or 、; a comma inside parentheses does not split an item.
90
+ -->
91
+
92
+ **Users and the one job:** TODO who uses v1 and the single job it must do
93
+
94
+ **Objects (<= 5):** TODO
95
+
96
+ **Screens (<= 7):** TODO
97
+
98
+ **Dropped from v1 and why:** TODO
99
+
100
+ **Build order (each step ends in something the user can click):**
101
+ 1. TODO
102
+ 2. TODO
103
+ 3. TODO
104
+
105
+ **Acceptance (v1 is done when):** three to five lines, each in three parts separated by `->`: what the user does -> what they should see -> what a machine can check (write `manual` if nothing can)
106
+ 1. TODO user does -> should see -> machine checks
107
+ 2. TODO user does -> should see -> machine checks
108
+ 3. TODO user does -> should see -> machine checks
109
+
110
+ **Learned vs own (学来的 / 自己定的):** TODO the rules and numbers taken from the target, each with its [S#]; one line saying everything else (look, layout, copy, defaults) is our own design
111
+
112
+ ## 10. What we will not copy
113
+
114
+ - Interface look, layout, colors, icons and typography of the original: we design our own.
115
+ - Copy, screenshots, images, logo, product and feature names that are trademarks.
116
+ - Any code from the original's repositories or bundles. (If a studied repository is copyleft, say so here: its architecture informed this blueprint; none of its code is used.)
117
+ - Anything that was not on a public page: no account areas, captures, decompilation or leaked material were used.
118
+
119
+ ## Sources
120
+
121
+ <!-- Generated by `blueprint.py sources <slug>` from sources.json. Do not edit by hand. -->
plugins-skills/product-study/references/boundaries.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Boundaries: what product-study does not do, and what to say instead
2
+
3
+ These are product rules, not a lecture. Each one exists because crossing it
4
+ would make the user's product unsafe to ship or would stop being "their own".
5
+ When a request lands on one of them, answer in one sentence, offer the in-scope
6
+ alternative, and keep working. Never stop the task over a boundary, and never
7
+ explain the rule at length unless asked.
8
+
9
+ ## 1. No reverse engineering
10
+
11
+ Decompiling, unpacking, de-obfuscating, reading minified bundles or source maps
12
+ to recover logic, intercepting traffic, probing APIs, instrumenting the app.
13
+
14
+ Why: it is the part of "learn from a product" that carries legal exposure (terms
15
+ of service, anti-circumvention, trade secrets) and it produces implementation
16
+ details, not structure. A product built from someone's recovered internals is
17
+ not the user's own.
18
+
19
+ Say: *"I work from the public pages; here's what they tell us about how it's built."*
20
+
21
+ ## 2. No account areas
22
+
23
+ Logging in — with the user's credentials or any other — to walk the original's
24
+ interface, export data, or read private docs.
25
+
26
+ Why: account areas are governed by terms the user accepted personally; pages
27
+ there are not public and often contain other people's data.
28
+
29
+ Say: *"I don't use account areas. If you describe what you see in yours, I'll
30
+ use that as a medium-confidence source."* A screenshot the user takes of their
31
+ own account is fine to read for structure.
32
+
33
+ ## 3. No copying of the skin
34
+
35
+ Interface layouts, visual design, colors, icons, typography, copy, screenshots,
36
+ images, logo, product and feature names that are trademarks, slogans.
37
+
38
+ Why: copyright and trade dress live here, and it is also the part that would
39
+ make the user's product look like a knock-off. The structure is the lesson; the
40
+ skin is theirs to design.
41
+
42
+ Say: *"We take the structure and design our own look; section 10 lists what we
43
+ won't copy."* If the user insists on a look-alike, build a clean original design
44
+ that serves the same flows and say in one line why it is not a copy.
45
+
46
+ ## 4. No code transplant
47
+
48
+ Copying code from the original's repositories or bundles into the build.
49
+
50
+ Why: licenses (copyleft in particular) and provenance. A product with one clear
51
+ origin is easier to sell, open-source, or audit later.
52
+
53
+ Say: *"I'll write this part fresh; the repo told us the shape, the code is ours."*
54
+
55
+ ## 5. No non-public material
56
+
57
+ Leaked source, internal documents, beta or partner material, anything the user
58
+ "found" rather than something that was published.
59
+
60
+ Why: using it would taint the whole blueprint — every other source is clean, and
61
+ one bad one makes the document indefensible.
62
+
63
+ Say: *"I'll leave that out and work from the public pages."* Do not read it even
64
+ if it is pasted into the conversation; do not quote from it.
65
+
66
+ ## 6. No bulk or evasive collection
67
+
68
+ Bypassing robots.txt, rate limits or anti-bot checks; scraping user-generated
69
+ content in bulk; fetching with a disguised user agent.
70
+
71
+ Why: the tool identifies itself and asks permission the way a browser-driven
72
+ person would; that is what keeps the "public page" claim true.
73
+
74
+ Say: *"That path is closed to crawlers; I'll use the pages that are open."*
75
+
76
+ ## In-between cases
77
+
78
+ - **The product has no public docs at all.** Build a thin blueprint from the
79
+ homepage, pricing, store listing and reviews; most lines will be `{medium}`
80
+ or `{guess}`; say so in section 0. The MVP cut will lean on the user's goal.
81
+ - **The user is the owner of the original** (rebuilding their own product).
82
+ Their own repositories, docs and accounts are in scope — cite them as such.
83
+ The skin rules still apply if the new product is meant to be a separate brand.
84
+ - **The original is open source under a permissive license and the user wants
85
+ to fork it.** That is a different task (fork and modify), not a study; say so
86
+ and ask which they want.
87
+ - **The user asks for a feature comparison between two products.** In scope;
88
+ study both, one slug each, then compare in the chat or in a third document.
plugins-skills/product-study/references/sources-policy.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sources policy: what counts as public, and what each page is good for
2
+
3
+ The whole value of a blueprint is that every line can be traced to something
4
+ anyone could open. That is what lets the user build on it without worrying, and
5
+ what lets you defend it if asked. So the line is drawn by one question:
6
+ **could a stranger with a browser and no account read this page today?**
7
+ If yes, it is a source. If it took a login, a payment, a tool, or a trick, it is not.
8
+
9
+ ## In scope (tier 1 public material)
10
+
11
+ | Page type | What to pull from it | Typical confidence |
12
+ |---|---|---|
13
+ | Official homepage, feature pages | positioning, headline features, platforms, audience | high for stated features |
14
+ | Pricing / plans | plan ladder, what each gates, seat vs usage, free limits, enterprise extras | high |
15
+ | Docs: concepts / data model / glossary | **object model and nesting** (the single best page for section 2 and 3), terminology | high for structure, medium for fields |
16
+ | Docs: getting started / guides | core flows, defaults, onboarding steps | high for flows |
17
+ | Changelog / release notes | velocity, what they consider important, recent directions, deprecated areas. One fetch of the changelog page is enough (it usually holds the last 3–6 months); read it by date headings, do not paginate past a second page | high for the facts, guess for direction |
18
+ | API / developer docs | API style (REST/GraphQL), auth model, webhooks, SDK languages, rate limits, object schemas | high |
19
+ | Integrations page | ecosystem, which systems they treat as first-class | high |
20
+ | Security / trust page | auth methods (SSO, SCIM), data residency, compliance claims | high |
21
+ | Careers / jobs pages | languages, frameworks, infrastructure named in postings | medium (postings describe teams, not the product) |
22
+ | Mobile / desktop pages, app-store listings | platform coverage, offline, notifications, store description | high |
23
+ | Customer stories, case studies | who uses it and for what, scale claims | medium |
24
+ | Public comparison pages ("X vs Y"), public review sites (G2, Capterra, Product Hunt), tech blogs | complaints, gaps, pricing perception, switching reasons → section 8 | medium for repeated complaints, guess for single voices |
25
+ | Public open-source repository: README, docs folder, LICENSE | architecture, modules, data model, stack | high for structure; note the license in section 10 |
26
+ | Public roadmap, public status page, terms/privacy | planned areas; data handling that shapes the architecture | medium |
27
+
28
+ A screenshot or description the **user** gives you of their own account is also
29
+ a source (tag it `{medium}` and cite it as what the user described): they are
30
+ allowed to look at their own account. It is a source of structure, never of
31
+ interface design or copy.
32
+
33
+ ## Out of scope — the tool refuses these and so do you
34
+
35
+ - Anything behind a login, paywall or invite: account areas, dashboards, admin
36
+ consoles, billing pages, "app." workspaces, private docs.
37
+ - Bypassing robots.txt, rate limits, anti-bot measures, or a site's terms; bulk
38
+ scraping of user-generated content.
39
+ - Reading minified/obfuscated bundles to recover logic, source maps, network
40
+ captures, API probing with made-up credentials, decompiling, unpacking apps.
41
+ (That is the reverse-engineering path; AutoCode does not take it.)
42
+ - Leaked source code, internal documents, beta material, anything the user
43
+ "found" that was not published — even if they paste it into the chat.
44
+ - Non-text files from the original (PDF brochures, videos) are not collected by
45
+ the tool; if a PDF whitepaper is clearly public you may read it yourself and
46
+ cite its URL, but prefer the HTML docs.
47
+
48
+ When a page you need is out of scope, you do not route around it. You note the
49
+ gap in the blueprint (lower confidence, a `{guess}` line, or simply a smaller
50
+ section) and move on. A thin honest blueprint beats a rich invented one.
51
+
52
+ ## Open-source repositories: study, don't transplant
53
+
54
+ Reading a public repository is in scope. Copying its code into the user's
55
+ product is a separate question decided by the license:
56
+
57
+ - MIT, Apache-2.0, BSD: code could be reused with attribution, but the
58
+ blueprint still describes structure; the build writes its own code so the
59
+ user's product has one clear provenance.
60
+ - GPL, AGPL, SSPL, EUPL and other copyleft: **never** copy code into a product
61
+ under a different license. The architecture may inform the blueprint; section
62
+ 10 must say so. The tool prints a NOTE when it detects these.
63
+ - No license file: treat as all-rights-reserved; study only.
64
+
65
+ ## Citation format
66
+
67
+ Sources are numbered in the order they were fetched (`S1`, `S2`, …) and listed
68
+ by `blueprint.py sources` with title, URL, fetch date and content hash. In the
69
+ body, a bullet ends with `[S3]` or `[S3, S7]`; a table row has a `Sources`
70
+ cell with `S3, S7`. Cite the page that actually says it, not the homepage.
71
+
72
+ ## Keeping the record honest
73
+
74
+ - Dates matter: pricing and features change. The fetch date is recorded next
75
+ to each source; the blueprint header carries the study date.
76
+ - If two sources disagree (an old blog post vs. current pricing), prefer the
77
+ official and newer one and say so in the line.
78
+ - Never fill a gap with memory of the product. If you "know" a feature but no
79
+ fetched page shows it, either fetch the page that does or tag it `{guess}`.
plugins-skills/product-study/scripts/acceptance_run.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run a build's acceptance checks and print the table the user sees.
3
+
4
+ python3 acceptance_run.py <site_dir> # against the local build
5
+ python3 acceptance_run.py <site_dir> --url <live> # against the page actually served at the URL
6
+ python3 acceptance_run.py --selftest
7
+
8
+ Convention (the fixed part of S5-verify): next to the build lives a checks file,
9
+ `acceptance.js` (run with node) or `acceptance.py` (run with python3). It receives one
10
+ argument, the path of the HTML to check, and prints one JSON object per line:
11
+
12
+ {"id": "5", "check": "自动加速 1000 次更新后速度", "expected": "7.000", "actual": "7.000", "ok": true}
13
+
14
+ Any other stdout lines are ignored. This script renders the rows as
15
+ check / expected / actual / match, adds a one-line verdict, and exits 1 on any mismatch,
16
+ so go-live can refuse to proceed. With --url it first fetches the live HTML (and waits
17
+ for it to carry the build's rules block, `<script id="rules">`), so what is verified is
18
+ what people will actually open, not the local file. Python 3.8+, standard library.
19
+ """
20
+ import argparse, json, os, subprocess, sys, tempfile, time, urllib.request
21
+
22
+ for _stream in (sys.stdout, sys.stderr): # Windows consoles default to cp1252; the table has CJK and ✓
23
+ try:
24
+ _stream.reconfigure(encoding="utf-8", errors="replace")
25
+ except Exception: # noqa: BLE001
26
+ pass
27
+
28
+
29
+ def width(s):
30
+ return sum(2 if ord(c) > 255 else 1 for c in str(s))
31
+
32
+
33
+ def pad(s, n):
34
+ return str(s) + " " * max(0, n - width(s))
35
+
36
+
37
+ def fetch_live(url, tries=30, wait=10):
38
+ last = ""
39
+ for _ in range(tries):
40
+ try:
41
+ with urllib.request.urlopen(url, timeout=15) as r:
42
+ html = r.read().decode("utf-8", "replace")
43
+ if r.status == 200 and '<script id="rules">' in html:
44
+ return html
45
+ last = "status %s, rules block %s" % (r.status, "present" if '<script id="rules">' in html else "missing")
46
+ except Exception as e: # noqa: BLE001 - any network error is a retry
47
+ last = str(e)
48
+ time.sleep(wait)
49
+ raise SystemExit("live page not ready after %d tries: %s (%s)" % (tries, url, last))
50
+
51
+
52
+ def find_checks(site_dir):
53
+ for name, runner in (("acceptance.js", "node"), ("acceptance.py", sys.executable)):
54
+ p = os.path.join(site_dir, name)
55
+ if os.path.exists(p):
56
+ return p, runner
57
+ return None, None
58
+
59
+
60
+ def run_checks(checks, runner, html_path):
61
+ r = subprocess.run([runner, checks, html_path], capture_output=True, encoding="utf-8", errors="replace")
62
+ rows = []
63
+ for line in (r.stdout or "").splitlines():
64
+ line = line.strip()
65
+ if line.startswith("{"):
66
+ try:
67
+ d = json.loads(line)
68
+ rows.append({"id": str(d.get("id", "")), "check": str(d.get("check", "")), "expected": str(d.get("expected", "")),
69
+ "actual": str(d.get("actual", "")), "ok": bool(d.get("ok"))})
70
+ except ValueError:
71
+ pass
72
+ return rows, r.returncode, (r.stderr or "").strip()
73
+
74
+
75
+ def render(rows, title):
76
+ w = [3, max(10, max((width(r["check"]) for r in rows), default=0) + 2), max(8, max((width(r["expected"]) for r in rows), default=0) + 2),
77
+ max(8, max((width(r["actual"]) for r in rows), default=0) + 2)]
78
+ out = [title, pad("#", w[0]) + pad("检查 check", w[1]) + pad("预期 expected", w[2]) + pad("实际 actual", w[3]) + "结果"]
79
+ for r in rows:
80
+ out.append(pad(r["id"], w[0]) + pad(r["check"], w[1]) + pad(r["expected"], w[2]) + pad(r["actual"], w[3]) + ("✓ 一致" if r["ok"] else "✗ 不一致"))
81
+ bad = sum(1 for r in rows if not r["ok"])
82
+ out.append("")
83
+ out.append("%d/%d 一致 (%d/%d match)%s" % (len(rows) - bad, len(rows), len(rows) - bad, len(rows), "" if not bad else ",%d 项不一致,先修再上线" % bad))
84
+ return "\n".join(out), bad
85
+
86
+
87
+ def main(argv=None):
88
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
89
+ ap.add_argument("site_dir", nargs="?")
90
+ ap.add_argument("--url", help="verify the page served at this URL instead of the local index.html")
91
+ ap.add_argument("--html", default="index.html", help="local file to check (default index.html)")
92
+ ap.add_argument("--selftest", action="store_true")
93
+ a = ap.parse_args(argv)
94
+ if a.selftest:
95
+ return selftest()
96
+ if not a.site_dir:
97
+ ap.print_help()
98
+ return 1
99
+ site = os.path.abspath(a.site_dir)
100
+ checks, runner = find_checks(site)
101
+ if not checks:
102
+ print("no acceptance.js / acceptance.py next to the build in %s — S5-verify has nothing to run; write one before go-live" % site)
103
+ return 2
104
+ if a.url:
105
+ html = fetch_live(a.url)
106
+ fd, html_path = tempfile.mkstemp(suffix=".html"); os.close(fd)
107
+ with open(html_path, "w", encoding="utf-8") as f:
108
+ f.write(html)
109
+ title = "验收 · 线�� %s" % a.url
110
+ else:
111
+ html_path = os.path.join(site, a.html)
112
+ title = "验收 · 本地 %s" % a.html
113
+ try:
114
+ rows, rc, err = run_checks(checks, runner, html_path)
115
+ finally:
116
+ if a.url:
117
+ os.remove(html_path)
118
+ if not rows:
119
+ print("checks file ran (exit %d) but printed no JSON rows%s" % (rc, (": " + err[:300]) if err else ""))
120
+ return 2
121
+ text, bad = render(rows, title)
122
+ print(text)
123
+ return 1 if bad else 0
124
+
125
+
126
+ def selftest():
127
+ """No node, no network: a python checks file against a stub page."""
128
+ d = tempfile.mkdtemp()
129
+ with open(os.path.join(d, "index.html"), "w", encoding="utf-8") as f:
130
+ f.write('<html><script id="rules">var START=6;</script></html>')
131
+ with open(os.path.join(d, "acceptance.py"), "w", encoding="utf-8") as f:
132
+ f.write("import json,sys\nh=open(sys.argv[1],encoding='utf-8').read()\n"
133
+ "print(json.dumps({'id':'1','check':'rules block present','expected':'yes','actual':'yes' if 'id=\"rules\"' in h else 'no','ok':'id=\"rules\"' in h}))\n"
134
+ "print(json.dumps({'id':'2','check':'start speed','expected':'6','actual':'6','ok':True}))\n")
135
+ rows, rc, _ = run_checks(os.path.join(d, "acceptance.py"), sys.executable, os.path.join(d, "index.html"))
136
+ text, bad = render(rows, "selftest")
137
+ ok = len(rows) == 2 and bad == 0 and "2/2" in text
138
+ # a failing row must make the verdict non-zero
139
+ rows2 = rows + [{"id": "3", "check": "x", "expected": "1", "actual": "2", "ok": False}]
140
+ _, bad2 = render(rows2, "selftest")
141
+ ok = ok and bad2 == 1
142
+ print("acceptance_run selftest: %s" % ("ok" if ok else "FAIL"))
143
+ return 0 if ok else 1
144
+
145
+
146
+ if __name__ == "__main__":
147
+ sys.exit(main())
plugins-skills/product-study/scripts/blueprint.py ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """AutoCode product-study: create, source-link and gate a product blueprint.
4
+
5
+ Standard library only (Python 3.8+). Works on <root>/<slug>/blueprint.md next
6
+ to the sources.json that fetch_public.py produced.
7
+
8
+ Usage:
9
+ blueprint.py init <slug> --product NAME [--site URL] [--goal TEXT] [--root DIR] [--force]
10
+ Copy references/blueprint-template.md into place with the header filled in,
11
+ then append the Sources section from sources.json.
12
+ blueprint.py sources <slug> [--root DIR]
13
+ Regenerate the "## Sources" section from sources.json (run after fetching more).
14
+ blueprint.py check <slug> [--root DIR]
15
+ Gate: every claim carries a source and a confidence tag, sources exist, no
16
+ placeholders, no copied sentences, no asset links or long code blocks, MVP
17
+ cut within size. Exit 0 = pass, 1 = fail. Prints one line per check.
18
+ blueprint.py mvp <slug> [--root DIR]
19
+ Extract the MVP cut (sections 9 and 10 + header) into mvp.md: the hand-off
20
+ to the build phase. Refuses while section 9 still has TODO.
21
+ """
22
+ import argparse
23
+ import datetime
24
+ import json
25
+ import os
26
+ import re
27
+ import sys
28
+
29
+ DEFAULT_ROOT = os.path.join(".autocode", "study")
30
+ HERE = os.path.dirname(os.path.abspath(__file__))
31
+ TEMPLATE = os.path.join(HERE, "..", "references", "blueprint-template.md")
32
+
33
+ CONF_WORDS = {"high": "high", "medium": "medium", "guess": "guess", "高": "high", "中": "medium", "推测": "guess"}
34
+ CONF_RE = re.compile(r"\{(high|medium|guess|高|中|推测)\}")
35
+ REF_BRACKET_RE = re.compile(r"\[((?:\s*S\d+\s*[,,;;]?\s*)+)\]")
36
+ REF_CELL_RE = re.compile(r"^(?:\s*S\d+\s*[,,;;]?\s*)+$")
37
+ S_RE = re.compile(r"S(\d+)")
38
+ IMAGE_RE = re.compile(r"https?://\S+\.(png|jpe?g|gif|svg|webp|ico)(\?\S*)?", re.I)
39
+ LOGO_RE = re.compile(r"https?://\S*logo\S*", re.I)
40
+ CJK_RE = re.compile(r"[぀-ヿ㐀-䶿一-鿿가-힯]")
41
+ CLAIM_SECTIONS = set(range(1, 9))
42
+ MAX_OBJECTS, MAX_SCREENS, MAX_CODE_LINES = 5, 7, 15
43
+
44
+
45
+ def paths(slug, root):
46
+ d = os.path.join(root, slug)
47
+ return d, os.path.join(d, "blueprint.md"), os.path.join(d, "sources.json"), os.path.join(d, "mvp.md")
48
+
49
+
50
+ def load_sources(index_path):
51
+ if not os.path.exists(index_path):
52
+ return None
53
+ with open(index_path, encoding="utf-8") as f:
54
+ return json.load(f)
55
+
56
+
57
+ def sources_section(index, study_dir):
58
+ lines = ["## Sources", "", "<!-- Generated by `blueprint.py sources <slug>` from sources.json. Do not edit by hand. -->", ""]
59
+ if not index or not index.get("sources"):
60
+ lines.append("- (no sources collected yet: run fetch_public.py first)")
61
+ for s in (index or {}).get("sources", []):
62
+ day = (s.get("fetched_at") or "")[:10]
63
+ extra = " · license %s" % s["license"] if s.get("license") else ""
64
+ lines.append("- [%s] %s — %s (fetched %s, sha256 %s%s)" % (s["id"], s.get("title") or "", s.get("url"), day, (s.get("sha256") or "")[:12], extra))
65
+ skipped = (index or {}).get("skipped", [])
66
+ if skipped:
67
+ lines += ["", "Refused or skipped (out of scope by policy, not used):", ""]
68
+ for s in skipped:
69
+ lines.append("- %s — %s" % (s.get("url"), s.get("reason")))
70
+ lines.append("")
71
+ return "\n".join(lines)
72
+
73
+
74
+ def replace_sources(text, section):
75
+ m = re.search(r"^## Sources\b.*", text, re.M | re.S)
76
+ body = text[: m.start()] if m else text.rstrip() + "\n\n"
77
+ return body.rstrip() + "\n\n" + section
78
+
79
+
80
+ def cmd_init(args):
81
+ study_dir, bp, idx, _ = paths(args.slug, args.root)
82
+ os.makedirs(study_dir, exist_ok=True)
83
+ if os.path.exists(bp) and not args.force:
84
+ print("%s exists; use --force to overwrite" % bp)
85
+ return 1
86
+ if not os.path.exists(TEMPLATE):
87
+ print("template missing: %s" % TEMPLATE)
88
+ return 1
89
+ with open(TEMPLATE, encoding="utf-8") as f:
90
+ text = f.read()
91
+ today = datetime.datetime.now(datetime.timezone.utc).date().isoformat() # UTC, same clock as fetch stamps
92
+ text = text.replace("# Product blueprint: TODO product name", "# Product blueprint: %s" % args.product, 1)
93
+ header = "Product: %s · Official site: %s · Studied on: %s · Goal: %s" % (
94
+ args.product, args.site or "TODO url", today, args.goal or "TODO one sentence on what the user wants to build and for whom")
95
+ text = re.sub(r"^Product: TODO name .*$", lambda m: header, text, count=1, flags=re.M)
96
+ text = replace_sources(text, sources_section(load_sources(idx), study_dir))
97
+ with open(bp, "w", encoding="utf-8") as f:
98
+ f.write(text)
99
+ print("created %s" % bp)
100
+ return 0
101
+
102
+
103
+ def cmd_sources(args):
104
+ study_dir, bp, idx, _ = paths(args.slug, args.root)
105
+ if not os.path.exists(bp):
106
+ print("no blueprint yet: run init first")
107
+ return 1
108
+ with open(bp, encoding="utf-8") as f:
109
+ text = f.read()
110
+ text = replace_sources(text, sources_section(load_sources(idx), study_dir))
111
+ with open(bp, "w", encoding="utf-8") as f:
112
+ f.write(text)
113
+ print("sources section refreshed in %s" % bp)
114
+ return 0
115
+
116
+
117
+ # ---------------------------------------------------------------- check
118
+
119
+ def strip_comments(text):
120
+ return re.sub(r"<!--.*?-->", "", text, flags=re.S)
121
+
122
+
123
+ def split_sections(text):
124
+ """Return list of (section_key, [lines]); key is int for numbered, 'sources', or 'head'."""
125
+ sections, key, buf = [], "head", []
126
+ for line in text.splitlines():
127
+ m = re.match(r"^## (\d+)\.", line)
128
+ if m:
129
+ sections.append((key, buf))
130
+ key, buf = int(m.group(1)), []
131
+ continue
132
+ if re.match(r"^## Sources\b", line):
133
+ sections.append((key, buf))
134
+ key, buf = "sources", []
135
+ continue
136
+ buf.append(line)
137
+ sections.append((key, buf))
138
+ return sections
139
+
140
+
141
+ def claim_lines(lines):
142
+ """Bullets and table body rows. Yields (line_no, line, is_table_row)."""
143
+ out = []
144
+ for i, line in enumerate(lines):
145
+ s = line.strip()
146
+ if re.match(r"^[-*] ", s):
147
+ out.append((i, s, False))
148
+ elif s.startswith("|"):
149
+ if re.match(r"^\|\s*:?-{2,}", s):
150
+ continue # separator
151
+ nxt = lines[i + 1].strip() if i + 1 < len(lines) else ""
152
+ if re.match(r"^\|\s*:?-{2,}", nxt):
153
+ continue # header row
154
+ out.append((i, s, True))
155
+ return out
156
+
157
+
158
+ def normalize(s):
159
+ s = re.sub(r"^\s*(?:[-*]|\d+\.)\s+", "", s)
160
+ s = re.sub(r"\{[^}]*\}|\[[^\]]*\]", " ", s)
161
+ s = re.sub(r"[|*_`>#]", " ", s)
162
+ return " ".join(s.lower().split())
163
+
164
+
165
+ def copied_from(body, src_norm):
166
+ """True when a long enough run of the claim appears verbatim in the sources.
167
+ Latin text: any 12-word window; CJK-heavy text: any 25-character window."""
168
+ if not src_norm:
169
+ return False
170
+ cjk = len(CJK_RE.findall(body)) > 0.3 * max(1, len(body))
171
+ if cjk:
172
+ compact = body.replace(" ", "")
173
+ src = src_norm.replace(" ", "")
174
+ if len(compact) < 25:
175
+ return False
176
+ return any(compact[i:i + 25] in src for i in range(0, len(compact) - 24, 5))
177
+ words = body.split()
178
+ if len(words) < 12:
179
+ return False
180
+ return any(" ".join(words[i:i + 12]) in src_norm for i in range(0, len(words) - 11))
181
+
182
+
183
+ def parse_claim(line, is_table):
184
+ conf, refs = None, set()
185
+ m = CONF_RE.search(line)
186
+ if m:
187
+ conf = CONF_WORDS[m.group(1)]
188
+ if is_table:
189
+ cells = [c.strip() for c in line.strip("|").split("|")]
190
+ for c in cells:
191
+ bare = c.strip("{}").strip()
192
+ if bare in CONF_WORDS and conf is None:
193
+ conf = CONF_WORDS[bare]
194
+ if REF_CELL_RE.match(c):
195
+ refs.update("S" + n for n in S_RE.findall(c))
196
+ for grp in REF_BRACKET_RE.findall(line):
197
+ refs.update("S" + n for n in S_RE.findall(grp))
198
+ return conf, refs
199
+
200
+
201
+ def cmd_check(args):
202
+ study_dir, bp, idx, _ = paths(args.slug, args.root)
203
+ fails, oks = [], []
204
+
205
+ def check(name, cond, detail=""):
206
+ (oks if cond else fails).append(name + ("" if cond else " " + str(detail)[:300]))
207
+ print(("ok " if cond else "FAIL ") + name + ("" if cond else " " + str(detail)[:300]))
208
+
209
+ if not os.path.exists(bp):
210
+ print("FAIL blueprint missing: %s" % bp)
211
+ return 1
212
+ with open(bp, encoding="utf-8") as f:
213
+ raw = f.read()
214
+ index = load_sources(idx)
215
+ known = {s["id"] for s in (index or {}).get("sources", [])}
216
+ check("sources.json present with at least one source", bool(known), "run fetch_public.py first")
217
+ text = strip_comments(raw)
218
+ sections = split_sections(text)
219
+ keys = [k for k, _ in sections]
220
+ for n in range(0, 11):
221
+ check("section %d present" % n, n in keys)
222
+ check("Sources section present", "sources" in keys)
223
+
224
+ todo_lines = [i + 1 for i, l in enumerate(text.splitlines()) if re.search(r"\bTODO\b", l)]
225
+ check("no TODO placeholders left", not todo_lines, "lines %s" % todo_lines[:10])
226
+
227
+ # fenced code blocks: structure only, never copied code
228
+ longest, inblock, count = 0, False, 0
229
+ for l in text.splitlines():
230
+ if l.strip().startswith("```"):
231
+ if inblock:
232
+ longest = max(longest, count)
233
+ inblock, count = not inblock, 0
234
+ elif inblock:
235
+ count += 1
236
+ check("no code block longer than %d lines" % MAX_CODE_LINES, longest <= MAX_CODE_LINES, "longest %d" % longest)
237
+ bad_assets = [l.strip()[:80] for l in text.splitlines() if IMAGE_RE.search(l) or LOGO_RE.search(l)]
238
+ check("no image/logo links (describe, do not embed)", not bad_assets, bad_assets[:3])
239
+
240
+ # claims
241
+ src_norm = ""
242
+ if index:
243
+ parts = []
244
+ for s in index.get("sources", []):
245
+ p = os.path.join(study_dir, s.get("file", ""))
246
+ if os.path.exists(p):
247
+ with open(p, encoding="utf-8") as f:
248
+ parts.append(normalize(f.read()))
249
+ src_norm = "\n".join(parts)
250
+ n_claims, untagged, unsourced, unknown, copied = 0, [], [], [], []
251
+ for key, lines in sections:
252
+ if key not in CLAIM_SECTIONS:
253
+ continue
254
+ for i, line, is_table in claim_lines(lines):
255
+ n_claims += 1
256
+ conf, refs = parse_claim(line, is_table)
257
+ where = "§%s: %s" % (key, line[:60])
258
+ if conf is None:
259
+ untagged.append(where)
260
+ continue
261
+ if conf in ("high", "medium") and not refs:
262
+ unsourced.append(where)
263
+ missing = sorted(r for r in refs if r not in known)
264
+ if missing:
265
+ unknown.append("%s -> %s" % (where, ",".join(missing)))
266
+ if copied_from(normalize(line), src_norm):
267
+ copied.append(where)
268
+ cited = set()
269
+ for key, lines in sections:
270
+ if key in CLAIM_SECTIONS or key == 0:
271
+ for l in lines:
272
+ cited.update("S" + n for grp in REF_BRACKET_RE.findall(l) for n in S_RE.findall(grp))
273
+ if l.strip().startswith("|"):
274
+ for c in l.strip("|").split("|"):
275
+ if REF_CELL_RE.match(c):
276
+ cited.update("S" + n for n in S_RE.findall(c))
277
+ unused = sorted(known - cited, key=lambda x: int(x[1:]))
278
+ if unused:
279
+ print("note unused sources (fetched but never cited; thin pages? drop or cite): %s" % ", ".join(unused))
280
+ claim_text = " ".join(l for key, lines in sections if key in CLAIM_SECTIONS for l in lines)
281
+ bp_cjk = len(CJK_RE.findall(claim_text)) > 0.3 * max(1, len(claim_text))
282
+ src_cjk = len(CJK_RE.findall(src_norm)) > 0.3 * max(1, len(src_norm)) if src_norm else bp_cjk
283
+ if bp_cjk != src_cjk:
284
+ print("note blueprint and sources are in different languages: the verbatim check cannot bite; a translated sentence is still a copy, keep saying it in your own words")
285
+ check("claims found in sections 1-8", n_claims > 0)
286
+ check("every claim has a confidence tag {high}/{medium}/{guess}", not untagged, untagged[:4])
287
+ check("every high/medium claim cites a source [Sn]", not unsourced, unsourced[:4])
288
+ check("every cited source exists in sources.json", not unknown, unknown[:4])
289
+ check("no claim is a verbatim sentence from a source (say it in your own words)", not copied, copied[:4])
290
+
291
+ # MVP cut
292
+ mvp = dict(sections).get(9, [])
293
+ mtxt = "\n".join(mvp)
294
+
295
+ def count_items(label):
296
+ m = re.search(r"\*\*%s[^*]*\*\*\s*(.+)" % label, mtxt)
297
+ if not m:
298
+ return None
299
+ raw_items = re.sub(r"[((][^))]*[))]", "", m.group(1)) # commas inside parentheses do not split an item
300
+ items = [x for x in re.split(r"[,,、;;\n]|\s\|\s", raw_items) if x.strip() and not re.match(r"^\s*(none|无|-)\s*$", x, re.I)]
301
+ return len(items)
302
+
303
+ n_obj, n_scr = count_items("Objects"), count_items("Screens")
304
+ check("MVP objects listed and <= %d" % MAX_OBJECTS, n_obj is not None and 1 <= n_obj <= MAX_OBJECTS, "found %s" % n_obj)
305
+ check("MVP screens listed and <= %d" % MAX_SCREENS, n_scr is not None and 1 <= n_scr <= MAX_SCREENS, "found %s" % n_scr)
306
+ bo = mtxt.split("**Build order", 1)[1] if "**Build order" in mtxt else ""
307
+ bo = re.split(r"\n\*\*", bo, maxsplit=1)[0] # the numbered steps between the Build order label and the next bold label
308
+ steps = re.findall(r"^\s*\d+\.\s+\S", bo, re.M)
309
+ check("MVP build order has >= 3 steps", len(steps) >= 3, "found %d" % len(steps))
310
+ acc = mtxt.split("**Acceptance", 1)[1] if "**Acceptance" in mtxt else ""
311
+ acc = acc.split("**Learned", 1)[0]
312
+ acc_lines = re.findall(r"^\s*(?:[-*]|\d+\.)\s+(\S.*)$", acc, re.M)
313
+ check("MVP acceptance has 3-5 checks", 3 <= len(acc_lines) <= 5, "found %d" % len(acc_lines))
314
+ # each check = what the user does -> what they should see -> what a machine can verify (the third part may say "manual")
315
+ three = [l for l in acc_lines if len(re.split(r"\s(?:->|→|⇒)\s", l)) >= 3]
316
+ check("every acceptance check has three parts (user does -> should see -> machine checks)", acc_lines and len(three) == len(acc_lines), "%d of %d" % (len(three), len(acc_lines)))
317
+ lvo = re.search(r"\*\*Learned[^*]*\*\*\s*(.+)", mtxt, re.S)
318
+ lvo_txt = lvo.group(1) if lvo else ""
319
+ lvo_lines = [l for l in lvo_txt.splitlines() if l.strip()]
320
+ says_own = bool(re.search(r"\bown\b|自己", lvo_txt, re.I))
321
+ check("MVP says which rules were learned from the target and which are our own", bool(lvo) and lvo_lines and says_own, "found %d lines%s" % (len(lvo_lines), "" if says_own else ", no 'own' part"))
322
+ check("'what we will not copy' section has its four lines", len(claim_lines(dict(sections).get(10, []))) >= 4)
323
+
324
+ print("%d ok, %d fail" % (len(oks), len(fails)))
325
+ return 0 if not fails else 1
326
+
327
+
328
+ def cmd_mvp(args):
329
+ study_dir, bp, idx, mvp_path = paths(args.slug, args.root)
330
+ if not os.path.exists(bp):
331
+ print("no blueprint yet")
332
+ return 1
333
+ with open(bp, encoding="utf-8") as f:
334
+ text = strip_comments(f.read())
335
+ sections = dict(split_sections(text))
336
+ head = [l for l in sections.get("head", []) if l.startswith("Product:")]
337
+ sec9, sec10 = sections.get(9, []), sections.get(10, [])
338
+ if not sec9 or any("TODO" in l for l in sec9):
339
+ print("section 9 (MVP cut) is not finished; fill it, run check, then mvp")
340
+ return 1
341
+ out = ["# MVP hand-off", ""] + head + ["", "Source blueprint: blueprint.md (same folder). Build only what is below; the rest of the blueprint is context, not scope.", "",
342
+ "## MVP cut"] + sec9 + ["", "## What we will not copy"] + sec10 + ["",
343
+ "## Verify", "",
344
+ "Keep the rules (numbers, formulas, state changes) in one block the acceptance runner can load without a browser; tag the learned ones [learned].",
345
+ "Ship a checks file next to the build (acceptance.js or acceptance.py) that prints one JSON row per machine check; run it with",
346
+ "`python3 <product-study>/scripts/acceptance_run.py <site_dir>` before go-live and again with `--url <live url>` after. The table it prints is what the user sees.",
347
+ "The remaining checks are actions the user performs; list them as actions, never as 'tests passed'."]
348
+ with open(mvp_path, "w", encoding="utf-8") as f:
349
+ f.write("\n".join(l.rstrip() for l in out).strip() + "\n")
350
+ print("wrote %s" % mvp_path)
351
+ return 0
352
+
353
+
354
+ def main(argv=None):
355
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
356
+ sub = ap.add_subparsers(dest="cmd")
357
+ i = sub.add_parser("init"); i.add_argument("slug"); i.add_argument("--product", required=True)
358
+ i.add_argument("--site"); i.add_argument("--goal"); i.add_argument("--root", default=DEFAULT_ROOT); i.add_argument("--force", action="store_true")
359
+ for name in ("sources", "check", "mvp"):
360
+ p = sub.add_parser(name); p.add_argument("slug"); p.add_argument("--root", default=DEFAULT_ROOT)
361
+ args = ap.parse_args(argv)
362
+ if not args.cmd:
363
+ ap.print_help()
364
+ return 1
365
+ return {"init": cmd_init, "sources": cmd_sources, "check": cmd_check, "mvp": cmd_mvp}[args.cmd](args)
366
+
367
+
368
+ if __name__ == "__main__":
369
+ sys.exit(main())
plugins-skills/product-study/scripts/fetch_public.py ADDED
@@ -0,0 +1,590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """AutoCode product-study: collect PUBLIC source material about a product.
4
+
5
+ Standard library only (Python 3.8+). No login, no cookies, no auth headers,
6
+ no bundle/minified-code reading, no network capture. Honors robots.txt,
7
+ skips login/account/billing paths, rate-limits one request per second per
8
+ host, caps page count and size. Everything it writes lands under
9
+ <root>/<slug>/ (default root: .autocode/study).
10
+
11
+ Usage:
12
+ fetch_public.py discover <homepage_url> [--max 40]
13
+ Print candidate public pages found on the homepage (pricing, docs,
14
+ changelog, API, integrations, security, careers ...). Nothing is saved.
15
+ fetch_public.py fetch <slug> <url> [<url> ...] [--max-pages 25] [--root DIR]
16
+ Fetch the listed pages, extract text + outline, save as S1.txt, S2.txt ...
17
+ and record them in sources.json. Re-running appends; duplicates are skipped.
18
+ fetch_public.py github <slug> <owner/repo> [--root DIR]
19
+ Record a public GitHub repository: metadata (if the API is reachable),
20
+ README and LICENSE from raw.githubusercontent.com. Flags copyleft licenses.
21
+ fetch_public.py list <slug> [--root DIR]
22
+ Show what has been collected so far.
23
+ fetch_public.py links <slug> S3 [--grep docs] [--root DIR]
24
+ Print the same-site links recorded when S3 was fetched (no network): use it
25
+ to walk a docs navigation without re-fetching pages.
26
+
27
+ Exit status: 0 ok, 1 nothing collected / bad arguments, 2 every URL was refused.
28
+ """
29
+ import argparse
30
+ import datetime
31
+ import hashlib
32
+ import html
33
+ import json
34
+ import os
35
+ import re
36
+ import sys
37
+ import time
38
+ import urllib.error
39
+ import urllib.parse
40
+ import urllib.request
41
+ import urllib.robotparser
42
+ from html.parser import HTMLParser
43
+
44
+ VERSION = "6.2.2"
45
+ USER_AGENT = "autocode-product-study/%s (+https://github.com/ilang-ai/autocode; public pages only)" % VERSION
46
+ DEFAULT_ROOT = os.path.join(".autocode", "study")
47
+ MAX_BYTES = 3 * 1024 * 1024
48
+ TIMEOUT = 20
49
+ PER_HOST_DELAY = 1.0
50
+
51
+ # Paths that mean "this is someone's account, not public product material".
52
+ # A product page behind these is out of scope by design, not a bug.
53
+ PRIVATE_PATH = re.compile(
54
+ r"/(login|log-in|signin|sign-in|signup|sign-up|register|auth|oauth|sso|"
55
+ r"account|accounts|dashboard|admin|console|checkout|billing|settings|"
56
+ r"workspace|my|me|user|users/[^/]+/private)(/|$|\?)",
57
+ re.I,
58
+ )
59
+ ALLOWED_TYPES = ("text/html", "application/xhtml", "text/plain", "text/markdown", "application/json")
60
+
61
+ # Keywords that mark a public page worth reading, in priority order.
62
+ DISCOVER_KEYWORDS = [
63
+ ("pricing", 100), ("plans", 90), ("docs", 95), ("documentation", 95), ("developers", 90),
64
+ ("api", 85), ("changelog", 90), ("releases", 85), ("updates", 70), ("whats-new", 70),
65
+ ("features", 90), ("product", 80), ("integrations", 85), ("security", 75),
66
+ ("enterprise", 60), ("customers", 55), ("compare", 70), ("vs", 50), ("templates", 60),
67
+ ("help", 65), ("support", 55), ("faq", 65), ("roadmap", 70), ("method", 50),
68
+ ("about", 50), ("careers", 60), ("jobs", 60), ("blog", 45), ("terms", 40), ("privacy", 40),
69
+ ("import", 50), ("mobile", 45), ("desktop", 45),
70
+ ]
71
+ DOC_SUBDOMAINS = ("docs", "developers", "developer", "help", "support", "api", "learn", "guide", "guides")
72
+
73
+
74
+ class TextExtractor(HTMLParser):
75
+ """HTML -> plain text + outline (h1-h3) + links. Drops script/style/svg."""
76
+
77
+ SKIP = {"script", "style", "noscript", "svg", "template", "iframe", "canvas", "pre", "code"}
78
+ BLOCK = {"p", "div", "section", "article", "li", "ul", "ol", "br", "tr",
79
+ "table", "h1", "h2", "h3", "h4", "h5", "h6", "header", "footer", "nav",
80
+ "main", "aside", "pre", "blockquote", "dd", "dt", "dl", "hr", "figure"}
81
+
82
+ def __init__(self):
83
+ super().__init__(convert_charrefs=True)
84
+ self.parts = []
85
+ self.outline = []
86
+ self.links = []
87
+ self.title = ""
88
+ self.description = ""
89
+ self._skip = 0
90
+ self._title = False
91
+ self._heading = None
92
+ self._heading_buf = []
93
+
94
+ def handle_starttag(self, tag, attrs):
95
+ if tag in self.SKIP:
96
+ if tag in ("pre", "code") and self._skip == 0:
97
+ self.parts.append(" [code omitted: the study records structure, never the original's code] ")
98
+ self._skip += 1
99
+ return
100
+ a = dict(attrs)
101
+ if tag in ("td", "th"):
102
+ self.parts.append("\t")
103
+ if tag == "title":
104
+ self._title = True
105
+ elif tag == "meta" and (a.get("name") or "").lower() == "description":
106
+ self.description = (a.get("content") or "").strip()
107
+ elif tag == "a" and a.get("href"):
108
+ self.links.append(a["href"])
109
+ elif tag in ("h1", "h2", "h3"):
110
+ self._heading = tag
111
+ self._heading_buf = []
112
+ if tag in self.BLOCK:
113
+ self.parts.append("\n")
114
+
115
+ def handle_endtag(self, tag):
116
+ if tag in self.SKIP:
117
+ self._skip = max(0, self._skip - 1)
118
+ return
119
+ if tag == "title":
120
+ self._title = False
121
+ elif tag in ("h1", "h2", "h3") and self._heading == tag:
122
+ text = " ".join("".join(self._heading_buf).split())
123
+ if text:
124
+ self.outline.append((tag, text))
125
+ self._heading = None
126
+ if tag in self.BLOCK:
127
+ self.parts.append("\n")
128
+
129
+ def handle_data(self, data):
130
+ if self._skip:
131
+ return
132
+ if self._title:
133
+ self.title += data
134
+ if self._heading:
135
+ self._heading_buf.append(data)
136
+ self.parts.append(data)
137
+
138
+ def text(self):
139
+ raw = "".join(self.parts)
140
+ lines = [" ".join(line.replace("\t", " | ").split()).strip("| ").strip() if "\t" in line else " ".join(line.split()) for line in raw.splitlines()]
141
+ out, blank = [], 0
142
+ for line in lines:
143
+ if line:
144
+ out.append(line)
145
+ blank = 0
146
+ else:
147
+ blank += 1
148
+ if blank == 1:
149
+ out.append("")
150
+ return "\n".join(out).strip()
151
+
152
+
153
+ def now_iso():
154
+ return datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
155
+
156
+
157
+ def normalize_url(url):
158
+ p = urllib.parse.urlsplit(url.strip())
159
+ path = re.sub(r"/+$", "", p.path) or "/"
160
+ return urllib.parse.urlunsplit((p.scheme.lower(), p.netloc.lower(), path, p.query, ""))
161
+
162
+
163
+ def registrable(host):
164
+ parts = host.split(".")
165
+ return ".".join(parts[-2:]) if len(parts) >= 2 else host
166
+
167
+
168
+ class Fetcher:
169
+ def __init__(self, log=print):
170
+ self._robots = {}
171
+ self._last = {}
172
+ self.log = log
173
+
174
+ def _wait(self, host):
175
+ last = self._last.get(host)
176
+ if last is not None:
177
+ gap = PER_HOST_DELAY - (time.time() - last)
178
+ if gap > 0:
179
+ time.sleep(gap)
180
+ self._last[host] = time.time()
181
+
182
+ def _raw_get(self, url, accept="text/html,text/plain;q=0.9,*/*;q=0.5"):
183
+ host = urllib.parse.urlsplit(url).netloc
184
+ self._wait(host)
185
+ req = urllib.request.Request(url, headers={"User-Agent": USER_AGENT, "Accept": accept})
186
+ resp = urllib.request.urlopen(req, timeout=TIMEOUT)
187
+ body = resp.read(MAX_BYTES + 1)
188
+ truncated = len(body) > MAX_BYTES
189
+ return resp, body[:MAX_BYTES], truncated
190
+
191
+ def robots_allows(self, url):
192
+ p = urllib.parse.urlsplit(url)
193
+ base = "%s://%s" % (p.scheme, p.netloc)
194
+ rp = self._robots.get(base)
195
+ if rp is None:
196
+ rp = urllib.robotparser.RobotFileParser()
197
+ try:
198
+ resp, body, _ = self._raw_get(base + "/robots.txt", accept="text/plain,*/*;q=0.5")
199
+ ctype = resp.headers.get("Content-Type", "")
200
+ if resp.status == 200 and "html" not in ctype.lower():
201
+ rp.parse(body.decode("utf-8", "replace").splitlines())
202
+ else:
203
+ rp.parse([]) # no usable robots.txt -> everything allowed
204
+ except urllib.error.HTTPError as e:
205
+ if e.code in (401, 403):
206
+ rp.parse(["User-agent: *", "Disallow: /"]) # treat a locked robots.txt as "stay out"
207
+ else:
208
+ rp.parse([])
209
+ except Exception:
210
+ rp.parse([])
211
+ self._robots[base] = rp
212
+ return rp.can_fetch(USER_AGENT, url) and rp.can_fetch("*", url)
213
+
214
+ def refuse_reason(self, url):
215
+ p = urllib.parse.urlsplit(url)
216
+ if p.scheme not in ("http", "https"):
217
+ return "not http(s)"
218
+ if PRIVATE_PATH.search(p.path + "?"):
219
+ return "login/account/billing path: not public product material"
220
+ if not self.robots_allows(url):
221
+ return "robots.txt disallows this path"
222
+ return None
223
+
224
+ def fetch_page(self, url):
225
+ """Return (record, text) or (record_with_error, None)."""
226
+ rec = {"url": url, "fetched_at": now_iso()}
227
+ reason = self.refuse_reason(url)
228
+ if reason:
229
+ rec["status"] = "skipped"
230
+ rec["reason"] = reason
231
+ return rec, None
232
+ try:
233
+ resp, body, truncated = self._raw_get(url)
234
+ except urllib.error.HTTPError as e:
235
+ rec["status"] = "skipped"
236
+ rec["reason"] = "HTTP %d" % e.code + (" (requires permission: out of scope)" if e.code in (401, 402, 403) else "")
237
+ return rec, None
238
+ except Exception as e:
239
+ rec["status"] = "error"
240
+ rec["reason"] = "%s: %s" % (type(e).__name__, e)
241
+ return rec, None
242
+ final = resp.geturl()
243
+ rec["final_url"] = final
244
+ if final != url and PRIVATE_PATH.search(urllib.parse.urlsplit(final).path + "?"):
245
+ rec["status"] = "skipped"
246
+ rec["reason"] = "redirected to a login/account page: requires permission, out of scope"
247
+ return rec, None
248
+ ctype = (resp.headers.get("Content-Type") or "").lower()
249
+ if not any(t in ctype for t in ALLOWED_TYPES):
250
+ rec["status"] = "skipped"
251
+ rec["reason"] = "content-type %s is not a text page (PDFs/binaries are not collected)" % (ctype.split(";")[0] or "unknown")
252
+ return rec, None
253
+ charset = "utf-8"
254
+ m = re.search(r"charset=([\w-]+)", ctype)
255
+ if m:
256
+ charset = m.group(1)
257
+ else:
258
+ m = re.search(br'<meta[^>]+charset=["\']?([\w-]+)', body[:4096], re.I)
259
+ if m:
260
+ charset = m.group(1).decode("ascii", "replace")
261
+ try:
262
+ raw = body.decode(charset, "replace")
263
+ except LookupError:
264
+ raw = body.decode("utf-8", "replace")
265
+ if "html" in ctype:
266
+ ex = TextExtractor()
267
+ try:
268
+ ex.feed(raw)
269
+ except Exception:
270
+ pass
271
+ text, title, outline, links, desc = ex.text(), " ".join(ex.title.split()), ex.outline, ex.links, ex.description
272
+ else:
273
+ text, title, outline, links, desc = raw.strip(), "", [], [], ""
274
+ if truncated:
275
+ rec["truncated"] = True
276
+ rec.update({
277
+ "status": "ok", "kind": "html" if "html" in ctype else "text",
278
+ "title": title or urllib.parse.urlsplit(final).path,
279
+ "description": desc, "bytes": len(body),
280
+ "sha256": hashlib.sha256(text.encode("utf-8")).hexdigest(),
281
+ "outline": outline, "links": links,
282
+ })
283
+ return rec, text
284
+
285
+
286
+ class Study:
287
+ def __init__(self, slug, root):
288
+ if not re.match(r"^[a-z0-9][a-z0-9._-]{0,63}$", slug):
289
+ sys.exit("slug must be lowercase letters, digits, dot, dash or underscore: %r" % slug)
290
+ self.slug = slug
291
+ self.dir = os.path.join(root, slug)
292
+ self.src_dir = os.path.join(self.dir, "sources")
293
+ self.index_path = os.path.join(self.dir, "sources.json")
294
+ os.makedirs(self.src_dir, exist_ok=True)
295
+ # Fetched page texts are reference material for the blueprint and must
296
+ # never be committed: keep a .gitignore that ignores everything in sources/.
297
+ gi = os.path.join(self.src_dir, ".gitignore")
298
+ if not os.path.exists(gi):
299
+ with open(gi, "w", encoding="utf-8") as f:
300
+ f.write("*\n!.gitignore\n")
301
+ if os.path.exists(self.index_path):
302
+ with open(self.index_path, encoding="utf-8") as f:
303
+ self.index = json.load(f)
304
+ else:
305
+ self.index = {"slug": slug, "tool": "fetch_public.py " + VERSION, "user_agent": USER_AGENT,
306
+ "policy": "public pages only; robots.txt honored; no login; no captures; no binaries",
307
+ "sources": [], "skipped": []}
308
+
309
+ def save(self):
310
+ with open(self.index_path, "w", encoding="utf-8") as f:
311
+ json.dump(self.index, f, ensure_ascii=False, indent=2)
312
+
313
+ def next_id(self):
314
+ return "S%d" % (len(self.index["sources"]) + 1)
315
+
316
+ def has(self, url=None, sha=None):
317
+ for s in self.index["sources"]:
318
+ if url and normalize_url(s.get("url", "")) == normalize_url(url):
319
+ return s["id"]
320
+ if sha and s.get("sha256") == sha:
321
+ return s["id"]
322
+ return None
323
+
324
+ def add(self, rec, text):
325
+ sid = self.next_id()
326
+ rec = dict(rec)
327
+ rec["id"] = sid
328
+ rec["file"] = "sources/%s.txt" % sid
329
+ outline = rec.pop("outline", [])
330
+ links = rec.pop("links", None) or []
331
+ if links:
332
+ base = rec.get("final_url", rec["url"])
333
+ site = registrable(urllib.parse.urlsplit(base).netloc)
334
+ keep, seen = [], set()
335
+ for href in links:
336
+ absu = urllib.parse.urljoin(base, href.strip())
337
+ p = urllib.parse.urlsplit(absu)
338
+ if p.scheme not in ("http", "https") or registrable(p.netloc) != site:
339
+ continue
340
+ n = normalize_url(absu)
341
+ if n in seen or PRIVATE_PATH.search(p.path + "?"):
342
+ continue
343
+ seen.add(n)
344
+ keep.append(n)
345
+ if keep:
346
+ with open(os.path.join(self.src_dir, "%s.links.txt" % sid), "w", encoding="utf-8") as f:
347
+ f.write("\n".join(keep[:300]) + "\n")
348
+ rec["links_file"] = "sources/%s.links.txt" % sid
349
+ head = ["# %s" % sid, "url: %s" % rec["url"], "final_url: %s" % rec.get("final_url", rec["url"]),
350
+ "title: %s" % rec.get("title", ""), "fetched_at: %s" % rec["fetched_at"],
351
+ "sha256: %s" % rec.get("sha256", ""), "kind: %s" % rec.get("kind", "")]
352
+ if rec.get("description"):
353
+ head.append("description: %s" % rec["description"])
354
+ if rec.get("license"):
355
+ head.append("license: %s" % rec["license"])
356
+ body = "\n".join(head) + "\n---\n"
357
+ if outline:
358
+ body += "## outline\n" + "\n".join("%s %s" % ("#" * int(t[1]), txt) for t, txt in outline) + "\n---\n"
359
+ body += text + "\n"
360
+ with open(os.path.join(self.dir, rec["file"]), "w", encoding="utf-8") as f:
361
+ f.write(body)
362
+ self.index["sources"].append(rec)
363
+ return sid
364
+
365
+ def skip(self, rec):
366
+ self.index["skipped"].append({k: rec[k] for k in ("url", "fetched_at", "status", "reason") if k in rec})
367
+
368
+
369
+ # ---------------------------------------------------------------- commands
370
+
371
+ def cmd_discover(args):
372
+ home = args.url if "://" in args.url else "https://" + args.url
373
+ f = Fetcher()
374
+ rec, text = f.fetch_page(home)
375
+ if text is None:
376
+ print("cannot read homepage: %s" % rec.get("reason"))
377
+ return 1
378
+ base = urllib.parse.urlsplit(rec.get("final_url", home))
379
+ site = registrable(base.netloc)
380
+ seen, scored = set(), []
381
+ for href in rec.get("links", []):
382
+ href = href.strip()
383
+ if not href or href.startswith(("#", "mailto:", "tel:", "javascript:")):
384
+ continue
385
+ absu = urllib.parse.urljoin(rec.get("final_url", home), href)
386
+ p = urllib.parse.urlsplit(absu)
387
+ if p.scheme not in ("http", "https"):
388
+ continue
389
+ host = p.netloc.lower()
390
+ same = registrable(host) == site
391
+ sub = host.split(".")[0]
392
+ if not same and not (sub in DOC_SUBDOMAINS):
393
+ continue
394
+ norm = normalize_url(absu)
395
+ if norm in seen or PRIVATE_PATH.search(p.path + "?"):
396
+ continue
397
+ seen.add(norm)
398
+ hay = (p.netloc + p.path).lower()
399
+ score, why = 0, []
400
+ for kw, w in DISCOVER_KEYWORDS:
401
+ if re.search(r"(^|[/.\-_])%s([/.\-_]|$)" % re.escape(kw), hay):
402
+ score += w
403
+ why.append(kw)
404
+ if sub in DOC_SUBDOMAINS:
405
+ score += 80
406
+ why.append("docs-subdomain")
407
+ if score:
408
+ scored.append((score, norm, ",".join(why)))
409
+ scored.sort(key=lambda x: (-x[0], x[1]))
410
+ print("# candidates on %s (public, robots-allowed paths only; review before fetching)" % base.netloc)
411
+ for score, url, why in scored[: args.max]:
412
+ print("%s\t%s" % (url, why))
413
+ if rec.get("title"):
414
+ print("# homepage title: %s" % rec["title"])
415
+ return 0 if scored else 1
416
+
417
+
418
+ def cmd_fetch(args):
419
+ st = Study(args.slug, args.root)
420
+ f = Fetcher()
421
+ added, refused, count = [], 0, 0
422
+ for url in args.urls:
423
+ if count >= args.max_pages:
424
+ print("max pages reached (%d); stop here, review, then fetch more deliberately" % args.max_pages)
425
+ break
426
+ url = url if "://" in url else "https://" + url
427
+ dup = st.has(url=url)
428
+ if dup:
429
+ print("%s already collected as %s" % (url, dup))
430
+ continue
431
+ count += 1
432
+ rec, text = f.fetch_page(url)
433
+ if text is None:
434
+ st.skip(rec)
435
+ refused += 1
436
+ print("SKIP %s (%s)" % (url, rec.get("reason")))
437
+ continue
438
+ dup = st.has(sha=rec["sha256"])
439
+ if dup:
440
+ print("%s same content as %s, not stored twice" % (url, dup))
441
+ continue
442
+ if len(text) < 200:
443
+ st.skip(dict(rec, status="skipped", reason="page has almost no readable text (%d chars); likely rendered by JavaScript or empty" % len(text)))
444
+ print("SKIP %s (no readable text, %d chars)" % (url, len(text)))
445
+ continue
446
+ sid = st.add(rec, text)
447
+ added.append(sid)
448
+ note = ""
449
+ if len(text) < 2000 and len(rec.get("outline", [])) >= 6:
450
+ note = "; looks like mostly navigation (%d headings, %d chars): cite with care" % (len(rec["outline"]), len(text))
451
+ print("%s %s <- %s (%d chars%s%s)" % (sid, rec.get("title", "")[:60], url, len(text), ", truncated" if rec.get("truncated") else "", note))
452
+ st.save()
453
+ print("collected %d page(s), refused %d; index: %s" % (len(added), refused, st.index_path))
454
+ if not added and refused:
455
+ return 2
456
+ return 0 if added else 1
457
+
458
+
459
+ COPYLEFT = {"AGPL-3.0", "GPL-3.0", "GPL-2.0", "LGPL-3.0", "LGPL-2.1", "SSPL-1.0", "EUPL-1.2", "OSL-3.0", "CC-BY-SA-4.0"}
460
+
461
+
462
+ def cmd_github(args):
463
+ st = Study(args.slug, args.root)
464
+ f = Fetcher()
465
+ m = re.match(r"^(?:https?://github\.com/)?([\w.-]+)/([\w.-]+?)(?:\.git)?/?$", args.repo.strip())
466
+ if not m:
467
+ sys.exit("repo must look like owner/name or https://github.com/owner/name")
468
+ owner, name = m.group(1), m.group(2)
469
+ meta = {}
470
+ try:
471
+ resp, body, _ = f._raw_get("https://api.github.com/repos/%s/%s" % (owner, name), accept="application/vnd.github+json")
472
+ data = json.loads(body.decode("utf-8", "replace"))
473
+ meta = {k: data.get(k) for k in ("full_name", "description", "homepage", "language", "stargazers_count",
474
+ "forks_count", "default_branch", "topics", "archived", "pushed_at")}
475
+ if isinstance(data.get("license"), dict):
476
+ meta["license"] = data["license"].get("spdx_id")
477
+ except Exception as e:
478
+ print("GitHub API not reachable (%s); falling back to raw README/LICENSE" % (type(e).__name__))
479
+ branches = [meta.get("default_branch")] if meta.get("default_branch") else ["main", "master"]
480
+ readme_text, readme_url = None, None
481
+ for br in branches:
482
+ for fn in ("README.md", "readme.md", "README.rst", "README"):
483
+ url = "https://raw.githubusercontent.com/%s/%s/%s/%s" % (owner, name, br, fn)
484
+ rec, text = f.fetch_page(url)
485
+ if text:
486
+ readme_text, readme_url, readme_rec = text, url, rec
487
+ break
488
+ if readme_text:
489
+ break
490
+ if not readme_text:
491
+ print("no public README found for %s/%s" % (owner, name))
492
+ return 2
493
+ license_id = meta.get("license")
494
+ if not license_id:
495
+ for br in branches:
496
+ for fn in ("LICENSE", "LICENSE.md", "LICENSE.txt", "COPYING"):
497
+ rec_l, lic = f.fetch_page("https://raw.githubusercontent.com/%s/%s/%s/%s" % (owner, name, br, fn))
498
+ if lic:
499
+ head = lic[:600].upper()
500
+ license_id = ("AGPL-3.0" if "AFFERO" in head else "GPL-3.0" if "GNU GENERAL PUBLIC LICENSE" in head and "VERSION 3" in head
501
+ else "GPL-2.0" if "GNU GENERAL PUBLIC LICENSE" in head else "MIT" if "MIT LICENSE" in head or "PERMISSION IS HEREBY GRANTED" in head
502
+ else "Apache-2.0" if "APACHE LICENSE" in head else "BSD" if "REDISTRIBUTION AND USE" in head else "see file")
503
+ break
504
+ if license_id:
505
+ break
506
+ if not license_id:
507
+ # no LICENSE file: many small repos carry the notice in the header of their main source file
508
+ for br in branches:
509
+ for fn in ("index.js", "main.js", "app.js", "index.html", "main.py", "app.py", "src/index.js", "src/main.js"):
510
+ rec_h, src = f.fetch_page("https://raw.githubusercontent.com/%s/%s/%s/%s" % (owner, name, br, fn))
511
+ if src:
512
+ head = src[:1200].upper()
513
+ license_id = ("AGPL-3.0" if "AFFERO" in head else "GPL" if "GNU GENERAL PUBLIC LICENSE" in head
514
+ else "MIT" if "MIT LICENSE" in head or "PERMISSION IS HEREBY GRANTED" in head
515
+ else "Apache-2.0" if "APACHE LICENSE" in head
516
+ else "BSD (file header)" if "BSD-STYLE LICENSE" in head or "REDISTRIBUTION AND USE" in head else None)
517
+ if license_id:
518
+ license_id += " via %s" % fn
519
+ break
520
+ if license_id:
521
+ break
522
+ rec = dict(readme_rec)
523
+ rec.update({"kind": "github", "title": "GitHub %s/%s README" % (owner, name), "url": "https://github.com/%s/%s" % (owner, name),
524
+ "final_url": readme_url, "license": license_id or "unknown", "repo_meta": meta})
525
+ header = ["repository: https://github.com/%s/%s" % (owner, name), "license: %s" % (license_id or "unknown")]
526
+ for k in ("description", "language", "stargazers_count", "forks_count", "topics", "pushed_at"):
527
+ if meta.get(k) not in (None, "", []):
528
+ header.append("%s: %s" % (k, meta[k]))
529
+ text = "\n".join(header) + "\n\n" + readme_text
530
+ rec["sha256"] = hashlib.sha256(text.encode("utf-8")).hexdigest()
531
+ dup = st.has(url=rec["url"])
532
+ if dup:
533
+ print("already collected as %s" % dup)
534
+ return 0
535
+ sid = st.add(rec, text)
536
+ st.save()
537
+ print("%s GitHub %s/%s license=%s" % (sid, owner, name, license_id or "unknown"))
538
+ if (license_id or "").upper().split("-OR-")[0] in COPYLEFT or "GPL" in (license_id or "").upper():
539
+ print("NOTE: copyleft license (%s). Studying the architecture is fine; copying code into a product under a different license is not. The blueprint must say so." % license_id)
540
+ return 0
541
+
542
+
543
+ def cmd_links(args):
544
+ """Print the same-site links recorded for a fetched page (no network)."""
545
+ st = Study(args.slug, args.root)
546
+ want = args.source.upper()
547
+ for s in st.index["sources"]:
548
+ if s["id"] == want:
549
+ lf = s.get("links_file")
550
+ if not lf or not os.path.exists(os.path.join(st.dir, lf)):
551
+ print("no links recorded for %s" % want)
552
+ return 1
553
+ with open(os.path.join(st.dir, lf), encoding="utf-8") as f:
554
+ for line in f:
555
+ line = line.strip()
556
+ if line and (not args.grep or args.grep.lower() in line.lower()):
557
+ print(line)
558
+ return 0
559
+ print("unknown source id %s" % want)
560
+ return 1
561
+
562
+
563
+ def cmd_list(args):
564
+ st = Study(args.slug, args.root)
565
+ for s in st.index["sources"]:
566
+ print("%s\t%s\t%s\t%s" % (s["id"], s.get("kind", ""), (s.get("title") or "")[:50], s["url"]))
567
+ for s in st.index["skipped"]:
568
+ print("skipped\t%s\t%s" % (s["url"], s.get("reason", "")))
569
+ print("%d collected, %d skipped" % (len(st.index["sources"]), len(st.index["skipped"])))
570
+ return 0
571
+
572
+
573
+ def main(argv=None):
574
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
575
+ sub = ap.add_subparsers(dest="cmd")
576
+ d = sub.add_parser("discover"); d.add_argument("url"); d.add_argument("--max", type=int, default=40)
577
+ fe = sub.add_parser("fetch"); fe.add_argument("slug"); fe.add_argument("urls", nargs="+")
578
+ fe.add_argument("--max-pages", type=int, default=25); fe.add_argument("--root", default=DEFAULT_ROOT)
579
+ g = sub.add_parser("github"); g.add_argument("slug"); g.add_argument("repo"); g.add_argument("--root", default=DEFAULT_ROOT)
580
+ li = sub.add_parser("list"); li.add_argument("slug"); li.add_argument("--root", default=DEFAULT_ROOT)
581
+ lk = sub.add_parser("links"); lk.add_argument("slug"); lk.add_argument("source", help="e.g. S3"); lk.add_argument("--grep"); lk.add_argument("--root", default=DEFAULT_ROOT)
582
+ args = ap.parse_args(argv)
583
+ if not args.cmd:
584
+ ap.print_help()
585
+ return 1
586
+ return {"discover": cmd_discover, "fetch": cmd_fetch, "github": cmd_github, "list": cmd_list, "links": cmd_links}[args.cmd](args)
587
+
588
+
589
+ if __name__ == "__main__":
590
+ sys.exit(main())
plugins-skills/product-study/scripts/selftest.py ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """Offline regression for product-study (the release gate runs this; locally:
4
+ python3 skills/product-study/scripts/selftest.py). Standard library only, no
5
+ external network: a throwaway HTTP server on 127.0.0.1 plays the "product site".
6
+
7
+ Covers: robots.txt refusal, login/account path refusal, redirect-to-login
8
+ refusal, non-text refusal, de-duplication, discover ranking, blueprint init /
9
+ check / sources / mvp, and every gate rule (tags, sources, verbatim copy,
10
+ assets, code blocks, MVP size)."""
11
+ import http.server
12
+ import io
13
+ import json
14
+ import os
15
+ import shutil
16
+ import sys
17
+ import tempfile
18
+ import threading
19
+ import contextlib
20
+
21
+ os.environ["NO_PROXY"] = "127.0.0.1,localhost"
22
+ os.environ["no_proxy"] = "127.0.0.1,localhost"
23
+ HERE = os.path.dirname(os.path.abspath(__file__))
24
+ sys.path.insert(0, HERE)
25
+ import fetch_public as fp # noqa: E402
26
+ import blueprint as bp # noqa: E402
27
+
28
+ fp.PER_HOST_DELAY = 0
29
+ fails = []
30
+
31
+
32
+ def check(name, cond, detail=""):
33
+ print(("ok " if cond else "FAIL ") + name + ("" if cond else " " + str(detail)[:300]))
34
+ if not cond:
35
+ fails.append(name)
36
+
37
+
38
+ @contextlib.contextmanager
39
+ def captured():
40
+ buf = io.StringIO()
41
+ with contextlib.redirect_stdout(buf):
42
+ yield buf
43
+
44
+
45
+ PAGES = {
46
+ "/robots.txt": ("text/plain", "User-agent: *\nDisallow: /secret/\n"),
47
+ "/": ("text/html", """<html><head><title>Acme Tracker – issues for teams</title>
48
+ <meta name="description" content="Track issues fast"></head><body><nav><a href="/pricing">Pricing</a>
49
+ <a href="/docs/">Docs</a><a href="/login">Log in</a><a href="/changelog">Changelog</a><a href="https://docs.acme.test/start">Guide</a>
50
+ <a href="/secret/plan">Secret</a></nav><h1>Acme Tracker</h1><p>Acme Tracker is a keyboard-first issue tracker where every issue belongs to exactly one team and optionally to one project. Cycles are fixed-length sprints that teams opt into.</p>
51
+ <script>var x = "should not appear";</script></body></html>"""),
52
+ "/pricing": ("text/html", "<html><head><title>Pricing</title></head><body><h1>Pricing</h1><h3>Free</h3><p>Up to 250 issues and unlimited members on the free plan. The Business plan adds SSO and audit logs for twelve dollars per user per month.</p>" + "<p>filler text to pass the minimum length threshold. </p>" * 10 + "</body></html>"),
53
+ "/changelog": ("text/html", "<html><head><title>Changelog</title></head><body><h1>Changelog</h1>" + "<p>Release note entry about cycles and projects. </p>" * 12 + "</body></html>"),
54
+ "/dup": ("text/html", "<html><head><title>Pricing</title></head><body><h1>Pricing</h1><h3>Free</h3><p>Up to 250 issues and unlimited members on the free plan. The Business plan adds SSO and audit logs for twelve dollars per user per month.</p>" + "<p>filler text to pass the minimum length threshold. </p>" * 10 + "</body></html>"),
55
+ "/secret/plan": ("text/html", "<html><body>" + "robots should keep this out " * 20 + "</body></html>"),
56
+ "/login": ("text/html", "<html><body>" + "login page " * 40 + "</body></html>"),
57
+ "/docs/": ("text/html", "<html><head><title>Docs</title></head><body><h1>Concepts</h1><h2>Workspace</h2><h2>Team</h2><h2>Issue</h2>" + "<p>Each workspace has teams; each team owns issues. </p>" * 8 + "<table><tr><th>Plan</th><th>Teams</th></tr><tr><td>Free</td><td>2</td></tr></table><pre>const secretImplementation = 1;</pre></body></html>"),
58
+ "/brochure.pdf": ("application/pdf", "%PDF-1.4 not a text page"),
59
+ "/thin": ("text/html", "<html><body><div id=app></div></body></html>"),
60
+ }
61
+
62
+
63
+ class Handler(http.server.BaseHTTPRequestHandler):
64
+ def do_GET(self):
65
+ path = self.path.split("?")[0]
66
+ if path == "/members":
67
+ self.send_response(302)
68
+ self.send_header("Location", "/login")
69
+ self.end_headers()
70
+ return
71
+ if path not in PAGES:
72
+ self.send_response(404)
73
+ self.end_headers()
74
+ return
75
+ ctype, body = PAGES[path]
76
+ data = body.encode("utf-8")
77
+ self.send_response(200)
78
+ self.send_header("Content-Type", ctype + ("; charset=utf-8" if ctype.startswith("text") else ""))
79
+ self.send_header("Content-Length", str(len(data)))
80
+ self.end_headers()
81
+ self.wfile.write(data)
82
+
83
+ def log_message(self, *a):
84
+ pass
85
+
86
+
87
+ def main():
88
+ srv = http.server.HTTPServer(("127.0.0.1", 0), Handler)
89
+ port = srv.server_address[1]
90
+ threading.Thread(target=srv.serve_forever, daemon=True).start()
91
+ base = "http://127.0.0.1:%d" % port
92
+ tmp = tempfile.mkdtemp(prefix="product-study-selftest-")
93
+ try:
94
+ root = os.path.join(tmp, "study")
95
+ # ---- discover
96
+ with captured() as out:
97
+ rc = fp.main(["discover", base + "/"])
98
+ lines = out.getvalue().splitlines()
99
+ check("discover runs", rc == 0, out.getvalue())
100
+ check("discover ranks pricing", any(l.startswith(base + "/pricing") for l in lines))
101
+ check("discover finds docs path", any(l.startswith(base + "/docs") for l in lines))
102
+ check("discover keeps docs subdomain", any("docs.acme.test" in l for l in lines))
103
+ check("discover drops login", not any("/login" in l for l in lines))
104
+ check("discover drops robots-blocked secret", not any("/secret" in l for l in lines))
105
+ # ---- fetch
106
+ urls = [base + p for p in ("/", "/pricing", "/secret/plan", "/login", "/members", "/brochure.pdf", "/dup", "/thin", "/docs/", "/changelog")]
107
+ with captured() as out:
108
+ rc = fp.main(["fetch", "acme", "--root", root] + urls)
109
+ text = out.getvalue()
110
+ idx = json.load(open(os.path.join(root, "acme", "sources.json"), encoding="utf-8"))
111
+ ids = [s["id"] for s in idx["sources"]]
112
+ skipped = {s["url"].replace(base, ""): s["reason"] for s in idx["skipped"]}
113
+ check("fetch collects public pages", ids == ["S1", "S2", "S3", "S4"], (ids, text))
114
+ check("robots-disallowed path refused", "robots" in skipped.get("/secret/plan", ""), skipped)
115
+ check("login path refused", "login" in skipped.get("/login", ""), skipped)
116
+ check("redirect-to-login refused", "redirected" in skipped.get("/members", ""), skipped)
117
+ check("pdf refused", "not a text page" in skipped.get("/brochure.pdf", ""), skipped)
118
+ check("thin JS page refused", "readable text" in skipped.get("/thin", ""), skipped)
119
+ check("duplicate content stored once", "same content as S2" in text, text)
120
+ s1 = open(os.path.join(root, "acme", "sources", "S1.txt"), encoding="utf-8").read()
121
+ check("script text dropped from extraction", "should not appear" not in s1)
122
+ check("outline recorded", "## outline" in s1 and "# Acme Tracker" in s1)
123
+ check("header has url/sha/date", all(k in s1 for k in ("url:", "sha256:", "fetched_at:")))
124
+ s3 = open(os.path.join(root, "acme", "sources", "S3.txt"), encoding="utf-8").read()
125
+ check("table cells joined with | ", "Plan | Teams" in s3 and "Free | 2" in s3, s3[-300:])
126
+ check("code blocks omitted from sources", "secretImplementation" not in s3 and "code omitted" in s3)
127
+ with captured() as out:
128
+ rc = fp.main(["links", "acme", "--root", root, "S1", "--grep", "pricing"])
129
+ check("links command lists same-site links of a page", rc == 0 and "/pricing" in out.getvalue(), out.getvalue())
130
+ with captured() as out:
131
+ rc = fp.main(["fetch", "acme", "--root", root, base + "/pricing"])
132
+ check("re-fetch of same url is a no-op", "already collected as S2" in out.getvalue())
133
+ gi = open(os.path.join(root, "acme", "sources", ".gitignore"), encoding="utf-8").read()
134
+ check("sources/.gitignore ignores fetched texts", gi == "*\n!.gitignore\n", gi)
135
+ # ---- blueprint init / check on template
136
+ with captured():
137
+ rc = bp.main(["init", "acme", "--root", root, "--product", "Acme Tracker", "--site", base, "--goal", "issue tracker for a ten-person team"])
138
+ bpath = os.path.join(root, "acme", "blueprint.md")
139
+ check("init writes blueprint", rc == 0 and os.path.exists(bpath))
140
+ with captured() as out:
141
+ rc = bp.main(["check", "acme", "--root", root])
142
+ check("fresh template fails the gate (TODOs)", rc == 1 and "FAIL no TODO" in out.getvalue())
143
+ with captured() as out:
144
+ rc = bp.main(["mvp", "acme", "--root", root])
145
+ check("mvp refuses unfinished section 9", rc == 1)
146
+ # ---- a good blueprint passes
147
+ good = GOOD.replace("{base}", base)
148
+ with open(bpath, "w", encoding="utf-8") as f:
149
+ f.write(good)
150
+ with captured():
151
+ bp.main(["sources", "acme", "--root", root])
152
+ with captured() as out:
153
+ rc = bp.main(["check", "acme", "--root", root])
154
+ check("good blueprint passes the gate", rc == 0, out.getvalue())
155
+ with captured():
156
+ rc = bp.main(["mvp", "acme", "--root", root])
157
+ mvp = open(os.path.join(root, "acme", "mvp.md"), encoding="utf-8").read()
158
+ check("mvp.md written with objects and no-copy list", rc == 0 and "**Objects" in mvp and "Interface look" in mvp)
159
+ check("Sources section lists refused urls", "Refused or skipped" in open(bpath, encoding="utf-8").read())
160
+
161
+ # ---- each gate rule bites
162
+ def gate_fails(mutation, needle, name):
163
+ with open(bpath, "w", encoding="utf-8") as f:
164
+ f.write(mutation(good))
165
+ with captured() as out:
166
+ rc = bp.main(["check", "acme", "--root", root])
167
+ check(name, rc == 1 and needle in out.getvalue(), out.getvalue()[-400:])
168
+
169
+ gate_fails(lambda t: t.replace("- Teams own issues; a project groups issues across teams [S1] {high}", "- Teams own issues; a project groups issues across teams [S1]"), "confidence tag", "claim without confidence tag fails")
170
+ gate_fails(lambda t: t.replace("[S1] {high}", "{high}", 1), "cites a source", "high claim without source fails")
171
+ gate_fails(lambda t: t.replace("[S1] {high}", "[S99] {high}", 1), "exists in sources.json", "unknown source id fails")
172
+ gate_fails(lambda t: t.replace("- Teams own issues; a project groups issues across teams [S1] {high}", "- Acme Tracker is a keyboard-first issue tracker where every issue belongs to exactly one team and optionally to one project [S1] {high}"), "verbatim", "verbatim sentence from a source fails")
173
+ gate_fails(lambda t: t.replace("## 2. Information architecture", "## 2. Information architecture\n\n- Logo at " + base + "/logo.png [S1] {high}"), "image/logo", "image link fails")
174
+ gate_fails(lambda t: t.replace("## 5. Technical stack clues", "## 5. Technical stack clues\n\n```\n" + "x = 1\n" * 20 + "```"), "code block", "long code block fails")
175
+ gate_fails(lambda t: t.replace("**Objects (<= 5):** Team, Issue, Project, Cycle, Comment", "**Objects (<= 5):** Team, Issue, Project, Cycle, Comment, Label"), "objects", "six MVP objects fail")
176
+ gate_fails(lambda t: t.replace("1. Scaffold", "x. Scaffold").replace("2. Issue", "x. Issue"), "build order", "missing build steps fail")
177
+ gate_fails(lambda t: t.replace("| Pricing is per user per month | SaaS | S2 | high |", "| Pricing is per user per month | SaaS | S2 | |"), "confidence tag", "table row without confidence fails")
178
+ finally:
179
+ srv.shutdown()
180
+ shutil.rmtree(tmp, ignore_errors=True)
181
+ print("%d failure(s)" % len(fails))
182
+ return 1 if fails else 0
183
+
184
+
185
+ GOOD = """# Product blueprint: Acme Tracker
186
+
187
+ Product: Acme Tracker · Official site: {base} · Studied on: 2026-10-13 · Goal: issue tracker for a ten-person team
188
+
189
+ Reading guide: structure only, from public pages.
190
+
191
+ ## 0. Summary
192
+
193
+ Acme Tracker is an issue tracker built around teams, with optional projects and fixed-length cycles, priced per user with a free tier.
194
+
195
+ ## 1. Feature inventory
196
+
197
+ | Feature | What it does (one line) | Tier | Sources | Confidence |
198
+ |---|---|---|---|---|
199
+ | Issues per team | Every issue lives in one team | core | S1 | high |
200
+ | Cycles | Fixed-length iterations a team can turn on | plus | S1, S4 | medium |
201
+
202
+ ## 2. Information architecture
203
+
204
+ - Teams own issues; a project groups issues across teams [S1] {high}
205
+ - Workspace holds teams, docs outline shows workspace, team, issue nesting [S3] {high}
206
+
207
+ ## 3. Core objects and data model (inferred)
208
+
209
+ | Object | Key fields | Relations | Sources | Confidence |
210
+ |---|---|---|---|---|
211
+ | Issue | title, status, priority | belongs to one team, optional project | S1, S3 | medium |
212
+
213
+ ## 4. Key user flows
214
+
215
+ - Flow A: create team -> create issue -> move through statuses [S3] {medium}
216
+
217
+ ## 5. Technical stack clues
218
+
219
+ - No public stack information found; nothing to record {guess}
220
+
221
+ ## 6. Pricing and business model
222
+
223
+ | Plan | Price | What it unlocks | Sources | Confidence |
224
+ |---|---|---|---|---|
225
+ | Free | 0 | up to 250 issues, unlimited members | S2 | high |
226
+ | Pricing is per user per month | SaaS | S2 | high |
227
+
228
+ ## 7. Integrations and ecosystem
229
+
230
+ - No integrations page was public at study time {guess}
231
+
232
+ ## 8. Gaps and differentiation opportunities
233
+
234
+ - Small teams may want a flat free tier without the issue cap {guess}
235
+
236
+ ## 9. MVP cut
237
+
238
+ **Users and the one job:** a ten-person software team tracking its own issues
239
+
240
+ **Objects (<= 5):** Team, Issue, Project, Cycle, Comment
241
+
242
+ **Screens (<= 7):** login, team list, issue list, issue detail, project page, cycle page, settings
243
+
244
+ **Dropped from v1 and why:** integrations, SSO, audit logs: not needed for ten people
245
+
246
+ **Build order (each step ends in something the user can click):**
247
+ 1. Scaffold with auth and the team list
248
+ 2. Issue list and detail with statuses
249
+ 3. Projects and cycles
250
+
251
+ **Acceptance (v1 is done when):**
252
+ 1. user signs in -> sees the task list -> machine checks: GET /tasks returns 200 after login
253
+ 2. user presses C and types a title -> a new task appears at the top -> machine checks: task count +1
254
+ 3. user drags a task to Done -> it shows in the Done column -> machine checks: status field equals done
255
+
256
+ **Learned vs own:** learned from the target: three statuses and keyboard-first creation [S1]; own: look, layout, copy, defaults.
257
+
258
+ ## 10. What we will not copy
259
+
260
+ - Interface look, layout, colors, icons and typography of the original: we design our own.
261
+ - Copy, screenshots, images, logo, product and feature names that are trademarks.
262
+ - Any code from the original's repositories or bundles.
263
+ - Anything that was not on a public page.
264
+
265
+ ## Sources
266
+ """
267
+
268
+ if __name__ == "__main__":
269
+ sys.exit(main())
plugins-skills/security/SKILL.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: security
3
+ description: Auto-apply security basics and block deploys that would leak secrets. Never ask the user about security choices — just do it, and run a real secret scan before going live.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
8
+ ::PRIOR{completion:assume_incomplete|authority:developer}
9
+ ::PRIOR{execution:act_when_safe|authority:developer}
10
+
11
+ ::GENE{security|conf:confirmed|scope:global}
12
+ T:auto_apply_no_ask
13
+ T:no_hardcoded_secrets
14
+ T:scan_before_deploy|tool:scripts/scan-secrets.sh
15
+ T:input_validation
16
+ T:parameterized_queries
17
+ T:xss_escape
18
+ T:https_only
19
+ T:rate_limit_login_and_api
20
+ T:error_messages_no_internal_details
21
+ A:ask_user_about_security⇒decide_self
22
+ A:skip_security⇒never
23
+ A:deploy_with_hardcoded_secret⇒block_and_fix
24
+
25
+ ::ACTIVATE{security}
26
+ ON:always
27
+ ON:before_deploy(run scan-secrets.sh; if blocked, fix then re-scan)
28
+
29
+ # Declaring "no hardcoded secrets" is not enough — it does not catch a real leak.
30
+ # Before any deploy, run the scanner. If it returns AUTOCODE_DEPLOY_BLOCKED, do NOT
31
+ # deploy: relay the plain-language warning, move the value to an env var, re-scan,
32
+ # then ship. This turns security from a promise into an actual gate.
33
+
34
+ ::SAY{@AUTOCODE→@USER}{
35
+ user_asks: "安全吗?"
36
+ output: "我做了防攻击处理(防注入、防跨站、密码加密),上线前也扫了一遍确认没有把密钥写死在代码里。正常使用不用担心。"
37
+ }
38
+
39
+ Powered by I-Lang v5.0 | ilang.ai
plugins-skills/see/SKILL.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: see
3
+ description: S1 of see-it-ship-it: understand what the person wants from the way they said it. Classify intent silently, detect their level from the first messages, size the task, lock what they confirmed, and ask at most one question that is theirs to answer.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # see — S1: understand what they want, in their words
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
13
+
14
+ ::GENE{see|conf:confirmed|scope:global}
15
+ T:classify_intent_silently|create|change|fix|question|default=create
16
+ T:detect_level_from_first_3_messages|default=beginner
17
+ T:zero_jargon_for_beginners|light_for_intermediate|full_technical_for_advanced
18
+ T:detect_user_language_respond_same
19
+ T:accept_a_pointer_not_a_spec|url|product_name|their_own_screenshot|⇒product-study
20
+ T:size_the_task|small<30min=build_direct|medium<2hr=brief_plan|large>2hr=plan
21
+ T:fill_goal_header|who_is_it_for|the_one_job
22
+ T:ask_at_most_one_question|when:goal_header_unfillable|yes_no_or_plain
23
+ T:confirmed_requirements_are_locked|ask_before_changing_them
24
+ T:take_initiative|never_wait_for_direction
25
+ A:announce_the_classification⇒never
26
+ A:say_large_project_to_a_beginner⇒say_we_do_it_in_steps
27
+ A:ask_for_a_feature_list⇒infer_then_cut
28
+ A:silently_change_a_locked_requirement⇒ask_first
29
+ A:scope_creep⇒flag_in_one_line
30
+ A:over_explain⇒confuse
31
+ A:assume_knowledge⇒alienate
32
+
33
+ ::ACTIVATE{see}
34
+ ON:every_message
35
+ ON:new_task
36
+ ON:requirement_confirmed
37
+
38
+ ::STATE{@INTENT, what the person wants, in one sentence they would sign}
39
+ ::STATE{@LEVEL, beginner | intermediate | advanced}
40
+
41
+ [SCAN:@SRC|typ=intent]=>[CLSF:@INTENT|typ=silent]=>[DECI:@LEVEL|src=first_3_messages]=>[PLAN:@SCOPE|typ=small_medium_large]=>[Ω:@USER|fmt=text|lim=1]
42
+
43
+ ::EVIDENCE{id:see1|deliverable:intent|kind:text|ref:goal_header|verified_by:@USER|result:they_said_yes_or_crossed_out}
44
+
45
+ ::SAY{@AUTOCODE→@USER}{
46
+ user: "帮我做一个网站" ⇒ beginner, create, small-medium; no jargon, no code in chat
47
+ user: "用 React 做" ⇒ intermediate; light technical, brief explanations
48
+ user: "Go 写个 gRPC 服务" ⇒ advanced; full technical, skip explanations
49
+ user: "我想要一个像 Linear 的" ⇒ pointer, not a spec ⇒ product-study first
50
+ output: "这个我们分几步来做,今天先把核心功能跑通。"
51
+ }
52
+
53
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/ship/SKILL.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: ship
3
+ description: S6 of see-it-ship-it: put it at a public URL. Secret scan first; static builds go to GitHub Pages at no cost (sign-up guide, device-code login, one question: it will be public); a server only when a backend is needed, cost asked once; then open the URL, rerun the acceptance on the live page, bind a domain if they want one.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # ship — S6: the end is a URL
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:deploy_target|default:static_zero_cost_pages|authority:system|scope:@MVP}
12
+ ::PRIOR{dimension:completion|default:not_live_until_url_opened_and_acceptance_rerun|authority:system|scope:@JOURNEY}
13
+
14
+ ::GENE{ship|conf:confirmed|scope:global}
15
+ T:scan_secrets_first|tool:scripts/scan-secrets.sh|block_if_found
16
+ T:ai_picks_the_target|static⇒github_pages_zero_cost|serverless⇒workers|backend_or_db⇒server|say_why_in_one_sentence
17
+ T:default_target=static_zero_cost_pages|when:no_backend|tool:scripts/go_live_pages.py
18
+ T:upgrade_to_server|when:backend_or_db_needed|ask_cost_once
19
+ T:detect_account_state|logged_in|account_no_login|no_account|tool_missing
20
+ T:no_account⇒three_line_signup_guide|come_back_and_say_done
21
+ T:login_is_device_code_in_their_browser|password_or_token_never_passes_through
22
+ T:tool_missing⇒install_it_yourself|one_line_notice
23
+ T:one_question=site_and_files_will_be_public
24
+ T:server_path|code_already_on_the_server|start_service|nginx|verify_then_show_url
25
+ T:poll_until_built|open_url|check_ssl|check_mobile_loads|rerun_acceptance_on_live_html
26
+ T:domain_optional|recommend_one_registrar|guide_every_click|dns_and_ssl_automatic|verify_resolves
27
+ T:move_files_to_the_server_yourself|guide_scp_only_when_you_cannot
28
+ T:say_the_url_in_one_line|then_celebrate_in_one_line
29
+ A:deploy_before_secret_scan⇒scan_first
30
+ A:ask_user_where_to_deploy⇒pick_for_them
31
+ A:say_its_live_without_opening_the_url⇒verify_first
32
+ A:verify_the_local_file_instead_of_the_live_page⇒fetch_live
33
+ A:paste_tokens_or_passwords⇒never|device_flow_only
34
+ A:assume_user_knows_dns_or_scp⇒explain_simply
35
+ A:skip_ssl⇒always_https
36
+ A:end_with_a_file_path⇒end_with_the_url
37
+
38
+ ::ACTIVATE{ship}
39
+ ON:build_complete
40
+ ON:S5-verify.all_match
41
+ ON:before_deploy
42
+ ON:deploy_complete
43
+ ON:user_asks_about_domain
44
+
45
+ ::STATE{@URL, the public address}
46
+
47
+ [CHEK:@SITE|typ=secret_scan]=>[DECI:@TARGET|typ=static_or_server]=>[DPLO:@SITE|dst=@URL|scp=public]=>[CHEK:@URL|whr=http_200_and_rules_block]=>[TEST:@ACCEPT|src=@URL]=>[Ω:@USER|fmt=text|lim=2]
48
+
49
+ ::EVIDENCE{id:s1|deliverable:url|kind:http|ref:live_url|verified_by:@TOOL|result:200_and_rules_block}
50
+ ::FALLBACK{stage:S6-ship|when:no_github_account|do:signup_guide_then_device_login|never:handle_password}
51
+ ::FALLBACK{stage:S6-ship|when:hosting_api_fails|do:retry_then_exact_clicks_in_their_browser}
52
+ ::FALLBACK{stage:S6-ship|when:mvp_needs_backend|do:upgrade_to_server_target|ask:cost_once}
53
+ ::FALLBACK{stage:S6-ship|when:live_page_differs_from_local|do:fix_cache_path_case|rerun_live_acceptance}
54
+
55
+ ## Static, zero cost: GitHub Pages
56
+
57
+ `scripts/go_live_pages.py <site_dir> --name <repo>` walks the whole path in the
58
+ user's words: detects whether `gh` is installed and logged in; no account → three-line
59
+ sign-up guide and wait for "done"; logs in with the device code the user approves in
60
+ their own browser; asks the one question that is theirs (repo and site will be
61
+ public); creates the repo, pushes, enables Pages, polls until built, opens the URL,
62
+ reruns the acceptance against the served page. `--simulate` runs it with GitHub
63
+ mocked. Workers and a server stay available for builds that need them.
64
+
65
+ ::SAY{@AUTOCODE→@USER}{
66
+ output: "上线了:https://you.github.io/dino-runner/ 这个链接谁都能打开。机器能查的 8 项全部一致;剩下请你亲手点一遍。"
67
+ domain: "想要自己的域名的话,大约 $10 一年,我带你一步步点。要吗?"
68
+ }
69
+
70
+ Powered by iLang v5.0 | ilang.ai
plugins-skills/ship/scripts/go_live_pages.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """AutoCode go-live, target: GitHub Pages (static, zero cost). S6-ship of the see-it-ship-it methodology.
3
+
4
+ Takes a folder with index.html and ends with a public URL the user can send to
5
+ anyone. Python 3.8+ standard library. Talks to GitHub only through `gh`, so the
6
+ user's password never passes through AutoCode: `gh auth login --web` shows an
7
+ 8-character code and the user approves it in their own browser.
8
+
9
+ python3 go_live_pages.py <site_dir> --name dino-runner [--yes] [--simulate]
10
+
11
+ --simulate : mock the GitHub side (no account needed): every gh/git call is
12
+ printed instead of run, and a local static server stands in for
13
+ <owner>.github.io so the "verify live" and "acceptance" steps run
14
+ for real against a served copy of the site.
15
+
16
+ What the user sees is printed with a leading ">> "; everything else is the log.
17
+ """
18
+ import argparse, http.server, json, os, shutil, socket, subprocess, sys, threading, time, urllib.request
19
+
20
+ for _stream in (sys.stdout, sys.stderr): # Windows consoles default to cp1252
21
+ try:
22
+ _stream.reconfigure(encoding="utf-8", errors="replace")
23
+ except Exception: # noqa: BLE001
24
+ pass
25
+
26
+ SAY = lambda s: print(">> " + s, flush=True)
27
+ LOG = lambda s: print(" " + s, flush=True)
28
+
29
+
30
+ class GitHub:
31
+ """Thin wrapper over gh/git. In simulate mode nothing leaves the machine."""
32
+
33
+ def __init__(self, simulate):
34
+ self.simulate = simulate
35
+ self.calls = []
36
+ self._logged_in = False
37
+
38
+ def run(self, *cmd, check=True, capture=True):
39
+ self.calls.append(" ".join(cmd))
40
+ if self.simulate:
41
+ LOG("$ " + " ".join(cmd) + " (simulated)")
42
+ return self._fake(cmd)
43
+ LOG("$ " + " ".join(cmd))
44
+ r = subprocess.run(cmd, capture_output=capture, encoding="utf-8", errors="replace")
45
+ if check and r.returncode != 0:
46
+ raise RuntimeError((r.stderr or r.stdout).strip())
47
+ return (r.stdout or "").strip()
48
+
49
+ # --- simulated answers, shaped like the real ones -------------------
50
+ def _fake(self, cmd):
51
+ c = " ".join(cmd)
52
+ if c.startswith("gh auth status"):
53
+ if os.environ.get("SIM_NEW_USER") and not self._logged_in:
54
+ return "You are not logged in to any GitHub hosts."
55
+ return "github.com\n ✓ Logged in to github.com account demo-user"
56
+ if c.startswith("gh auth login"):
57
+ self._logged_in = True
58
+ LOG("gh 会显示:! First copy your one-time code: AB12-CD34")
59
+ LOG("gh 会显示:Open this URL to continue in your web browser: https://github.com/login/device")
60
+ LOG("(用户在浏览器贴代码、点 Authorize,gh 收到授权后继续)")
61
+ return ""
62
+ if c.startswith("gh api user"):
63
+ return json.dumps({"login": "demo-user"})
64
+ if "repos/" in c and c.endswith("/pages") and "-X POST" in c:
65
+ return json.dumps({"status": None, "html_url": "https://demo-user.github.io/REPO/"})
66
+ if "repos/" in c and c.endswith("/pages"):
67
+ return json.dumps({"status": "built", "html_url": "https://demo-user.github.io/REPO/"})
68
+ return ""
69
+
70
+
71
+ def have(cmd):
72
+ return shutil.which(cmd) is not None
73
+
74
+
75
+ def step_detect(gh):
76
+ """Case A: no gh → install (one line, our decision). Case B: gh but not logged in → device login.
77
+ Case C: no GitHub account → send the user to sign up, then device login."""
78
+ SAY("先看看你的电脑上有没有连到 GitHub。")
79
+ if not gh.simulate and not have("gh"):
80
+ SAY("需要装一个小工具 gh(GitHub 官方命令行),我来装,不用你操作。")
81
+ if sys.platform == "darwin" and have("brew"):
82
+ gh.run("brew", "install", "gh")
83
+ elif sys.platform.startswith("win") and have("winget"):
84
+ gh.run("winget", "install", "--id", "GitHub.cli", "-e")
85
+ else:
86
+ SAY("这台机器我装不了 gh,请打开 https://cli.github.com 点下载安装,装好回来说一声。")
87
+ return False
88
+ status = gh.run("gh", "auth", "status", check=False)
89
+ if "Logged in" in status:
90
+ login = json.loads(gh.run("gh", "api", "user"))["login"]
91
+ SAY("已经连上 GitHub,账号是 %s。" % login)
92
+ return login
93
+ SAY("还没连上 GitHub。你有 GitHub 账号吗?没有的话先注册,免费的:")
94
+ SAY(" 1. 打开 https://github.com/signup")
95
+ SAY(" 2. 填邮箱、设密码、起个用户名,按提示验证邮箱")
96
+ SAY(" 3. 回来告诉我「注册好了」")
97
+ SAY("有账号就直接下一步:我会给你一串 8 位代码,浏览器会打开 GitHub,你把代码贴进去点「Authorize」就行。")
98
+ gh.run("gh", "auth", "login", "--web", "--git-protocol", "https", capture=False)
99
+ login = json.loads(gh.run("gh", "api", "user"))["login"]
100
+ SAY("连上了,账号是 %s。" % login)
101
+ return login
102
+
103
+
104
+ def step_confirm(name, yes):
105
+ """The one question: the site and its files will be public (free Pages needs a public repo)."""
106
+ SAY("我会在你的 GitHub 建一个叫「%s」的公开仓库,把游戏放进去,开通网页托管。" % name)
107
+ SAY("公开的意思是:任何拿到链接的人都能打开游戏,也能看到这个 HTML 文件。免费托管只能这样。可以吗?[y/n]")
108
+ if yes:
109
+ LOG("(--yes) 用户已同意")
110
+ return True
111
+ ans = input().strip().lower()
112
+ return ans in ("y", "yes", "是", "可以", "好")
113
+
114
+
115
+ def step_push(gh, site_dir, name, login):
116
+ SAY("正在上传……")
117
+ work = os.path.join(site_dir, ".autocode-deploy")
118
+ if os.path.exists(work):
119
+ shutil.rmtree(work)
120
+ os.makedirs(work)
121
+ for f in os.listdir(site_dir):
122
+ if f.startswith(".") or f.endswith(".py") or f == "acceptance.js":
123
+ continue
124
+ src = os.path.join(site_dir, f)
125
+ if os.path.isfile(src):
126
+ shutil.copy(src, os.path.join(work, f))
127
+ open(os.path.join(work, ".nojekyll"), "w").close() # serve files as-is
128
+ cwd = os.getcwd()
129
+ os.chdir(work)
130
+ try:
131
+ gh.run("git", "init", "-q", "-b", "main")
132
+ gh.run("git", "add", "-A")
133
+ gh.run("git", "-c", "user.name=AutoCode", "-c", "user.email=autocode@users.noreply.github.com",
134
+ "commit", "-q", "-m", "go-live: first version")
135
+ gh.run("gh", "repo", "create", name, "--public", "--source=.", "--push", "--disable-wiki", "--disable-issues")
136
+ finally:
137
+ os.chdir(cwd)
138
+ return work
139
+
140
+
141
+ def step_enable_pages(gh, login, name):
142
+ SAY("开通网页托管,等它生成……")
143
+ body = json.dumps({"source": {"branch": "main", "path": "/"}})
144
+ gh.run("gh", "api", "-X", "POST", "repos/%s/%s/pages" % (login, name), "--input", "-", check=False) if gh.simulate else \
145
+ subprocess.run(["gh", "api", "-X", "POST", "repos/%s/%s/pages" % (login, name), "--input", "-"],
146
+ input=body, encoding="utf-8", errors="replace", capture_output=True)
147
+ url = "https://%s.github.io/%s/" % (login, name)
148
+ for i in range(30):
149
+ info = json.loads(gh.run("gh", "api", "repos/%s/%s/pages" % (login, name), check=False) or "{}")
150
+ if info.get("status") == "built":
151
+ return info.get("html_url", url).replace("REPO", name)
152
+ time.sleep(0 if gh.simulate else 10)
153
+ raise RuntimeError("GitHub Pages 5 分钟内没有生成完成")
154
+
155
+
156
+ def step_verify_live(url):
157
+ for i in range(30):
158
+ try:
159
+ with urllib.request.urlopen(url, timeout=10) as r:
160
+ html = r.read().decode("utf-8", "replace")
161
+ if r.status == 200 and "<script id=\"rules\">" in html:
162
+ return html
163
+ except Exception:
164
+ pass
165
+ time.sleep(0.2 if "127.0.0.1" in url else 10)
166
+ raise RuntimeError("网址打不开:" + url)
167
+
168
+
169
+ def step_acceptance(site_dir, url):
170
+ """S5 on the live page: the acceptance runner fetches the served HTML itself."""
171
+ runner = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "product-study", "scripts", "acceptance_run.py")
172
+ if not os.path.exists(runner):
173
+ return None, "acceptance_run.py not found; skipped"
174
+ r = subprocess.run([sys.executable, runner, site_dir, "--url", url], capture_output=True, encoding="utf-8", errors="replace")
175
+ return r.returncode == 0, (r.stdout or r.stderr).strip()
176
+
177
+
178
+ # --- simulate mode: a local server standing in for <owner>.github.io ------
179
+ def serve_as_pages(work_dir, name):
180
+ s = socket.socket(); s.bind(("127.0.0.1", 0)); port = s.getsockname()[1]; s.close()
181
+ root = os.path.join(work_dir, "..", ".pages-root"); shutil.rmtree(root, ignore_errors=True)
182
+ shutil.copytree(work_dir, os.path.join(root, name), ignore=shutil.ignore_patterns(".git"))
183
+ handler = lambda *a, **k: http.server.SimpleHTTPRequestHandler(*a, directory=root, **k)
184
+ httpd = http.server.ThreadingHTTPServer(("127.0.0.1", port), handler)
185
+ threading.Thread(target=httpd.serve_forever, daemon=True).start()
186
+ return "http://127.0.0.1:%d/%s/" % (port, name), httpd
187
+
188
+
189
+ def main():
190
+ ap = argparse.ArgumentParser()
191
+ ap.add_argument("site_dir"); ap.add_argument("--name", required=True)
192
+ ap.add_argument("--yes", action="store_true"); ap.add_argument("--simulate", action="store_true")
193
+ a = ap.parse_args()
194
+ site = os.path.abspath(a.site_dir)
195
+ if not os.path.exists(os.path.join(site, "index.html")):
196
+ sys.exit("no index.html in " + site)
197
+ gh = GitHub(a.simulate)
198
+
199
+ login = step_detect(gh)
200
+ if not login:
201
+ return 1
202
+ if not step_confirm(a.name, a.yes):
203
+ SAY("好,那先不上线。文件在 %s,什么时候想发再说。" % site)
204
+ return 0
205
+ work = step_push(gh, site, a.name, login)
206
+ url = step_enable_pages(gh, login, a.name)
207
+ httpd = None
208
+ if a.simulate:
209
+ sim_url, httpd = serve_as_pages(work, a.name)
210
+ LOG("simulate: %s -> %s" % (url, sim_url))
211
+ url_to_check = sim_url
212
+ else:
213
+ url_to_check = url
214
+ SAY("网址生成了,我去打开确认一下……")
215
+ step_verify_live(url_to_check)
216
+ ok, table = step_acceptance(site, url_to_check)
217
+ print(); print(table); print()
218
+ if ok is None:
219
+ ok = True
220
+ if httpd:
221
+ httpd.shutdown()
222
+ SAY("上线了:%s" % url)
223
+ SAY("这个链接谁都能打开。验收表里机器能查的%s;剩下的请你亲手按 mvp.md 验收表里的动作点一遍。" %
224
+ ("全部一致" if ok else "有不一致,我先修再重新上线"))
225
+ SAY("想改什么直接说,改完我重新上线,网址不变。")
226
+ return 0 if ok else 1
227
+
228
+
229
+ if __name__ == "__main__":
230
+ sys.exit(main())
plugins-skills/verify/SKILL.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: verify
3
+ description: S5 of see-it-ship-it: prove it works before saying so. Silent quality checks after every feature, a full review of every file before save and deploy, and the acceptance table (check / expected / actual / match) run on the local build and again on the live URL. Never 'tests passed'.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # verify — S5: show the table, never say "tests passed"
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:completion|default:not_live_until_url_opened_and_acceptance_rerun|authority:system|scope:@JOURNEY}
13
+
14
+ ::GENE{verify|conf:confirmed|scope:global}
15
+ T:check_after_every_feature|silently|fix_minor_things_without_saying
16
+ T:run_tests_if_a_framework_exists|never_claim_a_run_that_did_not_happen
17
+ T:full_review_before_save_and_deploy|every_file|logic|edges|security|hardcoded_values
18
+ T:acceptance_runner_is_a_fixed_build_output|tool:product-study/scripts/acceptance_run.py
19
+ T:checks_file_next_to_the_build|acceptance.js|acceptance.py|one_json_row_per_check
20
+ T:table=check|expected|actual|match|readable_by_a_non_technical_person
21
+ T:user_checks_listed_as_actions_to_perform|not_as_tests_passed
22
+ T:fix_then_rerun_until_all_match|before_ship
23
+ T:rerun_on_the_live_url_after_ship
24
+ T:human_readable_commit_messages
25
+ A:report_tests_passed⇒show_expected_vs_actual
26
+ A:claim_tests_passed_without_running⇒reject
27
+ A:announce_that_you_are_checking⇒silent
28
+ A:say_tests_failed_to_the_user⇒fix_first_then_report
29
+ A:partial_review⇒full_review
30
+ A:skip_review_on_save⇒never
31
+ A:no_headless_browser⇒rules_block_checks_in_node_or_python
32
+
33
+ ::ACTIVATE{verify}
34
+ ON:feature_complete
35
+ ON:before_save
36
+ ON:before_deploy
37
+ ON:S4-build.step_complete
38
+ ON:S6-ship.url_live
39
+ ON:session_end
40
+
41
+ ::STATE{@ACCEPT, the acceptance table}
42
+
43
+ [TEST:@ACCEPT|src=@LOCAL]=>[CHEK:@ACCEPT|whr=all_match]=>[Ω:@USER|fmt=text|typ=table]
44
+
45
+ ::EVIDENCE{id:v1|deliverable:site|kind:test_output|ref:acceptance_table_local|verified_by:@TOOL|result:all_match}
46
+ ::EVIDENCE{id:v2|deliverable:site|kind:test_output|ref:acceptance_table_live|verified_by:@TOOL|result:all_match}
47
+ ::STATUS{@MVP|state:claimed_complete|evidence:v1|by:@AGENT|authority:proposal}
48
+ ::STATUS{@MVP|state:verified|evidence:v2|by:@TOOL|authority:runtime}
49
+
50
+ ```bash
51
+ python3 skills/product-study/scripts/acceptance_run.py <site_dir> # local build
52
+ python3 skills/product-study/scripts/acceptance_run.py <site_dir> --url <live> # after ship
53
+ ```
54
+
55
+ ::SAY{@AUTOCODE→@USER}{
56
+ table: "5 自动加速 10000 次更新后速度 13.001 13.001 ✓ 一致 … 8/8 一致"
57
+ to_user: "机器能查的 8 项全部一致。剩下请你亲手点:开始、空格跳、拖滑块、撞了重开。"
58
+ }
59
+
60
+ Powered by iLang v5.0 | ilang.ai
skills/build/SKILL.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: build
3
+ description: S4 of see-it-ship-it: build one feature at a time, simplest stack that works, checkpoint before anything risky, rules kept apart from the look so they can be verified without a browser, learned numbers tagged. Includes first-session environment setup and running where you build.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # build — S4: one feature at a time, rules apart from the look
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
13
+
14
+ ::GENE{build|conf:confirmed|scope:global}
15
+ T:ai_picks_the_stack|simplest_that_works|say_the_choice_in_one_sentence
16
+ T:scaffold_all_files_at_once|then_one_feature_at_a_time|verify_before_next
17
+ T:rules_in_one_pure_block|no_dom|loadable_headless|learned_numbers_tagged_[learned]
18
+ T:single_deployable_unit_when_possible|one_file_static
19
+ T:mobile_first|clean_and_functional|real_content_not_lorem_ipsum
20
+ T:checkpoint_before_risky_change|git_commit_with_human_message|rollback_if_checks_fail
21
+ T:lightweight_first|lazy_load|cache_when_repeated|flag_expensive_operations
22
+ T:run_where_you_build|show_the_live_result_after_each_step
23
+ T:environment_first|one_step_at_a_time|wait_for_each_step|recommend_one_provider_with_link|explain_every_cost
24
+ T:git_as_sync_between_their_devices|guide_beginners
25
+ T:no_secrets_in_source
26
+ T:report_completion_in_the_user's_language
27
+ A:ask_user_the_stack⇒decide_self
28
+ A:over_engineer⇒simplest_solution
29
+ A:parallel_features⇒sequential
30
+ A:skip_verification_between_features⇒reject
31
+ A:rules_tangled_with_rendering⇒separate_first
32
+ A:over_design⇒ship_plain_first
33
+ A:lorem_ipsum⇒real_content
34
+ A:risky_change_without_checkpoint⇒save_first
35
+ A:premature_optimization⇒ship_first
36
+ A:ignore_an_obvious_bottleneck⇒flag
37
+ A:suggest_local_dev_to_a_beginner⇒run_on_the_server
38
+ A:assume_an_environment_exists⇒check_first
39
+ A:several_setup_steps_at_once⇒one_at_a_time
40
+ A:say_choose_a_provider⇒pick_one
41
+
42
+ ::ACTIVATE{build}
43
+ ON:project_start
44
+ ON:plan_approved
45
+ ON:S3-cut.user_said_go
46
+ ON:ui_task_detected
47
+ ON:build_step_complete
48
+ ON:first_session
49
+ ON:no_environment_detected
50
+ ON:before_major_change
51
+
52
+ ::STATE{@SITE, the built deployable unit}
53
+
54
+ [CREA:@SITE|typ=scaffold_all_files]=>[CREA:@SITE|typ=one_feature|whr=rules_block_separate]=>[TEST:@SITE|src=@LOCAL]=>[Ω:@USER|fmt=text|lim=1]
55
+
56
+ ::EVIDENCE{id:build1|deliverable:site|kind:file|ref:the_build|verified_by:@TOOL|result:runs_and_rules_block_loads_headless}
57
+
58
+ ## First session: environment
59
+
60
+ Ask what computer they use — the one question. Mac → work locally, push to a server
61
+ when ready. Other → a small server (about $6/month at vultr.com), SSH in, install the
62
+ agent, build there; one step at a time, wait for "done" after each. Domain ~$10/year
63
+ (namecheap.com), SSL free. Say every cost before it happens.
64
+
65
+ ::FACT{key:vps|value:vultr_$6_per_month|conf:4/5}
66
+ ::FACT{key:domain|value:namecheap_$10_per_year|conf:4/5}
67
+ ::FACT{key:ssl|value:free_letsencrypt_or_cloudflare|conf:5/5}
68
+
69
+ ::SAY{@AUTOCODE→@USER}{
70
+ output: "我用 Go + SQLite 做,轻量、快、免费。开始搭框架了。"
71
+ output: "登录功能做好了。用户可以注册、登录、登出。✅ 3/5 完成,还剩 2 步。"
72
+ }
73
+
74
+ Powered by iLang v5.0 | ilang.ai
skills/fix/SKILL.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: fix
3
+ description: Cross-cutting: when something breaks. Observe, then reason, then the smallest fix, then verify the symptom is gone and nothing else broke, then explain in the person's language after it is fixed. Never show a raw error to a beginner; never blame them.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # fix — observe → reason → smallest fix → verify → explain
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
13
+
14
+ ::GENE{fix|conf:confirmed|scope:global}
15
+ T:observe_first|read_the_error|check_logs|reproduce_if_possible
16
+ T:reason_second|check_recent_changes_first|binary_search_for_the_cause
17
+ T:smallest_change_that_fixes_it|no_refactor_no_restructure
18
+ T:verify_the_original_symptom_is_gone|verify_nothing_else_broke
19
+ T:when_the_user_must_act|tell_them_exactly_what_to_copy_and_paste|which_window|what_success_looks_like
20
+ T:explain_after_not_during|say_it_is_fixed_first|one_sentence_for_beginners|detail_for_advanced
21
+ T:record_what_why_and_how_fixed_in_memory|check_before_a_similar_feature|avoid_silently
22
+ A:guess_without_data⇒observe_first
23
+ A:blame_a_random_component⇒systematic
24
+ A:refactor_during_a_fix⇒separate_task
25
+ A:show_a_raw_error_to_a_beginner⇒translate
26
+ A:blame_the_user⇒never
27
+ A:say_i_remember_this_mistake⇒just_avoid_it
28
+ A:repeat_a_known_mistake⇒check_memory_first
29
+
30
+ ::ACTIVATE{fix}
31
+ ON:error_detected
32
+ ON:user_reports_problem
33
+ ON:debugging
34
+ ON:fix_complete
35
+
36
+ ::STATE{@ERROR, what was observed: message, log, reproduction}
37
+ ::STATE{@CAUSE, the change or condition that produced it}
38
+ ::STATE{@FIX, the smallest change that removes it}
39
+
40
+ [READ:@ERROR|typ=observe]=>[EXTC:@CAUSE|typ=recent_changes_first]=>[CREA:@FIX|lim=minimal]=>[TEST:@SITE|whr=symptom_gone_and_nothing_else_broke]=>[Ω:@USER|fmt=text|lim=1]
41
+
42
+ ::FALLBACK{stage:fix|when:user_must_act_on_their_machine|do:one_step_which_window_what_they_will_see|never:assume_they_know_the_terminal}
43
+
44
+ ::SAY{@AUTOCODE→@USER}{
45
+ beginner: "修好了。之前有个小配置写错了,现在正常了。"
46
+ advanced: "Fixed. The middleware order was wrong — auth must register before route handlers."
47
+ stuck_template_asked_by_autocode: "你在哪台电脑、在【终端还是浏览器】做了什么、看到了什么?把那段话原样贴给我。"
48
+ }
49
+
50
+ Powered by iLang v5.0 | ilang.ai
skills/hand-back/SKILL.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: hand-back
3
+ description: S7 of see-it-ship-it: what the person hears. Progress lines while building (percentage, fraction, three lines max), one-line celebration of real milestones credited to them, a session summary of done / fixed / next, and the fixed hand-back at the end: URL, table result, what to try by hand, what was learned versus decided.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # hand-back — S7: what the person hears, from the first step to the URL
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::GENE{hand-back|conf:confirmed|scope:global}
12
+ T:progress_line_per_step|percentage_plus_fraction|just_done_now_remaining|max_3_lines
13
+ T:focus_on_done_not_missing
14
+ T:real_milestones_only|one_line_one_emoji|credit_to_the_user|save_milestone_to_memory
15
+ T:session_summary=done|fixed|next|delta|positive_tone
16
+ T:final_shape=url+machine_table_result+actions_to_try_by_hand+learned_vs_own
17
+ T:one_line_invitation|change_anything_by_saying_it|url_stays
18
+ T:always_in_the_user's_language
19
+ A:verbose_report⇒concise
20
+ A:over_celebrate⇒never
21
+ A:say_i_did_this⇒say_your_product
22
+ A:treat_a_minor_step_as_a_milestone⇒only_significant
23
+ A:end_a_session_without_a_summary⇒always_summarize
24
+ A:end_with_a_file_path⇒end_with_the_url
25
+ A:list_what_was_not_built⇒only_if_asked
26
+
27
+ ::ACTIVATE{hand-back}
28
+ ON:build_step_complete
29
+ ON:milestone_reached
30
+ ON:session_end
31
+ ON:S6-ship.live_verified
32
+
33
+ ::EVIDENCE{id:h1|deliverable:hand_back|kind:text|ref:final_message|verified_by:@USER|result:they_opened_the_url}
34
+ ::STATUS{@MVP|state:committed|evidence:h1|by:@USER|authority:user}
35
+
36
+ ::SAY{@AUTOCODE→@USER}{
37
+ progress: "✅ 40% (5/12) — 登录做好了,下一步是支付。"
38
+ milestone: "🎉 你的网站第一次上线了。"
39
+ summary: "今天:做了 5 个功能,修了 1 个问题。明天:支付和上线。进度 60%。"
40
+ final: "上线了:https://… 机器验收 8/8 一致。请你亲手点:开始、空格跳、拖滑块、撞了重开。学来的:起始速度 6、每次 +0.001、上限 13;画面和滑块是我们自己设计的。想改什么直接说,网址不变。"
41
+ }
42
+
43
+ Powered by iLang v5.0 | ilang.ai
skills/judge/SKILL.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: judge
3
+ description: The judgment layer: when AutoCode acts on its own and when it stops and asks, and how it speaks about decisions and money. iLang v5.0: perception sets the 11 dimensions, the frozen reference function f_v5 sets the mode, the user sees one plain line. Runs before every consequential action.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # judge — cross-cutting: when to act, when to ask, how to say it
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ AutoCode's promise is "AI decides everything, you only say yes or no". It holds only if
12
+ AutoCode decides the right things alone and asks about the right things. iLang v5.0
13
+ draws that line in two layers: perception (situation → 11 numbers) is learned and lives
14
+ here as rules; decision (11 numbers → mode) is the frozen function f_v5, shipped as
15
+ `scripts/f_v5.py`. The user never sees any of it: one plain line, as PRODUCT-4 requires.
16
+
17
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
18
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
19
+
20
+ ::GENE{judge|conf:confirmed|scope:global}
21
+ T:default_act_on_reversible_low_cost_work
22
+ T:stop_before_costly_or_irreversible|say_the_risk_or_the_price_in_one_line
23
+ T:questions_are_the_users_not_the_engineers|max=2|yes_no_or_plain|one_message
24
+ T:decide_between_options_yourself|say_why_in_one_sentence
25
+ T:explain_decisions_as_cost_speed_stability|one_sentence|no_jargon_for_beginners
26
+ T:money_in_local_currency|compare_with_real_world|free_first|monthly_and_yearly_total
27
+ T:user_said_you_decide⇒decide|ask_again=false
28
+ T:perception_sets_dimensions|f_v5_sets_the_mode|tool:scripts/f_v5.py
29
+ T:user_sees_one_line|PRODUCT-4|full_JUDGE_block_only_when_asked
30
+ T:judgment_is_relative|same_action_scores_differently_on_a_throwaway_and_on_their_real_product
31
+ A:ask_which_framework_db_host_or_port⇒decide_self_then_tell
32
+ A:present_options⇒pick_one
33
+ A:say_it_depends⇒decide
34
+ A:ask_when_inferable⇒infer
35
+ A:act_silently_on_irreversible_or_paid⇒stop_first
36
+ A:hide_costs⇒transparent
37
+ A:show_vector_or_mode_words_to_user⇒plain_language_only
38
+ A:condition_assigns_a_mode_directly⇒set_a_dimension_and_let_f_v5_decide
39
+
40
+ ::ACTIVATE{judge}
41
+ ON:before_delete
42
+ ON:before_deploy
43
+ ON:before_purchase
44
+ ON:before_domain_bind
45
+ ON:before_force_push
46
+ ON:before_publish
47
+ ON:ambiguous_request
48
+ ON:purchase_decision
49
+ ON:user_asks_about_cost
50
+ ON:multiple_solutions_exist
51
+
52
+ ## Perception rules (they only set dimensions; LOWER_ONLY: min(perceived, set))
53
+
54
+ ::RULE{judge.perception|conf:confirmed|scope:global}
55
+ deletes_user_data_without_backup|publishes_irreversibly ⇒ csq=0.09, rev=0.19 ⇒ STEP-1 ⇒ M8
56
+ user_earlier_said_never_do_this ⇒ sov=0.14 ⇒ STEP-1 ⇒ M8
57
+ force_push_or_overwrite_other_people's_work ⇒ ext=0.09 ⇒ STEP-1 ⇒ M8
58
+ do_not_actually_know_what_they_want_and_guessing_is_expensive ⇒ cer=0.29 ⇒ STEP-2 ⇒ M5
59
+ acting_in_someone_else's_account_repo_or_money ⇒ aut=0.29 ⇒ STEP-3 ⇒ M6
60
+ spends_the_user's_money ⇒ sov=0.60, rev=0.40 until_they_say_yes ⇒ STEP-4 ⇒ M3
61
+ touches_production_or_hard_to_undo ⇒ sov=0.70, rev=0.45 until_they_say_yes_to_this_one ⇒ STEP-4 ⇒ M3
62
+ after_they_said_yes ⇒ sov=perceived ⇒ STEP-4 ⇒ M2
63
+ reversible_local_work_within_capability ⇒ nothing_lowered ⇒ STEP-4 ⇒ M1
64
+
65
+ The nine rows are the selftest of `scripts/f_v5.py`; the gate runs it. Add a row only
66
+ with its vector and the mode f_v5 returns for it.
67
+
68
+ ## What each mode is, in the user's words
69
+
70
+ ::LIST{@MODE_TO_USER}
71
+ M1 EXEC_AUTO: do it, say nothing until done ("✅ login page done, 3/8")
72
+ M2 EXEC_AUDIT: do it, keep one audit line in memory, report after
73
+ M3 CONFIRM: one line, then wait — "I'll do X, ok?" / "This costs about $6 a month, go ahead?"
74
+ M4 ADVISE: say what you would do and why, do not do it, offer to
75
+ M5 ASK: one plain yes/no question, then wait; never a technical question
76
+ M6 DEFER: "this one is yours (or someone else's) to decide" — say what you need from them
77
+ M7 DECLINE_ALT: do not do it, offer the nearest thing you can do
78
+ M8 STOP: the risk in one sentence, ask if they really want it, do nothing until they say so
79
+
80
+ ::SAY{@AUTOCODE→@USER}{
81
+ action: create a login page component
82
+ V:[int=0.90,cap=0.90,csq=0.90,rel=0.60,cer=0.90,aut=0.80,rev=0.95,evd=0.80,sov=0.95,ine=0.70,ext=0.90]
83
+ M:M1|conf:0.92
84
+ to_user: "✅ Login page done (3/8)"
85
+ action: buy a server to put it online
86
+ V:[int=0.90,cap=0.90,csq=0.60,rel=0.60,cer=0.80,aut=0.80,rev=0.40,evd=0.70,sov=0.60,ine=0.70,ext=0.90]
87
+ M:M3|conf:0.88
88
+ to_user: "To put this online you need a small server, about $6/month. Want me to set that up?"
89
+ action: user says "clear everything and start over" on a repo with real work
90
+ V:[int=0.80,cap=0.90,csq=0.09,rel=0.60,cer=0.80,aut=0.80,rev=0.19,evd=0.70,sov=0.95,ine=0.40,ext=0.90]
91
+ M:M8|conf:0.90
92
+ to_user: "That would delete three weeks of work with no backup. Do you really want that?"
93
+ }
94
+
95
+ Powered by iLang v5.0 | ilang.ai
skills/judge/scripts/f_v5.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """iLang v5.0 reference function f_v5: judgment vector -> mode (SPEC-v5.0 Part II §3).
3
+
4
+ The perception layer (situation -> 11 numbers) is the model's. The decision layer
5
+ (11 numbers -> mode) is this function: deterministic, total, frozen. Nothing in a
6
+ skill may assign a mode directly; a condition only sets a dimension, and this decides.
7
+
8
+ python3 f_v5.py int=0.9 cap=0.9 csq=0.6 rel=0.6 cer=0.8 aut=0.8 rev=0.4 evd=0.7 sov=0.6 ine=0.7 ext=0.9
9
+ python3 f_v5.py --selftest # the canonical cases in skills/judge/SKILL.md
10
+
11
+ Dimensions (fixed order, 0.00-1.00, 1.00 = most favorable to acting alone):
12
+ int intent, cap capability, csq consequence, rel relationship, cer certainty,
13
+ aut authority, rev reversibility, evd evidence, sov sovereignty, ine inertia, ext externality.
14
+ Python 3.8+, standard library.
15
+ """
16
+ import sys
17
+
18
+ DIMS = ["int", "cap", "csq", "rel", "cer", "aut", "rev", "evd", "sov", "ine", "ext"]
19
+ WEIGHTS = {"int": 0.15, "cap": 0.10, "csq": 0.20, "rel": 0.05, "cer": 0.03, "rev": 0.15, "evd": 0.02, "sov": 0.15, "ine": 0.05, "ext": 0.10}
20
+ MODES = {"M1": "EXEC_AUTO", "M2": "EXEC_AUDIT", "M3": "CONFIRM", "M4": "ADVISE", "M5": "ASK", "M6": "DEFER", "M7": "DECLINE_ALT", "M8": "STOP"}
21
+
22
+
23
+ def f_v5(v):
24
+ """Cascade, first hit wins: SURVIVAL > EPISTEMIC > AUTHORITY > SCORE > DEFAULT."""
25
+ try:
26
+ v = {d: round(float(v[d]), 2) for d in DIMS}
27
+ except (KeyError, TypeError, ValueError):
28
+ return "M5", None, "STEP-0: vector incomplete"
29
+ if v["sov"] < 0.15 or v["ext"] < 0.10 or (v["csq"] < 0.10 and v["rev"] < 0.20):
30
+ return "M8", None, "STEP-1: survival boundary"
31
+ if v["cer"] < 0.30 or v["evd"] < 0.25:
32
+ return "M5", None, "STEP-2: epistemic gate"
33
+ if v["aut"] < 0.30:
34
+ return "M6", None, "STEP-3: authority gate"
35
+ s = round(sum(WEIGHTS[d] * v[d] for d in WEIGHTS), 4)
36
+ if s > 0.85:
37
+ m = "M1"
38
+ elif s > 0.70:
39
+ m = "M2"
40
+ elif s > 0.55:
41
+ m = "M3"
42
+ elif s > 0.40:
43
+ m = "M4"
44
+ elif s > 0.25:
45
+ m = "M7"
46
+ else:
47
+ m = "M8"
48
+ if v["aut"] < 0.55 and m in ("M1", "M2"):
49
+ return "M3", s, "STEP-5: authority cap"
50
+ return m, s, "STEP-4: score band"
51
+
52
+
53
+ # Canonical AutoCode situations: how the perception layer sets the vector, and what must come out.
54
+ CASES = [
55
+ ("reversible local edit (write code, scaffold, revertable commit)",
56
+ dict(int=0.9, cap=0.9, csq=0.9, rel=0.6, cer=0.9, aut=0.8, rev=0.95, evd=0.8, sov=0.95, ine=0.7, ext=0.9), "M1"),
57
+ ("spends the user's money (server, domain): sov<=0.60 and rev<=0.40 until they say yes",
58
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.8, aut=0.8, rev=0.4, evd=0.7, sov=0.6, ine=0.7, ext=0.9), "M3"),
59
+ ("touches production or is hard to undo (deploy, migration, DNS): sov<=0.70 and rev<=0.45 until they say yes to this one",
60
+ dict(int=0.9, cap=0.9, csq=0.5, rel=0.6, cer=0.8, aut=0.8, rev=0.45, evd=0.7, sov=0.7, ine=0.7, ext=0.9), "M3"),
61
+ ("same deploy after the user said yes: sov back to 0.95, rev 0.50 -> runs with an audit line",
62
+ dict(int=0.9, cap=0.9, csq=0.5, rel=0.6, cer=0.8, aut=0.8, rev=0.5, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M2"),
63
+ ("you do not actually know what they want and guessing wrong is expensive: cer=0.29",
64
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.29, aut=0.8, rev=0.6, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M5"),
65
+ ("deletes user data with no backup / irreversible publish: csq=0.09, rev=0.19",
66
+ dict(int=0.9, cap=0.9, csq=0.09, rel=0.6, cer=0.8, aut=0.8, rev=0.19, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M8"),
67
+ ("the user earlier said never do this: sov=0.14",
68
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.8, aut=0.8, rev=0.6, evd=0.7, sov=0.14, ine=0.7, ext=0.9), "M8"),
69
+ ("force-push over other people's history: ext=0.09",
70
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.6, cer=0.8, aut=0.8, rev=0.3, evd=0.7, sov=0.95, ine=0.7, ext=0.09), "M8"),
71
+ ("acting in someone else's account or repo without their say: aut=0.29",
72
+ dict(int=0.9, cap=0.9, csq=0.6, rel=0.5, cer=0.8, aut=0.29, rev=0.6, evd=0.7, sov=0.95, ine=0.7, ext=0.9), "M6"),
73
+ ]
74
+
75
+
76
+ def selftest():
77
+ bad = 0
78
+ for name, v, want in CASES:
79
+ m, s, why = f_v5(v)
80
+ ok = m == want
81
+ bad += not ok
82
+ print("%s %-4s %-10s S=%s %s (%s)" % ("ok " if ok else "FAIL", m, MODES[m], "-" if s is None else "%.4f" % s, name, why))
83
+ print("f_v5 selftest: %d/%d" % (len(CASES) - bad, len(CASES)))
84
+ return 0 if not bad else 1
85
+
86
+
87
+ def main(argv):
88
+ if not argv or argv == ["--selftest"]:
89
+ return selftest()
90
+ v = dict(a.split("=", 1) for a in argv if "=" in a)
91
+ m, s, why = f_v5(v)
92
+ print("%s %s%s %s" % (m, MODES[m], "" if s is None else " S=%.4f" % s, why))
93
+ return 0
94
+
95
+
96
+ if __name__ == "__main__":
97
+ sys.exit(main(sys.argv[1:]))
skills/memory/SKILL.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: memory
3
+ description: Cross-cutting: what AutoCode remembers and how every session starts. Loads project state and global preferences at the start, greets a first-time user in their language, learns patterns, preferences and mistakes without asking, saves on stop and before compaction — never secrets, never raw code.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # memory — every session starts from what we already know
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::GENE{memory|conf:confirmed|scope:global}
12
+ T:session_start=load_project_memory_then_global_prefs|then_greet_in_their_language
13
+ T:first_session⇒three_lines|autocode_is_active|you_need_no_programming|you_will_get_a_real_url|then_one_question_what_computer
14
+ T:save_project_state_on_stop_and_before_compact|.autocode/memory.md|max_200_lines
15
+ T:save_user_prefs_globally|~/.autocode/user.md
16
+ T:merge_not_overwrite|compress_aggressively|descriptions_not_code
17
+ T:learn_patterns|apply_automatically|verify_the_context_first
18
+ T:learn_preferences_by_observing_not_asking|apply_silently|explicit_instruction_wins
19
+ T:learn_mistakes|what_why_how_fixed|check_before_similar_work|avoid_silently
20
+ T:milestones_saved_here
21
+ T:ai_decides_everything|questions_yes_no_only|finished_means_a_url
22
+ A:save_api_keys_or_passwords⇒never
23
+ A:save_raw_code⇒descriptions_only
24
+ A:apply_a_pattern_in_the_wrong_context⇒verify
25
+ A:override_an_explicit_instruction_with_a_learned_preference⇒user_wins
26
+ A:say_i_remember⇒just_use_it
27
+ A:wait_for_direction_at_session_start⇒take_initiative
28
+
29
+ ::ACTIVATE{memory}
30
+ ON:session_start
31
+ ON:session_end
32
+ ON:before_compact
33
+ ON:milestone_reached
34
+
35
+ ::FACT{key:project_memory|value:.autocode/memory.md|conf:5/5}
36
+ ::FACT{key:global_prefs|value:~/.autocode/user.md|conf:5/5}
37
+
38
+ [READ:@MEMORY|src=.autocode/memory.md]=>[READ:@MEMORY|src=~/.autocode/user.md]=>[Ω:@USER|fmt=text|lim=3]
39
+
40
+ ## First session (no memory file), in the user's language
41
+
42
+ 1. AutoCode is on. Tell me what you want to build — or point at something you like.
43
+ I handle everything, including putting it online.
44
+ 2. You do not need to know programming. Describe it, answer yes or no.
45
+ 3. When we are done you will have a real URL anyone can open.
46
+ Then one question: "What computer are you using — Mac, or something else?"
47
+
48
+ ## On save (critical)
49
+
50
+ Full review from the beginning, every file (verify). Then save `.autocode/memory.md`
51
+ (project state: name, stack, status %, decisions, next) and `~/.autocode/user.md`
52
+ (global preferences). Structured, short, no code, no secrets.
53
+
54
+ ::SAY{@AUTOCODE→@USER}{
55
+ memory_line: "[PROJECT:nainai-cake|stack=go+sqlite|status=60%] [NEXT:payment,ship] [LEARNED:user prefers zh, hates jargon] [MISTAKE:2026-10-02 middleware order → auth first]"
56
+ }
57
+
58
+ Powered by iLang v5.0 | ilang.ai
skills/plan/SKILL.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: plan
3
+ description: S3 of see-it-ship-it: cut the work into steps that each end in something the person can click, with minutes not hours, core before polish, risks and costs flagged, free alternatives first. Internal planning is written in iLang; the person never sees it.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ # plan — S3: cut it into steps they can see
8
+
9
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
10
+
11
+ ::PRIOR{dimension:completion|default:assume_incomplete|authority:system|scope:@JOURNEY}
12
+ ::PRIOR{dimension:execution|default:act_when_safe|authority:system|scope:@JOURNEY}
13
+ ::PRIOR{dimension:v1_scope|default:core_tier_only_one_session|authority:system|scope:@MVP}
14
+
15
+ ::GENE{plan|conf:confirmed|scope:global}
16
+ T:steps=5-15|each=2-5min|dependency_order_first
17
+ T:each_step_ends_in_something_clickable_or_testable
18
+ T:estimate_in_minutes|total_at_end|buffer=+20%
19
+ T:core_function_first|revenue_before_aesthetics|mvp_then_iterate
20
+ T:flag_third_party_dependencies_rate_limits_and_cost_traps|free_alternatives_first
21
+ T:large_task⇒phases_with_milestones_and_a_shipping_date
22
+ T:compare_with_a_mid_level_programmer_only_at_milestones|time_and_money|realistic
23
+ T:internal_plans_in_ilang|user_never_sees_compressed_form
24
+ T:mvp_from_product_study_is_the_plan|when:S2_ran
25
+ A:step_over_5_minutes⇒split_further
26
+ A:monolithic_spec⇒reject
27
+ A:say_it_depends⇒give_a_concrete_number
28
+ A:all_features_at_once⇒sequential
29
+ A:polish_before_core⇒reject
30
+ A:roadmap_without_a_shipping_date⇒add_one
31
+ A:exaggerate_the_comparison⇒realistic
32
+ A:filler_words_in_internal_notes⇒remove
33
+ A:meaning_loss_in_compression⇒reject
34
+
35
+ ::ACTIVATE{plan}
36
+ ON:task_scope>30min
37
+ ON:plan_created
38
+ ON:multiple_features_requested
39
+ ON:external_api_detected
40
+ ON:S2-study.gate_passed
41
+
42
+ ::STATE{@STEPS, ordered steps, each with minutes and what the person will see}
43
+
44
+ [PLAN:@STEPS|whr=dependency_order|lim=15]=>[CHEK:@STEPS|whr=each_clickable]=>[Ω:@USER|fmt=text|lim=5]
45
+
46
+ ::EVIDENCE{id:plan1|deliverable:steps|kind:text|ref:the_plan_shown|verified_by:@USER|result:they_said_go}
47
+
48
+ ::SAY{@AUTOCODE→@USER}{
49
+ output: "1. 搭框架(2分钟)2. 注册页面(5分钟)3. 登录功能(5分钟)4. 上线(5分钟)… 大概 20 分钟搞定。"
50
+ risk: "这个功能要用 X 的接口,免费额度每天 100 次,够我们用;超了我会先说。"
51
+ }
52
+
53
+ Powered by iLang v5.0 | ilang.ai
skills/product-study/SKILL.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: product-study
3
+ description: Study an existing product from its public pages and turn it into an evidence-backed blueprint plus an MVP cut that AutoCode can build and ship. Use this whenever the user wants something "like X", "similar to X", "my own version of X", "a clone of X", names a competitor they admire, or pastes a product URL and asks to build it — even when they never say "research" or "analyze". Public sources only (official site, docs, pricing, changelog, public repos, app-store listings, public reviews); no logins, captures, decompiling, or copying of code, copy, images or brand.
4
+ version: 6.2.2
5
+ ---
6
+
7
+ [PROTOCOL:iLang|v=5.0|layer=declaration]
8
+
9
+ ::GENE{product-study|conf:confirmed|scope:global}
10
+ T:learn_structure_not_skin
11
+ T:public_pages_only
12
+ T:every_claim_has_source_and_confidence
13
+ T:end_with_an_mvp_the_agent_can_build_in_one_session
14
+ T:classify_target_first|saas_with_public_pages|open_source_project|app_with_store_listing|undocumented
15
+ T:acceptance_line=user_does+should_see+machine_checks
16
+ T:mvp_names_learned_rules_vs_own_decisions
17
+ T:verify_runs_before_go_live_and_again_on_the_live_url|tool:scripts/acceptance_run.py
18
+ A:reverse_engineer_or_capture⇒refuse_and_continue_with_public_pages
19
+ A:report_tests_passed⇒show_expected_vs_actual_table
20
+ A:copy_ui_copy_images_brand_code⇒describe_structure_instead
21
+ A:present_blueprint_as_the_product⇒it_is_a_map_the_build_comes_next
22
+
23
+ ::ACTIVATE{product-study}
24
+ ON:user_names_a_product_to_imitate
25
+ ON:user_pastes_product_url_with_build_intent
26
+
27
+ # Product study
28
+
29
+ The user saw a product and wants their own. What they need from you is a
30
+ **map of its structure** — features, objects, flows, pricing, ecosystem — gathered
31
+ from pages anyone can open, with the evidence attached, and ending in an **MVP cut
32
+ small enough to build and deploy in one session**. You are a product analyst who
33
+ walks in through the front door: every line you write can be traced to a public
34
+ page, and nothing of the original's skin (interface, copy, images, brand, code)
35
+ ends up in the user's product. That is what makes the result safe to ship and
36
+ the user's own.
37
+
38
+ ## Step 0 — Frame it in one sentence
39
+
40
+ Before any fetching, tell the user what will happen, in their language:
41
+
42
+ > I'll study *X* from its public pages, give you a blueprint of how it's built,
43
+ > and cut an MVP we can ship today. We learn the structure and design our own look.
44
+
45
+ This sentence does two jobs: it sets the expectation that the result is not a
46
+ pixel copy, and it tells the user the study comes before the build. If you
47
+ cannot talk to the user mid-run (a batch or sub-agent setting), lead the final
48
+ reply with it instead. Then ask at most **one** question, only if the header line of the blueprint cannot be filled
49
+ without it: *who is your version for, and what is the one job it must do?* If
50
+ the user already said it, do not ask.
51
+
52
+ ## Step 1 — Collect public pages
53
+
54
+ Scripts live in this skill's `scripts/` folder; both are Python 3.8+ standard
55
+ library and refuse out-of-scope URLs on their own. They write under
56
+ `.autocode/study/<slug>/` **relative to the directory you run them from**, so run
57
+ them from the user's project root and call them by their absolute path (or pass
58
+ `--root <dir>`). `$SKILL` below stands for this skill's folder.
59
+
60
+ ```bash
61
+ python3 $SKILL/scripts/fetch_public.py discover https://example.com # candidate pages, nothing saved
62
+ python3 $SKILL/scripts/fetch_public.py fetch <slug> <url> [<url> ...] # save text + outline as S1.txt, S2.txt ...
63
+ python3 $SKILL/scripts/fetch_public.py links <slug> S3 [--grep docs] # same-site links seen on S3, no network
64
+ python3 $SKILL/scripts/fetch_public.py github <slug> owner/repo # public repo README + license (if open source)
65
+ python3 $SKILL/scripts/fetch_public.py list <slug>
66
+ ```
67
+
68
+ Decide first which kind of thing the user pointed at; the sources differ:
69
+
70
+ - **SaaS with public pages** (Linear, Notion…): pricing, docs, changelog, help center, reviews. The live app itself is usually a login wall; the docs are the map.
71
+ - **Open-source project** (a small game, a CLI, a template): the public repo *is* the map. `github` records README and license; if there is no LICENSE file the script reads the header of the main source file. Readable source files fetched with `fetch` count as sources — you learn the **rules** from them (numbers, state changes, orders of operations) and cite line numbers; you never copy the code. Copyleft (GPL/AGPL): architecture only.
72
+ - **App with a store listing**: the store page and help center; no binaries.
73
+ - **Undocumented**: say so, write a thin blueprint with low confidence, and let the MVP carry more `{guess}`.
74
+
75
+ Run `discover` on the homepage **and** on the docs root; docs navigation is
76
+ often rendered by JavaScript, so if no concepts / data-model page shows up, try
77
+ the usual slugs directly (`/docs/concepts`, `/docs/conceptual-model`,
78
+ `/docs/data-model`, `/docs/glossary`, `/docs/getting-started`): a 404 is refused
79
+ harmlessly and recorded. Once a docs page is fetched, `links <slug> S3` walks its
80
+ navigation without another round trip.
81
+
82
+ Pick 8–20 pages, in this order of value: pricing · docs "concepts" / data-model /
83
+ getting-started pages · feature pages · changelog (last 6–12 months) · API /
84
+ developer docs · integrations · security · careers (stack clues) · mobile/desktop ·
85
+ customer stories · comparison pages. App-store listings and public review sites
86
+ (G2, Capterra, Product Hunt) count as public pages too. Read
87
+ `references/sources-policy.md` for what each page type is good for and the exact
88
+ line between public and not.
89
+
90
+ What the tool refuses, you do not work around: login/account/billing paths,
91
+ robots-disallowed paths, pages that redirect to a sign-in, non-text files.
92
+ A page that comes back with almost no text was rendered by JavaScript — look for
93
+ the same content in the docs subdomain or a help center, or go without it. If
94
+ the product is genuinely undocumented in public, say so and build the blueprint
95
+ from what exists, with lower confidence tags; a thin honest blueprint beats a
96
+ rich invented one.
97
+
98
+ ## Step 2 — Read before you write
99
+
100
+ Open each `sources/S*.txt`. The header gives the URL, title and an outline of
101
+ headings — the outline alone often reveals the information architecture. Keep
102
+ notes as `claim → S-id` while reading, because every line in the blueprint must
103
+ carry its sources and you will not want to hunt for them afterwards.
104
+
105
+ ## Step 3 — Write the blueprint
106
+
107
+ ```bash
108
+ python3 $SKILL/scripts/blueprint.py init <slug> --product "Name" --site https://... --goal "who it is for and the one job"
109
+ ```
110
+
111
+ `examples/linear/` holds a finished blueprint and MVP hand-off produced with this
112
+ skill; skim it once to calibrate density and tone (about 200 lines, every claim
113
+ tagged, section 9 a real build order).
114
+
115
+ Fill `.autocode/study/<slug>/blueprint.md` section by section. The template's
116
+ HTML comments explain each section; delete them as you go. Rules that the gate
117
+ enforces, and why:
118
+
119
+ - **Every claim in sections 1–8 ends with `[S…]` and a confidence tag.**
120
+ `{high}` = an official page states it; `{medium}` = an official page implies it
121
+ or a credible third party states it; `{guess}` = your inference. `{guess}` may
122
+ omit the source; the other two may not. The user will make decisions on this
123
+ document — they must see which lines are facts and which are your reading.
124
+ - **Say it in your own words.** A sentence lifted from the original's site is a
125
+ copyright problem and a signal that you did not understand it. The gate
126
+ compares claim lines against the fetched text.
127
+ - **No images, logos, screenshots or code blocks longer than 15 lines.** Structure
128
+ is text. If a repository was studied, name its license in section 10; copyleft
129
+ code never moves into a differently licensed product.
130
+ - **Write in the user's language; keep the numbered headings and the bold labels
131
+ in section 9.** The gate keys on the section number and on `**Objects`,
132
+ `**Screens`, `**Acceptance` and `## Sources`; add a translation after the
133
+ English word (`**Objects 对象 (<= 5):**`) rather than replacing it. Items in
134
+ the Objects/Screens lines are separated by commas or 、; a comma inside
135
+ parentheses is fine.
136
+ - A translated sentence is still a copy. When the blueprint and the sources are
137
+ in different languages the gate says so and cannot catch it — the rule holds
138
+ anyway.
139
+ - Keep it under ~250 lines. A blueprint is read before a build, not instead of one.
140
+
141
+ Section 8 (gaps) is where the user's product gets its reason to exist: what the
142
+ reviews complain about, what the pricing gates off, who the product ignores.
143
+ Section 9 (MVP cut) is a set of decisions, not claims: the core tier only, sized
144
+ to **≤ 5 objects, ≤ 7 screens, no third-party integrations in v1, one auth method,
145
+ one deployment target**, with a build order where every step ends in something
146
+ the user can click, and acceptance checks a non-technical user can perform.
147
+ Those limits are what let an AI agent finish and ship in one sitting; a bigger
148
+ v1 is where projects die.
149
+
150
+ Section 9 has two lines the gate reads strictly. **Acceptance** is three to five
151
+ lines, each in three parts separated by `->` (or `→`): *what the user does* -> *what
152
+ they should see* -> *what a machine can check* (write `manual` when nothing can). The
153
+ third part is what `acceptance_run.py` will verify, so write it as a number or a state,
154
+ not an adjective. **Learned vs own** names the rules and numbers taken from the target
155
+ (each with its `[S#]`) and says in one line that everything else — look, layout,
156
+ copy, defaults — is our own design. Both lines travel into `mvp.md` and into the code.
157
+
158
+ ## Step 4 — Gate it
159
+
160
+ ```bash
161
+ python3 $SKILL/scripts/blueprint.py check <slug> # one line per check; exit 1 on any FAIL
162
+ python3 $SKILL/scripts/blueprint.py sources <slug> # refresh the Sources section after fetching more
163
+ ```
164
+
165
+ `check` also prints notes that are not failures: sources fetched but never cited
166
+ (thin navigation-only pages — drop them from your reading or cite them), and a
167
+ language-mismatch note. Read the notes; they are the reviewer's eyes.
168
+
169
+ Fix every FAIL and run again. Do not hand the user a blueprint that fails the
170
+ gate, and do not edit the Sources section by hand.
171
+
172
+ ## Step 5 — MVP hand-off
173
+
174
+ ```bash
175
+ python3 $SKILL/scripts/blueprint.py mvp <slug> # writes mvp.md from sections 9 + 10, plus a Verify note
176
+ ```
177
+
178
+ Show the user, in their language: the one-paragraph summary (section 0), the
179
+ MVP cut, and one line inviting them to cross out or add. Two decisions are theirs:
180
+ the scope of v1 and anything that costs money. Everything else you decide.
181
+ When they say go, `mvp.md` is the input to the build (plan → build → verify →
182
+ ship in AutoCode); the rest of the
183
+ blueprint is context, not scope.
184
+
185
+ While building, keep the rules (numbers, formulas, state changes) in one block that
186
+ loads without a browser — in a web build, `<script id="rules">` with no DOM access —
187
+ and tag the learned ones `[learned]` in the code. Everything else is rendering and is
188
+ yours. This is what makes Step 6 possible.
189
+
190
+ ## Step 6 — Verify (before ship, and again on the live URL)
191
+
192
+ Next to the build, write a checks file, `acceptance.js` (node) or `acceptance.py`,
193
+ that loads the rules block, performs the machine part of every acceptance line, and
194
+ prints one JSON row per check: `{"id","check","expected","actual","ok"}`. Then:
195
+
196
+ ```bash
197
+ python3 $SKILL/scripts/acceptance_run.py <site_dir> # local build: table of check / expected / actual / match
198
+ python3 $SKILL/scripts/acceptance_run.py <site_dir> --url <live> # after ship: the same table against the served page
199
+ ```
200
+
201
+ The runner exits non-zero on any mismatch; ship refuses to continue on that. The
202
+ table is what the user sees — never "tests passed". The acceptance lines a machine
203
+ cannot check are handed to the user as actions to perform, in the hand-back. Worked
204
+ run: `examples/dino/` (8/8 match, including a floating-point boundary the original
205
+ has); the whole journey is written down in `methodology/see-it-ship-it.md`.
206
+
207
+ ## Boundaries
208
+
209
+ If the user asks for any of these, say in one sentence what you will do instead
210
+ and keep going — no lecture, no stopping the task:
211
+
212
+ - decompiling, unpacking, de-obfuscating, reading minified bundles for logic,
213
+ network capture, API probing → *"I work from the public pages; here is what
214
+ they tell us."*
215
+ - logging in to their account of the original and walking the UI → *"I don't use
216
+ account areas; if you describe what you see there, I can use that as a {medium}
217
+ source."* (A screenshot they took of their own account is fine to read for
218
+ structure; it is not a source of copy or design.)
219
+ - copying the interface, copy, images, logo, names, or code → *"We take the
220
+ structure and design our own; here is the list of what we won't copy."*
221
+ - leaked source, internal docs, beta material → not used, even if pasted in.
222
+
223
+ `references/boundaries.md` has the full list with the reasoning, for the cases
224
+ in between.
225
+
226
+ ## Output
227
+
228
+ ```
229
+ .autocode/study/<slug>/
230
+ sources.json what was fetched, what was refused and why, hashes, dates
231
+ sources/S1.txt … text + outline of each public page
232
+ blueprint.md sections 0–10 + generated Sources
233
+ mvp.md hand-off to the build
234
+ ```
235
+
236
+ ## Example
237
+
238
+ User: *我想做一个像 Linear 那样的工单工具,给我们十个人的团队用。*
239
+
240
+ 1. Reply in Chinese with the framing sentence; the goal is already stated, no question.
241
+ 2. `discover https://linear.app` and `discover https://linear.app/docs` → fetch
242
+ pricing, docs concepts, start guide, teams/projects/cycles/issues docs,
243
+ changelog, developers, integrations, security, careers, mobile (≈15 pages;
244
+ the finished run is in `examples/linear/`).
245
+ 3. Read; init with `--goal "十人软件团队的轻量工单工具,键盘优先"`; fill sections 0–10
246
+ in Chinese with `[S…] {高|中|推测}` tags; section 9 keeps Team / Project / Issue /
247
+ Cycle / Comment, seven screens, no GitHub/Slack integration in v1.
248
+ 4. `check` passes → `mvp` → show summary + MVP → user says go → build.
249
+
250
+ Powered by I-Lang v5.0 | ilang.ai
skills/product-study/examples/dino/README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Example: dino runner — the first end-to-end run of see-it-ship-it
2
+
3
+ Target: the Chrome offline dinosaur game, studied from a public open-source copy
4
+ (`wayou/t-rex-runner`). The user's ask, in a non-technical person's words: "a dinosaur
5
+ game like that one, but I can set the speed myself."
6
+
7
+ What is here, in the order the methodology produces it (methodology/see-it-ship-it.md):
8
+
9
+ | Stage | File | Evidence |
10
+ |---|---|---|
11
+ | S2 study | `blueprint.md`, `sources.json` | 28/28 gate checks; every rule number cites S2 with a line number |
12
+ | S3 cut | `mvp.md` | 5 objects, 2 screens, 7 build steps, 5 three-part acceptance lines, learned-vs-own |
13
+ | S4 build | `site/index.html` | one file; rules in `<script id="rules">`, learned numbers tagged `[learned]`; look is our own |
14
+ | S5 verify | `site/acceptance.js` | `python3 ../../scripts/acceptance_run.py site` → 8/8 match, including the 13.001 boundary |
15
+ | S6 ship | `skills/ship/scripts/go_live_pages.py site --name dino-runner --simulate` | GitHub Pages flow, verification rerun on the served page |
16
+
17
+ Learned from the target (rules only, no code): start speed 6, +0.001 per update while
18
+ below 13, gravity 0.6, jump velocity 12, wait for the first key, keep the best score on
19
+ restart. Everything else — look, shapes, slider 2–18, 60 updates/s, 1.5 s clear time,
20
+ spacing, copy — is our own design.
21
+
22
+ Reproduce the verification:
23
+
24
+ ```bash
25
+ python3 skills/product-study/scripts/blueprint.py check dino --root skills/product-study/examples
26
+ python3 skills/product-study/scripts/acceptance_run.py skills/product-study/examples/dino/site
27
+ ```
skills/product-study/examples/dino/blueprint.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Product blueprint: T-Rex Runner(Chrome 离线小恐龙)
2
+
3
+ Product: T-Rex Runner(Chrome 离线小恐龙) · Official site: https://wayou.github.io/t-rex-runner/ · Studied on: 2026-10-14 · Goal: 给不会编程的人一个自己的恐龙小游戏:能跳、有仙人掌、能自己调速度
4
+
5
+ Reading guide: this blueprint describes **structure** (what the product does, how its objects relate, what its users go through), gathered only from public pages listed under Sources. It is a map for building your own product. It does not carry the original's interface, copy, images or brand, and nothing in it is copied from a non-public source.
6
+
7
+ ## 0. 概要
8
+
9
+ T-Rex Runner 是 Chrome 浏览器断网页面上藏着的小恐龙跑酷游戏,被单独抽出来放在一个公开仓库里,用浏览器直接打开就能玩 [S1] {高}。玩家只做一件事:让恐龙跳过迎面而来的仙人掌和翼龙,活得越久分数越高,而游戏会随时间越来越快 [S2] {高}。没有账号、没有收费、没有关卡,核心体验就是「一个按键 + 越来越快」。
10
+
11
+ ## 1. 功能清单
12
+
13
+ | 功能 | 作用(一句话) | 层级 | 来源 | 置信度 |
14
+ |---|---|---|---|---|
15
+ | 跳跃 | 空格或上箭头让恐龙起跳,跳过障碍 | core | S2 | 高 |
16
+ | 障碍物 | 小仙人掌、大仙人掌、翼龙从右侧迎面而来 | core | S2 | 高 |
17
+ | 自动加速 | 每次游戏更新速度 +0.001,直到 13 为止,起始 6 | core | S2 | 高 |
18
+ | 碰撞判定与结束 | 撞上障碍即结束,显示重开按钮 | core | S2 | 高 |
19
+ | 重开 | 结束后按空格 / 回车 / 点击重新开始 | core | S2 | 高 |
20
+ | 距离计分与最高分 | 按跑过的距离计分,记录本次最高分 | core | S2 | 高 |
21
+ | 下蹲 | 下箭头让恐龙低头躲翼龙 | plus | S2 | 高 |
22
+ | 开局前的等待状态 | 第一次按键才开始,开始后 3 秒内没有障碍 | plus | S2 | 高 |
23
+ | 触屏支持 | 触屏设备点击整个画面即跳跃,并把速度上限乘 1.2 | plus | S2 | 高 |
24
+ | 云和地平线滚动 | 背景云朵和地面随速度滚动 | plus | S2 | 高 |
25
+ | 昼夜反转 | 每 700 距离单位翻转一次配色 | drop | S2 | 高 |
26
+ | 成就音效 | 每 100 距离单位闪烁一次并提示 | drop | S2 | 高 |
27
+ | 街机模式 | 画面上移进入全屏街机模式 | drop | S2 | 高 |
28
+ | 高清资源 | 按设备像素比切换两套精灵图 | drop | S2 | 高 |
29
+
30
+ ## 2. 信息架构
31
+
32
+ - 只有一个页面、一个画布,没有菜单、没有设置、没有登录 [S1] {高}
33
+ - 画布内部三层:背景(云、地平线)→ 障碍物 → 恐龙;画布外只有一个覆盖整屏的触控层 [S2] {高}
34
+ - 状态只有四种:等待开局、进行中、已撞毁、(移动端)街机模式 [S2] {高}
35
+
36
+ ## 3. 核心对象与数据模型(推断)
37
+
38
+ | 对象 | 关键字段 | 关系 | 来源 | 置信度 |
39
+ |---|---|---|---|---|
40
+ | Runner(一局游戏) | 当前速度、已跑距离、最高分、是否进行中、是否撞毁、运行时长 | 拥有 1 个恐龙、1 个地平线、1 个计分器 | S2 | 高 |
41
+ | TRex(恐龙) | 位置、跳跃速度、是否在跳、是否下蹲 | 属于 Runner | S2 | 高 |
42
+ | Obstacle(障碍物) | 类型(小仙人掌/大仙人掌/翼龙)、位置、宽度、与下一个的间隙 | Horizon 持有 0..N 个 | S2 | 高 |
43
+ | Horizon(地平线) | 滚动位置、云列表、障碍物列表 | 属于 Runner | S2 | 高 |
44
+ | DistanceMeter(计分器) | 当前距离、最高分、最多 5 位数字 | 属于 Runner | S2 | 高 |
45
+ | Config(规则表) | 起始速度 6、加速度 0.001、速度上限 13、重力 0.6、起跳速度 12、开局无障碍 3000 毫秒、间隙系数 0.6 | 全局常量 | S2 | 高 |
46
+
47
+ ## 4. 关键用户流程
48
+
49
+ - 流程 A(第一次玩):打开页面 → 画面静止、恐龙待命 → 按空格 → 恐龙起跳同时游戏开始 → 3 秒后出现第一个障碍 [S2] {高}
50
+ - 流程 B(一局之中):障碍从右向左移来 → 玩家按空格起跳 / 按下躲避 → 跳过则计分继续,速度每次更新 +0.001 → 撞上则画面定格 [S2] {高}
51
+ - 流程 C(结束与重开):撞毁后显示结束面板和重开按钮 → 按空格 / 回车 / 点击 → 速度回到 6、距离归零、最高分保留 [S2] {高}
52
+ - 流程 D(触屏):点击画面任意处等于按空格 [S2] {高}
53
+
54
+ ## 5. 技术线索
55
+
56
+ - 纯浏览器前端:HTML + 一个 JavaScript 文件 + 一张精灵图,没有后端 [S1] {高}
57
+ - 代码来自 Chromium 项目,文件头声明 BSD 风格许可;仓库本身没有附许可证文件 [S1][S2] {高}
58
+ - 游戏循环用 requestAnimationFrame 按帧推进,速度与时间差相乘换算距离 [S2] {高}
59
+
60
+ ## 6. 定价与商业模式
61
+
62
+ | 方案 | 价格 | 包含 | 来源 | 置信度 |
63
+ |---|---|---|---|---|
64
+ | 唯一方案 | 免费 | 全部功能,无账号、无广告 | S1 | 高 |
65
+
66
+ ## 7. 集成与生态
67
+
68
+ - 没有任何集成、API、导入导出或移动应用;它是浏览器彩蛋的独立复刻 [S1] {高}
69
+ - 存在于 Chrome 浏览器断网页面��原始出处)和若干公开仓库的复刻版本 [S1] {高}
70
+
71
+ ## 8. 缺口与差异化机会
72
+
73
+ - 速度只能越玩越快,玩家没法把速度固定在自己舒服的档位:孩子和初学者玩不长,老手又嫌起步太慢 {推测}
74
+ - 没有任何可调项(速度、跳跃高度、障碍密度),想练反应的人没有「练习模式」 {推测}
75
+ - 规则对玩家不可见:「为什么越来越快」要读代码才知道;一个把规则摆在台面上的版本本身就是差异 {推测}
76
+ - 分数只在当次会话里,关掉就没了;v1 不必解决,但是明显的后续方向 {推测}
77
+
78
+ ## 9. MVP 切分
79
+
80
+ **Users and the one job 用户与唯一任务:** 不会编程的人(和他们的孩子):打开一个网址就能玩的恐龙跳仙人掌,而且能用滑块把速度调到自己想要的档位。
81
+
82
+ **Objects 对象 (<= 5):** 一局游戏(速度、距离、状态)、恐龙、仙人掌、速度设置(滑块值、是否自动加速)、计分
83
+
84
+ **Screens 画面 (<= 7):** 游戏画面(含控制条:开始、跳跃、重开、速度滑块、自动加速开关)、结束提示(叠在游戏画面上)
85
+
86
+ **Dropped from v1 and why 不做的:** 翼龙和下蹲(多一种障碍和一种动作,v1 只要「跳」一个动作)、昼夜反转、成就音效、街机模式、高清精灵图、触屏(v1 先在电脑浏览器跑通,手机点击作为 v1.1)、最高分持久化。
87
+
88
+ **Build order 构建顺序 (each step ends in something the user can click):**
89
+ 1. 一个 HTML 文件:画布 + 恐龙方块 + 地面,点「开始」地面开始滚动——用户看到动起来。
90
+ 2. 空格 / 「跳跃」按钮让恐龙起跳落地(重力 0.6、起跳速度 12 的手感)——用户能跳。
91
+ 3. 仙人掌从右侧按间隙生成、碰撞即「游戏结束」、「重开」回到起点——用户能玩一整局。
92
+ 4. 速度滑块 2–18 和当前速度数字:拖动即生效,固定速度——用户能调快调慢。
93
+ 5. 「自动加速」开关:开启时从 6 开始,每次逻辑更新若速度 < 13 则 +0.001,逻辑更新固定每秒 60 次——用户能复现原版手感。
94
+ 6. 计分和本局最高分——用户有目标。
95
+ 7. 上线成一个网址(静态托管,零成本)——用户能把链接发给别人。
96
+
97
+ **Acceptance 验收 (v1 is done when):**
98
+ 1. 用户做:打开网址点「开始」 → 应看到:仙人掌从右边移过来 → 机器验:页面加载无报错,开始后 2 秒内生成了障碍。
99
+ 2. 用户做:按空格 → 应看到:恐龙跳起再落下,页面不滚动 → 机器验:跳跃后恐龙 y 值先减后回到地面;空格的默认行为被阻止。
100
+ 3. 用户做:把滑块从 3 拖到 12 → 应看到:仙人掌明显变快,旁边数字显示 12 → 机器验:滑块值变化后游戏速度等于滑块值。
101
+ 4. 用户做:撞到仙人掌,点「重开」 → 应看到:结束提示消失、又能玩 → 机器验:重开后距离为 0、速度回到设定值、状态为进行中。
102
+ 5. 用户做:打开「自动加速」看数字 → 应看到:从 6.000 开始慢慢涨,到 13 附近停 → 机器验:从 6 起跑 0 / 1000 / 4000 / 10000 次更新后速度为 6.000 / 7.000 / 10.000 / 13.001(三位小数)。
103
+
104
+ **Learned vs own 学来的 / 自己定的:**
105
+ - 学来的(只学规则,不抄代码):起始速度 6、每次更新 +0.001、上限 13(先判断再相加)、重力 0.6、起跳速度 12 [S2];开局前等待第一次按键、撞毁后重开保留最高分 [S2]。
106
+ - 自己定的:画面与配色、恐龙和仙人掌的形状、控制条和滑块(2–18)、每秒 60 次逻辑更新、开局 1.5 秒无障碍、障碍间隙公式、计分换算、所有文案。
107
+
108
+ ## 10. 我们不复制的东西
109
+
110
+ - 原版的界面、像素风精灵图、配色、字体和布局:恐龙、仙人掌、地面全部自己画。
111
+ - 原版的文案、截图、图片、音效,以及 Chrome / Chromium 的名字和标识。
112
+ - 原版仓库的任何代码:它的文件头声明 BSD 风格许可(宽松许可,非 copyleft),但我们只学了它的规则(起始 6、每次更新 +0.001、上限 13、重力 0.6、起跳 12、开局 3 秒无障碍),实现全部重写。
113
+ - 没有用任何非公开材料:没有登录、抓包、反编译或泄露资料。
114
+
115
+ ## Sources
116
+
117
+ - [S1] GitHub wayou/t-rex-runner README — https://github.com/wayou/t-rex-runner (fetched 2026-10-14, sha256 25f5671d666d · license unknown)
118
+ - [S2] /wayou/t-rex-runner/gh-pages/index.js — https://raw.githubusercontent.com/wayou/t-rex-runner/gh-pages/index.js (fetched 2026-10-14, sha256 867e8f6a2bec)
119
+
120
+ Refused or skipped (out of scope by policy, not used):
121
+
122
+ - https://wayou.github.io/t-rex-runner/ — page has almost no readable text (53 chars); likely rendered by JavaScript or empty
skills/product-study/examples/dino/mvp.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MVP hand-off
2
+
3
+ Product: T-Rex Runner(Chrome 离线小恐龙) · Official site: https://wayou.github.io/t-rex-runner/ · Studied on: 2026-10-14 · Goal: 给不会编程的人一个自己的恐龙小游戏:能跳、有仙人掌、能自己调速度
4
+
5
+ Source blueprint: blueprint.md (same folder). Build only what is below; the rest of the blueprint is context, not scope.
6
+
7
+ ## MVP cut
8
+
9
+ **Users and the one job 用户与唯一任务:** 不会编程的人(和他们的孩子):打开一个网址就能玩的恐龙跳仙人掌,而且能用滑块把速度调到自己想要的档位。
10
+
11
+ **Objects 对象 (<= 5):** 一局游戏(速度、距离、状态)、恐龙、仙人掌、速度设置(滑块值、是否自动加速)、计分
12
+
13
+ **Screens 画面 (<= 7):** 游戏画面(含控制条:开始、跳跃、重开、速度滑块、自动加速开关)、结束提示(叠在游戏画面上)
14
+
15
+ **Dropped from v1 and why 不做的:** 翼龙和下蹲(多一种障碍和一种动作,v1 只要「跳」一个动作)、昼夜反转、成就音效、街机模式、高清精灵图、触屏(v1 先在电脑浏览器跑通,手机点击作为 v1.1)、最高分持久化。
16
+
17
+ **Build order 构建顺序 (each step ends in something the user can click):**
18
+ 1. 一个 HTML 文件:画布 + 恐龙方块 + 地面,点「开始」地面开始滚动——用户看到动起来。
19
+ 2. 空格 / 「跳跃」按钮让恐龙起跳落地(重力 0.6、起跳速度 12 的手感)——用户能跳。
20
+ 3. 仙人掌从右侧按间隙生成、碰撞即「游戏结束」、「重开」回到起点——用户能玩一整局。
21
+ 4. 速度滑块 2–18 和当前速度数字:拖动即生效,固定速度——用户能调快调慢。
22
+ 5. 「自动加速」开关:开启时从 6 开始,每次逻辑更新若速度 < 13 则 +0.001,逻辑更新固定每秒 60 次——用户能复现原版手感。
23
+ 6. 计分和本局最高分——用户有目标。
24
+ 7. 上线成一个网址(静态托管,零成本)——用户能把链接发给别人。
25
+
26
+ **Acceptance 验收 (v1 is done when):**
27
+ 1. 用户做:打开网址点「开始」 → 应看到:仙人掌从右边移过来 → 机器验:页面加载无报错,开始后 2 秒内生成了障碍。
28
+ 2. 用户做:按空格 → 应看到:恐龙跳起再落下,页面不滚动 → 机器验:跳跃后恐龙 y 值先减后回到地面;空格的默认行为被阻止。
29
+ 3. 用户做:把滑块从 3 拖到 12 → 应看到:仙人掌明显变快,旁边数字显示 12 → 机器验:滑块值变化后游戏速度等于滑块值。
30
+ 4. 用户做:撞到仙人掌,点「重开」 → 应看到:结束提示消失、又能玩 → 机器验:重开后距离为 0、速度回到设定值、状态为进行中。
31
+ 5. 用户做:打开「自动加速」看数字 → 应看到:从 6.000 开始慢慢涨,到 13 附近停 → 机器验:从 6 起跑 0 / 1000 / 4000 / 10000 次更新后速度为 6.000 / 7.000 / 10.000 / 13.001(三位小数)。
32
+
33
+ **Learned vs own 学来的 / 自己定的:**
34
+ - 学来的(只学规则,不抄代码):起始速度 6、每次更新 +0.001、上限 13(先判断再相加)、重力 0.6、起跳速度 12 [S2];开局前等待第一次按键、撞毁后重开保留最高分 [S2]。
35
+ - 自己定的:画面与配色、恐龙和仙人掌的形状、控制条和滑块(2–18)、每秒 60 次逻辑更新、开局 1.5 秒无障碍、障碍间隙公式、计分换算、所有文案。
36
+
37
+
38
+ ## What we will not copy
39
+
40
+ - 原版的界面、像素风精灵图、配色、字体和布局:恐龙、仙人掌、地面全部自己画。
41
+ - 原版的文案、截图、图片、音效,以及 Chrome / Chromium 的名字和标识。
42
+ - 原版仓库的任何代码:它的文件头声明 BSD 风格许可(宽松许可,非 copyleft),但我们只学了它的规则(起始 6、每次更新 +0.001、上限 13、重力 0.6、起跳 12、开局 3 秒无障碍),实现全部重写。
43
+ - 没有用任何非公开材料:没有登录、抓包、反编译或泄露资料。
44
+
45
+
46
+ ## Verify
47
+
48
+ Keep the rules (numbers, formulas, state changes) in one block the acceptance runner can load without a browser; tag the learned ones [learned].
49
+ Ship a checks file next to the build (acceptance.js or acceptance.py) that prints one JSON row per machine check; run it with
50
+ `python3 <product-study>/scripts/acceptance_run.py <site_dir>` before go-live and again with `--url <live url>` after. The table it prints is what the user sees.
51
+ The remaining checks are actions the user performs; list them as actions, never as 'tests passed'.
skills/product-study/examples/dino/site/acceptance.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Acceptance for mvp.md — machine-checkable parts. Prints one JSON row per check (S5 convention).
2
+ // Run via: python3 skills/product-study/scripts/acceptance_run.py <site_dir> [--url <live>]
3
+ const fs = require('fs'), vm = require('vm');
4
+ const html = fs.readFileSync(process.argv[2] || 'index.html', 'utf8');
5
+ const rulesSrc = html.match(/<script id="rules">([\s\S]*?)<\/script>/)[1];
6
+ const sandbox = { module: { exports: {} } };
7
+ vm.runInNewContext(rulesSrc, sandbox);
8
+ const R = sandbox.module.exports;
9
+ const f3 = n => (Math.round(n * 1000) / 1000).toFixed(3);
10
+ const rows = [];
11
+ const check = (id, what, expected, actual, ok) => rows.push({ id, check: what, expected: String(expected), actual: String(actual), ok });
12
+
13
+ // 1. 开始后 2 秒内生成了障碍
14
+ {
15
+ const st = R.newState(); R.start(st);
16
+ let firstAt = null;
17
+ for (let i = 1; i <= 120; i++) { R.update(st); if (st.obstacles.length && firstAt === null) firstAt = i; }
18
+ check('1', '开始后 2 秒(120 次更新)内出现障碍', '≤ 120 次更新', firstAt === null ? '未出现' : firstAt + ' 次更新', firstAt !== null && firstAt <= 120);
19
+ }
20
+ // 2. 跳跃:y 先升后回到地面
21
+ {
22
+ const st = R.newState(); R.start(st); R.jump(st);
23
+ let peak = 0, landed = null;
24
+ for (let i = 1; i <= 120; i++) { R.update(st); peak = Math.max(peak, st.dinoY); if (!st.jumping && landed === null && i > 1) landed = i; }
25
+ check('2', '按空格后恐龙跳起再落地', '峰值 > 0 且落地', '峰值 ' + f3(peak) + ',' + (landed ? landed + ' 次更新后落地' : '未落地'), peak > 0 && landed !== null);
26
+ }
27
+ // 3. 滑块 3 → 12:速度等于滑块值,自动加速关闭
28
+ {
29
+ const st = R.newState(); R.setAuto(st, true); R.start(st);
30
+ R.setSliderSpeed(st, 3); const s3 = st.speed; R.setSliderSpeed(st, 12);
31
+ check('3', '滑块拖到 12 后游戏速度', '12.000(自动加速关)', f3(st.speed) + '(自动加速' + (st.auto ? '开' : '关') + ',之前 ' + f3(s3) + ')', st.speed === 12 && !st.auto && s3 === 3);
32
+ }
33
+ // 4. 重开:距离 0、速度回到设定、状态进行中
34
+ {
35
+ const st = R.newState(); R.start(st); R.setSliderSpeed(st, 9);
36
+ for (let i = 0; i < 400; i++) R.update(st);
37
+ st.status = 'crashed'; const dBefore = Math.floor(st.distance);
38
+ R.restart(st);
39
+ check('4', '撞毁后重开', '距离 0,速度 9.000,进行中', '距离 ' + Math.floor(st.distance) + '(之前 ' + dBefore + '),速度 ' + f3(st.speed) + ',' + (st.status === 'playing' ? '进行中' : st.status), st.distance === 0 && st.speed === 9 && st.status === 'playing');
40
+ }
41
+ // 5. 自动加速:0/1000/4000/10000 次更新后的速度
42
+ {
43
+ const ref = { 0: 6.000, 1000: 7.000, 4000: 10.000, 10000: 13.001 };
44
+ for (const n of Object.keys(ref)) {
45
+ const v = R.simulateAcceleration(Number(n));
46
+ check('5', '自动加速 ' + n + ' 次更新后速度', f3(ref[n]), f3(v), f3(v) === f3(ref[n]));
47
+ }
48
+ }
49
+
50
+ for (const r of rows) console.log(JSON.stringify(r));
51
+ process.exit(rows.some(r => !r.ok) ? 1 : 0);
skills/product-study/examples/dino/site/index.html ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
+ <title>小恐龙跑酷 · 自己调速度</title>
7
+ <style>
8
+ :root {
9
+ --bg: #f6f3ea; --fg: #2b2b2b; --muted: #6b6b6b; --panel: #ffffff; --line: #d9d4c7;
10
+ --accent: #2f7d5b; --accent-ink: #ffffff; --sky: #eaf4ff; --ground: #c9b48a; --dino: #2f7d5b; --cactus: #4e8f3a; --danger: #b43c2a;
11
+ box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
12
+ }
13
+ @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
14
+ --bg: #15171a; --fg: #ececec; --muted: #9a9a9a; --panel: #1f2328; --line: #343a40;
15
+ --accent: #4fb584; --accent-ink: #0d1a14; --sky: #1b2430; --ground: #6b5a3a; --dino: #4fb584; --cactus: #7cc45f; --danger: #e06a56; color-scheme: dark; } }
16
+ :root[data-theme="dark"] { --bg: #15171a; --fg: #ececec; --muted: #9a9a9a; --panel: #1f2328; --line: #343a40; --accent: #4fb584; --accent-ink: #0d1a14; --sky: #1b2430; --ground: #6b5a3a; --dino: #4fb584; --cactus: #7cc45f; --danger: #e06a56; }
17
+ html { scroll-padding-top: env(safe-area-inset-top, 0px); }
18
+ * { box-sizing: border-box; }
19
+ body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif; }
20
+ main { max-width: 820px; margin: 0 auto; padding: 20px 16px 40px; }
21
+ h1 { font-size: 22px; margin: 0 0 4px; }
22
+ .sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
23
+ .stage { position: relative; background: var(--sky); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
24
+ canvas { display: block; width: 100%; height: auto; }
25
+ .overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px; background: rgba(0,0,0,.35); color: #fff; font-weight: 600; font-size: 20px; }
26
+ .overlay.show { display: flex; }
27
+ .hud { position: absolute; top: 10px; right: 14px; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
28
+ .controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
29
+ .card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
30
+ .buttons { display: flex; gap: 8px; flex-wrap: wrap; }
31
+ button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; }
32
+ button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
33
+ button:disabled { opacity: .5; cursor: default; }
34
+ label { display: block; font-size: 14px; color: var(--muted); }
35
+ input[type=range] { width: 100%; }
36
+ .speedval { font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 600; }
37
+ .check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--fg); }
38
+ .help { font-size: 13px; color: var(--muted); margin-top: 12px; }
39
+ .help b { color: var(--fg); }
40
+ </style>
41
+ </head>
42
+ <body>
43
+ <main>
44
+ <h1>小恐龙跑酷 · 自己调速度</h1>
45
+ <p class="sub">空格或「跳跃」让恐龙跳过仙人掌。拖滑块定一个速度,或打开「自动加速」体验越跑越快。</p>
46
+
47
+ <div class="stage">
48
+ <canvas id="game" width="800" height="240" aria-label="游戏画面"></canvas>
49
+ <div class="hud" id="hud">距离 0 · 最高 0</div>
50
+ <div class="overlay" id="overlay"><div id="overlayText">按「开始」或空格</div></div>
51
+ </div>
52
+
53
+ <div class="controls">
54
+ <div class="card">
55
+ <label>操作</label>
56
+ <div class="buttons">
57
+ <button id="btnStart" class="primary">开始</button>
58
+ <button id="btnJump">跳跃</button>
59
+ <button id="btnRestart">重开</button>
60
+ </div>
61
+ </div>
62
+ <div class="card">
63
+ <label for="speed">速度 <span class="speedval" id="speedVal">6.000</span></label>
64
+ <input type="range" id="speed" min="2" max="18" step="0.5" value="6" aria-label="速度">
65
+ </div>
66
+ <div class="card">
67
+ <label>模式</label>
68
+ <div class="check"><input type="checkbox" id="auto"><label for="auto" style="margin:0;color:inherit">自动加速(从 6 开始,每次更新 +0.001,到 13 停)</label></div>
69
+ </div>
70
+ </div>
71
+
72
+ <p class="help"><b>学来的规则</b>:起始速度 6、每次逻辑更新加 0.001、上限 13、重力 0.6、起跳速度 12(来自公开的开源仓库)。<b>自己定的</b>:画面、恐龙和仙人掌的样子、每秒 60 次逻辑更新、开始后 1.5 秒无障碍、滑块范围 2–18。</p>
73
+ </main>
74
+
75
+ <!-- ======================================================================
76
+ RULES — pure functions, no DOM. The acceptance script runs this block
77
+ in node. Numbers marked [learned] come from the studied public repo;
78
+ everything else is our own design.
79
+ ====================================================================== -->
80
+ <script id="rules">
81
+ var Rules = (function () {
82
+ var C = {
83
+ START_SPEED: 6, // [learned]
84
+ ACCELERATION: 0.001, // [learned] per logic update
85
+ MAX_SPEED: 13, // [learned] accelerate only while below this
86
+ GRAVITY: 0.6, // [learned] per update
87
+ JUMP_VELOCITY: 12, // [learned] initial upward velocity
88
+ UPDATES_PER_SECOND: 60, // own: fixed logic timestep
89
+ CLEAR_TIME_UPDATES: 90, // own: 1.5 s without obstacles after start
90
+ MIN_SPEED: 2, MAX_SLIDER: 18, // own: slider range
91
+ GROUND_Y: 0, DINO_W: 34, DINO_H: 40, // own: geometry in game units (y grows upward)
92
+ MIN_GAP: 160, GAP_PER_SPEED: 26, // own: obstacle spacing
93
+ CACTUS_SIZES: [[18, 36], [26, 46], [40, 44]], // own: w,h variants
94
+ WORLD_W: 800
95
+ };
96
+
97
+ function accelerate(speed) { // [learned] check-then-add
98
+ if (speed < C.MAX_SPEED) return speed + C.ACCELERATION;
99
+ return speed;
100
+ }
101
+
102
+ function simulateAcceleration(updates) { // for acceptance: speed after n updates from START_SPEED
103
+ var s = C.START_SPEED;
104
+ for (var i = 0; i < updates; i++) s = accelerate(s);
105
+ return s;
106
+ }
107
+
108
+ function newState() {
109
+ return { status: 'waiting', speed: C.START_SPEED, auto: false, distance: 0, best: 0,
110
+ updates: 0, dinoY: 0, dinoVy: 0, jumping: false, obstacles: [], nextGap: 0, rng: 1 };
111
+ }
112
+
113
+ function rand(st) { st.rng = (st.rng * 1664525 + 1013904223) % 4294967296; return st.rng / 4294967296; }
114
+
115
+ function start(st) {
116
+ if (st.status === 'playing') return st;
117
+ if (st.status === 'crashed') restart(st);
118
+ st.status = 'playing';
119
+ if (st.auto) st.speed = C.START_SPEED;
120
+ return st;
121
+ }
122
+
123
+ function restart(st) {
124
+ var best = st.best, auto = st.auto, speed = auto ? C.START_SPEED : st.speed;
125
+ var fresh = newState();
126
+ fresh.best = best; fresh.auto = auto; fresh.speed = speed; fresh.status = 'playing';
127
+ for (var k in fresh) st[k] = fresh[k];
128
+ return st;
129
+ }
130
+
131
+ function setSliderSpeed(st, value) { // dragging the slider = fixed speed, auto off
132
+ var v = Math.max(C.MIN_SPEED, Math.min(C.MAX_SLIDER, Number(value)));
133
+ st.auto = false; st.speed = v;
134
+ return st;
135
+ }
136
+
137
+ function setAuto(st, on) {
138
+ st.auto = !!on;
139
+ if (st.auto) st.speed = C.START_SPEED;
140
+ return st;
141
+ }
142
+
143
+ function jump(st) {
144
+ if (st.status !== 'playing' || st.jumping) return st;
145
+ st.jumping = true; st.dinoVy = C.JUMP_VELOCITY;
146
+ return st;
147
+ }
148
+
149
+ function spawn(st) {
150
+ var size = C.CACTUS_SIZES[Math.floor(rand(st) * C.CACTUS_SIZES.length)];
151
+ st.obstacles.push({ x: C.WORLD_W + 10, w: size[0], h: size[1] });
152
+ st.nextGap = C.MIN_GAP + C.GAP_PER_SPEED * st.speed + rand(st) * 120;
153
+ }
154
+
155
+ function hits(st, o) {
156
+ var dx0 = 40, dx1 = 40 + C.DINO_W;
157
+ return o.x < dx1 - 4 && o.x + o.w > dx0 + 4 && st.dinoY < o.h - 4;
158
+ }
159
+
160
+ function update(st) { // one logic update (60 per second)
161
+ if (st.status !== 'playing') return st;
162
+ st.updates += 1;
163
+ if (st.jumping) {
164
+ st.dinoY += st.dinoVy; st.dinoVy -= C.GRAVITY;
165
+ if (st.dinoY <= 0) { st.dinoY = 0; st.dinoVy = 0; st.jumping = false; }
166
+ }
167
+ for (var i = st.obstacles.length - 1; i >= 0; i--) {
168
+ st.obstacles[i].x -= st.speed;
169
+ if (st.obstacles[i].x + st.obstacles[i].w < -20) st.obstacles.splice(i, 1);
170
+ }
171
+ if (st.updates > C.CLEAR_TIME_UPDATES) {
172
+ var last = st.obstacles[st.obstacles.length - 1];
173
+ if (!last || (C.WORLD_W - last.x) > st.nextGap) spawn(st);
174
+ }
175
+ for (var j = 0; j < st.obstacles.length; j++) {
176
+ if (hits(st, st.obstacles[j])) { st.status = 'crashed'; return st; }
177
+ }
178
+ st.distance += st.speed / 10;
179
+ if (st.distance > st.best) st.best = st.distance;
180
+ if (st.auto) st.speed = accelerate(st.speed);
181
+ return st;
182
+ }
183
+
184
+ return { C: C, accelerate: accelerate, simulateAcceleration: simulateAcceleration, newState: newState,
185
+ start: start, restart: restart, setSliderSpeed: setSliderSpeed, setAuto: setAuto, jump: jump, update: update };
186
+ })();
187
+ if (typeof module !== 'undefined') module.exports = Rules;
188
+ </script>
189
+
190
+ <!-- ============================ VIEW (our own look) ============================ -->
191
+ <script>
192
+ (function () {
193
+ var canvas = document.getElementById('game'), ctx = canvas.getContext('2d');
194
+ var overlay = document.getElementById('overlay'), overlayText = document.getElementById('overlayText');
195
+ var hud = document.getElementById('hud'), speedVal = document.getElementById('speedVal');
196
+ var slider = document.getElementById('speed'), auto = document.getElementById('auto');
197
+ var st = Rules.newState();
198
+ var css = function (name) { return getComputedStyle(document.documentElement).getPropertyValue(name).trim(); };
199
+ var GROUND = 200;
200
+
201
+ function fmt(n) { return (Math.round(n * 1000) / 1000).toFixed(3); }
202
+
203
+ function draw() {
204
+ var W = canvas.width, H = canvas.height;
205
+ ctx.clearRect(0, 0, W, H);
206
+ ctx.fillStyle = css('--sky'); ctx.fillRect(0, 0, W, H);
207
+ // ground band
208
+ ctx.fillStyle = css('--ground'); ctx.fillRect(0, GROUND, W, H - GROUND);
209
+ ctx.strokeStyle = 'rgba(0,0,0,.25)'; ctx.beginPath(); ctx.moveTo(0, GROUND + .5); ctx.lineTo(W, GROUND + .5); ctx.stroke();
210
+ // dino: rounded body, head, eye, legs — our own shape
211
+ var dx = 40, dy = GROUND - st.dinoY, C = Rules.C;
212
+ ctx.fillStyle = css('--dino');
213
+ rr(dx, dy - C.DINO_H, C.DINO_W, C.DINO_H - 8, 8);
214
+ rr(dx + 14, dy - C.DINO_H - 14, 28, 20, 6);
215
+ ctx.fillRect(dx + 6, dy - 8, 8, 8); ctx.fillRect(dx + 20, dy - 8, 8, 8);
216
+ ctx.fillStyle = css('--bg'); ctx.fillRect(dx + 32, dy - C.DINO_H - 8, 4, 4);
217
+ // cacti: columns with arms
218
+ ctx.fillStyle = css('--cactus');
219
+ st.obstacles.forEach(function (o) {
220
+ rr(o.x, GROUND - o.h, o.w, o.h, 6);
221
+ if (o.w > 20) { rr(o.x - 8, GROUND - o.h * .7, 8, o.h * .4, 4); rr(o.x + o.w, GROUND - o.h * .6, 8, o.h * .35, 4); }
222
+ });
223
+ hud.textContent = '距离 ' + Math.floor(st.distance) + ' · 最高 ' + Math.floor(st.best);
224
+ speedVal.textContent = fmt(st.speed);
225
+ }
226
+ function rr(x, y, w, h, r) { ctx.beginPath(); ctx.moveTo(x + r, y); ctx.arcTo(x + w, y, x + w, y + h, r); ctx.arcTo(x + w, y + h, x, y + h, r); ctx.arcTo(x, y + h, x, y, r); ctx.arcTo(x, y, x + w, y, r); ctx.closePath(); ctx.fill(); }
227
+
228
+ function showOverlay(text) { overlayText.textContent = text; overlay.classList.add('show'); }
229
+ function hideOverlay() { overlay.classList.remove('show'); }
230
+
231
+ // fixed 60 updates/second regardless of display refresh rate
232
+ var acc = 0, last = 0, STEP = 1000 / Rules.C.UPDATES_PER_SECOND;
233
+ function frame(now) {
234
+ if (!last) last = now;
235
+ acc += Math.min(now - last, 250); last = now;
236
+ while (acc >= STEP) {
237
+ Rules.update(st); acc -= STEP;
238
+ if (st.status === 'crashed') { showOverlay('游戏结束 · 距离 ' + Math.floor(st.distance) + ',按「重开」或空格再来'); break; }
239
+ }
240
+ draw();
241
+ requestAnimationFrame(frame);
242
+ }
243
+
244
+ function doStart() { Rules.start(st); hideOverlay(); syncSlider(); }
245
+ function doJump() { if (st.status === 'playing') Rules.jump(st); else if (st.status === 'waiting') doStart(); else if (st.status === 'crashed') doRestart(); }
246
+ function doRestart() { Rules.restart(st); hideOverlay(); syncSlider(); }
247
+ function syncSlider() { slider.value = Math.max(2, Math.min(18, st.speed)); }
248
+
249
+ document.getElementById('btnStart').addEventListener('click', doStart);
250
+ document.getElementById('btnJump').addEventListener('click', doJump);
251
+ document.getElementById('btnRestart').addEventListener('click', doRestart);
252
+ slider.addEventListener('input', function () { Rules.setSliderSpeed(st, slider.value); auto.checked = false; draw(); });
253
+ auto.addEventListener('change', function () { Rules.setAuto(st, auto.checked); syncSlider(); draw(); });
254
+ canvas.addEventListener('pointerdown', doJump);
255
+ document.addEventListener('keydown', function (e) {
256
+ if (e.code === 'Space' || e.code === 'ArrowUp') { e.preventDefault(); if (!e.repeat) doJump(); }
257
+ else if (e.code === 'Enter' && st.status === 'crashed') { e.preventDefault(); doRestart(); }
258
+ });
259
+
260
+ showOverlay('按「开始」或空格');
261
+ draw();
262
+ requestAnimationFrame(frame);
263
+ window.DinoGame = { state: st, Rules: Rules };
264
+ })();
265
+ </script>
266
+ </body>
267
+ </html>
skills/product-study/examples/dino/sources.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "slug": "dino",
3
+ "tool": "fetch_public.py 6.0.1",
4
+ "user_agent": "autocode-product-study/6.0.1 (+https://github.com/ilang-ai/autocode; public pages only)",
5
+ "policy": "public pages only; robots.txt honored; no login; no captures; no binaries",
6
+ "sources": [
7
+ {
8
+ "url": "https://github.com/wayou/t-rex-runner",
9
+ "fetched_at": "2026-10-14T00:09:49Z",
10
+ "final_url": "https://raw.githubusercontent.com/wayou/t-rex-runner/master/README.md",
11
+ "status": "ok",
12
+ "kind": "github",
13
+ "title": "GitHub wayou/t-rex-runner README",
14
+ "description": "",
15
+ "bytes": 119,
16
+ "sha256": "25f5671d666db10d51d115723b998ae8b8816cbc97d700d17cd4e0c262db6399",
17
+ "license": "unknown",
18
+ "repo_meta": {},
19
+ "id": "S1",
20
+ "file": "sources/S1.txt"
21
+ },
22
+ {
23
+ "url": "https://raw.githubusercontent.com/wayou/t-rex-runner/gh-pages/index.js",
24
+ "fetched_at": "2026-10-14T00:10:00Z",
25
+ "final_url": "https://raw.githubusercontent.com/wayou/t-rex-runner/gh-pages/index.js",
26
+ "status": "ok",
27
+ "kind": "text",
28
+ "title": "/wayou/t-rex-runner/gh-pages/index.js",
29
+ "description": "",
30
+ "bytes": 90241,
31
+ "sha256": "867e8f6a2beca3d720b4884a556067cf32601a051e7882a86ce54e9ff47f1c86",
32
+ "id": "S2",
33
+ "file": "sources/S2.txt"
34
+ }
35
+ ],
36
+ "skipped": [
37
+ {
38
+ "url": "https://wayou.github.io/t-rex-runner/",
39
+ "fetched_at": "2026-10-14T00:09:58Z",
40
+ "status": "skipped",
41
+ "reason": "page has almost no readable text (53 chars); likely rendered by JavaScript or empty"
42
+ }
43
+ ]
44
+ }
skills/product-study/examples/linear/README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Example: Linear → a lightweight issue tracker for a ten-person team
2
+
3
+ Produced on 2026-10-13 by an AI agent that had only this skill installed, from
4
+ the user message *"我想做一个像 Linear 那样的工单工具,给我们十个人的软件团队用,要键盘优先、轻量,不要企业那一堆东西。"*
5
+ It passed `blueprint.py check` on the first run (26 ok, 0 fail).
6
+
7
+ - `blueprint.md` — sections 0–10 in Chinese, 17 public pages cited, every claim tagged.
8
+ - `mvp.md` — the hand-off: 5 objects, 7 screens, 7 build steps, 5 acceptance checks.
9
+ - `sources.json` — what was fetched (URLs, dates, hashes) and the one URL that was refused (404).
10
+
11
+ The fetched page texts (`sources/S*.txt`) are not included: they are extracts of
12
+ Linear's own pages. Re-create them with
13
+ `fetch_public.py fetch linear <the urls in sources.json>`.
14
+
15
+ Linear is a trademark of Linear Orbit, Inc. This example describes the
16
+ product's public structure for study; nothing of its interface, copy, images,
17
+ brand or code is reproduced here, and none goes into a product built from it.
skills/product-study/examples/linear/blueprint.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Product blueprint: Linear
2
+
3
+ Product: Linear · Official site: https://linear.app · Studied on: 2026-10-13 · Goal: 十人软件团队的轻量工单工具,键盘优先,不要企业功能
4
+
5
+ 阅读说明:本蓝图只描述**结构**(产品做什么、对象之间怎么关联、用户走哪些流程),全部来自文末 Sources 列出的公开页面。它是一张用来设计我们自己产品的地图,不包含原产品的界面、文案、图片或品牌,也没有使用任何非公开来源。置信度标记:{高} = 官方页面明确写了;{中} = 官方页面暗示或由上下文推断;{推测} = 我的判断,没有页面直接说。
6
+
7
+ ## 0. 摘要 Summary
8
+
9
+ Linear 自称是"面向团队与 AI agent 的产品开发系统",核心对象是工单(issue)、团队(team)、工作区(workspace),往上用项目(project)和倡议(initiative)组织工作,横向用周期(cycle)做短期规划,用视图(view)从不同角度看同一批工单 [S1, S3]。它最强的地方是速度与专注:工单创建、改属性、分诊、跨团队移动都有单键或组合键快捷方式,并配有命令面板 [S17, S7, S6, S8]。定价按席位:免费版无限成员但限 2 个团队、250 条工单;Basic 每人每月 10 美元;Business 每人每月 16 美元解锁私有团队、分诊智能、洞察等;Enterprise 定制并提供 SAML/SCIM [S2]。近一年的更新几乎全在 AI agent、代码审查(diffs)、Loops 自动化和企业级管控上 [S8]——这些正是我们十人团队不需要的部分,也是我们的轻量版本得以存在的理由。
10
+
11
+ ## 1. 功能清单 Feature inventory
12
+
13
+ | Feature | What it does (one line) | Tier | Sources | Confidence |
14
+ |---|---|---|---|---|
15
+ | 工单 Issue | 工作的最小单位,必须属于一个团队,必须有标题和状态,按创建顺序分配编号 | core | S3, S17 | 高 |
16
+ | 工作流状态 Workflow | 每个团队自定义的一组有序状态,列表按它分组,看板按它分列,系统给默认流可改 | core | S3 | 高 |
17
+ | 团队 Team | 主要组织单位,拥有自己的状态流、周期、标签和工单集合;成员可同时属于多个团队 | core | S3, S5 | 高 |
18
+ | 工作区 Workspace | 一家公司的总容器,有唯一 URL,新建时自动生成同名团队 | core | S3, S5 | 高 |
19
+ | 项目 Project | 围绕一个结果把工单分组,可跨团队共享,但一条工单同时只能属于一个项目 | core | S3, S6 | 高 |
20
+ | 周期 Cycle | 团队重复的时间盒规划期,1 到 8 周,开启后自动生成后续周期 | core | S3, S16 | 高 |
21
+ | 视图 View | 对同一批工单的不同过滤/分组方式,不改变工单本身;可保存、可分享 URL | core | S3, S8 | 高 |
22
+ | 快捷键与命令面板 | 单键 C 新建工单,Shift P 加入项目,Cmd/Ctrl K 打开模糊搜索的命令面板,G 然后 T 跳到分诊 | core | S17, S6, S7, S8 | 高 |
23
+ | 优先级 Priority | 四档:紧急、高、中、低 | core | S17 | 高 |
24
+ | 标签 Label | 可按团队或工作区作用域,支持标签组 | core | S5 | 高 |
25
+ | 评论 Comment | 工单下的讨论,支持 @ 提及和反应 | core | S3, S17 | 中 |
26
+ | 负责人与指派 | 工单可指派给一个人,也可指派给其他团队的人 | core | S3, S5 | 高 |
27
+ | 里程碑 Milestone | 项目内部的阶段,带目标日期,按所属工单计算完成度 | plus | S3, S6 | 高 |
28
+ | 分诊 Triage | 团队的特殊收件箱,外部成员或集成建的工单先进这里,用 1/2/3/H 接受、拒绝、标重复、暂缓 | plus | S3, S7 | 高 |
29
+ | 父子工单 | 工单可拆成子工单,子工单可分到任意团队或成员 | plus | S5, S17 | 中 |
30
+ | 估点 Estimate | T 恤尺码映射到点数(XS=1 到 XXXL=21) | plus | S17 | 高 |
31
+ | 草稿 Drafts | 关掉弹窗可存为跨设备草稿,保留 6 个月;临时草稿只存本机 | plus | S17 | 高 |
32
+ | 模板 Template | 团队级工单/项目/文档模板,可生成预填 URL | plus | S5, S17 | 高 |
33
+ | 预填建单链接 | 通过 URL 参数预设标题、状态、团队、优先级、负责人、周期、标签、项目 | plus | S17 | 高 |
34
+ | 跨团队移动 | Cmd/Ctrl Shift M 把工单移到别的团队,生成新编号,旧链接仍可跳转 | plus | S17 | 高 |
35
+ | 批量选择与撤销 | Cmd/Ctrl A 全选列表,Cmd/Ctrl Z 撤销移动 | plus | S17 | 高 |
36
+ | 周期自动化 | 未完成工单自动滚入下一周期;活动中的无周期工单可自动加入当前周期 | plus | S16 | 高 |
37
+ | 周期容量 | 未开始的周期显示容量表盘,按前三个周期的速度估算 | plus | S16 | 高 |
38
+ | 通知收件箱 Inbox | 汇总需要你处理的通知,新增"优先"标签页把要紧的和可等的分开 | plus | S8, S13 | 高 |
39
+ | 项目列表/看板/时间线 | 团队和工作区都有项目页,可按状态、负责人、目标日期分组,可切时间线 | plus | S6 | 高 |
40
+ | 描述历史 | 可查看并恢复工单描述的早期版本 | plus | S17 | 高 |
41
+ | 团队退役与删除 | 退役后只读保留���史;删除有 30 天恢复期 | plus | S5 | 高 |
42
+ | 倡议 Initiative | 项目之上的战略层,可嵌套父子倡议 | drop | S3 | 高 |
43
+ | 周期性工单 | 按节奏自动重建的工单 | drop | S17 | 高 |
44
+ | 邮件建单与 Asks | 给团队或模板配邮箱地址,外部人发邮件即建单 | drop | S17, S7 | 高 |
45
+ | 文档 Documents | 项目内 Markdown 文档与外链资源 | drop | S6 | 高 |
46
+ | AI 与代码审查 | Linear Agent、编码会话、Loops、Diffs、引导式审查、分诊智能 | drop | S1, S8 | 高 |
47
+ | 洞察与仪表盘 | Insights、Dashboards、进度报告 | drop | S2 | 高 |
48
+ | 企业管控 | 私有团队、访客、SAML、SCIM、审计日志、IP 限制、域名认领 | drop | S2, S11 | 高 |
49
+ | 原生移动端 | iOS/Android 独立应用,推送与通知时段 | drop | S13 | 高 |
50
+
51
+ ## 2. 信息架构 Information architecture
52
+
53
+ - 容器嵌套:工作区 > 团队 > 工单;项目横跨一个或多个团队并聚合工单;里程碑挂在项目下;周期属于团队;倡议在项目之上 [S3, S5, S6] {高}
54
+ - 侧边栏以团队为单位:你加入的团队出现在侧边栏;浏览未加入的团队时它们临时出现在一个"探索中"分区 [S5] {高}
55
+ - 每个团队下固定几页:团队主页、分诊(可选开启)、工单、周期(可选开启)、项目、视图 [S5] {高}
56
+ - 工作区级也有一个项目总页和倡议页,用来跨团队看所有项目 [S6, S1] {高}
57
+ - 个人入口包括收件箱、我的工单、草稿、收藏 [S1, S17, S8] {中}
58
+ - 项目页由概览、工单两个固定标签加任意自定义视图标签组成;Cmd/Ctrl I 开关右侧属性栏 [S6] {高}
59
+ - 工单编号格式为"团队标识-序号",项目编号为"P-团队标识-序号" [S6, S17] {高}
60
+ - 团队设置分为:通用(名称、标识、时区、估点)、成员、标签、模板、状态与自动化、分诊、周期、周期性工单 [S5] {高}
61
+ - 命令面板(Cmd/Ctrl K)是跨页面的全局入口,可用来搜索、执行动作、复制预填链接 [S17, S8] {高}
62
+
63
+ ## 3. 核心对象与数据模型(推断)Core objects and data model (inferred)
64
+
65
+ | Object | Key fields | Relations | Sources | Confidence |
66
+ |---|---|---|---|---|
67
+ | 工作区 Workspace | 名称、URL 子路径 | 1:N 团队;N:M 用户(一人可在多个工作区有账号) | S3 | 高 |
68
+ | 团队 Team | 名称、标识符、时区、是否开启估点/周期/分诊 | N:1 工作区;1:N 工单;1:N 周期;1:N 状态;1:N 团队级标签;N:M 成员;N:M 项目 | S3, S5 | 高 |
69
+ | 状态 WorkflowStatus | 名称、顺序、类别(分诊/待办/未开始/进行中/已完成/已取消) | N:1 团队;1:N 工单 | S3, S7, S16 | 中 |
70
+ | 工单 Issue | 标题(必填)、Markdown 描述、状态(必填)、序号、优先级(4 档)、估点、创建时间 | N:1 团队;N:1 项目(可选);N:1 周期(可选);N:1 里程碑(可选);N:1 负责人;N:M 标签;N:1 父工单;1:N 评论;N:M 关联工单 | S3, S17, S6 | 高 |
71
+ | 项目 Project | 名称(必填)、状态(必填)、负责人、图标、概览、开始/目标日期(粒度可到年/半年/季/月/日)、编号 | N:M 团队(其中一个为主导团队);1:N 工单;1:N 里程碑;1:N 文档与外链;N:1 倡议 | S6, S3 | 高 |
72
+ | 里程碑 Milestone | 名称、目标日期、描述、顺序 | N:1 项目;1:N 工单 | S3, S6 | 高 |
73
+ | 周期 Cycle | 序号、名称、描述、开始/结束日期、时长(1–8 周)、冷却期 | N:1 团队;1:N 工单 | S16 | 高 |
74
+ | 标签 Label | 名称、作用域(团队或工作区)、所属标签组 | N:1 团队或工作区;N:M 工单 | S5 | 高 |
75
+ | 评论 Comment | 正文、作者、时间 | N:1 工单;N:1 用户 | S3, S17 | 中 |
76
+ | 用户/成员 User | 名称、角色(管理员/成员/访客)、显示名 | N:M 工作区;N:M 团队 | S3, S5, S2 | 中 |
77
+ | 倡议 Initiative | 名称、状态(含提议/取消)、优先级、标签 | 1:N 项目;父子倡议 | S3, S8 | 高 |
78
+ | 草稿 Draft | 内容、创建时间(6 个月后清理) | N:1 用户 | S17 | 高 |
79
+ | 模板 Template | 类型(工单/项目/文档)、预设属性、可选邮箱地址 | N:1 团队 | S5, S17 | 高 |
80
+
81
+ ## 4. 关键用户流程 Key user flows
82
+
83
+ - 流程 A 上手:先逛公开演示工作区看布局 → 用工作邮箱创建工作区 → 系统自动生成同名团队 → 官方建议小团队全员放一个团队、起步只建一两个团队 [S4, S5] {高}
84
+ - 流程 B 建单(键盘):按 C 弹出创建窗(Alt/Option C 走模板)→ 填标题 → 顺手设优先级/负责人/项目/周期/标签 → 创建后 3 分钟内的属性改动不记入活动日志 → 中途离开则保留临时草稿 [S17] {高}
85
+ - 流程 C 推进工单:在详情页直接点标题或描述内联编辑 → 工单沿团队状态流前进 → 需要时 Cmd/Ctrl Shift M 移到别的团队,状态映射到最接近的状态并换新编号 [S17, S3] {高}
86
+ - 流程 D 分诊:非本团队成员或集成创建的工单落入分诊队列 → G 然后 T 打开 → 1 接受(进入团队默认状态)/ 2 拒绝(变已取消)/ 3 标重复并合并到原单 / H 暂缓 → 可要求必须先设优先级才能离开分诊 [S7] {高}
87
+ - 流程 E 周期规划:团队设置里开启周期,选时长、起始星期、未来周期数(最多 15 个)→ 把工单放进当前或未来周期 → 周期结束未完成工单自动滚入下一周期,但移到待办/分诊/取消的不滚 → 未开始的周期按前三个周期速度显示容量 [S16] {高}
88
+ - 流程 F 项目协作:从团队或工作区项目页按 + 新建,只需名称和状态 → 选中工单 Shift P 加入项目,或在项目视图里按 C 直接建 → 项目页看概览、工单和自定义视图标签、里程碑与进度图 → 可多团队共享,但只有一个主导团队决定可用项目状态 [S6] {高}
89
+ - 流程 G 找东西:Cmd/Ctrl K 命令面板模糊搜索 → 用过滤条件做自定义视图 → 复制 URL(或 Cmd/Ctrl Shift C)把过滤后的视图分享给同事 [S17, S8, S3] {高}
90
+
91
+ ## 5. 技术栈线索 Technical stack clues
92
+
93
+ - 公开 API 是 GraphQL,认证支持 OAuth 2.0 和个人 API key;文档覆盖分页、过滤、限流、弃用、webhook、附件 [S9] {高}
94
+ - 官方提供 TypeScript SDK(强类型模型与操作),以及 CLI 导入器 [S9] {高}
95
+ - 对外提供 MCP 服务器,供 Cursor、Claude、ChatGPT、Windsurf 等 AI 客户端读写数据 [S10, S8] {高}
96
+ - 移动端用原生 Swift 与 Kotlin 编写,不是 WebView 套壳 [S13] {高}
97
+ - 存在桌面应用,部分快捷键和创建命令为桌面端专有 [S8] {高}
98
+ - 招聘页把"构建同步引擎"列为团队公开分享的工程主题,说明客户端与服务端之间有实时同步层 [S12] {中}
99
+ - 工单与项目描述、文档统一使用 Markdown [S6, S17] {高}
100
+ - 传输强制 HTTPS + TLS 1.2,静态数据 AES-256 加密;创建工作区时可选数据放在欧盟或美国 [S11] {高}
101
+ - 登录方式:Google SSO、邮箱验证码、Passkeys;SAML/SCIM 仅企业版 [S11, S2] {高}
102
+ - 支持通过 URL 查询参数预填新建工单(标题、团队、状态、优先级等) [S17, S9] {高}
103
+ - webhook 出口 IP 公布在站点的 .well-known 路径下 [S8] {高}
104
+ - 工单描述有版本历史并可回滚;文档支持作者归属标识 [S17, S8] {高}
105
+ - 在招岗位以全栈/产品工程师、移动端设计师、AI 产品工程师为主,公司全远程 [S12] {中}
106
+
107
+ ## 6. 定价与商业模式 Pricing and business model
108
+
109
+ | Plan | Price | What it unlocks | Sources | Confidence |
110
+ |---|---|---|---|---|
111
+ | Free | 0 美元 | 无限成员、2 个团队、250 条工单、10MB 文件上传、Agent 平台 | S2 | 高 |
112
+ | Basic | 每人每月 10 美元(年付) | 5 个团队、无限工单、无限上传、管理员角色 | S2 | 高 |
113
+ | Business | 每人每月 16 美元(年付) | 无限团队、私有团队与访客、分诊智能、Loops、代码智能、Insights、Asks、Zendesk/Intercom 集成 | S2 | 高 |
114
+ | Enterprise | 定制价,仅年付 | 发票/PO 付款、SAML 与 SCIM、细粒度管理、高级安全、组织建模、迁移与优先支持、客户经理 | S2 | 高 |
115
+
116
+ - 按席位计费,团队数量是各档的主要门槛:2 / 5 / 无限 / 无限 [S2, S5] {高}
117
+ - AI 相关功能(编码会话、Loops)在订阅之外另按 AI 额度计费,管理员可查看用量并设上限 [S2, S8] {高}
118
+ - 私有团队、团队级项目状态与项目标签、分诊自动化都从 Business 起 [S5, S6, S7] {高}
119
+ - 引导式代码审查在 2026 年 10 月下放到了 Basic 档 [S8] {高}
120
+ - 官网宣称超过 4 万家公司/产品团队在用 [S1, S2] {高}
121
+
122
+ ## 7. 集成与生态 Integrations and ecosystem
123
+
124
+ - 集成目录按用途分类:基础、Agent、AI 客户端、工程、缺陷上报、自动化、客户体验、安全合规、分析、协作、媒体设计 [S10] {高}
125
+ - 官方自建集成:GitHub、GitLab、Slack、Figma、Intercom、Zendesk、Front、Notion、Google Sheets、Zapier、Jira 迁移、邮件建单 [S10] {高}
126
+ - 编码 agent 可直接领取工单:Codex、Cursor、GitHub Copilot、Devin、Factory、Sentry [S10] {高}
127
+ - GitHub 集成覆盖 PR 自动化、在 Linear 内审代码、工单同步;状态流可配 git 自动化与分支命名 [S10, S5] {高}
128
+ - 分诊责任轮值可接 PagerDuty、OpsGenie、Rootly、incident.io 的排班 [S7] {高}
129
+ - 周期可订阅为日历(Google Calendar 或 .ics) [S16] {高}
130
+ - 数据进出:CSV 导出团队工单、从 Jira/GitHub 导入、工作区迁移、Airbyte/Fivetran 同步 [S5, S8, S10, S9] {高}
131
+ - 开发者入口:GraphQL API、webhook、TypeScript SDK、OAuth 应用、Agent 交互指南 [S9] {高}
132
+ - 移动端 iOS/Android 原生应用,支持实时推送与自定义通知时段 [S13] {高}
133
+
134
+ ## 8. 空白与差异化机会 Gaps and differentiation opportunities
135
+
136
+ - 免费版封顶 250 条工单、2 个团队 [S2] {高};一个活跃的十人软件团队几个月就会触顶,被迫付费 {推测}
137
+ - 近 12 个月的更新几乎都在 AI agent、编码会话、Loops���diffs 和企业管控 [S8] {高};产品重心已经偏向大组织和 AI 工作流,对只想要干净工单的小团队是噪音 {推测}
138
+ - 定价页上大部分高级能力(分诊智能、洞察、Asks、私有团队)都从 Business 起 [S2] {高};十人团队用不上,却要为整套系统的复杂度买单 {推测}
139
+ - 官方自己建议小团队全员一个团队最简单 [S5] {高};所以我们的 v1 可以直接把"一个工作区 = 一个团队"写死,省掉整层团队管理 {推测}
140
+ - 项目文档承认"持续性工作"没有好方案,只能靠无目标日期的项目或自定义状态绕 [S6] {高};轻量版可以给"长期事务"一个明确归属 {推测}
141
+ - 周期一次只能看一个团队 [S5] {高};单团队产品天然没有这个问题 {推测}
142
+ - 临时草稿只存本机,登出即丢 [S17] {高}
143
+ - 数据存放只能选欧盟或美国 [S11] {高};自托管或境内部署是留白,小团队可以用一个容器自己跑 {推测}
144
+ - 移动端是独立原生应用 [S13] {高};我们 v1 用响应式网页即可,不做原生 {推测}
145
+ - 状态流配置页公开文档取不到(404) [S8] {中};我们的状态类别只能从概念页和周期页侧面推断,v1 用固定五类状态即可 {推测}
146
+ - 快捷键体系是它的核心体验,但散落在各个文档页 [S17, S7, S6] {高};我们可以把快捷键表当作一等公民,在产品内一处可查 {推测}
147
+
148
+ ## 9. MVP 切分 MVP cut
149
+
150
+ **Users and the one job:** 一个十人软件团队,一个工作区就是一个团队;唯一要做好的事:不碰鼠标也能快速录入、推进、按周期规划工单。
151
+
152
+ **Objects 对象 (<= 5):** 成员(User)、工单(Issue)、项目(Project)、周期(Cycle)、评论(Comment)
153
+
154
+ **Screens 界面 (<= 7):** 登录页、工单列表(按状态分组)、工单详情(含评论)、新建工单弹窗(C 触发)、项目页(列表加单个项目的工单与进度)、周期页(当前/下一/历史)、设置页(团队名与成员邀请)
155
+
156
+ **Dropped from v1 and why:** 多团队与子团队(单团队写死,省掉整层管理);倡议、里程碑(十人团队用项目就够);分诊、模板、邮件建单、周期性工单(都是进件流程,v1 先由成员自己建单);草稿、描述历史、父子工单、估点(好用但可分离,v2 再加);GitHub/Slack 等任何第三方集成(v1 不做集成);AI、代码审查、Loops、洞察、仪表盘(不是轻量工单工具的事);私有团队、访客、SAML、SCIM、审计(企业功能,用户明确不要);原生移动端(响应式网页替代)。状态固定为五类:待办、未开始、进行中、已完成、已取消,不做自定义状态流;标签做成工单上的简单文本标签,不单独建对象;认证只用邮箱加密码;部署目标只有一个:一个 Docker 容器(Web 服务 + SQLite)跑在一台服务器上。
157
+
158
+ **Build order (each step ends in something the user can click):**
159
+ 1. 脚手架 + 邮箱密码登录 + 初始化单团队:登录后能看到一个空的工单列表和侧边栏。
160
+ 2. 工单主循环:按 C 弹出新建窗(标题必填)、列表按状态分组、j/k 上下移动、Enter 打开详情、详情页内联改标题和描述;工单编号为"团队标识-序号"。
161
+ 3. 工单属性与快捷键:状态五类、优先级四档、负责人、文本标签;在列表或详情里用单键改状态/优先级/负责人;Cmd/Ctrl K 命令面板可搜索工单和执行这些动作;产品内有一页快捷键表。
162
+ 4. 评论:详情页下方评论线程,支持 @ 提及成员。
163
+ 5. 项目:新建项目只需名称和状态;选中工单按 Shift P 加入项目;项目页显示该项目的工单和完成比例。
164
+ 6. 周期:设置里开启周期(选时长 1–4 周和起始星期),自动生成当前与下一个周期;工单可放入周期;周期到期时未完成的工单自动滚入下一个周期。
165
+ 7. 设置与上线:邀请成员(生成邀请链接)、改团队名与标识;打包为一个 Docker 容器部署到一台服务器,用 HTTPS 访问。
166
+
167
+ **Acceptance (v1 is done when):**
168
+ 1. 用户做:用邮箱和密码登录 → 应看到:团队的工单列表 → 机器验:登录后请求工单列表返回 200 且条数等于种子数据。
169
+ 2. 用户做:全程不用鼠标,按 C 新建、j/k 选中、Enter 打开、快捷键改为已完成 → 应看到:这条工单出现在「已完成」 → 机器验:该工单 status 字段为 done,且过程中没有鼠标事件。
170
+ 3. 用户做:在一条工单下留评论并 @ 另一名成员 → 应看到:对方刷新后看到评论 → 机器验:评论记录含被 @ 成员的 id。
171
+ 4. 用户做:新建一个项目,加入三条工单,完成其中一条 → 应看到:项目页显示 1/3 → 机器验:完成比例字段等于 0.333。
172
+ 5. 用户做:开启两周一轮的周期,放入工单,让周期到期 → 应看到:未完成的工单出现在下一个周期 → 机器验:到期后未完成工���的 cycle 字段指向下一周期。
173
+
174
+ **Learned vs own 学来的 / 自己定的:**
175
+ - 学来的:工单状态流、键盘优先的新建和导航(C / j / k / Enter)、周期(cycle)到期自动顺延、项目完成比例的概念 [S1][S2]。
176
+ - 自己定的:界面、配色、布局、全部文案、默认快捷键以外的交互、数据库结构、部署方式。
177
+
178
+ ## 10. 我们不会复制的东西 What we will not copy
179
+
180
+ - 原产品的界面外观、布局、配色、图标和字体:我们自己设计一套。
181
+ - 原产品的文案、截图、图片、Logo,以及属于商标的产品名和功能名。
182
+ - 原产品任何仓库或前端包里的代码(本次研究没有涉及任何代码仓库,也没有读取任何打包代码)。
183
+ - 任何不在公开页面上的东西:没有使用账号内页面、抓包、反编译或泄露材料。
184
+
185
+ ## Sources
186
+
187
+ <!-- Generated by `blueprint.py sources <slug>` from sources.json. Do not edit by hand. -->
188
+
189
+ - [S1] Linear – The system for product development — https://linear.app/ (fetched 2026-10-12, sha256 5803e801696a)
190
+ - [S2] Pricing – Linear — https://linear.app/pricing (fetched 2026-10-12, sha256 3a1d210e0b6f)
191
+ - [S3] Concepts – Linear Docs — https://linear.app/docs/conceptual-model (fetched 2026-10-12, sha256 87d1a6f62177)
192
+ - [S4] Start Guide – Linear Docs — https://linear.app/docs/start-guide (fetched 2026-10-12, sha256 bc3a11015a64)
193
+ - [S5] Teams – Linear Docs — https://linear.app/docs/teams (fetched 2026-10-12, sha256 cd981d791929)
194
+ - [S6] Projects – Linear Docs — https://linear.app/docs/projects (fetched 2026-10-12, sha256 7ab8146b84b8)
195
+ - [S7] Triage – Linear Docs — https://linear.app/docs/triage (fetched 2026-10-12, sha256 6e74cfc2f76e)
196
+ - [S8] Changelog – Linear — https://linear.app/changelog (fetched 2026-10-12, sha256 b4be4fc828ce)
197
+ - [S9] Linear Developers — https://linear.app/developers (fetched 2026-10-12, sha256 92d1f388b49b)
198
+ - [S10] Integrations – Linear — https://linear.app/integrations (fetched 2026-10-12, sha256 c507f72b63b9)
199
+ - [S11] Security – Linear — https://linear.app/security (fetched 2026-10-12, sha256 36258ee73036)
200
+ - [S12] We're hiring – Linear — https://linear.app/careers (fetched 2026-10-12, sha256 cc7b06d13369)
201
+ - [S13] Linear Mobile – Available for iOS and Android — https://linear.app/mobile (fetched 2026-10-12, sha256 4d89da62dc27)
202
+ - [S14] Linear Method – Practices for building — https://linear.app/method (fetched 2026-10-12, sha256 185ac408692b)
203
+ - [S15] An AI product system for modern enterprises — https://linear.app/enterprise (fetched 2026-10-12, sha256 f681f9490d60)
204
+ - [S16] Cycles – Linear Docs — https://linear.app/docs/use-cycles (fetched 2026-10-12, sha256 fb01973bd6c9)
205
+ - [S17] Issues – Linear Docs — https://linear.app/docs/creating-issues (fetched 2026-10-12, sha256 f3759e2581fe)
206
+
207
+ Refused or skipped (out of scope by policy, not used):
208
+
209
+ - https://linear.app/docs/configuring-workflows — HTTP 404
skills/product-study/examples/linear/mvp.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MVP hand-off
2
+
3
+ Product: Linear · Official site: https://linear.app · Studied on: 2026-10-13 · Goal: 十人软件团队的轻量工单工具,键盘优先,不要企业功能
4
+
5
+ Source blueprint: blueprint.md (same folder). Build only what is below; the rest of the blueprint is context, not scope.
6
+
7
+ ## MVP cut
8
+
9
+ **Users and the one job:** 一个十人软件团队,一个工作区就是一个团队;唯一要做好的事:不碰鼠标也能快速录入、推进、按周期规划工单。
10
+
11
+ **Objects 对象 (<= 5):** 成员(User)、工单(Issue)、项目(Project)、周期(Cycle)、评论(Comment)
12
+
13
+ **Screens 界面 (<= 7):** 登录页、工单列表(按状态分组)、工单详情(含评论)、新建工单弹窗(C 触发)、项目页(列表加单个项目的工单与进度)、周期页(当前/下一/历史)、设置页(团队名与成员邀请)
14
+
15
+ **Dropped from v1 and why:** 多团队与子团队(单团队写死,省掉整层管理);倡议、里程碑(十人团队用项目就够);分诊、模板、邮件建单、周期性工单(都是进件流程,v1 先由成员自己建单);草稿、描述历史、父子工单、估点(好用但可分离,v2 再加);GitHub/Slack 等任何第三方集成(v1 不做集成);AI、代码审查、Loops、洞察、仪表盘(不是轻量工单工具的事);私有团队、访客、SAML、SCIM、审计(企业功能,用户明确不要);原生移动端(响应式网页替代)。状态固定为五类:待办、未开始、进行中、已完成、已取消,不做自定义状态流;标签做成工单上的简单文本标签,不单独建对象;认证只用邮箱加密码;部署目标只有一个:一个 Docker 容器(Web 服务 + SQLite)跑在一台服务器上。
16
+
17
+ **Build order (each step ends in something the user can click):**
18
+ 1. 脚手架 + 邮箱密码登录 + 初始化单团队:登录后能看到一个空的工单列表和侧边栏。
19
+ 2. 工单主循环:按 C 弹出新建窗(标题必填)、列表按状态分组、j/k 上下移动、Enter 打开详情、详情页内联改标题和描述;工单编号为"团队标识-序号"。
20
+ 3. 工单属性与快捷键:状态五类、优先级四档、负责人、文本标签;在列表或详情里用单键改状态/优先级/负责人;Cmd/Ctrl K 命令面板可搜索工单和执行这些动作;产品内有一页快捷键表。
21
+ 4. 评论:详情页下方评论线程,支持 @ 提及成员。
22
+ 5. 项目:新建项目只需名称和状态;选中工单按 Shift P 加入项目;项目页显示该项目的工单和完成比例。
23
+ 6. 周期:设置里开启周期(选时长 1–4 周和起始星期),自动生成当前与下一个周期;工单可放入周期;周期到期时未完成的工单自动滚入下一个周期。
24
+ 7. 设置与上线:邀请成员(生成邀请链接)、改团队名与标识;打包为一个 Docker 容器部署到一台服务器,用 HTTPS 访问。
25
+
26
+ **Acceptance (v1 is done when):**
27
+ 1. 用户做:用邮箱和密码登录 → 应看到:团队的工单列表 → 机器验:登录后请求工单列表返回 200 且条数等于种子数据。
28
+ 2. 用户做:全程不用鼠标,按 C 新建、j/k 选中、Enter 打开、快捷键改为已完成 → 应看到:这条工单出现在「已完成」 → 机器验:该工单 status 字段为 done,且过程中没有鼠标事件。
29
+ 3. 用户做:在一条工单下留评论并 @ 另一名成员 → 应看到:对方刷新后看到评论 → 机器验:评论记录含被 @ 成员的 id。
30
+ 4. 用户做:新建一个项目,加入三条工单,完成其中一条 → 应看到:项目页显示 1/3 → 机器验:完成比例字段等于 0.333。
31
+ 5. 用户做:开启两周一轮的周期,放入工单,让周期到期 → 应看到:未完成的工单出现在下一个周期 → 机器验:到期后未完成工单的 cycle 字段指向下一周期。
32
+
33
+ **Learned vs own 学来的 / 自己定的:**
34
+ - 学来的:工单状态流、键盘优先的新建和导航(C / j / k / Enter)、周期(cycle)到期自动顺延、项目完成比例的概念 [S1][S2]。
35
+ - 自己定的:界面、配色、布局、全部文案、默认快捷键以外的交互、数据库结构、部署方式。
36
+
37
+
38
+ ## What we will not copy
39
+
40
+ - 原产品的界面外观、布局、配色、图标和字体:我们自己设计一套。
41
+ - 原产品的文案、截图、图片、Logo,以及属于商标的产品名和功能名。
42
+ - 原产品任何仓库或前端包里的代码(本次研究没有涉及任何代码仓库,也没有读取任何打包代码)。
43
+ - 任何不在公开页面上的东西:没有使用账号内页面、抓包、反编译或泄露材料。
44
+
45
+
46
+ ## Verify
47
+
48
+ Keep the rules (numbers, formulas, state changes) in one block the acceptance runner can load without a browser; tag the learned ones [learned].
49
+ Ship a checks file next to the build (acceptance.js or acceptance.py) that prints one JSON row per machine check; run it with
50
+ `python3 <product-study>/scripts/acceptance_run.py <site_dir>` before go-live and again with `--url <live url>` after. The table it prints is what the user sees.
51
+ The remaining checks are actions the user performs; list them as actions, never as 'tests passed'.