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
55 changes: 48 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ A powerful CLI tool that setups Generative UI examples with C1 by Thesys
# Run the tool
npx create-c1-app

# Or with options
npx create-c1-app --project-name my-thesys-project --template template-c1-component-next --api-key your-api-key
# With project name
npx create-c1-app my-thesys-project

# With project name and options
npx create-c1-app my-thesys-project --template template-c1-component-next --api-key your-api-key
```

## CLI Options

| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| `--project-name` | `-n` | Name of the project to create | Interactive prompt |
| `[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` |
Expand All @@ -34,14 +38,20 @@ npx create-c1-app --project-name my-thesys-project --template template-c1-compon
### Basic Usage

```bash
# Interactive mode (recommended)
# Interactive mode with OAuth authentication (recommended)
npx create-c1-app

# Quick setup with project name as positional argument
npx create-c1-app my-thesys-project

# Quick setup with project name, template, and API key
npx create-c1-app my-thesys-component --template template-c1-component-next --api-key your-api-key-here

# Using flag instead of positional argument
npx create-c1-app --project-name my-thesys-component --template template-c1-component-next --api-key your-api-key-here

# With specific template choice
npx create-c1-app --template template-c1-next --api-key your-api-key-here
npx create-c1-app my-project --template template-c1-next --api-key your-api-key-here

# Interactive with API key provided
npx create-c1-app --api-key your-api-key-here
Expand All @@ -61,9 +71,40 @@ pnpm link
```


## Getting Your Thesys API Key
## Authentication Options

Create C1 App supports two authentication methods:

### Option 1: OAuth 2.0 Authentication (Recommended)

The CLI will automatically open your browser and guide you through the OAuth authentication process:

```bash
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

### Option 2: Manual API Key

If you prefer to provide your API key manually or skip OAuth authentication:

```bash
npx create-c1-app --skip-auth
```

Or provide your existing API key directly:

```bash
npx create-c1-app --api-key your-api-key-here
```

## Getting Your Thesys API Key (Manual Method)

To use Create C1 App, you'll need a Thesys API key:
To get an API key manually:

1. 🌐 Visit: https://console.thesys.dev/keys
2. 🔐 Sign in to your Thesys account
Expand Down
2 changes: 1 addition & 1 deletion bin/create-c1-app → bin/create-c1-app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

// Entry point for the Create C1 App CLI
const { main } = require('../dist/index.js')
import { main } from '../dist/index.js'

main().catch((error) => {
console.error('Error:', error.message)
Expand Down
20 changes: 8 additions & 12 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
const tseslint = require('@typescript-eslint/eslint-plugin')
const tsparser = require('@typescript-eslint/parser')
import tseslint from '@typescript-eslint/eslint-plugin'
import tsparser from '@typescript-eslint/parser'

module.exports = [
export default [
// Global ignores
{
ignores: ['dist/', 'node_modules/']
},

// Base configuration for JavaScript/Node files
{
files: ['bin/create-c1-app'],
files: ['bin/create-c1-app.js'],
languageOptions: {
ecmaVersion: 2020,
sourceType: 'script',
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
global: 'readonly',
module: 'readonly',
require: 'readonly'
global: 'readonly'
}
},
rules: {
Expand Down Expand Up @@ -66,14 +62,14 @@ module.exports = [
'no-console': 'off',
'prefer-const': 'error',
'no-var': 'error',

// Disable style rules - focus on functionality
'semi': 'off',
'quotes': 'off',
'comma-dangle': 'off',
'space-before-function-paren': 'off',
'indent': 'off',

// TypeScript specific rules - only important ones
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': 'off',
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
"name": "create-c1-app",
"version": "1.1.5",
"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"
"create-c1-app": "bin/create-c1-app.js"
},
"scripts": {
"build": "tsc",
"dev": "ts-node src/index.ts",
"start": "node bin/create-c1-app",
"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'",
"lint:fix": "eslint 'src/**/*.ts' 'bin/create-c1-app' --fix"
"lint": "eslint 'src/**/*.ts' 'bin/create-c1-app.js'",
"lint:fix": "eslint 'src/**/*.ts' 'bin/create-c1-app.js' --fix"
},
"keywords": [
"generative-ui",
Expand All @@ -27,6 +28,8 @@
"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",
Expand Down
Loading