@ethlete/agent-rules 0.1.0-next.4 → 0.1.0-next.41
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.
- package/AGENTS.md +28 -0
- package/CHANGELOG.md +627 -0
- package/CLAUDE.md +1 -0
- package/README.md +406 -29
- package/THIRD-PARTY-LICENSES.md +35 -0
- package/content/defaults.json +1 -1
- package/content/git-hooks/post-checkout.sh +10 -0
- package/content/git-hooks/pre-push.sh +5 -0
- package/content/hooks/away-mode.py +287 -0
- package/content/hooks/background-design-commands.py +215 -0
- package/content/hooks/builder-chat-words.py +269 -0
- package/content/hooks/context-warning.py +836 -142
- package/content/hooks/git-safety.py +213 -0
- package/content/hooks/subagent-model-policy.py +261 -0
- package/content/mods/.claude-plugin/marketplace.json +16 -0
- package/content/mods/plugins/e2e-progress/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/e2e-progress/hooks/hooks.json +1 -0
- package/content/mods/plugins/e2e-progress/hooks/register.tsx +442 -0
- package/content/mods/plugins/e2e-progress/tsconfig.json +3 -0
- package/content/mods/plugins/e2e-progress/types/index.d.ts +23 -0
- package/content/mods/plugins/status-line/.claude-plugin/plugin.json +6 -0
- package/content/mods/plugins/status-line/hooks/hooks.json +1 -0
- package/content/mods/plugins/status-line/hooks/line.ts +73 -0
- package/content/mods/plugins/status-line/hooks/register.tsx +141 -0
- package/content/mods/plugins/status-line/types/index.d.ts +5 -0
- package/content/output-styles/ste-clarity.md +131 -0
- package/content/rules/agent-sessions-wake-up.md +11 -0
- package/content/rules/app-styling.md +66 -0
- package/content/rules/comments.md +4 -1
- package/content/rules/lint-and-format.md +7 -5
- package/content/rules/nx-layout.md +53 -0
- package/content/rules/reactive-state.md +1 -1
- package/content/rules/styling.md +19 -10
- package/content/rules/subagent-models.md +42 -0
- package/content/skills/agent-sessions/SKILL.md +94 -0
- package/content/skills/agent-sessions/agent-sessions.mjs +1125 -0
- package/content/skills/angular-patterns/SKILL.md +31 -7
- package/content/skills/api-source/SKILL.md +156 -0
- package/content/skills/app-testing/SKILL.md +141 -0
- package/content/skills/codex-subagent/SKILL.md +90 -0
- package/content/skills/codex-subagent/codex-agent.mjs +229 -0
- package/content/skills/design-exploration/SKILL.md +190 -0
- package/content/skills/design-exploration/check-story.mjs +139 -0
- package/content/skills/design-exploration/reference-check-and-notes.md +92 -0
- package/content/skills/design-exploration/reference-flows-and-wireframes.md +78 -0
- package/content/skills/design-exploration/reference-inbox-and-mcp.md +54 -0
- package/content/skills/design-exploration/reference-order-and-design-system.md +124 -0
- package/content/skills/design-exploration/reference-products-and-sketches.md +211 -0
- package/content/skills/design-exploration/reference-shots.md +25 -0
- package/content/skills/design-exploration/shoot-template.mjs +61 -0
- package/content/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/content/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/content/skills/domain-modeling/SKILL.md +80 -0
- package/content/skills/e2e-triage/SKILL.md +80 -0
- package/content/skills/figma-export/SKILL.md +191 -0
- package/content/skills/figma-export/dump-figma-layers.py +83 -0
- package/content/skills/figma-export/dump-figma-svg.py +235 -0
- package/content/skills/figma-export/measure-template.mjs +87 -0
- package/content/skills/git-commit/SKILL.md +21 -7
- package/content/skills/git-flow/SKILL.md +87 -0
- package/content/skills/grill-with-docs/SKILL.md +13 -0
- package/content/skills/grilling/SKILL.md +52 -0
- package/content/skills/handoff/SKILL.md +29 -69
- package/content/skills/handoff/save.md +187 -0
- package/content/skills/query/SKILL.md +165 -64
- package/content/skills/report/SKILL.md +26 -0
- package/content/skills/rxjs-signals/SKILL.md +33 -4
- package/content/skills/sdk-docs/SKILL.md +50 -14
- package/content/skills/sdk-local-build/SKILL.md +26 -8
- package/content/skills/sdk-local-build/sdk-local-baseline.mjs +64 -0
- package/content/skills/sdk-source/SKILL.md +37 -34
- package/content/skills/sdk-update/SKILL.md +103 -0
- package/content/skills/story-styling/SKILL.md +10 -8
- package/content/skills/styleguide/SKILL.md +13 -8
- package/content/skills/styleguide/assets.md +54 -0
- package/content/skills/styleguide/changesets.md +17 -0
- package/content/skills/styleguide/file-structure.md +73 -0
- package/content/skills/styleguide/lint-rule-lookup.md +52 -0
- package/content/skills/styleguide/storybook-structure.md +25 -0
- package/content/skills/theming/SKILL.md +56 -28
- package/content/skills/timetrack/SKILL.md +324 -0
- package/content/skills/verify-in-app/SKILL.md +107 -0
- package/content/skills/verify-in-storybook/SKILL.md +1 -1
- package/migrations/list-state-query-form.md +20 -0
- package/migrations/nx-layout.md +29 -0
- package/migrations/sdk-components-over-hand-built-ui.md +27 -0
- package/migrations/search-query-field.md +52 -0
- package/migrations.json +39 -0
- package/package.json +19 -3
- package/src/index.js +99 -32
- package/src/index.js.map +1 -1
- package/src/lib/cli-args.d.ts +9 -0
- package/src/lib/cli-args.js +48 -0
- package/src/lib/cli-args.js.map +1 -0
- package/src/lib/commitlint.d.ts +10 -0
- package/src/lib/commitlint.js +51 -0
- package/src/lib/commitlint.js.map +1 -0
- package/src/lib/config.d.ts +51 -6
- package/src/lib/config.js +127 -10
- package/src/lib/config.js.map +1 -1
- package/src/lib/filter.d.ts +2 -0
- package/src/lib/filter.js +4 -4
- package/src/lib/filter.js.map +1 -1
- package/src/lib/frontmatter.d.ts +2 -0
- package/src/lib/frontmatter.js +33 -5
- package/src/lib/frontmatter.js.map +1 -1
- package/src/lib/git-flow/build.d.ts +35 -0
- package/src/lib/git-flow/build.js +24 -0
- package/src/lib/git-flow/build.js.map +1 -0
- package/src/lib/git-flow/config.d.ts +59 -0
- package/src/lib/git-flow/config.js +50 -0
- package/src/lib/git-flow/config.js.map +1 -0
- package/src/lib/git-flow/index.d.ts +6 -0
- package/src/lib/git-flow/index.js +23 -0
- package/src/lib/git-flow/index.js.map +1 -0
- package/src/lib/git-flow/parse.d.ts +49 -0
- package/src/lib/git-flow/parse.js +300 -0
- package/src/lib/git-flow/parse.js.map +1 -0
- package/src/lib/git-flow/rename.d.ts +24 -0
- package/src/lib/git-flow/rename.js +70 -0
- package/src/lib/git-flow/rename.js.map +1 -0
- package/src/lib/git-flow/start.d.ts +49 -0
- package/src/lib/git-flow/start.js +57 -0
- package/src/lib/git-flow/start.js.map +1 -0
- package/src/lib/git-flow/validate.d.ts +34 -0
- package/src/lib/git-flow/validate.js +72 -0
- package/src/lib/git-flow/validate.js.map +1 -0
- package/src/lib/git-flow-command.d.ts +4 -0
- package/src/lib/git-flow-command.js +165 -0
- package/src/lib/git-flow-command.js.map +1 -0
- package/src/lib/git-flow-repair.d.ts +17 -0
- package/src/lib/git-flow-repair.js +165 -0
- package/src/lib/git-flow-repair.js.map +1 -0
- package/src/lib/git-flow-start.d.ts +20 -0
- package/src/lib/git-flow-start.js +140 -0
- package/src/lib/git-flow-start.js.map +1 -0
- package/src/lib/git-test-env.fixtures.d.ts +11 -0
- package/src/lib/git-test-env.fixtures.js +31 -0
- package/src/lib/git-test-env.fixtures.js.map +1 -0
- package/src/lib/git.d.ts +64 -0
- package/src/lib/git.js +131 -0
- package/src/lib/git.js.map +1 -0
- package/src/lib/gitlab.d.ts +35 -0
- package/src/lib/gitlab.js +116 -0
- package/src/lib/gitlab.js.map +1 -0
- package/src/lib/index.d.ts +2 -0
- package/src/lib/index.js +26 -11
- package/src/lib/index.js.map +1 -1
- package/src/lib/migrate.js +8 -2
- package/src/lib/migrate.js.map +1 -1
- package/src/lib/output-style-command.d.ts +3 -0
- package/src/lib/output-style-command.js +69 -0
- package/src/lib/output-style-command.js.map +1 -0
- package/src/lib/output-style.d.ts +38 -0
- package/src/lib/output-style.js +134 -0
- package/src/lib/output-style.js.map +1 -0
- package/src/lib/owned-paths.js +27 -3
- package/src/lib/owned-paths.js.map +1 -1
- package/src/lib/package-runner.d.ts +4 -0
- package/src/lib/package-runner.js +86 -0
- package/src/lib/package-runner.js.map +1 -0
- package/src/lib/peer-path.d.ts +12 -0
- package/src/lib/peer-path.js +39 -0
- package/src/lib/peer-path.js.map +1 -0
- package/src/lib/plain-text.d.ts +9 -0
- package/src/lib/plain-text.js +22 -0
- package/src/lib/plain-text.js.map +1 -0
- package/src/lib/plan.d.ts +6 -6
- package/src/lib/plan.js +168 -40
- package/src/lib/plan.js.map +1 -1
- package/src/lib/prettier.d.ts +21 -0
- package/src/lib/prettier.js +51 -0
- package/src/lib/prettier.js.map +1 -0
- package/src/lib/prompt.d.ts +8 -0
- package/src/lib/prompt.js +35 -0
- package/src/lib/prompt.js.map +1 -0
- package/src/lib/render.d.ts +26 -2
- package/src/lib/render.js +45 -10
- package/src/lib/render.js.map +1 -1
- package/src/lib/report-command.d.ts +33 -0
- package/src/lib/report-command.js +312 -0
- package/src/lib/report-command.js.map +1 -0
- package/src/lib/sessions-command.d.ts +4 -0
- package/src/lib/sessions-command.js +16 -0
- package/src/lib/sessions-command.js.map +1 -0
- package/src/lib/sync.d.ts +1 -2
- package/src/lib/sync.js +37 -17
- package/src/lib/sync.js.map +1 -1
- package/src/lib/targets/agents-skills.js +1 -1
- package/src/lib/targets/agents-skills.js.map +1 -1
- package/src/lib/targets/claude-hooks.d.ts +3 -23
- package/src/lib/targets/claude-hooks.js +22 -86
- package/src/lib/targets/claude-hooks.js.map +1 -1
- package/src/lib/targets/claude-mods.d.ts +20 -0
- package/src/lib/targets/claude-mods.js +47 -0
- package/src/lib/targets/claude-mods.js.map +1 -0
- package/src/lib/targets/claude.js +2 -3
- package/src/lib/targets/claude.js.map +1 -1
- package/src/lib/targets/codex-hooks.d.ts +12 -0
- package/src/lib/targets/codex-hooks.js +35 -0
- package/src/lib/targets/codex-hooks.js.map +1 -0
- package/src/lib/targets/codex.js +4 -4
- package/src/lib/targets/codex.js.map +1 -1
- package/src/lib/targets/copilot.js +4 -4
- package/src/lib/targets/copilot.js.map +1 -1
- package/src/lib/targets/cursor.js +3 -3
- package/src/lib/targets/cursor.js.map +1 -1
- package/src/lib/targets/git-hooks.d.ts +25 -0
- package/src/lib/targets/git-hooks.js +71 -0
- package/src/lib/targets/git-hooks.js.map +1 -0
- package/src/lib/targets/hooks-shared.d.ts +60 -0
- package/src/lib/targets/hooks-shared.js +174 -0
- package/src/lib/targets/hooks-shared.js.map +1 -0
- package/src/lib/targets/mcp.d.ts +16 -0
- package/src/lib/targets/mcp.js +72 -0
- package/src/lib/targets/mcp.js.map +1 -0
- package/src/lib/targets/shared.d.ts +1 -9
- package/src/lib/targets/shared.js +4 -8
- package/src/lib/targets/shared.js.map +1 -1
- package/src/lib/timetrack-command.d.ts +11 -0
- package/src/lib/timetrack-command.js +1262 -0
- package/src/lib/timetrack-command.js.map +1 -0
- package/src/lib/timetrack-snapshot.d.ts +66 -0
- package/src/lib/timetrack-snapshot.js +146 -0
- package/src/lib/timetrack-snapshot.js.map +1 -0
- package/src/lib/timetrack.d.ts +607 -0
- package/src/lib/timetrack.js +285 -0
- package/src/lib/timetrack.js.map +1 -0
- package/content/skills/styleguide/STYLEGUIDE.md +0 -520
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The branch grammar as data: one config drives the parser, the validators, the CLI, the generated
|
|
3
|
+
* skill and `@ethlete/timetrack`'s correlation engine.
|
|
4
|
+
*
|
|
5
|
+
* Nothing in this folder may import `fs`, `path` or `process`, or take a dependency — it is
|
|
6
|
+
* reachable as `@ethlete/agent-rules/git-flow` and gets bundled into a browser webview.
|
|
7
|
+
*/
|
|
8
|
+
export declare const GIT_FLOW_RULES: readonly ["unknown-type", "missing-key", "key-case", "missing-subject", "type-alias", "deprecated-prefix", "release-date", "wrong-mr-target", "protected-push"];
|
|
9
|
+
export type GitFlowRule = (typeof GIT_FLOW_RULES)[number];
|
|
10
|
+
export type GitFlowSeverity = 'off' | 'warn' | 'error';
|
|
11
|
+
export type GitFlowEnforcement = 'advisory' | 'gated';
|
|
12
|
+
export type GitFlowBranchKind = 'main-feature' | 'sub-feature' | 'release' | 'release-fix' | 'hotfix' | 'protected' | 'unknown';
|
|
13
|
+
/**
|
|
14
|
+
* A legacy spelling that means one of the known kinds. `match` is a regular expression whose
|
|
15
|
+
* `subject` and `key` named groups feed `renameTo`, in which `<subject>` and `<KEY>` are the
|
|
16
|
+
* placeholders — an unresolved `<KEY>` is left in place, because only Jira can supply it.
|
|
17
|
+
*/
|
|
18
|
+
export type GitFlowDeprecatedShape = {
|
|
19
|
+
match: string;
|
|
20
|
+
kind: GitFlowBranchKind;
|
|
21
|
+
renameTo: string;
|
|
22
|
+
};
|
|
23
|
+
export type GitFlowConfig = {
|
|
24
|
+
enforcement: GitFlowEnforcement;
|
|
25
|
+
/**
|
|
26
|
+
* The segment a nested branch is prefixed with. Git refuses a ref that is both a branch and a
|
|
27
|
+
* directory of branches, so a sub-feature cannot be spelled `<parent>/<KEY>-<subject>` while its
|
|
28
|
+
* parent exists — the push is rejected with "refname conflict". The prefix moves the whole nested
|
|
29
|
+
* tree out of the way while keeping the parent's full path inside the child's name.
|
|
30
|
+
*/
|
|
31
|
+
subPrefix: string;
|
|
32
|
+
keyPattern: string;
|
|
33
|
+
/**
|
|
34
|
+
* Project prefixes a key may use, e.g. `["FIP"]`. Empty accepts anything `keyPattern` matches,
|
|
35
|
+
* which also accepts `chore/angular-22` as issue ANGULAR-22 — set this in any repo whose
|
|
36
|
+
* branch subjects can start with a word followed by a number.
|
|
37
|
+
*/
|
|
38
|
+
keyPrefixes: string[];
|
|
39
|
+
baseBranches: {
|
|
40
|
+
development: string;
|
|
41
|
+
production: string;
|
|
42
|
+
};
|
|
43
|
+
types: string[];
|
|
44
|
+
typeAliases: Record<string, string>;
|
|
45
|
+
releasePrefix: string;
|
|
46
|
+
releasePattern: string;
|
|
47
|
+
hotfixPrefix: string;
|
|
48
|
+
subjectCase: 'kebab';
|
|
49
|
+
deprecatedShapes: GitFlowDeprecatedShape[];
|
|
50
|
+
severity: Record<GitFlowRule, GitFlowSeverity>;
|
|
51
|
+
};
|
|
52
|
+
export declare const DEFAULT_GIT_FLOW_CONFIG: GitFlowConfig;
|
|
53
|
+
export type RawGitFlowConfig = Partial<Omit<GitFlowConfig, 'baseBranches' | 'typeAliases' | 'severity'>> & {
|
|
54
|
+
baseBranches?: Partial<GitFlowConfig['baseBranches']>;
|
|
55
|
+
typeAliases?: Record<string, string>;
|
|
56
|
+
severity?: Partial<Record<GitFlowRule, GitFlowSeverity>>;
|
|
57
|
+
};
|
|
58
|
+
/** Fills a repo's `gitFlow` config block out to a complete grammar. */
|
|
59
|
+
export declare const resolveGitFlowConfig: (raw?: RawGitFlowConfig) => GitFlowConfig;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The branch grammar as data: one config drives the parser, the validators, the CLI, the generated
|
|
4
|
+
* skill and `@ethlete/timetrack`'s correlation engine.
|
|
5
|
+
*
|
|
6
|
+
* Nothing in this folder may import `fs`, `path` or `process`, or take a dependency — it is
|
|
7
|
+
* reachable as `@ethlete/agent-rules/git-flow` and gets bundled into a browser webview.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.resolveGitFlowConfig = exports.DEFAULT_GIT_FLOW_CONFIG = exports.GIT_FLOW_RULES = void 0;
|
|
11
|
+
exports.GIT_FLOW_RULES = [
|
|
12
|
+
'unknown-type',
|
|
13
|
+
'missing-key',
|
|
14
|
+
'key-case',
|
|
15
|
+
'missing-subject',
|
|
16
|
+
'type-alias',
|
|
17
|
+
'deprecated-prefix',
|
|
18
|
+
'release-date',
|
|
19
|
+
'wrong-mr-target',
|
|
20
|
+
'protected-push',
|
|
21
|
+
];
|
|
22
|
+
exports.DEFAULT_GIT_FLOW_CONFIG = {
|
|
23
|
+
enforcement: 'advisory',
|
|
24
|
+
subPrefix: 'sub',
|
|
25
|
+
keyPattern: '[A-Z]{2,10}-\\d+',
|
|
26
|
+
keyPrefixes: [],
|
|
27
|
+
baseBranches: { development: 'next', production: 'main' },
|
|
28
|
+
types: ['feat', 'fix', 'refactor', 'chore', 'docs', 'spec', 'perf', 'test', 'style', 'build', 'ci'],
|
|
29
|
+
typeAliases: { feature: 'feat', bugfix: 'fix' },
|
|
30
|
+
releasePrefix: 'release',
|
|
31
|
+
releasePattern: '\\d{4}\\.\\d{2}\\.\\d{2}',
|
|
32
|
+
hotfixPrefix: 'hotfix',
|
|
33
|
+
subjectCase: 'kebab',
|
|
34
|
+
deprecatedShapes: [{ match: '^dev-(?<subject>.+)$', kind: 'main-feature', renameTo: 'feat/<KEY>-<subject>' }],
|
|
35
|
+
severity: {
|
|
36
|
+
'unknown-type': 'warn',
|
|
37
|
+
'missing-key': 'warn',
|
|
38
|
+
'key-case': 'warn',
|
|
39
|
+
'missing-subject': 'warn',
|
|
40
|
+
'type-alias': 'warn',
|
|
41
|
+
'deprecated-prefix': 'warn',
|
|
42
|
+
'release-date': 'warn',
|
|
43
|
+
'wrong-mr-target': 'warn',
|
|
44
|
+
'protected-push': 'error',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/** Fills a repo's `gitFlow` config block out to a complete grammar. */
|
|
48
|
+
const resolveGitFlowConfig = (raw) => (Object.assign(Object.assign(Object.assign({}, exports.DEFAULT_GIT_FLOW_CONFIG), raw), { baseBranches: Object.assign(Object.assign({}, exports.DEFAULT_GIT_FLOW_CONFIG.baseBranches), raw === null || raw === void 0 ? void 0 : raw.baseBranches), typeAliases: Object.assign(Object.assign({}, exports.DEFAULT_GIT_FLOW_CONFIG.typeAliases), raw === null || raw === void 0 ? void 0 : raw.typeAliases), severity: Object.assign(Object.assign({}, exports.DEFAULT_GIT_FLOW_CONFIG.severity), raw === null || raw === void 0 ? void 0 : raw.severity) }));
|
|
49
|
+
exports.resolveGitFlowConfig = resolveGitFlowConfig;
|
|
50
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/git-flow/config.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEU,QAAA,cAAc,GAAG;IAC5B,cAAc;IACd,aAAa;IAC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AC,WAAW,GAAK,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,GAC1E,QAAQ,kCAAO,+BAAuB,CAAC,QAAQ,GAAK,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,KACjE,CAAC;AANU,QAAA,oBAAoB,wBAM9B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./build"), exports);
|
|
18
|
+
__exportStar(require("./config"), exports);
|
|
19
|
+
__exportStar(require("./parse"), exports);
|
|
20
|
+
__exportStar(require("./rename"), exports);
|
|
21
|
+
__exportStar(require("./start"), exports);
|
|
22
|
+
__exportStar(require("./validate"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/git-flow/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { GitFlowBranchKind, GitFlowConfig, GitFlowRule } from './config';
|
|
2
|
+
export type GitFlowFinding = {
|
|
3
|
+
rule: GitFlowRule;
|
|
4
|
+
message: string;
|
|
5
|
+
/** The conforming spelling, when it can be derived without asking Jira for an issue key. */
|
|
6
|
+
suggestion?: string;
|
|
7
|
+
};
|
|
8
|
+
export type BranchParseResult = {
|
|
9
|
+
branch: string;
|
|
10
|
+
/** True only for a fully conforming name — an alias or a lowercase key still parses, but is not `ok`. */
|
|
11
|
+
ok: boolean;
|
|
12
|
+
kind: GitFlowBranchKind;
|
|
13
|
+
/** The normalized type segment (`feature/` resolves to `feat`). */
|
|
14
|
+
type?: string;
|
|
15
|
+
storyKey?: string;
|
|
16
|
+
taskKey?: string;
|
|
17
|
+
/** The most specific issue the branch names — what time should be logged against. */
|
|
18
|
+
issueKey?: string;
|
|
19
|
+
subject?: string;
|
|
20
|
+
/** The branch this one nests under, for a sub-feature or a release fix. */
|
|
21
|
+
parent?: string;
|
|
22
|
+
/** The branch matched a `deprecatedShapes` entry, so it should be excluded from adoption reports. */
|
|
23
|
+
deprecated: boolean;
|
|
24
|
+
expectedBase?: string;
|
|
25
|
+
expectedMrTargets: string[];
|
|
26
|
+
/** Set by `resolveThroughBase` when the story key came from the base branch rather than this name. */
|
|
27
|
+
inheritedFrom?: string;
|
|
28
|
+
suggestedName?: string;
|
|
29
|
+
findings: GitFlowFinding[];
|
|
30
|
+
};
|
|
31
|
+
export declare const stripRefPrefix: (ref: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Classifies a branch name against the grammar. Never throws: an unrecognised name comes back as
|
|
34
|
+
* `kind: 'unknown'` with findings, so the validator and timetrack's correlation engine can read
|
|
35
|
+
* the same result for different purposes.
|
|
36
|
+
*/
|
|
37
|
+
export declare const parseBranch: (options: {
|
|
38
|
+
branch: string;
|
|
39
|
+
config: GitFlowConfig;
|
|
40
|
+
}) => BranchParseResult;
|
|
41
|
+
/**
|
|
42
|
+
* Attributes a keyless branch through the branch it is based on. Reviewed branches land in an
|
|
43
|
+
* integration branch, so a flat name like `feat/logout-confirmation` usually has a parent that
|
|
44
|
+
* does carry the story key. Deterministic — no model involved.
|
|
45
|
+
*/
|
|
46
|
+
export declare const resolveThroughBase: (options: {
|
|
47
|
+
branch: BranchParseResult;
|
|
48
|
+
base: BranchParseResult;
|
|
49
|
+
}) => BranchParseResult;
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveThroughBase = exports.parseBranch = exports.stripRefPrefix = void 0;
|
|
4
|
+
const build_1 = require("./build");
|
|
5
|
+
const stripRefPrefix = (ref) => ref
|
|
6
|
+
.trim()
|
|
7
|
+
.replace(/^refs\/heads\//, '')
|
|
8
|
+
.replace(/^refs\/remotes\/[^/]+\//, '');
|
|
9
|
+
exports.stripRefPrefix = stripRefPrefix;
|
|
10
|
+
const hasKeyPrefix = (options) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const key = (_a = options.key) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
13
|
+
const prefix = options.prefix.toUpperCase();
|
|
14
|
+
return !!(key === null || key === void 0 ? void 0 : key.startsWith(prefix)) && !/[A-Z0-9]/.test(key.charAt(prefix.length));
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The key is only recognised anchored at the start of a segment. A trailing number is therefore
|
|
18
|
+
* never mistaken for one — `ratings-reveal-secondary-page-27` yields no key rather than a wrong
|
|
19
|
+
* one, and a confidently wrong attribution is worse than none.
|
|
20
|
+
*/
|
|
21
|
+
const parseSegment = (options) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const { segment, config, role } = options;
|
|
24
|
+
const match = new RegExp(`^(?<etKey>${config.keyPattern})(?:-(?<etSubject>.*))?$`, 'i').exec(segment);
|
|
25
|
+
const rawKey = (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a['etKey'];
|
|
26
|
+
const known = config.keyPrefixes.length === 0
|
|
27
|
+
? !!rawKey && rawKey === rawKey.toUpperCase()
|
|
28
|
+
: config.keyPrefixes.some((prefix) => hasKeyPrefix({ key: rawKey, prefix }));
|
|
29
|
+
if (!rawKey || !known) {
|
|
30
|
+
return {
|
|
31
|
+
subject: segment || undefined,
|
|
32
|
+
findings: [{ rule: 'missing-key', message: `"${segment}" carries no ${role} issue key.` }],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const key = rawKey.toUpperCase();
|
|
36
|
+
const subject = ((_b = match === null || match === void 0 ? void 0 : match.groups) === null || _b === void 0 ? void 0 : _b['etSubject']) || undefined;
|
|
37
|
+
const findings = [];
|
|
38
|
+
if (rawKey !== key) {
|
|
39
|
+
findings.push({ rule: 'key-case', message: `Issue key "${rawKey}" should be uppercase "${key}".` });
|
|
40
|
+
}
|
|
41
|
+
if (!subject) {
|
|
42
|
+
findings.push({ rule: 'missing-subject', message: `"${segment}" names ${key} but has no subject.` });
|
|
43
|
+
}
|
|
44
|
+
return { key, subject, findings };
|
|
45
|
+
};
|
|
46
|
+
const matchDeprecatedShape = (options) => {
|
|
47
|
+
var _a;
|
|
48
|
+
const { branch, config } = options;
|
|
49
|
+
for (const shape of config.deprecatedShapes) {
|
|
50
|
+
const match = new RegExp(shape.match).exec(branch);
|
|
51
|
+
if (match)
|
|
52
|
+
return { shape, groups: (_a = match.groups) !== null && _a !== void 0 ? _a : {} };
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
};
|
|
56
|
+
const deprecatedKey = (options) => {
|
|
57
|
+
const { groups, config } = options;
|
|
58
|
+
const subject = groups['subject'];
|
|
59
|
+
if (groups['key'])
|
|
60
|
+
return { key: groups['key'].toUpperCase(), subject };
|
|
61
|
+
if (!subject)
|
|
62
|
+
return { subject };
|
|
63
|
+
const parts = parseSegment({ segment: subject, config, role: 'story' });
|
|
64
|
+
return parts.key ? { key: parts.key, subject: parts.subject } : { subject };
|
|
65
|
+
};
|
|
66
|
+
const renameSuggestion = (options) => {
|
|
67
|
+
const { shape, groups } = options;
|
|
68
|
+
const key = groups['key'];
|
|
69
|
+
return shape.renameTo
|
|
70
|
+
.replace(/<subject>/g, () => { var _a; return (_a = groups['subject']) !== null && _a !== void 0 ? _a : ''; })
|
|
71
|
+
.replace(/<KEY>/g, () => (key ? key.toUpperCase() : '<KEY>'));
|
|
72
|
+
};
|
|
73
|
+
const targetsForKind = (options) => {
|
|
74
|
+
const { kind, config, parent, branch } = options;
|
|
75
|
+
const { development, production } = config.baseBranches;
|
|
76
|
+
switch (kind) {
|
|
77
|
+
case 'main-feature':
|
|
78
|
+
return { expectedBase: development, expectedMrTargets: [development] };
|
|
79
|
+
case 'sub-feature':
|
|
80
|
+
case 'release-fix':
|
|
81
|
+
return { expectedBase: parent, expectedMrTargets: parent ? [parent] : [] };
|
|
82
|
+
case 'release':
|
|
83
|
+
return { expectedBase: development, expectedMrTargets: [development, production] };
|
|
84
|
+
case 'hotfix':
|
|
85
|
+
return { expectedBase: production, expectedMrTargets: [production] };
|
|
86
|
+
case 'protected':
|
|
87
|
+
return { expectedMrTargets: branch === development ? [production] : [development] };
|
|
88
|
+
default:
|
|
89
|
+
return { expectedMrTargets: [] };
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Classifies a branch name against the grammar. Never throws: an unrecognised name comes back as
|
|
94
|
+
* `kind: 'unknown'` with findings, so the validator and timetrack's correlation engine can read
|
|
95
|
+
* the same result for different purposes.
|
|
96
|
+
*/
|
|
97
|
+
const parseBranch = (options) => {
|
|
98
|
+
const { config } = options;
|
|
99
|
+
const branch = (0, exports.stripRefPrefix)(options.branch);
|
|
100
|
+
const segments = branch.split('/');
|
|
101
|
+
const unknown = (message) => ({
|
|
102
|
+
branch,
|
|
103
|
+
ok: false,
|
|
104
|
+
kind: 'unknown',
|
|
105
|
+
deprecated: false,
|
|
106
|
+
expectedMrTargets: [],
|
|
107
|
+
findings: [{ rule: 'unknown-type', message }],
|
|
108
|
+
});
|
|
109
|
+
if (!branch || segments.some((segment) => !segment))
|
|
110
|
+
return unknown(`"${options.branch}" is not a branch name.`);
|
|
111
|
+
if (branch === config.baseBranches.development || branch === config.baseBranches.production) {
|
|
112
|
+
return Object.assign({ branch, ok: true, kind: 'protected', deprecated: false, findings: [] }, targetsForKind({ kind: 'protected', config, branch }));
|
|
113
|
+
}
|
|
114
|
+
const deprecated = matchDeprecatedShape({ branch, config });
|
|
115
|
+
if (deprecated) {
|
|
116
|
+
const keyed = deprecatedKey({ groups: deprecated.groups, config });
|
|
117
|
+
const suggestion = renameSuggestion({
|
|
118
|
+
shape: deprecated.shape,
|
|
119
|
+
groups: Object.assign(Object.assign({}, deprecated.groups), { key: keyed.key, subject: keyed.subject }),
|
|
120
|
+
});
|
|
121
|
+
const keys = deprecated.shape.kind === 'main-feature'
|
|
122
|
+
? { storyKey: keyed.key, issueKey: keyed.key }
|
|
123
|
+
: { taskKey: keyed.key, issueKey: keyed.key };
|
|
124
|
+
return Object.assign(Object.assign(Object.assign({ branch, ok: false, kind: deprecated.shape.kind }, keys), { subject: keyed.subject, deprecated: true, suggestedName: suggestion, findings: [
|
|
125
|
+
{
|
|
126
|
+
rule: 'deprecated-prefix',
|
|
127
|
+
message: `"${branch}" uses a deprecated spelling; rename it to ${suggestion}.`,
|
|
128
|
+
suggestion,
|
|
129
|
+
},
|
|
130
|
+
] }), targetsForKind({ kind: deprecated.shape.kind, config }));
|
|
131
|
+
}
|
|
132
|
+
const [prefix, ...rest] = segments;
|
|
133
|
+
if (prefix === config.subPrefix)
|
|
134
|
+
return dropRedundantSuggestion(parseNested({ branch, segments: rest, config }));
|
|
135
|
+
if (prefix === config.releasePrefix)
|
|
136
|
+
return dropRedundantSuggestion(parseRelease({ branch, segments: rest, config }));
|
|
137
|
+
if (prefix === config.hotfixPrefix)
|
|
138
|
+
return dropRedundantSuggestion(parseHotfix({ branch, segments: rest, config }));
|
|
139
|
+
return dropRedundantSuggestion(parseFeature({ branch, prefix: prefix !== null && prefix !== void 0 ? prefix : '', segments: rest, config }));
|
|
140
|
+
};
|
|
141
|
+
exports.parseBranch = parseBranch;
|
|
142
|
+
const unrecognised = (options) => ({
|
|
143
|
+
branch: options.branch,
|
|
144
|
+
ok: false,
|
|
145
|
+
kind: 'unknown',
|
|
146
|
+
deprecated: false,
|
|
147
|
+
expectedMrTargets: [],
|
|
148
|
+
findings: [{ rule: 'unknown-type', message: options.message }],
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* `sub/<parent path>/<KEY>-<subject>` — the nested shape. The parent's full name is inside the
|
|
152
|
+
* child's, so the merge request target needs no lookup; only two levels are allowed, so a parent
|
|
153
|
+
* that is itself nested is not a shape.
|
|
154
|
+
*/
|
|
155
|
+
const parseNested = (options) => {
|
|
156
|
+
var _a, _b, _c;
|
|
157
|
+
const { branch, segments, config } = options;
|
|
158
|
+
const leaf = segments[segments.length - 1];
|
|
159
|
+
const parent = segments.slice(0, -1).join('/');
|
|
160
|
+
if (!leaf || !parent) {
|
|
161
|
+
return unrecognised({ branch, message: `"${branch}" names no parent branch to nest under.` });
|
|
162
|
+
}
|
|
163
|
+
const parentParse = (0, exports.parseBranch)({ branch: parent, config });
|
|
164
|
+
const kind = nestedKindFor(parentParse);
|
|
165
|
+
if (!kind) {
|
|
166
|
+
return unrecognised({
|
|
167
|
+
branch,
|
|
168
|
+
message: `"${parent}" is not a branch anything can nest under — only a main feature or a release branch is.`,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const parts = parseSegment({ segment: leaf, config, role: kind === 'release-fix' ? 'bug' : 'task' });
|
|
172
|
+
const findings = [...parentParse.findings, ...parts.findings];
|
|
173
|
+
return Object.assign({ branch, ok: findings.length === 0, type: parentParse.type, kind, storyKey: parentParse.storyKey, taskKey: parts.key, issueKey: (_a = parts.key) !== null && _a !== void 0 ? _a : parentParse.storyKey, subject: parts.subject, parent, deprecated: false, findings, suggestedName: parts.key
|
|
174
|
+
? (0, build_1.buildBranchName)({
|
|
175
|
+
spec: { kind, parent: (_b = parentParse.suggestedName) !== null && _b !== void 0 ? _b : parent, key: parts.key, subject: (_c = parts.subject) !== null && _c !== void 0 ? _c : '' },
|
|
176
|
+
config,
|
|
177
|
+
})
|
|
178
|
+
: undefined }, targetsForKind({ kind, config, parent }));
|
|
179
|
+
};
|
|
180
|
+
const nestedKindFor = (parent) => {
|
|
181
|
+
if (parent.kind === 'release')
|
|
182
|
+
return 'release-fix';
|
|
183
|
+
return parent.kind === 'main-feature' && !parent.deprecated ? 'sub-feature' : undefined;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* The spelling the convention was originally written with, `<parent>/<KEY>-<subject>`. It parses so
|
|
187
|
+
* that `explain` and `repair` can say something useful about it, but it can never exist next to the
|
|
188
|
+
* parent it names — see `subPrefix`.
|
|
189
|
+
*/
|
|
190
|
+
const nestedTooDeep = (options) => {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
const { branch, kind, parent, leaf, config, storyKey, type } = options;
|
|
193
|
+
const suggestion = leaf.key
|
|
194
|
+
? (0, build_1.buildBranchName)({ spec: { kind, parent, key: leaf.key, subject: (_a = leaf.subject) !== null && _a !== void 0 ? _a : '' }, config })
|
|
195
|
+
: `${config.subPrefix}/${branch}`;
|
|
196
|
+
return Object.assign({ branch, ok: false, kind,
|
|
197
|
+
type,
|
|
198
|
+
storyKey, taskKey: leaf.key, issueKey: (_b = leaf.key) !== null && _b !== void 0 ? _b : storyKey, subject: leaf.subject, parent, deprecated: true, suggestedName: suggestion, findings: [
|
|
199
|
+
{
|
|
200
|
+
rule: 'deprecated-prefix',
|
|
201
|
+
message: `"${branch}" cannot exist while ${parent} does — git rejects a ref that is both a branch and a directory of branches. Use ${suggestion}.`,
|
|
202
|
+
suggestion,
|
|
203
|
+
},
|
|
204
|
+
] }, targetsForKind({ kind, config, parent }));
|
|
205
|
+
};
|
|
206
|
+
const dropRedundantSuggestion = (result) => result.suggestedName === result.branch ? Object.assign(Object.assign({}, result), { suggestedName: undefined }) : result;
|
|
207
|
+
const parseRelease = (options) => {
|
|
208
|
+
const { branch, segments, config } = options;
|
|
209
|
+
const [date, leaf, ...extra] = segments;
|
|
210
|
+
if (!date || extra.length > 0) {
|
|
211
|
+
return unrecognised({ branch, message: `"${branch}" is not a release or release-fix branch.` });
|
|
212
|
+
}
|
|
213
|
+
const findings = [];
|
|
214
|
+
if (!new RegExp(`^${config.releasePattern}$`).test(date)) {
|
|
215
|
+
findings.push({ rule: 'release-date', message: `"${date}" is not a release date (expected YYYY.MM.DD).` });
|
|
216
|
+
}
|
|
217
|
+
const parent = `${config.releasePrefix}/${date}`;
|
|
218
|
+
if (leaf === undefined) {
|
|
219
|
+
return Object.assign({ branch, ok: findings.length === 0, kind: 'release', deprecated: false, findings }, targetsForKind({ kind: 'release', config }));
|
|
220
|
+
}
|
|
221
|
+
return nestedTooDeep({
|
|
222
|
+
branch,
|
|
223
|
+
kind: 'release-fix',
|
|
224
|
+
parent,
|
|
225
|
+
leaf: parseSegment({ segment: leaf, config, role: 'bug' }),
|
|
226
|
+
config,
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
const parseHotfix = (options) => {
|
|
230
|
+
var _a;
|
|
231
|
+
const { branch, segments, config } = options;
|
|
232
|
+
const [leaf, ...extra] = segments;
|
|
233
|
+
if (!leaf || extra.length > 0) {
|
|
234
|
+
return {
|
|
235
|
+
branch,
|
|
236
|
+
ok: false,
|
|
237
|
+
kind: 'unknown',
|
|
238
|
+
deprecated: false,
|
|
239
|
+
expectedMrTargets: [],
|
|
240
|
+
findings: [{ rule: 'unknown-type', message: `"${branch}" is not a hotfix branch.` }],
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
const parts = parseSegment({ segment: leaf, config, role: 'bug' });
|
|
244
|
+
return Object.assign({ branch, ok: parts.findings.length === 0, kind: 'hotfix', taskKey: parts.key, issueKey: parts.key, subject: parts.subject, deprecated: false, findings: parts.findings, suggestedName: parts.key
|
|
245
|
+
? (0, build_1.buildBranchName)({ spec: { kind: 'hotfix', key: parts.key, subject: (_a = parts.subject) !== null && _a !== void 0 ? _a : '' }, config })
|
|
246
|
+
: undefined }, targetsForKind({ kind: 'hotfix', config }));
|
|
247
|
+
};
|
|
248
|
+
const parseFeature = (options) => {
|
|
249
|
+
var _a;
|
|
250
|
+
const { branch, prefix, segments, config } = options;
|
|
251
|
+
const alias = Object.prototype.hasOwnProperty.call(config.typeAliases, prefix)
|
|
252
|
+
? config.typeAliases[prefix]
|
|
253
|
+
: undefined;
|
|
254
|
+
const type = config.types.includes(prefix) ? prefix : alias;
|
|
255
|
+
const [story, task, ...extra] = segments;
|
|
256
|
+
if (!type || !story || extra.length > 0) {
|
|
257
|
+
return unrecognised({
|
|
258
|
+
branch,
|
|
259
|
+
message: `"${branch}" matches no branch shape; expected <type>/<KEY>-<subject> with type one of ${config.types.join(', ')}.`,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
const findings = [];
|
|
263
|
+
if (alias && prefix !== type) {
|
|
264
|
+
findings.push({ rule: 'type-alias', message: `"${prefix}/" is an alias; use "${type}/".` });
|
|
265
|
+
}
|
|
266
|
+
const storyParts = parseSegment({ segment: story, config, role: 'story' });
|
|
267
|
+
if (task === undefined) {
|
|
268
|
+
findings.push(...storyParts.findings);
|
|
269
|
+
return Object.assign({ branch, ok: findings.length === 0, kind: 'main-feature', type, storyKey: storyParts.key, issueKey: storyParts.key, subject: storyParts.subject, deprecated: false, findings, suggestedName: storyParts.key
|
|
270
|
+
? (0, build_1.buildBranchName)({
|
|
271
|
+
spec: { kind: 'main-feature', type, key: storyParts.key, subject: (_a = storyParts.subject) !== null && _a !== void 0 ? _a : '' },
|
|
272
|
+
config,
|
|
273
|
+
})
|
|
274
|
+
: undefined }, targetsForKind({ kind: 'main-feature', config }));
|
|
275
|
+
}
|
|
276
|
+
return nestedTooDeep({
|
|
277
|
+
branch,
|
|
278
|
+
kind: 'sub-feature',
|
|
279
|
+
parent: `${prefix}/${story}`,
|
|
280
|
+
leaf: parseSegment({ segment: task, config, role: 'task' }),
|
|
281
|
+
config,
|
|
282
|
+
storyKey: storyParts.key,
|
|
283
|
+
type,
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Attributes a keyless branch through the branch it is based on. Reviewed branches land in an
|
|
288
|
+
* integration branch, so a flat name like `feat/logout-confirmation` usually has a parent that
|
|
289
|
+
* does carry the story key. Deterministic — no model involved.
|
|
290
|
+
*/
|
|
291
|
+
const resolveThroughBase = (options) => {
|
|
292
|
+
var _a, _b;
|
|
293
|
+
const { branch, base } = options;
|
|
294
|
+
const inherited = (_a = base.storyKey) !== null && _a !== void 0 ? _a : base.taskKey;
|
|
295
|
+
if (branch.storyKey || !inherited)
|
|
296
|
+
return branch;
|
|
297
|
+
return Object.assign(Object.assign({}, branch), { storyKey: inherited, issueKey: (_b = branch.taskKey) !== null && _b !== void 0 ? _b : inherited, inheritedFrom: base.branch });
|
|
298
|
+
};
|
|
299
|
+
exports.resolveThroughBase = resolveThroughBase;
|
|
300
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/git-flow/parse.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAkCnC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CAC5C,GAAG;KACA,IAAI,EAAE;KACN,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;KAC7B,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;AAJ/B,QAAA,cAAc,kBAIiB;AAE5C,MAAM,YAAY,GAAG,CAAC,OAAoD,EAAE,EAAE;;IAC5E,MAAM,GAAG,GAAG,MAAA,OAAO,CAAC,GAAG,0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
3
|
+
ok: true;
|
|
4
|
+
name: string;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
/**
|
|
8
|
+
* `needs-key` is the only reason a caller can act on: file the issue, then ask again with the
|
|
9
|
+
* key it returned.
|
|
10
|
+
*/
|
|
11
|
+
reason: 'already-conforms' | 'needs-key' | 'no-shape';
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The conforming name a non-conforming branch should take, once an issue key exists for it.
|
|
15
|
+
*
|
|
16
|
+
* A candidate is returned only after it parses as fully conforming, so a rename always lands on a
|
|
17
|
+
* name the grammar accepts — `parseBranch`'s own `suggestedName` does not guarantee that for a
|
|
18
|
+
* nested branch whose leaf names no issue, and half a rename is worse than none.
|
|
19
|
+
*/
|
|
20
|
+
export declare const conformingNameFor: (options: {
|
|
21
|
+
branch: string;
|
|
22
|
+
key?: string;
|
|
23
|
+
config: GitFlowConfig;
|
|
24
|
+
}) => ConformingName;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.conformingNameFor = void 0;
|
|
4
|
+
const build_1 = require("./build");
|
|
5
|
+
const parse_1 = require("./parse");
|
|
6
|
+
const KEY_PLACEHOLDER = '<KEY>';
|
|
7
|
+
/**
|
|
8
|
+
* The spec that rebuilds a branch whose leaf carries no key at all, which is why `parseBranch` left
|
|
9
|
+
* `suggestedName` unset. Only the kinds the grammar can spell are here — an unrecognised name names
|
|
10
|
+
* no kind, and inventing one would rename the branch to something the user never chose.
|
|
11
|
+
*/
|
|
12
|
+
const specFor = (options) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const { parse, key } = options;
|
|
15
|
+
const subject = (_a = parse.subject) !== null && _a !== void 0 ? _a : '';
|
|
16
|
+
switch (parse.kind) {
|
|
17
|
+
case 'main-feature':
|
|
18
|
+
return { kind: 'main-feature', type: parse.type, key, subject };
|
|
19
|
+
case 'hotfix':
|
|
20
|
+
return { kind: 'hotfix', key, subject };
|
|
21
|
+
case 'sub-feature':
|
|
22
|
+
return parse.parent ? { kind: 'sub-feature', parent: parse.parent, key, subject } : undefined;
|
|
23
|
+
case 'release-fix':
|
|
24
|
+
return parse.parent ? { kind: 'release-fix', parent: parse.parent, key, subject } : undefined;
|
|
25
|
+
default:
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const candidatesFor = (options) => {
|
|
30
|
+
const { parse, key, config } = options;
|
|
31
|
+
const suggested = parse.suggestedName;
|
|
32
|
+
const candidates = [];
|
|
33
|
+
if (suggested && !suggested.includes(KEY_PLACEHOLDER))
|
|
34
|
+
candidates.push(suggested);
|
|
35
|
+
if (key) {
|
|
36
|
+
if (suggested === null || suggested === void 0 ? void 0 : suggested.includes(KEY_PLACEHOLDER))
|
|
37
|
+
candidates.push(suggested.replace(/<KEY>/g, key.toUpperCase()));
|
|
38
|
+
const spec = specFor({ parse, key: key.toUpperCase() });
|
|
39
|
+
if (spec)
|
|
40
|
+
candidates.push((0, build_1.buildBranchName)({ spec, config }));
|
|
41
|
+
}
|
|
42
|
+
return candidates;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The conforming name a non-conforming branch should take, once an issue key exists for it.
|
|
46
|
+
*
|
|
47
|
+
* A candidate is returned only after it parses as fully conforming, so a rename always lands on a
|
|
48
|
+
* name the grammar accepts — `parseBranch`'s own `suggestedName` does not guarantee that for a
|
|
49
|
+
* nested branch whose leaf names no issue, and half a rename is worse than none.
|
|
50
|
+
*/
|
|
51
|
+
const conformingNameFor = (options) => {
|
|
52
|
+
var _a;
|
|
53
|
+
const { key, config } = options;
|
|
54
|
+
const parse = (0, parse_1.parseBranch)({ branch: options.branch, config });
|
|
55
|
+
if (parse.ok)
|
|
56
|
+
return { ok: false, reason: 'already-conforms' };
|
|
57
|
+
for (const name of candidatesFor({ parse, key, config })) {
|
|
58
|
+
if (name !== parse.branch && (0, parse_1.parseBranch)({ branch: name, config }).ok)
|
|
59
|
+
return { ok: true, name };
|
|
60
|
+
}
|
|
61
|
+
if (key)
|
|
62
|
+
return { ok: false, reason: 'no-shape' };
|
|
63
|
+
// Whether a key would help is answered by trying one, using a prefix this repo accepts so the
|
|
64
|
+
// probe is not rejected by `keyPrefixes` for a reason the real key would not hit.
|
|
65
|
+
const probe = candidatesFor({ parse, key: `${(_a = config.keyPrefixes[0]) !== null && _a !== void 0 ? _a : 'KEY'}-1`, config });
|
|
66
|
+
const rebuildable = probe.some((name) => (0, parse_1.parseBranch)({ branch: name, config }).ok);
|
|
67
|
+
return { ok: false, reason: rebuildable ? 'needs-key' : 'no-shape' };
|
|
68
|
+
};
|
|
69
|
+
exports.conformingNameFor = conformingNameFor;
|
|
70
|
+
//# sourceMappingURL=rename.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/git-flow/rename.ts"],"names":[],"mappings":";;;AAAA,mCAA0D;AAE1D,mCAAyD;AAEzD,MAAM,eAAe,GAAG,OAAO,CAAC;AAahC;;;;GAIG;AACH,MAAM,OAAO,GAAG,CAAC,OAAkD,EAA8B,EAAE;;IACjG,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,OAAO,mCAAI,EAAE,CAAC;IAEpC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,cAAc;YACjB,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;QAClE,KAAK,QAAQ;YACX,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;QAC1C,KAAK,aAAa;YAChB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAA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