hymnkeep 0.1.2 → 0.1.4

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/dist/cli.js CHANGED
@@ -185,7 +185,8 @@ Examples:
185
185
  stdout.write(`${describe(laid, load()?.url ? api().base : '')}\n`);
186
186
  return;
187
187
  }
188
- stdout.write(`${JSON.stringify(await send(api(), laid), null, 2)}\n`);
188
+ const answer = await send(api(), laid);
189
+ stdout.write(answer === null ? 'Done.\n' : `${JSON.stringify(answer, null, 2)}\n`);
189
190
  });
190
191
  program
191
192
  .command('mcp')
package/dist/mcp.js CHANGED
@@ -28,7 +28,7 @@ async function reply(task) {
28
28
  }
29
29
  }
30
30
  export function build(api) {
31
- const server = new McpServer({ name: 'hymnkeep', version: '0.1.2' }, { instructions: INSTRUCTIONS });
31
+ const server = new McpServer({ name: 'hymnkeep', version: '0.1.4' }, { instructions: INSTRUCTIONS });
32
32
  server.registerTool('whoami', { description: 'Who this key is: the community, the person, their role, and whether it may write.', annotations: READ }, () => reply(() => tasks.whoami(api)));
33
33
  server.registerTool('week', { description: "An occasion's services, its music place by place (where services differ, each one's), and who is on each service.", inputSchema: { day }, annotations: READ }, ({ day: when }) => reply(() => tasks.show(api, when)));
34
34
  server.registerTool('occasions', {
package/dist/params.js CHANGED
@@ -71,25 +71,28 @@ function path(key) {
71
71
  function place(into, keys, value) {
72
72
  const [head, ...rest] = keys;
73
73
  const container = into;
74
+ const at = Array.isArray(into) && /^\d+$/.test(head) ? Number(head) : head;
74
75
  if (rest.length === 0) {
75
76
  if (head === '' && Array.isArray(into)) {
76
77
  into.push(value);
77
78
  }
78
79
  else {
79
- container[head] = value;
80
+ container[at] = value;
80
81
  }
81
82
  return;
82
83
  }
83
- const next = rest[0] === '' ? [] : {};
84
+ // `a[]` and `a[0]` make a list; any other name makes an object.
85
+ const next = rest[0] === '' || /^\d+$/.test(rest[0]) ? [] : {};
84
86
  if (head === '' && Array.isArray(into)) {
85
87
  into.push(next);
86
88
  place(next, rest, value);
87
89
  return;
88
90
  }
89
- if (container[head] === undefined || typeof container[head] !== 'object' || container[head] === null) {
90
- container[head] = next;
91
+ const slot = container;
92
+ if (slot[at] === undefined || typeof slot[at] !== 'object' || slot[at] === null) {
93
+ slot[at] = next;
91
94
  }
92
- place(container[head], rest, value);
95
+ place(slot[at], rest, value);
93
96
  }
94
97
  const typeOf = (schema) => (schema?.type === undefined ? [] : Array.isArray(schema.type) ? schema.type : [schema.type]);
95
98
  /**
@@ -112,6 +115,10 @@ export function fit(value, schema) {
112
115
  return Object.fromEntries(Object.entries(value).map(([key, each]) => [key, fit(each, schema.properties?.[key])]));
113
116
  }
114
117
  if (typeof value === 'string') {
118
+ // A yes-or-no in a query is described as 1 or 0.
119
+ if (schema.enum?.includes(1) && schema.enum.includes(0) && /^(true|false|yes|no)$/i.test(value)) {
120
+ return /^(true|yes)$/i.test(value) ? 1 : 0;
121
+ }
115
122
  if (types.includes('boolean') && !types.includes('string') && /^(true|false|1|0|yes|no)$/i.test(value)) {
116
123
  return /^(true|1|yes)$/i.test(value);
117
124
  }