@ethlete/cli 2.1.0-next.12 → 2.1.0-next.14
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 +19 -0
- package/README.md +9 -2
- package/package.json +1 -1
- package/src/lib/config/local-config.d.ts +1 -1
- package/src/lib/update/agent-setup.d.ts +33 -0
- package/src/lib/update/agent-setup.js +124 -0
- package/src/lib/update/agent-setup.js.map +1 -0
- package/src/lib/update/ai.d.ts +5 -2
- package/src/lib/update/ai.js +12 -5
- package/src/lib/update/ai.js.map +1 -1
- package/src/lib/update/args.d.ts +2 -0
- package/src/lib/update/args.js +14 -1
- package/src/lib/update/args.js.map +1 -1
- package/src/lib/update/commits.d.ts +63 -0
- package/src/lib/update/commits.js +146 -0
- package/src/lib/update/commits.js.map +1 -0
- package/src/lib/update/gitignore.d.ts +6 -0
- package/src/lib/update/gitignore.js +8 -4
- package/src/lib/update/gitignore.js.map +1 -1
- package/src/lib/update/index.d.ts +1 -0
- package/src/lib/update/index.js +1 -0
- package/src/lib/update/index.js.map +1 -1
- package/src/lib/update/pending.d.ts +3 -0
- package/src/lib/update/pending.js +15 -4
- package/src/lib/update/pending.js.map +1 -1
- package/src/lib/update/registry.d.ts +4 -0
- package/src/lib/update/registry.js +10 -1
- package/src/lib/update/registry.js.map +1 -1
- package/src/lib/update/run-migrations.d.ts +1 -0
- package/src/lib/update/run-migrations.js +17 -11
- package/src/lib/update/run-migrations.js.map +1 -1
- package/src/lib/update/update-command.js +117 -24
- package/src/lib/update/update-command.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ethlete/cli
|
|
2
2
|
|
|
3
|
+
## 2.1.0-next.14
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `et update` commits each step by itself - the version bump, each codemod, the agent rules sync and each finished `--ai` task - and never a file that was dirty before the run; `--no-commit` turns this off.
|
|
8
|
+
- `et update --ai` without `updateAgentCommand` lists the agent CLIs on `PATH` and saves the one you pick, as an interactive session or a headless run.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- The Claude Code choices in `et update --ai` start the agent in auto mode, so it can run its checks without asking.
|
|
13
|
+
- `et update --ai` tells you, for each task and in the agent's last message, to type `/exit` so the next task starts.
|
|
14
|
+
|
|
15
|
+
## 2.1.0-next.13
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- `et update` hands the migrations to the newly installed `et` when the update moves `@ethlete/cli`, so steps a newer CLI added, such as the agent rules sync, run in that same update.
|
|
20
|
+
- `et update` follows the dist tag that holds the newest version of the installed prerelease line, so a package that changesets published to `latest`, such as `@ethlete/agent-rules`, no longer stays on the older `next` version.
|
|
21
|
+
|
|
3
22
|
## 2.1.0-next.12
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -47,6 +47,7 @@ yarn et update --tag latest # leave the prerelease line
|
|
|
47
47
|
yarn et update core --to 5.0.0-next.55 # an exact version for the package you name
|
|
48
48
|
yarn et update --continue # finish a run that stopped
|
|
49
49
|
yarn et update --ai # hand every agent-assisted task to an agent
|
|
50
|
+
yarn et update --no-commit # leave every change uncommitted
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
The target follows the dist tag the installed version is on, so a repo on a `-next` prerelease stays
|
|
@@ -67,8 +68,14 @@ needs a decision), `assisted` (written as a prompt for an agent) or `unsupported
|
|
|
67
68
|
has no Nx to run, with the command to run it by hand).
|
|
68
69
|
|
|
69
70
|
`--ai` hands each open assisted task to the command in `updateAgentCommand` in
|
|
70
|
-
`ethlete.config.local.json` (for example `claude --permission-mode
|
|
71
|
-
and reports each run. It also works on the tasks an earlier run left.
|
|
71
|
+
`ethlete.config.local.json` (for example `claude --permission-mode auto`), one run per task,
|
|
72
|
+
and reports each run. It also works on the tasks an earlier run left. When the key is missing, `--ai`
|
|
73
|
+
lists the agent CLIs on `PATH` and saves the command you pick.
|
|
74
|
+
|
|
75
|
+
Each step is committed by itself: the version bump with the lockfile, each codemod that changed files,
|
|
76
|
+
the agent rules sync, and each agent task that ends done. A commit takes only the paths its step
|
|
77
|
+
changed, and a step that touched a file you had changed before the run is left uncommitted.
|
|
78
|
+
`--no-commit` commits nothing.
|
|
72
79
|
|
|
73
80
|
A package declares its migrations in `migrations.json` at its own root, pointed at from `package.json`
|
|
74
81
|
with `"ethlete": { "migrations": "./migrations.json" }`. The full format is on the docs site.
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export type LocalConfig = {
|
|
|
15
15
|
apiRepoPaths?: Record<string, string>;
|
|
16
16
|
/** Branch that represents each API's deployed state, keyed by app name. `"*"` matches any app. */
|
|
17
17
|
apiRepoBranches?: Record<string, string>;
|
|
18
|
-
/** Command `et update --ai` hands an assisted migration task to, for example `claude --permission-mode
|
|
18
|
+
/** Command `et update --ai` hands an assisted migration task to, for example `claude --permission-mode auto`. */
|
|
19
19
|
updateAgentCommand?: string;
|
|
20
20
|
};
|
|
21
21
|
export declare const LOCAL_CONFIG_KEYS: (keyof LocalConfig)[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type AgentCli = {
|
|
2
|
+
binary: string;
|
|
3
|
+
label: string;
|
|
4
|
+
/** Opens a session the developer can answer questions in, and exits when they close it. */
|
|
5
|
+
interactive: string;
|
|
6
|
+
/** Runs to the end without a question, so a task that needs a decision stays open. */
|
|
7
|
+
headless: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const AGENT_CLIS: readonly AgentCli[];
|
|
10
|
+
export type AgentChoice = {
|
|
11
|
+
label: string;
|
|
12
|
+
command: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const onPath: (options: {
|
|
15
|
+
binary: string;
|
|
16
|
+
env?: NodeJS.ProcessEnv;
|
|
17
|
+
platform?: NodeJS.Platform;
|
|
18
|
+
}) => boolean;
|
|
19
|
+
/** The commands of every installed agent CLI, the interactive one of each first. */
|
|
20
|
+
export declare const agentChoices: (options?: {
|
|
21
|
+
env?: NodeJS.ProcessEnv;
|
|
22
|
+
platform?: NodeJS.Platform;
|
|
23
|
+
}) => AgentChoice[];
|
|
24
|
+
/**
|
|
25
|
+
* Asks which agent command `--ai` uses and saves the answer in the local config. Without a terminal it
|
|
26
|
+
* names the key and the installed CLIs instead. Returns `undefined` when there is no command to use.
|
|
27
|
+
*/
|
|
28
|
+
export declare const setUpAgentCommand: (options: {
|
|
29
|
+
root: string;
|
|
30
|
+
env?: NodeJS.ProcessEnv;
|
|
31
|
+
platform?: NodeJS.Platform;
|
|
32
|
+
isTTY?: boolean;
|
|
33
|
+
}) => Promise<string | undefined>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setUpAgentCommand = exports.agentChoices = exports.onPath = exports.AGENT_CLIS = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const local_config_1 = require("../config/local-config");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const ai_1 = require("./ai");
|
|
10
|
+
const gitignore_1 = require("./gitignore");
|
|
11
|
+
exports.AGENT_CLIS = [
|
|
12
|
+
{
|
|
13
|
+
binary: 'claude',
|
|
14
|
+
label: 'Claude Code',
|
|
15
|
+
interactive: 'claude --permission-mode auto',
|
|
16
|
+
headless: 'claude --permission-mode auto -p',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
binary: 'codex',
|
|
20
|
+
label: 'Codex',
|
|
21
|
+
interactive: 'codex --sandbox workspace-write',
|
|
22
|
+
headless: 'codex exec --sandbox workspace-write',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
binary: 'gemini',
|
|
26
|
+
label: 'Gemini CLI',
|
|
27
|
+
interactive: 'gemini --approval-mode auto_edit -i',
|
|
28
|
+
headless: 'gemini --approval-mode auto_edit -p',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
binary: 'copilot',
|
|
32
|
+
label: 'GitHub Copilot CLI',
|
|
33
|
+
interactive: 'copilot --allow-all-tools -i',
|
|
34
|
+
headless: 'copilot --allow-all-tools -p',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
binary: 'cursor-agent',
|
|
38
|
+
label: 'Cursor Agent',
|
|
39
|
+
interactive: 'cursor-agent --force',
|
|
40
|
+
headless: 'cursor-agent --force -p',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
const isExecutable = (path, platform) => {
|
|
44
|
+
try {
|
|
45
|
+
(0, fs_1.accessSync)(path, platform === 'win32' ? fs_1.constants.F_OK : fs_1.constants.X_OK);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch (_a) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const onPath = (options) => {
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
const { binary, env = process.env, platform = process.platform } = options;
|
|
55
|
+
const dirs = ((_b = (_a = env['PATH']) !== null && _a !== void 0 ? _a : env['Path']) !== null && _b !== void 0 ? _b : '').split(path_1.delimiter).filter(Boolean);
|
|
56
|
+
const extensions = platform === 'win32' ? ['', ...((_c = env['PATHEXT']) !== null && _c !== void 0 ? _c : '.EXE;.CMD;.BAT').split(';')] : [''];
|
|
57
|
+
return dirs.some((dir) => extensions.some((extension) => isExecutable((0, path_1.join)(dir, binary + extension), platform)));
|
|
58
|
+
};
|
|
59
|
+
exports.onPath = onPath;
|
|
60
|
+
/** The commands of every installed agent CLI, the interactive one of each first. */
|
|
61
|
+
const agentChoices = (options = {}) => exports.AGENT_CLIS.filter(({ binary }) => (0, exports.onPath)(Object.assign({ binary }, options))).flatMap((cli) => [
|
|
62
|
+
{ label: `${cli.label}, interactive: you can answer its questions`, command: cli.interactive },
|
|
63
|
+
{ label: `${cli.label}, headless: a task that needs a decision stays open`, command: cli.headless },
|
|
64
|
+
]);
|
|
65
|
+
exports.agentChoices = agentChoices;
|
|
66
|
+
const missingKeyMessage = `--ai needs "${ai_1.AGENT_COMMAND_KEY}" in ${local_config_1.LOCAL_CONFIG_FILE_NAME}, for example "${ai_1.AGENT_COMMAND_EXAMPLE}".`;
|
|
67
|
+
const pick = (choices) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const list = choices.map((choice, index) => ` ${index + 1}. ${choice.label}\n ${choice.command}`).join('\n');
|
|
70
|
+
const question = choices.length > 0
|
|
71
|
+
? `${list}\n\nPick a number, or type a command of your own. Press Enter for 1, or Ctrl+C to stop: `
|
|
72
|
+
: 'No agent CLI was found on PATH. Type the command to hand a task to, or press Enter to stop: ';
|
|
73
|
+
const answer = (yield (0, utils_1.askQuestion)(`\n${missingKeyMessage}\n\n${question}`)).trim();
|
|
74
|
+
if (answer === '')
|
|
75
|
+
return (_a = choices[0]) === null || _a === void 0 ? void 0 : _a.command;
|
|
76
|
+
const index = /^\d+$/.test(answer) ? Number(answer) - 1 : -1;
|
|
77
|
+
if (index >= 0)
|
|
78
|
+
return (_b = choices[index]) === null || _b === void 0 ? void 0 : _b.command;
|
|
79
|
+
return answer;
|
|
80
|
+
});
|
|
81
|
+
/** The file the key goes in: the one that holds the local config now, or a new `ethlete.config.local.json`. */
|
|
82
|
+
const targetFile = (root) => {
|
|
83
|
+
const primary = (0, local_config_1.readLocalConfigFile)((0, path_1.join)(root, local_config_1.LOCAL_CONFIG_FILE_NAME));
|
|
84
|
+
if (primary.status === 'ok')
|
|
85
|
+
return { fileName: local_config_1.LOCAL_CONFIG_FILE_NAME, config: primary.config };
|
|
86
|
+
if (primary.status !== 'absent')
|
|
87
|
+
return undefined;
|
|
88
|
+
const legacy = (0, local_config_1.readLocalConfigFile)((0, path_1.join)(root, local_config_1.LEGACY_LOCAL_CONFIG_FILE_NAME));
|
|
89
|
+
if (legacy.status === 'ok')
|
|
90
|
+
return { fileName: local_config_1.LEGACY_LOCAL_CONFIG_FILE_NAME, config: legacy.config };
|
|
91
|
+
return { fileName: local_config_1.LOCAL_CONFIG_FILE_NAME, config: {} };
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Asks which agent command `--ai` uses and saves the answer in the local config. Without a terminal it
|
|
95
|
+
* names the key and the installed CLIs instead. Returns `undefined` when there is no command to use.
|
|
96
|
+
*/
|
|
97
|
+
const setUpAgentCommand = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
const { root, isTTY = process.stdin.isTTY === true } = options;
|
|
99
|
+
const choices = (0, exports.agentChoices)(options);
|
|
100
|
+
if (!isTTY) {
|
|
101
|
+
const found = choices.map(({ command }) => ` ${command}`).join('\n');
|
|
102
|
+
console.error(`${missingKeyMessage}\n` +
|
|
103
|
+
(found ? `Commands for the agent CLIs on PATH:\n${found}\n` : '') +
|
|
104
|
+
'Nothing was changed.');
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
const target = targetFile(root);
|
|
108
|
+
if (!target) {
|
|
109
|
+
console.error(`${missingKeyMessage}\n${local_config_1.LOCAL_CONFIG_FILE_NAME} cannot be read, so it stays as it is. Nothing was changed.`);
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
const command = yield pick(choices);
|
|
113
|
+
if (!command) {
|
|
114
|
+
console.error('No agent command was picked. Nothing was changed.');
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(root, target.fileName), `${JSON.stringify(Object.assign(Object.assign({}, target.config), { [ai_1.AGENT_COMMAND_KEY]: command }), null, 2)}\n`, 'utf8');
|
|
118
|
+
console.log(`\n Saved "${ai_1.AGENT_COMMAND_KEY}": "${command}" in ${target.fileName}.`);
|
|
119
|
+
if ((0, gitignore_1.ignoreEntry)({ root, entry: target.fileName }))
|
|
120
|
+
console.log(` Added ${target.fileName} to .gitignore.`);
|
|
121
|
+
return command;
|
|
122
|
+
});
|
|
123
|
+
exports.setUpAgentCommand = setUpAgentCommand;
|
|
124
|
+
//# sourceMappingURL=agent-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-setup.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/lib/update/agent-setup.ts"],"names":[],"mappings":";;;;AAAA,2BAA0D;AAC1D,+BAAuC;AACvC,yDAAoH;AACpH,oCAAuC;AACvC,6BAAgE;AAChE,2CAA0C;AAW7B,QAAA,UAAU,GAAwB;IAC7C;QACE,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,+BAA+B;QAC5C,QAAQ,EAAE,kCAAkC;KAC7C;IACD;QACE,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,iCAAiC;QAC9C,QAAQ,EAAE,sCAAsC;KACjD;IACD;QACE,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE,qCAAqC;KAChD;IACD;QACE,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,8BAA8B;QAC3C,QAAQ,EAAE,8BAA8B;KACzC;IACD;QACE,MAAM,EAAE,cAAc;QACtB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,sBAAsB;QACnC,QAAQ,EAAE,yBAAyB;KACpC;CACF,CAAC;AAIF,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,QAAyB,EAAE,EAAE;IAC/D,IAAI,CAAC;QACH,IAAA,eAAU,EAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,cAAS,CAAC,IAAI,CAAC,CAAC,CAAC,cAAS,CAAC,IAAI,CAAC,CAAC;QAEzE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM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MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CACX,GAAG,iBAAiB,KAAK,qCAAsB,6DAA6D,CAC7G,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;IAEpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;QAEnE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAA,kBAAa,EACX,IAAA,WAAI,EAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,EAC3B,GAAG,IAAI,CAAC,SAAS,iCAAM,MAAM,CAAC,MAAM,KAAE,CAAC,sBAAiB,CAAC,EAAE,OAAO,KAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAClF,MAAM,CACP,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,cAAc,sBAAiB,OAAO,OAAO,QAAQ,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;IAErF,IAAI,IAAA,uBAAW,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,QAAQ,iBAAiB,CAAC,CAAC;IAE5G,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA,CAAC;AAjDW,QAAA,iBAAiB,qBAiD5B"}
|
package/src/lib/update/ai.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UpdateTask } from './tasks';
|
|
2
2
|
/** Where the agent command sits in `ethlete.config.local.json`. */
|
|
3
3
|
export declare const AGENT_COMMAND_KEY = "updateAgentCommand";
|
|
4
|
-
/** An agent command that can edit files without asking, for the
|
|
5
|
-
export declare const AGENT_COMMAND_EXAMPLE = "claude --permission-mode
|
|
4
|
+
/** An interactive agent command that can edit files without asking, for the error that names the key. */
|
|
5
|
+
export declare const AGENT_COMMAND_EXAMPLE = "claude --permission-mode auto";
|
|
6
6
|
/** Where the command template takes the whole prompt. */
|
|
7
7
|
export declare const PROMPT_PLACEHOLDER = "<prompt>";
|
|
8
8
|
/** Where the command template takes only the path of the task file. */
|
|
@@ -36,9 +36,12 @@ export declare const assistedTasks: (tasks: readonly UpdateTask[]) => UpdateTask
|
|
|
36
36
|
/**
|
|
37
37
|
* Runs the configured agent once per assisted task, in order, so each run has one change to make, and
|
|
38
38
|
* reports each one as it ends. The command is a user-written string, so it runs through a shell.
|
|
39
|
+
* `afterRun` runs after each task, before the next one starts; it is how `et update` commits a task that
|
|
40
|
+
* ended done, so the report of any other task says it is not committed.
|
|
39
41
|
*/
|
|
40
42
|
export declare const runAgentTasks: (options: {
|
|
41
43
|
root: string;
|
|
42
44
|
template: string;
|
|
43
45
|
tasks: readonly UpdateTask[];
|
|
46
|
+
afterRun?: (run: AgentRun) => void;
|
|
44
47
|
}) => AgentRun[];
|
package/src/lib/update/ai.js
CHANGED
|
@@ -6,15 +6,18 @@ const fs_1 = require("fs");
|
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
/** Where the agent command sits in `ethlete.config.local.json`. */
|
|
8
8
|
exports.AGENT_COMMAND_KEY = 'updateAgentCommand';
|
|
9
|
-
/** An agent command that can edit files without asking, for the
|
|
10
|
-
exports.AGENT_COMMAND_EXAMPLE = 'claude --permission-mode
|
|
9
|
+
/** An interactive agent command that can edit files without asking, for the error that names the key. */
|
|
10
|
+
exports.AGENT_COMMAND_EXAMPLE = 'claude --permission-mode auto';
|
|
11
11
|
/** Where the command template takes the whole prompt. */
|
|
12
12
|
exports.PROMPT_PLACEHOLDER = '<prompt>';
|
|
13
13
|
/** Where the command template takes only the path of the task file. */
|
|
14
14
|
exports.FILE_PLACEHOLDER = '<file>';
|
|
15
15
|
/** The prompt one assisted task is handed to an agent with. */
|
|
16
16
|
const agentPrompt = (taskPath) => `Apply the migration task described in ${taskPath} to this repository. ` +
|
|
17
|
-
'Follow its instructions, then delete that file once the change is complete.'
|
|
17
|
+
'Follow its instructions, then delete that file once the change is complete. ' +
|
|
18
|
+
'Do not commit: et update commits your change. ' +
|
|
19
|
+
'In an interactive session, end your last message with: ' +
|
|
20
|
+
'"Type /exit to hand back to et update. It commits this change and starts the next task."';
|
|
18
21
|
exports.agentPrompt = agentPrompt;
|
|
19
22
|
exports.PROMPT_ENV = 'ETHLETE_UPDATE_PROMPT';
|
|
20
23
|
exports.FILE_ENV = 'ETHLETE_UPDATE_TASK_FILE';
|
|
@@ -84,18 +87,22 @@ const runOne = (options) => {
|
|
|
84
87
|
/**
|
|
85
88
|
* Runs the configured agent once per assisted task, in order, so each run has one change to make, and
|
|
86
89
|
* reports each one as it ends. The command is a user-written string, so it runs through a shell.
|
|
90
|
+
* `afterRun` runs after each task, before the next one starts; it is how `et update` commits a task that
|
|
91
|
+
* ended done, so the report of any other task says it is not committed.
|
|
87
92
|
*/
|
|
88
93
|
const runAgentTasks = (options) => {
|
|
94
|
+
const { afterRun } = options;
|
|
89
95
|
const { root, template } = options;
|
|
90
96
|
const tasks = (0, exports.assistedTasks)(options.tasks);
|
|
91
97
|
return tasks.map((task, index) => {
|
|
92
98
|
const label = `[${index + 1}/${tasks.length}] ${task.packageName} ${task.name}`;
|
|
93
|
-
console.log(`\n ${label}
|
|
99
|
+
console.log(`\n ${label}\n When an interactive session has finished the task, type /exit to start the next one.`);
|
|
94
100
|
const run = runOne({ root, template, task });
|
|
95
101
|
if (run.state === 'done')
|
|
96
102
|
console.log(`\n ${label}: done`);
|
|
97
103
|
else
|
|
98
|
-
console.error(`\n ${label}: ${run.reason}`);
|
|
104
|
+
console.error(`\n ${label}: ${run.reason}${afterRun ? ', so it is not committed' : ''}`);
|
|
105
|
+
afterRun === null || afterRun === void 0 ? void 0 : afterRun(run);
|
|
99
106
|
return run;
|
|
100
107
|
});
|
|
101
108
|
};
|
package/src/lib/update/ai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/lib/update/ai.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAC1C,2BAAgC;AAChC,+BAA4B;AAG5B,mEAAmE;AACtD,QAAA,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD,
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/lib/update/ai.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAC1C,2BAAgC;AAChC,+BAA4B;AAG5B,mEAAmE;AACtD,QAAA,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD,yGAAyG;AAC5F,QAAA,qBAAqB,GAAG,+BAA+B,CAAC;AAErE,yDAAyD;AAC5C,QAAA,kBAAkB,GAAG,UAAU,CAAC;AAE7C,uEAAuE;AAC1D,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAEzC,+DAA+D;AACxD,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,EAAE,CAC9C,yCAAyC,QAAQ,uBAAuB;IACxE,8EAA8E;IAC9E,gDAAgD;IAChD,yDAAyD;IACzD,0FAA0F,CAAC;AALhF,QAAA,WAAW,eAKqE;AAEhF,QAAA,UAAU,GAAG,uBAAuB,CAAC;AACrC,QAAA,QAAQ,GAAG,0BAA0B,CAAC;AAEnD,MAAM,SAAS,GAAG,CAAC,OAA2E,EAAE,EAAE;IAChG,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACjD,MAAM,IAAI,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IAE7D,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC;AAC3C,CAAC,CAAC;AAEF,M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I,GAAG,CAAC,KAAK,KAAK,MAAM;YAAE,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC;;YACvD,OAAO,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE/F,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,GAAG,CAAC,CAAC;QAEhB,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAxBW,QAAA,aAAa,iBAwBxB"}
|
package/src/lib/update/args.d.ts
CHANGED
package/src/lib/update/args.js
CHANGED
|
@@ -3,7 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseUpdateArgs = exports.fullPackageName = void 0;
|
|
4
4
|
const packages_1 = require("./packages");
|
|
5
5
|
const VALUE_FLAGS = ['--tag', '--to', '--from'];
|
|
6
|
-
const BOOLEAN_FLAGS = [
|
|
6
|
+
const BOOLEAN_FLAGS = [
|
|
7
|
+
'--check',
|
|
8
|
+
'--dry-run',
|
|
9
|
+
'--no-install',
|
|
10
|
+
'--no-commit',
|
|
11
|
+
'--continue',
|
|
12
|
+
'--ai',
|
|
13
|
+
'--force',
|
|
14
|
+
'--help',
|
|
15
|
+
'-h',
|
|
16
|
+
];
|
|
7
17
|
/** `core` and `@ethlete/core` both name the same package on the command line. */
|
|
8
18
|
const fullPackageName = (name) => (name.includes('/') ? name : `${packages_1.ETHLETE_SCOPE}${name}`);
|
|
9
19
|
exports.fullPackageName = fullPackageName;
|
|
@@ -22,6 +32,7 @@ const parseUpdateArgs = (argv) => {
|
|
|
22
32
|
check: false,
|
|
23
33
|
dryRun: false,
|
|
24
34
|
install: true,
|
|
35
|
+
commit: true,
|
|
25
36
|
resume: false,
|
|
26
37
|
ai: false,
|
|
27
38
|
force: false,
|
|
@@ -68,6 +79,8 @@ const parseUpdateArgs = (argv) => {
|
|
|
68
79
|
args.dryRun = true;
|
|
69
80
|
if (flag === '--no-install')
|
|
70
81
|
args.install = false;
|
|
82
|
+
if (flag === '--no-commit')
|
|
83
|
+
args.commit = false;
|
|
71
84
|
if (flag === '--continue')
|
|
72
85
|
args.resume = true;
|
|
73
86
|
if (flag === '--ai')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/lib/update/args.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/lib/update/args.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAsB3C,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEhD,MAAM,aAAa,GAAG;IACpB,SAAS;IACT,WAAW;IACX,cAAc;IACd,aAAa;IACb,YAAY;IACZ,MAAM;IACN,SAAS;IACT,QAAQ;IACR,IAAI;CACL,CAAC;AAEF,iFAAiF;AAC1E,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,wBAAa,GAAG,IAAI,EAAE,CAAC,CAAC;AAA5F,QAAA,eAAe,mBAA6E;AAEzG,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,EAAE;IACrC,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAExC,OAAO,SAAS,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE;QACvC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ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AI,IAAI,KAAK,aAAa;YAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAChD,IAAI,IAAI,KAAK,YAAY;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAC9C,IAAI,IAAI,KAAK,MAAM;YAAE,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAC1C,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAC3D,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QACzD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;IACpF,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA1EW,QAAA,eAAe,mBA0E1B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Repo-relative paths git reports as changed or untracked, each with a hash of its content. */
|
|
2
|
+
export type DirtySnapshot = Record<string, string>;
|
|
3
|
+
/** What the commits of one update compare against. It lives in the pending update, so a `--continue` keeps it. */
|
|
4
|
+
export type CommitState = {
|
|
5
|
+
/** The paths that were dirty before the update wrote anything: the user's own work, never committed. */
|
|
6
|
+
baseline: DirtySnapshot;
|
|
7
|
+
/** The dirty paths after the last step, so the next step commits only what it changed. */
|
|
8
|
+
snapshot: DirtySnapshot;
|
|
9
|
+
bumped: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type StepCommit = {
|
|
12
|
+
state: 'unchanged';
|
|
13
|
+
} | {
|
|
14
|
+
state: 'committed';
|
|
15
|
+
hash: string;
|
|
16
|
+
paths: string[];
|
|
17
|
+
} | {
|
|
18
|
+
state: 'blocked';
|
|
19
|
+
paths: string[];
|
|
20
|
+
} | {
|
|
21
|
+
state: 'failed';
|
|
22
|
+
reason: string;
|
|
23
|
+
paths: string[];
|
|
24
|
+
};
|
|
25
|
+
/** The paths of `git status --porcelain -z`, a rename's source included. */
|
|
26
|
+
export declare const parsePorcelain: (output: string) => string[];
|
|
27
|
+
/** The dirty paths of the checkout `root` sits in, or `undefined` outside a git checkout. */
|
|
28
|
+
export declare const dirtySnapshot: (root: string) => DirtySnapshot | undefined;
|
|
29
|
+
/** The commit state of an update that starts now, or `undefined` outside a git checkout. */
|
|
30
|
+
export declare const startCommits: (root: string) => CommitState | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Commits what one step changed since the last one, and nothing else. A step that touched a path the user
|
|
33
|
+
* had changed before the update is not committed at all, so their work never lands in an update commit.
|
|
34
|
+
*/
|
|
35
|
+
export declare const commitStep: (options: {
|
|
36
|
+
root: string;
|
|
37
|
+
state: CommitState;
|
|
38
|
+
message: string;
|
|
39
|
+
body?: string;
|
|
40
|
+
}) => {
|
|
41
|
+
state: CommitState;
|
|
42
|
+
commit: StepCommit;
|
|
43
|
+
};
|
|
44
|
+
/** Moves the snapshot past a step that is not committed, so the next step does not pick up what it left. */
|
|
45
|
+
export declare const skipStep: (options: {
|
|
46
|
+
root: string;
|
|
47
|
+
state: CommitState;
|
|
48
|
+
}) => CommitState;
|
|
49
|
+
export type StepCommitter = {
|
|
50
|
+
readonly state: CommitState;
|
|
51
|
+
commit: (step: {
|
|
52
|
+
message: string;
|
|
53
|
+
body?: string;
|
|
54
|
+
}) => StepCommit;
|
|
55
|
+
skip: () => void;
|
|
56
|
+
markBumped: () => void;
|
|
57
|
+
};
|
|
58
|
+
/** Commits the steps of one update in order, and hands every new state to `save`. */
|
|
59
|
+
export declare const createStepCommitter: (options: {
|
|
60
|
+
root: string;
|
|
61
|
+
state: CommitState;
|
|
62
|
+
save: (state: CommitState) => void;
|
|
63
|
+
}) => StepCommitter;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStepCommitter = exports.skipStep = exports.commitStep = exports.startCommits = exports.dirtySnapshot = exports.parsePorcelain = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const tasks_1 = require("./tasks");
|
|
9
|
+
const git = (cwd, args) => {
|
|
10
|
+
var _a, _b, _c, _d, _e;
|
|
11
|
+
const result = (0, child_process_1.spawnSync)('git', args, { cwd, encoding: 'utf8' });
|
|
12
|
+
return {
|
|
13
|
+
status: result.error ? 1 : ((_a = result.status) !== null && _a !== void 0 ? _a : 1),
|
|
14
|
+
stdout: (_b = result.stdout) !== null && _b !== void 0 ? _b : '',
|
|
15
|
+
stderr: ((_c = result.stderr) !== null && _c !== void 0 ? _c : '').trim() || ((_e = (_d = result.error) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : ''),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const contentHash = (path) => {
|
|
19
|
+
try {
|
|
20
|
+
return (0, crypto_1.createHash)('sha1').update((0, fs_1.readFileSync)(path)).digest('hex');
|
|
21
|
+
}
|
|
22
|
+
catch (_a) {
|
|
23
|
+
return 'missing';
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const topLevel = (root) => {
|
|
27
|
+
const result = git(root, ['rev-parse', '--show-toplevel']);
|
|
28
|
+
const top = result.stdout.trim();
|
|
29
|
+
return result.status === 0 && top.length > 0 ? top : undefined;
|
|
30
|
+
};
|
|
31
|
+
/** The paths of `git status --porcelain -z`, a rename's source included. */
|
|
32
|
+
const parsePorcelain = (output) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const entries = output.split('\0').filter((entry) => entry.length > 0);
|
|
35
|
+
const paths = [];
|
|
36
|
+
for (let index = 0; index < entries.length; index += 1) {
|
|
37
|
+
const entry = (_a = entries[index]) !== null && _a !== void 0 ? _a : '';
|
|
38
|
+
const status = entry.slice(0, 2);
|
|
39
|
+
paths.push(entry.slice(3));
|
|
40
|
+
if (status.includes('R') || status.includes('C')) {
|
|
41
|
+
const source = entries[index + 1];
|
|
42
|
+
if (source !== undefined)
|
|
43
|
+
paths.push(source);
|
|
44
|
+
index += 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return paths;
|
|
48
|
+
};
|
|
49
|
+
exports.parsePorcelain = parsePorcelain;
|
|
50
|
+
const updateDirPrefix = (options) => {
|
|
51
|
+
const fromTop = (0, path_1.relative)(options.top, (0, fs_1.realpathSync)(options.root)).split(path_1.sep).join('/');
|
|
52
|
+
return fromTop.length === 0 ? `${tasks_1.UPDATE_DIR}/` : `${fromTop}/${tasks_1.UPDATE_DIR}/`;
|
|
53
|
+
};
|
|
54
|
+
/** The dirty paths of the checkout `root` sits in, or `undefined` outside a git checkout. */
|
|
55
|
+
const dirtySnapshot = (root) => {
|
|
56
|
+
const top = topLevel(root);
|
|
57
|
+
if (top === undefined)
|
|
58
|
+
return undefined;
|
|
59
|
+
const status = git(top, ['status', '--porcelain', '-z', '--untracked-files=all']);
|
|
60
|
+
if (status.status !== 0)
|
|
61
|
+
return undefined;
|
|
62
|
+
const ignored = updateDirPrefix({ root, top });
|
|
63
|
+
return Object.fromEntries((0, exports.parsePorcelain)(status.stdout)
|
|
64
|
+
.filter((path) => !path.startsWith(ignored))
|
|
65
|
+
.map((path) => [path, contentHash((0, path_1.join)(top, path))]));
|
|
66
|
+
};
|
|
67
|
+
exports.dirtySnapshot = dirtySnapshot;
|
|
68
|
+
/** The commit state of an update that starts now, or `undefined` outside a git checkout. */
|
|
69
|
+
const startCommits = (root) => {
|
|
70
|
+
const snapshot = (0, exports.dirtySnapshot)(root);
|
|
71
|
+
return snapshot === undefined ? undefined : { baseline: snapshot, snapshot, bumped: false };
|
|
72
|
+
};
|
|
73
|
+
exports.startCommits = startCommits;
|
|
74
|
+
const changedSince = (options) => Object.keys(options.now).filter((path) => options.before[path] !== options.now[path]);
|
|
75
|
+
/**
|
|
76
|
+
* Commits what one step changed since the last one, and nothing else. A step that touched a path the user
|
|
77
|
+
* had changed before the update is not committed at all, so their work never lands in an update commit.
|
|
78
|
+
*/
|
|
79
|
+
const commitStep = (options) => {
|
|
80
|
+
const { root, state, message, body } = options;
|
|
81
|
+
const now = (0, exports.dirtySnapshot)(root);
|
|
82
|
+
const top = topLevel(root);
|
|
83
|
+
if (now === undefined || top === undefined) {
|
|
84
|
+
return { state, commit: { state: 'failed', reason: 'git status failed', paths: [] } };
|
|
85
|
+
}
|
|
86
|
+
const paths = changedSince({ before: state.snapshot, now });
|
|
87
|
+
const settle = (commit) => { var _a; return ({ state: Object.assign(Object.assign({}, state), { snapshot: (_a = (0, exports.dirtySnapshot)(root)) !== null && _a !== void 0 ? _a : now }), commit }); };
|
|
88
|
+
if (paths.length === 0)
|
|
89
|
+
return settle({ state: 'unchanged' });
|
|
90
|
+
const blocked = paths.filter((path) => path in state.baseline);
|
|
91
|
+
if (blocked.length > 0)
|
|
92
|
+
return settle({ state: 'blocked', paths: blocked });
|
|
93
|
+
const added = git(top, ['add', '--', ...paths]);
|
|
94
|
+
if (added.status !== 0)
|
|
95
|
+
return settle({ state: 'failed', reason: added.stderr, paths });
|
|
96
|
+
const committed = git(top, ['commit', '-m', message, ...(body === undefined ? [] : ['-m', body]), '--', ...paths]);
|
|
97
|
+
if (committed.status !== 0) {
|
|
98
|
+
const reason = committed.stderr || committed.stdout.trim() || `git commit exited with ${committed.status}`;
|
|
99
|
+
git(top, ['reset', '--quiet', '--', ...paths]);
|
|
100
|
+
return settle({ state: 'failed', reason, paths });
|
|
101
|
+
}
|
|
102
|
+
return settle({ state: 'committed', hash: git(top, ['rev-parse', '--short', 'HEAD']).stdout.trim(), paths });
|
|
103
|
+
};
|
|
104
|
+
exports.commitStep = commitStep;
|
|
105
|
+
/** Moves the snapshot past a step that is not committed, so the next step does not pick up what it left. */
|
|
106
|
+
const skipStep = (options) => {
|
|
107
|
+
var _a;
|
|
108
|
+
return (Object.assign(Object.assign({}, options.state), { snapshot: (_a = (0, exports.dirtySnapshot)(options.root)) !== null && _a !== void 0 ? _a : options.state.snapshot }));
|
|
109
|
+
};
|
|
110
|
+
exports.skipStep = skipStep;
|
|
111
|
+
const printCommit = (options) => {
|
|
112
|
+
const { message, commit } = options;
|
|
113
|
+
if (commit.state === 'committed')
|
|
114
|
+
console.log(`\n Committed ${commit.hash}: ${message}`);
|
|
115
|
+
if (commit.state === 'blocked') {
|
|
116
|
+
console.error(`\n Not committed: ${commit.paths.join(', ')} had uncommitted changes before the update. ` +
|
|
117
|
+
`Commit "${message}" yourself.`);
|
|
118
|
+
}
|
|
119
|
+
if (commit.state === 'failed') {
|
|
120
|
+
console.error(`\n The commit "${message}" failed, so its changes stay in the working tree:\n${commit.reason}`);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
/** Commits the steps of one update in order, and hands every new state to `save`. */
|
|
124
|
+
const createStepCommitter = (options) => {
|
|
125
|
+
const { root, save } = options;
|
|
126
|
+
let state = options.state;
|
|
127
|
+
const update = (next) => {
|
|
128
|
+
state = next;
|
|
129
|
+
save(state);
|
|
130
|
+
};
|
|
131
|
+
return {
|
|
132
|
+
get state() {
|
|
133
|
+
return state;
|
|
134
|
+
},
|
|
135
|
+
commit: (step) => {
|
|
136
|
+
const result = (0, exports.commitStep)(Object.assign({ root, state }, step));
|
|
137
|
+
update(result.state);
|
|
138
|
+
printCommit({ message: step.message, commit: result.commit });
|
|
139
|
+
return result.commit;
|
|
140
|
+
},
|
|
141
|
+
skip: () => update((0, exports.skipStep)({ root, state })),
|
|
142
|
+
markBumped: () => update(Object.assign(Object.assign({}, state), { bumped: true })),
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
exports.createStepCommitter = createStepCommitter;
|
|
146
|
+
//# sourceMappingURL=commits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commits.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/lib/update/commits.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAC1C,mCAAoC;AACpC,2BAAgD;AAChD,+BAA2C;AAC3C,mCAAqC;AAoBrC,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,IAAc,EAAE,EAAE;;IAC1C,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAEjE,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAA,MAAM,CAAC,MAAM,mCAAI,CAAC,CAAC;QAC/C,MAAM,EAAE,MAAA,MAAM,CAAC,MAAM,mCAAI,EAAE;QAC3B,MAAM,EAAE,CAAC,MAAA,MAAM,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,MAAA,MAAA,MAAM,CAAC,KAAK,0CAAE,OAAO,mCAAI,EAAE,CAAC;KACtE,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;IACnC,IAAI,CAAC;QACH,OAAO,IAAA,mBAAU,EAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAA,iBAAY,EAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE;IAChC,MAAM,MA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AAC,MAAM,EAAE,CAAC,CAAC;IAClH,CAAC;AACH,CAAC,CAAC;AASF,qFAAqF;AAC9E,MAAM,mBAAmB,GAAG,CAAC,OAInC,EAAiB,EAAE;IAClB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAC/B,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAE1B,MAAM,MAAM,GAAG,CAAC,IAAiB,EAAE,EAAE;QACnC,KAAK,GAAG,IAAI,CAAC;QACb,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,KAAK;YACP,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,IAAA,kBAAU,kBAAG,IAAI,EAAE,KAAK,IAAK,IAAI,EAAG,CAAC;YAEpD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACrB,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAE9D,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,CAAC;QACD,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAA,gBAAQ,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7C,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,iCAAM,KAAK,KAAE,MAAM,EAAE,IAAI,IAAG;KACrD,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,mBAAmB,uBA4B9B"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export declare const UPDATE_IGNORE_ENTRY = ".ethlete/update/";
|
|
2
|
+
/** Appends `entry` to `.gitignore` unless git ignores `probe` already. True when it wrote the line. */
|
|
3
|
+
export declare const ignoreEntry: (options: {
|
|
4
|
+
root: string;
|
|
5
|
+
entry: string;
|
|
6
|
+
probe?: string;
|
|
7
|
+
}) => boolean;
|
|
2
8
|
export declare const ignoreUpdateDir: (root: string) => boolean;
|