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
79 changes: 79 additions & 0 deletions .cursor/rules/derived-cursor-rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
description: Cursor rules derived by SpecStory from the project AI interaction history
globs: *
---

## PROJECT OVERVIEW
This project is a Node.js based CLI tool. The source code is written in TypeScript.

## CODE STYLE
Adhere to standard TypeScript coding conventions. Use Prettier for formatting.

## FOLDER ORGANIZATION
The project follows a standard structure:
- `src`: Source code.
- `test`: Unit tests.
- `cli`: Contains the CLI application's entry point and related files.


## TECH STACK
- Node.js
- TypeScript
- npm
- shx (used in build script)
- OCLIF (used for CLI framework)
- zod (added 2025-03-12)


## PROJECT-SPECIFIC STANDARDS
- All commands should be defined in the `src/commands` directory.
- Unit tests should be written for every command. Tests should accurately reflect command functionality. Avoid simple string matching in tests; instead verify behavior.
- The `package.json` file should clearly define the entry point for the CLI.
- Avoid using `any` type; explicitly define types for all variables to prevent runtime errors. (Added 2025-03-12)
- Interface properties should be sorted alphabetically to satisfy `perfectionist/sort-object-types` linting rule. (Added 2025-03-12)


## WORKFLOW & RELEASE RULES
- Before running the CLI, build the TypeScript code using `npm run build`.
- Version updates will be managed using semantic versioning. (Further details on versioning strategy needed)
- To resolve TypeScript errors and missing modules, follow the steps outlined in `2025-03-12_14-21-fixing-typescript-errors-and-missing-modules.md`. This includes installing `zod` and correctly typing variables to avoid `'value' is of type 'unknown'` errors. The `npm install zod` command will install the necessary dependency. Type assertions like `as [string, EnvVariable][]` may be necessary to resolve type errors related to 'unknown' types.
- To run tests, use `npm run test`. Tests should be updated to reflect actual command behavior, not simple string matching. Remove tests for commands that do not exist. Use `npm run lint -- --fix` to automatically fix many linting errors. To run tests without linting, use `npm test --no-posttest`.
- Address deprecation warnings related to `fs.Stats` constructor.


## REFERENCE EXAMPLES
- Running the CLI from source: See instructions in `2025-03-11_12-54-running-a-package-from-source-instructions.md`
- Fixing TypeScript errors and missing modules: See `2025-03-12_14-21-fixing-typescript-errors-and-missing-modules.md`
- Fixing type issues in `uninstall.ts`: See `2025-03-12_15-33-fixing-type-issues-in-uninstall-ts.md`


## PROJECT DOCUMENTATION & CONTEXT SYSTEM
Documentation will be maintained using markdown files and integrated into the repository.

## DEBUGGING
- Ensure the TypeScript code is built (`npm run build`) before running the CLI.
- The error "command i not found" indicates that the TypeScript code needs to be compiled.
- `'value' is of type 'unknown'` errors in TypeScript indicate improperly typed variables. Refer to `2025-03-12_14-21-fixing-typescript-errors-and-missing-modules.md` for solutions.
- Missing module errors (e.g., "Cannot find module 'zod'") indicate missing dependencies. Use `npm install` to install required packages.
- Test failures often indicate a mismatch between test expectations and actual command output. Refactor tests to reflect actual command behavior.
- Deprecation warnings related to `fs.Stats` constructor indicate outdated code. Update the relevant code sections.
- Use `npm run lint -- --fix` to automatically fix many linting errors.
- `any` type errors indicate a need for explicit type definitions. Properly type variables to resolve these errors. (Added 2025-03-12)
- `perfectionist/sort-object-types` linting errors indicate improperly ordered object properties. Ensure properties are alphabetically ordered. (Added 2025-03-12)


## FINAL DOs AND DON'Ts
- **DO** use TypeScript.
- **DO** write unit tests that accurately reflect command functionality.
- **DO** build the project using `npm run build` before running.
- **DO** follow the folder organization guidelines.
- **DO** install all necessary dependencies using `npm install`.
- **DO** explicitly define types for all variables to avoid runtime errors. (Added 2025-03-12)
- **DO** sort object properties alphabetically to satisfy linting rules. (Added 2025-03-12)
- **DON'T** run the CLI without building the TypeScript code first.
- **DON'T** leave variables untyped; ensure proper type declarations to avoid runtime errors.
- **DON'T** write tests that rely on simple string matching of command output. Focus on verifying actual command behavior.
- **DON'T** ignore deprecation warnings; address them promptly to maintain code quality and avoid future compatibility issues.
- **DON'T** ignore linting errors; address them using `npm run lint -- --fix` or manually.
- **DON'T** use `any` type unless absolutely necessary and with clear justification. (Added 2025-03-12)
- **DON'T** leave object properties unsorted; maintain alphabetical order for consistency and to satisfy linting rules. (Added 2025-03-12)
2 changes: 2 additions & 0 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore SpecStory derived-cursor-rules.mdc backup files
.specstory/cursor_rules_backups/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ yarn.lock
pnpm-lock.yaml
*.tsbuildinfo
.vscode/
.specstory
158 changes: 152 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
"dependencies": {
"@inquirer/prompts": "^7.2.1",
"@oclif/core": "^4",
"@oclif/plugin-help": "^6"
"@oclif/plugin-help": "^6",
"sinon": "^19.0.2",
"zod": "^3.24.2"
},
"devDependencies": {
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^4",
"@types/chai": "^4",
"@types/mocha": "^10",
"@types/node": "^18",
"@types/sinon": "^17.0.4",
"chai": "^4",
"eslint": "^8",
"eslint-config-oclif": "^5",
Expand All @@ -27,7 +30,7 @@
"oclif": "^4",
"shx": "^0.3.3",
"ts-node": "^10",
"typescript": "^5"
"typescript": "~5.3.3"
},
"engines": {
"node": ">=18.0.0"
Expand Down
Loading
Loading