{"id":29436877,"url":"https://github.com/stone-foundation/stone-js-node-cli-adapter","last_synced_at":"2025-07-13T05:06:57.317Z","repository":{"id":266538747,"uuid":"898542616","full_name":"stone-foundation/stone-js-node-cli-adapter","owner":"stone-foundation","description":"CLI adapter for Stone.js. Enables command-line execution and custom commands using the Continuum Architecture.","archived":false,"fork":false,"pushed_at":"2025-06-13T02:26:46.000Z","size":770,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-13T02:27:19.749Z","etag":null,"topics":["cli","cli-app","context-aware","javascript","official-stonejs","stone-foundation","stonejs","stonejs-adapter","typescript"],"latest_commit_sha":null,"homepage":"https://stonejs.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stone-foundation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-04T15:25:56.000Z","updated_at":"2025-06-13T02:26:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"9aa9202c-bae5-41b3-ae77-d9fab927614a","html_url":"https://github.com/stone-foundation/stone-js-node-cli-adapter","commit_stats":null,"previous_names":["stonemjs/node-cli-adapter"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/stone-foundation/stone-js-node-cli-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-node-cli-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-node-cli-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-node-cli-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-node-cli-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stone-foundation","download_url":"https://codeload.github.com/stone-foundation/stone-js-node-cli-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stone-foundation%2Fstone-js-node-cli-adapter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265091734,"owners_count":23710033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cli-app","context-aware","javascript","official-stonejs","stone-foundation","stonejs","stonejs-adapter","typescript"],"created_at":"2025-07-13T05:06:55.770Z","updated_at":"2025-07-13T05:06:57.295Z","avatar_url":"https://github.com/stone-foundation.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stone.js - Node CLI Adapter\n\n[![npm](https://img.shields.io/npm/l/@stone-js/node-cli-adapter)](https://opensource.org/licenses/MIT)\n[![npm](https://img.shields.io/npm/v/@stone-js/node-cli-adapter)](https://www.npmjs.com/package/@stone-js/node-cli-adapter)\n[![npm](https://img.shields.io/npm/dm/@stone-js/node-cli-adapter)](https://www.npmjs.com/package/@stone-js/node-cli-adapter)\n![Maintenance](https://img.shields.io/maintenance/yes/2025)\n[![Build Status](https://github.com/stone-foundation/stone-js-node-cli-adapter/actions/workflows/main.yml/badge.svg)](https://github.com/stone-foundation/stone-js-node-cli-adapter/actions/workflows/main.yml)\n[![Publish Package to npmjs](https://github.com/stone-foundation/stone-js-node-cli-adapter/actions/workflows/release.yml/badge.svg)](https://github.com/stone-foundation/stone-js-node-cli-adapter/actions/workflows/release.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-node-cli-adapter\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-node-cli-adapter)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-node-cli-adapter\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-node-cli-adapter)\n[![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](./SECURITY.md)\n[![CodeQL](https://github.com/stone-foundation/stone-js-node-cli-adapter/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/stone-foundation/stone-js-node-cli-adapter/security/code-scanning)\n[![Dependabot Status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg)](https://github.com/stone-foundation/stone-js-node-cli-adapter/network/updates)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\nThe **Node CLI Adapter** enables you to run Stone.js applications in a command-line interface (CLI) context, transforming user-defined or custom commands into system-executable events.\n\n---\n\n## Introduction\n\nIn the Continuum Architecture, adapters are responsible for translating external context into normalized system events. The Node CLI Adapter takes terminal input, parsed arguments and commands, and turns them into `IncomingEvent` objects that your system can handle.\n\nThis allows you to:\n\n* Build CLI tools, scripts, or developer utilities with Stone.js\n* Define custom commands and map them to handlers\n* Leverage Stone.js's lifecycle, configuration, and event system in the terminal\n\n---\n\n## Installation\n\n```bash\nnpm install @stone-js/node-cli-adapter\n```\n\n\u003e This package is **pure ESM**. Ensure your project is ESM-compatible (`\"type\": \"module\"` in `package.json`) or configure your tooling accordingly.\n\n## Usage\n\nYou can activate the adapter using either the declarative or imperative API.\n\n### Declarative API\n\n```ts\nimport { NodeConsole } from '@stone-js/node-cli-adapter'\nimport { StoneApp, IncomingEvent, IEventHandler } from '@stone-js/core'\n\n@StoneApp()\n@NodeConsole()\nexport class Application implements IEventHandler\u003cIncomingEvent\u003e {\n  handle(event: IncomingEvent) {\n    console.log('CLI event received:', event.get\u003cstring\u003e('command'))\n    return { status: 'ok' }\n  }\n}\n```\n\n### Imperative API\n\n```ts\nimport { defineStoneApp, IncomingEvent } from '@stone-js/core'\nimport { nodeConsoleAdapterBlueprint } from '@stone-js/node-cli-adapter'\n\nconst handler = (event: IncomingEvent) =\u003e {\n  console.log('Running CLI command:', event.get\u003cstring\u003e('command'))\n  return { status: 'done' }\n}\n\nexport const MyCLIApp = defineStoneApp(handler, {}, [nodeConsoleAdapterBlueprint])\n```\n\n## What It Enables\n\n* **Universal CLI Entry Point**\n  Use the same `defineStoneApp` structure as other environments, just change the adapter.\n\n* **Custom Commands**\n  Register your own CLI commands using `defineCommand()` or `@Command()`, and bind them to handlers in your system.\n\n* **Runtime Argument Parsing**\n  Inputs from the terminal are automatically parsed and mapped into an `IncomingEvent`, with parameters available via `.get()`.\n\n* **Cross-platform Logic**\n  You can reuse the same handler logic between CLI and server, the adapter abstracts away the runtime.\n\n## Configuration Options\n\nThe CLI adapter supports command registration via metadata or blueprint configuration.\n\nTo register commands imperatively:\n\n```ts\nimport { defineConfig, IBlueprint } from '@stone-js/core'\nimport { defineCommand, NODE_CONSOLE_PLATFORM } from '@stone-js/node-cli-adapter'\n\nexport const AppConfig = defineConfig({\n  afterConfigure (blueprint: IBlueprint) {\n    if (blueprint.is('stone.adapter.platform', NODE_CONSOLE_PLATFORM)) {\n      blueprint.set(defineCommand(handler, { name: '*' }))\n    }\n  }\n})\n```\n\n\u003e You can also register commands using metadata decorators. See the main Stone.js documentation on [Command Handlers](https://stonejs.dev/docs/deeper/commands) for more.\n\n## Summary\n\nThe `@stone-js/node-cli-adapter` lets you run your Stone.js system as a CLI, turning terminal arguments and commands into system-level events. It enables you to reuse your event-handling logic, configuration, and hooks across environments without rewriting platform-specific glue code.\n\nThis adapter is ideal for scripting, developer tooling, generators, or any use case where your application lives in the terminal.\n\n## API documentation\n\n* [API](https://github.com/stone-foundation/stone-js-node-cli-adapter/blob/main/docs)\n\n## Contributing\n\nWe welcome contributions! See the [Contributing Guide](https://github.com/stone-foundation/stone-js-node-cli-adapter/blob/main/CONTRIBUTING.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstone-foundation%2Fstone-js-node-cli-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstone-foundation%2Fstone-js-node-cli-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstone-foundation%2Fstone-js-node-cli-adapter/lists"}