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
50 changes: 37 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Create C1 App
# Create C1 App

A powerful CLI tool that setups Generative UI examples with C1 by Thesys

## Features

✨ **Interactive Project Setup**




## Quick Start

```bash
Expand All @@ -24,14 +21,15 @@ npx create-c1-app my-thesys-project --template template-c1-component-next --api-

## CLI Options

| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| `[project-name]` | | Name of the project to create (positional argument) | Interactive prompt |
| `--project-name` | `-n` | Name of the project to create (alternative to positional argument) | Interactive prompt |
| `--template` | `-t` | Next.js template to use (`template-c1-component-next` or `template-c1-next`) | Interactive prompt |
| `--api-key` | `-k` | Thesys API key to use for the project | Interactive prompt |
| `--debug` | `-d` | Enable debug logging | `false` |
| `--disable-telemetry` | | Disable anonymous telemetry for current session | `false` |
| Option | Alias | Description | Default |
| --------------------- | ----- | ------------------------------------------------------------------------------------------------------ | ----------------------- |
| `[project-name]` | | Name of the project to create (positional argument) | Interactive prompt |
| `--project-name` | `-n` | Name of the project to create (alternative to positional argument) | Interactive prompt |
| `--template` | `-t` | Next.js template to use (`template-c1-component-next` or `template-c1-next`) | Interactive prompt |
| `--api-key` | `-k` | Thesys API key to use for the project | Interactive prompt |
| `--debug` | `-d` | Enable debug logging | `false` |
| `--non-interactive` | | Run without prompts; fails fast if required options are missing. Auto-enabled in CI or non-TTY shells. | `false` (auto-detected) |
| `--disable-telemetry` | | Disable anonymous telemetry for current session | `false` |

## Usage Examples

Expand All @@ -57,6 +55,29 @@ npx create-c1-app my-project --template template-c1-next --api-key your-api-key-
npx create-c1-app --api-key your-api-key-here
```

### Non-Interactive / CI / Agent Usage

When running in CI pipelines, automated scripts, or AI agent shells (e.g. Cursor, Copilot, Devin), interactive prompts will hang. The CLI supports a fully non-interactive mode:

```bash
# Explicit flag
npx create-c1-app my-project --template template-c1-next --api-key YOUR_API_KEY --non-interactive

# Or just provide all required flags — non-interactive mode is auto-detected
# when stdin is not a TTY (pipes, agents, CI) or when CI env vars are set
npx create-c1-app my-project --template template-c1-next --api-key YOUR_API_KEY
```

**Auto-detection:** The CLI automatically enables non-interactive mode when:

- `stdin` is not a TTY (piped input, background process, agent shell)

**Behavior in non-interactive mode:**

- `--api-key` is **required** (OAuth browser flow is skipped)
- `--project-name` defaults to `my-c1-app` if not provided
- `--template` defaults to `template-c1-next` if not provided
- The CLI will **fail immediately** with a clear error if required options are missing, instead of hanging on a prompt

## Development

Expand All @@ -70,7 +91,6 @@ pnpm run build
pnpm link
```


## Authentication Options

Create C1 App supports two authentication methods:
Expand All @@ -84,6 +104,7 @@ npx create-c1-app
```

This method will:

- Open your browser for secure authentication
- Generate an API key automatically after successful login
- Store the API key in your project's `.env` file
Expand Down Expand Up @@ -119,19 +140,22 @@ To get an API key manually:
### Common Issues

**Error: "Project directory already exists"**

```bash
# Choose a different name or remove the existing directory
rm -rf existing-project-name
npx create-c1-app
```

**Error: "Failed to download template"**

```bash
# Check your internet connection and try again
npx create-c1-app
```

**Error: "Failed to install dependencies"**

```bash
# Navigate to your project and install manually
cd your-project-name
Expand Down
134 changes: 67 additions & 67 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
{
"name": "create-c1-app",
"version": "1.1.6",
"description": "A CLI tool that creates C1 projects with API authentication",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"create-c1-app": "bin/create-c1-app.js"
},
"scripts": {
"build": "tsc",
"dev": "node --loader ts-node/esm src/index.ts --debug --disable-telemetry",
"start": "node bin/create-c1-app.js",
"prepublishOnly": "npm run build",
"lint": "eslint 'src/**/*.ts' 'bin/create-c1-app.js'",
"lint:fix": "eslint 'src/**/*.ts' 'bin/create-c1-app.js' --fix"
},
"keywords": [
"generative-ui",
"examples"
],
"author": "engineering@thesys.dev",
"license": "MIT",
"dependencies": {
"@inquirer/prompts": "^7.8.4",
"chalk": "^4.1.2",
"dotenv": "^16.3.1",
"execa": "^5.1.1",
"nanoid": "^5.1.5",
"open": "^10.2.0",
"openid-client": "^6.8.1",
"ora": "^5.4.1",
"posthog-node": "^5.8.4",
"unzipper": "^0.10.14",
"validate-npm-package-name": "^5.0.0",
"yargs": "^17.7.2"
},
"devDependencies": {
"@types/jest": "^29.5.8",
"@types/node": "^20.10.0",
"@types/unzipper": "^0.10.9",
"@types/validate-npm-package-name": "^4.0.2",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"eslint": "^9.0.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.4.0",
"eslint-plugin-promise": "^6.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.3.2"
},
"engines": {
"node": ">=20.9.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/thesysdev/create-c1-app.git"
},
"bugs": {
"url": "https://github.com/thesysdev/create-c1-app/issues"
},
"homepage": "https://github.com/thesysdev/create-c1-app#readme",
"publishConfig": {
"access": "public"
}
"name": "create-c1-app",
"version": "1.2.6",
"description": "A CLI tool that creates C1 projects with API authentication",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"create-c1-app": "bin/create-c1-app.js"
},
"scripts": {
"build": "tsc",
"dev": "node --loader ts-node/esm src/index.ts --debug --disable-telemetry",
"start": "node bin/create-c1-app.js",
"prepublishOnly": "npm run build",
"lint": "eslint 'src/**/*.ts' 'bin/create-c1-app.js'",
"lint:fix": "eslint 'src/**/*.ts' 'bin/create-c1-app.js' --fix"
},
"keywords": [
"generative-ui",
"examples"
],
"author": "engineering@thesys.dev",
"license": "MIT",
"dependencies": {
"@inquirer/prompts": "^7.8.4",
"chalk": "^4.1.2",
"dotenv": "^16.3.1",
"execa": "^5.1.1",
"nanoid": "^5.1.5",
"open": "^10.2.0",
"openid-client": "^6.8.1",
"ora": "^5.4.1",
"posthog-node": "^5.8.4",
"unzipper": "^0.10.14",
"validate-npm-package-name": "^5.0.0",
"yargs": "^17.7.2"
},
"devDependencies": {
"@types/jest": "^29.5.8",
"@types/node": "^20.10.0",
"@types/unzipper": "^0.10.9",
"@types/validate-npm-package-name": "^4.0.2",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"eslint": "^9.0.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.4.0",
"eslint-plugin-promise": "^6.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.3.2"
},
"engines": {
"node": ">=20.9.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/thesysdev/create-c1-app.git"
},
"bugs": {
"url": "https://github.com/thesysdev/create-c1-app/issues"
},
"homepage": "https://github.com/thesysdev/create-c1-app#readme",
"publishConfig": {
"access": "public"
}
}
Loading