@ethlete/agent-rules 0.1.0-next.3 → 0.1.0-next.30

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 (200) hide show
  1. package/AGENTS.md +28 -0
  2. package/CHANGELOG.md +463 -0
  3. package/CLAUDE.md +1 -0
  4. package/README.md +362 -29
  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/context-warning.py +871 -110
  10. package/content/hooks/subagent-model-policy.py +194 -0
  11. package/content/mods/.claude-plugin/marketplace.json +11 -0
  12. package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
  13. package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
  14. package/content/mods/plugins/e2e-progress/hooks/register.tsx +442 -0
  15. package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
  16. package/content/mods/plugins/e2e-progress/types/index.d.ts +23 -0
  17. package/content/output-styles/ste-clarity.md +131 -0
  18. package/content/rules/agent-sessions-wake-up.md +11 -0
  19. package/content/rules/app-styling.md +66 -0
  20. package/content/rules/comments.md +4 -1
  21. package/content/rules/lint-and-format.md +7 -5
  22. package/content/rules/nx-layout.md +50 -0
  23. package/content/rules/reactive-state.md +1 -1
  24. package/content/rules/styling.md +9 -7
  25. package/content/rules/subagent-models.md +39 -0
  26. package/content/skills/agent-sessions/SKILL.md +81 -0
  27. package/content/skills/agent-sessions/agent-sessions.mjs +492 -0
  28. package/content/skills/angular-patterns/SKILL.md +30 -7
  29. package/content/skills/api-source/SKILL.md +156 -0
  30. package/content/skills/app-testing/SKILL.md +141 -0
  31. package/content/skills/codex-subagent/SKILL.md +90 -0
  32. package/content/skills/codex-subagent/codex-agent.mjs +229 -0
  33. package/content/skills/design-exploration/SKILL.md +657 -0
  34. package/content/skills/design-exploration/check-story.mjs +139 -0
  35. package/content/skills/design-exploration/shoot-template.mjs +61 -0
  36. package/content/skills/domain-modeling/ADR-FORMAT.md +47 -0
  37. package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  38. package/content/skills/domain-modeling/SKILL.md +80 -0
  39. package/content/skills/e2e-triage/SKILL.md +80 -0
  40. package/content/skills/figma-export/SKILL.md +191 -0
  41. package/content/skills/figma-export/dump-figma-layers.py +83 -0
  42. package/content/skills/figma-export/dump-figma-svg.py +235 -0
  43. package/content/skills/figma-export/measure-template.mjs +87 -0
  44. package/content/skills/git-commit/SKILL.md +11 -7
  45. package/content/skills/git-flow/SKILL.md +87 -0
  46. package/content/skills/grill-with-docs/SKILL.md +13 -0
  47. package/content/skills/grilling/SKILL.md +51 -0
  48. package/content/skills/handoff/SKILL.md +125 -5
  49. package/content/skills/query/SKILL.md +165 -64
  50. package/content/skills/rxjs-signals/SKILL.md +33 -4
  51. package/content/skills/sdk-docs/SKILL.md +50 -14
  52. package/content/skills/sdk-local-build/SKILL.md +26 -8
  53. package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
  54. package/content/skills/sdk-source/SKILL.md +37 -34
  55. package/content/skills/sdk-update/SKILL.md +103 -0
  56. package/content/skills/story-styling/SKILL.md +10 -8
  57. package/content/skills/styleguide/SKILL.md +12 -7
  58. package/content/skills/styleguide/assets.md +54 -0
  59. package/content/skills/styleguide/changesets.md +17 -0
  60. package/content/skills/styleguide/file-structure.md +73 -0
  61. package/content/skills/styleguide/lint-rule-lookup.md +51 -0
  62. package/content/skills/styleguide/storybook-structure.md +25 -0
  63. package/content/skills/theming/SKILL.md +50 -28
  64. package/content/skills/timetrack/SKILL.md +397 -0
  65. package/content/skills/verify-in-app/SKILL.md +107 -0
  66. package/migrations/app-styling-utilities.md +63 -0
  67. package/migrations/list-state-query-form.md +20 -0
  68. package/migrations/nx-layout.md +29 -0
  69. package/migrations/sdk-components-over-hand-built-ui.md +27 -0
  70. package/migrations/search-query-field.md +52 -0
  71. package/migrations.json +48 -0
  72. package/package.json +19 -3
  73. package/src/index.js +85 -30
  74. package/src/index.js.map +1 -1
  75. package/src/lib/cli-args.d.ts +9 -0
  76. package/src/lib/cli-args.js +48 -0
  77. package/src/lib/cli-args.js.map +1 -0
  78. package/src/lib/commitlint.d.ts +10 -0
  79. package/src/lib/commitlint.js +51 -0
  80. package/src/lib/commitlint.js.map +1 -0
  81. package/src/lib/config.d.ts +41 -5
  82. package/src/lib/config.js +117 -10
  83. package/src/lib/config.js.map +1 -1
  84. package/src/lib/filter.d.ts +2 -0
  85. package/src/lib/filter.js +4 -4
  86. package/src/lib/filter.js.map +1 -1
  87. package/src/lib/frontmatter.d.ts +2 -0
  88. package/src/lib/frontmatter.js +33 -5
  89. package/src/lib/frontmatter.js.map +1 -1
  90. package/src/lib/git-flow/build.d.ts +35 -0
  91. package/src/lib/git-flow/build.js +24 -0
  92. package/src/lib/git-flow/build.js.map +1 -0
  93. package/src/lib/git-flow/config.d.ts +59 -0
  94. package/src/lib/git-flow/config.js +50 -0
  95. package/src/lib/git-flow/config.js.map +1 -0
  96. package/src/lib/git-flow/index.d.ts +6 -0
  97. package/src/lib/git-flow/index.js +23 -0
  98. package/src/lib/git-flow/index.js.map +1 -0
  99. package/src/lib/git-flow/parse.d.ts +49 -0
  100. package/src/lib/git-flow/parse.js +300 -0
  101. package/src/lib/git-flow/parse.js.map +1 -0
  102. package/src/lib/git-flow/rename.d.ts +24 -0
  103. package/src/lib/git-flow/rename.js +70 -0
  104. package/src/lib/git-flow/rename.js.map +1 -0
  105. package/src/lib/git-flow/start.d.ts +49 -0
  106. package/src/lib/git-flow/start.js +57 -0
  107. package/src/lib/git-flow/start.js.map +1 -0
  108. package/src/lib/git-flow/validate.d.ts +34 -0
  109. package/src/lib/git-flow/validate.js +72 -0
  110. package/src/lib/git-flow/validate.js.map +1 -0
  111. package/src/lib/git-flow-command.d.ts +4 -0
  112. package/src/lib/git-flow-command.js +165 -0
  113. package/src/lib/git-flow-command.js.map +1 -0
  114. package/src/lib/git-flow-repair.d.ts +17 -0
  115. package/src/lib/git-flow-repair.js +165 -0
  116. package/src/lib/git-flow-repair.js.map +1 -0
  117. package/src/lib/git-flow-start.d.ts +20 -0
  118. package/src/lib/git-flow-start.js +140 -0
  119. package/src/lib/git-flow-start.js.map +1 -0
  120. package/src/lib/git.d.ts +64 -0
  121. package/src/lib/git.js +131 -0
  122. package/src/lib/git.js.map +1 -0
  123. package/src/lib/gitlab.d.ts +35 -0
  124. package/src/lib/gitlab.js +116 -0
  125. package/src/lib/gitlab.js.map +1 -0
  126. package/src/lib/index.d.ts +2 -0
  127. package/src/lib/index.js +26 -11
  128. package/src/lib/index.js.map +1 -1
  129. package/src/lib/migrate.js +6 -1
  130. package/src/lib/migrate.js.map +1 -1
  131. package/src/lib/output-style-command.d.ts +3 -0
  132. package/src/lib/output-style-command.js +69 -0
  133. package/src/lib/output-style-command.js.map +1 -0
  134. package/src/lib/output-style.d.ts +38 -0
  135. package/src/lib/output-style.js +134 -0
  136. package/src/lib/output-style.js.map +1 -0
  137. package/src/lib/owned-paths.js +27 -3
  138. package/src/lib/owned-paths.js.map +1 -1
  139. package/src/lib/package-runner.d.ts +4 -0
  140. package/src/lib/package-runner.js +86 -0
  141. package/src/lib/package-runner.js.map +1 -0
  142. package/src/lib/plain-text.d.ts +9 -0
  143. package/src/lib/plain-text.js +22 -0
  144. package/src/lib/plain-text.js.map +1 -0
  145. package/src/lib/plan.d.ts +6 -6
  146. package/src/lib/plan.js +164 -40
  147. package/src/lib/plan.js.map +1 -1
  148. package/src/lib/prompt.d.ts +8 -0
  149. package/src/lib/prompt.js +35 -0
  150. package/src/lib/prompt.js.map +1 -0
  151. package/src/lib/render.d.ts +25 -2
  152. package/src/lib/render.js +43 -10
  153. package/src/lib/render.js.map +1 -1
  154. package/src/lib/sessions-command.d.ts +4 -0
  155. package/src/lib/sessions-command.js +16 -0
  156. package/src/lib/sessions-command.js.map +1 -0
  157. package/src/lib/sync.d.ts +0 -1
  158. package/src/lib/sync.js +30 -17
  159. package/src/lib/sync.js.map +1 -1
  160. package/src/lib/targets/agents-skills.js +1 -1
  161. package/src/lib/targets/agents-skills.js.map +1 -1
  162. package/src/lib/targets/claude-hooks.d.ts +3 -23
  163. package/src/lib/targets/claude-hooks.js +22 -86
  164. package/src/lib/targets/claude-hooks.js.map +1 -1
  165. package/src/lib/targets/claude-mods.d.ts +20 -0
  166. package/src/lib/targets/claude-mods.js +47 -0
  167. package/src/lib/targets/claude-mods.js.map +1 -0
  168. package/src/lib/targets/claude.js +2 -3
  169. package/src/lib/targets/claude.js.map +1 -1
  170. package/src/lib/targets/codex-hooks.d.ts +12 -0
  171. package/src/lib/targets/codex-hooks.js +35 -0
  172. package/src/lib/targets/codex-hooks.js.map +1 -0
  173. package/src/lib/targets/codex.js +4 -4
  174. package/src/lib/targets/codex.js.map +1 -1
  175. package/src/lib/targets/copilot.js +4 -4
  176. package/src/lib/targets/copilot.js.map +1 -1
  177. package/src/lib/targets/cursor.js +3 -3
  178. package/src/lib/targets/cursor.js.map +1 -1
  179. package/src/lib/targets/git-hooks.d.ts +25 -0
  180. package/src/lib/targets/git-hooks.js +71 -0
  181. package/src/lib/targets/git-hooks.js.map +1 -0
  182. package/src/lib/targets/hooks-shared.d.ts +60 -0
  183. package/src/lib/targets/hooks-shared.js +130 -0
  184. package/src/lib/targets/hooks-shared.js.map +1 -0
  185. package/src/lib/targets/mcp.d.ts +16 -0
  186. package/src/lib/targets/mcp.js +68 -0
  187. package/src/lib/targets/mcp.js.map +1 -0
  188. package/src/lib/targets/shared.d.ts +1 -9
  189. package/src/lib/targets/shared.js +4 -8
  190. package/src/lib/targets/shared.js.map +1 -1
  191. package/src/lib/timetrack-command.d.ts +11 -0
  192. package/src/lib/timetrack-command.js +1063 -0
  193. package/src/lib/timetrack-command.js.map +1 -0
  194. package/src/lib/timetrack-snapshot.d.ts +55 -0
  195. package/src/lib/timetrack-snapshot.js +120 -0
  196. package/src/lib/timetrack-snapshot.js.map +1 -0
  197. package/src/lib/timetrack.d.ts +561 -0
  198. package/src/lib/timetrack.js +279 -0
  199. package/src/lib/timetrack.js.map +1 -0
  200. package/content/skills/styleguide/STYLEGUIDE.md +0 -520
@@ -0,0 +1,34 @@
1
+ import { GitFlowConfig, GitFlowRule, GitFlowSeverity } from './config';
2
+ import { BranchParseResult, GitFlowFinding } from './parse';
3
+ export type GitFlowResolvedFinding = GitFlowFinding & {
4
+ severity: Exclude<GitFlowSeverity, 'off'>;
5
+ };
6
+ export type GitFlowReport = {
7
+ branch: string;
8
+ target?: string;
9
+ parse: BranchParseResult;
10
+ findings: GitFlowResolvedFinding[];
11
+ ok: boolean;
12
+ /** At least one finding resolved to `error`, so the hook or the CI job should exit non-zero. */
13
+ blocked: boolean;
14
+ };
15
+ /**
16
+ * `advisory` caps the *naming* rules at `warn`, because the whole naming zoo is deliberately
17
+ * accepted during the grace period. `protected-push` and `wrong-mr-target` are not naming rules
18
+ * and keep their configured severity in both modes — that is what lets `wrong-mr-target` be
19
+ * promoted to `error` before the naming grace period ends.
20
+ */
21
+ export declare const resolveSeverity: (options: {
22
+ rule: GitFlowRule;
23
+ config: GitFlowConfig;
24
+ }) => GitFlowSeverity;
25
+ /**
26
+ * The single place a verdict is computed — the CLI, the git hook, the CI job and timetrack all
27
+ * call this rather than re-deriving the rules.
28
+ */
29
+ export declare const validateBranch: (options: {
30
+ branch: string;
31
+ config: GitFlowConfig;
32
+ target?: string;
33
+ push?: boolean;
34
+ }) => GitFlowReport;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateBranch = exports.resolveSeverity = void 0;
4
+ const parse_1 = require("./parse");
5
+ /**
6
+ * `advisory` caps the *naming* rules at `warn`, because the whole naming zoo is deliberately
7
+ * accepted during the grace period. `protected-push` and `wrong-mr-target` are not naming rules
8
+ * and keep their configured severity in both modes — that is what lets `wrong-mr-target` be
9
+ * promoted to `error` before the naming grace period ends.
10
+ */
11
+ const resolveSeverity = (options) => {
12
+ const { rule, config } = options;
13
+ const configured = config.severity[rule];
14
+ if (configured === 'off')
15
+ return 'off';
16
+ if (rule === 'protected-push' || rule === 'wrong-mr-target')
17
+ return configured;
18
+ return config.enforcement === 'gated' ? configured : 'warn';
19
+ };
20
+ exports.resolveSeverity = resolveSeverity;
21
+ const mrTargetFindings = (options) => {
22
+ const { parse, target, config } = options;
23
+ if (parse.kind === 'unknown' || parse.expectedMrTargets.includes(target))
24
+ return [];
25
+ // A flat feature branch is how the zoo spells a sub-branch of an integration branch, and `dev-*`
26
+ // is an integration branch under its old name — so any main feature may target any other. Tighten
27
+ // this and the rule fires on the team's entire real workflow.
28
+ if (parse.kind === 'main-feature' && (0, parse_1.parseBranch)({ branch: target, config }).kind === 'main-feature')
29
+ return [];
30
+ const expected = parse.expectedMrTargets;
31
+ return [
32
+ {
33
+ rule: 'wrong-mr-target',
34
+ message: expected.length
35
+ ? `A ${parse.kind} branch must merge into ${expected.join(' or ')}, not ${target}.`
36
+ : `A ${parse.kind} branch has no merge request target.`,
37
+ suggestion: expected[0],
38
+ },
39
+ ];
40
+ };
41
+ /**
42
+ * The single place a verdict is computed — the CLI, the git hook, the CI job and timetrack all
43
+ * call this rather than re-deriving the rules.
44
+ */
45
+ const validateBranch = (options) => {
46
+ const { config, push } = options;
47
+ const branch = (0, parse_1.stripRefPrefix)(options.branch);
48
+ const target = options.target ? (0, parse_1.stripRefPrefix)(options.target) : undefined;
49
+ const parse = (0, parse_1.parseBranch)({ branch, config });
50
+ const findings = [...parse.findings];
51
+ if (target)
52
+ findings.push(...mrTargetFindings({ parse, target, config }));
53
+ if (push && parse.kind === 'protected') {
54
+ findings.push({
55
+ rule: 'protected-push',
56
+ message: `${branch} is protected — push a branch and open a merge request.`,
57
+ });
58
+ }
59
+ const resolved = findings
60
+ .map((finding) => (Object.assign(Object.assign({}, finding), { severity: (0, exports.resolveSeverity)({ rule: finding.rule, config }) })))
61
+ .filter((finding) => finding.severity !== 'off');
62
+ return {
63
+ branch,
64
+ target,
65
+ parse,
66
+ findings: resolved,
67
+ ok: resolved.length === 0,
68
+ blocked: resolved.some((finding) => finding.severity === 'error'),
69
+ };
70
+ };
71
+ exports.validateBranch = validateBranch;
72
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/git-flow/validate.ts"],"names":[],"mappings":";;;AACA,mCAAyF;AAczF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,OAAqD,EAAmB,EAAE;IACxG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAI,UAAU,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACvC,IAAI,IAAI,KAAK,gBAAgB,IAAI,IAAI,KAAK,iBAAiB;QAAE,OAAO,UAAU,CAAC;IAE/E,OAAO,MAAM,CAAC,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;AAC9D,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEF,MAAM,gBAAgB,GAAG,CAAC,OAIzB,EAAoB,EAAE;IACrB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE1C,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IAEpF,iGAAiG;IACjG,kGAAkG;IAClG,8DAA8D;IAC9D,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,IAAA,mBAAW,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,EAAE,CAAC;IAEhH,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AAO,EAAE,EAAE,CAAC,iCAAM,OAAO,KAAE,QAAQ,EAAE,IAAA,uBAAe,EAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,IAAG,CAAC;SAC7F,MAAM,CAAC,CAAC,OAAO,EAAqC,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC;IAEtF,OAAO;QACL,MAAM;QACN,MAAM;QACN,KAAK;QACL,QAAQ,EAAE,QAAQ;QAClB,EAAE,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;QACzB,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;KAClE,CAAC;AACJ,CAAC,CAAC;AAjCW,QAAA,cAAc,kBAiCzB"}
@@ -0,0 +1,4 @@
1
+ export declare const gitFlowCommand: (options: {
2
+ root: string;
3
+ argv: string[];
4
+ }) => Promise<number>;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.gitFlowCommand = void 0;
13
+ const config_1 = require("./config");
14
+ const git_1 = require("./git");
15
+ const git_flow_1 = require("./git-flow");
16
+ const git_flow_repair_1 = require("./git-flow-repair");
17
+ const git_flow_start_1 = require("./git-flow-start");
18
+ const describeParse = (parse) => {
19
+ const lines = [` kind ${parse.kind}${parse.deprecated ? ' (deprecated spelling)' : ''}`];
20
+ if (parse.type)
21
+ lines.push(` type ${parse.type}`);
22
+ if (parse.storyKey)
23
+ lines.push(` story ${parse.storyKey}${parse.inheritedFrom ? ` (from ${parse.inheritedFrom})` : ''}`);
24
+ if (parse.taskKey)
25
+ lines.push(` task ${parse.taskKey}`);
26
+ if (parse.subject)
27
+ lines.push(` subject ${parse.subject}`);
28
+ if (parse.parent)
29
+ lines.push(` parent ${parse.parent}`);
30
+ if (parse.expectedBase)
31
+ lines.push(` base ${parse.expectedBase}`);
32
+ lines.push(` merges to ${parse.expectedMrTargets.join(' or ') || '—'}`);
33
+ if (parse.suggestedName)
34
+ lines.push(` rename to ${parse.suggestedName}`);
35
+ return lines;
36
+ };
37
+ const checkOne = (options) => {
38
+ const { config, branch, target, push } = options;
39
+ const report = (0, git_flow_1.validateBranch)({ branch, target, push, config });
40
+ console.log(`Branch: ${report.branch}${report.target ? ` → ${report.target}` : ''}`);
41
+ if (report.ok) {
42
+ console.log(` ok ${report.parse.kind}`);
43
+ return 0;
44
+ }
45
+ for (const finding of report.findings) {
46
+ console.log(` ${finding.severity === 'error' ? 'error ' : 'warn '} ${finding.rule} ${finding.message}`);
47
+ }
48
+ if (report.blocked) {
49
+ console.error('\nBlocked by the finding(s) above.');
50
+ return 1;
51
+ }
52
+ console.log(`\nAdvisory only — nothing is blocked. Run \`ethlete-agents git-flow explain ${report.branch}\` for the full parse.`);
53
+ return 0;
54
+ };
55
+ const checkAll = (options) => {
56
+ var _a;
57
+ const { root, config } = options;
58
+ const branches = (0, git_1.allBranches)(root);
59
+ const counts = new Map();
60
+ const offenders = [];
61
+ let conforming = 0;
62
+ let counted = 0;
63
+ let deprecated = 0;
64
+ for (const branch of branches) {
65
+ const parse = (0, git_flow_1.parseBranch)({ branch, config });
66
+ for (const finding of parse.findings)
67
+ counts.set(finding.rule, ((_a = counts.get(finding.rule)) !== null && _a !== void 0 ? _a : 0) + 1);
68
+ if (parse.kind === 'protected')
69
+ continue;
70
+ if (parse.deprecated) {
71
+ deprecated++;
72
+ continue;
73
+ }
74
+ counted++;
75
+ if (parse.ok)
76
+ conforming++;
77
+ else
78
+ offenders.push(` ${branch}${parse.suggestedName ? ` → ${parse.suggestedName}` : ''}`);
79
+ }
80
+ const ratio = counted === 0 ? 100 : Math.round((conforming / counted) * 100);
81
+ console.log(`${conforming}/${counted} branches conform (${ratio}%), ${deprecated} deprecated, ${branches.length} scanned.`);
82
+ if (counts.size > 0) {
83
+ console.log('\nFindings');
84
+ [...counts.entries()]
85
+ .sort((a, b) => b[1] - a[1])
86
+ .forEach(([rule, count]) => console.log(` ${String(count).padStart(4)} ${rule}`));
87
+ }
88
+ if (offenders.length > 0) {
89
+ console.log('\nNon-conforming');
90
+ offenders.forEach((line) => console.log(line));
91
+ }
92
+ return 0;
93
+ };
94
+ const FLAGS_WITH_VALUE = ['--target', '--root', '--to', '--key', '--of', '--subject', '--type', '--release'];
95
+ const positionalArgs = (args) => args.filter((entry, index) => { var _a; return !entry.startsWith('--') && !FLAGS_WITH_VALUE.includes((_a = args[index - 1]) !== null && _a !== void 0 ? _a : ''); });
96
+ const flagValue = (args, flag) => {
97
+ const index = args.indexOf(flag);
98
+ return index === -1 ? undefined : args[index + 1];
99
+ };
100
+ const USAGE = `ethlete-agents git-flow — name, check and repair branches against the repo's git flow
101
+
102
+ git-flow start <KEY> Create the correctly named branch off the correct base
103
+ git-flow check [ref] Validate a branch name (default: the current branch)
104
+ git-flow check --all Adoption report over every local and remote branch
105
+ git-flow repair [ref] Rename a non-conforming branch and retarget its merge requests
106
+ git-flow explain [ref] Print what the parser saw
107
+
108
+ Options for check
109
+ --target <branch> Also validate the merge request target
110
+ --push Also report a direct push to a protected branch
111
+
112
+ Options for start
113
+ --subject <text> Use this subject instead of reading the issue from Jira
114
+ --of <branch> Nest under this branch instead of the parent story's own branch
115
+ --type <type> Branch type for a main feature (default: feat)
116
+ --hotfix Branch off production as a hotfix
117
+ --release <date> Create a release branch instead of a feature branch
118
+ --push Push the new branch and set its upstream
119
+
120
+ Options for repair
121
+ --key <KEY> The issue key to put into the new name
122
+ --to <branch> Use this name instead of the derived one
123
+ --no-mr-check Skip the GitLab merge request lookup (only when you know none point at it)
124
+
125
+ Options for start and repair
126
+ --yes Do not ask for confirmation
127
+ --dry-run Print the plan and stop
128
+ `;
129
+ const gitFlowCommand = (options) => __awaiter(void 0, void 0, void 0, function* () {
130
+ const { root, argv } = options;
131
+ // The subcommand is the first positional, not `argv[0]` — a global flag like `--root` may precede it.
132
+ const [subcommand, ref] = positionalArgs(argv);
133
+ const rest = argv;
134
+ const loaded = (0, config_1.loadConfig)({ root });
135
+ const config = loaded.gitFlow;
136
+ const target = flagValue(rest, '--target');
137
+ const shared = { root, assumeYes: rest.includes('--yes'), dryRun: rest.includes('--dry-run') };
138
+ if (subcommand === 'check') {
139
+ if (rest.includes('--all'))
140
+ return checkAll({ root, config });
141
+ return checkOne({ root, config, branch: ref !== null && ref !== void 0 ? ref : (0, git_1.currentBranch)(root), target, push: rest.includes('--push') });
142
+ }
143
+ if (subcommand === 'start') {
144
+ return (0, git_flow_start_1.gitFlowStart)(Object.assign(Object.assign({}, shared), { config: loaded, key: ref, subject: flagValue(rest, '--subject'), type: flagValue(rest, '--type'), parent: flagValue(rest, '--of'), hotfix: rest.includes('--hotfix'), releaseDate: flagValue(rest, '--release'), push: rest.includes('--push') }));
145
+ }
146
+ if (subcommand === 'repair') {
147
+ return (0, git_flow_repair_1.gitFlowRepair)(Object.assign(Object.assign({}, shared), { config: loaded, ref, to: flagValue(rest, '--to'), key: flagValue(rest, '--key'), skipMrCheck: rest.includes('--no-mr-check') }));
148
+ }
149
+ if (subcommand === 'explain') {
150
+ const branch = ref !== null && ref !== void 0 ? ref : (0, git_1.currentBranch)(root);
151
+ const parse = (0, git_flow_1.parseBranch)({ branch, config });
152
+ console.log(`Branch: ${parse.branch}`);
153
+ describeParse(parse).forEach((line) => console.log(line));
154
+ if (parse.findings.length > 0) {
155
+ console.log('\nFindings');
156
+ parse.findings.forEach((finding) => console.log(` ${finding.rule} ${finding.message}`));
157
+ }
158
+ console.log(`\nEnforcement: ${config.enforcement}`);
159
+ return 0;
160
+ }
161
+ console.log(USAGE);
162
+ return subcommand === undefined || subcommand === '--help' || subcommand === '-h' ? 0 : 1;
163
+ });
164
+ exports.gitFlowCommand = gitFlowCommand;
165
+ //# sourceMappingURL=git-flow-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-flow-command.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/git-flow-command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAsC;AACtC,+BAAmD;AACnD,yCAAwG;AACxG,uDAAkD;AAClD,qDAAgD;AAEhD,MAAM,aAAa,GAAG,CAAC,KAAwB,EAAE,EAAE;IACjD,MAAM,KAAK,GAAG,CAAC,eAAe,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE/F,IAAI,KAAK,CAAC,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,IAAI,KAAK,CAAC,QAAQ;QAChB,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5G,IAAI,KAAK,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,IAAI,KAAK,CAAC,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,IAAI,KAAK,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,KA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AAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,IAAA,mBAAa,EAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAE9C,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAE1D,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC1B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC7F,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAEpD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAEnB,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC,CAAA,CAAC;AA7DW,QAAA,cAAc,kBA6DzB"}
@@ -0,0 +1,17 @@
1
+ import { SyncConfig } from './config';
2
+ export type RepairRequest = {
3
+ root: string;
4
+ config: SyncConfig;
5
+ ref?: string;
6
+ to?: string;
7
+ key?: string;
8
+ skipMrCheck: boolean;
9
+ assumeYes: boolean;
10
+ dryRun: boolean;
11
+ };
12
+ /**
13
+ * Renames a non-conforming branch and moves the merge requests aimed at it. Everything that can be
14
+ * checked is checked before the first mutation, and the order of the mutations is chosen so a
15
+ * failure leaves the old branch and every merge request intact.
16
+ */
17
+ export declare const gitFlowRepair: (request: RepairRequest) => Promise<1 | 0>;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.gitFlowRepair = void 0;
13
+ const git_1 = require("./git");
14
+ const git_flow_1 = require("./git-flow");
15
+ const gitlab_1 = require("./gitlab");
16
+ const prompt_1 = require("./prompt");
17
+ const resolveNewName = (options) => {
18
+ const { branch, to, key, config } = options;
19
+ if (to)
20
+ return to;
21
+ const resolved = (0, git_flow_1.conformingNameFor)({ branch, key, config: config.gitFlow });
22
+ if (resolved.ok)
23
+ return resolved.name;
24
+ if (resolved.reason === 'already-conforms')
25
+ throw new Error(`${branch} already conforms — nothing to repair.`);
26
+ if (resolved.reason === 'needs-key') {
27
+ throw new Error(`${branch} carries no issue key, so the new name needs one: \`git-flow repair ${branch} --key FIP-1234\` (or --to <branch>).`);
28
+ }
29
+ throw new Error(`No conforming name can be derived from ${branch}. Pass --to <branch>.`);
30
+ };
31
+ const readRemoteState = (options) => __awaiter(void 0, void 0, void 0, function* () {
32
+ const { root, branch, skipMrCheck } = options;
33
+ const remote = (0, git_1.defaultRemote)(root);
34
+ if (!remote || !(0, git_1.remoteBranchExists)({ root, remote, branch }))
35
+ return { pushed: false };
36
+ if (skipMrCheck)
37
+ return { pushed: true, remote, retarget: [] };
38
+ const project = (0, gitlab_1.parseRemoteUrl)((0, git_1.remoteUrl)({ root, remote }));
39
+ const token = (0, gitlab_1.gitLabToken)();
40
+ if (!project || !token) {
41
+ throw new Error([
42
+ `${branch} is pushed to ${remote}, so open merge requests may point at it and must be retargeted.`,
43
+ project
44
+ ? 'Set GITLAB_TOKEN to a token with the "api" scope, or pass --no-mr-check if you know none do.'
45
+ : `The ${remote} URL is not a recognisable GitLab remote. Pass --no-mr-check if no merge request points at ${branch}.`,
46
+ ].join('\n'));
47
+ }
48
+ const mergeRequests = yield (0, gitlab_1.openMergeRequestsFor)({ project, token, branch });
49
+ const blocking = (0, gitlab_1.blockingMergeRequests)({ mergeRequests, branch });
50
+ if (blocking.length > 0) {
51
+ throw new Error([
52
+ `${branch} is the source branch of ${blocking.length} open merge request(s):`,
53
+ ...blocking.map((mr) => ` !${mr.iid} ${mr.title} ${mr.url}`),
54
+ 'GitLab cannot move a merge request to a different source branch, and closing it would lose its discussion.',
55
+ 'Merge or close it first, then repair the branch.',
56
+ ].join('\n'));
57
+ }
58
+ return {
59
+ pushed: true,
60
+ remote,
61
+ retarget: mergeRequests.filter((mr) => mr.targetBranch === branch),
62
+ api: { project, token },
63
+ };
64
+ });
65
+ const describeSteps = (options) => {
66
+ const { branch, newName, remote } = options;
67
+ const steps = [`git branch -m ${branch} ${newName}`];
68
+ if (remote.pushed) {
69
+ steps.push(`git push -u ${remote.remote} ${newName}`);
70
+ steps.push(...remote.retarget.map((mr) => `retarget !${mr.iid} to ${newName}`));
71
+ steps.push(`git push ${remote.remote} --delete ${branch}`);
72
+ }
73
+ return steps;
74
+ };
75
+ /**
76
+ * Renames a non-conforming branch and moves the merge requests aimed at it. Everything that can be
77
+ * checked is checked before the first mutation, and the order of the mutations is chosen so a
78
+ * failure leaves the old branch and every merge request intact.
79
+ */
80
+ const gitFlowRepair = (request) => __awaiter(void 0, void 0, void 0, function* () {
81
+ var _a;
82
+ const { root, config, dryRun } = request;
83
+ const branch = (_a = request.ref) !== null && _a !== void 0 ? _a : (0, git_1.currentBranch)(root);
84
+ const newName = resolveNewName({ branch, to: request.to, key: request.key, config });
85
+ const parsed = (0, git_flow_1.parseBranch)({ branch: newName, config: config.gitFlow });
86
+ if (!parsed.ok) {
87
+ console.error(`${newName} does not conform either:`);
88
+ parsed.findings.forEach((finding) => console.error(` ${finding.rule} ${finding.message}`));
89
+ return 1;
90
+ }
91
+ if (!(0, git_1.localBranchExists)({ root, branch })) {
92
+ console.error(`${branch} does not exist locally — check it out first, then repair it.`);
93
+ return 1;
94
+ }
95
+ if ((0, git_1.localBranchExists)({ root, branch: newName })) {
96
+ console.error(`${newName} already exists locally.`);
97
+ return 1;
98
+ }
99
+ const remote = yield readRemoteState({ root, branch, skipMrCheck: request.skipMrCheck });
100
+ if (remote.pushed && (0, git_1.remoteBranchExists)({ root, remote: remote.remote, branch: newName })) {
101
+ console.error(`${newName} already exists on ${remote.remote}.`);
102
+ return 1;
103
+ }
104
+ const steps = describeSteps({ branch, newName, remote });
105
+ console.log('Repair');
106
+ console.log(` from ${branch}`);
107
+ console.log(` to ${newName}`);
108
+ console.log(` remote ${remote.pushed ? `${remote.remote} (pushed)` : 'not pushed'}`);
109
+ if (remote.pushed && !remote.api)
110
+ console.log(' warn merge requests were not checked (--no-mr-check)');
111
+ if (remote.pushed) {
112
+ remote.retarget.forEach((mr) => console.log(` retarget !${mr.iid} ${mr.title}`));
113
+ }
114
+ console.log('\nSteps');
115
+ steps.forEach((step, index) => console.log(` ${index + 1}. ${step}`));
116
+ if (dryRun) {
117
+ console.log('\nDry run — nothing was changed.');
118
+ return 0;
119
+ }
120
+ if (!(yield (0, prompt_1.confirm)({ question: `\nRename ${branch} to ${newName}?`, assumeYes: request.assumeYes }))) {
121
+ console.log('Nothing was changed.');
122
+ return 1;
123
+ }
124
+ (0, git_1.git)({ root, args: ['branch', '-m', branch, newName] });
125
+ if (!remote.pushed) {
126
+ console.log(`\nRenamed to ${newName}.`);
127
+ return 0;
128
+ }
129
+ try {
130
+ (0, git_1.gitLoud)({ root, args: ['push', '-u', remote.remote, newName] });
131
+ }
132
+ catch (error) {
133
+ console.error(`\nFailed to push ${newName}: ${error instanceof Error ? error.message : error}`);
134
+ console.error([
135
+ `The local branch is already renamed to ${newName}; ${remote.remote} still has ${branch}.`,
136
+ `Retry: git push -u ${remote.remote} ${newName}`,
137
+ `Or undo: git branch -m ${newName} ${branch}`,
138
+ ].join('\n'));
139
+ return 1;
140
+ }
141
+ const { api } = remote;
142
+ for (const mergeRequest of remote.retarget) {
143
+ if (!api)
144
+ break;
145
+ try {
146
+ yield (0, gitlab_1.retargetMergeRequest)({ project: api.project, token: api.token, iid: mergeRequest.iid, target: newName });
147
+ console.log(`Retargeted !${mergeRequest.iid} to ${newName}.`);
148
+ }
149
+ catch (error) {
150
+ console.error(`\nFailed to retarget !${mergeRequest.iid}: ${error instanceof Error ? error.message : error}`);
151
+ console.error([
152
+ `${branch} still exists on ${remote.remote}, so nothing is broken — but the rename is half done.`,
153
+ `Retarget the remaining merge request(s) to ${newName} by hand, then run:`,
154
+ ` git push ${remote.remote} --delete ${branch}`,
155
+ `Or undo: git branch -m ${newName} ${branch} && git push ${remote.remote} --delete ${newName}`,
156
+ ].join('\n'));
157
+ return 1;
158
+ }
159
+ }
160
+ (0, git_1.gitLoud)({ root, args: ['push', remote.remote, '--delete', branch] });
161
+ console.log(`\nRenamed to ${newName} on ${remote.remote}.`);
162
+ return 0;
163
+ });
164
+ exports.gitFlowRepair = gitFlowRepair;
165
+ //# sourceMappingURL=git-flow-repair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-flow-repair.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/git-flow-repair.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+BAAqH;AACrH,yCAA4D;AAC5D,qCAQkB;AAClB,qCAAm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AAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YAC9G,OAAO,CAAC,KAAK,CACX;gBACE,GAAG,MAAM,oBAAoB,MAAM,CAAC,MAAM,uDAAuD;gBACjG,8CAA8C,OAAO,qBAAqB;gBAC1E,cAAc,MAAM,CAAC,MAAM,aAAa,MAAM,EAAE;gBAChD,0BAA0B,OAAO,IAAI,MAAM,gBAAgB,MAAM,CAAC,MAAM,aAAa,OAAO,EAAE;aAC/F,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;YAEF,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,IAAA,aAAO,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IAErE,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAE5D,OAAO,CAAC,CAAC;AACX,CAAC,CAAA,CAAC;AAhHW,QAAA,aAAa,iBAgHxB"}
@@ -0,0 +1,20 @@
1
+ import { SyncConfig } from './config';
2
+ export type StartRequest = {
3
+ root: string;
4
+ config: SyncConfig;
5
+ key?: string;
6
+ subject?: string;
7
+ type?: string;
8
+ parent?: string;
9
+ hotfix: boolean;
10
+ releaseDate?: string;
11
+ push: boolean;
12
+ assumeYes: boolean;
13
+ dryRun: boolean;
14
+ };
15
+ /**
16
+ * The prospective flow: an issue key in, a correctly named branch off the correct base out. Shares
17
+ * `planStart` with `@ethlete/timetrack`'s ticket → branch flow, so the two cannot name a branch
18
+ * differently.
19
+ */
20
+ export declare const gitFlowStart: (request: StartRequest) => Promise<1 | 0>;