Skip to content

TOML line parsers in writer.ts don't handle single-quoted strings or blank lines within blocks #73

@gricha

Description

@gricha

Status: Partially addressed in #71 — the block parsers (removeBlockByHeader, removeSkillBlocksBySource, addExcludeToWildcard) now use shared extractTomlStringValue and collectBlockLines helpers that handle single-quoted strings and blank lines within blocks.

Remaining work:

The addExcludeToWildcard function's exclude array parsing (/^(exclude\s*=\s*)\[([^\]]*)\]/) still only handles inline arrays. Multi-line TOML arrays would not be matched. This is unlikely in practice since smol-toml writes inline arrays, but could happen with hand-edited configs.

Additionally, the same pattern of line-by-line TOML manipulation exists in other files/functions that weren't touched in #71:

  • addTrustSource / removeTrustSource in writer.ts (these parse [trust] section fields, not [[skills]] blocks, so different pattern)
  • sync.ts and install.ts have their own gitignore managed-names logic (duplicated from doctor.ts)

Consider whether a proper TOML AST approach (parse → modify → serialize) would be more maintainable long-term vs. continuing to extend line-by-line surgery.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions