arkaos 2.4.2 → 2.4.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/installer/update.js +125 -26
- package/package.json +1 -1
- package/pyproject.toml +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.3
|
package/installer/update.js
CHANGED
|
@@ -1,52 +1,151 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join, dirname } from "node:path";
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync, copyFileSync, chmodSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { join, dirname, resolve } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { execSync } from "node:child_process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const
|
|
8
|
+
const ARKAOS_ROOT = resolve(__dirname, "..");
|
|
9
|
+
const VERSION = JSON.parse(readFileSync(join(ARKAOS_ROOT, "package.json"), "utf-8")).version;
|
|
9
10
|
|
|
10
11
|
export async function update() {
|
|
11
12
|
const installDir = join(homedir(), ".arkaos");
|
|
12
13
|
const manifestPath = join(installDir, "install-manifest.json");
|
|
14
|
+
const profilePath = join(installDir, "profile.json");
|
|
13
15
|
|
|
14
16
|
if (!existsSync(manifestPath)) {
|
|
15
|
-
console.error(" ArkaOS is not installed. Run: npx arkaos install");
|
|
17
|
+
console.error("\n ArkaOS is not installed. Run: npx arkaos install\n");
|
|
16
18
|
process.exit(1);
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
20
|
-
|
|
21
|
-
console.log(` Installed: v${manifest.version}`);
|
|
22
|
-
console.log(` Current: v${CURRENT_VERSION}\n`);
|
|
22
|
+
const profile = existsSync(profilePath) ? JSON.parse(readFileSync(profilePath, "utf-8")) : {};
|
|
23
23
|
|
|
24
|
-
// Check
|
|
25
|
-
let latestVersion;
|
|
24
|
+
// Check latest version
|
|
25
|
+
let latestVersion = VERSION;
|
|
26
26
|
try {
|
|
27
27
|
latestVersion = execSync("npm view arkaos version 2>/dev/null", { stdio: "pipe" }).toString().trim();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
} catch {}
|
|
29
|
+
|
|
30
|
+
console.log(`
|
|
31
|
+
ArkaOS Update
|
|
32
|
+
─────────────
|
|
33
|
+
Installed: v${manifest.version}
|
|
34
|
+
Package: v${VERSION}
|
|
35
|
+
Latest: v${latestVersion}
|
|
36
|
+
`);
|
|
33
37
|
|
|
34
|
-
if (latestVersion &&
|
|
35
|
-
console.log("
|
|
38
|
+
if (manifest.version === latestVersion && manifest.version === VERSION && !process.argv.includes("--force")) {
|
|
39
|
+
console.log(" ✓ Already up to date.\n");
|
|
36
40
|
return;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
console.log("
|
|
43
|
+
console.log(" Updating (keeping your configuration)...\n");
|
|
44
|
+
|
|
45
|
+
const pythonCmd = manifest.pythonCmd || "python3";
|
|
46
|
+
|
|
47
|
+
// ── 1. Update Python deps ──
|
|
48
|
+
console.log(" [1/6] Updating Python dependencies...");
|
|
40
49
|
try {
|
|
41
|
-
|
|
42
|
-
execSync(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
const coreDeps = "pyyaml pydantic rich click jinja2";
|
|
51
|
+
execSync(`${pythonCmd} -m pip install --upgrade ${coreDeps} --quiet`, { stdio: "pipe", timeout: 120000 });
|
|
52
|
+
console.log(" ✓ Core deps updated");
|
|
53
|
+
|
|
54
|
+
// Only update optional deps if they were installed before
|
|
55
|
+
try {
|
|
56
|
+
execSync(`${pythonCmd} -c "import fastembed"`, { stdio: "pipe" });
|
|
57
|
+
execSync(`${pythonCmd} -m pip install --upgrade fastembed sqlite-vss --quiet`, { stdio: "pipe", timeout: 180000 });
|
|
58
|
+
console.log(" ✓ Knowledge deps updated");
|
|
59
|
+
} catch { /* not installed, skip */ }
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
execSync(`${pythonCmd} -c "import fastapi"`, { stdio: "pipe" });
|
|
63
|
+
execSync(`${pythonCmd} -m pip install --upgrade fastapi uvicorn --quiet`, { stdio: "pipe", timeout: 60000 });
|
|
64
|
+
console.log(" ✓ Dashboard deps updated");
|
|
65
|
+
} catch { /* not installed, skip */ }
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
execSync(`${pythonCmd} -m pip install -e "${ARKAOS_ROOT}" --quiet`, { stdio: "pipe", timeout: 60000 });
|
|
69
|
+
} catch {}
|
|
47
70
|
} catch (err) {
|
|
48
|
-
console.
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
console.log(` ⚠ Some deps failed: ${err.message.slice(0, 80)}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ── 2. Update config files ──
|
|
75
|
+
console.log(" [2/6] Updating configuration...");
|
|
76
|
+
const constitutionSrc = join(ARKAOS_ROOT, "config", "constitution.yaml");
|
|
77
|
+
if (existsSync(constitutionSrc)) {
|
|
78
|
+
mkdirSync(join(installDir, "config"), { recursive: true });
|
|
79
|
+
copyFileSync(constitutionSrc, join(installDir, "config", "constitution.yaml"));
|
|
80
|
+
console.log(" ✓ Constitution updated");
|
|
51
81
|
}
|
|
82
|
+
|
|
83
|
+
// ── 3. Update hooks ──
|
|
84
|
+
console.log(" [3/6] Updating hooks...");
|
|
85
|
+
const hookMap = {
|
|
86
|
+
"user-prompt-submit-v2.sh": "user-prompt-submit.sh",
|
|
87
|
+
"post-tool-use-v2.sh": "post-tool-use.sh",
|
|
88
|
+
"pre-compact-v2.sh": "pre-compact.sh",
|
|
89
|
+
};
|
|
90
|
+
const srcHooksDir = join(ARKAOS_ROOT, "config", "hooks");
|
|
91
|
+
const destHooksDir = join(installDir, "config", "hooks");
|
|
92
|
+
mkdirSync(destHooksDir, { recursive: true });
|
|
93
|
+
|
|
94
|
+
for (const [src, dest] of Object.entries(hookMap)) {
|
|
95
|
+
const srcPath = join(srcHooksDir, src);
|
|
96
|
+
const destPath = join(destHooksDir, dest);
|
|
97
|
+
if (existsSync(srcPath)) {
|
|
98
|
+
let content = readFileSync(srcPath, "utf-8");
|
|
99
|
+
content = content.replace(
|
|
100
|
+
/ARKAOS_ROOT="\$\{ARKA_OS:-\$HOME\/\.claude\/skills\/arkaos\}"/g,
|
|
101
|
+
`ARKAOS_ROOT="${ARKAOS_ROOT}"`
|
|
102
|
+
);
|
|
103
|
+
content = content.replace(
|
|
104
|
+
/ARKAOS_HOME="\$\{HOME\}\/\.arkaos"/g,
|
|
105
|
+
`ARKAOS_HOME="${installDir}"`
|
|
106
|
+
);
|
|
107
|
+
writeFileSync(destPath, content);
|
|
108
|
+
try { chmodSync(destPath, 0o755); } catch {}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
console.log(" ✓ Hooks updated");
|
|
112
|
+
|
|
113
|
+
// ── 4. Update /arka skill ──
|
|
114
|
+
console.log(" [4/6] Updating /arka skill...");
|
|
115
|
+
const skillSrc = join(ARKAOS_ROOT, "arka", "SKILL.md");
|
|
116
|
+
const skillDest = join(homedir(), ".claude", "skills", "arka");
|
|
117
|
+
mkdirSync(skillDest, { recursive: true });
|
|
118
|
+
if (existsSync(skillSrc)) {
|
|
119
|
+
copyFileSync(skillSrc, join(skillDest, "SKILL.md"));
|
|
120
|
+
writeFileSync(join(skillDest, ".repo-path"), ARKAOS_ROOT);
|
|
121
|
+
writeFileSync(join(skillDest, "VERSION"), VERSION);
|
|
122
|
+
console.log(" ✓ /arka skill updated");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ── 5. Update .repo-path ──
|
|
126
|
+
console.log(" [5/6] Updating references...");
|
|
127
|
+
writeFileSync(join(installDir, ".repo-path"), ARKAOS_ROOT);
|
|
128
|
+
console.log(" ✓ Repo path updated");
|
|
129
|
+
|
|
130
|
+
// ── 6. Update manifest ──
|
|
131
|
+
console.log(" [6/6] Finalizing...");
|
|
132
|
+
manifest.version = VERSION;
|
|
133
|
+
manifest.repoRoot = ARKAOS_ROOT;
|
|
134
|
+
manifest.updatedAt = new Date().toISOString();
|
|
135
|
+
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
136
|
+
console.log(" ✓ Manifest updated");
|
|
137
|
+
|
|
138
|
+
console.log(`
|
|
139
|
+
╔══════════════════════════════════════════╗
|
|
140
|
+
║ ArkaOS updated to v${VERSION} ║
|
|
141
|
+
╚══════════════════════════════════════════╝
|
|
142
|
+
|
|
143
|
+
Your configuration is preserved:
|
|
144
|
+
Language: ${profile.language || "not set"}
|
|
145
|
+
Market: ${profile.market || "not set"}
|
|
146
|
+
Projects: ${profile.projectsDir || "not set"}
|
|
147
|
+
Vault: ${profile.vaultPath || "not set"}
|
|
148
|
+
|
|
149
|
+
Run 'npx arkaos doctor' to verify.
|
|
150
|
+
`);
|
|
52
151
|
}
|
package/package.json
CHANGED