### cullet info commands Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Examples of using the 'cullet info' command to get details about a kit. ```bash npx cullet info erp-core npx cullet info erp-core@1.0.0 npx cullet info erp-core --full # KIT_CONTEXT.md integral, sem resumir npx cullet info erp-core --alias # cria alias cullet/erp-core no tsconfig ``` -------------------------------- ### Direct Import Example Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Demonstrates how to import entities from 'cullet/erp-core' in direct import mode. ```typescript // modo: import direto import { Entity, RuleSet, Timeline, ValueObject, allow, deny, type Policy, } from "cullet/erp-core"; ``` -------------------------------- ### Local development commands Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Commands to install dependencies, build the project, and list kits. ```bash npm install npm run build npm run cli -- list ``` -------------------------------- ### Installation Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Install the cullet package using npm. ```bash npm install cullet ``` -------------------------------- ### Importing Kit Primitives Source: https://github.com/fabiano-eduardo/cullet/blob/main/templates/kit/README.md Example of how to import primitives from the kit, with a recommended version-pinned import. ```typescript import { /* primitives */ } from "cullet/__KIT_NAME__"; ``` ```typescript import { /* primitives */ } from "cullet/__KIT_NAME__/1.0.0"; ``` -------------------------------- ### Full-Control Import Example Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Shows how to import entities from 'cullet/erp-core' after using 'npx cullet fc erp-core@1.0.0'. ```typescript // modo: full-control (alias cullet/erp-core -> ./cullet/erp-core@1.0.0/index.ts) import { Entity, RuleSet, Timeline, ValueObject, allow, deny, type Policy, } from "cullet/erp-core"; ``` -------------------------------- ### Application Code Example Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md The identical application code used in both direct import and full-control modes. ```typescript const customerCodeRules = new RuleSet("CustomerCodeRules", [ { name: "required", validate: (value) => value.trim().length > 0 ? null : "Código do cliente é obrigatório.", }, { name: "prefix", validate: (value) => value.startsWith("CUS-") ? null : "Código precisa começar com CUS-.", }, ]); class CustomerCode extends ValueObject { private constructor(value: string) { super(value); } static create(value: string): CustomerCode { customerCodeRules.assert(value); return new CustomerCode(value); } } type CustomerProps = { code: CustomerCode; name: string; status: "draft" | "active"; }; class Customer extends Entity { private constructor(id: string, props: CustomerProps) { super(id, props); } static create(id: string, code: string, name: string): Customer { return new Customer(id, { code: CustomerCode.create(code), name, status: "draft", }); } activate(): void { this.mutate({ status: "active" }); } } const canActivateCustomer: Policy = { name: "can-activate-customer", evaluate: (customer) => customer.toJSON().status === "draft" ? allow() : deny("Somente clientes em draft podem ser ativados."), }; const statusTimeline = new Timeline([ { at: "2026-01-10", value: "draft" }, ]); const customer = Customer.create("customer-1", "CUS-0001", "Loja Aurora"); const decision = canActivateCustomer.evaluate(customer); if (decision.allowed) { customer.activate(); statusTimeline.append("active", new Date("2026-01-12")); } ``` -------------------------------- ### cullet fc commands Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Examples of using the 'cullet fc' (full-control) command to copy a kit and update tsconfig. ```bash npx cullet fc erp-core npx cullet fc erp-core@1.0.0 npx cullet fc erp-core@1.0.0 --dry-run ``` -------------------------------- ### Criação de um novo kit via CLI Source: https://github.com/fabiano-eduardo/cullet/blob/main/kits/VERSIONING.md Comando para criar um novo kit usando o script new-kit, com a opção de adicionar uma descrição. ```bash npm run new-kit -- # opcional: npm run new-kit -- --description "Descrição curta do kit" ``` -------------------------------- ### Como começa Source: https://github.com/fabiano-eduardo/cullet/blob/main/kits/dummy-api/versions/1.0.0/README.md Exemplo de importação inicial para o kit dummy. ```typescript import { /* nada exportado ainda */ } from "cullet/dummy-api"; ``` -------------------------------- ### Import direto Source: https://github.com/fabiano-eduardo/cullet/blob/main/kits/erp-core/versions/1.0.0/README.md Importando diretamente do pacote, sempre a versão `latest` exportada. ```typescript import { Entity, ValueObject, RuleSet, Timeline, allow, deny, type Policy, } from "cullet/erp-core"; ``` -------------------------------- ### Full-control copy Source: https://github.com/fabiano-eduardo/cullet/blob/main/CLAUDE.md Consumers can copy kit source into their project using the CLI. ```bash npx cullet fc erp-core@1.0.0 ``` -------------------------------- ### Create a new kit Source: https://github.com/fabiano-eduardo/cullet/blob/main/CLAUDE.md Command to add a new kit to the project. ```bash npm run new-kit ``` -------------------------------- ### Estrutura de deprecation em meta.json Source: https://github.com/fabiano-eduardo/cullet/blob/main/kits/VERSIONING.md Exemplo de como marcar uma versão de kit como deprecated no arquivo meta.json, incluindo informações sobre a versão de origem, o motivo e o sucessor. ```json { "deprecated": { "since": "1.2.0", "reason": "API de policies foi reescrita; v1 não suporta condições com escopo de tenant.", "successor": "erp-core/2.0.0" } } ``` -------------------------------- ### Pinado em uma versão Source: https://github.com/fabiano-eduardo/cullet/blob/main/kits/erp-core/versions/1.0.0/README.md Fixando a importação em uma versão específica, recomendado para produção. ```typescript import { Timeline } from "cullet/erp-core/1.0.0"; ``` -------------------------------- ### Development commands Source: https://github.com/fabiano-eduardo/cullet/blob/main/CLAUDE.md Common development commands for the cullet project. ```bash npm run build # tsup build (runs sync-exports first) npm run typecheck # tsc --noEmit (both tsconfig.json and tsconfig.test.json) npm run test # vitest unit tests npm run test:e2e # vitest E2E smoke tests npm run validate-kits # validates registry integrity npm run sync-exports # syncs package.json exports from kits/ npm run release:dry-run # build + pack + check contents (no publish) ``` -------------------------------- ### Publish command Source: https://github.com/fabiano-eduardo/cullet/blob/main/CLAUDE.md The command used for publishing to npm, including provenance attestation. ```bash npm publish --provenance --access public # env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} ``` -------------------------------- ### Direct import Source: https://github.com/fabiano-eduardo/cullet/blob/main/CLAUDE.md Consumers can import kits directly from the 'cullet' package. ```typescript import { Entity } from 'cullet/erp-core' ``` -------------------------------- ### cullet list command Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Command to list kits from the registry. ```bash npx cullet list ``` -------------------------------- ### Smoke test for package validation Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Script to validate the package in a real sandbox project. ```bash ./scripts/smoke-test.sh # ou apontando para um tarball especifico: ./scripts/smoke-test.sh ./cullet-.tgz ``` -------------------------------- ### Import Rules (Layers) Source: https://github.com/fabiano-eduardo/cullet/blob/main/PHILOSOPHY.md Defines the unidirectional import flow between different layers of the project, enforced by convention and linting. ```text domain ← application ← adapters ↑ ↑ └───── ports ─────┘ - `domain/` não importa de `application/`, `adapters/`, nem de nada fora do próprio kit. - `application/` importa de `domain/` e de `ports/`. Nunca de `adapters/`. - `adapters/` importa de `ports/` (para implementar) e pode importar de `domain/` apenas para tipos. Nunca de `application/`. - `ports/` é o contrato puro: só tipos, sem implementação, sem import de runtime externo. Import cruzando camada na direção errada é defeito de arquitetura. ``` -------------------------------- ### Doctor command Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Run the doctor command to validate the project's tsconfig and package.json before importing any kit. ```bash npx cullet doctor ``` -------------------------------- ### Dry-run release validation Source: https://github.com/fabiano-eduardo/cullet/blob/main/README.md Command to perform a dry-run of the release process. ```bash npm run release:dry-run ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.