many-ai-cli 0.8.0 → 0.10.0-rc.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/LICENSE +21 -0
- package/README.md +77 -13
- package/THIRD_PARTY_NOTICES.md +249 -0
- package/WEB-THIRD-PARTY-LICENSES.txt +1141 -0
- package/bin/many-ai-cli.mjs +95 -21
- package/build-inputs/README.txt +1 -0
- package/build-inputs/linux-x64/BUILD-INPUTS.json +14259 -0
- package/build-inputs/linux-x64/CRATE-NOTICES.txt +42171 -0
- package/build-inputs/linux-x64/THIRD_PARTY_NOTICES.md +60 -0
- package/build-inputs/linux-x64/build-inputs.spdx.json +6949 -0
- package/build-inputs/macos-apple-silicon/BUILD-INPUTS.json +14446 -0
- package/build-inputs/macos-apple-silicon/CRATE-NOTICES.txt +42403 -0
- package/build-inputs/macos-apple-silicon/THIRD_PARTY_NOTICES.md +60 -0
- package/build-inputs/macos-apple-silicon/build-inputs.spdx.json +7036 -0
- package/build-inputs/macos-intel/BUILD-INPUTS.json +14501 -0
- package/build-inputs/macos-intel/CRATE-NOTICES.txt +42638 -0
- package/build-inputs/macos-intel/THIRD_PARTY_NOTICES.md +60 -0
- package/build-inputs/macos-intel/build-inputs.spdx.json +7065 -0
- package/build-inputs/windows-x64/BUILD-INPUTS.json +14581 -0
- package/build-inputs/windows-x64/CRATE-NOTICES.txt +42378 -0
- package/build-inputs/windows-x64/THIRD_PARTY_NOTICES.md +60 -0
- package/build-inputs/windows-x64/build-inputs.spdx.json +7007 -0
- package/package.json +11 -7
package/bin/many-ai-cli.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Thin launcher for the `many-ai-cli` npm package.
|
|
3
3
|
//
|
|
4
|
-
// The real program is a native
|
|
5
|
-
// optional dependency (e.g. `many-ai-cli-
|
|
6
|
-
// matching package for the current OS/arch
|
|
7
|
-
// forwarding argv
|
|
4
|
+
// The real program is a native binary shipped in a platform-specific
|
|
5
|
+
// optional dependency (e.g. `many-ai-cli-windows-x64`). This shim finds the
|
|
6
|
+
// matching package for the current OS/arch inside its own installation and
|
|
7
|
+
// execs its bundled binary, forwarding argv and stdio and reporting its exit
|
|
8
|
+
// status.
|
|
8
9
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
10
|
+
// The shim is independent of the implementation language. Rust release
|
|
11
|
+
// candidates use the same package names and binary paths; this file alone does
|
|
12
|
+
// not establish which release is published to the registry. Package-manager
|
|
13
|
+
// installation does not guarantee that Windows security policies allow an exe.
|
|
12
14
|
|
|
13
15
|
import { spawnSync } from 'node:child_process';
|
|
14
|
-
import { chmodSync } from 'node:fs';
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
const require = createRequire(import.meta.url);
|
|
16
|
+
import { chmodSync, readFileSync, statSync } from 'node:fs';
|
|
17
|
+
import { basename, dirname, join } from 'node:path';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
18
19
|
|
|
19
20
|
// process.platform/arch -> optional dependency package name.
|
|
20
21
|
// Package names mirror the GitHub release archive suffixes
|
|
@@ -28,6 +29,57 @@ const PKG_BY_TARGET = {
|
|
|
28
29
|
'darwin arm64': 'many-ai-cli-macos-apple-silicon',
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
// This package's directory (the shim is bin/many-ai-cli.mjs). Node starts the
|
|
33
|
+
// shim from its real path, so a package manager's link is already followed.
|
|
34
|
+
const PACKAGE_DIR = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
35
|
+
|
|
36
|
+
// The platform package is looked for only inside the installation that holds
|
|
37
|
+
// this shim: this package's own node_modules, then the node_modules of each
|
|
38
|
+
// directory above it, up to the directory that contains the outermost
|
|
39
|
+
// node_modules on the shim's path. require.resolve would go on to every
|
|
40
|
+
// node_modules up to the drive root, NODE_PATH and the global folders; on
|
|
41
|
+
// Windows any signed-in user can create C:\node_modules, so a missing or
|
|
42
|
+
// incomplete platform package would start their executable with this user's
|
|
43
|
+
// rights (audit U38). Candidates are judged by where they sit, never by where
|
|
44
|
+
// a link points: pnpm links the platform package to a store directory outside
|
|
45
|
+
// this tree.
|
|
46
|
+
function searchDirs(pkg) {
|
|
47
|
+
const chain = [];
|
|
48
|
+
for (let dir = PACKAGE_DIR; ; ) {
|
|
49
|
+
chain.push(dir);
|
|
50
|
+
const parent = dirname(dir);
|
|
51
|
+
if (parent === dir) break;
|
|
52
|
+
dir = parent;
|
|
53
|
+
}
|
|
54
|
+
let rootIndex = 0;
|
|
55
|
+
chain.forEach((dir, index) => {
|
|
56
|
+
if (basename(dir) === 'node_modules' && index + 1 < chain.length) rootIndex = index + 1;
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
installRoot: chain[rootIndex],
|
|
60
|
+
dirs: chain
|
|
61
|
+
.slice(0, rootIndex + 1)
|
|
62
|
+
.filter((dir) => basename(dir) !== 'node_modules')
|
|
63
|
+
.map((dir) => join(dir, 'node_modules', pkg)),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function stat(path) {
|
|
68
|
+
try {
|
|
69
|
+
return statSync(path);
|
|
70
|
+
} catch {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function readManifest(dir) {
|
|
76
|
+
try {
|
|
77
|
+
return JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
|
|
78
|
+
} catch {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
31
83
|
function resolveBinary() {
|
|
32
84
|
const target = `${process.platform} ${process.arch}`;
|
|
33
85
|
const pkg = PKG_BY_TARGET[target];
|
|
@@ -39,17 +91,39 @@ function resolveBinary() {
|
|
|
39
91
|
`Install from GitHub Releases instead: https://github.com/ishizakahiroshi/many-ai-cli/releases`
|
|
40
92
|
);
|
|
41
93
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
94
|
+
const binName = `many-ai-cli${process.platform === 'win32' ? '.exe' : ''}`;
|
|
95
|
+
// The root package pins the platform package to its exact version.
|
|
96
|
+
const wanted = readManifest(PACKAGE_DIR)?.optionalDependencies?.[pkg];
|
|
97
|
+
const { installRoot, dirs } = searchDirs(pkg);
|
|
98
|
+
const problems = [];
|
|
99
|
+
if (typeof wanted !== 'string' || !wanted) {
|
|
100
|
+
problems.push(`many-ai-cli's package.json does not name the version of ${pkg}.`);
|
|
101
|
+
} else {
|
|
102
|
+
for (const dir of dirs) {
|
|
103
|
+
const manifest = readManifest(dir);
|
|
104
|
+
if (manifest === undefined) {
|
|
105
|
+
if (stat(dir)) problems.push(`${dir} has no readable package.json.`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (manifest?.name !== pkg || manifest?.version !== wanted) {
|
|
109
|
+
problems.push(
|
|
110
|
+
`${dir} holds ${manifest?.name}@${manifest?.version}; this many-ai-cli needs ${pkg}@${wanted}.`
|
|
111
|
+
);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const binary = join(dir, 'bin', binName);
|
|
115
|
+
if (stat(binary)?.isFile()) return binary;
|
|
116
|
+
problems.push(`${dir} has no bin/${binName}.`);
|
|
117
|
+
}
|
|
52
118
|
}
|
|
119
|
+
throw new Error(
|
|
120
|
+
`The platform package "${pkg}" is not installed.\n` +
|
|
121
|
+
`It is an optionalDependency of many-ai-cli and should be installed automatically.\n` +
|
|
122
|
+
`Reinstall with optional dependencies enabled, e.g. "pnpm add -g many-ai-cli" ` +
|
|
123
|
+
`(avoid --no-optional / --ignore-optional).\n` +
|
|
124
|
+
`many-ai-cli looks for it only inside its own installation: ${installRoot}` +
|
|
125
|
+
problems.map((problem) => `\n${problem}`).join('')
|
|
126
|
+
);
|
|
53
127
|
}
|
|
54
128
|
|
|
55
129
|
function main() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Cargo build-input evidence only. This is not a complete distribution SBOM or release/license acceptance.
|