create-restforge-skills 1.0.0 → 1.0.2

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.
@@ -1,4 +1,4 @@
1
- interface:
2
- display_name: "RESTForge"
3
- short_description: "Build RESTForge APIs and frontends through MCP"
4
- default_prompt: "Use $restforge to build or update my RESTForge application."
1
+ interface:
2
+ display_name: "RESTForge"
3
+ short_description: "Build RESTForge APIs and frontends through MCP"
4
+ default_prompt: "Use $restforge to add a table, an API endpoint, or a frontend page to my RESTForge project."
@@ -1,145 +1,185 @@
1
- # Reference: Auth Extension
2
-
3
- > **Offline mirror.** This file mirrors the auth commands of the installed
4
- > RESTForge platform and Designer (`restforge project auth`, `npx
5
- > npx restforge-designer auth`). The live tools/CLI are authoritative — when this file and them disagree,
6
- > trust the tools, then update this file.
7
-
8
- **This file documents the auth EXTENSION — auth WITHOUT RBAC.** It is one of two
9
- distinct auth mechanisms; do not confuse them:
10
-
11
- | Mechanism | RBAC? | Where |
12
- |---|---|---|
13
- | **Plugin auth** — built into the frontend at generation | **Yes (auth + RBAC)** | `vanilla-js-auth` / `vanilla-js-custom` plugin, chosen at `designer_init_project`; toggle off with `noAuth: true` (`--no-auth`). See `udf-catalog.md § Plugins`. |
14
- | **Auth extension** (this file) | **No RBAC** | `project_auth` (backend) + `designer_auth_create` (frontend `rfx_auth`) |
15
-
16
- The extension is an optional add-on installed into a project that already exists.
17
- Backend auth and frontend auth are **independent**: install either, both, or
18
- neither. Both are JWT-based.
19
-
20
- **Out of scope for the extension:** Google Sign-In, RBAC, and the
21
- `@restforgejs/auth` package. The embedded frontend flow is independent of the
22
- `vanilla-js-auth` plugin — if the user needs RBAC, use plugin auth, not this.
23
-
24
- ---
25
-
26
- ## Backend
27
-
28
- MCP tool: `project_auth` — wraps `npx restforge project auth --create`.
29
-
30
- ```
31
- npx restforge project auth --create --project=<name> [options]
32
- ```
33
-
34
- | Flag | Required | Default | Notes |
35
- |---|---|---|---|
36
- | `--create` | yes | `false` | Required trigger; must be present |
37
- | `--project <name>` | yes* | — | Target project name |
38
- | `--name <name>` | yes* | — | Alias of `--project` |
39
- | `--schema-path <dir>` | no | `./schema` | Output folder for auth SDF files |
40
- | `--config <file>` | no | `config/db-connection.env` | DB config for the migrate step |
41
- | `--force` | no | `false` | Overwrite existing files (backup still made) |
42
-
43
- \* one of `--project` / `--name` is required.
44
-
45
- MCP params: `cwd` (project folder, must contain `node_modules/@restforgejs/platform`),
46
- `project`, `schemaPath?`, `config?`, `force?`.
47
-
48
- **What it does (in order):**
49
- 1. Generates auth SDF files (prefix `rfx`) to `--schema-path`.
50
- 2. Creates auth DB tables via dbschema-kit (idempotent, `IF NOT EXISTS`).
51
- 3. Writes auth middleware + router.
52
- 4. Writes six processors: `register`, `login`, `refresh`, `logout`, `me`,
53
- `reset-password`.
54
- 5. Injects auth env vars (random `JWT_SECRET`) into the config file.
55
- 6. Records `bcrypt` + `jsonwebtoken` as runtime dependencies in the project's
56
- `package.json`.
57
-
58
- **Prerequisites:** the project already exists (run `endpoint create` /
59
- the standard backend pipeline first), `@restforgejs/platform` is installed in the
60
- project, and the DB is active and reachable with the config credentials.
61
-
62
- Idempotent (re-runnable). Non-destructive aside from `--force` overwrites, which
63
- still create a backup.
64
-
65
- ---
66
-
67
- ## Frontend
68
-
69
- Embedded login / signup / forget-password overlay (`rfx_auth`), mounted at route
70
- `/api/<project>/rfx_auth`. Independent of the `vanilla-js-auth` plugin.
71
-
72
- MCP tools: `designer_auth_create`, `designer_auth_remove` — wrap
73
- `npx restforge-designer auth --create | --remove`.
74
-
75
- ```
76
- npx restforge-designer auth --create --project=<name> [options]
77
- npx restforge-designer auth --remove --project=<name> [--frontend-path <path>] --force
78
- ```
79
-
80
- `--create` and `--remove` are mutually exclusive; exactly one is required.
81
-
82
- | Flag | Applies to | Default | Notes |
83
- |---|---|---|---|
84
- | `--create` | create | — | Install the overlay |
85
- | `--remove` | remove | — | Uninstall the overlay |
86
- | `--project <name>` | both | — | App code, localStorage prefix, route `/api/<project>/rfx_auth` |
87
- | `--frontend-path <path>` | both | `./frontend/apps` | Apps root; target app = `<frontend-path>/<project>` |
88
- | `--api-base-url <url>` | create | from `app-config.json` | Override backend base URL |
89
- | `--plugins-dir <dir>` | both | auto-detect | Plugins directory |
90
- | `--overwrite` | create | `false` | Overwrite existing auth files (+ archive backup) |
91
- | `--force` | remove | `false` | Skip the y/N removal prompt |
92
-
93
- MCP params — `designer_auth_create`: `cwd`, `project`, `frontendPath?`,
94
- `apiBaseUrl?`, `overwrite?`. `designer_auth_remove`: `cwd`, `project`,
95
- `frontendPath?` (the MCP tool always passes `--force`).
96
-
97
- **`--create` does (in order):**
98
- 1. Renders `login.html`, `signup.html`, the forget-password overlay, and
99
- `js/rfx_auth.js` from embedded templates (no Google Sign-In).
100
- 2. Writes the artifacts to `<frontend-path>/<project>/`.
101
- 3. Injects an auth guard `<script src="js/rfx_auth.js">` into all existing
102
- `*.html` pages in the target dir (except `login.html` / `signup.html`).
103
- 4. Writes the `embeddedAuth` marker to `payload/app-config.json` (non-destructive;
104
- other keys untouched).
105
-
106
- If no app pages exist yet, guard injection is skipped with a warning; the guard is
107
- injected automatically when `designer_generate` creates pages later.
108
-
109
- **`--remove` does (in order):**
110
- 1. Detects whether auth is installed (files + `embeddedAuth` marker).
111
- 2. Deletes `login.html`, `signup.html`, the forget-password overlay,
112
- `js/rfx_auth.js`.
113
- 3. Strips the auth guard from all `*.html` pages (other content untouched).
114
- 4. Removes the `embeddedAuth` key from `payload/app-config.json` (other keys kept).
115
-
116
- **Prerequisites:** the Designer is invoked via `npx restforge-designer` and is
117
- bundled inside the `@restforgejs/platform` package; the prerequisite is that
118
- `@restforgejs/platform` is installed in the project (e.g. a project created with
119
- `npx create-restforge-app`).
120
-
121
- Both are idempotent. **`--remove` is destructive** — confirm project name and
122
- intent with the user before running (MCP always passes `--force`).
123
-
124
- ---
125
-
126
- ## Two frontend auth approaches — do not combine
127
-
128
- | Approach | RBAC? | When | How |
129
- |---|---|---|---|
130
- | Plugin auth (`vanilla-js-auth`, `vanilla-js-custom`) | **Yes (auth + RBAC)** | A new app that needs auth/RBAC | Choose the plugin in `designer_init_project`; auth is built in at generation. Disable with `noAuth: true` (`--no-auth`) |
131
- | Embedded `rfx_auth` | **No RBAC** | An existing app generated WITHOUT plugin auth | `designer_auth_create` bolts auth on |
132
-
133
- Do not add `rfx_auth` to an app already built with plugin auth — they are two
134
- separate mechanisms. If the user needs RBAC, only plugin auth provides it.
135
-
136
- ---
137
-
138
- ## Common errors
139
-
140
- | Symptom | Cause | Recovery |
141
- |---|---|---|
142
- | Backend: "package not installed" precondition | `@restforgejs/platform` missing in the project | Install the package, then re-run |
143
- | Backend: project does not exist / DB not reachable | Auth runs against an existing project + live DB | Create the project + endpoints first; verify DB config |
144
- | Frontend: Designer (`npx restforge-designer`) cannot run | `@restforgejs/platform` (which bundles the Designer) missing in the project | Install `@restforgejs/platform` in the project (e.g. via `npx create-restforge-app`), then re-run |
145
- | Frontend: files already exist, not overwritten | Auth already installed | Use `--overwrite` (create) only if you intend to replace |
1
+ # Reference: Auth Extension
2
+
3
+ > **Offline mirror.** This file mirrors the auth commands of the installed
4
+ > RESTForge platform and Designer (`restforge project auth`, `npx
5
+ > npx restforge-designer auth`). The live tools/CLI are authoritative — when this file and them disagree,
6
+ > trust the tools, then update this file.
7
+
8
+ **This file documents the auth EXTENSION — auth WITHOUT RBAC.** It is one of two
9
+ distinct auth mechanisms; do not confuse them:
10
+
11
+ | Mechanism | RBAC? | Where |
12
+ |---|---|---|
13
+ | **Plugin auth** — built into the frontend at generation | **Yes (auth + RBAC)** | `vanilla-js-auth` / `vanilla-js-custom` plugin, chosen at `designer_init_project`; toggle off with `noAuth: true` (`--no-auth`). See `udf-catalog.md § Plugins`. |
14
+ | **Auth extension** (this file) | **No RBAC** | `project_auth` (backend) + `designer_auth_create` (frontend `rfx_auth`) |
15
+
16
+ The extension is an optional add-on installed into a project that already exists.
17
+ Backend auth and frontend auth are **independent**: install either, both, or
18
+ neither. Both are JWT-based.
19
+
20
+ **Out of scope for the extension:** Google Sign-In, RBAC, and the
21
+ `@restforgejs/auth` package. The embedded frontend flow is independent of the
22
+ `vanilla-js-auth` plugin — if the user needs RBAC, use plugin auth, not this.
23
+
24
+ ---
25
+
26
+ ## Choosing the mechanism
27
+
28
+ - **Needs RBAC** → plugin auth (`vanilla-js-auth` / `vanilla-js-custom`) at
29
+ `designer_init_project`. The extension below does **not** do RBAC.
30
+ - **Backend auth on an existing project (no RBAC)** → `project_auth` (after the
31
+ project and its endpoint exist, with an active DB).
32
+ - **Frontend auth on an app built WITHOUT plugin auth (no RBAC)** →
33
+ `designer_auth_create` (embedded `rfx_auth`).
34
+ - **Remove embedded frontend auth** → `designer_auth_remove` — destructive,
35
+ confirm first (SKILL.md § Guardrails).
36
+
37
+ ### Retrofit on a generated app — `designer_auth_attach`
38
+
39
+ ```
40
+ designer_auth_attach (wraps: npx restforge-designer auth --attach --project=<name>)
41
+ ```
42
+
43
+ The "turn auth on afterwards" path for an app whose pages already exist. It
44
+ installs `js/rfx_auth.js`, injects the script tag into the existing pages (except
45
+ the login page), and writes the `embeddedAuth` marker — **page files themselves
46
+ are never touched**, so customisations survive. When the project payload has an
47
+ auth block on an auth-capable plugin (`vanilla-js-auth` / `vanilla-js-custom`) it
48
+ additionally renders the plugin login artifacts (`js/auth.js`, `login.html`,
49
+ `js/login.js`) and extends `js/config.js` with a marked block; in that mode the
50
+ `rfx_auth` login/signup pages are not written, and the storage key is aligned with
51
+ the plugin login so both sides read the same session. Idempotent — existing files
52
+ are skipped unless `overwrite` is set.
53
+
54
+ Pick between the two: `designer_auth_create` when the app just needs a standalone
55
+ login/signup overlay and no auth-capable plugin is in play;
56
+ `designer_auth_attach` when the pages already exist, the plugin is
57
+ `vanilla-js-auth` / `vanilla-js-custom`, or `designer_generate` reported missing
58
+ auth artifacts. The CLI accepts exactly one of `--create` / `--attach` /
59
+ `--remove` per invocation.
60
+
61
+ Do not combine the two mechanisms on one app: if an app already has plugin auth
62
+ (`vanilla-js-auth` / `vanilla-js-custom`), do not also add embedded `rfx_auth`.
63
+
64
+ ---
65
+
66
+ ## Backend
67
+
68
+ MCP tool: `project_auth` — wraps `npx restforge project auth --create`.
69
+
70
+ ```
71
+ npx restforge project auth --create --project=<name> [options]
72
+ ```
73
+
74
+ | Flag | Required | Default | Notes |
75
+ |---|---|---|---|
76
+ | `--create` | yes | `false` | Required trigger; must be present |
77
+ | `--project <name>` | yes* | — | Target project name |
78
+ | `--name <name>` | yes* | — | Alias of `--project` |
79
+ | `--schema-path <dir>` | no | `./schema` | Output folder for auth SDF files |
80
+ | `--config <file>` | no | `config/db-connection.env` | DB config for the migrate step |
81
+ | `--force` | no | `false` | Overwrite existing files (backup still made) |
82
+
83
+ \* one of `--project` / `--name` is required.
84
+
85
+ MCP params: `cwd` (project folder, must contain `node_modules/@restforgejs/platform`),
86
+ `project`, `schemaPath?`, `config?`, `force?`.
87
+
88
+ **What it does (in order):**
89
+ 1. Generates auth SDF files (prefix `rfx`) to `--schema-path`.
90
+ 2. Creates auth DB tables via dbschema-kit (idempotent, `IF NOT EXISTS`).
91
+ 3. Writes auth middleware + router.
92
+ 4. Writes six processors: `register`, `login`, `refresh`, `logout`, `me`,
93
+ `reset-password`.
94
+ 5. Injects auth env vars (random `JWT_SECRET`) into the config file.
95
+ 6. Records `bcrypt` + `jsonwebtoken` as runtime dependencies in the project's
96
+ `package.json`.
97
+
98
+ **Prerequisites:** the project already exists (run `endpoint create` /
99
+ the standard backend pipeline first), `@restforgejs/platform` is installed in the
100
+ project, and the DB is active and reachable with the config credentials.
101
+
102
+ Idempotent (re-runnable). Non-destructive aside from `--force` overwrites, which
103
+ still create a backup.
104
+
105
+ ---
106
+
107
+ ## Frontend
108
+
109
+ Embedded login / signup / forget-password overlay (`rfx_auth`), mounted at route
110
+ `/api/<project>/rfx_auth`. Independent of the `vanilla-js-auth` plugin.
111
+
112
+ MCP tools: `designer_auth_create`, `designer_auth_remove` — wrap
113
+ `npx restforge-designer auth --create | --remove`.
114
+
115
+ ```
116
+ npx restforge-designer auth --create --project=<name> [options]
117
+ npx restforge-designer auth --remove --project=<name> [--frontend-path <path>] --force
118
+ ```
119
+
120
+ `--create` and `--remove` are mutually exclusive; exactly one is required.
121
+
122
+ | Flag | Applies to | Default | Notes |
123
+ |---|---|---|---|
124
+ | `--create` | create | — | Install the overlay |
125
+ | `--remove` | remove | — | Uninstall the overlay |
126
+ | `--project <name>` | both | — | App code, localStorage prefix, route `/api/<project>/rfx_auth` |
127
+ | `--frontend-path <path>` | both | `./frontend/apps` | Apps root; target app = `<frontend-path>/<project>` |
128
+ | `--api-base-url <url>` | create | from `app-config.json` | Override backend base URL |
129
+ | `--plugins-dir <dir>` | both | auto-detect | Plugins directory |
130
+ | `--overwrite` | create | `false` | Overwrite existing auth files (+ archive backup) |
131
+ | `--force` | remove | `false` | Skip the y/N removal prompt |
132
+
133
+ MCP params — `designer_auth_create`: `cwd`, `project`, `frontendPath?`,
134
+ `apiBaseUrl?`, `overwrite?`. `designer_auth_remove`: `cwd`, `project`,
135
+ `frontendPath?` (the MCP tool always passes `--force`).
136
+
137
+ **`--create` does (in order):**
138
+ 1. Renders `login.html`, `signup.html`, the forget-password overlay, and
139
+ `js/rfx_auth.js` from embedded templates (no Google Sign-In).
140
+ 2. Writes the artifacts to `<frontend-path>/<project>/`.
141
+ 3. Injects an auth guard `<script src="js/rfx_auth.js">` into all existing
142
+ `*.html` pages in the target dir (except `login.html` / `signup.html`).
143
+ 4. Writes the `embeddedAuth` marker to `payload/app-config.json` (non-destructive;
144
+ other keys untouched).
145
+
146
+ If no app pages exist yet, guard injection is skipped with a warning; the guard is
147
+ injected automatically when `designer_generate` creates pages later.
148
+
149
+ **`--remove` does (in order):**
150
+ 1. Detects whether auth is installed (files + `embeddedAuth` marker).
151
+ 2. Deletes `login.html`, `signup.html`, the forget-password overlay,
152
+ `js/rfx_auth.js`.
153
+ 3. Strips the auth guard from all `*.html` pages (other content untouched).
154
+ 4. Removes the `embeddedAuth` key from `payload/app-config.json` (other keys kept).
155
+
156
+ **Prerequisites:** the Designer is invoked via `npx restforge-designer` and is
157
+ bundled inside the `@restforgejs/platform` package; the prerequisite is that
158
+ `@restforgejs/platform` is installed in the project (e.g. a project created with
159
+ `npx create-restforge-app`).
160
+
161
+ Both are idempotent. **`--remove` is destructive** — confirm project name and
162
+ intent with the user before running (MCP always passes `--force`).
163
+
164
+ ---
165
+
166
+ ## Two frontend auth approaches — do not combine
167
+
168
+ | Approach | RBAC? | When | How |
169
+ |---|---|---|---|
170
+ | Plugin auth (`vanilla-js-auth`, `vanilla-js-custom`) | **Yes (auth + RBAC)** | A new app that needs auth/RBAC | Choose the plugin in `designer_init_project`; auth is built in at generation. Disable with `noAuth: true` (`--no-auth`) |
171
+ | Embedded `rfx_auth` | **No RBAC** | An existing app generated WITHOUT plugin auth | `designer_auth_create` bolts auth on |
172
+
173
+ Do not add `rfx_auth` to an app already built with plugin auth — they are two
174
+ separate mechanisms. If the user needs RBAC, only plugin auth provides it.
175
+
176
+ ---
177
+
178
+ ## Common errors
179
+
180
+ | Symptom | Cause | Recovery |
181
+ |---|---|---|
182
+ | Backend: "package not installed" precondition | `@restforgejs/platform` missing in the project | Install the package, then re-run |
183
+ | Backend: project does not exist / DB not reachable | Auth runs against an existing project + live DB | Create the project + endpoints first; verify DB config |
184
+ | Frontend: Designer (`npx restforge-designer`) cannot run | `@restforgejs/platform` (which bundles the Designer) missing in the project | Install `@restforgejs/platform` in the project (e.g. via `npx create-restforge-app`), then re-run |
185
+ | Frontend: files already exist, not overwritten | Auth already installed | Use `--overwrite` (create) only if you intend to replace |