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:
shumeiko.it
2026-11-04 10:31:20 +01:00
parent 120640780c
commit b275f0bf89
72 changed files with 217 additions and 170 deletions

View File

@@ -10,7 +10,7 @@ import Fastify, { type FastifyInstance, type FastifyRequest } from 'fastify';
import cors from '@fastify/cors';
import fastifyStatic from '@fastify/static';
import websocket from '@fastify/websocket';
import { WaggleDB, workspaceDataScope, WorkspaceManager, WaggleConfig, createEmbeddingProvider, type EmbeddingProviderConfig, type EmbeddingProviderInstance, CronStore, AwarenessLayer, VaultStore, SkillHashStore, TelemetryStore, TELEMETRY_EVENTS, ExecutionTraceStore } from '@waggle/core';
import { WaggleDB, workspaceDataScope, WorkspaceManager, WaggleConfig, createEmbeddingProvider, type EmbeddingProviderConfig, type EmbeddingProviderInstance, CronStore, AwarenessLayer, VaultStore, SkillHashStore, TelemetryStore, TELEMETRY_EVENTS, ExecutionTraceStore, defaultDataDir } from '@waggle/core';
import { corsOriginAllowed } from './cors-config.js';
import { InstallAuditStore } from './install-audit.js';
import { selfBaseUrl, selfRequestHeaders } from './self-request.js';
@@ -185,7 +185,7 @@ import { copyProviderKeysToVault, hydrateProviderEnvFromVault } from './provider
export interface LocalConfig {
port: number;
host: string;
dataDir: string; // ~/.waggle
dataDir: string; // ~/.waggle-community
litellmUrl: string; // http://localhost:4000
/** Immutable desktop-launch identity used to prove sidecar ownership. */
instanceId?: string;
@@ -470,7 +470,7 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
// Decorate with local config
server.decorate('localConfig', fullConfig);
// Set data dir for custom personas (loaded from ~/.waggle/personas/)
// Set data dir for custom personas (loaded from ~/.waggle-community/personas/)
setPersonaDataDir(fullConfig.dataDir);
// Event bus (replaces Redis pub/sub)
@@ -667,7 +667,7 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
// Decorate server with embedding provider for status endpoints
server.decorate('embeddingProvider', embeddingProvider);
const waggleHome = fullConfig.dataDir || path.join(os.homedir(), '.waggle');
const waggleHome = fullConfig.dataDir || defaultDataDir();
const rerankerCacheDir = path.join(waggleHome, 'models', 'reranker');
// Memory (ADR-0007): one mem0 store in <dataDir>/memory/, embedded by the
@@ -893,7 +893,7 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
const allTools = [...baseTools, ...subAgentTools, ...workflowTools];
// Load user customizations from ~/.waggle/
// Load user customizations from ~/.waggle-community/
const userSystemPrompt = loadSystemPrompt(waggleHome);
const skills = loadSkills(waggleHome);
@@ -954,7 +954,7 @@ export async function buildLocalServer(config: Partial<LocalConfig> = {}) {
// Plugin runtime manager — lifecycle, tools, skills from plugins
const pluginRuntimeManager = new PluginRuntimeManager();
// Auto-load installed plugins from ~/.waggle/plugins/
// Auto-load installed plugins from ~/.waggle-community/plugins/
const pluginsDir = path.join(waggleHome, 'plugins');
if (fs.existsSync(pluginsDir)) {
try {

View File

@@ -27,7 +27,7 @@
import fs from 'node:fs';
import * as path from 'node:path';
import * as os from 'node:os';
import { defaultDataDir } from '@waggle/core';
import { randomUUID, createHash } from 'node:crypto';
import type { McpRuntime, McpServerConfig } from '@waggle/agent';
import {
@@ -51,9 +51,9 @@ export interface McpConfigFile {
mcpServers: Record<string, PersistedMcpEntry>;
}
/** Same fallback as local/index.ts `waggleHome`: empty dataDir → ~/.waggle. */
/** Same fallback as local/index.ts `waggleHome`: empty dataDir → ~/.waggle-community. */
export function mcpConfigPath(dataDir: string): string {
const home = dataDir || path.join(os.homedir(), '.waggle');
const home = dataDir || defaultDataDir();
return path.join(home, '.mcp.json');
}

View File

@@ -24,7 +24,7 @@ export interface QueuedMessage {
}
export interface OfflineManagerConfig {
/** Directory for persistent storage (e.g. ~/.waggle) */
/** Directory for persistent storage (e.g. ~/.waggle-community) */
dataDir: string;
/** How often to check LLM health, in ms (default: 30000) */
checkIntervalMs?: number;

View File

@@ -1407,7 +1407,7 @@ function getAnthropicKey(server: FastifyInstance): string | null {
// Legacy fallback: env var (for test harnesses / dev loops)
if (process.env.ANTHROPIC_API_KEY) return process.env.ANTHROPIC_API_KEY;
// Legacy fallback: ~/.waggle/config.json
// Legacy fallback: ~/.waggle-community/config.json
try {
const configPath = path.join(server.localConfig.dataDir, 'config.json');
const raw = fs.readFileSync(configPath, 'utf-8');

View File

@@ -1,5 +1,5 @@
/**
* Backup & Restore Routes — encrypted ZIP-style archive of ~/.waggle/ for machine migration.
* Backup & Restore Routes — encrypted ZIP-style archive of ~/.waggle-community/ for machine migration.
*
* Endpoints:
* POST /api/backup — create and stream an encrypted backup archive

View File

@@ -28,7 +28,7 @@ const NON_RETAINED_TURN_CONTENT = '[Not retained: memory disabled for this turn]
/**
* Persona resolver that includes built-ins AND on-disk custom personas
* (Faza 1 evolved variants like `claude::gen1-v1`, `qwen-thinking::gen1-v1`,
* plus user-saved customs in `~/.waggle/personas/`).
* plus user-saved customs in `~/.waggle-community/personas/`).
*
* Previously `getPersona(id)` was used here, which only consulted the static
* built-in PERSONAS array — `listPersonas()` adds the custom ones from disk

View File

@@ -24,7 +24,7 @@
* later phases. The CommandResultType union carries them so the contract is stable.
*/
import os from 'node:os';
import { defaultDataDir } from '@waggle/core';
import path from 'node:path';
import fs from 'node:fs';
import type { FastifyPluginAsync } from 'fastify';
@@ -79,7 +79,7 @@ function toSubtitle(content: string, max = 120): string {
}
export const commandRoutes: FastifyPluginAsync = async (server) => {
const waggleHome = server.localConfig.dataDir || path.join(os.homedir(), '.waggle');
const waggleHome = server.localConfig.dataDir || defaultDataDir();
// ── GET /api/command/search ───────────────────────────────────────────
// Federated read over memory + workspaces + skills + sessions + commands.

View File

@@ -13,7 +13,7 @@
import type { FastifyPluginAsync } from 'fastify';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { defaultDataDir } from '@waggle/core';
import { assertSafeSegment } from './validate.js';
export interface DocumentVersion {
@@ -62,7 +62,7 @@ function writeRegistry(dataDir: string, workspaceId: string, registry: Documents
}
export const documentRoutes: FastifyPluginAsync = async (server) => {
const dataDir = server.localConfig?.dataDir || process.env.WAGGLE_DATA_DIR || path.join(os.homedir(), '.waggle');
const dataDir = server.localConfig?.dataDir || process.env.WAGGLE_DATA_DIR || defaultDataDir();
// GET /api/workspaces/:id/documents — list all tracked documents
server.get<{

View File

@@ -13,7 +13,7 @@
*/
import type { FastifyInstance } from 'fastify';
import os from 'node:os';
import { defaultDataDir } from '@waggle/core';
import path from 'node:path';
import { rankModels, OLLAMA_CATALOG } from '@waggle/agent';
import { detectHardware } from '../hardware-detect.js';
@@ -196,7 +196,7 @@ export async function localInferenceRoutes(
const VLLM_URL = process.env.VLLM_HOST ?? 'http://localhost:8000';
const dataDir = fastify.localConfig?.dataDir
|| process.env.WAGGLE_DATA_DIR
|| path.join(os.homedir(), '.waggle');
|| defaultDataDir();
const runtime = options.runtimeFactory?.(dataDir, OLLAMA_URL)
?? new ManagedOllamaRuntime(dataDir, OLLAMA_URL);
const probeOllama = options.ollamaProbe ?? checkOllama;

View File

@@ -18,6 +18,7 @@ import { createLogger } from '../logger.js';
const log = createLogger('marketplace-dev');
import fs from 'node:fs';
import { MarketplaceDB, SecurityGate } from '@waggle/marketplace';
import { DEFAULT_DATA_DIR_NAME } from '@waggle/shared';
import type { InstallationType, MarketplacePack, MarketplacePackage } from '@waggle/marketplace';
export async function marketplaceDevRoutes(fastify: FastifyInstance) {
@@ -26,7 +27,7 @@ export async function marketplaceDevRoutes(fastify: FastifyInstance) {
const dataDir = fastify.localConfig?.dataDir ?? path.join(
process.env.HOME ?? process.env.USERPROFILE ?? '.',
'.waggle',
DEFAULT_DATA_DIR_NAME,
);
// Lazy-instantiate marketplace handles on first use.

View File

@@ -11,7 +11,7 @@
import type { FastifyInstance, FastifyReply } from 'fastify';
import { existsSync, readFileSync } from 'fs';
import { join } from 'path';
import { homedir } from 'os';
import { defaultDataDir } from '@waggle/core';
import { MarketplaceDB, MarketplaceInstaller, MarketplaceSync, SecurityGate, PACKAGE_CATEGORIES, recategorizeAll, isCiscoScannerAvailable, resolveSkillSource, SkillSourceError, createMarketplaceMcpProvenance } from '@waggle/marketplace';
import type { InstallationType, SearchSort, ScanResult, MarketplacePackage, MarketplaceMcpProvenance, MarketplaceApprovalIdentity, FetchFn } from '@waggle/marketplace';
import { validateSkillMd } from '@waggle/sdk';
@@ -971,7 +971,7 @@ export async function marketplaceRoutes(fastify: FastifyInstance) {
// ── POST /api/marketplace/publish ─────────────────────────────────
// Publish a local skill to the marketplace catalog.
// Reads the skill from ~/.waggle/skills/, validates frontmatter,
// Reads the skill from ~/.waggle-community/skills/, validates frontmatter,
// runs SecurityGate scan, then upserts into the marketplace DB.
fastify.post('/api/marketplace/publish', async (request, reply) => {
@@ -991,8 +991,8 @@ export async function marketplaceRoutes(fastify: FastifyInstance) {
return reply.code(400).send({ error: 'Invalid skill name' });
}
// Read the skill file from ~/.waggle/skills/
const waggleHome = fastify.localConfig?.dataDir || join(homedir(), '.waggle');
// Read the skill file from ~/.waggle-community/skills/
const waggleHome = fastify.localConfig?.dataDir || defaultDataDir();
const skillPath = join(waggleHome, 'skills', `${skillName}.md`);
if (!existsSync(skillPath)) {

View File

@@ -373,7 +373,7 @@ export async function mcpRoutes(fastify: FastifyInstance) {
});
}
// Persist at the server's dataDir too — the installer writes to
// WAGGLE_DATA_DIR/~/.waggle, which may differ from a custom dataDir.
// WAGGLE_DATA_DIR/~/.waggle-community, which may differ from a custom dataDir.
saveMcpServerEntry(dataDir(), configured.name, entry);
const runtime = getRuntime();

View File

@@ -71,7 +71,7 @@ export const onboardingRoutes: FastifyPluginAsync = async (server) => {
});
// Idempotent completion stamp. The wizard's complete() fires this alongside
// the Tauri filesystem flag (which only covers default ~/.waggle installs).
// the Tauri filesystem flag (which only covers default ~/.waggle-community installs).
server.post('/api/onboarding/complete', async () => {
fs.mkdirSync(server.localConfig.dataDir, { recursive: true });
fs.writeFileSync(flagPath(), new Date().toISOString());

View File

@@ -13,7 +13,7 @@
import type { FastifyPluginAsync } from 'fastify';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { defaultDataDir } from '@waggle/core';
import crypto from 'node:crypto';
export interface PinnedItem {
@@ -57,7 +57,7 @@ function writePins(dataDir: string, workspaceId: string, pins: PinnedItem[]): vo
}
export const pinRoutes: FastifyPluginAsync = async (server) => {
const dataDir = server.localConfig?.dataDir || process.env.WAGGLE_DATA_DIR || path.join(os.homedir(), '.waggle');
const dataDir = server.localConfig?.dataDir || process.env.WAGGLE_DATA_DIR || defaultDataDir();
// GET /api/workspaces/:id/pins — list pins for workspace
server.get<{

View File

@@ -1,7 +1,7 @@
/**
* User Profile API — identity, writing style, brand, and preferences.
*
* Profile data is stored in a JSON file at ~/.waggle/profile.json and
* Profile data is stored in a JSON file at ~/.waggle-community/profile.json and
* key fields are also saved to personal memory for agent access.
*
* Endpoints:

View File

@@ -1,8 +1,7 @@
import os from 'node:os';
import path from 'node:path';
import fs from 'node:fs';
import type { FastifyPluginAsync } from 'fastify';
import { computeSkillHash } from '@waggle/core';
import { computeSkillHash, defaultDataDir } from '@waggle/core';
import {
loadActiveSkills,
loadSkillAudit,
@@ -44,7 +43,7 @@ async function buildAuditLLM(apiKey: string): Promise<EvolutionLLM | null> {
* first, then redacted/provenance-stamped/audited + the change-hash refreshed).
*/
export const skillsAuditRoutes: FastifyPluginAsync = async (server) => {
const waggleHome = server.localConfig.dataDir || path.join(os.homedir(), '.waggle');
const waggleHome = server.localConfig.dataDir || defaultDataDir();
const skillsDir = path.join(waggleHome, 'skills');
// GET /api/skills/audit — badge index (Skills Hub card source for the verified badge).

View File

@@ -1,4 +1,4 @@
import os from 'node:os';
import { defaultDataDir } from '@waggle/core';
import path from 'node:path';
import type { FastifyPluginAsync } from 'fastify';
import {
@@ -17,7 +17,7 @@ import {
* Waggle proxy cost — mirroring the evolution route's key gate.
*/
export const skillsHygieneRoutes: FastifyPluginAsync = async (server) => {
const waggleHome = server.localConfig.dataDir || path.join(os.homedir(), '.waggle');
const waggleHome = server.localConfig.dataDir || defaultDataDir();
// GET /api/skills/hygiene — current hygiene index (Skills Hub badges)
server.get('/api/skills/hygiene', async () => {

View File

@@ -1,4 +1,3 @@
import os from 'node:os';
import path from 'node:path';
import fs from 'node:fs';
import { createLogger } from '../logger.js';
@@ -7,7 +6,7 @@ import type { FastifyPluginAsync } from 'fastify';
const log = createLogger('skills');
import { PluginManager, getStarterSkillsDir, listStarterSkills, listCapabilityPacks, getPackManifest } from '@waggle/sdk';
import { loadSkills, loadSkillHygiene, loadSkillAudit, clearAuditBadge, SkillRecommender, assessTrust, generateSkillMarkdown, writeSkill, deleteSkill as deleteSkillWrite, parseSkillFrontmatter, extractSkillRequirements, checkSkillRequirements, type SkillTemplate, type SkillRequirements, type SkillRequirementsStatus } from '@waggle/agent';
import { computeSkillHash } from '@waggle/core';
import { computeSkillHash, defaultDataDir } from '@waggle/core';
/** Capability family definitions — user-job-first grouping */
const SKILL_FAMILIES: Record<string, { family: string; label: string }> = {
@@ -36,11 +35,11 @@ const WORKFLOW_SKILLS = new Set(['research-team', 'review-pair', 'plan-execute']
/**
* Skills & plugins routes — manage agent extensions.
* Skills: markdown files in ~/.waggle/skills/ that extend the system prompt.
* Plugins: structured packages in ~/.waggle/plugins/ with manifests.
* Skills: markdown files in ~/.waggle-community/skills/ that extend the system prompt.
* Plugins: structured packages in ~/.waggle-community/plugins/ with manifests.
*/
export const skillRoutes: FastifyPluginAsync = async (server) => {
const waggleHome = server.localConfig.dataDir || path.join(os.homedir(), '.waggle');
const waggleHome = server.localConfig.dataDir || defaultDataDir();
const skillsDir = path.join(waggleHome, 'skills');
const pluginsDir = path.join(waggleHome, 'plugins');
@@ -83,7 +82,7 @@ export const skillRoutes: FastifyPluginAsync = async (server) => {
const starterDir = getStarterSkillsDir();
const starterNames = listStarterSkills(); // returns sorted array of names without .md
// Determine installed skill names (files in ~/.waggle/skills/)
// Determine installed skill names (files in ~/.waggle-community/skills/)
const installedNames = new Set<string>();
if (fs.existsSync(skillsDir)) {
for (const f of fs.readdirSync(skillsDir)) {

View File

@@ -1,7 +1,7 @@
/**
* Task routes — workspace-scoped task board.
*
* JSONL-based storage in `~/.waggle/workspaces/{id}/tasks.jsonl`.
* JSONL-based storage in `~/.waggle-community/workspaces/{id}/tasks.jsonl`.
* Each task: id, title, status (open|in_progress|done), assignee, creator, timestamps.
*/

View File

@@ -4,7 +4,7 @@ import type { WorkflowTemplate } from '@waggle/agent';
/**
* Workflow routes — CRUD for custom workflow templates.
* Built-in templates are read-only; custom ones are stored as JSON in ~/.waggle/workflows/.
* Built-in templates are read-only; custom ones are stored as JSON in ~/.waggle-community/workflows/.
*/
export const workflowRoutes: FastifyPluginAsync = async (fastify) => {
const dataDir = fastify.localConfig.dataDir;

View File

@@ -1,9 +1,8 @@
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import type { FastifyPluginAsync } from 'fastify';
import { z } from 'zod';
import { AwarenessLayer, createFileStore, workspaceDataScope } from '@waggle/core';
import { AwarenessLayer, createFileStore, workspaceDataScope, defaultDataDir } from '@waggle/core';
import { workspaceScope, type MemoryRecord, type MemoryStore } from '@waggle/memory-contract';
import { assertSafeSegment } from './validate.js';
import { validateBody } from '../../validate-body.js';
@@ -438,7 +437,7 @@ export const workspaceRoutes: FastifyPluginAsync = async (server) => {
// Auto-install starter skills on first workspace creation
try {
const waggleHome = server.localConfig.dataDir || path.join(os.homedir(), '.waggle');
const waggleHome = server.localConfig.dataDir || defaultDataDir();
const skillsDir = path.join(waggleHome, 'skills');
const existingSkills = fs.existsSync(skillsDir)
? fs.readdirSync(skillsDir).filter(f => f.endsWith('.md'))

View File

@@ -2,9 +2,8 @@ import fs from 'node:fs';
import { randomUUID } from 'node:crypto';
import net from 'node:net';
import path from 'node:path';
import os from 'node:os';
import type { FastifyInstance } from 'fastify';
import { VaultStore, WaggleConfig, WAGGLE_DB_FILE } from '@waggle/core';
import { VaultStore, WaggleConfig, WAGGLE_DB_FILE, defaultDataDir } from '@waggle/core';
import { buildLocalServer } from './index.js';
import type { LlmHealthStatus } from './index.js';
import { startLiteLLM, stopLiteLLM, type LiteLLMStatus } from './lifecycle.js';
@@ -93,7 +92,7 @@ function removeOwnedDesktopReadyFile(filePath: string, instanceId: string): void
/**
* Resolve the service data directory: explicit option > WAGGLE_DATA_DIR env >
* ~/.waggle. D11 — the installer/launcher set WAGGLE_DATA_DIR; before this,
* ~/.waggle-community. D11 — the installer/launcher set WAGGLE_DATA_DIR; before this,
* startService ignored it while other modules (local/index.ts config,
* marketplace installer) honored it, splitting state across two
* directories on custom installs.
@@ -101,7 +100,7 @@ function removeOwnedDesktopReadyFile(filePath: string, instanceId: string): void
export function resolveDataDir(optionDataDir?: string): string {
// `||` on the env leg: WAGGLE_DATA_DIR set-but-empty must fall through to
// the default, not yield '' (mkdirSync('') throws / resolves to cwd).
return optionDataDir ?? (process.env.WAGGLE_DATA_DIR || path.join(os.homedir(), '.waggle'));
return optionDataDir ?? (process.env.WAGGLE_DATA_DIR || defaultDataDir());
}
/** Resolve the listen port: explicit option > validated WAGGLE_PORT > 3333. */
@@ -171,7 +170,7 @@ function getConfiguredProviderIds(dataDir: string, server?: FastifyInstance): st
/**
* Start the Waggle agent service.
*
* 1. Resolves/creates dataDir (option > WAGGLE_DATA_DIR > ~/.waggle)
* 1. Resolves/creates dataDir (option > WAGGLE_DATA_DIR > ~/.waggle-community)
* 2. Starts the LiteLLM proxy when config.json enables it and it is not skipped
* 3. Builds & starts local Fastify server
* 4. Registers graceful shutdown handlers

View File

@@ -7,7 +7,7 @@ import { STANDARD_DIRS } from './types.js';
/**
* Filesystem-backed StorageProvider.
* Used by both "virtual" storage (data in ~/.waggle/workspaces/{id}/files/)
* Used by both "virtual" storage (data in ~/.waggle-community/workspaces/{id}/files/)
* and "local" storage (data at a user-specified path).
*/
export class FsStorageProvider implements StorageProvider {

View File

@@ -17,7 +17,7 @@ interface WorkspaceLike {
/**
* Resolve the correct StorageProvider for a workspace.
*
* - virtual: files in ~/.waggle/workspaces/{id}/files/ (app-managed)
* - virtual: files in ~/.waggle-community/workspaces/{id}/files/ (app-managed)
* - local: user-specified directory on their machine (like Claude Code)
* - team: shared team storage is part of team mode, which the community
* edition does not ship (ADR-0003); such workspaces use virtual storage

View File

@@ -1,5 +1,5 @@
/**
* Backup & Restore Tests — PM-5: encrypted backup/restore of ~/.waggle/
* Backup & Restore Tests — PM-5: encrypted backup/restore of ~/.waggle-community/
*
* Tests:
* 1. POST /api/backup returns an octet-stream file

View File

@@ -1,7 +1,7 @@
/**
* D11 (UX-Refactor P4) — dataDir resolution.
*
* - resolveDataDir: explicit option > WAGGLE_DATA_DIR env > ~/.waggle. Before
* - resolveDataDir: explicit option > WAGGLE_DATA_DIR env > ~/.waggle-community. Before
* D11, startService ignored the env var while local/index.ts and the
* marketplace installer honored it — a custom install split
* its state across two directories.
@@ -10,6 +10,7 @@ import { describe, it, expect, afterEach, vi } from 'vitest';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { DEFAULT_DATA_DIR_NAME } from '@waggle/shared';
import { startService, resolveDataDir } from '../src/local/service.js';
import type { FastifyInstance } from 'fastify';
@@ -36,14 +37,15 @@ describe('resolveDataDir (D11)', () => {
expect(resolveDataDir()).toBe('D:/from-env');
});
it('defaults to ~/.waggle with neither', () => {
it('defaults to ~/.waggle-community with neither, never the commercial ~/.waggle (ADR-0011)', () => {
delete process.env[ENV_KEY];
expect(resolveDataDir()).toBe(path.join(os.homedir(), '.waggle'));
expect(resolveDataDir()).toBe(path.join(os.homedir(), DEFAULT_DATA_DIR_NAME));
expect(resolveDataDir()).not.toBe(path.join(os.homedir(), '.waggle'));
});
it('a set-but-EMPTY env var falls through to the default (never an empty dataDir)', () => {
process.env[ENV_KEY] = '';
expect(resolveDataDir()).toBe(path.join(os.homedir(), '.waggle'));
expect(resolveDataDir()).toBe(path.join(os.homedir(), DEFAULT_DATA_DIR_NAME));
});
});
@@ -72,7 +74,7 @@ describe('startService honors WAGGLE_DATA_DIR (D11 integration)', () => {
const result = await startService({ port, skipLiteLLM: true });
server = result.server;
// The env-pointed dir got the install, ~/.waggle got nothing new from us.
// The env-pointed dir got the install, ~/.waggle-community got nothing new from us.
expect(fs.existsSync(path.join(envDir, 'waggle.db'))).toBe(true);
expect(server.localConfig.dataDir).toBe(envDir);

View File

@@ -11,6 +11,7 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import fs from 'node:fs';
import * as path from 'node:path';
import * as os from 'node:os';
import { DEFAULT_DATA_DIR_NAME } from '@waggle/shared';
import { McpRuntime } from '@waggle/agent';
import { MCP_SERVERS, createMarketplaceMcpProvenance } from '@waggle/marketplace';
import {
@@ -283,8 +284,8 @@ describe('mcp-config store', () => {
for (const variant of variants) expect(validateMcpEntry('brave-search', variant)).not.toBeNull();
});
it('uses ~/.waggle when dataDir is empty (same fallback as index.ts)', () => {
expect(mcpConfigPath('')).toBe(path.join(os.homedir(), '.waggle', '.mcp.json'));
it('uses ~/.waggle-community when dataDir is empty (same fallback as index.ts)', () => {
expect(mcpConfigPath('')).toBe(path.join(os.homedir(), DEFAULT_DATA_DIR_NAME, '.mcp.json'));
});
});

View File

@@ -21,7 +21,7 @@ import { PassThrough } from 'node:stream';
import Database from 'better-sqlite3';
import { WaggleDB } from '@waggle/core';
import { InstallAuditStore } from '../../src/local/install-audit.js';
import { MCP_CATALOG } from '@waggle/shared';
import { DEFAULT_DATA_DIR_NAME, MCP_CATALOG } from '@waggle/shared';
import { SecurityGate } from '@waggle/marketplace';
import { McpRuntime, type McpProcess, type SpawnFn } from '@waggle/agent';
import { terminateProcessTree } from '../../../agent/src/system-tools-helpers.js';
@@ -61,7 +61,7 @@ vi.mock('../../src/local/mcp-config.js', async importOriginal => {
});
// Redirect the marketplace installer's module-level MCP_CONFIG_PATH away from
// the real ~/.waggle BEFORE the installer module loads (it reads the env at
// the real ~/.waggle-community BEFORE the installer module loads (it reads the env at
// import time) — marketplace routes are therefore imported dynamically below.
const installerTmp = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-mcps-installer-'));
fs.mkdirSync(isolatedHome, { recursive: true });
@@ -766,7 +766,7 @@ describe('MCP Hub routes (Phase 4)', () => {
skill_content: '# Safe helper\n\nSummarize a document.',
},
};
const swappedSkillPath = path.join(isolatedHome, '.waggle', 'skills', `${swappedSkillName}.md`);
const swappedSkillPath = path.join(isolatedHome, DEFAULT_DATA_DIR_NAME, 'skills', `${swappedSkillName}.md`);
expect(fs.existsSync(swappedSkillPath)).toBe(false);
let calls = 0;

View File

@@ -6,7 +6,7 @@ import path from 'node:path';
import { documentRoutes } from '../../src/local/routes/documents.js';
import { pinRoutes } from '../../src/local/routes/pins.js';
/** UF-064: pins and documents follow the server's data directory, not ~/.waggle. */
/** UF-064: pins and documents follow the server's data directory, not ~/.waggle-community. */
describe('pins and documents storage', () => {
let server: FastifyInstance;
let dataDir: string;

View File

@@ -8,7 +8,7 @@ import type { FastifyInstance } from 'fastify';
/**
* Plugin auto-load on startup tests.
*
* Verifies that the server scans ~/.waggle/plugins/ at boot and loads
* Verifies that the server scans ~/.waggle-community/plugins/ at boot and loads
* plugins with valid plugin.json manifests into the PluginRuntimeManager.
*/