catalyst-core 0.1.0-canary.9 → 0.2.0-beta.2
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 +1 -1
- package/bin/catalyst.js +8 -1
- package/changelog.md +6 -0
- package/dist/native/androidProject/app/build.gradle.kts +34 -8
- package/dist/native/androidProject/app/src/main/AndroidManifest.xml +2 -1
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/BridgeMessageValidator.kt +1 -1
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/CustomWebview.kt +270 -78
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MainActivity.kt +34 -5
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +149 -1
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeCameraManager.kt +337 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/OfflineCacheService.kt +374 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/TransitionManager.kt +202 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/WebCacheManager.kt +156 -39
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/BarcodeDetector.kt +123 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/CameraSessionManager.kt +244 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/HoldController.kt +70 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/TorchController.kt +57 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/VideoStreamState.kt +41 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/VideoStreamStateMachine.kt +40 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/ViewfinderMapper.kt +75 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/ZoomController.kt +156 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/plugins/CatalystPlugin.kt +7 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/plugins/GeneratedPluginIndex.kt +6 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/plugins/PluginBridge.kt +253 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/security/FridaDetector.kt +16 -5
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/BridgeUtils.kt +42 -5
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +7 -3
- package/dist/native/androidProject/app/src/main/res/drawable/debug_viewfinder_border.xml +8 -0
- package/dist/native/androidProject/app/src/main/res/layout/activity_main.xml +37 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/CustomWebviewTest.kt +7 -2
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/plugins/PluginBridgeTest.kt +139 -0
- package/dist/native/androidSetup.js +1 -0
- package/dist/native/bridge/WebBridge.js +5 -5
- package/dist/native/bridge/constants/NativeInterfaces.js +9 -5
- package/dist/native/bridge/hooks/index.js +1 -0
- package/dist/native/bridge/hooks/useCamera.js +9 -0
- package/dist/native/bridge/hooks/useDataProtection.js +2 -0
- package/dist/native/bridge/hooks/useDeviceInfo.js +2 -0
- package/dist/native/bridge/hooks/useFilePicker.js +2 -0
- package/dist/native/bridge/hooks/useGoogleSignIn.js +1 -0
- package/dist/native/bridge/hooks/useHapticFeedback.js +1 -0
- package/dist/native/bridge/hooks/useIntent.js +1 -0
- package/dist/native/bridge/hooks/useNativeTransition.js +43 -0
- package/dist/native/bridge/hooks/useNetworkStatus.js +3 -0
- package/dist/native/bridge/hooks/useNotification.js +2 -0
- package/dist/native/bridge/hooks/useSafeArea.js +2 -0
- package/dist/native/bridge/hooks/useVideoStream.js +6 -0
- package/dist/native/bridge/hooks/utils.js +1 -0
- package/dist/native/bridge/hooks.js +1 -137
- package/dist/native/bridge/useBaseHook.js +12 -7
- package/dist/native/bridge/utils/NativeBridge.js +41 -6
- package/dist/native/buildAndroid/assets.js +52 -0
- package/dist/native/buildAndroid/build.js +19 -0
- package/dist/native/buildAndroid/config.js +1 -0
- package/dist/native/buildAndroid/index.js +1 -0
- package/dist/native/buildAppAndroid.js +2 -150
- package/dist/native/buildAppIos.js +2 -312
- package/dist/native/buildIos/assets.js +8 -0
- package/dist/native/buildIos/build.js +40 -0
- package/dist/native/buildIos/config.js +71 -0
- package/dist/native/buildIos/index.js +6 -0
- package/dist/native/buildIos/plugins.js +45 -0
- package/dist/native/internalPluginUtils.js +7 -0
- package/dist/native/iosnativeWebView/Package.resolved +36 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/BarcodeDetector.swift +116 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/CameraPreviewView.swift +58 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/CameraSessionManager.swift +308 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/HoldController.swift +63 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/NativeCameraManager.swift +194 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/TorchController.swift +60 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/VideoStreamState.swift +44 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/VideoStreamStateMachine.swift +60 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/ZoomController.swift +130 -0
- package/dist/native/iosnativeWebView/Sources/Core/Constants/CatalystConstants.swift +11 -1
- package/dist/native/iosnativeWebView/Sources/Core/Constants/ConfigConstants.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/Plugins/CatalystPlugin.swift +5 -0
- package/dist/native/iosnativeWebView/Sources/Core/Plugins/GeneratedPluginIndex.swift +6 -0
- package/dist/native/iosnativeWebView/Sources/Core/Plugins/PluginBridge.swift +364 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +39 -4
- package/dist/native/iosnativeWebView/Sources/Core/Utils/OfflineCacheService.swift +683 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/OfflineURLSchemeHandler.swift +94 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +19 -6
- package/dist/native/iosnativeWebView/Sources/Core/Utils/SafeAreaUtils.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +4 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +227 -4
- package/dist/native/iosnativeWebView/Sources/Core/WebView/TransitionManager.swift +169 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WeakScriptMessageHandler.swift +14 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +53 -8
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +88 -4
- package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +30 -11
- package/dist/native/iosnativeWebView/iosnativeWebView/Info.plist +11 -17
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +8 -2
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/BootTimingUtilityTests.swift +1 -1
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/ConfigMappingTests.swift +4 -2
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/PluginBridgeTests.swift +160 -0
- package/dist/native/plugin-bridge/PluginBridge.js +1 -0
- package/dist/native/pluginComposerAndroid.js +28 -0
- package/dist/native/pluginComposerIos.js +16 -0
- package/dist/native/renameAndroidProject.js +5 -5
- package/dist/native/setupEmulatorIos.js +6 -4
- package/dist/native/setupServer.js +2 -3
- package/dist/native/utils.js +4 -1
- package/dist/offline/catalyst-sw.js +1 -0
- package/dist/offline/registerServiceWorker.js +1 -0
- package/dist/otel.js +70 -2
- package/dist/router/ClientRouter.js +1 -1
- package/dist/scripts/build.js +1 -1
- package/dist/scripts/cleanCache.js +1 -0
- package/dist/scripts/devBuild.js +1 -1
- package/dist/scripts/devServe.js +1 -1
- package/dist/scripts/generateOfflineManifest.js +1 -0
- package/dist/scripts/loadEnvironmentVariables.js +1 -2
- package/dist/scripts/plugins.js +1 -0
- package/dist/scripts/registerAliases.js +6 -2
- package/dist/scripts/scriptUtils.js +2 -1
- package/dist/scripts/serve.js +2 -1
- package/dist/scripts/start.js +7 -2
- package/dist/server/expressServer.js +4 -8
- package/dist/server/renderer/document/Body.js +4 -4
- package/dist/server/renderer/document/Head.js +2 -2
- package/dist/server/renderer/extract.js +31 -27
- package/dist/server/renderer/handler.js +47 -24
- package/dist/server/renderer/index.js +1 -1
- package/dist/server/startServer.js +57 -7
- package/dist/server/utils/userAgentUtil.js +9 -3
- package/dist/server/utils/validator.js +1 -1
- package/dist/webpack/babel-plugins/remove-client.plugin.js +2 -2
- package/dist/webpack/babel-plugins/remove-ssr.plugin.js +2 -2
- package/dist/webpack/babel.config.client.js +1 -1
- package/dist/webpack/babel.config.ssr.js +1 -1
- package/dist/webpack/base.babel.js +7 -8
- package/dist/webpack/development.client.babel.js +7 -16
- package/dist/webpack/production.client.babel.js +1 -1
- package/dist/webpack/production.ssr.babel.js +5 -1
- package/mcp_v2/knowledge-base.json +206 -100
- package/mcp_v2/lib/helpers.js +42 -8
- package/mcp_v2/lib/seed.js +88 -0
- package/mcp_v2/mcp.js +150 -4
- package/mcp_v2/setup.js +30 -193
- package/mcp_v2/tools/build.js +1 -1
- package/mcp_v2/tools/config.js +16 -4
- package/mcp_v2/tools/conversion.js +11 -11
- package/mcp_v2/tools/github.js +1117 -0
- package/mcp_v2/tools/knowledge.js +16 -3
- package/mcp_v2/tools/sync.js +179 -10
- package/mcp_v2/tools/tasks.js +13 -4
- package/package.json +20 -8
|
@@ -55,11 +55,20 @@ function fetchRaw(url) {
|
|
|
55
55
|
})
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
// Only allow known tag shapes or "main" — guards against a tampered/malformed
|
|
59
|
+
// installed version string being interpolated into the GitHub fetch URL.
|
|
60
|
+
// Covers all observed formats:
|
|
61
|
+
// v0.1.0, v0.1.0-canary.8, v0.0.3-canary-18, v0.1.0-beta.2
|
|
62
|
+
function sanitizeGithubTag(version) {
|
|
63
|
+
if (!version) return "main"
|
|
64
|
+
return /^v\d+\.\d+\.\d+(-[a-zA-Z0-9]+([.-]\d+)?)?$/.test(version) ? version : "main"
|
|
65
|
+
}
|
|
66
|
+
|
|
58
67
|
// Fetch first available file — used for KB-miss GitHub fallback
|
|
59
68
|
async function fetchFromGithub(files, installedVersion) {
|
|
60
69
|
if (!files || files.length === 0) return null
|
|
61
70
|
|
|
62
|
-
const tag = installedVersion
|
|
71
|
+
const tag = sanitizeGithubTag(installedVersion)
|
|
63
72
|
const base = `https://raw.githubusercontent.com/tata1mg/catalyst-core/${tag}`
|
|
64
73
|
|
|
65
74
|
for (const file of files) {
|
|
@@ -88,9 +97,13 @@ async function fetchFromGithub(files, installedVersion) {
|
|
|
88
97
|
return null
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
// Build FTS5 query string from keywords array — each term ORed, quoted for safety
|
|
100
|
+
// Build FTS5 query string from keywords array — each term ORed, quoted for safety.
|
|
101
|
+
// Strip all FTS5 special characters before quoting so keywords are treated as literals.
|
|
92
102
|
function buildFtsQuery(keywords) {
|
|
93
|
-
return keywords
|
|
103
|
+
return keywords
|
|
104
|
+
.map((k) => `"${k.replace(/[^a-zA-Z0-9 _-]/g, " ").trim()}"`)
|
|
105
|
+
.filter((k) => k.length > 2) // drop empty/whitespace-only terms after stripping
|
|
106
|
+
.join(" OR ")
|
|
94
107
|
}
|
|
95
108
|
|
|
96
109
|
function stripGithubFiles(rows) {
|
package/mcp_v2/tools/sync.js
CHANGED
|
@@ -1,23 +1,192 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
|
|
3
|
+
const fs = require("fs")
|
|
4
|
+
const path = require("path")
|
|
5
|
+
const https = require("https")
|
|
6
|
+
const http = require("http")
|
|
7
|
+
const crypto = require("crypto")
|
|
8
|
+
const { URL } = require("url")
|
|
9
|
+
|
|
10
|
+
const { seedKnowledgeBase } = require("../lib/seed")
|
|
11
|
+
const knowledge = require("./knowledge")
|
|
12
|
+
|
|
13
|
+
const KB_GITHUB_URL =
|
|
14
|
+
"https://raw.githubusercontent.com/tata1mg/catalyst-core/main/packages/catalyst-core/mcp_v2/knowledge-base.json"
|
|
15
|
+
const GITHUB_RAW_HOST = "raw.githubusercontent.com"
|
|
16
|
+
const KB_PATH = path.join(__dirname, "..", "knowledge-base.json")
|
|
17
|
+
const KB_MAX_BYTES = 4 * 1024 * 1024
|
|
18
|
+
const MAX_REDIRECTS = 5
|
|
19
|
+
const SOCKET_TIMEOUT_MS = 15_000
|
|
20
|
+
|
|
3
21
|
let _db
|
|
4
22
|
|
|
5
23
|
function init(db) {
|
|
6
24
|
_db = db
|
|
7
25
|
}
|
|
8
26
|
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
function fetchUrl(url, opts = {}) {
|
|
28
|
+
const { allowedHost = GITHUB_RAW_HOST, maxBytes = KB_MAX_BYTES, redirectsLeft = MAX_REDIRECTS } = opts
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
let parsed
|
|
31
|
+
try {
|
|
32
|
+
parsed = new URL(url)
|
|
33
|
+
} catch {
|
|
34
|
+
return reject(new Error(`Invalid URL: ${url}`))
|
|
35
|
+
}
|
|
36
|
+
if (parsed.hostname !== allowedHost) {
|
|
37
|
+
return reject(new Error(`Refusing off-host fetch: ${parsed.hostname}`))
|
|
38
|
+
}
|
|
39
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
40
|
+
return reject(new Error(`Unsupported protocol: ${parsed.protocol}`))
|
|
41
|
+
}
|
|
42
|
+
const mod = parsed.protocol === "https:" ? https : http
|
|
43
|
+
const req = mod.get(
|
|
44
|
+
url,
|
|
45
|
+
{ headers: { "User-Agent": "catalyst-mcp/2.0 sync_knowledge_base" } },
|
|
46
|
+
(res) => {
|
|
47
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
48
|
+
res.resume()
|
|
49
|
+
if (redirectsLeft <= 0) return reject(new Error("Too many redirects"))
|
|
50
|
+
let next
|
|
51
|
+
try {
|
|
52
|
+
next = new URL(res.headers.location, url).toString()
|
|
53
|
+
} catch {
|
|
54
|
+
return reject(new Error(`Invalid redirect target: ${res.headers.location}`))
|
|
55
|
+
}
|
|
56
|
+
return fetchUrl(next, {
|
|
57
|
+
allowedHost,
|
|
58
|
+
maxBytes,
|
|
59
|
+
redirectsLeft: redirectsLeft - 1,
|
|
60
|
+
}).then(resolve, reject)
|
|
61
|
+
}
|
|
62
|
+
if (res.statusCode !== 200) {
|
|
63
|
+
res.resume()
|
|
64
|
+
return reject(new Error(`HTTP ${res.statusCode}`))
|
|
65
|
+
}
|
|
66
|
+
let bytes = 0
|
|
67
|
+
const chunks = []
|
|
68
|
+
res.on("data", (chunk) => {
|
|
69
|
+
bytes += chunk.length
|
|
70
|
+
if (bytes > maxBytes) {
|
|
71
|
+
req.destroy(new Error(`Response exceeded ${maxBytes} bytes`))
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
chunks.push(chunk)
|
|
75
|
+
})
|
|
76
|
+
res.on("end", () => {
|
|
77
|
+
if (bytes > maxBytes) return
|
|
78
|
+
resolve(Buffer.concat(chunks).toString("utf8"))
|
|
79
|
+
})
|
|
80
|
+
res.on("error", reject)
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
req.setTimeout(SOCKET_TIMEOUT_MS, () => {
|
|
84
|
+
req.destroy(new Error(`Socket idle timeout after ${SOCKET_TIMEOUT_MS}ms`))
|
|
85
|
+
})
|
|
86
|
+
req.on("error", reject)
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function contentHash(text) {
|
|
91
|
+
return crypto.createHash("sha256").update(text).digest("hex").slice(0, 16)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function syncKnowledgeBaseFromGithub({ force = false } = {}) {
|
|
95
|
+
let remoteText
|
|
96
|
+
try {
|
|
97
|
+
remoteText = await fetchUrl(KB_GITHUB_URL, {
|
|
98
|
+
allowedHost: GITHUB_RAW_HOST,
|
|
99
|
+
maxBytes: KB_MAX_BYTES,
|
|
100
|
+
})
|
|
101
|
+
} catch (e) {
|
|
102
|
+
return { kb_changed: false, kb_url: KB_GITHUB_URL, error: `kb_fetch_failed: ${e.message}` }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let parsed
|
|
106
|
+
try {
|
|
107
|
+
parsed = JSON.parse(remoteText)
|
|
108
|
+
} catch (e) {
|
|
109
|
+
return { kb_changed: false, kb_url: KB_GITHUB_URL, error: `kb_invalid_json: ${e.message}` }
|
|
110
|
+
}
|
|
111
|
+
if (!Array.isArray(parsed)) {
|
|
112
|
+
return {
|
|
113
|
+
kb_changed: false,
|
|
114
|
+
kb_url: KB_GITHUB_URL,
|
|
115
|
+
error: "kb_invalid_format: expected JSON array at the top level",
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const remoteHash = contentHash(remoteText)
|
|
120
|
+
let localHash = null
|
|
121
|
+
if (fs.existsSync(KB_PATH)) {
|
|
122
|
+
try {
|
|
123
|
+
localHash = contentHash(fs.readFileSync(KB_PATH, "utf8"))
|
|
124
|
+
} catch {
|
|
125
|
+
localHash = null
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (!force && localHash === remoteHash) {
|
|
130
|
+
return {
|
|
131
|
+
kb_changed: false,
|
|
132
|
+
kb_url: KB_GITHUB_URL,
|
|
133
|
+
kb_hash: remoteHash,
|
|
134
|
+
message: "knowledge-base.json already in sync with main branch.",
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const tmpPath = `${KB_PATH}.tmp.${process.pid}`
|
|
139
|
+
try {
|
|
140
|
+
fs.writeFileSync(tmpPath, remoteText)
|
|
141
|
+
fs.renameSync(tmpPath, KB_PATH)
|
|
142
|
+
} catch (e) {
|
|
143
|
+
try {
|
|
144
|
+
if (fs.existsSync(tmpPath)) fs.unlinkSync(tmpPath)
|
|
145
|
+
} catch {
|
|
146
|
+
// ignore cleanup failure
|
|
147
|
+
}
|
|
148
|
+
return { kb_changed: false, kb_url: KB_GITHUB_URL, error: `kb_write_failed: ${e.message}` }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let counts
|
|
152
|
+
try {
|
|
153
|
+
counts = seedKnowledgeBase(_db, KB_PATH)
|
|
154
|
+
// Rebuild fk_fts so rowids match the freshly-inserted framework_knowledge ids.
|
|
155
|
+
_db.exec(`DROP TABLE IF EXISTS fk_fts`)
|
|
156
|
+
knowledge.init(_db)
|
|
157
|
+
} catch (e) {
|
|
158
|
+
return {
|
|
159
|
+
kb_changed: true,
|
|
160
|
+
kb_url: KB_GITHUB_URL,
|
|
161
|
+
kb_hash: remoteHash,
|
|
162
|
+
error: `kb_reseed_failed: ${e.message}`,
|
|
163
|
+
message: "knowledge-base.json written to disk but DB re-seed failed.",
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
kb_changed: true,
|
|
169
|
+
kb_url: KB_GITHUB_URL,
|
|
170
|
+
kb_hash: remoteHash,
|
|
171
|
+
kb_knowledge_count: counts.knowledgeCount,
|
|
172
|
+
kb_error_count: counts.errorCount,
|
|
173
|
+
message: "knowledge-base.json updated from main branch and re-seeded into context.db.",
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async function handle_sync_knowledge_base({ force = false } = {}) {
|
|
178
|
+
const knowledge_base = await syncKnowledgeBaseFromGithub({ force })
|
|
14
179
|
return {
|
|
15
|
-
|
|
180
|
+
synced_at: new Date().toISOString(),
|
|
16
181
|
force,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
message:
|
|
182
|
+
knowledge_base,
|
|
183
|
+
error: knowledge_base.error || null,
|
|
184
|
+
message:
|
|
185
|
+
knowledge_base.message ||
|
|
186
|
+
(knowledge_base.error
|
|
187
|
+
? `knowledge-base.json sync failed: ${knowledge_base.error}`
|
|
188
|
+
: "knowledge-base.json sync complete."),
|
|
20
189
|
}
|
|
21
190
|
}
|
|
22
191
|
|
|
23
|
-
module.exports = { init,
|
|
192
|
+
module.exports = { init, handle_sync_knowledge_base }
|
package/mcp_v2/tools/tasks.js
CHANGED
|
@@ -26,6 +26,14 @@ function now() {
|
|
|
26
26
|
return new Date().toISOString().replace("T", " ").slice(0, 19)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
function projectPath(projectRoot, rel) {
|
|
30
|
+
const normalized = path.normalize(rel)
|
|
31
|
+
if (path.isAbsolute(normalized) || normalized === ".." || normalized.startsWith(`..${path.sep}`)) {
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
return `${projectRoot}${path.sep}${normalized}`
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
// ─── Improvement 1: Resolve needs_review inline before plan write ─────────────
|
|
30
38
|
//
|
|
31
39
|
// Reads signal_files from disk for each needs_review task.
|
|
@@ -67,7 +75,8 @@ function resolveNeedsReview(task, projectRoot) {
|
|
|
67
75
|
let nativeBranchFound = false
|
|
68
76
|
for (const f of samplesToCheck) {
|
|
69
77
|
try {
|
|
70
|
-
const absPath = path.isAbsolute(f) ? f :
|
|
78
|
+
const absPath = path.isAbsolute(f) ? f : projectPath(projectRoot, f)
|
|
79
|
+
if (!absPath) continue
|
|
71
80
|
const content = fs.readFileSync(absPath, "utf8")
|
|
72
81
|
if (hookRegex && hookRegex.test(content)) {
|
|
73
82
|
nativeBranchFound = true
|
|
@@ -411,12 +420,12 @@ function summarisePlan(plan) {
|
|
|
411
420
|
// ─── MD file helpers ─────────────────────────────────────────────────────────
|
|
412
421
|
|
|
413
422
|
function getMdPath(projectRoot, slug) {
|
|
414
|
-
return path.
|
|
423
|
+
return `${projectRoot}${path.sep}.mcp_tasks${path.sep}${slug}.md`
|
|
415
424
|
}
|
|
416
425
|
|
|
417
426
|
function buildUserReviewWarnings(projectRoot) {
|
|
418
427
|
const warnings = []
|
|
419
|
-
const configPath = path.
|
|
428
|
+
const configPath = `${projectRoot}${path.sep}config${path.sep}config.json`
|
|
420
429
|
let config = null
|
|
421
430
|
try {
|
|
422
431
|
config = JSON.parse(fs.readFileSync(configPath, "utf8"))
|
|
@@ -463,7 +472,7 @@ function buildUserReviewWarnings(projectRoot) {
|
|
|
463
472
|
}
|
|
464
473
|
|
|
465
474
|
function writeMdFile(projectRoot, slug, goal, steps, bareMinimum, userReviewWarnings) {
|
|
466
|
-
const dir = path.
|
|
475
|
+
const dir = `${projectRoot}${path.sep}.mcp_tasks`
|
|
467
476
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
|
|
468
477
|
|
|
469
478
|
const mdPath = getMdPath(projectRoot, slug)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "catalyst-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-beta.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"description": "Web framework that provides great performance out of the box",
|
|
6
6
|
"bin": {
|
|
@@ -59,11 +59,10 @@
|
|
|
59
59
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
60
60
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
61
61
|
"@svgr/webpack": "^8.1.0",
|
|
62
|
-
"@tata1mg/router": "0.0
|
|
62
|
+
"@tata1mg/router": "0.1.0-beta",
|
|
63
63
|
"app-root-path": "^3.1.0",
|
|
64
64
|
"babel-loader": "^9.1.3",
|
|
65
65
|
"babel-plugin-react-compiler": "^19.0.0-beta-decd7b8-20250118",
|
|
66
|
-
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
67
66
|
"body-parser": "^1.20.2",
|
|
68
67
|
"chokidar": "^3.6.0",
|
|
69
68
|
"compression": "^1.7.4",
|
|
@@ -81,13 +80,12 @@
|
|
|
81
80
|
"picocolors": "^1.0.0",
|
|
82
81
|
"postcss-loader": "^7.3.3",
|
|
83
82
|
"postcss-scss": "^4.0.9",
|
|
84
|
-
"react": "
|
|
83
|
+
"react": "19.0.0",
|
|
85
84
|
"react-compiler-runtime": "^19.0.0-beta-decd7b8-20250118",
|
|
86
|
-
"react-dom": "
|
|
87
|
-
"react-redux": "^
|
|
85
|
+
"react-dom": "19.0.0",
|
|
86
|
+
"react-redux": "^9.2.0",
|
|
88
87
|
"react-refresh": "^0.14.0",
|
|
89
88
|
"react-router-dom": "^6.16.0",
|
|
90
|
-
"redux": "^4.2.1",
|
|
91
89
|
"sass": "^1.69.5",
|
|
92
90
|
"sass-loader": "^13.3.2",
|
|
93
91
|
"sass-resources-loader": "^2.2.5",
|
|
@@ -97,7 +95,7 @@
|
|
|
97
95
|
"webpack": "^5.88.2",
|
|
98
96
|
"webpack-bundle-analyzer": "^4.9.1",
|
|
99
97
|
"webpack-cli": "^5.1.4",
|
|
100
|
-
"webpack-dev-server": "^
|
|
98
|
+
"webpack-dev-server": "^5.2.4",
|
|
101
99
|
"webpack-merge": "^5.9.0",
|
|
102
100
|
"webpack-node-externals": "^3.0.0",
|
|
103
101
|
"winston": "^3.11.0",
|
|
@@ -115,5 +113,19 @@
|
|
|
115
113
|
"eslint-plugin-risxss": "^2.1.0",
|
|
116
114
|
"eslint-plugin-security": "^3.0.0",
|
|
117
115
|
"prettier": "^3.2.5"
|
|
116
|
+
},
|
|
117
|
+
"overrides": {
|
|
118
|
+
"@loadable/component": {
|
|
119
|
+
"react": "^16.3.0 || ^17.0.0 || ^18.0.0 || 19.0.0"
|
|
120
|
+
},
|
|
121
|
+
"@loadable/server": {
|
|
122
|
+
"react": "^16.3.0 || ^17.0.0 || ^18.0.0 || 19.0.0"
|
|
123
|
+
},
|
|
124
|
+
"uuid": "11.1.1",
|
|
125
|
+
"file-type": "22.0.1",
|
|
126
|
+
"imagemin": "9.0.1",
|
|
127
|
+
"webpack-dev-server": {
|
|
128
|
+
"http-proxy-middleware": "3.0.7"
|
|
129
|
+
}
|
|
118
130
|
}
|
|
119
131
|
}
|