@amodalai/amodal 0.1.13 → 0.1.15
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 +30 -0
- package/dist/src/commands/deploy.js +2 -2
- package/dist/src/commands/deploy.js.map +1 -1
- package/dist/src/commands/deployments.js +1 -1
- package/dist/src/commands/deployments.js.map +1 -1
- package/dist/src/commands/dev.d.ts.map +1 -1
- package/dist/src/commands/dev.js +19 -1
- package/dist/src/commands/dev.js.map +1 -1
- package/dist/src/commands/groups/auth.d.ts +8 -0
- package/dist/src/commands/groups/auth.d.ts.map +1 -0
- package/dist/src/commands/groups/auth.js +16 -0
- package/dist/src/commands/groups/auth.js.map +1 -0
- package/dist/src/commands/groups/deploy.d.ts +8 -0
- package/dist/src/commands/groups/deploy.d.ts.map +1 -0
- package/dist/src/commands/groups/deploy.js +27 -0
- package/dist/src/commands/groups/deploy.js.map +1 -0
- package/dist/src/commands/groups/ops.d.ts +8 -0
- package/dist/src/commands/groups/ops.d.ts.map +1 -0
- package/dist/src/commands/groups/ops.js +23 -0
- package/dist/src/commands/groups/ops.js.map +1 -0
- package/dist/src/commands/groups/pkg.d.ts +8 -0
- package/dist/src/commands/groups/pkg.d.ts.map +1 -0
- package/dist/src/commands/groups/pkg.js +33 -0
- package/dist/src/commands/groups/pkg.js.map +1 -0
- package/dist/src/commands/index.d.ts +4 -1
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +16 -54
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +0 -6
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/main.js +19 -1
- package/dist/src/main.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/commands/command-exports.test.ts +20 -56
- package/src/commands/deploy.ts +2 -2
- package/src/commands/deployments.ts +1 -1
- package/src/commands/dev.ts +18 -1
- package/src/commands/groups/auth.ts +19 -0
- package/src/commands/groups/deploy.ts +30 -0
- package/src/commands/groups/ops.ts +26 -0
- package/src/commands/groups/pkg.ts +36 -0
- package/src/commands/index.ts +17 -54
- package/src/commands/init.test.ts +6 -10
- package/src/commands/init.ts +0 -14
- package/src/main.ts +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amodalai/amodal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "Amodal CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"semver": "^7.6.0",
|
|
31
31
|
"yargs": "^17.7.2",
|
|
32
32
|
"zod": "^4.3.6",
|
|
33
|
-
"@amodalai/core": "0.1.
|
|
34
|
-
"@amodalai/runtime": "0.1.
|
|
35
|
-
"@amodalai/runtime-app": "0.1.
|
|
33
|
+
"@amodalai/core": "0.1.15",
|
|
34
|
+
"@amodalai/runtime": "0.1.15",
|
|
35
|
+
"@amodalai/runtime-app": "0.1.15"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^20.11.24",
|
|
@@ -7,38 +7,21 @@
|
|
|
7
7
|
import {describe, it, expect} from 'vitest';
|
|
8
8
|
import type {CommandModule} from 'yargs';
|
|
9
9
|
|
|
10
|
-
import {connectCommand} from './connect.js';
|
|
11
|
-
import {installPkgCommand} from './install-pkg.js';
|
|
12
|
-
import {uninstallCommand} from './uninstall.js';
|
|
13
|
-
import {listCommand} from './list.js';
|
|
14
|
-
import {updateCommand} from './update.js';
|
|
15
|
-
import {diffCommand} from './diff.js';
|
|
16
|
-
import {searchCommand} from './search.js';
|
|
17
|
-
import {publishCommand} from './publish.js';
|
|
18
|
-
import {loginCommand} from './login.js';
|
|
19
|
-
import {syncCommand} from './sync.js';
|
|
20
|
-
|
|
21
10
|
import {initCommand} from './init.js';
|
|
22
11
|
import {devCommand} from './dev.js';
|
|
23
12
|
import {inspectCommand} from './inspect.js';
|
|
24
13
|
import {validateCommand} from './validate.js';
|
|
25
|
-
|
|
26
|
-
import {secretsCommand} from './secrets.js';
|
|
27
|
-
import {deployCommand} from './deploy.js';
|
|
28
|
-
import {buildCommand} from './build.js';
|
|
29
|
-
import {dockerCommand} from './docker.js';
|
|
30
|
-
import {rollbackCommand} from './rollback.js';
|
|
31
|
-
import {deploymentsCommand} from './deployments.js';
|
|
32
|
-
import {promoteCommand} from './promote.js';
|
|
33
|
-
import {serveCommand} from './serve.js';
|
|
34
|
-
import {statusCommand} from './status.js';
|
|
35
|
-
import {auditCommand} from './audit.js';
|
|
36
|
-
import {automationsCommand} from './automations.js';
|
|
37
|
-
|
|
14
|
+
import {chatCommand} from './chat.js';
|
|
38
15
|
import {evalCommand} from './eval.js';
|
|
39
|
-
import {experimentCommand} from './experiment.js';
|
|
40
16
|
import {testQueryCommand} from './test-query.js';
|
|
41
17
|
|
|
18
|
+
import {pkgCommand} from './groups/pkg.js';
|
|
19
|
+
import {deployGroupCommand} from './groups/deploy.js';
|
|
20
|
+
import {opsCommand} from './groups/ops.js';
|
|
21
|
+
import {authCommand} from './groups/auth.js';
|
|
22
|
+
|
|
23
|
+
import {amodalCommands} from './index.js';
|
|
24
|
+
|
|
42
25
|
function assertValidCommandModule(mod: CommandModule, expectedCommand: string): void {
|
|
43
26
|
expect(mod.command).toBeDefined();
|
|
44
27
|
expect(String(mod.command).split(' ')[0]).toBe(expectedCommand);
|
|
@@ -46,43 +29,24 @@ function assertValidCommandModule(mod: CommandModule, expectedCommand: string):
|
|
|
46
29
|
}
|
|
47
30
|
|
|
48
31
|
describe('command-exports', () => {
|
|
49
|
-
it('
|
|
50
|
-
assertValidCommandModule(connectCommand, 'connect');
|
|
51
|
-
assertValidCommandModule(installPkgCommand, 'install');
|
|
52
|
-
assertValidCommandModule(uninstallCommand, 'uninstall');
|
|
53
|
-
assertValidCommandModule(listCommand, 'list');
|
|
54
|
-
assertValidCommandModule(updateCommand, 'update');
|
|
55
|
-
assertValidCommandModule(diffCommand, 'diff');
|
|
56
|
-
assertValidCommandModule(searchCommand, 'search');
|
|
57
|
-
assertValidCommandModule(publishCommand, 'publish');
|
|
58
|
-
assertValidCommandModule(loginCommand, 'login');
|
|
59
|
-
assertValidCommandModule(syncCommand, 'sync');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('project commands export valid CommandModules', () => {
|
|
32
|
+
it('top-level commands export valid CommandModules', () => {
|
|
63
33
|
assertValidCommandModule(initCommand, 'init');
|
|
64
34
|
assertValidCommandModule(devCommand, 'dev');
|
|
65
|
-
assertValidCommandModule(
|
|
35
|
+
assertValidCommandModule(chatCommand, 'chat');
|
|
66
36
|
assertValidCommandModule(validateCommand, 'validate');
|
|
37
|
+
assertValidCommandModule(inspectCommand, 'inspect');
|
|
38
|
+
assertValidCommandModule(evalCommand, 'eval');
|
|
39
|
+
assertValidCommandModule(testQueryCommand, 'test-query');
|
|
67
40
|
});
|
|
68
41
|
|
|
69
|
-
it('
|
|
70
|
-
assertValidCommandModule(
|
|
71
|
-
assertValidCommandModule(
|
|
72
|
-
assertValidCommandModule(
|
|
73
|
-
assertValidCommandModule(
|
|
74
|
-
assertValidCommandModule(rollbackCommand, 'rollback');
|
|
75
|
-
assertValidCommandModule(deploymentsCommand, 'deployments');
|
|
76
|
-
assertValidCommandModule(promoteCommand, 'promote');
|
|
77
|
-
assertValidCommandModule(serveCommand, 'serve');
|
|
78
|
-
assertValidCommandModule(statusCommand, 'status');
|
|
79
|
-
assertValidCommandModule(auditCommand, 'audit');
|
|
80
|
-
assertValidCommandModule(automationsCommand, 'automations');
|
|
42
|
+
it('group commands export valid CommandModules', () => {
|
|
43
|
+
assertValidCommandModule(pkgCommand, 'pkg');
|
|
44
|
+
assertValidCommandModule(deployGroupCommand, 'deploy');
|
|
45
|
+
assertValidCommandModule(opsCommand, 'ops');
|
|
46
|
+
assertValidCommandModule(authCommand, 'auth');
|
|
81
47
|
});
|
|
82
48
|
|
|
83
|
-
it('
|
|
84
|
-
|
|
85
|
-
assertValidCommandModule(experimentCommand, 'experiment');
|
|
86
|
-
assertValidCommandModule(testQueryCommand, 'test-query');
|
|
49
|
+
it('amodalCommands has expected count', () => {
|
|
50
|
+
expect(amodalCommands).toHaveLength(11);
|
|
87
51
|
});
|
|
88
52
|
});
|
package/src/commands/deploy.ts
CHANGED
|
@@ -148,8 +148,8 @@ export async function runDeploy(options: DeployOptions = {}): Promise<number> {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
export const deployCommand: CommandModule = {
|
|
151
|
-
command: '
|
|
152
|
-
describe: '
|
|
151
|
+
command: 'push',
|
|
152
|
+
describe: 'Push a deployment to the platform',
|
|
153
153
|
builder: (yargs) =>
|
|
154
154
|
yargs
|
|
155
155
|
.option('message', {
|
|
@@ -58,7 +58,7 @@ export async function runDeployments(options: DeploymentsOptions = {}): Promise<
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export const deploymentsCommand: CommandModule = {
|
|
61
|
-
command: '
|
|
61
|
+
command: 'list',
|
|
62
62
|
describe: 'List deployment history',
|
|
63
63
|
builder: (yargs) =>
|
|
64
64
|
yargs
|
package/src/commands/dev.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type {CommandModule} from 'yargs';
|
|
8
|
-
import {existsSync} from 'node:fs';
|
|
8
|
+
import {existsSync, readFileSync} from 'node:fs';
|
|
9
9
|
import {createRequire} from 'node:module';
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import {fileURLToPath} from 'node:url';
|
|
@@ -35,6 +35,23 @@ export async function runDev(options: DevOptions = {}): Promise<void> {
|
|
|
35
35
|
process.exit(1);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// Load .env file from the repo root (if present)
|
|
39
|
+
const envPath = path.join(repoPath, '.env');
|
|
40
|
+
if (existsSync(envPath)) {
|
|
41
|
+
const envContent = readFileSync(envPath, 'utf-8');
|
|
42
|
+
for (const line of envContent.split('\n')) {
|
|
43
|
+
const trimmed = line.trim();
|
|
44
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
45
|
+
const eqIdx = trimmed.indexOf('=');
|
|
46
|
+
if (eqIdx === -1) continue;
|
|
47
|
+
const key = trimmed.slice(0, eqIdx).trim();
|
|
48
|
+
const value = trimmed.slice(eqIdx + 1).trim();
|
|
49
|
+
if (key && !(key in process.env)) {
|
|
50
|
+
process.env[key] = value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
38
55
|
const port = options.port ?? DEFAULT_PORT;
|
|
39
56
|
const host = options.host ?? '0.0.0.0';
|
|
40
57
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {CommandModule} from 'yargs';
|
|
8
|
+
import {loginCommand, logoutCommand} from '../login.js';
|
|
9
|
+
|
|
10
|
+
export const authCommand: CommandModule = {
|
|
11
|
+
command: 'auth <command>',
|
|
12
|
+
describe: 'Authentication',
|
|
13
|
+
builder: (yargs) =>
|
|
14
|
+
yargs
|
|
15
|
+
.command(loginCommand)
|
|
16
|
+
.command(logoutCommand)
|
|
17
|
+
.demandCommand(1, 'Specify a subcommand'),
|
|
18
|
+
handler: () => {},
|
|
19
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {CommandModule} from 'yargs';
|
|
8
|
+
import {deployCommand as pushCommand} from '../deploy.js';
|
|
9
|
+
import {buildCommand} from '../build.js';
|
|
10
|
+
import {serveCommand} from '../serve.js';
|
|
11
|
+
import {statusCommand} from '../status.js';
|
|
12
|
+
import {deploymentsCommand} from '../deployments.js';
|
|
13
|
+
import {rollbackCommand} from '../rollback.js';
|
|
14
|
+
import {promoteCommand} from '../promote.js';
|
|
15
|
+
|
|
16
|
+
export const deployGroupCommand: CommandModule = {
|
|
17
|
+
command: 'deploy <command>',
|
|
18
|
+
describe: 'Deployment lifecycle',
|
|
19
|
+
builder: (yargs) =>
|
|
20
|
+
yargs
|
|
21
|
+
.command(pushCommand)
|
|
22
|
+
.command(buildCommand)
|
|
23
|
+
.command(serveCommand)
|
|
24
|
+
.command(statusCommand)
|
|
25
|
+
.command(deploymentsCommand)
|
|
26
|
+
.command(rollbackCommand)
|
|
27
|
+
.command(promoteCommand)
|
|
28
|
+
.demandCommand(1, 'Specify a subcommand'),
|
|
29
|
+
handler: () => {},
|
|
30
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {CommandModule} from 'yargs';
|
|
8
|
+
import {secretsCommand} from '../secrets.js';
|
|
9
|
+
import {dockerCommand} from '../docker.js';
|
|
10
|
+
import {automationsCommand} from '../automations.js';
|
|
11
|
+
import {auditCommand} from '../audit.js';
|
|
12
|
+
import {experimentCommand} from '../experiment.js';
|
|
13
|
+
|
|
14
|
+
export const opsCommand: CommandModule = {
|
|
15
|
+
command: 'ops <command>',
|
|
16
|
+
describe: 'Platform operations',
|
|
17
|
+
builder: (yargs) =>
|
|
18
|
+
yargs
|
|
19
|
+
.command(secretsCommand)
|
|
20
|
+
.command(dockerCommand)
|
|
21
|
+
.command(automationsCommand)
|
|
22
|
+
.command(auditCommand)
|
|
23
|
+
.command(experimentCommand)
|
|
24
|
+
.demandCommand(1, 'Specify a subcommand'),
|
|
25
|
+
handler: () => {},
|
|
26
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {CommandModule} from 'yargs';
|
|
8
|
+
import {connectCommand} from '../connect.js';
|
|
9
|
+
import {installPkgCommand} from '../install-pkg.js';
|
|
10
|
+
import {uninstallCommand} from '../uninstall.js';
|
|
11
|
+
import {listCommand} from '../list.js';
|
|
12
|
+
import {updateCommand} from '../update.js';
|
|
13
|
+
import {diffCommand} from '../diff.js';
|
|
14
|
+
import {searchCommand} from '../search.js';
|
|
15
|
+
import {publishCommand} from '../publish.js';
|
|
16
|
+
import {linkCommand} from '../link.js';
|
|
17
|
+
import {syncCommand} from '../sync.js';
|
|
18
|
+
|
|
19
|
+
export const pkgCommand: CommandModule = {
|
|
20
|
+
command: 'pkg <command>',
|
|
21
|
+
describe: 'Manage packages',
|
|
22
|
+
builder: (yargs) =>
|
|
23
|
+
yargs
|
|
24
|
+
.command(connectCommand)
|
|
25
|
+
.command(installPkgCommand)
|
|
26
|
+
.command(uninstallCommand)
|
|
27
|
+
.command(listCommand)
|
|
28
|
+
.command(updateCommand)
|
|
29
|
+
.command(diffCommand)
|
|
30
|
+
.command(searchCommand)
|
|
31
|
+
.command(publishCommand)
|
|
32
|
+
.command(linkCommand)
|
|
33
|
+
.command(syncCommand)
|
|
34
|
+
.demandCommand(1, 'Specify a subcommand'),
|
|
35
|
+
handler: () => {},
|
|
36
|
+
};
|
package/src/commands/index.ts
CHANGED
|
@@ -8,69 +8,32 @@ import {initCommand} from './init.js';
|
|
|
8
8
|
import {devCommand} from './dev.js';
|
|
9
9
|
import {inspectCommand} from './inspect.js';
|
|
10
10
|
import {validateCommand} from './validate.js';
|
|
11
|
-
import {connectCommand} from './connect.js';
|
|
12
|
-
import {installPkgCommand} from './install-pkg.js';
|
|
13
|
-
import {uninstallCommand} from './uninstall.js';
|
|
14
|
-
import {listCommand} from './list.js';
|
|
15
|
-
import {updateCommand} from './update.js';
|
|
16
|
-
import {diffCommand} from './diff.js';
|
|
17
|
-
import {searchCommand} from './search.js';
|
|
18
|
-
import {publishCommand} from './publish.js';
|
|
19
|
-
import {loginCommand, logoutCommand} from './login.js';
|
|
20
|
-
import {linkCommand} from './link.js';
|
|
21
|
-
import {syncCommand} from './sync.js';
|
|
22
|
-
import {secretsCommand} from './secrets.js';
|
|
23
|
-
import {deployCommand} from './deploy.js';
|
|
24
|
-
import {buildCommand} from './build.js';
|
|
25
|
-
import {dockerCommand} from './docker.js';
|
|
26
|
-
import {rollbackCommand} from './rollback.js';
|
|
27
|
-
import {deploymentsCommand} from './deployments.js';
|
|
28
|
-
import {promoteCommand} from './promote.js';
|
|
29
|
-
import {serveCommand} from './serve.js';
|
|
30
|
-
import {statusCommand} from './status.js';
|
|
31
11
|
import {chatCommand} from './chat.js';
|
|
32
|
-
import {auditCommand} from './audit.js';
|
|
33
12
|
import {evalCommand} from './eval.js';
|
|
34
|
-
import {experimentCommand} from './experiment.js';
|
|
35
13
|
import {testQueryCommand} from './test-query.js';
|
|
36
|
-
import {
|
|
14
|
+
import {pkgCommand} from './groups/pkg.js';
|
|
15
|
+
import {deployGroupCommand} from './groups/deploy.js';
|
|
16
|
+
import {opsCommand} from './groups/ops.js';
|
|
17
|
+
import {authCommand} from './groups/auth.js';
|
|
18
|
+
|
|
37
19
|
/**
|
|
38
|
-
* All amodal subcommands
|
|
20
|
+
* All amodal subcommands registered on the root yargs instance.
|
|
21
|
+
*
|
|
22
|
+
* Top-level: daily-driver commands (init, dev, chat, validate, inspect, eval, test)
|
|
23
|
+
* Groups: pkg, deploy, ops, auth
|
|
39
24
|
*/
|
|
40
25
|
export const amodalCommands = [
|
|
41
|
-
//
|
|
26
|
+
// Top-level
|
|
42
27
|
initCommand,
|
|
43
28
|
devCommand,
|
|
44
|
-
inspectCommand,
|
|
45
|
-
validateCommand,
|
|
46
|
-
// Package management
|
|
47
|
-
connectCommand,
|
|
48
|
-
installPkgCommand,
|
|
49
|
-
uninstallCommand,
|
|
50
|
-
listCommand,
|
|
51
|
-
updateCommand,
|
|
52
|
-
diffCommand,
|
|
53
|
-
searchCommand,
|
|
54
|
-
publishCommand,
|
|
55
|
-
loginCommand,
|
|
56
|
-
logoutCommand,
|
|
57
|
-
linkCommand,
|
|
58
|
-
syncCommand,
|
|
59
|
-
// Platform
|
|
60
|
-
secretsCommand,
|
|
61
|
-
deployCommand,
|
|
62
|
-
buildCommand,
|
|
63
|
-
dockerCommand,
|
|
64
|
-
rollbackCommand,
|
|
65
|
-
deploymentsCommand,
|
|
66
|
-
promoteCommand,
|
|
67
|
-
serveCommand,
|
|
68
|
-
statusCommand,
|
|
69
29
|
chatCommand,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// Advanced
|
|
30
|
+
validateCommand,
|
|
31
|
+
inspectCommand,
|
|
73
32
|
evalCommand,
|
|
74
|
-
experimentCommand,
|
|
75
33
|
testQueryCommand,
|
|
34
|
+
// Groups
|
|
35
|
+
pkgCommand,
|
|
36
|
+
deployGroupCommand,
|
|
37
|
+
opsCommand,
|
|
38
|
+
authCommand,
|
|
76
39
|
];
|
|
@@ -52,18 +52,14 @@ describe('runInit', () => {
|
|
|
52
52
|
expect(config['models']['main']['provider']).toBe('anthropic');
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
it('should write starter
|
|
55
|
+
it('should not write starter files into directories', async () => {
|
|
56
56
|
await runInit({cwd: tempDir});
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
expect(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
await runInit({cwd: tempDir});
|
|
64
|
-
|
|
65
|
-
const knowledge = readFileSync(join(tempDir, 'knowledge', 'domain.md'), 'utf-8');
|
|
66
|
-
expect(knowledge).toContain('Domain Knowledge');
|
|
58
|
+
// Directories should exist but be empty — no fake/mock content
|
|
59
|
+
expect(existsSync(join(tempDir, 'skills'))).toBe(true);
|
|
60
|
+
expect(existsSync(join(tempDir, 'skills', 'SKILL.md'))).toBe(false);
|
|
61
|
+
expect(existsSync(join(tempDir, 'knowledge'))).toBe(true);
|
|
62
|
+
expect(existsSync(join(tempDir, 'knowledge', 'domain.md'))).toBe(false);
|
|
67
63
|
});
|
|
68
64
|
|
|
69
65
|
it('should skip if config already exists', async () => {
|
package/src/commands/init.ts
CHANGED
|
@@ -8,8 +8,6 @@ import {existsSync, mkdirSync, writeFileSync} from 'node:fs';
|
|
|
8
8
|
import {join} from 'node:path';
|
|
9
9
|
import type {CommandModule} from 'yargs';
|
|
10
10
|
import {generateConfigTemplate} from '../templates/config-template.js';
|
|
11
|
-
import {generateSkillTemplate} from '../templates/skill-template.js';
|
|
12
|
-
import {generateKnowledgeTemplate} from '../templates/knowledge-template.js';
|
|
13
11
|
|
|
14
12
|
export interface InitOptions {
|
|
15
13
|
cwd?: string;
|
|
@@ -48,18 +46,6 @@ export async function runInit(options: InitOptions = {}): Promise<void> {
|
|
|
48
46
|
// Write amodal.json at repo root
|
|
49
47
|
writeFileSync(configPath, generateConfigTemplate({name, provider}));
|
|
50
48
|
|
|
51
|
-
// Write starter skill
|
|
52
|
-
writeFileSync(
|
|
53
|
-
join(cwd, 'skills', 'SKILL.md'),
|
|
54
|
-
generateSkillTemplate(),
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
// Write starter knowledge
|
|
58
|
-
writeFileSync(
|
|
59
|
-
join(cwd, 'knowledge', 'domain.md'),
|
|
60
|
-
generateKnowledgeTemplate(),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
49
|
// Write .gitignore if it doesn't exist
|
|
64
50
|
const gitignorePath = join(cwd, '.gitignore');
|
|
65
51
|
if (!existsSync(gitignorePath)) {
|
package/src/main.ts
CHANGED
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
import {readFileSync} from 'node:fs';
|
|
9
9
|
import yargs from 'yargs';
|
|
10
10
|
import {hideBin} from 'yargs/helpers';
|
|
11
|
+
|
|
12
|
+
// Suppress OpenTelemetry DiagAPI logger warnings from @google/gemini-cli-core.
|
|
13
|
+
// gemini-cli-core calls setLogger() which triggers a noisy "Current logger will
|
|
14
|
+
// be overwritten" stack trace on every startup. Not actionable on our side.
|
|
15
|
+
const origError = console.error; // eslint-disable-line no-console
|
|
16
|
+
console.error = (...args: unknown[]) => { // eslint-disable-line no-console
|
|
17
|
+
if (typeof args[0] === 'string' && args[0].includes('Current logger will')) return;
|
|
18
|
+
origError.apply(console, args);
|
|
19
|
+
};
|
|
20
|
+
|
|
11
21
|
import {amodalCommands} from './commands/index.js';
|
|
12
22
|
import {loadEnvFile} from './shared/load-env.js';
|
|
13
23
|
|
|
@@ -18,7 +28,11 @@ const raw: unknown = JSON.parse(readFileSync(new URL('../../package.json', impor
|
|
|
18
28
|
if (typeof raw !== 'object' || raw === null || !('version' in raw) || typeof raw.version !== 'string') {
|
|
19
29
|
throw new Error('Failed to read version from package.json');
|
|
20
30
|
}
|
|
21
|
-
|
|
31
|
+
// Detect source build: pnpm-workspace.yaml exists at repo root (4 levels up from dist/src/main.js)
|
|
32
|
+
const isSourceBuild = (() => {
|
|
33
|
+
try { return readFileSync(new URL('../../../../pnpm-workspace.yaml', import.meta.url), 'utf-8').length > 0; } catch { return false; }
|
|
34
|
+
})();
|
|
35
|
+
const pkgVersion = raw.version + (isSourceBuild ? '-dev' : '');
|
|
22
36
|
|
|
23
37
|
const cli = yargs(hideBin(process.argv))
|
|
24
38
|
.scriptName('amodal')
|