infrawise 0.8.0 → 0.8.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/dist/context/index.js +36 -21
- package/package.json +2 -2
package/dist/context/index.js
CHANGED
|
@@ -151,6 +151,36 @@ function detectDynamoOperations(callExpr, filePath) {
|
|
|
151
151
|
}
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
|
+
function resolveStringValue(node, sourceFile) {
|
|
155
|
+
if (Node.isStringLiteral(node)) {
|
|
156
|
+
return node.getLiteralValue();
|
|
157
|
+
}
|
|
158
|
+
if (Node.isNoSubstitutionTemplateLiteral(node)) {
|
|
159
|
+
return node.getLiteralText();
|
|
160
|
+
}
|
|
161
|
+
if (Node.isTemplateExpression(node)) {
|
|
162
|
+
let result = node.getHead().getLiteralText();
|
|
163
|
+
for (const span of node.getTemplateSpans()) {
|
|
164
|
+
const resolved = resolveStringValue(span.getExpression(), sourceFile);
|
|
165
|
+
if (resolved === null)
|
|
166
|
+
return null;
|
|
167
|
+
result += resolved + span.getLiteral().getLiteralText();
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
if (Node.isIdentifier(node)) {
|
|
172
|
+
const name = node.getText();
|
|
173
|
+
const decl = sourceFile
|
|
174
|
+
.getDescendantsOfKind(SyntaxKind.VariableDeclaration)
|
|
175
|
+
.find((d) => d.getName() === name);
|
|
176
|
+
if (decl) {
|
|
177
|
+
const init = decl.getInitializer();
|
|
178
|
+
if (init)
|
|
179
|
+
return resolveStringValue(init, sourceFile);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
154
184
|
function extractSqlTableName(sql) {
|
|
155
185
|
// Try to extract table name from common SQL patterns
|
|
156
186
|
const patterns = [
|
|
@@ -183,17 +213,9 @@ function detectPostgresOperations(callExpr, filePath) {
|
|
|
183
213
|
objText.includes('conn')) {
|
|
184
214
|
let tableName = 'unknown';
|
|
185
215
|
if (args.length > 0) {
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
tableName = extractSqlTableName(
|
|
189
|
-
}
|
|
190
|
-
else if (Node.isNoSubstitutionTemplateLiteral(firstArg)) {
|
|
191
|
-
tableName = extractSqlTableName(firstArg.getLiteralText());
|
|
192
|
-
}
|
|
193
|
-
else if (Node.isTemplateExpression(firstArg)) {
|
|
194
|
-
// Template literal — extract what we can from the head
|
|
195
|
-
tableName = extractSqlTableName(firstArg.getHead().getLiteralText());
|
|
196
|
-
}
|
|
216
|
+
const sql = resolveStringValue(args[0], callExpr.getSourceFile());
|
|
217
|
+
if (sql !== null)
|
|
218
|
+
tableName = extractSqlTableName(sql);
|
|
197
219
|
}
|
|
198
220
|
return {
|
|
199
221
|
functionName: getEnclosingFunctionName(callExpr),
|
|
@@ -270,16 +292,9 @@ function detectMySQLOperations(callExpr, filePath) {
|
|
|
270
292
|
if (isMysqlClient) {
|
|
271
293
|
let tableName = 'unknown';
|
|
272
294
|
if (args.length > 0) {
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
tableName = extractSqlTableName(
|
|
276
|
-
}
|
|
277
|
-
else if (Node.isNoSubstitutionTemplateLiteral(firstArg)) {
|
|
278
|
-
tableName = extractSqlTableName(firstArg.getLiteralText());
|
|
279
|
-
}
|
|
280
|
-
else if (Node.isTemplateExpression(firstArg)) {
|
|
281
|
-
tableName = extractSqlTableName(firstArg.getHead().getLiteralText());
|
|
282
|
-
}
|
|
295
|
+
const sql = resolveStringValue(args[0], callExpr.getSourceFile());
|
|
296
|
+
if (sql !== null)
|
|
297
|
+
tableName = extractSqlTableName(sql);
|
|
283
298
|
}
|
|
284
299
|
return {
|
|
285
300
|
functionName: getEnclosingFunctionName(callExpr),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "infrawise",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"mcpName": "io.github.Sidd27/infrawise",
|
|
5
5
|
"description": "CLI-first infrastructure intelligence platform — analyzes DynamoDB, PostgreSQL, MySQL, MongoDB, SQS, SNS, SSM, Secrets Manager, Lambda, S3, CloudWatch Logs and exposes findings as an MCP server for Claude Code",
|
|
6
6
|
"keywords": [
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"@aws-sdk/credential-providers": "^3.1048.0",
|
|
77
77
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
78
78
|
"chalk": "^5.6.2",
|
|
79
|
+
"@fastify/cors": "^11.2.0",
|
|
79
80
|
"commander": "^15.0.0",
|
|
80
81
|
"fastify": "^5.8.5",
|
|
81
82
|
"inquirer": "^14.0.2",
|
|
@@ -90,7 +91,6 @@
|
|
|
90
91
|
"zod": "^4.4.3"
|
|
91
92
|
},
|
|
92
93
|
"devDependencies": {
|
|
93
|
-
"@fastify/cors": "^11.2.0",
|
|
94
94
|
"@types/inquirer": "^9.0.9",
|
|
95
95
|
"@types/js-yaml": "^4.0.9",
|
|
96
96
|
"@types/node": "^25.8.0",
|