@hygraph/cli 0.0.20 → 0.1.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @hygraph/cli
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5c0f7b1: The CLI is now in beta. **Generate CLI PAT** in Studio is on for every project, and the Setup section of the README names it as the first way to create the token.
8
+
9
+ ## 0.0.21
10
+
11
+ ### Patch Changes
12
+
13
+ - 938c66a: Ctrl+C or Ctrl+D at the `hygraph apply` confirmation cancels the apply like a no, and is no longer reported as an error.
14
+ - 292eda4: `hygraph feedback` sends your feedback to the Hygraph team, with an optional email for a reply.
15
+ - 168d344: `plan` moves fields only when their order differs from the config. Before, a plan after an export, or after an apply that deleted a relation or a model, listed position changes for fields already in order.
16
+ - d521c81: The package has a `hygraph-modeling` skill for coding agents. It advises on models and fields, components and references, enumerations and taxonomies, apiId names, locales, variants and stages, and on changes that delete content, with a safe way to make each one.
17
+ - 50ff892: `plan` and `apply` show the `apiIdPlural`, `displayName` and `description` of a model or component they create. Before, they showed only the apiId.
18
+ - 25de0f7: `plan` lists a model's or component's fields in the order of your config. Fields `plan` deletes follow their order in the project. Before, fields were listed alphabetically.
19
+ - 50ff892: `plan --full` and `apply --full` show every setting of what they create. Without `--full`, a create leaves out settings at their default, such as `required: false` on a field, and settings that are not set.
20
+ - 50ff892: `plan` and `apply` name a created field by the builder your config uses, such as `markdown` or `slug`, followed by the type Hygraph stores for a simple field, such as `markdown (STRING)`. When a text field's editor changes, they name the editors the same way. Before, every text field showed as `string`, and an editor change showed Hygraph's ids, such as `GCMS_SINGLE_LINE`.
21
+ - 5d2f5d3: The package includes the agent skill `skills/pull-drift/SKILL.md`. A coding agent that follows it edits your config to match the changes `pull` reports, keeps the layout of your files, and checks the result with `plan`.
22
+ - 0c99006: `pull` and `apply` tell you when Studio can still edit the schema of the target environment, and how to lock it in Studio (Project Settings → Schema lock). A locked schema keeps Studio edits from making live differ from your config. The hint does not change the exit code.
23
+ - 87a2aa9: `plan`, `apply` and `pull` now report a config that is not in the expected form like other config errors, such as an invalid apiId: one block per error. `apply --plan` does the same for a plan file, and so does every command that reads the live schema, for a part of it that is not in the expected form. A config error names a model by its apiId, such as `apply.models.Author.__typename`. A model without a valid apiId, or with the same apiId as another model, keeps its position in the list.
24
+ - d90f206: The package includes an agent skill, `skills/split-config`. It shows a coding agent how to split `hygraph.config.ts` into one file per model, component, enumeration, taxonomy and remote source, and check with `plan` that the schema did not change.
25
+ - fd49bd2: `whoami` takes the config path as its first argument, like `plan`, `apply` and `pull`: `hygraph whoami brands/kaffa.ts`. `--config <file>` still works.
26
+
3
27
  ## 0.0.20
4
28
 
5
29
  ### Patch Changes
package/README.md CHANGED
@@ -6,7 +6,7 @@ Manage your Hygraph schema as code. Describe the schema in TypeScript, review
6
6
  what would change, and apply it as one migration.
7
7
 
8
8
  > [!WARNING]
9
- > The CLI is in **alpha** and under active development. Not every field type
9
+ > The CLI is in **beta** and under active development. Not every field type
10
10
  > and platform capability is supported yet, and commands and the config
11
11
  > format can still change between releases.
12
12
  >
@@ -28,12 +28,11 @@ npm i -D @hygraph/cli
28
28
  The CLI needs a permanent auth token from your project's settings in Studio:
29
29
 
30
30
  - a **permanent auth token** **(PAT)**
31
- - Create one in **Project Settings > Permanent Auth Tokens > Add token**
32
- - Then enable all management permissions for it
33
- - Or use **Generate CLI PAT** on the same page. It creates a token with the
34
- management permissions the CLI needs and no content access. The button
35
- is not on for every project yet. Ask Hygraph support to turn it on for
36
- your project.
31
+ - Create one in **Project Settings > Permanent Auth Tokens** with
32
+ **Generate CLI PAT**. It creates a token with the management permissions
33
+ the CLI needs and no content access.
34
+ - Or use **Add token** on the same page, and then enable all management
35
+ permissions for it.
37
36
  - Put the token in the `HYGRAPH_TOKEN` environment variable. The config
38
37
  reads it from there, so the token never ends up in a file you commit.
39
38
 
@@ -145,6 +144,14 @@ See what would change:
145
144
  npx hygraph plan
146
145
  ```
147
146
 
147
+ A create shows the settings your config sets. To also see the settings it
148
+ leaves at their default, and those it does not set, pass `--full` to `plan` or
149
+ `apply`:
150
+
151
+ ```bash
152
+ npx hygraph plan --full
153
+ ```
154
+
148
155
  Apply it:
149
156
 
150
157
  ```bash
@@ -208,6 +215,11 @@ Then bring the changes into the config in one of two ways:
208
215
  - **Export again.** `npx hygraph export --out hygraph.config.ts` replaces the
209
216
  config with the live schema. Your own edits to the file are lost.
210
217
 
218
+ To stop Studio edits, lock the environment in Studio: Project Settings → Schema
219
+ lock. While it is not locked, `pull` ends with a hint that says so.
220
+ `apply` shows the hint too, but only for a target that it applied or that had no
221
+ changes.
222
+
211
223
  ## What's supported
212
224
 
213
225
  - **Schema:** models, components, enumerations, taxonomies, locales and
@@ -231,10 +243,43 @@ hygraph whoami show which project and environment the token reaches
231
243
  hygraph plan show what would change against the environment
232
244
  hygraph apply apply the plan as one migration
233
245
  hygraph pull show what changed live, as a diff against the config
246
+ hygraph feedback send feedback to the Hygraph team
234
247
  ```
235
248
 
249
+ `plan`, `apply`, `pull` and `whoami` read `hygraph.config.ts`. To read
250
+ another config, give its path as the first argument, such as
251
+ `npx hygraph plan brands/kaffa.ts`.
252
+
236
253
  Run `npx hygraph <command> --help` for every option.
237
254
 
255
+ ## Use the CLI with a coding agent
256
+
257
+ The package ships agent skills in its `skills/` folder. A skill is a folder
258
+ with a `SKILL.md` file that tells a coding agent how to do a task with the
259
+ CLI.
260
+
261
+ To link the skills into your project, run the `experimental_sync` command of
262
+ the [`skills`](https://github.com/vercel-labs/skills) CLI. The command is
263
+ experimental.
264
+
265
+ ```bash
266
+ npx skills experimental_sync
267
+ ```
268
+
269
+ It finds the skills in `node_modules`, links each one into the skills folder
270
+ of your agents and writes `skills-lock.json`. The links point into
271
+ `node_modules`, so a skill changes when you update the CLI.
272
+
273
+ Or copy a skill into the folder that your agent reads, for example
274
+ `.claude/skills/` for Claude Code:
275
+
276
+ ```bash
277
+ cp -r node_modules/@hygraph/cli/skills/<name> .claude/skills/
278
+ ```
279
+
280
+ A copy does not change when you update the CLI. Copy it again after an
281
+ update.
282
+
238
283
  ## Telemetry
239
284
 
240
285
  The CLI reports errors and usage to Hygraph, so that we can fix bugs and
@@ -258,6 +303,11 @@ see which commands people use. It tells you so the first time it runs.
258
303
 
259
304
  To turn it off, set `HYGRAPH_TELEMETRY=0` or `DO_NOT_TRACK=1`.
260
305
 
306
+ ## Feedback
307
+
308
+ `hygraph feedback "..."` sends your feedback to the Hygraph team.
309
+ Without a message, it asks for one. Add `--email` if you want a reply.
310
+
261
311
  ## License
262
312
 
263
313
  MIT