Conversation
…gs (#67) * refactor(logging): Standardize cross-process log handling and improve UI Introduces a centralized logging mechanism to forward log entries generated by workers to the main process. This ensures all application logs are consistently processed and displayed. - **Logger:** Made `Logger.emitLogEntry` public and enhanced it to accept metadata for accurate log re-emission from various sources. Added a visual indicator for log hooks in formatted messages. - **Docker Client:** - Implemented `WorkerLogger` in `docker-client` workers to proxy log entries via a new `__log__` event. - The `docker-client` manager now listens for and re-emits `__log__` events through the main logger. - Refactored worker-related types (`InboundMessage`, `InitMessage`, `MetricsMessage`) and utility functions (`tryBuildFromProxy`) into dedicated shared files for better organization. - **Typings:** Defined `LogLevel`, `LogEntry` types, and added the `__log__` event to the `EVENTS` interface to support structured log forwarding. - **UI:** Updated the `Sidebar` to display the unified log stream with improved formatting, including colored log levels, badges for logger names/request IDs, and a new `log` timestamp format. - **Utils:** Added a new `log` format to `formatDate` and standardized the default locale for date formatting to `de-DE`. - **Dependencies:** Upgraded `@dockstat/docker-client` to `2.0.0` and numerous other dependencies (e.g., `framer-motion`, `react-router`, `@types/node`) to their latest patch/minor versions. - **Cleanup:** Removed a debug `console.log` statement from `plugin-handler`. * refactor(logging, client): improve logging detail and worker robustness Update .env.example with refined default logger configurations to reduce noise and focus on `PluginHandler` messages. Forward `requestId` within `__log__` events to enhance log correlation. Strengthen worker initialization checks by explicitly verifying `message.success`. Streamline event typings by removing `workerLoggerResponse`. Includes minor import reordering and variable name correction for consistency.
* chore(api): Add startup animation, logger config, and API dev script (#63) * docs: sync from Outline * [ImgBot] Optimize images *Total -- 389.34kb -> 261.94kb (32.72%) /.github/assets/logos/square.png -- 81.10kb -> 20.42kb (74.82%) /.github/assets/gifs/DockStatAPI-startup.gif -- 306.82kb -> 240.10kb (21.74%) /packages/ui/public/vite.svg -- 1.42kb -> 1.42kb (0.07%) Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com> * chore(assets): Add and organize GitHub assets, update README logo --------- Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com> Co-authored-by: ItsNik <info@itsnik.de> Co-authored-by: Its4Nik <106100177+Its4Nik@users.noreply.github.com> Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
* refactor(data): Implement useEdenQuery/Mutation hooks for data fetching
- Introduced `useEdenQuery` and `useEdenMutation` to streamline API interaction with `@elysiajs/eden`.
- Centralized common data fetching patterns including error handling, automatic query invalidation, and toast notifications.
- Removed deprecated `lib/actions` and `lib/queries` directories; their functionalities are now integrated into the new hooks.
- Refactored all major components and pages (`AddClient`, `AddHost`, `PluginBrowser`, `Layout`, client and extension pages) to utilize the new data hooks.
- Consolidated `AdditionalSettingsContext` into a unified `ConfigProviderContext` for better state management.
- Enhanced `PluginHandler` to improve plugin security verification, including explicit checks for DVA connectivity.
- Added `RepoCard` component and `RepoIcons` for improved repository UI.
- Updated `installPluginBody` schema to omit the `plugin` field.
- Extended `parseFromDBToRepoLink` to support generating raw file links or repository tree/branch links.
* refactor(frontend): Remove redundant lib/actions pattern and aliases
The `lib/actions` directory and its associated pattern have been removed, as the `useEdenMutation` hook provides a more direct and integrated way to handle client-side API mutations.
This refactoring includes:
* Deleting `apps/dockstat/src/lib/actions` directory, including `README.md`, `executePluginAction.ts`, and `executePluginLoader.ts`.
* Updating `apps/dockstat/src/hooks/usePluginPage.ts` to directly use `useEdenMutation` for executing plugin loaders and actions, replacing the previously used helper functions.
* Removing `@Actions` and `@Queries` path aliases from `apps/dockstat/tsconfig.json` and `apps/dockstat/vite.config.ts`.
* Reorganizing import statements across various files in `apps/dockstat` for consistency.
This change simplifies the codebase by reducing unnecessary abstraction layers for API interactions.
* refactor(api): Remove redundant 'api.v2' prefix from route calls
The Eden API client in the frontend previously required routes to be accessed with a verbose `api.api.v2.<route>` prefix. This commit refactors the `src/lib/api.ts` file to directly export the `api.v2` namespace from the `treaty` client.
Consequently, all API calls throughout the frontend (`apps/dockstat/`) and documentation (`apps/docs/`) are updated to use the simplified `api.<route>` syntax. This change improves code readability, reduces verbosity, and streamlines interaction with the backend API.
Additionally, the environment variable for the API base URL was updated from `VITE_API_URL` to `DOCKSTAT_API_PORT` in `src/lib/api.ts`. Minor formatting adjustments were also applied in the integration guide README.
* feat(ui): Enhance repository management and introduce Select component
Refactor repository management in the frontend and introduce a reusable
Select component to improve form interactions.
- **apps/api**:
- Truncate error details in the metrics middleware for more concise logging.
- **apps/dockstat**:
- Redesign `RepoCard` component to include detailed security badges (Strict, Relaxed, No Verification),
display source and verification API clearly, and provide direct links.
- Implement a dedicated "Add Repository" form on the extensions page, replacing the previous placeholder,
with state management and validation.
- Integrate the new `Select` component for repository filtering in the plugin browser.
- **packages/ui**:
- Introduce a new generic `Select` component with support for different sizes, variants (default, filled, underline),
and styling options.
- Add corresponding CSS variables for the `Select` component.
- Extend `RepoIcons` component with a `size` prop for scalable icon rendering.
- Simplify verification badge logic within the `Repo` component.
- Update rendering keys in `Modal`, `RepoPluginSlide`, and `RepoList` for improved stability.
- **packages/utils**:
- Add handling for the `default` repository type in `parseFromDBToRepoLink` function.
* chore(ci): Lint [skip ci]
* feat(plugins): Refactor plugin page logic and introduce dedicated UI states
Splits the monolithic `usePluginPage` hook into modular, specialized hooks: `usePluginTemplate`, `usePluginState`, `usePluginLoaders`, and `usePluginActions`. This enhances maintainability and separation of concerns for plugin page management.
Introduces a new component file, `PluginPageStates.tsx`, to centralize UI rendering for various plugin page states, including loading, error, not found, and missing templates. This improves the user experience with clearer feedback.
Updates the `useEdenMutation` hook to support a `routeBuilder` pattern, enabling dynamic construction of API endpoints for plugin actions and loaders based on runtime parameters.
Performs minor cleanup by replacing unstable `key` props (e.g., using `Date` or `Math.random()`) with stable, deterministic values in several UI components for improved React reconciliation.
* chore: lint
* refactor(hooks): Split useEdenMutation into specialized hooks
The monolithic `useEdenMutation` hook has been refactored and split into several specialized components to improve modularity, clarify API usage, and enhance maintainability.
The changes include:
- **`apps/dockstat/src/hooks/eden/types.ts`**: Introduced to centralize shared types for Eden-related hooks.
- **`apps/dockstat/src/hooks/eden/useBaseEdenMutation.ts`**: Extracts the core `useMutation` logic, toast handling, and query invalidation into a reusable base hook.
- **`apps/dockstat/src/hooks/eden/useEdenMutation.ts`**: Provides a simplified interface for direct Eden API routes that do not require a route builder with dynamic parameters.
- **`apps/dockstat/src/hooks/eden/useEdenRouteMutation.ts`**: Provides an interface for Eden API routes that require parameters to build the route function at the time of mutation.
- **Removed `apps/dockstat/src/hooks/useEdenMutation.ts`**: The old, overloaded hook has been removed.
All existing consumers of the previous `useEdenMutation` have been updated to use the appropriate new specialized hook (`useEdenMutation` or `useEdenRouteMutation`) and their new import paths.
Additionally, corrected query invalidation keys for `pinNavLink` and `unpinNavLink` mutations in `layout.tsx` from `fetchNavLinks` to `fetchAdditionalSettings` to ensure proper cache updates.
* refactor(plugins): Extract plugin template logic to utils and address UI issues
Moved plugin page data normalization, template parsing, and fragment mapping from `usePluginTemplate` hook to a new utility file `src/utils/normalizePluginPageData.ts`. This centralizes complex data processing logic and simplifies the `usePluginTemplate` hook.
Also includes the following improvements:
- Corrected the import path for `useEdenMutation` in `usePluginTemplate.ts`.
- Fixed an issue in the plugin browser (`plugins.tsx`) where the repository `Select` component did not display the currently selected repository.
- Adjusted how the `isBusy` prop is passed to the `TopNav` component in `layout.tsx`.
- Reordered a `toast` import statement in `useBaseEdenMutation.ts` for consistency.
* deps(bun.lock): Update various package dependencies
---------
Co-authored-by: actions-user <its4nik@users.noreply.github.com>
* feat(repo-cli): Introduce repository CLI for managing DockStat repos
This commit introduces a new `@dockstat/repo-cli` package, providing a command-line interface to assist with managing DockStat repositories.
Key functionalities include:
- `init`: Initialize a new repository configuration file.
- `bundle`: Bundle plugins within the repository and update the manifest.
- `badges`: Generate SVG badges based on repository content and configuration.
Additionally, a new `isRepoType` utility is added to `@dockstat/utils` for validating repository types.
* feat(repo-cli): Introduce local serving and consolidated repository config
Deprecate and remove the internal `apps/dockstore` tooling responsible for plugin bundling, README generation, and schema management. This includes `bundler.ts`, `generate-readme.ts`, `.schemas/plugin-meta.schema.json`, and related `package.json` scripts and config files.
Replaced the decentralized plugin metadata and manifest generation with a new, centralized `apps/dockstore/repo.json` file. This file now defines the repository's configuration (name, policy, verification_api, content directories) and serves as the single source of truth for repository content metadata (plugins, themes, stacks).
The `dockstat-repo-cli`'s `bundle` command has been updated to populate this new `repo.json` file with plugin metadata.
Added a new `serve` command to `dockstat-repo-cli`, enabling simple local serving of the repository's static files via `Bun.serve`. This is intended for development, testing, or use behind a reverse proxy.
Introduced `packages/dockstat-repo-cli/src/utils/contentType.ts` to support the new `serve` command by providing appropriate `Content-Type` headers.
* feat(repo-cli): introduce repository management CLI
* chore: bump versions in bun.lock
* chore(repo-config): Remove 'content/' prefix from module paths
* build(repo-cli): Configure package for publishing and metadata
Add .npmignore to exclude source files and build artifacts from published package.
Update package.json with version, description, and 'files' array for explicit publication control.
Correct the CLI executable name in the 'bin' field from 'dockstore-repo-cli' to 'dockstat-repo-cli'.
* fix(repo-cli): Correct CLI binary output filename
* fix(repo-cli): Sanitize served paths and refactor badge generation
refactor(repo-cli/badges): Consolidate badge creation logic
- Replaced repetitive conditional blocks for plugins, themes, and stacks with a configurable array and a loop.
- Improves code maintainability and extensibility for future badge types.
fix(repo-cli/serve): Prevent directory traversal attacks
- Added `filePath.replaceAll("../", "/")` to sanitize requested file paths.
- Mitigates a potential security vulnerability allowing access to files outside the intended content directory.
refactor(typings, utils): Remove 'default' repo type
- Removed "default" from the `Repo.type` union enum in `db.ts`.
- Removed "default" from the `REPO_TYPES` array in `isRepoType.ts`.
- Aligns type definitions and utility functions with current supported repository types.
* feat(repo): Implement manifest-based repository registration
This commit significantly overhauls the repository registration process, moving towards a manifest-driven approach.
**Key Changes:**
* **API (`apps/api`)**:
* The `POST /repositories` endpoint now accepts a single `link_to_manifest` (URL) instead of individual fields like name, source, type, and policy.
* The API fetches the manifest from the provided link, utilizes new utility functions to parse its content, and extracts the repository configuration for storage.
* Adds `@dockstat/repo-cli` dependency to facilitate manifest parsing.
* **Core Logic (`packages/utils/repo`)**:
* Introduces `parseRawToDB` to intelligently convert raw manifest URLs (GitHub, GitLab, Gitea, HTTP) into structured database `type` and `source` strings.
* Enhances `parseFromDBToRepoLink` for more robust URL reconstruction based on repository type and source.
* Adds helper functions `parseRepoParts` and `splitDomain` for robust URL decomposition.
* **Database (`packages/db`)**:
* Updates the `repositories_table` schema to include a `paths` column (JSON type) for storing manifest-defined paths for themes, plugins, and stacks.
* Enables automatic database backup functionality with configurable intervals, compression, and maximum backups. Backups are stored in a `.backups` directory.
* **Frontend (`apps/dockstat`)**:
* The "Add Repository" form in the Extensions page is simplified to a single input field for the raw manifest or repository link.
* Removes previously individual fields for name, source, type, policy, and verification API.
* **Typings**:
* `Repo` and `CreateRepo` types updated to include the new `paths` field and remove the "default" option from the `type` enum.
* `RepoFile` interface in `@dockstat/repo-cli` is extended for flexibility.
* **.gitignore**: Updated to exclude the `.backups` directory.
This refactor streamlines the user experience for adding new repositories and prepares the system for richer manifest-based capabilities.
* chore(ci): Lint [skip ci]
* feat(plugins, api, build): Introduce DockStacks plugin and standardize publishing
- Introduce the new `DockStacks` plugin for managing Docker container stacks. This includes its initial project setup, definition using `@dockstat/plugin-builder`, and configuration types.
- Update the API route (`apps/api/src/routes/db.ts`) to store specific `paths` (plugins, stacks, themes) in the repository configuration upon creation. This allows repositories to define structured locations for different asset types.
- Standardize the package publishing process across core utility packages (`@dockstat/plugin-builder`, `@dockstat/repo-cli`, `@dockstat/sqlite-wrapper`, `@dockstat/typings`, `@dockstat/utils`) by adding a dedicated `publish` script to each `package.json`.
- Add root-level `publish` and `pub` commands to the monorepo `package.json` for simplified execution of package publishing.
- Bump versions for `@dockstat/plugin-builder` and `@dockstat/typings`.
* merge
* merge
* feat(docknode): Initial application setup with Bun and Elysia
Replaces the previous subproject entry with a new implementation of the DockNode application.
This commit establishes the foundational structure for DockNode, leveraging Bun runtime and the Elysia web framework.
Key components include:
- Integration with @dockstat/sqlite-wrapper for local database management.
- A StackHandler for dynamic creation, configuration, and orchestration of Docker Compose stacks.
- Essential project configuration such as .gitignore, tsconfig, and package.json.
* style(fmt): Standardize TS and TSConfig formatting
Reordered import statements in `apps/docknode/src/stacks/index.ts`.
Standardized comment placement and property delimiters (commas vs. semicolons) in `apps/docknode/tsconfig.json` and `packages/typings/src/v2/extensions/stacks/compose.d.ts`.
These changes improve code consistency and readability.
* feat(dev-env): Introduce Dockerized local development environment
Adds a comprehensive Docker Compose setup for consistent local development, coupled with significant ecosystem and dependency updates.
- **Docker Development Environment:**
- Introduced `docker-compose.dev.yaml` to provide isolated services:
- `socket-proxy`: For secure Docker socket access.
- `sqlite-web`: Two instances for inspecting `dockstat.sqlite` and `verification.db`.
- `prometheus`: For collecting application metrics.
- Added `dockstat-dev.prometheus.yml` to configure Prometheus to scrape metrics from the API.
- Updated `package.json` scripts (`docker-up`, `docker-up:quiet`, `dev:dockstat`) to integrate with the new Docker setup.
- **Bun and Dependency Updates:**
- Upgraded Bun runtime from `1.3.1` to `1.3.6`.
- Migrated core dependencies (`elysia`, `@elysiajs/eden`) to Bun's package catalog for enhanced dependency management and resolution.
- Performed various dependency updates across the monorepo, including `turbo`, `typescript`, `@types/bun`, `@types/react`, `js-yaml`, `@elysiajs/openapi`, `rollup`, `@sinclair/typebox`, `docker-compose`, `framer-motion`, `storybook`, and `@typescript-eslint` packages.
* Update packages/repo-cli/src/types.ts
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: ItsNik <info@itsnik.de>
* chore(docknode): update gitignore to exclude local environment files [DOCK-123]
Added patterns for local backup directories, stack configurations, and database files to prevent them from being tracked in version control. Updated the formatting for the bun lockfile entry.
* build(deps): bump dependencies in bun.lock
Update various project dependencies to their latest versions, including Babel, ESLint, Storybook, Tailwind CSS, TypeScript, and Rollup components.
---------
Signed-off-by: ItsNik <info@itsnik.de>
Co-authored-by: actions-user <its4nik@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
…s bag and avoid no op defaults (#94) * feat(repo-cli): Introduce repository CLI for managing DockStat repos This commit introduces a new `@dockstat/repo-cli` package, providing a command-line interface to assist with managing DockStat repositories. Key functionalities include: - `init`: Initialize a new repository configuration file. - `bundle`: Bundle plugins within the repository and update the manifest. - `badges`: Generate SVG badges based on repository content and configuration. Additionally, a new `isRepoType` utility is added to `@dockstat/utils` for validating repository types. * feat(repo-cli): Introduce local serving and consolidated repository config Deprecate and remove the internal `apps/dockstore` tooling responsible for plugin bundling, README generation, and schema management. This includes `bundler.ts`, `generate-readme.ts`, `.schemas/plugin-meta.schema.json`, and related `package.json` scripts and config files. Replaced the decentralized plugin metadata and manifest generation with a new, centralized `apps/dockstore/repo.json` file. This file now defines the repository's configuration (name, policy, verification_api, content directories) and serves as the single source of truth for repository content metadata (plugins, themes, stacks). The `dockstat-repo-cli`'s `bundle` command has been updated to populate this new `repo.json` file with plugin metadata. Added a new `serve` command to `dockstat-repo-cli`, enabling simple local serving of the repository's static files via `Bun.serve`. This is intended for development, testing, or use behind a reverse proxy. Introduced `packages/dockstat-repo-cli/src/utils/contentType.ts` to support the new `serve` command by providing appropriate `Content-Type` headers. * feat(repo-cli): introduce repository management CLI * chore: bump versions in bun.lock * chore(repo-config): Remove 'content/' prefix from module paths * build(repo-cli): Configure package for publishing and metadata Add .npmignore to exclude source files and build artifacts from published package. Update package.json with version, description, and 'files' array for explicit publication control. Correct the CLI executable name in the 'bin' field from 'dockstore-repo-cli' to 'dockstat-repo-cli'. * fix(repo-cli): Correct CLI binary output filename * fix(repo-cli): Sanitize served paths and refactor badge generation refactor(repo-cli/badges): Consolidate badge creation logic - Replaced repetitive conditional blocks for plugins, themes, and stacks with a configurable array and a loop. - Improves code maintainability and extensibility for future badge types. fix(repo-cli/serve): Prevent directory traversal attacks - Added `filePath.replaceAll("../", "/")` to sanitize requested file paths. - Mitigates a potential security vulnerability allowing access to files outside the intended content directory. refactor(typings, utils): Remove 'default' repo type - Removed "default" from the `Repo.type` union enum in `db.ts`. - Removed "default" from the `REPO_TYPES` array in `isRepoType.ts`. - Aligns type definitions and utility functions with current supported repository types. * feat(repo): Implement manifest-based repository registration This commit significantly overhauls the repository registration process, moving towards a manifest-driven approach. **Key Changes:** * **API (`apps/api`)**: * The `POST /repositories` endpoint now accepts a single `link_to_manifest` (URL) instead of individual fields like name, source, type, and policy. * The API fetches the manifest from the provided link, utilizes new utility functions to parse its content, and extracts the repository configuration for storage. * Adds `@dockstat/repo-cli` dependency to facilitate manifest parsing. * **Core Logic (`packages/utils/repo`)**: * Introduces `parseRawToDB` to intelligently convert raw manifest URLs (GitHub, GitLab, Gitea, HTTP) into structured database `type` and `source` strings. * Enhances `parseFromDBToRepoLink` for more robust URL reconstruction based on repository type and source. * Adds helper functions `parseRepoParts` and `splitDomain` for robust URL decomposition. * **Database (`packages/db`)**: * Updates the `repositories_table` schema to include a `paths` column (JSON type) for storing manifest-defined paths for themes, plugins, and stacks. * Enables automatic database backup functionality with configurable intervals, compression, and maximum backups. Backups are stored in a `.backups` directory. * **Frontend (`apps/dockstat`)**: * The "Add Repository" form in the Extensions page is simplified to a single input field for the raw manifest or repository link. * Removes previously individual fields for name, source, type, policy, and verification API. * **Typings**: * `Repo` and `CreateRepo` types updated to include the new `paths` field and remove the "default" option from the `type` enum. * `RepoFile` interface in `@dockstat/repo-cli` is extended for flexibility. * **.gitignore**: Updated to exclude the `.backups` directory. This refactor streamlines the user experience for adding new repositories and prepares the system for richer manifest-based capabilities. * chore(ci): Lint [skip ci] * feat(plugins, api, build): Introduce DockStacks plugin and standardize publishing - Introduce the new `DockStacks` plugin for managing Docker container stacks. This includes its initial project setup, definition using `@dockstat/plugin-builder`, and configuration types. - Update the API route (`apps/api/src/routes/db.ts`) to store specific `paths` (plugins, stacks, themes) in the repository configuration upon creation. This allows repositories to define structured locations for different asset types. - Standardize the package publishing process across core utility packages (`@dockstat/plugin-builder`, `@dockstat/repo-cli`, `@dockstat/sqlite-wrapper`, `@dockstat/typings`, `@dockstat/utils`) by adding a dedicated `publish` script to each `package.json`. - Add root-level `publish` and `pub` commands to the monorepo `package.json` for simplified execution of package publishing. - Bump versions for `@dockstat/plugin-builder` and `@dockstat/typings`. * merge * merge * feat(docknode): Initial application setup with Bun and Elysia Replaces the previous subproject entry with a new implementation of the DockNode application. This commit establishes the foundational structure for DockNode, leveraging Bun runtime and the Elysia web framework. Key components include: - Integration with @dockstat/sqlite-wrapper for local database management. - A StackHandler for dynamic creation, configuration, and orchestration of Docker Compose stacks. - Essential project configuration such as .gitignore, tsconfig, and package.json. * style(fmt): Standardize TS and TSConfig formatting Reordered import statements in `apps/docknode/src/stacks/index.ts`. Standardized comment placement and property delimiters (commas vs. semicolons) in `apps/docknode/tsconfig.json` and `packages/typings/src/v2/extensions/stacks/compose.d.ts`. These changes improve code consistency and readability. * feat(dev-env): Introduce Dockerized local development environment Adds a comprehensive Docker Compose setup for consistent local development, coupled with significant ecosystem and dependency updates. - **Docker Development Environment:** - Introduced `docker-compose.dev.yaml` to provide isolated services: - `socket-proxy`: For secure Docker socket access. - `sqlite-web`: Two instances for inspecting `dockstat.sqlite` and `verification.db`. - `prometheus`: For collecting application metrics. - Added `dockstat-dev.prometheus.yml` to configure Prometheus to scrape metrics from the API. - Updated `package.json` scripts (`docker-up`, `docker-up:quiet`, `dev:dockstat`) to integrate with the new Docker setup. - **Bun and Dependency Updates:** - Upgraded Bun runtime from `1.3.1` to `1.3.6`. - Migrated core dependencies (`elysia`, `@elysiajs/eden`) to Bun's package catalog for enhanced dependency management and resolution. - Performed various dependency updates across the monorepo, including `turbo`, `typescript`, `@types/bun`, `@types/react`, `js-yaml`, `@elysiajs/openapi`, `rollup`, `@sinclair/typebox`, `docker-compose`, `framer-motion`, `storybook`, and `@typescript-eslint` packages. * feat(docknode): Implement core DockNode features and Docker stack management - Introduce Dockerfile for containerizing the DockNode application. - Develop a comprehensive StackHandler for Docker Compose stack management, including: - CRUD operations (create, get, list, update, delete, rename, export). - Lifecycle commands (up, down, stop, restart, pull). - Information commands (ps, logs, config, network stats, version). - Execution commands (exec, run, rm, kill, port). - Expose stack management functionalities via new `/api/stacks` endpoints. - Integrate `docker-compose` for orchestration and `dockerode` for Docker API interaction. - Add `.dockerignore`, `.npmignore`, and update `.gitignore` for relevant file exclusions. - Update `README.md` with DockNode description and API examples. - Introduce application-specific logger and utility functions. - Configure `tsconfig.json` for ESNext and bundler module resolution. - Add necessary dependencies for Docker client, logger, typings, utilities, and OpenAPI. * build(dockstacks): Add @dockstat/logger dependency * feat(docker-client): Export core DockerClient directly and refine constructor options The `DockerClient` class is now directly exportable and importable via `@dockstat/docker-client/client`, allowing for more flexible usage without needing to instantiate the `DockerClientManager`. Additionally, the `options` parameter in the `DockerClientBase` constructor has been made required, ensuring explicit configuration for client instances. The package version has been incremented to `2.0.1`. * feat(docknode): Integrate shared docker client and update dependencies * refactor(sqlite-wrapper): Restructure source code and modularize DB class Moved all source files into a dedicated 'src/' directory to improve project structure and maintainability. This refactor also includes a significant modularization of the 'DB' class. Key changes include: * All core logic previously in 'index.ts' has been moved to 'src/index.ts'. * Extracted various concerns from the 'DB' class into new helper modules under 'src/lib': * Backup and restore operations moved to 'src/lib/backup'. * Index creation and dropping moved to 'src/lib/index'. * SQL helper functions like 'isSQLFunction' moved to 'src/lib/sql'. * Table creation logic ('buildColumnSQL', 'buildTableConstraints', 'isTableSchema', 'setTableComment', 'getTableComment') moved to 'src/lib/table'. * Updated all relative imports in test files to point to the new 'src/' paths. * Adjusted 'package.json' and 'tsconfig.json' to reflect the new file structure and module resolution. * Bumped package version to 1.3.3. * feat(repo-cli): overhaul README documentation and rename package - Renamed package from 'dockstore-cli' to '@dockstat/repo-cli' for consistent branding. - Completely rewrote the README to provide comprehensive usage documentation: - Added detailed installation instructions. - Documented 'init', 'bundle', 'badges', and 'serve' commands with their options, descriptions, and requirement status. - Included license information. - Bumped package version to 1.0.4. * feat(query-builder): Add detailed info-level logging to query execution and WHERE methods - Introduce `safeStringify` utility in `WhereQueryBuilder` to robustly serialize complex values (including RegExp) for logging. - Add info-level logs to `SelectQueryBuilder` execution methods (`all`, `get`, `count`, `exists`, `value`, `pluck`) to display built queries, parameters, and results. - Add info-level logs to `WhereQueryBuilder` methods (`where`, `whereRgx`, `whereExpr`, `whereIn`, `whereOp`, `whereBetween`, `whereNull`, etc.) to track the construction of WHERE clauses and their parameters. - Remove duplicate `safeStringify` implementation from `SelectQueryBuilder` to utilize the new base class helper. - Bump package version to 1.3.4. * formatting * Feat theme handler (#73) * feat(query-builder): Add detailed info-level logging to query execution and WHERE methods - Introduce `safeStringify` utility in `WhereQueryBuilder` to robustly serialize complex values (including RegExp) for logging. - Add info-level logs to `SelectQueryBuilder` execution methods (`all`, `get`, `count`, `exists`, `value`, `pluck`) to display built queries, parameters, and results. - Add info-level logs to `WhereQueryBuilder` methods (`where`, `whereRgx`, `whereExpr`, `whereIn`, `whereOp`, `whereBetween`, `whereNull`, etc.) to track the construction of WHERE clauses and their parameters. - Remove duplicate `safeStringify` implementation from `SelectQueryBuilder` to utilize the new base class helper. - Bump package version to 1.3.4. * formatting * feat(theme-handler): Introduce theme-handler package for managing UI themes This commit introduces the new `@dockstat/theme-handler` package, providing a comprehensive solution for managing UI themes across the application. Key features include: - **Client-side utilities**: - React context (`ThemeContext`) for easily accessing theme data. - Functions to dynamically apply theme variables (CSS custom properties) to the document. - Local storage integration for persisting user theme preferences. - **Server-side management**: - `ThemeDB` class for robust SQLite database integration to store, retrieve, update, and delete themes. - Elysia-based API routes (`/themes`) offering full CRUD capabilities for themes, including fetching by name or ID. - **Default themes**: - Ships with pre-defined "DockStat-Dark", "DockStat-Light", "DockStat-OLED", and "DockStat-UltraDark" themes, including their CSS variables and animation properties. - **Bun & Elysia integration**: - The package is set up with Bun for efficient dependency management and runtime, and Elysia for building high-performance API routes. This package centralizes theme logic, making it easier to manage and apply consistent styling throughout the application. * feat(ui): Add theme browser and selection functionality This commit introduces a user interface for browsing and selecting application themes. - **New `ThemeBrowser` Component**: A dedicated component is added to display available themes, each with a preview of its key color variables (background, primary text, accent, etc.). Users can select a theme from this browser. - **Sidebar Integration**: The `Sidebar` component now includes a new 'Palette' icon button that opens a modal containing the `ThemeBrowser`. - **`ThemeProps` Interface**: A `ThemeProps` interface is defined to facilitate passing theme-related data (list of themes, current theme ID, selection handler, open callback) from parent components to the `Sidebar` and subsequently to the `ThemeBrowser`. - **Navbar Update**: The `Navbar` component is updated to accept and forward `themeProps` to the `Sidebar`, ensuring theme management can be controlled from higher up the component tree. - Refactored the loading state check for pinned items in the Sidebar to use `mutationFn.isBusy` for a cleaner approach. - Exports `ThemeBrowser` components for broader use within the `ui` package. * refactor(sqlite-wrapper): Truncate excessively long stringified condition values Introduce a `truncate` utility function to limit the length of strings. Apply this utility within the `WhereQueryBuilder.safeStringify` method to prevent excessively long stringified values (e.g., from `JSON.stringify` or `String()`) from being returned. This improves readability in debugging logs or contexts where these values might be displayed, ensuring they don't consume too much space. The maximum length for truncated strings is set to 100 characters. * feat(dockstat): Implement client-side theme management and provider Introduce `ThemeProvider` to manage and apply themes within the DockStat UI. This includes: - Adding `@dockstat/theme-handler` dependency. - Creating `ThemeProviderContext` and `useTheme` hook for global theme state and access. - Implementing `ThemeProvider` to handle theme fetching (by name/ID) from the API, applying themes to the document using `@dockstat/theme-handler/client` functions (`applyThemeToDocument`), and persisting user preferences (`saveThemePreference`, `loadThemePreference`). - Integrating the `ThemeProvider` at the application root in `src/providers/index.tsx`. - Updating `layout.tsx` to consume theme data and functions from `useTheme`, enabling theme selection capabilities in the sidebar. - Adding a new `/stacks` route and a placeholder `StacksIndex` page. * feat(api): Add theme management endpoints * feat(docknode): Implement API key authentication Introduces API key-based authentication to the docknode application. This implementation leverages the 'better-auth' library, configured to accept API keys via the 'x-docknode-key' header. Key changes include: - Addition of the 'better-auth' dependency to apps/docknode. - Creation of 'src/auth/index.ts' to define the authentication setup. - Updates to '.env.example' for `BETTER_AUTH_SECRET` and `BETTER_AUTH_URL` configuration. - Minor updates to `bun.lock` and import reordering across various packages (e.g., `dockstat`, `sqlite-wrapper`, `theme-handler`) for consistency and dependency management. * docs(all): Standardize formatting and add new content - Refactored RSS feed websocket subscription path to `api.api.v2.misc.stats.rss` in `apps/dockstat/src/lib/websocketEffects/README.md`. - Introduced a new documentation page for `Eden Query & Mutation Hooks` under `apps/docs/dockstat/patterns`, detailing `useEdenQuery` and `useEdenMutation` with code examples and type inference. - Documented the `createIndex` method in `@dockstat/sqlite-wrapper`, providing comprehensive usage, options, and examples for index creation. - Standardized Markdown table formatting across all documentation files for improved readability and consistency. - Addressed minor formatting issues, including trailing commas in code snippets and ensuring all Markdown files end with a newline. * Update apps/dockstat/src/providers/theme.tsx Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: ItsNik <info@itsnik.de> * fix(db): Remove incomplete createIndex call * refactor(dockstat/theme): Simplify API calls in theme provider Remove `useEdenQuery` hooks from `ThemeProvider` and replace them with direct calls to the `api` client. This streamlines data fetching for themes (by name, by ID, and all themes) by eliminating an intermediate hook layer. Consolidate theme application and persistence logic into a new `applyAndPersistTheme` callback for improved code reuse and clarity. The `useTheme` hook also removes its explicit error throw for usage outside `ThemeProvider`, relying on `useContext` to return `undefined` when the context is not available. * refactor(theme-handler): modularize server API routes and models The `theme-handler` server API has been refactored into a more modular and organized structure. Previously, all theme API routes and associated response models were defined in a single large file (`src/server/api.ts`). This commit breaks down this monolithic file into a clear directory structure: * **`src/server/api/models/`**: Contains schema definitions for theme data (`themeModel.ts`), mutation payloads (`themePost.ts`), and standardized API responses (`themeResponses.ts`). * **`src/server/api/routes/`**: Contains individual files for each set of API operations: `queries.ts` (GET), `mutations.ts` (POST), `update.ts` (PUT), and `delete.ts` (DELETE). The main `createThemeRoutes` function now composes these smaller, focused route modules, improving maintainability and readability. Additionally, the top-level `src/index.ts` has been updated to re-export `client` and `server` modules as namespaces (`export * as client from "./client"`), providing a clearer and more explicit import structure for consumers of the package. This refactoring aims to improve code organization, reusability of API models, and overall maintainability of the `theme-handler` package. * refactor(query-builder/logging): Centralize logging in Select and Where builders Refactor logging logic within `SelectQueryBuilder` and `WhereQueryBuilder` by introducing dedicated private/protected helper methods. This change: - Consolidates common logging patterns for query initiation and results in `SelectQueryBuilder` into `logSelectStart` and `logSelectReturn`. - Introduces `logColumnReturn` for consistent logging in `pluck` and `value` methods. - Centralizes logging of `where` conditions and internal state in `WhereQueryBuilder` using `logWhere` and `logWhereState`. - Improves consistency and readability of log messages across different query execution and condition building methods. - Reduces code duplication for logging statements, making the code more maintainable. * feat(ui, api, theme-handler): Implement user feedback toasts and enhance theme preview - **`dockstat`**: Added toast notifications for successful pin/unpin operations and theme selection, providing immediate user feedback. - **`ui`**: Overhauled the `ThemeBrowser` component to display a more dynamic and accurate color preview using validated theme variables. Extracted color constants and created a `getValidColors` utility. - **`theme-handler`**: - Introduced `onFinish` callback to `applyThemeToDocument` for client-side feedback integration. - Corrected the logic in the theme creation route to prevent creating themes with duplicate names (bug fix). - Updated theme response models to use `ThemeModel` consistently and refined the delete route's response type. - **`api`**: Improved request completion logging by including the request URL path, enhancing observability. * Update apps/docs/dockstat/patterns/eden-query-&-mutation-hooks/README.md Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: ItsNik <info@itsnik.de> * refactor(components): Remove unused props and refine component types Omit 'paths' from `RepoCard` props definition to align with actual usage. Remove 'isLoading' from `ThemeProps` in `Sidebar` as it is no longer required. Perform minor whitespace cleanup in the `WhereQueryBuilder`. --------- Signed-off-by: ItsNik <info@itsnik.de> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * feat(hotkeys, node, ui): Introduce configurable hotkeys and DockNode pages This commit brings significant updates including configurable hotkeys, a new DockNode section, and various UI enhancements. **Hotkeys:** - Add `hotkeys` field to the global configuration schema (`DockStatConfigTable`) and context (`ConfigProviderData`). - Define `HotkeyAction` type for better type safety of configurable hotkey actions (e.g., "open:quicklinks"). - Set a default hotkey `k` for opening quick links in the database defaults. - Integrate configurable hotkeys into the `Navbar` and `LinkLookup` components, allowing customization of the quick links modal hotkey. **DockNode & Stacks:** - Create new pages for `/node` (DockNode overview) and `/node/stacks` (Stacks within a DockNode). - Refactor and move the existing `/stacks` functionality to the new `/node/stacks` route, deleting the old `/stacks` page. - Update the application router and sidebar navigation to reflect the new DockNode structure. **UI & Accessibility:** - Enhance the `Card` component with a `tabIndex` prop to improve keyboard navigation and focus management. - Adjust tab indexing within the `LinkLookup` modal for better accessibility. - Apply minor styling and structure adjustments to sidebar items, including child item formatting. **Refactoring:** - Streamline theme loading state management in the main layout by removing unnecessary `isLoading` prop from `useTheme` consumer. * feat(hotkeys): Introduce `useHotkey` hook and add sidebar toggle Create a new `useHotkey` React hook in `@dockstat/utils/react` to provide a centralized and declarative way for components to manage keyboard shortcuts. - Migrate existing hotkey handling logic in `LinkLookup` component (for quick links modal) to utilize the new `useHotkey` hook. - Integrate the `useHotkey` hook into the `Navbar` component to manage sidebar `open`, `close`, and `toggle` actions, making hotkey management consistent. - Add `toggle:sidebar` hotkey (`b` by default) to the default application configuration in `packages/db`. - Refactor utility imports across `apps/api` and `packages/plugin-handler` to use barrel exports from `@dockstat/utils` (e.g., `import { repo } from "@dockstat/utils"` instead of direct path imports). - Update various project dependencies. * fix(formatting): adjusted imports * feat(docknode-management): Introduce API, UI, and backend for DockNode registration This commit introduces a comprehensive system for managing DockNode instances from the main DockStat API and frontend. Users can now register, monitor, and remove external DockNode servers, enhancing distributed management capabilities. **Key Changes:** * **API (`apps/api`):** * Added `@dockstat/docknode` and `@elysiajs/eden` dependencies. * Implemented `DockNodeHandler` to manage DockNode registration within a new `docknode-register` SQLite table. This includes functionality for checking node reachability, creating, and deleting entries. * Exposed new `/api/v2/node` endpoints (`GET`, `POST`, `DELETE`) for performing CRUD operations on DockNode registrations. * Defined Elysia TypeBox models for robust API request validation. * **DockNode (`apps/docknode`):** * Added a `GET /api/status` endpoint, allowing the main API to perform health checks and determine if a registered DockNode is online. * Configured the SQLite database to use Write-Ahead Logging (WAL) journal mode for improved performance and data integrity. * **Frontend (`apps/dockstat`):** * Created a new "DockNodes" page (`src/pages/node/index.tsx`) in the UI to list, create, and delete DockNode registrations. * Developed the `DockNodeCard` React component to visually represent each registered node, displaying its status, host, port, SSL usage, and providing options for interaction. * Integrated new `useEdenQuery` and `useEdenMutation` hooks for seamless interaction with the API. * **Database & Typings (`packages/db`, `packages/typings`):** * Refactored the `tls_certs_and_keys` field in the main `config` table to a more generic `keys` object. * Extended the `keys` object to include a dedicated slot for `docknode` specific API keys, enabling future secure communication. * Improved type definitions for foreign keys in `packages/sqlite-wrapper`. * **Utilities (`packages/utils`):** * Introduced a new set of React Query-based utility hooks (`useEdenQuery`, `useEdenMutation`, `useEdenRouteMutation`) for `elysia/eden` clients. These hooks simplify data fetching and mutations, providing standardized error handling, loading states, and automatic query invalidation. * Added `@tanstack/react-query` as a dependency. * **Build & Development:** * Updated the `dev:dockstat` script to include `--filter=@dockstat/docknode` for integrated development. * Updated various dependencies across the monorepo. This feature lays the groundwork for centralized management of distributed DockNode services. * chore(ci): Lint [skip ci] * refactor(ui): Enhance Slides animation and DockNodeCard UI Refactor the `Slides` component in `@packages/ui` to dynamically measure and animate content height. This change leverages `ResizeObserver` to ensure that slides with dynamic content automatically adjust their height during transitions, resulting in a smoother and more responsive user experience. The previous `collapseVariants` animation logic is replaced with direct height and opacity animations. Additionally, the `overflow-hidden` class is removed from the `Slides` `CardBody` as `SlideContent` now manages its own overflow for animation. Redesign the `DockNodeCard` component in the `dockstat` application, introducing significant visual and structural improvements: - Updated layout and spacing for better readability. - Refined typography and enhanced status badges. - Improved presentation of connection details. - Restyled `CardFooter` with updated action button presentation and text ("Visit" changed to "Open"). - Minor adjustments to event handling for the delete action, including explicit `e.stopPropagation()`. * Feat settings page (#76) * feat(hotkeys): Implement configurable hotkey management Introduce a comprehensive hotkey management system within the application settings. - **API:** Added a new `POST /config/hotkey` endpoint to allow users to update and persist their hotkey preferences in the database. - **Frontend (DockStat):** - Created a new `SettingsPage` with a dedicated "Hotkeys" slide. - The `HotkeysSlide` provides an intuitive UI for users to configure global hotkeys, including support for `CTRL + SHIFT + <key>` combinations. - Integrates with the new API endpoint to save changes and provides immediate feedback. - **Hotkeys Utility:** Enhanced the `useHotkey` hook to support `shift+key` combinations and a generic `toggle` function, making hotkey handling more flexible. - **Configuration:** Updated default hotkey configurations to include new actions such as `open:sidebar` and `close:sidebar`. - **UI Integration:** Adapted components like `Navbar` and `LinkLookup` to consume dynamic hotkey configurations. - **Database/Typings:** Updated database models and type definitions (`DatabaseModel.hotkeyRes`, `DatabaseModel.hotkeyBody`, `HotkeyAction`) to reflect the new hotkey structure. * refactor(codebase): Reorder imports and remove unused declarations * feat(settings): Introduce General Settings page and API config management This commit introduces a new "General Settings" page in the DockStat frontend and expands the backend API for configuration management. Key changes include: * **API & Database (`apps/api`, `packages/db`, `packages/typings`):** * **Fix(config):** Corrected a widespread typo from `addtionalSettings` to `additionalSettings` in database schemas, typings, default configurations, and API models. This ensures consistency and correctness of the configuration object. * Added `GET /db/details` and `GET /db/details/:tableName/all` endpoints for database introspection, providing schema information and raw table data. * Implemented `POST /db/config/additionalSettings` for updating application-wide settings such as `showBackendRamUsageInNavbar`. * Added TypeBox schemas for `additionalSettingsBody` and `additionalSettingsRes`. * **Frontend (`apps/dockstat`):** * Introduced the `GeneralSettingsSlide` component as the main entry point for general settings. * Implemented `PinnedNavSection` to manage user-pinned navigation links. * Developed `PinnableLinksSection` to allow users to discover and pin available dashboard links, including those provided by plugins. * Added `PluginLinksSection` to display all detected plugin-provided routes. * Created `AdditionalSettingsSection` to control specific application behaviors, starting with the option to display backend RAM usage in the navbar. * Updated the `/settings` page to integrate the new `GeneralSettingsSlide`. * Refactored the `ConfigProvider` to correctly handle `additionalSettings` and provide it to the application context. * Minor UI adjustments in `HostsList` and `ClientsPage` for improved layout and consistency. * Fixed hotkey display to correctly replace both `_` and `:` with spaces. * **UI Library (`packages/ui`):** * Expanded `Badge` component with an `xs` size option. * Adjusted `Divider` vertical orientation to use `min-h-full` for better responsiveness. * Enhanced `Slides` component with improved content transition animations and a `ResizeObserver` for dynamic height adjustments. * Exported `SidebarPaths` and `PathItem` from Navbar for broader use in navigation. * **Other:** * Updated `apps/docknode/.gitignore` to include `docknode.db*` for better exclusion of database files and backups. This comprehensive update streamlines configuration management and provides users with more control over their DockStat experience. * chore(ci): Lint [skip ci] * fix(formatting): adjusted imports * fix(remove unwanted): remove database file from git tree * feat(ui, api): Enhance UI components and streamline API error responses Refactor: - API: Removed redundant 'error' field from additional settings update error response in `db.ts` to ensure consistent error payload with `message`. Dockstat App: - UI/Hosts: Simplified the display for "no hosts configured" by removing an unnecessary card and icon. - UI/Settings: Enhanced pinned navigation section with a fixed height, vertical resizing, and scroll functionality for improved usability. UI Package: - Badges: Corrected `xs` badge padding from `py-.5` to `py-0.5` for consistent styling. - Slides: Fixed `useSlideState` by adding `activeSlide` to `useEffect` dependencies, ensuring proper re-measurement on slide changes. - Theme Browser: Added `m-1` margin to `ThemePreviewCard` for improved visual spacing between theme previews. * feat(db:migration): Implement automatic schema migration (#78) * feat(db:migration): Implement automatic schema migration This commit introduces automatic schema migration capabilities to the `sqlite-wrapper`. The `db.createTable()` method now automatically detects schema changes when a table already exists and performs an atomic migration if differences are found. This process ensures smooth schema evolution without manual intervention, including: - Creating a temporary table with the new schema. - Copying existing data, mapping common columns and applying defaults for new ones. - Recreating indexes, triggers, and foreign key constraints. - Swapping the tables safely within a transaction. **Key Migration Features & Options:** - **Schema Detection**: Automatically identifies additions, removals, and changes in column constraints (NOT NULL, UNIQUE, Primary Key status) and types. - **Data Preservation**: Data is preserved by default (`preserveData: true`), with options to control how constraint violations are handled (`onConflict: 'fail' | 'ignore' | 'replace'`). - **Customization**: Supports `dropMissingColumns` and `tempTableSuffix` for fine-grained control. - **Disabling Migration**: Migration can be explicitly disabled per table using `migrate: false` in `TableOptions`. - **Type Handling**: Correctly migrates JSON and Boolean columns. This feature significantly simplifies schema management for applications using `sqlite-wrapper`. A new test suite (`__test__/migration.test.ts`) has been added to thoroughly validate various migration scenarios. The `README.md` has been updated to document the new "Automatic Schema Migration" feature in detail, including usage examples and best practices. The package version is bumped to `1.3.5`. * deps(bun): update @types/bun to 1.3.9 * fix(migration): improve migration robustness and add comprehensive tests Migration robustness: - Foreign key `PRAGMA` statements are now correctly handled outside the migration transaction, ensuring proper disabling and re-enabling of FK constraints for reliable table alterations. - Improved logging in `schemasAreDifferent` to provide more detail on column count differences. - The `currentSchema` is now passed to `migrateTable` from `checkAndMigrate` to avoid redundant database calls. New migration tests: - Added a test to verify that migration fails with the default `onConflict` strategy when constraints (e.g., `NOT NULL`) are violated. - Added tests to confirm that no actual migration (ALTER TABLE) occurs when switching between type aliases (e.g., `TEXT` to `JSON`, `INTEGER` to `BOOLEAN`), ensuring data is preserved and correctly interpreted. Type centralization: - Moved `TableColumn`, `IndexInfo`, `ForeignKeyInfo`, and `ForeignKeyStatus` interfaces to `src/types.ts` for better organization and reusability. Minor fixes and improvements: - Corrected the in-memory database name check from `:memory` to `:memory:` in the `DB` class. - Updated README.md to fix a typo from "Wrong packing" to "incorrect packaging". - Removed the `dropMissingColumns` option from `MigrationOptions` as it was never implemented. * Sqlite wrapper automatic table migration on schema change (#79) * feat(db:migration): Implement automatic schema migration This commit introduces automatic schema migration capabilities to the `sqlite-wrapper`. The `db.createTable()` method now automatically detects schema changes when a table already exists and performs an atomic migration if differences are found. This process ensures smooth schema evolution without manual intervention, including: - Creating a temporary table with the new schema. - Copying existing data, mapping common columns and applying defaults for new ones. - Recreating indexes, triggers, and foreign key constraints. - Swapping the tables safely within a transaction. **Key Migration Features & Options:** - **Schema Detection**: Automatically identifies additions, removals, and changes in column constraints (NOT NULL, UNIQUE, Primary Key status) and types. - **Data Preservation**: Data is preserved by default (`preserveData: true`), with options to control how constraint violations are handled (`onConflict: 'fail' | 'ignore' | 'replace'`). - **Customization**: Supports `dropMissingColumns` and `tempTableSuffix` for fine-grained control. - **Disabling Migration**: Migration can be explicitly disabled per table using `migrate: false` in `TableOptions`. - **Type Handling**: Correctly migrates JSON and Boolean columns. This feature significantly simplifies schema management for applications using `sqlite-wrapper`. A new test suite (`__test__/migration.test.ts`) has been added to thoroughly validate various migration scenarios. The `README.md` has been updated to document the new "Automatic Schema Migration" feature in detail, including usage examples and best practices. The package version is bumped to `1.3.5`. * deps(bun): update @types/bun to 1.3.9 * fix(migration): improve migration robustness and add comprehensive tests Migration robustness: - Foreign key `PRAGMA` statements are now correctly handled outside the migration transaction, ensuring proper disabling and re-enabling of FK constraints for reliable table alterations. - Improved logging in `schemasAreDifferent` to provide more detail on column count differences. - The `currentSchema` is now passed to `migrateTable` from `checkAndMigrate` to avoid redundant database calls. New migration tests: - Added a test to verify that migration fails with the default `onConflict` strategy when constraints (e.g., `NOT NULL`) are violated. - Added tests to confirm that no actual migration (ALTER TABLE) occurs when switching between type aliases (e.g., `TEXT` to `JSON`, `INTEGER` to `BOOLEAN`), ensuring data is preserved and correctly interpreted. Type centralization: - Moved `TableColumn`, `IndexInfo`, `ForeignKeyInfo`, and `ForeignKeyStatus` interfaces to `src/types.ts` for better organization and reusability. Minor fixes and improvements: - Corrected the in-memory database name check from `:memory` to `:memory:` in the `DB` class. - Updated README.md to fix a typo from "Wrong packing" to "incorrect packaging". - Removed the `dropMissingColumns` option from `MigrationOptions` as it was never implemented. * refactor(sqlite-wrapper): Extract createTable helper methods Introduces `normalizeMigrationOptions` to centralize the parsing of the `migrate` option into a standardized `{ enabled, options }` object. Adds `shouldCheckExistingTable` to encapsulate the conditions for checking if a table already exists (e.g., excluding temporary or in-memory tables). These private helper methods refactor the `createTable` method, improving its readability and maintainability by extracting complex conditional logic. This makes the `createTable` method more focused on its primary responsibility. * feat(sqlite-wrapper): Introduce migration onConflict options and SQL-based schema comparison **Migration Conflict Resolution:** Adds `onConflict` options (`ignore` and `replace`) to schema migration, allowing users to define how existing data is handled when new unique constraints are introduced during a migration. **Robust Schema Comparison:** Reworks the `schemasAreDifferent` logic to compare the full `CREATE TABLE` SQL statements. This provides a more precise and comprehensive detection of schema changes, including intricate column definitions, constraints, and default values, greatly improving migration reliability. **SQL Generation Refactoring:** Extracts the `CREATE TABLE` SQL generation into a new `buildTableSQL` utility function, enhancing modularity and reusability. **Standardized Migration Options:** Normalizes the `migrate` option in `TableOptions` to always be a `MigrationOptions` object, providing a consistent API for configuring migration behavior. Updates internal schema retrieval mechanisms and tests to leverage the full `CREATE TABLE` SQL for migration decisions. * fix(sqlite-wrapper): Correct handling of 'migrate' option in migrateTable * refactor(types): Relax column definition type constraints The `InferTableSchema` type in `plugin-builder` and `PluginConfig['table']['columns']` (along with `DBPlugin`'s generic type) in `typings` were previously constrained to `Record<string, ColumnDefinition>`. This commit relaxes these constraints to `Record<string, unknown>`. This change offers greater flexibility for defining columns within plugin configurations and during table schema inference, reducing tight coupling to the `ColumnDefinition` type from `@dockstat/sqlite-wrapper`. It allows for more generic or custom column definitions without needing to strictly conform to `ColumnDefinition` at the interface level. Additionally, this commit includes minor import reordering in `sqlite-wrapper` and `migration` for consistency. * feat(sqlite-wrapper): Prevent auto-migration for temporary and in-memory tables The `createTable` method will no longer automatically apply schema migrations to certain types of tables. This change introduces an `allowMigration` utility that determines if a table is eligible for automatic schema migration based on its properties and name. Migrations are now explicitly denied for: - Tables created with the `temporary: true` option. - In-memory tables (identified by the name `":memory:"`). - Tables prefixed with `temp_` (which SQLite uses for internal temporary objects). - Tables used internally by the migration process (matching `_migration_temp` suffix). This ensures that only persistent, user-managed tables are subject to schema changes, preventing unintended modifications to ephemeral table structures. Additionally, the `createTable` method now includes a `try...catch` block to handle `SQLiteError` with `errno === 1` (table already exists). This allows the method to gracefully proceed and return the `QueryBuilder` for an existing table even if a `CREATE TABLE` statement fails because the table already exists, ensuring robust behavior in various scenarios. New tests have been added to validate that temporary and in-memory tables do not trigger automatic schema migrations. --------- Signed-off-by: ItsNik <info@itsnik.de> * 80 migrations always run when ifnotexists is true (#81) * feat(migration): Implement automatic table schema migration and refactor logging This release introduces robust automatic schema migration capabilities for tables managed by `sqlite-wrapper`, alongside a comprehensive refactor of the internal logging system. **Automatic Schema Migration:** * **Intelligent Detection**: `createTable` now automatically detects schema differences (column additions, removals, constraint changes, default values) between the existing table and the desired schema. * **Data Preservation**: Migrations are performed without data loss by creating a temporary table, copying data, and re-creating the original table. * **Flexible Conflict Handling**: Supports `onConflict` strategies (`ignore`, `replace`) during migration when adding unique constraints that might conflict with existing data. * **Index and Foreign Key Preservation**: Ensures that existing indexes and foreign key constraints are re-established after migration. * **Alias-Aware Type Handling**: Correctly identifies column type aliases (e.g., `JSON` as `TEXT`, `BOOLEAN` as `INTEGER`) to prevent unnecessary migrations. * **Migration Control**: Introduces `migrate` options to explicitly enable/disable migration or customize the temporary table suffix. * **Exclusion for Special Tables**: Automatically skips migration for `:memory:` databases and `TEMPORARY` tables. * **Enhanced Comparison**: The `schemasAreDifferent` logic has been improved to normalize `CREATE TABLE` statements (removing `IF NOT EXISTS` and normalizing quoting) for more accurate comparisons. **Logging Refactor:** * **Unified Logger**: Migrated from a custom `SqliteLogger` to `@dockstat/logger` across the entire codebase. * **Hierarchical Logging**: Implemented `logger.spawn()` to create child loggers for `DB`, `Table`, `Backup`, `Migration`, `QueryBuilder` (and its sub-builders like `Insert`, `Select`, `Update`, `Delete`), and `Transformer` components, providing clearer context in logs. * **Detailed Messages**: Reviewed and refined log messages for all major operations to provide more informative debug, info, and error output. **Other Enhancements:** * **`InsertResult` Extension**: The `insert` and `batchInsert` methods now return an optional `insertedIDs` array in the `InsertResult` type, providing all IDs generated during a batch operation. * **Comprehensive Testing**: Added extensive unit tests for migration logic, schema difference detection, and various migration scenarios to ensure reliability. * refactor(logging): Standardize logging with @dockstat/logger Removed the custom `SqliteLogger` implementation and its associated utilities from `src/utils/logger.ts`. All logging within the `sqlite-wrapper` package now directly uses `Logger` from the `@dockstat/logger` package. This change: - Simplifies the codebase by eliminating a custom logging abstraction. - Reduces maintenance overhead. - Ensures consistent logging practices across the Dockstat ecosystem by leveraging a shared library. - Updated relevant test files (`migration.test.ts`, `schemasAreDifferent.test.ts`) to use the new logger. - Updated package description to reflect comprehensive features. * chore(ci): Lint [skip ci] * fix(sqlite-wrapper): Enhance schema comparison and standardize logging - **Migration Module:** - Implement `normalizeCreateTable` helper to robustly handle `IF NOT EXISTS` clauses and quoted identifiers during `CREATE TABLE` schema comparison. - Update `schemasAreDifferent` to leverage the new normalization for consistent and accurate schema comparisons. - Adjust test fixture `SCHEMA_WITH_IF_NOT_EXISTS` to include `IF NOT EXISTS` for migration tests. - **Query Builder Module:** - Improve logging consistency by using `JSON.stringify` for query parameters in `SelectQueryBuilder` and `UpdateQueryBuilder`. - Correct logger scope from `INSERT` to `WHERE` in `WhereQueryBuilder`'s constructor. - Fix "Resseting" typo to "Resetting" in `BaseQueryBuilder`'s `reset` and `resetWhereConditions` debug messages. - **Package Metadata:** - Bump package version to `1.3.11`. - Correct "automati" typo to "automatic" in the package description. * feat(core): Enhance UI with Framer Motion & refactor multi-client container stats feat(ui): - Integrate Framer Motion for smooth animations on buttons and navbar badges, improving overall UI responsiveness and interactivity. - Redesign General Settings sections for better layout and clarity, introducing a new "Link Settings" header. - Enhance Extensions page with an onboarding prompt to add the default repository for new users. - Update Pinned Links icon to 'Pin' and refine sidebar item display by removing unnecessary prefixes. feat(api): - Refactor Docker client manager to aggregate container statistics across all initialized clients, providing a unified view via `getAllContainerStats`. - Update API route `/all-containers` to utilize the new multi-client container stats aggregation. feat(packages): - Release `@dockstat/theme-handler` v2.0.0 as a public package, complete with a comprehensive README detailing its features, API, and usage. chore(deps): - Update `turbo` to `^2.8.10`. - Update `@dockstat/sqlite-wrapper` to `1.3.8`. style: - Adjust various text colors to use `primary-text` for consistency across UI components. - Standardize card variants to `flat` in several settings sections for a cleaner look. - Refine toast success message for additional settings updates. * fix(query-builder): Adjust logger hierarchy and inheritance Previously, the `BaseQueryBuilder` would incorrectly spawn an additional "QB" logger from the `baseLogger` provided in its constructor, rather than using the `baseLogger` directly (which is already intended to be the QueryBuilder's logger). Additionally, descendant query builders (Insert, Select, Update, Delete) would spawn their specific loggers (e.g., "INSERT") directly from the original `baseLogger` passed to `BaseQueryBuilder`. This resulted in these sub-loggers being siblings of the main "QB" logger, instead of children. This commit corrects the logger initialization logic: 1. `BaseQueryBuilder` now directly uses the `baseLogger` if provided, assuming it is already the designated "QB" logger. If no `baseLogger` is provided, a new "QB" logger is created. 2. Sub-query builders now spawn their specific loggers from `this.log` (the QueryBuilder's main logger), ensuring the correct hierarchical structure: `Root Logger -> QB Logger -> [Delete/Insert/Select/Update] Logger`. This change improves logging clarity and ensures proper inheritance of log hooks throughout the query builder stack. * refactor(ui/Button): Extract button and spinner animations to dedicated files Moved Framer Motion animation definitions for the `Button` component's active/inactive states and the loading spinner into `animations.ts`. Encapsulated the loading spinner's `motion.span` and its animation logic into a new `ButtonSpinner` component, located in `spinner.tsx`. This refactoring centralizes animation logic, enhancing modularity and reusability, and cleaning up the main `Button.tsx` file for improved readability and maintainability. --------- Co-authored-by: actions-user <its4nik@users.noreply.github.com> --------- Signed-off-by: ItsNik <info@itsnik.de> Co-authored-by: actions-user <its4nik@users.noreply.github.com> * feat(ui/theme): Implement comprehensive theme customization and editor This commit introduces a suite of features for advanced theme customization within DockStat. Key changes include: * **Theme Editor UI**: Added new `ThemeEditor` and `ThemeSidebar` components, allowing users to dynamically adjust individual color variables of the current theme directly from the settings page. * **Dynamic Theme Adjustments**: Enhanced `ThemeProviderContext` with `adjustCurrentTheme` to apply real-time color changes to the application's CSS variables and `isModifiedTheme` to track unsaved changes. * **New Theme Creation**: Integrated a mutation to `createNewThemeFromCurrent`, enabling users to save their customized theme as a new theme. * **Improved Theme Persistence**: The selected theme preference now stores both the theme ID and name, providing better context upon reload. * **Categorized Color Editing**: Theme colors are now categorized by UI component (e.g., Buttons, Cards, Forms) within the `ThemeSidebar` for easier navigation and editing. * **Logging Enhancements**: SQLite queries now truncate long parameter lists in logs for improved readability. * **Dependency Updates**: Various packages across the monorepo, including `@dockstat/ui`, `@dockstat/theme-handler`, `elysia`, `react`, and Storybook, have been updated to their latest versions to support these new features and maintain compatibility. * **Documentation Update**: Updated the `theme-handler` README to reflect the new client-side setup and usage patterns. This allows for a much more flexible and user-friendly experience for tailoring DockStat's visual appearance. * feat(theme): Implement theme editor sidebar and hotkeys Introduces a new dedicated sidebar for theme editing, allowing users to dynamically adjust theme colors (CSS variables) directly from the application's UI. This feature includes: - Integration of a new `ThemeSidebar` component, accessible via a dedicated button in the main sidebar and configurable hotkeys. - Addition of `toggle:themeEditor`, `open:themeEditor`, and `close:themeEditor` hotkeys, with 't' set as the default key for toggling the editor. - Updates to `db/defaults.ts` and `typings` to support the new hotkeys. - Refinement of theme color adjustment logic in `layout.tsx` and `settings.tsx` to use the `adjustCurrentTheme` function for consistent updates. - Implementation of `reverseSlideInVariants` for the new sidebar's animation. - Removal of unnecessary `console.log` statements. * feat(theme): Centralize ThemeSidebar state and globalize rendering This commit refactors the `ThemeSidebar` component to improve the theme customization experience and ensure its consistent behavior across the application. * **Centralized State Management**: Introduced `ThemeSidebarContext` and `ThemeSidebarProvider` to centralize the management of the theme sidebar's open/close state and associated theme properties. * **Global Rendering**: Moved the `ThemeSidebar` rendering from `packages/ui/src/components/Sidebar/Sidebar.tsx` to `apps/dockstat/src/layout.tsx`, making it a global, application-wide overlay. * **Dynamic Data Provisioning**: `apps/dockstat/src/layout.tsx` now populates the `ThemeSidebarContext` with dynamic theme data and callback functions from the `useTheme` hook, ensuring the sidebar always displays the current theme information. * **UI Component Integration**: Updated `packages/ui/src/components/Sidebar/Sidebar.tsx` to interact with the theme sidebar exclusively through the new context, removing its internal state management for the sidebar. * **Theme Sidebar Enhancements**: Enhanced `packages/ui/src/components/ThemeSidebar/ThemeSidebar.tsx` with functionality to track theme modifications and include a placeholder for saving new theme configurations. * **Modal Transparency**: Applied `transparent` prop to `Modal` components in `packages/ui/src/components/Sidebar/Sidebar.tsx` for improved visual integration. * **Code Cleanliness**: Performed minor import reordering across several files. * feat(theme): Implement comprehensive theme management and editor redesign This commit introduces a complete overhaul of theme management capabilities, including full CRUD operations, a redesigned theme editor UI, and significant improvements to data fetching and state management. - **Theme Management:** - Enabled creation of new themes based on the currently active theme's variables. - Added functionality to delete custom themes directly from the theme browser. - Refined theme selection to ensure immediate application and persistence. - **Theme Editor Redesign:** - Introduced a new, more organized color editing interface with a scrollable list, providing better visibility and detailed information for each color variable. - Improved layout and integration of individual color pickers. - **React Query Integration & Enhancements:** - Introduced `QueryClientContext` for centralized React Query client management. - Added `edenQuery` as a specialized hook for programmatic Eden API data fetching, complementing `useEdenQuery`. - Refactored `ThemeProvider` to utilize `edenQuery` for efficient theme list fetching and robust refetching mechanisms. - Added detailed JSDoc comments to `useBaseEdenMutation`, `useEdenRouteMutation`, and `extractEdenError` for enhanced developer clarity and usage guidance. - **API & Context Updates:** - Modified the theme deletion endpoint from using a path parameter (`DELETE /themes/:id`) to accepting the `id` in the request body (`DELETE /themes`). - Extended `ThemeSidebarContext` to include `addNewTheme` and updated `toastSuccess` to accept theme names, providing more contextual feedback. - **UI/UX Refinements:** - Updated text colors in `LinkLookup` to align with the active theme. - Adjusted `ThemeSidebar` width and integrated a dedicated modal for saving new themes. - **Hotkeys:** - Changed the hotkey for `toggle:themeEditor` from `t` to `p` to prevent conflicts. * refactor(dockstat): Refactor layout into modular hooks and improve context initialization The monolithic `layout.tsx` component has been refactored into a dedicated `src/layout` directory, organizing related logic into smaller, reusable custom hooks. This significantly improves code organization, readability, and maintainability by separating concerns. Key changes include: * **Layout Component Decomposition**: The main `Layout` component is now located in `src/layout/components/Layout.tsx`. * **Modular Hooks**: * `useLayout`: Consolidates state and effects for the primary layout. * `useThemeManager`: Encapsulates theme-related logic, including application, adjustment, and creation. * `useLogs`, `useRamUsage`, `usePinMutations`, `usePluginRoutes`, `useDeleteTheme`: Extract specific functionalities into dedicated hooks. * **QueryClient Context Initialization**: The `QueryClientContext` now initializes with a proper `new QueryClient()` instance, ensuring a fully functional client is always provided. The `QueryClientProvider` also now wraps its children with `QueryClientContext.Provider`. * **Theme Provider Simplification**: * The `getAllThemes` function has been removed from `ThemeProviderData` and the `ThemeProvider` context, as theme list updates are now handled more directly via `useEdenQuery`. * Toast notifications related to theme cache updates from theme creation mutations have been removed, aligning with the simplified theme list refresh. * chore(ci): Lint [skip ci] * refactor(core): Standardize Eden API query functions and streamline React Query setup - **feat(eden-query)**: Introduced `createEdenQueryFn` helper to standardize query function creation for Eden API calls, including signal handling and error extraction. - Centralized Eden-related types (`EdenQueryRoute`, `EdenQueryData`, `UseEdenQueryOptions`) in a dedicated file, removing duplication from `useEdenQuery`. - **refactor(query-client)**: Exported a singleton `QueryClient` instance from its context file and simplified `QueryClientProvider` to use this shared instance, removing redundant instantiation. - **refactor(theme)**: Cleaned up `useThemeManager` by removing unnecessary `useRef` wrappers for theme application functions. Refactored theme application logic in `ThemeProvider` using `applyThemeEffect` for improved reusability and state management. - **fix(layout)**: Corrected an incorrect hotkey assignment for opening the sidebar in the `Layout` component. * chore(ci): Lint [skip ci] * refactor(theme-management): Decouple theme sidebar contexts and streamline prop passing Refactor theme sidebar state management to improve separation of concerns and reduce prop drilling. - Split the monolithic `ThemeSidebarContext` into: - `ThemeSidebarContext`: For domain logic (e.g., `addNewTheme`). - `ThemeSidebarUIContext`: For UI state (e.g., `isThemeSidebarOpen`). - Eliminated the `themeProps` object; individual theme-related properties are now passed explicitly to components (`Navbar`, `Sidebar`, `ThemeSidebar`). - Introduced a new `useLayout` hook to centralize layout-related data and theme management logic. - Restructured `ThemeSidebarProvider` to utilize the new, separate UI and domain contexts. - Added support for `toggle:themeEditor` hotkey to control the theme sidebar visibility. - Enhanced `ThemeEditor` component with a `multiColumn` prop for improved layout flexibility. * chore(ci): Lint [skip ci] * refactor(core): Streamline theme data flow and module resolution * refactor(theme): Simplify theme sidebar provider and clean up Navbar theme props Merged ThemeSidebarDomainProvider into ThemeSidebarProvider to streamline theme sidebar logic and state management. Removed currentThemeName and currentThemeColors props from Navbar component, as these are now directly accessed via the useTheme context. * fix(dockstat-thememanager): Add ref dependencies to theme manager useEffects * import adjustments * Feat node graph (#93) * This is a test branch for me currently, this is not the final implementation! * adjustments * feat(graph, api, ui, docker-client): Enhance infrastructure graph with DockNodes and containers This commit introduces a comprehensive update to the infrastructure graph visualization, expanding it to include DockNodes and individual Docker containers. This enhancement provides a more complete overview of the monitored environment by integrating all layers of infrastructure into a single, interactive graph. **Key changes include:** * **API Enhancements (`apps/api`):** * Introduced new `calculateNodeLayout` and `reachableStatus` helpers to dynamically arrange and standardize the status of all node types (clients, hosts, docknodes, containers). * Added robust `GraphModel` schemas for API request/response validation, including definitions for new node types (docknode, container) and their respective data structures. * The `/graph` API endpoint now aggregates data from clients, hosts, docknodes, and containers, processing them into a React Flow-compatible format for the frontend. * Centralized the `DockNodeHandler` instance, improving resource management and consistency. * **Frontend UI Overhaul (`apps/dockstat`):** * Integrated `@xyflow/react` for a powerful and interactive graph visualization experience. * Implemented dynamic node types (`client`, `host`, `docknode`, `container`) with distinct visual representations and associated data. * Developed a detailed `NodeDetailsPanel` to display contextual information for selected nodes, including IP, port, status, image, and IDs. * Updated `StatsDisplay` and `Legend` components to accurately reflect the expanded infrastructure components. * Added graph controls like `fitView`, background dots, and snap-to-grid functionality for better usability. * **Docker Client Improvements (`packages/docker-client`):** * Modified container mapping to include `clientId`, enabling correct association of containers with their respective client instances in the graph. * Introduced a new `pingHost` method to check the reachability of individual hosts, improving granular status monitoring. * Enhanced worker message handling and error reporting for greater robustness. * feat(graph): Add infrastructure graph visualization This commit introduces a new, interactive infrastructure graph page to visualize the entire Docker client ecosystem. The backend has been refactored to use the `dagre` library for automated and more robust node layout, replacing the previous manual positioning logic. The `/api/graph` endpoint now provides comprehensive data, including clients, hosts, docknodes, and newly added container information, leveraging enhanced data types. Key changes include: - **Backend (`apps/api`):** Migrated graph layout calculation from a custom algorithm to `dagre`. New graph calculator, helper functions, and types were introduced. The `/api/graph` response now includes detailed container information. - **Frontend (`apps/dockstat`):** Implemented a dedicated `/graph` page using React Flow. New UI components like `GraphFlow`, `NodeDetailsPanel`, `Legend`, and `StatsDisplay` were created to render the graph and its associated data dynamically. - **`docker-client` package:** Modified container information mapping to include `clientId`, ensuring containers are correctly associated with their respective clients. Host information was also enriched with `host` and `port` details for better graph representation. - **`typings` package:** Updated `DOCKER.ContainerInfo` to include `clientId` and `DockerClientManagerCore.getAllHosts` return type to include `host` and `port`. - **`ui` package:** Extended UI components with new styling variables for graph nodes and introduced a `custom` card variant for flexible node rendering. - **Navigation:** The new graph page is accessible vi…
* feat(repo-cli): Introduce repository CLI for managing DockStat repos
This commit introduces a new `@dockstat/repo-cli` package, providing a command-line interface to assist with managing DockStat repositories.
Key functionalities include:
- `init`: Initialize a new repository configuration file.
- `bundle`: Bundle plugins within the repository and update the manifest.
- `badges`: Generate SVG badges based on repository content and configuration.
Additionally, a new `isRepoType` utility is added to `@dockstat/utils` for validating repository types.
* feat(repo-cli): Introduce local serving and consolidated repository config
Deprecate and remove the internal `apps/dockstore` tooling responsible for plugin bundling, README generation, and schema management. This includes `bundler.ts`, `generate-readme.ts`, `.schemas/plugin-meta.schema.json`, and related `package.json` scripts and config files.
Replaced the decentralized plugin metadata and manifest generation with a new, centralized `apps/dockstore/repo.json` file. This file now defines the repository's configuration (name, policy, verification_api, content directories) and serves as the single source of truth for repository content metadata (plugins, themes, stacks).
The `dockstat-repo-cli`'s `bundle` command has been updated to populate this new `repo.json` file with plugin metadata.
Added a new `serve` command to `dockstat-repo-cli`, enabling simple local serving of the repository's static files via `Bun.serve`. This is intended for development, testing, or use behind a reverse proxy.
Introduced `packages/dockstat-repo-cli/src/utils/contentType.ts` to support the new `serve` command by providing appropriate `Content-Type` headers.
* feat(repo-cli): introduce repository management CLI
* chore: bump versions in bun.lock
* chore(repo-config): Remove 'content/' prefix from module paths
* build(repo-cli): Configure package for publishing and metadata
Add .npmignore to exclude source files and build artifacts from published package.
Update package.json with version, description, and 'files' array for explicit publication control.
Correct the CLI executable name in the 'bin' field from 'dockstore-repo-cli' to 'dockstat-repo-cli'.
* fix(repo-cli): Correct CLI binary output filename
* fix(repo-cli): Sanitize served paths and refactor badge generation
refactor(repo-cli/badges): Consolidate badge creation logic
- Replaced repetitive conditional blocks for plugins, themes, and stacks with a configurable array and a loop.
- Improves code maintainability and extensibility for future badge types.
fix(repo-cli/serve): Prevent directory traversal attacks
- Added `filePath.replaceAll("../", "/")` to sanitize requested file paths.
- Mitigates a potential security vulnerability allowing access to files outside the intended content directory.
refactor(typings, utils): Remove 'default' repo type
- Removed "default" from the `Repo.type` union enum in `db.ts`.
- Removed "default" from the `REPO_TYPES` array in `isRepoType.ts`.
- Aligns type definitions and utility functions with current supported repository types.
* feat(repo): Implement manifest-based repository registration
This commit significantly overhauls the repository registration process, moving towards a manifest-driven approach.
**Key Changes:**
* **API (`apps/api`)**:
* The `POST /repositories` endpoint now accepts a single `link_to_manifest` (URL) instead of individual fields like name, source, type, and policy.
* The API fetches the manifest from the provided link, utilizes new utility functions to parse its content, and extracts the repository configuration for storage.
* Adds `@dockstat/repo-cli` dependency to facilitate manifest parsing.
* **Core Logic (`packages/utils/repo`)**:
* Introduces `parseRawToDB` to intelligently convert raw manifest URLs (GitHub, GitLab, Gitea, HTTP) into structured database `type` and `source` strings.
* Enhances `parseFromDBToRepoLink` for more robust URL reconstruction based on repository type and source.
* Adds helper functions `parseRepoParts` and `splitDomain` for robust URL decomposition.
* **Database (`packages/db`)**:
* Updates the `repositories_table` schema to include a `paths` column (JSON type) for storing manifest-defined paths for themes, plugins, and stacks.
* Enables automatic database backup functionality with configurable intervals, compression, and maximum backups. Backups are stored in a `.backups` directory.
* **Frontend (`apps/dockstat`)**:
* The "Add Repository" form in the Extensions page is simplified to a single input field for the raw manifest or repository link.
* Removes previously individual fields for name, source, type, policy, and verification API.
* **Typings**:
* `Repo` and `CreateRepo` types updated to include the new `paths` field and remove the "default" option from the `type` enum.
* `RepoFile` interface in `@dockstat/repo-cli` is extended for flexibility.
* **.gitignore**: Updated to exclude the `.backups` directory.
This refactor streamlines the user experience for adding new repositories and prepares the system for richer manifest-based capabilities.
* chore(ci): Lint [skip ci]
* feat(plugins, api, build): Introduce DockStacks plugin and standardize publishing
- Introduce the new `DockStacks` plugin for managing Docker container stacks. This includes its initial project setup, definition using `@dockstat/plugin-builder`, and configuration types.
- Update the API route (`apps/api/src/routes/db.ts`) to store specific `paths` (plugins, stacks, themes) in the repository configuration upon creation. This allows repositories to define structured locations for different asset types.
- Standardize the package publishing process across core utility packages (`@dockstat/plugin-builder`, `@dockstat/repo-cli`, `@dockstat/sqlite-wrapper`, `@dockstat/typings`, `@dockstat/utils`) by adding a dedicated `publish` script to each `package.json`.
- Add root-level `publish` and `pub` commands to the monorepo `package.json` for simplified execution of package publishing.
- Bump versions for `@dockstat/plugin-builder` and `@dockstat/typings`.
* merge
* merge
* feat(docknode): Initial application setup with Bun and Elysia
Replaces the previous subproject entry with a new implementation of the DockNode application.
This commit establishes the foundational structure for DockNode, leveraging Bun runtime and the Elysia web framework.
Key components include:
- Integration with @dockstat/sqlite-wrapper for local database management.
- A StackHandler for dynamic creation, configuration, and orchestration of Docker Compose stacks.
- Essential project configuration such as .gitignore, tsconfig, and package.json.
* style(fmt): Standardize TS and TSConfig formatting
Reordered import statements in `apps/docknode/src/stacks/index.ts`.
Standardized comment placement and property delimiters (commas vs. semicolons) in `apps/docknode/tsconfig.json` and `packages/typings/src/v2/extensions/stacks/compose.d.ts`.
These changes improve code consistency and readability.
* feat(dev-env): Introduce Dockerized local development environment
Adds a comprehensive Docker Compose setup for consistent local development, coupled with significant ecosystem and dependency updates.
- **Docker Development Environment:**
- Introduced `docker-compose.dev.yaml` to provide isolated services:
- `socket-proxy`: For secure Docker socket access.
- `sqlite-web`: Two instances for inspecting `dockstat.sqlite` and `verification.db`.
- `prometheus`: For collecting application metrics.
- Added `dockstat-dev.prometheus.yml` to configure Prometheus to scrape metrics from the API.
- Updated `package.json` scripts (`docker-up`, `docker-up:quiet`, `dev:dockstat`) to integrate with the new Docker setup.
- **Bun and Dependency Updates:**
- Upgraded Bun runtime from `1.3.1` to `1.3.6`.
- Migrated core dependencies (`elysia`, `@elysiajs/eden`) to Bun's package catalog for enhanced dependency management and resolution.
- Performed various dependency updates across the monorepo, including `turbo`, `typescript`, `@types/bun`, `@types/react`, `js-yaml`, `@elysiajs/openapi`, `rollup`, `@sinclair/typebox`, `docker-compose`, `framer-motion`, `storybook`, and `@typescript-eslint` packages.
* feat(docknode): Implement core DockNode features and Docker stack management
- Introduce Dockerfile for containerizing the DockNode application.
- Develop a comprehensive StackHandler for Docker Compose stack management, including:
- CRUD operations (create, get, list, update, delete, rename, export).
- Lifecycle commands (up, down, stop, restart, pull).
- Information commands (ps, logs, config, network stats, version).
- Execution commands (exec, run, rm, kill, port).
- Expose stack management functionalities via new `/api/stacks` endpoints.
- Integrate `docker-compose` for orchestration and `dockerode` for Docker API interaction.
- Add `.dockerignore`, `.npmignore`, and update `.gitignore` for relevant file exclusions.
- Update `README.md` with DockNode description and API examples.
- Introduce application-specific logger and utility functions.
- Configure `tsconfig.json` for ESNext and bundler module resolution.
- Add necessary dependencies for Docker client, logger, typings, utilities, and OpenAPI.
* build(dockstacks): Add @dockstat/logger dependency
* feat(docker-client): Export core DockerClient directly and refine constructor options
The `DockerClient` class is now directly exportable and importable via `@dockstat/docker-client/client`, allowing for more flexible usage without needing to instantiate the `DockerClientManager`.
Additionally, the `options` parameter in the `DockerClientBase` constructor has been made required, ensuring explicit configuration for client instances.
The package version has been incremented to `2.0.1`.
* feat(docknode): Integrate shared docker client and update dependencies
* refactor(sqlite-wrapper): Restructure source code and modularize DB class
Moved all source files into a dedicated 'src/' directory to improve project structure and maintainability. This refactor also includes a significant modularization of the 'DB' class.
Key changes include:
* All core logic previously in 'index.ts' has been moved to 'src/index.ts'.
* Extracted various concerns from the 'DB' class into new helper modules under 'src/lib':
* Backup and restore operations moved to 'src/lib/backup'.
* Index creation and dropping moved to 'src/lib/index'.
* SQL helper functions like 'isSQLFunction' moved to 'src/lib/sql'.
* Table creation logic ('buildColumnSQL', 'buildTableConstraints', 'isTableSchema', 'setTableComment', 'getTableComment') moved to 'src/lib/table'.
* Updated all relative imports in test files to point to the new 'src/' paths.
* Adjusted 'package.json' and 'tsconfig.json' to reflect the new file structure and module resolution.
* Bumped package version to 1.3.3.
* feat(repo-cli): overhaul README documentation and rename package
- Renamed package from 'dockstore-cli' to '@dockstat/repo-cli' for consistent branding.
- Completely rewrote the README to provide comprehensive usage documentation:
- Added detailed installation instructions.
- Documented 'init', 'bundle', 'badges', and 'serve' commands with their options, descriptions, and requirement status.
- Included license information.
- Bumped package version to 1.0.4.
* feat(query-builder): Add detailed info-level logging to query execution and WHERE methods
- Introduce `safeStringify` utility in `WhereQueryBuilder` to robustly serialize complex values (including RegExp) for logging.
- Add info-level logs to `SelectQueryBuilder` execution methods (`all`, `get`, `count`, `exists`, `value`, `pluck`) to display built queries, parameters, and results.
- Add info-level logs to `WhereQueryBuilder` methods (`where`, `whereRgx`, `whereExpr`, `whereIn`, `whereOp`, `whereBetween`, `whereNull`, etc.) to track the construction of WHERE clauses and their parameters.
- Remove duplicate `safeStringify` implementation from `SelectQueryBuilder` to utilize the new base class helper.
- Bump package version to 1.3.4.
* formatting
* Feat theme handler (#73)
* feat(query-builder): Add detailed info-level logging to query execution and WHERE methods
- Introduce `safeStringify` utility in `WhereQueryBuilder` to robustly serialize complex values (including RegExp) for logging.
- Add info-level logs to `SelectQueryBuilder` execution methods (`all`, `get`, `count`, `exists`, `value`, `pluck`) to display built queries, parameters, and results.
- Add info-level logs to `WhereQueryBuilder` methods (`where`, `whereRgx`, `whereExpr`, `whereIn`, `whereOp`, `whereBetween`, `whereNull`, etc.) to track the construction of WHERE clauses and their parameters.
- Remove duplicate `safeStringify` implementation from `SelectQueryBuilder` to utilize the new base class helper.
- Bump package version to 1.3.4.
* formatting
* feat(theme-handler): Introduce theme-handler package for managing UI themes
This commit introduces the new `@dockstat/theme-handler` package, providing a comprehensive solution for managing UI themes across the application.
Key features include:
- **Client-side utilities**:
- React context (`ThemeContext`) for easily accessing theme data.
- Functions to dynamically apply theme variables (CSS custom properties) to the document.
- Local storage integration for persisting user theme preferences.
- **Server-side management**:
- `ThemeDB` class for robust SQLite database integration to store, retrieve, update, and delete themes.
- Elysia-based API routes (`/themes`) offering full CRUD capabilities for themes, including fetching by name or ID.
- **Default themes**:
- Ships with pre-defined "DockStat-Dark", "DockStat-Light", "DockStat-OLED", and "DockStat-UltraDark" themes, including their CSS variables and animation properties.
- **Bun & Elysia integration**:
- The package is set up with Bun for efficient dependency management and runtime, and Elysia for building high-performance API routes.
This package centralizes theme logic, making it easier to manage and apply consistent styling throughout the application.
* feat(ui): Add theme browser and selection functionality
This commit introduces a user interface for browsing and selecting application themes.
- **New `ThemeBrowser` Component**: A dedicated component is added to display available themes, each with a preview of its key color variables (background, primary text, accent, etc.). Users can select a theme from this browser.
- **Sidebar Integration**: The `Sidebar` component now includes a new 'Palette' icon button that opens a modal containing the `ThemeBrowser`.
- **`ThemeProps` Interface**: A `ThemeProps` interface is defined to facilitate passing theme-related data (list of themes, current theme ID, selection handler, open callback) from parent components to the `Sidebar` and subsequently to the `ThemeBrowser`.
- **Navbar Update**: The `Navbar` component is updated to accept and forward `themeProps` to the `Sidebar`, ensuring theme management can be controlled from higher up the component tree.
- Refactored the loading state check for pinned items in the Sidebar to use `mutationFn.isBusy` for a cleaner approach.
- Exports `ThemeBrowser` components for broader use within the `ui` package.
* refactor(sqlite-wrapper): Truncate excessively long stringified condition values
Introduce a `truncate` utility function to limit the length of strings.
Apply this utility within the `WhereQueryBuilder.safeStringify` method to prevent excessively long stringified values (e.g., from `JSON.stringify` or `String()`) from being returned. This improves readability in debugging logs or contexts where these values might be displayed, ensuring they don't consume too much space. The maximum length for truncated strings is set to 100 characters.
* feat(dockstat): Implement client-side theme management and provider
Introduce `ThemeProvider` to manage and apply themes within the DockStat UI. This includes:
- Adding `@dockstat/theme-handler` dependency.
- Creating `ThemeProviderContext` and `useTheme` hook for global theme state and access.
- Implementing `ThemeProvider` to handle theme fetching (by name/ID) from the API, applying themes to the document using `@dockstat/theme-handler/client` functions (`applyThemeToDocument`), and persisting user preferences (`saveThemePreference`, `loadThemePreference`).
- Integrating the `ThemeProvider` at the application root in `src/providers/index.tsx`.
- Updating `layout.tsx` to consume theme data and functions from `useTheme`, enabling theme selection capabilities in the sidebar.
- Adding a new `/stacks` route and a placeholder `StacksIndex` page.
* feat(api): Add theme management endpoints
* feat(docknode): Implement API key authentication
Introduces API key-based authentication to the docknode application. This implementation leverages the 'better-auth' library, configured to accept API keys via the 'x-docknode-key' header.
Key changes include:
- Addition of the 'better-auth' dependency to apps/docknode.
- Creation of 'src/auth/index.ts' to define the authentication setup.
- Updates to '.env.example' for `BETTER_AUTH_SECRET` and `BETTER_AUTH_URL` configuration.
- Minor updates to `bun.lock` and import reordering across various packages (e.g., `dockstat`, `sqlite-wrapper`, `theme-handler`) for consistency and dependency management.
* docs(all): Standardize formatting and add new content
- Refactored RSS feed websocket subscription path to `api.api.v2.misc.stats.rss` in `apps/dockstat/src/lib/websocketEffects/README.md`.
- Introduced a new documentation page for `Eden Query & Mutation Hooks` under `apps/docs/dockstat/patterns`, detailing `useEdenQuery` and `useEdenMutation` with code examples and type inference.
- Documented the `createIndex` method in `@dockstat/sqlite-wrapper`, providing comprehensive usage, options, and examples for index creation.
- Standardized Markdown table formatting across all documentation files for improved readability and consistency.
- Addressed minor formatting issues, including trailing commas in code snippets and ensuring all Markdown files end with a newline.
* Update apps/dockstat/src/providers/theme.tsx
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: ItsNik <info@itsnik.de>
* fix(db): Remove incomplete createIndex call
* refactor(dockstat/theme): Simplify API calls in theme provider
Remove `useEdenQuery` hooks from `ThemeProvider` and replace them with direct calls to the `api` client. This streamlines data fetching for themes (by name, by ID, and all themes) by eliminating an intermediate hook layer.
Consolidate theme application and persistence logic into a new `applyAndPersistTheme` callback for improved code reuse and clarity.
The `useTheme` hook also removes its explicit error throw for usage outside `ThemeProvider`, relying on `useContext` to return `undefined` when the context is not available.
* refactor(theme-handler): modularize server API routes and models
The `theme-handler` server API has been refactored into a more modular and organized structure.
Previously, all theme API routes and associated response models were defined in a single large file (`src/server/api.ts`). This commit breaks down this monolithic file into a clear directory structure:
* **`src/server/api/models/`**: Contains schema definitions for theme data (`themeModel.ts`), mutation payloads (`themePost.ts`), and standardized API responses (`themeResponses.ts`).
* **`src/server/api/routes/`**: Contains individual files for each set of API operations: `queries.ts` (GET), `mutations.ts` (POST), `update.ts` (PUT), and `delete.ts` (DELETE).
The main `createThemeRoutes` function now composes these smaller, focused route modules, improving maintainability and readability.
Additionally, the top-level `src/index.ts` has been updated to re-export `client` and `server` modules as namespaces (`export * as client from "./client"`), providing a clearer and more explicit import structure for consumers of the package.
This refactoring aims to improve code organization, reusability of API models, and overall maintainability of the `theme-handler` package.
* refactor(query-builder/logging): Centralize logging in Select and Where builders
Refactor logging logic within `SelectQueryBuilder` and `WhereQueryBuilder` by introducing dedicated private/protected helper methods.
This change:
- Consolidates common logging patterns for query initiation and results in `SelectQueryBuilder` into `logSelectStart` and `logSelectReturn`.
- Introduces `logColumnReturn` for consistent logging in `pluck` and `value` methods.
- Centralizes logging of `where` conditions and internal state in `WhereQueryBuilder` using `logWhere` and `logWhereState`.
- Improves consistency and readability of log messages across different query execution and condition building methods.
- Reduces code duplication for logging statements, making the code more maintainable.
* feat(ui, api, theme-handler): Implement user feedback toasts and enhance theme preview
- **`dockstat`**: Added toast notifications for successful pin/unpin operations and theme selection, providing immediate user feedback.
- **`ui`**: Overhauled the `ThemeBrowser` component to display a more dynamic and accurate color preview using validated theme variables. Extracted color constants and created a `getValidColors` utility.
- **`theme-handler`**:
- Introduced `onFinish` callback to `applyThemeToDocument` for client-side feedback integration.
- Corrected the logic in the theme creation route to prevent creating themes with duplicate names (bug fix).
- Updated theme response models to use `ThemeModel` consistently and refined the delete route's response type.
- **`api`**: Improved request completion logging by including the request URL path, enhancing observability.
* Update apps/docs/dockstat/patterns/eden-query-&-mutation-hooks/README.md
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: ItsNik <info@itsnik.de>
* refactor(components): Remove unused props and refine component types
Omit 'paths' from `RepoCard` props definition to align with actual usage.
Remove 'isLoading' from `ThemeProps` in `Sidebar` as it is no longer required.
Perform minor whitespace cleanup in the `WhereQueryBuilder`.
---------
Signed-off-by: ItsNik <info@itsnik.de>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* feat(hotkeys, node, ui): Introduce configurable hotkeys and DockNode pages
This commit brings significant updates including configurable hotkeys, a new DockNode section, and various UI enhancements.
**Hotkeys:**
- Add `hotkeys` field to the global configuration schema (`DockStatConfigTable`) and context (`ConfigProviderData`).
- Define `HotkeyAction` type for better type safety of configurable hotkey actions (e.g., "open:quicklinks").
- Set a default hotkey `k` for opening quick links in the database defaults.
- Integrate configurable hotkeys into the `Navbar` and `LinkLookup` components, allowing customization of the quick links modal hotkey.
**DockNode & Stacks:**
- Create new pages for `/node` (DockNode overview) and `/node/stacks` (Stacks within a DockNode).
- Refactor and move the existing `/stacks` functionality to the new `/node/stacks` route, deleting the old `/stacks` page.
- Update the application router and sidebar navigation to reflect the new DockNode structure.
**UI & Accessibility:**
- Enhance the `Card` component with a `tabIndex` prop to improve keyboard navigation and focus management.
- Adjust tab indexing within the `LinkLookup` modal for better accessibility.
- Apply minor styling and structure adjustments to sidebar items, including child item formatting.
**Refactoring:**
- Streamline theme loading state management in the main layout by removing unnecessary `isLoading` prop from `useTheme` consumer.
* feat(hotkeys): Introduce `useHotkey` hook and add sidebar toggle
Create a new `useHotkey` React hook in `@dockstat/utils/react` to provide a centralized and declarative way for components to manage keyboard shortcuts.
- Migrate existing hotkey handling logic in `LinkLookup` component (for quick links modal) to utilize the new `useHotkey` hook.
- Integrate the `useHotkey` hook into the `Navbar` component to manage sidebar `open`, `close`, and `toggle` actions, making hotkey management consistent.
- Add `toggle:sidebar` hotkey (`b` by default) to the default application configuration in `packages/db`.
- Refactor utility imports across `apps/api` and `packages/plugin-handler` to use barrel exports from `@dockstat/utils` (e.g., `import { repo } from "@dockstat/utils"` instead of direct path imports).
- Update various project dependencies.
* fix(formatting): adjusted imports
* feat(docknode-management): Introduce API, UI, and backend for DockNode registration
This commit introduces a comprehensive system for managing DockNode instances from the main DockStat API and frontend. Users can now register, monitor, and remove external DockNode servers, enhancing distributed management capabilities.
**Key Changes:**
* **API (`apps/api`):**
* Added `@dockstat/docknode` and `@elysiajs/eden` dependencies.
* Implemented `DockNodeHandler` to manage DockNode registration within a new `docknode-register` SQLite table. This includes functionality for checking node reachability, creating, and deleting entries.
* Exposed new `/api/v2/node` endpoints (`GET`, `POST`, `DELETE`) for performing CRUD operations on DockNode registrations.
* Defined Elysia TypeBox models for robust API request validation.
* **DockNode (`apps/docknode`):**
* Added a `GET /api/status` endpoint, allowing the main API to perform health checks and determine if a registered DockNode is online.
* Configured the SQLite database to use Write-Ahead Logging (WAL) journal mode for improved performance and data integrity.
* **Frontend (`apps/dockstat`):**
* Created a new "DockNodes" page (`src/pages/node/index.tsx`) in the UI to list, create, and delete DockNode registrations.
* Developed the `DockNodeCard` React component to visually represent each registered node, displaying its status, host, port, SSL usage, and providing options for interaction.
* Integrated new `useEdenQuery` and `useEdenMutation` hooks for seamless interaction with the API.
* **Database & Typings (`packages/db`, `packages/typings`):**
* Refactored the `tls_certs_and_keys` field in the main `config` table to a more generic `keys` object.
* Extended the `keys` object to include a dedicated slot for `docknode` specific API keys, enabling future secure communication.
* Improved type definitions for foreign keys in `packages/sqlite-wrapper`.
* **Utilities (`packages/utils`):**
* Introduced a new set of React Query-based utility hooks (`useEdenQuery`, `useEdenMutation`, `useEdenRouteMutation`) for `elysia/eden` clients. These hooks simplify data fetching and mutations, providing standardized error handling, loading states, and automatic query invalidation.
* Added `@tanstack/react-query` as a dependency.
* **Build & Development:**
* Updated the `dev:dockstat` script to include `--filter=@dockstat/docknode` for integrated development.
* Updated various dependencies across the monorepo.
This feature lays the groundwork for centralized management of distributed DockNode services.
* chore(ci): Lint [skip ci]
* refactor(ui): Enhance Slides animation and DockNodeCard UI
Refactor the `Slides` component in `@packages/ui` to dynamically measure and animate content height. This change leverages `ResizeObserver` to ensure that slides with dynamic content automatically adjust their height during transitions, resulting in a smoother and more responsive user experience. The previous `collapseVariants` animation logic is replaced with direct height and opacity animations. Additionally, the `overflow-hidden` class is removed from the `Slides` `CardBody` as `SlideContent` now manages its own overflow for animation.
Redesign the `DockNodeCard` component in the `dockstat` application, introducing significant visual and structural improvements:
- Updated layout and spacing for better readability.
- Refined typography and enhanced status badges.
- Improved presentation of connection details.
- Restyled `CardFooter` with updated action button presentation and text ("Visit" changed to "Open").
- Minor adjustments to event handling for the delete action, including explicit `e.stopPropagation()`.
* Feat settings page (#76)
* feat(hotkeys): Implement configurable hotkey management
Introduce a comprehensive hotkey management system within the application settings.
- **API:** Added a new `POST /config/hotkey` endpoint to allow users to update and persist their hotkey preferences in the database.
- **Frontend (DockStat):**
- Created a new `SettingsPage` with a dedicated "Hotkeys" slide.
- The `HotkeysSlide` provides an intuitive UI for users to configure global hotkeys, including support for `CTRL + SHIFT + <key>` combinations.
- Integrates with the new API endpoint to save changes and provides immediate feedback.
- **Hotkeys Utility:** Enhanced the `useHotkey` hook to support `shift+key` combinations and a generic `toggle` function, making hotkey handling more flexible.
- **Configuration:** Updated default hotkey configurations to include new actions such as `open:sidebar` and `close:sidebar`.
- **UI Integration:** Adapted components like `Navbar` and `LinkLookup` to consume dynamic hotkey configurations.
- **Database/Typings:** Updated database models and type definitions (`DatabaseModel.hotkeyRes`, `DatabaseModel.hotkeyBody`, `HotkeyAction`) to reflect the new hotkey structure.
* refactor(codebase): Reorder imports and remove unused declarations
* feat(settings): Introduce General Settings page and API config management
This commit introduces a new "General Settings" page in the DockStat frontend and expands the backend API for configuration management.
Key changes include:
* **API & Database (`apps/api`, `packages/db`, `packages/typings`):**
* **Fix(config):** Corrected a widespread typo from `addtionalSettings` to `additionalSettings` in database schemas, typings, default configurations, and API models. This ensures consistency and correctness of the configuration object.
* Added `GET /db/details` and `GET /db/details/:tableName/all` endpoints for database introspection, providing schema information and raw table data.
* Implemented `POST /db/config/additionalSettings` for updating application-wide settings such as `showBackendRamUsageInNavbar`.
* Added TypeBox schemas for `additionalSettingsBody` and `additionalSettingsRes`.
* **Frontend (`apps/dockstat`):**
* Introduced the `GeneralSettingsSlide` component as the main entry point for general settings.
* Implemented `PinnedNavSection` to manage user-pinned navigation links.
* Developed `PinnableLinksSection` to allow users to discover and pin available dashboard links, including those provided by plugins.
* Added `PluginLinksSection` to display all detected plugin-provided routes.
* Created `AdditionalSettingsSection` to control specific application behaviors, starting with the option to display backend RAM usage in the navbar.
* Updated the `/settings` page to integrate the new `GeneralSettingsSlide`.
* Refactored the `ConfigProvider` to correctly handle `additionalSettings` and provide it to the application context.
* Minor UI adjustments in `HostsList` and `ClientsPage` for improved layout and consistency.
* Fixed hotkey display to correctly replace both `_` and `:` with spaces.
* **UI Library (`packages/ui`):**
* Expanded `Badge` component with an `xs` size option.
* Adjusted `Divider` vertical orientation to use `min-h-full` for better responsiveness.
* Enhanced `Slides` component with improved content transition animations and a `ResizeObserver` for dynamic height adjustments.
* Exported `SidebarPaths` and `PathItem` from Navbar for broader use in navigation.
* **Other:**
* Updated `apps/docknode/.gitignore` to include `docknode.db*` for better exclusion of database files and backups.
This comprehensive update streamlines configuration management and provides users with more control over their DockStat experience.
* chore(ci): Lint [skip ci]
* fix(formatting): adjusted imports
* fix(remove unwanted): remove database file from git tree
* feat(ui, api): Enhance UI components and streamline API error responses
Refactor:
- API: Removed redundant 'error' field from additional settings update error response in `db.ts` to ensure consistent error payload with `message`.
Dockstat App:
- UI/Hosts: Simplified the display for "no hosts configured" by removing an unnecessary card and icon.
- UI/Settings: Enhanced pinned navigation section with a fixed height, vertical resizing, and scroll functionality for improved usability.
UI Package:
- Badges: Corrected `xs` badge padding from `py-.5` to `py-0.5` for consistent styling.
- Slides: Fixed `useSlideState` by adding `activeSlide` to `useEffect` dependencies, ensuring proper re-measurement on slide changes.
- Theme Browser: Added `m-1` margin to `ThemePreviewCard` for improved visual spacing between theme previews.
* feat(db:migration): Implement automatic schema migration (#78)
* feat(db:migration): Implement automatic schema migration
This commit introduces automatic schema migration capabilities to the `sqlite-wrapper`.
The `db.createTable()` method now automatically detects schema changes when a table already exists and performs an atomic migration if differences are found. This process ensures smooth schema evolution without manual intervention, including:
- Creating a temporary table with the new schema.
- Copying existing data, mapping common columns and applying defaults for new ones.
- Recreating indexes, triggers, and foreign key constraints.
- Swapping the tables safely within a transaction.
**Key Migration Features & Options:**
- **Schema Detection**: Automatically identifies additions, removals, and changes in column constraints (NOT NULL, UNIQUE, Primary Key status) and types.
- **Data Preservation**: Data is preserved by default (`preserveData: true`), with options to control how constraint violations are handled (`onConflict: 'fail' | 'ignore' | 'replace'`).
- **Customization**: Supports `dropMissingColumns` and `tempTableSuffix` for fine-grained control.
- **Disabling Migration**: Migration can be explicitly disabled per table using `migrate: false` in `TableOptions`.
- **Type Handling**: Correctly migrates JSON and Boolean columns.
This feature significantly simplifies schema management for applications using `sqlite-wrapper`.
A new test suite (`__test__/migration.test.ts`) has been added to thoroughly validate various migration scenarios.
The `README.md` has been updated to document the new "Automatic Schema Migration" feature in detail, including usage examples and best practices. The package version is bumped to `1.3.5`.
* deps(bun): update @types/bun to 1.3.9
* fix(migration): improve migration robustness and add comprehensive tests
Migration robustness:
- Foreign key `PRAGMA` statements are now correctly handled outside the migration transaction, ensuring proper disabling and re-enabling of FK constraints for reliable table alterations.
- Improved logging in `schemasAreDifferent` to provide more detail on column count differences.
- The `currentSchema` is now passed to `migrateTable` from `checkAndMigrate` to avoid redundant database calls.
New migration tests:
- Added a test to verify that migration fails with the default `onConflict` strategy when constraints (e.g., `NOT NULL`) are violated.
- Added tests to confirm that no actual migration (ALTER TABLE) occurs when switching between type aliases (e.g., `TEXT` to `JSON`, `INTEGER` to `BOOLEAN`), ensuring data is preserved and correctly interpreted.
Type centralization:
- Moved `TableColumn`, `IndexInfo`, `ForeignKeyInfo`, and `ForeignKeyStatus` interfaces to `src/types.ts` for better organization and reusability.
Minor fixes and improvements:
- Corrected the in-memory database name check from `:memory` to `:memory:` in the `DB` class.
- Updated README.md to fix a typo from "Wrong packing" to "incorrect packaging".
- Removed the `dropMissingColumns` option from `MigrationOptions` as it was never implemented.
* Sqlite wrapper automatic table migration on schema change (#79)
* feat(db:migration): Implement automatic schema migration
This commit introduces automatic schema migration capabilities to the `sqlite-wrapper`.
The `db.createTable()` method now automatically detects schema changes when a table already exists and performs an atomic migration if differences are found. This process ensures smooth schema evolution without manual intervention, including:
- Creating a temporary table with the new schema.
- Copying existing data, mapping common columns and applying defaults for new ones.
- Recreating indexes, triggers, and foreign key constraints.
- Swapping the tables safely within a transaction.
**Key Migration Features & Options:**
- **Schema Detection**: Automatically identifies additions, removals, and changes in column constraints (NOT NULL, UNIQUE, Primary Key status) and types.
- **Data Preservation**: Data is preserved by default (`preserveData: true`), with options to control how constraint violations are handled (`onConflict: 'fail' | 'ignore' | 'replace'`).
- **Customization**: Supports `dropMissingColumns` and `tempTableSuffix` for fine-grained control.
- **Disabling Migration**: Migration can be explicitly disabled per table using `migrate: false` in `TableOptions`.
- **Type Handling**: Correctly migrates JSON and Boolean columns.
This feature significantly simplifies schema management for applications using `sqlite-wrapper`.
A new test suite (`__test__/migration.test.ts`) has been added to thoroughly validate various migration scenarios.
The `README.md` has been updated to document the new "Automatic Schema Migration" feature in detail, including usage examples and best practices. The package version is bumped to `1.3.5`.
* deps(bun): update @types/bun to 1.3.9
* fix(migration): improve migration robustness and add comprehensive tests
Migration robustness:
- Foreign key `PRAGMA` statements are now correctly handled outside the migration transaction, ensuring proper disabling and re-enabling of FK constraints for reliable table alterations.
- Improved logging in `schemasAreDifferent` to provide more detail on column count differences.
- The `currentSchema` is now passed to `migrateTable` from `checkAndMigrate` to avoid redundant database calls.
New migration tests:
- Added a test to verify that migration fails with the default `onConflict` strategy when constraints (e.g., `NOT NULL`) are violated.
- Added tests to confirm that no actual migration (ALTER TABLE) occurs when switching between type aliases (e.g., `TEXT` to `JSON`, `INTEGER` to `BOOLEAN`), ensuring data is preserved and correctly interpreted.
Type centralization:
- Moved `TableColumn`, `IndexInfo`, `ForeignKeyInfo`, and `ForeignKeyStatus` interfaces to `src/types.ts` for better organization and reusability.
Minor fixes and improvements:
- Corrected the in-memory database name check from `:memory` to `:memory:` in the `DB` class.
- Updated README.md to fix a typo from "Wrong packing" to "incorrect packaging".
- Removed the `dropMissingColumns` option from `MigrationOptions` as it was never implemented.
* refactor(sqlite-wrapper): Extract createTable helper methods
Introduces `normalizeMigrationOptions` to centralize the parsing of the `migrate` option into a standardized `{ enabled, options }` object.
Adds `shouldCheckExistingTable` to encapsulate the conditions for checking if a table already exists (e.g., excluding temporary or in-memory tables).
These private helper methods refactor the `createTable` method, improving its readability and maintainability by extracting complex conditional logic. This makes the `createTable` method more focused on its primary responsibility.
* feat(sqlite-wrapper): Introduce migration onConflict options and SQL-based schema comparison
**Migration Conflict Resolution:** Adds `onConflict` options (`ignore` and `replace`) to schema migration, allowing users to define how existing data is handled when new unique constraints are introduced during a migration.
**Robust Schema Comparison:** Reworks the `schemasAreDifferent` logic to compare the full `CREATE TABLE` SQL statements. This provides a more precise and comprehensive detection of schema changes, including intricate column definitions, constraints, and default values, greatly improving migration reliability.
**SQL Generation Refactoring:** Extracts the `CREATE TABLE` SQL generation into a new `buildTableSQL` utility function, enhancing modularity and reusability.
**Standardized Migration Options:** Normalizes the `migrate` option in `TableOptions` to always be a `MigrationOptions` object, providing a consistent API for configuring migration behavior.
Updates internal schema retrieval mechanisms and tests to leverage the full `CREATE TABLE` SQL for migration decisions.
* fix(sqlite-wrapper): Correct handling of 'migrate' option in migrateTable
* refactor(types): Relax column definition type constraints
The `InferTableSchema` type in `plugin-builder` and `PluginConfig['table']['columns']` (along with `DBPlugin`'s generic type) in `typings` were previously constrained to `Record<string, ColumnDefinition>`.
This commit relaxes these constraints to `Record<string, unknown>`. This change offers greater flexibility for defining columns within plugin configurations and during table schema inference, reducing tight coupling to the `ColumnDefinition` type from `@dockstat/sqlite-wrapper`. It allows for more generic or custom column definitions without needing to strictly conform to `ColumnDefinition` at the interface level.
Additionally, this commit includes minor import reordering in `sqlite-wrapper` and `migration` for consistency.
* feat(sqlite-wrapper): Prevent auto-migration for temporary and in-memory tables
The `createTable` method will no longer automatically apply schema migrations to certain types of tables.
This change introduces an `allowMigration` utility that determines if a table is eligible for automatic schema migration based on its properties and name. Migrations are now explicitly denied for:
- Tables created with the `temporary: true` option.
- In-memory tables (identified by the name `":memory:"`).
- Tables prefixed with `temp_` (which SQLite uses for internal temporary objects).
- Tables used internally by the migration process (matching `_migration_temp` suffix).
This ensures that only persistent, user-managed tables are subject to schema changes, preventing unintended modifications to ephemeral table structures.
Additionally, the `createTable` method now includes a `try...catch` block to handle `SQLiteError` with `errno === 1` (table already exists). This allows the method to gracefully proceed and return the `QueryBuilder` for an existing table even if a `CREATE TABLE` statement fails because the table already exists, ensuring robust behavior in various scenarios.
New tests have been added to validate that temporary and in-memory tables do not trigger automatic schema migrations.
---------
Signed-off-by: ItsNik <info@itsnik.de>
* 80 migrations always run when ifnotexists is true (#81)
* feat(migration): Implement automatic table schema migration and refactor logging
This release introduces robust automatic schema migration capabilities for tables managed by `sqlite-wrapper`, alongside a comprehensive refactor of the internal logging system.
**Automatic Schema Migration:**
* **Intelligent Detection**: `createTable` now automatically detects schema differences (column additions, removals, constraint changes, default values) between the existing table and the desired schema.
* **Data Preservation**: Migrations are performed without data loss by creating a temporary table, copying data, and re-creating the original table.
* **Flexible Conflict Handling**: Supports `onConflict` strategies (`ignore`, `replace`) during migration when adding unique constraints that might conflict with existing data.
* **Index and Foreign Key Preservation**: Ensures that existing indexes and foreign key constraints are re-established after migration.
* **Alias-Aware Type Handling**: Correctly identifies column type aliases (e.g., `JSON` as `TEXT`, `BOOLEAN` as `INTEGER`) to prevent unnecessary migrations.
* **Migration Control**: Introduces `migrate` options to explicitly enable/disable migration or customize the temporary table suffix.
* **Exclusion for Special Tables**: Automatically skips migration for `:memory:` databases and `TEMPORARY` tables.
* **Enhanced Comparison**: The `schemasAreDifferent` logic has been improved to normalize `CREATE TABLE` statements (removing `IF NOT EXISTS` and normalizing quoting) for more accurate comparisons.
**Logging Refactor:**
* **Unified Logger**: Migrated from a custom `SqliteLogger` to `@dockstat/logger` across the entire codebase.
* **Hierarchical Logging**: Implemented `logger.spawn()` to create child loggers for `DB`, `Table`, `Backup`, `Migration`, `QueryBuilder` (and its sub-builders like `Insert`, `Select`, `Update`, `Delete`), and `Transformer` components, providing clearer context in logs.
* **Detailed Messages**: Reviewed and refined log messages for all major operations to provide more informative debug, info, and error output.
**Other Enhancements:**
* **`InsertResult` Extension**: The `insert` and `batchInsert` methods now return an optional `insertedIDs` array in the `InsertResult` type, providing all IDs generated during a batch operation.
* **Comprehensive Testing**: Added extensive unit tests for migration logic, schema difference detection, and various migration scenarios to ensure reliability.
* refactor(logging): Standardize logging with @dockstat/logger
Removed the custom `SqliteLogger` implementation and its associated utilities from `src/utils/logger.ts`.
All logging within the `sqlite-wrapper` package now directly uses `Logger` from the `@dockstat/logger` package.
This change:
- Simplifies the codebase by eliminating a custom logging abstraction.
- Reduces maintenance overhead.
- Ensures consistent logging practices across the Dockstat ecosystem by leveraging a shared library.
- Updated relevant test files (`migration.test.ts`, `schemasAreDifferent.test.ts`) to use the new logger.
- Updated package description to reflect comprehensive features.
* chore(ci): Lint [skip ci]
* fix(sqlite-wrapper): Enhance schema comparison and standardize logging
- **Migration Module:**
- Implement `normalizeCreateTable` helper to robustly handle `IF NOT EXISTS` clauses and quoted identifiers during `CREATE TABLE` schema comparison.
- Update `schemasAreDifferent` to leverage the new normalization for consistent and accurate schema comparisons.
- Adjust test fixture `SCHEMA_WITH_IF_NOT_EXISTS` to include `IF NOT EXISTS` for migration tests.
- **Query Builder Module:**
- Improve logging consistency by using `JSON.stringify` for query parameters in `SelectQueryBuilder` and `UpdateQueryBuilder`.
- Correct logger scope from `INSERT` to `WHERE` in `WhereQueryBuilder`'s constructor.
- Fix "Resseting" typo to "Resetting" in `BaseQueryBuilder`'s `reset` and `resetWhereConditions` debug messages.
- **Package Metadata:**
- Bump package version to `1.3.11`.
- Correct "automati" typo to "automatic" in the package description.
* feat(core): Enhance UI with Framer Motion & refactor multi-client container stats
feat(ui):
- Integrate Framer Motion for smooth animations on buttons and navbar badges, improving overall UI responsiveness and interactivity.
- Redesign General Settings sections for better layout and clarity, introducing a new "Link Settings" header.
- Enhance Extensions page with an onboarding prompt to add the default repository for new users.
- Update Pinned Links icon to 'Pin' and refine sidebar item display by removing unnecessary prefixes.
feat(api):
- Refactor Docker client manager to aggregate container statistics across all initialized clients, providing a unified view via `getAllContainerStats`.
- Update API route `/all-containers` to utilize the new multi-client container stats aggregation.
feat(packages):
- Release `@dockstat/theme-handler` v2.0.0 as a public package, complete with a comprehensive README detailing its features, API, and usage.
chore(deps):
- Update `turbo` to `^2.8.10`.
- Update `@dockstat/sqlite-wrapper` to `1.3.8`.
style:
- Adjust various text colors to use `primary-text` for consistency across UI components.
- Standardize card variants to `flat` in several settings sections for a cleaner look.
- Refine toast success message for additional settings updates.
* fix(query-builder): Adjust logger hierarchy and inheritance
Previously, the `BaseQueryBuilder` would incorrectly spawn an additional "QB" logger from the `baseLogger` provided in its constructor, rather than using the `baseLogger` directly (which is already intended to be the QueryBuilder's logger).
Additionally, descendant query builders (Insert, Select, Update, Delete) would spawn their specific loggers (e.g., "INSERT") directly from the original `baseLogger` passed to `BaseQueryBuilder`. This resulted in these sub-loggers being siblings of the main "QB" logger, instead of children.
This commit corrects the logger initialization logic:
1. `BaseQueryBuilder` now directly uses the `baseLogger` if provided, assuming it is already the designated "QB" logger. If no `baseLogger` is provided, a new "QB" logger is created.
2. Sub-query builders now spawn their specific loggers from `this.log` (the QueryBuilder's main logger), ensuring the correct hierarchical structure: `Root Logger -> QB Logger -> [Delete/Insert/Select/Update] Logger`.
This change improves logging clarity and ensures proper inheritance of log hooks throughout the query builder stack.
* refactor(ui/Button): Extract button and spinner animations to dedicated files
Moved Framer Motion animation definitions for the `Button` component's active/inactive states and the loading spinner into `animations.ts`.
Encapsulated the loading spinner's `motion.span` and its animation logic into a new `ButtonSpinner` component, located in `spinner.tsx`.
This refactoring centralizes animation logic, enhancing modularity and reusability, and cleaning up the main `Button.tsx` file for improved readability and maintainability.
---------
Co-authored-by: actions-user <its4nik@users.noreply.github.com>
---------
Signed-off-by: ItsNik <info@itsnik.de>
Co-authored-by: actions-user <its4nik@users.noreply.github.com>
* feat(ui/theme): Implement comprehensive theme customization and editor
This commit introduces a suite of features for advanced theme customization within DockStat.
Key changes include:
* **Theme Editor UI**: Added new `ThemeEditor` and `ThemeSidebar` components, allowing users to dynamically adjust individual color variables of the current theme directly from the settings page.
* **Dynamic Theme Adjustments**: Enhanced `ThemeProviderContext` with `adjustCurrentTheme` to apply real-time color changes to the application's CSS variables and `isModifiedTheme` to track unsaved changes.
* **New Theme Creation**: Integrated a mutation to `createNewThemeFromCurrent`, enabling users to save their customized theme as a new theme.
* **Improved Theme Persistence**: The selected theme preference now stores both the theme ID and name, providing better context upon reload.
* **Categorized Color Editing**: Theme colors are now categorized by UI component (e.g., Buttons, Cards, Forms) within the `ThemeSidebar` for easier navigation and editing.
* **Logging Enhancements**: SQLite queries now truncate long parameter lists in logs for improved readability.
* **Dependency Updates**: Various packages across the monorepo, including `@dockstat/ui`, `@dockstat/theme-handler`, `elysia`, `react`, and Storybook, have been updated to their latest versions to support these new features and maintain compatibility.
* **Documentation Update**: Updated the `theme-handler` README to reflect the new client-side setup and usage patterns.
This allows for a much more flexible and user-friendly experience for tailoring DockStat's visual appearance.
* feat(theme): Implement theme editor sidebar and hotkeys
Introduces a new dedicated sidebar for theme editing, allowing users to dynamically
adjust theme colors (CSS variables) directly from the application's UI.
This feature includes:
- Integration of a new `ThemeSidebar` component, accessible via a dedicated button
in the main sidebar and configurable hotkeys.
- Addition of `toggle:themeEditor`, `open:themeEditor`, and `close:themeEditor`
hotkeys, with 't' set as the default key for toggling the editor.
- Updates to `db/defaults.ts` and `typings` to support the new hotkeys.
- Refinement of theme color adjustment logic in `layout.tsx` and `settings.tsx`
to use the `adjustCurrentTheme` function for consistent updates.
- Implementation of `reverseSlideInVariants` for the new sidebar's animation.
- Removal of unnecessary `console.log` statements.
* feat(theme): Centralize ThemeSidebar state and globalize rendering
This commit refactors the `ThemeSidebar` component to improve the theme customization experience and ensure its consistent behavior across the application.
* **Centralized State Management**: Introduced `ThemeSidebarContext` and `ThemeSidebarProvider` to centralize the management of the theme sidebar's open/close state and associated theme properties.
* **Global Rendering**: Moved the `ThemeSidebar` rendering from `packages/ui/src/components/Sidebar/Sidebar.tsx` to `apps/dockstat/src/layout.tsx`, making it a global, application-wide overlay.
* **Dynamic Data Provisioning**: `apps/dockstat/src/layout.tsx` now populates the `ThemeSidebarContext` with dynamic theme data and callback functions from the `useTheme` hook, ensuring the sidebar always displays the current theme information.
* **UI Component Integration**: Updated `packages/ui/src/components/Sidebar/Sidebar.tsx` to interact with the theme sidebar exclusively through the new context, removing its internal state management for the sidebar.
* **Theme Sidebar Enhancements**: Enhanced `packages/ui/src/components/ThemeSidebar/ThemeSidebar.tsx` with functionality to track theme modifications and include a placeholder for saving new theme configurations.
* **Modal Transparency**: Applied `transparent` prop to `Modal` components in `packages/ui/src/components/Sidebar/Sidebar.tsx` for improved visual integration.
* **Code Cleanliness**: Performed minor import reordering across several files.
* feat(theme): Implement comprehensive theme management and editor redesign
This commit introduces a complete overhaul of theme management capabilities, including full CRUD operations, a redesigned theme editor UI, and significant improvements to data fetching and state management.
- **Theme Management:**
- Enabled creation of new themes based on the currently active theme's variables.
- Added functionality to delete custom themes directly from the theme browser.
- Refined theme selection to ensure immediate application and persistence.
- **Theme Editor Redesign:**
- Introduced a new, more organized color editing interface with a scrollable list, providing better visibility and detailed information for each color variable.
- Improved layout and integration of individual color pickers.
- **React Query Integration & Enhancements:**
- Introduced `QueryClientContext` for centralized React Query client management.
- Added `edenQuery` as a specialized hook for programmatic Eden API data fetching, complementing `useEdenQuery`.
- Refactored `ThemeProvider` to utilize `edenQuery` for efficient theme list fetching and robust refetching mechanisms.
- Added detailed JSDoc comments to `useBaseEdenMutation`, `useEdenRouteMutation`, and `extractEdenError` for enhanced developer clarity and usage guidance.
- **API & Context Updates:**
- Modified the theme deletion endpoint from using a path parameter (`DELETE /themes/:id`) to accepting the `id` in the request body (`DELETE /themes`).
- Extended `ThemeSidebarContext` to include `addNewTheme` and updated `toastSuccess` to accept theme names, providing more contextual feedback.
- **UI/UX Refinements:**
- Updated text colors in `LinkLookup` to align with the active theme.
- Adjusted `ThemeSidebar` width and integrated a dedicated modal for saving new themes.
- **Hotkeys:**
- Changed the hotkey for `toggle:themeEditor` from `t` to `p` to prevent conflicts.
* refactor(dockstat): Refactor layout into modular hooks and improve context initialization
The monolithic `layout.tsx` component has been refactored into a dedicated `src/layout` directory, organizing related logic into smaller, reusable custom hooks. This significantly improves code organization, readability, and maintainability by separating concerns.
Key changes include:
* **Layout Component Decomposition**: The main `Layout` component is now located in `src/layout/components/Layout.tsx`.
* **Modular Hooks**:
* `useLayout`: Consolidates state and effects for the primary layout.
* `useThemeManager`: Encapsulates theme-related logic, including application, adjustment, and creation.
* `useLogs`, `useRamUsage`, `usePinMutations`, `usePluginRoutes`, `useDeleteTheme`: Extract specific functionalities into dedicated hooks.
* **QueryClient Context Initialization**: The `QueryClientContext` now initializes with a proper `new QueryClient()` instance, ensuring a fully functional client is always provided. The `QueryClientProvider` also now wraps its children with `QueryClientContext.Provider`.
* **Theme Provider Simplification**:
* The `getAllThemes` function has been removed from `ThemeProviderData` and the `ThemeProvider` context, as theme list updates are now handled more directly via `useEdenQuery`.
* Toast notifications related to theme cache updates from theme creation mutations have been removed, aligning with the simplified theme list refresh.
* chore(ci): Lint [skip ci]
* refactor(core): Standardize Eden API query functions and streamline React Query setup
- **feat(eden-query)**: Introduced `createEdenQueryFn` helper to standardize query function creation for Eden API calls, including signal handling and error extraction.
- Centralized Eden-related types (`EdenQueryRoute`, `EdenQueryData`, `UseEdenQueryOptions`) in a dedicated file, removing duplication from `useEdenQuery`.
- **refactor(query-client)**: Exported a singleton `QueryClient` instance from its context file and simplified `QueryClientProvider` to use this shared instance, removing redundant instantiation.
- **refactor(theme)**: Cleaned up `useThemeManager` by removing unnecessary `useRef` wrappers for theme application functions. Refactored theme application logic in `ThemeProvider` using `applyThemeEffect` for improved reusability and state management.
- **fix(layout)**: Corrected an incorrect hotkey assignment for opening the sidebar in the `Layout` component.
* chore(ci): Lint [skip ci]
* refactor(theme-management): Decouple theme sidebar contexts and streamline prop passing
Refactor theme sidebar state management to improve separation of concerns and reduce prop drilling.
- Split the monolithic `ThemeSidebarContext` into:
- `ThemeSidebarContext`: For domain logic (e.g., `addNewTheme`).
- `ThemeSidebarUIContext`: For UI state (e.g., `isThemeSidebarOpen`).
- Eliminated the `themeProps` object; individual theme-related properties are now passed explicitly to components (`Navbar`, `Sidebar`, `ThemeSidebar`).
- Introduced a new `useLayout` hook to centralize layout-related data and theme management logic.
- Restructured `ThemeSidebarProvider` to utilize the new, separate UI and domain contexts.
- Added support for `toggle:themeEditor` hotkey to control the theme sidebar visibility.
- Enhanced `ThemeEditor` component with a `multiColumn` prop for improved layout flexibility.
* chore(ci): Lint [skip ci]
* refactor(core): Streamline theme data flow and module resolution
* refactor(theme): Simplify theme sidebar provider and clean up Navbar theme props
Merged ThemeSidebarDomainProvider into ThemeSidebarProvider to streamline theme sidebar logic and state management.
Removed currentThemeName and currentThemeColors props from Navbar component, as these are now directly accessed via the useTheme context.
* fix(dockstat-thememanager): Add ref dependencies to theme manager useEffects
* This is a test branch for me currently, this is not the final implementation!
* adjustments
* feat(graph, api, ui, docker-client): Enhance infrastructure graph with DockNodes and containers
This commit introduces a comprehensive update to the infrastructure graph visualization, expanding it to include DockNodes and individual Docker containers. This enhancement provides a more complete overview of the monitored environment by integrating all layers of infrastructure into a single, interactive graph.
**Key changes include:**
* **API Enhancements (`apps/api`):**
* Introduced new `calculateNodeLayout` and `reachableStatus` helpers to dynamically arrange and standardize the status of all node types (clients, hosts, docknodes, containers).
* Added robust `GraphModel` schemas for API request/response validation, including definitions for new node types (docknode, container) and their respective data structures.
* The `/graph` API endpoint now aggregates data from clients, hosts, docknodes, and containers, processing them into a React Flow-compatible format for the frontend.
* Centralized the `DockNodeHandler` instance, improving resource management and consistency.
* **Frontend UI Overhaul (`apps/dockstat`):**
* Integrated `@xyflow/react` for a powerful and interactive graph visualization experience.
* Implemented dynamic node types (`client`, `host`, `docknode`, `container`) with distinct visual representations and associated data.
* Developed a detailed `NodeDetailsPanel` to display contextual information for selected nodes, including IP, port, status, image, and IDs.
* Updated `StatsDisplay` and `Legend` components to accurately reflect the expanded infrastructure components.
* Added graph controls like `fitView`, background dots, and snap-to-grid functionality for better usability.
* **Docker Client Improvements (`packages/docker-client`):**
* Modified container mapping to include `clientId`, enabling correct association of containers with their respective client instances in the graph.
* Introduced a new `pingHost` method to check the reachability of individual hosts, improving granular status monitoring.
* Enhanced worker message handling and error reporting for greater robustness.
* feat(graph): Add infrastructure graph visualization
This commit introduces a new, interactive infrastructure graph page to visualize the entire Docker client ecosystem.
The backend has been refactored to use the `dagre` library for automated and more robust node layout, replacing the previous manual positioning logic. The `/api/graph` endpoint now provides comprehensive data, including clients, hosts, docknodes, and newly added container information, leveraging enhanced data types.
Key changes include:
- **Backend (`apps/api`):** Migrated graph layout calculation from a custom algorithm to `dagre`. New graph calculator, helper functions, and types were introduced. The `/api/graph` response now includes detailed container information.
- **Frontend (`apps/dockstat`):** Implemented a dedicated `/graph` page using React Flow. New UI components like `GraphFlow`, `NodeDetailsPanel`, `Legend`, and `StatsDisplay` were created to render the graph and its associated data dynamically.
- **`docker-client` package:** Modified container information mapping to include `clientId`, ensuring containers are correctly associated with their respective clients. Host information was also enriched with `host` and `port` details for better graph representation.
- **`typings` package:** Updated `DOCKER.ContainerInfo` to include `clientId` and `DockerClientManagerCore.getAllHosts` return type to include `host` and `port`.
- **`ui` package:** Extended UI components with new styling variables for graph nodes and introduced a `custom` card variant for flexible node rendering.
- **Navigation:** The new graph page is accessible via the sidebar navigation.
* feat(ui): Redesign graph visualization with Geist fonts and new theme
- Integrate Geist…
- Run `biome format` on all projects - Reorder package.json keys for consistency - Update and clean up tsconfig.json configurations - Reorganize dependencies and scripts in package.json files - Cleanup unused and duplicate code across packages
…pping - Update docker-compose environment to disable AUTH - Refactor system, images, and container logic to use @bun-docker v2 API methods - Implement `mapToLowercaseProperties` to normalize container data for event proxying - Fix event stream processing to handle single objects returned by API - Add DockerError support and improve error propagation in manager core - Enhance metrics collection to explicitly map host and container properties - Fix network stats iteration bug in ContainerMetricsMonitor
…d utilities [N/A] - Added comprehensive test suites for connection configuration, DockerError handling, logger functionality, request options, response processing, URL building, and WebSocket state management. - Improved environment variable parsing and validation logic in utils/env.ts. - Enhanced logger with better configuration resolution and child logger support. - Refined URL and request option builders for better TCP/Unix mode support. - Added JSDoc documentation to core utility and module classes.
- fix: add robust input header parsing in `prepareRequestOptions` - fix: validate `DOCKER_TIMEOUT` in `getConnectionConfig` to prevent NaN - feat: add `isSocketAvailable` utility and extensive `loadTls` test coverage - refactor: update `ContainerEventMonitor` to track 'dead' states and clean up `Input` component accessibility props - chore: improve type safety in `eventStreamMonitor` and `ContainerMetricsMonitor`
* chore(repo): run biome formatting and cleanup across all packages - Run `biome format` on all projects - Reorder package.json keys for consistency - Update and clean up tsconfig.json configurations - Reorganize dependencies and scripts in package.json files - Cleanup unused and duplicate code across packages * Format code with Biome * refactor(docker): update to @bun-docker API and improve event data mapping - Update docker-compose environment to disable AUTH - Refactor system, images, and container logic to use @bun-docker v2 API methods - Implement `mapToLowercaseProperties` to normalize container data for event proxying - Fix event stream processing to handle single objects returned by API - Add DockerError support and improve error propagation in manager core - Enhance metrics collection to explicitly map host and container properties - Fix network stats iteration bug in ContainerMetricsMonitor * test(bun-docker): add unit tests for environment, errors, logging, and utilities [N/A] - Added comprehensive test suites for connection configuration, DockerError handling, logger functionality, request options, response processing, URL building, and WebSocket state management. - Improved environment variable parsing and validation logic in utils/env.ts. - Enhanced logger with better configuration resolution and child logger support. - Refined URL and request option builders for better TCP/Unix mode support. - Added JSDoc documentation to core utility and module classes. * chore(deps): refactor docker client utilities and improve reliability - fix: add robust input header parsing in `prepareRequestOptions` - fix: validate `DOCKER_TIMEOUT` in `getConnectionConfig` to prevent NaN - feat: add `isSocketAvailable` utility and extensive `loadTls` test coverage - refactor: update `ContainerEventMonitor` to track 'dead' states and clean up `Input` component accessibility props - chore: improve type safety in `eventStreamMonitor` and `ContainerMetricsMonitor`
- Update `@types/bun` to 1.3.12 across the workspace - Remove `timeout` configuration from `ConnectionConfig` and related logic - Add `@dockstat/docker` as a dependency to `@dockstat/typings` - Improve header processing in `prepareRequestOptions` - Enhance `ContainerStatsInfo` interface with Docker API spec types - Clean up unused test utilities in `bun-docker`
…I-123] Replace the non-standard Math.random based string generation with Bun.randomUUIDv7 to ensure better uniqueness and performance when generating badges.
…123] Adjust the import order in packages/repo-cli/src/utils/badge.ts to ensure proper grouping and readability by moving the local type import below the external Bun import.
…r client management - Added a toggle in General Settings to enable/disable toast notifications for backend errors. - Integrated `deleteClientMutation` in the `ClientCard` component with automatic query invalidation. - Updated `DockerModel` to include success status in error responses. - Adjusted logging in the metrics middleware to use debug level for tracked errors. - Removed unused timeout constants from `bun-docker` and `docker-swarm` packages. - Refactored `DockerClientElysia` route documentation.
- Clean up code formatting, indentation, and spacing across multiple components and hooks. - Reorder properties in object definitions for improved readability. - Fix minor stylistic inconsistencies in React components and TypeBox models. - Reorganize hook logic and prop ordering for better maintainability.
…entation - Added better-auth and @better-auth/api-key dependencies - Configured better-auth instance with SQLite database and plugins - Implemented OpenAPI schema generator for better-auth endpoints - Mounted auth handler into the Elysia application - Integrated better-auth documentation into Scalar OpenAPI UI - Added BASE_URL environment variable declaration
- Added biome-ignore comments for explicit-any types in the OpenAPI configuration to align with Better Auth implementation patterns. - Imported OpenAPISchemaType from better-auth in elysia-plugins.ts.
…UTH-123] - Added biome-ignore for explicit any usage in OpenAPI components as per upstream example - Removed unused OpenAPISchemaType import from better-auth in elysia-plugins.ts
* feat(auth): integrate Better Auth with admin and API key management - Add database initialization for Better Auth tables (user, session, account, verification, apikey) - Enable Better Auth admin and API key plugins in the backend - Implement Accounts settings UI with management sections for users, API keys, and OAuth providers - Add custom hooks and mutations for account management operations - Update OpenAPI path prefix to /api/v2/auth for better route organization * feat(auth): integrate better-auth as an Elysia plugin - Add Zed editor configuration for Biome and TypeScript support - Refactor authentication setup to expose a reusable `betterAuthPlugin` for Elysia - Update API entry point to use the new authentication plugin and reorder middleware initialization * chore(config): add path aliases and minor auth cleanup [TASK-000] - Add @dockstat/api path alias to tsconfig.json for both api and dockstat apps - Clean up unused import in elysia-plugins - Improve readability of getSession call in auth plugin - Export CommandResult type in docknode treaty * test(auth): refactor again * Add elysia-decorators package with type safety Implements a decorator-based routing system for Elysia JS with full TypeScript type safety via TypeBox schema extraction. Includes comprehensive documentation with examples and migration guides. Features: - Proper @controller() decorator pattern (fixes ts 1206 errors) - Type extraction utilities for compile-time safety - Support for @BodySchema, @QuerySchema, @ParamsSchema, etc. - Dual pattern support (context destructuring and parameter decorators) - typedRoute helper for functional style handlers - Extensive documentation on type safety approaches * Replace elysia-decorators with auth package The new auth package introduces database schemas and handlers for users, API tokens, and OIDC providers. The API application has been updated to use the new AuthHandler for managing users and API keys. * feat(sqlite-wrapper): add support for type-safe JOIN operations [v1.5.0] - Implement join, innerJoin, leftJoin, rightJoin, fullJoin, and crossJoin methods - Add generic type merging to allow IntelliSense for joined table columns - Support join conditions via simple column mapping or raw SQL expressions - Enable table aliasing for complex queries and self-joins - Update README documentation with join examples and migration notes - Add extensive type-safe JOIN unit tests in __test__/join-types.test.ts - Refactor QueryBuilder architecture to support chained result type transformations * feat(sqlite-wrapper): refactor logging and improve debug visibility [no-ticket] - Standardize log formatting across all query builders and database operations by adding bracketed prefixes (e.g., [INIT], [SELECT], [TRANSACTION]) for better traceability. - Enhance logging detail with operational context and result summaries in query-builder modules. - Refactor `BaseQueryBuilder` to include a `logWithTable` helper for consistent logging. - Update `transformFromDb` and `transformToDb` to provide more granular debug information during data serialization. - Correct boolean expectation in `join-types.test.ts` and update serialization test in `transformer.test.ts` to be more robust. * feat(sqlite-wrapper): refactor join API to accept QueryBuilder instances for type-safe inference - Update join methods (join, innerJoin, leftJoin, etc.) to accept a `QueryBuilder` instance instead of a string table name. - Implement automatic parser merging for joined tables to ensure correct column transformation (e.g., boolean/date/json parsing) on joined data. - Update type-safe documentation and examples to remove generic type parameters in join calls. - Improve `BaseQueryBuilder` with public accessors for table names and parsers to facilitate cross-builder interactions. - Cleanup unused `tableParsers` state in the main DB class. * feat(knip): advanced linting * Elysia OIDC/OAuth proxy (#101) * feat(auth): implement OIDC authentication provider - Refactor AuthHandler to use openid-client for OIDC integration - Add OIDC providers table to manage client configurations - Add auth routes to API for login/callback flows - Add frontend auth hooks (useAuth) and protected route components - Update project dependencies with elysia-oauth2 and openid-client - Improve type safety for SQLite wrapper index creation * feat(auth): implement secure OAuth callback flow with JWT - Added `jose` to handle JWT creation for secure user session transmission - Updated AuthHandler to include state, nonce, and PKCE verification cookies - Refactored frontend auth callback to process JWT tokens instead of direct API response - Added `FRONTEND_URL` environment variable for cross-origin redirects - Enhanced logging in the auth flow for improved debugging - Updated SignInPage UI to support dynamic provider discovery and selection - Refactored ProtectedRoute to use updated auth logic * feat(auth): implement OIDC logout flow and user session display - Added `/auth/:providerId/logout` endpoint to `@dockstat/auth` to support OIDC end-session redirection - Enhanced `useAuth` hook to manage provider ID tracking and handle logout redirects - Updated `Navbar` and `Sidebar` components to display the authenticated user's identifier - Added logout action to the UI sidebar - Refactored `AuthHandler` to store `logout_url` and improve environment variable handling for JWT secrets * refactor(auth): modularize AuthHandler and bump dependencies - Move configuration logic to ConfigService - Move route definitions to separate file - Update API entry point to use AuthHandler.routes property - Bump turbo to 2.9.6 and bun-types to 1.3.13 - Add version field to @dockstat/auth package.json * refactor(api/auth): update route documentation, add auth client and improve plugin management - Add missing OpenAPI summaries and descriptions to various API routes - Clean up unused parameters in Docker client routes - Refactor plugin installation type casting and enhance unloadPlugins documentation - Implement `useAuth` React hook in `@dockstat/auth` - Update auth route handlers to use Elysia `redirect` utility - Add missing documentation to auth routes * feat(auth): add ProtectedRoute and reorganize auth client exports - Add ProtectedRoute component for route guarding - Reorganize @dockstat/auth/client exports - Update layout to handle auth state and user display in navbar - Refactor system stats route logic for better maintainability - Add DOM lib to auth package for browser-based auth utilities - Minor cleanup of route documentation summaries and internal code formatting * feat(auth): implement ElysiaJS authentication middleware and React Context provider - Add `createAuthMiddleware` to `@dockstat/auth` for JWT-based request authentication in ElysiaJS. - Integrate authentication middleware into `DockStatAPI` via `apps/api`. - Introduce `AuthProvider` in `@dockstat/auth/client` for improved React state management, including cross-tab sync and automatic token refresh. - Add comprehensive documentation for new authentication middleware and React integration in `packages/auth/README.md`. - Deprecate legacy hook-based authentication approach in favor of the new Context API. - Add utility functions for WebSocket authentication and protected route handling. * refactor(auth): migrate authentication to use route guards and unify middleware - Remove manual middleware usage in API routes and move to a centralized `.guard(authenticated(), ...)` pattern. - Consolidate auth middleware into `middleware/auth.ts`. - Update `DockStatAPI` to enforce authentication globally for core services via guards. - Remove deprecated accounts UI components. - Fix TS path mapping for `@dockstat/auth` package and adjust client-side routing to use the new `CreateRoutes` wrapper. - Upgrade `elysia` to 1.4.28 and bump `@dockstat/auth` dependency versioning. * feat(auth): implement token-based authentication and configure QueryClient [DOCK-123] - Add auth_token support to Eden Treaty API client via Authorization header - Persist auth_token to localStorage during sign-in - Configure TanStack Query default options with staleTime, gcTime, and retry strategies - Cleanup SignInPage logic to improve state handling and remove redundant user redirection logic * feat(auth): refactor authentication to provider-based middleware - Refactor `AuthHandler` to expose middleware via `getMiddlewareFunctions` - Update API and Elysia plugins to use factory-provided middleware and proper OpenAPI security schemes - Clean up `packages/auth` exports and deprecate old `useAuth` API - Update JWT expiration time to 1 day - Improve authorization header handling in `lib/api` - Added comprehensive logging to the authentication middleware flow * style(refactor): apply consistent formatting across codebase - Reorder properties in Elysia openapi configuration - Correct indentation and spacing in QueryClient, React Router, and auth middleware - Improve readability of exported middleware functions - Add missing whitespace in api.ts and other utility files * refactor(deps): clean up code style and unused imports [DOCK-000] - Replace standard string concatenation with template literals in SignIn.tsx - Remove unused imports in router.tsx and AuthProvider.tsx - Update property access and prefix unused variable with underscore in middleware.ts for better linting compliance * feat(auth): implement encryption for client secrets - Add `cryptr` dependency to encrypt/decrypt OAuth client secrets. - Update auth routes and config service to handle secret transformation. - Introduce `CRYPTO_SECRET` environment variable for encryption key management. - Refactor `authenticated` middleware type hint. - Replace manual SVG with `ArrowRight` icon in `SignIn` page. * refactor(auth): fix import ordering and type formatting [AUTH-000] Reordered imports in config.ts and routes.ts to maintain consistency and updated type casting syntax in routes.ts for improved readability. * feat(auth): add support for local username/password authentication - Introduce `LocalUsersTable` and implement database storage for local accounts - Add registration, login, and exists check endpoints to the Auth service - Implement password hashing using argon2id and secure token generation - Update encryption utility to support asynchronous operations - Add UI for local login on the SignIn page, conditionally displayed if local users exist - Update AuthHandler to manage user repository and provide routes - Refactor authentication middleware to use compatible schema types * feat(auth): implement API key authentication and management system - Add `api-keys` table to `AuthHandler` for storing hashed API keys - Implement API key validation middleware in `packages/auth` - Add support for `Authorization: Api-Key <key>` and `X-API-Key` headers - Add `/api-keys` CRUD routes for key generation, listing, and revocation - Create `SignInPage` and `AuthCallback` pages in `apps/dockstat` - Add UI logic to hide sidebar/navbar on the login route - Update `CommandResult` type definition in `apps/docknode` * refactor(deps/ui): clean up API types and adjust sign-in form markup [DS-000] - Remove unused CommandResult import in docknode/index.ts. - Define explicit ApiClient type for the Elysia eden treaty in dockstat/lib/api.ts. - Replace label elements with p tags in SignIn.tsx to resolve hydration/DOM nesting warnings. - Remove unused redirect parameter from the login auth route handler. * feat(auth): overhaul sign-in page UI and layout [DOCK-123] - Introduced a modernized, dark-themed login interface with animated background orbs and glassmorphism effects. - Integrated brand logo into the authentication flow. - Refactored layout to handle conditional padding for the login page specifically. - Enhanced the visual feedback for loading, error, and provider-selection states. - Cleaned up redundant comments and improved input field styling. * feat(auth): refactor login page with animated background and improved UI - Add new `SignInPage` component with `AnimatedIconBackground` and `HeroPanel` - Add `FeaturePill`, `LocalLoginForm`, and `ProviderList` components for modular auth UI - Integrate `react-simple-icons` for provider branding - Remove legacy `apps/dockstat/src/pages/auth/SignIn.tsx` - Add `DOCKSTAT_API_PORT` to API env and update `auth` package env keys to `DOCKSTAT_AUTH_*` - Clean up Dockerfile and minor layout component styles * feat(auth): add header-based authentication support across API calls - Introduce `getAuthHeaders` utility to retrieve and format Authorization headers. - Update `eden` query and mutation hooks to support passing custom `opts` (headers). - Refactor all API service calls and mutation definitions to include auth headers. - Remove redundant/deprecated Eden helper files in favor of unified `opts` support. - Improve error feedback in `AddClient` component. - Fix client secret decryption issue in OIDC config. * feat(auth): implement guest registration system and improve request logging [#DS-001] - Refactor RequestLogger into a factory function to support per-request state tracking. - Add comprehensive error logging with duration tracking for API requests. - Introduce `LocalRegistration` component and user mutation hooks for the sign-in page. - Add `/auth/local/register` and `/auth/local/allow-guest` endpoints to the AuthHandler. - Add administrative control to toggle guest registration. - Optimize `SignInBg` component by switching from Framer Motion to pure CSS animations for improved performance. - Update `AuthHandler` to manage guest registration status dynamically. - Update database default configuration schema to include registration settings. * refactor(core): implement centralized request state management and upgrade Eden client - Refactored `requestLogger` to use a `WeakMap` for per-request state tracking (`startTime` and `reqId`). - Updated `AuthHandler` and middleware to inject the state map, enabling context-aware logging and auth checks. - Overhauled `EdenClient` to handle automatic authorization headers and unified toast notifications for mutations. - Updated `onError` handler to globalize error processing. - Enhanced API registration logic to include automated onboarding for the first user. * refactor(auth): migrate to EdenClientContext for API authentication [AUTH-001] - Replace manual header injection and `eden` global object usage with `EdenClientContext` throughout the codebase. - Implement token management via `EdenClientContext` in `Layout`, `AuthCallback`, and authentication-related hooks. - Remove redundant `useAuth` hook and consolidate header management logic. - Standardize `eden.query` and `eden.mutate` calls to consume the client from context. * Adjust dev scripts and turbo config (#102) * Adjust dev scripts and turbo config - Use `docker-compose` syntax in docker-up script - Silence docker output when running API dev server - Add global passthrough for DOCKSTAT_LOGGER_IGNORE_MESSAGES * Update tooling and clean up code - Switch to `docker compose` v2 - Expand globalPassThroughEnv in turbo.json - Remove unused variables and imports - Use template literals for strings - Fix void return in AuthHandler - Add Biome ignore comments * Pass OAuth token via HttpOnly cookie instead of URL This prevents token leakage through browser history, referrer headers, and server logs. Also adds auth requirements to provider endpoints, improves JWT secret validation, fixes CPU calculation units, and cleans up excessive OAuth logging. * Improve bun usage (#103) * Pass OAuth token via HttpOnly cookie instead of URL This prevents token leakage through browser history, referrer headers, and server logs. Also adds auth requirements to provider endpoints, improves JWT secret validation, fixes CPU calculation units, and cleans up excessive OAuth logging. * Migrate to bun-types and update Bun configuration * Prefix auth env vars and refactor timeout --------- Signed-off-by: ItsNik <info@itsnik.de> * Refactor sign-in page with tabbed interface Combine login and registration into tabs Inline form components into SignIn page Update ProviderList styling and empty state Allow unauthenticated access to providers endpoint Update auth package dependencies and environment variables * Simplify sign-in background effects Replace framer-motion and complex animations with lightweight CSS. Add more provider icons and update sign-in page logic. * Add auth provider and user management features - Add name and icon fields to providers table and API - Add delete endpoints for providers and users - Add list users endpoint - Improve auth callback page with animated background - Replace accounts settings placeholder with component - Fix Tailwind important syntax for v4 compatibility - Treat auth callback routes as login pages in layout * Add accounts settings components and hooks Adds UI sections for managing local users, API keys, and OAuth providers. Includes query and mutation hooks for account data operations. * Use cookies instead of URL params for auth tokens Add server-side token verification via /auth/verify endpoint, replacing client-side JWT decoding. Also auto-select the register tab when no local users exist and add API key security scheme to OpenAPI docs. * Refactor OAuth provider icons to use DB-stored names Replace hardcoded URL-based provider icon detection with database-driven icon mapping. Centralize provider types in the shared @dockstat/auth package. * Add guest registration toggle and improve auth handling - Add enableRegistration setting with live toggle in general settings - Pass allowGuestRegistration to AuthHandler and support runtime updates - Add create local user dialog with validation in accounts section - Fix auth cookie path and send token via Authorization header in callback verification - Extract reusable AdditionalSettingsCard component - Memoize active/revoked API key filtering - Add null check for OAuth provider icons * Improve auth error handling and date parsing Display dynamic error messages in HeroPanel with auto-dismiss. Add parseApiDate utility to handle ISO strings, Unix timestamps, and Date objects. Serialize Unix timestamps to ISO format in backend responses. Enhance background icon animations with multi-axis drifting. Prevent users from deleting their own account in settings. * Enhance error handling and auth - Add error handler middleware with request ID logging - Refactor auth forms: remove Card wrapper, centralize error handling - Move SignIn page to separate component - Add minimal development script - Update error display utilities and imports * Add efficiency reporting and caching improvements to DockStat backend * Introduce @dockstat/errors for unified error handling Add a new @dockstat/errors package with a DockStatError class, standardized error codes, and helper functions. Refactor the API error handler and route handlers to use typed errors with consistent response shapes (code, message, details). * Sign in should now be done! * Format * Migrate to cookieStore --------- Signed-off-by: ItsNik <info@itsnik.de> * Resolve reported issues * chore(ci): Lint [skip ci] --------- Signed-off-by: ItsNik <info@itsnik.de> Co-authored-by: actions-user <its4nik@users.noreply.github.com>
* Version bump * Add changeset * Adress sourcery reports
🦋 Changeset detectedLatest commit: 5cb1a35 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedToo many files! This PR contains 191 files, which is 41 over the limit of 150. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (191)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ntain permissions' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: ItsNik <info@itsnik.de>
Finally, a new update to the main branch, this is still no release, nor beta-release. I am sorry for the delays 😞