| 22 | |
| 23 | |
| 24 | def parser() -> argparse.ArgumentParser: |
| 25 | p = argparse.ArgumentParser(description=__doc__ or "write obsidian note") |
| 26 | p.add_argument("--input", default="", help="Metadata JSON path or JSON string.") |
| 27 | p.add_argument("--content-file", default="", help="Path to the final Markdown content.") |
| 28 | p.add_argument("--content", default="", help="Inline Markdown content.") |
| 29 | p.add_argument("--stdin", action="store_true", help="Read Markdown content from stdin.") |
| 30 | p.add_argument("--lint-json", default="", help="Optional lint JSON path. Refuse write if structure, style, or math gate failed.") |
| 31 | p.add_argument( |
| 32 | "--figure-decisions", |
| 33 | default="", |
| 34 | help="Optional figure/table decisions JSON. Insert decisions must have referenced materialized images.", |
| 35 | ) |
| 36 | p.add_argument("--title", default="", help="Explicit title override.") |
| 37 | p.add_argument("--output", default="", help="JSON status output path.") |
| 38 | p.add_argument("--vault", default="", help="Target Obsidian vault path.") |
| 39 | p.add_argument("--subdir", default="", help="Vault-relative subdirectory.") |
| 40 | p.add_argument("--filename", default="", help="Explicit note filename.") |
| 41 | p.add_argument("--asset-subdir", default="images", help="Asset folder name relative to the note directory.") |
| 42 | p.add_argument("--paper-id", default="", help="Canonical paper id.") |
| 43 | return p |
| 44 | |
| 45 | |
| 46 | def insert_decisions(decisions: dict) -> list[dict]: |