@ethlete/agent-rules 0.1.0-next.6 → 0.1.0-next.60

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 (220) hide show
  1. package/AGENTS.md +28 -0
  2. package/CHANGELOG.md +841 -0
  3. package/CLAUDE.md +1 -0
  4. package/README.md +244 -36
  5. package/THIRD-PARTY-LICENSES.md +35 -0
  6. package/content/defaults.json +1 -1
  7. package/content/hooks/away-mode.py +410 -0
  8. package/content/hooks/background-commands.py +177 -0
  9. package/content/hooks/builder-idle-check.py +529 -0
  10. package/content/hooks/context-warning.py +666 -134
  11. package/content/hooks/git-safety.py +213 -0
  12. package/content/hooks/human-wait-check.py +167 -0
  13. package/content/hooks/subagent-model-policy.py +261 -0
  14. package/content/mods/.claude-plugin/marketplace.json +26 -0
  15. package/content/mods/plugins/codex-runs/.claude-plugin/plugin.json +6 -0
  16. package/content/mods/plugins/codex-runs/hooks/agent-runs.ts +310 -0
  17. package/content/mods/plugins/codex-runs/hooks/hooks.json +1 -0
  18. package/content/mods/plugins/codex-runs/hooks/progress.ts +130 -0
  19. package/content/mods/plugins/codex-runs/hooks/register.tsx +283 -0
  20. package/content/mods/plugins/codex-runs/tests/pane.test.ts +21 -0
  21. package/content/mods/plugins/codex-runs/tsconfig.json +4 -0
  22. package/content/mods/plugins/codex-runs/types/index.d.ts +37 -0
  23. package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
  24. package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
  25. package/content/mods/plugins/e2e-progress/hooks/progress.ts +205 -0
  26. package/content/mods/plugins/e2e-progress/hooks/register.tsx +498 -0
  27. package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
  28. package/content/mods/plugins/e2e-progress/types/index.d.ts +27 -0
  29. package/content/mods/plugins/status-line/.claude-plugin/plugin.json +6 -0
  30. package/content/mods/plugins/status-line/hooks/hooks.json +1 -0
  31. package/content/mods/plugins/status-line/hooks/line.ts +74 -0
  32. package/content/mods/plugins/status-line/hooks/register.tsx +141 -0
  33. package/content/mods/plugins/status-line/types/index.d.ts +5 -0
  34. package/content/mods/plugins/usage-line/.claude-plugin/plugin.json +6 -0
  35. package/content/mods/plugins/usage-line/hooks/codex.ts +52 -0
  36. package/content/mods/plugins/usage-line/hooks/format.ts +24 -0
  37. package/content/mods/plugins/usage-line/hooks/hooks.json +1 -0
  38. package/content/mods/plugins/usage-line/hooks/rate-limits.ts +23 -0
  39. package/content/mods/plugins/usage-line/hooks/register.tsx +83 -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 +101 -0
  53. package/content/skills/agent-sessions/agent-sessions.mjs +1462 -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 +102 -0
  58. package/content/skills/codex-subagent/codex-agent.mjs +260 -0
  59. package/content/skills/codex-subagent/codex-limit.mjs +106 -0
  60. package/content/skills/design-exploration/SKILL.md +121 -0
  61. package/content/skills/design-exploration/check-story.mjs +139 -0
  62. package/content/skills/design-exploration/reference-shots.md +15 -0
  63. package/content/skills/design-exploration/shoot-template.mjs +61 -0
  64. package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  65. package/content/skills/domain-modeling/SKILL.md +71 -0
  66. package/content/skills/e2e-triage/SKILL.md +80 -0
  67. package/content/skills/figma-export/SKILL.md +16 -18
  68. package/content/skills/git-commit/SKILL.md +21 -7
  69. package/content/skills/git-flow/SKILL.md +9 -5
  70. package/content/skills/grill-with-docs/SKILL.md +13 -0
  71. package/content/skills/grilling/SKILL.md +52 -0
  72. package/content/skills/handoff/SKILL.md +30 -72
  73. package/content/skills/handoff/save.md +189 -0
  74. package/content/skills/query/SKILL.md +165 -74
  75. package/content/skills/report/SKILL.md +26 -0
  76. package/content/skills/rxjs-signals/SKILL.md +33 -4
  77. package/content/skills/sdk-docs/SKILL.md +50 -14
  78. package/content/skills/sdk-local-build/SKILL.md +26 -8
  79. package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
  80. package/content/skills/sdk-source/SKILL.md +37 -34
  81. package/content/skills/sdk-update/SKILL.md +103 -0
  82. package/content/skills/story-styling/SKILL.md +12 -10
  83. package/content/skills/styleguide/SKILL.md +13 -8
  84. package/content/skills/styleguide/assets.md +54 -0
  85. package/content/skills/styleguide/changesets.md +17 -0
  86. package/content/skills/styleguide/file-structure.md +73 -0
  87. package/content/skills/styleguide/lint-rule-lookup.md +52 -0
  88. package/content/skills/styleguide/storybook-structure.md +25 -0
  89. package/content/skills/theming/SKILL.md +76 -49
  90. package/content/skills/verify-in-app/SKILL.md +107 -0
  91. package/content/skills/verify-in-storybook/SKILL.md +1 -1
  92. package/content/skills/verify-on-apple-devices/SKILL.md +100 -0
  93. package/content/skills/verify-on-apple-devices/apple-remote.sh +421 -0
  94. package/content/skills/verify-on-apple-devices/sim-edge-back.m +159 -0
  95. package/migrations/list-state-query-form.md +20 -0
  96. package/migrations/nx-layout.md +29 -0
  97. package/migrations/sdk-components-over-hand-built-ui.md +27 -0
  98. package/migrations/search-query-field.md +52 -0
  99. package/migrations/studio-claude-plugin.md +27 -0
  100. package/migrations.json +47 -0
  101. package/package.json +8 -3
  102. package/src/index.js +84 -28
  103. package/src/index.js.map +1 -1
  104. package/src/lib/cli-args.d.ts +9 -0
  105. package/src/lib/cli-args.js +48 -0
  106. package/src/lib/cli-args.js.map +1 -0
  107. package/src/lib/commitlint.d.ts +10 -0
  108. package/src/lib/commitlint.js +51 -0
  109. package/src/lib/commitlint.js.map +1 -0
  110. package/src/lib/config.d.ts +53 -22
  111. package/src/lib/config.js +128 -12
  112. package/src/lib/config.js.map +1 -1
  113. package/src/lib/filter.d.ts +3 -0
  114. package/src/lib/filter.js +7 -5
  115. package/src/lib/filter.js.map +1 -1
  116. package/src/lib/frontmatter.d.ts +2 -0
  117. package/src/lib/frontmatter.js +33 -5
  118. package/src/lib/frontmatter.js.map +1 -1
  119. package/src/lib/git-flow/config.js +1 -1
  120. package/src/lib/git-flow/config.js.map +1 -1
  121. package/src/lib/git-flow/index.d.ts +1 -0
  122. package/src/lib/git-flow/index.js +20 -6
  123. package/src/lib/git-flow/index.js.map +1 -1
  124. package/src/lib/git-flow/parse.js +38 -12
  125. package/src/lib/git-flow/parse.js.map +1 -1
  126. package/src/lib/git-flow/rename.d.ts +24 -0
  127. package/src/lib/git-flow/rename.js +70 -0
  128. package/src/lib/git-flow/rename.js.map +1 -0
  129. package/src/lib/git-flow/start.d.ts +27 -0
  130. package/src/lib/git-flow/start.js +34 -1
  131. package/src/lib/git-flow/start.js.map +1 -1
  132. package/src/lib/git-flow-command.js +10 -2
  133. package/src/lib/git-flow-command.js.map +1 -1
  134. package/src/lib/git-flow-repair.d.ts +1 -1
  135. package/src/lib/git-flow-repair.js +30 -15
  136. package/src/lib/git-flow-repair.js.map +1 -1
  137. package/src/lib/git-flow-start.d.ts +1 -1
  138. package/src/lib/git-flow-start.js +25 -32
  139. package/src/lib/git-flow-start.js.map +1 -1
  140. package/src/lib/git.d.ts +37 -0
  141. package/src/lib/git.js +85 -3
  142. package/src/lib/git.js.map +1 -1
  143. package/src/lib/gitlab.js +24 -6
  144. package/src/lib/gitlab.js.map +1 -1
  145. package/src/lib/index.d.ts +2 -0
  146. package/src/lib/index.js +26 -11
  147. package/src/lib/index.js.map +1 -1
  148. package/src/lib/migrate.js +8 -2
  149. package/src/lib/migrate.js.map +1 -1
  150. package/src/lib/output-style-command.d.ts +3 -0
  151. package/src/lib/output-style-command.js +69 -0
  152. package/src/lib/output-style-command.js.map +1 -0
  153. package/src/lib/output-style.d.ts +38 -0
  154. package/src/lib/output-style.js +134 -0
  155. package/src/lib/output-style.js.map +1 -0
  156. package/src/lib/owned-paths.js +8 -2
  157. package/src/lib/owned-paths.js.map +1 -1
  158. package/src/lib/package-runner.d.ts +4 -0
  159. package/src/lib/package-runner.js +86 -0
  160. package/src/lib/package-runner.js.map +1 -0
  161. package/src/lib/plain-text.d.ts +9 -0
  162. package/src/lib/plain-text.js +22 -0
  163. package/src/lib/plain-text.js.map +1 -0
  164. package/src/lib/plan.d.ts +6 -6
  165. package/src/lib/plan.js +153 -40
  166. package/src/lib/plan.js.map +1 -1
  167. package/src/lib/prettier.d.ts +21 -0
  168. package/src/lib/prettier.js +51 -0
  169. package/src/lib/prettier.js.map +1 -0
  170. package/src/lib/prompt.js +10 -2
  171. package/src/lib/prompt.js.map +1 -1
  172. package/src/lib/render.d.ts +14 -1
  173. package/src/lib/render.js +23 -5
  174. package/src/lib/render.js.map +1 -1
  175. package/src/lib/report-command.d.ts +34 -0
  176. package/src/lib/report-command.js +322 -0
  177. package/src/lib/report-command.js.map +1 -0
  178. package/src/lib/sessions-command.d.ts +4 -0
  179. package/src/lib/sessions-command.js +16 -0
  180. package/src/lib/sessions-command.js.map +1 -0
  181. package/src/lib/sync.d.ts +1 -2
  182. package/src/lib/sync.js +37 -17
  183. package/src/lib/sync.js.map +1 -1
  184. package/src/lib/targets/agents-skills.js +1 -1
  185. package/src/lib/targets/agents-skills.js.map +1 -1
  186. package/src/lib/targets/claude-hooks.d.ts +5 -0
  187. package/src/lib/targets/claude-hooks.js +27 -4
  188. package/src/lib/targets/claude-hooks.js.map +1 -1
  189. package/src/lib/targets/claude-mods.d.ts +20 -0
  190. package/src/lib/targets/claude-mods.js +47 -0
  191. package/src/lib/targets/claude-mods.js.map +1 -0
  192. package/src/lib/targets/claude.js +2 -3
  193. package/src/lib/targets/claude.js.map +1 -1
  194. package/src/lib/targets/codex-hooks.js +4 -2
  195. package/src/lib/targets/codex-hooks.js.map +1 -1
  196. package/src/lib/targets/codex.js +4 -4
  197. package/src/lib/targets/codex.js.map +1 -1
  198. package/src/lib/targets/copilot.js +4 -4
  199. package/src/lib/targets/copilot.js.map +1 -1
  200. package/src/lib/targets/cursor.js +3 -3
  201. package/src/lib/targets/cursor.js.map +1 -1
  202. package/src/lib/targets/git-hooks.d.ts +1 -1
  203. package/src/lib/targets/git-hooks.js +6 -5
  204. package/src/lib/targets/git-hooks.js.map +1 -1
  205. package/src/lib/targets/hooks-shared.d.ts +34 -5
  206. package/src/lib/targets/hooks-shared.js +132 -36
  207. package/src/lib/targets/hooks-shared.js.map +1 -1
  208. package/src/lib/targets/mcp.d.ts +25 -0
  209. package/src/lib/targets/mcp.js +114 -0
  210. package/src/lib/targets/mcp.js.map +1 -0
  211. package/src/lib/targets/shared.d.ts +1 -9
  212. package/src/lib/targets/shared.js +4 -8
  213. package/src/lib/targets/shared.js.map +1 -1
  214. package/src/lib/timetrack.d.ts +16 -0
  215. package/src/lib/timetrack.js +149 -0
  216. package/src/lib/timetrack.js.map +1 -0
  217. package/content/skills/styleguide/STYLEGUIDE.md +0 -520
  218. package/src/lib/jira.d.ts +0 -28
  219. package/src/lib/jira.js +0 -83
  220. package/src/lib/jira.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ # Replace a hand-debounced search with `searchQueryField`
2
+
3
+ The earlier query guidance said there was no built-in debounce and to debounce at the input. So a
4
+ search box that feeds a query was debounced by hand: `debounceTime` on a stream, a `setTimeout`, or a
5
+ debounced copy of the input signal. `searchQueryField()` debounces by itself (300ms), and applies a
6
+ cleared input at once.
7
+
8
+ ## Before you start
9
+
10
+ `et update` regenerates the skills when it moves `@ethlete/agent-rules`. If
11
+ `.agents/skills/ethlete-query/SKILL.md` does not mention `searchQueryField`, run
12
+ `ethlete-agents sync` with this repo's package manager (`yarn`, `pnpm exec` or `npx`) first.
13
+
14
+ ## Find the call sites
15
+
16
+ ```bash
17
+ grep -rnE 'debounceTime\(|debounce\(' apps libs --include='*.ts'
18
+ grep -rnE 'setTimeout\(' apps libs --include='*.ts'
19
+ ```
20
+
21
+ A call site is in scope when the debounced value ends up in the args of a query.
22
+
23
+ ## What to change
24
+
25
+ 1. Add a `search: searchQueryField()` field to the list's `defineQueryForm`, or declare a form with
26
+ that one field.
27
+ 2. Call `.observe()` on it. Keep the URL behaviour the old search had. If it did not write the
28
+ URL, as a search inside a dialog, pass `{ writeToQueryParams: false, syncOnNavigation: false }`.
29
+ `writeToQueryParams: false` alone stops the writes only: the form still reads the page's own
30
+ params, such as `page`.
31
+ 3. Read `this.qf.value().search` in `withArgs`, and bind the input with `[formField]="qf.fields.search"`.
32
+ 4. Delete the debounce, the subject or timer, and the intermediate signal.
33
+ 5. Pass `debounce` to the field when the old delay was deliberately different from 300ms.
34
+
35
+ If the search text is part of list state the component syncs to the URL by hand, skip the call
36
+ site: it moves with the rest of the list to `defineQueryForm` when that list is next edited.
37
+
38
+ ## Leave these alone
39
+
40
+ - A debounce whose value never reaches a query: resize and scroll handlers, autosave, analytics.
41
+ - An SDK control that takes a search input of its own.
42
+
43
+ ## Done when
44
+
45
+ - No hit of the greps above feeds a query any more, apart from the hand-synced lists you skipped.
46
+ Your final message names each skipped one.
47
+ - The type check, lint and tests pass for every project you changed.
48
+
49
+ Then delete this task file.
50
+
51
+ The guide the `Docs` line at the top of this file links (`/query/query-forms` on the SDK docs site)
52
+ has the field creators and their options.
@@ -0,0 +1,27 @@
1
+ # Install the Ethlete Studio Claude plugin
2
+
3
+ The design hooks `background-design-commands` and `design-live-check` moved out of `@ethlete/agent-rules`
4
+ into the `ethlete-studio` Claude Code plugin that Ethlete Studio ships. `ethlete-agents sync` removes the old
5
+ hook scripts and their settings entries and keeps the generic `background-commands` hook.
6
+
7
+ A checkout without a `.ethlete/design` folder needs nothing: delete this task file.
8
+
9
+ ## What to do
10
+
11
+ 1. Open the checkout in Ethlete Studio, press Ctrl+K and run **Agent verbinden**.
12
+ 2. Run the **Claude Code** line in a terminal. It has this form:
13
+
14
+ ```sh
15
+ cd <checkout> && claude plugin install ethlete-studio --marketplace "<Studio resources>/claude-plugin" --scope local
16
+ ```
17
+
18
+ It adds Studio's marketplace to the user settings and enables the plugin for this checkout only.
19
+
20
+ 3. Remove a hand-added `ethlete-design` server from `claude mcp` (`claude mcp remove ethlete-design`) when the
21
+ checkout had one: the plugin brings its own.
22
+
23
+ ## Done when
24
+
25
+ - A new Claude Code session in the checkout lists the `mcp__plugin_ethlete-studio_ethlete-design__*` tools.
26
+
27
+ Then delete this task file.
@@ -0,0 +1,47 @@
1
+ {
2
+ "migrations": [
3
+ {
4
+ "name": "list-state-query-form",
5
+ "version": "0.1.0-next.17",
6
+ "kind": "manual",
7
+ "level": "optional",
8
+ "description": "Lists that sync their params to the URL by hand move to defineQueryForm when they are next edited.",
9
+ "instructions": "./migrations/list-state-query-form.md",
10
+ "docs": "/query/query-forms"
11
+ },
12
+ {
13
+ "name": "search-query-field",
14
+ "version": "0.1.0-next.17",
15
+ "kind": "assisted",
16
+ "level": "optional",
17
+ "description": "A hand-debounced search that feeds a query moves to searchQueryField.",
18
+ "instructions": "./migrations/search-query-field.md",
19
+ "docs": "/query/query-forms"
20
+ },
21
+ {
22
+ "name": "sdk-components-over-hand-built-ui",
23
+ "version": "0.1.0-next.17",
24
+ "kind": "manual",
25
+ "level": "optional",
26
+ "description": "Hand-built bar charts, avatars and progress bars move to the SDK components when their view is next edited.",
27
+ "instructions": "./migrations/sdk-components-over-hand-built-ui.md",
28
+ "docs": "/components/"
29
+ },
30
+ {
31
+ "name": "nx-layout",
32
+ "version": "0.1.0-next.17",
33
+ "kind": "manual",
34
+ "level": "optional",
35
+ "description": "Compare the workspace with the Nx layout rule, and decide whether any project moves.",
36
+ "instructions": "./migrations/nx-layout.md"
37
+ },
38
+ {
39
+ "name": "studio-claude-plugin",
40
+ "version": "0.1.0-next.52",
41
+ "kind": "manual",
42
+ "level": "recommended",
43
+ "description": "The design hooks left agent-rules: a checkout that uses Ethlete Studio installs its Claude plugin to keep them.",
44
+ "instructions": "./migrations/studio-claude-plugin.md"
45
+ }
46
+ ]
47
+ }
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@ethlete/agent-rules",
3
- "version": "0.1.0-next.6",
3
+ "version": "0.1.0-next.60",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/ethlete-io/ethdk",
7
+ "directory": "libs/agent-rules"
8
+ },
4
9
  "license": "MIT",
5
10
  "type": "commonjs",
6
11
  "exports": {
@@ -19,8 +24,8 @@
19
24
  "bin": {
20
25
  "ethlete-agents": "./src/index.js"
21
26
  },
22
- "peerDependencies": {
23
- "tslib": "2.8.1"
27
+ "ethlete": {
28
+ "migrations": "./migrations.json"
24
29
  },
25
30
  "types": "./src/index.d.ts"
26
31
  }
package/src/index.js CHANGED
@@ -1,12 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
3
17
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
18
  const fs_1 = require("fs");
19
+ const prettier_1 = require("./lib/prettier");
6
20
  const path_1 = require("path");
21
+ const cli_args_1 = require("./lib/cli-args");
7
22
  const config_1 = require("./lib/config");
8
23
  const git_flow_command_1 = require("./lib/git-flow-command");
24
+ const load_content_1 = require("./lib/load-content");
25
+ const sessions_command_1 = require("./lib/sessions-command");
9
26
  const migrate_1 = require("./lib/migrate");
27
+ const output_style_command_1 = require("./lib/output-style-command");
28
+ const package_runner_1 = require("./lib/package-runner");
29
+ const plain_text_1 = require("./lib/plain-text");
30
+ const report_command_1 = require("./lib/report-command");
10
31
  const sync_1 = require("./lib/sync");
11
32
  const USAGE = `ethlete-agents — compile @ethlete agent rules and skills into your repo
12
33
 
@@ -15,6 +36,15 @@ const USAGE = `ethlete-agents — compile @ethlete agent rules and skills into y
15
36
  ethlete-agents init Write a starter ${config_1.CONFIG_FILE_NAME}
16
37
  ethlete-agents git-flow Name, check and repair branches against the repo's git flow
17
38
  (start, check, repair, explain)
39
+ ethlete-agents output-style
40
+ Install an Ethlete output style into this machine's Claude Code
41
+ config and switch to it (Claude Code only)
42
+ ethlete-agents sessions Run agents in tmux sessions of one checkout: message them, wake idle
43
+ ones, restart one with a prompt, claim paths (run, up, down, restart,
44
+ send, inbox, claim). The old name "mailbox" works too
45
+ ethlete-agents report Print a table of what was done in a period: rows with their commits,
46
+ parked rows, commit counts, CI and subagent figures
47
+ (today, yesterday, week, --since <date> [--until <date>])
18
48
  ethlete-agents migrate Convert the repo to the AGENTS.md + .agents/skills layout:
19
49
  CLAUDE.md content moves into AGENTS.md (CLAUDE.md becomes an
20
50
  @AGENTS.md import), hand-written .claude/skills move to
@@ -22,7 +52,8 @@ const USAGE = `ethlete-agents — compile @ethlete agent rules and skills into y
22
52
 
23
53
  Options
24
54
  --targets <list> Comma-separated subset of: ${config_1.AGENT_TARGETS.join(', ')}
25
- --root <path> Repo root to write into (default: current directory)
55
+ --root <path> Repo root to write into (default: the nearest directory holding
56
+ ${config_1.CONFIG_FILE_NAME}, else the current directory)
26
57
  --dry-run Print what would change without writing (sync and migrate)
27
58
  `;
28
59
  const readFlag = (args, flag) => {
@@ -31,62 +62,87 @@ const readFlag = (args, flag) => {
31
62
  return undefined;
32
63
  return args[index + 1];
33
64
  };
34
- const parseTargets = (args) => {
35
- const raw = readFlag(args, '--targets');
36
- if (!raw)
37
- return undefined;
38
- return raw.split(',').map((entry) => entry.trim());
39
- };
40
- const readVersion = () => {
41
- const manifest = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
42
- return manifest.version;
43
- };
65
+ const INIT_VARS = ['lintCommand', 'lintFixCommand', 'formatCommand', 'storybookStartCommand', 'storybookUrl'];
44
66
  const init = (root) => {
45
67
  const path = (0, path_1.join)(root, config_1.CONFIG_FILE_NAME);
46
68
  if ((0, fs_1.existsSync)(path)) {
47
69
  console.error(`${config_1.CONFIG_FILE_NAME} already exists.`);
48
70
  return 1;
49
71
  }
72
+ const defaults = (0, package_runner_1.followPackageManager)(root, (0, load_content_1.loadDefaultVars)());
73
+ const detected = (0, package_runner_1.detectCommandVars)(root);
74
+ const vars = Object.fromEntries(INIT_VARS.map((name) => { var _a; return [name, (_a = detected[name]) !== null && _a !== void 0 ? _a : defaults[name]]; }).filter(([, value]) => value));
50
75
  const template = {
51
76
  targets: (0, config_1.detectTargets)(root),
52
- vars: {},
77
+ vars,
53
78
  exclude: [],
54
79
  hooks: [],
55
80
  };
56
- (0, fs_1.writeFileSync)(path, `${JSON.stringify(template, null, 2)}\n`, 'utf8');
57
- console.log(`Wrote ${config_1.CONFIG_FILE_NAME}. Fill in "vars" for your repo, then run \`ethlete-agents sync\`.`);
81
+ (0, prettier_1.writeJsonFile)({ file: path, value: template });
82
+ console.log(`Wrote ${config_1.CONFIG_FILE_NAME}. Check the commands in "vars" (${Object.keys(vars).join(', ')}) against your repo, then run \`ethlete-agents sync\`.`);
58
83
  return 0;
59
84
  };
60
- const run = (argv) => {
61
- var _a;
62
- const command = argv[0];
63
- const root = (_a = readFlag(argv, '--root')) !== null && _a !== void 0 ? _a : process.cwd();
64
- const options = { root, version: readVersion(), targets: parseTargets(argv) };
85
+ const STRICT_COMMANDS = ['sync', 'check', 'init', 'migrate'];
86
+ const runStrict = (command, args) => {
87
+ var _a, _b;
88
+ const root = (_a = args.root) !== null && _a !== void 0 ? _a : (0, config_1.resolveRepoRoot)(process.cwd());
89
+ const options = { root, targets: args.targets };
65
90
  switch (command) {
66
91
  case 'sync':
67
- return (0, sync_1.sync)(Object.assign(Object.assign({}, options), { dryRun: argv.includes('--dry-run') }));
92
+ return (0, sync_1.sync)(Object.assign(Object.assign({}, options), { dryRun: args.dryRun }));
68
93
  case 'check':
69
94
  return (0, sync_1.check)(options);
70
95
  case 'init':
71
- return init(root);
96
+ return init((_b = args.root) !== null && _b !== void 0 ? _b : process.cwd());
97
+ default:
98
+ return (0, migrate_1.migrate)(Object.assign(Object.assign({}, options), { dryRun: args.dryRun }));
99
+ }
100
+ };
101
+ const run = (argv) => {
102
+ var _a;
103
+ const command = argv[0];
104
+ if (command !== undefined && STRICT_COMMANDS.includes(command)) {
105
+ const args = (0, cli_args_1.parseCommandArgs)(command, argv.slice(1));
106
+ if (args.problems.length) {
107
+ console.error(`${args.problems.join('\n')}\n\n${USAGE}`);
108
+ return 1;
109
+ }
110
+ if (args.help) {
111
+ console.log(USAGE);
112
+ return 0;
113
+ }
114
+ return runStrict(command, args);
115
+ }
116
+ const root = (_a = readFlag(argv, '--root')) !== null && _a !== void 0 ? _a : (0, config_1.resolveRepoRoot)(process.cwd());
117
+ switch (command) {
72
118
  case 'git-flow':
73
119
  return (0, git_flow_command_1.gitFlowCommand)({ root, argv: argv.slice(1) });
74
- case 'migrate':
75
- return (0, migrate_1.migrate)(Object.assign(Object.assign({}, options), { dryRun: argv.includes('--dry-run') }));
120
+ case 'sessions':
121
+ case 'mailbox':
122
+ return (0, sessions_command_1.sessionsCommand)({ argv: argv.slice(1) });
123
+ case 'output-style':
124
+ return (0, output_style_command_1.outputStyleCommand)({ argv: argv.slice(1) });
125
+ case 'report':
126
+ return (0, report_command_1.reportCommand)({ root, argv: argv.slice(1) });
76
127
  default:
77
128
  console.log(USAGE);
78
129
  return command === undefined || command === '--help' || command === '-h' ? 0 : 1;
79
130
  }
80
131
  };
81
- tslib_1.__exportStar(require("./lib"), exports);
132
+ __exportStar(require("./lib"), exports);
133
+ const exitAfterDrain = (code) => {
134
+ process.exitCode = code;
135
+ // A piped stdout is written asynchronously, and exit() would cut off what is still buffered.
136
+ process.stdout.write('', () => process.exit(code));
137
+ };
82
138
  // Guarded so the package can also be imported as a library without running the CLI.
83
139
  if (require.main === module) {
84
140
  Promise.resolve()
85
141
  .then(() => run(process.argv.slice(2)))
86
- .then((code) => process.exit(code))
142
+ .then((code) => exitAfterDrain(code))
87
143
  .catch((error) => {
88
- console.error(error instanceof Error ? error.message : error);
89
- process.exit(1);
144
+ console.error((0, plain_text_1.plain)(error instanceof Error ? error.message : String(error)));
145
+ exitAfterDrain(1);
90
146
  });
91
147
  }
92
148
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/agent-rules/src/index.ts"],"names":[],"mappings":";;;;AACA,2BAA6D;AAC7D,+BAA4B;AAC5B,yCAA2F;AAC3F,6DAAwD;AACxD,2CAAwC;AACxC,qCAAyC;AAEzC,MAAM,KAAK,GAAG;;;;6CAI+B,yBAAgB;;;;;;;;;kDASX,sBAAa,CAAC,IAAI,CAAC,IAAI,CAAC;;;CAGzE,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,IAAc,EAAE,IAAY,EAAE,EAAE;IAChD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,KAAK,KAAK,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAEnC,OAAO,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACzB,CAAC,CAA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C,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,oFAAoF;AACpF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE;SACd,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACtC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SACpC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,IAAA,kBAAK,EAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7E,cAAc,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { AgentTarget } from './config';
2
+ export type CommandArgs = {
3
+ targets?: AgentTarget[];
4
+ root?: string;
5
+ dryRun: boolean;
6
+ help: boolean;
7
+ problems: string[];
8
+ };
9
+ export declare const parseCommandArgs: (command: string, argv: readonly string[]) => CommandArgs;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCommandArgs = void 0;
4
+ const VALUE_FLAGS = ['--targets', '--root'];
5
+ const FLAGS_BY_COMMAND = {
6
+ sync: ['--targets', '--root', '--dry-run'],
7
+ check: ['--targets', '--root'],
8
+ init: ['--root'],
9
+ migrate: ['--targets', '--root', '--dry-run'],
10
+ };
11
+ const parseCommandArgs = (command, argv) => {
12
+ var _a, _b;
13
+ const allowed = [...((_a = FLAGS_BY_COMMAND[command]) !== null && _a !== void 0 ? _a : []), '--help', '-h'];
14
+ const args = { dryRun: false, help: false, problems: [] };
15
+ for (let index = 0; index < argv.length; index += 1) {
16
+ const argument = (_b = argv[index]) !== null && _b !== void 0 ? _b : '';
17
+ const separator = argument.indexOf('=');
18
+ const flag = separator === -1 ? argument : argument.slice(0, separator);
19
+ if (!allowed.includes(flag)) {
20
+ args.problems.push(flag.startsWith('-') ? `Unknown flag "${flag}" for ${command}.` : `Unexpected argument "${argument}".`);
21
+ continue;
22
+ }
23
+ if (VALUE_FLAGS.includes(flag)) {
24
+ const value = separator === -1 ? argv[++index] : argument.slice(separator + 1);
25
+ const targets = value === null || value === void 0 ? void 0 : value.split(',').map((entry) => entry.trim()).filter((entry) => entry.length > 0);
26
+ if (!value || value.startsWith('-') || (flag === '--targets' && !(targets === null || targets === void 0 ? void 0 : targets.length))) {
27
+ args.problems.push(`${flag} needs a value.`);
28
+ continue;
29
+ }
30
+ if (flag === '--root')
31
+ args.root = value;
32
+ else
33
+ args.targets = targets;
34
+ continue;
35
+ }
36
+ if (separator !== -1) {
37
+ args.problems.push(`${flag} takes no value.`);
38
+ continue;
39
+ }
40
+ if (flag === '--dry-run')
41
+ args.dryRun = true;
42
+ else
43
+ args.help = true;
44
+ }
45
+ return args;
46
+ };
47
+ exports.parseCommandArgs = parseCommandArgs;
48
+ //# sourceMappingURL=cli-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/cli-args.ts"],"names":[],"mappings":";;;AAUA,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAE5C,MAAM,gBAAgB,GAA6B;IACjD,IAAI,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC;IAC1C,KAAK,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC;IAC9B,IAAI,EAAE,CAAC,QAAQ,CAAC;IAChB,OAAO,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC;CAC9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AO,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CACjB,KAAK,CAAC,GAAG,EACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAC3B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAEvC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA,CAAC,EAAE,CAAC;gBAClF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,iBAAiB,CAAC,CAAC;gBAC7C,SAAS;YACX,CAAC;YAED,IAAI,IAAI,KAAK,QAAQ;gBAAE,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;;gBACpC,IAAI,CAAC,OAAO,GAAG,OAAwB,CAAC;YAC7C,SAAS;QACX,CAAC;QAED,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAC;YAC9C,SAAS;QACX,CAAC;QAED,IAAI,IAAI,KAAK,WAAW;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;;YACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA3CW,QAAA,gBAAgB,oBA2C3B"}
@@ -0,0 +1,10 @@
1
+ /** The file that validates commit messages, as the skill should name it, or `null` when none does. */
2
+ export type CommitlintSource = string | null;
3
+ export declare const findCommitlintConfig: (root: string) => CommitlintSource;
4
+ /**
5
+ * The git-commit skill states where its format comes from, and whether a message can be verified,
6
+ * from what the repo actually has. Promising a `commitlint` run to a repo without one makes the
7
+ * agent narrate the contradiction it finds instead of just writing the commit — so a repo with no
8
+ * commitlint gets a guide that never mentions it.
9
+ */
10
+ export declare const commitMessageVars: (source: CommitlintSource) => Record<string, string>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commitMessageVars = exports.findCommitlintConfig = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const COMMITLINT_CONFIG_FILES = [
7
+ 'commitlint.config.js',
8
+ 'commitlint.config.cjs',
9
+ 'commitlint.config.mjs',
10
+ 'commitlint.config.ts',
11
+ 'commitlint.config.mts',
12
+ 'commitlint.config.json',
13
+ 'commitlint.config.yaml',
14
+ 'commitlint.config.yml',
15
+ '.commitlintrc',
16
+ '.commitlintrc.js',
17
+ '.commitlintrc.cjs',
18
+ '.commitlintrc.mjs',
19
+ '.commitlintrc.ts',
20
+ '.commitlintrc.json',
21
+ '.commitlintrc.yaml',
22
+ '.commitlintrc.yml',
23
+ ];
24
+ const findCommitlintConfig = (root) => {
25
+ const configFile = COMMITLINT_CONFIG_FILES.find((name) => (0, fs_1.existsSync)((0, path_1.join)(root, name)));
26
+ if (configFile)
27
+ return configFile;
28
+ const manifestPath = (0, path_1.join)(root, 'package.json');
29
+ if (!(0, fs_1.existsSync)(manifestPath))
30
+ return null;
31
+ const manifest = JSON.parse((0, fs_1.readFileSync)(manifestPath, 'utf8'));
32
+ return manifest.commitlint ? 'package.json' : null;
33
+ };
34
+ exports.findCommitlintConfig = findCommitlintConfig;
35
+ /**
36
+ * The git-commit skill states where its format comes from, and whether a message can be verified,
37
+ * from what the repo actually has. Promising a `commitlint` run to a repo without one makes the
38
+ * agent narrate the contradiction it finds instead of just writing the commit — so a repo with no
39
+ * commitlint gets a guide that never mentions it.
40
+ */
41
+ const commitMessageVars = (source) => source
42
+ ? {
43
+ commitRuleSource: `the **commitlint rules** in \`${source}\` - conventional commits with a required scope`,
44
+ commitValidation: 'When unsure a message passes, check it: `echo "<msg>" | npx commitlint`.',
45
+ }
46
+ : {
47
+ commitRuleSource: "this repo's **conventional-commit** convention",
48
+ commitValidation: 'Nothing checks the message once it is written, so get the type, scope and subject case right the first time.',
49
+ };
50
+ exports.commitMessageVars = commitMessageVars;
51
+ //# sourceMappingURL=commitlint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commitlint.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/commitlint.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,+BAA4B;AAK5B,MAAM,uBAAuB,GAAG;IAC9B,sBAAsB;IACtB,uBAAuB;IACvB,uBAAuB;IACvB,sBAAsB;IACtB,uBAAuB;IACvB,wBAAwB;IACxB,wBAAwB;IACxB,uBAAuB;IACvB,eAAe;IACf,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,kBAAkB;IAClB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AAEK,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAoB,EAAE;IACrE,MAAM,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAExF,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAElC,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAEhD,IAAI,CAAC,IAAA,eAAU,EAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAE3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,YAAY,EAAE,MAAM,CAAC,CAA6B,CAAC;IAE5F,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B;AAEF;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,MAAwB,EAA0B,EAAE,CACpF,MAAM;IACJ,CAAC,CAAC;QACE,gBAAgB,EAAE,iCAAiC,MAAM,iDAAiD;QAC1G,gBAAgB,EAAE,0EAA0E;KAC7F;IACH,CAAC,CAAC;QACE,gBAAgB,EAAE,gDAAgD;QAClE,gBAAgB,EACd,8GAA8G;KACjH,CAAC;AAVK,QAAA,iBAAiB,qBAUtB"}
@@ -5,16 +5,10 @@ export type AgentTarget = (typeof AGENT_TARGETS)[number];
5
5
  export declare const CONFIG_FILE_NAME = "ethlete-agents.config.json";
6
6
  export declare const LOCAL_CONFIG_FILE_NAME = "ethlete-agents.config.local.json";
7
7
  /**
8
- * Non-secret Jira wiring, committed with the repo — `git-flow start` resolves an issue key through
9
- * it. Credentials never live here; they come from the environment or the gitignored local config.
8
+ * How this repo reads a Jira issue into a branch name. The instance, the credentials and the subject
9
+ * field are not here and cannot be: the Timetrack app holds them, and `git-flow start` asks it.
10
10
  */
11
11
  export type JiraSettings = {
12
- host?: string;
13
- /**
14
- * The instance's field holding a Story's branch subject (`customfield_10050`). Without it the
15
- * summary is slugified instead, which is a paraphrase rather than the agreed subject.
16
- */
17
- subjectField?: string;
18
12
  /** Branch type per Jira issue type, e.g. `{ "Bug": "fix" }`. Anything unlisted becomes `feat`. */
19
13
  typeByIssueType?: Record<string, string>;
20
14
  };
@@ -31,39 +25,66 @@ export type SyncConfig = {
31
25
  * `AGENTS.md` marker block, and a second copy would load twice.
32
26
  */
33
27
  claudeMdImportsAgentsMd: boolean;
34
- /** Opt-in agent hooks (they run commands on the developer's machine, so never default). */
28
+ /** Opt-in agent hooks: they run commands on the developer's machine, so never default. */
35
29
  hooks: string[];
36
30
  /** Opt-in git hooks, appended to the repo's own husky hooks. Same reason they never default. */
37
31
  gitHooks: string[];
32
+ /** Opt-in Claude Code mods from the `ethlete` marketplace the package ships. */
33
+ mods: string[];
38
34
  /** The branch grammar, resolved against its defaults — see `@ethlete/agent-rules/git-flow`. */
39
35
  gitFlow: GitFlowConfig;
40
36
  jira: JiraSettings;
37
+ configWarnings?: string[];
38
+ };
39
+ /** Opt-in settings of the `away-mode` hook: the skills whose sessions it tracks, the idle threshold, and the command printing the report table on return. */
40
+ export type AwayModeConfig = {
41
+ skills?: string[];
42
+ thresholdMinutes?: number;
43
+ reportCommand?: string;
44
+ };
45
+ /** Opt-in settings of `ethlete-agents report`: repo-relative paths of the markdown files holding row tables and the queue. */
46
+ export type ReportConfig = {
47
+ planFiles?: string[];
48
+ };
49
+ /** The nearest directory at or above `start` holding an `ethlete-agents.config.json`, else `start`. */
50
+ export declare const resolveRepoRoot: (start: string) => string;
51
+ /** The `report` block of the repo config, or an empty one when the file or the key is missing. */
52
+ export declare const readReportConfig: (root: string) => ReportConfig;
53
+ /** Settings of the `builder-idle-check` hook for a repo whose queue is not `plans/QUEUE.md`. */
54
+ export type BuilderIdleConfig = {
55
+ queues?: {
56
+ path: string;
57
+ format?: 'table' | 'checkbox';
58
+ }[];
59
+ waitPatterns?: string[];
60
+ roles?: string[];
41
61
  };
42
62
  /**
43
63
  * The gitignored local config holds per-machine values, read at runtime — by the generated hook
44
- * scripts, and by the agent while following a skill — never by `sync`. Sync output must be
64
+ * scripts, and by the agent while following a skill — never by `sync`, except `mods`. Sync output must be
45
65
  * identical on every machine and in CI (the generated files are committed and `check` diffs them),
46
66
  * so nothing here may change what gets emitted:
47
67
  *
48
68
  * - `disableHooks: true` silences every generated hook, `["context-warning"]` just the named ones.
69
+ * - `mods` enables Claude Code mods on this machine only. It is the one key `sync` reads: it writes them
70
+ * into the gitignored `.claude/settings.local.json`, never into the committed `settings.json`.
49
71
  * - `disableAutoHandoffSave: true` keeps the context-warning hook's normal tiered messages (including
50
72
  * in auto mode), but at the critical tier in auto mode it falls back to just recommending
51
73
  * a handoff instead of writing the handoff file automatically.
52
- * - `sdkSourcePath` points at a local `ethlete-sdk` checkout, which the SDK source and local-build
53
- * skills read when they need the SDK's own sources instead of the published package.
54
- * - `jira` holds the per-user Jira credentials `git-flow start` needs. This is the one place in the
55
- * repo a secret may sit, and only because the file is gitignored; `JIRA_EMAIL`/`JIRA_API_TOKEN`
56
- * in the environment are the alternative.
74
+ *
75
+ * Where the sibling checkouts live (`sdkSourcePath`, `apiRepoPaths`, `apiRepoBranches`) is not here:
76
+ * it moved to `ethlete.config.local.json`, which the `et` CLI owns, because `et` reads the same values.
77
+ *
78
+ * No secret belongs here any more. Jira is reached through the Timetrack app, which holds the token
79
+ * in the machine's keychain — one secret per machine rather than one per checkout.
57
80
  */
58
81
  export type LocalConfig = {
59
82
  disableHooks?: boolean | string[];
60
83
  disableAutoHandoffSave?: boolean;
61
- sdkSourcePath?: string;
62
- jira?: {
63
- host?: string;
64
- email?: string;
65
- token?: string;
66
- };
84
+ awayMode?: AwayModeConfig;
85
+ builderSlots?: number;
86
+ builderIdle?: BuilderIdleConfig;
87
+ mods?: string[];
67
88
  };
68
89
  export type LocalConfigState = {
69
90
  exists: false;
@@ -75,10 +96,20 @@ export type LocalConfigState = {
75
96
  valid: true;
76
97
  config: LocalConfig;
77
98
  unknownKeys: string[];
99
+ movedKeys: string[];
78
100
  };
101
+ export declare const LOCAL_CONFIG_KEYS: (keyof LocalConfig)[];
102
+ /**
103
+ * Repo topology moved to `ethlete.config.local.json`, which the `et` CLI owns, because `et` needs it too.
104
+ * Still recognised here so a checkout that has not moved them yet gets told where they went
105
+ * instead of an "unsupported key" warning.
106
+ */
107
+ export declare const MOVED_LOCAL_CONFIG_KEYS: string[];
108
+ /** Named only to point a migration at it. The `et` CLI owns the file and validates its values. */
109
+ export declare const TOPOLOGY_CONFIG_FILE_NAME = "ethlete.config.local.json";
79
110
  export declare const readLocalConfig: (root: string) => LocalConfigState;
80
111
  /**
81
- * Emit for the agents a repo already uses. `codex` is always included: `AGENTS.md` is the
112
+ * Emit for the agents a repo already uses (a `.claude` directory or a `CLAUDE.md` file means Claude). `codex` is always included: `AGENTS.md` is the
82
113
  * cross-tool standard that Cursor, Copilot and most other agents read as well, and gating it on
83
114
  * an existing `AGENTS.md` would mean the file that triggers Codex output is the very file the
84
115
  * sync is supposed to create.