Skip to content

Commit ab7f0ee

Browse files
vkuttypclaude
andcommitted
release: 2.5.0 — cosmokv CLI + schema introspection
New dotnet global tool `cosmokv` (CosmoSQLClient.CosmoKv.Cli) gives an sqlite3-style shell to any CosmoKv database: REPL, one-shot SQL, stdin scripts, four output formats (table/csv/tsv/json), and dot-commands for .tables / .schema / .indexes / .dump / .format. To make the CLI possible without exposing internal schema types, the driver gains a small public introspection surface on CosmoKvConnection: GetTableNames(), GetTableScript(name), GetIndexScriptsForTable(name), ScriptSchema(). Output round-trips through the parser, so .dump output is safe to replay against an empty CosmoKv. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1ee0f7e commit ab7f0ee

11 files changed

Lines changed: 959 additions & 1 deletion

File tree

.github/workflows/nuget.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ jobs:
8888
-p:Version=${{ steps.version.outputs.VERSION }} \
8989
-o ./nupkgs
9090
91+
dotnet pack src/CosmoSQLClient.CosmoKv.Cli/CosmoSQLClient.CosmoKv.Cli.csproj \
92+
-c Release \
93+
-p:Version=${{ steps.version.outputs.VERSION }} \
94+
-o ./nupkgs
95+
9196
ls -la ./nupkgs
9297
9398
- name: Push to NuGet

CosmoSQLClient-Dotnet.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CosmoSQLClient.CosmoKv.Test
4141
EndProject
4242
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CosmoSQLClient.CosmoKvHttp", "src\CosmoSQLClient.CosmoKvHttp\CosmoSQLClient.CosmoKvHttp.csproj", "{89630EF9-0FE4-4C0C-A858-798CDCE700E3}"
4343
EndProject
44+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CosmoSQLClient.CosmoKv.Cli", "src\CosmoSQLClient.CosmoKv.Cli\CosmoSQLClient.CosmoKv.Cli.csproj", "{520F292D-D5B8-415F-84DD-B3072EBBBE63}"
45+
EndProject
4446
Global
4547
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4648
Debug|Any CPU = Debug|Any CPU
@@ -255,6 +257,18 @@ Global
255257
{89630EF9-0FE4-4C0C-A858-798CDCE700E3}.Release|x64.Build.0 = Release|Any CPU
256258
{89630EF9-0FE4-4C0C-A858-798CDCE700E3}.Release|x86.ActiveCfg = Release|Any CPU
257259
{89630EF9-0FE4-4C0C-A858-798CDCE700E3}.Release|x86.Build.0 = Release|Any CPU
260+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
261+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Debug|Any CPU.Build.0 = Debug|Any CPU
262+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Debug|x64.ActiveCfg = Debug|Any CPU
263+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Debug|x64.Build.0 = Debug|Any CPU
264+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Debug|x86.ActiveCfg = Debug|Any CPU
265+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Debug|x86.Build.0 = Debug|Any CPU
266+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Release|Any CPU.ActiveCfg = Release|Any CPU
267+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Release|Any CPU.Build.0 = Release|Any CPU
268+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Release|x64.ActiveCfg = Release|Any CPU
269+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Release|x64.Build.0 = Release|Any CPU
270+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Release|x86.ActiveCfg = Release|Any CPU
271+
{520F292D-D5B8-415F-84DD-B3072EBBBE63}.Release|x86.Build.0 = Release|Any CPU
258272
EndGlobalSection
259273
GlobalSection(SolutionProperties) = preSolution
260274
HideSolutionNode = FALSE
@@ -277,5 +291,6 @@ Global
277291
{63463845-4079-4171-ABE3-525606D36AB6} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
278292
{65E8881F-CEEC-4085-84DC-7BBFDE746E43} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
279293
{89630EF9-0FE4-4C0C-A858-798CDCE700E3} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
294+
{520F292D-D5B8-415F-84DD-B3072EBBBE63} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
280295
EndGlobalSection
281296
EndGlobal

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<Authors>vkuttyp</Authors>
88
<PackageLicenseExpression>MIT</PackageLicenseExpression>
99
<RepositoryUrl>https://github.com/vkuttyp/CosmoSQLClient-Dotnet</RepositoryUrl>
10-
<Version>2.4.0</Version>
10+
<Version>2.5.0</Version>
1111
</PropertyGroup>
1212
</Project>

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ A lightweight, high-performance database client library for .NET designed for lo
1313
| `CosmoSQLClient.Sqlite` | [![NuGet](https://img.shields.io/nuget/v/CosmoSQLClient.Sqlite.svg)](https://www.nuget.org/packages/CosmoSQLClient.Sqlite/) |
1414
| `CosmoSQLClient.CosmoKv` | [![NuGet](https://img.shields.io/nuget/v/CosmoSQLClient.CosmoKv.svg)](https://www.nuget.org/packages/CosmoSQLClient.CosmoKv/) |
1515
| `CosmoSQLClient.CosmoKvHttp` | [![NuGet](https://img.shields.io/nuget/v/CosmoSQLClient.CosmoKvHttp.svg)](https://www.nuget.org/packages/CosmoSQLClient.CosmoKvHttp/) |
16+
| `CosmoSQLClient.CosmoKv.Cli` *(dotnet tool: `cosmokv`)* | [![NuGet](https://img.shields.io/nuget/v/CosmoSQLClient.CosmoKv.Cli.svg)](https://www.nuget.org/packages/CosmoSQLClient.CosmoKv.Cli/) |
1617
| `CosmoSQLClient.MsSql.EntityFrameworkCore` | [![NuGet](https://img.shields.io/nuget/v/CosmoSQLClient.MsSql.EntityFrameworkCore.svg)](https://www.nuget.org/packages/CosmoSQLClient.MsSql.EntityFrameworkCore/) |
1718
| `CosmoSQLClient.Postgres.EntityFrameworkCore` | [![NuGet](https://img.shields.io/nuget/v/CosmoSQLClient.Postgres.EntityFrameworkCore.svg)](https://www.nuget.org/packages/CosmoSQLClient.Postgres.EntityFrameworkCore/) |
1819
| `CosmoSQLClient.MySql.EntityFrameworkCore` | [![NuGet](https://img.shields.io/nuget/v/CosmoSQLClient.MySql.EntityFrameworkCore.svg)](https://www.nuget.org/packages/CosmoSQLClient.MySql.EntityFrameworkCore/) |
@@ -171,6 +172,25 @@ services.AddDbContext<AppDbContext>(options =>
171172
options.UseCosmoSqlite("Data Source=sales.db"));
172173
```
173174

175+
## CLI: `cosmokv`
176+
177+
A `sqlite3`-style shell for CosmoKv embedded databases — REPL, one-shot SQL, stdin scripts, and four output formats. Ships as a dotnet global tool.
178+
179+
```bash
180+
dotnet tool install -g CosmoSQLClient.CosmoKv.Cli
181+
```
182+
183+
```bash
184+
cosmokv ./mydb # REPL
185+
cosmokv ./mydb "SELECT * FROM Users" # one-shot
186+
cat schema.sql | cosmokv ./mydb - # stdin script
187+
cosmokv --format=json ./mydb "SELECT * FROM Users" # JSON output
188+
```
189+
190+
REPL dot-commands cover the usual introspection surface (`.tables`, `.schema [TABLE]`, `.indexes [TABLE]`, `.dump`, `.format FMT`, `.quit`). Full reference: [`src/CosmoSQLClient.CosmoKv.Cli/README.md`](src/CosmoSQLClient.CosmoKv.Cli/README.md).
191+
192+
The introspection used by `.schema` / `.dump` is also available programmatically from v2.5 — `CosmoKvConnection.GetTableNames()`, `GetTableScript(name)`, `GetIndexScriptsForTable(name)`, `ScriptSchema()` — so you can build your own dump/backup tooling without going through the CLI.
193+
174194
## Technical Architecture
175195

176196
### Zero-Allocation Pipeline

0 commit comments

Comments
 (0)