agentic-workflow-manager 8.1.3 → 8.1.4
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.
|
@@ -40,6 +40,7 @@ function parseArgs(argv) {
|
|
|
40
40
|
}
|
|
41
41
|
function realIO(repoRoot, cliDir) {
|
|
42
42
|
const pkgPath = path_1.default.join(cliDir, 'package.json');
|
|
43
|
+
const lockPath = path_1.default.join(cliDir, 'package-lock.json');
|
|
43
44
|
const changelogPath = path_1.default.join(repoRoot, 'CHANGELOG.md');
|
|
44
45
|
const npmrcPath = path_1.default.join(cliDir, '.npmrc');
|
|
45
46
|
return {
|
|
@@ -52,6 +53,18 @@ function realIO(repoRoot, cliDir) {
|
|
|
52
53
|
pkg.version = v;
|
|
53
54
|
fs_1.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
54
55
|
},
|
|
56
|
+
// El round-trip JSON.parse/stringify preserva el orden de claves y el formato que
|
|
57
|
+
// npm escribe (2 espacios + newline final), asi que el diff de un bump son las dos
|
|
58
|
+
// lineas de version y nada mas — verificado sobre el lockfile real de este repo.
|
|
59
|
+
writeLockVersion: (v) => {
|
|
60
|
+
if (!fs_1.default.existsSync(lockPath))
|
|
61
|
+
return;
|
|
62
|
+
const lock = JSON.parse(fs_1.default.readFileSync(lockPath, 'utf8'));
|
|
63
|
+
lock.version = v;
|
|
64
|
+
if (lock.packages?.[''])
|
|
65
|
+
lock.packages[''].version = v;
|
|
66
|
+
fs_1.default.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + '\n');
|
|
67
|
+
},
|
|
55
68
|
readChangelog: () => (fs_1.default.existsSync(changelogPath) ? fs_1.default.readFileSync(changelogPath, 'utf8') : ''),
|
|
56
69
|
writeChangelog: (c) => fs_1.default.writeFileSync(changelogPath, c),
|
|
57
70
|
writeNpmrc: (token) => fs_1.default.writeFileSync(npmrcPath, `//registry.npmjs.org/:_authToken=${token}\n`),
|
|
@@ -65,9 +65,10 @@ function release(opts, io) {
|
|
|
65
65
|
}
|
|
66
66
|
// aplicar
|
|
67
67
|
io.writePackageVersion(version);
|
|
68
|
+
io.writeLockVersion(version);
|
|
68
69
|
const section = (0, core_1.renderChangelog)(version, io.today(), commits);
|
|
69
70
|
io.writeChangelog(section + '\n' + io.readChangelog());
|
|
70
|
-
io.run('git', ['add', 'cli/package.json', 'CHANGELOG.md']);
|
|
71
|
+
io.run('git', ['add', 'cli/package.json', 'cli/package-lock.json', 'CHANGELOG.md']);
|
|
71
72
|
io.run('git', ['commit', '-m', `chore(release): v${version} [skip ci]`]);
|
|
72
73
|
io.run('git', ['tag', '-a', `v${version}`, '-m', `v${version}`]);
|
|
73
74
|
// OIDC mode: GitHub inyecta ACTIONS_ID_TOKEN_REQUEST_URL con id-token:write
|
|
@@ -6,6 +6,10 @@ const core_1 = require("../../src/release/core");
|
|
|
6
6
|
function makeIO(over = {}) {
|
|
7
7
|
const calls = [];
|
|
8
8
|
let pkgVersion = '2.1.1';
|
|
9
|
+
// El lockfile arranca en la MISMA version que el package.json, como en el repo real.
|
|
10
|
+
// Si el release no lo sincroniza, este valor se queda atras — que es exactamente el
|
|
11
|
+
// estado que dejaba `main` en rojo (#92).
|
|
12
|
+
let lockVersion = '2.1.1';
|
|
9
13
|
const io = {
|
|
10
14
|
run(cmd, args) {
|
|
11
15
|
const full = `${cmd} ${args.join(' ')}`;
|
|
@@ -26,6 +30,7 @@ function makeIO(over = {}) {
|
|
|
26
30
|
},
|
|
27
31
|
readPackageVersion: () => pkgVersion,
|
|
28
32
|
writePackageVersion: (v) => { pkgVersion = v; calls.push(`WRITE_PKG ${v}`); },
|
|
33
|
+
writeLockVersion: (v) => { lockVersion = v; calls.push(`WRITE_LOCK ${v}`); },
|
|
29
34
|
readChangelog: () => '',
|
|
30
35
|
writeChangelog: (c) => calls.push(`WRITE_CHANGELOG ${c.split('\n')[0]}`),
|
|
31
36
|
writeNpmrc: () => calls.push('WRITE_NPMRC'),
|
|
@@ -35,7 +40,7 @@ function makeIO(over = {}) {
|
|
|
35
40
|
env: { NPM_TOKEN: 'tok' },
|
|
36
41
|
...over,
|
|
37
42
|
};
|
|
38
|
-
return { io, calls };
|
|
43
|
+
return { io, calls, versions: () => ({ pkg: pkgVersion, lock: lockVersion }) };
|
|
39
44
|
}
|
|
40
45
|
const opts = (o = {}) => ({ dryRun: false, force: null, push: true, branch: 'main', cliDir: '/cli', ...o });
|
|
41
46
|
describe('release — happy path', () => {
|
|
@@ -54,6 +59,25 @@ describe('release — happy path', () => {
|
|
|
54
59
|
expect(calls).toContain('WRITE_NPMRC');
|
|
55
60
|
expect(calls).toContain('REMOVE_NPMRC');
|
|
56
61
|
});
|
|
62
|
+
// #92: el bump escribia solo package.json, asi que el lockfile quedaba una version
|
|
63
|
+
// atras en CADA release. `r3-cli-major-version.test.ts` exige que coincidan, y el
|
|
64
|
+
// `[skip ci]` del commit de bump hacia que ese rojo no apareciera hasta el PR
|
|
65
|
+
// siguiente — que llegaba roto por algo que no habia hecho.
|
|
66
|
+
it('sincroniza package-lock.json con package.json y lo incluye en el commit de bump', () => {
|
|
67
|
+
const { io, calls, versions } = makeIO({ commits: `feat: x${core_1.US}${core_1.RS}` });
|
|
68
|
+
(0, orchestrator_1.release)(opts(), io);
|
|
69
|
+
expect(versions()).toEqual({ pkg: '2.2.0', lock: '2.2.0' });
|
|
70
|
+
expect(calls).toContain('WRITE_LOCK 2.2.0');
|
|
71
|
+
// Escribir el archivo no alcanza: si no se stagea, el commit de release lo deja
|
|
72
|
+
// fuera y el lockfile queda sucio en el working tree del runner.
|
|
73
|
+
expect(calls).toContain('git add cli/package.json cli/package-lock.json CHANGELOG.md');
|
|
74
|
+
});
|
|
75
|
+
it('no toca el lockfile cuando no hay nada que publicar', () => {
|
|
76
|
+
const { io, calls, versions } = makeIO({ commits: `docs: solo docs${core_1.US}${core_1.RS}` });
|
|
77
|
+
(0, orchestrator_1.release)(opts(), io);
|
|
78
|
+
expect(versions()).toEqual({ pkg: '2.1.1', lock: '2.1.1' });
|
|
79
|
+
expect(calls.some((c) => c.startsWith('WRITE_LOCK'))).toBe(false);
|
|
80
|
+
});
|
|
57
81
|
it('sin commits releasables → no publica (exit 0 lógico)', () => {
|
|
58
82
|
const { io, calls } = makeIO({ commits: `docs: solo docs${core_1.US}${core_1.RS}` });
|
|
59
83
|
const res = (0, orchestrator_1.release)(opts(), io);
|