{"id":13498284,"url":"https://github.com/feature-sliced/cli","last_synced_at":"2025-04-10T17:12:07.891Z","repository":{"id":198093542,"uuid":"700065334","full_name":"feature-sliced/cli","owner":"feature-sliced","description":"Utility to quickly generate layers, slices, and segments from Feature-Sliced Design.","archived":false,"fork":false,"pushed_at":"2024-04-27T18:48:34.000Z","size":307,"stargazers_count":29,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T16:49:02.200Z","etag":null,"topics":["cli","feature-sliced-design","generator"],"latest_commit_sha":null,"homepage":"https://feature-sliced.design","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/feature-sliced.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-03T21:53:01.000Z","updated_at":"2025-03-21T14:55:13.000Z","dependencies_parsed_at":"2023-12-02T23:31:57.364Z","dependency_job_id":"eb1f6d92-23c9-4a10-844c-eb767d743872","html_url":"https://github.com/feature-sliced/cli","commit_stats":null,"previous_names":["feature-sliced/cli"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feature-sliced%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feature-sliced%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feature-sliced%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feature-sliced%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feature-sliced","download_url":"https://codeload.github.com/feature-sliced/cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261905,"owners_count":21074224,"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","feature-sliced-design","generator"],"created_at":"2024-07-31T21:00:21.372Z","updated_at":"2025-04-10T17:12:07.870Z","avatar_url":"https://github.com/feature-sliced.png","language":"TypeScript","funding_links":[],"categories":["cli","DevExp"],"sub_categories":["Tools"],"readme":"# @feature-sliced/cli\n\n[![npm version](https://img.shields.io/npm/v/@feature-sliced/cli)](https://www.npmjs.com/package/@feature-sliced/cli)\n[![Static checks and tests](https://github.com/feature-sliced/cli/actions/workflows/check.yaml/badge.svg)](https://github.com/feature-sliced/cli/actions/workflows/check.yaml)\n\nUtility to quickly generate layers, slices, and segments from [Feature-Sliced Design](https://feature-sliced.design).\n\n## Installation\n\n```bash\nnpm add -g @feature-sliced/cli\n```\n\nThis will create a global binary `fsd`. You can install this CLI locally as well, but then you will need to use `npx` to run it.\n\n## Usage\n\nGenerate the Entities layer with a `client` slice that contains an index file and two segments, `ui` and `api`:\n\n```bash\nfsd entities client --segments ui api\n```\n\nOr, for short:\n\n```bash\nfsd e client -s ui,api\n```\n\nIf you have at least one slice in your project already, the CLI will know where to generate. Otherwise, it will generate in the current folder, or you can specify the location yourself with the `--root` or `-r` option.\n\n\u003cdetails\u003e\u003csummary\u003eOther examples\u003c/summary\u003e\n\n- Generate the Widgets layer with a `bottom-bar` slice that has an index file and segments `ui` and `api` in the `src/` folder:\n\n  ```bash\n  fsd w bottom-bar -s ui api -r src\n  fsd widget bottom-bar -s ui,api -r src\n  fsd widgets bottom-bar --segments ui,api -r src\n  ```\n\n  Produces:\n\n  - `src/widgets/bottom-bar/index.(js|ts)` (depending on your project)\n  - `src/widgets/bottom-bar/ui/`\n  - `src/widgets/bottom-bar/api/`\n\n- Generate the Features layer with a slice `employee/employee-record` inside a slice group `employee`:\n\n  ```bash\n  fsd f employee/employee-record\n  fsd feat employee/employee-record\n  ```\n\n  In a detected FSD root[^1] or current folder, produces:\n\n  - `features/employee/employee-record/index.(js|ts)` (depending on your project)\n\n- Generate the Entities layer with a `user` slice inside the `src/lib` folder, creating it if necessary:\n\n  ```bash\n  fsd e user -r ./src/lib\n  fsd entity user --root ./src/lib\n  ```\n\n  Produces:\n\n  - `src/lib/entities/user/index.(js|ts)` (depending on your project)\n\n- Generate the Pages layer with slices `edit-note` and `note-list`, each containing segments `ui` and `api`:\n\n  ```bash\n  fsd p edit-note note-list -s ui, api\n  fsd page edit-note, note-list -s ui api\n  ```\n\n  In a detected FSD root[^1] or current folder, produces:\n\n  - `pages/edit-note/index.(js|ts)` (depending on your project)\n  - `pages/edit-note/ui/`\n  - `pages/edit-note/api/`\n  - `pages/note-list/index.(js|ts)`\n  - `pages/note-list/ui/`\n  - `pages/note-list/api/`\n\n- Generate the Shared layer with segments `ui` and `api` and an index file for each segment:\n\n  ```\n  fsd s ui api\n  fsd s -s ui api\n  fsd shared ui -s api\n  ```\n\n  In a detected FSD root[^1] or current folder, produces:\n\n  - `shared/ui/index.(js|ts)`\n  - `shared/api/index.(js|ts)`\n\n\u003c/details\u003e\n\n## Credits\n\nBig thanks to a community member [`Agent_RBY_`](https://github.com/AgentRBY) for implementing most of the generating and detecting logic.\n\n## License\n\nThe source code of this project is distributed under the terms of the ISC license. It's like MIT, but better. [Click here](https://choosealicense.com/licenses/isc/) to learn what that means.\n\n[^1]: An FSD root is the folder that contains slices in Feature-Sliced Design. There can be several independent roots in one project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeature-sliced%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeature-sliced%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeature-sliced%2Fcli/lists"}