@construct-space/cli 1.1.8 → 1.1.9

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/index.js CHANGED
@@ -7362,8 +7362,8 @@ function validate2(m) {
7362
7362
  errors2.push("author: must be an object with a name");
7363
7363
  if (!m.icon)
7364
7364
  errors2.push("icon: must be a string");
7365
- if (!["company", "project", "both"].includes(m.scope))
7366
- errors2.push('scope: must be "company", "project", or "both"');
7365
+ if (!["app", "project", "org", "any"].includes(m.scope))
7366
+ errors2.push('scope: must be "app", "project", "org", or "any"');
7367
7367
  if (!m.pages?.length)
7368
7368
  errors2.push("pages: must be a non-empty array");
7369
7369
  if (!m.navigation?.label)
@@ -9568,6 +9568,16 @@ async function uploadSource(portalURL, token, tarballPath, m) {
9568
9568
  if (resp.status === 401) {
9569
9569
  throw new Error("authentication failed \u2014 run 'construct login' to re-authenticate");
9570
9570
  }
9571
+ if (resp.status === 403) {
9572
+ let msg = result.error || "You are not the owner of this space";
9573
+ if (result.owner_user_id) {
9574
+ msg += `
9575
+ Current owner: ${result.owner_user_id}`;
9576
+ }
9577
+ msg += `
9578
+ Fork to a new space_id to publish your own version.`;
9579
+ throw new Error(msg);
9580
+ }
9571
9581
  if (resp.status >= 400) {
9572
9582
  const msg = result.error || result.errors?.join("; ") || `server returned ${resp.status}`;
9573
9583
  throw new Error(msg);
@@ -10260,12 +10270,14 @@ async function graphPush() {
10260
10270
  const graphURL = process.env.GRAPH_URL || "https://graph.construct.space";
10261
10271
  const spinner = ora("Registering models...").start();
10262
10272
  try {
10273
+ const userID = creds.user?.id || "";
10263
10274
  const resp = await fetch(`${graphURL}/api/schemas/register`, {
10264
10275
  method: "POST",
10265
10276
  headers: {
10266
10277
  "Content-Type": "application/json",
10267
10278
  Authorization: `Bearer ${creds.token}`,
10268
- "X-Space-ID": m.id
10279
+ "X-Space-ID": m.id,
10280
+ "X-Auth-User-ID": userID
10269
10281
  },
10270
10282
  body: JSON.stringify({
10271
10283
  space_id: m.id,
@@ -10275,6 +10287,20 @@ async function graphPush() {
10275
10287
  manifest: { version: 1, models }
10276
10288
  })
10277
10289
  });
10290
+ if (resp.status === 403) {
10291
+ spinner.fail("Ownership check failed");
10292
+ try {
10293
+ const errBody = await resp.json();
10294
+ console.error(source_default.red(` ${errBody.error || "You are not the owner of this space"}`));
10295
+ if (errBody.owner_user_id) {
10296
+ console.error(source_default.dim(` Current owner: ${errBody.owner_user_id}`));
10297
+ }
10298
+ console.error(source_default.dim(" Fork to a new space_id to publish your own version."));
10299
+ } catch {
10300
+ console.error(source_default.red(` 403: Forbidden \u2014 ownership check failed`));
10301
+ }
10302
+ process.exit(1);
10303
+ }
10278
10304
  if (!resp.ok) {
10279
10305
  const body = await resp.text();
10280
10306
  spinner.fail("Registration failed");
@@ -10501,7 +10527,7 @@ function parseModelFields(content, fileName) {
10501
10527
  }
10502
10528
 
10503
10529
  // src/index.ts
10504
- var VERSION = "1.1.8";
10530
+ var VERSION = "1.1.9";
10505
10531
  var program2 = new Command;
10506
10532
  program2.name("construct").description("Construct CLI \u2014 scaffold, build, develop, and publish spaces").version(VERSION);
10507
10533
  program2.command("scaffold [name]").alias("new").alias("create").description("Create a new Construct space project").option("--with-tests", "Include E2E testing boilerplate").option("--full", "Full preset: multiple pages, extra skills, widget templates").action(async (name, opts) => scaffold(name, opts));
@@ -7,7 +7,7 @@
7
7
  "name": "Your Name"
8
8
  },
9
9
  "icon": "i-lucide-box",
10
- "scope": "both",
10
+ "scope": "app",
11
11
  "minConstructVersion": "0.7.0",
12
12
  "navigation": {
13
13
  "label": "{{.DisplayName}}",
@@ -7,7 +7,7 @@
7
7
  "name": "Your Name"
8
8
  },
9
9
  "icon": "i-lucide-box",
10
- "scope": "both",
10
+ "scope": "app",
11
11
  "minConstructVersion": "0.7.0",
12
12
  "navigation": {
13
13
  "label": "{{.DisplayName}}",
@@ -1,7 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  /**
3
3
  * {{.DisplayName}} Summary Widget — 2×1 compact view
4
+ *
5
+ * Widgets run inside a closed Shadow DOM sandbox.
6
+ * Use the injected widgetApi for theme and actions — do not access
7
+ * window, document, or global stores directly.
4
8
  */
9
+ import { inject } from 'vue'
10
+
11
+ const api = inject<{ theme: { mode: string; vars: Record<string, string> }; space: { id: string; name: string } }>('widgetApi')
5
12
  </script>
6
13
 
7
14
  <template>
@@ -1,7 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  /**
3
3
  * {{.DisplayName}} Summary Widget — 4×1 wide view
4
+ *
5
+ * Widgets run inside a closed Shadow DOM sandbox.
6
+ * Use the injected widgetApi for theme and actions — do not access
7
+ * window, document, or global stores directly.
4
8
  */
9
+ import { inject } from 'vue'
10
+
11
+ const api = inject<{ theme: { mode: string; vars: Record<string, string> }; space: { id: string; name: string } }>('widgetApi')
5
12
  </script>
6
13
 
7
14
  <template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@construct-space/cli",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Construct CLI — scaffold, build, develop, and publish spaces",
5
5
  "type": "module",
6
6
  "bin": {
@@ -7,7 +7,7 @@
7
7
  "name": "Your Name"
8
8
  },
9
9
  "icon": "i-lucide-box",
10
- "scope": "both",
10
+ "scope": "app",
11
11
  "minConstructVersion": "0.7.0",
12
12
  "navigation": {
13
13
  "label": "{{.DisplayName}}",
@@ -7,7 +7,7 @@
7
7
  "name": "Your Name"
8
8
  },
9
9
  "icon": "i-lucide-box",
10
- "scope": "both",
10
+ "scope": "app",
11
11
  "minConstructVersion": "0.7.0",
12
12
  "navigation": {
13
13
  "label": "{{.DisplayName}}",
@@ -1,7 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  /**
3
3
  * {{.DisplayName}} Summary Widget — 2×1 compact view
4
+ *
5
+ * Widgets run inside a closed Shadow DOM sandbox.
6
+ * Use the injected widgetApi for theme and actions — do not access
7
+ * window, document, or global stores directly.
4
8
  */
9
+ import { inject } from 'vue'
10
+
11
+ const api = inject<{ theme: { mode: string; vars: Record<string, string> }; space: { id: string; name: string } }>('widgetApi')
5
12
  </script>
6
13
 
7
14
  <template>
@@ -1,7 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  /**
3
3
  * {{.DisplayName}} Summary Widget — 4×1 wide view
4
+ *
5
+ * Widgets run inside a closed Shadow DOM sandbox.
6
+ * Use the injected widgetApi for theme and actions — do not access
7
+ * window, document, or global stores directly.
4
8
  */
9
+ import { inject } from 'vue'
10
+
11
+ const api = inject<{ theme: { mode: string; vars: Record<string, string> }; space: { id: string; name: string } }>('widgetApi')
5
12
  </script>
6
13
 
7
14
  <template>