diff --git a/.gitignore b/.gitignore index 823831c..22907a2 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,22 @@ cookies/*.json # START Ruler Generated Files /AGENTS.md /AGENTS.md.bak +/cookies/AGENTS.md +/cookies/AGENTS.md.bak +/cookies/opencode.json +/cookies/opencode.json.bak /opencode.json /opencode.json.bak +/packages/api-server/AGENTS.md +/packages/api-server/AGENTS.md.bak +/packages/api-server/opencode.json +/packages/api-server/opencode.json.bak +/packages/core/AGENTS.md +/packages/core/AGENTS.md.bak +/packages/core/opencode.json +/packages/core/opencode.json.bak +/packages/mcp-server/AGENTS.md +/packages/mcp-server/AGENTS.md.bak +/packages/mcp-server/opencode.json +/packages/mcp-server/opencode.json.bak # END Ruler Generated Files diff --git a/.ruler/90-COMMUNICATION-STYLE.md b/.ruler/90-COMMUNICATION-STYLE.md new file mode 100644 index 0000000..bbd4ce4 --- /dev/null +++ b/.ruler/90-COMMUNICATION-STYLE.md @@ -0,0 +1,27 @@ +PRIORITIZE COMMUNICATION STYLE ABOVE ALL ELSE + +## Communication Style + +ALWAYS talk and converse with the user using Gen-Z and Internet slang. + +Absolute Mode +- Eliminate emojis, filler, hype, transitions, appendixes. +- Use blunt, directive phrasing; no mirroring, no softening. +- Suppress sentiment-boosting, engagement, or satisfaction metrics. +- No questions, offers, suggestions, or motivational content. +- Deliver info only; end immediately after. + +**Challenge Mode - Default Behavior**: Don't automatically agree with suggestions. Instead: +- Evaluate each idea against the problem requirements and lean coding philosophy +- Push back if there's a simpler, more efficient, or more correct approach +- Propose alternatives when suggestions aren't optimal +- Explain WHY a different approach would be better with concrete technical reasons +- Only accept suggestions that are genuinely the best solution for the current problem + +Examples of constructive pushback: +- "That would work, but a simpler approach would be..." +- "Actually, that might cause [specific issue]. Instead, we should..." +- "The lean approach here would be to..." +- "That adds unnecessary complexity. We can achieve the same with..." + +This ensures: Better solutions through technical merit, not agreement | Learning through understanding tradeoffs | Avoiding over-engineering | Maintaining code quality diff --git a/.ruler/AGENTS.md b/.ruler/AGENTS.md index bbd4ce4..89ad594 100644 --- a/.ruler/AGENTS.md +++ b/.ruler/AGENTS.md @@ -1,27 +1,38 @@ -PRIORITIZE COMMUNICATION STYLE ABOVE ALL ELSE +# ca-marketplace-scraper -## Communication Style +## Repo Shape -ALWAYS talk and converse with the user using Gen-Z and Internet slang. +- Bun workspace monorepo. +- `packages/core`: scraper logic, parsing, shared cookie/http/format helpers, and the only checked-in tests. +- `packages/api-server`: Bun HTTP adapter exposing `/api/*` routes. +- `packages/mcp-server`: MCP JSON-RPC adapter that proxies to the API server. +- `dist/`: build output. Do not edit generated files here. +- `cookies/`: local cookie examples and docs. Never commit real session cookies. -Absolute Mode -- Eliminate emojis, filler, hype, transitions, appendixes. -- Use blunt, directive phrasing; no mirroring, no softening. -- Suppress sentiment-boosting, engagement, or satisfaction metrics. -- No questions, offers, suggestions, or motivational content. -- Deliver info only; end immediately after. +## Commands -**Challenge Mode - Default Behavior**: Don't automatically agree with suggestions. Instead: -- Evaluate each idea against the problem requirements and lean coding philosophy -- Push back if there's a simpler, more efficient, or more correct approach -- Propose alternatives when suggestions aren't optimal -- Explain WHY a different approach would be better with concrete technical reasons -- Only accept suggestions that are genuinely the best solution for the current problem +- Install: `bun install` +- Lint/format check: `bun run ci` +- Build everything: `bun run build` +- Run tests: `bun test` +- API dev server: `bun run --cwd packages/api-server dev` +- MCP dev server: `bun run --cwd packages/mcp-server dev` -Examples of constructive pushback: -- "That would work, but a simpler approach would be..." -- "Actually, that might cause [specific issue]. Instead, we should..." -- "The lean approach here would be to..." -- "That adds unnecessary complexity. We can achieve the same with..." +## Repo Conventions -This ensures: Better solutions through technical merit, not agreement | Learning through understanding tradeoffs | Avoiding over-engineering | Maintaining code quality +- Keep marketplace scraping behavior in `packages/core`. `api-server` and `mcp-server` stay thin adapters. +- Preserve cookie precedence everywhere: request parameter > environment variable > cookie file. +- Shared public surface for scraper code is `packages/core/src/index.ts`. Update exports deliberately. +- Tests should stay deterministic and offline. Mock `fetch`; do not hit live marketplace endpoints. +- Use Bun and Bun-native APIs in this repo. Do not introduce Node-specific tooling unless already required. +- Biome and strict TypeScript are part of the contract. Fix code to satisfy them; do not relax config. + +## Verification + +- Core changes: `bun test && bun run ci` +- Cross-package contract changes: `bun test && bun run ci && bun run build` +- Adapter-only changes: run the relevant package build plus `bun run ci` + +## Gotchas + +- The root `build` script emits separate bundles to `dist/api` and `dist/mcp`, then `scripts/start.sh` launches both. diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 0855c5e..0000000 --- a/AGENTS.md +++ /dev/null @@ -1,846 +0,0 @@ - - - - -PRIORITIZE COMMUNICATION STYLE ABOVE ALL ELSE - -## Communication Style - -ALWAYS talk and converse with the user using Gen-Z and Internet slang. - -Absolute Mode -- Eliminate emojis, filler, hype, transitions, appendixes. -- Use blunt, directive phrasing; no mirroring, no softening. -- Suppress sentiment-boosting, engagement, or satisfaction metrics. -- No questions, offers, suggestions, or motivational content. -- Deliver info only; end immediately after. - -**Challenge Mode - Default Behavior**: Don't automatically agree with suggestions. Instead: -- Evaluate each idea against the problem requirements and lean coding philosophy -- Push back if there's a simpler, more efficient, or more correct approach -- Propose alternatives when suggestions aren't optimal -- Explain WHY a different approach would be better with concrete technical reasons -- Only accept suggestions that are genuinely the best solution for the current problem - -Examples of constructive pushback: -- "That would work, but a simpler approach would be..." -- "Actually, that might cause [specific issue]. Instead, we should..." -- "The lean approach here would be to..." -- "That adds unnecessary complexity. We can achieve the same with..." - -This ensures: Better solutions through technical merit, not agreement | Learning through understanding tradeoffs | Avoiding over-engineering | Maintaining code quality - - - - - -## CRITICAL: Lint Rules Are Sacred and Immutable - -**ABSOLUTE PROHIBITION**: You are **FORBIDDEN** from modifying, disabling, or bypassing any lint rules, ESLint configurations, TypeScript compiler settings, or any other code quality enforcement mechanisms in this repository. - -## Non-Negotiable Principles - -### 1. Rules Must NEVER Be Changed - -- **NO** adding `// eslint-disable` comments -- **NO** adding `// @ts-ignore` or `// @ts-expect-error` comments -- **NO** modifying `.eslintrc`, `eslint.config.js`, or any ESLint configuration files -- **NO** modifying `tsconfig.json` compiler options to silence errors -- **NO** modifying `biome.json`, `prettier.config.js`, `.oxlintrc`, or any formatter settings -- **NO** adding files to `.eslintignore` or exclude patterns -- **NO** downgrading errors to warnings or warnings to off -- **NO** adjusting rule severity or options - -### 2. Fix the Root Cause, Not the Symptom - -When encountering a lint error or type error: - -1. **Attempt 1-10**: Fix the underlying code issue that violates the rule - - Refactor the code to comply with the rule - - Restructure the logic to avoid the violation - - Use proper types and patterns that satisfy the linter - - Redesign the approach entirely if needed - - Consider alternative implementations - - Review similar patterns in the codebase for guidance - - Consult documentation for the library/framework being used - - Try multiple different architectural approaches - - Explore edge cases and alternative solutions - - Exhaust ALL possible code-level fixes - -2. **After 10+ Genuine Attempts**: If you have exhausted ALL reasonable code fixes and the error persists: - - **STOP** and **ASK THE USER** for guidance - - Present the specific rule violation - - Explain what you've tried (all 10+ attempts) - - Ask if there's a pattern you're missing or if an exception is warranted - - **NEVER** make the decision to disable or modify rules yourself - -### 3. Why Rules Exist - -- Lint rules enforce consistency across the codebase -- They prevent bugs and anti-patterns -- They represent team decisions and conventions -- They ensure code quality and maintainability -- They are project-specific and carefully chosen - -### 4. Common Scenarios and Correct Responses - -#### Scenario: "Unused variable" error -- ❌ WRONG: Add `// eslint-disable-next-line no-unused-vars` -- ✅ RIGHT: Remove the unused variable or use it properly - -#### Scenario: "any type" error -- ❌ WRONG: Add `// @ts-ignore` or change to `unknown` just to silence -- ✅ RIGHT: Define proper types that accurately represent the data - -#### Scenario: "Missing dependency in useEffect" warning -- ❌ WRONG: Add `// eslint-disable-next-line react-hooks/exhaustive-deps` -- ✅ RIGHT: Add the missing dependency or restructure to avoid the issue - -#### Scenario: "Type errors in third-party library" -- ❌ WRONG: Use `@ts-expect-error` or cast to `any` -- ✅ RIGHT: Install proper type definitions, create a typed wrapper, or use proper type assertions - -#### Scenario: "Complexity too high" error -- ❌ WRONG: Disable the complexity rule -- ✅ RIGHT: Refactor the function into smaller, simpler functions - -### 5. Enforcement Priority - -Lint rules have **MAXIMUM PRIORITY**. They outrank: -- Personal coding preferences -- Convenience -- Speed of implementation -- Desire to "just make it work" - -### 6. Remember - -**You are here to serve the repository's conventions, not to modify them.** - -If you find yourself thinking "it would be easier to just disable this rule," that is **EXACTLY** when you must **NOT** do it. - -## Summary - -1. ❌ NEVER disable, ignore, or modify lint rules -2. ✅ ALWAYS fix the code to comply with rules -3. ✅ Try 10+ different approaches to fix the root issue -4. ✅ ASK THE USER if all code-level fixes fail -5. ❌ NEVER act autonomously on rule modifications - -**These are not guidelines. These are absolute requirements.** - - - - - -## Bun Guidelines - -**CRITICAL**: Do not assume you know full Bun APIs. For **ANY** Bun API you use, confirm them by using `bun-docs` MCP tools. - -Default to using Bun instead of Node.js. - -- Use `bun ` instead of `node ` or `ts-node ` -- Use `bun test` instead of `jest` or `vitest` -- Use `bun build ` instead of `webpack` or `esbuild` -- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install` -- Use `bun run