mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-07-09 18:57:08 +08:00
59460e9a5c
Builds on the structured-skill engine (slack was the first conversion). Adds the two directives the rest of the family needed, converts the 12 remaining skills, and routes their setup flows through the engine — deleting the hand-maintained shell scripts that had drifted from the skills. Engine (scripts/): - json-merge: merge a keyed JSON object into an array file (container/cli-tools.json), idempotent + journal-removable. add-codex uses it for its @openai/codex entry. - append at:<marker>: insert before a `// <<< <marker>` line instead of EOF. - setup/index.ts: a dormant `nanoclaw:setup-steps` marker in the STEPS map. Conversions (.claude/skills/): discord, telegram, teams, imessage, linear, github, webex, resend, matrix, gchat, whatsapp-cloud, codex — each aligned with its now-deleted setup script (versions, copied-file lists). @chat-adapter/* pins match our chat core (4.26.0); the lint enforces it. Setup integration (setup/): the discord/telegram/teams/imessage channel flows and the codex provider now apply their skill in-process via applySkill (secrets via the Prompter, fork-aware remote resolution), mirroring slack. Deleted 5 add-*.sh + 9 install-*.sh drifted duplicates; rewired the claude-assist diagnostics map. Channel remove no longer tears down the DB: wechat/emacs REMOVE.md stop deleting messaging_groups/sessions/wirings. Those are user runtime data the skill never created, so remove must not touch them — and orphan rows are inert (adapters start from the registry, not the DB). Verified: all 12 skills lint clean; 168/168 setup+scripts tests pass; no deps installed by the conversion and no core barrels applied. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
/**
|
|
* Setup CLI entry point.
|
|
* Usage: pnpm exec tsx setup/index.ts --step <name> [args...]
|
|
*/
|
|
import { log } from '../src/log.js';
|
|
import { emitStatus } from './status.js';
|
|
|
|
const STEPS: Record<
|
|
string,
|
|
() => Promise<{ run: (args: string[]) => Promise<void> }>
|
|
> = {
|
|
timezone: () => import('./timezone.js'),
|
|
'set-env': () => import('./set-env.js'),
|
|
environment: () => import('./environment.js'),
|
|
container: () => import('./container.js'),
|
|
register: () => import('./register.js'),
|
|
'pair-telegram': () => import('./pair-telegram.js'),
|
|
groups: () => import('./groups.js'),
|
|
'whatsapp-auth': () => import('./whatsapp-auth.js'),
|
|
'signal-auth': () => import('./signal-auth.js'),
|
|
mounts: () => import('./mounts.js'),
|
|
service: () => import('./service.js'),
|
|
verify: () => import('./verify.js'),
|
|
onecli: () => import('./onecli.js'),
|
|
auth: () => import('./auth.js'),
|
|
'provider-auth': () => import('./provider-auth.js'),
|
|
'cli-agent': () => import('./cli-agent.js'),
|
|
// >>> nanoclaw:setup-steps
|
|
// <<< nanoclaw:setup-steps
|
|
};
|
|
|
|
async function main(): Promise<void> {
|
|
const args = process.argv.slice(2);
|
|
const stepIdx = args.indexOf('--step');
|
|
|
|
if (stepIdx === -1 || !args[stepIdx + 1]) {
|
|
console.error(
|
|
`Usage: pnpm exec tsx setup/index.ts --step <${Object.keys(STEPS).join('|')}> [args...]`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
const stepName = args[stepIdx + 1];
|
|
const stepArgs = args.filter(
|
|
(a, i) => i !== stepIdx && i !== stepIdx + 1 && a !== '--',
|
|
);
|
|
|
|
const loader = STEPS[stepName];
|
|
if (!loader) {
|
|
console.error(`Unknown step: ${stepName}`);
|
|
console.error(`Available steps: ${Object.keys(STEPS).join(', ')}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
try {
|
|
const mod = await loader();
|
|
await mod.run(stepArgs);
|
|
} catch (err) {
|
|
const message = err instanceof Error ? err.message : String(err);
|
|
log.error('Setup step failed', { err, step: stepName });
|
|
emitStatus(stepName.toUpperCase(), {
|
|
STATUS: 'failed',
|
|
ERROR: message,
|
|
});
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
main();
|