Skip to content

nanocoai/nanoclaw / .claude/skills/add-iron-proxy

add-iron-proxy

Flagged

Install or refresh Iron Proxy and its official Iron Control web console for NanoClaw. Use when selecting the Iron gateway, adding its management UI, configuring credentials and grants, or restoring the proxy, approval bridge, and agent guidance.

FileKindSize
REMOVE.mdmarkdown1.7 KB
SKILL.mdskill md18.4 KB
assets/entrypoint.shscript300 B
assets/managed-proxy.Dockerfileother1.0 KB
conformance/credential-scope-cases.goscript3.0 KB
conformance/credential-scope-cases.jsonconfig28.8 KB
evals/evals.jsonconfig983 B
front-proxy/go.modmanifest443 B
front-proxy/go.summanifest3.2 KB
front-proxy/main.goscript22.6 KB
front-proxy/security_test.goscript29.8 KB
gateway.jsonconfig128 B
payload/src/gateway-providers/iron-proxy-allowlist.tsscript2.9 KB
payload/src/gateway-providers/iron-proxy-approval.test.tsscript14.4 KB
payload/src/gateway-providers/iron-proxy-approval.tsscript12.2 KB
payload/src/gateway-providers/iron-proxy-credential-scope.test.tsscript23.6 KB
payload/src/gateway-providers/iron-proxy-credential-scope.tsscript14.1 KB
payload/src/gateway-providers/iron-proxy-local-model.test.tsscript2.3 KB
payload/src/gateway-providers/iron-proxy-local-model.tsscript1.8 KB
payload/src/gateway-providers/iron-proxy-transform.protoother1.4 KB
payload/src/gateway-providers/iron-proxy.test.tsscript16.5 KB
payload/src/gateway-providers/iron-proxy.tsscript21.5 KB
references/control-plane.mdmarkdown4.8 KB
scripts/allowed-hosts.test.tsscript4.0 KB
scripts/auth-resume.test.tsscript6.2 KB
scripts/auth.test.tsscript2.4 KB
scripts/auth.tsscript7.9 KB
scripts/build-managed-proxy.tsscript4.8 KB
scripts/capture-claude-token.shscript963 B
scripts/control-preflight.tsscript3.8 KB
scripts/control.test.tsscript4.5 KB
scripts/control.tsscript11.7 KB
scripts/credential-isolation.test.tsscript5.6 KB
scripts/credential-isolation.tsscript3.9 KB
scripts/credential-store.test.tsscript9.1 KB
scripts/credential-store.tsscript7.0 KB
scripts/detect.test.tsscript1.6 KB
scripts/detect.tsscript1.4 KB
scripts/install-claude.shexecutablescript1.8 KB
scripts/install-command.test.tsscript5.2 KB
scripts/install-command.tsscript4.8 KB
scripts/local-model.test.tsscript2.7 KB
scripts/provider-credentials.test.tsscript18.3 KB
scripts/provider-credentials.tsscript20.1 KB
scripts/setup.test.tsscript7.9 KB
scripts/setup.tsscript17.1 KB
versions.jsonconfig747 B

scripts/control.test.ts

View on GitHub
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { parse as yaml } from 'yaml';

import { controlCompose, controlPaths, controlPort, installControl } from './control.js';
import { hasFrontProxy, frontProxyHash } from './build-managed-proxy.js';
import { installCommand } from './install-command.js';
import { getInstallSlug } from '../../../../src/install-slug.js';
import { GATEWAY_ROLE, LABELS } from '../../../../src/drivers/types.js';

vi.mock('./install-command.js', async (importActual) => ({
  ...(await importActual<typeof import('./install-command.js')>()),
  installCommand: vi.fn(async () => ''),
}));
const installCommandMock = vi.mocked(installCommand);

const roots: string[] = [];
const temporary = () => {
  const root = fs.mkdtempSync(path.join(os.tmpdir(), 'iron-control-test-'));
  roots.push(root);
  return root;
};
afterEach(() => {
  installCommandMock.mockClear();
  delete process.env.NANOCLAW_IRON_CONTROL_PORT;
  for (const root of roots.splice(0)) fs.rmSync(root, { recursive: true, force: true });
});

describe('official Iron Control installation', () => {
  it('isolates installs and exposes only the console on loopback', () => {
    const root = temporary();
    const other = temporary();
    const config = yaml(controlCompose(root, 18443));
    expect(config.name).not.toBe(yaml(controlCompose(other, 18443)).name);
    expect(config.services.web.ports).toEqual(['127.0.0.1:18443:3000']);
    expect(config.services.database.ports).toBeUndefined();
    expect(config.services.database.env_file).toEqual([controlPaths(root).databaseEnvironment]);
    expect(config.services.web.env_file).toEqual([controlPaths(root).environment]);
    expect(config.services.database.volumes).toEqual(['database:/var/lib/postgresql/data']);
    expect(config.services.web.image).toMatch(/^docker.io\/ironsh\/iron-control:.*@sha256:[a-f0-9]{64}$/);
    expect(JSON.stringify(config)).not.toContain('INITIAL_USER_PASSWORD');
  });

  it('uses the configured UI port and rejects invalid input before starting services', () => {
    const root = temporary();
    fs.writeFileSync(path.join(root, '.env'), 'NANOCLAW_IRON_CONTROL_PORT=18080\n');
    expect(controlPort(root)).toBe(18080);
    process.env.NANOCLAW_IRON_CONTROL_PORT = '18500';
    expect(controlPort(root)).toBe(18500);
    process.env.NANOCLAW_IRON_CONTROL_PORT = '70000';
    expect(() => controlPort(root)).toThrow('between 1 and 65535');
    delete process.env.NANOCLAW_IRON_CONTROL_PORT;
    fs.writeFileSync(path.join(root, '.env'), 'NANOCLAW_IRON_CONTROL_PORT=invalid\n');
    expect(() => controlPort(root)).toThrow('between 1 and 65535');
  });

  it('labels both services like the central proxy, and neither the volume nor the network', () => {
    const root = temporary();
    const config = yaml(controlCompose(root, 18443));
    const labels = { [LABELS.install]: getInstallSlug(root), [LABELS.role]: GATEWAY_ROLE };
    expect(config.services.web.labels).toEqual(labels);
    expect(config.services.database.labels).toEqual(labels);
    expect(Object.keys(config.services.web).slice(0, 4)).toEqual(['image', 'platform', 'restart', 'labels']);
    expect(config.volumes.database).toEqual({});
    expect(config.networks.default).toEqual({ name: controlPaths(root).network });
  });

  it('prints the exact cleanup commands when the database outlived its keys', async () => {
    const root = temporary();
    const project = controlPaths(root).project;
    installCommandMock.mockResolvedValueOnce(`other_database\n${project}_database\n`);
    const failure = installControl(root);
    await expect(failure).rejects.toThrow(`restore ${controlPaths(root).environment}`);
    await expect(failure).rejects.toThrow(
      `docker rm -f ${project}-database-1 ${project}-web-1; docker volume rm ${project}_database`,
    );
    // Only the volume listing ran: nothing was removed or started.
    expect(installCommandMock).toHaveBeenCalledTimes(1);
    expect(fs.existsSync(controlPaths(root).environment)).toBe(false);
  });

  it('requires both the pinned source and the exact approval front', () => {
    const labels = {
      'org.opencontainers.image.revision': '8a0eb0beb6524f4a7739b799842a13159d8b739e',
      'ai.nanoclaw.approval-front': frontProxyHash,
    };
    expect(hasFrontProxy({ Config: { Labels: labels } })).toBe(true);
    expect(hasFrontProxy({ Config: { Labels: { ...labels, 'ai.nanoclaw.approval-front': 'old' } } })).toBe(false);
    expect(hasFrontProxy({ Config: {} })).toBe(false);
  });
});
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall