openmoneta-dev-kit 1.10.1 → 1.10.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/VERSION +1 -1
- package/package.json +3 -2
- package/src/commands/init.js +19 -6
- package/src/commands/install.js +5 -5
- package/src/commands/uninstall.js +15 -7
- package/src/commands/update.js +16 -7
- package/src/lib/paths.js +13 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.10.
|
|
1
|
+
1.10.3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmoneta-dev-kit",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "OpenMoneta Dev Kit — Biến Cursor IDE / OpenCode thành team developer hoàn chỉnh với quy trình 6 bước, adaptive planning, hooks enforcement, và token-aware doc routing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cursor",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"os": [
|
|
47
47
|
"darwin",
|
|
48
|
-
"linux"
|
|
48
|
+
"linux",
|
|
49
|
+
"win32"
|
|
49
50
|
]
|
|
50
51
|
}
|
package/src/commands/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { execSync } = require("node:child_process")
|
|
2
2
|
const path = require("node:path")
|
|
3
|
-
const { getPkgRoot, OPENCODE_DIR } = require("../lib/paths")
|
|
3
|
+
const { getPkgRoot, OPENCODE_DIR, isWindows } = require("../lib/paths")
|
|
4
4
|
|
|
5
5
|
async function run(args) {
|
|
6
6
|
let projectDir = process.cwd()
|
|
@@ -23,19 +23,32 @@ async function run(args) {
|
|
|
23
23
|
const pkgRoot = getPkgRoot()
|
|
24
24
|
const initScript = path.join(pkgRoot, "scripts", "init-project.sh")
|
|
25
25
|
|
|
26
|
-
// If opencode, use opencode install path
|
|
27
26
|
const env = { ...process.env }
|
|
28
27
|
if (isOpenCode) {
|
|
29
28
|
env.OPENMONETA_HOME = OPENCODE_DIR
|
|
30
29
|
console.log(` Mode: OpenCode`)
|
|
31
30
|
}
|
|
32
31
|
|
|
32
|
+
const shellCmd = isWindows()
|
|
33
|
+
? `bash "${initScript}" "${projectDir}" ${remaining.join(" ")}`
|
|
34
|
+
: `bash "${initScript}" "${projectDir}" ${remaining.join(" ")}`
|
|
35
|
+
|
|
36
|
+
console.log(` Running: ${shellCmd}`)
|
|
37
|
+
|
|
33
38
|
try {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
if (isWindows()) {
|
|
40
|
+
execSync(shellCmd, { stdio: "inherit", env, shell: true })
|
|
41
|
+
} else {
|
|
42
|
+
execSync(shellCmd, { stdio: "inherit", env })
|
|
43
|
+
}
|
|
37
44
|
} catch (err) {
|
|
38
|
-
|
|
45
|
+
if (isWindows()) {
|
|
46
|
+
console.error(`\n ❌ Init thất bại. Windows cần Git Bash để chạy init-project.sh.`)
|
|
47
|
+
console.error(` Cài Git for Windows: https://git-scm.com/download/win`)
|
|
48
|
+
console.error(` Sau đó chạy lại: openmoneta init`)
|
|
49
|
+
} else {
|
|
50
|
+
console.error(`\n ❌ Init thất bại: ${err.message}`)
|
|
51
|
+
}
|
|
39
52
|
process.exit(1)
|
|
40
53
|
}
|
|
41
54
|
}
|
package/src/commands/install.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { execSync } = require("node:child_process")
|
|
2
2
|
const path = require("node:path")
|
|
3
|
-
const { getPkgRoot } = require("../lib/paths")
|
|
3
|
+
const { getPkgRoot, runScript } = require("../lib/paths")
|
|
4
4
|
const { getLocalVersion } = require("../lib/version")
|
|
5
5
|
|
|
6
6
|
async function run(args) {
|
|
@@ -20,10 +20,10 @@ async function run(args) {
|
|
|
20
20
|
console.log(`\n 🔧 Cài OpenMoneta Dev Kit v${v} cho OpenCode`)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
// Cursor install
|
|
24
23
|
if (both || cursorOnly) {
|
|
25
24
|
try {
|
|
26
|
-
const
|
|
25
|
+
const flags = autoYes ? "--yes" : ""
|
|
26
|
+
const cmd = `${runScript("install.sh", pkgRoot)} ${flags}`.trim()
|
|
27
27
|
console.log(`\n ▶ Cursor...`)
|
|
28
28
|
execSync(cmd, { stdio: "inherit", cwd: pkgRoot })
|
|
29
29
|
console.log(` ✅ Cursor done.`)
|
|
@@ -32,10 +32,10 @@ async function run(args) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
// OpenCode install
|
|
36
35
|
if (both || opencodeOnly) {
|
|
37
36
|
try {
|
|
38
|
-
const
|
|
37
|
+
const flags = autoYes ? "--yes" : ""
|
|
38
|
+
const cmd = `${runScript("install-opencode.sh", pkgRoot)} ${flags}`.trim()
|
|
39
39
|
console.log(`\n ▶ OpenCode...`)
|
|
40
40
|
execSync(cmd, { stdio: "inherit", cwd: pkgRoot })
|
|
41
41
|
console.log(` ✅ OpenCode done.`)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { unlinkSync, rmdirSync, existsSync, readdirSync, lstatSync } = require("node:fs")
|
|
2
2
|
const path = require("node:path")
|
|
3
3
|
const { execSync } = require("node:child_process")
|
|
4
|
-
const { CURSOR_DIR, OPENCODE_DIR, isInstalled, getPkgRoot } = require("../lib/paths")
|
|
4
|
+
const { CURSOR_DIR, OPENCODE_DIR, isInstalled, getPkgRoot, isWindows, runScript } = require("../lib/paths")
|
|
5
5
|
|
|
6
6
|
function rmDir(dir) {
|
|
7
7
|
if (!existsSync(dir)) return
|
|
@@ -39,20 +39,28 @@ async function run(args) {
|
|
|
39
39
|
|
|
40
40
|
console.log(`\n 🗑 Uninstalling OpenMoneta Dev Kit...`)
|
|
41
41
|
|
|
42
|
-
// Try calling uninstall.sh first (handles backup restore)
|
|
43
42
|
const pkgRoot = getPkgRoot()
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
const flags = [autoYes ? "--yes" : "", purge ? "--purge" : ""].filter(Boolean).join(" ")
|
|
44
|
+
|
|
45
|
+
if (isWindows()) {
|
|
46
46
|
try {
|
|
47
|
-
|
|
48
|
-
execSync(`bash "${uninstallScript}" ${flags}`, { stdio: "inherit" })
|
|
47
|
+
execSync(`${runScript("uninstall.sh", pkgRoot)} ${flags}`.trim(), { stdio: "inherit", cwd: pkgRoot })
|
|
49
48
|
return
|
|
50
49
|
} catch {
|
|
51
50
|
console.log(` Manual uninstall...`)
|
|
52
51
|
}
|
|
52
|
+
} else {
|
|
53
|
+
const uninstallScript = path.join(pkgRoot, "uninstall.sh")
|
|
54
|
+
if (existsSync(uninstallScript)) {
|
|
55
|
+
try {
|
|
56
|
+
execSync(`bash "${uninstallScript}" ${flags}`.trim(), { stdio: "inherit" })
|
|
57
|
+
return
|
|
58
|
+
} catch {
|
|
59
|
+
console.log(` Manual uninstall...`)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
|
|
55
|
-
// Manual removal
|
|
56
64
|
for (const dir of [CURSOR_DIR, OPENCODE_DIR]) {
|
|
57
65
|
if (!existsSync(dir)) continue
|
|
58
66
|
for (const item of ["templates", "skills", "agents", "hooks", "scripts"]) {
|
package/src/commands/update.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { execSync } = require("node:child_process")
|
|
2
2
|
const path = require("node:path")
|
|
3
|
-
const { getPkgRoot, isInstalled } = require("../lib/paths")
|
|
3
|
+
const { getPkgRoot, isInstalled, isWindows, runScript } = require("../lib/paths")
|
|
4
4
|
const { getLocalVersion, getLatestVersion } = require("../lib/version")
|
|
5
5
|
|
|
6
6
|
async function run(args) {
|
|
@@ -42,7 +42,7 @@ async function run(args) {
|
|
|
42
42
|
if (isInstalled("cursor")) {
|
|
43
43
|
console.log(`\n ▶ Cursor global...`)
|
|
44
44
|
try {
|
|
45
|
-
execSync(
|
|
45
|
+
execSync(`${runScript("install.sh", pkgRoot)} --yes`, { stdio: "inherit", cwd: pkgRoot })
|
|
46
46
|
} catch {
|
|
47
47
|
console.error(` ⚠ Cursor update failed`)
|
|
48
48
|
}
|
|
@@ -51,7 +51,7 @@ async function run(args) {
|
|
|
51
51
|
if (isInstalled("opencode")) {
|
|
52
52
|
console.log(`\n ▶ OpenCode global...`)
|
|
53
53
|
try {
|
|
54
|
-
execSync(
|
|
54
|
+
execSync(`${runScript("install-opencode.sh", pkgRoot)} --yes`, { stdio: "inherit", cwd: pkgRoot })
|
|
55
55
|
} catch {
|
|
56
56
|
console.error(` ⚠ OpenCode update failed`)
|
|
57
57
|
}
|
|
@@ -67,11 +67,20 @@ async function run(args) {
|
|
|
67
67
|
try {
|
|
68
68
|
require("node:fs").accessSync(docsIndex)
|
|
69
69
|
console.log(`\n ▶ Syncing project: ${path.basename(cwd)}`)
|
|
70
|
-
|
|
70
|
+
if (isWindows()) {
|
|
71
|
+
execSync(`bash "${initScript}" "${cwd}"`, { stdio: "inherit", shell: true })
|
|
72
|
+
} else {
|
|
73
|
+
execSync(`bash "${initScript}" "${cwd}"`, { stdio: "inherit" })
|
|
74
|
+
}
|
|
71
75
|
console.log(`\n ✅ Project synced.`)
|
|
72
|
-
} catch {
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
} catch (err) {
|
|
77
|
+
if (isWindows()) {
|
|
78
|
+
console.log(`\n ⚠ Không thể sync project (cần Git Bash). Cài tại: https://git-scm.com/download/win`)
|
|
79
|
+
console.log(` Sau đó chạy thủ công: bash "${initScript}" "${cwd}"`)
|
|
80
|
+
} else {
|
|
81
|
+
console.log(`\n ℹ Không phát hiện project OpenMoneta ở thư mục hiện tại.`)
|
|
82
|
+
console.log(` Sync thủ công: openmoneta init`)
|
|
83
|
+
}
|
|
75
84
|
}
|
|
76
85
|
}
|
|
77
86
|
|
package/src/lib/paths.js
CHANGED
|
@@ -31,6 +31,17 @@ function isInstalled(target) {
|
|
|
31
31
|
return installedVersion(target) !== null
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function isWindows() {
|
|
35
|
+
return process.platform === "win32"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function runScript(scriptName, pkgRoot) {
|
|
39
|
+
if (isWindows()) {
|
|
40
|
+
return `powershell.exe -ExecutionPolicy Bypass -File "${path.join(pkgRoot, scriptName.replace(/\\.sh$/, ".ps1"))}"`
|
|
41
|
+
}
|
|
42
|
+
return `bash "${path.join(pkgRoot, scriptName)}"`
|
|
43
|
+
}
|
|
44
|
+
|
|
34
45
|
module.exports = {
|
|
35
46
|
setPkgRoot(r) {
|
|
36
47
|
ROOT = r
|
|
@@ -43,4 +54,6 @@ module.exports = {
|
|
|
43
54
|
versionFilePath,
|
|
44
55
|
installedVersion,
|
|
45
56
|
isInstalled,
|
|
57
|
+
isWindows,
|
|
58
|
+
runScript,
|
|
46
59
|
}
|