From 81eaa9e02117e4ce0ec706cee160c2172335ba02 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Mar 2026 10:13:24 +0000 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20rename=20rigs=E2=86=92jatos=20direct?= =?UTF-8?q?ory=20and=20add=20installation=20guide=20to=20skill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Hub directory changed from ~/.jato/rigs/ to ~/.jato/jatos/ to match user-facing terminology (fixes skill creating files CLI couldn't find) - jato-manager.md skill now includes installation instructions and explicitly forbids manual file creation — always use CLI first - All "rig" references in CLI messages, comments, variable names, and test descriptions updated to "jato" for consistency - Repo install command now looks for jatos/ subdirectory in repos - Size limit for skill test bumped to 8KB to accommodate install docs --- src/cli/commands/doctor.ts | 14 +- src/cli/commands/install.ts | 6 +- src/cli/commands/list.ts | 14 +- src/cli/commands/off.ts | 4 +- src/core/hub.ts | 4 +- src/core/materializer.ts | 8 +- src/providers/claude.ts | 10 +- src/providers/codex.ts | 14 +- src/providers/gemini.ts | 10 +- src/providers/opencode.ts | 6 +- src/providers/types.ts | 2 +- src/skills/jato-context.ts | 24 ++-- src/skills/jato-manager.md | 166 +++++++++++++---------- tests/cli/doctor.test.ts | 10 +- tests/cli/init.test.ts | 20 +-- tests/cli/list.test.ts | 12 +- tests/cli/use.test.ts | 6 +- tests/core/hub.test.ts | 32 ++--- tests/core/jato.test.ts | 44 +++--- tests/core/materializer.test.ts | 6 +- tests/integration/full-lifecycle.test.ts | 12 +- tests/integration/import-and-use.test.ts | 2 +- tests/providers/claude.test.ts | 18 +-- tests/providers/codex.test.ts | 22 +-- tests/providers/gemini.test.ts | 18 +-- tests/providers/opencode.test.ts | 18 +-- tests/skills/jato-context.test.ts | 28 ++-- tests/skills/jato-manager.test.ts | 18 ++- 28 files changed, 293 insertions(+), 255 deletions(-) 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..a144e0d 100644 --- a/src/skills/jato-context.ts +++ b/src/skills/jato-context.ts @@ -1,6 +1,6 @@ import type { ResolvedJato } from "../core/jato.js"; -export function generateJatoContextSkill(rig: ResolvedJato): string { +export function generateJatoContextSkill(jato: ResolvedJato): string { const lines: string[] = []; lines.push("# jato — Active Context"); @@ -8,29 +8,29 @@ export function generateJatoContextSkill(rig: ResolvedJato): string { 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 +39,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..18f2dd3 100644 --- a/src/skills/jato-manager.md +++ b/src/skills/jato-manager.md @@ -2,16 +2,55 @@ 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. +## IMPORTANT: Before Doing Anything + +Before creating or modifying any jato, you MUST verify that the jato CLI is installed and working. **Never create jato files manually** — always use the CLI. + +### Check if jato is installed + +Run this command first: + +```bash +npx @malopezr7/jato list +``` + +If the command fails or is not found, install it: + +```bash +npx @malopezr7/jato init +``` + +This will install the CLI and run the interactive setup. If the user wants a non-interactive setup: + +```bash +npx @malopezr7/jato init --from auto --name +``` + +### Installation options + +| Method | Command | +|--------|---------| +| Interactive setup | `npx @malopezr7/jato init` | +| Import existing config | `npx @malopezr7/jato init --from auto --name myproject` | +| From template | `npx @malopezr7/jato init --template mobile --name myproject` | +| Empty jato | `npx @malopezr7/jato init --empty --name myproject` | +| Install skill only | `npx @malopezr7/jato skill install` | +| Install from git repo | `npx @malopezr7/jato install ` | + +You can also use `pnpm dlx @malopezr7/jato` instead of `npx`. + ## CLI Operations -You can manage jatos by running these commands: +Manage jatos by running these commands (all prefixed with `npx @malopezr7/jato`): - `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 init` — Create a new jato (interactive or with flags) - `jato install ` — Install jatos from a git repository +- `jato skill install` — Install the jato-manager skill to detected providers Always run `jato use ` after modifying a jato's files to re-materialize. @@ -40,26 +79,68 @@ All jatos live in `~/.jato/`: ## Creating a New Jato -When the user wants to create a new jato, guide them through this process: +**Always use the CLI to create jatos.** Do not create the directory structure manually. + +### Option A: Interactive (recommended for first-time) + +```bash +npx @malopezr7/jato init +``` + +This will: +1. Scan for installed AI tools (Claude Code, Codex, etc.) +2. Ask how to start (import existing, template, or empty) +3. Import MCPs and instructions from detected tools +4. Create the jato and install the manager skill + +### Option B: Import existing config (non-interactive) + +```bash +npx @malopezr7/jato init --from auto --name myproject +``` + +This auto-detects all installed providers and imports their MCPs and instructions. + +### Option C: From template + +```bash +npx @malopezr7/jato init --template mobile --name myproject +``` + +Available templates: `starter`, `backend`, `fullstack`, `mobile`. + +### After creating a jato + +1. Edit the generated files in `~/.jato/jatos//` to customize: + - `jato.yaml` — Add/remove MCPs, toggle providers + - `instructions.md` — Add global conventions + - `providers/*.md` — Add provider-specific instructions + - `skills/*.md` — Add specialized context (testing patterns, architecture, etc.) +2. Run `jato use ` to activate and materialize the configs + +## Modifying an Existing Jato -### 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...) +When the user wants to modify their active jato: -### Step 2: Build the manifest -Based on their answers, create the jato directory structure: +- **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 ` -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 +Always remind the user to run `jato use ` after changes to re-materialize. + +## Inspecting a Jato + +When the user asks about their current jato or wants to see what's configured: + +1. Run `jato use` (no args) to see the active jato +2. Run `jato list` to see all jatos +3. Run `jato doctor` to check health +4. Read `~/.jato/jatos//jato.yaml` for the manifest +5. List files in `skills/`, `agents/`, `providers/` to show what's available + +## Example `jato.yaml` -Example `jato.yaml`: ```yaml name: mobile description: React Native mobile development setup @@ -84,57 +165,6 @@ 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. - -## Modifying an Existing Jato - -When the user wants to modify their active jato: - -- **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 ` - -Always remind the user to run `jato use ` after changes to re-materialize. - -## Inspecting a Jato - -When the user asks about their current jato or wants to see what's configured: - -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 - ## Common MCP Server References When suggesting MCPs, use these known configurations: 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..5e4ec82 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 }); @@ -87,7 +87,7 @@ describe("materialize", () => { expect(managerContent).toContain("jato — Manager Skill"); }); - 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..79851dc 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: [], @@ -20,7 +20,7 @@ function makeRig(overrides?: Partial): ResolvedJato { describe("generateJatoContextSkill", () => { it("generates minimal context", () => { - const content = generateJatoContextSkill(makeRig()); + const content = generateJatoContextSkill(makeJato()); expect(content).toContain("# jato — Active Context"); expect(content).toContain("## Active Jato: test"); expect(content).not.toContain("## Available Skills"); @@ -28,7 +28,7 @@ describe("generateJatoContextSkill", () => { it("includes description", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ manifest: { name: "mobile", description: "React Native dev", @@ -43,10 +43,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 +57,7 @@ describe("generateJatoContextSkill", () => { it("lists MCP servers", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ manifest: { name: "test", providers: {}, @@ -82,7 +82,7 @@ describe("generateJatoContextSkill", () => { it("skips disabled MCP servers", () => { const content = generateJatoContextSkill( - makeRig({ + makeJato({ manifest: { name: "test", providers: {}, @@ -105,7 +105,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 +113,17 @@ 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("stays under 4KB for reasonable jatos", () => { const content = generateJatoContextSkill( - makeRig({ + 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..a1eb2b9 100644 --- a/tests/skills/jato-manager.test.ts +++ b/tests/skills/jato-manager.test.ts @@ -12,6 +12,13 @@ describe("jato-manager.md", () => { expect(content.length).toBeGreaterThan(1000); }); + it("contains installation instructions", async () => { + const content = await readFile(skillPath, "utf8"); + expect(content).toContain("## IMPORTANT: Before Doing Anything"); + expect(content).toContain("npx @malopezr7/jato"); + expect(content).toContain("Never create jato files manually"); + }); + it("contains CLI operations section", async () => { const content = await readFile(skillPath, "utf8"); expect(content).toContain("## CLI Operations"); @@ -21,11 +28,12 @@ describe("jato-manager.md", () => { expect(content).toContain("jato doctor"); }); - it("contains rig creation wizard", async () => { + it("contains jato creation guide", async () => { const content = await readFile(skillPath, "utf8"); expect(content).toContain("## Creating a New Jato"); - expect(content).toContain("Step 1"); - expect(content).toContain("Step 7"); + expect(content).toContain("Option A"); + expect(content).toContain("Option B"); + expect(content).toContain("Option C"); }); it("contains modification section", async () => { @@ -41,9 +49,9 @@ describe("jato-manager.md", () => { expect(content).toContain("supabase"); }); - it("is between 2KB and 6KB", async () => { + it("is between 2KB and 8KB", async () => { const content = await readFile(skillPath, "utf8"); expect(content.length).toBeGreaterThan(2048); - expect(content.length).toBeLessThan(6144); + expect(content.length).toBeLessThan(8192); }); }); From bca522677b4b53c52533fafbda2113cb2870f600 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Mar 2026 10:18:57 +0000 Subject: [PATCH 2/3] fix: restore guided manual creation flow and add skill recommendations - Skill now supports both CLI and manual jato creation (both valid) - Restored step-by-step guided wizard for manual creation - Added "Recommended Skills by Stack" section with specific suggestions for Mobile, Backend, Frontend, Full-stack, and DevOps projects - Added "What makes a good skill" guidelines - Removed overly restrictive "never create manually" constraint --- src/skills/jato-manager.md | 136 ++++++++++++++++++------------ tests/skills/jato-manager.test.ts | 21 +++-- 2 files changed, 95 insertions(+), 62 deletions(-) diff --git a/src/skills/jato-manager.md b/src/skills/jato-manager.md index 18f2dd3..eedc23c 100644 --- a/src/skills/jato-manager.md +++ b/src/skills/jato-manager.md @@ -2,31 +2,17 @@ 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. -## IMPORTANT: Before Doing Anything +## Prerequisites -Before creating or modifying any jato, you MUST verify that the jato CLI is installed and working. **Never create jato files manually** — always use the CLI. - -### Check if jato is installed - -Run this command first: +Before creating or modifying any jato, ensure the jato CLI is available. Run: ```bash npx @malopezr7/jato list ``` -If the command fails or is not found, install it: - -```bash -npx @malopezr7/jato init -``` - -This will install the CLI and run the interactive setup. If the user wants a non-interactive setup: +If the command fails, the CLI will be installed automatically via npx. You can also use `pnpm dlx @malopezr7/jato` instead. -```bash -npx @malopezr7/jato init --from auto --name -``` - -### Installation options +### Quick install options | Method | Command | |--------|---------| @@ -37,12 +23,8 @@ npx @malopezr7/jato init --from auto --name | Install skill only | `npx @malopezr7/jato skill install` | | Install from git repo | `npx @malopezr7/jato install ` | -You can also use `pnpm dlx @malopezr7/jato` instead of `npx`. - ## CLI Operations -Manage jatos by running these commands (all prefixed with `npx @malopezr7/jato`): - - `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 @@ -62,61 +44,105 @@ All jatos live in `~/.jato/`: ~/.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 -**Always use the CLI to create jatos.** Do not create the directory structure manually. +You can create jatos using the CLI **or** by building the file structure manually. Both approaches are valid — the CLI is faster for importing existing configs, while manual creation lets you guide the user step-by-step through each decision. -### Option A: Interactive (recommended for first-time) +### Option A: Using the CLI ```bash -npx @malopezr7/jato init +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 ``` -This will: -1. Scan for installed AI tools (Claude Code, Codex, etc.) -2. Ask how to start (import existing, template, or empty) -3. Import MCPs and instructions from detected tools -4. Create the jato and install the manager skill +### Option B: Guided manual creation -### Option B: Import existing config (non-interactive) +When creating a jato manually, guide the user through these steps: -```bash -npx @malopezr7/jato init --from auto --name myproject -``` +#### 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...) -This auto-detects all installed providers and imports their MCPs and instructions. +#### Step 2: Build the manifest +Create the directory structure at `~/.jato/jatos//`: -### Option C: From template +1. Create directories: `providers/`, `skills/`, `agents/` +2. Write `jato.yaml` (see example below) +3. Write `instructions.md` with shared conventions -```bash -npx @malopezr7/jato init --template mobile --name myproject -``` +#### Step 3: 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 4: Generate skills +Create relevant skill files in `skills/`. Ask the user what areas they'd like covered, and recommend based on their stack (see Recommended Skills section below). + +#### Step 5: Generate agents (if requested) +Create agent definitions in `agents/` for specialized roles. + +#### Step 6: Activate +Run `jato use ` to materialize all configs into the provider tools. + +## Recommended Skills by Stack + +When creating skills, ask the user which areas they want covered and recommend based on their stack: + +### Mobile (React Native, Flutter, Swift, Kotlin) +- **testing.md** — Component testing patterns, renderHook usage, mock patterns for navigation/storage/native modules +- **viewmodel-architecture.md** — ViewModel patterns, state management, separation of UI/logic +- **native-bridge.md** — Native module integration, platform-specific code patterns +- **code-review.md** — Checklist: performance (FlatList, memoization), accessibility, platform parity + +### Backend (Node.js, Python, Go, Java) +- **api-patterns.md** — REST/GraphQL conventions, error handling, response formats, pagination +- **database.md** — Query patterns, migrations, ORM usage, connection pooling +- **testing.md** — Unit/integration test patterns, mocking external services, fixtures +- **code-review.md** — Checklist: security (input validation, auth), performance, error handling + +### Frontend (React, Vue, Angular) +- **component-patterns.md** — Component architecture, composition, state management +- **testing.md** — Component testing, user-event patterns, MSW for API mocking +- **accessibility.md** — ARIA patterns, keyboard navigation, screen reader considerations +- **styling.md** — CSS conventions, responsive patterns, design system integration -Available templates: `starter`, `backend`, `fullstack`, `mobile`. +### Full-stack / General +- **code-review.md** — Quality checklist adapted to the project's conventions +- **testing.md** — Testing strategy, what to test, coverage expectations +- **git-workflow.md** — Branch naming, commit conventions, PR process +- **architecture.md** — Project structure, design decisions, dependency rules -### After creating a jato +### DevOps / Infrastructure +- **deployment.md** — CI/CD patterns, environment management, rollback procedures +- **monitoring.md** — Logging conventions, alerting patterns, health checks +- **security.md** — Secrets management, access control, vulnerability scanning -1. Edit the generated files in `~/.jato/jatos//` to customize: - - `jato.yaml` — Add/remove MCPs, toggle providers - - `instructions.md` — Add global conventions - - `providers/*.md` — Add provider-specific instructions - - `skills/*.md` — Add specialized context (testing patterns, architecture, etc.) -2. Run `jato use ` to activate and materialize the configs +### What makes a good skill +- **Actionable**: Include concrete code templates and patterns, not vague advice +- **Specific**: Reference actual libraries, file paths, and conventions from the project +- **Concise**: Keep each skill focused on one topic (2-4KB is ideal) +- **Contextual**: Include "when to use" and "when NOT to use" guidance ## Modifying an Existing Jato diff --git a/tests/skills/jato-manager.test.ts b/tests/skills/jato-manager.test.ts index a1eb2b9..a24332e 100644 --- a/tests/skills/jato-manager.test.ts +++ b/tests/skills/jato-manager.test.ts @@ -12,11 +12,10 @@ describe("jato-manager.md", () => { expect(content.length).toBeGreaterThan(1000); }); - it("contains installation instructions", async () => { + it("contains prerequisites and install instructions", async () => { const content = await readFile(skillPath, "utf8"); - expect(content).toContain("## IMPORTANT: Before Doing Anything"); + expect(content).toContain("## Prerequisites"); expect(content).toContain("npx @malopezr7/jato"); - expect(content).toContain("Never create jato files manually"); }); it("contains CLI operations section", async () => { @@ -28,12 +27,20 @@ describe("jato-manager.md", () => { expect(content).toContain("jato doctor"); }); - it("contains jato creation guide", 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("Option A"); expect(content).toContain("Option B"); - expect(content).toContain("Option C"); + expect(content).toContain("Step 1"); + }); + + it("contains recommended skills by stack", async () => { + const content = await readFile(skillPath, "utf8"); + expect(content).toContain("## Recommended Skills by Stack"); + expect(content).toContain("### Mobile"); + expect(content).toContain("### Backend"); + expect(content).toContain("### Frontend"); }); it("contains modification section", async () => { @@ -49,9 +56,9 @@ describe("jato-manager.md", () => { expect(content).toContain("supabase"); }); - it("is between 2KB and 8KB", async () => { + it("is between 2KB and 10KB", async () => { const content = await readFile(skillPath, "utf8"); expect(content.length).toBeGreaterThan(2048); - expect(content.length).toBeLessThan(8192); + expect(content.length).toBeLessThan(10240); }); }); From ad8da89efccb0303cae686ddca039b7458b30a92 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Mar 2026 12:40:20 +0000 Subject: [PATCH 3/3] feat: apply official SKILL.md format from Anthropic's skill-building guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both jato-manager and jato-context skills now follow the official format: - YAML frontmatter with name, description, and trigger phrases - Progressive disclosure structure (frontmatter → body → references) - Specific, actionable instructions with "CRITICAL" markers - Troubleshooting section with Cause/Fix patterns - Tables instead of bullet lists for scannability - Skill recommendations condensed into a table by stack --- src/skills/jato-context.ts | 16 ++ src/skills/jato-manager.md | 253 ++++++++++++------------------ tests/core/materializer.test.ts | 2 +- tests/skills/jato-context.test.ts | 19 ++- tests/skills/jato-manager.test.ts | 36 +++-- 5 files changed, 163 insertions(+), 163 deletions(-) diff --git a/src/skills/jato-context.ts b/src/skills/jato-context.ts index a144e0d..d83e438 100644 --- a/src/skills/jato-context.ts +++ b/src/skills/jato-context.ts @@ -3,6 +3,22 @@ import type { ResolvedJato } from "../core/jato.js"; 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."); diff --git a/src/skills/jato-manager.md b/src/skills/jato-manager.md index eedc23c..55d6d6f 100644 --- a/src/skills/jato-manager.md +++ b/src/skills/jato-manager.md @@ -1,45 +1,45 @@ -# 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 + +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. ## Prerequisites -Before creating or modifying any jato, ensure the jato CLI is available. Run: +Verify the CLI is available before any operation: ```bash npx @malopezr7/jato list ``` -If the command fails, the CLI will be installed automatically via npx. You can also use `pnpm dlx @malopezr7/jato` instead. - -### Quick install options - -| Method | Command | -|--------|---------| -| Interactive setup | `npx @malopezr7/jato init` | -| Import existing config | `npx @malopezr7/jato init --from auto --name myproject` | -| From template | `npx @malopezr7/jato init --template mobile --name myproject` | -| Empty jato | `npx @malopezr7/jato init --empty --name myproject` | -| Install skill only | `npx @malopezr7/jato skill install` | -| Install from git repo | `npx @malopezr7/jato install ` | +You can also use `pnpm dlx @malopezr7/jato` instead of `npx`. -## CLI Operations +## CLI Commands -- `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 init` — Create a new jato (interactive or with flags) -- `jato install ` — Install jatos from a git repository -- `jato skill install` — Install the jato-manager skill to detected providers +| 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 | -Always run `jato use ` after modifying a jato's files to re-materialize. +CRITICAL: Always run `jato use ` after modifying any jato files to re-materialize. ## Hub Structure -All jatos live in `~/.jato/`: - ``` ~/.jato/ config.yaml ← active_jato: @@ -61,9 +61,9 @@ All jatos live in `~/.jato/`: ## Creating a New Jato -You can create jatos using the CLI **or** by building the file structure manually. Both approaches are valid — the CLI is faster for importing existing configs, while manual creation lets you guide the user step-by-step through each decision. +Both CLI and manual creation are valid. The CLI is faster for imports; manual creation enables a guided step-by-step experience. -### Option A: Using the CLI +### Via CLI ```bash npx @malopezr7/jato init # Interactive wizard @@ -71,101 +71,13 @@ npx @malopezr7/jato init --from auto --name myproject # Import existing npx @malopezr7/jato init --template mobile --name myproject # From template ``` -### Option B: Guided manual creation - -When creating a jato manually, guide the user through these steps: - -#### 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...) - -#### Step 2: Build the manifest -Create the directory structure at `~/.jato/jatos//`: - -1. Create directories: `providers/`, `skills/`, `agents/` -2. Write `jato.yaml` (see example below) -3. Write `instructions.md` with shared conventions - -#### Step 3: 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 4: Generate skills -Create relevant skill files in `skills/`. Ask the user what areas they'd like covered, and recommend based on their stack (see Recommended Skills section below). - -#### Step 5: Generate agents (if requested) -Create agent definitions in `agents/` for specialized roles. - -#### Step 6: Activate -Run `jato use ` to materialize all configs into the provider tools. - -## Recommended Skills by Stack - -When creating skills, ask the user which areas they want covered and recommend based on their stack: - -### Mobile (React Native, Flutter, Swift, Kotlin) -- **testing.md** — Component testing patterns, renderHook usage, mock patterns for navigation/storage/native modules -- **viewmodel-architecture.md** — ViewModel patterns, state management, separation of UI/logic -- **native-bridge.md** — Native module integration, platform-specific code patterns -- **code-review.md** — Checklist: performance (FlatList, memoization), accessibility, platform parity - -### Backend (Node.js, Python, Go, Java) -- **api-patterns.md** — REST/GraphQL conventions, error handling, response formats, pagination -- **database.md** — Query patterns, migrations, ORM usage, connection pooling -- **testing.md** — Unit/integration test patterns, mocking external services, fixtures -- **code-review.md** — Checklist: security (input validation, auth), performance, error handling - -### Frontend (React, Vue, Angular) -- **component-patterns.md** — Component architecture, composition, state management -- **testing.md** — Component testing, user-event patterns, MSW for API mocking -- **accessibility.md** — ARIA patterns, keyboard navigation, screen reader considerations -- **styling.md** — CSS conventions, responsive patterns, design system integration - -### Full-stack / General -- **code-review.md** — Quality checklist adapted to the project's conventions -- **testing.md** — Testing strategy, what to test, coverage expectations -- **git-workflow.md** — Branch naming, commit conventions, PR process -- **architecture.md** — Project structure, design decisions, dependency rules - -### DevOps / Infrastructure -- **deployment.md** — CI/CD patterns, environment management, rollback procedures -- **monitoring.md** — Logging conventions, alerting patterns, health checks -- **security.md** — Secrets management, access control, vulnerability scanning - -### What makes a good skill -- **Actionable**: Include concrete code templates and patterns, not vague advice -- **Specific**: Reference actual libraries, file paths, and conventions from the project -- **Concise**: Keep each skill focused on one topic (2-4KB is ideal) -- **Contextual**: Include "when to use" and "when NOT to use" guidance - -## Modifying an Existing Jato - -When the user wants to modify their active jato: - -- **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 ` - -Always remind the user to run `jato use ` after changes to re-materialize. +### Via guided manual creation -## Inspecting a Jato +Walk the user through these steps: -When the user asks about their current jato or wants to see what's configured: +**Step 1 — Understand context:** Ask about the role (mobile, backend, devops...), tech stack, and which AI tools they use. -1. Run `jato use` (no args) to see the active jato -2. Run `jato list` to see all jatos -3. Run `jato doctor` to check health -4. Read `~/.jato/jatos//jato.yaml` for the manifest -5. List files in `skills/`, `agents/`, `providers/` to show what's available - -## Example `jato.yaml` +**Step 2 — Build manifest:** Create `~/.jato/jatos//` with subdirectories `providers/`, `skills/`, `agents/`. Write `jato.yaml`: ```yaml name: mobile @@ -182,37 +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 ``` -## Common MCP Server References - -When suggesting MCPs, use these known configurations: - -- **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 - -- 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` +**Step 3 — Write instructions:** Create `instructions.md` with shared conventions, then `providers/.md` for each enabled provider. + +**Step 4 — Create skills:** Recommend skills based on the stack (see below). Each skill should be a focused `.md` file in `skills/`. + +**Step 5 — Activate:** Run `jato use ` to materialize. + +## Skill Recommendations + +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). + +### By stack + +| 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) | + +### What makes a good skill + +- 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 + +## Modifying an Existing Jato + +| 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/core/materializer.test.ts b/tests/core/materializer.test.ts index 5e4ec82..e9e9d7f 100644 --- a/tests/core/materializer.test.ts +++ b/tests/core/materializer.test.ts @@ -84,7 +84,7 @@ 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 jato", async () => { diff --git a/tests/skills/jato-context.test.ts b/tests/skills/jato-context.test.ts index 79851dc..4167152 100644 --- a/tests/skills/jato-context.test.ts +++ b/tests/skills/jato-context.test.ts @@ -19,8 +19,11 @@ function makeJato(overrides?: Partial): ResolvedJato { } describe("generateJatoContextSkill", () => { - it("generates minimal context", () => { + 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"); @@ -121,6 +124,20 @@ describe("generateJatoContextSkill", () => { expect(content).toContain("reviewer"); }); + it("includes jato name in frontmatter description", () => { + const content = generateJatoContextSkill( + 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({ diff --git a/tests/skills/jato-manager.test.ts b/tests/skills/jato-manager.test.ts index a24332e..5762cee 100644 --- a/tests/skills/jato-manager.test.ts +++ b/tests/skills/jato-manager.test.ts @@ -12,15 +12,24 @@ describe("jato-manager.md", () => { expect(content.length).toBeGreaterThan(1000); }); + it("has valid YAML frontmatter", async () => { + const content = await readFile(skillPath, "utf8"); + 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 operations section", async () => { + it("contains CLI commands section", async () => { const content = await readFile(skillPath, "utf8"); - expect(content).toContain("## CLI Operations"); + expect(content).toContain("## CLI Commands"); expect(content).toContain("jato list"); expect(content).toContain("jato use"); expect(content).toContain("jato off"); @@ -30,17 +39,17 @@ describe("jato-manager.md", () => { 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("Option A"); - expect(content).toContain("Option B"); + expect(content).toContain("Via CLI"); + expect(content).toContain("Via guided manual creation"); expect(content).toContain("Step 1"); }); - it("contains recommended skills by stack", async () => { + it("contains skill recommendations", async () => { const content = await readFile(skillPath, "utf8"); - expect(content).toContain("## Recommended Skills by Stack"); - expect(content).toContain("### Mobile"); - expect(content).toContain("### Backend"); - expect(content).toContain("### Frontend"); + expect(content).toContain("## Skill Recommendations"); + expect(content).toContain("Mobile"); + expect(content).toContain("Backend"); + expect(content).toContain("Frontend"); }); it("contains modification section", async () => { @@ -50,12 +59,19 @@ 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("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);