Improve mnemonic handling and remote repo resolution#46
Merged
amhellmund merged 3 commits intomainfrom Mar 1, 2026
Merged
Conversation
- Validate mnemonic names: must match `^[a-z][a-z0-9_-]*$` (lowercase letter, then alphanumeric/dash/underscore; no slashes or uppercase) - Require at least one source-import per workspace config - Validate mnemonic names in `archml init` CLI command - Model source_import_map as `dict[tuple[str, str], Path]` keyed by `(repo_id, mnemonic)`: local mnemonics use `""` as repo_id, remote repos use `"@name"` - Add `_get_source_repo()` to determine which repo a source file belongs to - Update `_resolve_import_source()` to accept source_repo context so bare mnemonic imports (`mnemonic/path`) resolve against the source file's repo - Remote imports require full `@repo/mnemonic/path` format; bare imports require `mnemonic/path` format (no bare unqualified paths) - CLI `check` scans only files under configured local mnemonic paths (not the workspace root), and does not add a bare `@repo` fallback key - Update all tests for the new mnemonic-based import and map structure Co-authored-by: Andi Hellmund <amhellmund@users.noreply.github.com>
amhellmund
commented
Mar 1, 2026
src/archml/cli/main.py
Outdated
|
|
||
| # Build the source import map: (repo_id, mnemonic) -> absolute base path. | ||
| # Local mnemonics use "" as repo_id; remote repos use "@name". | ||
| source_import_map: dict[tuple[str, str], Path] = {} |
Owner
Author
There was a problem hiding this comment.
@claude Use a namedtuple here instead of a plain tuple.
src/archml/cli/main.py
Outdated
| for imp in config.source_imports: | ||
| if isinstance(imp, LocalPathImport): | ||
| source_import_map[imp.name] = (directory / imp.local_path).resolve() | ||
| source_import_map[("", imp.name)] = (directory / imp.local_path).resolve() |
Owner
Author
There was a problem hiding this comment.
@claude
Always use a repo name. Even the local import has a repo name, the name of the archml workspace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #43
Changes
^[a-z][a-z0-9_-]*$(lowercase letter, then alphanumeric/dash/underscore; no slashes or uppercase)dict[tuple[str, str], Path]keyed by(repo_id, mnemonic): local mnemonics use""as repo_id, remote repos use"@name"mnemonic/path) resolve using the source file's repo; remote imports require@repo/mnemonic/pathformatGenerated with Claude Code