@geosynk/vertigis-web-sdk 1.0.6 → 1.0.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.
package/README.md CHANGED
@@ -171,14 +171,29 @@ When referencing secured Web Maps or layers from an ArcGIS Enterprise Portal or
171
171
 
172
172
  This SDK includes an automated configuration wizard that sets up seamless OAuth 2.0 authentication, trusted servers, and callback endpoints.
173
173
 
174
- #### Step 1: Portal Application Registration (Prerequisite)
174
+ #### Step 1: Portal Prerequisites (Application Registration & CORS Allowed Origins)
175
+
176
+ To allow the browser to authenticate and fetch secured resources (Web Maps, layers, feature services, REST metadata) from ArcGIS Enterprise, configure the following in your Portal:
177
+
178
+ ##### A. Register Application (OAuth 2.0 Client ID & Redirect URIs)
175
179
  1. Log in to your ArcGIS Enterprise Portal or ArcGIS Online organization.
176
180
  2. Navigate to **Content** > **Add Item** > **An Application** > **Application Configuration**.
177
- 3. Under **Redirect URIs**, add the following development endpoints:
181
+ 3. Under **Redirect URIs**, add the development callback endpoints:
178
182
  - `https://localtest.me:3001`
179
183
  - `https://localtest.me:3001/oauth_callback.html`
180
184
  4. Copy the generated **Client ID** (App ID) (e.g., `myClientId123`).
181
185
 
186
+ ##### B. Allow Origins for CORS (Cross-Origin Resource Sharing)
187
+ If your ArcGIS Enterprise Portal restricts cross-domain requests, you must whitelist your development origin to permit direct browser REST queries and resource fetching:
188
+ 1. Log in to Portal as an **Administrator**.
189
+ 2. Navigate to **Organization** > **Settings** > **Security**.
190
+ 3. Scroll down to the **Allow Origins** section.
191
+ 4. Add the development origin URL:
192
+ - `https://localtest.me:3001`
193
+ 5. Click **Add Domain** and **Save**.
194
+
195
+ > **Note**: ArcGIS Enterprise requires a fully qualified domain name (FQDN) containing a domain suffix (e.g., `localtest.me:3001`). Bare hostnames like `localhost` and wildcard `*` machine names are rejected by Portal security. In production, VertiGIS Studio Web is deployed directly within your GIS environment, so only the development origin needs whitelisting.
196
+
182
197
  #### Step 2: Run the Automated Portal Configurator
183
198
  Run the interactive configurator in your project:
184
199
  ```bash
@@ -224,6 +239,27 @@ When accessing `https://localtest.me:3001/`, VertiGIS Web automatically triggers
224
239
 
225
240
  ---
226
241
 
242
+ ### 6. AI Coding Assistant Skills (Antigravity, Cursor, Claude Code)
243
+
244
+ This SDK integrates directly with the [VertiGIS SDK Skills repository](https://github.com/davekazemi/vertigis-sdk-skills).
245
+
246
+ During project creation, you will be prompted:
247
+ ```text
248
+ ? Would you like to install AI coding assistant skills from https://github.com/davekazemi/vertigis-sdk-skills into this project? [Y/n]
249
+ ```
250
+ If accepted, the `vertigis-web-sdk-skill` is automatically installed into `./.agents/skills/` using the standard `skills` tool (`npx skills add`).
251
+
252
+ You can install or update the skill at any time in your project:
253
+ ```bash
254
+ npm run skill:add
255
+ ```
256
+ Or via non-interactive flag during scaffolding:
257
+ ```bash
258
+ npx @geosynk/vertigis-web-sdk create my-app --skills
259
+ ```
260
+
261
+ ---
262
+
227
263
  ## Upstream Synchronization
228
264
 
229
265
  This fork tracks official updates from `https://github.com/vertigis/vertigis-web-sdk.git`. Because enterprise templates are maintained in the isolated `template-custom/` overlay directory, upstream merges execute cleanly without merge conflicts:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geosynk/vertigis-web-sdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Enterprise SDK for extending VertiGIS Studio Web",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/scripts/create.js CHANGED
@@ -5,6 +5,7 @@ import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { execSync } from "node:child_process";
8
+ import readline from "node:readline";
8
9
 
9
10
  import sdkCreate from "@vertigis/sdk-library/scripts/create.js";
10
11
 
@@ -13,8 +14,9 @@ const dirName = path.dirname(fileURLToPath(import.meta.url));
13
14
  const rootDir = path.join(dirName, "..");
14
15
 
15
16
  // Target directory name.
16
- const createIndex = process.argv.findIndex(s => s.includes("create"));
17
- const directoryName = process.argv[createIndex + 1];
17
+ const cliArgs = process.argv.slice(2);
18
+ const createIdx = cliArgs.indexOf("create");
19
+ const directoryName = createIdx !== -1 ? cliArgs[createIdx + 1] : cliArgs[0];
18
20
 
19
21
  if (!directoryName) {
20
22
  console.error("Please specify the project directory name: vertigis-web-sdk create <project-name>");
@@ -24,7 +26,19 @@ if (!directoryName) {
24
26
  const targetPath = path.resolve(directoryName);
25
27
 
26
28
  // 1. Run standard VertiGIS base scaffolding
27
- sdkCreate(rootDir, directoryName, "web");
29
+ const rootPkgPath = path.join(rootDir, "package.json");
30
+ const originalRootPkg = fs.readFileSync(rootPkgPath, "utf-8");
31
+ try {
32
+ // Upstream sdkCreate expects @vertigis/web-sdk on npm to match selfVersion.
33
+ // Setting version to "latest" prevents notarget 404 errors during npm install.
34
+ const rootPkg = JSON.parse(originalRootPkg);
35
+ rootPkg.version = "latest";
36
+ fs.writeFileSync(rootPkgPath, JSON.stringify(rootPkg, null, 2), "utf-8");
37
+
38
+ sdkCreate(rootDir, directoryName, "web");
39
+ } finally {
40
+ fs.writeFileSync(rootPkgPath, originalRootPkg, "utf-8");
41
+ }
28
42
 
29
43
  // 2. Apply Enterprise Template Custom Overlay
30
44
  const customTemplateDir = path.join(rootDir, "template-custom");
@@ -81,9 +95,11 @@ if (fs.existsSync(customTemplateDir) && fs.existsSync(targetPath)) {
81
95
  pkg.scripts = pkg.scripts || {};
82
96
  pkg.scripts["cert:gen"] = "bash ./certs/generate-cert.sh";
83
97
  pkg.scripts["auth:portal"] = "node ./scripts/configure-portal.js";
98
+ pkg.scripts["skill:add"] = "npx --yes skills add davekazemi/vertigis-sdk-skills --skill vertigis-web-sdk-skill -y";
99
+ pkg.scripts["skills:add"] = "npx --yes skills add davekazemi/vertigis-sdk-skills -y";
84
100
 
85
101
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 4) + "\n", "utf-8");
86
- console.log("[ENTERPRISE] Added enterprise dependencies and auth:portal script to package.json");
102
+ console.log("[ENTERPRISE] Added enterprise dependencies, auth:portal, and skill:add scripts to package.json");
87
103
  } catch (e) {
88
104
  console.warn("[WARN] Failed to merge enterprise package.json dependencies:", e);
89
105
  }
@@ -104,12 +120,52 @@ if (fs.existsSync(customTemplateDir) && fs.existsSync(targetPath)) {
104
120
  }
105
121
  }
106
122
 
123
+ // 5. Prompt to install AI Coding Assistant Skill (https://github.com/davekazemi/vertigis-sdk-skills)
124
+ let shouldInstallSkill = false;
125
+ if (process.argv.includes("--skills") || process.argv.includes("--with-skills")) {
126
+ shouldInstallSkill = true;
127
+ } else if (process.argv.includes("--no-skills") || process.argv.includes("--without-skills")) {
128
+ shouldInstallSkill = false;
129
+ } else if (process.stdin.isTTY) {
130
+ const rl = readline.createInterface({
131
+ input: process.stdin,
132
+ output: process.stdout,
133
+ });
134
+ const answer = await new Promise(resolve => {
135
+ rl.question(
136
+ "\n? Would you like to install AI coding assistant skills from https://github.com/davekazemi/vertigis-sdk-skills into this project? [Y/n] ",
137
+ ans => {
138
+ rl.close();
139
+ resolve(ans.trim());
140
+ }
141
+ );
142
+ });
143
+ shouldInstallSkill = !answer || answer.toLowerCase().startsWith("y");
144
+ } else {
145
+ console.log("\n[INFO] Non-interactive mode: Run 'npm run skill:add' to install AI assistant skills.");
146
+ }
147
+
148
+ if (shouldInstallSkill) {
149
+ console.log("\n[SKILLS] Installing VertiGIS Web SDK skill into project repository via npx skills add...");
150
+ try {
151
+ execSync("npx --yes skills add davekazemi/vertigis-sdk-skills --skill vertigis-web-sdk-skill -y", {
152
+ stdio: "inherit",
153
+ cwd: targetPath,
154
+ });
155
+ console.log("✔ VertiGIS Web SDK skill installed successfully in .agents/skills/\n");
156
+ } catch (e) {
157
+ console.warn("[WARN] Automatic skill installation encountered an issue:", e.message);
158
+ console.log("[INFO] You can install it anytime by running: npm run skill:add\n");
159
+ }
160
+ }
161
+
107
162
  console.log("\n================================================================================");
108
163
  console.log(" [ENTERPRISE] VertiGIS Studio Web Extension successfully configured!");
109
164
  console.log(" - Centralized Design Tokens: src/tokens/ (100% safe fallbacks & color-mix)");
110
165
  console.log(" - Dynamic Dark/Light Theme: src/hooks/useIsDarkTheme.ts & src/utils/");
111
166
  console.log(" - Anti-God Component: src/components/CustomWidget/ (ErrorBoundary)");
112
167
  console.log(" - Portal Auth Config: npm run auth:portal (Enterprise Portal / AGOL OAuth)");
168
+ console.log(" - AI Assistant Skill: npm run skill:add (install/update from vertigis-sdk-skills)");
113
169
  console.log(" - Development Scripts: start.sh / start.bat, build.sh / build.bat");
114
170
  console.log(" - AI Directives: AGENTS.md pre-configured for coding assistants");
115
171
  console.log("================================================================================\n");
@@ -258,10 +258,15 @@ async function main() {
258
258
  if (webMap) {
259
259
  console.log(` - Web Map: ${webMap}`);
260
260
  }
261
- console.log("\n IMPORTANT PREREQUISITE in your Portal App Registration:");
262
- console.log(" Ensure the following Redirect URIs are registered in Portal:");
263
- console.log(" • https://localtest.me:3001");
264
- console.log(" • https://localtest.me:3001/oauth_callback.html");
261
+ console.log("\n IMPORTANT PREREQUISITES in your Portal Configuration:");
262
+ console.log(" 1. OAuth App Registration (Content > Add Item > Application):");
263
+ console.log(" Ensure Redirect URIs include:");
264
+ console.log(" • https://localtest.me:3001");
265
+ console.log(" • https://localtest.me:3001/oauth_callback.html");
266
+ console.log(" 2. Allowed Origins / CORS (Organization > Settings > Security > Allow Origins):");
267
+ console.log(" If cross-domain requests are restricted, whitelist your development origin:");
268
+ console.log(" • https://localtest.me:3001");
269
+ console.log(" (Note: ArcGIS Enterprise requires an FQDN and rejects bare \"localhost\")");
265
270
  console.log("\n Next Steps:");
266
271
  console.log(" Run: npm start (or ./start.sh)");
267
272
  console.log("================================================================================\n");