parallel-agents 0.2.0
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 +31 -0
- package/bin/cli.js +113 -0
- package/package.json +37 -0
- package/scripts/postinstall.js +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# parallel-agents
|
|
2
|
+
|
|
3
|
+
Parallel multi-agent pipeline for code analysis and transformation, powered by Claude.
|
|
4
|
+
|
|
5
|
+
This is the **npm wrapper** for the Python `parallel-agents` package. It auto-installs the Python package and delegates all commands to it.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- **Python 3.11+** must be installed and on your PATH
|
|
10
|
+
- **Claude Code CLI** must be installed and authenticated
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Via npx (no install needed)
|
|
16
|
+
npx parallel-agents run --repo ./my-project "Fix security issues"
|
|
17
|
+
|
|
18
|
+
# Or install globally
|
|
19
|
+
npm install -g parallel-agents
|
|
20
|
+
parallel-agents run --repo ./project "Review code quality"
|
|
21
|
+
parallel-agents workers
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## How it works
|
|
25
|
+
|
|
26
|
+
This package is a thin Node.js wrapper that:
|
|
27
|
+
1. Checks for Python 3.11+
|
|
28
|
+
2. Installs `parallel-agents` from PyPI if not present
|
|
29
|
+
3. Forwards all CLI arguments to the Python CLI
|
|
30
|
+
|
|
31
|
+
For full documentation, see the [Python package on PyPI](https://pypi.org/project/parallel-agents/).
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* parallel-agents npm wrapper
|
|
5
|
+
*
|
|
6
|
+
* Thin wrapper that delegates to the Python `parallel-agents` CLI.
|
|
7
|
+
* Ensures Python + pip package are available, then forwards all arguments.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const { spawn, execSync } = require("child_process");
|
|
11
|
+
const path = require("path");
|
|
12
|
+
|
|
13
|
+
const PYPI_PACKAGE = "parallel-agents";
|
|
14
|
+
const CLI_COMMAND = "parallel-agents";
|
|
15
|
+
|
|
16
|
+
function findPython() {
|
|
17
|
+
const candidates = ["python3", "python"];
|
|
18
|
+
for (const cmd of candidates) {
|
|
19
|
+
try {
|
|
20
|
+
const version = execSync(`${cmd} --version 2>&1`, {
|
|
21
|
+
encoding: "utf-8",
|
|
22
|
+
}).trim();
|
|
23
|
+
const major = parseInt(version.split(" ")[1].split(".")[0], 10);
|
|
24
|
+
const minor = parseInt(version.split(" ")[1].split(".")[1], 10);
|
|
25
|
+
if (major === 3 && minor >= 11) {
|
|
26
|
+
return cmd;
|
|
27
|
+
}
|
|
28
|
+
} catch {
|
|
29
|
+
// not found, try next
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isPipPackageInstalled(python) {
|
|
36
|
+
try {
|
|
37
|
+
execSync(`${python} -m pip show ${PYPI_PACKAGE} 2>&1`, {
|
|
38
|
+
encoding: "utf-8",
|
|
39
|
+
stdio: "pipe",
|
|
40
|
+
});
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function installPipPackage(python) {
|
|
48
|
+
console.log(`Installing ${PYPI_PACKAGE} via pip...`);
|
|
49
|
+
try {
|
|
50
|
+
execSync(`${python} -m pip install ${PYPI_PACKAGE}`, {
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
});
|
|
53
|
+
return true;
|
|
54
|
+
} catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function findCLI(python) {
|
|
60
|
+
// Try direct command first
|
|
61
|
+
try {
|
|
62
|
+
execSync(`${CLI_COMMAND} --help`, { stdio: "pipe" });
|
|
63
|
+
return CLI_COMMAND;
|
|
64
|
+
} catch {
|
|
65
|
+
// Fall back to python -m
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function main() {
|
|
71
|
+
const python = findPython();
|
|
72
|
+
if (!python) {
|
|
73
|
+
console.error(
|
|
74
|
+
"Error: Python 3.11+ is required but not found.\n" +
|
|
75
|
+
"Install Python from https://python.org or via your package manager."
|
|
76
|
+
);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!isPipPackageInstalled(python)) {
|
|
81
|
+
if (!installPipPackage(python)) {
|
|
82
|
+
console.error(
|
|
83
|
+
`Error: Failed to install ${PYPI_PACKAGE}.\n` +
|
|
84
|
+
`Try manually: ${python} -m pip install ${PYPI_PACKAGE}`
|
|
85
|
+
);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Forward all args to the Python CLI
|
|
91
|
+
const args = process.argv.slice(2);
|
|
92
|
+
const directCLI = findCLI(python);
|
|
93
|
+
|
|
94
|
+
let child;
|
|
95
|
+
if (directCLI) {
|
|
96
|
+
child = spawn(directCLI, args, { stdio: "inherit" });
|
|
97
|
+
} else {
|
|
98
|
+
child = spawn(python, ["-m", "parallel_agents.main", ...args], {
|
|
99
|
+
stdio: "inherit",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
child.on("exit", (code) => {
|
|
104
|
+
process.exit(code || 0);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
child.on("error", (err) => {
|
|
108
|
+
console.error(`Failed to start parallel-agents: ${err.message}`);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "parallel-agents",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Parallel multi-agent pipeline for code analysis and transformation, powered by Claude",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"agents",
|
|
8
|
+
"claude",
|
|
9
|
+
"code-analysis",
|
|
10
|
+
"parallel",
|
|
11
|
+
"multi-agent",
|
|
12
|
+
"llm",
|
|
13
|
+
"security",
|
|
14
|
+
"code-review"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "parallel-agents contributors",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/ErenAri/pa"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"parallel-agents": "./bin/cli.js"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"postinstall": "node ./scripts/postinstall.js"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16.0.0"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin/",
|
|
33
|
+
"scripts/",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post-install script: check Python availability and install the pip package.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { execSync } = require("child_process");
|
|
8
|
+
|
|
9
|
+
const PYPI_PACKAGE = "parallel-agents";
|
|
10
|
+
|
|
11
|
+
function findPython() {
|
|
12
|
+
for (const cmd of ["python3", "python"]) {
|
|
13
|
+
try {
|
|
14
|
+
const version = execSync(`${cmd} --version 2>&1`, {
|
|
15
|
+
encoding: "utf-8",
|
|
16
|
+
}).trim();
|
|
17
|
+
const parts = version.split(" ")[1].split(".");
|
|
18
|
+
if (parseInt(parts[0]) === 3 && parseInt(parts[1]) >= 11) {
|
|
19
|
+
return cmd;
|
|
20
|
+
}
|
|
21
|
+
} catch {
|
|
22
|
+
// continue
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const python = findPython();
|
|
29
|
+
if (!python) {
|
|
30
|
+
console.warn(
|
|
31
|
+
`\n⚠️ Python 3.11+ not found. parallel-agents requires Python.\n` +
|
|
32
|
+
` Install from https://python.org then run:\n` +
|
|
33
|
+
` ${python || "python3"} -m pip install ${PYPI_PACKAGE}\n`
|
|
34
|
+
);
|
|
35
|
+
process.exit(0); // don't fail npm install
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
execSync(`${python} -m pip show ${PYPI_PACKAGE}`, { stdio: "pipe" });
|
|
40
|
+
console.log(`✓ ${PYPI_PACKAGE} Python package already installed`);
|
|
41
|
+
} catch {
|
|
42
|
+
console.log(`Installing ${PYPI_PACKAGE} Python package...`);
|
|
43
|
+
try {
|
|
44
|
+
execSync(`${python} -m pip install ${PYPI_PACKAGE}`, { stdio: "inherit" });
|
|
45
|
+
console.log(`✓ ${PYPI_PACKAGE} installed successfully`);
|
|
46
|
+
} catch {
|
|
47
|
+
console.warn(
|
|
48
|
+
`\n⚠️ Failed to auto-install ${PYPI_PACKAGE}. Run manually:\n` +
|
|
49
|
+
` ${python} -m pip install ${PYPI_PACKAGE}\n`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|