<!--
hoody-code Subskill (sdk)
Auto-generated by Hoody Skills Generator
Generated: 2026-05-06T20:05:54.226Z
Model: mimo-v2.5-pro
Mode: sdk


Tokens: 6515

DO NOT EDIT MANUALLY - Changes will be overwritten on next generation
-->

# hoody-code Subskill

## Overview

**hoody-code** provides cloud-hosted VS Code instances accessible via web browser URL. Each container can run multiple isolated VS Code instances, enabling remote development without local IDE setup.

### When to Use

- Remote code editing in containerized environments
- Automated extension deployment and management
- Health monitoring of VS Code instances
- Proxying requests to local development servers running inside the container
- Progressive Web App installation for offline access

### Philosophy Alignment

hoody-code embodies Hoody's zero-configuration philosophy: no local installation, no DNS setup, no SSL certificates. Access your development environment from any browser with automatic authentication and service isolation.

### Authentication Model

- Session-based authentication via cookies
- Password authentication with argon2 hashing
- Automatic redirect to `/login` when unauthenticated
- Rate limiting: 2 attempts/minute, 12 attempts/hour

---

## Common Workflows

### 1. Access VS Code Web Interface

Retrieve the main VS Code interface. Optionally specify folder, workspace, or locale.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Basic access
const vscode = await client.code.vscode.getVSCode()

// With folder and workspace parameters
const vscodeWithParams = await client.code.vscode.getVSCode(
  '/workspace/my-project',
  'my-workspace.code-workspace'
)
```

### 2. Authentication Flow

Handle login when password authentication is enabled.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Step 1: Get login page
const loginPage = await client.code.auth.getLoginPage()

// Step 2: Submit credentials
await client.code.auth.login()

// Step 3: Access VS Code after authentication
const vscode = await client.code.vscode.getVSCode()

// Logout when done
await client.code.auth.logout()
```

### 3. Install VS Code Extensions

Deploy extensions remotely via VSIX URL.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Install extension from URL
await client.code.extensions.install({
  url: 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/2024.1.0/vspackage'
})

// Verify installation
const extensions = await client.code.extensions.list()
console.log('Installed extensions:', extensions)
```

### 4. Health Monitoring

Check service status and available updates.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Check service health (does NOT count toward heartbeat activity)
const health = await client.code.health.check()

// Check for available updates
const updates = await client.code.health.checkUpdate()
```

### 5. Proxy to Local Applications

Forward requests to applications running on local ports inside the container.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Path-based proxy (strips /proxy/{port} prefix)
const apiResponse = await client.code.proxy.resolve(3000, '/api/data')

// Absolute proxy (preserves full path)
const fullResponse = await client.code.proxy.resolveAbsolute(8080, '/v1/status')
```

### 6. Retrieve PWA Manifest and Generate Keys

Set up Progressive Web App capabilities.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Get PWA manifest for installation
const manifest = await client.code.vscode.getManifest()

// Generate or retrieve encryption key (256-bit, persisted across restarts)
const key = await client.code.vscode.mintKey()
```

---

## Advanced Operations

### 1. Automated Extension Deployment Pipeline

Deploy a set of extensions and verify all installations succeed.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

const extensionsToInstall = [
  'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-python/vsextensions/python/2024.1.0/vspackage',
  'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/dbaeumer/vsextensions/eslint/2.4.0/vspackage'
]

// Install each extension
for (const url of extensionsToInstall) {
  await client.code.extensions.install({ url })
}

// Verify all extensions are present
const installed = await client.code.extensions.list()

// Use iterator for large extension lists
const iterator = await client.code.extensions.listIterator()
for await (const ext of iterator) {
  console.log(`Extension: ${ext.identifier}`)
}
```

### 2. Health Check with Recovery Pattern

Monitor health and handle failures gracefully.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

async function checkHealthWithRetry(maxRetries = 3): Promise<boolean> {
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
    try {
      const health = await client.code.health.check()
      if (health.status === 'ok') {
        return true
      }
    } catch (error) {
      console.log(`Health check attempt ${attempt} failed`)
      if (attempt === maxRetries) {
        throw new Error('Service unhealthy after maximum retries')
      }
      await new Promise(resolve => setTimeout(resolve, 1000 * attempt))
    }
  }
  return false
}

const isHealthy = await checkHealthWithRetry()
```

### 3. Multi-Port Development Server Proxy

Set up proxying for multiple local services running in the container.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Proxy configuration for local services
const services = [
  { port: 3000, path: '/api', mode: 'path' as const },
  { port: 5173, path: '/', mode: 'absolute' as const },
  { port: 8080, path: '/health', mode: 'path' as const }
]

// Test each service endpoint
for (const service of services) {
  try {
    const response = service.mode === 'path'
      ? await client.code.proxy.resolve(service.port, service.path)
      : await client.code.proxy.resolveAbsolute(service.port, service.path)
    console.log(`Port ${service.port}: OK`)
  } catch (error) {
    console.log(`Port ${service.port}: Failed - ${error}`)
  }
}
```

### 4. Injected Scripts and Static Assets

Retrieve custom scripts and static resources.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

// Get injected JavaScript (loaded automatically with --hoody-code flag)
const customScript = await client.code.static.getInjectedScript({ script: 'custom-theme.js' })

// Get static assets from build directory
const cssFile = await client.code.static.get({ path: 'css/main.css' })
const icon = await client.code.static.get({ path: 'icons/icon-192.png' })

// Get security and robots files
const securityPolicy = await client.code.static.getSecurityPolicy()
const robots = await client.code.static.getRobots()
```

### 5. Error Recovery for Authentication

Handle authentication failures with proper retry logic.

```
import { HoodyClient } from '@hoody-ai/hoody-sdk'

const client = new HoodyClient({
  baseURL: 'https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu',
  token: 'YOUR_TOKEN'
})

async function authenticatedAccess(): Promise<void> {
  try {
    await client.code.vscode.getVSCode()
  } catch (error: any) {
    if (error.status === 401 || error.message?.includes('redirect')) {
      console.log('Authentication required, initiating login flow')
      await client.code.auth.login()
      await client.code.vscode.getVSCode()
    } else {
      throw error
    }
  }
}
```

---

## Quick Reference

### Essential Endpoints

| Operation | SDK Method | HTTP |
|-----------|-----------|------|
| Get VS Code UI | `client.code.vscode.getVSCode()` | GET `/api/v1/code` |
| Login | `client.code.auth.login()` | POST `/api/v1/code/login` |
| Logout | `client.code.auth.logout()` | GET `/api/v1/code/logout` |
| Health check | `client.code.health.check()` | GET `/api/v1/code/health` |
| Install extension | `client.code.extensions.install({url})` | POST `/api/v1/code/extensions/install` |
| List extensions | `client.code.extensions.list()` | GET `/api/v1/code/extensions/list` |
| Proxy (path) | `client.code.proxy.resolve(port, path)` | GET `/api/v1/code/proxy/{port}/{path}` |
| Proxy (absolute) | `client.code.proxy.resolveAbsolute(port, path)` | GET `/api/v1/code/absproxy/{port}/{path}` |
| Get manifest | `client.code.vscode.getManifest()` | GET `/api/v1/code/manifest.json` |
| Mint key | `client.code.vscode.mintKey()` | POST `/api/v1/code/mint-key` |
| Check updates | `client.code.health.checkUpdate()` | GET `/api/v1/code/update/check` |

### Key Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `url` | string | VSIX file URL for extension install |
| `port` | number | Local port (1024-65535) for proxy |
| `path` | string | Path segment for proxy or static assets |
| `script` | string | Script filename for injected scripts |

### Response Patterns

- **Health**: Returns process and runtime info; does NOT trigger heartbeat
- **Extensions list**: Returns array of installed extension metadata
- **Proxy**: Returns proxied response from local application
- **Login**: Rate limited (2/min, 12/hour); returns error on exceeded
- **Static assets**: Long cache headers in production based on git commit

### Base URL Construction

```
https://{projectId}-{containerId}-code-{serviceId}.{node}.containers.hoody.icu
```

Refer to core SKILL.md for container creation and service discovery to obtain these values.