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
10 changes: 5 additions & 5 deletions .claude/skills/architecture/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: architecture
description: Monorepo structure, dependency graph, domain boundaries, and package-level constraints for the Confidence CLI project
version: '0.4'
version: '0.5'
---

# Architecture Guidelines
Expand All @@ -12,9 +12,9 @@ Structural rules, domain boundaries, and constraints for the Confidence CLI mono

| Package | Published | Purpose |
| ------------------------- | --------- | -------------------------------------------------------------------------------------------------------- |
| `packages/shared-kernel/` | No | Cross-domain types and `noop` helper |
| `packages/shared-kernel/` | No | Cross-domain types and helpers (`noop`, `isDefined`). No runtime deps |
| `packages/eslint-config/` | No | Shared ESLint config (base + react presets) |
| `packages/core/` | No | Shared infrastructure (auth, session, telemetry, exec, system, sdk, frameworks, integrations, providers) |
| `packages/core/` | No | Shared infrastructure (api, auth, config, session, telemetry, exec, system, sdk, mcp, frameworks, integrations, providers) |
| `packages/testing/` | No | Test infrastructure (sub-paths: `/auth`, `/scaffold`, `/env`, `/terminal`, `/msw`, `/e2e`) |
| `packages/quickstart/` | Yes | TUI wizard — `@spotify-confidence/quickstart` |
| `packages/cli/` | Yes | CLI — `@spotify-confidence/cli` |
Expand All @@ -41,8 +41,8 @@ import { buildTestJwt } from '@spotify-confidence/testing/auth';

| Package | Aliases |
| ---------- | ----------------------------------------------------------------- |
| quickstart | `@commands/*`, `@features/*`, `@ui/*` |
| cli | `@commands/*`, `@features/*`, `@output/*`, `@network/*` |
| quickstart | `@commands/*`, `@features/*`, `@ui/*` |
| cli | `@commands/*`, `@features/*`, `@input/*`, `@output/*`, `@network/*`, `@utils/*`, `@meta` |
| core | Relative imports in `src/`; tsconfig aliases in `__tests__/` only |

## Domain Boundaries
Expand Down
15 changes: 12 additions & 3 deletions .claude/skills/cli/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: cli
description: Structure, commands, output formatting, and conventions for the packages/cli/ package
version: '0.2'
version: '0.3'
---

# CLI Package
Expand All @@ -20,17 +20,25 @@ Each command exports a yargs command object:
export const exampleCommand = {
command: 'example',
describe: 'One-line description',
builder(yargs: Argv) { ... }, // optional — for subcommands or extra options
builder(yargs: Argv) { ... },
async handler(argv: Record<string, unknown>) { ... },
};
```

For parent commands with subcommands, use `noop` from `@spotify-confidence/shared-kernel` as the empty builder, not `() => {}`.

### Command Types

- **Standalone** — `login`, `logout`, `whoami`, `config` — directly perform their action
- **Standalone** — `login`, `logout`, `whoami`, `config`, `update` — directly perform their action
- **API commands** — `flags`, `events`, `recordings`, `docs` — CRUD operations against Confidence APIs via `@network/*`
- **Integration** — `mcp`, `plugin`, `sdk`, `migrate` — manage IDE tooling and SDK setup
- **Setup** — `flags setup`, `events setup`, `recordings setup` — delegate to quickstart TUI with pre-selected features
- **TUI launcher** — `quickstart` — launches the full interactive wizard

### Path Aliases

`@commands/*`, `@features/*`, `@input/*`, `@output/*`, `@network/*`, `@utils/*`, `@meta` — use these for cross-domain imports within the CLI package.

## Output Formatting

All structured output goes through `src/output/`:
Expand All @@ -50,3 +58,4 @@ Commands never call `JSON.stringify` directly.
- Commands must not contain UI rendering logic — delegate to quickstart for TUI flows.
- Auth logic lives in `@spotify-confidence/core`, not in command handlers.
- The CLI must not import from quickstart's internal modules — only from its public `startTui` export.
- Use `noop` from `@spotify-confidence/shared-kernel` for empty yargs builders, not `() => {}`.
12 changes: 6 additions & 6 deletions .claude/skills/ink-tui/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: ink-tui
description: Develop and modify the Ink-based terminal UI in the packages/quickstart/ package
version: '0.2'
version: '0.3'
---

# Ink TUI Skill
Expand All @@ -16,16 +16,16 @@ The TUI follows a **reactive session-driven pattern**: the rendered screen deriv

- **WizardSession** (`packages/core/src/session/session.ts`) — Source of truth for wizard state
- **WizardStore** (`packages/quickstart/src/ui/store.ts`) — Nanostores-backed reactive store with explicit setters
- **WizardRouter** (`packages/quickstart/src/ui/router.ts`) — Declarative sequence-based navigation
- **WizardRouter** (`packages/quickstart/src/ui/router.ts`) — State-machine navigation using transition map
- **ScreenContainer** (`packages/quickstart/src/ui/components/ScreenContainer.tsx`) — Root layout orchestrating screens
- **Screen Registry** (`packages/quickstart/src/ui/screen-registry.tsx`) — Factory mapping ScreenId to components

## Adding a Screen

1. Create the component in `packages/quickstart/src/ui/screens/YourScreen.tsx`
1. Create subdir in `packages/quickstart/src/ui/screens/` with component + barrel `index.ts` + collocated slice files (`telemetry-events.ts`, `log-messages.ts`, `actions.ts` as needed)
2. Add a `ScreenId` entry in `packages/core/src/session/session.ts`
3. Register the mapping in `packages/quickstart/src/ui/screen-registry.tsx`
4. Add to the sequence in `packages/quickstart/src/ui/screen-sequences.ts`
4. Add transitions in `packages/quickstart/src/ui/screen-transitions.ts`

No other files need changes.

Expand All @@ -47,9 +47,9 @@ For display-only state:

Reusable building blocks and composites: `TextBlock`, `Divider`, `KeyboardHintsBar`, `ScreenContainer`, `TitleBar`, etc. Barrel-exported from `index.ts`.

### Theme (`packages/quickstart/src/ui/styles.ts`)
### Theme (`packages/quickstart/src/ui/theme/`)

Shared constants: `Colors`, `Icons`, `HAlign`, `VAlign`. Import from here for consistent styling.
Split into `colors.ts`, `icons.ts`, `layout.ts`, re-exported via `ui/styles.ts`. Exports: `Colors`, `Icons`, `Emoji`, `HAlign`, `VAlign`. Import from `styles.ts` for consistent styling.

## Key Dependencies

Expand Down
25 changes: 21 additions & 4 deletions .claude/skills/integrations/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: integrations
description: IDE integration strategy pattern and guidelines for the packages/core/src/integrations/ module
version: '0.4'
version: '0.5'
---

# IDE Integrations Guidelines
Expand All @@ -14,18 +14,35 @@ Each supported IDE (Claude Code, Cursor, Codex) is a self-contained `IdeIntegrat

Every IDE implements the `IdeIntegration` interface: `id`, `name`, `launchChat()`, `runOnboarding()`, `detectPlugins()`, `installPlugins()`, `detectMcpStatuses()`, `connectMcpServer()`. See the type definition in `types.ts` for the full contract.

Thin orchestrators (`chat.ts`, `plugins.ts`) resolve the strategy via `getIntegration(ide)` and delegate.
Thin orchestrators (`chat.ts`) resolve the strategy via `getIntegration(ide)` and delegate.

## Module Structure

| Path | Purpose |
| ----------------- | -------------------------------------------------------------------- |
| `claude/` | Claude Code integration (paths, plugins, mcp, chat, onboarding, prepare) |
| `cursor/` | Cursor integration (same file structure) |
| `codex/` | Codex integration (same file structure) |
| `mcp/` | Shared MCP server definitions, config, preference |
| `skills/` | Skill file management (local installation, plugin-based delivery) |
| `chat.ts` | Orchestrator — resolves IDE strategy and delegates chat launch |
| `registry.ts` | `INTEGRATIONS` array and `getIntegration()` lookup |
| `types.ts` | `IdeIntegration` interface and related types |
| `constants.ts` | Shared integration constants |
| `stream-json.ts` | JSON streaming utilities for IDE exec output |
| `version.ts` | IDE version detection |
| `utils.ts` | Shared integration helpers |

## Hard Constraints

- **IDE subdirs are self-contained** — no imports from other IDE subdirs. Each is split into `paths.ts`, `plugins.ts`, `mcp.ts`, and `index.ts`. May import from `../types.js`, `../mcp/servers.js`, `../shared.js` — never from `../registry.js` or each other.
- **IDE subdirs are self-contained** — no imports from other IDE subdirs. Each contains `paths.ts`, `plugins.ts`, `mcp.ts`, `chat.ts`, `onboarding.ts`, `prepare.ts`, and `index.ts`. May import from `../types.js`, `../mcp/servers.js` — never from `../registry.js` or each other.
- **No switch-on-IDE outside strategies** — code outside `integrations/` must not branch on `IdeId`. Use `getIntegration(ide)` and call strategy methods.
- **Dependency direction** — integrations imports from `shared-kernel` and other core modules, never from `quickstart/` or `cli/`.
- **Clean-dev script** — when changing MCP-related code, verify `scripts/clean-dev-env.sh` still cleans up correctly. Update it when adding a new IDE.

## Adding a New IDE

1. Create `packages/core/src/integrations/<ide-name>/index.ts` with `paths.ts`, `plugins.ts`, `mcp.ts`
1. Create `packages/core/src/integrations/<ide-name>/` with `index.ts`, `paths.ts`, `plugins.ts`, `mcp.ts`, `chat.ts`, `onboarding.ts`, `prepare.ts`
2. Export a `const <name>Integration: IdeIntegration`
3. Add to the `INTEGRATIONS` array in `registry.ts`
4. Update `scripts/clean-dev-env.sh`
Expand Down
26 changes: 16 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ pnpm workspace with six packages under `packages/`:

| Package | Published | Purpose |
| ------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `packages/shared-kernel/` | No (private) | Cross-domain types (`AuthState`, `IdeId`, `OnboardingGoal`, etc.) and `noop`. No runtime dependencies. |
| `packages/shared-kernel/` | No (private) | Cross-domain types (`AuthState`, `IdeId`, `OnboardingGoal`, etc.) and helpers (`noop`, `isDefined`). No runtime dependencies. |
| `packages/eslint-config/` | No (private) | Shared ESLint configuration. Exports base preset and `/react` preset with React Hooks rules. |
| `packages/core/` | No (private) | Shared infrastructure — auth, session, telemetry, exec, system, sdk, utils, constants, frameworks, integrations, providers. Depends on `shared-kernel`. |
| `packages/testing/` | No (private) | Test infrastructure — auth scaffolds, project scaffolds, env helpers, terminal helpers, MSW handlers. Sub-path exports: `/auth`, `/scaffold`, `/env`, `/terminal`, `/msw`. Depends on `shared-kernel`. |
| `packages/core/` | No (private) | Shared infrastructure — api, auth, config, session, telemetry, exec, system, sdk, mcp, utils, constants, frameworks, integrations, providers. Depends on `shared-kernel`. |
| `packages/testing/` | No (private) | Test infrastructure — auth scaffolds, project scaffolds, env helpers, terminal helpers, MSW handlers. Sub-path exports: `/auth`, `/scaffold`, `/env`, `/terminal`, `/msw`, `/e2e`. Depends on `shared-kernel`. |
| `packages/quickstart/` | Yes (`@spotify-confidence/quickstart`) | Interactive TUI wizard. Depends on `core` and `shared-kernel`. |
| `packages/cli/` | Yes (`@spotify-confidence/cli`) | CLI for managing Confidence (flags, events, recordings, config). Depends on `quickstart`. |

Expand All @@ -28,17 +28,20 @@ shared-kernel (types-only leaf)

### packages/core/ modules

- **`api/`** — HTTP client, types, and base request helpers for Confidence APIs
- **`auth/`** — OAuth PKCE flow + token persistence
- **`config/`** — Persistent CLI configuration (read/write/reset)
- **`session/`** — WizardSession state, ScreenId enum, createSession
- **`telemetry/`** — Analytics + session tracking
- **`exec/`** — Running external commands (spawn, execFile, resolveBin)
- **`system/`** — Environment vars, filesystem helpers, system checks
- **`sdk/`** — SDK metadata + options
- **`utils/`** — Generic utilities (addIf, interpolate)
- **`mcp/`** — MCP client and server type definitions
- **`utils/`** — Generic utilities (prompt-utils, semver)
- **`constants.ts`** — Confidence URLs + env-derived values
- **`frameworks/`** — Framework detection (react, nextjs, node, go, java, kotlin, python, swift)
- **`integrations/`** — IDE integration strategies (claude, cursor, codex) + MCP, plugins, chat
- **`providers/`** — Provider detection (Statsig, Eppo, PostHog, Optimizely)
- **`integrations/`** — IDE integration strategies (claude, cursor, codex) + MCP, skills, chat
- **`providers/`** — Provider detection (Statsig, Eppo, PostHog, Optimizely) + dependency scanners

### packages/quickstart/ structure

Expand All @@ -50,9 +53,12 @@ shared-kernel (types-only leaf)
### packages/cli/ structure

- **`bin/cli.ts`** — Entry point (yargs, `confidence` binary)
- **`src/commands/`** — Command definitions (login, logout, whoami, config, flags, events, recordings, quickstart)
- **`src/features/`** — Feature implementations (config management, quickstart launcher)
- **`src/commands/`** — Command definitions (login, logout, whoami, config, flags, events, recordings, docs, mcp, plugin, sdk, migrate, update, quickstart)
- **`src/features/`** — Feature implementations (config, docs, events, flags, ide, mcp, migrate, plugin, quickstart, recordings, sdk, update)
- **`src/input/`** — Input parsing (file reading, aliases, resolve)
- **`src/output/`** — Output formatters (json, table, format detection)
- **`src/network/`** — API clients (flags, events, recordings, docs, config, registry)
- **`src/utils/`** — Shared utilities (auth, safely, telemetry, validation)

## Key Patterns

Expand Down Expand Up @@ -120,9 +126,9 @@ The stable `node-pty` release (v1.1.0) doesn't ship prebuilt binaries for Node.j

- **Cross-package imports** use npm package names: `import { authenticate } from '@spotify-confidence/core'`, `import type { IdeId } from '@spotify-confidence/shared-kernel'`.
- **Within quickstart**, use path aliases (`@commands/*`, `@features/*`, `@ui/*`) for cross-domain imports. Keep relative imports within the same domain.
- **Within cli**, use path aliases (`@commands/*`, `@features/*`, `@output/*`, `@network/*`) for cross-domain imports. Keep relative imports within the same domain.
- **Within cli**, use path aliases (`@commands/*`, `@features/*`, `@input/*`, `@output/*`, `@network/*`, `@utils/*`, `@meta`) for cross-domain imports. Keep relative imports within the same domain.
- **Within core source** (`packages/core/src/`), use relative imports. Core's `__tests__/` may use tsconfig path aliases (`@auth/*`, `@integrations/*`, etc.).
- **Test imports** from `@spotify-confidence/testing` use sub-path exports: `@spotify-confidence/testing/auth`, `@spotify-confidence/testing/scaffold`, `@spotify-confidence/testing/env`, `@spotify-confidence/testing/terminal`.
- **Test imports** from `@spotify-confidence/testing` use sub-path exports: `@spotify-confidence/testing/auth`, `@spotify-confidence/testing/scaffold`, `@spotify-confidence/testing/env`, `@spotify-confidence/testing/terminal`, `@spotify-confidence/testing/e2e`.
- Use `@inkjs/ui` components over standalone `ink-*` packages.
- Screens go in `packages/quickstart/src/ui/screens/` (as slices), reusable components in `components/`.
- Shared modules (`hooks/`, `lib/`, `components/`) must never import from screen slices. If a type is needed by both, put it in `ui/lib/`.
Expand Down
Loading
Loading