feat(cli): add CLI scaffold, app bootstrap, daemon, and shared libraries#670
Merged
Conversation
Member
Author
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
52f7269 to
2d96711
Compare
This was referenced May 6, 2026
There was a problem hiding this comment.
Pull request overview
Adds the initial CLI + daemon runtime scaffold for Sia Storage, including IPC transport, background worker scheduling, and node-side database lifecycle support (finalize/close), plus repo-level scripts and dependency wiring to build and test the new CLI app.
Changes:
- Extend the core
DatabaseAdaptercontract with optional lifecycle hooks (finalize,close) and implement them in node adapters. - Introduce
apps/cliscaffold: bootstrap wiring, daemon lifecycle/scheduler, Unix-socket IPC server + client helpers, and basic CLI entrypoint. - Add supporting scripts/config (root
package.jsonscripts, CLI tsconfig/jest config, changeset, lockfile updates).
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/node-adapters/src/database.ts | better-sqlite3 adapter: expose finalize() and adjust adapter typing |
| packages/node-adapters/src/bunDatabase.ts | bun:sqlite adapter: expose finalize() and adjust adapter typing |
| packages/core/src/db/operations/test-setup.ts | Test DB setup/teardown updated for optional close() |
| packages/core/src/adapters/db.ts | DatabaseAdapter docs + optional lifecycle methods (finalize, close) |
| package.json | Add root scripts for building/linking CLI |
| bun.lock | Lockfile updates for new CLI deps and version bumps |
| apps/integration/test/fs-eviction.test.ts | Fix ArrayBuffer write payload construction for test FS writes |
| apps/integration/test/app.ts | Adjust test database wrapper for optional close() typing |
| apps/cli/tsconfig.json | CLI TypeScript config + workspace path mappings |
| apps/cli/test/e2e/setup.ts | Placeholder E2E setup file (future PR hook) |
| apps/cli/test/mocks/bun-sqlite.ts | Jest runtime stub for bun:sqlite in tests |
| apps/cli/test/mocks/@siafoundation/sia-storage.ts | Jest runtime stubs for SDK bindings during tests |
| apps/cli/src/testMode.ts | Test-mode bootstrap using Mock SDK and stubbed auth adapters |
| apps/cli/src/lib/resolveFile.ts | Utility to resolve a file by id/path/name for CLI commands |
| apps/cli/src/lib/normalizePath.ts | Path normalization helper for CLI argument parsing |
| apps/cli/src/lib/ingestFile.ts | Disk-to-library ingestion helper (stream copy + sha256 + DB record) |
| apps/cli/src/lib/format.ts | CLI formatting helpers (colors, bytes/date formatting, table/progress) |
| apps/cli/src/lib/appServiceClient.ts | IPC-backed AppService client factory for CLI ↔ daemon |
| apps/cli/src/index.ts | CLI entrypoint + daemon mode fork via env flag |
| apps/cli/src/daemon/supervisor.ts | Ensure daemon running + IPC command helper |
| apps/cli/src/daemon/spawn.ts | Spawn detached daemon process with log redirection |
| apps/cli/src/daemon/scheduler.ts | Interval-based background service scheduler initialization |
| apps/cli/src/daemon/lifecycle.ts | Lock acquisition + signal handling + graceful shutdown sequence |
| apps/cli/src/daemon/ipc/upload.ts | IPC handlers for upload + upload state queries |
| apps/cli/src/daemon/ipc/status.ts | IPC handlers for ping/status/shutdown |
| apps/cli/src/daemon/ipc/index.ts | IPC dispatcher wiring + AppService method reflection |
| apps/cli/src/daemon/entry.ts | Daemon startup orchestration (bootstrap, scheduler, IPC, signals) |
| apps/cli/src/app.ts | CLI app factory/bootstrap wiring (DB/storage/secrets/sdk/uploader/etc.) |
| apps/cli/package.json | CLI package metadata, scripts, and dependencies |
| apps/cli/jest.config.cjs | Jest multi-project config (unit + e2e) with module mapping |
| .changeset/cli-scaffold-daemon.md | Changeset documenting the new CLI/daemon scaffold |
Comments suppressed due to low confidence (1)
packages/core/src/db/operations/test-setup.ts:10
_dbis declared as a non-nullableDatabaseAdapterbut is uninitialized untilsetupTestDb()runs. This makesdb()’s signature unsound (it can returnundefinedat runtime) and leads to awkward optional chaining in teardown. Consider declaring_dbasDatabaseAdapter | undefined(or| null) and updatingdb()to either throw if called before setup or return an optional type.
let _db: DatabaseAdapter
export function db(): DatabaseAdapter {
return _db
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b476d53 to
d14eb29
Compare
telestrial
approved these changes
May 8, 2026
d14eb29 to
dadb90c
Compare
Member
Author
Merge activity
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds the cli/daemon runtime foundation that runs sync, thumbnail, optimize, trash-purge, and log-rotation workers on a scheduler, exposed over a Unix-socket IPC server. A CliApp factory wires SQLite, fsIO, secrets, and the SDK; daemon entry is split into lifecycle, scheduler, and ipc/* modules.