Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46ea3e4c authored by Paula's avatar Paula
Browse files

Feature/#40 code refactoring

parent 2ab3003a
Loading
Loading
Loading
Loading

AGENTS.md

0 → 100644
+60 −0
Original line number Diff line number Diff line
# Agent Instructions

## Language

- Write all code and comments in English

## Naming conventions

- `my-class` — CSS classes use kebab-case
- `camelCase` — variables
- `$variableName` — DOM Node variables are prefixed with `$`
- `MAJUSCULE` — global constants use UPPERCASE

## File conventions

- `object.manager.js` — directive class coordinating sub-classes or views
- `object.class.js` — single-responsibility class used by a manager

## Function & JSDoc conventions

- Add a blank line between each function
- Any function created by an agent must include a JSDoc block with:
  - A function description
  - Parameters with their types
  - Return value with its type
- Use JSDoc for all functions with this format:
  - `/** Description. */`
  - `@param {Type} paramName Description.`
  - `@returns {Type} Description.`
- For functions returning nothing, use `@returns {void}`
- For optional parameters, use `@param {Type} [paramName] Description.`

## Async conventions

- Do not leave floating promises
- Prefer `async/await` over chained `.then()` calls

## Import conventions

- Group imports in this order:
  - External dependencies
  - Internal modules
  - Styles and assets
- Keep imports sorted within each group

## UI text conventions

- Do not hardcode user-facing strings in views
- Use translation keys and language files in `app/public/assets/languages/*.json`

## Validation conventions

Run the formatter from the `app/` directory before finishing:

- After code changes, run:
  - `cd app && npm run format`
  - `cd app && npm run check`

## Canary test
- If the user writes "canary", answer exactly: "AGENTS_OK"
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -10,8 +10,7 @@
    <link rel="stylesheet" href="/css/styles.css" />
    <link rel="stylesheet" href="/css/loader.css" />
    <title>/e/OS Installer</title>
    <script type="module" src="/src/viewManager.js"></script>
    <script type="module" src="/src/before-leave-app.js"></script>
    <script type="module" src="/src/view/listener.manager.js"></script>
  </head>
  <body id="body">
    <div id="process-ctn">

app/src/before-leave-app.js

deleted100644 → 0
+0 −3
Original line number Diff line number Diff line
window.addEventListener("beforeunload", function (event) {
  event.preventDefault();
});
+595 −0

File changed and moved.

Preview size limit exceeded, changes collapsed.

+24 −0
Original line number Diff line number Diff line
export class WDebug {
/**
 * Centralized debug logger used by controller components.
 */
export class DebugManager {
  constructor() {}

  /**
   * Writes a debug message to the console.
   *
   * @param {...any} args Values to log.
   */
  static log(...args) {
    console.log("[DEBUG]", ...args);
  }

  /**
   * Writes an error message to the console.
   *
   * @param {...any} args Values to log as an error.
   */
  static error(...args) {
    console.error("[ERROR]", ...args);
  }
Loading