{"id":47874497,"url":"https://github.com/knu/obaq","last_synced_at":"2026-04-04T01:08:43.586Z","repository":{"id":331628112,"uuid":"1078182542","full_name":"knu/obaq","owner":"knu","description":"CLI query processor for Obsidian Bases","archived":false,"fork":false,"pushed_at":"2026-03-19T18:14:07.000Z","size":113,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-20T09:47:49.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"knu"}},"created_at":"2025-10-17T10:31:59.000Z","updated_at":"2026-02-05T17:04:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/knu/obaq","commit_stats":null,"previous_names":["knu/obaq"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/knu/obaq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Fobaq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Fobaq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Fobaq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Fobaq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knu","download_url":"https://codeload.github.com/knu/obaq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Fobaq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31383676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T23:20:52.058Z","status":"ssl_error","status_checked_at":"2026-04-03T23:20:51.675Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T01:08:40.384Z","updated_at":"2026-04-04T01:08:43.571Z","avatar_url":"https://github.com/knu.png","language":"TypeScript","funding_links":["https://github.com/sponsors/knu"],"categories":[],"sub_categories":[],"readme":"# obaq\n\nCLI query processor for Obsidian Bases\n\nThis tool aims to process Base queries with compatibility against the Obsidian Bases specifications.\nFor authoritative behavior and examples, refer to the official Obsidian documentation:\n```\nhttps://help.obsidian.md/bases\nhttps://help.obsidian.md/bases/syntax\nhttps://help.obsidian.md/bases/functions\nhttps://help.obsidian.md/formulas\n```\n\n## Installation\n\n```sh\nnpm install\nnpm run build\n```\n\n## Usage\n\n```sh\nobaq [-d VAULT_DIR] [-f FORMAT] (-e YAML | PATH.md)\n```\n\n- `-d|--directory VAULT_DIR`: Path to the Obsidian vault directory (defaults to current directory, searches for vault root).\n- `-e|--eval YAML`: YAML query string or `@file.base` to load from file (use `@-` for stdin).\n- `-t|--this PATH`: File path to use as the `this` context for base queries.\n- `PATH.md`: Markdown file containing `\\`\\`\\`base` blocks to evaluate and replace (use `-` for stdin).\n- `-f|--format FORMAT`: Output format: `json` (default for `-e`), `csv`, `md`, or `markdown` (default for `PATH.md`).\n- `--title-width MODE`: Table width calculation for Markdown output: `markup` (default) or `title`.\n\nSpecify either `-e/--eval` or a Markdown file.  You cannot use both at once.\n\n## Output Format\n\nThe tool outputs JSON with the following structure:\n\n```json\n{\n  \"columns\": [\n    {\n      \"id\": \"formula.title\",\n      \"displayName\": \"Title\",\n      \"size\": 286\n    }\n  ],\n  \"rows\": [\n    {\n      \"formula.title\": \"[Note Title](Notes/Note%20Title.md)\",\n      \"formula.updated\": \"2024-01-20T14:45:00.000Z\",\n      \"note.created\": \"2024-01-15T10:30:00.000Z\"\n    }\n  ]\n}\n```\n\n### Columns\n- `id`: Column identifier (e.g., `formula.title` or `note.propertyName`)\n- `displayName`: Human-readable column name\n- `size`: Optional column width\n\n### Rows\nEach row contains values for the columns specified in the query's `order` field.\n\n## Query Format\n\nThe tool supports YAML queries with the following structure:\n\n```yaml\nformulas:\n  title: file.asLink(title)\n  updated: updated.format(\"YYYY-MM-DD HH:mm:ss\")\nproperties:\n  formula.title:\n    displayName: Title\n  formula.updated:\n    displayName: Updated\nviews:\n  - type: table\n    name: Table\n    filters:\n      and:\n        - file.folder == \"ChatGPT\"\n        - file.name != file.folder\n    order:\n      - formula.title\n      - formula.updated\n    sort:\n      - property: formula.updated\n        direction: DESC\n    columnSize:\n      formula.title: 286\n```\n\n### Formulas\nJavaScript-like expressions evaluated in the context of each file:\n- `file.name`: File name without extension\n- `file.folder`: Folder path\n- `file.path`: Full relative path\n- `file.asLink(title)`: Generate a Markdown link\n- All frontmatter properties are available as variables\n\n### Filters\nBoolean expressions or nested `and`/`or` structures:\n```yaml\nfilters:\n  and:\n    - file.folder == \"Notes\"\n    - created \u003e \"2024-01-01\"\n```\n\n### Note on Date Handling\n\nYAML datetime values are preserved as `Date` instances when parsed from frontmatter.  Format them explicitly when needed:\n```yaml\nupdated: updated.format(\"YYYY-MM-DD HH:mm:ss\")\n```\n\n## Examples\n\n```sh\n# Build the project\nnpm run build\n\n# Query with inline YAML\nnode dist/cli.js -d test-vault -e \"$(cat test-vault/query.base)\"\n\n# Query from file (inside vault)\nnode dist/cli.js -d test-vault -e @test-vault/query.base\n\n# Process a Markdown file containing ```base blocks\nnode dist/cli.js -d test-vault test-vault/query.md\n\n# Process stdin as Markdown (uses cwd as base)\ncat test-vault/query.md | node dist/cli.js - -f markdown\n\n# Output as CSV\nnode dist/cli.js -d test-vault -e @test-vault/query.base -f csv\n\n# Output as markdown table\nnode dist/cli.js -d test-vault -e @test-vault/query.base -f md\n\n# Run from within vault (auto-detects vault root)\ncd test-vault\nnode ../dist/cli.js -e @query.base\n```\n\n## License\n\nCopyright (c) 2025-2026 Akinori Musha\n\nLicensed under the 2-clause BSD license.  See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknu%2Fobaq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknu%2Fobaq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknu%2Fobaq/lists"}