@gaia-ai/addon-dropsh 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/index.d.ts +6 -0
- package/dist/src/index.js +75 -0
- package/dist/src/preset.d.ts +2 -0
- package/dist/src/preset.js +8 -0
- package/package.json +31 -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-dropsh
|
|
2
|
+
|
|
3
|
+
GAIA dropsh command plugin: the `gaia dropsh` JSON:API shell bound to the split connection config.
|
|
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,6 @@
|
|
|
1
|
+
import { type GaiaCommandPlugin } from '@gaia-ai/core';
|
|
2
|
+
/** Actionable hint when a `gaia dropsh` command runs with no loadable connection. */
|
|
3
|
+
export declare function dropshConfigHint(resolvedPath?: string): string;
|
|
4
|
+
/** The `dropsh` command plugin the host mounts (`gaia dropsh …`). */
|
|
5
|
+
declare const dropshCommandPlugin: GaiaCommandPlugin;
|
|
6
|
+
export default dropshCommandPlugin;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { loadGaiaConfig, } from '@gaia-ai/core';
|
|
2
|
+
import { buildProgram as buildDropshProgram } from 'dropsh';
|
|
3
|
+
// GAIA-201: the `gaia dropsh` command PLUGIN. It builds the inherited dropsh
|
|
4
|
+
// JSON:API shell from the CONNECTION config (`loadGaiaConfig`) — NEVER
|
|
5
|
+
// `loadConductorConfig`. That is the deepest AC-2 fix: the old `gaia dropsh`
|
|
6
|
+
// went through `loadConductorConfig`, which eagerly constructed the whole engine
|
|
7
|
+
// plugin farm (remote/executor/agent/workspace) just to read the auth `plugins`.
|
|
8
|
+
// This package has no `@gaia-ai/conductor` edge and imports no engine plugin, so
|
|
9
|
+
// a `gaia dropsh read …` instantiates nothing but the dropsh auth plugins.
|
|
10
|
+
//
|
|
11
|
+
// Connection precedence (AC-4, resolved in core `resolveGaiaConfigPath`):
|
|
12
|
+
// explicit `--config` / `$DROPSH_CONFIG` → project `./.gaia/gaia.config.js`
|
|
13
|
+
// walk-up (legacy `conductor.config.js` accepted) → home `~/.gaia/gaia.config.js`
|
|
14
|
+
// → shipped fallback. `$DROPSH_CONFIG` is set to the resolved path so dropsh's
|
|
15
|
+
// own subcommands (`auth login`) reload the same connection.
|
|
16
|
+
/** Actionable hint when a `gaia dropsh` command runs with no loadable connection. */
|
|
17
|
+
export function dropshConfigHint(resolvedPath) {
|
|
18
|
+
const where = resolvedPath ? ` (looked at ${resolvedPath})` : '';
|
|
19
|
+
return (`gaia dropsh: no connection config could be loaded${where}.\n` +
|
|
20
|
+
'Point at one with --config <path>, set $DROPSH_CONFIG, run from a directory ' +
|
|
21
|
+
'containing .gaia/gaia.config.js, or onboard this machine with ' +
|
|
22
|
+
'`gaia conductor init --base-url <url>` (home fallback).');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build the `dropsh` command from a resolved connection. Sets `$DROPSH_CONFIG`
|
|
26
|
+
* to the connection path (unless already set) so dropsh's own subcommands reload
|
|
27
|
+
* the same site + plugins.
|
|
28
|
+
*/
|
|
29
|
+
async function buildDropshCommand(host) {
|
|
30
|
+
let connection;
|
|
31
|
+
try {
|
|
32
|
+
connection = await loadGaiaConfig(host, {});
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
connection = undefined;
|
|
36
|
+
}
|
|
37
|
+
const dropsh = buildDropshProgram({
|
|
38
|
+
plugins: connection?.plugins ?? [],
|
|
39
|
+
});
|
|
40
|
+
if (connection && !process.env.DROPSH_CONFIG) {
|
|
41
|
+
process.env.DROPSH_CONFIG = connection.config_path;
|
|
42
|
+
}
|
|
43
|
+
if (!connection) {
|
|
44
|
+
// Registration is unconditional; a config problem must surface WHEN a dropsh
|
|
45
|
+
// command runs, not make the command vanish. The hook fires only on a real
|
|
46
|
+
// subcommand dispatch — never for `--help` — so discoverability holds. It
|
|
47
|
+
// honours a late `--config` (AC-4 explicit leg).
|
|
48
|
+
dropsh.hook('preSubcommand', async (thisCommand) => {
|
|
49
|
+
const override = thisCommand.opts().config ??
|
|
50
|
+
process.env.DROPSH_CONFIG;
|
|
51
|
+
let resolvedPath;
|
|
52
|
+
try {
|
|
53
|
+
const c = await loadGaiaConfig(host, { explicit: override });
|
|
54
|
+
resolvedPath = c.config_path;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new Error(dropshConfigHint(override));
|
|
58
|
+
}
|
|
59
|
+
if (!process.env.DROPSH_CONFIG) {
|
|
60
|
+
process.env.DROPSH_CONFIG = resolvedPath;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return dropsh;
|
|
65
|
+
}
|
|
66
|
+
/** The `dropsh` command plugin the host mounts (`gaia dropsh …`). */
|
|
67
|
+
const dropshCommandPlugin = {
|
|
68
|
+
kind: 'command',
|
|
69
|
+
name: 'dropsh',
|
|
70
|
+
describe: 'JSON:API shell (dropsh) bound to the GAIA connection config',
|
|
71
|
+
async register(program, host) {
|
|
72
|
+
program.addCommand(await buildDropshCommand(host));
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export default dropshCommandPlugin;
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gaia-ai/addon-dropsh",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "GAIA dropsh command plugin: the `gaia dropsh` JSON:API shell bound to the split connection config.",
|
|
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/dropsh"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@dropsh/plugin-jsonapi-schema": "^0.5.8",
|
|
24
|
+
"@dropsh/plugin-oauth2": "^0.5.7",
|
|
25
|
+
"commander": "^12.1.0",
|
|
26
|
+
"dropsh": "^0.5.8"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@gaia-ai/core": "^0.6.1"
|
|
30
|
+
}
|
|
31
|
+
}
|