@notur/sdk 1.4.5 → 1.4.7

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 (51) hide show
  1. package/README.md +136 -1
  2. package/bin/notur-create.js +586 -0
  3. package/bin/notur-doctor.js +123 -0
  4. package/bin/notur-pack.js +13 -7
  5. package/bin/notur-push.js +331 -0
  6. package/bin/notur-sync.js +199 -0
  7. package/bin/notur-validate.js +200 -0
  8. package/bin/notur.js +46 -0
  9. package/dist/events.d.ts +10 -0
  10. package/dist/events.d.ts.map +1 -1
  11. package/dist/events.js +7 -0
  12. package/dist/events.js.map +1 -1
  13. package/dist/hooks/useExtensionConfig.d.ts +23 -4
  14. package/dist/hooks/useExtensionConfig.d.ts.map +1 -1
  15. package/dist/hooks/useExtensionConfig.js +8 -1
  16. package/dist/hooks/useExtensionConfig.js.map +1 -1
  17. package/dist/hooks/useNavigate.d.ts +27 -6
  18. package/dist/hooks/useNavigate.d.ts.map +1 -1
  19. package/dist/hooks/useNavigate.js +11 -2
  20. package/dist/hooks/useNavigate.js.map +1 -1
  21. package/dist/hooks/useNoturEvent.d.ts +12 -0
  22. package/dist/hooks/useNoturEvent.d.ts.map +1 -1
  23. package/dist/hooks/useNoturEvent.js +12 -0
  24. package/dist/hooks/useNoturEvent.js.map +1 -1
  25. package/dist/hooks/usePermission.d.ts +10 -1
  26. package/dist/hooks/usePermission.d.ts.map +1 -1
  27. package/dist/hooks/usePermission.js +10 -1
  28. package/dist/hooks/usePermission.js.map +1 -1
  29. package/dist/hooks/useServerContext.d.ts +18 -3
  30. package/dist/hooks/useServerContext.d.ts.map +1 -1
  31. package/dist/hooks/useServerContext.js +8 -1
  32. package/dist/hooks/useServerContext.js.map +1 -1
  33. package/dist/hooks/useUserContext.d.ts +10 -2
  34. package/dist/hooks/useUserContext.d.ts.map +1 -1
  35. package/dist/hooks/useUserContext.js +2 -0
  36. package/dist/hooks/useUserContext.js.map +1 -1
  37. package/dist/index.d.ts +6 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/types.d.ts +179 -20
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/types.js +6 -1
  43. package/dist/types.js.map +1 -1
  44. package/examples/red-button/.env.example +2 -0
  45. package/examples/red-button/README.md +30 -0
  46. package/examples/red-button/extension.yaml +9 -0
  47. package/examples/red-button/package.json +29 -0
  48. package/examples/red-button/resources/frontend/src/index.tsx +32 -0
  49. package/examples/red-button/tsconfig.json +13 -0
  50. package/examples/red-button/webpack.config.js +17 -0
  51. package/package.json +11 -3
package/README.md CHANGED
@@ -94,7 +94,100 @@ import type {
94
94
 
95
95
  ## CLI Tools
96
96
 
97
- The SDK ships two CLI tools, available via `npx`, `yarn dlx`, `pnpm dlx`, or `bunx`.
97
+ The SDK ships local development CLI tools, available via `npx`, `yarn dlx`, `pnpm dlx`, or `bunx`.
98
+
99
+ You can use the dispatcher:
100
+
101
+ ```bash
102
+ npx @notur/sdk create acme/red-button
103
+ npx @notur/sdk pack
104
+ npx @notur/sdk push --host https://panel.example.com --key notur_xxx
105
+ ```
106
+
107
+ Or the standalone bins:
108
+
109
+ ```bash
110
+ npx notur-create acme/red-button
111
+ npx notur-pack
112
+ npx notur-push --host https://panel.example.com --key notur_xxx
113
+ ```
114
+
115
+ ### `notur-create` — Scaffold extensions locally
116
+
117
+ Creates a Notur extension folder without requiring Pterodactyl, Laravel, or `php artisan`.
118
+
119
+ Run without arguments to start the interactive wizard:
120
+
121
+ ```bash
122
+ npx notur-create
123
+ ```
124
+
125
+ Scripted usage stays non-interactive:
126
+
127
+ ```bash
128
+ npx notur-create acme/red-button --slot server.header
129
+ cd red-button
130
+ npm install
131
+ npm run build
132
+ npx notur-pack
133
+ ```
134
+
135
+ Options:
136
+ - `--path <dir>` — parent directory for the generated extension.
137
+ - `--preset <name>` — `frontend`, `backend`, `full`, or `minimal`.
138
+ - `--name <name>` — display name for `extension.yaml`.
139
+ - `--description <text>` — description for `extension.yaml`.
140
+ - `--slot <slot>` — initial frontend slot, default `dashboard.widgets`.
141
+ - `--package-manager <name>` — `npm`, `pnpm`, `yarn`, or `bun`.
142
+ - `--install` / `--no-install` — install frontend dependencies after scaffolding.
143
+ - `--env` / `--no-env` — create `.env` from `.env.example`.
144
+ - `--no-frontend` — generate only `extension.yaml` and the PHP entrypoint.
145
+ - `--with-api-routes` — include a client API route stub.
146
+ - `--force` — allow writing into an existing empty directory.
147
+
148
+ Frontend-only extensions are manifest-only by default. They do not need a PHP entrypoint unless you choose backend features such as API routes.
149
+
150
+ ### `notur-sync` — Sync generated metadata
151
+
152
+ Reads `extension.yaml` and updates derived local development files.
153
+
154
+ ```bash
155
+ npx notur-sync
156
+ npx @notur/sdk sync
157
+ ```
158
+
159
+ It keeps `package.json` name/version/scripts aligned, creates `.env.example` if missing, and creates `webpack.config.js` for frontend extensions that do not already have one.
160
+
161
+ Options:
162
+ - `--force-webpack` — regenerate `webpack.config.js` from `extension.yaml`.
163
+
164
+ ### `notur-validate` — Validate extension structure
165
+
166
+ Runs local checks before packaging or pushing:
167
+
168
+ ```bash
169
+ npx notur-validate
170
+ npx @notur/sdk validate
171
+ ```
172
+
173
+ Checks include manifest shape, id format, route file paths, bundle path, package metadata drift, missing scripts, `createExtension()` usage, and unknown slot IDs.
174
+
175
+ Options:
176
+ - `--strict` — treat warnings as errors.
177
+
178
+ ### `notur-doctor` — Diagnose local and remote setup
179
+
180
+ Summarizes whether the local extension is buildable and ready to push:
181
+
182
+ ```bash
183
+ npx notur-doctor
184
+ npx @notur/sdk doctor
185
+ ```
186
+
187
+ It checks manifest/package/build files, runs `notur-validate`, and verifies local `.env` or shell variables for remote push.
188
+
189
+ Options:
190
+ - `--no-remote` — skip remote host/key checks.
98
191
 
99
192
  ### `notur-pack` — Package extensions
100
193
 
@@ -137,6 +230,48 @@ This additionally produces:
137
230
 
138
231
  The `.sig` format is compatible with PHP's `SignatureVerifier::verify()`.
139
232
 
233
+ ### `notur-push` — Push to a remote Notur panel
234
+
235
+ Packages the local extension and uploads it to a Notur-enabled Pterodactyl panel using a remote push key.
236
+
237
+ ```bash
238
+ npx notur-push --host https://panel.example.com --key notur_xxx
239
+ ```
240
+
241
+ Equivalent values can be provided by the shell or by a local `.env` file in the extension directory:
242
+
243
+ ```dotenv
244
+ NOTUR_HOST=https://panel.example.com
245
+ NOTUR_PUSH_KEY=notur_xxx
246
+ ```
247
+
248
+ Then run:
249
+
250
+ ```bash
251
+ npm run push
252
+ ```
253
+
254
+ or:
255
+
256
+ ```bash
257
+ npx notur-push
258
+ ```
259
+
260
+ Remote setup on the panel:
261
+
262
+ ```bash
263
+ php artisan notur:remote-key
264
+ ```
265
+
266
+ Add the printed `NOTUR_REMOTE_PUSH_ENABLED=true` and `NOTUR_REMOTE_PUSH_KEYS=...` values to the panel `.env`.
267
+
268
+ Options:
269
+ - `--archive <file>` — upload an existing `.notur` archive instead of packing.
270
+ - `--env-file <file>` — load host/key values from a custom env file.
271
+ - `--no-build` — skip running the local `build` script before packing.
272
+ - `--no-force` — do not overwrite an already installed extension.
273
+ - `--keep-archive` — keep the temporary archive generated for the push.
274
+
140
275
  ### `notur-keygen` — Generate signing keypair
141
276
 
142
277
  Generates a new Ed25519 keypair for extension signing.