@ethlete/agent-rules 0.1.0-next.0 → 0.1.0-next.10
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/CHANGELOG.md +102 -0
- package/README.md +363 -16
- package/content/git-hooks/post-checkout.sh +10 -0
- package/content/git-hooks/pre-push.sh +5 -0
- package/content/hooks/context-warning.py +430 -0
- package/content/output-styles/ste-clarity.md +131 -0
- package/content/rules/comments.md +50 -20
- package/content/skills/angular-patterns/SKILL.md +1 -1
- package/content/skills/api-source/SKILL.md +118 -0
- package/content/skills/figma-export/SKILL.md +193 -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 +6 -7
- package/content/skills/git-flow/SKILL.md +87 -0
- package/content/skills/handoff/SKILL.md +4 -0
- package/content/skills/query/SKILL.md +23 -13
- package/content/skills/rxjs-signals/SKILL.md +1 -1
- package/content/skills/sdk-docs/SKILL.md +10 -2
- package/content/skills/sdk-local-build/SKILL.md +115 -0
- package/content/skills/sdk-source/SKILL.md +133 -0
- package/content/skills/styleguide/STYLEGUIDE.md +2 -2
- package/content/skills/theming/SKILL.md +1 -1
- package/content/skills/timetrack/SKILL.md +66 -0
- package/package.json +12 -1
- package/src/index.js +35 -14
- package/src/index.js.map +1 -1
- 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 +64 -2
- package/src/lib/config.js +54 -9
- package/src/lib/config.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 +10 -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 +274 -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 +157 -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 +146 -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 +132 -0
- package/src/lib/git-flow-start.js.map +1 -0
- package/src/lib/git.d.ts +27 -0
- package/src/lib/git.js +49 -0
- package/src/lib/git.js.map +1 -0
- package/src/lib/gitlab.d.ts +35 -0
- package/src/lib/gitlab.js +98 -0
- package/src/lib/gitlab.js.map +1 -0
- package/src/lib/index.d.ts +2 -0
- package/src/lib/index.js +2 -0
- package/src/lib/index.js.map +1 -1
- package/src/lib/migrate.d.ts +6 -0
- package/src/lib/migrate.js +155 -0
- package/src/lib/migrate.js.map +1 -0
- 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 +126 -0
- package/src/lib/output-style.js.map +1 -0
- package/src/lib/owned-paths.js +22 -1
- package/src/lib/owned-paths.js.map +1 -1
- package/src/lib/plan.d.ts +4 -1
- package/src/lib/plan.js +141 -8
- package/src/lib/plan.js.map +1 -1
- package/src/lib/prompt.d.ts +8 -0
- package/src/lib/prompt.js +27 -0
- package/src/lib/prompt.js.map +1 -0
- package/src/lib/render.d.ts +20 -2
- package/src/lib/render.js +31 -8
- package/src/lib/render.js.map +1 -1
- package/src/lib/sync.d.ts +0 -1
- package/src/lib/sync.js +8 -2
- package/src/lib/sync.js.map +1 -1
- package/src/lib/targets/agents-skills.d.ts +8 -0
- package/src/lib/targets/agents-skills.js +18 -0
- package/src/lib/targets/agents-skills.js.map +1 -0
- package/src/lib/targets/claude-hooks.d.ts +11 -0
- package/src/lib/targets/claude-hooks.js +28 -0
- package/src/lib/targets/claude-hooks.js.map +1 -0
- package/src/lib/targets/claude.d.ts +3 -1
- package/src/lib/targets/claude.js +14 -21
- 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 +33 -0
- package/src/lib/targets/codex-hooks.js.map +1 -0
- package/src/lib/targets/codex.d.ts +5 -3
- package/src/lib/targets/codex.js +9 -8
- package/src/lib/targets/codex.js.map +1 -1
- package/src/lib/targets/copilot.d.ts +3 -3
- package/src/lib/targets/copilot.js +6 -29
- package/src/lib/targets/copilot.js.map +1 -1
- package/src/lib/targets/cursor.d.ts +3 -3
- package/src/lib/targets/cursor.js +7 -12
- package/src/lib/targets/cursor.js.map +1 -1
- package/src/lib/targets/git-hooks.d.ts +24 -0
- package/src/lib/targets/git-hooks.js +70 -0
- package/src/lib/targets/git-hooks.js.map +1 -0
- package/src/lib/targets/hooks-shared.d.ts +37 -0
- package/src/lib/targets/hooks-shared.js +95 -0
- package/src/lib/targets/hooks-shared.js.map +1 -0
- package/src/lib/targets/shared.d.ts +22 -13
- package/src/lib/targets/shared.js +32 -15
- package/src/lib/targets/shared.js.map +1 -1
- package/src/lib/timetrack-command.d.ts +11 -0
- package/src/lib/timetrack-command.js +199 -0
- package/src/lib/timetrack-command.js.map +1 -0
- package/src/lib/timetrack.d.ts +86 -0
- package/src/lib/timetrack.js +112 -0
- package/src/lib/timetrack.js.map +1 -0
- package/src/lib/targets/neutral.d.ts +0 -8
- package/src/lib/targets/neutral.js +0 -29
- package/src/lib/targets/neutral.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: timetrack
|
|
3
|
+
description: How to reach Jira from any repo through the running Timetrack app - look up an issue, search for one, ask which project a repo logs into, file a ticket, or add a worklog row. Read whenever a task needs Jira data or a Jira write, and never put a Jira token in a repo.
|
|
4
|
+
kind: skill
|
|
5
|
+
scope: both
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Reaching Jira through Timetrack
|
|
9
|
+
|
|
10
|
+
**No repository holds a Jira token.** The Timetrack desktop app holds one set of credentials
|
|
11
|
+
in this machine's keychain, and every repository asks it:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx ethlete-agents timetrack status # is the app reachable, and what does it hold?
|
|
15
|
+
npx ethlete-agents timetrack issue FIP-2177 # one issue: summary, type, parent, subject
|
|
16
|
+
npx ethlete-agents timetrack search "password" # open issues of the picked projects
|
|
17
|
+
npx ethlete-agents timetrack project # which project does this repo log into?
|
|
18
|
+
npx ethlete-agents timetrack instance # the instance's own levels and custom fields
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Add `--json` to any of them when you need to read a field rather than a line.
|
|
22
|
+
|
|
23
|
+
**Never ask the user for a Jira token, and never write one into a file.** If a command reports
|
|
24
|
+
that the app is not running, say so and ask the user to start it. That is the whole fix -
|
|
25
|
+
there is no per-repo fallback, by design: a secret copied into every checkout is a secret
|
|
26
|
+
nobody can rotate.
|
|
27
|
+
|
|
28
|
+
## What each command is for
|
|
29
|
+
|
|
30
|
+
| Command | Use it when |
|
|
31
|
+
| --------------------------------- | ----------------------------------------------------------------------- |
|
|
32
|
+
| `status` | Before anything else, when a Jira command failed and you need the cause |
|
|
33
|
+
| `instance` | A setup step needs the instance's levels or its branch-subject field |
|
|
34
|
+
| `issue <KEY>` | The user names a key and you need its summary, type or parent |
|
|
35
|
+
| `search [text]` | The user describes work but names no key |
|
|
36
|
+
| `project [path]` | You need the project a repository files into |
|
|
37
|
+
| `create --summary "…"` | The work has no ticket and the user asked for one |
|
|
38
|
+
| `log --issue <KEY> --minutes <n>` | The user asks to record time that nothing observed |
|
|
39
|
+
|
|
40
|
+
`git-flow start` uses the same channel, so a branch is named from the real issue rather than
|
|
41
|
+
from a key you typed - see the `git-flow` skill.
|
|
42
|
+
|
|
43
|
+
## Writes
|
|
44
|
+
|
|
45
|
+
Two commands write, so both need the user to have asked for them in this conversation:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx ethlete-agents timetrack create --summary "Reset password mail is not sent" --project FIP
|
|
49
|
+
npx ethlete-agents timetrack log --issue FIP-2177 --minutes 45 --description "pairing call"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- **`create`** files the issue with the instance's own ticket settings - its type, its parent
|
|
53
|
+
rule and its subject field all come from the app, so the ticket is shaped like every other.
|
|
54
|
+
`--project` is needed unless the app holds exactly one picked project.
|
|
55
|
+
- **`log`** adds a row to the day in Timetrack. It is **not** a Tempo entry: the user reviews
|
|
56
|
+
the day and syncs it, which is what keeps an agent's row from double-booking against the
|
|
57
|
+
hours the day already observed. `--at <date>` places it; without one it starts now.
|
|
58
|
+
|
|
59
|
+
## What the app decides, not you
|
|
60
|
+
|
|
61
|
+
- **The projects.** The user picked them in Timetrack. `search` is scoped to them, and
|
|
62
|
+
`--project <KEY>` is how you look outside.
|
|
63
|
+
- **The branch subject.** `issue` returns `subject` when the instance's subject field is set on
|
|
64
|
+
that issue. Prefer it over the summary; the summary is a paraphrase.
|
|
65
|
+
- **The instance.** Its host, its issue types and its hierarchy are settings in the app. Do not
|
|
66
|
+
hardcode any of them in this repo.
|
package/package.json
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethlete/agent-rules",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "commonjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.d.ts",
|
|
9
|
+
"default": "./src/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./git-flow": {
|
|
12
|
+
"types": "./src/lib/git-flow/index.d.ts",
|
|
13
|
+
"default": "./src/lib/git-flow/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
6
17
|
"main": "./src/index.js",
|
|
7
18
|
"typings": "./src/index.d.ts",
|
|
8
19
|
"bin": {
|
package/src/index.js
CHANGED
|
@@ -5,17 +5,33 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const config_1 = require("./lib/config");
|
|
8
|
+
const git_flow_command_1 = require("./lib/git-flow-command");
|
|
9
|
+
const migrate_1 = require("./lib/migrate");
|
|
10
|
+
const output_style_command_1 = require("./lib/output-style-command");
|
|
8
11
|
const sync_1 = require("./lib/sync");
|
|
12
|
+
const timetrack_command_1 = require("./lib/timetrack-command");
|
|
9
13
|
const USAGE = `ethlete-agents — compile @ethlete agent rules and skills into your repo
|
|
10
14
|
|
|
11
|
-
ethlete-agents sync
|
|
12
|
-
ethlete-agents check
|
|
13
|
-
ethlete-agents init
|
|
15
|
+
ethlete-agents sync Write the generated rules/skills for every detected agent
|
|
16
|
+
ethlete-agents check Exit non-zero when the generated files are out of date (for CI)
|
|
17
|
+
ethlete-agents init Write a starter ${config_1.CONFIG_FILE_NAME}
|
|
18
|
+
ethlete-agents git-flow Name, check and repair branches against the repo's git flow
|
|
19
|
+
(start, check, repair, explain)
|
|
20
|
+
ethlete-agents output-style
|
|
21
|
+
Install an Ethlete output style into this machine's Claude Code
|
|
22
|
+
config and switch to it (Claude Code only)
|
|
23
|
+
ethlete-agents timetrack Ask the running Timetrack app about Jira - it holds this
|
|
24
|
+
machine's credentials, so no repo needs a token
|
|
25
|
+
(status, instance, issue, search, project, create, log)
|
|
26
|
+
ethlete-agents migrate Convert the repo to the AGENTS.md + .agents/skills layout:
|
|
27
|
+
CLAUDE.md content moves into AGENTS.md (CLAUDE.md becomes an
|
|
28
|
+
@AGENTS.md import), hand-written .claude/skills move to
|
|
29
|
+
.agents/skills with symlinks left behind, then a sync runs
|
|
14
30
|
|
|
15
31
|
Options
|
|
16
32
|
--targets <list> Comma-separated subset of: ${config_1.AGENT_TARGETS.join(', ')}
|
|
17
33
|
--root <path> Repo root to write into (default: current directory)
|
|
18
|
-
--dry-run Print what
|
|
34
|
+
--dry-run Print what would change without writing (sync and migrate)
|
|
19
35
|
`;
|
|
20
36
|
const readFlag = (args, flag) => {
|
|
21
37
|
const index = args.indexOf(flag);
|
|
@@ -29,10 +45,6 @@ const parseTargets = (args) => {
|
|
|
29
45
|
return undefined;
|
|
30
46
|
return raw.split(',').map((entry) => entry.trim());
|
|
31
47
|
};
|
|
32
|
-
const readVersion = () => {
|
|
33
|
-
const manifest = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
|
|
34
|
-
return manifest.version;
|
|
35
|
-
};
|
|
36
48
|
const init = (root) => {
|
|
37
49
|
const path = (0, path_1.join)(root, config_1.CONFIG_FILE_NAME);
|
|
38
50
|
if ((0, fs_1.existsSync)(path)) {
|
|
@@ -43,6 +55,7 @@ const init = (root) => {
|
|
|
43
55
|
targets: (0, config_1.detectTargets)(root),
|
|
44
56
|
vars: {},
|
|
45
57
|
exclude: [],
|
|
58
|
+
hooks: [],
|
|
46
59
|
};
|
|
47
60
|
(0, fs_1.writeFileSync)(path, `${JSON.stringify(template, null, 2)}\n`, 'utf8');
|
|
48
61
|
console.log(`Wrote ${config_1.CONFIG_FILE_NAME}. Fill in "vars" for your repo, then run \`ethlete-agents sync\`.`);
|
|
@@ -52,7 +65,7 @@ const run = (argv) => {
|
|
|
52
65
|
var _a;
|
|
53
66
|
const command = argv[0];
|
|
54
67
|
const root = (_a = readFlag(argv, '--root')) !== null && _a !== void 0 ? _a : process.cwd();
|
|
55
|
-
const options = { root,
|
|
68
|
+
const options = { root, targets: parseTargets(argv) };
|
|
56
69
|
switch (command) {
|
|
57
70
|
case 'sync':
|
|
58
71
|
return (0, sync_1.sync)(Object.assign(Object.assign({}, options), { dryRun: argv.includes('--dry-run') }));
|
|
@@ -60,6 +73,14 @@ const run = (argv) => {
|
|
|
60
73
|
return (0, sync_1.check)(options);
|
|
61
74
|
case 'init':
|
|
62
75
|
return init(root);
|
|
76
|
+
case 'git-flow':
|
|
77
|
+
return (0, git_flow_command_1.gitFlowCommand)({ root, argv: argv.slice(1) });
|
|
78
|
+
case 'output-style':
|
|
79
|
+
return (0, output_style_command_1.outputStyleCommand)({ argv: argv.slice(1) });
|
|
80
|
+
case 'timetrack':
|
|
81
|
+
return (0, timetrack_command_1.timetrackCommand)({ root, argv: argv.slice(1) });
|
|
82
|
+
case 'migrate':
|
|
83
|
+
return (0, migrate_1.migrate)(Object.assign(Object.assign({}, options), { dryRun: argv.includes('--dry-run') }));
|
|
63
84
|
default:
|
|
64
85
|
console.log(USAGE);
|
|
65
86
|
return command === undefined || command === '--help' || command === '-h' ? 0 : 1;
|
|
@@ -68,12 +89,12 @@ const run = (argv) => {
|
|
|
68
89
|
tslib_1.__exportStar(require("./lib"), exports);
|
|
69
90
|
// Guarded so the package can also be imported as a library without running the CLI.
|
|
70
91
|
if (require.main === module) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
Promise.resolve()
|
|
93
|
+
.then(() => run(process.argv.slice(2)))
|
|
94
|
+
.then((code) => process.exit(code))
|
|
95
|
+
.catch((error) => {
|
|
75
96
|
console.error(error instanceof Error ? error.message : error);
|
|
76
97
|
process.exit(1);
|
|
77
|
-
}
|
|
98
|
+
});
|
|
78
99
|
}
|
|
79
100
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/agent-rules/src/index.ts"],"names":[],"mappings":";;;;AACA,2BAA+C;AAC/C,+BAA4B;AAC5B,yCAA2F;AAC3F,6DAAwD;AACxD,2CAAwC;AACxC,qEAAgE;AAChE,qCAAyC;AACzC,+DAA2D;AAE3D,MAAM,KAAK,GAAG;;;;6CAI+B,yBAAgB;;;;;;;;;;;;;;;kDAeX,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,IAAc,EAAE,EAAE;IACtC,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAExC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAE3B,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAkB,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE;IAC5B,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,yBAAgB,CAAC,CAAC;IAE1C,IAAI,IAAA,eAAU,EAAC,IAAI,CAAC,EAAE,CAAC;QACrB,OA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A,yCAAkB,EAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrD,KAAK,WAAW;YACd,OAAO,IAAA,oCAAgB,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzD,KAAK,SAAS;YACZ,OAAO,IAAA,iBAAO,kCAAM,OAAO,KAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAG,CAAC;QACrE;YACE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAEnB,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,CAAC;AACH,CAAC,CAAC;AAEF,gDAAsB;AAEtB,oFAAoF;AACpF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE;SACd,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACtC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAClC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -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"}
|
package/src/lib/config.d.ts
CHANGED
|
@@ -1,7 +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";
|
|
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
|
+
};
|
|
5
15
|
export type SyncConfig = {
|
|
6
16
|
root: string;
|
|
7
17
|
targets: AgentTarget[];
|
|
@@ -9,10 +19,62 @@ export type SyncConfig = {
|
|
|
9
19
|
scopes: ContentScope[];
|
|
10
20
|
vars: Record<string, string | string[]>;
|
|
11
21
|
exclude: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Declares that the repo's `CLAUDE.md` is an `@AGENTS.md` import (or symlink). The claude
|
|
24
|
+
* target then skips `.claude/rules/ethlete/` — the rules already reach Claude through the
|
|
25
|
+
* `AGENTS.md` marker block, and a second copy would load twice.
|
|
26
|
+
*/
|
|
27
|
+
claudeMdImportsAgentsMd: boolean;
|
|
28
|
+
/** Opt-in agent hooks (they run commands on the developer's machine, so never default). */
|
|
29
|
+
hooks: string[];
|
|
30
|
+
/** Opt-in git hooks, appended to the repo's own husky hooks. Same reason they never default. */
|
|
31
|
+
gitHooks: string[];
|
|
32
|
+
/** The branch grammar, resolved against its defaults — see `@ethlete/agent-rules/git-flow`. */
|
|
33
|
+
gitFlow: GitFlowConfig;
|
|
34
|
+
jira: JiraSettings;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The gitignored local config holds per-machine values, read at runtime — by the generated hook
|
|
38
|
+
* scripts, and by the agent while following a skill — never by `sync`. Sync output must be
|
|
39
|
+
* identical on every machine and in CI (the generated files are committed and `check` diffs them),
|
|
40
|
+
* so nothing here may change what gets emitted:
|
|
41
|
+
*
|
|
42
|
+
* - `disableHooks: true` silences every generated hook, `["context-warning"]` just the named ones.
|
|
43
|
+
* - `disableAutoHandoffSave: true` keeps the context-warning hook's normal tiered messages (including
|
|
44
|
+
* in auto mode), but at the critical tier in auto mode it falls back to just recommending
|
|
45
|
+
* a handoff instead of writing the handoff file automatically.
|
|
46
|
+
* - `sdkSourcePath` points at a local `ethlete-sdk` checkout, which the SDK source and local-build
|
|
47
|
+
* skills read when they need the SDK's own sources instead of the published package.
|
|
48
|
+
* - `apiRepoPaths` maps an app in this repo to the checkout of the API it talks to (`{ "hub":
|
|
49
|
+
* "../fut-hub-backend" }`), which the api-source skill reads to answer a question about the
|
|
50
|
+
* server instead of guessing it from the client.
|
|
51
|
+
*
|
|
52
|
+
* No secret belongs here any more. Jira is reached through the Timetrack app, which holds the token
|
|
53
|
+
* in the machine's keychain — one secret per machine rather than one per checkout.
|
|
54
|
+
*/
|
|
55
|
+
export type LocalConfig = {
|
|
56
|
+
disableHooks?: boolean | string[];
|
|
57
|
+
disableAutoHandoffSave?: boolean;
|
|
58
|
+
sdkSourcePath?: string;
|
|
59
|
+
apiRepoPaths?: Record<string, string>;
|
|
60
|
+
};
|
|
61
|
+
export type LocalConfigState = {
|
|
62
|
+
exists: false;
|
|
63
|
+
} | {
|
|
64
|
+
exists: true;
|
|
65
|
+
valid: false;
|
|
66
|
+
} | {
|
|
67
|
+
exists: true;
|
|
68
|
+
valid: true;
|
|
69
|
+
config: LocalConfig;
|
|
70
|
+
unknownKeys: string[];
|
|
12
71
|
};
|
|
72
|
+
export declare const readLocalConfig: (root: string) => LocalConfigState;
|
|
13
73
|
/**
|
|
14
|
-
* Emit for the agents a repo already uses.
|
|
15
|
-
*
|
|
74
|
+
* Emit for the agents a repo already uses. `codex` is always included: `AGENTS.md` is the
|
|
75
|
+
* cross-tool standard that Cursor, Copilot and most other agents read as well, and gating it on
|
|
76
|
+
* an existing `AGENTS.md` would mean the file that triggers Codex output is the very file the
|
|
77
|
+
* sync is supposed to create.
|
|
16
78
|
*/
|
|
17
79
|
export declare const detectTargets: (root: string) => AgentTarget[];
|
|
18
80
|
export declare const loadConfig: (options: {
|
package/src/lib/config.js
CHANGED
|
@@ -1,32 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadConfig = exports.detectTargets = exports.CONFIG_FILE_NAME = exports.AGENT_TARGETS = void 0;
|
|
3
|
+
exports.loadConfig = exports.detectTargets = exports.readLocalConfig = exports.LOCAL_CONFIG_FILE_NAME = exports.CONFIG_FILE_NAME = exports.AGENT_TARGETS = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const commitlint_1 = require("./commitlint");
|
|
7
|
+
const git_flow_1 = require("./git-flow");
|
|
6
8
|
const load_content_1 = require("./load-content");
|
|
7
9
|
exports.AGENT_TARGETS = ['claude', 'codex', 'cursor', 'copilot'];
|
|
8
10
|
exports.CONFIG_FILE_NAME = 'ethlete-agents.config.json';
|
|
11
|
+
exports.LOCAL_CONFIG_FILE_NAME = 'ethlete-agents.config.local.json';
|
|
9
12
|
const readRawConfig = (root) => {
|
|
10
13
|
const path = (0, path_1.join)(root, exports.CONFIG_FILE_NAME);
|
|
11
14
|
if (!(0, fs_1.existsSync)(path))
|
|
12
15
|
return {};
|
|
13
16
|
return JSON.parse((0, fs_1.readFileSync)(path, 'utf8'));
|
|
14
17
|
};
|
|
18
|
+
const LOCAL_CONFIG_KEYS = [
|
|
19
|
+
'disableHooks',
|
|
20
|
+
'disableAutoHandoffSave',
|
|
21
|
+
'sdkSourcePath',
|
|
22
|
+
'apiRepoPaths',
|
|
23
|
+
];
|
|
24
|
+
const readLocalConfig = (root) => {
|
|
25
|
+
const path = (0, path_1.join)(root, exports.LOCAL_CONFIG_FILE_NAME);
|
|
26
|
+
if (!(0, fs_1.existsSync)(path))
|
|
27
|
+
return { exists: false };
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = JSON.parse((0, fs_1.readFileSync)(path, 'utf8'));
|
|
31
|
+
}
|
|
32
|
+
catch (_a) {
|
|
33
|
+
return { exists: true, valid: false };
|
|
34
|
+
}
|
|
35
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
|
|
36
|
+
return { exists: true, valid: false };
|
|
37
|
+
const config = parsed;
|
|
38
|
+
const unknownKeys = Object.keys(config).filter((key) => !LOCAL_CONFIG_KEYS.includes(key));
|
|
39
|
+
return { exists: true, valid: true, config, unknownKeys };
|
|
40
|
+
};
|
|
41
|
+
exports.readLocalConfig = readLocalConfig;
|
|
15
42
|
/**
|
|
16
|
-
* Emit for the agents a repo already uses.
|
|
17
|
-
*
|
|
43
|
+
* Emit for the agents a repo already uses. `codex` is always included: `AGENTS.md` is the
|
|
44
|
+
* cross-tool standard that Cursor, Copilot and most other agents read as well, and gating it on
|
|
45
|
+
* an existing `AGENTS.md` would mean the file that triggers Codex output is the very file the
|
|
46
|
+
* sync is supposed to create.
|
|
18
47
|
*/
|
|
19
48
|
const detectTargets = (root) => {
|
|
20
|
-
const detected = [];
|
|
49
|
+
const detected = ['codex'];
|
|
21
50
|
if ((0, fs_1.existsSync)((0, path_1.join)(root, '.claude')))
|
|
22
51
|
detected.push('claude');
|
|
23
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(root, 'AGENTS.md')) || (0, fs_1.existsSync)((0, path_1.join)(root, '.codex')))
|
|
24
|
-
detected.push('codex');
|
|
25
52
|
if ((0, fs_1.existsSync)((0, path_1.join)(root, '.cursor')))
|
|
26
53
|
detected.push('cursor');
|
|
27
54
|
if ((0, fs_1.existsSync)((0, path_1.join)(root, '.github')))
|
|
28
55
|
detected.push('copilot');
|
|
29
|
-
return detected
|
|
56
|
+
return detected;
|
|
30
57
|
};
|
|
31
58
|
exports.detectTargets = detectTargets;
|
|
32
59
|
const assertKnownTargets = (targets) => {
|
|
@@ -35,19 +62,37 @@ const assertKnownTargets = (targets) => {
|
|
|
35
62
|
throw new Error(`Unknown target(s): ${unknown.join(', ')}. Known targets: ${exports.AGENT_TARGETS.join(', ')}.`);
|
|
36
63
|
}
|
|
37
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* The git-flow skill interpolates the grammar it teaches from the same `gitFlow` block the
|
|
67
|
+
* validator reads, so the documented convention cannot drift from the enforced one. A repo can
|
|
68
|
+
* still override any of these through `vars`.
|
|
69
|
+
*/
|
|
70
|
+
const gitFlowVars = (gitFlow) => ({
|
|
71
|
+
gitFlowDevelopmentBranch: gitFlow.baseBranches.development,
|
|
72
|
+
gitFlowProductionBranch: gitFlow.baseBranches.production,
|
|
73
|
+
gitFlowTypes: gitFlow.types,
|
|
74
|
+
gitFlowEnforcement: gitFlow.enforcement,
|
|
75
|
+
gitFlowSubPrefix: gitFlow.subPrefix,
|
|
76
|
+
});
|
|
38
77
|
const loadConfig = (options) => {
|
|
39
|
-
var _a, _b, _c;
|
|
78
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
40
79
|
const { root, targetOverride } = options;
|
|
41
80
|
const raw = readRawConfig(root);
|
|
42
81
|
const configured = raw.targets && raw.targets !== 'auto' ? raw.targets : undefined;
|
|
43
82
|
const targets = (_a = targetOverride !== null && targetOverride !== void 0 ? targetOverride : configured) !== null && _a !== void 0 ? _a : (0, exports.detectTargets)(root);
|
|
83
|
+
const gitFlow = (0, git_flow_1.resolveGitFlowConfig)(raw.gitFlow);
|
|
44
84
|
assertKnownTargets(targets);
|
|
45
85
|
return {
|
|
46
86
|
root,
|
|
47
87
|
targets,
|
|
48
88
|
scopes: raw.profile === 'sdk' ? ['both'] : ['consumer', 'both'],
|
|
49
|
-
vars: Object.assign(Object.assign({}, (0, load_content_1.loadDefaultVars)()), ((_b = raw.vars) !== null && _b !== void 0 ? _b : {})),
|
|
89
|
+
vars: Object.assign(Object.assign(Object.assign(Object.assign({}, (0, load_content_1.loadDefaultVars)()), gitFlowVars(gitFlow)), (0, commitlint_1.commitMessageVars)((0, commitlint_1.findCommitlintConfig)(root))), ((_b = raw.vars) !== null && _b !== void 0 ? _b : {})),
|
|
50
90
|
exclude: (_c = raw.exclude) !== null && _c !== void 0 ? _c : [],
|
|
91
|
+
claudeMdImportsAgentsMd: (_d = raw.claudeMdImportsAgentsMd) !== null && _d !== void 0 ? _d : false,
|
|
92
|
+
hooks: (_e = raw.hooks) !== null && _e !== void 0 ? _e : [],
|
|
93
|
+
gitHooks: (_f = raw.gitHooks) !== null && _f !== void 0 ? _f : [],
|
|
94
|
+
gitFlow,
|
|
95
|
+
jira: (_g = raw.jira) !== null && _g !== void 0 ? _g : {},
|
|
51
96
|
};
|
|
52
97
|
};
|
|
53
98
|
exports.loadConfig = loadConfig;
|
package/src/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/config.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,+BAA4B;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../libs/agent-rules/src/lib/config.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,+BAA4B;AAC5B,6CAAuE;AAEvE,yCAAmF;AACnF,iDAAiD;AAEpC,QAAA,aAAa,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAIlE,QAAA,gBAAgB,GAAG,4BAA4B,CAAC;AAEhD,QAAA,sBAAsB,GAAG,kCAAkC,CAAC;AA6CzE,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE;IACrC,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,wBAAgB,CAAC,CAAC;IAE1C,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAc,CAAC;AAC7D,CAAC,CAAC;AAiCF,MAAM,iBAAiB,GAA0B;IAC/C,cAAc;IACd,wBAAw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
+
/**
|
|
4
|
+
* `parent` is the full branch name the new branch nests under — `feat/FIP-2177-user-management`
|
|
5
|
+
* for a sub-feature, `release/2026.04.28` for a release fix. The nested name keeps that whole path
|
|
6
|
+
* under the config's `subPrefix`, so the parent stays derivable from the child.
|
|
7
|
+
*/
|
|
8
|
+
export type BranchNameSpec = {
|
|
9
|
+
kind: 'main-feature';
|
|
10
|
+
type?: string;
|
|
11
|
+
key: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'sub-feature';
|
|
15
|
+
parent: string;
|
|
16
|
+
key: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'release';
|
|
20
|
+
date: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'release-fix';
|
|
23
|
+
parent: string;
|
|
24
|
+
key: string;
|
|
25
|
+
subject: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'hotfix';
|
|
28
|
+
key: string;
|
|
29
|
+
subject: string;
|
|
30
|
+
};
|
|
31
|
+
/** Builds a conforming branch name from the grammar. The single naming implementation. */
|
|
32
|
+
export declare const buildBranchName: (options: {
|
|
33
|
+
spec: BranchNameSpec;
|
|
34
|
+
config: GitFlowConfig;
|
|
35
|
+
}) => string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBranchName = exports.slugifySubject = void 0;
|
|
4
|
+
const slugifySubject = (subject) => subject
|
|
5
|
+
.trim()
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
8
|
+
.replace(/^-+|-+$/g, '');
|
|
9
|
+
exports.slugifySubject = slugifySubject;
|
|
10
|
+
/** Builds a conforming branch name from the grammar. The single naming implementation. */
|
|
11
|
+
const buildBranchName = (options) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const { spec, config } = options;
|
|
14
|
+
if (spec.kind === 'release')
|
|
15
|
+
return `${config.releasePrefix}/${spec.date}`;
|
|
16
|
+
const leaf = [spec.key.toUpperCase(), (0, exports.slugifySubject)(spec.subject)].filter(Boolean).join('-');
|
|
17
|
+
if (spec.kind === 'main-feature')
|
|
18
|
+
return `${(_a = spec.type) !== null && _a !== void 0 ? _a : 'feat'}/${leaf}`;
|
|
19
|
+
if (spec.kind === 'hotfix')
|
|
20
|
+
return `${config.hotfixPrefix}/${leaf}`;
|
|
21
|
+
return `${config.subPrefix}/${spec.parent}/${leaf}`;
|
|
22
|
+
};
|
|
23
|
+
exports.buildBranchName = buildBranchName;
|
|
24
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/git-flow/build.ts"],"names":[],"mappings":";;;AAEO,MAAM,cAAc,GAAG,CAAC,OAAe,EAAE,EAAE,CAChD,OAAO;KACJ,IAAI,EAAE;KACN,WAAW,EAAE;KACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;KAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AALhB,QAAA,cAAc,kBAKE;AAc7B,0FAA0F;AACnF,MAAM,eAAe,GAAG,CAAC,OAAwD,EAAE,EAAE;;IAC1F,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEjC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,GAAG,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAE3E,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,IAAA,sBAAc,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9F,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,GAAG,MAAA,IAAI,CAAC,IAAI,mCAAI,MAAM,IAAI,IAAI,EAAE,CAAC;IAC1E,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,GAAG,MAAM,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC;IAEpE,OAAO,GAAG,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;AACtD,CAAC,CAAC;AAXW,QAAA,eAAe,mBAW1B"}
|
|
@@ -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;
|