@gaia-ai/addon-deployment 0.6.1
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/src/deployment.d.ts +34 -0
- package/dist/src/deployment.js +63 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +34 -0
- package/dist/src/preset.d.ts +2 -0
- package/dist/src/preset.js +8 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 keytec GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @gaia-ai/addon-deployment
|
|
2
|
+
|
|
3
|
+
GAIA deployment command plugin: `gaia deployment tickets` — the release batch computed from a git-log range.
|
|
4
|
+
|
|
5
|
+
Part of the GAIA CLI. Install the meta package `@gaia-ai/gaia` to get the `gaia` CLI with all addons. Source: https://git.key-tec.de/keytec/gaia (gaia-cli/).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GaiaRemote } from '@gaia-ai/conductor/contract';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
export interface GatherResult {
|
|
4
|
+
range: string;
|
|
5
|
+
resolved: Array<{
|
|
6
|
+
identifier: string;
|
|
7
|
+
uuid: string;
|
|
8
|
+
title: string;
|
|
9
|
+
}>;
|
|
10
|
+
unresolved: string[];
|
|
11
|
+
}
|
|
12
|
+
/** Deduped GAIA-nnn from a git log, in first-seen order. */
|
|
13
|
+
export declare function parseIdentifiers(gitLog: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Compute the release batch from a git-log delta: parse GAIA-nnn identifiers and
|
|
16
|
+
* resolve each to a ticket. Unresolved identifiers are reported, never fatal
|
|
17
|
+
* (the resolver returning null is not an error) — GAIA-153 AC-2.
|
|
18
|
+
*/
|
|
19
|
+
export declare function gatherBatch(opts: {
|
|
20
|
+
sinceRef: string;
|
|
21
|
+
toRef: string;
|
|
22
|
+
gitLog: string;
|
|
23
|
+
resolve: (id: string) => Promise<{
|
|
24
|
+
uuid: string;
|
|
25
|
+
title: string;
|
|
26
|
+
} | null>;
|
|
27
|
+
}): Promise<GatherResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Register the `gaia deployment` command group. `tickets` computes the release's
|
|
30
|
+
* tickets (git-log identifier parse + resolve over the given range) and prints
|
|
31
|
+
* them as JSON — pure compute + report, it does not write `referenced_tickets`
|
|
32
|
+
* (the prepare-deployment skill does, via the documented dropsh path).
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerDeployment(program: Command, resolveRemote: () => Promise<GaiaRemote>, resolveProject: () => Promise<string>, cwd: () => string): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { exec } from '@gaia-ai/core';
|
|
2
|
+
/** Deduped GAIA-nnn from a git log, in first-seen order. */
|
|
3
|
+
export function parseIdentifiers(gitLog) {
|
|
4
|
+
const seen = new Set();
|
|
5
|
+
const out = [];
|
|
6
|
+
for (const m of gitLog.matchAll(/\bGAIA-\d+\b/g)) {
|
|
7
|
+
if (!seen.has(m[0])) {
|
|
8
|
+
seen.add(m[0]);
|
|
9
|
+
out.push(m[0]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compute the release batch from a git-log delta: parse GAIA-nnn identifiers and
|
|
16
|
+
* resolve each to a ticket. Unresolved identifiers are reported, never fatal
|
|
17
|
+
* (the resolver returning null is not an error) — GAIA-153 AC-2.
|
|
18
|
+
*/
|
|
19
|
+
export async function gatherBatch(opts) {
|
|
20
|
+
const resolved = [];
|
|
21
|
+
const unresolved = [];
|
|
22
|
+
for (const identifier of parseIdentifiers(opts.gitLog)) {
|
|
23
|
+
const hit = await opts.resolve(identifier);
|
|
24
|
+
if (hit) {
|
|
25
|
+
resolved.push({ identifier, ...hit });
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
unresolved.push(identifier);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { range: `${opts.sinceRef}..${opts.toRef}`, resolved, unresolved };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register the `gaia deployment` command group. `tickets` computes the release's
|
|
35
|
+
* tickets (git-log identifier parse + resolve over the given range) and prints
|
|
36
|
+
* them as JSON — pure compute + report, it does not write `referenced_tickets`
|
|
37
|
+
* (the prepare-deployment skill does, via the documented dropsh path).
|
|
38
|
+
*/
|
|
39
|
+
export function registerDeployment(program, resolveRemote, resolveProject, cwd) {
|
|
40
|
+
const dep = program
|
|
41
|
+
.command('deployment')
|
|
42
|
+
.description('release / deployment helpers');
|
|
43
|
+
dep
|
|
44
|
+
.command('tickets')
|
|
45
|
+
.description("the release's tickets (git-log identifier parse + resolve over a range) as JSON")
|
|
46
|
+
.requiredOption('--since <ref>', "the env's currently-deployed ref (git range start)")
|
|
47
|
+
.requiredOption('--to <ref>', 'the post-merge env branch tip (git range end)')
|
|
48
|
+
.action(async (opts) => {
|
|
49
|
+
// Prefix each commit with a record separator (%x1e) so one commit's body
|
|
50
|
+
// cannot run into the next commit's header line; the identifier parse is
|
|
51
|
+
// separator-agnostic, but the boundary keeps the log unambiguous.
|
|
52
|
+
const gitLog = await exec('git', ['log', '--format=%x1e%H %s%n%b', `${opts.since}..${opts.to}`], { cwd: cwd() });
|
|
53
|
+
const remote = await resolveRemote();
|
|
54
|
+
const project = await resolveProject();
|
|
55
|
+
const result = await gatherBatch({
|
|
56
|
+
sinceRef: opts.since,
|
|
57
|
+
toRef: opts.to,
|
|
58
|
+
gitLog,
|
|
59
|
+
resolve: (id) => remote.resolveTicketByIdentifier(project, id),
|
|
60
|
+
});
|
|
61
|
+
console.log(JSON.stringify(result));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type GaiaCommandPlugin } from '@gaia-ai/core';
|
|
2
|
+
/** The `deployment` command plugin the host mounts (`gaia deployment …`). */
|
|
3
|
+
declare const deploymentCommandPlugin: GaiaCommandPlugin;
|
|
4
|
+
export default deploymentCommandPlugin;
|
|
5
|
+
export { type GatherResult, gatherBatch, parseIdentifiers, registerDeployment, } from './deployment.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { composeConductorConfig, loadConductorConfig, selectRemote, } from '@gaia-ai/conductor';
|
|
2
|
+
import { loadGaiaConfig, resolveConfigPath, } from '@gaia-ai/core';
|
|
3
|
+
import { registerDeployment } from './deployment.js';
|
|
4
|
+
// GAIA-224 (Finding 7): `deployment` is its own COMMAND-surface addon, no longer
|
|
5
|
+
// a side-registration of the `conductor` command plugin. The release-batch
|
|
6
|
+
// gathering (`src/deployment.ts`) was already fully dependency-inverted — it
|
|
7
|
+
// takes the remote, the project and the cwd as thunks — so this module only has
|
|
8
|
+
// to reproduce the thunks the conductor command plugin used to pass, over the
|
|
9
|
+
// same split-config resolution:
|
|
10
|
+
// engine half `conductor.config.js` via `loadConductorConfig`
|
|
11
|
+
// connection half `gaia.config.js` via `loadGaiaConfig`
|
|
12
|
+
// composed by `composeConductorConfig`, with the remote picked by `selectRemote`.
|
|
13
|
+
//
|
|
14
|
+
// The `@gaia-ai/conductor` import is the package MAIN (engine + config loader),
|
|
15
|
+
// not the runtime-light `./contract` subpath — that cost is paid only when a
|
|
16
|
+
// `gaia deployment …` subcommand actually dispatches, because the host mounts
|
|
17
|
+
// this module lazily (the `./preset` accumulator is what `gaia --help` reads).
|
|
18
|
+
/** Resolve + compose the full conductor config (engine + connection halves). */
|
|
19
|
+
async function resolveConfig(host) {
|
|
20
|
+
const engine = await loadConductorConfig(resolveConfigPath());
|
|
21
|
+
const connection = await loadGaiaConfig(host, {});
|
|
22
|
+
return composeConductorConfig(engine, connection);
|
|
23
|
+
}
|
|
24
|
+
/** The `deployment` command plugin the host mounts (`gaia deployment …`). */
|
|
25
|
+
const deploymentCommandPlugin = {
|
|
26
|
+
kind: 'command',
|
|
27
|
+
name: 'deployment',
|
|
28
|
+
describe: 'release / deployment helpers',
|
|
29
|
+
register(program, host) {
|
|
30
|
+
registerDeployment(program, async () => selectRemote(await resolveConfig(host)), async () => (await resolveConfig(host)).project, () => process.cwd());
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export default deploymentCommandPlugin;
|
|
34
|
+
export { gatherBatch, parseIdentifiers, registerDeployment, } from './deployment.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gaia-ai/addon-deployment",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "GAIA deployment command plugin: `gaia deployment tickets` — the release batch computed from a git-log range.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/src/index.js",
|
|
9
|
+
"./preset": "./dist/src/preset.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/src"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://git.key-tec.de/keytec/gaia.git",
|
|
20
|
+
"directory": "gaia-cli/addons/deployment"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"commander": "^12.1.0"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@gaia-ai/conductor": "^0.6.1",
|
|
27
|
+
"@gaia-ai/core": "^0.6.1"
|
|
28
|
+
}
|
|
29
|
+
}
|