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

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 +742 -0
  3. package/CLAUDE.md +1 -0
  4. package/README.md +430 -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 +388 -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 +152 -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 +100 -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 +68 -43
  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 +64 -5
  113. package/src/lib/config.js +140 -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 +160 -38
  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 +2 -0
  206. package/src/lib/targets/claude-hooks.js +8 -3
  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
package/src/index.js CHANGED
@@ -1,17 +1,54 @@
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");
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");
8
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");
9
31
  const sync_1 = require("./lib/sync");
32
+ const timetrack_command_1 = require("./lib/timetrack-command");
10
33
  const USAGE = `ethlete-agents — compile @ethlete agent rules and skills into your repo
11
34
 
12
35
  ethlete-agents sync Write the generated rules/skills for every detected agent
13
36
  ethlete-agents check Exit non-zero when the generated files are out of date (for CI)
14
37
  ethlete-agents init Write a starter ${config_1.CONFIG_FILE_NAME}
38
+ ethlete-agents git-flow Name, check and repair branches against the repo's git flow
39
+ (start, check, repair, explain)
40
+ ethlete-agents output-style
41
+ Install an Ethlete output style into this machine's Claude Code
42
+ config and switch to it (Claude Code only)
43
+ ethlete-agents timetrack Ask the running Timetrack app about Jira - it holds this
44
+ machine's credentials, so no repo needs a token
45
+ (status, instance, issue, search, project, create, log)
46
+ ethlete-agents sessions Run agents in tmux sessions of one checkout: message them, wake idle
47
+ ones, restart one with a prompt, claim paths (run, up, down, restart,
48
+ send, inbox, claim). The old name "mailbox" works too
49
+ ethlete-agents report Print a table of what was done in a period: rows with their commits,
50
+ parked rows, commit counts, CI and subagent figures
51
+ (today, yesterday, week, --since <date> [--until <date>])
15
52
  ethlete-agents migrate Convert the repo to the AGENTS.md + .agents/skills layout:
16
53
  CLAUDE.md content moves into AGENTS.md (CLAUDE.md becomes an
17
54
  @AGENTS.md import), hand-written .claude/skills move to
@@ -19,7 +56,8 @@ const USAGE = `ethlete-agents — compile @ethlete agent rules and skills into y
19
56
 
20
57
  Options
21
58
  --targets <list> Comma-separated subset of: ${config_1.AGENT_TARGETS.join(', ')}
22
- --root <path> Repo root to write into (default: current directory)
59
+ --root <path> Repo root to write into (default: the nearest directory holding
60
+ ${config_1.CONFIG_FILE_NAME}, else the current directory)
23
61
  --dry-run Print what would change without writing (sync and migrate)
24
62
  `;
25
63
  const readFlag = (args, flag) => {
@@ -28,60 +66,89 @@ const readFlag = (args, flag) => {
28
66
  return undefined;
29
67
  return args[index + 1];
30
68
  };
31
- const parseTargets = (args) => {
32
- const raw = readFlag(args, '--targets');
33
- if (!raw)
34
- return undefined;
35
- return raw.split(',').map((entry) => entry.trim());
36
- };
37
- const readVersion = () => {
38
- const manifest = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
39
- return manifest.version;
40
- };
69
+ const INIT_VARS = ['lintCommand', 'lintFixCommand', 'formatCommand', 'storybookStartCommand', 'storybookUrl'];
41
70
  const init = (root) => {
42
71
  const path = (0, path_1.join)(root, config_1.CONFIG_FILE_NAME);
43
72
  if ((0, fs_1.existsSync)(path)) {
44
73
  console.error(`${config_1.CONFIG_FILE_NAME} already exists.`);
45
74
  return 1;
46
75
  }
76
+ const defaults = (0, package_runner_1.followPackageManager)(root, (0, load_content_1.loadDefaultVars)());
77
+ const detected = (0, package_runner_1.detectCommandVars)(root);
78
+ 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));
47
79
  const template = {
48
80
  targets: (0, config_1.detectTargets)(root),
49
- vars: {},
81
+ vars,
50
82
  exclude: [],
51
83
  hooks: [],
52
84
  };
53
- (0, fs_1.writeFileSync)(path, `${JSON.stringify(template, null, 2)}\n`, 'utf8');
54
- console.log(`Wrote ${config_1.CONFIG_FILE_NAME}. Fill in "vars" for your repo, then run \`ethlete-agents sync\`.`);
85
+ (0, prettier_1.writeJsonFile)({ file: path, value: template });
86
+ 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\`.`);
55
87
  return 0;
56
88
  };
57
- const run = (argv) => {
58
- var _a;
59
- const command = argv[0];
60
- const root = (_a = readFlag(argv, '--root')) !== null && _a !== void 0 ? _a : process.cwd();
61
- const options = { root, version: readVersion(), targets: parseTargets(argv) };
89
+ const STRICT_COMMANDS = ['sync', 'check', 'init', 'migrate'];
90
+ const runStrict = (command, args) => {
91
+ var _a, _b;
92
+ const root = (_a = args.root) !== null && _a !== void 0 ? _a : (0, config_1.resolveRepoRoot)(process.cwd());
93
+ const options = { root, targets: args.targets };
62
94
  switch (command) {
63
95
  case 'sync':
64
- return (0, sync_1.sync)(Object.assign(Object.assign({}, options), { dryRun: argv.includes('--dry-run') }));
96
+ return (0, sync_1.sync)(Object.assign(Object.assign({}, options), { dryRun: args.dryRun }));
65
97
  case 'check':
66
98
  return (0, sync_1.check)(options);
67
99
  case 'init':
68
- return init(root);
69
- case 'migrate':
70
- return (0, migrate_1.migrate)(Object.assign(Object.assign({}, options), { dryRun: argv.includes('--dry-run') }));
100
+ return init((_b = args.root) !== null && _b !== void 0 ? _b : process.cwd());
101
+ default:
102
+ return (0, migrate_1.migrate)(Object.assign(Object.assign({}, options), { dryRun: args.dryRun }));
103
+ }
104
+ };
105
+ const run = (argv) => {
106
+ var _a;
107
+ const command = argv[0];
108
+ if (command !== undefined && STRICT_COMMANDS.includes(command)) {
109
+ const args = (0, cli_args_1.parseCommandArgs)(command, argv.slice(1));
110
+ if (args.problems.length) {
111
+ console.error(`${args.problems.join('\n')}\n\n${USAGE}`);
112
+ return 1;
113
+ }
114
+ if (args.help) {
115
+ console.log(USAGE);
116
+ return 0;
117
+ }
118
+ return runStrict(command, args);
119
+ }
120
+ const root = (_a = readFlag(argv, '--root')) !== null && _a !== void 0 ? _a : (0, config_1.resolveRepoRoot)(process.cwd());
121
+ switch (command) {
122
+ case 'git-flow':
123
+ return (0, git_flow_command_1.gitFlowCommand)({ root, argv: argv.slice(1) });
124
+ case 'sessions':
125
+ case 'mailbox':
126
+ return (0, sessions_command_1.sessionsCommand)({ argv: argv.slice(1) });
127
+ case 'output-style':
128
+ return (0, output_style_command_1.outputStyleCommand)({ argv: argv.slice(1) });
129
+ case 'report':
130
+ return (0, report_command_1.reportCommand)({ root, argv: argv.slice(1) });
131
+ case 'timetrack':
132
+ return (0, timetrack_command_1.timetrackCommand)({ root, argv: argv.slice(1) });
71
133
  default:
72
134
  console.log(USAGE);
73
135
  return command === undefined || command === '--help' || command === '-h' ? 0 : 1;
74
136
  }
75
137
  };
76
- tslib_1.__exportStar(require("./lib"), exports);
138
+ __exportStar(require("./lib"), exports);
139
+ const exitAfterDrain = (code) => {
140
+ process.exitCode = code;
141
+ // A piped stdout is written asynchronously, and exit() would cut off what is still buffered.
142
+ process.stdout.write('', () => process.exit(code));
143
+ };
77
144
  // Guarded so the package can also be imported as a library without running the CLI.
78
145
  if (require.main === module) {
79
- try {
80
- process.exit(run(process.argv.slice(2)));
81
- }
82
- catch (error) {
83
- console.error(error instanceof Error ? error.message : error);
84
- process.exit(1);
85
- }
146
+ Promise.resolve()
147
+ .then(() => run(process.argv.slice(2)))
148
+ .then((code) => exitAfterDrain(code))
149
+ .catch((error) => {
150
+ console.error((0, plain_text_1.plain)(error instanceof Error ? error.message : String(error)));
151
+ exitAfterDrain(1);
152
+ });
86
153
  }
87
154
  //# 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,2CAAwC;AACxC,qCAAyC;AAEzC,MAAM,KAAK,GAAG;;;;6CAI+B,yBAAgB;;;;;;;kDAOX,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,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,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AO,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;CAC9C,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,IAAuB,EAAe,EAAE;;IACxF,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,MAAA,gBAAg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I,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"}
@@ -1,8 +1,17 @@
1
1
  import { ContentScope } from './frontmatter';
2
+ import { GitFlowConfig } from './git-flow';
2
3
  export declare const AGENT_TARGETS: readonly ["claude", "codex", "cursor", "copilot"];
3
4
  export type AgentTarget = (typeof AGENT_TARGETS)[number];
4
5
  export declare const CONFIG_FILE_NAME = "ethlete-agents.config.json";
5
6
  export declare const LOCAL_CONFIG_FILE_NAME = "ethlete-agents.config.local.json";
7
+ /**
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
+ */
11
+ export type JiraSettings = {
12
+ /** Branch type per Jira issue type, e.g. `{ "Bug": "fix" }`. Anything unlisted becomes `feat`. */
13
+ typeByIssueType?: Record<string, string>;
14
+ };
6
15
  export type SyncConfig = {
7
16
  root: string;
8
17
  targets: AgentTarget[];
@@ -16,8 +25,42 @@ export type SyncConfig = {
16
25
  * `AGENTS.md` marker block, and a second copy would load twice.
17
26
  */
18
27
  claudeMdImportsAgentsMd: boolean;
19
- /** Opt-in agent hooks (they run commands on the developer's machine, so never default). */
28
+ /**
29
+ * Opt-in agent hooks (they run commands on the developer's machine, so never default), plus
30
+ * `DESIGN_SYSTEM_HOOKS` in a repo with a design system.
31
+ */
20
32
  hooks: string[];
33
+ /** Opt-in git hooks, appended to the repo's own husky hooks. Same reason they never default. */
34
+ gitHooks: string[];
35
+ /** Opt-in Claude Code mods from the `ethlete` marketplace the package ships. */
36
+ mods: string[];
37
+ /** The branch grammar, resolved against its defaults — see `@ethlete/agent-rules/git-flow`. */
38
+ gitFlow: GitFlowConfig;
39
+ jira: JiraSettings;
40
+ configWarnings?: string[];
41
+ };
42
+ /** 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. */
43
+ export type AwayModeConfig = {
44
+ skills?: string[];
45
+ thresholdMinutes?: number;
46
+ reportCommand?: string;
47
+ };
48
+ /** Opt-in settings of `ethlete-agents report`: repo-relative paths of the markdown files holding row tables and the queue. */
49
+ export type ReportConfig = {
50
+ planFiles?: string[];
51
+ };
52
+ /** The nearest directory at or above `start` holding an `ethlete-agents.config.json`, else `start`. */
53
+ export declare const resolveRepoRoot: (start: string) => string;
54
+ /** The `report` block of the repo config, or an empty one when the file or the key is missing. */
55
+ export declare const readReportConfig: (root: string) => ReportConfig;
56
+ /** Settings of the `builder-idle-check` hook for a repo whose queue is not `plans/QUEUE.md`. */
57
+ export type BuilderIdleConfig = {
58
+ queues?: {
59
+ path: string;
60
+ format?: 'table' | 'checkbox';
61
+ }[];
62
+ waitPatterns?: string[];
63
+ roles?: string[];
21
64
  };
22
65
  /**
23
66
  * The gitignored local config holds per-machine values, read at runtime — by the generated hook
@@ -29,13 +72,19 @@ export type SyncConfig = {
29
72
  * - `disableAutoHandoffSave: true` keeps the context-warning hook's normal tiered messages (including
30
73
  * in auto mode), but at the critical tier in auto mode it falls back to just recommending
31
74
  * a handoff instead of writing the handoff file automatically.
32
- * - `sdkSourcePath` points at a local `ethlete-sdk` checkout, which the SDK source and local-build
33
- * skills read when they need the SDK's own sources instead of the published package.
75
+ *
76
+ * Where the sibling checkouts live (`sdkSourcePath`, `apiRepoPaths`, `apiRepoBranches`) is not here:
77
+ * it moved to `@ethlete/cli`'s `ethlete.config.local.json`, because `et` reads the same values.
78
+ *
79
+ * No secret belongs here any more. Jira is reached through the Timetrack app, which holds the token
80
+ * in the machine's keychain — one secret per machine rather than one per checkout.
34
81
  */
35
82
  export type LocalConfig = {
36
83
  disableHooks?: boolean | string[];
37
84
  disableAutoHandoffSave?: boolean;
38
- sdkSourcePath?: string;
85
+ awayMode?: AwayModeConfig;
86
+ builderSlots?: number;
87
+ builderIdle?: BuilderIdleConfig;
39
88
  };
40
89
  export type LocalConfigState = {
41
90
  exists: false;
@@ -47,10 +96,20 @@ export type LocalConfigState = {
47
96
  valid: true;
48
97
  config: LocalConfig;
49
98
  unknownKeys: string[];
99
+ movedKeys: string[];
50
100
  };
101
+ export declare const LOCAL_CONFIG_KEYS: (keyof LocalConfig)[];
102
+ /**
103
+ * Repo topology moved to `@ethlete/cli`'s `ethlete.config.local.json`, 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. `@ethlete/cli` owns the file and validates its values. */
109
+ export declare const TOPOLOGY_CONFIG_FILE_NAME = "ethlete.config.local.json";
51
110
  export declare const readLocalConfig: (root: string) => LocalConfigState;
52
111
  /**
53
- * 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
54
113
  * cross-tool standard that Cursor, Copilot and most other agents read as well, and gating it on
55
114
  * an existing `AGENTS.md` would mean the file that triggers Codex output is the very file the
56
115
  * sync is supposed to create.