forest-cli 5.24.1 → 5.24.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +202 -674
  2. package/README.md +107 -55
  3. package/oclif.manifest.json +136 -136
  4. package/package.json +9 -6
package/README.md CHANGED
@@ -1,88 +1,140 @@
1
- # Forest Admin CLI
2
1
  <p align="center">
3
- <img src="https://github.com/ForestAdmin/toolbelt/blob/main/assets/logo.png?raw=true" alt="Toolbelt logo">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="./assets/header-toolbelt-dark.svg">
4
+ <img alt="Forest CLI: set up, build and ship your Forest project from the terminal." src="./assets/header-toolbelt-light.svg" width="100%">
5
+ </picture>
4
6
  </p>
5
7
 
6
- [![npm package](https://badge.fury.io/js/forest-cli.svg)](https://badge.fury.io/js/forest-cli)
7
- [![Build Status](https://github.com/ForestAdmin/toolbelt/workflows/Build,%20Test%20and%20Deploy/badge.svg?branch=main)](https://github.com/ForestAdmin/toolbelt/actions)
8
- [![Test Coverage](https://api.codeclimate.com/v1/badges/8c0c80478866e3399c92/test_coverage)](https://codeclimate.com/github/ForestAdmin/toolbelt/test_coverage)
9
- [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/forest-cli"><img alt="npm" src="https://img.shields.io/npm/v/forest-cli?color=3f5b1e&labelColor=262d1e"></a>
10
+ <a href="https://github.com/ForestAdmin/toolbelt/actions/workflows/build.yml"><img alt="CI" src="https://github.com/ForestAdmin/toolbelt/actions/workflows/build.yml/badge.svg?branch=main"></a>
11
+ <a href="./LICENSE"><img alt="License" src="https://img.shields.io/github/license/ForestAdmin/toolbelt?color=3f5b1e&labelColor=262d1e"></a>
12
+ </p>
13
+
14
+ **Forest is the back office for operations teams in regulated companies.** Ops teams review, decide and act on your data from one interface, or let AI agents do it through MCP, within the roles, permissions and audit logs you define.
15
+
16
+ This repository is the **Forest CLI** (`forest`): it creates your project, boots its agent, and manages layouts, workflows, roles, users and environments from the terminal. Everything you do in the Forest settings, you can script, review and version.
17
+
18
+ ## Quick start
19
+
20
+ ```bash
21
+ npm install -g forest-cli
22
+ forest start
23
+ ```
24
+
25
+ `forest start` takes you from nothing to a running back office: it logs you in, creates the project, boots its agent locally, and gives your coding agent the Forest skills to build on it. Pick a flow:
10
26
 
11
- The Lumberjacks' toolbelt is the Forest Admin CLI which makes easy to manage your back office application directly from the terminal.
27
+ | Flow | For | Command |
28
+ |---|---|---|
29
+ | Demo | Seeing Forest on realistic data, no database needed | `forest start --flow demo` |
30
+ | Standalone | A Node.js agent generated on your SQL or MongoDB database | `forest start --flow standalone --db <DATABASE_URL>` |
31
+ | In-app | Mounting Forest in an app you already run (Rails, Node.js) | `forest start --flow inapp --stack rails` |
12
32
 
13
- ## Install
33
+ Add `--dry-run` to print every step instead of running it.
34
+ Full guide: [docs.forest.app/get-started/quickstart](https://docs.forest.app/get-started/quickstart)
14
35
 
15
- $ npm install -g forest-cli
36
+ ## Requirements
37
+
38
+ | | |
39
+ |---|---|
40
+ | Node.js | `>= 18` |
41
+ | Account | A Forest account. `forest login` opens the browser to sign in. |
16
42
 
17
43
  ## Commands
18
44
 
19
- $ forest [command]
45
+ Run `forest help <command>` for the flags of any command.
46
+
47
+ <details open>
48
+ <summary><b>Set up a project</b></summary>
20
49
 
21
- ### General
50
+ | Command | What it does |
51
+ |---|---|
52
+ | `start` | Set up Forest from scratch: log in, create a project, boot its back-end, hand your coding agent the skills |
53
+ | `login` / `logout` / `user` | Sign in, sign out, show the logged-in user |
54
+ | `projects:create:demo` | Create a project with demo data, no database required |
55
+ | `projects:create:sql` / `projects:create:nosql` | Create a project with a Node.js agent generated on your SQL or MongoDB database |
56
+ | `projects:create:in-app` | Register a project for an app you host yourself and print its environment secret |
57
+ | `projects` / `projects:get` | List your projects, get a project's configuration |
58
+ | `skills:init` / `skills:update` | Install or refresh the Forest skills for your coding agent (Claude Code, Codex, Cursor, OpenCode…) |
22
59
 
23
- - `user` display the current logged in user.
24
- - `login` sign in to your Forest Admin account.
25
- - `logout` sign out of your Forest Admin account.
26
- - `help [cmd]` display help for [cmd].
60
+ </details>
27
61
 
28
- ### Projects
62
+ <details open>
63
+ <summary><b>Build the back office</b></summary>
29
64
 
30
- Manage Forest Admin projects.
65
+ | Command | What it does |
66
+ |---|---|
67
+ | `layout:pull` / `layout:apply` | Pull an environment's layout into `forest-layout.json`, edit it, apply it back |
68
+ | `layout:patch` | Patch the layout directly from a JSON file or stdin |
69
+ | `workflow:apply` | Create or update a workflow from a JSON steps spec |
70
+ | `schema:update` / `schema:apply` / `schema:diff` | Refresh, apply or compare `.forestadmin-schema.json` |
31
71
 
32
- - `projects` list your projects.
33
- - `projects:create <appName>` generate a backend application with an ORM/ODM configured.
34
- - `projects:get` get the configuration of a project.
72
+ </details>
35
73
 
36
- ### Environments
74
+ <details>
75
+ <summary><b>Manage access</b></summary>
37
76
 
38
- Manage Forest Admin environments.
77
+ | Command | What it does |
78
+ |---|---|
79
+ | `users:list` / `users:invite` / `users:edit` | List, invite and edit users (role, teams, permission level) |
80
+ | `roles:create` / `roles:copy` | Create a role, copy role permissions between environments |
81
+ | `roles:export` / `roles:apply` | Export every role's permissions to a CSV, edit it, apply it back |
82
+ | `teams:create` / `teams:delete` / `teams:copy-layout` | Manage teams and copy a team's layout onto another |
39
83
 
40
- - `environments` list your environments.
41
- - `environments:get` get the configuration of an environment.
42
- - `environments:create` create a new environment.
43
- - `environments:delete` delete an environment.
84
+ </details>
44
85
 
45
- Without the Development Workflow experience.
46
- - `environments:copy-layout` copy the layout from one environment to another.
86
+ <details>
87
+ <summary><b>Develop and deploy</b></summary>
47
88
 
48
- With the Development Workflow activated.
49
- - `init` set up your development environment in your current folder.
50
- - `branch` create a new branch or list your existing branches.
51
- - `switch` switch to another branch in your local development environment.
52
- - `push` push layout changes of your current branch to a remote environment.
53
- - `deploy` deploy layout changes of an environment to the reference one.
54
- - `environments:reset` reset a remote environment by removing all layout changes.
89
+ | Command | What it does |
90
+ |---|---|
91
+ | `init` | Set up your development environment in the current folder |
92
+ | `branch` / `switch` / `set-origin` | Create, list and switch layout branches, set a branch's origin |
93
+ | `push` | Push the layout changes of your branch to its origin |
94
+ | `deploy` | Deploy layout changes to the reference environment |
95
+ | `environments` / `environments:get` | List environments, get an environment's configuration |
96
+ | `environments:create` / `environments:update` / `environments:delete` / `environments:reset` | Manage environments |
55
97
 
56
- ### Schema
98
+ </details>
57
99
 
58
- Manage Forest Admin schema.
100
+ ## With a coding agent
59
101
 
60
- - `schema:apply` apply the current schema of your repository to the specified environment (using your `.forestadmin-schema.json` file).
61
- - `schema:diff` allow to compare two environment schemas.
62
- - `schema:update` refresh your schema by generating files that do not currently exist.
102
+ The CLI is built to be driven by an AI coding agent as well as by you. `forest skills:init` installs the Forest skills (the Forest plugin for Claude Code and Codex, plain skill files for the others), so your agent knows how to customize the agent code, edit layouts and write workflows with these commands. Listing and `get` commands accept `--format json`, and `layout:patch` and `workflow:apply` read their spec from stdin.
63
103
 
64
104
  ## Docker
65
105
 
66
- ### ENV variables
106
+ ```bash
107
+ docker run --rm --init -it \
108
+ -v `pwd`:/usr/src/app \
109
+ -v ~/.forest.d:/usr/src/cli/.forest.d \
110
+ -e TOKEN_PATH="/usr/src/cli" \
111
+ forestadmin/toolbelt:latest [command]
112
+ ```
113
+
114
+ | Variable | Use |
115
+ |---|---|
116
+ | `TOKEN_PATH` | Where the session token is stored. Must be `/usr/src/cli` with the image. |
117
+ | `FOREST_ENV_SECRET` | Environment secret, for commands that target an environment |
118
+ | `DATABASE_URL`, `DATABASE_SCHEMA` | Database connection, for the commands that need one |
119
+ | `SILENT` | Do not log command results (optional) |
120
+
121
+ A `.env` file in the current folder is picked up; otherwise pass each variable with `-e`.
67
122
 
68
- - `DATABASE_SCHEMA` the schema used by the database. (not for all commands)
69
- - `DATABASE_URL` the connection string. (not fot all commands)
70
- - `FOREST_ENV_SECRET` the env secret token used to access your Forest Admin environment.
71
- - `SILENT` used to not log commands results. (optional)
72
- - `TOKEN_PATH` path where store the session token. (need to be "/usr/src/cli" to work with the docker image)
123
+ ## Documentation
73
124
 
74
- If you have an `.env` file in you current folder docker should take it to run commands. So you can define the missing ENV variable inside.
75
- Otherwise you should pass all env variable you need in the `docker run` command, eg: `-e TOKEN_PATH="/usr/src/app"`.
125
+ | | |
126
+ |---|---|
127
+ | Get started | https://docs.forest.app/get-started/quickstart |
128
+ | CLI reference | https://docs.forest.app/reference/cli/overview |
76
129
 
77
- ### Using Forest Admin CLI
78
- - `TOKEN_PATH`="/usr/src/cli"
130
+ ## Contributing
131
+
132
+ Bug reports and pull requests are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup, tests and commit conventions.
79
133
 
80
134
  ```bash
81
- docker run --rm --init -it -v `pwd`:/usr/src/app -v ~/.forest.d:/usr/src/cli/.forest.d -e TOKEN_PATH="/usr/src/cli" forestadmin/toolbelt:latest [command]
135
+ yarn install && yarn build && yarn test
82
136
  ```
83
137
 
84
- ## Community
85
-
86
- 👇 Join our Developers community for support and more
138
+ ## License
87
139
 
88
- [![Discourse developers community](https://img.shields.io/discourse/posts?label=discourse&server=https%3A%2F%2Fcommunity.forestadmin.com)](https://community.forestadmin.com)
140
+ Apache-2.0. See [LICENSE](./LICENSE).
@@ -1659,141 +1659,6 @@
1659
1659
  "update.js"
1660
1660
  ]
1661
1661
  },
1662
- "teams:copy-layout": {
1663
- "aliases": [],
1664
- "args": {},
1665
- "description": "Copy a team's whole layout onto another team of the same project.",
1666
- "flags": {
1667
- "from": {
1668
- "char": "f",
1669
- "description": "Name of the team to copy the layout from.",
1670
- "name": "from",
1671
- "required": true,
1672
- "hasDynamicHelp": false,
1673
- "multiple": false,
1674
- "type": "option"
1675
- },
1676
- "to": {
1677
- "char": "t",
1678
- "description": "Name of the team to copy the layout to (its layout is overwritten).",
1679
- "name": "to",
1680
- "required": true,
1681
- "hasDynamicHelp": false,
1682
- "multiple": false,
1683
- "type": "option"
1684
- },
1685
- "projectId": {
1686
- "char": "p",
1687
- "description": "Forest project ID.",
1688
- "name": "projectId",
1689
- "hasDynamicHelp": false,
1690
- "multiple": false,
1691
- "type": "option"
1692
- },
1693
- "force": {
1694
- "description": "Skip the confirmation prompt.",
1695
- "name": "force",
1696
- "allowNo": false,
1697
- "type": "boolean"
1698
- }
1699
- },
1700
- "hasDynamicHelp": false,
1701
- "hiddenAliases": [],
1702
- "id": "teams:copy-layout",
1703
- "pluginAlias": "forest-cli",
1704
- "pluginName": "forest-cli",
1705
- "pluginType": "core",
1706
- "strict": true,
1707
- "isESM": false,
1708
- "relativePath": [
1709
- "dist",
1710
- "commands",
1711
- "teams",
1712
- "copy-layout.js"
1713
- ]
1714
- },
1715
- "teams:create": {
1716
- "aliases": [],
1717
- "args": {},
1718
- "description": "Create a new team in a project.",
1719
- "flags": {
1720
- "name": {
1721
- "char": "n",
1722
- "description": "Name of the team to create.",
1723
- "name": "name",
1724
- "required": true,
1725
- "hasDynamicHelp": false,
1726
- "multiple": false,
1727
- "type": "option"
1728
- },
1729
- "projectId": {
1730
- "char": "p",
1731
- "description": "Forest project ID.",
1732
- "name": "projectId",
1733
- "hasDynamicHelp": false,
1734
- "multiple": false,
1735
- "type": "option"
1736
- }
1737
- },
1738
- "hasDynamicHelp": false,
1739
- "hiddenAliases": [],
1740
- "id": "teams:create",
1741
- "pluginAlias": "forest-cli",
1742
- "pluginName": "forest-cli",
1743
- "pluginType": "core",
1744
- "strict": true,
1745
- "isESM": false,
1746
- "relativePath": [
1747
- "dist",
1748
- "commands",
1749
- "teams",
1750
- "create.js"
1751
- ]
1752
- },
1753
- "teams:delete": {
1754
- "aliases": [],
1755
- "args": {},
1756
- "description": "Delete a team from a project.",
1757
- "flags": {
1758
- "name": {
1759
- "char": "n",
1760
- "description": "Name of the team to delete.",
1761
- "name": "name",
1762
- "required": true,
1763
- "hasDynamicHelp": false,
1764
- "multiple": false,
1765
- "type": "option"
1766
- },
1767
- "projectId": {
1768
- "char": "p",
1769
- "description": "Forest project ID.",
1770
- "name": "projectId",
1771
- "hasDynamicHelp": false,
1772
- "multiple": false,
1773
- "type": "option"
1774
- },
1775
- "force": {
1776
- "description": "Skip the confirmation prompt.",
1777
- "name": "force",
1778
- "allowNo": false,
1779
- "type": "boolean"
1780
- }
1781
- },
1782
- "hasDynamicHelp": false,
1783
- "hiddenAliases": [],
1784
- "id": "teams:delete",
1785
- "pluginAlias": "forest-cli",
1786
- "pluginName": "forest-cli",
1787
- "pluginType": "core",
1788
- "strict": true,
1789
- "isESM": false,
1790
- "relativePath": [
1791
- "dist",
1792
- "commands",
1793
- "teams",
1794
- "delete.js"
1795
- ]
1796
- },
1797
1662
  "users:edit": {
1798
1663
  "aliases": [],
1799
1664
  "args": {},
@@ -1995,6 +1860,141 @@
1995
1860
  "list.js"
1996
1861
  ]
1997
1862
  },
1863
+ "teams:copy-layout": {
1864
+ "aliases": [],
1865
+ "args": {},
1866
+ "description": "Copy a team's whole layout onto another team of the same project.",
1867
+ "flags": {
1868
+ "from": {
1869
+ "char": "f",
1870
+ "description": "Name of the team to copy the layout from.",
1871
+ "name": "from",
1872
+ "required": true,
1873
+ "hasDynamicHelp": false,
1874
+ "multiple": false,
1875
+ "type": "option"
1876
+ },
1877
+ "to": {
1878
+ "char": "t",
1879
+ "description": "Name of the team to copy the layout to (its layout is overwritten).",
1880
+ "name": "to",
1881
+ "required": true,
1882
+ "hasDynamicHelp": false,
1883
+ "multiple": false,
1884
+ "type": "option"
1885
+ },
1886
+ "projectId": {
1887
+ "char": "p",
1888
+ "description": "Forest project ID.",
1889
+ "name": "projectId",
1890
+ "hasDynamicHelp": false,
1891
+ "multiple": false,
1892
+ "type": "option"
1893
+ },
1894
+ "force": {
1895
+ "description": "Skip the confirmation prompt.",
1896
+ "name": "force",
1897
+ "allowNo": false,
1898
+ "type": "boolean"
1899
+ }
1900
+ },
1901
+ "hasDynamicHelp": false,
1902
+ "hiddenAliases": [],
1903
+ "id": "teams:copy-layout",
1904
+ "pluginAlias": "forest-cli",
1905
+ "pluginName": "forest-cli",
1906
+ "pluginType": "core",
1907
+ "strict": true,
1908
+ "isESM": false,
1909
+ "relativePath": [
1910
+ "dist",
1911
+ "commands",
1912
+ "teams",
1913
+ "copy-layout.js"
1914
+ ]
1915
+ },
1916
+ "teams:create": {
1917
+ "aliases": [],
1918
+ "args": {},
1919
+ "description": "Create a new team in a project.",
1920
+ "flags": {
1921
+ "name": {
1922
+ "char": "n",
1923
+ "description": "Name of the team to create.",
1924
+ "name": "name",
1925
+ "required": true,
1926
+ "hasDynamicHelp": false,
1927
+ "multiple": false,
1928
+ "type": "option"
1929
+ },
1930
+ "projectId": {
1931
+ "char": "p",
1932
+ "description": "Forest project ID.",
1933
+ "name": "projectId",
1934
+ "hasDynamicHelp": false,
1935
+ "multiple": false,
1936
+ "type": "option"
1937
+ }
1938
+ },
1939
+ "hasDynamicHelp": false,
1940
+ "hiddenAliases": [],
1941
+ "id": "teams:create",
1942
+ "pluginAlias": "forest-cli",
1943
+ "pluginName": "forest-cli",
1944
+ "pluginType": "core",
1945
+ "strict": true,
1946
+ "isESM": false,
1947
+ "relativePath": [
1948
+ "dist",
1949
+ "commands",
1950
+ "teams",
1951
+ "create.js"
1952
+ ]
1953
+ },
1954
+ "teams:delete": {
1955
+ "aliases": [],
1956
+ "args": {},
1957
+ "description": "Delete a team from a project.",
1958
+ "flags": {
1959
+ "name": {
1960
+ "char": "n",
1961
+ "description": "Name of the team to delete.",
1962
+ "name": "name",
1963
+ "required": true,
1964
+ "hasDynamicHelp": false,
1965
+ "multiple": false,
1966
+ "type": "option"
1967
+ },
1968
+ "projectId": {
1969
+ "char": "p",
1970
+ "description": "Forest project ID.",
1971
+ "name": "projectId",
1972
+ "hasDynamicHelp": false,
1973
+ "multiple": false,
1974
+ "type": "option"
1975
+ },
1976
+ "force": {
1977
+ "description": "Skip the confirmation prompt.",
1978
+ "name": "force",
1979
+ "allowNo": false,
1980
+ "type": "boolean"
1981
+ }
1982
+ },
1983
+ "hasDynamicHelp": false,
1984
+ "hiddenAliases": [],
1985
+ "id": "teams:delete",
1986
+ "pluginAlias": "forest-cli",
1987
+ "pluginName": "forest-cli",
1988
+ "pluginType": "core",
1989
+ "strict": true,
1990
+ "isESM": false,
1991
+ "relativePath": [
1992
+ "dist",
1993
+ "commands",
1994
+ "teams",
1995
+ "delete.js"
1996
+ ]
1997
+ },
1998
1998
  "workflow:apply": {
1999
1999
  "aliases": [],
2000
2000
  "args": {
@@ -3736,5 +3736,5 @@
3736
3736
  ]
3737
3737
  }
3738
3738
  },
3739
- "version": "5.24.1"
3739
+ "version": "5.24.3"
3740
3740
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "forest-cli",
3
3
  "description": "The Lumberjacks' toolbelt is the Forest CLI which makes easy to manage your back office application directly from the terminal.",
4
- "version": "5.24.1",
4
+ "version": "5.24.3",
5
5
  "author": "Sandro Munda",
6
6
  "contributors": [
7
7
  "Arnaud Valensi <arnaud.valensi@gmail.com>",
@@ -30,14 +30,14 @@
30
30
  "clipboardy": "2.3.0",
31
31
  "commander": "2.9.0",
32
32
  "dotenv": "8.2.0",
33
- "handlebars": "4.7.9",
33
+ "handlebars": "4.7.10",
34
34
  "inquirer": "6.2.0",
35
- "joi": "17.13.6",
35
+ "joi": "17.13.8",
36
36
  "json-diff": "1.0.0",
37
37
  "jsonapi-serializer": "3.6.2",
38
38
  "jsonwebtoken": "9.0.3",
39
39
  "jwt-decode": "2.2.0",
40
- "lodash": "4.18.0",
40
+ "lodash": "^4.17.21",
41
41
  "mkdirp": "1.0.4",
42
42
  "mongodb": "4.17.2",
43
43
  "mysql2": "3.23.1",
@@ -104,7 +104,7 @@
104
104
  "keywords": [
105
105
  "forestadmin"
106
106
  ],
107
- "license": "GPL-3.0",
107
+ "license": "Apache-2.0",
108
108
  "main": "dist/index.js",
109
109
  "oclif": {
110
110
  "commands": "./dist/commands",
@@ -140,6 +140,9 @@
140
140
  "resolutions": {
141
141
  "uuid": "^11.1.1",
142
142
  "inquirer/**/tmp": "^0.2.6",
143
- "mongodb/mongodb-connection-string-url": "^3.0.2"
143
+ "mongodb/mongodb-connection-string-url": "^3.0.2",
144
+ "filelist": "^2.0.2",
145
+ "fast-xml-parser": "^5.7.0",
146
+ "semantic-release/**/handlebars": "^4.7.10"
144
147
  }
145
148
  }