ShtukbaseStandard
страница пакета→ /base/icons.md

pages/base/icons.md

90 строк, 4.8 КБ. Как страница.

Этот текст ещё не переведён. Ниже английский оригинал.

  1. ---
  2. type: Page
  3. title: "Page icons"
  4. icon: "🖼️"
  5. description: "What a page icon is, which pages get which kind (tiers), where the files lie, how an agent makes one and how lenses show it."
  6. ---
  7. A page shows a small icon next to its title. In Notion it is an emoji. Here it can also be an SVG that an agent draws for the page. Drawings are not free: they cost tokens, review and bytes in git. So a project decides up front which pages deserve one. That decision is the **tier**.
  8. ## The fields
  9. | Field | Where | What |
  10. |---|---|---|
  11. | `icon` | any page | one emoji (`"🥕"`) or a path to an SVG (`/assets/icons/carrot.svg`) |
  12. | `art` | any page | a large picture for cards, a path to an SVG |
  13. | `icons` | a collection page | `{tier, item, required, max}`: how its records get icons |
  14. A path starts at the project root (`/assets/icons/x.svg`); a path without the slash is read from the page's folder.
  15. ## Tiers
  16. | Tier | The record shows | The record may set | For |
  17. |---|---|---|---|
  18. | `none` | nothing | nothing | logs, runs, generated pages |
  19. | `kind` | the collection's `icons.item` | nothing | many uniform records: tasks, bugs, service pages |
  20. | `pick` | its own emoji or set icon, else the kind icon | an emoji, or `icon: /assets/icons/set/<name>.svg` | ordinary pages |
  21. | `bespoke` | its own drawing, else as above | an SVG drawn for it, and `art` | few important pages: the map, packages, principles |
  22. Where the tier comes from, first match wins:
  23. 1. The page is listed in `heroes` of [/design/icons.md](/design/icons.md) — `bespoke`.
  24. 2. The page is a collection page — `collectionTier` (`bespoke`).
  25. 3. The page is a record of a collection — `icons.tier` of the collection page, or `defaultTier` (`pick`) if it has none.
  26. 4. Any other page — `looseTier` (`pick`).
  27. A collection allows `bespoke` for at most `icons.max` distinct files (default `max` in the settings, 100). Reusing one file on several pages counts once. Raising the budget is the owner's decision.
  28. ```yaml
  29. # /plants.md
  30. type: Collection
  31. itemType: Plant
  32. icons: {tier: bespoke, max: 40, required: true, item: "🌱"}
  33. ```
  34. ## Files
  35. - Every SVG lies in `/assets/icons/`: one file per drawing, named after the page (`plants/dill.md` → `dill.svg`); on a clash, the collection first (`plants-dill.svg`).
  36. - Kind icons: `/assets/icons/kinds/<itemType>.svg`. The shared set: `/assets/icons/set/<name>.svg`, uniform icons any `pick` page may use; a set from elsewhere keeps its licence file next to it.
  37. - Never inline SVG in front matter: it bloats every diff, cannot be shared and breaks short header reads.
  38. ## The SVG contract
  39. Square `viewBox` (`0 0 96 96` is usual), `xmlns`, at most 4096 bytes, drawing elements only (`path`, `rect`, `circle`, `ellipse`, `line`, `polyline`, `polygon`, `g`, `defs`, gradients, `clipPath`, `mask`, `use`, `symbol`, `title`, `desc`). No script, event attributes, links out of the file, text, `<style>`, `<image>` or `currentColor`; colours as hex. It reads at 16 px and works on light and dark. The first comment records where it came from: `<!-- icon: page=/plants/dill.md; by=<model>; date=2026-11-28; licence=CC0-1.0 -->`.
  40. ## The style
  41. A style package supplies a page `type: IconStyle` under `/design/`:
  42. ```yaml
  43. type: IconStyle
  44. title: "Kit pictures"
  45. viewBox: "0 0 96 96"
  46. gradients: false
  47. palette: {red: "#FF7369", yellow: "#FFDC49", green: "#4DAB9A", blue: "#529CCA", white: "#FFFFFF"}
  48. rules: ["Flat, no background tile, no outline.", "2–4 colours of the palette."]
  49. examples: [/assets/icons/carrot.svg]
  50. ```
  51. With it, the prompt quotes the style and the check holds the palette. Without it, the contract alone holds.
  52. ## For agents: when and how
  53. 1. Making a page? Run `shtuk run icons prompt <page.md>`. It says the tier and what to do.
  54. 2. `none` or `kind`: add nothing.
  55. 3. `pick`: write one emoji, or a set icon.
  56. 4. `bespoke`: draw by the printed prompt, write the file, set `icon:` (or `art:` with `--art`), run `shtuk run icons validate <file>`.
  57. 5. A new collection: decide its tier and write `icons:` in its page. A kind icon: `shtuk run icons prompt <collection>.md --kind`.
  58. 6. An SVG from elsewhere: `shtuk run icons sanitize <file> --write`, then validate.
  59. ## How lenses show it
  60. Emoji as text, SVG through `<img>` (no script can run), as decoration next to the title. The chain: the record's own `icon` → the collection's `icons.item` → the collection page's `icon` → 📄; with tier `none` nothing. A card with the option `art` shows the large picture instead.
  61. ## Enforcers of the norms
  62. | Norm | What it means | Enforcer (check) |
  63. |---|---|---|
  64. | [ICN-R01](/norms/rules/icons/ICN-R01.md) | An icon a page refers to exists and is a valid, safe SVG | `valid` |
  65. | [ICN-R02](/norms/rules/icons/ICN-R02.md) | A page carries only what its tier allows; bespoke files stay in the budget | `budget` |
  66. | [ICN-R03](/norms/rules/icons/ICN-R03.md) | A collection that requires icons has one on every record | `required` |