arkaos 2.10.0 → 2.11.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.
Files changed (46) hide show
  1. package/README.md +318 -107
  2. package/VERSION +1 -1
  3. package/config/hooks/cwd-changed.ps1 +144 -0
  4. package/config/hooks/post-tool-use.ps1 +347 -0
  5. package/config/hooks/post-tool-use.sh +6 -6
  6. package/config/hooks/pre-compact.ps1 +238 -0
  7. package/config/hooks/pre-compact.sh +10 -6
  8. package/config/hooks/session-start.ps1 +109 -0
  9. package/config/hooks/session-start.sh +1 -1
  10. package/config/hooks/user-prompt-submit.ps1 +287 -0
  11. package/config/hooks/user-prompt-submit.sh +5 -2
  12. package/config/statusline.ps1 +160 -0
  13. package/core/cognition/__pycache__/__init__.cpython-313.pyc +0 -0
  14. package/core/cognition/capture/__pycache__/__init__.cpython-313.pyc +0 -0
  15. package/core/cognition/capture/__pycache__/collector.cpython-313.pyc +0 -0
  16. package/core/cognition/capture/__pycache__/store.cpython-313.pyc +0 -0
  17. package/core/cognition/insights/__pycache__/__init__.cpython-313.pyc +0 -0
  18. package/core/cognition/insights/__pycache__/store.cpython-313.pyc +0 -0
  19. package/core/cognition/memory/__pycache__/__init__.cpython-313.pyc +0 -0
  20. package/core/cognition/memory/__pycache__/obsidian.cpython-313.pyc +0 -0
  21. package/core/cognition/memory/__pycache__/schemas.cpython-313.pyc +0 -0
  22. package/core/cognition/memory/__pycache__/vector.cpython-313.pyc +0 -0
  23. package/core/cognition/memory/__pycache__/writer.cpython-313.pyc +0 -0
  24. package/core/cognition/research/__pycache__/__init__.cpython-313.pyc +0 -0
  25. package/core/cognition/research/__pycache__/profiler.cpython-313.pyc +0 -0
  26. package/core/cognition/scheduler/__pycache__/__init__.cpython-313.pyc +0 -0
  27. package/core/cognition/scheduler/__pycache__/cli.cpython-313.pyc +0 -0
  28. package/core/cognition/scheduler/__pycache__/daemon.cpython-313.pyc +0 -0
  29. package/core/cognition/scheduler/__pycache__/platform.cpython-313.pyc +0 -0
  30. package/core/cognition/scheduler/daemon.py +77 -21
  31. package/core/cognition/scheduler/platform.py +43 -12
  32. package/core/knowledge/__pycache__/vector_store.cpython-313.pyc +0 -0
  33. package/core/knowledge/vector_store.py +50 -25
  34. package/core/synapse/__pycache__/layers.cpython-313.pyc +0 -0
  35. package/core/synapse/layers.py +2 -2
  36. package/installer/adapters/claude-code.js +72 -45
  37. package/installer/cli.js +19 -6
  38. package/installer/doctor.js +130 -18
  39. package/installer/index.js +592 -149
  40. package/installer/platform.js +20 -0
  41. package/installer/prompts.js +109 -5
  42. package/installer/python-resolver.js +251 -0
  43. package/installer/update.js +497 -62
  44. package/package.json +1 -1
  45. package/pyproject.toml +2 -2
  46. package/scripts/start-dashboard.ps1 +271 -0
@@ -2,50 +2,75 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { homedir } from "node:os";
4
4
  import { execSync } from "node:child_process";
5
+ import { getArkaosPython, getVenvPython, canImportCore, getRepoRoot } from "./python-resolver.js";
6
+ import { IS_WINDOWS, HOOK_EXT, CMD_FINDER } from "./platform.js";
5
7
 
6
8
  const INSTALL_DIR = join(homedir(), ".arkaos");
7
9
 
10
+ // Resolve a single command via the platform-native locator. Returns true
11
+ // when the command is discoverable on PATH, false otherwise. stderr is
12
+ // suppressed through Node's stdio option so the probe does not print
13
+ // noise when the command is missing.
14
+ function commandExists(cmd) {
15
+ const finder = CMD_FINDER;
16
+ try {
17
+ execSync(`${finder} ${cmd}`, { stdio: ["pipe", "pipe", "ignore"] });
18
+ return true;
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+
8
24
  const checks = [
9
25
  {
10
26
  name: "install-dir",
11
27
  description: "ArkaOS installation directory exists",
12
28
  severity: "fail",
13
29
  check: () => existsSync(INSTALL_DIR),
14
- fix: "Run: npx arkaos install",
30
+ fix: () => "Run: npx arkaos install",
15
31
  },
16
32
  {
17
33
  name: "manifest",
18
34
  description: "Install manifest present",
19
35
  severity: "fail",
20
36
  check: () => existsSync(join(INSTALL_DIR, "install-manifest.json")),
21
- fix: "Run: npx arkaos install",
37
+ fix: () => "Run: npx arkaos install",
22
38
  },
23
39
  {
24
40
  name: "python",
25
41
  description: "Python 3.11+ available",
26
42
  severity: "fail",
27
43
  check: () => {
44
+ const py = getArkaosPython();
45
+ if (!py) return false;
28
46
  try {
29
- const v = execSync("python3 --version 2>&1", { stdio: "pipe" }).toString();
47
+ const v = execSync(`"${py}" --version 2>&1`, { stdio: "pipe" }).toString();
30
48
  const m = v.match(/(\d+)\.(\d+)/);
31
49
  return m && parseInt(m[1]) >= 3 && parseInt(m[2]) >= 11;
32
50
  } catch { return false; }
33
51
  },
34
- fix: "Install Python 3.11+: https://python.org",
52
+ fix: () => "Install Python 3.11+: https://python.org",
53
+ },
54
+ {
55
+ name: "venv",
56
+ description: "ArkaOS virtual environment exists",
57
+ severity: "warn",
58
+ check: () => existsSync(getVenvPython()),
59
+ fix: () => "Run: npx arkaos@latest update (creates venv automatically)",
35
60
  },
36
61
  {
37
62
  name: "hooks-dir",
38
63
  description: "Hook scripts installed",
39
64
  severity: "fail",
40
- check: () => existsSync(join(INSTALL_DIR, "config", "hooks", "user-prompt-submit.sh")),
41
- fix: "Run: npx arkaos install --force",
65
+ check: () => existsSync(join(INSTALL_DIR, "config", "hooks", `user-prompt-submit${HOOK_EXT}`)),
66
+ fix: () => "Run: npx arkaos install --force",
42
67
  },
43
68
  {
44
69
  name: "constitution",
45
70
  description: "Constitution YAML present",
46
71
  severity: "warn",
47
72
  check: () => existsSync(join(INSTALL_DIR, "config", "constitution.yaml")),
48
- fix: "Run: npx arkaos install --force",
73
+ fix: () => "Run: npx arkaos install --force",
49
74
  },
50
75
  {
51
76
  name: "repo-path",
@@ -57,29 +82,93 @@ const checks = [
57
82
  const root = readFileSync(p, "utf-8").trim();
58
83
  return existsSync(root);
59
84
  },
60
- fix: "Run: npx arkaos install --force",
85
+ fix: () => "Run: npx arkaos install --force",
61
86
  },
62
87
  {
63
88
  name: "profile",
64
89
  description: "User profile exists",
65
90
  severity: "warn",
66
91
  check: () => existsSync(join(INSTALL_DIR, "profile.json")),
67
- fix: "Run: npx arkaos install",
92
+ fix: () => "Run: npx arkaos install",
68
93
  },
69
94
  {
70
95
  name: "python-core",
71
96
  description: "Python core engine importable",
72
97
  severity: "warn",
73
- check: () => {
74
- try {
75
- execSync('python3 -c "from core.synapse.engine import SynapseEngine"', { stdio: "pipe" });
76
- return true;
77
- } catch { return false; }
98
+ check: () => canImportCore(),
99
+ fix: () => {
100
+ const py = getArkaosPython();
101
+ const root = getRepoRoot();
102
+ if (py && root) {
103
+ return `Run: "${py}" -m pip install -e "${root}"`;
104
+ }
105
+ return "Run: npx arkaos@latest update (reinstalls Python core)";
78
106
  },
79
- fix: "Run: pip install -e <arkaos-root>",
107
+ },
108
+ {
109
+ name: "scheduler",
110
+ description: "Cognitive scheduler config deployed",
111
+ severity: "warn",
112
+ check: () => existsSync(join(INSTALL_DIR, "schedules.yaml")),
113
+ fix: () => "Run: npx arkaos@latest update (deploys scheduler)",
80
114
  },
81
115
  ];
82
116
 
117
+ // ─── Windows-only checks ───────────────────────────────────────────────
118
+ // Appended conditionally so non-Windows runs are byte-for-byte unchanged.
119
+ if (IS_WINDOWS) {
120
+ checks.push(
121
+ {
122
+ name: "powershell",
123
+ description: "PowerShell 5.1+ available",
124
+ severity: "fail",
125
+ check: () => {
126
+ try {
127
+ const out = execSync(
128
+ 'powershell -NoProfile -Command "$PSVersionTable.PSVersion.Major"',
129
+ { stdio: ["pipe", "pipe", "ignore"] }
130
+ ).toString().trim();
131
+ const major = parseInt(out, 10);
132
+ return Number.isFinite(major) && major >= 5;
133
+ } catch {
134
+ return false;
135
+ }
136
+ },
137
+ fix: () => "Install Windows PowerShell 5.1+ (ships with every Windows 10/11).",
138
+ },
139
+ {
140
+ name: "arka-claude-wrapper",
141
+ description: "arka-claude wrapper installed (.cmd + .ps1)",
142
+ severity: "warn",
143
+ check: () =>
144
+ existsSync(join(INSTALL_DIR, "bin", "arka-claude.cmd")) &&
145
+ existsSync(join(INSTALL_DIR, "bin", "arka-claude.ps1")),
146
+ fix: () => "Run: npx arkaos install --force",
147
+ },
148
+ {
149
+ name: "schtasks",
150
+ description: "schtasks available (cognitive scheduler backend)",
151
+ severity: "warn",
152
+ check: () => commandExists("schtasks"),
153
+ fix: () => "schtasks ships with Windows by default; verify %WINDIR%\\System32 is on PATH.",
154
+ },
155
+ {
156
+ name: "venv-scripts",
157
+ description: "Venv Python at %USERPROFILE%\\.arkaos\\venv\\Scripts\\python.exe",
158
+ severity: "warn",
159
+ check: () => {
160
+ const venvPy = getVenvPython();
161
+ // Only meaningful if venv exists at all. The "venv" check above
162
+ // covers absence; this one guards against a macOS-shaped venv
163
+ // being mistaken for a Windows venv (bin/ instead of Scripts/).
164
+ if (!existsSync(join(INSTALL_DIR, "venv"))) return true;
165
+ return existsSync(venvPy) && venvPy.toLowerCase().endsWith("\\scripts\\python.exe");
166
+ },
167
+ fix: () => "Remove %USERPROFILE%\\.arkaos\\venv and run: npx arkaos@latest update",
168
+ }
169
+ );
170
+ }
171
+
83
172
  export async function doctor() {
84
173
  console.log("\n ArkaOS Doctor — Health Checks\n");
85
174
 
@@ -88,11 +177,34 @@ export async function doctor() {
88
177
  let failed = 0;
89
178
 
90
179
  for (const check of checks) {
91
- const ok = check.check();
92
- const icon = ok ? "\x1b[32m✓\x1b[0m" : (check.severity === "fail" ? "\x1b[31m✗\x1b[0m" : "\x1b[33m!\x1b[0m");
180
+ // A single check that throws must not crash the rest of the doctor.
181
+ // Treat the exception as "check failed" and record a short hint so
182
+ // the user can see what blew up. Also keep any stack-trace noise
183
+ // out of the console output.
184
+ let ok = false;
185
+ let checkError = null;
186
+ try {
187
+ ok = !!check.check();
188
+ } catch (err) {
189
+ checkError = err && err.message ? String(err.message).split("\n")[0].slice(0, 120) : String(err);
190
+ }
191
+
192
+ const icon = ok
193
+ ? "\x1b[32m\u2713\x1b[0m"
194
+ : (check.severity === "fail" ? "\x1b[31m\u2717\x1b[0m" : "\x1b[33m!\x1b[0m");
93
195
  console.log(` ${icon} ${check.description}`);
196
+
94
197
  if (!ok) {
95
- console.log(` Fix: ${check.fix}`);
198
+ if (checkError) {
199
+ console.log(` Error: ${checkError}`);
200
+ }
201
+ let fixHint;
202
+ try {
203
+ fixHint = check.fix();
204
+ } catch (err) {
205
+ fixHint = "(fix hint unavailable)";
206
+ }
207
+ console.log(` Fix: ${fixHint}`);
96
208
  if (check.severity === "fail") failed++;
97
209
  else warned++;
98
210
  } else {