sceneview-mcp 4.3.2 → 4.3.3

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.
@@ -4,7 +4,7 @@
4
4
  // build time so the MCP server, telemetry, and the install-snippet
5
5
  // generators all report the actually-published versions instead of
6
6
  // stale hardcoded constants. See #941.
7
- export const PACKAGE_VERSION = "4.3.2";
7
+ export const PACKAGE_VERSION = "4.3.3";
8
8
  export const LATEST_SCENEVIEW_RELEASE = "4.72.0";
9
9
  // The pub.dev coordinate for `flutter_sceneview`, read from the plugin's
10
10
  // README. Deliberately NOT LATEST_SCENEVIEW_RELEASE: pub.dev lags the SDK,
package/dist/validator.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { LATEST_SCENEVIEW_RELEASE } from "./generated/version.js";
1
2
  import { didYouMean, isKnownTopLevelFunction, isKnownTypeName, knownTypeNames, membersOfClass, rememberHelperNames, resolveImport, } from "./symbols.js";
2
3
  function findLines(lines, pattern) {
3
4
  return lines.map((l, i) => (pattern.test(l) ? i + 1 : -1)).filter((n) => n !== -1);
@@ -13,7 +14,141 @@ function locallyDeclaredNames(code) {
13
14
  }
14
15
  return names;
15
16
  }
17
+ function outdatedSceneViewVersionIssue(artifact, version, line) {
18
+ const coordinate = `io.github.sceneview:${artifact}`;
19
+ return {
20
+ severity: "error",
21
+ rule: "setup/outdated-sceneview-version",
22
+ message: `\`${coordinate}:${version}\` is a pre-4.x release whose API no longer exists. Use \`${coordinate}:${LATEST_SCENEVIEW_RELEASE}\`, which also ships 16 KB page-size aligned native libraries (required by Google Play from February 1, 2027); if the app cannot move to compileSdk 37 / AGP 9 yet, use \`${coordinate}:4.18.0\`, the newest release that builds on AGP 8 / compileSdk 36. See the migration guide (\`get_migration_guide\`).`,
23
+ line,
24
+ };
25
+ }
16
26
  const RULES = [
27
+ // ─── Outdated SceneView dependency ──────────────────────────────────────
28
+ {
29
+ id: "setup/outdated-sceneview-version",
30
+ severity: "error",
31
+ check(_code, lines) {
32
+ const issues = [];
33
+ const directDependency = /io\.github\.sceneview:(sceneview|arsceneview|sceneview-compose):(\d+(?:\.\d+)*(?:-[0-9A-Za-z.-]+)?)(?=["'])/;
34
+ const directDependencies = new RegExp(directDependency.source, "g");
35
+ findLines(lines, directDependency).forEach((lineNumber) => {
36
+ for (const match of lines[lineNumber - 1].matchAll(directDependencies)) {
37
+ if (Number.parseInt(match[2], 10) < 4) {
38
+ issues.push(outdatedSceneViewVersionIssue(match[1], match[2], lineNumber));
39
+ }
40
+ }
41
+ });
42
+ const catalogSections = [];
43
+ let catalogSection = "";
44
+ lines.forEach((line) => {
45
+ const sectionMatch = line.match(/^\s*\[([^\]]+)]\s*(?:#.*)?$/);
46
+ if (sectionMatch) {
47
+ catalogSection = sectionMatch[1];
48
+ }
49
+ catalogSections.push(catalogSection);
50
+ });
51
+ // Version catalogs: resolve each SceneView entry of [libraries] to its
52
+ // literal version or to the [versions] key it references.
53
+ const versionValue = /(\d+(?:\.\d+)*(?:-[0-9A-Za-z.-]+)?)/.source;
54
+ const catalogVersions = new Map();
55
+ lines.forEach((line, index) => {
56
+ if (catalogSections[index] !== "versions")
57
+ return;
58
+ const m = line.match(new RegExp(`^\\s*([A-Za-z0-9_.-]+)\\s*=\\s*["']${versionValue}["']\\s*(?:#.*)?$`));
59
+ if (m)
60
+ catalogVersions.set(m[1], { version: m[2], line: index + 1 });
61
+ });
62
+ const reported = new Set(issues.map((issue) => issue.line));
63
+ lines.forEach((line, index) => {
64
+ if (catalogSections[index] !== "libraries")
65
+ return;
66
+ const artifactMatch = line.match(/\bmodule\s*=\s*["']io\.github\.sceneview:(sceneview|arsceneview|sceneview-compose)["']/) ??
67
+ (/\bgroup\s*=\s*["']io\.github\.sceneview["']/.test(line)
68
+ ? line.match(/\bname\s*=\s*["'](sceneview|arsceneview|sceneview-compose)["']/)
69
+ : null);
70
+ if (!artifactMatch)
71
+ return;
72
+ let found;
73
+ const inline = line.match(new RegExp(`\\bversion\\s*=\\s*["']${versionValue}["']`));
74
+ if (inline) {
75
+ found = { version: inline[1], line: index + 1 };
76
+ }
77
+ else {
78
+ const ref = line.match(/\bversion\.ref\s*=\s*["']([^"']+)["']/);
79
+ if (ref)
80
+ found = catalogVersions.get(ref[1]);
81
+ }
82
+ if (!found || Number.parseInt(found.version, 10) >= 4 || reported.has(found.line))
83
+ return;
84
+ reported.add(found.line);
85
+ issues.push(outdatedSceneViewVersionIssue(artifactMatch[1], found.version, found.line));
86
+ });
87
+ return issues;
88
+ },
89
+ },
90
+ // ─── Compose Multiplatform dependency with Android API ──────────────────
91
+ {
92
+ id: "setup/sceneview-compose-android-api",
93
+ severity: "error",
94
+ check(code, lines) {
95
+ const composeDependency = /io\.github\.sceneview:sceneview-compose(?::[^\s"')]+)?/;
96
+ if (!composeDependency.test(code))
97
+ return [];
98
+ // A KMP module can declare the façade for commonMain AND the Android
99
+ // artifact for androidMain: the Android API is then on the classpath.
100
+ if (/io\.github\.sceneview:(?:sceneview|arsceneview)(?::|["'\s)]|$)/m.test(code))
101
+ return [];
102
+ // Comments and string literals are not API usage.
103
+ // Strings first, so a "https://…" literal is not read as a line comment.
104
+ const codeOnly = code
105
+ .replace(/"(?:\\.|[^"\\\n])*"/g, '""')
106
+ .replace(/\/\*[\s\S]*?\*\//g, " ")
107
+ .replace(/\/\/[^\n]*/g, " ");
108
+ const localNames = locallyDeclaredNames(codeOnly);
109
+ const androidImport = /\bimport\s+io\.github\.sceneview\.(?!compose(?:\.|\b))/;
110
+ const androidNames = [
111
+ "Scene",
112
+ "SceneView",
113
+ "ARScene",
114
+ "ARSceneView",
115
+ "PlacementScene",
116
+ "AutoPlacementScene",
117
+ "rememberEngine",
118
+ "rememberModelLoader",
119
+ "rememberModelInstance",
120
+ "rememberEnvironmentLoader",
121
+ "rememberMaterialLoader",
122
+ "rememberView",
123
+ "rememberARView",
124
+ "ModelNode",
125
+ "AnchorNode",
126
+ "CubeNode",
127
+ "LightNode",
128
+ ];
129
+ // A call (`Name(` or `Name {`) to an Android name the snippet does not declare itself.
130
+ const calledAndroidNames = androidNames.filter((name) => !localNames.has(name) && new RegExp(`\\b${name}\\s*[({]`).test(codeOnly));
131
+ if (!androidImport.test(codeOnly) && calledAndroidNames.length === 0)
132
+ return [];
133
+ const arNames = new Set([
134
+ "ARScene",
135
+ "ARSceneView",
136
+ "PlacementScene",
137
+ "AutoPlacementScene",
138
+ "rememberARView",
139
+ "AnchorNode",
140
+ ]);
141
+ const isAr = /\bimport\s+io\.github\.sceneview\.ar(?:\.|\b)/.test(codeOnly) ||
142
+ calledAndroidNames.some((name) => arNames.has(name));
143
+ const coordinate = isAr ? "io.github.sceneview:arsceneview" : "io.github.sceneview:sceneview";
144
+ return findLines(lines, composeDependency).map((line) => ({
145
+ severity: "error",
146
+ rule: "setup/sceneview-compose-android-api",
147
+ message: `\`sceneview-compose\` is the Compose Multiplatform \`SceneViewer\` façade and does not expose the Android \`io.github.sceneview.*\` API. Use \`${coordinate}\` instead.`,
148
+ line,
149
+ }));
150
+ },
151
+ },
17
152
  // ─── Threading ────────────────────────────────────────────────────────────
18
153
  {
19
154
  id: "threading/filament-off-main-thread",
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "sceneview-mcp",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "mcpName": "io.github.sceneview/mcp",
5
- "description": "MCP server for SceneView — cross-platform 3D & AR SDK for Android and iOS. Gives your AI coding assistant the full SceneView SDK so it writes correct, compilable code.",
5
+ "description": "MCP server for SceneView, the 3D & AR SDK for Android and the web. Gives your AI coding assistant the full SceneView SDK so it writes correct, compilable code.",
6
6
  "keywords": [
7
7
  "mcp",
8
8
  "model-context-protocol",