@absolutejs/manifest
Advanced tools
+27
-4
@@ -6,3 +6,3 @@ #!/usr/bin/env bun | ||
| import { existsSync } from "fs"; | ||
| import { mkdir, readFile, writeFile } from "fs/promises"; | ||
| import { mkdir, readFile, readdir, writeFile } from "fs/promises"; | ||
| import { join, resolve } from "path"; | ||
@@ -639,6 +639,27 @@ import { pathToFileURL } from "url"; | ||
| var packagePathIsInspectable = (relativePath) => !relativePath.split("/").some((segment) => IGNORED_PACKAGE_DIRECTORIES.has(segment)); | ||
| var scanPackageTree = async (root, directory = root) => { | ||
| let entries; | ||
| try { | ||
| entries = await readdir(directory, { withFileTypes: true }); | ||
| } catch (error) { | ||
| const code = typeof error === "object" && error !== null && "code" in error ? Reflect.get(error, "code") : undefined; | ||
| if (code === "EACCES" || code === "EPERM") | ||
| return { packagePaths: [], skippedDirectories: [directory] }; | ||
| throw error; | ||
| } | ||
| const packagePaths = []; | ||
| const skippedDirectories = []; | ||
| if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) | ||
| packagePaths.push(join(directory, "package.json")); | ||
| const childScans = await Promise.all(entries.filter((entry) => entry.isDirectory() && !IGNORED_PACKAGE_DIRECTORIES.has(entry.name)).map((entry) => scanPackageTree(root, join(directory, entry.name)))); | ||
| for (const child of childScans) { | ||
| packagePaths.push(...child.packagePaths); | ||
| skippedDirectories.push(...child.skippedDirectories); | ||
| } | ||
| return { packagePaths, skippedDirectories }; | ||
| }; | ||
| var verifyTree = async (explicitDirectory, artifacts) => { | ||
| const root = resolve(process.cwd(), explicitDirectory ?? "."); | ||
| const glob = new Bun.Glob("**/package.json"); | ||
| const packagePaths = (await Array.fromAsync(glob.scan({ cwd: root, onlyFiles: true }))).filter(packagePathIsInspectable); | ||
| const scanned = await scanPackageTree(root); | ||
| const packagePaths = scanned.packagePaths.map((packagePath) => packagePath.slice(root.length + 1)).filter(packagePathIsInspectable); | ||
| const results = await Promise.all(packagePaths.map(async (packagePath) => { | ||
@@ -653,2 +674,4 @@ const directory = resolve(root, packagePath, ".."); | ||
| `)); | ||
| for (const directory of scanned.skippedDirectories) | ||
| console.warn(`absolute-manifest: warning \u2014 skipped unreadable directory ${directory}`); | ||
| console.log(`absolute-manifest: ${packagePaths.length} package policies valid in ${root}`); | ||
@@ -717,3 +740,3 @@ }; | ||
| //# debugId=F56BCE7F3FA7E4C864756E2164756E21 | ||
| //# debugId=FDC7C5D652F33B7364756E2164756E21 | ||
| //# sourceMappingURL=cli.js.map |
+1
-1
| { | ||
| "name": "@absolutejs/manifest", | ||
| "version": "0.6.1", | ||
| "version": "0.6.2", | ||
| "description": "The AbsoluteJS package manifest contract. Every @absolutejs/* package exports a typed manifest (settings schema, env requirements, adapter slots, wiring recipes, AI tools) from its ./manifest subpath; this package is the contract those manifests are written against, plus bridges that turn any manifest into an AI tool map or a remote MCP tool registry.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
300683
1.19%2331
1%