### Run Deno BaaS Example Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-deno-baas/README.md Execute this command to start the Deno BaaS example using Barrits. ```bash deno task start ``` -------------------------------- ### Run Development Server and Build Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-solid/README.md Commands to start the SolidJS development server and generate the production build. ```bash npm run dev # Start the SolidJS development server npm run build # Generate the production build ``` -------------------------------- ### createBarrits(options?) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Starts the application by dynamically building the SDK context based on the configuration file, allowing renaming of the system root. ```APIDOC ## createBarrits(options?) ### Description Starts the application by dynamically building the SDK context based on the configuration file. ### Purpose Allows renaming the system root (dynamic namespace) by injecting predefined domains (`logic`, `traits`) into the local object without breaking the IDE or Typings Tooling. ### Usage Invoked asynchronously at the consumer application boot and returns a typed instance with a custom `namespace`. ### Where used In main scripts of `examples/example-nodejs` as a corporate replacement for global variables. ``` -------------------------------- ### Run Svelte Development Server Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-svelte/README.md Starts the Svelte development server for local testing and development. ```bash npm run dev ``` -------------------------------- ### Running Vue Development and Build Servers Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-vue/README.md Use these commands to start the Vue development server or generate the production build. ```bash npm run dev # Start the Vue development server npm run build # Generate the production build ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/zuccadev-labs/barrits/blob/main/CONTRIBUTING.md Commands to clone the Barrits repository, navigate into the directory, and install project dependencies using npm. ```bash git clone https://github.com/zuccadev-labs/Barrits.git cd Barrits npm ci ``` -------------------------------- ### Node.js Execution Commands Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-nodejs/README.md Common npm scripts for running the Node.js example, including development server, algorithm walkthrough, benchmarks, and validation checks. ```bash npm run dev # Start the service entrypoint npm run showcase # Execute the full algorithm walkthrough npm run benchmark:algorithms # Run performance benchmarks npm run demo:validation # Execute operational validation checks ``` -------------------------------- ### Install @zuccadev-labs/barrits with npm Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/01-installation.md Use this command to install the package for Node.js, Bun, and browser bundler projects. ```bash npm install @zuccadev-labs/barrits ``` -------------------------------- ### readBuildManifestSummary Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads a build manifest and directly returns its summary. This is a convenient way to get a high-level overview of the manifest. ```APIDOC ## readBuildManifestSummary(path, readTextFile) ### Description Reads the manifest and returns its summary directly. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the build manifest file. - **readTextFile** (function) - Required - A function that reads the content of a file as text. ### Appears In `examples/example-tauri/src/main.ts` ``` -------------------------------- ### Execute Development and Build Commands Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-react/README.md Use these commands to start the development server with the Barrits plugin active or to generate the production build with artifact materialization. ```bash npm run dev # Start the development server with the plugin active npm run build # Generate the production build with artifact materialization ``` -------------------------------- ### Execute Cross-Runtime Validation Commands Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/agents/skills/barrits-cross-runtime-validation/SKILL.md Use these commands to build the core, verify JSR publishing, and execute runtime-specific example checks. ```bash # Build and verify the industrialized core npm run build && npm test # Verify JSR surface in isolation npm run publish:jsr:dry-run # Run cross-runtime example checks deno task build # Inside example-deno node src/main.js # Inside example-nodejs ``` -------------------------------- ### Git Branching and Committing Source: https://github.com/zuccadev-labs/barrits/blob/main/CONTRIBUTING.md Example Git commands for creating a new branch, committing changes with a conventional commit message, and pushing to a remote branch. ```bash git checkout -b feature/amazing-feature git commit -m 'feat: add amazing feature' git push origin feature/amazing-feature ``` -------------------------------- ### Define Barrits Config Example Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09d-api-reference-traits-and-composition.md Example of defining traits within the package configuration using `defineBarritsConfig`. ```APIDOC ## Usage in Package Configuration Traits can also be defined in the package configuration via the `contracts` trait in `barrits.config.ts`: ```ts // barrits.config.ts import { defineBarritsConfig } from "@zuccadev-labs/barrits"; export default defineBarritsConfig({ contracts: { traits: [ { name: "AuthDomain", provides: ["auth-session", "database-adapter"], conflicts: ["legacy-adapter"], state: ["currentUser", "connectionPool"], consumes: ["logger", "config"] } ] } }); ``` This is equivalent to defining the trait with JSDoc or `createTraitDescriptor` but avoids modifying source files. ``` -------------------------------- ### Run Demonstration Walkthrough with Bun Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-bun/README.md Execute the demonstration walkthrough using the Bun runtime. This command is useful for showcasing the functionality and behavior of the SDK. ```bash bun run showcase ``` -------------------------------- ### createBuildManifestSummary(manifest) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Generates a condensed summary of the build manifest. Appears in: examples/example-react/src/main.jsx, examples/example-vue/src/App.vue, examples/example-solid/src/main.tsx, examples/example-svelte/src/App.svelte, examples/bundlers/*-manifest-entry.mjs. ```APIDOC ## createBuildManifestSummary(manifest) ### Description Generates a condensed summary of the build manifest. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **manifest** (object) - Required - The build manifest object. ### Request Example ```ts import { createBuildManifestSummary } from "@zuccadev-labs/barrits"; const summary = createBuildManifestSummary(manifest); console.log(summary.domains); ``` ### Response #### Success Response (200) - **summary** (object) - A condensed summary of the build manifest. #### Response Example ```json { "domains": [...], "entryPoints": [...] } ``` ``` -------------------------------- ### createBarrits(options?) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Initializes the SDK by dynamically building the context based on the configuration file. Solves: Enables renaming the root system namespace (dynamic namespace injection) while keeping the IDE and typings tooling intact. ```APIDOC ## createBarrits(options?) ### Description Initializes the SDK by dynamically building the context based on the configuration file. Solves: Enables renaming the root system namespace (dynamic namespace injection) while keeping the IDE and typings tooling intact. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **options** (object) - Optional - Initialization options. ### Request Example ```ts import { createBarrits } from "@zuccadev-labs/barrits"; const app = await createBarrits(); // app.logic, app.traits, app.routes — available under the configured namespace ``` ### Response #### Success Response (200) - **app** (object) - The initialized Barrits application context. #### Response Example ```json { "logic": { ... }, "traits": { ... }, "routes": { ... } } ``` ``` -------------------------------- ### readBuildManifestSummary(path, readTextFile) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads the manifest and returns its summary directly. ```APIDOC ## readBuildManifestSummary(path, readTextFile) ### Description Reads the manifest and returns its summary directly. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the build manifest file. - **readTextFile** (function) - Required - A function that reads text content from a given path. ### Appears In `examples/example-tauri/src/main.ts` ``` -------------------------------- ### Initialize and Use IoC Container Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/10-deno-baas-core.md Demonstrates initializing the BarritsIoCContainer with a manifest, registering custom capabilities, wiring dependencies, and resolving instances. ```typescript import { BarritsIoCContainer } from "@zuccadev-labs/barrits/ioc"; // 1. Initialize container with the AST manifest const container = new BarritsIoCContainer(manifest); // 2. Register capabilities (e.g. your custom Database or Services) container.register("Database", () => { return new CustomDatabaseAdapter("connection_string"); }); // 3. Auto-Wire all dependencies across your application await container.wire(); // 4. Resolve instances easily const db = await container.resolve("Database"); ``` -------------------------------- ### createDenoFileSystemAdapter() Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Creates a Deno filesystem adapter for discovery and inspection. ```APIDOC ## createDenoFileSystemAdapter() ### Description Creates a Deno filesystem adapter for discovery and inspection. ``` -------------------------------- ### readNodeBuildManifestSummary(path) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads and summarizes the manifest from disk. ```APIDOC ## readNodeBuildManifestSummary(path) ### Description Reads and summarizes the manifest from disk. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the build manifest file. ### Request Example ```ts import { readNodeBuildManifestSummary } from "@zuccadev-labs/barrits/node"; const summary = await readNodeBuildManifestSummary(".barrits/manifest.json"); console.log(summary.domains); ``` ### Appears In `examples/example-nodejs/scripts/build-runner.mjs` ``` -------------------------------- ### Example Trait Definition Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09d-api-reference-traits-and-composition.md Defines an authentication trait with JSDoc annotations for Barrits. Use this to specify trait metadata like summary, consumed capabilities, and state. ```typescript /** * @barrits-trait * @barrits-summary Authentication trait * @barrits-consumes logger, config * @barrits-state sessionToken, user */ export function login(username: string, password: string): Promise { // implementation } export function logout(): void { // implementation } ``` -------------------------------- ### Execute Orchestration Entrypoint with Deno Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-deno/README.md Run the main orchestration entrypoint using Deno tasks. This command executes the primary Deno script for the project. ```bash deno task dev ``` -------------------------------- ### Get Top K Elements Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09b-api-reference-algorithms.md Use `topK` to retrieve the top `k` elements from a collection without fully sorting it. Specify the number of elements to retrieve as the `limit`. ```typescript import { topK } from "@zuccadev-labs/barrits"; topK(candidates, 5); ``` -------------------------------- ### readDenoBuildManifestSummary(path) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads and summarizes the manifest in Deno. ```APIDOC ## readDenoBuildManifestSummary(path) ### Description Reads and summarizes the manifest in Deno. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the build manifest file. ``` -------------------------------- ### Declare a Domain Module with Traits Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/03-examples-and-walkthroughs.md Declare domain modules by placing typed files inside the `barrits/` directory. This example shows how to define a trait for authentication, specifying provided and conflicting capabilities. ```typescript // barrits/auth-domain.ts import { createTraitDescriptor } from "@zuccadev-labs/barrits"; /** * @barrits-trait * @barrits-provides auth-session, database-adapter * @barrits-conflicts legacy-adapter */ export const authDomainTrait = createTraitDescriptor({ name: "AuthDomain", provides: ["auth-session", "database-adapter"], conflicts: ["legacy-adapter"], }); ``` -------------------------------- ### Read and Summarize Build Manifest Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/07-manifests-bundlers-and-consumption.md Use `readBuildManifestSummary` to read and summarize a manifest file. Requires a path and a function to read text files. ```typescript import { readBuildManifestSummary } from "@zuccadev-labs/barrits/consume"; const summary = await readBuildManifestSummary( "path/to/build-manifest.json", readTextFile ); ``` -------------------------------- ### Define a Consumable and Providable Function with Traits Source: https://github.com/zuccadev-labs/barrits/blob/main/README.md This example demonstrates how to use Barrits Traits in JSDoc comments to define a function that consumes a database dependency and provides a user capability. The `@barrits-state` tag ensures the database connection is automatically managed. ```typescript /** * @barrits-trait * @barrits-consumes database * @barrits-provides user * @barrits-state Database */ export async function getUser(id: string) { const db = await resolve("Database"); return await db.get(["users", id]); } ``` -------------------------------- ### loadBarritsConfig() Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Loads the project configuration from disk. Solves: Tooling, CLI, and automation can resolve the configuration without duplicating the file-reading logic. ```APIDOC ## loadBarritsConfig() ### Description Loads the project configuration from disk. Solves: Tooling, CLI, and automation can resolve the configuration without duplicating the file-reading logic. ### Parameters None ### Request Example ```ts import { loadBarritsConfig } from "@zuccadev-labs/barrits"; const config = loadBarritsConfig(); ``` ### Response #### Success Response (200) - **config** (object) - The loaded project configuration. #### Response Example ```json { "runtime": "react", "watch": "auto", "autoManifest": true, "automationDirectory": ".barrits" } ``` ``` -------------------------------- ### Inspect Project Manifest with Bun Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-bun/README.md Inspect the project manifest using the Bun runtime. This command is helpful for understanding the project's configuration and dependencies. ```bash bun run inspect ``` -------------------------------- ### Run Project Commands Source: https://github.com/zuccadev-labs/barrits/blob/main/CONTRIBUTING.md Common npm commands for running tests, type checking, and building the project. ```bash npm test npm run typecheck npm run build ``` -------------------------------- ### loadBarritsConfig() Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Loads the project configuration from disk, allowing tooling, CLI, or automations to resolve the configuration without duplicating reading logic. ```APIDOC ## loadBarritsConfig() ### Description Loads the project configuration from disk. ### Purpose Tooling, CLI or automations can resolve the configuration without duplicating the reading logic. ### Usage Invoked from internal processes or tools that need introspection. ### Where used Part of the flow documented in `06-commands-and-runtimes.md`. ``` -------------------------------- ### runDenoCli(argumentsList?) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Executes the Barrits Deno CLI from code. ```APIDOC ## runDenoCli(argumentsList?) ### Description Executes the Barrits Deno CLI from code. ### Parameters #### Query Parameters - **argumentsList** (string[]) - Optional - A list of arguments to pass to the CLI. ### Request Example ```ts import { runDenoCli } from "@zuccadev-labs/barrits/deno"; await runDenoCli(["inspect"]); ``` ``` -------------------------------- ### Manifest and Snapshot Summarization Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Functions for creating summaries of build manifests and watch snapshots. ```APIDOC ## createBuildManifestSummary(manifest) ### Description Generates a summary of the build manifest. ### Usage Receives a manifest already available in memory or injected by a plugin. ## createWatchSnapshotSummary(snapshot) ### Description Summarizes a watch snapshot. ### Usage Receives the already parsed snapshot. ``` -------------------------------- ### createNodeFileSystemAdapter() Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Creates a Node.js filesystem adapter for discovery and inspection. ```APIDOC ## createNodeFileSystemAdapter() ### Description Creates a Node.js filesystem adapter for discovery and inspection. ### Request Example ```ts import { createNodeFileSystemAdapter } from "@zuccadev-labs/barrits/node"; const adapter = createNodeFileSystemAdapter(); ``` ``` -------------------------------- ### Execute Bundler Builds Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/bundlers/README.md Run specific bundler builds using npm scripts. Use 'build:all' to execute all bundler builds sequentially. ```bash npm run build:vite # Build with Vite npm run build:esbuild # Build with esbuild npm run build:rollup # Build with Rollup npm run build:webpack # Build with Webpack npm run build:all # Build with all bundlers sequentially ``` -------------------------------- ### readDenoBuildManifest(path) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads a build manifest in Deno. ```APIDOC ## readDenoBuildManifest(path) ### Description Reads a build manifest in Deno. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the build manifest file. ``` -------------------------------- ### defineBarritsPackage(options) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Normalizes the consumer description by unifying runtime, watch, autoManifest, projectRoot, and automationDirectory before interacting with plugins or tooling. ```APIDOC ## defineBarritsPackage(options) ### Description Normalizes the consumer description. ### Purpose Unifies runtime, watch, autoManifest, projectRoot and automationDirectory before touching plugins or tooling. ### Usage Called in `vite.config.ts`, `webpack.config.mjs`, `rollup.config.mjs`, `esbuild.config.mjs` or equivalent scripts. ### Where used `examples/example-react/vite.config.ts`, `examples/example-vue/vite.config.ts`, `examples/example-solid/vite.config.ts`, `examples/example-svelte/vite.config.ts`, `examples/bundlers/*` and `examples/example-bun/src/main.ts`. ``` -------------------------------- ### Run Quality Gates Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/agents/skills/barrits-package-first-implementation/SKILL.md Execute standard build pipeline commands to verify type safety, build integrity, and test coverage. ```bash npm run typecheck npm run build npm test ``` -------------------------------- ### createLanguageToolSnapshot Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Constructs a language tooling-compatible snapshot of the domain state. ```APIDOC ## createLanguageToolSnapshot(input) ### Description Constructs a language tooling-compatible snapshot of the domain state. ### Parameters #### Path Parameters - **input** (any) - Required - The input for creating the snapshot. ``` -------------------------------- ### barritsEsbuildPlugin(options) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Integrates the package-first contract into esbuild. ```APIDOC ## barritsEsbuildPlugin(options) ### Description Integrates the package-first contract into esbuild. ### Parameters #### Query Parameters - **options** (object) - Required - Configuration options for the plugin. ### Appears In `examples/bundlers/esbuild/esbuild.config.mjs` ``` -------------------------------- ### Build with Barrits CLI using Bun Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-bun/README.md Build the project using the Barrits CLI with the Bun runtime. This command is used for creating production-ready artifacts. ```bash bun run build ``` -------------------------------- ### Execute Base Orchestration Flow with Bun Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-bun/README.md Run the base orchestration flow using the Bun runtime. This command is typically used for development and testing purposes. ```bash bun run dev ``` -------------------------------- ### toBarritsAutomationOptions(options) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Adapts the package definition to the operational options expected by the plugins, preventing bundlers from needing unnecessary configuration details. ```APIDOC ## toBarritsAutomationOptions(options) ### Description Adapts the package definition to the operational options expected by the plugins. ### Purpose Prevents the bundler from knowing configuration details it does not need. ### Usage The result of `defineBarritsPackage()` or the same input object is passed. ### Where used `examples/example-react/vite.config.ts` and each configuration in `examples/bundlers/`. ``` -------------------------------- ### readBuildManifest(path, readTextFile) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads and parses a build manifest using the provided text reader. ```APIDOC ## readBuildManifest(path, readTextFile) ### Description Reads and parses a build manifest using the provided text reader. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the build manifest file. - **readTextFile** (function) - Required - A function that reads text content from a given path. ### Request Example ```ts import { readBuildManifest } from "@zuccadev-labs/barrits/consume"; const manifest = await readBuildManifest(".barrits/manifest.json", async (p) => { return await fetch(p).then((r) => r.text()); // or Tauri's readTextFile }); ``` ``` -------------------------------- ### Read Build Manifest Summary with createBuildManifestSummary Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/02-getting-started.md Produces a condensed view of the build manifest for UI, dashboards, or tooling consumers. Prevents UI or tooling from depending on the full manifest JSON when only domains, exports, or a status summary are needed. ```typescript import { createBuildManifestSummary } from "@zuccadev-labs/barrits"; import manifest from "virtual:barrits/manifest"; // injected by the Vite plugin const summary = createBuildManifestSummary(manifest); console.log(summary.domains); // Resolved domains console.log(summary.exports); // Public export surfaces ``` -------------------------------- ### Initialize Barrits SDK Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Use to initialize the SDK by dynamically building the context based on the configuration file. Enables renaming the root system namespace while keeping IDE and typings tooling intact. ```typescript import { createBarrits } from "@zuccadev-labs/barrits"; const app = await createBarrits(); // app.logic, app.traits, app.routes — available under the configured namespace ``` -------------------------------- ### Create Node.js File System Adapter Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Creates a Node.js-native filesystem adapter for Barrits. This adapter is pre-wired to use Node.js's built-in file system access. ```ts import { createNodeFileSystemAdapter } from "@zuccadev-labs/barrits/node"; const adapter = createNodeFileSystemAdapter(); ``` -------------------------------- ### createWatchSnapshotSummary Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Summarizes a watch snapshot for observability, panels, or quick diagnostics. ```APIDOC ## createWatchSnapshotSummary(snapshot) ### Description Summarizes a watch snapshot for observability, panels, or quick diagnostics. ### Parameters #### Path Parameters - **snapshot** (any) - Required - The snapshot object to summarize. ``` -------------------------------- ### readDenoWatchSnapshotSummary(path) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads and summarizes the watch snapshot in Deno. ```APIDOC ## readDenoWatchSnapshotSummary(path) ### Description Reads and summarizes the watch snapshot in Deno. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the watch snapshot file. ``` -------------------------------- ### Read Barrits Build Manifest Summary Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/README.md Create a summary of the Barrits build manifest and access its domain information. This requires importing the manifest and the summary creation utility. ```typescript import { createBuildManifestSummary } from "@zuccadev-labs/barrits"; import manifest from "virtual:barrits/manifest"; const summary = createBuildManifestSummary(manifest); console.log(summary.domains); ``` -------------------------------- ### Generate Build Manifest Summary Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Use to generate a condensed summary of the build manifest. Accesses properties like `domains` from the summary object. ```typescript import { createBuildManifestSummary } from "@zuccadev-labs/barrits"; const summary = createBuildManifestSummary(manifest); console.log(summary.domains); ``` -------------------------------- ### Manifest and Snapshot Parsing Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Functions for parsing build manifests and watch snapshots. ```APIDOC ## parseBuildManifest(value) ### Description Parses a build manifest. ### Usage Receives text or serialized structure and returns the typed manifest. ## parseWatchSnapshot(value) ### Description Parses a watch snapshot. ### Usage Applied over the snapshot payload before summarizing or displaying it. ``` -------------------------------- ### runNodeCli(argumentsList?) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Executes the Barrits Node.js CLI from code, without a manual spawn. ```APIDOC ## runNodeCli(argumentsList?) ### Description Executes the Barrits Node.js CLI from code, without a manual spawn. ### Parameters #### Query Parameters - **argumentsList** (string[]) - Optional - A list of arguments to pass to the CLI. ### Request Example ```ts import { runNodeCli } from "@zuccadev-labs/barrits/node"; await runNodeCli(["build"]); ``` ``` -------------------------------- ### toBarritsAutomationOptions(options) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Adapts the package definition to the operational options expected by plugins. Solves: Prevents the bundler plugin from requiring configuration details it does not own. ```APIDOC ## toBarritsAutomationOptions(options) ### Description Adapts the package definition to the operational options expected by plugins. Solves: Prevents the bundler plugin from requiring configuration details it does not own. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **options** (object) - Required - The package definition object. ### Request Example ```ts import { defineBarritsPackage, toBarritsAutomationOptions } from "@zuccadev-labs/barrits"; const pkg = defineBarritsPackage({ runtime: "react", watch: "auto" }); const automationOptions = toBarritsAutomationOptions(pkg); ``` ### Response #### Success Response (200) - **automationOptions** (object) - The adapted automation options. #### Response Example ```json { "runtime": "react", "watch": "auto" } ``` ``` -------------------------------- ### Read Build Manifest Summary in Node.js Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads and summarizes a build manifest directly from disk in a Node.js environment. Accesses the summary object and logs its domains. ```ts import { readNodeBuildManifestSummary } from "@zuccadev-labs/barrits/node"; const summary = await readNodeBuildManifestSummary(".barrits/manifest.json"); console.log(summary.domains); ``` -------------------------------- ### defineBarritsConfig(options) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Creates a valid configuration for `barrits.config.*`, declaring persistent project defaults instead of repeating them in each file. ```APIDOC ## defineBarritsConfig(options) ### Description Creates a valid configuration for `barrits.config.* ### Purpose Declares persistent project defaults instead of repeating them in each file. ### Usage Exported as default from the configuration file. ### Where used Explained in `05-automation-and-configuration.md`. ``` -------------------------------- ### findBarritsConfigFile() Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Locates the project configuration file, useful for controlled discovery of `barrits.config.*` before loading or resolving. ```APIDOC ## findBarritsConfigFile() ### Description Locates the project configuration file. ### Purpose Controlled discovery of `barrits.config.* ### Usage Called before loading or resolving configuration when it is necessary to determine whether the file exists. ### Where used Useful in tooling and diagnostics; explained in `05-automation-and-configuration.md`. ``` -------------------------------- ### Create Barrits Integration Directory Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/03-examples-and-walkthroughs.md Create a directory named `.barrits` or `barrits/` at the execution root to enable Barrits's differential caching and deterministic orchestration. ```bash mkdir barrits ``` -------------------------------- ### readNodeBuildManifest(path) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads a build manifest from disk in Node.js. ```APIDOC ## readNodeBuildManifest(path) ### Description Reads a build manifest from disk in Node.js. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the build manifest file. ``` -------------------------------- ### readNodeLanguageToolSnapshot(path) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads a language tooling snapshot from disk. ```APIDOC ## readNodeLanguageToolSnapshot(path) ### Description Reads a language tooling snapshot from disk. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the language tooling snapshot file. ### Appears In `examples/example-nodejs/scripts/snapshot-consumer.mjs` ``` -------------------------------- ### Inspect Build Manifest with Deno Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-deno/README.md Inspect the generated build manifest using Deno tasks. This command is useful for verifying the integrity and contents of the build artifacts. ```bash deno task inspect ``` -------------------------------- ### quickSort(collection, compare?) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09b-api-reference-algorithms.md General-purpose high-performance sort. ```APIDOC ## quickSort(collection, compare?) ### Description General-purpose high-performance sort. ### Parameters #### Path Parameters - **collection** (Array) - Required - The collection to sort. - **compare** (Function) - Optional - A comparison function. ### Response #### Success Response (200) - **result** (Array) - A new array containing the sorted elements. #### Response Example ```json { "result": [sortedItem1, sortedItem2] } ``` ``` -------------------------------- ### readDenoLanguageToolSnapshot(path) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads a language tooling snapshot in Deno. ```APIDOC ## readDenoLanguageToolSnapshot(path) ### Description Reads a language tooling snapshot in Deno. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the language tooling snapshot file. ``` -------------------------------- ### defineBarritsPackage(options) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Normalizes the consumer project's description into a validated contract. Solves: Repeated runtime, watch, and autoManifest declarations across Vite, esbuild, Rollup, Webpack, and custom scripts. ```APIDOC ## defineBarritsPackage(options) ### Description Normalizes the consumer project's description into a validated contract. Solves: Repeated runtime, watch, and autoManifest declarations across Vite, esbuild, Rollup, Webpack, and custom scripts. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **options** (object) - Required - Configuration options for the package. - **runtime** (string) - Optional - Specifies the runtime environment (e.g., 'react'). - **watch** (string) - Optional - Specifies the watch behavior (e.g., 'auto'). - **autoManifest** (boolean) - Optional - Enables automatic manifest generation. ### Request Example ```ts import { defineBarritsPackage } from "@zuccadev-labs/barrits"; const pkg = defineBarritsPackage({ runtime: "react", watch: "auto", autoManifest: true, }); ``` ### Response #### Success Response (200) - **pkg** (object) - The normalized and validated package configuration. #### Response Example ```json { "runtime": "react", "watch": "auto", "autoManifest": true } ``` ``` -------------------------------- ### Tauri Development Commands Source: https://github.com/zuccadev-labs/barrits/blob/main/packages/sdk/ts_js/examples/example-tauri/README.md Commands to run the Tauri application in development and build modes. ```bash npm run dev # Start the web development server npm run build # Generate the web production build npm run tauri:dev # Launch the desktop application in development mode npm run tauri:build # Generate the desktop production build ``` -------------------------------- ### resolveBarritsConfig() Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Resolves the effective project configuration. Solves: Applies defaults and returns an object ready for operation, as opposed to the raw source file. ```APIDOC ## resolveBarritsConfig() ### Description Resolves the effective project configuration. Solves: Applies defaults and returns an object ready for operation, as opposed to the raw source file. ### Parameters None ### Request Example ```ts import { resolveBarritsConfig } from "@zuccadev-labs/barrits"; const resolvedConfig = resolveBarritsConfig(); ``` ### Response #### Success Response (200) - **resolvedConfig** (object) - The resolved project configuration with defaults applied. #### Response Example ```json { "runtime": "react", "watch": "auto", "autoManifest": true, "automationDirectory": ".barrits" } ``` ``` -------------------------------- ### binarySearch(collection, target, compare?) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09b-api-reference-algorithms.md O(log n) search on sorted collections. ```APIDOC ## binarySearch(collection, target, compare?) ### Description O(log n) search on sorted collections. ### Parameters #### Path Parameters - **collection** (Array) - Required - The sorted collection to search within. - **target** (any) - Required - The value to search for. - **compare** (Function) - Optional - A comparison function. ### Request Example ```ts import { binarySearch } from "@zuccadev-labs/barrits"; binarySearch(sortedItems, targetValue); ``` ### Response #### Success Response (200) - **result** (number) - The index of the target value, or -1 if not found. #### Response Example ```json { "result": 5 } ``` ``` -------------------------------- ### barritsVitePlugin(options) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Integrates the package-first contract into Vite. ```APIDOC ## barritsVitePlugin(options) ### Description Integrates the package-first contract into Vite. ### Parameters #### Query Parameters - **options** (object) - Required - Configuration options for the plugin. - **package** (object) - Required - Barrits package automation options. ### Request Example ```ts import { barritsVitePlugin } from "@zuccadev-labs/barrits/vite"; import { defineBarritsPackage, toBarritsAutomationOptions } from "@zuccadev-labs/barrits"; const pkg = defineBarritsPackage({ runtime: "react", watch: "auto" }); export default defineConfig({ plugins: [barritsVitePlugin({ package: toBarritsAutomationOptions(pkg) })], }); ``` ### Appears In `examples/example-react/vite.config.ts`, `examples/example-vue/vite.config.ts`, `examples/example-solid/vite.config.ts`, `examples/example-svelte/vite.config.ts`, `examples/bundlers/vite/vite.config.ts` ``` -------------------------------- ### Access All Algorithms Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09b-api-reference-algorithms.md The `algorithms` object provides access to the full catalog of algorithms for dynamic navigation or grouped exploration. Use it to access specific algorithm families like `sort`. ```typescript import { algorithms } from "@zuccadev-labs/barrits"; algorithms.sort.orderBy(items, criteria); ``` -------------------------------- ### algorithms Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09b-api-reference-algorithms.md Provides access to the full catalog of algorithms for dynamic navigation or grouped exploration. This is a top-level namespace. ```APIDOC ## algorithms ### Description Exposes the full algorithm catalog for dynamic navigation or grouped exploration. ### Usage ```ts import { algorithms } from "@zuccadev-labs/barrits"; algorithms.sort.orderBy(items, criteria); ``` ``` -------------------------------- ### Deno API Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09-api-reference.md Functions for interacting with Barrits in a Deno environment, including filesystem adapters and manifest/snapshot readers. ```APIDOC ## createDenoFileSystemAdapter() ### Description Creates a filesystem adapter for Deno, enabling discovery and inspection in the Deno runtime. ### Usage Connected to tooling or controlled reading. ### Where Used Deno and JSR flows. ``` ```APIDOC ## readDenoBuildManifest(path) ### Description Reads a build manifest in Deno. This is a ready-made wrapper for the runtime. ### Usage The file path is passed. ### Where Used Deno tooling. ``` ```APIDOC ## readDenoBuildManifestSummary(path) ### Description Reads and summarizes a build manifest in Deno, simplifying consumption in scripts or `deno task` tasks. ### Usage Direct wrapper by path. ### Where Used Deno runtime walkthroughs. ``` ```APIDOC ## readDenoWatchSnapshot(path) ### Description Reads a watch snapshot in Deno, useful for observability and tooling. ### Usage The snapshot path is passed. ### Where Used Deno scripts. ``` ```APIDOC ## readDenoWatchSnapshotSummary(path) ### Description Summarizes a watch snapshot in Deno, providing a compact view of the project state. ### Usage Wrapper by path. ### Where Used Deno tooling. ``` ```APIDOC ## readDenoLanguageToolSnapshot(path) ### Description Reads a language tooling snapshot in Deno, suitable for inspection or editor-friendly integrations. ### Usage Receives the file path. ### Where Used Scripts and runtime tasks. ``` ```APIDOC ## runDenoCli(argumentsList?) ### Description Executes the Deno CLI from code, useful for wrappers or automation from Deno. ### Usage Receives optional arguments. ### Where Used `@zuccadev-labs/barrits/deno/cli`. ``` -------------------------------- ### PACKAGE_NAME Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09a-api-reference-package-config.md Exposes the canonical package name. ```APIDOC ## PACKAGE_NAME ### Description Exposes the canonical package name. ### Parameters None ### Request Example ```ts import { PACKAGE_NAME } from "@zuccadev-labs/barrits"; console.log(PACKAGE_NAME); // "@zuccadev-labs/barrits" ``` ### Response #### Success Response (200) - **PACKAGE_NAME** (string) - The canonical package name. #### Response Example ```json "@zuccadev-labs/barrits" ``` ``` -------------------------------- ### Configure Custom Main Method for Barrits Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/05-automation-and-configuration.md Specify a custom main method in the configuration to control application startup behavior. This allows for custom initialization logic. ```typescript import { defineBarritsConfig } from "@zuccadev-labs/barrits"; export default defineBarritsConfig({ runtime: "node", main: async () => { console.log("Application starting with custom configuration"); }, }); ``` -------------------------------- ### readWatchSnapshotSummary(path, readTextFile) Source: https://github.com/zuccadev-labs/barrits/blob/main/docs/users/EN/packages/ts_js/09c-api-reference-consume-and-adapters.md Reads and summarizes the watch snapshot. ```APIDOC ## readWatchSnapshotSummary(path, readTextFile) ### Description Reads and summarizes the watch snapshot. ### Parameters #### Path Parameters - **path** (string) - Required - The path to the watch snapshot file. - **readTextFile** (function) - Required - A function that reads text content from a given path. ```