zinkee 0.1.28 → 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.
@@ -52,7 +52,19 @@
52
52
  "Bash(zinkee --json profiles list)",
53
53
  "Bash(zinkee displays *)",
54
54
  "Bash(chmod +x /tmp/audit_search.sh)",
55
- "Bash(/tmp/audit_search.sh)"
55
+ "Bash(/tmp/audit_search.sh)",
56
+ "Bash(head -60 CLAUDE.md)",
57
+ "Bash(head -40 AGENTS.md)",
58
+ "Bash(xargs cat)",
59
+ "Bash(./gradlew :api:test --tests \"com.zinkee.api.service.v2.data.DataV2TranslatorTest\" --tests \"com.zinkee.api.service.v2.data.DataV2ServiceTest\" --tests \"com.zinkee.api.domain.model.v2.data.DataV2PatchRecordRequestTest\")",
60
+ "Bash(./gradlew :api:test --tests \"com.zinkee.api.service.v2.data.DataV2ServiceTest\" --tests \"com.zinkee.api.domain.model.v2.data.DataV2PatchRecordRequestTest\")",
61
+ "Bash(./gradlew :api:spotlessApply)",
62
+ "Bash(./gradlew :api:test :api:spotbugsMain spotlessCheck)",
63
+ "Bash(./gradlew :api:spotbugsMain)",
64
+ "Bash(./gradlew spotlessCheck)",
65
+ "Bash(git --no-pager diff --stat)",
66
+ "Bash(git --no-pager diff -- src/commands/records.ts src/api/records.ts)",
67
+ "Bash(echo \"===EXIT: $?===\")"
56
68
  ]
57
69
  }
58
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",
@@ -10984,40 +10993,14 @@ function buildRecordCreateInput(options) {
10984
10993
  }
10985
10994
  return { values };
10986
10995
  }
10987
- function readRawSetPayload2(raw) {
10988
- const setValue = raw.set;
10989
- if (setValue === void 0) {
10990
- return {};
10991
- }
10992
- if (!isJsonObject6(setValue)) {
10993
- throw new CliError(
10994
- "invalid_cli_usage",
10995
- 'Expected raw update payload field "set" to be a JSON object.'
10996
- );
10997
- }
10998
- return { ...setValue };
10999
- }
11000
- function readRawUnsetPayload2(raw) {
11001
- const unsetValue = raw.unset;
11002
- if (unsetValue === void 0) {
11003
- return [];
11004
- }
11005
- if (!Array.isArray(unsetValue) || !unsetValue.every((value) => typeof value === "string")) {
11006
- throw new CliError(
11007
- "invalid_cli_usage",
11008
- 'Expected raw update payload field "unset" to be an array of strings.'
11009
- );
11010
- }
11011
- return [...unsetValue];
11012
- }
11013
10996
  function buildRecordUpdateInput(options) {
11014
10997
  const raw = readRawObject3(options.raw, options.rawFile);
11015
- const input = { ...raw };
10998
+ const input = {};
11016
10999
  const setPayload = {
11017
- ...readRawSetPayload2(raw),
11000
+ ...raw,
11018
11001
  ...buildAssignmentObject(options.set, options.setJson)
11019
11002
  };
11020
- const unsetPayload = [...readRawUnsetPayload2(raw), ...options.unset ?? []];
11003
+ const unsetPayload = [...options.unset ?? []];
11021
11004
  for (const key of Object.keys(setPayload)) {
11022
11005
  const unsetIndex = unsetPayload.indexOf(key);
11023
11006
  if (unsetIndex !== -1) {
@@ -11145,7 +11128,7 @@ function registerRecordsCommands(program, options = {}) {
11145
11128
  }
11146
11129
  writeLine10(stdout, `Created record "${getRecordIdentifier(data)}".`);
11147
11130
  });
11148
- records.command("update").description("Update a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector8).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector8).option("--set <field=value>", "set a string field", collectKeyValueAssignments, []).option("--set-json <field=json>", "set a structured field", collectJsonAssignments, []).option("--unset <field>", "unset a field", collectStringValues, []).option("--raw <json>", "raw JSON object payload").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, record, commandOptions) {
11131
+ records.command("update").description("Update a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector8).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector8).option("--set <field=value>", "set a string field", collectKeyValueAssignments, []).option("--set-json <field=json>", "set a structured field", collectJsonAssignments, []).option("--unset <field>", "unset a field", collectStringValues, []).option("--raw <json>", "raw JSON object of fields to set").option("--raw-file <path>", "path to a JSON object of fields to set").action(async function action(schema, record, commandOptions) {
11149
11132
  const { api, schemasApi, json, readOnly } = createRecordsApi(this, filePath);
11150
11133
  ensureWritable7("records update", readOnly, "write");
11151
11134
  const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);
@@ -11524,15 +11507,27 @@ function registerSchemasCommands(program, options = {}) {
11524
11507
  }
11525
11508
  writeLine11(stdout, `Created schema "${data.slug ?? commandOptions.slug}".`);
11526
11509
  });
11527
- 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).action(async function action(schema, commandOptions) {
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) {
11528
11515
  const { api, json, readOnly } = createSchemasApi(this, filePath);
11529
11516
  ensureWritable8("schemas update", readOnly, "write");
11530
11517
  const resolvedSchema = await resolveSchemaSelector2(api, schema);
11531
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
+ }
11532
11527
  if (isEmptyObject6(input)) {
11533
11528
  throw new CliError(
11534
11529
  "invalid_cli_usage",
11535
- 'Provide at least one schema field to update via "--name", "--slug", "--auditable", or "--commentable".'
11530
+ 'Provide at least one schema field to update via "--name", "--slug", "--auditable", "--commentable", or "--highlighted-field".'
11536
11531
  );
11537
11532
  }
11538
11533
  const data = await api.updateSchema(resolvedSchema, input);