Skip to content

Commit 016a269

Browse files
authored
chore: clean up (#108)
* chore: use `noop` for empty builders * chore: clean up transient files * chore: update skills and agents.md * chore: prettier
1 parent c318422 commit 016a269

11 files changed

Lines changed: 123 additions & 1017 deletions

File tree

‎.claude/skills/architecture/SKILL.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: architecture
33
description: Monorepo structure, dependency graph, domain boundaries, and package-level constraints for the Confidence CLI project
4-
version: '0.4'
4+
version: '0.5'
55
---
66

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

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

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

4848
## Domain Boundaries

‎.claude/skills/cli/SKILL.md‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: cli
33
description: Structure, commands, output formatting, and conventions for the packages/cli/ package
4-
version: '0.2'
4+
version: '0.3'
55
---
66

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

28+
For parent commands with subcommands, use `noop` from `@spotify-confidence/shared-kernel` as the empty builder, not `() => {}`.
29+
2830
### Command Types
2931

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

38+
### Path Aliases
39+
40+
`@commands/*`, `@features/*`, `@input/*`, `@output/*`, `@network/*`, `@utils/*`, `@meta` — use these for cross-domain imports within the CLI package.
41+
3442
## Output Formatting
3543

3644
All structured output goes through `src/output/`:
@@ -50,3 +58,4 @@ Commands never call `JSON.stringify` directly.
5058
- Commands must not contain UI rendering logic — delegate to quickstart for TUI flows.
5159
- Auth logic lives in `@spotify-confidence/core`, not in command handlers.
5260
- The CLI must not import from quickstart's internal modules — only from its public `startTui` export.
61+
- Use `noop` from `@spotify-confidence/shared-kernel` for empty yargs builders, not `() => {}`.

‎.claude/skills/ink-tui/SKILL.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: ink-tui
33
description: Develop and modify the Ink-based terminal UI in the packages/quickstart/ package
4-
version: '0.2'
4+
version: '0.3'
55
---
66

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

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

2323
## Adding a Screen
2424

25-
1. Create the component in `packages/quickstart/src/ui/screens/YourScreen.tsx`
25+
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)
2626
2. Add a `ScreenId` entry in `packages/core/src/session/session.ts`
2727
3. Register the mapping in `packages/quickstart/src/ui/screen-registry.tsx`
28-
4. Add to the sequence in `packages/quickstart/src/ui/screen-sequences.ts`
28+
4. Add transitions in `packages/quickstart/src/ui/screen-transitions.ts`
2929

3030
No other files need changes.
3131

@@ -47,9 +47,9 @@ For display-only state:
4747

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

50-
### Theme (`packages/quickstart/src/ui/styles.ts`)
50+
### Theme (`packages/quickstart/src/ui/theme/`)
5151

52-
Shared constants: `Colors`, `Icons`, `HAlign`, `VAlign`. Import from here for consistent styling.
52+
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.
5353

5454
## Key Dependencies
5555

‎.claude/skills/integrations/SKILL.md‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: integrations
33
description: IDE integration strategy pattern and guidelines for the packages/core/src/integrations/ module
4-
version: '0.4'
4+
version: '0.5'
55
---
66

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

1515
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.
1616

17-
Thin orchestrators (`chat.ts`, `plugins.ts`) resolve the strategy via `getIntegration(ide)` and delegate.
17+
Thin orchestrators (`chat.ts`) resolve the strategy via `getIntegration(ide)` and delegate.
18+
19+
## Module Structure
20+
21+
| Path | Purpose |
22+
| ----------------- | -------------------------------------------------------------------- |
23+
| `claude/` | Claude Code integration (paths, plugins, mcp, chat, onboarding, prepare) |
24+
| `cursor/` | Cursor integration (same file structure) |
25+
| `codex/` | Codex integration (same file structure) |
26+
| `mcp/` | Shared MCP server definitions, config, preference |
27+
| `skills/` | Skill file management (local installation, plugin-based delivery) |
28+
| `chat.ts` | Orchestrator — resolves IDE strategy and delegates chat launch |
29+
| `registry.ts` | `INTEGRATIONS` array and `getIntegration()` lookup |
30+
| `types.ts` | `IdeIntegration` interface and related types |
31+
| `constants.ts` | Shared integration constants |
32+
| `stream-json.ts` | JSON streaming utilities for IDE exec output |
33+
| `version.ts` | IDE version detection |
34+
| `utils.ts` | Shared integration helpers |
1835

1936
## Hard Constraints
2037

21-
- **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.
38+
- **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.
2239
- **No switch-on-IDE outside strategies** — code outside `integrations/` must not branch on `IdeId`. Use `getIntegration(ide)` and call strategy methods.
2340
- **Dependency direction** — integrations imports from `shared-kernel` and other core modules, never from `quickstart/` or `cli/`.
2441
- **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.
2542

2643
## Adding a New IDE
2744

28-
1. Create `packages/core/src/integrations/<ide-name>/index.ts` with `paths.ts`, `plugins.ts`, `mcp.ts`
45+
1. Create `packages/core/src/integrations/<ide-name>/` with `index.ts`, `paths.ts`, `plugins.ts`, `mcp.ts`, `chat.ts`, `onboarding.ts`, `prepare.ts`
2946
2. Export a `const <name>Integration: IdeIntegration`
3047
3. Add to the `INTEGRATIONS` array in `registry.ts`
3148
4. Update `scripts/clean-dev-env.sh`

‎AGENTS.md‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ pnpm workspace with six packages under `packages/`:
88

99
| Package | Published | Purpose |
1010
| ------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
11-
| `packages/shared-kernel/` | No (private) | Cross-domain types (`AuthState`, `IdeId`, `OnboardingGoal`, etc.) and `noop`. No runtime dependencies. |
11+
| `packages/shared-kernel/` | No (private) | Cross-domain types (`AuthState`, `IdeId`, `OnboardingGoal`, etc.) and helpers (`noop`, `isDefined`). No runtime dependencies. |
1212
| `packages/eslint-config/` | No (private) | Shared ESLint configuration. Exports base preset and `/react` preset with React Hooks rules. |
13-
| `packages/core/` | No (private) | Shared infrastructure — auth, session, telemetry, exec, system, sdk, utils, constants, frameworks, integrations, providers. Depends on `shared-kernel`. |
14-
| `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`. |
13+
| `packages/core/` | No (private) | Shared infrastructure — api, auth, config, session, telemetry, exec, system, sdk, mcp, utils, constants, frameworks, integrations, providers. Depends on `shared-kernel`. |
14+
| `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`. |
1515
| `packages/quickstart/` | Yes (`@spotify-confidence/quickstart`) | Interactive TUI wizard. Depends on `core` and `shared-kernel`. |
1616
| `packages/cli/` | Yes (`@spotify-confidence/cli`) | CLI for managing Confidence (flags, events, recordings, config). Depends on `quickstart`. |
1717

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

2929
### packages/core/ modules
3030

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

4346
### packages/quickstart/ structure
4447

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

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

5763
## Key Patterns
5864

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

121127
- **Cross-package imports** use npm package names: `import { authenticate } from '@spotify-confidence/core'`, `import type { IdeId } from '@spotify-confidence/shared-kernel'`.
122128
- **Within quickstart**, use path aliases (`@commands/*`, `@features/*`, `@ui/*`) for cross-domain imports. Keep relative imports within the same domain.
123-
- **Within cli**, use path aliases (`@commands/*`, `@features/*`, `@output/*`, `@network/*`) for cross-domain imports. Keep relative imports within the same domain.
129+
- **Within cli**, use path aliases (`@commands/*`, `@features/*`, `@input/*`, `@output/*`, `@network/*`, `@utils/*`, `@meta`) for cross-domain imports. Keep relative imports within the same domain.
124130
- **Within core source** (`packages/core/src/`), use relative imports. Core's `__tests__/` may use tsconfig path aliases (`@auth/*`, `@integrations/*`, etc.).
125-
- **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`.
131+
- **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`.
126132
- Use `@inkjs/ui` components over standalone `ink-*` packages.
127133
- Screens go in `packages/quickstart/src/ui/screens/` (as slices), reusable components in `components/`.
128134
- Shared modules (`hooks/`, `lib/`, `components/`) must never import from screen slices. If a type is needed by both, put it in `ui/lib/`.

0 commit comments

Comments
 (0)