Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ examples/**/.prod.vars
# Ignore test apps
cli/test-apps/**
!cli/test-apps/.gitkeep
# Ignore test apps in create-fiberplane
create-fiberplane/test-apps/**
!create-fiberplane/test-apps/.gitkeep

# Ignore macOS DS_Store files
.DS_Store
Expand Down
6 changes: 5 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
"dist",

// ignore all tsconfig.json files
"tsconfig.json"
"tsconfig.json",

// ignore all test-apps
"cli/test-apps/**",
"create-fiberplane/test-apps/**"
]
}
}
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "An interactive CLI to create modular typesafe data APIs using TypeScript",
"scripts": {
"build": "pnpm clean && tsup",
"dev": "tsup --watch && node dist/index.js",
"dev": "tsup --watch --onSuccess 'node dist/index.js'",
"dev:target": "tsup --watch --onSuccess 'node dist/index.js test-name'",
"format": "biome format . --write",
"typecheck": "tsc --noEmit",
Expand Down
33 changes: 33 additions & 0 deletions create-fiberplane/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# prod
dist/

# dev
.yarn/
!.yarn/releases
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf

# deps
node_modules/
.wrangler

# env
.env
.env.production
.dev.vars

# logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# misc
.DS_Store
75 changes: 75 additions & 0 deletions create-fiberplane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# create-fiberplane

An interactive CLI to create MCP (Model Context Protocol) projects with Fiberplane.

## Usage

```bash
npm create fiberplane@latest [project-name]
```

## Features

- 🚀 Interactive project setup
- 📦 Automatic dependency installation
- 🤖 AI assistant integration (Cursor, Claude Code, VSCode, Windsurf)
- 🔧 Git initialization
- ☁️ Fiberplane deployment configuration
- 📋 MCP template scaffolding

## Flow

1. **Target directory?** - Project directory name (default: "echo-mcp")
2. **Install AI assistance?** - Choose your preferred AI coding assistant
3. **Install dependencies?** - Automatically install project dependencies
4. **Initialize git?** - Set up git repository (skipped if already in a git repo)
5. **"Make it live" (Deploy with Fiberplane?)** - Configure Fiberplane deployment

## Debugging

The CLI includes comprehensive logging to help debug issues. Logs are automatically saved to:

- **macOS**: `~/Library/Logs/create-fiberplane/`
- **Linux**: `~/.local/state/create-fiberplane/logs/`
- **Windows**: `%LOCALAPPDATA%\create-fiberplane\Logs\`

### View Debug Logs

All CLI operations are automatically logged to files for debugging:

```bash
# Check the logs (macOS example)
tail -f ~/Library/Logs/create-fiberplane/create-fiberplane-*.log

# Or view the latest log file
ls -t ~/Library/Logs/create-fiberplane/ | head -1 | xargs -I {} cat ~/Library/Logs/create-fiberplane/{}
```

### Environment Variables

- `CFP_LOG_DIR=/custom/path` - Override log directory (optional)

**Note**: All debug information is automatically logged to files to avoid interfering with the interactive CLI prompts.

## Development

```bash
# Install dependencies
pnpm install

# Build the CLI
pnpm build

# Test locally
pnpm dev

# Test locally (check log files for debug output)
pnpm dev

# Format code
pnpm format
```

## License

MIT
3 changes: 3 additions & 0 deletions create-fiberplane/biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["../biome.jsonc"]
}
49 changes: 49 additions & 0 deletions create-fiberplane/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "create-fiberplane",
"type": "module",
"version": "0.0.1",
"description": "An interactive CLI to create MCP (Model Context Protocol) projects with Fiberplane",
"scripts": {
"build": "pnpm clean && tsup",
"dev": "tsup --watch --onSuccess 'node dist/index.js'",
"dev:target": "tsup --watch --onSuccess 'node dist/index.js test-name'",
"test:auth": "tsx test-auth.ts",
"format": "biome format . --write",
"typecheck": "tsc --noEmit",
"clean": "rimraf dist",
"clean:test-apps": "rimraf test-apps/* && touch test-apps/.gitkeep"
},
"exports": "./dist/index.js",
"files": ["dist", "README.md", "LICENSE", ".gitignore"],
"bin": {
"create-fiberplane": "dist/index.js"
},
"author": "Fiberplane<[email protected]>",
"license": "MIT",
"repository": {
"url": "https://github.com/fiberplane/create-honc-app",
"type": "git"
},
"dependencies": {
"@clack/core": "^0.3.4",
"@clack/prompts": "^0.7.0",
"@oslojs/oauth2": "^0.5.0",
"giget": "^1.2.3",
"open": "^10.1.0",
"picocolors": "^1.0.1",
"pino": "^9.9.4",
"pino-pretty": "^13.1.1"
},
"devDependencies": {
"@types/node": "^22.2.0",
"rimraf": "^6.0.1",
"tsup": "^8.2.3",
"tsx": "^4.19.2"
},
"engines": {
"node": ">=18.17.0"
},
"publishConfig": {
"access": "public"
}
}
48 changes: 48 additions & 0 deletions create-fiberplane/src/actions/ai-assistant/ai-assistant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { note, select } from "@clack/prompts";
import pico from "picocolors";
import type { Context } from "../../context";
import type { AIAssistant } from "../../types";
import { actionCursor } from "./cursor";
import { actionClaudeCode } from "./claude-code";
import { actionVSCode } from "./vscode";
import { actionWindsurf } from "./windsurf";

export async function promptAIAssistant(context: Context) {
const aiAssistant = await select({
message: "Who is your copilot?",
options: [
{ value: "cursor", label: "Cursor" },
{ value: "claude-code", label: "Claude Code" },
{ value: "vscode", label: "VSCode" },
{ value: "windsurf", label: "Windsurf" },
{ value: "none", label: "I do it old school" },
],
initialValue: "cursor",
});

if (typeof aiAssistant === "string") {
context.aiAssistant = aiAssistant as AIAssistant;
}

return aiAssistant;
}

export async function actionAIAssistant(context: Context) {
if (!context.aiAssistant || context.aiAssistant === "none") {
return;
}

switch (context.aiAssistant) {
case "cursor":
return await actionCursor(context);
case "claude-code":
return await actionClaudeCode(context);
case "vscode":
return await actionVSCode(context);
case "windsurf":
return await actionWindsurf(context);
default:
note(`${pico.gray("No AI assistant selected - skipping setup")}`);
return;
}
}
62 changes: 62 additions & 0 deletions create-fiberplane/src/actions/ai-assistant/claude-code.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { note, spinner } from "@clack/prompts";
import { existsSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import pico from "picocolors";
import type { Context } from "../../context";
import {
AGENTS_MD,
FIBERPLANE_MCP_NAME,
FIBERPLANE_MCP_URL,
} from "./constants";

// NOTE - CC needs the `type: "http"` property
const CLAUDE_CODE_FIBERPLANE_MCP_CONFIG = {
mcpServers: {
[FIBERPLANE_MCP_NAME]: {
type: "http",
url: FIBERPLANE_MCP_URL,
},
},
};

export async function actionClaudeCode(context: Context) {
if (!context.path) {
throw new Error("Path not set");
}

const s = spinner();
s.start("Setting up Claude Code configuration...");

try {
const mcpJsonPath = join(context.path, ".mcp.json");
const claudePath = join(context.path, "CLAUDE.md");

// Create .mcp.json if it doesn't exist
if (!existsSync(mcpJsonPath)) {
const mcpConfig = CLAUDE_CODE_FIBERPLANE_MCP_CONFIG;

writeFileSync(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
}

// Create CLAUDE.md if it doesn't exist
if (!existsSync(claudePath)) {
const claudeContent = AGENTS_MD;

writeFileSync(claudePath, claudeContent);
}

s.stop(`${pico.green("✓")} Claude Code configuration created`);

note(`${pico.cyan("Claude Code setup complete!")}

${pico.dim("Created:")}
• CLAUDE.md
• .mcp.json with Fiberplane MCP server

Claude Code is ready to use Fiberplane.
`);
} catch (error) {
s.stop(`${pico.red("✗")} Failed to set up Claude Code configuration`);
throw error;
}
}
38 changes: 38 additions & 0 deletions create-fiberplane/src/actions/ai-assistant/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export const FIBERPLANE_MCP_NAME = "fiberplane-mcp-server";
export const FIBERPLANE_MCP_URL = "https://fiberplane.com/mcp";

export const FIBERPLANE_MCP_CONFIG = {
mcpServers: {
[FIBERPLANE_MCP_NAME]: {
url: FIBERPLANE_MCP_URL,
headers: {},
},
},
};

export const AGENTS_MD = `# AI Coding Agent Instructions

This is a modern Typescript web application.

It creates a Model Context Protocol (MCP) server, which can be connected to by MCP Clients (AI assistants) such as:

- Claude Desktop
- Claude Code
- Cursor
- VSCode + GitHub Copilot
- Windsurf

## Stack

This project is deployed to Fiberplane, which is equivalent to a Cloudflare serverless runtime.

## Workflow

Keep this file up to date with succinct descriptions of the project purpose, architecture, integrations, and other important information.

### Development

This project does not support local development.

Your workflow should be that, after you make changes, you run \`pnpm run deploy\` to deploy the changes to Fiberplane.
`;
Loading