@griffin-app/griffin-cli 1.0.36 → 1.0.37

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.
Files changed (45) hide show
  1. package/dist/commands/apply.d.ts +9 -0
  2. package/dist/commands/apply.js +76 -0
  3. package/dist/commands/config.d.ts +36 -0
  4. package/dist/commands/config.js +144 -0
  5. package/dist/commands/configure-runner-host.d.ts +2 -0
  6. package/dist/commands/configure-runner-host.js +41 -0
  7. package/dist/commands/deploy.d.ts +1 -0
  8. package/dist/commands/deploy.js +36 -0
  9. package/dist/commands/execute-remote.d.ts +1 -0
  10. package/dist/commands/execute-remote.js +33 -0
  11. package/dist/commands/hub/config.d.ts +27 -0
  12. package/dist/commands/hub/config.js +102 -0
  13. package/dist/commands/hub/plan.d.ts +8 -0
  14. package/dist/commands/hub/plan.js +75 -0
  15. package/dist/commands/local/config.d.ts +28 -0
  16. package/dist/commands/local/config.js +82 -0
  17. package/dist/commands/logs.d.ts +1 -0
  18. package/dist/commands/logs.js +20 -0
  19. package/dist/commands/plan.d.ts +8 -0
  20. package/dist/commands/plan.js +58 -0
  21. package/dist/commands/run-remote.d.ts +11 -0
  22. package/dist/commands/run-remote.js +98 -0
  23. package/dist/commands/run.d.ts +4 -0
  24. package/dist/commands/run.js +86 -0
  25. package/dist/commands/runner.d.ts +12 -0
  26. package/dist/commands/runner.js +53 -0
  27. package/dist/commands/status.d.ts +8 -0
  28. package/dist/commands/status.js +75 -0
  29. package/dist/core/plan-diff.d.ts +41 -0
  30. package/dist/core/plan-diff.js +257 -0
  31. package/dist/output/context.d.ts +18 -0
  32. package/dist/output/context.js +22 -0
  33. package/dist/output/index.d.ts +3 -0
  34. package/dist/output/index.js +2 -0
  35. package/dist/output/renderer.d.ts +6 -0
  36. package/dist/output/renderer.js +348 -0
  37. package/dist/output/types.d.ts +153 -0
  38. package/dist/output/types.js +1 -0
  39. package/dist/providers/registry.js +15 -29
  40. package/dist/schemas/payload.d.ts +6 -0
  41. package/dist/schemas/payload.js +8 -0
  42. package/dist/test-runner.js +5 -4
  43. package/dist/utils/console.d.ts +5 -0
  44. package/dist/utils/console.js +5 -0
  45. package/package.json +2 -2
@@ -0,0 +1,153 @@
1
+ import type { ApplyResult } from "../core/apply.js";
2
+ import type { DiffResult } from "../core/diff.js";
3
+ /**
4
+ * Base result type for all CLI commands.
5
+ * Discriminated union: success yields data; failure yields error and optional hint.
6
+ * exitCode: if set, used when exiting (default 0 for success, 1 for failure).
7
+ */
8
+ export type CommandResult<T> = {
9
+ success: true;
10
+ data: T;
11
+ warnings?: string[];
12
+ exitCode?: number;
13
+ } | {
14
+ success: false;
15
+ error: string;
16
+ hint?: string;
17
+ exitCode?: number;
18
+ };
19
+ export interface InitResultData {
20
+ projectId: string;
21
+ stateFile: string;
22
+ environments: string[];
23
+ variablesCreated: boolean;
24
+ nextSteps: string[];
25
+ }
26
+ export interface ConnectResultData {
27
+ url: string;
28
+ tokenSet: boolean;
29
+ }
30
+ export interface LoginResultData {
31
+ success: true;
32
+ }
33
+ export interface LogoutResultData {
34
+ success: true;
35
+ }
36
+ export interface GenerateKeyResultData {
37
+ apiKey: string;
38
+ }
39
+ export interface ValidateMonitorInfo {
40
+ name: string;
41
+ filePath: string;
42
+ exportName: string;
43
+ nodes: number;
44
+ edges: number;
45
+ frequency?: {
46
+ every: number;
47
+ unit: string;
48
+ };
49
+ }
50
+ export interface ValidateResultData {
51
+ monitors: ValidateMonitorInfo[];
52
+ valid: boolean;
53
+ }
54
+ export interface EnvListResultData {
55
+ environments: string[];
56
+ default: string | null;
57
+ }
58
+ export interface StatusResultData {
59
+ url: string;
60
+ token: string | null;
61
+ updatedAt: string | null;
62
+ }
63
+ export interface RunSummary {
64
+ id: string;
65
+ monitorId: string | null;
66
+ status: string;
67
+ success?: boolean;
68
+ duration_ms?: number;
69
+ startedAt: string;
70
+ errors?: string[];
71
+ }
72
+ export interface RunsResultData {
73
+ runs: RunSummary[];
74
+ total: number;
75
+ }
76
+ export interface MetricsResultData {
77
+ period: string;
78
+ periodStart: string;
79
+ periodEnd: string;
80
+ monitors: {
81
+ total: number;
82
+ passing: number;
83
+ failing: number;
84
+ noRecentRuns: number;
85
+ };
86
+ runs: {
87
+ total: number;
88
+ successful: number;
89
+ failed: number;
90
+ successRate: number;
91
+ };
92
+ latency: {
93
+ p50DurationMs: number | null;
94
+ p95DurationMs: number | null;
95
+ p99DurationMs: number | null;
96
+ };
97
+ uptimePercent: number;
98
+ failingMonitors: Array<{
99
+ monitorId: string;
100
+ monitorName: string;
101
+ lastFailureAt: string;
102
+ consecutiveFailures: number;
103
+ }>;
104
+ }
105
+ export interface MonitorResultData {
106
+ diff: DiffResult;
107
+ hasChanges: boolean;
108
+ }
109
+ export interface ApplyResultData {
110
+ diff: DiffResult;
111
+ applied: ApplyResult;
112
+ dryRun: boolean;
113
+ }
114
+ export interface LocalRunResultData {
115
+ results: Array<{
116
+ file: string;
117
+ success: boolean;
118
+ }>;
119
+ passed: number;
120
+ failed: number;
121
+ total: number;
122
+ }
123
+ export interface HubRunResultData {
124
+ runId: string;
125
+ status: string;
126
+ success?: boolean;
127
+ duration_ms?: number;
128
+ startedAt: string;
129
+ errors?: string[];
130
+ waited?: boolean;
131
+ }
132
+ export interface NotificationRuleSummary {
133
+ id: string;
134
+ name: string;
135
+ monitorId: string | null;
136
+ trigger: unknown;
137
+ channels: string[];
138
+ enabled: boolean;
139
+ }
140
+ export interface NotificationsListResultData {
141
+ rules: NotificationRuleSummary[];
142
+ }
143
+ export interface NotificationsAddResultData {
144
+ id: string;
145
+ name: string;
146
+ }
147
+ export interface NotificationsDeleteResultData {
148
+ id: string;
149
+ }
150
+ export interface NotificationsTestResultData {
151
+ success: boolean;
152
+ message: string;
153
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -24,35 +24,21 @@ const providers = [
24
24
  authMethod: "credentials",
25
25
  configFields: [{ key: "url", label: "Webhook URL", required: true }],
26
26
  },
27
- {
28
- category: "notifications",
29
- provider: "slack_webhook",
30
- displayName: "Slack Webhook",
31
- authMethod: "credentials",
32
- credentialFields: [
33
- {
34
- key: "webhook_url",
35
- label: "Webhook URL",
36
- secret: true,
37
- required: true,
38
- },
39
- ],
40
- },
41
- {
42
- category: "notifications",
43
- provider: "email",
44
- displayName: "Email (SES)",
45
- authMethod: "credentials",
46
- configFields: [
47
- { key: "fromAddress", label: "From Address", required: true },
48
- { key: "sesRegion", label: "SES Region", required: true },
49
- {
50
- key: "toAddresses",
51
- label: "To Addresses (comma-separated)",
52
- required: true,
53
- },
54
- ],
55
- },
27
+ //{
28
+ // category: "notifications",
29
+ // provider: "email",
30
+ // displayName: "Email (SES)",
31
+ // authMethod: "credentials",
32
+ // configFields: [
33
+ // { key: "fromAddress", label: "From Address", required: true },
34
+ // { key: "sesRegion", label: "SES Region", required: true },
35
+ // {
36
+ // key: "toAddresses",
37
+ // label: "To Addresses (comma-separated)",
38
+ // required: true,
39
+ // },
40
+ // ],
41
+ //},
56
42
  // Secrets - Credentials
57
43
  {
58
44
  category: "secrets",
@@ -0,0 +1,6 @@
1
+ import { type TestMonitorV1 } from "griffin-hub-sdk";
2
+ /**
3
+ * Compute a deterministic hash of a monitor payload.
4
+ * Used for change detection.
5
+ */
6
+ export declare function hashMonitorPayload(monitor: TestMonitorV1): string;
@@ -0,0 +1,8 @@
1
+ import objectHash from "object-hash";
2
+ /**
3
+ * Compute a deterministic hash of a monitor payload.
4
+ * Used for change detection.
5
+ */
6
+ export function hashMonitorPayload(monitor) {
7
+ return objectHash(monitor);
8
+ }
@@ -1,12 +1,13 @@
1
1
  import "tsx";
2
2
  import { Value } from "typebox/value";
3
- import { executeMonitorV1, AxiosAdapter, EnvSecretProvider, SecretProviderRegistry, } from "@griffin-app/griffin-plan-executor";
3
+ import { executeMonitorV1, AxiosAdapter, } from "@griffin-app/griffin-plan-executor";
4
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
8
  import { resolveMonitor } from "./resolve.js";
9
9
  import { terminal } from "./utils/terminal.js";
10
+ import { createSecretsProviderForCLI } from "./core/secrets.js";
10
11
  function validateDsl(monitor) {
11
12
  const errors = Value.Errors(MonitorDSLSchema, monitor);
12
13
  if (errors.length > 0) {
@@ -24,8 +25,8 @@ export async function runTestFile(filePath, envName) {
24
25
  const rawMonitor = validateDsl(defaultExport.default);
25
26
  terminal.dim(`Project ID: ${projectId}`);
26
27
  const resolvedMonitor = resolveMonitor(rawMonitor, projectId, envName, variables);
27
- const secretRegistry = new SecretProviderRegistry();
28
- secretRegistry.setProvider(new EnvSecretProvider());
28
+ // Create secret provider from environment configuration
29
+ const secretProvider = await createSecretsProviderForCLI();
29
30
  try {
30
31
  const result = await executeMonitorV1({
31
32
  ...resolvedMonitor,
@@ -33,7 +34,7 @@ export async function runTestFile(filePath, envName) {
33
34
  }, "default-org", {
34
35
  mode: "local",
35
36
  httpClient: new AxiosAdapter(),
36
- secretRegistry: secretRegistry,
37
+ secretProvider,
37
38
  });
38
39
  return result;
39
40
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @deprecated Use terminal from "./terminal.js" instead
3
+ * This file is kept for backwards compatibility
4
+ */
5
+ export { terminal as console, colors } from "./terminal.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @deprecated Use terminal from "./terminal.js" instead
3
+ * This file is kept for backwards compatibility
4
+ */
5
+ export { terminal as console, colors } from "./terminal.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@griffin-app/griffin-cli",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "CLI tool for running and managing griffin API tests",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "author": "",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@griffin-app/griffin-core": "0.3.1",
27
+ "@griffin-app/griffin-core": "0.3.2",
28
28
  "@griffin-app/griffin-executor": "0.2.1",
29
29
  "@griffin-app/griffin-hub-sdk": "1.0.31",
30
30
  "better-auth": "^1.4.17",