Skip to content

feat: ✨ Refine from data — paint auto-detects any constant wrapper - #90

Merged
ozgesolidkey merged 2 commits into
mainfrom
feat/paint-refine-from-data
Aug 13, 2026
Merged

ozgesolidkey merged 2 commits into
mainfrom
feat/paint-refine-from-data

Conversation

@ozgesolidkey

Copy link
Copy Markdown
Contributor

Paint now auto-detects ANY constant wrapper around a column value (not just brackets) by sampling that column across the file: longest common prefix+suffix = the wrapper, kept literal (whitespace-flexible via staticToRegex), varying middle generalised. Composes with the date/int/word typing. Fires automatically in the preview ("✨ refined from data").

  • columnPattern.ts: commonAffix + sample-aware inferPaintField/compilePaint + refinePaintPattern
  • column-pattern-preview auto-refines from extracted column values (returns refined)
  • fixes "adb ->" → peels the whole " ->" border (was leaving "-" in the value)
  • +4 tests (/…/, xx…xx, no-wrapper, whitespace-flexible " ->")

tsc 0 · 628 tests · bundle.

🤖 Generated with Claude Code

ozgesolidkey and others added 2 commits August 13, 2026 10:06
…rapper

Brackets are guessable from one painted line, but arbitrary wrappers (/blah/,
xxblahxx, ...blah...) need multiple samples. Now the paint preview extracts the
painted column's values across the file's head, finds each column's longest common
PREFIX + SUFFIX (its constant wrapper), keeps that literal, and generalises only the
varying middle — then re-compiles + re-previews. Composes with the date/int/word
typing + bracket borders. No-op when values share no wrapper. Status shows "✨ refined
from data" when it fires.

- columnPattern.ts: commonAffix() + sample-aware inferPaintField/compilePaint +
  refinePaintPattern() (pure, +3 tests: /…/, xx…xx, and no-wrapper cases)
- index.ts: column-pattern-preview refactored to gather lines once, collect(), then
  auto-refine paint patterns from the extracted column values (returns `refined` flag)
- renderer: shows the "✨ refined from data" hint; patcolCompiled already uses the
  returned regex so Use-as-columns / Save get the smart pattern for free

tsc 0 · 627 tests · bundle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… fully

The refine-from-data wrapper was escaped literally, so a border with spaces like
'  ->' had to match EXACTLY (and single brackets caught '>' but left '-' in the
value). Peel it via staticToRegex instead → '  ->' becomes '\s+->', so the whole
'->' (with any whitespace) is the literal border and only 'adb' is the varying
column. +1 test (multi-char whitespace-flexible border). tsc 0 · 628 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ozgesolidkey
ozgesolidkey merged commit ed4b80c into main Aug 13, 2026
3 checks passed
ozgesolidkey added a commit that referenced this pull request Aug 19, 2026
feat: ✨ Refine from data — paint auto-detects any constant wrapper
@ozgesolidkey
ozgesolidkey deleted the feat/paint-refine-from-data branch August 19, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant