zinkee 0.1.29 → 0.1.30
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/.claude/settings.local.json +2 -1
- package/AGENTS.md +13 -0
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/schemas.ts +2 -0
- package/src/commands/schemas.test.ts +80 -0
- package/src/commands/schemas.ts +16 -1
- package/src/utils/examples.ts +10 -0
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"Bash(./gradlew :api:spotbugsMain)",
|
|
64
64
|
"Bash(./gradlew spotlessCheck)",
|
|
65
65
|
"Bash(git --no-pager diff --stat)",
|
|
66
|
-
"Bash(git --no-pager diff -- src/commands/records.ts src/api/records.ts)"
|
|
66
|
+
"Bash(git --no-pager diff -- src/commands/records.ts src/api/records.ts)",
|
|
67
|
+
"Bash(echo \"===EXIT: $?===\")"
|
|
67
68
|
]
|
|
68
69
|
}
|
|
69
70
|
}
|
package/AGENTS.md
CHANGED
|
@@ -48,6 +48,19 @@ Use this order when reasoning about behavior:
|
|
|
48
48
|
- parsers live in `src/parsers`
|
|
49
49
|
- shell completion (engine, scripts, install, runtime) lives in `src/completion`
|
|
50
50
|
|
|
51
|
+
## API Examples (`--example`)
|
|
52
|
+
|
|
53
|
+
- `--example` output comes 100% from hand-written `src/utils/examples.ts`
|
|
54
|
+
(`specificExamples`, keyed by command path e.g. `"schemas update"`). No
|
|
55
|
+
codegen, no OpenAPI import.
|
|
56
|
+
- These MIRROR the swagger `@ExampleObject`s in the `z2-backend` repo
|
|
57
|
+
(`api/src/main/java/com/zinkee/api/infra/web/v2/ApiV2<Resource>Documentation.java`).
|
|
58
|
+
When you add/change an example on either side, update the other with the same
|
|
59
|
+
payload (request `raw` and `response`). Nothing keeps them in sync
|
|
60
|
+
automatically.
|
|
61
|
+
- Keep `response` shapes aligned with the backend DTO field order (e.g.
|
|
62
|
+
`SchemaV2ResourceResponse`: `… commentable, highlightedField, fields`).
|
|
63
|
+
|
|
51
64
|
## Testing
|
|
52
65
|
|
|
53
66
|
Prefer focused command tests and parser/client unit tests.
|
package/dist/index.js
CHANGED
|
@@ -2402,6 +2402,7 @@ var specificExamples = {
|
|
|
2402
2402
|
},
|
|
2403
2403
|
"auditable": true,
|
|
2404
2404
|
"commentable": true,
|
|
2405
|
+
"highlightedField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
2405
2406
|
"fields": [
|
|
2406
2407
|
{
|
|
2407
2408
|
"id": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
@@ -2432,6 +2433,13 @@ var specificExamples = {
|
|
|
2432
2433
|
command: "zinkee --json schemas update contacts --auditable true",
|
|
2433
2434
|
raw: `{
|
|
2434
2435
|
"auditable": true
|
|
2436
|
+
}`
|
|
2437
|
+
},
|
|
2438
|
+
{
|
|
2439
|
+
description: "Set the highlighted (main) field of a schema.",
|
|
2440
|
+
command: "zinkee --json schemas update contacts --highlighted-field contact-name",
|
|
2441
|
+
raw: `{
|
|
2442
|
+
"highlightedField": "c60b8526-5835-4c9f-aecd-9a16c7704a34"
|
|
2435
2443
|
}`
|
|
2436
2444
|
}
|
|
2437
2445
|
]),
|
|
@@ -3973,6 +3981,7 @@ var specificExamples = {
|
|
|
3973
3981
|
},
|
|
3974
3982
|
"auditable": true,
|
|
3975
3983
|
"commentable": true,
|
|
3984
|
+
"highlightedField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
3976
3985
|
"fields": [
|
|
3977
3986
|
{
|
|
3978
3987
|
"id": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
@@ -11498,15 +11507,27 @@ function registerSchemasCommands(program, options = {}) {
|
|
|
11498
11507
|
}
|
|
11499
11508
|
writeLine11(stdout, `Created schema "${data.slug ?? commandOptions.slug}".`);
|
|
11500
11509
|
});
|
|
11501
|
-
schemas.command("update").description("Update a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector9).option("--name <name>", "schema name").option("--slug <slug>", "schema slug").option("--auditable <bool>", "auditable flag", parseBooleanFlag).option("--commentable <bool>", "commentable flag", parseBooleanFlag).
|
|
11510
|
+
schemas.command("update").description("Update a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector9).option("--name <name>", "schema name").option("--slug <slug>", "schema slug").option("--auditable <bool>", "auditable flag", parseBooleanFlag).option("--commentable <bool>", "commentable flag", parseBooleanFlag).option(
|
|
11511
|
+
"--highlighted-field <field>",
|
|
11512
|
+
"highlighted (main) field uuid or slug",
|
|
11513
|
+
parseUuidOrSlugSelector9
|
|
11514
|
+
).action(async function action(schema, commandOptions) {
|
|
11502
11515
|
const { api, json, readOnly } = createSchemasApi(this, filePath);
|
|
11503
11516
|
ensureWritable8("schemas update", readOnly, "write");
|
|
11504
11517
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
11505
11518
|
const input = buildSchemaUpdateInput(commandOptions);
|
|
11519
|
+
if (commandOptions.highlightedField !== void 0) {
|
|
11520
|
+
const resolvedField = await resolveFieldSelector(
|
|
11521
|
+
api,
|
|
11522
|
+
resolvedSchema,
|
|
11523
|
+
commandOptions.highlightedField
|
|
11524
|
+
);
|
|
11525
|
+
input.highlightedField = resolvedField.value;
|
|
11526
|
+
}
|
|
11506
11527
|
if (isEmptyObject6(input)) {
|
|
11507
11528
|
throw new CliError(
|
|
11508
11529
|
"invalid_cli_usage",
|
|
11509
|
-
'Provide at least one schema field to update via "--name", "--slug", "--auditable", or "--
|
|
11530
|
+
'Provide at least one schema field to update via "--name", "--slug", "--auditable", "--commentable", or "--highlighted-field".'
|
|
11510
11531
|
);
|
|
11511
11532
|
}
|
|
11512
11533
|
const data = await api.updateSchema(resolvedSchema, input);
|