Skip to content

Phase 3: CLI foundation, YAML parser, and model introspector - #6

Merged
manavgup merged 1 commit into
mainfrom
phase-3/cli-yaml-parser
Mar 30, 2026
Merged

Phase 3: CLI foundation, YAML parser, and model introspector#6
manavgup merged 1 commit into
mainfrom
phase-3/cli-yaml-parser

Conversation

@manavgup

Copy link
Copy Markdown
Owner

Summary

  • CLI entry pointfaststack --version works, Click group ready for subcommands
  • Field mappings — 13 YAML types mapped to SQLAlchemy, Pydantic, and Python types with helpers for enum/array special cases
  • YAML parserparse_entities_yaml() with relationship resolution (many-to-one, many-to-many, self-referential), inflect pluralization, cross-entity validation
  • Model introspector — AST-based reader that parses SQLAlchemy 2.0 Mapped[] models without importing them. Handles FK, relationships, enums, nullable unions.

Test coverage

146 new tests (246 total):

  • All 13 type mappings across 3 targets
  • YAML parsing with User/Post/Category fixture (relationships, enums, arrays, searchable)
  • AST introspection of simple fields, FK, enum classes, self-referential, one-to-many
  • Error cases for invalid input

How to test

make check     # lint + typecheck + 246 tests pass
faststack --version   # prints "faststack, version 0.1.0"

Part of

Phase 3 in #1

🤖 Generated with Claude Code

- cli/__init__.py: Click CLI group with --version
- cli/field_mappings.py: 13-type YAML → SQLAlchemy → Pydantic mapping
  with helpers for enum, array, and import resolution
- cli/yaml_parser.py: EntityDefinition/FieldDefinition/RelationshipDefinition
  dataclasses, parse_entities_yaml() with relationship resolution
  (many_to_one, many_to_many, self_referential), inflect pluralization
- cli/model_introspector.py: AST-based model reader — parses Mapped[],
  mapped_column(), relationship(), enum classes without importing

146 new tests (246 total) covering:
- All 13 type mappings across SQLAlchemy/Pydantic/Python
- YAML parsing with User/Post/Category fixture
- Relationship resolution and cross-entity validation
- AST introspection of FK, enum, self-referential, and nullable patterns
- Error cases for invalid YAML and model files

Part of Phase 3 in #1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@manavgup
manavgup merged commit 1c46443 into main Mar 30, 2026
5 checks passed
@manavgup
manavgup deleted the phase-3/cli-yaml-parser branch March 30, 2026 19: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