ep_stats 0.0.60 → 0.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/AGENTS.md +75 -0
  2. package/index.js +8 -12
  3. package/package.json +4 -1
package/AGENTS.md ADDED
@@ -0,0 +1,75 @@
1
+ # Agent Guide — ep_stats
2
+
3
+ See pad Stats in Etherpad.
4
+
5
+ ## Tech stack
6
+
7
+ * Etherpad plugin framework (hooks declared in `ep.json`)
8
+ * EJS templates rendered server-side via `eejsBlock_*` hooks
9
+ * html10n for i18n (`locales/<lang>.json`, `data-l10n-id` in templates)
10
+
11
+ ## Project structure
12
+
13
+ ```
14
+ ep_stats/
15
+ ├── AGENTS.md
16
+ ├── CONTRIBUTING.md
17
+ ├── ep.json
18
+ ├── express.js
19
+ ├── index.js
20
+ ├── locales/
21
+ │ ├── de.json
22
+ │ ├── en.json
23
+ │ ├── fr.json
24
+ │ ├── my.json
25
+ │ ├── sw.json
26
+ │ ├── th.json
27
+ ├── package.json
28
+ ├── static/
29
+ │ ├── css/
30
+ │ ├── js/
31
+ │ ├── tests/
32
+ ├── templates/
33
+ │ ├── exportcolumn.html
34
+ │ ├── scripts.html
35
+ │ ├── stats.html
36
+ │ ├── stats_entry.ejs
37
+ ```
38
+
39
+ ## Helpers used
40
+
41
+ _None — `ep_plugin_helpers` is not a dependency. Adoption is part of the helpers-adoption sweep (Phase 4)._
42
+
43
+
44
+ ## Helpers NOT used
45
+
46
+ _To be audited in the helpers-adoption sweep (Phase 4)._
47
+
48
+
49
+ ## Running tests locally
50
+
51
+ `ep_stats` runs inside Etherpad's test harness. From an etherpad checkout that has installed this plugin via `pnpm run plugins i --path ../ep_stats`:
52
+
53
+ ```bash
54
+ # Backend (Mocha) — harness boots its own server
55
+ pnpm --filter ep_etherpad-lite run test
56
+
57
+ # Playwright — needs `pnpm run dev` in a second terminal
58
+ pnpm --filter ep_etherpad-lite run test-ui
59
+ ```
60
+
61
+ ## Standing rules for agent edits
62
+
63
+ * PRs target `main`. Linear commits, no merge commits.
64
+ * Every bug fix includes a regression test in the same commit.
65
+ * All user-facing strings in `locales/`. No hardcoded English in templates.
66
+ * No hardcoded `aria-label` on icon-only controls — etherpad's html10n auto-populates `aria-label` from the localized string when (a) the element has a `data-l10n-id` and (b) no author-supplied `aria-label` is present. Adding a hardcoded English `aria-label` blocks that and leaves it untranslated. (See `etherpad-lite/src/static/js/vendors/html10n.ts:665-678`.)
67
+ * No nested interactive elements (no `<button>` inside `<a>`).
68
+ * LLM/Agent contributions are explicitly welcomed by maintainers.
69
+
70
+ ## Quick reference: hooks declared in `ep.json`
71
+
72
+ * Server: `expressCreateServer`, `eejsBlock_exportColumn`, `eejsBlock_scripts`, `eejsBlock_mySettings`, `eejsBlock_styles`, `eejsBlock_body`, `eejsBlock_dd_view`
73
+ * Client: `postAceInit`, `aceEditEvent`
74
+
75
+ When adding a hook, register it in both `ep.json` *and* the matching `exports.<hook> = ...` in the JS file.
package/index.js CHANGED
@@ -1,27 +1,23 @@
1
1
  'use strict';
2
2
 
3
+ const {template} = require('ep_plugin_helpers');
4
+
3
5
  const eejs = require('ep_etherpad-lite/node/eejs');
4
6
  const settings = require('ep_etherpad-lite/node/utils/Settings');
5
7
 
6
- exports.eejsBlock_exportColumn = (hookName, args, cb) => {
7
- args.content += eejs.require('ep_stats/templates/exportcolumn.html', {}, module);
8
- return cb();
9
- };
8
+ exports.eejsBlock_exportColumn =
9
+ template('ep_stats/templates/exportcolumn.html');
10
10
 
11
- exports.eejsBlock_scripts = (hookName, args, cb) => {
12
- args.content += eejs.require('ep_stats/templates/scripts.html', {}, module);
13
- return cb();
14
- };
11
+ exports.eejsBlock_scripts =
12
+ template('ep_stats/templates/scripts.html');
15
13
 
16
14
  exports.eejsBlock_styles = (hookName, args, cb) => {
17
15
  args.content += '<link href="../static/plugins/ep_stats/static/css/stats.css" rel="stylesheet">';
18
16
  return cb();
19
17
  };
20
18
 
21
- exports.eejsBlock_body = (hookName, args, cb) => {
22
- args.content += eejs.require('ep_stats/templates/stats.html', {}, module);
23
- return cb();
24
- };
19
+ exports.eejsBlock_body =
20
+ template('ep_stats/templates/stats.html');
25
21
 
26
22
  exports.eejsBlock_mySettings = (hookName, args, cb) => {
27
23
  let checkedState;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep_stats",
3
3
  "description": "See pad Stats in Etherpad",
4
- "version": "0.0.60",
4
+ "version": "0.0.62",
5
5
  "author": {
6
6
  "name": "John McLear",
7
7
  "email": "john@mclear.co.uk",
@@ -37,5 +37,8 @@
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18.0.0"
40
+ },
41
+ "dependencies": {
42
+ "ep_plugin_helpers": "^0.5.0"
40
43
  }
41
44
  }