LeoYeAI/agent-master-skills / skills/auto-respawn
auto-respawn
VerifiedYour agent always comes back. Anchor identity and memory on-chain so any new instance can resurrect from just an address — no local state, no single point of failure. Permanent identity and recovery on the Autonomys Network.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 16.4 KB |
| _meta.json | config | 281 B |
| auto-respawn.ts | script | 14.4 KB |
| eslint.config.js | script | 468 B |
| lib/address.ts | script | 2.2 KB |
| lib/balance.ts | script | 1.1 KB |
| lib/cli.ts | script | 1.6 KB |
| lib/evm-balance.ts | script | 925 B |
| lib/evm-transfer.ts | script | 2.4 KB |
| lib/evm.ts | script | 3.4 KB |
| lib/memory-chain.ts | script | 3.5 KB |
| lib/network.ts | script | 1.4 KB |
| lib/remark.ts | script | 1.3 KB |
| lib/transfer.ts | script | 1.7 KB |
| lib/wallet.ts | script | 8.8 KB |
| lib/xdm.ts | script | 3.3 KB |
| package.json | manifest | 647 B |
| references/auto-respawn-commands.md | markdown | 9.6 KB |
| references/autonomys-network.md | markdown | 6.2 KB |
| setup.shexecutable | script | 2.2 KB |
| tests/address.test.ts | script | 3.4 KB |
| tests/balance.test.ts | script | 4.3 KB |
| tests/cli.test.ts | script | 3.5 KB |
| tests/evm-balance.test.ts | script | 3.1 KB |
| tests/evm-transfer.test.ts | script | 5.2 KB |
| tests/evm.test.ts | script | 2.4 KB |
| tests/network.test.ts | script | 1.8 KB |
| tests/wallet-roundtrip.test.ts | script | 6.3 KB |
| tests/wallet.test.ts | script | 1.1 KB |
| tsconfig.json | config | 366 B |
tests/cli.test.ts
View on GitHubimport { describe, it, expect } from 'vitest'
import { parseArgs, validateAmount } from '../lib/cli.js'
describe('parseArgs', () => {
// Helper: simulate process.argv with node + script prefix
const argv = (...args: string[]) => ['node', 'auto-respawn.ts', ...args]
it('extracts a simple command', () => {
const result = parseArgs(argv('balance', 'my-wallet'))
expect(result.command).toBe('balance')
expect(result.positional).toEqual(['my-wallet'])
expect(result.subcommand).toBeUndefined()
})
it('extracts wallet subcommand', () => {
const result = parseArgs(argv('wallet', 'create', '--name', 'test'))
expect(result.command).toBe('wallet')
expect(result.subcommand).toBe('create')
expect(result.flags.name).toBe('test')
})
it('parses key-value flags', () => {
const result = parseArgs(argv('transfer', '--from', 'alice', '--to', 'bob', '--amount', '1.5'))
expect(result.flags).toEqual({ from: 'alice', to: 'bob', amount: '1.5' })
})
it('parses boolean flags', () => {
const result = parseArgs(argv('wallet', 'list', '--verbose'))
expect(result.flags.verbose).toBe('true')
})
it('handles mixed flags and positional args', () => {
const result = parseArgs(argv('gethead', '0xabc', '--network', 'mainnet'))
expect(result.command).toBe('gethead')
expect(result.positional).toEqual(['0xabc'])
expect(result.flags.network).toBe('mainnet')
})
it('returns empty command for empty argv', () => {
const result = parseArgs(argv())
expect(result.command).toBe('')
expect(result.positional).toEqual([])
expect(result.flags).toEqual({})
})
it('does not treat non-wallet commands as having subcommands', () => {
const result = parseArgs(argv('balance', 'my-wallet', '--network', 'chronos'))
expect(result.command).toBe('balance')
expect(result.subcommand).toBeUndefined()
expect(result.positional).toEqual(['my-wallet'])
})
it('treats flag-like wallet subcommand as a flag', () => {
const result = parseArgs(argv('wallet', '--name', 'test'))
expect(result.command).toBe('wallet')
expect(result.subcommand).toBeUndefined()
expect(result.flags.name).toBe('test')
})
it('handles consecutive boolean flags', () => {
const result = parseArgs(argv('test', '--verbose', '--dry-run'))
expect(result.flags.verbose).toBe('true')
expect(result.flags['dry-run']).toBe('true')
})
})
describe('validateAmount', () => {
it('accepts valid positive amounts', () => {
expect(() => validateAmount('1')).not.toThrow()
expect(() => validateAmount('0.5')).not.toThrow()
expect(() => validateAmount('100.123')).not.toThrow()
})
it('rejects zero', () => {
expect(() => validateAmount('0')).toThrow(/Must be a positive number/)
})
it('rejects negative amounts', () => {
expect(() => validateAmount('-1')).toThrow(/Must be a positive number/)
})
it('rejects non-numeric strings', () => {
expect(() => validateAmount('abc')).toThrow(/Must be a positive number/)
expect(() => validateAmount('')).toThrow(/Must be a positive number/)
})
it('rejects Infinity', () => {
expect(() => validateAmount('Infinity')).toThrow(/Must be a positive number/)
})
it('enforces minimum when provided', () => {
expect(() => validateAmount('0.5', 1)).toThrow(/below the minimum/)
})
it('accepts amounts at the minimum', () => {
expect(() => validateAmount('1', 1)).not.toThrow()
})
it('accepts amounts above the minimum', () => {
expect(() => validateAmount('2.5', 1)).not.toThrow()
})
})
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |