Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/cli/commands/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -45,19 +45,19 @@ 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,
});

// 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);

Expand All @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions src/cli/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
14 changes: 7 additions & 7 deletions src/cli/commands/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/off.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
});
}
4 changes: 2 additions & 2 deletions src/core/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -29,7 +29,7 @@ export function getJatoDir(jatoName: string, home?: string): string {

export async function ensureHub(home?: string): Promise<void> {
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 });
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/materializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ export async function materialize(
options: MaterializeOptions = {},
): Promise<MaterializeOutput> {
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);

for (const providerName of enabledProviders) {
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("/")
Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/providers/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@ 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<string, unknown> = {
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({
path: this.configPath(home),
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"],
});
}

Expand Down
14 changes: 7 additions & 7 deletions src/providers/codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}]`);

Expand Down Expand Up @@ -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"],
});
}

Expand Down
10 changes: 5 additions & 5 deletions src/providers/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ 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<string, unknown> = {
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({
path: this.configPath(home),
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"],
});
}

Expand Down
6 changes: 3 additions & 3 deletions src/providers/opencode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown> = {
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({
Expand Down
2 changes: 1 addition & 1 deletion src/providers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
40 changes: 28 additions & 12 deletions src/skills/jato-context.ts
Original file line number Diff line number Diff line change
@@ -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(", ")})` : "";
Expand All @@ -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("");
Expand Down
Loading