@hygraph/cli 0.0.20 → 0.0.21
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 +18 -0
- package/README.md +51 -0
- package/dist/cli.js +4125 -3803
- package/dist/define2.js +5 -1
- package/dist/version.js +1 -1
- package/package.json +3 -1
- package/skills/.gitkeep +0 -0
- package/skills/hygraph-modeling/SKILL.md +148 -0
- package/skills/pull-drift/SKILL.md +90 -0
- package/skills/split-config/SKILL.md +115 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @hygraph/cli
|
|
2
2
|
|
|
3
|
+
## 0.0.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
- 292eda4: `hygraph feedback` sends your feedback to the Hygraph team, with an optional email for a reply.
|
|
9
|
+
- 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.
|
|
10
|
+
- 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.
|
|
11
|
+
- 50ff892: `plan` and `apply` show the `apiIdPlural`, `displayName` and `description` of a model or component they create. Before, they showed only the apiId.
|
|
12
|
+
- 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.
|
|
13
|
+
- 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.
|
|
14
|
+
- 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`.
|
|
15
|
+
- 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`.
|
|
16
|
+
- 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.
|
|
17
|
+
- 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.
|
|
18
|
+
- 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.
|
|
19
|
+
- fd49bd2: `whoami` takes the config path as its first argument, like `plan`, `apply` and `pull`: `hygraph whoami brands/kaffa.ts`. `--config <file>` still works.
|
|
20
|
+
|
|
3
21
|
## 0.0.20
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -145,6 +145,14 @@ See what would change:
|
|
|
145
145
|
npx hygraph plan
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
+
A create shows the settings your config sets. To also see the settings it
|
|
149
|
+
leaves at their default, and those it does not set, pass `--full` to `plan` or
|
|
150
|
+
`apply`:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npx hygraph plan --full
|
|
154
|
+
```
|
|
155
|
+
|
|
148
156
|
Apply it:
|
|
149
157
|
|
|
150
158
|
```bash
|
|
@@ -208,6 +216,11 @@ Then bring the changes into the config in one of two ways:
|
|
|
208
216
|
- **Export again.** `npx hygraph export --out hygraph.config.ts` replaces the
|
|
209
217
|
config with the live schema. Your own edits to the file are lost.
|
|
210
218
|
|
|
219
|
+
To stop Studio edits, lock the environment in Studio: Project Settings → Schema
|
|
220
|
+
lock. While it is not locked, `pull` ends with a hint that says so.
|
|
221
|
+
`apply` shows the hint too, but only for a target that it applied or that had no
|
|
222
|
+
changes.
|
|
223
|
+
|
|
211
224
|
## What's supported
|
|
212
225
|
|
|
213
226
|
- **Schema:** models, components, enumerations, taxonomies, locales and
|
|
@@ -231,10 +244,43 @@ hygraph whoami show which project and environment the token reaches
|
|
|
231
244
|
hygraph plan show what would change against the environment
|
|
232
245
|
hygraph apply apply the plan as one migration
|
|
233
246
|
hygraph pull show what changed live, as a diff against the config
|
|
247
|
+
hygraph feedback send feedback to the Hygraph team
|
|
234
248
|
```
|
|
235
249
|
|
|
250
|
+
`plan`, `apply`, `pull` and `whoami` read `hygraph.config.ts`. To read
|
|
251
|
+
another config, give its path as the first argument, such as
|
|
252
|
+
`npx hygraph plan brands/kaffa.ts`.
|
|
253
|
+
|
|
236
254
|
Run `npx hygraph <command> --help` for every option.
|
|
237
255
|
|
|
256
|
+
## Use the CLI with a coding agent
|
|
257
|
+
|
|
258
|
+
The package ships agent skills in its `skills/` folder. A skill is a folder
|
|
259
|
+
with a `SKILL.md` file that tells a coding agent how to do a task with the
|
|
260
|
+
CLI.
|
|
261
|
+
|
|
262
|
+
To link the skills into your project, run the `experimental_sync` command of
|
|
263
|
+
the [`skills`](https://github.com/vercel-labs/skills) CLI. The command is
|
|
264
|
+
experimental.
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
npx skills experimental_sync
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
It finds the skills in `node_modules`, links each one into the skills folder
|
|
271
|
+
of your agents and writes `skills-lock.json`. The links point into
|
|
272
|
+
`node_modules`, so a skill changes when you update the CLI.
|
|
273
|
+
|
|
274
|
+
Or copy a skill into the folder that your agent reads, for example
|
|
275
|
+
`.claude/skills/` for Claude Code:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
cp -r node_modules/@hygraph/cli/skills/<name> .claude/skills/
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
A copy does not change when you update the CLI. Copy it again after an
|
|
282
|
+
update.
|
|
283
|
+
|
|
238
284
|
## Telemetry
|
|
239
285
|
|
|
240
286
|
The CLI reports errors and usage to Hygraph, so that we can fix bugs and
|
|
@@ -258,6 +304,11 @@ see which commands people use. It tells you so the first time it runs.
|
|
|
258
304
|
|
|
259
305
|
To turn it off, set `HYGRAPH_TELEMETRY=0` or `DO_NOT_TRACK=1`.
|
|
260
306
|
|
|
307
|
+
## Feedback
|
|
308
|
+
|
|
309
|
+
`hygraph feedback "..."` sends your feedback to the Hygraph team.
|
|
310
|
+
Without a message, it asks for one. Add `--email` if you want a reply.
|
|
311
|
+
|
|
261
312
|
## License
|
|
262
313
|
|
|
263
314
|
MIT
|