@tenonhq/dovetail-servicenow 0.0.53 → 0.0.54

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/README.md CHANGED
@@ -675,6 +675,40 @@ adds diagnostics (app-switch status, resolved column key, assigned sys_id) to th
675
675
  result note. Ground truth (the HAR dissection) lives in the CTO repo's create-table
676
676
  docs.
677
677
 
678
+ ### Dictionary attributes (`sys_dictionary.attributes`) and the reference-column rule
679
+
680
+ **Team rule (2026-10-08): every reference column carries `readonly_clickthrough=true`.**
681
+ `add-column` and `create-table` apply it by default to every `reference` column; any
682
+ other attributes you need ride alongside it.
683
+
684
+ ```bash
685
+ # default — the column is created with readonly_clickthrough=true, verified on read-back
686
+ npx dove-sn add-column --table x_cadso_journey --label Owner --type reference --reference sys_user --update-set <sys_id>
687
+ # more attributes (merged with the default) / opt out of the default
688
+ npx dove-sn add-column ... --attributes "ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name;email"
689
+ npx dove-sn add-column ... --no-readonly-clickthrough
690
+ # fix an EXISTING column — MERGED into its current attributes, never overwriting them
691
+ npx dove-sn set-column --table x_cadso_automate_email_batch --column x_cadso_journey_instance_step \
692
+ --attributes readonly_clickthrough=true --update-set <sys_id>
693
+ # read-only audit: which reference columns lack it
694
+ npx dove-sn reference-attr-audit --scope-prefix x_cadso_ --json
695
+ ```
696
+
697
+ - **Format.** `--attributes` (MCP `attributes`) is `"k=v,k2=v2"` or, in JSON/MCP, a
698
+ `{ key: value }` map. Keys are identifiers; a value may not contain `,` (the separator).
699
+ - **Merge, never clobber.** `set-column` sets the named keys and keeps every other
700
+ attribute the column carries. A column that already has them reports `unchanged`.
701
+ - **Verified.** add-column reads `attributes` back; if the insert dropped a key it patches
702
+ once (as a merge) and re-reads — still missing is `failed` (exit 2). create-table reads
703
+ every column with attributes back after the form save (`columnAttributes` on the
704
+ result) and merge-patches into `--update-set` the same way. set-column verifies each
705
+ requested key order-insensitively.
706
+ - **Opt-out / override.** `--no-readonly-clickthrough` (create-table: table-wide;
707
+ per column `readonly_clickthrough: false` in `--from-json`), or set
708
+ `readonly_clickthrough=false` in `attributes` — the caller's value wins.
709
+ - **Inherited columns** are refused by `set-column --attributes` for now (a per-child
710
+ `sys_dictionary_override` for attributes has not been verified live).
711
+
678
712
  ### Add a unique index
679
713
 
680
714
  Create a **single-column UNIQUE index** on an existing table, then read it back.
@@ -1261,7 +1295,9 @@ record — dry-run by default, `confirm:true` to apply, `updateSetSysId` require
1261
1295
  record read back before AND after so success is only reported once it is confirmed
1262
1296
  gone) — all read-back-verified; `set_field` / `create_record` are captured in the
1263
1297
  update set you pass, while `delete_record` pins the set as current and reads the DELETE
1264
- capture back (`captureState`) until [#297](https://github.com/TenonHQ/Dovetail/issues/297) ships — `host_assets` (deploy a built
1298
+ capture back (`captureState`) until [#297](https://github.com/TenonHQ/Dovetail/issues/297) ships — `reference_attr_audit` (read-only: reference columns under a table-name prefix
1299
+ missing `readonly_clickthrough=true`; `add_column` / `create_table` columns and
1300
+ `set_column` also take `attributes` — see "Dictionary attributes"), `host_assets` (deploy a built
1265
1301
  dist/), plus the Flow Designer
1266
1302
  tools `flow_view` (read a flow/subflow's step graph), `action_view` (read an action
1267
1303
  type's model), `action_edit` (structurally edit a published action type — per-step
package/dist/cli.js CHANGED
@@ -1268,7 +1268,9 @@ function parseColumnsInline(input) {
1268
1268
  * --columns "Key:string:255, Severity:choice:50, Occurence Count:integer:5"
1269
1269
  * [--extends sys_metadata] [--number-prefix ERR] [--user-role x_cadso_core.user]
1270
1270
  * [--no-acls] [--no-menu] [--update-set <sys_id>] [--save-action <sys_id>]
1271
- * [--from-json <spec.json>] [--dry-run] [--json]
1271
+ * [--no-readonly-clickthrough] [--from-json <spec.json>] [--dry-run] [--json]
1272
+ * Reference columns carry readonly_clickthrough=true by default; per-column
1273
+ * `attributes` / `readonly_clickthrough` ride on the --from-json column specs.
1272
1274
  */
1273
1275
  async function runCreateTable(flags) {
1274
1276
  var spec = {};
@@ -1285,6 +1287,16 @@ async function runCreateTable(flags) {
1285
1287
  process.stderr.write("create-table: --name, --label, --scope and --columns (or --from-json) are required\n");
1286
1288
  return 1;
1287
1289
  }
1290
+ // Table-wide opt-out of the reference default; a column that says otherwise wins.
1291
+ if (flags["no-readonly-clickthrough"] === "true") {
1292
+ columns = columns.map(function (c) {
1293
+ if (c.readonly_clickthrough !== undefined)
1294
+ return c;
1295
+ var copy = Object.assign({}, c);
1296
+ copy.readonly_clickthrough = false;
1297
+ return copy;
1298
+ });
1299
+ }
1288
1300
  var params = {
1289
1301
  client: (0, client_1.createClient)({}),
1290
1302
  name: name,
@@ -1394,6 +1406,7 @@ async function runDesignAccess(flags) {
1394
1406
  * --table x_cadso_journey --label URL --type url
1395
1407
  * [--name url] [--max-length 1024] [--reference <table>]
1396
1408
  * [--mandatory] [--default <value>] [--dependent-on-field <element>]
1409
+ * [--attributes "k=v,k2=v2"] [--no-readonly-clickthrough]
1397
1410
  * [--scope x_cadso_journey] [--cross-scope] [--ensure-design-access]
1398
1411
  * [--update-set <sys_id>] [--from-json <spec.json>] [--dry-run] [--debug] [--json]
1399
1412
  * --update-set is required unless --dry-run. --cross-scope opts in to a column
@@ -1423,6 +1436,17 @@ async function runAddColumn(flags) {
1423
1436
  column.dependent_on_field = flags["dependent-on-field"];
1424
1437
  }
1425
1438
  }
1439
+ // Apply to a --from-json column too, so the flags never silently do nothing.
1440
+ if (column && flags.attributes !== undefined) {
1441
+ if (flags.attributes === "true" || !flags.attributes.trim()) {
1442
+ process.stderr.write('add-column: --attributes needs a value, e.g. --attributes "readonly_clickthrough=true"\n');
1443
+ return 1;
1444
+ }
1445
+ column.attributes = flags.attributes;
1446
+ }
1447
+ if (column && flags["no-readonly-clickthrough"] === "true") {
1448
+ column.readonly_clickthrough = false;
1449
+ }
1426
1450
  if (!table || !column || !column.label) {
1427
1451
  process.stderr.write("add-column: --table and --label (with --type) are required (or --from-json)\n");
1428
1452
  return 1;
@@ -1554,6 +1578,56 @@ async function runAddIndex(flags) {
1554
1578
  return 2;
1555
1579
  return 0;
1556
1580
  }
1581
+ /**
1582
+ * dove-sn reference-attr-audit:
1583
+ * --scope-prefix x_cadso_ [--attribute "readonly_clickthrough=true"] [--json]
1584
+ *
1585
+ * Read-only. Lists active reference columns under the prefix whose
1586
+ * sys_dictionary.attributes lack the attribute (team rule: readonly_clickthrough=true).
1587
+ * Backfilling is a separate decision — set-column --attributes per column.
1588
+ *
1589
+ * Exit codes: 0 read (findings are a report, not a failure), 1 bad args.
1590
+ */
1591
+ async function runReferenceAttrAudit(flags) {
1592
+ var prefix = flags["scope-prefix"];
1593
+ if (!prefix || prefix === "true") {
1594
+ process.stderr.write("reference-attr-audit: --scope-prefix <prefix> is required (e.g. x_cadso_)\n");
1595
+ return 1;
1596
+ }
1597
+ if (flags.attribute === "true") {
1598
+ process.stderr.write('reference-attr-audit: --attribute needs a value, e.g. "readonly_clickthrough=true"\n');
1599
+ return 1;
1600
+ }
1601
+ var result;
1602
+ try {
1603
+ result = await (0, table_1.referenceAttrAudit)({
1604
+ client: (0, client_1.createClient)({}),
1605
+ scopePrefix: prefix,
1606
+ attribute: flags.attribute,
1607
+ });
1608
+ }
1609
+ catch (e) {
1610
+ var msg = e instanceof Error ? e.message : String(e);
1611
+ if (/^reference-attr-audit:/.test(msg)) {
1612
+ process.stderr.write(msg + "\n");
1613
+ return 1;
1614
+ }
1615
+ throw e;
1616
+ }
1617
+ if (flags.json === "true") {
1618
+ process.stdout.write(JSON.stringify(result, null, 2) + "\n");
1619
+ return 0;
1620
+ }
1621
+ process.stdout.write(result.scopePrefix + "* — " + result.total + " reference column(s), " +
1622
+ result.missing.length + " missing '" + result.attribute + "'" +
1623
+ (result.truncated ? " (SCAN TRUNCATED — results incomplete)" : "") + "\n");
1624
+ for (var i = 0; i < result.missing.length; i += 1) {
1625
+ var m = result.missing[i];
1626
+ process.stdout.write(" " + m.table + "." + m.element + " -> " + (m.reference || "(no target)") +
1627
+ " [" + (m.attributes || "no attributes") + "]\n");
1628
+ }
1629
+ return 0;
1630
+ }
1557
1631
  /**
1558
1632
  * dove-sn index-list:
1559
1633
  * --table x_cadso_automate_message_batch_recipient [--json]
@@ -1714,6 +1788,7 @@ function parseBoolFlag(name, raw, verb = "set-column") {
1714
1788
  * --table x_cadso_journey --column description --update-set <sys_id>
1715
1789
  * [--label "Description"] [--mandatory true|false] [--default <v>]
1716
1790
  * [--read-only true|false] [--max-length 4000] [--dependent-on-field <element>]
1791
+ * [--attributes "k=v,k2=v2"] (MERGED into the column's existing attributes)
1717
1792
  * [--dry-run] [--json]
1718
1793
  *
1719
1794
  * Updates an EXISTING column's schema. `internal_type` and a rename are refused —
@@ -1755,6 +1830,9 @@ async function runSetColumn(flags, bare) {
1755
1830
  if (flags["dependent-on-field"] !== undefined) {
1756
1831
  attributes.dependentOnField = flags["dependent-on-field"].trim();
1757
1832
  }
1833
+ // A bare --attributes is refused above (stringFlags); the value is validated in setColumn.
1834
+ if (flags.attributes !== undefined)
1835
+ attributes.attributes = flags.attributes;
1758
1836
  if (flags["max-length"] !== undefined) {
1759
1837
  var len = Number(flags["max-length"]);
1760
1838
  // sys_dictionary.max_length is an integer; the MCP schema enforces int() too.
@@ -2770,6 +2848,9 @@ async function dispatch(parsed) {
2770
2848
  if (parsed.command === "add-index") {
2771
2849
  return await runAddIndex(parsed.flags);
2772
2850
  }
2851
+ if (parsed.command === "reference-attr-audit") {
2852
+ return await runReferenceAttrAudit(parsed.flags);
2853
+ }
2773
2854
  if (parsed.command === "index-list") {
2774
2855
  return await runIndexList(parsed.flags);
2775
2856
  }
package/dist/cliUsage.js CHANGED
@@ -167,6 +167,10 @@ exports.VERB_USAGE = {
167
167
  { flag: "user-role", value: "<role>", note: "Role that may read the table." },
168
168
  { flag: "no-acls", note: "Skip the default access controls." },
169
169
  { flag: "no-menu", note: "Skip the application-menu module." },
170
+ {
171
+ flag: "no-readonly-clickthrough",
172
+ note: "Opt every reference column out of the readonly_clickthrough=true default (per column: readonly_clickthrough:false / attributes in --from-json).",
173
+ },
170
174
  UPDATE_SET_FLAG,
171
175
  { flag: "save-action", value: "<sys_id>", note: "Advanced: override the Studio save UI action." },
172
176
  { flag: "columns-rel-id", value: "<sys_id>", note: "Advanced: override the Studio columns relationship id." },
@@ -176,7 +180,10 @@ exports.VERB_USAGE = {
176
180
  ],
177
181
  gate: "dry-run-flag",
178
182
  example: 'dove-sn create-table --name x_cadso_core_error --label Error --scope x_cadso_core --columns "Key:string:255, Severity:choice:50" --update-set <sys_id> --dry-run',
179
- notes: ["Exit 2 when the platform reports the save failed."],
183
+ notes: [
184
+ "Reference columns get sys_dictionary.attributes readonly_clickthrough=true by default; every column with attributes is read back after the save and merge-patched once into --update-set if they did not land.",
185
+ "Exit 2 when the platform reports the save failed, or a column's attributes could not be verified.",
186
+ ],
180
187
  },
181
188
  "add-column": {
182
189
  summary: "Add ONE column to an EXISTING table via a scope-aware sys_dictionary insert, then verify",
@@ -200,6 +207,15 @@ exports.VERB_USAGE = {
200
207
  value: "<element>",
201
208
  note: "Sibling column a document_id resolves against (its table_name column); must already exist.",
202
209
  },
210
+ {
211
+ flag: "attributes",
212
+ value: '"k=v,k2=v2"',
213
+ note: "sys_dictionary.attributes to set; verified on read-back. Reference columns also get readonly_clickthrough=true unless you set it yourself.",
214
+ },
215
+ {
216
+ flag: "no-readonly-clickthrough",
217
+ note: "Opt a reference column out of the readonly_clickthrough=true default.",
218
+ },
203
219
  {
204
220
  flag: "scope",
205
221
  value: "<x_scope>",
@@ -222,7 +238,7 @@ exports.VERB_USAGE = {
222
238
  gateNote: "--update-set is required unless --dry-run.",
223
239
  example: "dove-sn add-column --table x_cadso_journey --label URL --type url --max-length 1024 --update-set <sys_id>",
224
240
  notes: [
225
- "Exit 2 when the write landed but the read-back does not show the column.",
241
+ "Exit 2 when the write landed but the read-back does not show the column (or its requested attributes).",
226
242
  "Cross-scope: dove-sn add-column --table x_cadso_automate_email_batch --label 'Instance Step' --name instance_step --type reference --reference x_cadso_journey_instance_step --scope x_cadso_journey --cross-scope --update-set <journey set>",
227
243
  ],
228
244
  },
@@ -247,7 +263,7 @@ exports.VERB_USAGE = {
247
263
  ],
248
264
  },
249
265
  "set-column": {
250
- summary: "Update an EXISTING column's schema (label/mandatory/default/read-only/max-length/dependent-on-field), then verify",
266
+ summary: "Update an EXISTING column's schema (label/mandatory/default/read-only/max-length/dependent-on-field/attributes), then verify",
251
267
  required: [
252
268
  { flag: "table", value: "<name>" },
253
269
  { flag: "column", value: "<element>" },
@@ -260,6 +276,11 @@ exports.VERB_USAGE = {
260
276
  { flag: "read-only", value: "<true|false>" },
261
277
  { flag: "max-length", value: "<n>", note: "Positive integer. A SHRINK is refused while rows hold longer values." },
262
278
  { flag: "dependent-on-field", value: "<element>", note: "Empty string clears the dependency." },
279
+ {
280
+ flag: "attributes",
281
+ value: '"k=v,k2=v2"',
282
+ note: "MERGED into the column's existing sys_dictionary.attributes — keys you don't name are kept. Refused on an inherited column.",
283
+ },
263
284
  DRY_RUN_FLAG,
264
285
  JSON_FLAG,
265
286
  ],
@@ -278,6 +299,7 @@ exports.VERB_USAGE = {
278
299
  "update-set",
279
300
  "updateSetSysId",
280
301
  "dependent-on-field",
302
+ "attributes",
281
303
  ],
282
304
  },
283
305
  "set-table": {
@@ -321,6 +343,17 @@ exports.VERB_USAGE = {
321
343
  "Exit 2 when the dictionary flag is set but no index was read back.",
322
344
  ],
323
345
  },
346
+ "reference-attr-audit": {
347
+ summary: "List reference columns whose sys_dictionary.attributes lack readonly_clickthrough=true (or --attribute)",
348
+ required: [{ flag: "scope-prefix", value: "<prefix>", note: "Table-name prefix, e.g. x_cadso_." }],
349
+ optional: [
350
+ { flag: "attribute", value: '"k=v"', note: "Attribute(s) to require. Default readonly_clickthrough=true." },
351
+ JSON_FLAG,
352
+ ],
353
+ gate: "read-only",
354
+ example: "dove-sn reference-attr-audit --scope-prefix x_cadso_ --json",
355
+ notes: ["Report only — backfill with set-column --attributes per column, into an update set."],
356
+ },
324
357
  "index-list": {
325
358
  summary: "List a table's DATABASE indexes from the v_db_index view",
326
359
  required: [{ flag: "table", value: "<name>" }],
package/dist/index.d.ts CHANGED
@@ -21,8 +21,8 @@ export { sincPlugin } from "./plugin";
21
21
  export { listTemplates, verifyArtifact, cloneSubflow, cloneActionType, resolveScope, slugInternalName, fetchActionSteps, findStepInput, triggerPublication, publishActionType, editActionType, defineActionType, planActionDefinition, validateDefineSpec, applyStepOps, verifySteps, summarizeSteps, formatStepPill, readFlow, readActionType, publishFlow, copyFlow, createFlow, buildPublishModel, editFlow, testFlow, DEFAULT_RUN_FLOW_PATH, LEGACY_RUN_FLOW_PATH, generateSysId, topoSort, executeWritePlan, WriteOrderError, } from "./flowDesigner";
22
22
  export type { TemplateRef, ListTemplatesParams, FlowKind, VerifyExpect, VerifyFound, VerifyFailure, VerifyReport, VerifyArtifactParams, CloneSubflowParams, CloneSubflowResult, CloneActionTypeParams, CloneActionTypeResult, CloneActionTypePlan, CloneActionTypeStepReport, TriggerPublicationParams, TriggerPublicationResult, PublishActionTypeParams, PublishActionTypeResult, EditActionTypeParams, EditActionTypeResult, EditActionTypeOps, DefineActionSpec, DefineActionInputSpec, DefineActionOutputSpec, DefineStepSpec, DefineStepVarSpec, DefineStepOutputSpec, DefineStepValue, DefineActionTypeParams, DefineActionTypeResult, DefineActionDiff, DefineActionPlan, PlanActionDefinitionParams, ActionView, StepView, StepOps, StepRecord, StepSummary, StepIoSummary, PatchStepScriptOp, SetStepInputOp, AddStepOutputOp, AddStepInputOp, ApplyStepOpsResult, VerifyStepsResult, ReadFlowParams, ReadFlowResult, FlowStep, FlowVariable, ReadActionTypeParams, ReadActionTypeResult, ActionIo, PublishFlowParams, PublishFlowResult, CopyFlowParams, CopyFlowResult, CreateFlowParams, CreateFlowResult, EditFlowParams, EditFlowResult, EditFlowOps, StepInputPatch, TestFlowParams, TestFlowResult, TestFlowTarget, WriteOp, WriteOpResult, } from "./flowDesigner";
23
23
  export type { ServiceNowClientConfig, ChoiceValue, ChoiceType, AddChoicesParams, AddChoicesResult, ChoiceActionResult, ChoiceFieldRef, RemoveChoicesParams, RemoveChoicesResult, ChoiceRemovalResult, DictionaryRecord, UpdateSetRecord, LayoutAction, LayoutRecordResult, LayoutResult, CreateViewParams, CreateViewResult, FormSectionSpec, SetFormLayoutParams, SetListLayoutParams, SetRelatedListsParams, ChunkRole, ChunkInfo, ChunkResult, PrunedResult, HostAssetsParams, HostAssetsResult, } from "./types";
24
- export { createTable, projectTableGraph, buildColumnXml, normalizeColumns, resolveType, applyTableSaveOverlay, defaultAccessFlags, TYPE_MAP, DEFAULT_SUPER_CLASS, DEFAULT_SAVE_ACTION, addColumn, deriveElement, ensureDesignAccess, findDesignAccess, DESIGN_ACCESS_TABLE, addIndex, parseIndexColumns, indexMatchesColumns, listIndexes, createIndex, validateCreateIndex, captureRowName, parseAjaxAnswer, parseCanCreate, buildCanCreateFields, buildCreateScheduleFields, XMLHTTP_PATH, DEFAULT_ACCESS_METHOD, CAPTURE_NOTE, setColumn, resolveAttributes, toStoredValue, setTable, resolveTableAttributes, } from "./table";
25
- export type { CreateTableParams, CreateTableResult, AddColumnParams, AddColumnResult, DesignAccessFlag, EnsureDesignAccessParams, EnsureDesignAccessResult, AddIndexParams, AddIndexResult, AddIndexVerification, ListIndexesParams, ListIndexesResult, TableIndex, CreateIndexParams, CreateIndexResult, SetColumnParams, SetColumnResult, ColumnAttributes, AttributeChange, SetTableParams, SetTableResult, TableAttributes, TableGraph, NormalizedColumn, ColumnSpec, AccessFlags, OverlaySpec, } from "./table";
24
+ export { createTable, projectTableGraph, buildColumnXml, normalizeColumns, resolveType, applyTableSaveOverlay, defaultAccessFlags, TYPE_MAP, DEFAULT_SUPER_CLASS, DEFAULT_SAVE_ACTION, addColumn, referenceAttrAudit, parseAttributes, mergeAttributes, missingAttributes, normalizeAttributeInput, resolveColumnAttributes, deriveElement, ensureDesignAccess, findDesignAccess, DESIGN_ACCESS_TABLE, addIndex, parseIndexColumns, indexMatchesColumns, listIndexes, createIndex, validateCreateIndex, captureRowName, parseAjaxAnswer, parseCanCreate, buildCanCreateFields, buildCreateScheduleFields, XMLHTTP_PATH, DEFAULT_ACCESS_METHOD, CAPTURE_NOTE, setColumn, resolveAttributes, toStoredValue, setTable, resolveTableAttributes, } from "./table";
25
+ export type { CreateTableParams, CreateTableResult, AddColumnParams, ReferenceAttrAuditParams, ReferenceAttrAuditResult, ReferenceAttrAuditRow, ColumnAttributeCheck, DictionaryAttribute, AttributeInput, AddColumnResult, DesignAccessFlag, EnsureDesignAccessParams, EnsureDesignAccessResult, AddIndexParams, AddIndexResult, AddIndexVerification, ListIndexesParams, ListIndexesResult, TableIndex, CreateIndexParams, CreateIndexResult, SetColumnParams, SetColumnResult, ColumnAttributes, AttributeChange, SetTableParams, SetTableResult, TableAttributes, TableGraph, NormalizedColumn, ColumnSpec, AccessFlags, OverlaySpec, } from "./table";
26
26
  export { setField } from "./setField";
27
27
  export { createRecord } from "./createRecord";
28
28
  export type { RecordWriteResult, SetFieldParams, SetFieldResult, } from "./setField";
package/dist/index.js CHANGED
@@ -7,9 +7,9 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.editFlow = exports.buildPublishModel = exports.createFlow = exports.copyFlow = exports.publishFlow = exports.readActionType = exports.readFlow = exports.formatStepPill = exports.summarizeSteps = exports.verifySteps = exports.applyStepOps = exports.validateDefineSpec = exports.planActionDefinition = exports.defineActionType = exports.editActionType = exports.publishActionType = exports.triggerPublication = exports.findStepInput = exports.fetchActionSteps = exports.slugInternalName = exports.resolveScope = exports.cloneActionType = exports.cloneSubflow = exports.verifyArtifact = exports.listTemplates = exports.sincPlugin = exports.formatCreateViewResult = exports.formatLayoutResult = exports.setRelatedLists = exports.setFormLayout = exports.setListLayout = exports.createView = exports.formatRemoveChoicesResult = exports.formatAddChoicesResult = exports.formatHostAssetsResult = exports.classifyChunks = exports.hostAssets = exports.ChoiceWriteError = exports.removeChoicesFromField = exports.addChoicesToField = exports.resolveConfigFromEnvFile = exports.createClientFromEnvFile = exports.assertWriteAllowed = exports.evaluateWriteGate = exports.isCiEnvironment = exports.resolveExecutionContext = exports.PROCESSFLOW_PATH_PREFIX = exports.isProcessflowPath = exports.resolveFlowAuth = exports.createClient = void 0;
10
- exports.readBackMatches = exports.hasHtmlEntity = exports.decodeHtmlEntities = exports.formatUxEventSync = exports.parseNowUiActions = exports.syncUxEvents = exports.deleteRecord = exports.createRecord = exports.setField = exports.resolveTableAttributes = exports.setTable = exports.toStoredValue = exports.resolveAttributes = exports.setColumn = exports.CAPTURE_NOTE = exports.DEFAULT_ACCESS_METHOD = exports.XMLHTTP_PATH = exports.buildCreateScheduleFields = exports.buildCanCreateFields = exports.parseCanCreate = exports.parseAjaxAnswer = exports.captureRowName = exports.validateCreateIndex = exports.createIndex = exports.listIndexes = exports.indexMatchesColumns = exports.parseIndexColumns = exports.addIndex = exports.DESIGN_ACCESS_TABLE = exports.findDesignAccess = exports.ensureDesignAccess = exports.deriveElement = exports.addColumn = exports.DEFAULT_SAVE_ACTION = exports.DEFAULT_SUPER_CLASS = exports.TYPE_MAP = exports.defaultAccessFlags = exports.applyTableSaveOverlay = exports.resolveType = exports.normalizeColumns = exports.buildColumnXml = exports.projectTableGraph = exports.createTable = exports.WriteOrderError = exports.executeWritePlan = exports.topoSort = exports.generateSysId = exports.LEGACY_RUN_FLOW_PATH = exports.DEFAULT_RUN_FLOW_PATH = exports.testFlow = void 0;
11
- exports.escapeRegExp = exports.encodeXmlText = exports.encodeXmlEntities = exports.stripJsonValue = exports.stripField = exports.plannedStrips = exports.recordFieldNames = exports.readRecordTable = exports.readField = exports.verifyStripped = exports.stripSecrets = exports.DEFAULT_EXPORT_APP_TIMEOUT_MS = exports.buildPublishFields = exports.buildCreateSetFields = exports.exportApp = exports.DEFAULT_MAX_ROWS = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.UPDATE_XML_FIELDS = exports.xmlEscape = exports.formatUnloadDate = exports.parseStatsCount = exports.refreshTypeFields = exports.fetchUpdateXmlRows = exports.countUpdateXml = exports.countUnloadRecords = exports.renderUnload = exports.renderRemoteUpdateSet = exports.renderUpdateXmlRow = exports.exportUpdateSet = exports.PUBLISH_POLL_DELAYS_MS = exports.DEFAULT_PUBLISH_TIMEOUT_MS = exports.parseCicdProgress = exports.parseCicdPublishResponse = exports.harvestProgressResults = exports.flattenSteps = exports.classifyProgress = exports.parseProgressTree = exports.parseXmlAnswer = exports.PUBLISH_TARGETS = exports.parsePublishTargets = exports.describeTarget = exports.resolveUpdateSetNaming = exports.buildPublishToUpdateSetFields = exports.buildCreateUpdateSetFields = exports.buildStartFields = exports.publishApp = exports.INVOKE_REST_METHODS = exports.invokeRest = exports.verifyReadBack = void 0;
12
- exports.SECRET_INTERNAL_TYPES = exports.SENTINEL = exports.isCapturable = exports.secretFieldsFromDictionary = exports.mergeSecretRules = exports.loadSecretRules = exports.defaultSecretRules = void 0;
10
+ exports.deleteRecord = exports.createRecord = exports.setField = exports.resolveTableAttributes = exports.setTable = exports.toStoredValue = exports.resolveAttributes = exports.setColumn = exports.CAPTURE_NOTE = exports.DEFAULT_ACCESS_METHOD = exports.XMLHTTP_PATH = exports.buildCreateScheduleFields = exports.buildCanCreateFields = exports.parseCanCreate = exports.parseAjaxAnswer = exports.captureRowName = exports.validateCreateIndex = exports.createIndex = exports.listIndexes = exports.indexMatchesColumns = exports.parseIndexColumns = exports.addIndex = exports.DESIGN_ACCESS_TABLE = exports.findDesignAccess = exports.ensureDesignAccess = exports.deriveElement = exports.resolveColumnAttributes = exports.normalizeAttributeInput = exports.missingAttributes = exports.mergeAttributes = exports.parseAttributes = exports.referenceAttrAudit = exports.addColumn = exports.DEFAULT_SAVE_ACTION = exports.DEFAULT_SUPER_CLASS = exports.TYPE_MAP = exports.defaultAccessFlags = exports.applyTableSaveOverlay = exports.resolveType = exports.normalizeColumns = exports.buildColumnXml = exports.projectTableGraph = exports.createTable = exports.WriteOrderError = exports.executeWritePlan = exports.topoSort = exports.generateSysId = exports.LEGACY_RUN_FLOW_PATH = exports.DEFAULT_RUN_FLOW_PATH = exports.testFlow = void 0;
11
+ exports.recordFieldNames = exports.readRecordTable = exports.readField = exports.verifyStripped = exports.stripSecrets = exports.DEFAULT_EXPORT_APP_TIMEOUT_MS = exports.buildPublishFields = exports.buildCreateSetFields = exports.exportApp = exports.DEFAULT_MAX_ROWS = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.UPDATE_XML_FIELDS = exports.xmlEscape = exports.formatUnloadDate = exports.parseStatsCount = exports.refreshTypeFields = exports.fetchUpdateXmlRows = exports.countUpdateXml = exports.countUnloadRecords = exports.renderUnload = exports.renderRemoteUpdateSet = exports.renderUpdateXmlRow = exports.exportUpdateSet = exports.PUBLISH_POLL_DELAYS_MS = exports.DEFAULT_PUBLISH_TIMEOUT_MS = exports.parseCicdProgress = exports.parseCicdPublishResponse = exports.harvestProgressResults = exports.flattenSteps = exports.classifyProgress = exports.parseProgressTree = exports.parseXmlAnswer = exports.PUBLISH_TARGETS = exports.parsePublishTargets = exports.describeTarget = exports.resolveUpdateSetNaming = exports.buildPublishToUpdateSetFields = exports.buildCreateUpdateSetFields = exports.buildStartFields = exports.publishApp = exports.INVOKE_REST_METHODS = exports.invokeRest = exports.verifyReadBack = exports.readBackMatches = exports.hasHtmlEntity = exports.decodeHtmlEntities = exports.formatUxEventSync = exports.parseNowUiActions = exports.syncUxEvents = void 0;
12
+ exports.SECRET_INTERNAL_TYPES = exports.SENTINEL = exports.isCapturable = exports.secretFieldsFromDictionary = exports.mergeSecretRules = exports.loadSecretRules = exports.defaultSecretRules = exports.escapeRegExp = exports.encodeXmlText = exports.encodeXmlEntities = exports.stripJsonValue = exports.stripField = exports.plannedStrips = void 0;
13
13
  var client_1 = require("./client");
14
14
  Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } });
15
15
  Object.defineProperty(exports, "resolveFlowAuth", { enumerable: true, get: function () { return client_1.resolveFlowAuth; } });
@@ -92,6 +92,12 @@ Object.defineProperty(exports, "TYPE_MAP", { enumerable: true, get: function ()
92
92
  Object.defineProperty(exports, "DEFAULT_SUPER_CLASS", { enumerable: true, get: function () { return table_1.DEFAULT_SUPER_CLASS; } });
93
93
  Object.defineProperty(exports, "DEFAULT_SAVE_ACTION", { enumerable: true, get: function () { return table_1.DEFAULT_SAVE_ACTION; } });
94
94
  Object.defineProperty(exports, "addColumn", { enumerable: true, get: function () { return table_1.addColumn; } });
95
+ Object.defineProperty(exports, "referenceAttrAudit", { enumerable: true, get: function () { return table_1.referenceAttrAudit; } });
96
+ Object.defineProperty(exports, "parseAttributes", { enumerable: true, get: function () { return table_1.parseAttributes; } });
97
+ Object.defineProperty(exports, "mergeAttributes", { enumerable: true, get: function () { return table_1.mergeAttributes; } });
98
+ Object.defineProperty(exports, "missingAttributes", { enumerable: true, get: function () { return table_1.missingAttributes; } });
99
+ Object.defineProperty(exports, "normalizeAttributeInput", { enumerable: true, get: function () { return table_1.normalizeAttributeInput; } });
100
+ Object.defineProperty(exports, "resolveColumnAttributes", { enumerable: true, get: function () { return table_1.resolveColumnAttributes; } });
95
101
  Object.defineProperty(exports, "deriveElement", { enumerable: true, get: function () { return table_1.deriveElement; } });
96
102
  Object.defineProperty(exports, "ensureDesignAccess", { enumerable: true, get: function () { return table_1.ensureDesignAccess; } });
97
103
  Object.defineProperty(exports, "findDesignAccess", { enumerable: true, get: function () { return table_1.findDesignAccess; } });
@@ -10,7 +10,7 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
10
  import { z } from "zod";
11
11
  import type { ToolAnnotations } from "@tenonhq/dovetail-mcp-kit";
12
12
  import type { ServiceNowClient } from "../client";
13
- export declare var TOOL_NAMES: readonly ["create_view", "set_list_layout", "set_form_layout", "set_related_lists", "add_choices_to_field", "remove_choices_from_field", "flow_view", "action_view", "action_edit", "action_clone", "action_define", "flow_publish", "flow_copy", "flow_create", "flow_test", "flow_edit", "create_table", "add_column", "design_access", "add_index", "index_list", "index_create", "set_column", "set_table", "set_field", "create_record", "delete_record", "sync_ux_events", "host_assets", "invoke_rest", "app_publish", "update_set_export", "app_export"];
13
+ export declare var TOOL_NAMES: readonly ["create_view", "set_list_layout", "set_form_layout", "set_related_lists", "add_choices_to_field", "remove_choices_from_field", "flow_view", "action_view", "action_edit", "action_clone", "action_define", "flow_publish", "flow_copy", "flow_create", "flow_test", "flow_edit", "create_table", "add_column", "design_access", "add_index", "index_list", "reference_attr_audit", "index_create", "set_column", "set_table", "set_field", "create_record", "delete_record", "sync_ux_events", "host_assets", "invoke_rest", "app_publish", "update_set_export", "app_export"];
14
14
  export type ToolName = (typeof TOOL_NAMES)[number];
15
15
  export interface RegistryDeps {
16
16
  /** Optional client injection for tests; defaults to createClient({}). */
@@ -96,6 +96,7 @@ exports.TOOL_NAMES = [
96
96
  "design_access",
97
97
  "add_index",
98
98
  "index_list",
99
+ "reference_attr_audit",
99
100
  "index_create",
100
101
  "set_column",
101
102
  "set_table",
@@ -444,7 +445,12 @@ function buildDescriptors(deps = {}) {
444
445
  "(POST /sys_db_object.do) so the real 36-record graph + the physical table + seeded ACLs " +
445
446
  "are created. name (x_scope_*), label, scope, and columns[] are required; extendsTable " +
446
447
  "defaults to sys_metadata; friendly column types are mapped to internal types " +
447
- "(string -> string_full_utf8). dryRun:true returns the plan + the column XML + the projected " +
448
+ "(string -> string_full_utf8). A reference column gets sys_dictionary.attributes " +
449
+ "readonly_clickthrough=true by default (team rule; column.readonly_clickthrough:false opts " +
450
+ "out); column.attributes ('k=v,k2=v2' or a map) adds more. After a live save every column " +
451
+ "with attributes is READ BACK and merge-patched once into updateSetSysId if they did not land " +
452
+ "— still missing fails the create (see columnAttributes). " +
453
+ "dryRun:true returns the plan + the column XML + the projected " +
448
454
  "graph with no session and no writes. NOTE: the live write path is pending a validated-live " +
449
455
  "spike — prefer dryRun until confirmed, and always verify the sys_update_xml landed in the " +
450
456
  "intended update set.",
@@ -477,11 +483,16 @@ function buildDescriptors(deps = {}) {
477
483
  "inserts, restores) so the column lands in the right scope and update set, then READS THE COLUMN " +
478
484
  "BACK from sys_dictionary to prove it materialised (a returned sys_id with no column is reported " +
479
485
  "failed, not created). table is the table name or its sys_db_object sys_id; column is " +
480
- "{ label, type, name?, max_length?, reference?, mandatory?, default?, dependent_on_field? } with " +
486
+ "{ label, type, name?, max_length?, reference?, mandatory?, default?, dependent_on_field?, " +
487
+ "attributes?, readonly_clickthrough? } with " +
481
488
  "friendly types mapped to internal types (string -> string_full_utf8) and reference = the target " +
482
489
  "table NAME; element is derived from label unless column.name is given. dependent_on_field names " +
483
490
  "the sibling column a document_id column resolves against (its table_name column) — it must " +
484
491
  "already exist on the table, is verified on the read-back, and is refused when absent. " +
492
+ "A REFERENCE column gets sys_dictionary.attributes readonly_clickthrough=true by default " +
493
+ "(team rule; readonly_clickthrough:false opts out, or set it yourself in attributes); " +
494
+ "column.attributes ('k=v,k2=v2' or a map) adds more. Every requested attribute is verified " +
495
+ "on the read-back (patched once as a merge if the insert dropped it; still missing = failed). " +
485
496
  "scope must match the table's scope unless crossScope:true, which opts in to a column OWNED " +
486
497
  "by scope on another app's table (the platform's cross-scope field: element becomes " +
487
498
  "<scope>_<name>, the dictionary row and its update-set capture land in scope); the table " +
@@ -632,6 +643,26 @@ function buildDescriptors(deps = {}) {
632
643
  return (0, table_1.listIndexes)({ client: client(), table: p.table });
633
644
  },
634
645
  },
646
+ {
647
+ name: "reference_attr_audit",
648
+ annotations: dovetail_mcp_kit_1.READ_ONLY,
649
+ description: "List the REFERENCE columns under a table-name prefix (e.g. x_cadso_) whose " +
650
+ "sys_dictionary.attributes lack a required attribute — by default " +
651
+ "readonly_clickthrough=true, the team rule for every reference column. Read-only: pages " +
652
+ "sys_dictionary (internal_type=reference, active) 1000 rows at a time and returns " +
653
+ "{ total, compliant, missing: [{ table, element, columnSysId, scope, reference, attributes }], " +
654
+ "truncated }. It never writes — backfill a column with set_column attributes into an " +
655
+ "update set as a separate, deliberate step.",
656
+ shape: schemas_1.referenceAttrAuditSchema.shape,
657
+ handler: async function (args) {
658
+ var p = schemas_1.referenceAttrAuditSchema.parse(args);
659
+ return (0, table_1.referenceAttrAudit)({
660
+ client: client(),
661
+ scopePrefix: p.scopePrefix,
662
+ attribute: p.attribute,
663
+ });
664
+ },
665
+ },
635
666
  {
636
667
  name: "index_create",
637
668
  annotations: dovetail_mcp_kit_1.WRITE_ADDITIVE_IDEMPOTENT,
@@ -694,8 +725,11 @@ function buildDescriptors(deps = {}) {
694
725
  name: "set_column",
695
726
  annotations: dovetail_mcp_kit_1.WRITE_OVERWRITE,
696
727
  description: "Update the SCHEMA of an EXISTING column on an EXISTING ServiceNow table — its label, " +
697
- "mandatory, default, readOnly, maxLength, or dependentOnField (the sibling column a " +
698
- "document_id resolves against; must exist on the table; \"\" clears it) — on an INHERITED " +
728
+ "mandatory, default, readOnly, maxLength, dependentOnField (the sibling column a " +
729
+ "document_id resolves against; must exist on the table; \"\" clears it), or attributes " +
730
+ "(sys_dictionary.attributes, 'k=v,k2=v2' or a map — MERGED into the column's existing " +
731
+ "attributes, never overwriting keys you did not name; verified order-insensitively; refused " +
732
+ "on an inherited column) — on an INHERITED " +
699
733
  "column, overridden for that table alone via sys_dictionary_override — captured into a " +
700
734
  "named update set, then READ " +
701
735
  "BACK from the instance to verify. This is the schema counterpart to set_field: set_field " +