diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index beffa30..0000000 --- a/.editorconfig +++ /dev/null @@ -1,11 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 9b1c8b1..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -/dist diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 7b84619..0000000 --- a/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": [ - "oclif", - "oclif-typescript" - ] -} diff --git a/.gitignore b/.gitignore index 12865b1..a94b49e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,3 @@ -*-debug.log -*-error.log -/.nyc_output -/dist -/lib -/package-lock.json -/tmp -/yarn.lock -node_modules -oclif.manifest.json -.idea -flagsmith.json +/flagsmith +/dist/ +*.test diff --git a/.mocharc.json b/.mocharc.json deleted file mode 100644 index 4a09d14..0000000 --- a/.mocharc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "require": [ - "test/helpers/init.js", - "ts-node/register" - ], - "watch-extensions": [ - "ts" - ], - "recursive": true, - "reporter": "spec", - "timeout": 60000 -} diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index a45fd52..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index 8d6e472..0000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1 +0,0 @@ -{".":"1.1.0"} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index eafae8c..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,80 +0,0 @@ -# Changelog - -## [1.1.0](https://github.com/Flagsmith/flagsmith-cli/compare/v1.0.0...v1.1.0) (2026-05-27) - - -### Features - -* migrate npm package to [@flagsmith](https://github.com/flagsmith) organization scope ([#40](https://github.com/Flagsmith/flagsmith-cli/issues/40)) ([3b96bf3](https://github.com/Flagsmith/flagsmith-cli/commit/3b96bf33ed5d4397430381c65e9417b216b2e0e8)) - - -### CI - -* add NPM trusted publishing and release please ([#33](https://github.com/Flagsmith/flagsmith-cli/issues/33)) ([d6fe2bc](https://github.com/Flagsmith/flagsmith-cli/commit/d6fe2bc84accaae327d7afe6ac71f86b82337d7c)) -* fix npm trusted publishing ([#36](https://github.com/Flagsmith/flagsmith-cli/issues/36)) ([f76d21c](https://github.com/Flagsmith/flagsmith-cli/commit/f76d21c4e6d9f036237de92a1621fd9994c41346)) - - -### Other - -* Add build and test workflow, fix npm audit issues ([fa5d5da](https://github.com/Flagsmith/flagsmith-cli/commit/fa5d5da19e1ae552ca2c93a9f2473f9287ec9630)) -* **main:** release 0.2.2 ([#34](https://github.com/Flagsmith/flagsmith-cli/issues/34)) ([7759431](https://github.com/Flagsmith/flagsmith-cli/commit/775943112431f5ad40a9b196023c2f466d17a44d)) -* **main:** release 0.2.3 ([#37](https://github.com/Flagsmith/flagsmith-cli/issues/37)) ([80a5064](https://github.com/Flagsmith/flagsmith-cli/commit/80a50645d20af1924ca8f55b1c017bb655e834a3)) -* Remove amannn/action-semantic-pull-request workflow ([#38](https://github.com/Flagsmith/flagsmith-cli/issues/38)) ([a069831](https://github.com/Flagsmith/flagsmith-cli/commit/a0698319d3def4461ac3344a89f30a092b30e48c)) - -## [0.2.3](https://github.com/Flagsmith/flagsmith-cli/compare/v0.2.2...v0.2.3) (2025-11-24) - - -### CI - -* fix npm trusted publishing ([#36](https://github.com/Flagsmith/flagsmith-cli/issues/36)) ([f76d21c](https://github.com/Flagsmith/flagsmith-cli/commit/f76d21c4e6d9f036237de92a1621fd9994c41346)) - -## [0.2.2](https://github.com/Flagsmith/flagsmith-cli/compare/0.2.1...v0.2.2) (2025-11-06) - - -### CI - -* add NPM trusted publishing and release please ([#33](https://github.com/Flagsmith/flagsmith-cli/issues/33)) ([d6fe2bc](https://github.com/Flagsmith/flagsmith-cli/commit/d6fe2bc84accaae327d7afe6ac71f86b82337d7c)) - - -### Other - -* Add build and test workflow, fix npm audit issues ([fa5d5da](https://github.com/Flagsmith/flagsmith-cli/commit/fa5d5da19e1ae552ca2c93a9f2473f9287ec9630)) - - -## [0.2.1 - Update Flagsmith sdk](https://github.com/Flagsmith/flagsmith-cli/releases/tag/0.2.1) - 2025-03-20 - -Merges [#25](https://github.com/Flagsmith/flagsmith-cli/pull/25) - -[Changes][0.2.1] - - - -## [0.1.3 - Adds prettify flag -p](https://github.com/Flagsmith/flagsmith-cli/releases/tag/0.1.3) - 2023-05-29 - -[#12](https://github.com/Flagsmith/flagsmith-cli/pull/12) - -[Changes][0.1.3] - - - -## [0.1.2 - Add Identity flag -i](https://github.com/Flagsmith/flagsmith-cli/releases/tag/0.1.2) - 2023-05-29 - -[#11](https://github.com/Flagsmith/flagsmith-cli/pull/11) - -[Changes][0.1.2] - - - -## [0.1.1 - Fix api-input in a wrong const](https://github.com/Flagsmith/flagsmith-cli/releases/tag/0.1.1) - 2023-01-20 - -Merges [#10](https://github.com/Flagsmith/flagsmith-cli/pull/10), thank you very much [@vladaCizek](https://github.com/vladaCizek)! ๐Ÿš€ - -[Changes][0.1.1] - - -[0.2.1]: https://github.com/Flagsmith/flagsmith-cli/compare/0.1.3...0.2.1 -[0.1.3]: https://github.com/Flagsmith/flagsmith-cli/compare/0.1.2...0.1.3 -[0.1.2]: https://github.com/Flagsmith/flagsmith-cli/compare/0.1.1...0.1.2 -[0.1.1]: https://github.com/Flagsmith/flagsmith-cli/tree/0.1.1 - - diff --git a/README.md b/README.md index 0e7e3cc..e5c9f88 100644 --- a/README.md +++ b/README.md @@ -1,137 +1,67 @@ - +# Flagsmith CLI -@flagsmith/cli -================= +The next-generation Flagsmith command-line interface (work in progress). -Retrieve Flagsmith state from an API and store it in a file. +## Build -This CLI can be used to bake default flags into your application as part of CI/CD, this provides support for offline applications and is also advised as part of our [Defensive Coding and Default Flags Documentation](https://docs.flagsmith.com/guides-and-examples/defensive-coding). An example of this can be seen [here](./example). - - -# Populating defaultFlags in your Project - -The steps to using this to provide default flags are as follows. An example of this can be found [here](./example). The main steps to achieving this are as follows: - - -1. Install the cli ``npm i @flagsmith/cli --save-dev`` -2. Call the cli as part of postinstall to create a ``flagsmith.json`` file: - -```export FLAGSMITH_ENVIRONMENT=API_KEY``` - -``` -"postinstall": "flagsmith get" -``` -An example of this can be seen [here](./example/src/index.tsx). -3. In your application, import the outputted JSON and initialise the client with the json ``flagsmith.init({state:json, environmentID: json.environmentID})`` - -**Example:** - -```typescript -import flagsmith from '@flagsmith/flagsmith' -import state from './flagsmith.json' - -flagsmith.init({state, environmentID: state.environmentID}) -``` - -**Example with React:** - -```jsx -import state from './flagsmith.json' -ReactDOM.render( - - - , - document.getElementById('root') -); +```sh +go build -o flagsmith . ``` - -# Usage - Global - -```sh-session -$ npm install -g @flagsmith/cli -$ flagsmith COMMAND -running command... -$ flagsmith (--version) -flagsmith-cli/0.1.2 darwin-arm64 node-v18.13.0 -$ flagsmith --help [COMMAND] -USAGE - $ flagsmith COMMAND -... -``` - -# Commands - -* [`flagsmith get [ENVIRONMENT]`](#flagsmith-get-environment) -* [`flagsmith help [COMMANDS]`](#flagsmith-help-commands) - -## `flagsmith get [ENVIRONMENT]` - -Retrieve flagsmith features from the Flagsmith API and output them to a file. +## Quickstart +```sh +flagsmith init # log in, pick a project + environment, write flagsmith.json +flagsmith flag list # list the flags in the current environment ``` -USAGE - $ flagsmith get [ENVIRONMENT] [-o ] [-a ] [-t - -i ] [-p] [-e flags|environment] - -ARGUMENTS - ENVIRONMENT The flagsmith environment key to use, defaults to the environment - variable FLAGSMITH_ENVIRONMENT - -FLAGS - -a, --api= [default: https://edge.api.flagsmith.com/api/v1/] The - API URL to fetch the feature flags from - -e, --entity=