canina/docs/audit/03-baseline-command-plan.md
2026-08-06 20:54:44 +03:30

54 lines
4.8 KiB
Markdown

# Baseline Command Plan & Reconciled Command History
## Attempted Command Execution Log
| Attempted Command | Working Directory | Start Condition | Execution Status | Exit Code | Stdout Summary | Stderr Summary | Modified Files? | Final Classification | Reason for Success / Failure |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| `npm run lint` | `c:\Users\parsa\Desktop\work\caninairan` | Manual Invocation | Executed | 1 | None | `'tsc' is not recognized as an internal or external command` | No | REQUIRES INSTALLED DEPENDENCIES | Global `tsc` binary link missing in system shell PATH |
| `npx tsc --noEmit` | `c:\Users\parsa\Desktop\work\caninairan` | Manual Invocation | Executed | 1 | `This is not the tsc command you are looking for...` | None | No | REQUIRES INSTALLED DEPENDENCIES | `npx` attempted to execute uninstalled global tsc package wrapper |
| `.\node_modules\.bin\tsc --noEmit` | `c:\Users\parsa\Desktop\work\caninairan` | Manual Invocation | Executed | 1 | None | `The term '.\node_modules\.bin\tsc' is not recognized...` | No | REQUIRES INSTALLED DEPENDENCIES | Path syntax incompatible with Windows PowerShell binary resolution |
| `node .\node_modules\typescript\bin\tsc --noEmit` | `c:\Users\parsa\Desktop\work\caninairan` | Manual Invocation | Executed | 1 | None | `Cannot find module '...\node_modules\typescript\bin\tsc'` | No | REQUIRES INSTALLED DEPENDENCIES | Root `node_modules` lacks full local `typescript` package installation |
| `cmd /c "if exist .\node_modules\.bin\tsc.cmd ..."` | `c:\Users\parsa\Desktop\work\caninairan` | Manual Invocation | Executed | 0 | `NO_TSC_CMD` | None | No | REQUIRES INSTALLED DEPENDENCIES | Confirmed root `node_modules\.bin\tsc.cmd` does not exist |
| `cmd /c "if exist backend\node_modules\.bin\tsc.cmd ..."` | `c:\Users\parsa\Desktop\work\caninairan` | Background Task | Executed | 1 | None | `6 TypeScript Compilation Errors` (TS2322 in seed.ts, TS1272 in metrics.controller.ts, TS2339 in specs) | No | SAFE_NON_MUTATING | Successfully ran local backend TypeScript check using existing `backend/node_modules\.bin\tsc.cmd` |
---
## Package Scripts Safety Analysis
### Root `package.json` Scripts
| Script Name | Command | Purpose | Safety Classification | Notes / Mutation Risk |
| :--- | :--- | :--- | :--- | :--- |
| `dev` | `vite --port=5173 --host=0.0.0.0` | Launch Vite Dev Server | REQUIRES_LOCAL_SERVICES | Starts interactive network server |
| `build` | `vite build` | Production Bundle Build | GENERATES_OUTPUT | Writes bundle to `dist/` |
| `preview` | `vite preview` | Preview Production Build | REQUIRES_LOCAL_SERVICES | Starts local HTTP server |
| `clean` | `rm -rf dist server.js` | Remove Build Outputs | MUTATES_SOURCE | Deletes directories/files |
| `lint` | `tsc --noEmit` | Type Check Storefront | SAFE_NON_MUTATING | Non-mutating type check (requires local tsc) |
| `test` | `vitest run` | Single-run Unit Tests | SAFE_NON_MUTATING | Read-only unit test execution |
| `test:watch` | `vitest` | Watch-mode Unit Tests | SAFE_NON_MUTATING | Interactive test runner |
### Backend `backend/package.json` Scripts
| Script Name | Command | Purpose | Safety Classification | Notes / Mutation Risk |
| :--- | :--- | :--- | :--- | :--- |
| `build` | `nest build` | Build NestJS App | GENERATES_OUTPUT | Writes build files to `backend/dist/` |
| `format` | `prettier --write "src/**/*.ts" "test/**/*.ts"` | Auto-format Code | MUTATES_SOURCE | Contains `--write` flag (Mutates source code) |
| `start` | `nest start` | Start Backend App | REQUIRES_LOCAL_SERVICES | Spawns server process |
| `start:dev` | `nest start --watch` | Dev Server Watch Mode | REQUIRES_LOCAL_SERVICES | Interactive process |
| `start:prod` | `node dist/main` | Run Production Build | REQUIRES_LOCAL_SERVICES | Requires compiled `dist/main` |
| `lint` | `eslint "{src,apps,libs,test}/**/*.ts" --fix` | Lint and Auto-fix | MUTATES_SOURCE | Contains `--fix` flag (Mutates source code) |
| `test` | `jest` | Run Backend Unit Tests | SAFE_NON_MUTATING | Read-only test execution |
| `test:watch` | `jest --watch` | Watch-mode Unit Tests | SAFE_NON_MUTATING | Interactive process |
| `test:cov` | `jest --coverage` | Test Coverage Report | GENERATES_OUTPUT | Writes coverage report to `backend/coverage/` |
| `test:e2e` | `jest --config ./test/jest-e2e.json` | E2E Integration Tests | REQUIRES_LOCAL_SERVICES | Requires active PostgreSQL database |
| `prisma:seed` | `ts-node prisma/seed.ts` | Seed Database | MUTATES_SOURCE / REQUIRES_LOCAL_SERVICES | Modifies database records |
---
## Permitted Safe Checks for Phase 2
The following commands are non-mutating and safe to execute during Phase 2 validation:
1. `git rev-parse HEAD`
2. `git branch --show-current`
3. `git status --short --branch`
4. `node --version`
5. `npm --version`
6. `cmd /c "backend\node_modules\.bin\tsc.cmd --noEmit -p backend\tsconfig.json"`