@arshdelight/practi 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,11 +58,12 @@ The local workflow is fully offline. Optionally a practice syncs with practihub
58
58
  |---|---|---|
59
59
  | `name` | both | display label (required); renaming changes the hash like any edit |
60
60
  | `description` | both | one line — what this skill does, for discovery/selection |
61
- | `content` | both | the body: details, narrative, warnings (trimmed for the hash) |
61
+ | `content` | both | **how** to do it — nothing else (trimmed for the hash) |
62
+ | `notice` | both | caveats and pitfalls: what tends to go wrong here and what to do instead. Optional — fill it only when there is one. Never fold a notice into `content` |
62
63
  | `op` | practice | `seq` (default, ordered) · `par` parallelizable · `choice` alternatives · `loop` repetition (`{mode:"count",count:N}` or `{mode:"until",until:"<prose>"}`) · `set` directory view, no aggregation |
63
64
  | `children` | practice | inline subtrees (recursive, same shape) or `{ "hash": … }` refs to stored POPs — interchangeable |
64
- | `inputs` | action | consumed flows: `name` + optional `spec`; optional `from` wires one producer |
65
- | `outputs` | action | produced flows — the step's acceptance criteria (`from` not allowed) |
65
+ | `inputs` | action | what the step takes in: `name` + optional `spec` for every material, tool, account and piece of information; `from` when it is another step's output |
66
+ | `outputs` | action | what the step yields — `name` + `spec`, the done-when check (`from` not allowed) |
66
67
  | `attachments` | action | blob pointers (below) |
67
68
  | `license` / `metadata` | both | reuse terms / vendor bag (`x-<vendor>-<name>` keys) |
68
69
 
@@ -73,30 +74,137 @@ Documents carry **no history fields**: a document is a pure content snapshot. Re
73
74
  "name": "Make tea",
74
75
  "description": "From kettle to cup",
75
76
  "children": [
76
- { "name": "Boil water", "content": "Heat until boiling.",
77
+ { "name": "Boil water", "description": "Heat the water to a rolling boil.",
78
+ "content": "Fill the kettle and switch it on.",
79
+ "notice": "Do not overfill the kettle.",
80
+ "inputs": [{ "name": "kettle" }],
77
81
  "outputs": [{ "name": "boiling water", "spec": "100°C" }] },
78
- { "name": "Pour", "content": "Pour along the wall.",
79
- "inputs": [{ "name": "boiling water", "from": "@Boil water" }] }
82
+ { "name": "Pour", "description": "Fill the cup.",
83
+ "content": "Pour along the wall.",
84
+ "inputs": [{ "name": "boiling water", "from": "@Boil water" }, { "name": "tea leaves", "spec": "2 g" }],
85
+ "outputs": [{ "name": "cup of tea", "spec": "85°C" }] }
80
86
  ]
81
87
  }
82
88
  ```
83
89
 
90
+ This one already follows the standard: each step declares what it takes in (`kettle` and `tea leaves` from outside, `boiling water` from the first step) and what it yields; `content` is only the how; the one pitfall is a `notice`. From this the SDK derives the practice's *what you need* — kettle, tea leaves — and *what you get* — a cup of tea.
91
+
84
92
  Rules that bite:
85
93
 
86
94
  - **Unknown fields are rejected** (`E_SCHEMA`), never dropped — silently dropping a field forks hashes. **Empty ≡ absent**: an optional field set to `""` or `[]` hashes exactly as if omitted.
95
+ - `notice` is a string like `description` (POP 2.2.0). A document that never carries it hashes as before; one that carries it needs an implementation of 2.2.0 or later — a hub still on an older SDK rejects the unknown field with `E_SCHEMA` until it is upgraded.
87
96
  - `attachments` / `inputs` / `outputs` are **action-only**; on a practice they are a schema error (they are derived aggregate views).
88
97
  - `inputs.from` accepts authoring sugar `"@<name>"`, resolved against this document's inline nodes; the stored form always carries hashes.
89
98
  - Export (`export`, `show --doc`, `skill export`) rewrites an in-subtree from pin as its `@name` label when the name is unambiguous — editing the referenced child then re-resolves by name on import instead of dangling on the old hash. Out-of-subtree or same-name-ambiguous pins export verbatim.
90
99
  - Children may inline recursively or reference stored content as `{ "hash": "sha256:…" }` — both forms produce the same root hash.
91
100
 
92
- ## Recording quality
101
+ ### What the reader sees
102
+
103
+ A practice is read by someone who was not there, on a page you do not control. Every reader (practi web, the hub) shows the same surface, in this order:
104
+
105
+ 1. **The card** — the root `name` and `description`. That is all a stranger has before deciding to open it.
106
+ 2. **The root page** — `description`, then two lists the SDK **derives from the steps' `inputs` and `outputs`**: *what you need* (inputs no step supplies) and *what you get* (outputs no step consumes). After them: optional `content`, then a **table of contents** — one card per step, showing each child's `name` and its one-line `description`. Last of all, the optional `notice`: a notice always sits at the bottom of its node.
107
+ 3. **Each step** — `description`, *what you get* (its `outputs`), *what you need* (its `inputs`), the `content` (how), and last the optional `notice`.
108
+ 4. **The end** — the last step's output says what "done" looks like.
109
+
110
+ Write for that surface. The two lists are computed, so you never write them — a tool a step uses but does not declare is simply missing from *what you need*. A step without a `description` is a blank line in the table of contents.
111
+
112
+ ### A practice is a tutorial, not a transcript
113
+
114
+ The session you just finished was full of exploration: dead ends, retries, things you looked up, numbers that were only true for your machine. **The practice is the edited version of that session** — the one route that works, written for the next person.
115
+
116
+ So the standard is not "as detailed as possible". It is: **as short as possible while a competent stranger can still do it and tell that it worked.** Record what actually worked — never an idealised route you did not run — then edit it the way a good tutorial is edited.
117
+
118
+ ## Writing quality
119
+
120
+ Check every document against these before committing it.
121
+
122
+ ### Shape of a good practice
123
+
124
+ | Part | Must be | Must not be |
125
+ |---|---|---|
126
+ | Root `name` | the result the reader gets — “煎出一块外焦里嫩的牛排” | a method chain (“X:A + B + C”), a topic (“关于牛排”) |
127
+ | Root `description` | one sentence: for whom, and what they end up with. ≤ 50 Chinese characters / 25 English words | a list of techniques; a paragraph |
128
+ | Root `content` | optional — only what no field can carry: when to use this practice and when not to. One or two lines | the *what you need / what you get* lists (they are derived — never restate them), time and level by default, dead-end analysis, background |
129
+ | Root `notice` | a caveat that holds for the whole practice | a pitfall of a single step (it belongs on that step) |
130
+ | Step `name` | verb + object — “擦干表面并撒盐” | a topic (“锅温”), a note (“提示词写法”), history (“已弃用”, “备用”, “v2”) |
131
+ | Step `description` | the one-line summary shown in the table of contents. ≤ 25 Chinese characters / 15 English words | missing |
132
+ | Step `inputs` | everything the step takes in: each material, tool, account and piece of information, plus the products of earlier steps (`from`). This is where *what you need* comes from | a tool the step uses but does not declare |
133
+ | Step `content` | **how** — exact: values, commands, the names of buttons and menu items | the done-when check (that is `outputs`), warnings (that is `notice`), restating inputs or outputs |
134
+ | Step `notice` | what tends to go wrong here and what to do instead. Optional: one or two sentences, only when there is one | instructions, encouragement, background; anything already in `content` |
135
+ | Step `outputs` | what the step yields, with the done-when check as `spec` | missing (that is the CLI's `W_NO_VERIFY`) |
136
+ | Structure | `seq` by default. `choice`, `loop`, `par` only where the reader's path branches, repeats, or truly does not care about order. Phases (nested practices) past 8 steps | a structure that mirrors the order *you* happened to try things |
137
+
138
+ Lengths are given for Chinese prose; for English, count words instead.
139
+
140
+ Time and level are optional. Add a time only when it changes the reader's decision (an 8-week plan is not a weekend), as part of the one root `content` line.
141
+
142
+ ### Size budget
143
+
144
+ - **3–8 top-level steps.** Fewer than 3 with no judgment in them is an action, not a practice. More than 8 needs grouping into phases. Depth ≤ 3.
145
+ - **Step `content` ≤ 200 Chinese characters / 120 English words.** Fenced code blocks and tables do not count — they are compact reference material, not prose to read. (A table past 8 rows is still a sign the step is doing too much.) The exemplars average 40–90 characters of `content` per step.
146
+ - **`notice` ≤ 2 sentences.** A warning that needs a paragraph means the step is doing too much.
147
+ - **One action per step.** If you cannot write a single done-when check for the whole step, it is two steps.
148
+ - The CLI's `W_CONTENT_LONG` fires at 2000 characters of prose. That is a floor for "several steps are sharing one node" — never a target. The exemplars average 60–120 characters per step.
149
+
150
+ ### Detail: keep vs cut
151
+
152
+ “Detailed” means *exact where it matters*, not *complete*.
153
+
154
+ **Keep, exactly:** commands, paths, config keys and values, thresholds and timings, the names of buttons and menu items (quote them), required tools, versions and accounts, the done-when check — and one worked example of every value the reader must substitute, labelled as an example.
93
155
 
94
- Check every document against these before committing it:
156
+ **Cut:**
95
157
 
96
- - **Detailed** — someone who wasn't here can reproduce it: exact commands, file changes, config values, concrete specs. Record what was actually done — dead ends included — not the idealized version.
97
- - **Sanitized** — remove values specific to the author that a reproducer won't reuse: own repos, accounts, usernames, addresses, phones, credentials, personal hostnames/IPs — even embedded in commands, and even inside attachment bytes (screenshots, logs). Replace with descriptive placeholders (`<your-github-username>/repo`). Keep third-party package names, public endpoints, standard tools, and command structure.
98
- - **Curated** — a child step is something a reproducer physically does. Research and deciding are not steps; their conclusions go in `content`. Test: *would a reproducer physically do this, or only need its conclusion?*
99
- - **Bounded** — one document is one thing a reproducer pulls up and follows end-to-end for a single trigger. Sessions are time units; practices are structural ones — "record a session" means extracting the *practices* the session produced (zero, one, or several documents). Split when the parts would be invoked by different triggers or share few or no steps; if what remains has 1–2 steps and no judgment content, it was an action — don't manufacture a document around it.
158
+ - **A warning the reader needs goes in `notice`** on the step where it bites — what goes wrong → what to do instead, one or two sentences (“不要用 X——会 Y”). Routes you tried and dropped, tool comparisons, post-mortems: out of the document altogether (`practi note`, pinned to the step, if worth keeping at all).
159
+ - **Values that were only true for you**: one-off coordinates, your machine names and paths, timestamps, “本例” numbers nobody can reuse.
160
+ - **Background, tool manuals, option lists, parameter sweeps.** One line where it is used, at most.
161
+ - **History words**: 已弃用 / 备用 / 原方案 / v1 / deprecated / legacy. The document is the current route; history lives in the commit chain.
162
+ - **Raw output and logs.** Keep only the one line the reader must compare against.
163
+ - **Anything the root page already says.**
164
+
165
+ ### Code
166
+
167
+ - Commands and code go in fenced code blocks, runnable as written, with the places to substitute marked (`<your-domain>`, `<你的电脑名>`). Never describe code in prose — a paragraph explaining what a script does cannot be run.
168
+ - Keep the block to the part the reader must see or change. A whole script or file is an attachment (`practi blob add`), referenced from the step.
169
+
170
+ ### One practice stands alone
171
+
172
+ Practices are independent units: a reader who opens this one has read none of your others. Declare its prerequisites as `inputs` on the steps that use them — they become the practice's *what you need*. If a step needs a skill that is explained elsewhere, inline the minimum here — never make "see my other practice" a prerequisite. (Naming a related practice in plain text, for going deeper, is fine.)
173
+
174
+ ### Only actions are nodes
175
+
176
+ A child step is something the reader physically does. Research, deciding, background, pitfalls and reference material are not steps. Test: *would the reader physically do this, or only need its conclusion?* If only the conclusion — put that conclusion in one line of the step that needs it.
177
+
178
+ ### Flows
179
+
180
+ A step's inputs and outputs are the practice's dataflow. They are what the SDK turns into *what you need* and *what you get* — and what `practi show <hash>` prints as `external inputs` / `final outputs`.
181
+
182
+ - `outputs` on **every** step: what it yields, with the done-when check as `spec` (“两面深棕色,中心 50–52℃”). Intermediate products count as outputs too — the next step consumes them.
183
+ - `inputs` on **every** step, for **everything** it takes in:
184
+ - from outside the practice — a material, tool, account, piece of information: `{ "name": "铸铁锅" }`, with a `spec` when the detail matters (“厚 2–3 厘米”). No `from`.
185
+ - from an earlier step — the **same `name`** as that step's output, plus `"from": "@<step name>"`.
186
+ - Nothing restated in prose: not in `content`, not on the root.
187
+ - Then check the result: *external inputs* must read like the practice's shopping list, *final outputs* like its deliverable. A tool missing from the first → an undeclared input. An intermediate product showing up in either → a consumption you forgot to wire.
188
+ - Branches: when `choice` branches produce the same thing, give both outputs one name and wire the next step to each producer (one input entry per `from`).
189
+ - Loops: wire the loop's first step to what precedes the loop. Never wire backwards inside a loop — it closes a dataflow loop (`E_SCHEMA`).
190
+
191
+ ### Sanitized
192
+
193
+ Remove values specific to the author that a reproducer won't reuse: own repos, accounts, usernames, addresses, phones, credentials, personal hostnames/IPs — even embedded in commands, and even inside attachment bytes (screenshots, logs). Replace with descriptive placeholders (`<your-github-username>/repo`). Keep third-party package names, public endpoints, standard tools, and command structure.
194
+
195
+ ### Bounded
196
+
197
+ One document is one thing a reader pulls up and follows end-to-end for a single trigger. Sessions are time units; practices are structural ones — "record a session" means extracting the *practices* the session produced (zero, one, or several documents). Split when the parts would be invoked by different triggers or share few or no steps; if what remains has 1–2 steps and no judgment content, it was an action — don't manufacture a document around it.
198
+
199
+ ### From a session to a practice
200
+
201
+ 1. **Write the promise.** Root `name` = the result; `description` = one sentence: for whom, and what they end up with.
202
+ 2. **List what the reader does** — not what you did. Three to eight verbs, in order.
203
+ 3. **For each step fill four fields**: `inputs` (what it takes in) → `content` (how) → `outputs` (what it yields, with the done-when check) → `notice`, only if there is a pitfall.
204
+ 4. **Wire the products.** Every input that is another step's output gets `from`.
205
+ 5. **Choose the shape.** `seq` unless the reader's path branches (`choice`), repeats (`loop`) or genuinely does not care about order (`par`). Group past 8 steps.
206
+ 6. **Check the derived lists.** `practi new <name> --base doc.json`, then `practi show <hash>`: *external inputs* and *final outputs* must read like the shopping list and the deliverable. Leave the root `content` empty unless the scope needs a line.
207
+ 7. **Read it once as a newcomer.** Resolve every `W_*`; every question you would have to ask is a missing field; every line you would skip is a cut.
100
208
 
101
209
  ### E_ blocks, W_ only prompts
102
210
 
@@ -106,9 +214,23 @@ Check every document against these before committing it:
106
214
  |---|---|---|
107
215
  | Meaning | a validation invariant is violated | the writing looks thin, but is *legal* |
108
216
  | Effect | the revision is **refused** — `new --base` rejects without leaving a half-born folder, `commit` rolls the chain back; exit 1 | the revision **is committed** and the command exits 0 |
109
- | What to do | fix the JSON and re-run — this is a hard stop | keep the recording, then go back and fill in content when you can |
217
+ | What to do | fix the JSON and re-run — this is a hard stop | the commit already happened; go back and fix the writing before you move on |
218
+
219
+ So: **`W_*` are prompts, not errors — seeing one means "go back and fix it", never "this failed"**. Do not retry a commit that only printed `W_*`: it already succeeded. The codes are `W_THIN_CONTENT` (near-empty action — `content` plus `notice` — with no attachments), `W_NO_VERIFY` (an action with no `outputs`), `W_CONTENT_LONG` (a node carrying so much prose — fenced code blocks excluded — that it is probably several steps sharing one node: **cut what the reader does not need first; if what remains is still several steps, split it**), `W_FLAT_TREE` (many steps, none grouped), `W_DEEP_TREE`, `W_DUP_NAME`, `W_VAGUE_NAME`, `W_DESC_MISSING` (a practice root with no `description` — the field search leans on most). The thresholds are the CLI's own calibration, not protocol (pop-spec §6); treat them as a floor, not a target — a document with zero `W_*` has only cleared the minimum (see "Writing quality").
220
+
221
+ ## Exemplars
222
+
223
+ Five complete practices live in `examples/` beside this file (written in Chinese; the rules are language-neutral). Before writing a new practice, open the one closest in shape and match its level of detail:
224
+
225
+ | File | Domain | Shape | What to learn from it |
226
+ |---|---|---|---|
227
+ | `pan-seared-steak.json` | cooking | `seq` + `choice` | two branches yield one named product and the next step is wired to both; `content` is only the how, every pitfall is a `notice` |
228
+ | `first-5k-in-8-weeks.json` | fitness | `seq` + `loop` (count), with a `par` week | a repeating routine; a progression table in one step; a practice-wide `notice` on the root |
229
+ | `monthly-budget-routine.json` | personal finance | short `seq` | how short a complete practice can be — five steps, the root `content` is one line |
230
+ | `daily-folder-backup.json` | computing | `seq` + `choice`, code blocks | one product wired forward through three steps; a dry run before the real command; a restore test |
231
+ | `patch-a-nail-hole.json` | home repair | `seq` + `loop` (until) | every tool and material declared on the step that uses it — the root's *what you need* is entirely derived |
110
232
 
111
- So: **`W_*` are prompts, not errors — seeing one means "go back and add the missing content", never "this failed"**. Do not retry a commit that only printed `W_*`: it already succeeded. The codes are `W_THIN_CONTENT` (near-empty action with no attachments), `W_NO_VERIFY` (an action with no `outputs`), `W_CONTENT_LONG` (a node carrying so much prose — fenced code blocks excluded — that it is probably several steps sharing one node: **split it into child steps, do not trim it**), `W_FLAT_TREE` (many steps, none grouped), `W_DEEP_TREE`, `W_DUP_NAME`, `W_VAGUE_NAME`, `W_DESC_MISSING` (a practice root with no `description` — the field search leans on most). The thresholds are the CLI's own calibration, not protocol (pop-spec §6); treat them as a nudge, not a rule.
233
+ To read one in the reader: `practi new <name> --base <this-skill-dir>/examples/<file>.json`, then `practi web`.
112
234
 
113
235
  ## Attachments
114
236
 
@@ -255,17 +377,17 @@ practi skill export <ref> [--dir <out>] # a revision → an installable skill d
255
377
  practi skill import <dir> # replay a `practi skill export` directory back into the practice
256
378
  ```
257
379
 
258
- - An exported directory carries `SKILL.md` (a readable projection), attachment files, and `pop.doc.json` — the sidecar holding the canonical document. Import replays the sidecar byte-identically (same hash, any machine), re-staging attachment files into the practice's blob store; then `practi commit -m "..."` records it as a revision.
259
- - Import refuses directories without a sidecar (`E_NO_SIDECAR`): it is the inverse of export, not a skill importer. To bring a foreign skill into POP, read it and **author** a structured tree of practices and actions (the recording-quality rules apply).
380
+ - An exported directory carries `SKILL.md` (a readable projection), attachment files, and `pop.doc.json` — the sidecar holding the canonical document. Import replays the sidecar byte-identically (same hash, any machine), re-staging attachment files into the practice's blob store; then `practi commit -m "..."` records it as a revision. A node's `notice` is projected as a `> **Notice:**` blockquote at the end of the node's own content, before any child heading.
381
+ - Import refuses directories without a sidecar (`E_NO_SIDECAR`): it is the inverse of export, not a skill importer. To bring a foreign skill into POP, read it and **author** a structured tree of practices and actions (the writing-quality rules apply).
260
382
  - Hand-editing `SKILL.md` after export desynchronizes the sidecar: import warns and treats the edited body as truth (a new hash — fork semantics). Edit the document and re-export instead.
261
383
 
262
384
  ## Error codes
263
385
 
264
- `E_*` refuse a revision (born-empty folder on `new --base`, chain rollback on `commit`). `W_*` never do — see "Recording quality" above.
386
+ `E_*` refuse a revision (born-empty folder on `new --base`, chain rollback on `commit`). `W_*` never do — see "Writing quality" above.
265
387
 
266
388
  | Code | Trigger |
267
389
  |---|---|
268
- | `E_SCHEMA` | shape violation: unknown field anywhere, derived fields on a practice, op/children/loop on an action, duplicate attachment names, unresolvable `@label` |
390
+ | `E_SCHEMA` | shape violation: unknown field anywhere, a non-string `notice`, derived fields on a practice, op/children/loop on an action, duplicate attachment names, unresolvable `@label` |
269
391
  | `E_DANGLING` | a `{hash}` child not stored in this practice |
270
392
  | `E_FLOW_FROM` | `from` names no node in scope |
271
393
  | `E_HASH_FORMAT` | not `sha256:` + 64 lowercase hex |
@@ -275,7 +397,7 @@ practi skill import <dir> # replay a `practi skill export` direct
275
397
 
276
398
  ## Workflow quick reference
277
399
 
278
- - **Record a session** — extract the *practices* the conversation produced → shape one JSON tree per practice (quality rules above) → `practi new <name> --base doc.json -m "first"` → replace any `W_*` prompts you can (edit the working file, `commit` again) → `practi push` when it should live on the hub.
400
+ - **Turn a session into a practice** — extract the *practices* the conversation produced → for each, follow “From a session to a practice” above (promise → the reader's steps → per step `inputs` / `content` / `outputs` / `notice` → wire the products → shape → check the derived lists; match the nearest exemplar) → `practi new <name> --base doc.json -m "first"` → resolve every `W_*` and re-read it as a newcomer (edit the working file, `commit` again) → `practi push` when it should live on the hub.
279
401
  - **Find prior art** — `cd` into the practice → `practi search <query>` (add `--notes`; `field:` when you know the field) → `practi show <hash>`. No wording recall? `practi similar <hash>` from a node you do have.
280
402
  - **Learn from a practice** — reproduce it, then pin what you learned: `practi note add <node-hash> -m "…"`. Fold it back by editing the working file and committing.
281
403
  - **Improve a practice** — edit `<name>.json` → `practi commit -m "what changed"` → `practi push`. Oops: `commit --amend`, `history reset <seq>` (working file kept — keep or discard), or `export <head>` and re-edit. Improving someone else's practice is a new instance on the hub declaring `refines` → the original's root hash (§9.1) — a hub-web action.
@@ -0,0 +1,102 @@
1
+ {
2
+ "name": "让电脑每天自动备份一个文件夹,并确认能恢复",
3
+ "description": "用系统自带的复制命令加一个定时任务,把「文档」文件夹每天镜像到移动硬盘,并亲手验证一次能恢复。",
4
+ "content": "文中的盘符、路径和 `<你的电脑名>` 都换成你自己的。",
5
+ "notice": "这是镜像备份:源文件夹里删掉的文件,备份里也会被删。所以备份文件夹里不要手动放东西。",
6
+ "op": "seq",
7
+ "children": [
8
+ {
9
+ "name": "在硬盘上建一个只放备份的文件夹",
10
+ "description": "备份单独放,不会被别的文件混进来。",
11
+ "content": "在移动硬盘上新建 `Backup` 文件夹,里面再建一个以你电脑命名的子文件夹:\n\n```text\nE:\\Backup\\<你的电脑名>\\\n```",
12
+ "inputs": [
13
+ { "name": "移动硬盘", "spec": "插上后位置固定;下文 Windows 以 E: 为例,macOS / Linux 以 /Volumes/Backup 为例" }
14
+ ],
15
+ "outputs": [
16
+ { "name": "备份目标文件夹", "spec": "硬盘上存在 Backup/<你的电脑名> 文件夹" }
17
+ ]
18
+ },
19
+ {
20
+ "name": "先空跑一遍,看它要复制什么",
21
+ "description": "不写任何文件,只列出将要发生的改动。",
22
+ "content": "Windows 打开「命令提示符」,macOS / Linux 打开「终端」。粘贴对应的一条,把 `<你的电脑名>` 换成第 1 步的名字:\n\nWindows:\n\n```bat\nrobocopy \"%USERPROFILE%\\Documents\" \"E:\\Backup\\<你的电脑名>\\Documents\" /MIR /L\n```\n\nmacOS / Linux:\n\n```bash\nrsync -avn --delete ~/Documents/ /Volumes/Backup/<你的电脑名>/Documents/\n```",
23
+ "inputs": [
24
+ { "name": "备份目标文件夹", "from": "@在硬盘上建一个只放备份的文件夹" },
25
+ { "name": "要备份的文件夹", "spec": "下文以「文档」为例" }
26
+ ],
27
+ "outputs": [
28
+ { "name": "空跑输出", "spec": "列出的文件数与「文档」文件夹里的文件数一致" }
29
+ ]
30
+ },
31
+ {
32
+ "name": "正式运行一次备份",
33
+ "description": "去掉空跑参数再执行,这次才真正写入。",
34
+ "content": "把命令末尾的 `/L`(Windows)或 `-n`(macOS / Linux)去掉,其余不变,再执行一次。第一次会复制全部文件,之后每天只复制有变动的。",
35
+ "inputs": [
36
+ { "name": "空跑输出", "from": "@先空跑一遍,看它要复制什么" }
37
+ ],
38
+ "outputs": [
39
+ { "name": "第一份完整备份", "spec": "备份文件夹里的文件数与源文件夹一致" },
40
+ { "name": "备份命令", "spec": "去掉空跑参数的那一条" }
41
+ ]
42
+ },
43
+ {
44
+ "name": "设成每天自动运行",
45
+ "description": "按系统选一种。",
46
+ "op": "choice",
47
+ "children": [
48
+ {
49
+ "name": "Windows:用任务计划程序",
50
+ "description": "系统自带,不用装软件。",
51
+ "op": "seq",
52
+ "children": [
53
+ {
54
+ "name": "新建每天固定时间运行的任务",
55
+ "description": "让它每天自动执行第 3 步的命令。",
56
+ "content": "在「开始」菜单搜索「任务计划程序」,点右侧的「创建基本任务」:\n\n1. 名称填 `每日备份文档`,触发器选「每天」,时间设在电脑常开着的时段\n2. 操作选「启动程序」,程序填 `robocopy`,参数填第 3 步的命令去掉开头的 `robocopy`\n\n回到列表右键它点「运行」,再看备份文件夹里文件的修改时间。",
57
+ "notice": "笔记本建好任务后,要到任务的「条件」页取消「只有在计算机使用交流电源时才启动此任务」,否则用电池时不备份。",
58
+ "inputs": [
59
+ { "name": "备份命令", "from": "@正式运行一次备份" }
60
+ ],
61
+ "outputs": [
62
+ { "name": "每日备份任务", "spec": "手动点「运行」后,备份文件夹里有文件被更新" }
63
+ ]
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ "name": "macOS / Linux:用 cron",
69
+ "description": "一行定时配置。",
70
+ "op": "seq",
71
+ "children": [
72
+ {
73
+ "name": "加一条每天固定时间执行的 cron",
74
+ "description": "cron 会按时执行第 3 步的命令。",
75
+ "content": "在终端执行 `crontab -e`,在末尾加一行,把时间换成你电脑通常开着的时刻:\n\n```cron\n0 20 * * * rsync -a --delete ~/Documents/ /Volumes/Backup/<你的电脑名>/Documents/\n```\n\n过了设定的时间,去看备份文件夹里的文件修改时间。",
76
+ "inputs": [
77
+ { "name": "备份命令", "from": "@正式运行一次备份" }
78
+ ],
79
+ "outputs": [
80
+ { "name": "每日备份任务", "spec": "过了设定时间后,备份文件夹里有文件被更新" }
81
+ ]
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "name": "做一次恢复演练",
89
+ "description": "没验证过能恢复的备份,等于没有备份。",
90
+ "content": "1. 在电脑上的「文档」里新建一个 `恢复测试.txt`\n2. 手动运行一次备份,或等定时任务跑过\n3. 删掉电脑上的 `恢复测试.txt`\n4. 从备份文件夹把它复制回「文档」,打开确认内容完好",
91
+ "notice": "最后把备份文件夹里的这个测试文件也删掉,让两边保持一致。",
92
+ "inputs": [
93
+ { "name": "第一份完整备份", "from": "@正式运行一次备份" },
94
+ { "name": "每日备份任务", "from": "@新建每天固定时间运行的任务" },
95
+ { "name": "每日备份任务", "from": "@加一条每天固定时间执行的 cron" }
96
+ ],
97
+ "outputs": [
98
+ { "name": "验证过能恢复的备份", "spec": "从备份复制回来的文件能正常打开" }
99
+ ]
100
+ }
101
+ ]
102
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "零基础跑完人生第一个 5 公里",
3
+ "description": "每周 3 次、每次 40 分钟,8 周从「跑 1 分钟走 1 分半」到不停歇跑完 5 公里。",
4
+ "content": "这是一个 8 周的计划,两次跑步之间隔一天。",
5
+ "notice": "膝盖或心脏有旧疾,先问医生再开始。",
6
+ "op": "seq",
7
+ "children": [
8
+ {
9
+ "name": "先快走 30 分钟做基线测试",
10
+ "description": "确认身体承受得住,再开始跑。",
11
+ "content": "找一段平路,用最快的速度走 30 分钟,中途不要停。\n\n走完只是微喘、第二天腿不酸,就从第 1 周开始;中途要停,或第二天酸痛明显,就先按这个节奏走两周再开始。",
12
+ "inputs": [
13
+ { "name": "跑鞋", "spec": "缓震型即可" },
14
+ { "name": "计时用的手表或手机" }
15
+ ],
16
+ "outputs": [
17
+ { "name": "基线结果", "spec": "不停走完 30 分钟,第二天无明显酸痛" }
18
+ ]
19
+ },
20
+ {
21
+ "name": "按周训练",
22
+ "description": "每周同样的节奏:3 次跑步、2 次力量,周末评估。",
23
+ "op": "loop",
24
+ "loop": { "mode": "count", "count": 8 },
25
+ "children": [
26
+ {
27
+ "name": "本周的训练",
28
+ "description": "三次跑步、两次力量,先后顺序随意。",
29
+ "op": "par",
30
+ "children": [
31
+ {
32
+ "name": "完成本周的 3 次跑步",
33
+ "description": "跑步是主线,课表逐周加量,不要跳周。",
34
+ "content": "每次都用 5 分钟快走热身、5 分钟快走收尾,中间按下表做(单位:分钟):\n\n| 周 | 跑 / 走交替 | 重复 |\n|---|---|---|\n| 1 | 跑 1 / 走 1.5 | 8 次 |\n| 2 | 跑 2 / 走 1 | 6 次 |\n| 3 | 跑 3 / 走 1 | 5 次 |\n| 4 | 跑 5 / 走 2 | 4 次 |\n| 5 | 跑 8 / 走 1 | 3 次 |\n| 6 | 跑 12 / 走 1 | 2 次 |\n| 7 | 跑 20 / 走 3 / 跑 10 | 1 次 |\n| 8 | 跑 30 不停 | 1 次 |\n\n跑步的速度以「能边跑边说出完整的句子」为准。",
35
+ "inputs": [
36
+ { "name": "跑鞋", "spec": "缓震型即可" },
37
+ { "name": "计时用的手表或手机" },
38
+ { "name": "基线结果", "from": "@先快走 30 分钟做基线测试" }
39
+ ],
40
+ "outputs": [
41
+ { "name": "本周 3 次跑步", "spec": "三次都按当周课表完成" }
42
+ ]
43
+ },
44
+ {
45
+ "name": "做 2 次力量训练",
46
+ "description": "练腿和核心,跑量上来时膝盖才不疼。",
47
+ "content": "安排在不跑步的两天,每次 15 分钟,徒手即可:\n\n1. 靠墙静蹲 3 组 × 30 秒\n2. 臀桥 3 组 × 12 次\n3. 侧平板支撑 3 组 × 20 秒(两侧)\n4. 单腿站立 3 组 × 30 秒(两侧)",
48
+ "notice": "前两周做不到规定次数就减半,动作要慢。",
49
+ "inputs": [
50
+ { "name": "瑜伽垫", "spec": "可选" }
51
+ ],
52
+ "outputs": [
53
+ { "name": "2 次力量训练", "spec": "每个动作 3 组" }
54
+ ]
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "name": "周末评估,决定下周进还是留",
60
+ "description": "没跑完就重复本周,比硬撑更安全。",
61
+ "content": "周日回看这一周的记录,按结果定下周:\n\n- 三次跑步都完成、没有持续疼痛 → 下周进入下一档\n- 有一次没完成,或膝盖、小腿疼了 3 天以上 → 下周重复本周课表,力量训练照做",
62
+ "notice": "连续两周都要重复,就把跑步速度再放慢一点。",
63
+ "inputs": [
64
+ { "name": "本周 3 次跑步", "from": "@完成本周的 3 次跑步" },
65
+ { "name": "2 次力量训练", "from": "@做 2 次力量训练" }
66
+ ],
67
+ "outputs": [
68
+ { "name": "下周计划", "spec": "明确写下:进入下一周,或重复本周" }
69
+ ]
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "name": "第 8 周末跑一次 5 公里",
75
+ "description": "不停歇跑完,就算毕业。",
76
+ "content": "选一条 5 公里的平路,早晨或傍晚凉快时出发。前 2 公里刻意比平时慢,最后 1 公里再提速。跑完走 5 分钟,做几次拉伸。",
77
+ "notice": "没跑完也没关系,重复第 8 周再试一次——重复一周很常见。",
78
+ "inputs": [
79
+ { "name": "跑鞋", "spec": "缓震型即可" },
80
+ { "name": "计时用的手表或手机" },
81
+ { "name": "下周计划", "from": "@周末评估,决定下周进还是留" }
82
+ ],
83
+ "outputs": [
84
+ { "name": "第一个 5 公里", "spec": "不停歇跑完 5 公里" }
85
+ ]
86
+ }
87
+ ]
88
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "发工资后 30 分钟,把当月的钱分好",
3
+ "description": "工资到账当天,按「先留后花」把钱分进几个账户,月底不再不知道钱花哪了。",
4
+ "content": "下文以到手 10000 元为例。",
5
+ "op": "seq",
6
+ "children": [
7
+ {
8
+ "name": "算出三个数:固定、储蓄、生活费",
9
+ "description": "先减掉不能动的钱,剩下的才是能花的。",
10
+ "content": "打开计算器,按到手工资依次算:\n\n1. **固定支出**:上月账单合计,加上每季、每年才交的费用除以 12(例:3500)\n2. **储蓄**:工资的 10%–20%,先从 10% 开始(例:1500)\n3. **生活费**:工资 − 固定 − 储蓄(例:5000)",
11
+ "inputs": [
12
+ { "name": "到手工资金额" },
13
+ { "name": "上个月的账单清单", "spec": "房租、水电、订阅等固定支出" }
14
+ ],
15
+ "outputs": [
16
+ { "name": "三个金额", "spec": "固定 + 储蓄 + 生活费 = 到手工资" }
17
+ ]
18
+ },
19
+ {
20
+ "name": "把储蓄转走",
21
+ "description": "先付给未来的自己,剩下的才是能花的。",
22
+ "content": "把储蓄金额从工资卡转到储蓄账户。",
23
+ "notice": "这一步放在最前面——等到月底再存,通常就存不下了。",
24
+ "inputs": [
25
+ { "name": "三个金额", "from": "@算出三个数:固定、储蓄、生活费" },
26
+ { "name": "储蓄账户", "spec": "取用麻烦的:没绑支付软件,或提现第二天才到账" }
27
+ ],
28
+ "outputs": [
29
+ { "name": "已转出的储蓄", "spec": "储蓄账户余额增加指定金额" }
30
+ ]
31
+ },
32
+ {
33
+ "name": "把固定支出放进账单账户",
34
+ "description": "账单和日常生活费分开,房租永远不会被吃掉。",
35
+ "content": "把固定支出的金额转到专门付账单的账户,水电、订阅、房租都绑在这张卡上,设成自动扣款。",
36
+ "inputs": [
37
+ { "name": "三个金额", "from": "@算出三个数:固定、储蓄、生活费" },
38
+ { "name": "账单账户" }
39
+ ],
40
+ "outputs": [
41
+ { "name": "备好的账款项", "spec": "固定支出金额到位,所有自动扣款都绑这张卡" }
42
+ ]
43
+ },
44
+ {
45
+ "name": "把生活费分成日常和弹性",
46
+ "description": "一笔管必须花的,一笔管想花的,超支不互相拖累。",
47
+ "content": "生活费按 7 : 3 拆开:\n\n- **日常**(70%):吃饭、交通、日用,转进日常账户\n- **弹性**(30%):聚餐、购物、娱乐,转进弹性账户",
48
+ "notice": "弹性账户花完就停,下个月再买。日常账户不要动。",
49
+ "inputs": [
50
+ { "name": "三个金额", "from": "@算出三个数:固定、储蓄、生活费" },
51
+ { "name": "日常账户" },
52
+ { "name": "弹性账户" }
53
+ ],
54
+ "outputs": [
55
+ { "name": "分好的生活费", "spec": "日常与弹性金额为 7 : 3" }
56
+ ]
57
+ },
58
+ {
59
+ "name": "在日历上记下下次发薪日",
60
+ "description": "让下个月自动发生。",
61
+ "content": "在手机日历建一个每月重复的提醒,时间设在发薪日晚上,备注里写上这次的三个金额。下个月照着做,10 分钟就够了。",
62
+ "inputs": [
63
+ { "name": "三个金额", "from": "@算出三个数:固定、储蓄、生活费" },
64
+ { "name": "手机日历" }
65
+ ],
66
+ "outputs": [
67
+ { "name": "每月提醒", "spec": "日历里有一条发薪日的重复提醒" }
68
+ ]
69
+ }
70
+ ]
71
+ }