@ethlete/cli 2.1.0-next.11 → 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 +33 -0
- package/README.md +10 -3
- package/package.json +1 -1
- package/src/lib/api/clear.js +13 -3
- package/src/lib/api/clear.js.map +1 -1
- package/src/lib/api/compose.js +5 -1
- package/src/lib/api/compose.js.map +1 -1
- package/src/lib/api/git.d.ts +9 -4
- package/src/lib/api/git.js +27 -8
- package/src/lib/api/git.js.map +1 -1
- package/src/lib/api/load-definitions.js +10 -1
- package/src/lib/api/load-definitions.js.map +1 -1
- package/src/lib/api/ports.js +12 -3
- package/src/lib/api/ports.js.map +1 -1
- package/src/lib/api/run.js +8 -3
- package/src/lib/api/run.js.map +1 -1
- package/src/lib/api/setup.js +1 -1
- package/src/lib/api/setup.js.map +1 -1
- package/src/lib/api/state.js +7 -5
- package/src/lib/api/state.js.map +1 -1
- package/src/lib/auth/composer-auth.js +3 -2
- package/src/lib/auth/composer-auth.js.map +1 -1
- package/src/lib/auth/gitlab-token.js +1 -1
- package/src/lib/auth/gitlab-token.js.map +1 -1
- package/src/lib/config/diagnose.js +15 -9
- package/src/lib/config/diagnose.js.map +1 -1
- package/src/lib/config/local-config.d.ts +1 -1
- package/src/lib/design/check.js +16 -5
- package/src/lib/design/check.js.map +1 -1
- package/src/lib/design/serve.js +5 -5
- package/src/lib/design/serve.js.map +1 -1
- package/src/lib/design/vite-paths.d.ts +7 -0
- package/src/lib/design/vite-paths.js +15 -0
- package/src/lib/design/vite-paths.js.map +1 -0
- package/src/lib/doctor/doctor-command.js +18 -4
- package/src/lib/doctor/doctor-command.js.map +1 -1
- package/src/lib/release.d.ts +6 -0
- package/src/lib/release.js +24 -4
- package/src/lib/release.js.map +1 -1
- package/src/lib/update/agent-rules-sync.js +2 -2
- package/src/lib/update/agent-rules-sync.js.map +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 +14 -4
- package/src/lib/update/ai.js +55 -16
- 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/migration-manifest.js +6 -2
- package/src/lib/update/migration-manifest.js.map +1 -1
- package/src/lib/update/package-manager.d.ts +13 -1
- package/src/lib/update/package-manager.js +21 -15
- package/src/lib/update/package-manager.js.map +1 -1
- package/src/lib/update/packages.js +31 -9
- package/src/lib/update/packages.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 +17 -0
- package/src/lib/update/registry.js +54 -16
- 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 +19 -14
- package/src/lib/update/run-migrations.js.map +1 -1
- package/src/lib/update/update-command.js +120 -26
- package/src/lib/update/update-command.js.map +1 -1
|
@@ -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,EAA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,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,22 +1,29 @@
|
|
|
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. */
|
|
9
9
|
export declare const FILE_PLACEHOLDER = "<file>";
|
|
10
10
|
/** The prompt one assisted task is handed to an agent with. */
|
|
11
11
|
export declare const agentPrompt: (taskPath: string) => string;
|
|
12
|
+
export declare const PROMPT_ENV = "ETHLETE_UPDATE_PROMPT";
|
|
13
|
+
export declare const FILE_ENV = "ETHLETE_UPDATE_TASK_FILE";
|
|
12
14
|
/**
|
|
13
15
|
* The command that hands one task to an agent. `<prompt>` becomes the prompt, `<file>` the path of the
|
|
14
|
-
* task file; a template with neither gets the prompt appended, which is what `claude -p` needs.
|
|
16
|
+
* task file; a template with neither gets the prompt appended, which is what `claude -p` needs. Both
|
|
17
|
+
* values reach the shell as variable references; run it with `agentEnv`.
|
|
15
18
|
*/
|
|
16
19
|
export declare const agentCommand: (options: {
|
|
17
20
|
template: string;
|
|
18
|
-
|
|
21
|
+
platform?: NodeJS.Platform;
|
|
19
22
|
}) => string;
|
|
23
|
+
export declare const agentEnv: (taskPath: string) => {
|
|
24
|
+
ETHLETE_UPDATE_PROMPT: string;
|
|
25
|
+
ETHLETE_UPDATE_TASK_FILE: string;
|
|
26
|
+
};
|
|
20
27
|
export type AgentRunState = 'done' | 'open' | 'failed';
|
|
21
28
|
export type AgentRun = {
|
|
22
29
|
task: UpdateTask;
|
|
@@ -29,9 +36,12 @@ export declare const assistedTasks: (tasks: readonly UpdateTask[]) => UpdateTask
|
|
|
29
36
|
/**
|
|
30
37
|
* Runs the configured agent once per assisted task, in order, so each run has one change to make, and
|
|
31
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.
|
|
32
41
|
*/
|
|
33
42
|
export declare const runAgentTasks: (options: {
|
|
34
43
|
root: string;
|
|
35
44
|
template: string;
|
|
36
45
|
tasks: readonly UpdateTask[];
|
|
46
|
+
afterRun?: (run: AgentRun) => void;
|
|
37
47
|
}) => AgentRun[];
|
package/src/lib/update/ai.js
CHANGED
|
@@ -1,35 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runAgentTasks = exports.assistedTasks = exports.agentCommand = exports.agentPrompt = exports.FILE_PLACEHOLDER = exports.PROMPT_PLACEHOLDER = exports.AGENT_COMMAND_EXAMPLE = exports.AGENT_COMMAND_KEY = void 0;
|
|
3
|
+
exports.runAgentTasks = exports.assistedTasks = exports.agentEnv = exports.agentCommand = exports.FILE_ENV = exports.PROMPT_ENV = exports.agentPrompt = exports.FILE_PLACEHOLDER = exports.PROMPT_PLACEHOLDER = exports.AGENT_COMMAND_EXAMPLE = exports.AGENT_COMMAND_KEY = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
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';
|
|
23
|
+
exports.FILE_ENV = 'ETHLETE_UPDATE_TASK_FILE';
|
|
24
|
+
const reference = (options) => {
|
|
25
|
+
const { name, platform, insideQuotes } = options;
|
|
26
|
+
const bare = platform === 'win32' ? `%${name}%` : `$${name}`;
|
|
27
|
+
return insideQuotes ? bare : `"${bare}"`;
|
|
28
|
+
};
|
|
29
|
+
const PLACEHOLDERS = [
|
|
30
|
+
{ text: exports.PROMPT_PLACEHOLDER, name: exports.PROMPT_ENV },
|
|
31
|
+
{ text: exports.FILE_PLACEHOLDER, name: exports.FILE_ENV },
|
|
32
|
+
];
|
|
20
33
|
/**
|
|
21
34
|
* The command that hands one task to an agent. `<prompt>` becomes the prompt, `<file>` the path of the
|
|
22
|
-
* task file; a template with neither gets the prompt appended, which is what `claude -p` needs.
|
|
35
|
+
* task file; a template with neither gets the prompt appended, which is what `claude -p` needs. Both
|
|
36
|
+
* values reach the shell as variable references; run it with `agentEnv`.
|
|
23
37
|
*/
|
|
24
38
|
const agentCommand = (options) => {
|
|
25
|
-
const { template,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
const { template, platform = process.platform } = options;
|
|
40
|
+
if (!PLACEHOLDERS.some(({ text }) => template.includes(text))) {
|
|
41
|
+
return `${template} ${reference({ name: exports.PROMPT_ENV, platform, insideQuotes: false })}`;
|
|
42
|
+
}
|
|
43
|
+
let command = '';
|
|
44
|
+
let insideQuotes = false;
|
|
45
|
+
for (let index = 0; index < template.length;) {
|
|
46
|
+
const placeholder = PLACEHOLDERS.find(({ text }) => template.startsWith(text, index));
|
|
47
|
+
if (placeholder) {
|
|
48
|
+
command += reference({ name: placeholder.name, platform, insideQuotes });
|
|
49
|
+
index += placeholder.text.length;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const char = template.charAt(index);
|
|
53
|
+
if (char === '"')
|
|
54
|
+
insideQuotes = !insideQuotes;
|
|
55
|
+
command += char;
|
|
56
|
+
index += 1;
|
|
29
57
|
}
|
|
30
|
-
return
|
|
58
|
+
return command;
|
|
31
59
|
};
|
|
32
60
|
exports.agentCommand = agentCommand;
|
|
61
|
+
const agentEnv = (taskPath) => ({ [exports.PROMPT_ENV]: (0, exports.agentPrompt)(taskPath), [exports.FILE_ENV]: taskPath });
|
|
62
|
+
exports.agentEnv = agentEnv;
|
|
33
63
|
/** The tasks an agent can work on: the ones whose instructions were written as a prompt. */
|
|
34
64
|
const assistedTasks = (tasks) => tasks.filter((task) => task.kind === 'assisted' && task.instructionsFile !== undefined);
|
|
35
65
|
exports.assistedTasks = assistedTasks;
|
|
@@ -37,9 +67,14 @@ const runOne = (options) => {
|
|
|
37
67
|
var _a;
|
|
38
68
|
const { root, template, task } = options;
|
|
39
69
|
const taskPath = (0, path_1.join)(root, (_a = task.instructionsFile) !== null && _a !== void 0 ? _a : '');
|
|
40
|
-
const command = (0, exports.agentCommand)({ template
|
|
41
|
-
console.log(` ${command}\n`);
|
|
42
|
-
const result = (0, child_process_1.spawnSync)(command, {
|
|
70
|
+
const command = (0, exports.agentCommand)({ template });
|
|
71
|
+
console.log(` ${command}\n ${exports.FILE_ENV}=${taskPath}\n`);
|
|
72
|
+
const result = (0, child_process_1.spawnSync)(command, {
|
|
73
|
+
cwd: root,
|
|
74
|
+
stdio: 'inherit',
|
|
75
|
+
shell: true,
|
|
76
|
+
env: Object.assign(Object.assign({}, process.env), (0, exports.agentEnv)(taskPath)),
|
|
77
|
+
});
|
|
43
78
|
if (result.error)
|
|
44
79
|
return { task, command, state: 'failed', reason: result.error.message };
|
|
45
80
|
if (result.status !== 0)
|
|
@@ -52,18 +87,22 @@ const runOne = (options) => {
|
|
|
52
87
|
/**
|
|
53
88
|
* Runs the configured agent once per assisted task, in order, so each run has one change to make, and
|
|
54
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.
|
|
55
92
|
*/
|
|
56
93
|
const runAgentTasks = (options) => {
|
|
94
|
+
const { afterRun } = options;
|
|
57
95
|
const { root, template } = options;
|
|
58
96
|
const tasks = (0, exports.assistedTasks)(options.tasks);
|
|
59
97
|
return tasks.map((task, index) => {
|
|
60
98
|
const label = `[${index + 1}/${tasks.length}] ${task.packageName} ${task.name}`;
|
|
61
|
-
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.`);
|
|
62
100
|
const run = runOne({ root, template, task });
|
|
63
101
|
if (run.state === 'done')
|
|
64
102
|
console.log(`\n ${label}: done`);
|
|
65
103
|
else
|
|
66
|
-
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);
|
|
67
106
|
return run;
|
|
68
107
|
});
|
|
69
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,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AAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAEhF,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,0FAA0F,CAAC,CAAC;QAEpH,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7C,IAAI,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,SAA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AAS;YAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAC1C,IAAI,IAAI,KAAK,WAAW;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAC7C,IAAI,IAAI,KAAK,cAAc;YAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAClD,IAAI,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,EAA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-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;
|