secondbrain-py 0.2.1__py3-none-any.whl

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.
Files changed (273) hide show
  1. brain/__init__.py +0 -0
  2. brain/__main__.py +18 -0
  3. brain/_capture_command.py +445 -0
  4. brain/_compose.py +52 -0
  5. brain/activity.py +206 -0
  6. brain/ask.py +631 -0
  7. brain/audio.py +591 -0
  8. brain/backfill/__init__.py +12 -0
  9. brain/backfill/search_extras.py +141 -0
  10. brain/backfill/source_rows.py +101 -0
  11. brain/bin/__init__.py +1 -0
  12. brain/bin/_launcher.py +107 -0
  13. brain/bin/down.py +8 -0
  14. brain/bin/launchd.py +268 -0
  15. brain/bin/monitor.py +570 -0
  16. brain/bin/rebuild.py +8 -0
  17. brain/bin/status.py +8 -0
  18. brain/bin/up.py +8 -0
  19. brain/brief.py +272 -0
  20. brain/capture.py +49 -0
  21. brain/chat.py +293 -0
  22. brain/cli.py +9760 -0
  23. brain/cli_claude.py +81 -0
  24. brain/cli_connect.py +285 -0
  25. brain/cli_demo.py +266 -0
  26. brain/config.py +1949 -0
  27. brain/connect.py +925 -0
  28. brain/db.py +540 -0
  29. brain/demo/__init__.py +452 -0
  30. brain/demo/corpus/manifest.json +403 -0
  31. brain/demo/embedder.py +74 -0
  32. brain/durations.py +84 -0
  33. brain/edit_session.py +156 -0
  34. brain/editor.py +67 -0
  35. brain/elicit/__init__.py +16 -0
  36. brain/elicit/detectors.py +250 -0
  37. brain/elicit/drafter.py +70 -0
  38. brain/elicit/queue.py +220 -0
  39. brain/elicit/schema.py +48 -0
  40. brain/elicit/session.py +445 -0
  41. brain/embedding_targets.py +54 -0
  42. brain/embeddings.py +424 -0
  43. brain/enrichment.py +808 -0
  44. brain/errors.py +357 -0
  45. brain/eval/__init__.py +129 -0
  46. brain/eval/answer_eval.py +281 -0
  47. brain/eval/baseline.py +265 -0
  48. brain/eval/concept_extraction.py +378 -0
  49. brain/eval/corpus.py +152 -0
  50. brain/eval/errors.py +19 -0
  51. brain/eval/graph_baseline.py +226 -0
  52. brain/eval/graph_retrieval.py +202 -0
  53. brain/eval/graph_runner.py +319 -0
  54. brain/eval/metrics.py +101 -0
  55. brain/eval/runner.py +223 -0
  56. brain/format.py +783 -0
  57. brain/gaps.py +390 -0
  58. brain/graph_rag/__init__.py +94 -0
  59. brain/graph_rag/_retrieval_common.py +113 -0
  60. brain/graph_rag/aggregates.py +303 -0
  61. brain/graph_rag/aliases/__init__.py +583 -0
  62. brain/graph_rag/backends/__init__.py +10 -0
  63. brain/graph_rag/backends/_age_helpers.py +473 -0
  64. brain/graph_rag/backends/age.py +782 -0
  65. brain/graph_rag/backends/base.py +272 -0
  66. brain/graph_rag/build.py +344 -0
  67. brain/graph_rag/communities.py +644 -0
  68. brain/graph_rag/communities_summary.py +437 -0
  69. brain/graph_rag/concepts.py +202 -0
  70. brain/graph_rag/cooccur.py +193 -0
  71. brain/graph_rag/cross_type.py +312 -0
  72. brain/graph_rag/extract.py +885 -0
  73. brain/graph_rag/fuse.py +371 -0
  74. brain/graph_rag/global_.py +412 -0
  75. brain/graph_rag/grouping.py +372 -0
  76. brain/graph_rag/person_resolver.py +167 -0
  77. brain/graph_rag/reconcile.py +792 -0
  78. brain/graph_rag/relational.py +353 -0
  79. brain/graph_rag/retrieve.py +526 -0
  80. brain/graph_rag/router.py +288 -0
  81. brain/graph_rag/schema.py +320 -0
  82. brain/graph_rag/sync.py +237 -0
  83. brain/graph_rag/tenancy.py +43 -0
  84. brain/graph_rag/themes.py +501 -0
  85. brain/graph_rag/weighting.py +202 -0
  86. brain/ingest/__init__.py +1926 -0
  87. brain/ingest/chunker.py +249 -0
  88. brain/ingest/docx.py +40 -0
  89. brain/ingest/gmail.py +621 -0
  90. brain/ingest/markdown.py +37 -0
  91. brain/ingest/pdf.py +61 -0
  92. brain/ingest/stdin.py +22 -0
  93. brain/ingest/sub_tokens.py +91 -0
  94. brain/ingest/text.py +16 -0
  95. brain/interactions.py +205 -0
  96. brain/maintenance.py +355 -0
  97. brain/mcp_server.py +3405 -0
  98. brain/migrations/001_init.sql +43 -0
  99. brain/migrations/002_qwen3_embedding.sql +17 -0
  100. brain/migrations/003_vault_model.sql +41 -0
  101. brain/migrations/004_relax_content_hash_uniqueness.sql +18 -0
  102. brain/migrations/005_derived_links.sql +67 -0
  103. brain/migrations/006_dedup_file_by_source_path.sql +25 -0
  104. brain/migrations/007_email_thread_and_draft.sql +15 -0
  105. brain/migrations/008_gmail_thread_unique.sql +11 -0
  106. brain/migrations/009_chunks_weighted_tsv.sql +28 -0
  107. brain/migrations/010_interactions.sql +30 -0
  108. brain/migrations/011_documents_summary.sql +23 -0
  109. brain/migrations/012_graphrag.sql +171 -0
  110. brain/migrations/013_graphrag_communities.sql +125 -0
  111. brain/migrations/014_graphrag_community_summary_hash.sql +33 -0
  112. brain/migrations/015_interactions_graph_targets.sql +89 -0
  113. brain/migrations/016_index_hygiene.sql +61 -0
  114. brain/migrations/017_elicit.sql +30 -0
  115. brain/migrations/018_review_gap_signal_kinds.sql +40 -0
  116. brain/migrations/019_search_queries.sql +35 -0
  117. brain/migrations/020_link_suggestions.sql +40 -0
  118. brain/migrations/021_timeline_doc_date.sql +34 -0
  119. brain/migrations/022_link_suggestions_undirected.sql +84 -0
  120. brain/migrations/023_search_queries_fts_count.sql +28 -0
  121. brain/quartz_overrides/__init__.py +8 -0
  122. brain/quartz_overrides/quartz/bootstrap-cli.mjs +65 -0
  123. brain/quartz_overrides/quartz/build.ts +568 -0
  124. brain/quartz_overrides/quartz/cli/args.js +152 -0
  125. brain/quartz_overrides/quartz/cli/build_partial_handler.js +544 -0
  126. brain/quartz_overrides/quartz/cli/handlers.js +636 -0
  127. brain/quartz_overrides/quartz/components/CommandPalette.tsx +172 -0
  128. brain/quartz_overrides/quartz/components/Explorer.tsx +198 -0
  129. brain/quartz_overrides/quartz/components/Footer.tsx +27 -0
  130. brain/quartz_overrides/quartz/components/Graph.tsx +468 -0
  131. brain/quartz_overrides/quartz/components/PageTitle.tsx +72 -0
  132. brain/quartz_overrides/quartz/components/RelatedDocs.tsx +38 -0
  133. brain/quartz_overrides/quartz/components/Search.tsx +161 -0
  134. brain/quartz_overrides/quartz/components/SummaryLede.tsx +72 -0
  135. brain/quartz_overrides/quartz/components/index.ts +92 -0
  136. brain/quartz_overrides/quartz/components/pages/TagContent.tsx +272 -0
  137. brain/quartz_overrides/quartz/components/scripts/commandPalette.inline.ts +665 -0
  138. brain/quartz_overrides/quartz/components/scripts/explorer.inline.ts +768 -0
  139. brain/quartz_overrides/quartz/components/scripts/graph.inline.ts +2302 -0
  140. brain/quartz_overrides/quartz/components/scripts/relatedDocs.inline.ts +163 -0
  141. brain/quartz_overrides/quartz/components/scripts/search.inline.ts +1011 -0
  142. brain/quartz_overrides/quartz/plugins/emitters/contentIndex.ts +546 -0
  143. brain/quartz_overrides/quartz/plugins/transformers/codeCopy.ts +94 -0
  144. brain/quartz_overrides/quartz/plugins/transformers/derivedFenceMark.ts +302 -0
  145. brain/quartz_overrides/quartz/plugins/transformers/emailThread.ts +148 -0
  146. brain/quartz_overrides/quartz/plugins/transformers/emptyDoorFilter.ts +213 -0
  147. brain/quartz_overrides/quartz/plugins/transformers/index.ts +114 -0
  148. brain/quartz_overrides/quartz/plugins/transformers/linkKindMark.ts +205 -0
  149. brain/quartz_overrides/quartz/plugins/transformers/linkSourceTag.ts +104 -0
  150. brain/quartz_overrides/quartz/plugins/transformers/relativeDate.ts +100 -0
  151. brain/quartz_overrides/quartz/plugins/transformers/reloadSignal.ts +131 -0
  152. brain/quartz_overrides/quartz/processors/parse.ts +371 -0
  153. brain/quartz_overrides/quartz/processors/parser_cache.ts +78 -0
  154. brain/quartz_overrides/quartz/static/brain-logo-dark.png +0 -0
  155. brain/quartz_overrides/quartz/static/brain-logo-light.png +0 -0
  156. brain/quartz_overrides/quartz/static/codeCopy.js +196 -0
  157. brain/quartz_overrides/quartz/static/emailThread.js +334 -0
  158. brain/quartz_overrides/quartz/static/favicon.ico +0 -0
  159. brain/quartz_overrides/quartz/static/icon.png +0 -0
  160. brain/quartz_overrides/quartz/static/linkSourceTag.js +104 -0
  161. brain/quartz_overrides/quartz/static/relativeDate.js +142 -0
  162. brain/quartz_overrides/quartz/static/reload.js +168 -0
  163. brain/quartz_overrides/quartz/styles/brain/_article.scss +252 -0
  164. brain/quartz_overrides/quartz/styles/brain/_atmosphere.scss +113 -0
  165. brain/quartz_overrides/quartz/styles/brain/_callouts.scss +180 -0
  166. brain/quartz_overrides/quartz/styles/brain/_cmdk.scss +7 -0
  167. brain/quartz_overrides/quartz/styles/brain/_code.scss +208 -0
  168. brain/quartz_overrides/quartz/styles/brain/_command_palette.scss +369 -0
  169. brain/quartz_overrides/quartz/styles/brain/_email_thread.scss +228 -0
  170. brain/quartz_overrides/quartz/styles/brain/_explorer.scss +142 -0
  171. brain/quartz_overrides/quartz/styles/brain/_home.scss +182 -0
  172. brain/quartz_overrides/quartz/styles/brain/_links.scss +322 -0
  173. brain/quartz_overrides/quartz/styles/brain/_marginalia.scss +117 -0
  174. brain/quartz_overrides/quartz/styles/brain/_motion.scss +175 -0
  175. brain/quartz_overrides/quartz/styles/brain/_people_hub.scss +100 -0
  176. brain/quartz_overrides/quartz/styles/brain/_related_docs.scss +137 -0
  177. brain/quartz_overrides/quartz/styles/brain/_search.scss +252 -0
  178. brain/quartz_overrides/quartz/styles/brain/_sidebar.scss +468 -0
  179. brain/quartz_overrides/quartz/styles/brain/_summary_lede.scss +56 -0
  180. brain/quartz_overrides/quartz/styles/brain/_surface.scss +43 -0
  181. brain/quartz_overrides/quartz/styles/brain/_tag_content.scss +118 -0
  182. brain/quartz_overrides/quartz/styles/brain/_tokens.scss +197 -0
  183. brain/quartz_overrides/quartz/styles/brain/_typography.scss +92 -0
  184. brain/quartz_overrides/quartz/styles/custom.scss +89 -0
  185. brain/quartz_overrides/quartz/styles/graph.scss +505 -0
  186. brain/quartz_overrides/quartz/util/ctx.ts +92 -0
  187. brain/quartz_overrides/quartz/util/fastpath_manifest.ts +608 -0
  188. brain/quartz_overrides/quartz/util/path.ts +358 -0
  189. brain/quartz_overrides/quartz/util/sourceIcons.ts +55 -0
  190. brain/quartz_overrides/quartz.config.ts +270 -0
  191. brain/quartz_overrides/quartz.layout.ts +314 -0
  192. brain/queries.py +1188 -0
  193. brain/rank_fusion.py +8 -0
  194. brain/resurface.py +210 -0
  195. brain/review/__init__.py +26 -0
  196. brain/review/emit.py +27 -0
  197. brain/review/queries.py +436 -0
  198. brain/review/render.py +196 -0
  199. brain/review/scans.py +355 -0
  200. brain/review/weekly.py +413 -0
  201. brain/search.py +704 -0
  202. brain/set_similarity.py +15 -0
  203. brain/setup.py +1205 -0
  204. brain/tags.py +56 -0
  205. brain/templates/Caddyfile.j2 +9 -0
  206. brain/templates/__init__.py +1 -0
  207. brain/templates/bin/__init__.py +1 -0
  208. brain/templates/bin/_brain-brief-fg.sh +25 -0
  209. brain/templates/bin/_brain-build-fg.sh +53 -0
  210. brain/templates/bin/_brain-watcher-fg.sh +65 -0
  211. brain/templates/bin/brain-down.sh +89 -0
  212. brain/templates/bin/brain-status.sh +83 -0
  213. brain/templates/bin/brain-up.sh +221 -0
  214. brain/templates/docker/age/Dockerfile +79 -0
  215. brain/templates/docker-compose.stock.yml.j2 +26 -0
  216. brain/templates/docker-compose.yml.j2 +34 -0
  217. brain/templates/env.example +190 -0
  218. brain/templates/launchd/__init__.py +1 -0
  219. brain/templates/launchd/com.brain.brief.plist.j2 +45 -0
  220. brain/templates/launchd/com.brain.build.plist.j2 +46 -0
  221. brain/templates/launchd/com.brain.watcher.plist.j2 +46 -0
  222. brain/templates/skill/SKILL.md +63 -0
  223. brain/templates/skill/__init__.py +1 -0
  224. brain/timeline.py +834 -0
  225. brain/todo.py +124 -0
  226. brain/uninstall.py +185 -0
  227. brain/vault/__init__.py +115 -0
  228. brain/vault/_atomic.py +25 -0
  229. brain/vault/daily_index.py +228 -0
  230. brain/vault/derived_links/__init__.py +50 -0
  231. brain/vault/derived_links/directory.py +683 -0
  232. brain/vault/derived_links/fence.py +408 -0
  233. brain/vault/derived_links/gws.py +64 -0
  234. brain/vault/derived_links/participants.py +143 -0
  235. brain/vault/derived_links/pass_runner.py +362 -0
  236. brain/vault/derived_links/rules.py +137 -0
  237. brain/vault/export.py +683 -0
  238. brain/vault/frontmatter.py +165 -0
  239. brain/vault/graph.py +620 -0
  240. brain/vault/graph_format.py +388 -0
  241. brain/vault/link_rewrite.py +235 -0
  242. brain/vault/links.py +260 -0
  243. brain/vault/note_builder.py +211 -0
  244. brain/vault/paths.py +55 -0
  245. brain/vault/quartz_overlay.py +236 -0
  246. brain/vault/rename.py +591 -0
  247. brain/vault/resolver.py +304 -0
  248. brain/vault/slug.py +127 -0
  249. brain/vault/sync.py +1513 -0
  250. brain/vault/sync_summaries.py +264 -0
  251. brain/vault/templates.py +145 -0
  252. brain/vault/watch.py +1052 -0
  253. brain/wiki/__init__.py +6 -0
  254. brain/wiki/_github_slugger.py +76 -0
  255. brain/wiki/_person_name.py +314 -0
  256. brain/wiki/build_homepage.py +541 -0
  257. brain/wiki/build_partial.py +273 -0
  258. brain/wiki/build_people.py +934 -0
  259. brain/wiki/build_related.py +758 -0
  260. brain/wiki/build_swap.py +585 -0
  261. brain/wiki/build_watcher.py +975 -0
  262. brain/wiki/edit_classifier.py +215 -0
  263. brain/wiki/errors.py +10 -0
  264. brain/wiki/fastpath_manifest.py +475 -0
  265. brain/wiki/fastpath_state.py +174 -0
  266. brain/wiki/install.py +296 -0
  267. brain/wiki/slug.py +111 -0
  268. secondbrain_py-0.2.1.dist-info/METADATA +195 -0
  269. secondbrain_py-0.2.1.dist-info/RECORD +273 -0
  270. secondbrain_py-0.2.1.dist-info/WHEEL +5 -0
  271. secondbrain_py-0.2.1.dist-info/entry_points.txt +11 -0
  272. secondbrain_py-0.2.1.dist-info/licenses/LICENSE +21 -0
  273. secondbrain_py-0.2.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,180 @@
1
+ // Brain callouts — Lane C of the 2026 commonplace-book redesign.
2
+ //
3
+ // This file is installed at
4
+ // `<vault>/.quartz/quartz/styles/brain/_callouts.scss` by `brain vault
5
+ // render --overlay` and pulled into the global SCSS via `custom.scss`'s
6
+ // `@use "./brain/callouts"` line.
7
+ //
8
+ // Stock Quartz callouts (`quartz/styles/callouts.scss`) ship a
9
+ // Material-style palette — saturated blue / cyan / orange / red over
10
+ // white — that clashes hard with the cream-paper redesign. This file
11
+ // repaints every Quartz callout type into the redesign palette, then
12
+ // adds the editorial chrome the plan calls for: tinted background
13
+ // (`color-mix`), a 3px left border in the type color, a small-caps
14
+ // title bar, and a subtle `--shadow-sm` on the container.
15
+ //
16
+ // Callout types touched (the full Quartz set):
17
+ // note, info, abstract, tip, success, question, warning, danger,
18
+ // failure, bug, example, quote.
19
+ //
20
+ // Each gets its own `--callout-{type}` token at the top of `:root` /
21
+ // `:root[saved-theme="dark"]` so the palette is auditable in one
22
+ // place. The per-type rule below resolves `--type-color` from the
23
+ // matching token, then layers the chrome on top.
24
+ //
25
+ // Strategy note — we don't try to fight stock Quartz on icon/glyph
26
+ // markup (the SVG icon URIs in stock `callouts.scss` still apply via
27
+ // `--callout-icon`). We only repaint colors, the title bar, and the
28
+ // container.
29
+ //
30
+ // Tokens consumed (from `_tokens.scss`):
31
+ // * `--surface-1` — base for the `color-mix` tinted bg
32
+ // * `--shadow-sm` — container elevation
33
+ // * `--ink-0` — body text inside callouts
34
+ // * `--accent-soft`/`--accent-strong` — ridden by `note` + `quote`
35
+ // * `--brain-tier-*` — re-used so callouts and the graph share hues
36
+ // * `--callout-note / -info / -abstract / -tip / -success /
37
+ // -question / -warning / -danger / -failure / -bug / -example /
38
+ // -quote` — per-type hue palette (one per Quartz callout type),
39
+ // defined in `_tokens.scss` so cross-file consumers (`_code.scss`'s
40
+ // success-flash, future home/sidebar callouts) don't depend on
41
+ // this partial's load order.
42
+
43
+ // ---------------------------------------------------------------------------
44
+ // Type-color tokens are defined in `_tokens.scss` (light + dark blocks).
45
+ //
46
+ // Single source of truth — devtools-inspecting any callout surfaces the
47
+ // full palette under `:root` alongside the rest of the redesign tokens,
48
+ // and cross-file consumers (`_code.scss`'s success-flash, future
49
+ // home/sidebar callouts) don't depend on this partial's load order.
50
+ // ---------------------------------------------------------------------------
51
+
52
+ // ---------------------------------------------------------------------------
53
+ // Container chrome — applied uniformly via the data-callout attribute
54
+ // ---------------------------------------------------------------------------
55
+ //
56
+ // Stock callouts.scss writes `--color`, `--border`, `--bg` per type.
57
+ // We override those vars to pull from our `--callout-{type}` tokens
58
+ // instead, then add the `--shadow-sm` + `border-left: 3px solid` +
59
+ // tinted bg via `color-mix`.
60
+ //
61
+ // Why mutate stock's `--color`/`--bg` rather than restyle every
62
+ // selector: stock's `.callout-title { color: var(--color) }` (and
63
+ // inner-`<p>` in title, and icon mask color) all read the same vars,
64
+ // so swapping the var values cleanly retints the entire chrome with
65
+ // one block. Less drift surface than re-targeting each child.
66
+
67
+ .callout {
68
+ // brain: redesign chrome — the per-type `--color` set in the rules
69
+ // below picks the hue; this block applies the universal layout.
70
+ border: 0;
71
+ border-left: 3px solid var(--type-color, var(--callout-note));
72
+ border-radius: 6px;
73
+ // brain: tinted background via `color-mix`. 8% per the plan spec —
74
+ // visible enough to read as a tinted region, faint enough not to
75
+ // shout. Falls back to `--surface-1` cleanly when `color-mix` is
76
+ // unsupported (graceful degradation).
77
+ background: color-mix(in srgb, var(--type-color, var(--callout-note)) 8%, var(--surface-1));
78
+ box-shadow: var(--shadow-sm);
79
+ margin: 1.2rem 0;
80
+ padding: 0.4rem 1rem;
81
+ color: var(--ink-0);
82
+
83
+ // Override stock's `--color` so the title bar + icon mask track
84
+ // the redesigned hue. (`--bg` is irrelevant since we paint the
85
+ // background directly above; we still null it for cleanliness.)
86
+ --color: var(--type-color, var(--callout-note));
87
+ --bg: transparent;
88
+ --border: var(--type-color, var(--callout-note));
89
+ }
90
+
91
+ // Title bar — uppercase + tracking, type-color tint, tighter padding
92
+ // than stock so the title sits close to the content rather than
93
+ // floating mid-card.
94
+ //
95
+ // brain (Linear): replaced small-caps with uppercase + tracking.
96
+ // Tech aesthetic doesn't have small caps; uppercase reads cleaner
97
+ // against the indigo-violet accent.
98
+ .callout-title {
99
+ padding: 0.6rem 0;
100
+ text-transform: uppercase;
101
+ letter-spacing: 0.06em;
102
+ font-size: 0.75rem;
103
+ font-weight: 600;
104
+ color: var(--type-color, var(--callout-note));
105
+
106
+ // The inner `<p>` Quartz wraps around the title text inherits the
107
+ // type color via stock's `.callout-title-inner > p { color: var(--color) }`.
108
+ // We re-pin to be explicit and inherit the uppercase treatment.
109
+ > .callout-title-inner > p {
110
+ color: inherit;
111
+ text-transform: inherit;
112
+ letter-spacing: inherit;
113
+ margin: 0;
114
+ }
115
+ }
116
+
117
+ // ---------------------------------------------------------------------------
118
+ // Per-type rules — set --type-color, the chrome above does the rest
119
+ // ---------------------------------------------------------------------------
120
+ //
121
+ // Stock callouts.scss uses the `&[data-callout="x"]` selector pattern
122
+ // inside its top-level `.callout` block. Since this file is loaded
123
+ // AFTER stock's via custom.scss's `@use` order (base → tokens →
124
+ // typography → surface → atmosphere → motion → links → sidebar →
125
+ // article → marginalia → callouts → code → home), we override at
126
+ // equal specificity by using the same `&[data-callout="x"]` shape.
127
+
128
+ .callout {
129
+ &[data-callout="note"] {
130
+ --type-color: var(--callout-note);
131
+ }
132
+ &[data-callout="info"],
133
+ &[data-callout="todo"] {
134
+ --type-color: var(--callout-info);
135
+ }
136
+ &[data-callout="abstract"],
137
+ &[data-callout="summary"],
138
+ &[data-callout="tldr"] {
139
+ --type-color: var(--callout-abstract);
140
+ }
141
+ &[data-callout="tip"],
142
+ &[data-callout="hint"],
143
+ &[data-callout="important"] {
144
+ --type-color: var(--callout-tip);
145
+ }
146
+ &[data-callout="success"],
147
+ &[data-callout="check"],
148
+ &[data-callout="done"] {
149
+ --type-color: var(--callout-success);
150
+ }
151
+ &[data-callout="question"],
152
+ &[data-callout="help"],
153
+ &[data-callout="faq"] {
154
+ --type-color: var(--callout-question);
155
+ }
156
+ &[data-callout="warning"],
157
+ &[data-callout="caution"],
158
+ &[data-callout="attention"] {
159
+ --type-color: var(--callout-warning);
160
+ }
161
+ &[data-callout="danger"],
162
+ &[data-callout="error"] {
163
+ --type-color: var(--callout-danger);
164
+ }
165
+ &[data-callout="failure"],
166
+ &[data-callout="fail"],
167
+ &[data-callout="missing"] {
168
+ --type-color: var(--callout-failure);
169
+ }
170
+ &[data-callout="bug"] {
171
+ --type-color: var(--callout-bug);
172
+ }
173
+ &[data-callout="example"] {
174
+ --type-color: var(--callout-example);
175
+ }
176
+ &[data-callout="quote"],
177
+ &[data-callout="cite"] {
178
+ --type-color: var(--callout-quote);
179
+ }
180
+ }
@@ -0,0 +1,7 @@
1
+ // Compatibility alias for the historical command-palette partial name.
2
+ //
3
+ // The Phase 5 handoff standardizes the file as `_command_palette.scss`;
4
+ // this wrapper keeps older comments/tools that probe `_cmdk.scss` from
5
+ // failing while the real styles live in the spec-named partial.
6
+
7
+ @use "./command_palette";
@@ -0,0 +1,208 @@
1
+ // Brain code surface — Lane C of the 2026 commonplace-book redesign.
2
+ //
3
+ // This file is installed at
4
+ // `<vault>/.quartz/quartz/styles/brain/_code.scss` by `brain vault
5
+ // render --overlay` and pulled into the global SCSS via `custom.scss`'s
6
+ // `@use "./brain/code"` line.
7
+ //
8
+ // Scope of this file:
9
+ //
10
+ // * `<pre>` block surface — rounded `8px`, `--shadow-sm`, padding
11
+ // `1rem 1.2rem`, `--fs-sm` body. Background `--surface-2` in light,
12
+ // a deeper espresso in dark (the dark-mode token wiring is in
13
+ // `_tokens.scss`'s dark-mode `:root[saved-theme="dark"]` block —
14
+ // `--surface-2` becomes `#2a2418` there).
15
+ // * Inline `code` polish — Lane A's `_surface.scss` already paints
16
+ // the background; this file refines padding/radius/no-shrink so
17
+ // `code` snippets read at the surrounding text size.
18
+ // * Language label + copy button hover affordance — wires the
19
+ // `[data-language]` attribute Quartz's `Plugin.SyntaxHighlighting`
20
+ // stamps on `<pre>` into a CSS-only top-right pill, paired with
21
+ // a brain-themed copy button injected by `codeCopy.js`.
22
+ // * Hide stock Quartz `.clipboard-button` — Body.tsx ships a
23
+ // stock clipboard button that, if left alone, would render next
24
+ // to our brain-themed `.brain-code-copy`. Our button supersedes
25
+ // it; this file hides stock's via `display: none`.
26
+ //
27
+ // Tokens consumed (from `_tokens.scss`):
28
+ // * `--surface-1` / `--surface-2` — code surfaces
29
+ // * `--shadow-sm` — pre elevation
30
+ // * `--fs-sm` — pre font size
31
+ // * `--ink-1` / `--ink-2` — label + button colors
32
+ // * `--rule` — button border
33
+ // * `--accent-soft` — copy hover
34
+ // * `--motion-fast`/`--motion-easing` — transitions
35
+
36
+ // ---------------------------------------------------------------------------
37
+ // 1. <pre> block surface
38
+ // ---------------------------------------------------------------------------
39
+ //
40
+ // Stock Quartz paints `pre { padding: 0 0.5rem; border-radius: 5px;
41
+ // border: 1px solid var(--lightgray); }` (see base.scss). We override
42
+ // to the redesign aesthetic: bigger radius, generous padding, soft
43
+ // shadow, no border. Background pulls from the surface scale —
44
+ // `--surface-2` is the third-tier paper surface in light, the espresso
45
+ // `#2a2418` in dark (see `_tokens.scss`).
46
+
47
+ article pre {
48
+ position: relative;
49
+ background: var(--surface-2);
50
+ border: 0;
51
+ border-radius: 8px;
52
+ box-shadow: var(--shadow-sm);
53
+ padding: 1rem 1.2rem;
54
+ font-size: var(--fs-sm);
55
+ // Stock Quartz keeps `<pre>` content as a single line in some
56
+ // mermaid contexts; cap with an explicit overflow rule so wide
57
+ // code scrolls horizontally rather than blowing out the column.
58
+ overflow-x: auto;
59
+ margin: 1.2rem 0;
60
+ // brain: line-height tuned for code reading. Stock leaves it at the
61
+ // article's `1.7`, which is far too loose for monospace.
62
+ line-height: 1.55;
63
+ }
64
+
65
+ // Reset the inner `<code>` so its padding doesn't double-pad inside
66
+ // the pre. Stock Quartz adds `padding: 0.5rem 0` on `pre > code`;
67
+ // keep that for line-number gutters but trim outer.
68
+ article pre > code {
69
+ padding: 0;
70
+ background: none;
71
+ font-size: inherit;
72
+ }
73
+
74
+ // ---------------------------------------------------------------------------
75
+ // 2. Inline `code` polish
76
+ // ---------------------------------------------------------------------------
77
+ //
78
+ // Lane A's `_surface.scss` already writes `code:not(pre code) { background: var(--surface-2) }`.
79
+ // This block refines the box: tighter padding, smaller radius, and
80
+ // `font-size: 0.92em` so `code` snippets don't visibly shrink against
81
+ // surrounding running serif text. The 0.92em is deliberate — pure
82
+ // `1em` reads chunky against Newsreader's optical-sized body, while
83
+ // the stock `0.9em` reads tiny.
84
+
85
+ code:not(pre code) {
86
+ padding: 0.1rem 0.35rem;
87
+ border-radius: 3px;
88
+ font-size: 0.92em;
89
+ // Reset stock Quartz's `color: var(--dark)` so inline code rides the
90
+ // ink scale for theme consistency. Falls back to the body color
91
+ // otherwise.
92
+ color: var(--ink-0);
93
+ }
94
+
95
+ // ---------------------------------------------------------------------------
96
+ // 3. Hide stock Quartz `.clipboard-button`
97
+ // ---------------------------------------------------------------------------
98
+ //
99
+ // `Body.tsx` injects a stock clipboard button on every `<pre>`. Our
100
+ // brain copy button (injected by `codeCopy.js`) supersedes it. Hiding
101
+ // stock's avoids two-buttons-side-by-side. The stock script's click
102
+ // behavior still functions if accessed programmatically; we only hide
103
+ // the visual chrome.
104
+ //
105
+ // brain (Lane C audit fix 2026-05-02): scoped to `article pre
106
+ // .clipboard-button`. The added selector chain (3,0,2 vs stock's
107
+ // 0,1,0) wins on specificity without `!important`, and confines the
108
+ // rule to article code blocks — popovers / mermaid diagrams / future
109
+ // non-pre clipboard hooks won't be globally hidden.
110
+
111
+ article pre .clipboard-button {
112
+ display: none;
113
+ }
114
+
115
+ // ---------------------------------------------------------------------------
116
+ // 4. Brain copy button + language label hover area
117
+ // ---------------------------------------------------------------------------
118
+ //
119
+ // Both the copy button and the language label live in the top-right
120
+ // of the `<pre>`. Together they form a small chrome that fades in on
121
+ // hover. Default: opacity 0; on `pre:hover` or `pre:focus-within`:
122
+ // opacity 1. `focus-within` covers keyboard users tabbing into the
123
+ // button.
124
+ //
125
+ // The language label is pure CSS, driven by `pre[data-language]`
126
+ // (Quartz's `Plugin.SyntaxHighlighting` stamps the attribute). Falls
127
+ // back gracefully when absent — the `::before` only renders when the
128
+ // attribute is present, so untyped code blocks stay clean.
129
+
130
+ article pre[data-language]::before {
131
+ content: attr(data-language);
132
+ position: absolute;
133
+ top: 0.5rem;
134
+ // brain: room for the 64px-wide copy button at the same right edge.
135
+ // The label sits to the LEFT of the button so they don't overlap.
136
+ right: 4.2rem;
137
+ font-family: var(--codeFont);
138
+ font-size: var(--fs-xs);
139
+ color: var(--ink-2);
140
+ // brain (Linear): code-style label — lowercase mono instead of
141
+ // small-caps. Reads as a tech tag, not an editorial caption.
142
+ text-transform: lowercase;
143
+ letter-spacing: 0.02em;
144
+ pointer-events: none;
145
+ opacity: 0;
146
+ transition: opacity var(--motion-fast) var(--motion-easing);
147
+ }
148
+
149
+ article pre:hover[data-language]::before,
150
+ article pre:focus-within[data-language]::before {
151
+ opacity: 1;
152
+ }
153
+
154
+ // The injected copy button — class is `.brain-code-copy`, written
155
+ // by `codeCopy.js`. ARIA label set there too. Visual rules here.
156
+ .brain-code-copy {
157
+ position: absolute;
158
+ top: 0.5rem;
159
+ right: 0.5rem;
160
+ display: inline-flex;
161
+ align-items: center;
162
+ gap: 0.3rem;
163
+ padding: 0.2rem 0.55rem;
164
+ background: var(--surface-1);
165
+ color: var(--ink-1);
166
+ border: 1px solid var(--rule);
167
+ border-radius: 4px;
168
+ // brain (Linear): mono copy button — Geist Mono lowercase tracks
169
+ // the language label's tech tag treatment.
170
+ font-family: var(--codeFont);
171
+ font-size: var(--fs-xs);
172
+ text-transform: lowercase;
173
+ letter-spacing: 0.02em;
174
+ cursor: pointer;
175
+ opacity: 0;
176
+ transition:
177
+ opacity var(--motion-fast) var(--motion-easing),
178
+ background var(--motion-fast) var(--motion-easing),
179
+ color var(--motion-fast) var(--motion-easing);
180
+
181
+ &:hover {
182
+ background: var(--accent-soft);
183
+ color: var(--ink-0);
184
+ }
185
+
186
+ &:focus-visible {
187
+ outline: 2px solid var(--accent-strong);
188
+ outline-offset: 1px;
189
+ opacity: 1;
190
+ }
191
+
192
+ // brain: the "Copied" pulse swaps the label text via JS; the chip
193
+ // itself uses the success-callout color briefly. `--callout-success`
194
+ // is defined in `_tokens.scss` (loaded first via `custom.scss` order),
195
+ // so the var is always resolved here — no fallback hex needed.
196
+ &.is-copied {
197
+ background: color-mix(in srgb, var(--callout-success) 18%, var(--surface-1));
198
+ color: var(--callout-success);
199
+ border-color: var(--callout-success);
200
+ opacity: 1;
201
+ }
202
+ }
203
+
204
+ // Reveal on hover or keyboard focus on the surrounding pre.
205
+ article pre:hover .brain-code-copy,
206
+ article pre:focus-within .brain-code-copy {
207
+ opacity: 1;
208
+ }