feat: default the data directory to ~/.waggle-community (P1.3c)
The community edition defaulted to ~/.waggle, the data directory of the commercial Waggle, so both editions would open the same config, vault, waggle.db, marketplace catalog and skills. Default to ~/.waggle-community instead (ADR-0011). WAGGLE_DATA_DIR still overrides it wherever it did; nothing is migrated from ~/.waggle. The name is defined once as DEFAULT_DATA_DIR_NAME and DEFAULT_DATA_DIR_LABEL in @waggle/shared, with defaultDataDir() in @waggle/core for the sidecar, the CLI, the agent and the model caches. The marketplace installs on its own without workspace packages, so it keeps a copy in its data-dir.ts; the CLI help, which loads no dependency, spells the path out and its runtime test checks it. The marketplace security scan also flags skills that reference the new skills folder. Tests that asserted the old default now use the constant, and comments name the new directory.
This commit is contained in:
@@ -8,6 +8,7 @@ import type { AddressInfo } from 'node:net';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { DEFAULT_DATA_DIR_LABEL, DEFAULT_DATA_DIR_NAME } from '@waggle/shared';
|
||||
|
||||
const ROOT = path.resolve(import.meta.dirname, '..', '..', '..');
|
||||
const CLI_DIR = path.join(ROOT, 'packages', 'cli');
|
||||
@@ -242,8 +243,9 @@ describe('@waggle/cli runtime UX', () => {
|
||||
expect(result.status).toBe(0);
|
||||
expect(result.stdout).toContain('Waggle CLI');
|
||||
expect(result.stdout).toContain('Usage:');
|
||||
expect(result.stdout).toContain(`${DEFAULT_DATA_DIR_LABEL}/config.json`);
|
||||
expect(result.stderr).toBe('');
|
||||
expect(fs.existsSync(path.join(home, '.waggle'))).toBe(false);
|
||||
expect(fs.existsSync(path.join(home, DEFAULT_DATA_DIR_NAME))).toBe(false);
|
||||
} finally {
|
||||
fs.rmSync(home, { recursive: true, force: true });
|
||||
}
|
||||
@@ -281,7 +283,7 @@ describe('@waggle/cli runtime UX', () => {
|
||||
expect(result.stdout).toContain('Waggle CLI');
|
||||
expect(result.stdout).toContain('Usage:');
|
||||
expect(result.stderr).toBe('');
|
||||
expect(fs.existsSync(path.join(home, '.waggle'))).toBe(false);
|
||||
expect(fs.existsSync(path.join(home, DEFAULT_DATA_DIR_NAME))).toBe(false);
|
||||
} finally {
|
||||
fs.rmSync(home, { recursive: true, force: true });
|
||||
}
|
||||
@@ -399,7 +401,7 @@ describe('@waggle/cli runtime UX', () => {
|
||||
expect(result.stdout).toContain('Waggle CLI');
|
||||
expect(result.stdout).toContain('Usage:');
|
||||
expect(result.stderr).toBe('');
|
||||
expect(fs.existsSync(path.join(home, '.waggle'))).toBe(false);
|
||||
expect(fs.existsSync(path.join(home, DEFAULT_DATA_DIR_NAME))).toBe(false);
|
||||
} finally {
|
||||
fs.rmSync(home, { recursive: true, force: true });
|
||||
}
|
||||
@@ -505,9 +507,11 @@ describe('@waggle/cli runtime UX', () => {
|
||||
expect(stdout).toContain('Goodbye!');
|
||||
expect(stderr).not.toContain('Fatal error');
|
||||
// Memory (mem0) and Waggle's own database live in the data directory (ADR-0007).
|
||||
expect(fs.existsSync(path.join(home, '.waggle', 'memory', 'waggle-memory.json'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(home, '.waggle', 'waggle.db'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(home, '.waggle', 'default.mind'))).toBe(false);
|
||||
expect(fs.existsSync(path.join(home, DEFAULT_DATA_DIR_NAME, 'memory', 'waggle-memory.json'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(home, DEFAULT_DATA_DIR_NAME, 'waggle.db'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(home, DEFAULT_DATA_DIR_NAME, 'default.mind'))).toBe(false);
|
||||
// ADR-0011: the commercial edition's directory stays untouched.
|
||||
expect(fs.existsSync(path.join(home, '.waggle'))).toBe(false);
|
||||
} finally {
|
||||
if (child) await stopProcess(child);
|
||||
fs.rmSync(home, { recursive: true, force: true });
|
||||
@@ -564,7 +568,7 @@ describe('@waggle/cli runtime UX', () => {
|
||||
}
|
||||
|
||||
mockLiteLlm = await startMockLiteLlm();
|
||||
const waggleHome = path.join(home, '.waggle');
|
||||
const waggleHome = path.join(home, DEFAULT_DATA_DIR_NAME);
|
||||
const workspaceConfigDir = path.join(projectDir, '.waggle');
|
||||
fs.mkdirSync(waggleHome, { recursive: true });
|
||||
fs.mkdirSync(workspaceConfigDir, { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user