@neopress/cli 0.3.0 → 3.2.0

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/bin.cjs CHANGED
@@ -4174,7 +4174,13 @@ var NeopressClient = class {
4174
4174
  throw new NeopressApiError("CONNECTION_ERROR", `Cannot connect to ${this.baseUrl} \u2014 is the dev server running?`, 0);
4175
4175
  }
4176
4176
  clearTimeout(timeout);
4177
- const json = await response.json();
4177
+ const responseText = await response.text();
4178
+ let json;
4179
+ try {
4180
+ json = responseText ? JSON.parse(responseText) : {};
4181
+ } catch {
4182
+ throw new NeopressApiError("NON_JSON_RESPONSE", `Expected JSON from ${method} ${url} but received non-JSON response (${response.status} ${response.statusText})`, response.status, { body: responseText.slice(0, 500) });
4183
+ }
4178
4184
  if (!response.ok) {
4179
4185
  const err = json?.error || {};
4180
4186
  throw new NeopressApiError(err.code || "UNKNOWN", err.message || response.statusText, response.status, json);
@@ -4905,12 +4911,9 @@ function registerTemplateCommands(program3) {
4905
4911
  const template = await client.templates.get();
4906
4912
  output(template);
4907
4913
  });
4908
- templates.command("mark").description("Mark or update the active site as a template").requiredOption("--name <name>", "Template display name").requiredOption("--industry <industry>", "Template industry key").requiredOption("--category <category>", "Template category key").requiredOption(
4909
- "--structure-reference-url <url>",
4910
- "Reference URL for template structure"
4911
- ).requiredOption(
4912
- "--design-reference-url <url>",
4913
- "Reference URL for template design"
4914
+ templates.command("mark").description("Mark or update the active site as a template").requiredOption("--name <name>", "Template display name").option("--description <description>", "Template description, up to 150 characters").requiredOption("--industry <industry>", "Template industry key").requiredOption(
4915
+ "--reference-url <url>",
4916
+ "Reference URL for template provenance"
4914
4917
  ).option(
4915
4918
  "--preview-img-url <url>",
4916
4919
  "Preview image URL. Repeat for multiple images.",
@@ -4920,12 +4923,9 @@ function registerTemplateCommands(program3) {
4920
4923
  const client = await getClientAsync();
4921
4924
  const template = await client.templates.mark({
4922
4925
  name: options.name,
4926
+ description: options.description,
4923
4927
  industry: options.industry,
4924
- category: options.category,
4925
- reference: {
4926
- structure: options.structureReferenceUrl,
4927
- design: options.designReferenceUrl
4928
- },
4928
+ referenceUrl: options.referenceUrl,
4929
4929
  previewImgUrls: options.previewImgUrl.length > 0 ? options.previewImgUrl : void 0
4930
4930
  });
4931
4931
  output(template);
@@ -4939,7 +4939,7 @@ function registerTemplateCommands(program3) {
4939
4939
 
4940
4940
  // src/bin.ts
4941
4941
  var program2 = new Command();
4942
- program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("0.3.0").option("--json", "Output in JSON format (for AI tools and pipes)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
4942
+ program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("3.2.0").option("--json", "Output in JSON format (for AI tools and pipes)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
4943
4943
  const opts = thisCommand.optsWithGlobals();
4944
4944
  if (opts.json) setJsonMode(true);
4945
4945
  });
package/dist/index.js CHANGED
@@ -493,7 +493,13 @@ var NeopressClient = class {
493
493
  throw new NeopressApiError("CONNECTION_ERROR", `Cannot connect to ${this.baseUrl} \u2014 is the dev server running?`, 0);
494
494
  }
495
495
  clearTimeout(timeout);
496
- const json = await response.json();
496
+ const responseText = await response.text();
497
+ let json;
498
+ try {
499
+ json = responseText ? JSON.parse(responseText) : {};
500
+ } catch {
501
+ throw new NeopressApiError("NON_JSON_RESPONSE", `Expected JSON from ${method} ${url} but received non-JSON response (${response.status} ${response.statusText})`, response.status, { body: responseText.slice(0, 500) });
502
+ }
497
503
  if (!response.ok) {
498
504
  const err = json?.error || {};
499
505
  throw new NeopressApiError(err.code || "UNKNOWN", err.message || response.statusText, response.status, json);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neopress/cli",
3
- "version": "0.3.0",
3
+ "version": "3.2.0",
4
4
  "description": "Neopress CLI — manage your Neopress site from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  "commander": "^13.0.0",
20
20
  "tsup": "^8.5.1",
21
21
  "typescript": "^5.7.0",
22
- "@neopress/sdk": "0.3.0"
22
+ "@neopress/sdk": "0.3.1"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsup",