Skip to content

Simplify extension dedup, width table, and skills section construction - #1

Merged
cris7ian merged 1 commit into
mainfrom
simplify-context-rendering
Aug 31, 2026
Merged

cris7ian merged 1 commit into
mainfrom
simplify-context-rendering

Conversation

@cris7ian

Copy link
Copy Markdown
Owner

Summary

Three targeted simplifications from a code-review pass on src/index.ts, with no behavior change in the common path:

  • Flat extension label dedup. Replaces the path-suffix disambiguation walk in listResolvedExtensions with a flat rule: unique label → label; duplicate → scope:label; still duplicate → scope + full path. Duplicate labels are rare, and the old fallback already degraded to a full path.
  • Tighter width table. Moves the East-Asian/emoji ranges into a WIDE_RANGES table and drops the per-character combining-mark/zero-width regex. Combining marks now approximate to one column, which can only wrap slightly early — never overflow.
  • Shared skills section builder. /context skills and the default view now use one addSkillsSection helper parameterized by cap instead of two copies of the same construction.

Net −8 lines in src/index.ts; the suffix-walk branch was the hardest-to-test code in the file and is gone.

Trade-offs

  • Combining marks and variation selectors count as one column instead of zero (minor, conservative direction).
  • Same-scope duplicate extension labels now show the full path immediately instead of a searched suffix.

Verification

  • npm test — 35/35 pass
  • npm run typecheck — clean

- Replace the path-suffix disambiguation walk in listResolvedExtensions
  with a flat rule: unique label, then scope:label, then scope + full path.
- Move wide code point ranges into a WIDE_RANGES table and drop the
  combining-mark/zero-width regex; combining marks now approximate to one
  column.
- Extract addSkillsSection so /context skills and the default view share
  one section builder.

Net -8 lines in src with all 35 tests passing.
@cris7ian cris7ian self-assigned this Aug 31, 2026
@cris7ian
cris7ian merged commit 8d149f9 into main Aug 31, 2026
2 checks passed
@cris7ian
cris7ian deleted the simplify-context-rendering branch August 31, 2026 15:22
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