diff --git a/src/cli/commands/doctor.ts b/src/cli/commands/doctor.ts index f046f20..3b13419 100644 --- a/src/cli/commands/doctor.ts +++ b/src/cli/commands/doctor.ts @@ -32,7 +32,7 @@ export function registerDoctorCommand(program: Command): void { return; } - // Check 2: Active rig + // Check 2: Active jato const activeJatoName = await getActiveJato(); checks.push({ label: "Active jato is set", @@ -45,11 +45,11 @@ export function registerDoctorCommand(program: Command): void { return; } - // Check 3: Rig is valid - let rigValid = false; + // Check 3: Jato is valid + let jatoValid = false; try { - const rig = await loadJato(activeJatoName); - rigValid = true; + const jato = await loadJato(activeJatoName); + jatoValid = true; checks.push({ label: `Jato '${activeJatoName}' has valid jato.yaml`, ok: true, @@ -57,7 +57,7 @@ export function registerDoctorCommand(program: Command): void { // Check 4: Enabled providers are installed const detected = await detectInstalledProviders(); - const enabledProviders = Object.entries(rig.manifest.providers) + const enabledProviders = Object.entries(jato.manifest.providers) .filter(([, enabled]) => enabled) .map(([name]) => name); @@ -81,7 +81,7 @@ export function registerDoctorCommand(program: Command): void { } // Check 5: Env vars for MCPs - for (const server of rig.manifest.mcp_servers) { + for (const server of jato.manifest.mcp_servers) { for (const envKey of server.env) { const defined = process.env[envKey] !== undefined; checks.push({ diff --git a/src/cli/commands/install.ts b/src/cli/commands/install.ts index 33c5465..6835d1c 100644 --- a/src/cli/commands/install.ts +++ b/src/cli/commands/install.ts @@ -34,10 +34,10 @@ export function registerInstallCommand(program: Command): void { const repoDir = join(tmpDir, "repo"); - // Find rigs in the repo + // Find jatos in the repo // Look for directories with jato.yaml - const jatosDir = existsSync(join(repoDir, "rigs")) - ? join(repoDir, "rigs") + const jatosDir = existsSync(join(repoDir, "jatos")) + ? join(repoDir, "jatos") : repoDir; const entries = await readdir(jatosDir, { withFileTypes: true }); diff --git a/src/cli/commands/list.ts b/src/cli/commands/list.ts index 9d2ff11..d36dad9 100644 --- a/src/cli/commands/list.ts +++ b/src/cli/commands/list.ts @@ -6,24 +6,24 @@ import { loadJato } from "../../core/jato.js"; export function registerListCommand(program: Command): void { program .command("list") - .description("List all available rigs") + .description("List all available jatos") .action(async () => { - const rigs = await listJatos(); + const jatos = await listJatos(); const active = await getActiveJato(); - if (rigs.length === 0) { + if (jatos.length === 0) { process.stdout.write(" No jatos found. Run `jato init` to create one.\n"); return; } process.stdout.write("\n"); - for (const name of rigs) { + for (const name of jatos) { let description = ""; try { - const rig = await loadJato(name); - description = rig.manifest.description ?? ""; + const jato = await loadJato(name); + description = jato.manifest.description ?? ""; } catch { - // Skip invalid rigs + // Skip invalid jatos } const isActive = name === active; diff --git a/src/cli/commands/off.ts b/src/cli/commands/off.ts index c4ce10f..2270976 100644 --- a/src/cli/commands/off.ts +++ b/src/cli/commands/off.ts @@ -10,11 +10,11 @@ export function registerOffCommand(program: Command): void { const active = await getActiveJato(); if (!active) { - process.stdout.write(" No rig is currently active.\n"); + process.stdout.write(" No jato is currently active.\n"); return; } await writeGlobalConfig({}); - process.stdout.write(` ${chalk.green("✓")} Deactivated rig '${active}'\n`); + process.stdout.write(` ${chalk.green("✓")} Deactivated jato '${active}'\n`); }); } diff --git a/src/core/hub.ts b/src/core/hub.ts index 938db29..82ce24d 100644 --- a/src/core/hub.ts +++ b/src/core/hub.ts @@ -16,7 +16,7 @@ export function getConfigPath(home?: string): string { } export function getJatosDir(home?: string): string { - return join(getHubDir(home), "rigs"); + return join(getHubDir(home), "jatos"); } export function getSkillsDir(home?: string): string { @@ -29,7 +29,7 @@ export function getJatoDir(jatoName: string, home?: string): string { export async function ensureHub(home?: string): Promise { const hubDir = getHubDir(home); - await mkdir(join(hubDir, "rigs"), { recursive: true }); + await mkdir(join(hubDir, "jatos"), { recursive: true }); await mkdir(join(hubDir, "skills"), { recursive: true }); } diff --git a/src/core/materializer.ts b/src/core/materializer.ts index d86a2f8..4b8079a 100644 --- a/src/core/materializer.ts +++ b/src/core/materializer.ts @@ -21,11 +21,11 @@ export async function materialize( options: MaterializeOptions = {}, ): Promise { const { home, targetRoot = process.cwd() } = options; - const rig = await loadJato(jatoName, home); + const jato = await loadJato(jatoName, home); const filesWritten: BackupResult[] = []; - const enabledProviders = Object.entries(rig.manifest.providers) + const enabledProviders = Object.entries(jato.manifest.providers) .filter(([, enabled]) => enabled) .map(([name]) => name); @@ -33,7 +33,7 @@ export async function materialize( const provider = getProvider(providerName); if (!provider) continue; - const result = provider.materialize(rig, home); + const result = provider.materialize(jato, home); for (const file of result.files) { const filePath = file.path.startsWith("/") @@ -47,7 +47,7 @@ export async function materialize( const contextSkillDir = join(skillsDir, "jato-context"); await mkdir(contextSkillDir, { recursive: true }); - const contextContent = generateJatoContextSkill(rig); + const contextContent = generateJatoContextSkill(jato); const contextBackup = await writeWithBackup( join(contextSkillDir, "SKILL.md"), contextContent, diff --git a/src/providers/claude.ts b/src/providers/claude.ts index 882a3a0..ed06b1a 100644 --- a/src/providers/claude.ts +++ b/src/providers/claude.ts @@ -43,14 +43,14 @@ export const claudeProvider: Provider = { instructionsFileName: "CLAUDE.md", - materialize(rig: ResolvedJato, home?: string): MaterializeResult { + materialize(jato: ResolvedJato, home?: string): MaterializeResult { const files: MaterializeResult["files"] = []; const settings: Record = { permissions: { - mode: mapPermission(rig.manifest.permissions.auto_execute), + mode: mapPermission(jato.manifest.permissions.auto_execute), }, - mcpServers: mapMcpServers(rig.manifest.mcp_servers), + mcpServers: mapMcpServers(jato.manifest.mcp_servers), }; files.push({ @@ -58,10 +58,10 @@ export const claudeProvider: Provider = { content: JSON.stringify(settings, null, 2) + "\n", }); - if (rig.providerDocs["claude"]) { + if (jato.providerDocs["claude"]) { files.push({ path: "CLAUDE.md", - content: rig.providerDocs["claude"], + content: jato.providerDocs["claude"], }); } diff --git a/src/providers/codex.ts b/src/providers/codex.ts index 4f7b197..85796da 100644 --- a/src/providers/codex.ts +++ b/src/providers/codex.ts @@ -16,13 +16,13 @@ function tomlKey(key: string): string { return /^[a-zA-Z0-9_-]+$/.test(key) ? key : JSON.stringify(key); } -function renderCodexConfig(rig: ResolvedJato): string { +function renderCodexConfig(jato: ResolvedJato): string { const lines: string[] = []; - lines.push(`approval_policy = ${tomlString(rig.manifest.permissions.auto_execute ? "auto-edit" : "on-request")}`); + lines.push(`approval_policy = ${tomlString(jato.manifest.permissions.auto_execute ? "auto-edit" : "on-request")}`); lines.push(""); - for (const server of rig.manifest.mcp_servers) { + for (const server of jato.manifest.mcp_servers) { if (!server.enabled) continue; lines.push(`[mcp_servers.${tomlKey(server.id)}]`); @@ -62,18 +62,18 @@ export const codexProvider: Provider = { instructionsFileName: "AGENTS.md", - materialize(rig: ResolvedJato, home?: string): MaterializeResult { + materialize(jato: ResolvedJato, home?: string): MaterializeResult { const files: MaterializeResult["files"] = []; files.push({ path: this.configPath(home), - content: renderCodexConfig(rig), + content: renderCodexConfig(jato), }); - if (rig.providerDocs["codex"]) { + if (jato.providerDocs["codex"]) { files.push({ path: "AGENTS.md", - content: rig.providerDocs["codex"], + content: jato.providerDocs["codex"], }); } diff --git a/src/providers/gemini.ts b/src/providers/gemini.ts index c926234..5534728 100644 --- a/src/providers/gemini.ts +++ b/src/providers/gemini.ts @@ -44,12 +44,12 @@ export const geminiProvider: Provider = { instructionsFileName: "GEMINI.md", - materialize(rig: ResolvedJato, home?: string): MaterializeResult { + materialize(jato: ResolvedJato, home?: string): MaterializeResult { const files: MaterializeResult["files"] = []; const settings: Record = { - approvalMode: mapPermission(rig.manifest.permissions.auto_execute), - mcpServers: mapMcpServers(rig.manifest.mcp_servers), + approvalMode: mapPermission(jato.manifest.permissions.auto_execute), + mcpServers: mapMcpServers(jato.manifest.mcp_servers), }; files.push({ @@ -57,10 +57,10 @@ export const geminiProvider: Provider = { content: JSON.stringify(settings, null, 2) + "\n", }); - if (rig.providerDocs["gemini"]) { + if (jato.providerDocs["gemini"]) { files.push({ path: "GEMINI.md", - content: rig.providerDocs["gemini"], + content: jato.providerDocs["gemini"], }); } diff --git a/src/providers/opencode.ts b/src/providers/opencode.ts index 6151612..8e98b8c 100644 --- a/src/providers/opencode.ts +++ b/src/providers/opencode.ts @@ -43,12 +43,12 @@ export const opencodeProvider: Provider = { instructionsFileName: "", - materialize(rig: ResolvedJato, home?: string): MaterializeResult { + materialize(jato: ResolvedJato, home?: string): MaterializeResult { const files: MaterializeResult["files"] = []; const config: Record = { - mode: mapPermission(rig.manifest.permissions.auto_execute), - mcp: mapMcpServers(rig.manifest.mcp_servers), + mode: mapPermission(jato.manifest.permissions.auto_execute), + mcp: mapMcpServers(jato.manifest.mcp_servers), }; files.push({ diff --git a/src/providers/types.ts b/src/providers/types.ts index 45ec21a..7d35da9 100644 --- a/src/providers/types.ts +++ b/src/providers/types.ts @@ -14,5 +14,5 @@ export interface Provider { configPath(home?: string): string; skillsDir(home?: string): string; instructionsFileName: string; - materialize(rig: ResolvedJato, home?: string): MaterializeResult; + materialize(jato: ResolvedJato, home?: string): MaterializeResult; } diff --git a/src/skills/jato-context.ts b/src/skills/jato-context.ts index 4db208c..d83e438 100644 --- a/src/skills/jato-context.ts +++ b/src/skills/jato-context.ts @@ -1,36 +1,52 @@ import type { ResolvedJato } from "../core/jato.js"; -export function generateJatoContextSkill(rig: ResolvedJato): string { +export function generateJatoContextSkill(jato: ResolvedJato): string { const lines: string[] = []; + lines.push("---"); + lines.push("name: jato-context"); + lines.push( + "description: >", + ); + lines.push( + ` Active jato environment context for '${jato.manifest.name}'. Provides current configuration,`, + ); + lines.push( + " available skills, MCP servers, and global instructions. Automatically loaded to inform", + ); + lines.push( + " about the active AI environment setup.", + ); + lines.push("---"); + lines.push(""); lines.push("# jato — Active Context"); lines.push(""); lines.push("You are working within a jato-managed environment."); lines.push(""); - lines.push(`## Active Jato: ${rig.manifest.name}`); - if (rig.manifest.description) { - lines.push(rig.manifest.description); + lines.push(`## Active Jato: ${jato.manifest.name}`); + if (jato.manifest.description) { + lines.push(jato.manifest.description); } lines.push(""); - if (rig.skills.length > 0) { + if (jato.skills.length > 0) { lines.push("## Available Skills"); lines.push(""); lines.push("The following skill files contain specialized context. Read them when the task is relevant:"); lines.push(""); - for (const skill of rig.skills) { + for (const skill of jato.skills) { lines.push(`- \`${skill.path}\` — ${skill.name}`); } lines.push(""); } - if (rig.manifest.mcp_servers.length > 0) { + if (jato.manifest.mcp_servers.length > 0) { lines.push("## Configured MCP Servers"); lines.push(""); lines.push("The following MCP servers are configured and available in this session:"); lines.push(""); - for (const server of rig.manifest.mcp_servers) { + for (const server of jato.manifest.mcp_servers) { if (!server.enabled) continue; const cmd = server.url ?? `${server.command ?? ""} ${server.args.join(" ")}`.trim(); const envNote = server.env.length > 0 ? ` (requires: ${server.env.join(", ")})` : ""; @@ -39,17 +55,17 @@ export function generateJatoContextSkill(rig: ResolvedJato): string { lines.push(""); } - if (rig.instructions) { + if (jato.instructions) { lines.push("## Global Instructions"); lines.push(""); - lines.push(rig.instructions.trim()); + lines.push(jato.instructions.trim()); lines.push(""); } - if (rig.agents.length > 0) { + if (jato.agents.length > 0) { lines.push("## Agents"); lines.push(""); - for (const agent of rig.agents) { + for (const agent of jato.agents) { lines.push(`- \`${agent.path}\` — ${agent.name}`); } lines.push(""); diff --git a/src/skills/jato-manager.md b/src/skills/jato-manager.md index 6dff8ca..55d6d6f 100644 --- a/src/skills/jato-manager.md +++ b/src/skills/jato-manager.md @@ -1,65 +1,84 @@ -# jato — Manager Skill +--- +name: jato-manager +description: > + Manages jato configurations — create, modify, switch, and inspect AI environment setups. + Use when user mentions 'jato', asks to 'create a jato', 'switch jato', 'add an MCP', + 'change AI config', 'set up my tools', or asks about their active environment configuration. + Also use when user wants to add skills, agents, or MCP servers to their setup. +--- -You are the jato manager. You help users create, modify, and manage their jato configurations. A jato is a complete AI environment configuration that can be activated to set up all AI coding tools (Claude Code, Codex CLI, Gemini CLI, OpenCode) at once. +# jato Manager -## CLI Operations +You help users create, modify, and manage their jato configurations. A jato is a complete AI environment configuration that activates across all AI coding tools (Claude Code, Codex CLI, Gemini CLI, OpenCode) at once. -You can manage jatos by running these commands: +## Prerequisites -- `jato list` — Show all available jatos and which is active -- `jato use ` — Switch to a different jato (materializes all configs) -- `jato use` — Show which jato is currently active -- `jato off` — Deactivate the current jato -- `jato doctor` — Check health of the current jato setup -- `jato install ` — Install jatos from a git repository +Verify the CLI is available before any operation: -Always run `jato use ` after modifying a jato's files to re-materialize. +```bash +npx @malopezr7/jato list +``` -## Hub Structure +You can also use `pnpm dlx @malopezr7/jato` instead of `npx`. + +## CLI Commands + +| Command | Purpose | +|---------|---------| +| `jato list` | Show all jatos and which is active | +| `jato use ` | Activate a jato (materializes configs) | +| `jato use` | Show active jato | +| `jato off` | Deactivate current jato | +| `jato doctor` | Health check | +| `jato init` | Create new jato (interactive or flags) | +| `jato init --from auto --name ` | Import from existing tool configs | +| `jato init --template --name ` | From template (starter, backend, fullstack, mobile) | +| `jato install ` | Install jatos from git | +| `jato skill install` | Install this skill to providers | -All jatos live in `~/.jato/`: +CRITICAL: Always run `jato use ` after modifying any jato files to re-materialize. + +## Hub Structure ``` ~/.jato/ config.yaml ← active_jato: skills/ - jato-manager.md ← this file + jato-manager.md ← this file jatos/ / - jato.yaml ← manifest (providers, MCPs, permissions) - instructions.md ← shared instructions for all providers + jato.yaml ← manifest (providers, MCPs, permissions) + instructions.md ← shared instructions for all providers providers/ - claude.md ← materializes as CLAUDE.md - codex.md ← materializes as AGENTS.md - gemini.md ← materializes as GEMINI.md + claude.md ← materializes as CLAUDE.md + codex.md ← materializes as AGENTS.md + gemini.md ← materializes as GEMINI.md skills/ - .md ← specialized context files + .md ← specialized context files agents/ - .md ← agent definitions + .md ← agent definitions ``` ## Creating a New Jato -When the user wants to create a new jato, guide them through this process: +Both CLI and manual creation are valid. The CLI is faster for imports; manual creation enables a guided step-by-step experience. + +### Via CLI + +```bash +npx @malopezr7/jato init # Interactive wizard +npx @malopezr7/jato init --from auto --name myproject # Import existing +npx @malopezr7/jato init --template mobile --name myproject # From template +``` + +### Via guided manual creation -### Step 1: Understand the context -Ask about: -- What role/context is this jato for? (mobile dev, backend, data science, devops, code review...) -- What tech stack? (React Native, Node.js, Python, Go...) -- What AI tools do they use? (Claude Code, Codex, Gemini...) +Walk the user through these steps: -### Step 2: Build the manifest -Based on their answers, create the jato directory structure: +**Step 1 — Understand context:** Ask about the role (mobile, backend, devops...), tech stack, and which AI tools they use. -1. Create directory: `~/.jato/jatos//` -2. Create subdirectories: `providers/`, `skills/`, `agents/` -3. Write `jato.yaml` with: - - Appropriate name and description - - Enabled providers based on their tools - - MCP servers relevant to their stack - - Permission settings based on their preference +**Step 2 — Build manifest:** Create `~/.jato/jatos//` with subdirectories `providers/`, `skills/`, `agents/`. Write `jato.yaml`: -Example `jato.yaml`: ```yaml name: mobile description: React Native mobile development setup @@ -75,88 +94,76 @@ mcp_servers: args: [-y, "@modelcontextprotocol/server-github"] env: [GITHUB_TOKEN] - - id: expo - command: npx - args: [-y, "expo-mcp-server"] - env: [EXPO_TOKEN] - permissions: auto_execute: false ``` -### Step 3: Generate instructions -Create `instructions.md` with context-appropriate guidelines: -- Coding conventions for their stack -- Review standards -- Architecture patterns they follow - -### Step 4: Generate provider-specific instructions -For each enabled provider, create `providers/.md`: -- `claude.md` — Instructions specific to Claude Code behavior -- `codex.md` — Instructions specific to Codex CLI behavior -- `gemini.md` — Instructions specific to Gemini CLI behavior - -Tailor each to the provider's strengths and format expectations. - -### Step 5: Generate skills -Create relevant skill files in `skills/`: -- Code review guidelines for their stack -- Testing patterns -- Architecture decision records -- Deployment procedures -- Any domain-specific knowledge - -### Step 6: Generate agents (if requested) -Create agent definitions in `agents/`: -- Reviewer agent -- Architect agent -- Testing agent - -### Step 7: Activate -After generating all files, run `jato use ` to materialize. +**Step 3 — Write instructions:** Create `instructions.md` with shared conventions, then `providers/.md` for each enabled provider. -## Modifying an Existing Jato - -When the user wants to modify their active jato: +**Step 4 — Create skills:** Recommend skills based on the stack (see below). Each skill should be a focused `.md` file in `skills/`. -- **Add an MCP**: Edit `~/.jato/jatos//jato.yaml`, add the server entry, then run `jato use ` -- **Add a skill**: Create a new `.md` file in `~/.jato/jatos//skills/`, then run `jato use ` -- **Change instructions**: Edit `instructions.md` or files in `providers/`, then run `jato use ` -- **Add an agent**: Create a new `.md` file in `~/.jato/jatos//agents/`, then run `jato use ` +**Step 5 — Activate:** Run `jato use ` to materialize. -Always remind the user to run `jato use ` after changes to re-materialize. +## Skill Recommendations -## Inspecting a Jato +When creating skills, recommend based on the user's stack. Each skill should be **actionable** (concrete patterns, not vague advice), **specific** (reference actual libraries and conventions), and **concise** (2-4KB, one topic per file). -When the user asks about their current jato or wants to see what's configured: +### By stack -1. Read `~/.jato/config.yaml` to find the active jato -2. Read `~/.jato/jatos//jato.yaml` for the manifest -3. List files in `skills/`, `agents/`, `providers/` to show what's available -4. Present a clear summary +| Stack | Recommended skills | +|-------|--------------------| +| **Mobile** | testing (component/hook patterns, mock native modules), viewmodel-architecture, native-bridge, code-review | +| **Backend** | api-patterns (REST/GraphQL, error format, pagination), database (queries, migrations, pooling), testing, security | +| **Frontend** | component-patterns, testing (user-event, MSW), accessibility (ARIA, keyboard nav), styling | +| **Full-stack** | code-review, testing, git-workflow, architecture | +| **DevOps** | deployment (CI/CD, rollback), monitoring (logging, alerts), security (secrets, access) | -## Common MCP Server References +### What makes a good skill -When suggesting MCPs, use these known configurations: +- Include concrete code templates and "when to use / when NOT to use" guidance +- Reference actual libraries, file paths, and project conventions +- Keep each skill focused on one topic (under 500 lines) +- Put critical instructions at the top — Claude reads top-down -- **github**: `npx -y @modelcontextprotocol/server-github` env: [GITHUB_TOKEN] -- **filesystem**: `npx -y @modelcontextprotocol/server-filesystem` args: [] -- **postgres**: `npx -y @modelcontextprotocol/server-postgres` env: [DATABASE_URL] -- **sqlite**: `npx -y @modelcontextprotocol/server-sqlite` args: [] -- **brave-search**: `npx -y @modelcontextprotocol/server-brave-search` env: [BRAVE_API_KEY] -- **fetch**: `npx -y @modelcontextprotocol/server-fetch` -- **memory**: `npx -y @modelcontextprotocol/server-memory` -- **supabase**: `npx -y @anthropic/mcp-server-supabase` env: [SUPABASE_URL, SUPABASE_KEY] -- **sentry**: `npx -y @sentry/mcp-server` env: [SENTRY_AUTH_TOKEN] -- **linear**: `npx -y @anthropic/mcp-server-linear` env: [LINEAR_API_KEY] -- **slack**: `npx -y @anthropic/mcp-server-slack` env: [SLACK_BOT_TOKEN] -- **puppeteer**: `npx -y @anthropic/mcp-server-puppeteer` -- **docker**: `npx -y @modelcontextprotocol/server-docker` - -## Tips for Good Jatos +## Modifying an Existing Jato -- Keep instructions focused: one jato per role/context -- Put shared conventions in `instructions.md`, provider-specific in `providers/` -- Skills should be actionable: specific patterns, not vague advice -- Use MCPs that match the actual workflow (don't add MCPs you won't use) -- Name jatos clearly: `mobile`, `backend`, `code-review`, not `my-stuff` +| Change | How | +|--------|-----| +| Add MCP | Edit `jato.yaml`, add server entry | +| Add skill | Create `.md` in `skills/` | +| Change instructions | Edit `instructions.md` or `providers/*.md` | +| Add agent | Create `.md` in `agents/` | + +After any change: `jato use ` to re-materialize. + +## Common MCP Servers + +| Server | Command | Env vars | +|--------|---------|----------| +| github | `npx -y @modelcontextprotocol/server-github` | GITHUB_TOKEN | +| filesystem | `npx -y @modelcontextprotocol/server-filesystem` | — | +| postgres | `npx -y @modelcontextprotocol/server-postgres` | DATABASE_URL | +| sqlite | `npx -y @modelcontextprotocol/server-sqlite` | — | +| brave-search | `npx -y @modelcontextprotocol/server-brave-search` | BRAVE_API_KEY | +| fetch | `npx -y @modelcontextprotocol/server-fetch` | — | +| memory | `npx -y @modelcontextprotocol/server-memory` | — | +| supabase | `npx -y @anthropic/mcp-server-supabase` | SUPABASE_URL, SUPABASE_KEY | +| sentry | `npx -y @sentry/mcp-server` | SENTRY_AUTH_TOKEN | +| linear | `npx -y @anthropic/mcp-server-linear` | LINEAR_API_KEY | +| slack | `npx -y @anthropic/mcp-server-slack` | SLACK_BOT_TOKEN | +| puppeteer | `npx -y @anthropic/mcp-server-puppeteer` | — | +| docker | `npx -y @modelcontextprotocol/server-docker` | — | + +## Troubleshooting + +### jato use fails with "not found" +**Cause:** Jato name doesn't exist in `~/.jato/jatos/` +**Fix:** Run `jato list` to see available names; check spelling + +### MCP server not connecting after activation +**Cause:** Missing environment variables +**Fix:** Check `env` entries in `jato.yaml`; ensure vars are set in your shell + +### Changes not reflected after editing files +**Cause:** Forgot to re-materialize +**Fix:** Run `jato use ` after every file change diff --git a/tests/cli/doctor.test.ts b/tests/cli/doctor.test.ts index 8976aef..823c2c0 100644 --- a/tests/cli/doctor.test.ts +++ b/tests/cli/doctor.test.ts @@ -31,18 +31,18 @@ describe("jato doctor", () => { expect(output).toContain("Hub directory"); }); - it("runs full checks when hub and rig exist", async () => { + it("runs full checks when hub and jato exist", async () => { // Create hub with active rig - await mkdir(join(tmpHome, ".jato", "rigs", "test", "providers"), { recursive: true }); - await mkdir(join(tmpHome, ".jato", "rigs", "test", "skills"), { recursive: true }); - await mkdir(join(tmpHome, ".jato", "rigs", "test", "agents"), { recursive: true }); + await mkdir(join(tmpHome, ".jato", "jatos", "test", "providers"), { recursive: true }); + await mkdir(join(tmpHome, ".jato", "jatos", "test", "skills"), { recursive: true }); + await mkdir(join(tmpHome, ".jato", "jatos", "test", "agents"), { recursive: true }); await writeFile( join(tmpHome, ".jato", "config.yaml"), stringifyYaml({ active_jato: "test" }), ); await writeFile( - join(tmpHome, ".jato", "rigs", "test", "jato.yaml"), + join(tmpHome, ".jato", "jatos", "test", "jato.yaml"), stringifyYaml({ name: "test", providers: { claude: true }, diff --git a/tests/cli/init.test.ts b/tests/cli/init.test.ts index 91c0892..7259755 100644 --- a/tests/cli/init.test.ts +++ b/tests/cli/init.test.ts @@ -25,12 +25,12 @@ function runCli(args: string): string { } describe("jato init --empty", () => { - it("creates an empty rig", () => { + it("creates an empty jato", () => { const output = runCli("init --empty --name test-rig --yes"); expect(output).toContain("Created empty jato"); - expect(existsSync(join(tmpHome, ".jato", "rigs", "test-rig", "jato.yaml"))).toBe(true); - expect(existsSync(join(tmpHome, ".jato", "rigs", "test-rig", "instructions.md"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos", "test-rig", "jato.yaml"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos", "test-rig", "instructions.md"))).toBe(true); expect(existsSync(join(tmpHome, ".jato", "skills", "jato-manager.md"))).toBe(true); }); }); @@ -40,17 +40,17 @@ describe("jato init --template", () => { const output = runCli("init --template starter --name my-starter --yes"); expect(output).toContain("Created jato from template"); - expect(existsSync(join(tmpHome, ".jato", "rigs", "my-starter", "jato.yaml"))).toBe(true); - expect(existsSync(join(tmpHome, ".jato", "rigs", "my-starter", "instructions.md"))).toBe(true); - expect(existsSync(join(tmpHome, ".jato", "rigs", "my-starter", "providers", "claude.md"))).toBe(true); - expect(existsSync(join(tmpHome, ".jato", "rigs", "my-starter", "skills", "code-review.md"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos", "my-starter", "jato.yaml"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos", "my-starter", "instructions.md"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos", "my-starter", "providers", "claude.md"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos", "my-starter", "skills", "code-review.md"))).toBe(true); }); - it("updates rig name in manifest", async () => { + it("updates jato name in manifest", async () => { runCli("init --template starter --name custom-name --yes"); const { parse: parseYaml } = await import("yaml"); - const raw = await readFile(join(tmpHome, ".jato", "rigs", "custom-name", "jato.yaml"), "utf8"); + const raw = await readFile(join(tmpHome, ".jato", "jatos", "custom-name", "jato.yaml"), "utf8"); const manifest = parseYaml(raw); expect(manifest.name).toBe("custom-name"); }); @@ -77,6 +77,6 @@ describe("jato init --from", () => { const output = runCli("init --from claude --name imported --yes"); expect(output).toContain("Imported"); - expect(existsSync(join(tmpHome, ".jato", "rigs", "imported", "jato.yaml"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos", "imported", "jato.yaml"))).toBe(true); }); }); diff --git a/tests/cli/list.test.ts b/tests/cli/list.test.ts index 21a1820..161bdef 100644 --- a/tests/cli/list.test.ts +++ b/tests/cli/list.test.ts @@ -24,8 +24,8 @@ function runCli(args: string): string { }); } -async function createRig(name: string, description: string) { - const jatoDir = join(tmpHome, ".jato", "rigs", name); +async function createJato(name: string, description: string) { + const jatoDir = join(tmpHome, ".jato", "jatos", name); await mkdir(jatoDir, { recursive: true }); await writeFile( join(jatoDir, "jato.yaml"), @@ -34,14 +34,14 @@ async function createRig(name: string, description: string) { } describe("jato list", () => { - it("shows no rigs message", () => { + it("shows no jatos message", () => { const output = runCli("list"); expect(output).toContain("No jatos found"); }); - it("lists available rigs", async () => { - await createRig("mobile", "Mobile dev"); - await createRig("backend", "Backend dev"); + it("lists available jatos", async () => { + await createJato("mobile", "Mobile dev"); + await createJato("backend", "Backend dev"); const output = runCli("list"); expect(output).toContain("mobile"); diff --git a/tests/cli/use.test.ts b/tests/cli/use.test.ts index 4468ed1..bc7ea24 100644 --- a/tests/cli/use.test.ts +++ b/tests/cli/use.test.ts @@ -30,7 +30,7 @@ function runCli(args: string): string { } async function createRig(name: string) { - const jatoDir = join(tmpHome, ".jato", "rigs", name); + const jatoDir = join(tmpHome, ".jato", "jatos", name); await mkdir(join(jatoDir, "providers"), { recursive: true }); await mkdir(join(jatoDir, "skills"), { recursive: true }); await mkdir(join(jatoDir, "agents"), { recursive: true }); @@ -47,7 +47,7 @@ async function createRig(name: string) { } describe("jato use", () => { - it("shows no active rig when none set", () => { + it("shows no active jato when none set", () => { const output = runCli("use"); expect(output).toContain("No jato is currently active"); }); @@ -64,7 +64,7 @@ describe("jato use", () => { expect(existsSync(join(tmpHome, ".claude", "skills", "jato-context", "SKILL.md"))).toBe(true); }); - it("shows active rig after activation", async () => { + it("shows active jato after activation", async () => { await createRig("myrig"); runCli("use myrig"); diff --git a/tests/core/hub.test.ts b/tests/core/hub.test.ts index 62cb479..c4850db 100644 --- a/tests/core/hub.test.ts +++ b/tests/core/hub.test.ts @@ -29,16 +29,16 @@ describe("path helpers", () => { expect(getHubDir("/fake")).toBe("/fake/.jato"); }); - it("returns correct rigs dir", () => { - expect(getJatosDir("/fake")).toBe("/fake/.jato/rigs"); + it("returns correct jatos dir", () => { + expect(getJatosDir("/fake")).toBe("/fake/.jato/jatos"); }); it("returns correct skills dir", () => { expect(getSkillsDir("/fake")).toBe("/fake/.jato/skills"); }); - it("returns correct rig dir for a named rig", () => { - expect(getJatoDir("mobile", "/fake")).toBe("/fake/.jato/rigs/mobile"); + it("returns correct jato dir for a named jato", () => { + expect(getJatoDir("mobile", "/fake")).toBe("/fake/.jato/jatos/mobile"); }); }); @@ -47,7 +47,7 @@ describe("ensureHub", () => { await ensureHub(tmpHome); const { existsSync } = await import("node:fs"); expect(existsSync(join(tmpHome, ".jato"))).toBe(true); - expect(existsSync(join(tmpHome, ".jato", "rigs"))).toBe(true); + expect(existsSync(join(tmpHome, ".jato", "jatos"))).toBe(true); expect(existsSync(join(tmpHome, ".jato", "skills"))).toBe(true); }); @@ -69,32 +69,32 @@ describe("global config", () => { expect(config.active_jato).toBe("mobile"); }); - it("reads active rig", async () => { + it("reads active jato", async () => { await writeGlobalConfig({ active_jato: "backend" }, tmpHome); const active = await getActiveJato(tmpHome); expect(active).toBe("backend"); }); - it("returns undefined when no active rig", async () => { + it("returns undefined when no active jato", async () => { const active = await getActiveJato(tmpHome); expect(active).toBeUndefined(); }); }); describe("listJatos", () => { - it("returns empty array when no rigs", async () => { - const rigs = await listJatos(tmpHome); - expect(rigs).toEqual([]); + it("returns empty array when no jatos", async () => { + const jatos = await listJatos(tmpHome); + expect(jatos).toEqual([]); }); - it("lists rig directories", async () => { + it("lists jato directories", async () => { await ensureHub(tmpHome); - await mkdir(join(tmpHome, ".jato", "rigs", "mobile"), { recursive: true }); - await mkdir(join(tmpHome, ".jato", "rigs", "backend"), { recursive: true }); + await mkdir(join(tmpHome, ".jato", "jatos", "mobile"), { recursive: true }); + await mkdir(join(tmpHome, ".jato", "jatos", "backend"), { recursive: true }); // Create a file to ensure it's filtered out - await writeFile(join(tmpHome, ".jato", "rigs", ".DS_Store"), ""); + await writeFile(join(tmpHome, ".jato", "jatos", ".DS_Store"), ""); - const rigs = await listJatos(tmpHome); - expect(rigs.sort()).toEqual(["backend", "mobile"]); + const jatos = await listJatos(tmpHome); + expect(jatos.sort()).toEqual(["backend", "mobile"]); }); }); diff --git a/tests/core/jato.test.ts b/tests/core/jato.test.ts index 6a328de..3ac52bb 100644 --- a/tests/core/jato.test.ts +++ b/tests/core/jato.test.ts @@ -21,7 +21,7 @@ async function createRig(name: string, manifest: Record, extras skills?: Record; agents?: Record; }) { - const jatoDir = join(tmpHome, ".jato", "rigs", name); + const jatoDir = join(tmpHome, ".jato", "jatos", name); await mkdir(join(jatoDir, "providers"), { recursive: true }); await mkdir(join(jatoDir, "skills"), { recursive: true }); await mkdir(join(jatoDir, "agents"), { recursive: true }); @@ -48,18 +48,18 @@ async function createRig(name: string, manifest: Record, extras } describe("loadJato", () => { - it("loads a minimal rig", async () => { + it("loads a minimal jato", async () => { await createRig("test", { name: "test" }); - const rig = await loadJato("test", tmpHome); + const jato = await loadJato("test", tmpHome); - expect(rig.manifest.name).toBe("test"); - expect(rig.instructions).toBeUndefined(); - expect(rig.providerDocs).toEqual({}); - expect(rig.skills).toEqual([]); - expect(rig.agents).toEqual([]); + expect(jato.manifest.name).toBe("test"); + expect(jato.instructions).toBeUndefined(); + expect(jato.providerDocs).toEqual({}); + expect(jato.skills).toEqual([]); + expect(jato.agents).toEqual([]); }); - it("loads a full rig with all files", async () => { + it("loads a full jato with all files", async () => { await createRig("mobile", { name: "mobile", description: "Mobile dev", @@ -80,28 +80,28 @@ describe("loadJato", () => { }, }); - const rig = await loadJato("mobile", tmpHome); + const jato = await loadJato("mobile", tmpHome); - expect(rig.manifest.name).toBe("mobile"); - expect(rig.manifest.providers).toEqual({ claude: true, codex: true }); - expect(rig.manifest.mcp_servers).toHaveLength(1); - expect(rig.instructions).toContain("Be awesome"); - expect(rig.providerDocs["claude"]).toContain("Use tools"); - expect(rig.providerDocs["codex"]).toContain("Be concise"); - expect(rig.skills).toHaveLength(2); - expect(rig.skills.map((s) => s.name).sort()).toEqual(["code-review", "testing"]); - expect(rig.agents).toHaveLength(1); - expect(rig.agents[0].name).toBe("reviewer"); + expect(jato.manifest.name).toBe("mobile"); + expect(jato.manifest.providers).toEqual({ claude: true, codex: true }); + expect(jato.manifest.mcp_servers).toHaveLength(1); + expect(jato.instructions).toContain("Be awesome"); + expect(jato.providerDocs["claude"]).toContain("Use tools"); + expect(jato.providerDocs["codex"]).toContain("Be concise"); + expect(jato.skills).toHaveLength(2); + expect(jato.skills.map((s) => s.name).sort()).toEqual(["code-review", "testing"]); + expect(jato.agents).toHaveLength(1); + expect(jato.agents[0].name).toBe("reviewer"); }); - it("throws when rig does not exist", async () => { + it("throws when jato does not exist", async () => { await expect(loadJato("nonexistent", tmpHome)).rejects.toThrow( "Jato 'nonexistent' not found" ); }); it("throws on invalid manifest", async () => { - const jatoDir = join(tmpHome, ".jato", "rigs", "bad"); + const jatoDir = join(tmpHome, ".jato", "jatos", "bad"); await mkdir(jatoDir, { recursive: true }); await writeFile(join(jatoDir, "jato.yaml"), stringifyYaml({ description: "no name" })); diff --git a/tests/core/materializer.test.ts b/tests/core/materializer.test.ts index d9d9e90..e9e9d7f 100644 --- a/tests/core/materializer.test.ts +++ b/tests/core/materializer.test.ts @@ -24,7 +24,7 @@ async function createRig(name: string, manifest: Record, extras providerDocs?: Record; skills?: Record; }) { - const jatoDir = join(tmpHome, ".jato", "rigs", name); + const jatoDir = join(tmpHome, ".jato", "jatos", name); await mkdir(join(jatoDir, "providers"), { recursive: true }); await mkdir(join(jatoDir, "skills"), { recursive: true }); await mkdir(join(jatoDir, "agents"), { recursive: true }); @@ -84,10 +84,10 @@ describe("materialize", () => { const managerSkill = join(tmpHome, ".claude", "skills", "jato-manager", "SKILL.md"); expect(existsSync(managerSkill)).toBe(true); const managerContent = await readFile(managerSkill, "utf8"); - expect(managerContent).toContain("jato — Manager Skill"); + expect(managerContent).toContain("name: jato-manager"); }); - it("updates global config with active rig", async () => { + it("updates global config with active jato", async () => { await createRig("myrig", { name: "myrig", providers: { claude: true }, @@ -115,7 +115,7 @@ describe("materialize", () => { expect(existsSync(geminiSettings)).toBe(false); }); - it("throws for nonexistent rig", async () => { + it("throws for nonexistent jato", async () => { await expect( materialize("nonexistent", { home: tmpHome }) ).rejects.toThrow("Jato 'nonexistent' not found"); diff --git a/tests/integration/full-lifecycle.test.ts b/tests/integration/full-lifecycle.test.ts index d65e9f1..2e1ae81 100644 --- a/tests/integration/full-lifecycle.test.ts +++ b/tests/integration/full-lifecycle.test.ts @@ -34,8 +34,8 @@ describe("full lifecycle: init → use → list → off", () => { const initOutput = runCli("init --template starter --name my-rig --yes"); expect(initOutput).toContain("Created jato from template"); - // Verify rig was created - expect(existsSync(join(tmpHome, ".jato", "rigs", "my-rig", "jato.yaml"))).toBe(true); + // Verify jato was created + expect(existsSync(join(tmpHome, ".jato", "jatos", "my-rig", "jato.yaml"))).toBe(true); expect(existsSync(join(tmpHome, ".jato", "skills", "jato-manager.md"))).toBe(true); // Step 2: Use the jato @@ -56,7 +56,7 @@ describe("full lifecycle: init → use → list → off", () => { expect(contextSkill).toContain("Active Jato: my-rig"); expect(contextSkill).toContain("github"); - // Step 3: List rigs + // Step 3: List jatos const listOutput = runCli("list"); expect(listOutput).toContain("my-rig"); expect(listOutput).toContain("[active]"); @@ -80,9 +80,9 @@ describe("full lifecycle: init → use → list → off", () => { }); }); -describe("multiple rigs", () => { - it("can create and switch between rigs", () => { - // Create two rigs +describe("multiple jatos", () => { + it("can create and switch between jatos", () => { + // Create two jatos runCli("init --template starter --name rig-a --yes"); runCli("init --template backend --name rig-b --yes"); diff --git a/tests/integration/import-and-use.test.ts b/tests/integration/import-and-use.test.ts index 6874167..56505ab 100644 --- a/tests/integration/import-and-use.test.ts +++ b/tests/integration/import-and-use.test.ts @@ -58,7 +58,7 @@ describe("import → use lifecycle", () => { // Verify jato.yaml was created with imported MCPs const jatoYaml = await readFile( - join(tmpHome, ".jato", "rigs", "imported", "jato.yaml"), + join(tmpHome, ".jato", "jatos", "imported", "jato.yaml"), "utf8", ); const manifest = parseYaml(jatoYaml); diff --git a/tests/providers/claude.test.ts b/tests/providers/claude.test.ts index 92131e6..06c9cf6 100644 --- a/tests/providers/claude.test.ts +++ b/tests/providers/claude.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest"; import { claudeProvider } from "../../src/providers/claude.js"; import type { ResolvedJato } from "../../src/core/jato.js"; -function makeRig(overrides?: Partial): ResolvedJato { +function makeJato(overrides?: Partial): ResolvedJato { return { manifest: { name: "test", @@ -10,7 +10,7 @@ function makeRig(overrides?: Partial): ResolvedJato { mcp_servers: [], permissions: { auto_execute: false }, }, - dir: "/fake/.jato/rigs/test", + dir: "/fake/.jato/jatos/test", providerDocs: {}, skills: [], agents: [], @@ -26,7 +26,7 @@ describe("claudeProvider", () => { }); it("materializes basic settings", () => { - const result = claudeProvider.materialize(makeRig(), "/home/user"); + const result = claudeProvider.materialize(makeJato(), "/home/user"); expect(result.files).toHaveLength(1); const settings = JSON.parse(result.files[0].content); @@ -35,7 +35,7 @@ describe("claudeProvider", () => { }); it("materializes MCP servers", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: { claude: true }, @@ -61,7 +61,7 @@ describe("claudeProvider", () => { }, }); - const result = claudeProvider.materialize(rig, "/home/user"); + const result = claudeProvider.materialize(jato, "/home/user"); const settings = JSON.parse(result.files[0].content); expect(settings.mcpServers.github).toBeDefined(); @@ -72,7 +72,7 @@ describe("claudeProvider", () => { }); it("materializes auto_execute permission", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: {}, @@ -81,17 +81,17 @@ describe("claudeProvider", () => { }, }); - const result = claudeProvider.materialize(rig, "/home/user"); + const result = claudeProvider.materialize(jato, "/home/user"); const settings = JSON.parse(result.files[0].content); expect(settings.permissions.mode).toBe("allowedCommands"); }); it("materializes provider docs as CLAUDE.md", () => { - const rig = makeRig({ + const jato = makeJato({ providerDocs: { claude: "# Claude Instructions\nDo things." }, }); - const result = claudeProvider.materialize(rig, "/home/user"); + const result = claudeProvider.materialize(jato, "/home/user"); expect(result.files).toHaveLength(2); expect(result.files[1].path).toBe("CLAUDE.md"); expect(result.files[1].content).toContain("Claude Instructions"); diff --git a/tests/providers/codex.test.ts b/tests/providers/codex.test.ts index bccd991..f37a685 100644 --- a/tests/providers/codex.test.ts +++ b/tests/providers/codex.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest"; import { codexProvider } from "../../src/providers/codex.js"; import type { ResolvedJato } from "../../src/core/jato.js"; -function makeRig(overrides?: Partial): ResolvedJato { +function makeJato(overrides?: Partial): ResolvedJato { return { manifest: { name: "test", @@ -10,7 +10,7 @@ function makeRig(overrides?: Partial): ResolvedJato { mcp_servers: [], permissions: { auto_execute: false }, }, - dir: "/fake/.jato/rigs/test", + dir: "/fake/.jato/jatos/test", providerDocs: {}, skills: [], agents: [], @@ -26,13 +26,13 @@ describe("codexProvider", () => { }); it("materializes basic TOML config", () => { - const result = codexProvider.materialize(makeRig(), "/home/user"); + const result = codexProvider.materialize(makeJato(), "/home/user"); expect(result.files).toHaveLength(1); expect(result.files[0].content).toContain('approval_policy = "on-request"'); }); it("materializes MCP servers in TOML format", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: { codex: true }, @@ -50,7 +50,7 @@ describe("codexProvider", () => { }, }); - const result = codexProvider.materialize(rig, "/home/user"); + const result = codexProvider.materialize(jato, "/home/user"); const content = result.files[0].content; expect(content).toContain("[mcp_servers.github]"); expect(content).toContain('type = "stdio"'); @@ -60,7 +60,7 @@ describe("codexProvider", () => { }); it("materializes http transport servers", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: { codex: true }, @@ -78,14 +78,14 @@ describe("codexProvider", () => { }, }); - const result = codexProvider.materialize(rig, "/home/user"); + const result = codexProvider.materialize(jato, "/home/user"); const content = result.files[0].content; expect(content).toContain('type = "http"'); expect(content).toContain('url = "https://example.com/mcp"'); }); it("materializes auto-edit permission", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: {}, @@ -94,16 +94,16 @@ describe("codexProvider", () => { }, }); - const result = codexProvider.materialize(rig, "/home/user"); + const result = codexProvider.materialize(jato, "/home/user"); expect(result.files[0].content).toContain('approval_policy = "auto-edit"'); }); it("materializes provider docs as AGENTS.md", () => { - const rig = makeRig({ + const jato = makeJato({ providerDocs: { codex: "# Codex Instructions" }, }); - const result = codexProvider.materialize(rig, "/home/user"); + const result = codexProvider.materialize(jato, "/home/user"); expect(result.files).toHaveLength(2); expect(result.files[1].path).toBe("AGENTS.md"); }); diff --git a/tests/providers/gemini.test.ts b/tests/providers/gemini.test.ts index eb93625..18757f4 100644 --- a/tests/providers/gemini.test.ts +++ b/tests/providers/gemini.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest"; import { geminiProvider } from "../../src/providers/gemini.js"; import type { ResolvedJato } from "../../src/core/jato.js"; -function makeRig(overrides?: Partial): ResolvedJato { +function makeJato(overrides?: Partial): ResolvedJato { return { manifest: { name: "test", @@ -10,7 +10,7 @@ function makeRig(overrides?: Partial): ResolvedJato { mcp_servers: [], permissions: { auto_execute: false }, }, - dir: "/fake/.jato/rigs/test", + dir: "/fake/.jato/jatos/test", providerDocs: {}, skills: [], agents: [], @@ -20,13 +20,13 @@ function makeRig(overrides?: Partial): ResolvedJato { describe("geminiProvider", () => { it("materializes settings with approvalMode", () => { - const result = geminiProvider.materialize(makeRig(), "/home/user"); + const result = geminiProvider.materialize(makeJato(), "/home/user"); const settings = JSON.parse(result.files[0].content); expect(settings.approvalMode).toBe("default"); }); it("sets yolo mode for auto_execute", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: {}, @@ -35,13 +35,13 @@ describe("geminiProvider", () => { }, }); - const result = geminiProvider.materialize(rig, "/home/user"); + const result = geminiProvider.materialize(jato, "/home/user"); const settings = JSON.parse(result.files[0].content); expect(settings.approvalMode).toBe("yolo"); }); it("materializes MCPs with trust flag", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: {}, @@ -59,18 +59,18 @@ describe("geminiProvider", () => { }, }); - const result = geminiProvider.materialize(rig, "/home/user"); + const result = geminiProvider.materialize(jato, "/home/user"); const settings = JSON.parse(result.files[0].content); expect(settings.mcpServers.github.trust).toBe(true); expect(settings.mcpServers.github.env).toEqual({ GITHUB_TOKEN: "" }); }); it("materializes GEMINI.md", () => { - const rig = makeRig({ + const jato = makeJato({ providerDocs: { gemini: "# Gemini" }, }); - const result = geminiProvider.materialize(rig, "/home/user"); + const result = geminiProvider.materialize(jato, "/home/user"); expect(result.files).toHaveLength(2); expect(result.files[1].path).toBe("GEMINI.md"); }); diff --git a/tests/providers/opencode.test.ts b/tests/providers/opencode.test.ts index 4a60b24..3d489cb 100644 --- a/tests/providers/opencode.test.ts +++ b/tests/providers/opencode.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest"; import { opencodeProvider } from "../../src/providers/opencode.js"; import type { ResolvedJato } from "../../src/core/jato.js"; -function makeRig(overrides?: Partial): ResolvedJato { +function makeJato(overrides?: Partial): ResolvedJato { return { manifest: { name: "test", @@ -10,7 +10,7 @@ function makeRig(overrides?: Partial): ResolvedJato { mcp_servers: [], permissions: { auto_execute: false }, }, - dir: "/fake/.jato/rigs/test", + dir: "/fake/.jato/jatos/test", providerDocs: {}, skills: [], agents: [], @@ -26,13 +26,13 @@ describe("opencodeProvider", () => { }); it("materializes config with interactive mode", () => { - const result = opencodeProvider.materialize(makeRig(), "/home/user"); + const result = opencodeProvider.materialize(makeJato(), "/home/user"); const config = JSON.parse(result.files[0].content); expect(config.mode).toBe("interactive"); }); it("sets auto mode for auto_execute", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: {}, @@ -41,13 +41,13 @@ describe("opencodeProvider", () => { }, }); - const result = opencodeProvider.materialize(rig, "/home/user"); + const result = opencodeProvider.materialize(jato, "/home/user"); const config = JSON.parse(result.files[0].content); expect(config.mode).toBe("auto"); }); it("materializes MCP servers", () => { - const rig = makeRig({ + const jato = makeJato({ manifest: { name: "test", providers: {}, @@ -65,15 +65,15 @@ describe("opencodeProvider", () => { }, }); - const result = opencodeProvider.materialize(rig, "/home/user"); + const result = opencodeProvider.materialize(jato, "/home/user"); const config = JSON.parse(result.files[0].content); expect(config.mcp.github).toBeDefined(); expect(config.mcp.github.command).toBe("npx"); }); it("does not emit provider docs (no instructionsFileName)", () => { - const rig = makeRig(); - const result = opencodeProvider.materialize(rig, "/home/user"); + const jato = makeJato(); + const result = opencodeProvider.materialize(jato, "/home/user"); expect(result.files).toHaveLength(1); }); }); diff --git a/tests/skills/jato-context.test.ts b/tests/skills/jato-context.test.ts index 6646c13..4167152 100644 --- a/tests/skills/jato-context.test.ts +++ b/tests/skills/jato-context.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest"; import { generateJatoContextSkill } from "../../src/skills/jato-context.js"; import type { ResolvedJato } from "../../src/core/jato.js"; -function makeRig(overrides?: Partial): ResolvedJato { +function makeJato(overrides?: Partial): ResolvedJato { return { manifest: { name: "test", @@ -10,7 +10,7 @@ function makeRig(overrides?: Partial): ResolvedJato { mcp_servers: [], permissions: { auto_execute: false }, }, - dir: "/home/user/.jato/rigs/test", + dir: "/home/user/.jato/jatos/test", providerDocs: {}, skills: [], agents: [], @@ -19,8 +19,11 @@ function makeRig(overrides?: Partial): ResolvedJato { } describe("generateJatoContextSkill", () => { - it("generates minimal context", () => { - const content = generateJatoContextSkill(makeRig()); + it("generates minimal context with YAML frontmatter", () => { + const content = generateJatoContextSkill(makeJato()); + expect(content).toMatch(/^---\n/); + expect(content).toContain("name: jato-context"); + expect(content).toContain("description:"); expect(content).toContain("# jato — Active Context"); expect(content).toContain("## Active Jato: test"); expect(content).not.toContain("## Available Skills"); @@ -28,7 +31,7 @@ describe("generateJatoContextSkill", () => { it("includes description", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ manifest: { name: "mobile", description: "React Native dev", @@ -43,10 +46,10 @@ describe("generateJatoContextSkill", () => { it("lists skills", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ skills: [ - { name: "code-review", path: "/home/.jato/rigs/test/skills/code-review.md" }, - { name: "testing", path: "/home/.jato/rigs/test/skills/testing.md" }, + { name: "code-review", path: "/home/.jato/jatos/test/skills/code-review.md" }, + { name: "testing", path: "/home/.jato/jatos/test/skills/testing.md" }, ], }) ); @@ -57,7 +60,7 @@ describe("generateJatoContextSkill", () => { it("lists MCP servers", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ manifest: { name: "test", providers: {}, @@ -82,7 +85,7 @@ describe("generateJatoContextSkill", () => { it("skips disabled MCP servers", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ manifest: { name: "test", providers: {}, @@ -105,7 +108,7 @@ describe("generateJatoContextSkill", () => { it("includes instructions", () => { const content = generateJatoContextSkill( - makeRig({ instructions: "Always use TypeScript." }) + makeJato({ instructions: "Always use TypeScript." }) ); expect(content).toContain("## Global Instructions"); expect(content).toContain("Always use TypeScript."); @@ -113,17 +116,31 @@ describe("generateJatoContextSkill", () => { it("lists agents", () => { const content = generateJatoContextSkill( - makeRig({ - agents: [{ name: "reviewer", path: "/home/.jato/rigs/test/agents/reviewer.md" }], + makeJato({ + agents: [{ name: "reviewer", path: "/home/.jato/jatos/test/agents/reviewer.md" }], }) ); expect(content).toContain("## Agents"); expect(content).toContain("reviewer"); }); - it("stays under 4KB for reasonable rigs", () => { + it("includes jato name in frontmatter description", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ + manifest: { + name: "mobile-app", + providers: {}, + mcp_servers: [], + permissions: { auto_execute: false }, + }, + }) + ); + expect(content).toContain("'mobile-app'"); + }); + + it("stays under 4KB for reasonable jatos", () => { + const content = generateJatoContextSkill( + makeJato({ manifest: { name: "mobile", description: "Mobile dev setup", diff --git a/tests/skills/jato-manager.test.ts b/tests/skills/jato-manager.test.ts index 063428f..5762cee 100644 --- a/tests/skills/jato-manager.test.ts +++ b/tests/skills/jato-manager.test.ts @@ -12,20 +12,44 @@ describe("jato-manager.md", () => { expect(content.length).toBeGreaterThan(1000); }); - it("contains CLI operations section", async () => { + it("has valid YAML frontmatter", async () => { const content = await readFile(skillPath, "utf8"); - expect(content).toContain("## CLI Operations"); + expect(content).toMatch(/^---\n/); + expect(content).toContain("name: jato-manager"); + expect(content).toContain("description:"); + // Description should include trigger phrases + expect(content).toMatch(/Use when/i); + }); + + it("contains prerequisites and install instructions", async () => { + const content = await readFile(skillPath, "utf8"); + expect(content).toContain("## Prerequisites"); + expect(content).toContain("npx @malopezr7/jato"); + }); + + it("contains CLI commands section", async () => { + const content = await readFile(skillPath, "utf8"); + expect(content).toContain("## CLI Commands"); expect(content).toContain("jato list"); expect(content).toContain("jato use"); expect(content).toContain("jato off"); expect(content).toContain("jato doctor"); }); - it("contains rig creation wizard", async () => { + it("contains jato creation guide with CLI and manual options", async () => { const content = await readFile(skillPath, "utf8"); expect(content).toContain("## Creating a New Jato"); + expect(content).toContain("Via CLI"); + expect(content).toContain("Via guided manual creation"); expect(content).toContain("Step 1"); - expect(content).toContain("Step 7"); + }); + + it("contains skill recommendations", async () => { + const content = await readFile(skillPath, "utf8"); + expect(content).toContain("## Skill Recommendations"); + expect(content).toContain("Mobile"); + expect(content).toContain("Backend"); + expect(content).toContain("Frontend"); }); it("contains modification section", async () => { @@ -35,15 +59,22 @@ describe("jato-manager.md", () => { it("contains MCP server catalog", async () => { const content = await readFile(skillPath, "utf8"); - expect(content).toContain("## Common MCP Server References"); + expect(content).toContain("## Common MCP Servers"); expect(content).toContain("github"); expect(content).toContain("postgres"); expect(content).toContain("supabase"); }); - it("is between 2KB and 6KB", async () => { + it("contains troubleshooting section", async () => { + const content = await readFile(skillPath, "utf8"); + expect(content).toContain("## Troubleshooting"); + expect(content).toContain("Cause:"); + expect(content).toContain("Fix:"); + }); + + it("is between 2KB and 10KB", async () => { const content = await readFile(skillPath, "utf8"); expect(content.length).toBeGreaterThan(2048); - expect(content.length).toBeLessThan(6144); + expect(content.length).toBeLessThan(10240); }); });