arkaos 2.18.1 → 2.19.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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.18.1
1
+ 2.19.0
@@ -43,7 +43,13 @@ if ([string]::IsNullOrWhiteSpace($newCwd)) { exit 0 }
43
43
  if (-not (Test-Path -LiteralPath $newCwd -PathType Container)) { exit 0 }
44
44
 
45
45
  # ─── Detect ecosystem from ecosystems.json ─────────────────────────────
46
- $ecosystemsFile = Join-Path $env:USERPROFILE '.claude\skills\arka\knowledge\ecosystems.json'
46
+ # Canonical path is %USERPROFILE%\.arkaos\ecosystems.json (ADR 2026-04-17).
47
+ # Falls back to the legacy skill-dir path until v2.21.0.
48
+ $ecosystemsFile = Join-Path $env:USERPROFILE '.arkaos\ecosystems.json'
49
+ if (-not (Test-Path -LiteralPath $ecosystemsFile)) {
50
+ $legacyEcosystems = Join-Path $env:USERPROFILE '.claude\skills\arka\knowledge\ecosystems.json'
51
+ if (Test-Path -LiteralPath $legacyEcosystems) { $ecosystemsFile = $legacyEcosystems }
52
+ }
47
53
  $ecosystem = ''
48
54
  $ecosystemName = ''
49
55
 
@@ -115,15 +121,17 @@ if (Test-Path -LiteralPath $composerJson) {
115
121
 
116
122
  # ─── Check for project descriptor ─────────────────────────────────────
117
123
  $dirName = Split-Path -Leaf $newCwd.TrimEnd('\','/')
118
- $projectsDir = Join-Path $env:USERPROFILE '.claude\skills\arka\projects'
119
- $descriptorFile = Join-Path $projectsDir "$dirName.md"
120
- $descriptorDir = Join-Path (Join-Path $projectsDir $dirName) 'PROJECT.md'
124
+ $newProjectsDir = Join-Path $env:USERPROFILE '.arkaos\projects'
125
+ $legacyProjectsDir = Join-Path $env:USERPROFILE '.claude\skills\arka\projects'
121
126
 
122
127
  $descriptor = ''
123
- if (Test-Path -LiteralPath $descriptorFile) {
124
- $descriptor = $descriptorFile
125
- } elseif (Test-Path -LiteralPath $descriptorDir) {
126
- $descriptor = $descriptorDir
128
+ foreach ($candidate in @(
129
+ (Join-Path $newProjectsDir "$dirName.md"),
130
+ (Join-Path (Join-Path $newProjectsDir $dirName) 'PROJECT.md'),
131
+ (Join-Path $legacyProjectsDir "$dirName.md"),
132
+ (Join-Path (Join-Path $legacyProjectsDir $dirName) 'PROJECT.md')
133
+ )) {
134
+ if (Test-Path -LiteralPath $candidate) { $descriptor = $candidate; break }
127
135
  }
128
136
 
129
137
  # ─── Build context output ─────────────────────────────────────────────
@@ -13,7 +13,13 @@ if [ -z "$NEW_CWD" ] || [ ! -d "$NEW_CWD" ]; then
13
13
  fi
14
14
 
15
15
  # ─── Detect ecosystem from ecosystems.json ─────────────────────────────
16
- ECOSYSTEMS_FILE="$HOME/.claude/skills/arka/knowledge/ecosystems.json"
16
+ # Canonical path is ~/.arkaos/ecosystems.json (ADR 2026-04-17). During the
17
+ # deprecation window we fall back to the legacy skill-dir path. The legacy
18
+ # fallback is removed in v2.21.0.
19
+ ECOSYSTEMS_FILE="$HOME/.arkaos/ecosystems.json"
20
+ if [ ! -f "$ECOSYSTEMS_FILE" ] && [ -f "$HOME/.claude/skills/arka/knowledge/ecosystems.json" ]; then
21
+ ECOSYSTEMS_FILE="$HOME/.claude/skills/arka/knowledge/ecosystems.json"
22
+ fi
17
23
  ECOSYSTEM=""
18
24
  ECOSYSTEM_NAME=""
19
25
 
@@ -75,16 +81,19 @@ elif [ -f "$NEW_CWD/pyproject.toml" ]; then
75
81
  fi
76
82
 
77
83
  # ─── Check for project descriptor ─────────────────────────────────────
84
+ # New canonical path: ~/.arkaos/projects/. Legacy fallback remains until v2.21.0.
78
85
  DIR_NAME=$(basename "$NEW_CWD")
79
86
  DESCRIPTOR=""
80
- DESCRIPTOR_FILE="$HOME/.claude/skills/arka/projects/${DIR_NAME}.md"
81
- DESCRIPTOR_DIR="$HOME/.claude/skills/arka/projects/${DIR_NAME}/PROJECT.md"
82
-
83
- if [ -f "$DESCRIPTOR_FILE" ]; then
84
- DESCRIPTOR="$DESCRIPTOR_FILE"
85
- elif [ -f "$DESCRIPTOR_DIR" ]; then
86
- DESCRIPTOR="$DESCRIPTOR_DIR"
87
- fi
87
+ for CANDIDATE in \
88
+ "$HOME/.arkaos/projects/${DIR_NAME}.md" \
89
+ "$HOME/.arkaos/projects/${DIR_NAME}/PROJECT.md" \
90
+ "$HOME/.claude/skills/arka/projects/${DIR_NAME}.md" \
91
+ "$HOME/.claude/skills/arka/projects/${DIR_NAME}/PROJECT.md"; do
92
+ if [ -f "$CANDIDATE" ]; then
93
+ DESCRIPTOR="$CANDIDATE"
94
+ break
95
+ fi
96
+ done
88
97
 
89
98
  # ─── Build context output ─────────────────────────────────────────────
90
99
  CONTEXT=""
@@ -0,0 +1,115 @@
1
+ """Canonical resolver for ArkaOS user-local data paths.
2
+
3
+ User-mutable data lives under ~/.arkaos/. The installed skill bundle at
4
+ ~/.claude/skills/arka/ is read-only and installer-managed. Two historical
5
+ paths still receive user writes in some installs:
6
+
7
+ ~/.claude/skills/arka/projects/*.md
8
+ ~/.claude/skills/arka/knowledge/ecosystems.json
9
+
10
+ This module returns the canonical new path when present, falls back to the
11
+ legacy path with a one-shot deprecation warning, and returns None when
12
+ neither exists. Callers treat None as empty. See ADR
13
+ docs/adr/2026-04-17-user-data-separation.md.
14
+
15
+ Legacy fallback sunsets in v2.21.0.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import logging
21
+ from pathlib import Path
22
+
23
+ logger = logging.getLogger(__name__)
24
+
25
+ _LEGACY_SKILLS_ROOT = Path.home() / ".claude" / "skills" / "arka"
26
+ _USER_DATA_ROOT = Path.home() / ".arkaos"
27
+
28
+ _warned: set[str] = set()
29
+
30
+
31
+ def user_data_root() -> Path:
32
+ """Root directory for ArkaOS user-local state."""
33
+ return _USER_DATA_ROOT
34
+
35
+
36
+ def projects_dir() -> Path | None:
37
+ """Resolve the user projects directory.
38
+
39
+ Returns the new path when it exists, else the legacy path with a
40
+ one-shot deprecation warning, else None.
41
+ """
42
+ new = _USER_DATA_ROOT / "projects"
43
+ legacy = _LEGACY_SKILLS_ROOT / "projects"
44
+ return _resolve_with_fallback("projects_dir", new, legacy)
45
+
46
+
47
+ def ecosystems_file() -> Path | None:
48
+ """Resolve the ecosystems registry file.
49
+
50
+ Returns the new path when it exists, else the legacy path with a
51
+ one-shot deprecation warning, else None.
52
+ """
53
+ new = _USER_DATA_ROOT / "ecosystems.json"
54
+ legacy = _LEGACY_SKILLS_ROOT / "knowledge" / "ecosystems.json"
55
+ return _resolve_with_fallback("ecosystems_file", new, legacy)
56
+
57
+
58
+ def projects_dir_for_write() -> Path:
59
+ """Return the write target for user project descriptors.
60
+
61
+ Writers always target the new path. The directory is created if absent.
62
+ """
63
+ new = _USER_DATA_ROOT / "projects"
64
+ new.mkdir(parents=True, exist_ok=True)
65
+ return new
66
+
67
+
68
+ def ecosystems_file_for_write() -> Path:
69
+ """Return the write target for the ecosystems registry.
70
+
71
+ Writers always target the new path. Parent directory is created if absent.
72
+ """
73
+ new = _USER_DATA_ROOT / "ecosystems.json"
74
+ new.parent.mkdir(parents=True, exist_ok=True)
75
+ return new
76
+
77
+
78
+ def legacy_projects_dir() -> Path:
79
+ """Legacy projects directory (for migration tooling only)."""
80
+ return _LEGACY_SKILLS_ROOT / "projects"
81
+
82
+
83
+ def legacy_ecosystems_file() -> Path:
84
+ """Legacy ecosystems file (for migration tooling only)."""
85
+ return _LEGACY_SKILLS_ROOT / "knowledge" / "ecosystems.json"
86
+
87
+
88
+ def reset_warnings() -> None:
89
+ """Clear the per-process deprecation warning cache.
90
+
91
+ Intended for tests. Real runtime should emit each warning exactly once.
92
+ """
93
+ _warned.clear()
94
+
95
+
96
+ def _resolve_with_fallback(kind: str, new: Path, legacy: Path) -> Path | None:
97
+ if new.exists():
98
+ return new
99
+ if legacy.exists():
100
+ _warn_once(kind, legacy)
101
+ return legacy
102
+ return None
103
+
104
+
105
+ def _warn_once(kind: str, legacy: Path) -> None:
106
+ if kind in _warned:
107
+ return
108
+ _warned.add(kind)
109
+ logger.warning(
110
+ "ArkaOS: reading %s from legacy location %s. "
111
+ "This path is deprecated and will be removed in v2.21.0. "
112
+ "Run `npx arkaos@latest migrate-user-data` or `/arka update` to move your data to ~/.arkaos/.",
113
+ kind,
114
+ legacy,
115
+ )
@@ -11,6 +11,10 @@ import re
11
11
  import sys
12
12
  from pathlib import Path
13
13
 
14
+ from core.runtime.user_paths import (
15
+ ecosystems_file as resolve_ecosystems_file,
16
+ projects_dir as resolve_projects_dir,
17
+ )
14
18
  from core.sync.manifest import build_manifest
15
19
  from core.sync.discovery import discover_all_projects
16
20
  from core.sync.mcp_optimizer import optimize_all_mcps
@@ -169,13 +173,29 @@ def _parse_scan_dirs(projects_dir_str: str) -> list[Path]:
169
173
 
170
174
 
171
175
  def _discover_projects(arkaos_home: Path, skills_dir: Path) -> list:
172
- """Combine profile.json dirs, descriptor dir, and ecosystems into projects."""
173
- descriptor_dir = skills_dir / "arka" / "projects"
174
- ecosystems_file = skills_dir / "arka" / "knowledge" / "ecosystems.json"
176
+ """Combine profile.json dirs, descriptor dir, and ecosystems into projects.
177
+
178
+ Project descriptors and the ecosystems registry are user-local data and
179
+ live under ~/.arkaos/ (see ADR 2026-04-17-user-data-separation). During
180
+ the deprecation window, reads fall back to the legacy paths under
181
+ skills_dir with a one-shot warning. `skills_dir` is kept in the
182
+ signature for backward compatibility and test ergonomics but is no
183
+ longer consulted for user data.
184
+ """
185
+ del skills_dir # retained for signature stability; unused.
186
+
187
+ descriptor_dir = resolve_projects_dir()
188
+ ecosystems_path = resolve_ecosystems_file()
189
+
190
+ # discover_all_projects treats missing paths as empty; pass a stable
191
+ # sentinel when the resolver returned None so downstream .exists()
192
+ # checks short-circuit cleanly.
193
+ descriptor_dir = descriptor_dir or (Path.home() / ".arkaos" / "projects")
194
+ ecosystems_path = ecosystems_path or (Path.home() / ".arkaos" / "ecosystems.json")
175
195
 
176
196
  scan_dirs = _load_scan_dirs_from_profile(arkaos_home)
177
197
 
178
- return discover_all_projects(descriptor_dir, scan_dirs, ecosystems_file)
198
+ return discover_all_projects(descriptor_dir, scan_dirs, ecosystems_path)
179
199
 
180
200
 
181
201
  def _load_scan_dirs_from_profile(arkaos_home: Path) -> list[Path]:
package/installer/cli.js CHANGED
@@ -41,6 +41,7 @@ Usage:
41
41
  npx arkaos init Initialize project config (.arkaos.json)
42
42
  npx arkaos update Update to latest version
43
43
  npx arkaos migrate Migrate from v1 to v2
44
+ npx arkaos migrate-user-data Move user data (~/.claude/skills/arka/ → ~/.arkaos/)
44
45
  npx arkaos dashboard Start monitoring dashboard
45
46
  npx arkaos keys Manage API keys (OpenAI, fal.ai, etc.)
46
47
  npx arkaos doctor Run health checks
@@ -102,6 +103,12 @@ async function main() {
102
103
  await migrate();
103
104
  break;
104
105
 
106
+ case "migrate-user-data": {
107
+ const { migrateUserData, printMigrationReport } = await import("./migrate-user-data.js");
108
+ printMigrationReport(migrateUserData());
109
+ break;
110
+ }
111
+
105
112
  case "keys": {
106
113
  const { keys: keysCmd } = await import("./keys.js");
107
114
  await keysCmd(positionals.slice(1));
@@ -34,8 +34,28 @@ export async function install({ runtime, path, force }) {
34
34
  // ═══ Step 1: Create directories ═══
35
35
  step(1, 14, "Creating directories...");
36
36
  ensureDir(installDir);
37
- const dirs = ["config", "config/hooks", "agents", "media", "session-digests", "vault"];
37
+ const dirs = ["config", "config/hooks", "agents", "media", "session-digests", "vault", "projects", "logs"];
38
38
  for (const d of dirs) ensureDir(join(installDir, d));
39
+
40
+ // Seed an empty ecosystems.json the first time; never overwrite existing user data.
41
+ const ecosystemsPath = join(installDir, "ecosystems.json");
42
+ if (!existsSync(ecosystemsPath)) {
43
+ writeFileSync(
44
+ ecosystemsPath,
45
+ JSON.stringify(
46
+ {
47
+ _meta: {
48
+ description: "ArkaOS — user-local ecosystem registry",
49
+ note: "Populated by /arka onboard. Never committed to the public repo.",
50
+ updated: new Date().toISOString().slice(0, 10),
51
+ },
52
+ ecosystems: {},
53
+ },
54
+ null,
55
+ 2,
56
+ ) + "\n",
57
+ );
58
+ }
39
59
  ok(`${dirs.length + 1} directories ready`);
40
60
 
41
61
  // ═══ Step 2: Detect v1 installation ═══
@@ -0,0 +1,110 @@
1
+ import { existsSync, mkdirSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+
5
+ const LEGACY_SKILLS_ROOT = join(homedir(), ".claude", "skills", "arka");
6
+ const USER_DATA_ROOT = join(homedir(), ".arkaos");
7
+
8
+ const LEGACY_PROJECTS = join(LEGACY_SKILLS_ROOT, "projects");
9
+ const LEGACY_ECOSYSTEMS = join(LEGACY_SKILLS_ROOT, "knowledge", "ecosystems.json");
10
+ const NEW_PROJECTS = join(USER_DATA_ROOT, "projects");
11
+ const NEW_ECOSYSTEMS = join(USER_DATA_ROOT, "ecosystems.json");
12
+ const LOGS_DIR = join(USER_DATA_ROOT, "logs");
13
+
14
+ /**
15
+ * Move user-local project descriptors and ecosystems registry from the
16
+ * legacy skill directory to ~/.arkaos/. Idempotent: items already present
17
+ * at the destination are left alone and logged as conflicts.
18
+ *
19
+ * @returns {{ moved: string[], skipped: string[], conflicts: string[], logPath: string|null }}
20
+ */
21
+ export function migrateUserData({ dryRun = false } = {}) {
22
+ const moved = [];
23
+ const skipped = [];
24
+ const conflicts = [];
25
+
26
+ if (!existsSync(USER_DATA_ROOT)) {
27
+ mkdirSync(USER_DATA_ROOT, { recursive: true });
28
+ }
29
+ if (!existsSync(NEW_PROJECTS)) {
30
+ mkdirSync(NEW_PROJECTS, { recursive: true });
31
+ }
32
+
33
+ if (existsSync(LEGACY_PROJECTS) && statSync(LEGACY_PROJECTS).isDirectory()) {
34
+ for (const entry of readdirSync(LEGACY_PROJECTS)) {
35
+ const src = join(LEGACY_PROJECTS, entry);
36
+ const dst = join(NEW_PROJECTS, entry);
37
+ if (existsSync(dst)) {
38
+ conflicts.push(`projects/${entry}: destination already present, left source untouched`);
39
+ continue;
40
+ }
41
+ if (dryRun) {
42
+ moved.push(`projects/${entry} (dry-run)`);
43
+ } else {
44
+ try {
45
+ renameSync(src, dst);
46
+ moved.push(`projects/${entry}`);
47
+ } catch (err) {
48
+ conflicts.push(`projects/${entry}: ${err.message}`);
49
+ }
50
+ }
51
+ }
52
+ } else {
53
+ skipped.push("projects/: legacy directory absent");
54
+ }
55
+
56
+ if (existsSync(LEGACY_ECOSYSTEMS)) {
57
+ if (existsSync(NEW_ECOSYSTEMS)) {
58
+ conflicts.push("ecosystems.json: destination already present, left source untouched");
59
+ } else if (dryRun) {
60
+ moved.push("ecosystems.json (dry-run)");
61
+ } else {
62
+ try {
63
+ renameSync(LEGACY_ECOSYSTEMS, NEW_ECOSYSTEMS);
64
+ moved.push("ecosystems.json");
65
+ } catch (err) {
66
+ conflicts.push(`ecosystems.json: ${err.message}`);
67
+ }
68
+ }
69
+ } else {
70
+ skipped.push("ecosystems.json: legacy file absent");
71
+ }
72
+
73
+ let logPath = null;
74
+ if (moved.length > 0 || conflicts.length > 0) {
75
+ if (!existsSync(LOGS_DIR)) mkdirSync(LOGS_DIR, { recursive: true });
76
+ const stamp = new Date().toISOString().replace(/[:.]/g, "-");
77
+ logPath = join(LOGS_DIR, `migration-${stamp}.log`);
78
+ const body = [
79
+ `ArkaOS user-data migration — ${new Date().toISOString()}`,
80
+ `Source: ${LEGACY_SKILLS_ROOT}`,
81
+ `Destination: ${USER_DATA_ROOT}`,
82
+ `Dry-run: ${dryRun}`,
83
+ "",
84
+ `Moved (${moved.length}):`,
85
+ ...moved.map(m => ` - ${m}`),
86
+ "",
87
+ `Conflicts (${conflicts.length}):`,
88
+ ...conflicts.map(c => ` - ${c}`),
89
+ "",
90
+ `Skipped (${skipped.length}):`,
91
+ ...skipped.map(s => ` - ${s}`),
92
+ "",
93
+ ].join("\n");
94
+ if (!dryRun) writeFileSync(logPath, body);
95
+ }
96
+
97
+ return { moved, skipped, conflicts, logPath };
98
+ }
99
+
100
+ export function printMigrationReport(result) {
101
+ const { moved, conflicts, logPath } = result;
102
+ if (moved.length === 0 && conflicts.length === 0) {
103
+ console.log(" ✓ User data already migrated, nothing to move.");
104
+ return;
105
+ }
106
+ console.log(` ✓ Migration: ${moved.length} moved, ${conflicts.length} conflicts`);
107
+ for (const m of moved) console.log(` + ${m}`);
108
+ for (const c of conflicts) console.log(` ! ${c}`);
109
+ if (logPath) console.log(` Log: ${logPath}`);
110
+ }
@@ -5,6 +5,7 @@ import { execSync } from "node:child_process";
5
5
  import { ensureVenv, getArkaosPython, pipInstall } from "./python-resolver.js";
6
6
  import { getRuntimeConfig } from "./detect-runtime.js";
7
7
  import { loadAdapter } from "./index.js";
8
+ import { migrateUserData, printMigrationReport } from "./migrate-user-data.js";
8
9
  import { IS_WINDOWS, HOOK_EXT } from "./platform.js";
9
10
  import { fileURLToPath } from "node:url";
10
11
 
@@ -37,6 +38,14 @@ export async function update() {
37
38
  console.log(` \u26a0 Legacy hook state migration skipped: ${err.message}`);
38
39
  }
39
40
 
41
+ // User-data separation (ADR 2026-04-17): move descriptors and ecosystems
42
+ // from ~/.claude/skills/arka/ to ~/.arkaos/. Idempotent, non-destructive.
43
+ try {
44
+ printMigrationReport(migrateUserData());
45
+ } catch (err) {
46
+ console.log(` \u26a0 User-data migration skipped: ${err.message}`);
47
+ }
48
+
40
49
  const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
41
50
  const profile = existsSync(profilePath) ? JSON.parse(readFileSync(profilePath, "utf-8")) : {};
42
51
 
@@ -2,7 +2,7 @@
2
2
  "_meta": {
3
3
  "description": "ARKA OS — Project Ecosystem Registry (user-local, populated after install)",
4
4
  "format": "Ecosystems group related projects that share squads, stacks, and conventions.",
5
- "note": "This file ships empty. Users define their own ecosystems locally via /arka onboard or by editing ~/.claude/skills/arka/knowledge/ecosystems.json after installation. Client names and internal project data MUST NOT be committed to the public repository.",
5
+ "note": "This file ships empty. Users define their own ecosystems locally in ~/.arkaos/ecosystems.json (populated by /arka onboard). Client names and internal project data MUST NOT be committed to the public repository.",
6
6
  "updated": "2026-04-17"
7
7
  },
8
8
  "ecosystems": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkaos",
3
- "version": "2.18.1",
3
+ "version": "2.19.0",
4
4
  "description": "The Operating System for AI Agent Teams",
5
5
  "type": "module",
6
6
  "bin": {
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "arkaos-core"
3
- version = "2.18.1"
3
+ version = "2.19.0"
4
4
  description = "Core engine for ArkaOS — The Operating System for AI Agent Teams"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}