@neopress/cli 0.2.1 → 0.3.1

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
@@ -4105,6 +4105,10 @@ var TemplatesEndpoint = class {
4105
4105
  const res = await this.client.post(this.basePath, data);
4106
4106
  return res.data;
4107
4107
  }
4108
+ async delete() {
4109
+ const res = await this.client.delete(this.basePath);
4110
+ return res.data;
4111
+ }
4108
4112
  };
4109
4113
 
4110
4114
  // ../sdk/dist/client.js
@@ -4170,7 +4174,13 @@ var NeopressClient = class {
4170
4174
  throw new NeopressApiError("CONNECTION_ERROR", `Cannot connect to ${this.baseUrl} \u2014 is the dev server running?`, 0);
4171
4175
  }
4172
4176
  clearTimeout(timeout);
4173
- 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
+ }
4174
4184
  if (!response.ok) {
4175
4185
  const err = json?.error || {};
4176
4186
  throw new NeopressApiError(err.code || "UNKNOWN", err.message || response.statusText, response.status, json);
@@ -4901,7 +4911,13 @@ function registerTemplateCommands(program3) {
4901
4911
  const template = await client.templates.get();
4902
4912
  output(template);
4903
4913
  });
4904
- 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").option(
4914
+ 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(
4915
+ "--structure-reference-url <url>",
4916
+ "Reference URL for template structure"
4917
+ ).requiredOption(
4918
+ "--design-reference-url <url>",
4919
+ "Reference URL for template design"
4920
+ ).option(
4905
4921
  "--preview-img-url <url>",
4906
4922
  "Preview image URL. Repeat for multiple images.",
4907
4923
  collectPreviewImgUrl,
@@ -4912,15 +4928,24 @@ function registerTemplateCommands(program3) {
4912
4928
  name: options.name,
4913
4929
  industry: options.industry,
4914
4930
  category: options.category,
4931
+ reference: {
4932
+ structure: options.structureReferenceUrl,
4933
+ design: options.designReferenceUrl
4934
+ },
4915
4935
  previewImgUrls: options.previewImgUrl.length > 0 ? options.previewImgUrl : void 0
4916
4936
  });
4917
4937
  output(template);
4918
4938
  });
4939
+ templates.command("delete").description("Delete the active template metadata row and linked site").action(async () => {
4940
+ const client = await getClientAsync();
4941
+ const result = await client.templates.delete();
4942
+ output(result);
4943
+ });
4919
4944
  }
4920
4945
 
4921
4946
  // src/bin.ts
4922
4947
  var program2 = new Command();
4923
- program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("0.2.1").option("--json", "Output in JSON format (for AI tools and pipes)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
4948
+ program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("0.3.1").option("--json", "Output in JSON format (for AI tools and pipes)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
4924
4949
  const opts = thisCommand.optsWithGlobals();
4925
4950
  if (opts.json) setJsonMode(true);
4926
4951
  });
package/dist/index.js CHANGED
@@ -424,6 +424,10 @@ var TemplatesEndpoint = class {
424
424
  const res = await this.client.post(this.basePath, data);
425
425
  return res.data;
426
426
  }
427
+ async delete() {
428
+ const res = await this.client.delete(this.basePath);
429
+ return res.data;
430
+ }
427
431
  };
428
432
 
429
433
  // ../sdk/dist/client.js
@@ -489,7 +493,13 @@ var NeopressClient = class {
489
493
  throw new NeopressApiError("CONNECTION_ERROR", `Cannot connect to ${this.baseUrl} \u2014 is the dev server running?`, 0);
490
494
  }
491
495
  clearTimeout(timeout);
492
- 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
+ }
493
503
  if (!response.ok) {
494
504
  const err = json?.error || {};
495
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.2.1",
3
+ "version": "0.3.1",
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.1.0"
22
+ "@neopress/sdk": "0.3.1"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsup",