@thelogicatelier/sylva 1.0.9 → 1.0.10
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 +20 -0
- package/dist/awareness/braveSearch.d.ts +18 -0
- package/dist/awareness/braveSearch.js +134 -0
- package/dist/awareness/detector.d.ts +18 -0
- package/dist/awareness/detector.js +176 -0
- package/dist/awareness/index.d.ts +11 -0
- package/dist/awareness/index.js +259 -0
- package/dist/awareness/manifestParsers/dotnetParsers.d.ts +13 -0
- package/dist/awareness/manifestParsers/dotnetParsers.js +151 -0
- package/dist/awareness/manifestParsers/goParsers.d.ts +9 -0
- package/dist/awareness/manifestParsers/goParsers.js +137 -0
- package/dist/awareness/manifestParsers/index.d.ts +13 -0
- package/dist/awareness/manifestParsers/index.js +182 -0
- package/dist/awareness/manifestParsers/javaParsers.d.ts +13 -0
- package/dist/awareness/manifestParsers/javaParsers.js +243 -0
- package/dist/awareness/manifestParsers/openclawParser.d.ts +6 -0
- package/dist/awareness/manifestParsers/openclawParser.js +103 -0
- package/dist/awareness/manifestParsers/packageJsonParser.d.ts +7 -0
- package/dist/awareness/manifestParsers/packageJsonParser.js +209 -0
- package/dist/awareness/manifestParsers/pythonParsers.d.ts +21 -0
- package/dist/awareness/manifestParsers/pythonParsers.js +344 -0
- package/dist/awareness/manifestParsers/rustParsers.d.ts +9 -0
- package/dist/awareness/manifestParsers/rustParsers.js +153 -0
- package/dist/awareness/manifestScanner.d.ts +11 -0
- package/dist/awareness/manifestScanner.js +182 -0
- package/dist/awareness/types.d.ts +105 -0
- package/dist/awareness/types.js +6 -0
- package/dist/awareness/versionResolver.d.ts +17 -0
- package/dist/awareness/versionResolver.js +62 -0
- package/dist/awareness/webGrounding.d.ts +20 -0
- package/dist/awareness/webGrounding.js +102 -0
- package/dist/cli.js +19 -4
- package/dist/constants.js +11 -0
- package/dist/modules.d.ts +5 -2
- package/dist/modules.js +17 -4
- package/dist/prompts.d.ts +6 -0
- package/dist/prompts.js +5 -2
- package/dist/utils.js +12 -6
- package/package.json +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* .NET manifest parsers.
|
|
4
|
+
* Handles *.csproj files and global.json.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.parseCsproj = parseCsproj;
|
|
41
|
+
exports.parseGlobalJson = parseGlobalJson;
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
/**
|
|
45
|
+
* Parse a .csproj file (MSBuild XML format)
|
|
46
|
+
*/
|
|
47
|
+
function parseCsproj(manifest) {
|
|
48
|
+
const signals = [];
|
|
49
|
+
const content = fs.readFileSync(manifest.absolutePath, "utf-8");
|
|
50
|
+
const rootPath = path.dirname(manifest.relativePath) || ".";
|
|
51
|
+
signals.push({
|
|
52
|
+
kind: "framework",
|
|
53
|
+
frameworkId: "dotnet",
|
|
54
|
+
frameworkName: ".NET",
|
|
55
|
+
evidence: {
|
|
56
|
+
file: manifest.relativePath,
|
|
57
|
+
reason: `${manifest.filename} project file found`,
|
|
58
|
+
},
|
|
59
|
+
scope: { pathRoot: rootPath },
|
|
60
|
+
});
|
|
61
|
+
// Extract TargetFramework
|
|
62
|
+
const tfMatch = content.match(/<TargetFramework>([^<]+)<\/TargetFramework>/);
|
|
63
|
+
if (tfMatch) {
|
|
64
|
+
signals.push({
|
|
65
|
+
kind: "version",
|
|
66
|
+
frameworkId: "dotnet",
|
|
67
|
+
frameworkName: ".NET",
|
|
68
|
+
version: { value: tfMatch[1], certainty: "exact", sourceFile: manifest.relativePath },
|
|
69
|
+
evidence: {
|
|
70
|
+
file: manifest.relativePath,
|
|
71
|
+
reason: "TargetFramework specified in csproj",
|
|
72
|
+
excerpt: `<TargetFramework>${tfMatch[1]}</TargetFramework>`,
|
|
73
|
+
},
|
|
74
|
+
scope: { pathRoot: rootPath },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// Extract PackageReference versions
|
|
78
|
+
const pkgRefRegex = /<PackageReference\s+Include="([^"]+)"\s+Version="([^"]+)"/g;
|
|
79
|
+
let m;
|
|
80
|
+
while ((m = pkgRefRegex.exec(content)) !== null) {
|
|
81
|
+
const pkgName = m[1];
|
|
82
|
+
const version = m[2];
|
|
83
|
+
const isPinned = /^\d+\.\d+/.test(version) && !/[*[\]]/.test(version);
|
|
84
|
+
const versionInfo = isPinned
|
|
85
|
+
? { value: version, certainty: "exact", sourceFile: manifest.relativePath }
|
|
86
|
+
: {
|
|
87
|
+
value: version,
|
|
88
|
+
certainty: "ambiguous",
|
|
89
|
+
sourceFile: manifest.relativePath,
|
|
90
|
+
notes: `Version range: ${version}`,
|
|
91
|
+
};
|
|
92
|
+
// Check for known .NET frameworks
|
|
93
|
+
let frameworkId = `nuget-${pkgName.toLowerCase()}`;
|
|
94
|
+
let frameworkName = pkgName;
|
|
95
|
+
if (pkgName.startsWith("Microsoft.AspNetCore") || pkgName.startsWith("Microsoft.Extensions")) {
|
|
96
|
+
frameworkId = "aspnet-core";
|
|
97
|
+
frameworkName = "ASP.NET Core";
|
|
98
|
+
}
|
|
99
|
+
else if (pkgName.startsWith("Microsoft.EntityFrameworkCore")) {
|
|
100
|
+
frameworkId = "ef-core";
|
|
101
|
+
frameworkName = "Entity Framework Core";
|
|
102
|
+
}
|
|
103
|
+
signals.push({
|
|
104
|
+
kind: "framework",
|
|
105
|
+
frameworkId,
|
|
106
|
+
frameworkName,
|
|
107
|
+
version: versionInfo,
|
|
108
|
+
evidence: {
|
|
109
|
+
file: manifest.relativePath,
|
|
110
|
+
reason: `NuGet package '${pkgName}' referenced in csproj`,
|
|
111
|
+
excerpt: m[0],
|
|
112
|
+
},
|
|
113
|
+
scope: { pathRoot: rootPath },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return signals;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Parse global.json (.NET SDK version pinning)
|
|
120
|
+
*/
|
|
121
|
+
function parseGlobalJson(manifest) {
|
|
122
|
+
const signals = [];
|
|
123
|
+
const content = fs.readFileSync(manifest.absolutePath, "utf-8");
|
|
124
|
+
const rootPath = path.dirname(manifest.relativePath) || ".";
|
|
125
|
+
try {
|
|
126
|
+
const config = JSON.parse(content);
|
|
127
|
+
if (config.sdk?.version) {
|
|
128
|
+
signals.push({
|
|
129
|
+
kind: "version",
|
|
130
|
+
frameworkId: "dotnet-sdk",
|
|
131
|
+
frameworkName: ".NET SDK",
|
|
132
|
+
version: {
|
|
133
|
+
value: config.sdk.version,
|
|
134
|
+
certainty: "exact",
|
|
135
|
+
sourceFile: manifest.relativePath,
|
|
136
|
+
},
|
|
137
|
+
evidence: {
|
|
138
|
+
file: manifest.relativePath,
|
|
139
|
+
reason: ".NET SDK version pinned in global.json",
|
|
140
|
+
excerpt: `"version": "${config.sdk.version}"`,
|
|
141
|
+
},
|
|
142
|
+
scope: { pathRoot: rootPath },
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.warn(`⚠️ Could not parse ${manifest.relativePath}: ${error.message}\n` +
|
|
148
|
+
` .NET SDK version detection skipped for this file. Fix the JSON syntax to enable it.`);
|
|
149
|
+
}
|
|
150
|
+
return signals;
|
|
151
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Go manifest parser.
|
|
4
|
+
* Handles go.mod files.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.parseGoMod = parseGoMod;
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
/** Known Go frameworks/libraries */
|
|
44
|
+
const GO_FRAMEWORKS = [
|
|
45
|
+
{ module: "github.com/gin-gonic/gin", frameworkId: "gin", frameworkName: "Gin" },
|
|
46
|
+
{ module: "github.com/labstack/echo", frameworkId: "echo", frameworkName: "Echo" },
|
|
47
|
+
{ module: "github.com/gofiber/fiber", frameworkId: "fiber", frameworkName: "Fiber" },
|
|
48
|
+
{ module: "github.com/gorilla/mux", frameworkId: "gorilla-mux", frameworkName: "Gorilla Mux" },
|
|
49
|
+
{ module: "gorm.io/gorm", frameworkId: "gorm", frameworkName: "GORM" },
|
|
50
|
+
{ module: "github.com/stretchr/testify", frameworkId: "testify", frameworkName: "Testify" },
|
|
51
|
+
{ module: "google.golang.org/grpc", frameworkId: "grpc-go", frameworkName: "gRPC-Go" },
|
|
52
|
+
];
|
|
53
|
+
/**
|
|
54
|
+
* Parse go.mod
|
|
55
|
+
*/
|
|
56
|
+
function parseGoMod(manifest) {
|
|
57
|
+
const signals = [];
|
|
58
|
+
const content = fs.readFileSync(manifest.absolutePath, "utf-8");
|
|
59
|
+
const rootPath = path.dirname(manifest.relativePath) || ".";
|
|
60
|
+
// Extract Go version
|
|
61
|
+
const goVersionMatch = content.match(/^go\s+(\S+)/m);
|
|
62
|
+
if (goVersionMatch) {
|
|
63
|
+
signals.push({
|
|
64
|
+
kind: "framework",
|
|
65
|
+
frameworkId: "go",
|
|
66
|
+
frameworkName: "Go",
|
|
67
|
+
version: { value: goVersionMatch[1], certainty: "exact", sourceFile: manifest.relativePath },
|
|
68
|
+
evidence: {
|
|
69
|
+
file: manifest.relativePath,
|
|
70
|
+
reason: "Go version specified in go.mod",
|
|
71
|
+
excerpt: `go ${goVersionMatch[1]}`,
|
|
72
|
+
},
|
|
73
|
+
scope: { pathRoot: rootPath },
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
signals.push({
|
|
78
|
+
kind: "framework",
|
|
79
|
+
frameworkId: "go",
|
|
80
|
+
frameworkName: "Go",
|
|
81
|
+
evidence: {
|
|
82
|
+
file: manifest.relativePath,
|
|
83
|
+
reason: "go.mod found",
|
|
84
|
+
},
|
|
85
|
+
scope: { pathRoot: rootPath },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Extract module name
|
|
89
|
+
const moduleMatch = content.match(/^module\s+(\S+)/m);
|
|
90
|
+
if (moduleMatch) {
|
|
91
|
+
signals.push({
|
|
92
|
+
kind: "entrypoint",
|
|
93
|
+
frameworkId: "go-module",
|
|
94
|
+
frameworkName: "Go Module",
|
|
95
|
+
evidence: {
|
|
96
|
+
file: manifest.relativePath,
|
|
97
|
+
reason: `Go module: ${moduleMatch[1]}`,
|
|
98
|
+
excerpt: `module ${moduleMatch[1]}`,
|
|
99
|
+
},
|
|
100
|
+
scope: { pathRoot: rootPath },
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Extract require blocks
|
|
104
|
+
const requireBlock = content.match(/require\s*\(([\s\S]*?)\)/);
|
|
105
|
+
const requireLines = [];
|
|
106
|
+
if (requireBlock) {
|
|
107
|
+
requireLines.push(...requireBlock[1].split("\n"));
|
|
108
|
+
}
|
|
109
|
+
// Also handle single-line requires
|
|
110
|
+
const singleRequires = content.match(/^require\s+(\S+)\s+(\S+)/gm);
|
|
111
|
+
if (singleRequires) {
|
|
112
|
+
requireLines.push(...singleRequires);
|
|
113
|
+
}
|
|
114
|
+
for (const line of requireLines) {
|
|
115
|
+
const match = line.trim().match(/^(\S+)\s+(v\S+)/);
|
|
116
|
+
if (!match)
|
|
117
|
+
continue;
|
|
118
|
+
const modulePath = match[1];
|
|
119
|
+
const version = match[2];
|
|
120
|
+
const framework = GO_FRAMEWORKS.find((f) => modulePath.startsWith(f.module));
|
|
121
|
+
if (framework) {
|
|
122
|
+
signals.push({
|
|
123
|
+
kind: "framework",
|
|
124
|
+
frameworkId: framework.frameworkId,
|
|
125
|
+
frameworkName: framework.frameworkName,
|
|
126
|
+
version: { value: version, certainty: "exact", sourceFile: manifest.relativePath },
|
|
127
|
+
evidence: {
|
|
128
|
+
file: manifest.relativePath,
|
|
129
|
+
reason: `Go dependency '${modulePath}' found in go.mod`,
|
|
130
|
+
excerpt: `${modulePath} ${version}`,
|
|
131
|
+
},
|
|
132
|
+
scope: { pathRoot: rootPath },
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return signals;
|
|
137
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest parser dispatcher.
|
|
3
|
+
* Routes discovered manifest files to the appropriate parser based on filename.
|
|
4
|
+
*/
|
|
5
|
+
import { Signal, ManifestFile } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* Parse a single manifest file and return signals.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseManifest(manifest: ManifestFile): Signal[];
|
|
10
|
+
/**
|
|
11
|
+
* Parse all discovered manifests and return combined signals.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseAllManifests(manifests: ManifestFile[]): Signal[];
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Manifest parser dispatcher.
|
|
4
|
+
* Routes discovered manifest files to the appropriate parser based on filename.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.parseManifest = parseManifest;
|
|
41
|
+
exports.parseAllManifests = parseAllManifests;
|
|
42
|
+
const openclawParser_1 = require("./openclawParser");
|
|
43
|
+
const packageJsonParser_1 = require("./packageJsonParser");
|
|
44
|
+
const pythonParsers_1 = require("./pythonParsers");
|
|
45
|
+
const javaParsers_1 = require("./javaParsers");
|
|
46
|
+
const dotnetParsers_1 = require("./dotnetParsers");
|
|
47
|
+
const goParsers_1 = require("./goParsers");
|
|
48
|
+
const rustParsers_1 = require("./rustParsers");
|
|
49
|
+
const fs = __importStar(require("fs"));
|
|
50
|
+
const path = __importStar(require("path"));
|
|
51
|
+
/**
|
|
52
|
+
* Parse angular.json to detect Angular workspace structure.
|
|
53
|
+
*/
|
|
54
|
+
function parseAngularJson(manifest) {
|
|
55
|
+
const signals = [];
|
|
56
|
+
const content = fs.readFileSync(manifest.absolutePath, "utf-8");
|
|
57
|
+
const rootPath = path.dirname(manifest.relativePath) || ".";
|
|
58
|
+
try {
|
|
59
|
+
const config = JSON.parse(content);
|
|
60
|
+
const projects = config.projects ? Object.keys(config.projects) : [];
|
|
61
|
+
signals.push({
|
|
62
|
+
kind: "framework",
|
|
63
|
+
frameworkId: "angular",
|
|
64
|
+
frameworkName: "Angular",
|
|
65
|
+
evidence: {
|
|
66
|
+
file: manifest.relativePath,
|
|
67
|
+
reason: `angular.json workspace found with ${projects.length} project(s): ${projects.join(", ")}`,
|
|
68
|
+
excerpt: projects.length > 0 ? `Projects: ${projects.slice(0, 5).join(", ")}` : undefined,
|
|
69
|
+
},
|
|
70
|
+
scope: { pathRoot: rootPath },
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
// Invalid JSON — still record the Angular workspace with a note
|
|
75
|
+
console.warn(`⚠️ Could not parse ${manifest.relativePath} as JSON: ${error.message}\n` +
|
|
76
|
+
` Angular workspace detected but project details are unavailable. This is non-fatal.`);
|
|
77
|
+
signals.push({
|
|
78
|
+
kind: "framework",
|
|
79
|
+
frameworkId: "angular",
|
|
80
|
+
frameworkName: "Angular",
|
|
81
|
+
evidence: {
|
|
82
|
+
file: manifest.relativePath,
|
|
83
|
+
reason: "angular.json found but JSON is malformed — workspace detected without project details",
|
|
84
|
+
},
|
|
85
|
+
scope: { pathRoot: rootPath },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return signals;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Parse Dockerfile for runtime hints
|
|
92
|
+
*/
|
|
93
|
+
function parseDockerfile(manifest) {
|
|
94
|
+
const signals = [];
|
|
95
|
+
const content = fs.readFileSync(manifest.absolutePath, "utf-8");
|
|
96
|
+
const rootPath = path.dirname(manifest.relativePath) || ".";
|
|
97
|
+
// Extract FROM base images
|
|
98
|
+
const fromMatches = content.match(/^FROM\s+(\S+)/gm);
|
|
99
|
+
if (fromMatches) {
|
|
100
|
+
for (const fromLine of fromMatches) {
|
|
101
|
+
const image = fromLine.replace(/^FROM\s+/, "").trim();
|
|
102
|
+
signals.push({
|
|
103
|
+
kind: "tooling",
|
|
104
|
+
frameworkId: "docker",
|
|
105
|
+
frameworkName: "Docker",
|
|
106
|
+
evidence: {
|
|
107
|
+
file: manifest.relativePath,
|
|
108
|
+
reason: `Docker base image: ${image}`,
|
|
109
|
+
excerpt: fromLine,
|
|
110
|
+
},
|
|
111
|
+
scope: { pathRoot: rootPath },
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return signals;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Parse a single manifest file and return signals.
|
|
119
|
+
*/
|
|
120
|
+
function parseManifest(manifest) {
|
|
121
|
+
try {
|
|
122
|
+
const filename = manifest.filename;
|
|
123
|
+
// Exact filename matches
|
|
124
|
+
switch (filename) {
|
|
125
|
+
case "openclaw.json":
|
|
126
|
+
return (0, openclawParser_1.parseOpenclawJson)(manifest);
|
|
127
|
+
case "package.json":
|
|
128
|
+
return (0, packageJsonParser_1.parsePackageJson)(manifest);
|
|
129
|
+
case "angular.json":
|
|
130
|
+
case "workspace.json":
|
|
131
|
+
return parseAngularJson(manifest);
|
|
132
|
+
case "requirements.txt":
|
|
133
|
+
return (0, pythonParsers_1.parseRequirementsTxt)(manifest);
|
|
134
|
+
case "pyproject.toml":
|
|
135
|
+
return (0, pythonParsers_1.parsePyprojectToml)(manifest);
|
|
136
|
+
case "Pipfile":
|
|
137
|
+
return (0, pythonParsers_1.parsePipfile)(manifest);
|
|
138
|
+
case "setup.cfg":
|
|
139
|
+
return (0, pythonParsers_1.parseSetupCfg)(manifest);
|
|
140
|
+
case "pom.xml":
|
|
141
|
+
return (0, javaParsers_1.parsePomXml)(manifest);
|
|
142
|
+
case "build.gradle":
|
|
143
|
+
case "build.gradle.kts":
|
|
144
|
+
return (0, javaParsers_1.parseBuildGradle)(manifest);
|
|
145
|
+
case "go.mod":
|
|
146
|
+
return (0, goParsers_1.parseGoMod)(manifest);
|
|
147
|
+
case "Cargo.toml":
|
|
148
|
+
return (0, rustParsers_1.parseCargoToml)(manifest);
|
|
149
|
+
case "global.json":
|
|
150
|
+
return (0, dotnetParsers_1.parseGlobalJson)(manifest);
|
|
151
|
+
case "Dockerfile":
|
|
152
|
+
return parseDockerfile(manifest);
|
|
153
|
+
default:
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
// Extension-based matches
|
|
157
|
+
if (filename.endsWith(".csproj") ||
|
|
158
|
+
filename.endsWith(".fsproj") ||
|
|
159
|
+
filename.endsWith(".vbproj")) {
|
|
160
|
+
return (0, dotnetParsers_1.parseCsproj)(manifest);
|
|
161
|
+
}
|
|
162
|
+
// Files we scan but don't parse (lockfiles, CI configs, etc.)
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
console.warn(`⚠️ Skipping manifest ${manifest.relativePath}: ${error.message}\n` +
|
|
167
|
+
` This file could not be parsed. It may be malformed or use an unsupported format.\n` +
|
|
168
|
+
` Other manifests will still be processed normally.`);
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Parse all discovered manifests and return combined signals.
|
|
174
|
+
*/
|
|
175
|
+
function parseAllManifests(manifests) {
|
|
176
|
+
const allSignals = [];
|
|
177
|
+
for (const manifest of manifests) {
|
|
178
|
+
const signals = parseManifest(manifest);
|
|
179
|
+
allSignals.push(...signals);
|
|
180
|
+
}
|
|
181
|
+
return allSignals;
|
|
182
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java/JVM manifest parsers.
|
|
3
|
+
* Handles pom.xml and build.gradle(.kts) with regex-based parsing.
|
|
4
|
+
*/
|
|
5
|
+
import { Signal, ManifestFile } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* Parse pom.xml (Maven)
|
|
8
|
+
*/
|
|
9
|
+
export declare function parsePomXml(manifest: ManifestFile): Signal[];
|
|
10
|
+
/**
|
|
11
|
+
* Parse build.gradle or build.gradle.kts (Gradle)
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseBuildGradle(manifest: ManifestFile): Signal[];
|