A simple command-line tool to start NetBSD virtual machines using QEMU with sensible defaults.

Refactor project structure and enhance type definitions; update installation command in README, add mod.ts for exports, and improve type annotations in context and db modules

+21 -8
+1 -1
README.md
··· 45 45 Run the following command to install the CLI: 46 46 47 47 ```bash 48 - deno install -A -g -r -f --config deno.json ./main.ts -n netbsd-up 48 + deno install -A -g -r -f jsr:@tsiry/netbsd-up 49 49 ``` 50 50 51 51 ## 🎯 Usage
+4
deno.json
··· 1 1 { 2 + "name": "@tsiry/netbsd-up", 3 + "version": "0.1.0", 4 + "exports": "./main.ts", 5 + "license": "MPL-2.0", 2 6 "tasks": { 3 7 "dev": "deno run --watch main.ts" 4 8 },
+4 -2
main.ts
··· 16 16 runQemu, 17 17 } from "./src/utils.ts"; 18 18 19 + export * from "./src/mod.ts"; 20 + 19 21 if (import.meta.main) { 20 22 await new Command() 21 23 .name("netbsd-up") ··· 120 122 }) 121 123 .command("ps", "List all virtual machines") 122 124 .option("--all, -a", "Show all virtual machines, including stopped ones") 123 - .action(async (options: { all: boolean }) => { 124 - await ps(options.all); 125 + .action(async (options: { all?: unknown }) => { 126 + await ps(Boolean(options.all)); 125 127 }) 126 128 .command("start", "Start a virtual machine") 127 129 .arguments("<vm-name:string>")
+2 -2
src/constants.ts
··· 1 - export const CONFIG_DIR = `${Deno.env.get("HOME")}/.netbsd-up`; 2 - export const DB_PATH = `${CONFIG_DIR}/state.sqlite`; 1 + export const CONFIG_DIR: string = `${Deno.env.get("HOME")}/.netbsd-up`; 2 + export const DB_PATH: string = `${CONFIG_DIR}/state.sqlite`;
+2 -2
src/context.ts
··· 1 1 import { DB_PATH } from "./constants.ts"; 2 - import { createDb, migrateToLatest } from "./db.ts"; 2 + import { createDb, type Database, migrateToLatest } from "./db.ts"; 3 3 4 - export const db = createDb(DB_PATH); 4 + export const db: Database = createDb(DB_PATH); 5 5 await migrateToLatest(db); 6 6 7 7 export const ctx = {
+1 -1
src/db.ts
··· 87 87 }, 88 88 }; 89 89 90 - export const migrateToLatest = async (db: Database) => { 90 + export const migrateToLatest = async (db: Database): Promise<void> => { 91 91 const migrator = new Migrator({ db, provider: migrationProvider }); 92 92 const { error } = await migrator.migrateToLatest(); 93 93 if (error) throw error;
+7
src/mod.ts
··· 1 + export * from "./constants.ts"; 2 + export * from "./context.ts"; 3 + export * from "./db.ts"; 4 + export * from "./network.ts"; 5 + export * from "./state.ts"; 6 + export * from "./types.ts"; 7 + export * from "./utils.ts";