dirsql 0.3.95__tar.gz → 0.3.97__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. {dirsql-0.3.95 → dirsql-0.3.97}/Cargo.lock +1 -1
  2. {dirsql-0.3.95 → dirsql-0.3.97}/PKG-INFO +1 -1
  3. {dirsql-0.3.95/packages/python → dirsql-0.3.97}/docs/howto/define-tables.md +4 -3
  4. {dirsql-0.3.95/packages/rust → dirsql-0.3.97}/docs/reference/cli.md +1 -1
  5. {dirsql-0.3.95 → dirsql-0.3.97}/docs/reference/config.md +33 -1
  6. {dirsql-0.3.95/packages/rust → dirsql-0.3.97}/docs/reference/sdk.md +3 -1
  7. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/Cargo.toml +1 -1
  8. {dirsql-0.3.95/packages/rust → dirsql-0.3.97/packages/python}/docs/howto/define-tables.md +4 -3
  9. {dirsql-0.3.95 → dirsql-0.3.97/packages/python}/docs/reference/cli.md +1 -1
  10. {dirsql-0.3.95/packages/rust → dirsql-0.3.97/packages/python}/docs/reference/config.md +33 -1
  11. {dirsql-0.3.95 → dirsql-0.3.97/packages/python}/docs/reference/sdk.md +3 -1
  12. dirsql-0.3.97/packages/python/e2e-attestations/claude-github-issue-580-d0jd9u.json +7 -0
  13. dirsql-0.3.97/packages/python/e2e-attestations/claude-open-issues-review-le8hm5-red-547.json +7 -0
  14. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/benches/matcher_bench.rs +2 -2
  15. {dirsql-0.3.95 → dirsql-0.3.97/packages/rust}/docs/howto/define-tables.md +4 -3
  16. {dirsql-0.3.95/packages/python → dirsql-0.3.97/packages/rust}/docs/reference/cli.md +1 -1
  17. {dirsql-0.3.95/packages/python → dirsql-0.3.97/packages/rust}/docs/reference/config.md +33 -1
  18. {dirsql-0.3.95/packages/python → dirsql-0.3.97/packages/rust}/docs/reference/sdk.md +3 -1
  19. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/bin/dirsql.rs +110 -73
  20. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/lib.rs +61 -43
  21. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/matcher.rs +146 -96
  22. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/persist.rs +84 -16
  23. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/scanner.rs +4 -2
  24. dirsql-0.3.95/packages/python/e2e-attestations/claude-open-issues-review-le8hm5-red-546.json +0 -7
  25. dirsql-0.3.95/packages/python/e2e-attestations/claude-open-issues-review-le8hm5-red-553.json +0 -7
  26. {dirsql-0.3.95 → dirsql-0.3.97}/Cargo.toml +0 -0
  27. {dirsql-0.3.95 → dirsql-0.3.97}/README.md +0 -0
  28. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/__init__.py +0 -0
  29. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/_async.py +0 -0
  30. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/_dirsql.pyi +0 -0
  31. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/cli/__init__.py +0 -0
  32. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/cli/binary_path.py +0 -0
  33. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/cli/is_windows.py +0 -0
  34. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/cli/main.py +0 -0
  35. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/cli/resolve_config_extensions.py +0 -0
  36. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/py.typed +0 -0
  37. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/resolve_config_extensions.py +0 -0
  38. {dirsql-0.3.95 → dirsql-0.3.97}/dirsql/resolve_extension.py +0 -0
  39. {dirsql-0.3.95 → dirsql-0.3.97}/docs/.claude/CLAUDE.md +0 -0
  40. {dirsql-0.3.95 → dirsql-0.3.97}/docs/.vitepress/config.ts +0 -0
  41. {dirsql-0.3.95 → dirsql-0.3.97}/docs/.vitepress/theme/index.ts +0 -0
  42. {dirsql-0.3.95 → dirsql-0.3.97}/docs/.vitepress/theme/lang.ts +0 -0
  43. {dirsql-0.3.95 → dirsql-0.3.97}/docs/AGENTS.md +0 -0
  44. {dirsql-0.3.95 → dirsql-0.3.97}/docs/explanation.md +0 -0
  45. {dirsql-0.3.95 → dirsql-0.3.97}/docs/getting-started.md +0 -0
  46. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/columns-from-paths.md +0 -0
  47. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/embed.md +0 -0
  48. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/extract-from-contents.md +0 -0
  49. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/load-extension.md +0 -0
  50. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/persist.md +0 -0
  51. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/react-to-changes.md +0 -0
  52. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/search-by-meaning.md +0 -0
  53. {dirsql-0.3.95 → dirsql-0.3.97}/docs/howto/skip-files.md +0 -0
  54. {dirsql-0.3.95 → dirsql-0.3.97}/docs/index.md +0 -0
  55. {dirsql-0.3.95 → dirsql-0.3.97}/docs/migrations.md +0 -0
  56. {dirsql-0.3.95 → dirsql-0.3.97}/docs/package.json +0 -0
  57. {dirsql-0.3.95 → dirsql-0.3.97}/docs/playwright.config.ts +0 -0
  58. {dirsql-0.3.95 → dirsql-0.3.97}/docs/pnpm-lock.yaml +0 -0
  59. {dirsql-0.3.95 → dirsql-0.3.97}/docs/pnpm-workspace.yaml +0 -0
  60. {dirsql-0.3.95 → dirsql-0.3.97}/docs/reference/columns.md +0 -0
  61. {dirsql-0.3.95 → dirsql-0.3.97}/docs/reference/hooks.md +0 -0
  62. {dirsql-0.3.95 → dirsql-0.3.97}/docs/reference/http-api.md +0 -0
  63. {dirsql-0.3.95 → dirsql-0.3.97}/docs/tests/integration/home.spec.ts +0 -0
  64. {dirsql-0.3.95 → dirsql-0.3.97}/docs/tests/integration/language-flag.spec.ts +0 -0
  65. {dirsql-0.3.95 → dirsql-0.3.97}/docs/tests/integration/sidebar.spec.ts +0 -0
  66. {dirsql-0.3.95 → dirsql-0.3.97}/docs/tests/unit/config.test.ts +0 -0
  67. {dirsql-0.3.95 → dirsql-0.3.97}/docs/tests/unit/lang.test.ts +0 -0
  68. {dirsql-0.3.95 → dirsql-0.3.97}/docs/vitest.config.ts +0 -0
  69. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/README.md +0 -0
  70. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/conftest.py +0 -0
  71. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/.claude/CLAUDE.md +0 -0
  72. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/.vitepress/config.ts +0 -0
  73. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/.vitepress/theme/index.ts +0 -0
  74. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/.vitepress/theme/lang.ts +0 -0
  75. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/AGENTS.md +0 -0
  76. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/explanation.md +0 -0
  77. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/getting-started.md +0 -0
  78. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/columns-from-paths.md +0 -0
  79. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/embed.md +0 -0
  80. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/extract-from-contents.md +0 -0
  81. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/load-extension.md +0 -0
  82. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/persist.md +0 -0
  83. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/react-to-changes.md +0 -0
  84. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/search-by-meaning.md +0 -0
  85. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/howto/skip-files.md +0 -0
  86. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/index.md +0 -0
  87. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/migrations.md +0 -0
  88. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/package.json +0 -0
  89. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/playwright.config.ts +0 -0
  90. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/pnpm-lock.yaml +0 -0
  91. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/pnpm-workspace.yaml +0 -0
  92. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/reference/columns.md +0 -0
  93. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/reference/hooks.md +0 -0
  94. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/reference/http-api.md +0 -0
  95. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/tests/integration/home.spec.ts +0 -0
  96. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/tests/integration/language-flag.spec.ts +0 -0
  97. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/tests/integration/sidebar.spec.ts +0 -0
  98. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/tests/unit/config.test.ts +0 -0
  99. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/tests/unit/lang.test.ts +0 -0
  100. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/docs/vitest.config.ts +0 -0
  101. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/src/lib.rs +0 -0
  102. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/tests/__init__.py +0 -0
  103. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/tests/conftest.py +0 -0
  104. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/tests/e2e/__init__.py +0 -0
  105. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/tests/integration/__init__.py +0 -0
  106. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/tests/integration/binding/__init__.py +0 -0
  107. {dirsql-0.3.95 → dirsql-0.3.97}/packages/python/tests/integration/hermetic/__init__.py +0 -0
  108. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/Cargo.toml +0 -0
  109. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/README.md +0 -0
  110. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/benches/db_bench.rs +0 -0
  111. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/benches/differ_bench.rs +0 -0
  112. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/benches/scanner_bench.rs +0 -0
  113. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/explanation.md +0 -0
  114. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/getting-started.md +0 -0
  115. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/columns-from-paths.md +0 -0
  116. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/embed.md +0 -0
  117. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/extract-from-contents.md +0 -0
  118. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/load-extension.md +0 -0
  119. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/persist.md +0 -0
  120. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/react-to-changes.md +0 -0
  121. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/search-by-meaning.md +0 -0
  122. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/howto/skip-files.md +0 -0
  123. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/index.md +0 -0
  124. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/migrations.md +0 -0
  125. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/reference/columns.md +0 -0
  126. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/reference/hooks.md +0 -0
  127. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/docs/reference/http-api.md +0 -0
  128. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/cli/execute.rs +0 -0
  129. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/cli/init.rs +0 -0
  130. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/cli/mod.rs +0 -0
  131. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/cli/router.rs +0 -0
  132. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/cli/serialize.rs +0 -0
  133. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/cli/server.rs +0 -0
  134. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/command.rs +0 -0
  135. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/config.rs +0 -0
  136. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/db.rs +0 -0
  137. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/default_config.toml +0 -0
  138. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/differ.rs +0 -0
  139. {dirsql-0.3.95 → dirsql-0.3.97}/packages/rust/src/watcher.rs +0 -0
  140. {dirsql-0.3.95 → dirsql-0.3.97}/pyproject.toml +0 -0
@@ -500,7 +500,7 @@ dependencies = [
500
500
 
501
501
  [[package]]
502
502
  name = "dirsql-py-ext"
503
- version = "0.3.95"
503
+ version = "0.3.97"
504
504
  dependencies = [
505
505
  "dirsql",
506
506
  "pyo3",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirsql
3
- Version: 0.3.95
3
+ Version: 0.3.97
4
4
  Summary: Ephemeral SQL index over a local directory
5
5
  Keywords: sql,filesystem,directory,sqlite,index
6
6
  Author: Kevin Scott
@@ -42,9 +42,10 @@ zero-config default — only the tables you define are served.
42
42
 
43
43
  ## Multiple tables
44
44
 
45
- Add one `[[table]]` entry per table. When a file matches several globs, the
46
- first matching table wins see [`[[table]]`](../reference/config.md#table)
47
- for that and the remaining keys (`strict`, `on-file`).
45
+ Add one `[[table]]` entry per table. When a file matches several globs, it
46
+ populates every matching table — each table is an independent view. See
47
+ [`[[table]]`](../reference/config.md#table) for that and the remaining keys
48
+ (`strict`, `on-file`).
48
49
 
49
50
  ## Going further
50
51
 
@@ -45,7 +45,7 @@ requests, closes open `/events` streams, and exits.
45
45
 
46
46
  | Flag | Default | Description |
47
47
  |---|---|---|
48
- | `-c, --config <path>` | `./.dirsql.toml` | Path to the [config file](./config.md). The index is always rooted at the **invocation directory** (the current working directory), regardless of where this file lives — so `--config /elsewhere/.dirsql.toml` still indexes the directory you ran `dirsql` from. When the file does not exist, the server runs in [zero-config mode](#zero-config-mode). |
48
+ | `-c, --config <path>` | `./.dirsql.toml` | Path to a [config file](./config.md). **Repeatable** (`-c a -c b`): the configs load and merge in argv order — see [Composing multiple configs](./config.md#composing-multiple-configs). The index is always rooted at the **invocation directory** (the current working directory), regardless of where a config lives — so `--config /elsewhere/.dirsql.toml` still indexes the directory you ran `dirsql` from. With none given, `./.dirsql.toml` is used; when it does not exist, the server runs in [zero-config mode](#zero-config-mode). |
49
49
  | `--host <addr>` | `localhost` | Bind address. |
50
50
  | `--port <n>` | `7117` | TCP port to bind. |
51
51
  | `--persist [<path>]` | off | Keep the SQLite index on disk between runs so a restart only re-parses files that actually changed. Bare `--persist` caches at `<root>/.dirsql/cache.db`; `--persist <path>` caches at `<path>`. Off by default (the index is ephemeral). Global — also honored by [`dirsql query`](#dirsql-query). See [Keep the index across restarts](../howto/persist.md). |
@@ -97,7 +97,7 @@ per-file command.
97
97
  | Key | Required | Description |
98
98
  |---|---|---|
99
99
  | `ddl` | yes | A SQLite `CREATE TABLE` statement. The table name is parsed from it. Only columns declared here are populated; auto-injected facts not in the DDL are dropped. |
100
- | `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures). First matching table wins when a file matches several globs. |
100
+ | `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures). Every table whose glob matches a file receives that file's rows — a file can populate multiple tables. |
101
101
  | `strict` | no (default `false`) | When `true`, rows whose keys do not exactly match the declared columns are rejected with an error: extra keys error, and every declared column must be supplied (by the command/extract output, a glob capture, or a stat column). When `false`, extra keys are dropped and missing columns become `NULL`. |
102
102
  | `on-file` | no | A command run once per matched file; its stdout (a JSON array of row objects) becomes the file's rows. Must be non-empty. See [Command hooks](./hooks.md#on-file). |
103
103
 
@@ -131,6 +131,38 @@ by the command wins over a same-named fact. Output that is not a JSON array
131
131
  of objects is a per-file failure: the file is skipped with a stderr warning
132
132
  and the scan continues (see [failure semantics](./hooks.md#failure-semantics)).
133
133
 
134
+ ## Composing multiple configs
135
+
136
+ Pass [`-c`/`--config`](./cli.md#flags) more than once to compose several config
137
+ files — a shared team config plus local overrides, or a plugin's config
138
+ alongside your own:
139
+
140
+ ```bash
141
+ dirsql -c ./.dirsql.toml -c ~/team/embeddings.toml -c ./local.toml
142
+ ```
143
+
144
+ The configs load and merge in **argv order**:
145
+
146
+ - **`[[table]]`, `ignore`, and `[[dirsql.extension]]` entries accumulate** across
147
+ all configs, in order.
148
+ - **Each config's `on-file`, `pre-query`, and `post-query` hooks run from that
149
+ config file's own directory**, under that config's own
150
+ [`hook-timeout`](#dirsql-keys) — so a relative command like
151
+ `on-file = "sh ./extract.sh"` resolves against the config that declared it,
152
+ wherever it lives.
153
+ - **`pre-query` / `post-query` hooks chain FIFO**: the request body flows through
154
+ each `pre-query` stage in order to the final SQL, and the result rows flow
155
+ through each `post-query` stage to the response. See the
156
+ [hook contract](./hooks.md).
157
+ - Each config is **validated on its own** (the [parse errors](#parse-errors)
158
+ below apply per file). There is no cross-file merge validation, with one
159
+ structural exception: **two configs defining a table of the same name is an
160
+ error**, naming the table.
161
+
162
+ The index [root](./cli.md#flags) is the invocation directory regardless of where
163
+ any config lives. With no `-c`, `./.dirsql.toml` is used; a single `-c` behaves
164
+ exactly as before.
165
+
134
166
  ## Parse errors
135
167
 
136
168
  Loading fails (the CLI enters [degraded mode](./cli.md#degraded-mode); the
@@ -318,7 +318,9 @@ Maps files to table rows.
318
318
  - `ddl` — A SQLite `CREATE TABLE` statement; the table name is parsed from
319
319
  it. Table names must be unique across all tables.
320
320
  - `glob` — Glob pattern matched against root-relative paths. May contain
321
- `{name}` [captures](./columns.md#glob-captures).
321
+ `{name}` [captures](./columns.md#glob-captures). Every table whose glob
322
+ matches a file receives that file's rows — a file can populate multiple
323
+ tables.
322
324
  - `extract` — Callback receiving the matched file's full path (the root
323
325
  joined with the file's relative path — absolute when `root` is absolute)
324
326
  and returning the rows that file contributes. `dirsql` never reads file
@@ -4,7 +4,7 @@ name = "dirsql-py-ext"
4
4
  # pypi/maturin handler can rewrite it via `write-version` before
5
5
  # `maturin build`. `pyproject.toml` declares `dynamic = ["version"]`
6
6
  # and maturin reads this field. Mirrors `packages/rust/Cargo.toml`.
7
- version = "0.3.95"
7
+ version = "0.3.97"
8
8
  # abi3 note: the `abi3-py311` pyo3 feature (below) builds ONE stable-ABI
9
9
  # `cp311-abi3` wheel per platform that loads on every CPython >= 3.11
10
10
  # (matching `pyproject.toml`'s `requires-python = ">=3.11"`), instead of
@@ -42,9 +42,10 @@ zero-config default — only the tables you define are served.
42
42
 
43
43
  ## Multiple tables
44
44
 
45
- Add one `[[table]]` entry per table. When a file matches several globs, the
46
- first matching table wins see [`[[table]]`](../reference/config.md#table)
47
- for that and the remaining keys (`strict`, `on-file`).
45
+ Add one `[[table]]` entry per table. When a file matches several globs, it
46
+ populates every matching table — each table is an independent view. See
47
+ [`[[table]]`](../reference/config.md#table) for that and the remaining keys
48
+ (`strict`, `on-file`).
48
49
 
49
50
  ## Going further
50
51
 
@@ -45,7 +45,7 @@ requests, closes open `/events` streams, and exits.
45
45
 
46
46
  | Flag | Default | Description |
47
47
  |---|---|---|
48
- | `-c, --config <path>` | `./.dirsql.toml` | Path to the [config file](./config.md). The index is always rooted at the **invocation directory** (the current working directory), regardless of where this file lives — so `--config /elsewhere/.dirsql.toml` still indexes the directory you ran `dirsql` from. When the file does not exist, the server runs in [zero-config mode](#zero-config-mode). |
48
+ | `-c, --config <path>` | `./.dirsql.toml` | Path to a [config file](./config.md). **Repeatable** (`-c a -c b`): the configs load and merge in argv order — see [Composing multiple configs](./config.md#composing-multiple-configs). The index is always rooted at the **invocation directory** (the current working directory), regardless of where a config lives — so `--config /elsewhere/.dirsql.toml` still indexes the directory you ran `dirsql` from. With none given, `./.dirsql.toml` is used; when it does not exist, the server runs in [zero-config mode](#zero-config-mode). |
49
49
  | `--host <addr>` | `localhost` | Bind address. |
50
50
  | `--port <n>` | `7117` | TCP port to bind. |
51
51
  | `--persist [<path>]` | off | Keep the SQLite index on disk between runs so a restart only re-parses files that actually changed. Bare `--persist` caches at `<root>/.dirsql/cache.db`; `--persist <path>` caches at `<path>`. Off by default (the index is ephemeral). Global — also honored by [`dirsql query`](#dirsql-query). See [Keep the index across restarts](../howto/persist.md). |
@@ -97,7 +97,7 @@ per-file command.
97
97
  | Key | Required | Description |
98
98
  |---|---|---|
99
99
  | `ddl` | yes | A SQLite `CREATE TABLE` statement. The table name is parsed from it. Only columns declared here are populated; auto-injected facts not in the DDL are dropped. |
100
- | `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures). First matching table wins when a file matches several globs. |
100
+ | `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures). Every table whose glob matches a file receives that file's rows — a file can populate multiple tables. |
101
101
  | `strict` | no (default `false`) | When `true`, rows whose keys do not exactly match the declared columns are rejected with an error: extra keys error, and every declared column must be supplied (by the command/extract output, a glob capture, or a stat column). When `false`, extra keys are dropped and missing columns become `NULL`. |
102
102
  | `on-file` | no | A command run once per matched file; its stdout (a JSON array of row objects) becomes the file's rows. Must be non-empty. See [Command hooks](./hooks.md#on-file). |
103
103
 
@@ -131,6 +131,38 @@ by the command wins over a same-named fact. Output that is not a JSON array
131
131
  of objects is a per-file failure: the file is skipped with a stderr warning
132
132
  and the scan continues (see [failure semantics](./hooks.md#failure-semantics)).
133
133
 
134
+ ## Composing multiple configs
135
+
136
+ Pass [`-c`/`--config`](./cli.md#flags) more than once to compose several config
137
+ files — a shared team config plus local overrides, or a plugin's config
138
+ alongside your own:
139
+
140
+ ```bash
141
+ dirsql -c ./.dirsql.toml -c ~/team/embeddings.toml -c ./local.toml
142
+ ```
143
+
144
+ The configs load and merge in **argv order**:
145
+
146
+ - **`[[table]]`, `ignore`, and `[[dirsql.extension]]` entries accumulate** across
147
+ all configs, in order.
148
+ - **Each config's `on-file`, `pre-query`, and `post-query` hooks run from that
149
+ config file's own directory**, under that config's own
150
+ [`hook-timeout`](#dirsql-keys) — so a relative command like
151
+ `on-file = "sh ./extract.sh"` resolves against the config that declared it,
152
+ wherever it lives.
153
+ - **`pre-query` / `post-query` hooks chain FIFO**: the request body flows through
154
+ each `pre-query` stage in order to the final SQL, and the result rows flow
155
+ through each `post-query` stage to the response. See the
156
+ [hook contract](./hooks.md).
157
+ - Each config is **validated on its own** (the [parse errors](#parse-errors)
158
+ below apply per file). There is no cross-file merge validation, with one
159
+ structural exception: **two configs defining a table of the same name is an
160
+ error**, naming the table.
161
+
162
+ The index [root](./cli.md#flags) is the invocation directory regardless of where
163
+ any config lives. With no `-c`, `./.dirsql.toml` is used; a single `-c` behaves
164
+ exactly as before.
165
+
134
166
  ## Parse errors
135
167
 
136
168
  Loading fails (the CLI enters [degraded mode](./cli.md#degraded-mode); the
@@ -318,7 +318,9 @@ Maps files to table rows.
318
318
  - `ddl` — A SQLite `CREATE TABLE` statement; the table name is parsed from
319
319
  it. Table names must be unique across all tables.
320
320
  - `glob` — Glob pattern matched against root-relative paths. May contain
321
- `{name}` [captures](./columns.md#glob-captures).
321
+ `{name}` [captures](./columns.md#glob-captures). Every table whose glob
322
+ matches a file receives that file's rows — a file can populate multiple
323
+ tables.
322
324
  - `extract` — Callback receiving the matched file's full path (the root
323
325
  joined with the file's relative path — absolute when `root` is absolute)
324
326
  and returning the rows that file contributes. `dirsql` never reads file
@@ -0,0 +1,7 @@
1
+ {
2
+ "command": "uv run python -m pytest tests/e2e/ -x -q",
3
+ "ran_at": 1783944230,
4
+ "exit_code": 0,
5
+ "commit": "f6b1948a6d2de0b769ca428a802f52899f85c4b9",
6
+ "branch": "claude/github-issue-580-d0jd9u"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "command": "uv run python -m pytest tests/e2e/ -x -q",
3
+ "ran_at": 1783946846,
4
+ "exit_code": 0,
5
+ "commit": "8b174e918f0319dc63df7931a20997ffec7cd132",
6
+ "branch": "claude/open-issues-review-le8hm5-red-547"
7
+ }
@@ -20,7 +20,7 @@ fn make_test_paths(count: usize) -> Vec<String> {
20
20
  }
21
21
 
22
22
  fn bench_match_file(c: &mut Criterion) {
23
- let mut group = c.benchmark_group("matcher/match_file");
23
+ let mut group = c.benchmark_group("matcher/match_all");
24
24
  for pattern_count in [1, 10, 50] {
25
25
  let matcher = make_matcher(pattern_count);
26
26
  let paths = make_test_paths(100);
@@ -30,7 +30,7 @@ fn bench_match_file(c: &mut Criterion) {
30
30
  |b, _| {
31
31
  b.iter(|| {
32
32
  for p in &paths {
33
- matcher.match_file(Path::new(p));
33
+ matcher.match_all(Path::new(p));
34
34
  }
35
35
  });
36
36
  },
@@ -42,9 +42,10 @@ zero-config default — only the tables you define are served.
42
42
 
43
43
  ## Multiple tables
44
44
 
45
- Add one `[[table]]` entry per table. When a file matches several globs, the
46
- first matching table wins see [`[[table]]`](../reference/config.md#table)
47
- for that and the remaining keys (`strict`, `on-file`).
45
+ Add one `[[table]]` entry per table. When a file matches several globs, it
46
+ populates every matching table — each table is an independent view. See
47
+ [`[[table]]`](../reference/config.md#table) for that and the remaining keys
48
+ (`strict`, `on-file`).
48
49
 
49
50
  ## Going further
50
51
 
@@ -45,7 +45,7 @@ requests, closes open `/events` streams, and exits.
45
45
 
46
46
  | Flag | Default | Description |
47
47
  |---|---|---|
48
- | `-c, --config <path>` | `./.dirsql.toml` | Path to the [config file](./config.md). The index is always rooted at the **invocation directory** (the current working directory), regardless of where this file lives — so `--config /elsewhere/.dirsql.toml` still indexes the directory you ran `dirsql` from. When the file does not exist, the server runs in [zero-config mode](#zero-config-mode). |
48
+ | `-c, --config <path>` | `./.dirsql.toml` | Path to a [config file](./config.md). **Repeatable** (`-c a -c b`): the configs load and merge in argv order — see [Composing multiple configs](./config.md#composing-multiple-configs). The index is always rooted at the **invocation directory** (the current working directory), regardless of where a config lives — so `--config /elsewhere/.dirsql.toml` still indexes the directory you ran `dirsql` from. With none given, `./.dirsql.toml` is used; when it does not exist, the server runs in [zero-config mode](#zero-config-mode). |
49
49
  | `--host <addr>` | `localhost` | Bind address. |
50
50
  | `--port <n>` | `7117` | TCP port to bind. |
51
51
  | `--persist [<path>]` | off | Keep the SQLite index on disk between runs so a restart only re-parses files that actually changed. Bare `--persist` caches at `<root>/.dirsql/cache.db`; `--persist <path>` caches at `<path>`. Off by default (the index is ephemeral). Global — also honored by [`dirsql query`](#dirsql-query). See [Keep the index across restarts](../howto/persist.md). |
@@ -97,7 +97,7 @@ per-file command.
97
97
  | Key | Required | Description |
98
98
  |---|---|---|
99
99
  | `ddl` | yes | A SQLite `CREATE TABLE` statement. The table name is parsed from it. Only columns declared here are populated; auto-injected facts not in the DDL are dropped. |
100
- | `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures). First matching table wins when a file matches several globs. |
100
+ | `glob` | yes | Glob pattern matched against root-relative paths. May contain `{name}` [capture segments](./columns.md#glob-captures). Every table whose glob matches a file receives that file's rows — a file can populate multiple tables. |
101
101
  | `strict` | no (default `false`) | When `true`, rows whose keys do not exactly match the declared columns are rejected with an error: extra keys error, and every declared column must be supplied (by the command/extract output, a glob capture, or a stat column). When `false`, extra keys are dropped and missing columns become `NULL`. |
102
102
  | `on-file` | no | A command run once per matched file; its stdout (a JSON array of row objects) becomes the file's rows. Must be non-empty. See [Command hooks](./hooks.md#on-file). |
103
103
 
@@ -131,6 +131,38 @@ by the command wins over a same-named fact. Output that is not a JSON array
131
131
  of objects is a per-file failure: the file is skipped with a stderr warning
132
132
  and the scan continues (see [failure semantics](./hooks.md#failure-semantics)).
133
133
 
134
+ ## Composing multiple configs
135
+
136
+ Pass [`-c`/`--config`](./cli.md#flags) more than once to compose several config
137
+ files — a shared team config plus local overrides, or a plugin's config
138
+ alongside your own:
139
+
140
+ ```bash
141
+ dirsql -c ./.dirsql.toml -c ~/team/embeddings.toml -c ./local.toml
142
+ ```
143
+
144
+ The configs load and merge in **argv order**:
145
+
146
+ - **`[[table]]`, `ignore`, and `[[dirsql.extension]]` entries accumulate** across
147
+ all configs, in order.
148
+ - **Each config's `on-file`, `pre-query`, and `post-query` hooks run from that
149
+ config file's own directory**, under that config's own
150
+ [`hook-timeout`](#dirsql-keys) — so a relative command like
151
+ `on-file = "sh ./extract.sh"` resolves against the config that declared it,
152
+ wherever it lives.
153
+ - **`pre-query` / `post-query` hooks chain FIFO**: the request body flows through
154
+ each `pre-query` stage in order to the final SQL, and the result rows flow
155
+ through each `post-query` stage to the response. See the
156
+ [hook contract](./hooks.md).
157
+ - Each config is **validated on its own** (the [parse errors](#parse-errors)
158
+ below apply per file). There is no cross-file merge validation, with one
159
+ structural exception: **two configs defining a table of the same name is an
160
+ error**, naming the table.
161
+
162
+ The index [root](./cli.md#flags) is the invocation directory regardless of where
163
+ any config lives. With no `-c`, `./.dirsql.toml` is used; a single `-c` behaves
164
+ exactly as before.
165
+
134
166
  ## Parse errors
135
167
 
136
168
  Loading fails (the CLI enters [degraded mode](./cli.md#degraded-mode); the
@@ -318,7 +318,9 @@ Maps files to table rows.
318
318
  - `ddl` — A SQLite `CREATE TABLE` statement; the table name is parsed from
319
319
  it. Table names must be unique across all tables.
320
320
  - `glob` — Glob pattern matched against root-relative paths. May contain
321
- `{name}` [captures](./columns.md#glob-captures).
321
+ `{name}` [captures](./columns.md#glob-captures). Every table whose glob
322
+ matches a file receives that file's rows — a file can populate multiple
323
+ tables.
322
324
  - `extract` — Callback receiving the matched file's full path (the root
323
325
  joined with the file's relative path — absolute when `root` is absolute)
324
326
  and returning the rows that file contributes. `dirsql` never reads file
@@ -33,12 +33,15 @@ struct Cli {
33
33
  #[command(subcommand)]
34
34
  command: Option<Command>,
35
35
 
36
- /// Path to the config file (default: `./.dirsql.toml`). The index is
37
- /// rooted at the invocation directory (cwd), not this file's location
38
- /// (#540). When the file does not exist, a default `files` table is
39
- /// served. Used by server mode and by the `query` subcommand.
40
- #[arg(short = 'c', long, default_value = "./.dirsql.toml", global = true)]
41
- config: PathBuf,
36
+ /// Path to a config file. **Repeatable** (`-c a -c b`): the configs load
37
+ /// and merge in argv order -- their `[[table]]`, `ignore`, and
38
+ /// `[[dirsql.extension]]` entries accumulate, and their `pre-query` /
39
+ /// `post-query` hooks chain FIFO. With none given, `./.dirsql.toml` is used;
40
+ /// when that file does not exist, a default `files` table is served. The
41
+ /// index is rooted at the invocation directory (cwd), not a config's
42
+ /// location (#540). Used by server mode and by the `query` subcommand.
43
+ #[arg(short = 'c', long, global = true)]
44
+ config: Vec<PathBuf>,
42
45
 
43
46
  /// Bind address. Used when no subcommand is given.
44
47
  #[arg(long, default_value = "localhost")]
@@ -80,6 +83,16 @@ impl Cli {
80
83
  }
81
84
  builder
82
85
  }
86
+
87
+ /// The effective config paths: those passed via `-c`/`--config`, or the
88
+ /// single default `./.dirsql.toml` when none were given.
89
+ fn config_paths(&self) -> Vec<PathBuf> {
90
+ if self.config.is_empty() {
91
+ vec![PathBuf::from("./.dirsql.toml")]
92
+ } else {
93
+ self.config.clone()
94
+ }
95
+ }
83
96
  }
84
97
 
85
98
  #[derive(Debug, Subcommand)]
@@ -138,8 +151,8 @@ async fn main() -> ExitCode {
138
151
  /// stderr with a non-zero exit.
139
152
  async fn run_query(cli: &Cli, args: QueryArgs) -> ExitCode {
140
153
  let state = load_state(cli);
141
- let pre_query: Vec<PreQuery> = load_pre_query(cli).into_iter().collect();
142
- let post_query: Vec<PostQuery> = load_post_query(cli).into_iter().collect();
154
+ let pre_query = load_pre_queries(cli);
155
+ let post_query = load_post_queries(cli);
143
156
  // Same default the server binds with; the pipeline enforces it.
144
157
  let timeout = ServerConfig::default().query_timeout;
145
158
 
@@ -200,10 +213,10 @@ fn run_init(args: InitArgs) -> ExitCode {
200
213
  async fn run_server(cli: Cli) -> ExitCode {
201
214
  let state = load_state(&cli);
202
215
  let mut server_config = ServerConfig::bind(cli.host.clone(), cli.port);
203
- if let Some(pre_query) = load_pre_query(&cli) {
216
+ for pre_query in load_pre_queries(&cli) {
204
217
  server_config = server_config.with_pre_query(pre_query);
205
218
  }
206
- if let Some(post_query) = load_post_query(&cli) {
219
+ for post_query in load_post_queries(&cli) {
207
220
  server_config = server_config.with_post_query(post_query);
208
221
  }
209
222
 
@@ -231,33 +244,38 @@ async fn run_server(cli: Cli) -> ExitCode {
231
244
  }
232
245
 
233
246
  fn load_state(cli: &Cli) -> AppState {
234
- let config_path = &cli.config;
235
- if !config_path.exists() {
236
- // No config: serve a default `files` table so dirsql is queryable
237
- // out of the box. A config file, when present, fully overrules this.
238
- return load_default_state(cli, config_path);
247
+ let configs = cli.config_paths();
248
+
249
+ // Zero-config default: no `-c` was given and the implicit `./.dirsql.toml`
250
+ // is absent -> serve a default `files` table so dirsql is queryable out of
251
+ // the box. An explicitly-passed config that is missing degrades below.
252
+ if cli.config.is_empty() && !configs[0].exists() {
253
+ return load_default_state(cli, &configs[0]);
239
254
  }
240
255
 
241
- // Canonicalize so config-relative paths (extension libraries, hook
242
- // working directories) resolve against an absolute parent — `notify` and
243
- // the hook subprocesses misbehave with relative paths like `./`. The
244
- // index root itself is the invocation cwd (#540), not derived from here.
245
- let resolved = match config_path.canonicalize() {
246
- Ok(p) => p,
247
- Err(err) => {
248
- return AppState::Unavailable(format!(
249
- "failed to resolve {}: {err}",
250
- config_path.display()
251
- ));
252
- }
253
- };
256
+ let mut builder = DirSQL::builder();
257
+ for config_path in &configs {
258
+ // Canonicalize so config-relative paths (extension libraries, hook
259
+ // working directories) resolve against an absolute parent `notify`
260
+ // and the hook subprocesses misbehave with relative paths like `./`.
261
+ // The index root itself is the invocation cwd (#540), not derived here.
262
+ let resolved = match config_path.canonicalize() {
263
+ Ok(p) => p,
264
+ Err(err) => {
265
+ return AppState::Unavailable(format!(
266
+ "failed to resolve {}: {err}",
267
+ config_path.display()
268
+ ));
269
+ }
270
+ };
271
+ builder = builder.config(resolved);
272
+ }
254
273
 
255
- // Launcher-resolved extensions (`--extension`) override the TOML config's
256
- // own `[[dirsql.extension]]` entries: the launcher has already merged and
274
+ // Launcher-resolved extensions (`--extension`) override the configs' own
275
+ // `[[dirsql.extension]]` entries: the launcher has already merged and
257
276
  // resolved them (including package names the compiled binary can't
258
- // resolve), so suppress the config's extension loading and supply the
259
- // resolved literal paths instead.
260
- let mut builder = DirSQL::builder().config(&resolved);
277
+ // resolve), so suppress config extension loading and supply the resolved
278
+ // literal paths instead.
261
279
  if !cli.extension.is_empty() {
262
280
  builder = builder
263
281
  .extensions(parse_extension_specs(&cli.extension))
@@ -290,51 +308,70 @@ fn parse_extension_specs(specs: &[String]) -> Vec<Extension> {
290
308
  .collect()
291
309
  }
292
310
 
293
- /// Extract the server-wide `pre-query` hook from the config, if any.
311
+ /// Collect the `pre-query` hooks declared across the configs, in argv order,
312
+ /// so the server chains them FIFO (#546/#547).
294
313
  ///
295
- /// Returns `None` when the config is absent, unresolvable, unparsable, or
296
- /// declares no `pre-query` the server then parses `POST /query` bodies as
297
- /// `{"sql": …}` (the degraded / zero-config paths never get a hook). The
298
- /// command's working directory is the config file's parent, mirroring the
299
- /// `on-file` contract. Config resolution mirrors [`load_state`]: a config that
300
- /// fails here also fails there (leaving the server degraded), so the hook is
301
- /// simply skipped.
302
- fn load_pre_query(cli: &Cli) -> Option<PreQuery> {
303
- let config_path = &cli.config;
304
- if !config_path.exists() {
305
- return None;
306
- }
307
- let resolved = config_path.canonicalize().ok()?;
308
- let config = dirsql::config::load_config(&resolved).ok()?;
309
- let command = config.pre_query?;
310
- let config_dir = resolved.parent()?.to_path_buf();
311
- let mut pre_query = PreQuery::new(command, config_dir);
312
- if let Some(timeout) = config.hook_timeout {
313
- pre_query = pre_query.with_timeout(timeout);
314
+ /// Each config contributes at most one `pre-query`; a config that is absent,
315
+ /// unresolvable, unparsable, or declares none is skipped (its load failure
316
+ /// degrades the index in [`load_state`], so the hook is simply omitted here).
317
+ /// Each hook's working directory is its own config file's parent, mirroring
318
+ /// the `on-file` contract, and it carries that config's `hook-timeout`.
319
+ fn load_pre_queries(cli: &Cli) -> Vec<PreQuery> {
320
+ let mut hooks = Vec::new();
321
+ for config_path in &cli.config_paths() {
322
+ if !config_path.exists() {
323
+ continue;
324
+ }
325
+ let Ok(resolved) = config_path.canonicalize() else {
326
+ continue;
327
+ };
328
+ let Ok(config) = dirsql::config::load_config(&resolved) else {
329
+ continue;
330
+ };
331
+ let Some(command) = config.pre_query else {
332
+ continue;
333
+ };
334
+ let Some(parent) = resolved.parent() else {
335
+ continue;
336
+ };
337
+ let mut pre_query = PreQuery::new(command, parent.to_path_buf());
338
+ if let Some(timeout) = config.hook_timeout {
339
+ pre_query = pre_query.with_timeout(timeout);
340
+ }
341
+ hooks.push(pre_query);
314
342
  }
315
- Some(pre_query)
343
+ hooks
316
344
  }
317
345
 
318
- /// Extract the server-wide `post-query` hook from the config, if any.
319
- ///
320
- /// Returns `None` when the config is absent, unresolvable, unparsable, or
321
- /// declares no `post-query` the server then returns `POST /query` result rows
322
- /// as-is (the degraded / zero-config paths never get a hook). The command's
323
- /// working directory is the config file's parent, mirroring [`load_pre_query`].
324
- fn load_post_query(cli: &Cli) -> Option<PostQuery> {
325
- let config_path = &cli.config;
326
- if !config_path.exists() {
327
- return None;
328
- }
329
- let resolved = config_path.canonicalize().ok()?;
330
- let config = dirsql::config::load_config(&resolved).ok()?;
331
- let command = config.post_query?;
332
- let config_dir = resolved.parent()?.to_path_buf();
333
- let mut post_query = PostQuery::new(command, config_dir);
334
- if let Some(timeout) = config.hook_timeout {
335
- post_query = post_query.with_timeout(timeout);
346
+ /// Collect the `post-query` hooks declared across the configs, in argv order,
347
+ /// so the server chains them FIFO. Mirrors [`load_pre_queries`]: one hook per
348
+ /// config, skipped when absent/unloadable, each running from its own config's
349
+ /// parent under its own `hook-timeout`.
350
+ fn load_post_queries(cli: &Cli) -> Vec<PostQuery> {
351
+ let mut hooks = Vec::new();
352
+ for config_path in &cli.config_paths() {
353
+ if !config_path.exists() {
354
+ continue;
355
+ }
356
+ let Ok(resolved) = config_path.canonicalize() else {
357
+ continue;
358
+ };
359
+ let Ok(config) = dirsql::config::load_config(&resolved) else {
360
+ continue;
361
+ };
362
+ let Some(command) = config.post_query else {
363
+ continue;
364
+ };
365
+ let Some(parent) = resolved.parent() else {
366
+ continue;
367
+ };
368
+ let mut post_query = PostQuery::new(command, parent.to_path_buf());
369
+ if let Some(timeout) = config.hook_timeout {
370
+ post_query = post_query.with_timeout(timeout);
371
+ }
372
+ hooks.push(post_query);
336
373
  }
337
- Some(post_query)
374
+ hooks
338
375
  }
339
376
 
340
377
  /// Zero-config fallback. When no `.dirsql.toml` is found, dirsql indexes the