@griffin-app/griffin-cli 1.0.5 → 1.0.7
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/README.md +38 -38
- package/dist/cli.js +11 -11
- package/dist/commands/apply.js +7 -7
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/hub/apply.d.ts +1 -1
- package/dist/commands/hub/apply.js +17 -17
- package/dist/commands/hub/login.js +14 -8
- package/dist/commands/hub/monitor.d.ts +8 -0
- package/dist/commands/hub/monitor.js +75 -0
- package/dist/commands/hub/plan.d.ts +2 -2
- package/dist/commands/hub/plan.js +16 -16
- package/dist/commands/hub/run.d.ts +2 -2
- package/dist/commands/hub/run.js +33 -33
- package/dist/commands/hub/runs.d.ts +1 -1
- package/dist/commands/hub/runs.js +4 -4
- package/dist/commands/init.js +28 -12
- package/dist/commands/local/run.d.ts +2 -2
- package/dist/commands/local/run.js +1 -1
- package/dist/commands/plan.d.ts +2 -2
- package/dist/commands/plan.js +7 -7
- package/dist/commands/run-remote.d.ts +1 -1
- package/dist/commands/run-remote.js +10 -10
- package/dist/commands/validate.d.ts +1 -1
- package/dist/commands/validate.js +12 -12
- package/dist/core/apply.d.ts +2 -2
- package/dist/core/apply.js +25 -25
- package/dist/core/apply.test.js +54 -54
- package/dist/core/diff.d.ts +14 -14
- package/dist/core/diff.js +42 -42
- package/dist/core/diff.test.js +34 -34
- package/dist/core/discovery.d.ts +6 -6
- package/dist/core/discovery.js +20 -20
- package/dist/core/monitor-diff.d.ts +41 -0
- package/dist/core/monitor-diff.js +257 -0
- package/dist/core/plan-diff.d.ts +7 -7
- package/dist/core/plan-diff.js +10 -10
- package/dist/core/state.js +2 -2
- package/dist/core/variables.d.ts +5 -5
- package/dist/core/variables.js +7 -7
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/resolve.d.ts +3 -3
- package/dist/resolve.js +9 -4
- package/dist/schemas/payload.d.ts +3 -3
- package/dist/schemas/payload.js +3 -3
- package/dist/schemas/state.d.ts +1 -1
- package/dist/schemas/state.js +2 -2
- package/dist/test-runner.d.ts +1 -1
- package/dist/test-runner.js +13 -13
- package/dist/utils/sdk-error.js +1 -1
- package/package.json +4 -4
package/dist/schemas/state.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Type } from "typebox";
|
|
|
3
3
|
* State file schema for tracking project configuration
|
|
4
4
|
* Stored in .griffin/state.json
|
|
5
5
|
*
|
|
6
|
-
* Note: The hub is now the source of truth for
|
|
6
|
+
* Note: The hub is now the source of truth for monitors.
|
|
7
7
|
* This file only stores configuration (project, environments, runner connection).
|
|
8
8
|
*/
|
|
9
9
|
export const EnvironmentConfigSchema = Type.Object({});
|
|
@@ -15,7 +15,7 @@ export const DiscoveryConfigSchema = Type.Object({
|
|
|
15
15
|
pattern: Type.Optional(Type.String()),
|
|
16
16
|
ignore: Type.Optional(Type.Array(Type.String())),
|
|
17
17
|
});
|
|
18
|
-
// State schema (hub is source of truth for
|
|
18
|
+
// State schema (hub is source of truth for monitors)
|
|
19
19
|
export const StateFileSchema = Type.Object({
|
|
20
20
|
stateVersion: Type.Literal(1),
|
|
21
21
|
projectId: Type.String(),
|
package/dist/test-runner.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "tsx";
|
|
2
2
|
import { ExecutionResult } from "@griffin-app/griffin-plan-executor";
|
|
3
3
|
/**
|
|
4
|
-
* Runs a TypeScript test file and executes the resulting JSON
|
|
4
|
+
* Runs a TypeScript test file and executes the resulting JSON monitor.
|
|
5
5
|
*/
|
|
6
6
|
export declare function runTestFile(filePath: string, envName: string): Promise<ExecutionResult>;
|
package/dist/test-runner.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import "tsx";
|
|
2
2
|
import { Value } from "typebox/value";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { executeMonitorV1, AxiosAdapter, EnvSecretProvider, SecretProviderRegistry, } from "@griffin-app/griffin-plan-executor";
|
|
4
|
+
import { MonitorDSLSchema } from "@griffin-app/griffin-ts/schema";
|
|
5
5
|
import { randomUUID } from "crypto";
|
|
6
6
|
import { loadVariables } from "./core/variables.js";
|
|
7
7
|
import { getProjectId } from "./core/state.js";
|
|
8
|
-
import {
|
|
8
|
+
import { resolveMonitor } from "./resolve.js";
|
|
9
9
|
import { terminal } from "./utils/terminal.js";
|
|
10
|
-
function validateDsl(
|
|
11
|
-
const errors = Value.Errors(
|
|
10
|
+
function validateDsl(monitor) {
|
|
11
|
+
const errors = Value.Errors(MonitorDSLSchema, monitor);
|
|
12
12
|
if (errors.length > 0) {
|
|
13
|
-
throw new Error(`Invalid
|
|
13
|
+
throw new Error(`Invalid monitor: ${JSON.stringify([...errors], null, 2)}`);
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return monitor;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Runs a TypeScript test file and executes the resulting JSON
|
|
18
|
+
* Runs a TypeScript test file and executes the resulting JSON monitor.
|
|
19
19
|
*/
|
|
20
20
|
export async function runTestFile(filePath, envName) {
|
|
21
21
|
const variables = await loadVariables(envName);
|
|
22
22
|
const projectId = await getProjectId();
|
|
23
23
|
const defaultExport = await import(filePath);
|
|
24
|
-
const
|
|
24
|
+
const rawMonitor = validateDsl(defaultExport.default);
|
|
25
25
|
terminal.dim(`Project ID: ${projectId}`);
|
|
26
|
-
const
|
|
26
|
+
const resolvedMonitor = resolveMonitor(rawMonitor, projectId, envName, variables);
|
|
27
27
|
const secretRegistry = new SecretProviderRegistry();
|
|
28
28
|
secretRegistry.register(new EnvSecretProvider());
|
|
29
29
|
try {
|
|
30
|
-
const result = await
|
|
31
|
-
...
|
|
30
|
+
const result = await executeMonitorV1({
|
|
31
|
+
...resolvedMonitor,
|
|
32
32
|
id: randomUUID(),
|
|
33
33
|
}, "default-org", {
|
|
34
34
|
mode: "local",
|
|
@@ -38,7 +38,7 @@ export async function runTestFile(filePath, envName) {
|
|
|
38
38
|
return result;
|
|
39
39
|
}
|
|
40
40
|
catch (error) {
|
|
41
|
-
throw new Error(`Error executing
|
|
41
|
+
throw new Error(`Error executing monitor: ${error instanceof Error ? error.message : String(error)}`);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
//function findWorkspaceRoot(): string {
|
package/dist/utils/sdk-error.js
CHANGED
|
@@ -37,7 +37,7 @@ export function handleSDKError(error, context) {
|
|
|
37
37
|
case 404:
|
|
38
38
|
terminal.error(`${contextMsg}Resource not found`);
|
|
39
39
|
if (sdkError.url) {
|
|
40
|
-
terminal.dim(`
|
|
40
|
+
terminal.dim(`URL: ${sdkError.url}`);
|
|
41
41
|
}
|
|
42
42
|
terminal.dim("The requested resource may not exist on the hub.");
|
|
43
43
|
return terminal.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griffin-app/griffin-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "CLI tool for running and managing griffin API tests",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@griffin-app/griffin-hub-sdk": "1.0.
|
|
27
|
-
"@griffin-app/griffin-plan-executor": "0.1.
|
|
28
|
-
"@griffin-app/griffin-ts": "0.1.
|
|
26
|
+
"@griffin-app/griffin-hub-sdk": "1.0.7",
|
|
27
|
+
"@griffin-app/griffin-plan-executor": "0.1.14",
|
|
28
|
+
"@griffin-app/griffin-ts": "0.1.14",
|
|
29
29
|
"better-auth": "^1.4.17",
|
|
30
30
|
"cli-table3": "^0.6.5",
|
|
31
31
|
"commander": "^12.1.0",
|