Skip to content

Commit 1606f07

Browse files
anatoly314claude
andcommitted
docs: fix cli import path and document missing subsystems
- Fix broken `import { cli } from '@/cli'` example — actual path is `@/cli/cli-output` (the `cli.ts` file and `cli/` directory coexist; nodenext resolution picks the file). - Add `services/ngrok.service.ts`, `http/guards/`, and the missing `tunnel/{in-memory.transport.ts,tunnel.protocol.ts}` to the Core Files map. - Note the root-level `src/__tests__/` directory under Test Organization. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bce6727 commit 1606f07

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

CLAUDE.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,17 @@ src/
5858
├── main-tunnel.ts # Tunnel bootstrap: auth commands + WebSocket tunnel
5959
├── app.module.ts # Root module with forStdio()/forHttp()/forTunnel() factories
6060
├── bootstrap.ts # Shared logger setup (pino → NestJS LoggerService)
61-
├── cli.ts # Commander CLI with subcommands: default (server), --tunnel, --login, --logout
61+
├── cli.ts # Commander entrypoint: option parsing, subcommand dispatch
62+
├── cli/cli-output.ts # User-facing print helpers (cli.success/error/info/box) — separate from cli.ts so non-CLI code can use it without pulling in Commander
6263
├── app-config.service.ts # IAnkiConfig implementation (reads from validated AppConfig)
6364
├── config/ # Zod-validated config system (schema, factory, APP_CONFIG token)
65+
├── services/ngrok.service.ts # Optional ngrok subprocess for HTTP-mode public tunneling
66+
├── http/guards/ # HTTP-only guards (Origin allowlist)
6467
├── tunnel/ # Tunnel mode: WebSocket client, OAuth device flow, credentials
6568
│ ├── tunnel.client.ts # WebSocket client for tunnel server
6669
│ ├── tunnel-mcp.service.ts # Bridges MCP ↔ tunnel via InMemoryTransport
70+
│ ├── in-memory.transport.ts # MCP transport that connects to TunnelClient in-process
71+
│ ├── tunnel.protocol.ts # WS message type definitions (request/response/ping/error)
6772
│ ├── device-flow.service.ts # OAuth device flow authentication
6873
│ ├── credentials.service.ts # Persistent credential storage
6974
│ └── commands/ # CLI command handlers (login, logout, tunnel)
@@ -138,7 +143,7 @@ These are upstream behaviors that shape tool design — surface them in tool des
138143

139144
1. **CLI Output** (user-facing, clean, no timestamps):
140145
```typescript
141-
import { cli } from '@/cli';
146+
import { cli } from '@/cli/cli-output';
142147

143148
cli.success('Connected to Anki'); // ✓ Connected to Anki
144149
cli.error('Connection failed'); // ✗ Connection failed
@@ -211,6 +216,8 @@ See `src/mcp/primitives/essential/tools/sync.tool.ts` for minimal example.
211216
Three distinct tiers — pick the right one for the change:
212217

213218
- **Unit**`src/**/__tests__/*.spec.ts`, colocated with source. Mock `AnkiConnectClient`. Fast, run on every push.
219+
- Tool-level tests live next to each tool (e.g. `src/mcp/primitives/essential/tools/__tests__/`).
220+
- App-level wiring tests live in `src/__tests__/` (`app-config.service.spec.ts`, `cli.spec.ts`, `main-http.spec.ts`) — bootstrap, CLI parsing, config validation.
214221
- **Workflows**`test/workflows/*.spec.ts` (e.g., `note-management.spec.ts`, `review-session.spec.ts`). Multi-tool scenarios still against a mocked client. Use for cross-tool invariants.
215222
- **E2E**`test/e2e/*.e2e-spec.ts`. Hits a real Anki + AnkiConnect running in Docker. Covers both STDIO and HTTP transports.
216223

0 commit comments

Comments
 (0)