Skip to content

Commit c2b7cbd

Browse files
authored
Merge pull request #1 from pipedrive/AINATIVEM-41
AINATIVEM-41: CLI tool foundation — create-pipedrive-app scaffold
2 parents 0b65448 + f67f24c commit c2b7cbd

34 files changed

Lines changed: 4897 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
ci:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
cache: npm
18+
- run: npm ci
19+
- run: npm run lint
20+
- run: npm run typecheck
21+
- run: npm test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
dist/
3+
.env
4+
docs/superpowers/
5+
6+
# locally generated test apps
7+
*-app/

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"useTabs": true,
5+
"tabWidth": 4,
6+
"trailingComma": "all",
7+
"quoteProps": "consistent",
8+
"proseWrap": "always"
9+
}

CLAUDE.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Purpose
6+
7+
`create-pipedrive-app` is a CLI scaffolding tool for external Pipedrive Marketplace developers. It generates a production-ready integration project via `npx create-pipedrive-app <project-name>`.
8+
9+
## Architecture
10+
11+
The tool is **CLI-first**, with an **AI plugin layer** built on top:
12+
13+
- **CLI core**: Collects user choices via interactive prompts, then generates a project scaffold from templates.
14+
- **AI plugin layer** (secondary): Claude/Codex skills that wrap the CLI — guide developers, modify existing projects, and explain generated code.
15+
16+
### Interactive prompts (CLI)
17+
18+
The CLI asks for:
19+
- Backend: Node.js/Express, Node.js/Fastify, or PHP/Laravel
20+
- Database: Postgres, MySQL, or SQLite
21+
- App Extensions frontend: React, Vanilla JS, or none
22+
- Webhooks: Yes/No
23+
24+
### Generated project structure
25+
26+
```
27+
<project-name>/
28+
backend/
29+
oauth/ # Authorization redirect, callback, token exchange, refresh, state validation
30+
pipedrive-client/ # Official API client wrapper with preconfigured auth
31+
database/ # Tenant/account mapping, tokens, scopes, installation status
32+
webhooks/ # Optional webhook handlers
33+
frontend/
34+
app-extension-ui/ # Optional: React or Vanilla iframe UI with App Extensions SDK
35+
.env.example
36+
README.md
37+
docker-compose.yml
38+
marketplace-checklist.md
39+
```
40+
41+
## MVP Scope
42+
43+
The initial implementation targets:
44+
- **Runtime**: Node.js + TypeScript
45+
- **Backend**: Express or Fastify
46+
- **Database**: Postgres via Docker Compose
47+
- **Auth**: Full OAuth 2.0 install/callback/token-refresh flow
48+
- **API client**: Pipedrive Node.js client wrapper
49+
- **Frontend** (optional): React App Extensions UI
50+
- Outputs `.env.example` and a Marketplace readiness checklist
51+
52+
PHP and MySQL/SQLite backends come after MVP.
53+
54+
## Core Modules
55+
56+
### OAuth (`backend/oauth/`)
57+
Full OAuth 2.0: app registration guidance, authorization redirect, callback handling, token exchange, token refresh, state validation.
58+
59+
### Database (`backend/database/`)
60+
Uses **Drizzle ORM** (`drizzle-orm` + `drizzle-kit`) for schema definition and migrations. Drizzle is chosen because it supports Postgres, MySQL, and SQLite with the same TypeScript API — matching the three database options the CLI offers — and produces readable schema files with no codegen step.
61+
62+
Structure:
63+
- `schema.ts` — Drizzle table definitions (tenants, oauth_tokens, installations)
64+
- `migrations/` — SQL migration files managed by `drizzle-kit`
65+
- `db.ts` — driver setup (selects `postgres-js`, `mysql2`, or `better-sqlite3` based on the chosen DB)
66+
67+
Key packages: `drizzle-orm`, `drizzle-kit`, and the appropriate driver for the selected database.
68+
69+
### Pipedrive API client (`backend/pipedrive-client/`)
70+
Wrapper around the official Pipedrive Node.js client with preconfigured authentication and helpers for common API calls.
71+
72+
### App Extensions frontend (`frontend/app-extension-ui/`)
73+
Only generated when the user opts in. Iframe-based UI using the App Extensions SDK, supporting: initialization, resizing, modals, notifications/snackbars, theme handling.
74+
75+
## Development
76+
77+
To test app generation locally:
78+
79+
```bash
80+
npx tsx src/cli.ts app
81+
```
82+
83+
This creates an `app/` directory in the repo root (gitignored via `*-app/`).
84+
85+
## AI Plugin Commands (future layer)
86+
87+
```
88+
/pipedrive-new-app
89+
/pipedrive-add-oauth
90+
/pipedrive-add-app-extension
91+
/pipedrive-review-marketplace-readiness
92+
```

eslint.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
4+
export default tseslint.config(
5+
eslint.configs.recommended,
6+
...tseslint.configs.recommended,
7+
{
8+
ignores: ['dist/**'],
9+
},
10+
{
11+
rules: {
12+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
13+
},
14+
},
15+
);

0 commit comments

Comments
 (0)