Skip to content

Use official Links Notation parser for .lino files#8

Merged
konard merged 3 commits into
mainfrom
issue-7-48338435
Nov 2, 2025
Merged

Use official Links Notation parser for .lino files#8
konard merged 3 commits into
mainfrom
issue-7-48338435

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented Nov 2, 2025

Summary

Implements issue #7 by integrating the official links-notation npm package to parse .lino (Links Notation) files, replacing the custom hand-written parser.

Changes Made

1. Installed Official Parser

2. Refactored Parser Implementation

File: website/src/utils/linoParser.js

  • Uses official parser: Replaced custom line-by-line parsing logic with the official Parser class from links-notation
  • Interpreter layer: Created interpretation functions to convert the parsed Link objects into our JSON model structure:
    • extractFieldPath() - Extracts field paths from nested link structures
    • getDeepestValue() - Retrieves values from link chains
    • interpretLinks() - Main interpreter that maps Links to JSON model format
    • extractCapabilitiesFromContent() - Hybrid parser for capabilities field to handle multi-word items

The implementation follows a two-step approach:

  1. Parse the .lino content using the official parser
  2. Interpret the resulting Links into our application's JSON structure

3. Updated Tests

File: website/src/utils/linoParser.test.js

  • Fixed test case with invalid formatting (missing indentation)
  • All 13 parser tests passing ✅
  • Validates parsing of: model name, dates, weights, capabilities, modalities, limits, and costs

4. Added Experiment Scripts

Created validation scripts in experiments/ folder to understand parser behavior:

  • test-parser-experiment.js - Tests basic parsing with sample files
  • test-interpreter-experiment.js - Develops and validates interpretation logic
  • test-capabilities-experiment.js - Investigates capabilities parsing edge cases

Testing

Unit Tests

✅ All 35 tests passing (35/35)
   - Parser tests: 13/13 ✅
   - Component tests: 12/12 ✅
   - App tests: 10/10 ✅

Build & Lint

✅ Build successful
✅ ESLint passing (no errors)

CI Status

All PR checks are configured to run:

  • Lint check
  • Unit tests
  • Production build

Implementation Notes

Multi-word Capabilities Handling

The Links Notation parser treats space-separated items on the same line as individual tokens. For capabilities like "tool calls" on a single line, we use a hybrid approach:

  • Parse overall structure with official parser
  • Extract capabilities line-by-line from original content
  • This preserves multi-word capability names correctly

Backward Compatibility

The JSON output structure remains identical to the original parser, ensuring no breaking changes for React components consuming the model data.

Related

Fixes #7

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Nov 2, 2025
- Install links-notation npm package (v0.11.2)
- Refactor linoParser.js to use the official Links Notation parser
- Add interpreter layer to convert parsed Links to JSON model structure
- Add hybrid parsing for capabilities to handle multi-word items
- Update tests to use proper Links Notation formatting
- Add experiment scripts to validate parser behavior
- All unit tests passing (35/35)
- Build and lint checks passing

This implementation:
1. Parses .lino files using the official links-notation parser
2. Interprets the parsed data to create JSON objects for React display
3. Maintains backward compatibility with existing model structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Use real Links Notation parser Use official Links Notation parser for .lino files Nov 2, 2025
@konard konard marked this pull request as ready for review November 2, 2025 05:38
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Nov 2, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

📎 Log file uploaded as GitHub Gist (399KB)
🔗 View complete solution draft log


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit c58bee6 into main Nov 2, 2025
1 check passed
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.

Use real Links Notation parser

1 participant