@ethlete/agent-rules 0.1.0-next.5 → 0.1.0-next.51

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 (242) hide show
  1. package/AGENTS.md +28 -0
  2. package/CHANGELOG.md +759 -0
  3. package/CLAUDE.md +1 -0
  4. package/README.md +434 -25
  5. package/THIRD-PARTY-LICENSES.md +35 -0
  6. package/content/defaults.json +1 -1
  7. package/content/git-hooks/post-checkout.sh +10 -0
  8. package/content/git-hooks/pre-push.sh +5 -0
  9. package/content/hooks/away-mode.py +327 -0
  10. package/content/hooks/background-design-commands.py +228 -0
  11. package/content/hooks/builder-idle-check.py +397 -0
  12. package/content/hooks/context-warning.py +694 -134
  13. package/content/hooks/design-live-check.py +136 -0
  14. package/content/hooks/git-safety.py +213 -0
  15. package/content/hooks/human-wait-check.py +167 -0
  16. package/content/hooks/subagent-model-policy.py +261 -0
  17. package/content/mods/.claude-plugin/marketplace.json +26 -0
  18. package/content/mods/plugins/codex-runs/.claude-plugin/plugin.json +6 -0
  19. package/content/mods/plugins/codex-runs/hooks/hooks.json +1 -0
  20. package/content/mods/plugins/codex-runs/hooks/progress.ts +130 -0
  21. package/content/mods/plugins/codex-runs/hooks/register.tsx +103 -0
  22. package/content/mods/plugins/codex-runs/tsconfig.json +4 -0
  23. package/content/mods/plugins/codex-runs/types/index.d.ts +19 -0
  24. package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
  25. package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
  26. package/content/mods/plugins/e2e-progress/hooks/progress.ts +160 -0
  27. package/content/mods/plugins/e2e-progress/hooks/register.tsx +442 -0
  28. package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
  29. package/content/mods/plugins/e2e-progress/types/index.d.ts +26 -0
  30. package/content/mods/plugins/status-line/.claude-plugin/plugin.json +6 -0
  31. package/content/mods/plugins/status-line/hooks/hooks.json +1 -0
  32. package/content/mods/plugins/status-line/hooks/line.ts +74 -0
  33. package/content/mods/plugins/status-line/hooks/register.tsx +141 -0
  34. package/content/mods/plugins/status-line/types/index.d.ts +5 -0
  35. package/content/mods/plugins/usage-line/.claude-plugin/plugin.json +6 -0
  36. package/content/mods/plugins/usage-line/hooks/codex.ts +52 -0
  37. package/content/mods/plugins/usage-line/hooks/format.ts +24 -0
  38. package/content/mods/plugins/usage-line/hooks/hooks.json +1 -0
  39. package/content/mods/plugins/usage-line/hooks/register.tsx +67 -0
  40. package/content/mods/plugins/usage-line/tsconfig.json +4 -0
  41. package/content/mods/plugins/usage-line/types/index.d.ts +5 -0
  42. package/content/output-styles/ste-clarity.md +131 -0
  43. package/content/rules/agent-sessions-wake-up.md +11 -0
  44. package/content/rules/app-styling.md +66 -0
  45. package/content/rules/comments.md +4 -1
  46. package/content/rules/lint-and-format.md +7 -5
  47. package/content/rules/nx-layout.md +53 -0
  48. package/content/rules/reactive-state.md +1 -1
  49. package/content/rules/styling.md +19 -10
  50. package/content/rules/subagent-models.md +42 -0
  51. package/content/rules/waiting-on-the-human.md +17 -0
  52. package/content/skills/agent-sessions/SKILL.md +100 -0
  53. package/content/skills/agent-sessions/agent-sessions.mjs +1420 -0
  54. package/content/skills/angular-patterns/SKILL.md +31 -7
  55. package/content/skills/api-source/SKILL.md +156 -0
  56. package/content/skills/app-testing/SKILL.md +141 -0
  57. package/content/skills/codex-subagent/SKILL.md +96 -0
  58. package/content/skills/codex-subagent/codex-agent.mjs +229 -0
  59. package/content/skills/codex-subagent/codex-limit.mjs +106 -0
  60. package/content/skills/design-exploration/SKILL.md +203 -0
  61. package/content/skills/design-exploration/check-story.mjs +139 -0
  62. package/content/skills/design-exploration/reference-check-and-notes.md +101 -0
  63. package/content/skills/design-exploration/reference-flows.md +38 -0
  64. package/content/skills/design-exploration/reference-inbox-and-mcp.md +54 -0
  65. package/content/skills/design-exploration/reference-order-and-design-system.md +120 -0
  66. package/content/skills/design-exploration/reference-products-and-sketches.md +250 -0
  67. package/content/skills/design-exploration/reference-shots.md +25 -0
  68. package/content/skills/design-exploration/shoot-template.mjs +61 -0
  69. package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  70. package/content/skills/domain-modeling/SKILL.md +71 -0
  71. package/content/skills/e2e-triage/SKILL.md +80 -0
  72. package/content/skills/figma-export/SKILL.md +16 -18
  73. package/content/skills/git-commit/SKILL.md +21 -7
  74. package/content/skills/git-flow/SKILL.md +87 -0
  75. package/content/skills/grill-with-docs/SKILL.md +13 -0
  76. package/content/skills/grilling/SKILL.md +52 -0
  77. package/content/skills/handoff/SKILL.md +29 -69
  78. package/content/skills/handoff/save.md +187 -0
  79. package/content/skills/query/SKILL.md +165 -70
  80. package/content/skills/report/SKILL.md +26 -0
  81. package/content/skills/rxjs-signals/SKILL.md +33 -4
  82. package/content/skills/sdk-docs/SKILL.md +50 -14
  83. package/content/skills/sdk-local-build/SKILL.md +26 -8
  84. package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
  85. package/content/skills/sdk-source/SKILL.md +37 -34
  86. package/content/skills/sdk-update/SKILL.md +103 -0
  87. package/content/skills/story-styling/SKILL.md +12 -10
  88. package/content/skills/styleguide/SKILL.md +13 -8
  89. package/content/skills/styleguide/assets.md +54 -0
  90. package/content/skills/styleguide/changesets.md +17 -0
  91. package/content/skills/styleguide/file-structure.md +73 -0
  92. package/content/skills/styleguide/lint-rule-lookup.md +52 -0
  93. package/content/skills/styleguide/storybook-structure.md +25 -0
  94. package/content/skills/theming/SKILL.md +76 -49
  95. package/content/skills/timetrack/SKILL.md +324 -0
  96. package/content/skills/verify-in-app/SKILL.md +107 -0
  97. package/content/skills/verify-in-storybook/SKILL.md +1 -1
  98. package/migrations/list-state-query-form.md +20 -0
  99. package/migrations/nx-layout.md +29 -0
  100. package/migrations/sdk-components-over-hand-built-ui.md +27 -0
  101. package/migrations/search-query-field.md +52 -0
  102. package/migrations.json +39 -0
  103. package/package.json +19 -3
  104. package/src/index.js +99 -32
  105. package/src/index.js.map +1 -1
  106. package/src/lib/cli-args.d.ts +9 -0
  107. package/src/lib/cli-args.js +48 -0
  108. package/src/lib/cli-args.js.map +1 -0
  109. package/src/lib/commitlint.d.ts +10 -0
  110. package/src/lib/commitlint.js +51 -0
  111. package/src/lib/commitlint.js.map +1 -0
  112. package/src/lib/config.d.ts +68 -6
  113. package/src/lib/config.js +141 -11
  114. package/src/lib/config.js.map +1 -1
  115. package/src/lib/filter.d.ts +2 -0
  116. package/src/lib/filter.js +4 -4
  117. package/src/lib/filter.js.map +1 -1
  118. package/src/lib/frontmatter.d.ts +2 -0
  119. package/src/lib/frontmatter.js +33 -5
  120. package/src/lib/frontmatter.js.map +1 -1
  121. package/src/lib/git-flow/build.d.ts +35 -0
  122. package/src/lib/git-flow/build.js +24 -0
  123. package/src/lib/git-flow/build.js.map +1 -0
  124. package/src/lib/git-flow/config.d.ts +59 -0
  125. package/src/lib/git-flow/config.js +50 -0
  126. package/src/lib/git-flow/config.js.map +1 -0
  127. package/src/lib/git-flow/index.d.ts +6 -0
  128. package/src/lib/git-flow/index.js +23 -0
  129. package/src/lib/git-flow/index.js.map +1 -0
  130. package/src/lib/git-flow/parse.d.ts +49 -0
  131. package/src/lib/git-flow/parse.js +300 -0
  132. package/src/lib/git-flow/parse.js.map +1 -0
  133. package/src/lib/git-flow/rename.d.ts +24 -0
  134. package/src/lib/git-flow/rename.js +70 -0
  135. package/src/lib/git-flow/rename.js.map +1 -0
  136. package/src/lib/git-flow/start.d.ts +49 -0
  137. package/src/lib/git-flow/start.js +57 -0
  138. package/src/lib/git-flow/start.js.map +1 -0
  139. package/src/lib/git-flow/validate.d.ts +34 -0
  140. package/src/lib/git-flow/validate.js +72 -0
  141. package/src/lib/git-flow/validate.js.map +1 -0
  142. package/src/lib/git-flow-command.d.ts +4 -0
  143. package/src/lib/git-flow-command.js +165 -0
  144. package/src/lib/git-flow-command.js.map +1 -0
  145. package/src/lib/git-flow-repair.d.ts +17 -0
  146. package/src/lib/git-flow-repair.js +165 -0
  147. package/src/lib/git-flow-repair.js.map +1 -0
  148. package/src/lib/git-flow-start.d.ts +20 -0
  149. package/src/lib/git-flow-start.js +140 -0
  150. package/src/lib/git-flow-start.js.map +1 -0
  151. package/src/lib/git-test-env.fixtures.d.ts +11 -0
  152. package/src/lib/git-test-env.fixtures.js +31 -0
  153. package/src/lib/git-test-env.fixtures.js.map +1 -0
  154. package/src/lib/git.d.ts +64 -0
  155. package/src/lib/git.js +131 -0
  156. package/src/lib/git.js.map +1 -0
  157. package/src/lib/gitlab.d.ts +35 -0
  158. package/src/lib/gitlab.js +116 -0
  159. package/src/lib/gitlab.js.map +1 -0
  160. package/src/lib/index.d.ts +2 -0
  161. package/src/lib/index.js +26 -11
  162. package/src/lib/index.js.map +1 -1
  163. package/src/lib/migrate.js +8 -2
  164. package/src/lib/migrate.js.map +1 -1
  165. package/src/lib/output-style-command.d.ts +3 -0
  166. package/src/lib/output-style-command.js +69 -0
  167. package/src/lib/output-style-command.js.map +1 -0
  168. package/src/lib/output-style.d.ts +38 -0
  169. package/src/lib/output-style.js +134 -0
  170. package/src/lib/output-style.js.map +1 -0
  171. package/src/lib/owned-paths.js +8 -2
  172. package/src/lib/owned-paths.js.map +1 -1
  173. package/src/lib/package-runner.d.ts +4 -0
  174. package/src/lib/package-runner.js +86 -0
  175. package/src/lib/package-runner.js.map +1 -0
  176. package/src/lib/peer-path.d.ts +12 -0
  177. package/src/lib/peer-path.js +39 -0
  178. package/src/lib/peer-path.js.map +1 -0
  179. package/src/lib/plain-text.d.ts +9 -0
  180. package/src/lib/plain-text.js +22 -0
  181. package/src/lib/plain-text.js.map +1 -0
  182. package/src/lib/plan.d.ts +6 -6
  183. package/src/lib/plan.js +167 -39
  184. package/src/lib/plan.js.map +1 -1
  185. package/src/lib/prettier.d.ts +21 -0
  186. package/src/lib/prettier.js +51 -0
  187. package/src/lib/prettier.js.map +1 -0
  188. package/src/lib/prompt.d.ts +8 -0
  189. package/src/lib/prompt.js +35 -0
  190. package/src/lib/prompt.js.map +1 -0
  191. package/src/lib/render.d.ts +26 -2
  192. package/src/lib/render.js +45 -10
  193. package/src/lib/render.js.map +1 -1
  194. package/src/lib/report-command.d.ts +34 -0
  195. package/src/lib/report-command.js +316 -0
  196. package/src/lib/report-command.js.map +1 -0
  197. package/src/lib/sessions-command.d.ts +4 -0
  198. package/src/lib/sessions-command.js +16 -0
  199. package/src/lib/sessions-command.js.map +1 -0
  200. package/src/lib/sync.d.ts +1 -2
  201. package/src/lib/sync.js +37 -17
  202. package/src/lib/sync.js.map +1 -1
  203. package/src/lib/targets/agents-skills.js +1 -1
  204. package/src/lib/targets/agents-skills.js.map +1 -1
  205. package/src/lib/targets/claude-hooks.d.ts +5 -0
  206. package/src/lib/targets/claude-hooks.js +27 -4
  207. package/src/lib/targets/claude-hooks.js.map +1 -1
  208. package/src/lib/targets/claude-mods.d.ts +20 -0
  209. package/src/lib/targets/claude-mods.js +47 -0
  210. package/src/lib/targets/claude-mods.js.map +1 -0
  211. package/src/lib/targets/claude.js +2 -3
  212. package/src/lib/targets/claude.js.map +1 -1
  213. package/src/lib/targets/codex-hooks.js +4 -2
  214. package/src/lib/targets/codex-hooks.js.map +1 -1
  215. package/src/lib/targets/codex.js +4 -4
  216. package/src/lib/targets/codex.js.map +1 -1
  217. package/src/lib/targets/copilot.js +4 -4
  218. package/src/lib/targets/copilot.js.map +1 -1
  219. package/src/lib/targets/cursor.js +3 -3
  220. package/src/lib/targets/cursor.js.map +1 -1
  221. package/src/lib/targets/git-hooks.d.ts +25 -0
  222. package/src/lib/targets/git-hooks.js +71 -0
  223. package/src/lib/targets/git-hooks.js.map +1 -0
  224. package/src/lib/targets/hooks-shared.d.ts +29 -5
  225. package/src/lib/targets/hooks-shared.js +130 -36
  226. package/src/lib/targets/hooks-shared.js.map +1 -1
  227. package/src/lib/targets/mcp.d.ts +16 -0
  228. package/src/lib/targets/mcp.js +72 -0
  229. package/src/lib/targets/mcp.js.map +1 -0
  230. package/src/lib/targets/shared.d.ts +1 -9
  231. package/src/lib/targets/shared.js +4 -8
  232. package/src/lib/targets/shared.js.map +1 -1
  233. package/src/lib/timetrack-command.d.ts +11 -0
  234. package/src/lib/timetrack-command.js +1262 -0
  235. package/src/lib/timetrack-command.js.map +1 -0
  236. package/src/lib/timetrack-snapshot.d.ts +66 -0
  237. package/src/lib/timetrack-snapshot.js +146 -0
  238. package/src/lib/timetrack-snapshot.js.map +1 -0
  239. package/src/lib/timetrack.d.ts +607 -0
  240. package/src/lib/timetrack.js +285 -0
  241. package/src/lib/timetrack.js.map +1 -0
  242. package/content/skills/styleguide/STYLEGUIDE.md +0 -520
@@ -0,0 +1,74 @@
1
+ const STALE_MS = 2 * 60 * 60 * 1000;
2
+ const QUEUE_HEADING = /^#{1,6} Warteschlange(, Rest)?\s*$/;
3
+ const HEADING = /^#{1,6} /;
4
+ const QUEUE_ITEM = /^\d+\. \*\*(?:.+ \()?[A-Z]\d+b?\)?\*\*/;
5
+ const QUEUE_ROW = /^\| [A-Z]\d+b? \|/;
6
+
7
+ export type StatusFields = {
8
+ task?: string;
9
+ minutes?: number;
10
+ queue?: number;
11
+ questions?: number;
12
+ isCiRot?: boolean;
13
+ };
14
+
15
+ export const lastSlice = (content: string, mtimeMs: number) => {
16
+ const blocks = content.split(/^(?=#\s*slice:)/m).filter((text) => /^#\s*slice:/m.test(text));
17
+ const block = blocks[blocks.length - 1];
18
+ if (block === undefined) return undefined;
19
+ const name = /^#\s*slice:\s*(.+)$/m.exec(block)?.[1]?.trim();
20
+ const written = /^#\s*written:\s*(\S+)/m.exec(block)?.[1];
21
+ const writtenAt = written && !Number.isNaN(Date.parse(written)) ? Date.parse(written) : mtimeMs;
22
+ return name ? { name, writtenAt } : undefined;
23
+ };
24
+
25
+ export const taskFields = (content: string, mtimeMs: number, nowMs: number): Pick<StatusFields, 'task' | 'minutes'> => {
26
+ const slice = lastSlice(content, mtimeMs);
27
+ if (slice === undefined) return {};
28
+ if (nowMs - slice.writtenAt > STALE_MS) return { task: 'kein Slice' };
29
+ return { task: slice.name, minutes: Math.max(0, Math.floor((nowMs - slice.writtenAt) / 60_000)) };
30
+ };
31
+
32
+ export const queueCount = (text: string) => {
33
+ let count = 0;
34
+ let isInQueue = false;
35
+ for (const line of text.split('\n')) {
36
+ if (HEADING.test(line)) isInQueue = QUEUE_HEADING.test(line);
37
+ else if (isInQueue && (QUEUE_ITEM.test(line) || QUEUE_ROW.test(line))) count++;
38
+ }
39
+ return count;
40
+ };
41
+
42
+ export const questionCount = (text: string) => text.split('\n').filter((line) => line.startsWith('- ')).length;
43
+
44
+ export const planFilesOf = (configText: string) => {
45
+ try {
46
+ const files = (JSON.parse(configText) as { report?: { planFiles?: unknown } }).report?.planFiles;
47
+ return Array.isArray(files) && files.every((f) => typeof f === 'string') ? (files as string[]) : undefined;
48
+ } catch {
49
+ return undefined;
50
+ }
51
+ };
52
+
53
+ export const isCiRotOf = (runJson: string) => {
54
+ try {
55
+ const [run] = JSON.parse(runJson) as { conclusion?: string; status?: string }[];
56
+ return run?.status === 'completed' && run.conclusion === 'failure';
57
+ } catch {
58
+ return false;
59
+ }
60
+ };
61
+
62
+ const durationOf = (minutes: number) =>
63
+ minutes < 60 ? `${minutes} min` : `${Math.floor(minutes / 60)} h ${minutes % 60} min`;
64
+
65
+ export const formatLine = (fields: StatusFields) => {
66
+ const parts = [
67
+ fields.task === undefined ? undefined : `▶ ${fields.task}`,
68
+ fields.minutes === undefined ? undefined : durationOf(fields.minutes),
69
+ fields.queue === undefined ? undefined : `${fields.queue} offen`,
70
+ fields.questions ? `❓${fields.questions}` : undefined,
71
+ fields.isCiRot ? '⛔ CI rot' : undefined,
72
+ ].filter((part): part is string => part !== undefined);
73
+ return parts.length === 0 ? null : parts.join(' · ');
74
+ };
@@ -0,0 +1,141 @@
1
+ import { atom, update } from 'claude-code';
2
+ import type { EngineInterface, Register } from 'claude-code';
3
+
4
+ import { formatLine, isCiRotOf, planFilesOf, questionCount, queueCount, taskFields } from './line';
5
+ import type { StatusFields } from './line';
6
+
7
+ const TICK_MS = 5000;
8
+ const CI_EVERY_MS = 2 * 60_000;
9
+ const CI_TIMEOUT_MS = 15_000;
10
+ const ROLE_SKILLS: Record<string, boolean> = { 'doc-agent': true, 'builder-agent': false };
11
+ const line = atom({ plugin: 'status-line', key: 'line' } as const, null);
12
+ const isDocSession = atom({ plugin: 'status-line', key: 'isDocSession' } as const, false);
13
+
14
+ async function markRole($: EngineInterface, skill: string | undefined) {
15
+ const isDoc = skill === undefined ? undefined : ROLE_SKILLS[skill];
16
+ if (isDoc !== undefined) await update($, isDocSession, () => isDoc);
17
+ }
18
+
19
+ type Source = { mtimeMs: number; text: string };
20
+
21
+ const cache = new Map<string, Source | null>();
22
+
23
+ async function readChanged($: EngineInterface, path: string) {
24
+ const stat = await $.fs.stat(path).catch(() => undefined);
25
+ if (stat === undefined) {
26
+ cache.delete(path);
27
+ return null;
28
+ }
29
+ const cached = cache.get(path);
30
+ if (cached && cached.mtimeMs === stat.mtimeMs) return cached;
31
+ const text = await $.fs.read(path).catch(() => undefined);
32
+ if (text === undefined) return null;
33
+ const source = { mtimeMs: stat.mtimeMs, text };
34
+ cache.set(path, source);
35
+ return source;
36
+ }
37
+
38
+ async function git($: EngineInterface, args: string[]) {
39
+ const result = await $.process.run(['git', ...args], { timeoutMs: 5000 }).catch(() => undefined);
40
+ return result?.exitCode === 0 ? result.stdout.trim() : undefined;
41
+ }
42
+
43
+ let isCiRot = false;
44
+ let lastCiMs = 0;
45
+ let isCiRunning = false;
46
+
47
+ async function refreshCi($: EngineInterface, nowMs: number) {
48
+ if (isCiRunning || nowMs - lastCiMs < CI_EVERY_MS) return;
49
+ isCiRunning = true;
50
+ lastCiMs = nowMs;
51
+ try {
52
+ const branch = await git($, ['branch', '--show-current']);
53
+ const result = branch
54
+ ? await $.process.run(['gh', 'run', 'list', '--branch', branch, '-L', '1', '--json', 'conclusion,status'], {
55
+ timeoutMs: CI_TIMEOUT_MS,
56
+ })
57
+ : undefined;
58
+ isCiRot = result?.exitCode === 0 && isCiRotOf(result.stdout);
59
+ } catch {
60
+ isCiRot = false;
61
+ } finally {
62
+ isCiRunning = false;
63
+ }
64
+ }
65
+
66
+ async function compute($: EngineInterface, nowMs: number): Promise<StatusFields> {
67
+ const paths = await git($, [
68
+ 'rev-parse',
69
+ '--path-format=absolute',
70
+ '--git-path',
71
+ 'slice-paths',
72
+ '--git-common-dir',
73
+ '--show-toplevel',
74
+ ]);
75
+ const [slicePath, commonDir, root] = paths?.split('\n') ?? [];
76
+ const fields: StatusFields = {};
77
+
78
+ if (slicePath) {
79
+ const slice = await readChanged($, slicePath);
80
+ if (slice) Object.assign(fields, taskFields(slice.text, slice.mtimeMs, nowMs));
81
+ }
82
+
83
+ if (root) {
84
+ const config = await readChanged($, `${root}/ethlete-agents.config.json`);
85
+ const planFiles = config ? planFilesOf(config.text) : undefined;
86
+ if (planFiles) {
87
+ const texts = await Promise.all(planFiles.map((file) => readChanged($, `${root}/${file}`)));
88
+ fields.queue = texts.reduce((sum, source) => sum + (source ? queueCount(source.text) : 0), 0);
89
+ }
90
+ }
91
+
92
+ if (commonDir) {
93
+ const questions = await readChanged($, `${commonDir}/ethlete/open-questions.md`);
94
+ if (questions) fields.questions = questionCount(questions.text);
95
+ }
96
+
97
+ fields.isCiRot = isCiRot;
98
+ return fields;
99
+ }
100
+
101
+ async function tick($: EngineInterface) {
102
+ try {
103
+ if (!(await $.state.get({ plugin: 'status-line', key: 'isDocSession' } as const)).value) return;
104
+ const nowMs = await $.clock.now();
105
+ void refreshCi($, nowMs);
106
+ const text = formatLine(await compute($, nowMs));
107
+ await update($, line, () => text);
108
+ } catch {
109
+ await update($, line, () => null).catch(() => undefined);
110
+ }
111
+ }
112
+
113
+ export const register: Register = (on) => {
114
+ on('session.start', async ($, e, next) => {
115
+ $.clock.every(TICK_MS, () => tick($));
116
+ await tick($);
117
+ return next(e);
118
+ });
119
+
120
+ on('tool.call', { tool: 'Skill' }, async ($, e, next) => {
121
+ await markRole($, e.skill).catch(() => undefined);
122
+ return next(e);
123
+ });
124
+
125
+ on('prompt.submit', async ($, e, next) => {
126
+ await markRole($, e.command?.name).catch(() => undefined);
127
+ return next(e);
128
+ });
129
+
130
+ on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
131
+ if (!(await $.state.get({ plugin: 'status-line', key: 'isDocSession' } as const)).value) return next(e);
132
+ const text = (await $.state.get({ plugin: 'status-line', key: 'line' } as const)).value;
133
+ if (!text) return next(e);
134
+ const { Box, Text } = $.ui.resolve(e);
135
+ return (
136
+ <Box>
137
+ <Text dimColor>{text}</Text>
138
+ </Box>
139
+ );
140
+ });
141
+ };
@@ -0,0 +1,5 @@
1
+ declare module 'claude-code' {
2
+ interface PluginState {
3
+ 'status-line': { line: string | null; isDocSession: boolean };
4
+ }
5
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "usage-line",
3
+ "version": "0.1.0-next.51",
4
+ "description": "Status line entry with the 5 hour and weekly usage, the reset time of the 5 hour window and the Codex limit",
5
+ "types": "./types/index.d.ts"
6
+ }
@@ -0,0 +1,52 @@
1
+ type Window = { used_percent: number; resets_at: number };
2
+ export type CodexSample = { at: number; primary: Window; secondary?: Window };
3
+
4
+ const pad = (value: number) => String(value).padStart(2, '0');
5
+
6
+ export function parseCodexLine(line: string): CodexSample | undefined {
7
+ if (!line.includes('"rate_limits"')) return undefined;
8
+ try {
9
+ const event = JSON.parse(line);
10
+ const limits = event?.payload?.rate_limits;
11
+ const at = Date.parse(event.timestamp);
12
+ if (!limits?.primary || limits.limit_id !== 'codex' || Number.isNaN(at)) return undefined;
13
+ return { at, primary: limits.primary, secondary: limits.secondary };
14
+ } catch {
15
+ return undefined;
16
+ }
17
+ }
18
+
19
+ export function latestCodexSample(text: string) {
20
+ let latest: CodexSample | undefined;
21
+ for (const line of text.split('\n')) {
22
+ const sample = parseCodexLine(line);
23
+ if (sample && (!latest || sample.at >= latest.at)) latest = sample;
24
+ }
25
+ return latest;
26
+ }
27
+
28
+ function windowOf(window: Window | undefined, now: number) {
29
+ if (!window) return undefined;
30
+ const resetsAt = window.resets_at * 1000;
31
+ const used = resetsAt <= now ? 0 : window.used_percent;
32
+ return { left: Math.max(0, Math.round(100 - used)), resetsAt, exhausted: used >= 100 };
33
+ }
34
+
35
+ function clock(ms: number, now: number) {
36
+ const date = new Date(ms);
37
+ const time = `${pad(date.getHours())}:${pad(date.getMinutes())}`;
38
+ return date.toDateString() === new Date(now).toDateString()
39
+ ? time
40
+ : `${pad(date.getDate())}.${pad(date.getMonth() + 1)}. ${time}`;
41
+ }
42
+
43
+ export function formatCodex(sample: CodexSample | undefined, now: number) {
44
+ if (!sample) return undefined;
45
+ const fiveHour = windowOf(sample.primary, now);
46
+ const week = windowOf(sample.secondary, now);
47
+ if (!fiveHour) return undefined;
48
+ const mark = fiveHour.exhausted || week?.exhausted ? '⛔ ' : '';
49
+ const reset = fiveHour.exhausted ? ` (${clock(fiveHour.resetsAt, now)})` : '';
50
+ const weekText = week ? ` · wk ${week.left}%${week.exhausted ? ` (${clock(week.resetsAt, now)})` : ''}` : '';
51
+ return `${mark}codex 5h ${fiveHour.left}%${reset}${weekText}`;
52
+ }
@@ -0,0 +1,24 @@
1
+ type RateLimit = { kind: string; percentUsed: number; resetsAt?: string };
2
+
3
+ const pad = (value: number) => String(value).padStart(2, '0');
4
+
5
+ function clock(iso: string | undefined) {
6
+ if (!iso) return '';
7
+ const date = new Date(iso);
8
+ if (Number.isNaN(date.getTime())) return '';
9
+ return ` bis ${pad(date.getHours())}:${pad(date.getMinutes())}`;
10
+ }
11
+
12
+ const percent = (limit: RateLimit | undefined) => (limit ? String(limit.percentUsed) : '?');
13
+
14
+ export function formatUsage(limits: RateLimit[]) {
15
+ const fiveHour = limits.find((limit) => limit.kind === 'five_hour');
16
+ const sevenDay = limits.find((limit) => limit.kind === 'seven_day');
17
+ if (!fiveHour && !sevenDay) return undefined;
18
+ return `5h ${percent(fiveHour)}%${clock(fiveHour?.resetsAt)} · Woche ${percent(sevenDay)}%`;
19
+ }
20
+
21
+ export function statusTextOf(commandText: string | null, usage: string | null) {
22
+ if (!usage) return commandText;
23
+ return commandText ? `${commandText} · ${usage}` : usage;
24
+ }
@@ -0,0 +1 @@
1
+ { "modules": ["./register.tsx"] }
@@ -0,0 +1,67 @@
1
+ import { atom, update } from 'claude-code';
2
+ import type { EngineInterface, Register } from 'claude-code';
3
+
4
+ import { latestCodexSample, formatCodex } from './codex';
5
+ import type { CodexSample } from './codex';
6
+ import { formatUsage, statusTextOf } from './format';
7
+
8
+ const usage = atom({ plugin: 'usage-line', key: 'usage' } as const, null);
9
+
10
+ const CODEX_ROOT = '.codex/sessions';
11
+ const CODEX_REFRESH_MS = 30_000;
12
+ const CODEX_SCAN_FILES = 3;
13
+
14
+ let codexSample: CodexSample | undefined;
15
+ let codexCheckedAt = 0;
16
+
17
+ async function newestDirectory($: EngineInterface, path: string) {
18
+ const entries = await $.fs.list(path).catch(() => []);
19
+ return entries.filter((entry) => entry.kind === 'dir').sort((a, b) => b.name.localeCompare(a.name));
20
+ }
21
+
22
+ async function newestRollouts($: EngineInterface, root: string) {
23
+ for (const year of await newestDirectory($, root)) {
24
+ for (const month of await newestDirectory($, `${root}/${year.name}`)) {
25
+ for (const day of await newestDirectory($, `${root}/${year.name}/${month.name}`)) {
26
+ const dir = `${root}/${year.name}/${month.name}/${day.name}`;
27
+ const files = (await $.fs.list(dir).catch(() => [])).filter((entry) => entry.name.endsWith('.jsonl'));
28
+ if (files.length > 0) {
29
+ return files
30
+ .sort((a, b) => b.mtimeMs - a.mtimeMs)
31
+ .slice(0, CODEX_SCAN_FILES)
32
+ .map((f) => `${dir}/${f.name}`);
33
+ }
34
+ }
35
+ }
36
+ }
37
+ return [];
38
+ }
39
+
40
+ async function refreshCodex($: EngineInterface, now: number) {
41
+ if (now - codexCheckedAt < CODEX_REFRESH_MS) return;
42
+ codexCheckedAt = now;
43
+ const home = await $.env.get('HOME');
44
+ if (!home) return;
45
+ let latest: CodexSample | undefined;
46
+ for (const path of await newestRollouts($, `${home}/${CODEX_ROOT}`)) {
47
+ const sample = latestCodexSample(await $.fs.read(path).catch(() => ''));
48
+ if (sample && (!latest || sample.at >= latest.at)) latest = sample;
49
+ }
50
+ codexSample = latest ?? codexSample;
51
+ }
52
+
53
+ export const register: Register = (on) => {
54
+ on('session.measure', async ($, e, next) => {
55
+ const now = await $.clock.now();
56
+ await refreshCodex($, now).catch(() => undefined);
57
+ const parts = [formatUsage(e.rateLimits), formatCodex(codexSample, now)].filter(Boolean);
58
+ const text = parts.length > 0 ? parts.join(' · ') : null;
59
+ await update($, usage, () => text).catch(() => undefined);
60
+ return next(e);
61
+ });
62
+
63
+ on('ui.render', { component: 'StatusLine' }, async ($, e, next) => {
64
+ const text = (await $.state.get({ plugin: 'usage-line', key: 'usage' } as const)).value;
65
+ return next({ ...e, props: { ...e.props, text: statusTextOf(e.props.text, text ?? null) } });
66
+ });
67
+ };
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../e2e-progress/.claude-plugin/types/tsconfig.json",
3
+ "include": ["hooks"]
4
+ }
@@ -0,0 +1,5 @@
1
+ declare module 'claude-code' {
2
+ interface PluginState {
3
+ 'usage-line': { usage: string | null };
4
+ }
5
+ }
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: ste-clarity
3
+ description: Write all prose in ASD-STE100 Simplified Technical English — approved words, simple verb forms, active voice, one idea per sentence.
4
+ keep-coding-instructions: true
5
+ ---
6
+
7
+ # ASD-STE100 output style
8
+
9
+ Write every sentence you show the user in Simplified Technical English, as specified
10
+ by ASD-STE100. Clarity comes first. Never sacrifice technical accuracy for brevity.
11
+
12
+ ## Scope
13
+
14
+ Apply STE to your own prose: answers, explanations, plans, summaries, commit
15
+ messages, and pull request text.
16
+
17
+ Do not apply STE to:
18
+
19
+ - Code, identifiers, file paths, and command names.
20
+ - Quoted material: error messages, log lines, command output, and text from files.
21
+ Copy these exactly. Never rewrite a quote to make it simpler.
22
+ - Text the user asks you to write in a different style.
23
+
24
+ Markdown is still available. Use code blocks, and use `file.ts:42` references.
25
+
26
+ ## Words
27
+
28
+ 1. Use the most common, shortest word that has one clear meaning.
29
+ 2. Use one word for one meaning. Do not use synonyms for the same thing. If you
30
+ write "flag" for a variable, do not later call it a "switch" or an "option".
31
+ 3. Use one meaning for one word. Do not use "close" for both a state and an action
32
+ if this can confuse the reader.
33
+ 4. Technical names are permitted. Use the exact name from the code or the domain.
34
+ 5. Do not use slang, idioms, or figures of speech. "The build blew up" is wrong.
35
+ "The build failed" is correct.
36
+ 6. Do not use "etc." Complete the list, or write "for example" and give two items.
37
+ 7. Do not use a noun as a verb. Write "make a request", not "request it", when
38
+ "request" is a name in the code.
39
+
40
+ Prefer the word on the right:
41
+
42
+ | Not approved | Use |
43
+ | ------------------------ | ----------------- |
44
+ | utilize, employ | use |
45
+ | initiate, commence | start |
46
+ | terminate | stop, end |
47
+ | perform, execute | do, run |
48
+ | modify | change |
49
+ | indicate | show |
50
+ | ascertain, determine | find, find out |
51
+ | assist, aid | help |
52
+ | attempt | try |
53
+ | require | need |
54
+ | sufficient | enough |
55
+ | additional | more |
56
+ | numerous, multiple | many |
57
+ | approximately | about |
58
+ | currently, presently | now |
59
+ | prior to | before |
60
+ | subsequent to, following | after |
61
+ | in order to | to |
62
+ | due to the fact that | because |
63
+ | via | with, by, through |
64
+ | such as | for example |
65
+ | in the event that | if |
66
+ | at this point in time | now |
67
+
68
+ This table is a guide, not the full ASD-STE100 Dictionary. The Dictionary holds about
69
+ 900 approved words, each with one approved part of speech and one approved meaning.
70
+ When you do not know if a word is approved, choose the shortest common word that has
71
+ one clear meaning.
72
+
73
+ ## Verbs
74
+
75
+ 1. Use only these verb forms: the infinitive, the imperative, the simple present, the
76
+ simple past, the simple future, and the past participle as an adjective.
77
+ 2. Do not use complex tenses. Write "I changed the config", not "I have changed the
78
+ config".
79
+ 3. Do not use "-ing" forms, unless the form is part of a technical name, for example
80
+ "a logging module".
81
+ 4. Use the active voice. Write "the parser drops the field", not "the field is dropped
82
+ by the parser". Use the passive voice only when the actor is unknown or does not
83
+ matter.
84
+ 5. Do not leave out a verb to make a sentence shorter.
85
+
86
+ ## Noun phrases
87
+
88
+ 1. Do not build a cluster of more than three nouns. Break up "user account balance
89
+ sync failure" as "a failure in the sync of the user account balance".
90
+ 2. Add articles ("a", "the") where they help the reader.
91
+
92
+ ## Sentences
93
+
94
+ 1. Instructions: 20 words maximum.
95
+ 2. Descriptions: 25 words maximum.
96
+ 3. One idea per sentence. One instruction per sentence.
97
+ 4. A paragraph holds 6 sentences maximum, and covers one topic.
98
+ 5. Put a condition at the start of the sentence, before the instruction. Write "If the
99
+ sync fails, restart the server".
100
+ 6. Use connecting words such as "however", "therefore", and "then" to show the link
101
+ between sentences.
102
+ 7. Use a vertical list when the content has more than three parallel parts. Do not use
103
+ a list to give structure to a single idea.
104
+
105
+ ## Procedures
106
+
107
+ 1. Use the imperative for each step. Write "Open the file", not "You should open the
108
+ file" or "We can open the file".
109
+ 2. Number the steps in the order the user must do them.
110
+ 3. Give the result after the action, if the result is not obvious.
111
+
112
+ ## Warnings
113
+
114
+ 1. Put a warning or a caution before the step it applies to, never after.
115
+ 2. Start the warning with a clear command. Write "Do not run this on the production
116
+ database. The command deletes all rows."
117
+ 3. State the consequence in a separate, simple sentence.
118
+
119
+ ## Punctuation
120
+
121
+ 1. Do not use a slash to mean "and" or "or". Write "the date or the payee".
122
+ 2. Do not use parentheses for information the reader needs. Put it in its own sentence.
123
+ 3. Do not use a dash to join two thoughts. Use two sentences.
124
+ 4. Use a hyphen only to make a compound word clear.
125
+
126
+ ## When STE and accuracy conflict
127
+
128
+ Accuracy wins. If a simple word would hide a real distinction, use the exact term and
129
+ define it once in a short sentence. Never simplify a claim about what the code does.
130
+ Keep the difference between what you verified and what you assume: write "I ran the
131
+ tests and they passed" or "I did not run the tests", not a sentence that blurs the two.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: agent-sessions-wake-up
3
+ description: A prompt that starts with "Mailbox message from <sender>:" is a message from another agent; act on it; read the agent-sessions skill before you edit a file another agent may edit.
4
+ kind: rule
5
+ scope: both
6
+ ---
7
+
8
+ ## Agent sessions
9
+
10
+ A prompt that starts with `Mailbox message from <sender>:` is a mailbox message from another agent: act
11
+ on it. Before you edit a file that another agent may edit, read {% skill:agent-sessions %}.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: app-styling
3
+ description: App components are styled with Tailwind utilities in their templates; app CSS goes in @layer components, @layer utilities or unlayered; the SDK needs a 10px rem root; hardcoded colours are never primary values.
4
+ kind: rule
5
+ scope: consumer
6
+ requires: ['@ethlete/core']
7
+ ---
8
+
9
+ ## Styling
10
+
11
+ Every component in this workspace (views, pages, shells, shared UI in `libs/`) is laid out
12
+ and styled with **Tailwind utility classes in its template**, including the colour utilities
13
+ the app's theme provides: the generated SDK theme utilities (`bg-et-surface-bg`,
14
+ `border-et-surface-border`, `text-et-<theme>`) where the app generates them, or the palette its
15
+ Tailwind config defines. Do not
16
+ invent a BEM class system, and do not write a `.css` file for layout, spacing or
17
+ typography a utility expresses. Every app component sets `encapsulation: ViewEncapsulation.None`,
18
+ as the `require-view-encapsulation-none` lint rule requires. Its CSS is then global, so give the
19
+ component a host class (`host: { class: 'app-player-card' }`) and scope every selector under it,
20
+ the way SDK components scope theirs under their `et-` classes. Never write a bare element or
21
+ unprefixed class selector in a component stylesheet.
22
+
23
+ In an existing repo, convert a component's styles whenever you change any of its files (class,
24
+ template, template-bound logic or CSS), not only its styles; if the conversion is large, ask the
25
+ user first. A legacy component that relies on emulated encapsulation keeps it until its CSS is
26
+ scoped under a host class: without that scope, `ViewEncapsulation.None` leaks its CSS into every
27
+ view.
28
+
29
+ If the repo as a whole breaks this section (global classes in `styles.css`, hardcoded colours),
30
+ tell the user once at first contact, with the size of the conversion (files, classes, hardcoded
31
+ colours), and record it as owed work in the plan or handoff. Never skip it silently. This holds
32
+ for a deviation from any rule here: report it once and record it.
33
+
34
+ Write CSS only for what utilities cannot express. With Tailwind 4, put that CSS in
35
+ `@layer components`, `@layer utilities` or leave it unlayered: SDK component styles sit in
36
+ `@layer components.sdk`, a layer nested in `components`, so each of the three beats them. In
37
+ `@layer components` a utility on the same element still wins over the app rule. With Tailwind
38
+ 3, `@layer` is a Tailwind directive that emits unlayered CSS, so app CSS already beats the
39
+ SDK's layered styles.
40
+
41
+ To change an SDK component's look, set its `--et-*` tokens first (documented per
42
+ component), then use a utility class or unlayered CSS on the element — see "Overriding
43
+ component styles" in the docs site's components overview.
44
+
45
+ The SDK sizes everything in `rem` on a **10px root**: the app's global stylesheet must set
46
+ `html { font-size: 62.5%; }`. Without it every SDK control renders 1.6× too large. With it,
47
+ `1rem` is `10px`, so the app's own `rem` values stay easy to read.
48
+
49
+ The 10px root also shrinks every rem-based Tailwind scale to 62.5% of its nominal size (1.6×
50
+ smaller): `p-4` is 10px instead of 16px, and `max-w-3xl` is 480px instead of 768px. Keep the
51
+ spacing scale on its 4px step: with Tailwind 4, set `--spacing: 0.4rem` in the app's `@theme`,
52
+ as the SDK's own Storybook does; with Tailwind 3, redefine `theme.spacing` in
53
+ `tailwind.config`. In an app that already uses utilities without it, the change rescales every
54
+ view: tell the user rather than make it. Redefine any other rem scale the app uses (text,
55
+ container, radius) the same way, or use px where a size matters. Breakpoints are not affected:
56
+ a media query's `rem` ignores the root font size.
57
+
58
+ **Never use a hardcoded colour as the primary value.** Backgrounds, text, borders and
59
+ interaction states resolve from the app's theme: the SDK surface and colour tokens
60
+ (`--et-surface-*`, `--et-tone-*`) and their generated utilities, or the palette
61
+ the app's Tailwind config defines. Never write an arbitrary colour value such as
62
+ `bg-[#1a1a1a]` in a template. A static fallback inside `var(--token, <fallback>)` is
63
+ permitted, but not required.
64
+
65
+ Theme **names** (`brand`, `danger`, `dark-elevated`, …) are registered by this app; the SDK
66
+ ships none. Semantic colours resolve by theme `type` (e.g. `injectSemanticColorTheme('error')`).
@@ -20,6 +20,8 @@ smaller function, or a type; fix that instead of narrating it.
20
20
  limitation) and linking it where a link exists, so the next reader can tell when it may go.
21
21
  4. **Public API JSDoc** — what it does and how to call it, on something a lib actually
22
22
  exports. One or two sentences. Not internals, not history, not why it is shaped that way.
23
+ In an application nothing is public API unless it lives in a shared lib other projects
24
+ import, so this case rarely applies to app code.
23
25
 
24
26
  Nothing else qualifies. Not "this is subtle", not "worth noting", not a heading over a group
25
27
  of members, not a summary of the function underneath it.
@@ -43,7 +45,8 @@ years.
43
45
  annotation, a factory instead of a literal, a helper moved into its own file. The type, the
44
46
  annotation and the import already say what happens.
45
47
  - **Migration narration** — "moved here from X", "used to be a tuple", "so Y no longer pulls
46
- Z", "renamed for clarity". Git knows; the next reader does not care.
48
+ Z", "renamed for clarity", "see ADR-0012". Git and the ADR index know; the next reader does
49
+ not care.
47
50
  - **The same explanation at every call site.** Explain a pattern once where it is defined (the
48
51
  helper's JSDoc, the lint rule's message, the guide) and let every use site stay silent.
49
52
  - **Commented-out code.**
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lint-and-format
3
- description: Run lint with --fix before fixing anything by hand, and format every edited file.
3
+ description: Run lint with --fix before fixing anything by hand, and format every edited source file Prettier supports.
4
4
  kind: rule
5
5
  scope: both
6
6
  vars: [lintCommand, lintFixCommand, formatCommand]
@@ -12,14 +12,16 @@ Run lint with `--fix` — most styleguide rules in `@ethlete/eslint-plugin` ship
12
12
  so let them do the work before correcting anything by hand:
13
13
 
14
14
  ```bash
15
- {%lintFixCommand%} # auto-fixes first (case, ordering, $ suffix, metadata, …)
15
+ {%lintFixCommand%} # auto-fixes first (case, ordering, metadata, …); rename to the $ suffix by hand
16
16
  {%lintCommand%} # then re-run to see what needs a manual fix
17
17
  ```
18
18
 
19
- For the judgment calls lint cannot enforce — signals vs RxJS, templates, lifecycle and DI
20
- patterns — see {%skill:styleguide%}.
19
+ For judgment calls lint cannot enforce, load the repository's focused guidance for the
20
+ code you are changing.
21
21
 
22
- After editing any file, format it before wrapping up:
22
+ Format every edited Prettier-supported source file before wrapping up, in one call over all of
23
+ them, not one call per file. Do not send binary,
24
+ generated, or unsupported files to this command:
23
25
 
24
26
  ```bash
25
27
  {%formatCommand%}