ccdesk 0.2.6 → 0.2.7

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.
@@ -6,7 +6,7 @@
6
6
  <meta name="color-scheme" content="light dark" />
7
7
  <title>ccdesk</title>
8
8
  <link rel="icon" href="/logo.png" type="image/png" />
9
- <script type="module" crossorigin src="/assets/index-D3snAAMI.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-BOJGsyhD.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-DcIoz4qK.css">
11
11
  </head>
12
12
  <body>
@@ -70,7 +70,7 @@ export declare function fromDraft(kind: FieldKind, property: SettingSchema | und
70
70
  } | {
71
71
  error: string;
72
72
  };
73
- /** JSON typed into a form, or why it does not parse. */
73
+ /** JSON typed into a form, or why it cannot be saved, as a sentence to show. */
74
74
  export declare function parseJson(text: string): {
75
75
  value: unknown;
76
76
  } | {
@@ -180,8 +180,9 @@ export function fromDraft(kind, property, draft, inObject = false) {
180
180
  if (kind === "boolean")
181
181
  return { value: draft === "true" };
182
182
  if (kind === "number") {
183
+ // JSON has no Infinity, so a number too large would reach the review as null.
183
184
  const n = Number(draft);
184
- return draft.trim() === "" || Number.isNaN(n) ? { error: "Enter a number." } : { value: n };
185
+ return draft.trim() === "" || !Number.isFinite(n) ? { error: "Enter a number." } : { value: n };
185
186
  }
186
187
  if (kind === "lines")
187
188
  return {
@@ -222,22 +223,30 @@ function jsonFromDraft(property, draft) {
222
223
  const quote = property && text !== "" && takesText(property)
223
224
  ? `. Text goes in double quotes: ${JSON.stringify(text)}`
224
225
  : "";
225
- return { error: `Not valid JSON: ${parsed.error}${quote}` };
226
+ return { error: `${parsed.error}${quote}` };
226
227
  }
227
228
  function takesText(schema) {
228
229
  if (schema.anyOf)
229
230
  return schema.anyOf.some(takesText);
230
231
  return [schema.type ?? []].flat().includes("string");
231
232
  }
232
- /** JSON typed into a form, or why it does not parse. */
233
+ /** JSON typed into a form, or why it cannot be saved, as a sentence to show. */
233
234
  export function parseJson(text) {
234
235
  try {
235
- return { value: JSON.parse(text) };
236
+ return { value: JSON.parse(text, finiteNumbers) };
236
237
  }
237
238
  catch (error) {
238
- return { error: error instanceof Error ? error.message : String(error) };
239
+ if (error instanceof RangeError)
240
+ return { error: error.message };
241
+ return { error: `Not valid JSON: ${error instanceof Error ? error.message : String(error)}` };
239
242
  }
240
243
  }
244
+ /** JSON.parse reads 1e400 as Infinity, which JSON.stringify writes as null. */
245
+ function finiteNumbers(_key, value) {
246
+ if (typeof value === "number" && !Number.isFinite(value))
247
+ throw new RangeError("A number is too large to save: JSON would write it as null.");
248
+ return value;
249
+ }
241
250
  /**
242
251
  * What a value must be, in JSON's terms: "true or false, or an object with commit, pr and
243
252
  * sessionUrl". Shown beside a JSON field, so you know the shape before the review checks it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccdesk",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "See and change everything Claude Code loads on your machine: instruction files, settings, permissions, hooks, MCP servers, subagents, skills, plugins and auto memory",
5
5
  "keywords": [
6
6
  "claude-code",