원클릭으로
subtrack-rules
When working on the subtrack project, editing source code, running tests, or managing dependencies
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
When working on the subtrack project, editing source code, running tests, or managing dependencies
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | subtrack-rules |
| description | When working on the subtrack project, editing source code, running tests, or managing dependencies |
subtrack is a Node.js CLI tool for managing subscription services from the terminal. Written in TypeScript, it stores data in SQLite and provides interactive prompts for CRUD operations.
pnpm add <package> instead of npm install <package> or bun add <package>pnpm remove <package> instead of npm uninstall <package> or bun remove <package>pnpm update instead of npm update or bun updatepnpm run <script> or pnpm <script> instead of npm run or bun runpnpmx <package> instead of npx or bunxapps/subtrack/ directory (monorepo root has no deps)tsx src/index.tstsdown (configured as pnpm build)pnpm lint:types (tsc --noEmit)bun or node --loader for running TypeScript directlyapps/subtrack/dist/index.mjsvitest (pnpm test or vitest run)*.test.tspnpm test:watch for watch mode__setDb() from db.ts to inject an in-memory SQLite database for testsconsola via consola.mockTypes() for output assertions (see display.test.ts)globalThis.fetch for exchange rate API testssql.js (WASM-based SQLite) — not better-sqlite3, sqlite3, or bun:sqliteimport initSqlJs from "sql.js" and import type { Database, SqlValue, BindParams } from "sql.js"$SUBSC_CLI_DB_DIR env var or ~/.config/subtrack/subtrack.db_db) and persisted to disk via saveDb() on writessubscriptions, tags, subscription_tags (many-to-many)BEGIN TRANSACTION / COMMIT / ROLLBACK)PRAGMA foreign_keys = ON at connection timeThe source code (subtrack/src/) follows a 4-layer separation:
| Layer | File | Responsibility |
|---|---|---|
| Entry | index.ts | CLI definition (commander), command routing |
| Commands | commands.ts | Command handlers, workflow logic, user interaction |
| Database | db.ts | SQLite CRUD, schema, persistence, __setDb() for testing |
| Display | display.ts | Table rendering with cli-table3, FX rate conversion |
| Prompts | prompts.ts | Input validation, interactive prompts, shared choices |
Keep concerns separated. Don't put DB queries in display logic or prompt logic in command handlers.
node: prefix for Node.js built-ins: import { readFileSync } from "node:fs", import path from "node:path", import { homedir } from "node:os".ts extension in local imports: import { handleList } from "./commands.ts"fetch for HTTP requestsWebSocket for WebSocket connections (if needed)type prefix for type-only imports: import type { SharedArgs } from "./db.ts"tsconfig.json)*.test.ts) excluded from tsconfig.json — type-checked separately by vitest"type": "module" in package.json)verbatimModuleSyntax: enforce correct import/value separationnoUncheckedIndexedAccess: disabled (codebase not compatible)Key packages and their purpose:
| Package | Usage |
|---|---|---|
| gunshi | CLI argument parsing (cli(), define(), .args, .run()) |
| @inquirer/prompts | Interactive prompts (input, confirm, checkbox, select) |
| consola | Logging (consola.info, consola.success, consola.error, consola.warn, consola.fail) |
| cli-table3 | Table rendering (customizable chars, styles, column widths) |
| picocolors | Terminal colors |
| sql.js | SQLite via WASM (new SQL.Database(), .run(), .exec()) |
| @types/node | Node.js type definitions (dev) |
typos (pnpm lint:typos or typos)nix fmt (nixfmt-rfc-style)SUBSC_CLI_DB_DIR: override database directory (default: ~/.config/subtrack/)subtrack.db (SQLite).env file or secrets management in this projectopen.er-api.com (USD base)