generated from coulomb/repo-seed
markitect-tool integration
This commit is contained in:
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
|
||||
from .errors import InfospaceError
|
||||
from .lifecycle import add_artifact, create_infospace, load_infospace
|
||||
from .markdown_adapter import validate_infospace_artifacts
|
||||
|
||||
|
||||
def build_parser() -> argparse.ArgumentParser:
|
||||
@@ -31,6 +32,9 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
export = sub.add_parser("export", help="Print the infospace representation")
|
||||
export.add_argument("root")
|
||||
|
||||
validate = sub.add_parser("validate", help="Validate infospace artifacts")
|
||||
validate.add_argument("root")
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
@@ -58,6 +62,16 @@ def main(argv: list[str] | None = None) -> int:
|
||||
_write_json({"artifact": artifact.to_dict()})
|
||||
elif args.command == "export":
|
||||
_write_json(load_infospace(Path(args.root)).to_dict())
|
||||
elif args.command == "validate":
|
||||
results = validate_infospace_artifacts(Path(args.root))
|
||||
valid = all(result.valid for result in results)
|
||||
_write_json(
|
||||
{
|
||||
"valid": valid,
|
||||
"results": [result.to_dict() for result in results],
|
||||
}
|
||||
)
|
||||
return 0 if valid else 1
|
||||
else:
|
||||
parser.error(f"Unhandled command: {args.command}")
|
||||
except InfospaceError as exc:
|
||||
|
||||
Reference in New Issue
Block a user