@devlitusp/opencode-agent 0.0.2 → 0.0.3
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/bin/dev-agents.js +2 -2
- package/dist/bin/postinstall.js +10 -3
- package/package.json +9 -8
- package/src/init.ts +1 -1
- package/src/inject.ts +1 -1
package/dist/bin/dev-agents.js
CHANGED
|
@@ -584,7 +584,7 @@ function inject(options = {}) {
|
|
|
584
584
|
}
|
|
585
585
|
const scripts = pkg["scripts"] ?? {};
|
|
586
586
|
if (!scripts["prepare"] || force) {
|
|
587
|
-
scripts["prepare"] = "
|
|
587
|
+
scripts["prepare"] = "opencode-agent inject";
|
|
588
588
|
pkg["scripts"] = scripts;
|
|
589
589
|
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + `
|
|
590
590
|
`, "utf-8");
|
|
@@ -664,7 +664,7 @@ function detectPackageManager(cwd) {
|
|
|
664
664
|
}
|
|
665
665
|
function getOwnVersion() {
|
|
666
666
|
try {
|
|
667
|
-
const selfPkg = join2(import.meta.dirname ?? ".", "..", "package.json");
|
|
667
|
+
const selfPkg = join2(import.meta.dirname ?? ".", "..", "..", "package.json");
|
|
668
668
|
if (existsSync2(selfPkg)) {
|
|
669
669
|
const p = JSON.parse(readFileSync2(selfPkg, "utf-8"));
|
|
670
670
|
return p.version;
|
package/dist/bin/postinstall.js
CHANGED
|
@@ -583,7 +583,7 @@ function inject(options = {}) {
|
|
|
583
583
|
}
|
|
584
584
|
const scripts = pkg["scripts"] ?? {};
|
|
585
585
|
if (!scripts["prepare"] || force) {
|
|
586
|
-
scripts["prepare"] = "
|
|
586
|
+
scripts["prepare"] = "opencode-agent inject";
|
|
587
587
|
pkg["scripts"] = scripts;
|
|
588
588
|
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + `
|
|
589
589
|
`, "utf-8");
|
|
@@ -605,11 +605,18 @@ Available agents:
|
|
|
605
605
|
}
|
|
606
606
|
|
|
607
607
|
// bin/postinstall.ts
|
|
608
|
-
|
|
608
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
609
|
+
import { join as join2 } from "path";
|
|
609
610
|
var projectRoot = process.env["INIT_CWD"];
|
|
610
|
-
if (!
|
|
611
|
+
if (!projectRoot) {
|
|
611
612
|
process.exit(0);
|
|
612
613
|
}
|
|
614
|
+
try {
|
|
615
|
+
const targetPkg = JSON.parse(readFileSync2(join2(projectRoot, "package.json"), "utf-8"));
|
|
616
|
+
if (targetPkg.name === "@devlitusp/opencode-agent") {
|
|
617
|
+
process.exit(0);
|
|
618
|
+
}
|
|
619
|
+
} catch {}
|
|
613
620
|
try {
|
|
614
621
|
console.log(`
|
|
615
622
|
[dev-agents] Injecting OpenCode agent config...
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devlitusp/opencode-agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Multi-agent development team for OpenCode CLI — orchestrator, investigator, planner, builder, QA, security & docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opencode-agent": "./dist/bin/dev-agents.js"
|
|
8
8
|
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "bun run scripts/build.ts",
|
|
11
|
+
"dev": "bun run bin/dev-agents.ts",
|
|
12
|
+
"postinstall": "node ./dist/bin/postinstall.js",
|
|
13
|
+
"prepublishOnly": "pnpm run build",
|
|
14
|
+
"typecheck": "tsc --noEmit"
|
|
15
|
+
},
|
|
9
16
|
"files": [
|
|
10
17
|
"dist",
|
|
11
18
|
"src",
|
|
@@ -39,11 +46,5 @@
|
|
|
39
46
|
},
|
|
40
47
|
"engines": {
|
|
41
48
|
"node": ">=18.0.0"
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "bun run scripts/build.ts",
|
|
45
|
-
"dev": "bun run bin/dev-agents.ts",
|
|
46
|
-
"postinstall": "node ./dist/bin/postinstall.js",
|
|
47
|
-
"typecheck": "tsc --noEmit"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|
package/src/init.ts
CHANGED
|
@@ -66,7 +66,7 @@ function detectPackageManager(cwd: string): string {
|
|
|
66
66
|
function getOwnVersion(): string {
|
|
67
67
|
try {
|
|
68
68
|
// When running via dlx, __dirname is the temp package location
|
|
69
|
-
const selfPkg = join(import.meta.dirname ?? ".", "..", "package.json");
|
|
69
|
+
const selfPkg = join(import.meta.dirname ?? ".", "..", "..", "package.json");
|
|
70
70
|
if (existsSync(selfPkg)) {
|
|
71
71
|
const p = JSON.parse(readFileSync(selfPkg, "utf-8")) as { version: string };
|
|
72
72
|
return p.version;
|
package/src/inject.ts
CHANGED
|
@@ -180,7 +180,7 @@ export function inject(options: InjectOptions = {}): void {
|
|
|
180
180
|
|
|
181
181
|
const scripts = (pkg["scripts"] ?? {}) as Record<string, string>;
|
|
182
182
|
if (!scripts["prepare"] || force) {
|
|
183
|
-
scripts["prepare"] = "
|
|
183
|
+
scripts["prepare"] = "opencode-agent inject";
|
|
184
184
|
pkg["scripts"] = scripts;
|
|
185
185
|
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
|
|
186
186
|
log(`Added "prepare": "dev-agents inject" to package.json`);
|