docs(reference): import Dune: Awakening server-manager references
All checks were successful
CI / backend-types (push) Successful in 10s
CI / frontend-build (push) Successful in 15s
CI / agent-tests (push) Successful in 39s
CI / integration (push) Successful in 22s

Phase 2 references for the host-agent Dune adapter, moved out of volatile /tmp
into docs/reference-repos/ (per Commander). Three upstream projects, .git +
node_modules + compiled binaries stripped (16MB source). Nested AI-instruction
files (.claude/, CLAUDE.md) removed so they don't pollute Corrosion sessions.

- icehunter/    dune-admin (Go+React) — 4 control planes; SETUP_DOCKER.md is the
                closest analog to our agent's Dune docker control plane (compose
                lifecycle, docker logs, RabbitMQ-via-exec, dune Postgres schema)
- adainrivers/  Rust/Tauri desktop — SSH+k8s BattleGroup control, maintenance
                daemon, in-game admin console (Rust idiom reference)
- the4rchangel/ Node web UI replacing battlegroup.bat — matches the Commander's
                Hyper-V self-host path + game-config schema

See docs/reference-repos/README.md for the full index + how we use each.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-06-11 21:08:05 -04:00
parent 0715492ddf
commit 651a35d4be
1334 changed files with 238971 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
const fs = require('fs');
const path = require('path');
const os = require('os');
const { execSync } = require('child_process');
let cachedLocalAppData = null;
function isWsl() {
if (process.env.WSL_DISTRO_NAME) return true;
try {
return /microsoft/i.test(fs.readFileSync('/proc/version', 'utf8'));
} catch {
return false;
}
}
function getWindowsLocalAppData() {
if (cachedLocalAppData) return cachedLocalAppData;
if (process.env.LOCALAPPDATA) {
cachedLocalAppData = process.env.LOCALAPPDATA;
return cachedLocalAppData;
}
if (process.env.USERPROFILE) {
cachedLocalAppData = path.join(process.env.USERPROFILE, 'AppData', 'Local');
return cachedLocalAppData;
}
try {
const out = execSync(
'powershell.exe -NoProfile -NonInteractive -Command "[Environment]::GetFolderPath(\'LocalApplicationData\')"',
{ encoding: 'utf8', windowsHide: true, timeout: 15000 }
).trim();
if (out) {
cachedLocalAppData = out;
return cachedLocalAppData;
}
} catch { /* fall through */ }
throw new Error(
'Could not resolve Windows LOCALAPPDATA. Start the manager with start_as_admin.bat on Windows.'
);
}
function windowsToWslPath(winPath) {
const normalized = winPath.replace(/\\/g, '/');
const match = normalized.match(/^([A-Za-z]):\/(.*)$/);
if (!match) return winPath;
return `/mnt/${match[1].toLowerCase()}/${match[2]}`;
}
function getDuneKeyDir() {
return path.join(getWindowsLocalAppData(), 'DuneAwakeningServer');
}
function getKeyPath() {
return path.join(getDuneKeyDir(), 'sshKey');
}
function getWslKeyMirrorPath() {
return path.join(os.homedir(), '.dune-awakening-server-manager', 'sshKey');
}
function sshKeyExists() {
try {
const keyPath = isWsl() ? windowsToWslPath(getKeyPath()) : getKeyPath();
return fs.existsSync(keyPath);
} catch {
return false;
}
}
function getSshIdentityPath() {
const keyPath = getKeyPath();
if (!isWsl()) return keyPath;
const source = windowsToWslPath(keyPath);
if (!fs.existsSync(source)) {
throw new Error(
`SSH key not found at ${keyPath}. Use Settings → Rotate SSH Key, or re-run Setup → Security.`
);
}
const localKey = getWslKeyMirrorPath();
fs.mkdirSync(path.dirname(localKey), { recursive: true });
const srcStat = fs.statSync(source);
let needsCopy = !fs.existsSync(localKey);
if (!needsCopy) {
const dstStat = fs.statSync(localKey);
needsCopy = srcStat.mtimeMs > dstStat.mtimeMs || srcStat.size !== dstStat.size;
}
if (needsCopy) {
fs.copyFileSync(source, localKey);
}
fs.chmodSync(localKey, 0o600);
return localKey;
}
function removeWslKeyMirror() {
try {
const mirror = getWslKeyMirrorPath();
if (fs.existsSync(mirror)) fs.unlinkSync(mirror);
} catch { /* ignore */ }
}
module.exports = {
isWsl,
getWindowsLocalAppData,
getDuneKeyDir,
getKeyPath,
getSshIdentityPath,
getWslKeyMirrorPath,
sshKeyExists,
removeWslKeyMirror,
windowsToWslPath,
};