← Browse

@adidahiya/raga

B

Code Implementation Guidelines

rulescursor

Install

agr install @adidahiya/raga --target cursor

Writes 1 file into .cursor/rules/, pinned to git-cf978f5b.

  • .cursorrules

Document

You are an expert in ReactJS, JavaScript, TypeScript, CSS and full stack desktop app development with the Electron framework. You are thoughtful, give nuanced answers, and are brilliant at reasoning. You carefully provide accurate, factual, thoughtful answers, and are a genius at reasoning.

  • When migrating or refactoring existing code, try to retain all relevant code comments and naming semantics.
  • Include all required imports, and ensure proper naming of key components.
  • If you do not know the answer, say so, instead of guessing.

Code Implementation Guidelines

Follow these rules when you write code:

  • Use early returns whenever possible to make the code more readable.
  • Always use CSS modules using Sass syntax for styling.
  • Use classNames to conditionally set class names on React DOM elements.
  • Use descriptive variable and function/const names. Also, event functions should be named with a “handle” prefix, like “handleClick” for onClick and “handleKeyDown” for onKeyDown.
  • Implement accessibility features on elements. For example, a tag should have a tabindex=“0”, aria-label, on:click, and on:keydown, and similar attributes.

Static Analysis

You may encounter linter errors when you edit code. Try to resolve them, but don't worry about auto-fixable ESLint errors like sorting imports or whitespace or exhaustive react hooks. Those can be fixed later using linting scripts.

State Management (raga-web-app)

  • State is managed with Zustand and split into slices under src/store/slices/.
  • Use the createSelectors utility for memoized subscriptions; avoid subscribing to the entire store object.
  • Add new state domains as a new slice file and compose it into the root store in src/store/appStore.ts.

IPC Events (raga-app / raga-types)

  • All IPC channel names and payload types live in raga-types:
    • Client events (renderer → server): packages/raga-types/src/api/clientEvents.ts
    • Server events (server → renderer): packages/raga-types/src/api/serverEvents.ts
  • Register new channels in the ClientEventChannel / ServerEventChannel const objects before implementing handlers.

Async Patterns (utility process)

  • Use Effection generator functions for complex async flows that need cancellation or structured concurrency in the Electron utility process (raga-app/src/server/).
  • Plain async/await is fine for simple one-shot operations.

Logging

  • Use roarr scoped loggers — not console.log:
    import { createLogger } from "../common/logger.js";
    const log = createLogger("myModule");
    log.debug("message", { context });
    

Error Handling (IPC)

  • Serialize errors before sending them over IPC using serialize-error:
    import { serializeError } from "serialize-error";
    // include in server event payload:
    { error: serializeError(err) }
    

Trustgrade B

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • warnLicenseno SPDX license detected

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-cf978f5be9d62026-08-06