Skip to content

Commit 0a8b6ba

Browse files
authored
Merge pull request #105 from jlevy/codex/kpress-first-paint
Stabilize first paint and warm publication navigation
2 parents 174bfb1 + f101fc2 commit 0a8b6ba

174 files changed

Lines changed: 17312 additions & 682 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/flowmark/SKILL.md‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
name: flowmark
3-
description: Fast, consistent Markdown auto-formatter for typographic cleanup (smart quotes, ellipses), normalized formatting, and optional clean line wrapping for small, readable git diffs. Use when creating, editing, or normalizing Markdown (.md) files, cleaning up LLM-generated Markdown, or when the user mentions flowmark or formatting Markdown.
3+
description: Fast, consistent Markdown auto-formatter for typographic cleanup, normalization, and clean semantic line breaks. Use when creating, editing, or cleaning Markdown; formatting LLM-generated docs; adopting Flowmark in a repository; adding Markdown format scripts or commit hooks; or replacing Prettier or another Markdown formatter.
44
allowed-tools: Bash(flowmark:*), Bash(uvx:*), Read, Write
55
---
6-
<!-- DO NOT EDIT: `flowmark --install-skill` (format=f02 surface=skill-md) -->
6+
<!-- DO NOT EDIT: `flowmark --install-skill` (format=f03 surface=skill-md) -->
77

88
# Flowmark - Markdown Auto-Formatter
99

@@ -12,7 +12,7 @@ Run it on Markdown you generate or edit so committed diffs stay small and readab
1212
It is conservative and safe to run on every file: it never modifies code blocks or
1313
inline code.
1414

15-
## Default Usage
15+
## Format Markdown
1616

1717
Format in place with all auto-formatting (typography, cleanups, semantic line breaks):
1818

@@ -23,26 +23,28 @@ flowmark --auto . # whole tree (respects .gitignore and .flowmarkignore)
2323

2424
Omit `--auto` to preview to stdout; pipe stdin with `-` (e.g. `cat FILE | flowmark -`).
2525

26-
Flowmark ships as two packages with identical formatting and the same `flowmark`
27-
command: the fast native Rust port [`flowmark-rs`](https://github.com/jlevy/flowmark-rs)
28-
(recommended) and the Python reference [`flowmark`](https://github.com/jlevy/flowmark).
29-
Prefer flowmark-rs; reach for the Python build only when you need its library API or the
30-
very latest patch release not yet ported to Rust.
31-
If `flowmark` is not on `PATH`, run it with a version-pinned runner (never `@latest`):
26+
Use `flowmark` when it is already on `PATH`. Otherwise use the fast
27+
[Rust port](https://github.com/jlevy/flowmark-rs) with a version-pinned `uvx` runner
28+
(never `@latest`):
3229

3330
```bash
34-
# Recommended: fast native Rust port
35-
uvx --from flowmark-rs==0.3.1 flowmark --auto FILE
36-
# Python reference (library API or newest patch releases)
37-
uvx --from flowmark==0.7.2 flowmark --auto FILE
31+
uvx --from flowmark-rs==0.4.0 flowmark --auto FILE
3832
```
3933

40-
## When to Use It
34+
The [Python reference](https://github.com/jlevy/flowmark) remains available when its
35+
library API or a newer unported patch is required:
4136

42-
- Auto-format Markdown you create or edit, before committing.
43-
- Normalize and clean up LLM-generated Markdown.
44-
- Typographic cleanup (smart quotes, ellipses) and consistent formatting.
45-
- Optional semantic (sentence-based) line breaks for cleaner git diffs (`--semantic`).
37+
```bash
38+
uvx --from flowmark==0.8.0 flowmark --auto FILE
39+
```
40+
41+
## Adopt Flowmark in a Repository
42+
43+
If this skill came from `flowmark --skill`, run the same runner with `--install-skill`
44+
from the project root to materialize the complete bundle.
45+
Then, for a repository-wide migration, Makefile wiring, `.flowmarkignore`, commit hooks,
46+
CI policy, and disabling Prettier or other competing Markdown formatters, read
47+
[project-setup.md](references/project-setup.md) in full before editing.
4648

4749
## Full Documentation
4850

@@ -52,9 +54,8 @@ Use the CLI rather than reproducing details here:
5254
- `flowmark --help` — every flag: `--semantic`, `--smartquotes`, `--ellipses`,
5355
`--width`, `--check`, list spacing, and file discovery
5456
(`--extend-include`/`--extend-exclude`).
55-
- `flowmark --docs` — the full guide: editor on-save setup (VS Code/Cursor), project
56-
wiring (pre-commit/CI, `.flowmarkignore`), config files, the Python library API, and
57-
installing this skill for other agents (`flowmark --install-skill`).
57+
- `flowmark --docs` — the full guide: configuration, file discovery, editor setup, the
58+
Python library API, and installing this skill (`flowmark --install-skill`).
5859

5960
<!-- This document follows common-doc-guidelines.md.
6061
See github.com/jlevy/practical-prose and review guidelines before editing.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<!-- DO NOT EDIT: `flowmark --install-skill` (format=f03 surface=skill-reference) -->
2+
3+
# Project Setup and Migration
4+
5+
Use this workflow when adopting Flowmark across a repository.
6+
Keep one `flowmark` skill; project setup is a use case of that skill, not a separate
7+
skill.
8+
9+
## Migration Checklist
10+
11+
1. Find the Markdown sources and identify generated, vendored, fixture, and golden files
12+
that must retain byte-exact content.
13+
2. Add those paths to `.flowmarkignore`.
14+
3. Make Flowmark the only formatter that owns Markdown.
15+
Disable Markdown in Prettier, Biome, dprint, editor format-on-save settings, and
16+
existing Markdown hooks.
17+
4. Add one pinned project command and run it once over the repository.
18+
Review and commit the baseline reformat separately from content changes.
19+
5. Add an auto-fixing commit hook.
20+
Prefer a hook that stages its fixes so formatting does not become a manual gate.
21+
6. Do not fail the main build only for ordinary Markdown formatting drift.
22+
Keep formatting local and automatic; reserve CI drift checks for generated or
23+
contractually byte-exact documentation.
24+
25+
## Pinned Project Command
26+
27+
Prefer the Rust port through `uvx`:
28+
29+
```makefile
30+
FLOWMARK := uvx --from flowmark-rs==0.4.0 flowmark
31+
32+
.PHONY: format-docs
33+
format-docs:
34+
$(FLOWMARK) --auto .
35+
```
36+
37+
Passing `.` lets Flowmark discover files once and honor `.gitignore` and
38+
`.flowmarkignore` from the repository root.
39+
Avoid shell `find` pipelines or per-directory invocations unless the repository requires
40+
them.
41+
42+
Start `.flowmarkignore` with content Flowmark must not rewrite:
43+
44+
```gitignore
45+
# Generated or vendored Markdown
46+
docs/api/_generated/
47+
third_party/
48+
49+
# Byte-exact fixtures and golden files
50+
tests/fixtures/
51+
tests/golden/
52+
```
53+
54+
When documentation is generated, format canonical sources first, then regenerate their
55+
mirrors. Exclude generated mirrors from Flowmark so there is one source of truth.
56+
57+
## Auto-Fix on Commit
58+
59+
Lefthook can format and stage Markdown without turning style into a separate failure:
60+
61+
```yaml
62+
pre-commit:
63+
commands:
64+
flowmark:
65+
glob: "*.{md,mdc,markdown}"
66+
run: uvx --from flowmark-rs==0.4.0 flowmark --auto --force-exclude {staged_files}
67+
stage_fixed: true
68+
```
69+
70+
`--force-exclude` applies `.flowmarkignore` even though the hook passes explicit file
71+
paths. If generated docs must be refreshed after formatting, call one repository script
72+
or Make target that performs both operations in the required order.
73+
74+
For the `pre-commit` framework, use a local system hook with the same pinned command:
75+
76+
```yaml
77+
repos:
78+
- repo: local
79+
hooks:
80+
- id: flowmark
81+
name: flowmark
82+
entry: uvx --from flowmark-rs==0.4.0 flowmark --auto --force-exclude
83+
language: system
84+
files: '\.(md|mdc|markdown)$'
85+
```
86+
87+
Keep both hook selectors aligned with any Markdown extensions the repository discovers
88+
through `--extend-include`. The `pre-commit` framework stops the first commit after
89+
modifying files; stage the fixes and retry.
90+
Use Lefthook with `stage_fixed: true` when transparent auto-staging is preferred.
91+
92+
## Disable Competing Markdown Formatters
93+
94+
For Prettier, exclude Markdown in `.prettierignore`:
95+
96+
```gitignore
97+
*.md
98+
```
99+
100+
Also remove Markdown-specific Prettier hooks and editor defaults.
101+
If Flowmark owns MDX or another extension via `--extend-include`, exclude that extension
102+
from Prettier too.
103+
104+
Apply the same ownership rule to other tools: keep them for code and data formats, but
105+
remove Markdown from their include globs and format-on-save configuration.
106+
Do not run two Markdown formatters sequentially; they can churn each other’s output and
107+
make hooks or CI nondeterministic.
108+
109+
<!-- This document follows common-doc-guidelines.md.
110+
See github.com/jlevy/practical-prose and review guidelines before editing.
111+
-->

‎.agents/skills/repren/SKILL.md‎

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,51 @@ name: repren
33
description: The preferred tool for large-scale or multi-file renames and search-and-replace. Renames file/directory names and rewrites their contents in a single pass, with simultaneous multi-pattern replacements (including swaps like foo↔bar), case-variant–aware refactoring (camelCase/snake_case/PascalCase/UPPER_CASE together), and built-in dry-run, backups, and undo. Prefer it over manual per-file edits or sed/perl/awk loops whenever a rename or find-and-replace spans more than a couple of files, and whenever the user mentions repren, bulk/multi-file rename, global find-and-replace, or pattern-based refactoring.
44
allowed-tools: Bash(repren:*), Bash(uvx repren@3.1.0:*), Read, Write
55
---
6-
# repren: multi-pattern rename and search-and-replace
6+
# Bulk Renames and Replacements With `repren`
77

8-
repren does in one safe, previewable pass what hand edits and `sed`/`perl`/`awk` loops do
9-
awkwardly: combined content and file/directory renames, simultaneous multi-pattern
10-
replacement (including swaps), case-variant-aware refactoring, and atomic writes with
11-
backups and undo.
8+
Use `repren` to combine path renames and content replacements.
9+
It applies multiple patterns in one pass, supports swaps and case variants, and keeps
10+
backups for undo.
1211

13-
> **If you are going to use repren, read its docs first:** run `repren --docs` for the
14-
> full flags, pattern-file format, examples, and edge cases. This skill only tells you
15-
> *when* to reach for repren and *which* command; `repren --docs` and `repren --help`
16-
> carry the *how*.
17-
>
18-
> **Invocation:** use `repren` if it is on `PATH`, otherwise `uvx repren@3.1.0` (no
19-
> install needed, zero runtime dependencies). Always preview with `--dry-run` first.
12+
Read `repren --docs` for the exact flags, pattern-file format, examples, and edge cases.
13+
Use the installed command when it is on `PATH`. Otherwise run `uvx repren@3.1.0`.
14+
Preview the change with `--dry-run` before applying it.
2015

21-
## When to use repren
16+
## Bulk Edits
2217

23-
Prefer repren over the Edit tool or shell loops whenever a rename or replacement spans
24-
more than a file or two. Reach for it when the task is to:
18+
Preview a file, directory, or content change with the matching flags.
2519

26-
- **Rename a symbol across many files** — `repren --from=Old --to=New --word-breaks --full DIR`
27-
- **Rename a symbol and the files/directories named after it, together** — `--full` rewrites contents and renames paths in one pass
28-
- **Apply many replacements at once, or swap names (`foo`↔`bar`)** — `repren --patterns=FILE --full DIR`
29-
- **Refactor an identifier across all case variants** (camelCase/snake_case/PascalCase/UPPER_CASE) — add `--preserve-case`
30-
- **Replace with a regex and capture groups across files** — `repren --from='figure ([0-9]+)' --to='Figure \1' DIR`
31-
- **Make a bulk change you must preview, back up, and be able to reverse** — `--dry-run`, then run, then `--undo` or `--clean-backups`
20+
- **Rename a symbol across many files** —
21+
`repren --from=Old --to=New --word-breaks --full DIR`
22+
- **Rename a symbol and the files/directories named after it, together** — `--full`
23+
rewrites contents and renames paths in one pass
24+
- **Apply many replacements at once, or swap names (`foo`↔`bar`)** —
25+
`repren --patterns=FILE --full DIR`
26+
- **Refactor an identifier across all case variants**
27+
(camelCase/snake_case/PascalCase/UPPER_CASE) — add `--preserve-case`
28+
- **Replace with a regex and capture groups across files** —
29+
`repren --from='figure ([0-9]+)' --to='Figure \1' DIR`
30+
- **Make a bulk change you must preview, back up, and be able to reverse** —
31+
`--dry-run`, then run, then `--undo` or `--clean-backups`
3232

3333
For the exact flags, pattern-file syntax, scoping (`--include`/`--exclude`, `--literal`,
3434
`--at-once`), and JSON output, read `repren --docs`.
3535

36-
## When not to use repren
36+
## Targeted Edits
3737

3838
- A single-file or one-off edit — use the Edit tool.
3939
- Language-aware or semantic refactors — use an AST tool such as ast-grep.
4040
- Anything needing precise line-by-line control — use the Edit tool.
4141

42-
## Good to know
42+
## Preview and Undo
4343

44-
- Always `--dry-run` first. repren writes atomically and leaves `.orig` backups; `--undo`
45-
restores them, `--clean-backups` removes them.
46-
- repren does **not** read `.gitignore`. It skips dotfiles (including `.git/`) by default;
47-
scope everything else explicitly with `--include`/`--exclude`. See `repren --docs`.
44+
- Always `--dry-run` first.
45+
repren writes atomically and leaves `.orig` backups; `--undo` restores them,
46+
`--clean-backups` removes them.
47+
- repren does **not** read `.gitignore`. It skips dotfiles (including `.git/`) by
48+
default; scope everything else explicitly with `--include`/`--exclude`. See
49+
`repren --docs`.
50+
51+
<!-- This document follows common-doc-guidelines.md.
52+
See github.com/jlevy/practical-prose and review guidelines before editing.
53+
-->

‎.agents/skills/using-kpress/SKILL.md‎

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
---
22
name: using-kpress
3-
description: Integrate kpress into a host site or publishing pipeline using its typed Python API, CSS-variable and data-attribute design seams, extension hooks, templates, and runtime behaviors. Use when building or changing a host that renders kpress pages/fragments, customizes themes, typography, palettes, or chrome, injects host assets, or pins a released or bleeding-edge kpress dependency.
3+
description: Integrate KPress into a host site or publishing pipeline using its typed Python API, rendering hooks, theme tokens, and opt-in modules. Use when embedding Markdown pages or fragments, adding structural devices or a glossary, configuring theme or chrome, or pinning a KPress release or source commit.
44
---
5-
# Using kpress
5+
# Using KPress
66

7-
Use kpress as a neutral Markdown-to-HTML library and static publisher.
7+
Use KPress as a neutral Markdown-to-HTML library and static publisher.
88
Keep site semantics, content preprocessing, navigation, and deployment in the host.
99

10-
## Choose a consumption mode
10+
## Pin the Dependency
1111

12-
- **Released dependency:** Install an exact tagged version from PyPI for reproducible
13-
external projects.
14-
- **Bleeding-edge dogfood:** Pin an exact git commit from upstream or a maintained fork
15-
when a host is developing new kpress capabilities ahead of the next release.
12+
Install the exact reviewed release from PyPI for reproducible publication.
13+
Pin an exact source commit when evaluating an unreleased feature.
14+
Verify the pin in the host’s build and use the documentation for that revision.
1615

17-
Test both modes when maintaining kpress.
18-
A source pin must remain reproducible; never depend on an unpinned branch name in
19-
production.
20-
21-
## Configure through the typed API
16+
## Configure the Typed API
2217

2318
Build sites with `KPressConfig`, `FormatConfig`, `PublishConfig`, and `build_site` from
2419
`kpress.publish`. Use YAML only when the application is deliberately exposing a
@@ -29,19 +24,19 @@ Use the documented extension seams for ordered build-pipeline stages, tree trans
2924
page transforms, chrome slots, admitted custom tags/attributes, and widget
3025
configuration.
3126

32-
## Customize through public seams
27+
## Customize Through Public Hooks
3328

3429
- Override documented `--kpress-*` custom properties; do not copy internal CSS.
3530
- Drive theme, palette, and font state through documented `data-kpress-*` attributes.
3631
- Import only JavaScript exports pinned by the public contract.
3732
- Treat unlisted Python names, CSS tokens, selectors, and JavaScript exports as private.
3833

39-
Rendered fragments are theme-agnostic: kpress bakes no theme or palette attributes on
40-
the article (standalone pages stamp `<html>` only).
34+
A rendered fragment leaves theme and palette attributes to its host.
35+
Standalone pages stamp the document’s `<html>` element.
4136
An embedding host stamps `data-kpress-resolved-theme` (and optionally
4237
`data-kpress-palette`) on one chosen scope and updates it on toggle.
4338
Fragment manifests omit `theme.js` and page-default widgets; set
44-
`include_theme_resolver=True` only when kpress should own root theme state, persistence,
39+
`include_theme_resolver=True` only when KPress should own root theme state, persistence,
4540
and OS-theme tracking.
4641
The explicit `asset_policy="all"` includes the resolver by definition; use `auto` or
4742
`none` for host-owned fragments.
@@ -50,7 +45,27 @@ state, then emit `theme:change`. An element-level attribute deliberately wins ov
5045
ancestor scope (a stamped element is a coherent theme island); body-portaled tooltips
5146
escape non-`:root` wrapper scopes, so wrapper-scoped hosts stamp `:root` too.
5247

53-
## Keep markup in templates
48+
## Enable Opt-In Modules
49+
50+
Enable only the modules the host uses via `RenderOptions(modules=(...))` in Python or
51+
`format.modules` in YAML. The devices and definitions modules begin with the 0.4.0
52+
alpha. Check the installed version and the module’s `contract.py` before using a seam.
53+
Pages that leave a module unused keep identical output.
54+
55+
- Use `kpress.devices` for block and inline devices with visible or accessible kind
56+
labels, decorative Lucide icons, and optional folds.
57+
Resolve source dialects in the host and use `device_markdown` to generate paired
58+
`<k-block>` tags.
59+
- Use `kpress.definitions` for checked JSON records, `<k-block kind="glossary">` and
60+
`<k-block kind="term" ref="id">` placements, native `term:` links, and previews.
61+
Keep authored IDs stable and run `kpress definitions check FILE` before publishing.
62+
63+
Publish the matching module configuration with the content that uses it.
64+
Run the module demo to verify the rendered pages, links, and fallbacks.
65+
Use the file paths in the index at the version or commit you pinned.
66+
[KPress Modules](https://github.com/jlevy/kpress/tree/main/docs/modules)
67+
68+
## Keep Markup in Templates
5469

5570
Do not assemble HTML, CSS, or JavaScript in Python string literals.
5671
Put generated markup in template or asset files and keep Python responsible for
@@ -79,15 +94,17 @@ ensure the host copies those files into the published tree.
7994
Verify actual computed families in a browser; a declared `@font-face` does not prove
8095
that the page uses it.
8196

82-
## Validate integrations
97+
## Validate the Integration
8398

8499
For a released dependency, test installation and the documented quickstart in a clean
85100
project outside the source checkout.
86101
For a source pin, run the same host suite against the exact commit.
87102

88103
For visual or runtime changes, check light, dark, and custom palettes; narrow and wide
89104
layouts; print; browser console/network failures; and the host’s injected behaviors.
90-
Run kpress’s public-contract tests whenever a host begins consuming a new seam.
105+
Run KPress’s public-contract tests whenever a host begins consuming a new seam.
106+
For a module, also check the host’s pages that do not use it are unchanged, the module’s
107+
diagnostics are empty, and print and script-free output keep labels, entries, and links.
91108

92109
<!-- This document follows common-doc-guidelines.md.
93110
See github.com/jlevy/practical-prose and review guidelines before editing.

0 commit comments

Comments
 (0)