feat(desktop,launcher): default to ~/.waggle-community (P1.3c)
The Tauri shell's bundled npm environment and its first-launch flag, the server installer's --data-dir default and the NSIS installer config fell back to ~/.waggle. Use ~/.waggle-community (ADR-0011). The Rust shell keeps the name in DEFAULT_DATA_DIR_NAME in lib.rs and the launcher, which uses only Node built-ins, in DATA_DIR_NAME. packages/shared/tests/data-dir.test.ts fails when either copy, or the marketplace's, differs from @waggle/shared.
This commit is contained in:
@@ -20,7 +20,7 @@ describe('getDefaultInstallerConfig', () => {
|
||||
expect(config.version).toBe('0.1.0');
|
||||
expect(config.publisher).toBe('Waggle');
|
||||
expect(config.defaultInstallDir).toBe('C:\\Program Files\\Waggle');
|
||||
expect(config.dataDir).toBe('~/.waggle');
|
||||
expect(config.dataDir).toBe('~/.waggle-community');
|
||||
expect(config.autostart).toBe(true);
|
||||
expect(config.desktopShortcut).toBe(true);
|
||||
expect(config.startMenuEntry).toBe(true);
|
||||
@@ -46,7 +46,7 @@ describe('generateNsisDefines', () => {
|
||||
expect(defines.PRODUCT_VERSION).toBe('0.1.0');
|
||||
expect(defines.PRODUCT_PUBLISHER).toBe('Waggle');
|
||||
expect(defines.DEFAULT_INSTALL_DIR).toBe('C:\\Program Files\\Waggle');
|
||||
expect(defines.DATA_DIR).toBe('~/.waggle');
|
||||
expect(defines.DATA_DIR).toBe('~/.waggle-community');
|
||||
expect(defines.AUTOSTART).toBe('1');
|
||||
expect(defines.DESKTOP_SHORTCUT).toBe('1');
|
||||
expect(defines.START_MENU_ENTRY).toBe('1');
|
||||
@@ -188,22 +188,22 @@ describe('isSystemPath', () => {
|
||||
|
||||
describe('getUninstallPrompt', () => {
|
||||
it('includes the data directory in the prompt', () => {
|
||||
const prompt = getUninstallPrompt('~/.waggle');
|
||||
expect(prompt).toContain('~/.waggle');
|
||||
const prompt = getUninstallPrompt('~/.waggle-community');
|
||||
expect(prompt).toContain('~/.waggle-community');
|
||||
});
|
||||
|
||||
it('mentions keeping data for future use', () => {
|
||||
const prompt = getUninstallPrompt('C:\\Users\\test\\.waggle');
|
||||
const prompt = getUninstallPrompt('C:\\Users\\test\\.waggle-community');
|
||||
expect(prompt).toContain('keep it for future use');
|
||||
});
|
||||
|
||||
it('mentions deleting all data option', () => {
|
||||
const prompt = getUninstallPrompt('~/.waggle');
|
||||
const prompt = getUninstallPrompt('~/.waggle-community');
|
||||
expect(prompt).toContain('delete all data');
|
||||
});
|
||||
|
||||
it('mentions agents and memories', () => {
|
||||
const prompt = getUninstallPrompt('~/.waggle');
|
||||
const prompt = getUninstallPrompt('~/.waggle-community');
|
||||
expect(prompt).toContain('agents');
|
||||
expect(prompt).toContain('memories');
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ export interface InstallerConfig {
|
||||
version: string;
|
||||
publisher: string;
|
||||
defaultInstallDir: string;
|
||||
dataDir: string; // ~/.waggle
|
||||
dataDir: string; // ~/.waggle-community (ADR-0011)
|
||||
autostart: boolean;
|
||||
desktopShortcut: boolean;
|
||||
startMenuEntry: boolean;
|
||||
@@ -27,7 +27,7 @@ export function getDefaultInstallerConfig(): InstallerConfig {
|
||||
version: '0.1.0',
|
||||
publisher: 'Waggle',
|
||||
defaultInstallDir: 'C:\\Program Files\\Waggle',
|
||||
dataDir: '~/.waggle',
|
||||
dataDir: '~/.waggle-community',
|
||||
autostart: true,
|
||||
desktopShortcut: true,
|
||||
startMenuEntry: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Brief: briefs/2026-04-30-cc-sesija-A-waggle-apps-web-integration.md §2.3 Task A10
|
||||
//
|
||||
// Persists a flag file at `~/.waggle/first-launch.flag` so the onboarding wizard
|
||||
// Persists a flag file at `~/.waggle-community/first-launch.flag` so the onboarding wizard
|
||||
// state survives across app reinstalls (browser localStorage doesn't, since
|
||||
// Tauri builds may use a fresh WebView profile per install). The web `npm run
|
||||
// dev` path continues to use localStorage via useOnboarding — these commands
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
const FLAG_DIR: &str = ".waggle";
|
||||
use crate::DEFAULT_DATA_DIR_NAME;
|
||||
|
||||
const FLAG_FILE: &str = "first-launch.flag";
|
||||
|
||||
fn home_dir() -> Option<PathBuf> {
|
||||
@@ -23,10 +24,10 @@ fn home_dir() -> Option<PathBuf> {
|
||||
}
|
||||
|
||||
/// Resolve the flag location: `WAGGLE_DATA_DIR` (when set and non-empty) else
|
||||
/// `~/.waggle` — the SAME resolution order the sidecar's resolveDataDir uses
|
||||
/// `~/.waggle-community` — the SAME resolution order the sidecar's resolveDataDir uses
|
||||
/// (UX-Refactor P4/D11). Without this, a custom-data-dir install reads/writes
|
||||
/// the flag in `~/.waggle` while the server's completion stamp lives in the
|
||||
/// data dir — and a stale `~/.waggle` flag from a prior default install would
|
||||
/// the flag in the default directory while the server's completion stamp lives in the
|
||||
/// data dir — and a stale default-directory flag from a prior default install would
|
||||
/// auto-skip onboarding against a brand-new data dir (P4 review, 5 findings).
|
||||
fn flag_path() -> Result<PathBuf, String> {
|
||||
if let Some(dir) = std::env::var_os("WAGGLE_DATA_DIR") {
|
||||
@@ -37,7 +38,7 @@ fn flag_path() -> Result<PathBuf, String> {
|
||||
let home = home_dir().ok_or_else(|| {
|
||||
"could not resolve user home directory (USERPROFILE/HOME unset)".to_string()
|
||||
})?;
|
||||
Ok(home.join(FLAG_DIR).join(FLAG_FILE))
|
||||
Ok(home.join(DEFAULT_DATA_DIR_NAME).join(FLAG_FILE))
|
||||
}
|
||||
|
||||
/// Returns true if the user has not yet completed onboarding.
|
||||
@@ -54,7 +55,7 @@ pub async fn is_first_launch() -> Result<bool, String> {
|
||||
}
|
||||
|
||||
/// Marks onboarding as complete by creating the flag file. Idempotent.
|
||||
/// Creates the parent `~/.waggle/` directory if needed.
|
||||
/// Creates the parent data directory if needed.
|
||||
#[tauri::command]
|
||||
pub async fn mark_first_launch_complete() -> Result<(), String> {
|
||||
let path = flag_path()?;
|
||||
@@ -91,12 +92,12 @@ mod tests {
|
||||
std::env::set_var("USERPROFILE", &tmp);
|
||||
std::env::set_var("HOME", &tmp);
|
||||
|
||||
// Default: ~/.waggle.
|
||||
// Default: ~/.waggle-community, never the commercial edition's ~/.waggle.
|
||||
std::env::remove_var("WAGGLE_DATA_DIR");
|
||||
let path = flag_path().expect("flag_path resolves with USERPROFILE/HOME set");
|
||||
assert!(
|
||||
path.ends_with(".waggle/first-launch.flag")
|
||||
|| path.ends_with(".waggle\\first-launch.flag")
|
||||
assert_eq!(
|
||||
path,
|
||||
tmp.join(".waggle-community").join("first-launch.flag")
|
||||
);
|
||||
|
||||
// P4/D11: a custom data dir keeps the flag NEXT TO the server's stamp.
|
||||
@@ -110,9 +111,9 @@ mod tests {
|
||||
// Empty env value falls through to the home default (matches resolveDataDir).
|
||||
std::env::set_var("WAGGLE_DATA_DIR", "");
|
||||
let fallback = flag_path().expect("flag_path resolves with empty WAGGLE_DATA_DIR");
|
||||
assert!(
|
||||
fallback.ends_with(".waggle/first-launch.flag")
|
||||
|| fallback.ends_with(".waggle\\first-launch.flag")
|
||||
assert_eq!(
|
||||
fallback,
|
||||
tmp.join(".waggle-community").join("first-launch.flag")
|
||||
);
|
||||
|
||||
std::env::remove_var("WAGGLE_DATA_DIR");
|
||||
|
||||
@@ -8,6 +8,13 @@ mod tray;
|
||||
use service::ServiceState;
|
||||
use tauri::Manager;
|
||||
|
||||
/// Default data directory under the user's home directory, used when
|
||||
/// `WAGGLE_DATA_DIR` is unset. It is separate from the commercial Waggle's
|
||||
/// `~/.waggle` so the two editions never open the same databases (ADR-0011).
|
||||
/// The name is temporary: the final one follows the product-name decision (Q8).
|
||||
/// `packages/shared/tests/data-dir.test.ts` checks it matches `@waggle/shared`.
|
||||
pub(crate) const DEFAULT_DATA_DIR_NAME: &str = ".waggle-community";
|
||||
|
||||
#[tauri::command]
|
||||
async fn show_notification(
|
||||
app: tauri::AppHandle,
|
||||
|
||||
@@ -414,7 +414,7 @@ fn bundled_npm_environment(
|
||||
home_dir
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(PathBuf::from)
|
||||
.map(|home| home.join(".waggle"))
|
||||
.map(|home| home.join(crate::DEFAULT_DATA_DIR_NAME))
|
||||
})
|
||||
.ok_or_else(|| "Unable to resolve writable npm data directory".to_string())?;
|
||||
let runtime_dir = resources_dir
|
||||
@@ -1138,7 +1138,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bundled_npm_environment_falls_back_to_waggle_home() {
|
||||
fn bundled_npm_environment_falls_back_to_the_default_data_dir() {
|
||||
let resources = Path::new("resources");
|
||||
let home = Path::new("home");
|
||||
let environment = bundled_npm_environment(
|
||||
@@ -1149,15 +1149,10 @@ mod tests {
|
||||
)
|
||||
.expect("fallback npm environment resolves");
|
||||
|
||||
assert_eq!(
|
||||
environment.npm_prefix,
|
||||
home.join(".waggle").join("npm").join("prefix")
|
||||
);
|
||||
assert_eq!(
|
||||
environment.npm_cache,
|
||||
home.join(".waggle").join("npm").join("cache")
|
||||
);
|
||||
assert_eq!(environment.data_dir, home.join(".waggle"));
|
||||
let data_dir = home.join(".waggle-community");
|
||||
assert_eq!(environment.npm_prefix, data_dir.join("npm").join("prefix"));
|
||||
assert_eq!(environment.npm_cache, data_dir.join("npm").join("cache"));
|
||||
assert_eq!(environment.data_dir, data_dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user