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
119 changes: 119 additions & 0 deletions docs/resources/(resources)/claude-code-project.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: claude-code-project
description: A reference page for the claude-code-project resource
---

The claude-code-project resource manages **per-project** Claude Code configuration. It writes project-scoped instructions, settings, and MCP servers under a specific directory — leaving global configuration untouched. Use it alongside the [`claude-code`](/docs/resources/claude-code/claude-code) resource, which handles installation.

## Parameters

- **directory**: *(string, required)* Path to the project directory. All configuration files are written relative to this path:
- `<directory>/.claude/CLAUDE.md`
- `<directory>/.claude/settings.json`
- `<directory>/.claude.json`

- **claudeMd**: *(string, optional)* Content for `<directory>/.claude/CLAUDE.md`. Accepts inline text, an `https://` URL, or a `codify://documentId:fileId` cloud URL. Claude Code reads this at the start of every session within the project, making it ideal for project-specific conventions, preferred libraries, and review checklists.

- **settings**: *(object, optional)* Key-value pairs to merge into `<directory>/.claude/settings.json`. On apply, the declared keys are written; on destroy, only the declared keys are removed. Supports the same keys as the global settings:
- `model` — override the default Claude model for this project
- `effortLevel` — `"low"` | `"medium"` | `"high"` | `"xhigh"`
- `editorMode` — `"normal"` | `"vim"`
- `permissions` — `{ allow: [...], deny: [...] }`
- `env` — environment variables injected into every session
- `hooks` — lifecycle hooks (PreToolUse, PostToolUse, SessionStart, etc.)

- **mcpServers**: *(array, optional)* MCP servers to register for this project in `<directory>/.claude.json`. Each entry requires a `name` and `type`, plus transport-specific fields:
- **stdio**: `{ name, type: "stdio", command, args?, env? }` — local process server
- **http**: `{ name, type: "http", url, headers? }` — remote HTTP (streamable-http) server
- **sse**: `{ name, type: "sse", url, headers? }` — remote SSE server (deprecated; prefer http)

## Example usage

### Per-project instructions and permissions

```json title="codify.jsonc"
[
{
"type": "claude-code-project",
"directory": "~/projects/my-api",
"claudeMd": "# Project Instructions\n\nThis is a Node.js API. Always use async/await.\nRun `npm test` before committing.",
"settings": {
"permissions": {
"allow": ["Bash(npm run *)", "Bash(git *)"],
"deny": ["Bash(rm -rf *)"]
}
}
}
]
```

### Per-project instructions with an MCP server

```json title="codify.jsonc"
[
{
"type": "claude-code-project",
"directory": "~/projects/my-api",
"claudeMd": "# Project Instructions\n\nAlways check types with `npm run typecheck` before submitting.",
"mcpServers": [
{
"name": "project-db",
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
}
]
}
]
```

### Per-project CLAUDE.md from a remote URL

```json title="codify.jsonc"
[
{
"type": "claude-code-project",
"directory": "~/projects/my-api",
"claudeMd": "codify://my-document-id:my-file-id"
}
]
```

Or from a public HTTPS URL:

```json title="codify.jsonc"
[
{
"type": "claude-code-project",
"directory": "~/projects/my-api",
"claudeMd": "https://raw.githubusercontent.com/my-org/dotfiles/main/CLAUDE.md"
}
]
```

### Global install + per-project config together

```json title="codify.jsonc"
[
{
"type": "claude-code",
"settings": {
"model": "claude-opus-4-7"
}
},
{
"type": "claude-code-project",
"directory": "~/projects/my-api",
"claudeMd": "# My API\n\nNode.js + TypeScript. Run `npm test` before any commit."
}
]
```

## Notes

- The `claude-code` resource must be applied before `claude-code-project` (it declares a dependency automatically). If Claude Code is not installed, this resource will report as not present.
- Multiple `claude-code-project` entries can coexist — each unique `directory` is a separate resource instance.
- Destroying a `claude-code-project` resource removes only the per-project files (`CLAUDE.md`, the declared `settings` keys, and the declared `mcpServers`). The Claude Code binary and global configuration are left untouched.
- The `settings` parameter merges only the declared keys. Existing project settings not in your Codify config are left untouched.
- The `claudeMd` parameter manages the entire file. On destroy, the file is removed.
- MCP servers are stored in `<directory>/.claude.json` under the `mcpServers` key. Removing an MCP server from your config removes it from the file; other servers are untouched.
99 changes: 99 additions & 0 deletions docs/resources/(resources)/claude-code.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
title: claude-code
description: A reference page for the claude-code resource
---

The claude-code resource installs [Claude Code](https://code.claude.com) — Anthropic's agentic coding assistant — and manages its configuration. It handles installation via the official installer script and gives you declarative control over settings, MCP servers, and global instructions.

## Parameters

- **globalClaudeMd**: *(string, optional)* Content to write to `~/.claude/CLAUDE.md`. Claude Code reads this file at the start of every session, making it ideal for global coding standards, preferred libraries, and review checklists that apply to all projects.

- **settings**: *(object, optional)* Key-value pairs to merge into `~/.claude/settings.json`. On apply, the declared keys are written; on destroy, only the declared keys are removed. Common settings include:
- `model` — override the default Claude model
- `effortLevel` — `"low"` | `"medium"` | `"high"` | `"xhigh"`
- `editorMode` — `"normal"` | `"vim"`
- `permissions` — `{ allow: [...], deny: [...] }`
- `env` — environment variables injected into every session
- `hooks` — lifecycle hooks (PreToolUse, PostToolUse, SessionStart, etc.)
- `autoMemoryEnabled` — enable/disable auto memory (default: `true`)

- **mcpServers**: *(array, optional)* MCP servers to register globally in `~/.claude.json`. Each entry requires a `name` and `type`, plus transport-specific fields:
- **stdio**: `{ name, type: "stdio", command, args?, env? }` — local process server
- **http**: `{ name, type: "http", url, headers? }` — remote HTTP (streamable-http) server
- **sse**: `{ name, type: "sse", url, headers? }` — remote SSE server (deprecated; prefer http)

## Example usage

### Install Claude Code with custom settings

```json title="codify.jsonc"
[
{
"type": "claude-code",
"settings": {
"model": "claude-opus-4-7",
"effortLevel": "high",
"editorMode": "vim",
"permissions": {
"allow": ["Bash(npm run *)", "Bash(git *)"],
"deny": ["Bash(rm -rf *)"]
}
}
}
]
```

### Claude Code with global instructions and an MCP server

```json title="codify.jsonc"
[
{
"type": "claude-code",
"globalClaudeMd": "# Global Instructions\n\nAlways follow security best practices.\nPrefer TypeScript over JavaScript.",
"mcpServers": [
{
"name": "filesystem",
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
}
]
}
]
```

### Claude Code with hooks

```json title="codify.jsonc"
[
{
"type": "claude-code",
"settings": {
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "npx",
"args": ["eslint", "--fix", "${tool_input.file_path}"]
}
]
}
]
}
}
}
]
```

## Notes

- Claude Code is installed via the official installer (`curl -fsSL https://claude.ai/install.sh | bash`) on both macOS and Linux. The binary is placed at `~/.local/bin/claude`.
- The installer adds `~/.local/bin` to your PATH via your shell RC file (`.bashrc` or `.zshrc`). This entry remains after destroy — remove it manually if you no longer want it.
- The `settings` parameter merges only the declared keys. Existing settings not in your Codify config are left untouched.
- The `globalClaudeMd` parameter manages the entire file. On destroy, the file is removed.
- MCP servers are stored in `~/.claude.json` under the `mcpServers` key. Each server's `name` becomes its key in that object. Removing an MCP server from your config removes it from the file; other servers are untouched.
- To see all available settings, run `claude config list` or visit the [settings reference](https://code.claude.com/docs/en/settings).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "default",
"version": "1.1.2",
"version": "1.2.0",
"description": "Default plugin for Codify - provides 50+ declarative resources for managing development tools and system configuration across macOS and Linux",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ async function uploadResources(prerelease: boolean) {
.upsert(parameters, { onConflict: 'name,resource_id,prerelease' })
.throwOnError();
}
}
}
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { FnmResource } from './resources/javascript/fast-node-manager/fast-node-
import { NvmResource } from './resources/javascript/nvm/nvm.js';
import { Pnpm } from './resources/javascript/pnpm/pnpm.js';
import { MacportsResource } from './resources/macports/macports.js';
import { ClaudeCodeResource } from './resources/claude-code/claude-code.js';
import { ClaudeCodeProjectResource } from './resources/claude-code/claude-code-project.js';
import { OllamaResource } from './resources/ollama/ollama.js';
import { PgcliResource } from './resources/pgcli/pgcli.js';
import { Pip } from './resources/python/pip/pip.js';
Expand Down Expand Up @@ -108,6 +110,8 @@ runPlugin(Plugin.create(
new SnapResource(),
new TartResource(),
new TartVmResource(),
new ClaudeCodeResource(),
new ClaudeCodeProjectResource(),
new OllamaResource(),
new SyncthingResource(),
new SyncthingDeviceResource(),
Expand Down
Loading
Loading