@geosynk/vertigis-web-sdk 1.0.5 → 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,13 +171,28 @@ 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
- 4. Copy the generated **App ID / Client ID** (e.g., `myPortalAppId123`).
184
+ 4. Copy the generated **Client ID** (App ID) (e.g., `myClientId123`).
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.
181
196
 
182
197
  #### Step 2: Run the Automated Portal Configurator
183
198
  Run the interactive configurator in your project:
@@ -186,7 +201,7 @@ npm run auth:portal
186
201
  ```
187
202
  You will be prompted for:
188
203
  - **Portal URL** `[Required]`: Your Enterprise Portal instance (e.g., `https://gis.{org}.com/portal`).
189
- - **App ID (Client ID)** `[Required]`: The App ID obtained from Step 1.
204
+ - **Client ID** `[Required]`: The OAuth Application Client ID obtained from Step 1.
190
205
  - **Account ID** `[Optional]`: Organization identifier (e.g., `{org}` or `enterprise`).
191
206
  - **Web Map Item ID or URL** `[Optional]`: If provided, automatically updates `webMap` in `app/app.json`. If omitted, your current `app.json` remains untouched.
192
207
 
@@ -195,14 +210,15 @@ Or execute directly via non-interactive CLI flags:
195
210
  # Minimal (configures Portal OAuth, leaves current app.json untouched):
196
211
  npm run auth:portal -- \
197
212
  --portal https://gis.{org}.com/portal \
198
- --app-id myPortalAppId123
213
+ --client-id myClientId123
199
214
 
200
215
  # Full (configures Portal OAuth AND updates app.json web map):
201
216
  npm run auth:portal -- \
202
217
  --portal https://gis.{org}.com/portal \
203
- --app-id myPortalAppId123 \
218
+ --client-id myClientId123 \
204
219
  --webmap 4f970e5d0a684b0f9f30cf00fa0119e6
205
220
  ```
221
+ *(Note: `--app-id` and `--clientId` are also supported as aliases).*
206
222
 
207
223
  #### Step 3: Start Development Server
208
224
  ```bash
@@ -223,6 +239,27 @@ When accessing `https://localtest.me:3001/`, VertiGIS Web automatically triggers
223
239
 
224
240
  ---
225
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
+
226
263
  ## Upstream Synchronization
227
264
 
228
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.5",
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");
@@ -26,7 +26,7 @@ Usage:
26
26
 
27
27
  Options:
28
28
  --portal <url> [Required] ArcGIS Enterprise Portal or AGOL URL (e.g. https://gis.{org}.com/portal)
29
- --app-id <id> [Required] Portal OAuth Application Client ID / App ID
29
+ --client-id <id> [Required] Portal OAuth Application Client ID
30
30
  --account-id <id> [Optional] Account ID / Org slug (default: derived from hostname or "enterprise")
31
31
  --webmap <id-or-url> [Optional] Web Map Item ID or full URL to update in app.json
32
32
  --reset Revert back to public sample ArcGIS Online map and disable portal auth
@@ -37,7 +37,7 @@ Examples:
37
37
  npm run auth:portal
38
38
 
39
39
  Direct CLI Mode:
40
- npm run auth:portal -- --portal https://gis.example.com/portal --app-id MyClientId123 --webmap 4f970e5d0a684b0f9f30cf00fa0119e6
40
+ npm run auth:portal -- --portal https://gis.{org}.com/portal --client-id myClientId123
41
41
 
42
42
  Reset to Defaults:
43
43
  npm run auth:portal -- --reset
@@ -107,7 +107,7 @@ async function main() {
107
107
  }
108
108
 
109
109
  let portalUrl = getArgValue("--portal");
110
- let appId = getArgValue("--app-id") || getArgValue("--client-id");
110
+ let appId = getArgValue("--client-id") || getArgValue("--clientId") || getArgValue("--app-id");
111
111
  let accountId = getArgValue("--account-id");
112
112
  let webMap = getArgValue("--webmap") || getArgValue("--webMap");
113
113
 
@@ -138,12 +138,12 @@ async function main() {
138
138
 
139
139
  appId = appId || await prompt(
140
140
  rl,
141
- "Portal OAuth Application App ID (Client ID)",
142
- existingConfig.appId || ""
141
+ "Portal OAuth Application Client ID",
142
+ existingConfig.clientId || existingConfig.appId || ""
143
143
  );
144
144
 
145
145
  if (!appId) {
146
- console.error("\n✖ Error: App ID (Client ID) is required to configure OAuth.");
146
+ console.error("\n✖ Error: Client ID is required to configure OAuth.");
147
147
  rl.close();
148
148
  process.exit(1);
149
149
  }
@@ -253,15 +253,20 @@ async function main() {
253
253
  console.log(" [SUCCESS] ArcGIS Enterprise Portal Authentication Configured!");
254
254
  console.log("================================================================================");
255
255
  console.log(` - Portal: ${portalUrl}`);
256
- console.log(` - App ID: ${appId}`);
256
+ console.log(` - Client ID: ${appId}`);
257
257
  console.log(` - Account ID: ${accountId}`);
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");