LeoYeAI/agent-master-skills / skills/aquaclaw-openclaw-bridge
aquaclaw-openclaw-bridge
UnverifiedUse when OpenClaw needs to join a hosted Aqua from URL + invite code, read mirror-backed or live Aqua state, inspect runtime status, or run local/hosted Aqua join, context, pulse, mirror, heartbeat, and diary-digest flows.
scripts/resolve-openclaw-user-timezone.mjs
View on GitHub#!/usr/bin/env node
import process from 'node:process';
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const execFileAsync = promisify(execFile);
function printHelp() {
console.log(`Usage: resolve-openclaw-user-timezone.mjs [options]
Options:
--configured-timezone <iana> Override configured user timezone (mainly for tests)
--host-timezone <iana> Override detected host timezone (mainly for tests)
--field <name> Print one field: timezone|source
--json Print the full resolved timezone as JSON
--help Show this message
`);
}
function parseArgValue(argv, index, current, label) {
if (current.includes('=')) {
return current.slice(current.indexOf('=') + 1);
}
const next = argv[index + 1];
if (!next || next.startsWith('--')) {
throw new Error(`${label} requires a value`);
}
return next;
}
export function validateTimeZone(value) {
const timeZone = String(value ?? '').trim();
if (!timeZone) {
return null;
}
try {
new Intl.DateTimeFormat('en-US', { timeZone }).format(new Date());
return timeZone;
} catch {
return null;
}
}
export function resolveHostTimeZone(hostTimeZone) {
return validateTimeZone(hostTimeZone) ?? validateTimeZone(Intl.DateTimeFormat().resolvedOptions().timeZone) ?? 'UTC';
}
export function resolveUserTimeZone({ configuredTimeZone, hostTimeZone } = {}) {
const configured = validateTimeZone(configuredTimeZone);
if (configured) {
return {
source: 'config',
timezone: configured,
};
}
return {
source: 'host',
timezone: resolveHostTimeZone(hostTimeZone),
};
}
async function readConfiguredUserTimeZone() {
try {
const { stdout } = await execFileAsync('openclaw', ['config', 'get', 'agents.defaults.userTimezone'], {
env: process.env,
});
return String(stdout ?? '').trim() || null;
} catch {
return null;
}
}
function parseOptions(argv) {
const options = {
configuredTimeZone: null,
field: null,
hostTimeZone: null,
json: false,
};
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === '--help') {
printHelp();
process.exit(0);
}
if (arg.startsWith('--configured-timezone')) {
options.configuredTimeZone = parseArgValue(argv, index, arg, '--configured-timezone').trim();
if (!arg.includes('=')) {
index += 1;
}
continue;
}
if (arg.startsWith('--host-timezone')) {
options.hostTimeZone = parseArgValue(argv, index, arg, '--host-timezone').trim();
if (!arg.includes('=')) {
index += 1;
}
continue;
}
if (arg.startsWith('--field')) {
options.field = parseArgValue(argv, index, arg, '--field').trim();
if (!arg.includes('=')) {
index += 1;
}
continue;
}
if (arg === '--json') {
options.json = true;
continue;
}
throw new Error(`unknown option: ${arg}`);
}
if (options.field && !new Set(['timezone', 'source']).has(options.field)) {
throw new Error('--field must be one of: timezone, source');
}
return options;
}
async function main() {
const options = parseOptions(process.argv.slice(2));
const configuredTimeZone = options.configuredTimeZone ?? (await readConfiguredUserTimeZone());
const resolved = resolveUserTimeZone({
configuredTimeZone,
hostTimeZone: options.hostTimeZone,
});
if (options.json) {
process.stdout.write(`${JSON.stringify(resolved, null, 2)}\n`);
return;
}
if (options.field === 'source') {
process.stdout.write(`${resolved.source}\n`);
return;
}
if (options.field === 'timezone') {
process.stdout.write(`${resolved.timezone}\n`);
return;
}
process.stdout.write(`${resolved.timezone}\n`);
}
if (import.meta.url === `file://${process.argv[1]}`) {
main().catch((error) => {
console.error(error instanceof Error ? error.message : String(error));
process.exit(1);
});
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |