Skip to content

Add sources command for custom structures#144

Closed
httpdss wants to merge 2 commits intomainfrom
codex/implement-feature-from-github-issue-139
Closed

Add sources command for custom structures#144
httpdss wants to merge 2 commits intomainfrom
codex/implement-feature-from-github-issue-139

Conversation

@httpdss
Copy link
Copy Markdown
Owner

@httpdss httpdss commented May 8, 2026

Motivation

  • Provide a way to save, validate and reuse local custom structure directories as named sources to simplify reuse and automation.
  • Allow selecting custom structure sources via a --source flag or a source-prefixed structure name (e.g. company/project/python) while preserving existing --structures-path / STRUCTKIT_STRUCTURES_PATH behavior.

Description

  • Add structkit/sources.py with utilities for reading/writing a user-level sources.json, validation helpers, source-prefix parsing, resolve_structures_path, and SourceConfigError for error handling.
  • Add structkit/commands/sources.py implementing the structkit sources command group with list, add, remove, show, and validate subcommands and register it in the CLI via structkit/main.py.
  • Integrate --source and source-prefix resolution into generate, info, list, and search by calling resolve_structures_path and handling SourceConfigError to preserve precedence: CLI --structures-path / env var > --source > source-prefixed names > bundled contribs.
  • Document named sources in docs/custom-structures.md and add README examples; include new tests in tests/test_sources_command.py.

Testing

  • Ran pytest tests/test_sources_command.py and the targeted tests which passed.
  • Ran the full test suite with pytest and all tests passed (164 passed).
  • Executed a quick CLI flow (adding a source, listing it and resolving an info/list against a named source) in an automated script which exercised the new commands and resolution logic as part of automated checks.

Codex Task

@httpdss httpdss marked this pull request as ready for review May 9, 2026 11:37
@httpdss httpdss closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant