@fluidgrids/cli 0.0.0-stage → 2026.1028.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 +9 -0
- package/README.md +219 -2
- package/dist/auth/device-login.d.ts +31 -0
- package/dist/auth/device-login.d.ts.map +1 -0
- package/dist/auth/device-login.js +75 -0
- package/dist/auth/device-login.js.map +1 -0
- package/dist/auth/token-auth.d.ts +49 -0
- package/dist/auth/token-auth.d.ts.map +1 -0
- package/dist/auth/token-auth.js +279 -0
- package/dist/auth/token-auth.js.map +1 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +37 -0
- package/dist/cli.js.map +1 -0
- package/dist/code-first/api.d.ts +170 -0
- package/dist/code-first/api.d.ts.map +1 -0
- package/dist/code-first/api.js +166 -0
- package/dist/code-first/api.js.map +1 -0
- package/dist/code-first/commands/codegen.d.ts +20 -0
- package/dist/code-first/commands/codegen.d.ts.map +1 -0
- package/dist/code-first/commands/codegen.js +50 -0
- package/dist/code-first/commands/codegen.js.map +1 -0
- package/dist/code-first/commands/diff.d.ts +28 -0
- package/dist/code-first/commands/diff.d.ts.map +1 -0
- package/dist/code-first/commands/diff.js +73 -0
- package/dist/code-first/commands/diff.js.map +1 -0
- package/dist/code-first/commands/import.d.ts +40 -0
- package/dist/code-first/commands/import.d.ts.map +1 -0
- package/dist/code-first/commands/import.js +235 -0
- package/dist/code-first/commands/import.js.map +1 -0
- package/dist/code-first/commands/init.d.ts +33 -0
- package/dist/code-first/commands/init.d.ts.map +1 -0
- package/dist/code-first/commands/init.js +177 -0
- package/dist/code-first/commands/init.js.map +1 -0
- package/dist/code-first/commands/interface.d.ts +12 -0
- package/dist/code-first/commands/interface.d.ts.map +1 -0
- package/dist/code-first/commands/interface.js +21 -0
- package/dist/code-first/commands/interface.js.map +1 -0
- package/dist/code-first/commands/pull.d.ts +63 -0
- package/dist/code-first/commands/pull.d.ts.map +1 -0
- package/dist/code-first/commands/pull.js +266 -0
- package/dist/code-first/commands/pull.js.map +1 -0
- package/dist/code-first/commands/push.d.ts +51 -0
- package/dist/code-first/commands/push.d.ts.map +1 -0
- package/dist/code-first/commands/push.js +217 -0
- package/dist/code-first/commands/push.js.map +1 -0
- package/dist/code-first/commands/validate.d.ts +34 -0
- package/dist/code-first/commands/validate.d.ts.map +1 -0
- package/dist/code-first/commands/validate.js +115 -0
- package/dist/code-first/commands/validate.js.map +1 -0
- package/dist/code-first/connections.d.ts +55 -0
- package/dist/code-first/connections.d.ts.map +1 -0
- package/dist/code-first/connections.js +180 -0
- package/dist/code-first/connections.js.map +1 -0
- package/dist/code-first/index.d.ts +14 -0
- package/dist/code-first/index.d.ts.map +1 -0
- package/dist/code-first/index.js +31 -0
- package/dist/code-first/index.js.map +1 -0
- package/dist/code-first/lowering.d.ts +42 -0
- package/dist/code-first/lowering.d.ts.map +1 -0
- package/dist/code-first/lowering.js +128 -0
- package/dist/code-first/lowering.js.map +1 -0
- package/dist/code-first/operations.d.ts +57 -0
- package/dist/code-first/operations.d.ts.map +1 -0
- package/dist/code-first/operations.js +167 -0
- package/dist/code-first/operations.js.map +1 -0
- package/dist/code-first/project.d.ts +114 -0
- package/dist/code-first/project.d.ts.map +1 -0
- package/dist/code-first/project.js +279 -0
- package/dist/code-first/project.js.map +1 -0
- package/dist/code-first/python.d.ts +70 -0
- package/dist/code-first/python.d.ts.map +1 -0
- package/dist/code-first/python.js +219 -0
- package/dist/code-first/python.js.map +1 -0
- package/dist/code-first/register.d.ts +21 -0
- package/dist/code-first/register.d.ts.map +1 -0
- package/dist/code-first/register.js +126 -0
- package/dist/code-first/register.js.map +1 -0
- package/dist/code-first/remote.d.ts +58 -0
- package/dist/code-first/remote.d.ts.map +1 -0
- package/dist/code-first/remote.js +120 -0
- package/dist/code-first/remote.js.map +1 -0
- package/dist/code-first/shared.d.ts +39 -0
- package/dist/code-first/shared.d.ts.map +1 -0
- package/dist/code-first/shared.js +57 -0
- package/dist/code-first/shared.js.map +1 -0
- package/dist/modules.d.ts +15 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +61 -0
- package/dist/modules.js.map +1 -0
- package/dist/product-defaults.d.ts +11 -0
- package/dist/product-defaults.d.ts.map +1 -0
- package/dist/product-defaults.js +25 -0
- package/dist/product-defaults.js.map +1 -0
- package/dist/program.d.ts +20 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +43 -0
- package/dist/program.js.map +1 -0
- package/package.json +100 -4
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comparing local workflows with stored versions.
|
|
3
|
+
*
|
|
4
|
+
* A stored canvas definition has no `key` (the key lives on the row), and code
|
|
5
|
+
* never carries pinned TEST data unless a `workflows/<key>.pinned.json` sidecar
|
|
6
|
+
* exists (spec 07 §3 rule 10). Both are therefore aligned before hashing, and
|
|
7
|
+
* a push keeps the stored pinned data instead of silently dropping it.
|
|
8
|
+
*/
|
|
9
|
+
import { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
10
|
+
import { irHash, normalizeDefinition } from '@fluidgrids/workflows/ir';
|
|
11
|
+
import { listSourcePaths, WORKFLOWS_DIR } from './project.js';
|
|
12
|
+
import { buildConnectionIndex, adaptersInDefinitions, } from './connections.js';
|
|
13
|
+
function isRecord(value) {
|
|
14
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
/** Versions oldest first. */
|
|
17
|
+
export function sortVersions(versions) {
|
|
18
|
+
return [...versions].sort((a, b) => a.createdAt < b.createdAt ? -1 : a.createdAt > b.createdAt ? 1 : 0);
|
|
19
|
+
}
|
|
20
|
+
/** `latest` (newest), `active` (the ACTIVE version) or an exact version string. */
|
|
21
|
+
export function pickVersion(versions, against) {
|
|
22
|
+
const sorted = sortVersions(versions);
|
|
23
|
+
if (against === 'latest')
|
|
24
|
+
return sorted[sorted.length - 1];
|
|
25
|
+
if (against === 'active')
|
|
26
|
+
return sorted.filter((version) => version.isActive).pop();
|
|
27
|
+
return sorted.find((version) => version.version === against);
|
|
28
|
+
}
|
|
29
|
+
/** The stored definition normalised, with its workflow key, as lowering would produce it. */
|
|
30
|
+
export function comparableRemote(definition, workflowKey) {
|
|
31
|
+
const normalized = normalizeDefinition(definition);
|
|
32
|
+
if (!isRecord(normalized)) {
|
|
33
|
+
throw new CliUserError(`The stored definition of ${workflowKey} is not an object.`);
|
|
34
|
+
}
|
|
35
|
+
const copy = { ...normalized };
|
|
36
|
+
if (typeof copy['key'] !== 'string' || copy['key'] === '')
|
|
37
|
+
copy['key'] = workflowKey;
|
|
38
|
+
return copy;
|
|
39
|
+
}
|
|
40
|
+
/** The local definition as it would be stored: stored pinned data is kept when code has none. */
|
|
41
|
+
export function outgoingDefinition(local, remote) {
|
|
42
|
+
if (!remote || local['pinnedData'] !== undefined || remote['pinnedData'] === undefined) {
|
|
43
|
+
return local;
|
|
44
|
+
}
|
|
45
|
+
return { ...local, pinnedData: remote['pinnedData'] };
|
|
46
|
+
}
|
|
47
|
+
export function sameContent(a, b) {
|
|
48
|
+
return irHash(a) === irHash(b);
|
|
49
|
+
}
|
|
50
|
+
/** Fetches each key's versions and the export of the requested version once. */
|
|
51
|
+
export class RemoteWorkflows {
|
|
52
|
+
api;
|
|
53
|
+
against;
|
|
54
|
+
cache = new Map();
|
|
55
|
+
constructor(api, against = 'latest') {
|
|
56
|
+
this.api = api;
|
|
57
|
+
this.against = against;
|
|
58
|
+
}
|
|
59
|
+
get(key) {
|
|
60
|
+
let entry = this.cache.get(key);
|
|
61
|
+
if (!entry) {
|
|
62
|
+
entry = this.load(key);
|
|
63
|
+
this.cache.set(key, entry);
|
|
64
|
+
}
|
|
65
|
+
return entry;
|
|
66
|
+
}
|
|
67
|
+
async load(key) {
|
|
68
|
+
const versions = sortVersions(await this.api.workflowVersions(key));
|
|
69
|
+
if (versions.length === 0)
|
|
70
|
+
return { key, versions };
|
|
71
|
+
const target = pickVersion(versions, this.against);
|
|
72
|
+
if (!target) {
|
|
73
|
+
throw new CliUserError(this.against === 'active'
|
|
74
|
+
? `${key} has no ACTIVE version.`
|
|
75
|
+
: `${key} has no version "${this.against}".`, { hint: `Stored versions: ${versions.map((version) => version.version).join(', ')}` });
|
|
76
|
+
}
|
|
77
|
+
return { key, versions, export: await this.api.exportWorkflow(key, target.version) };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The workspace's connections indexed by name. The node registry is fetched
|
|
82
|
+
* only when some connection is not already bound by one of `remoteDefinitions`.
|
|
83
|
+
*/
|
|
84
|
+
export async function loadConnectionIndex(api, remoteDefinitions, registry) {
|
|
85
|
+
const connections = await api.connections();
|
|
86
|
+
const bound = adaptersInDefinitions(remoteDefinitions);
|
|
87
|
+
const needsRegistry = connections.some((connection) => !bound.has(connection.id));
|
|
88
|
+
const manifests = registry ?? (needsRegistry ? await api.nodeManifests() : undefined);
|
|
89
|
+
return {
|
|
90
|
+
index: buildConnectionIndex(connections, {
|
|
91
|
+
remoteDefinitions,
|
|
92
|
+
...(manifests ? { registry: manifests } : {}),
|
|
93
|
+
}),
|
|
94
|
+
...(manifests ? { registry: manifests } : {}),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Keys the project probably defines, before lowering tells for sure: named
|
|
99
|
+
* keys, tracked keys and workflow file stems (a Python stem `lead_enrichment`
|
|
100
|
+
* also as `lead-enrichment`). Fetching a key that does not exist is harmless.
|
|
101
|
+
*/
|
|
102
|
+
export function likelyKeys(project, requested) {
|
|
103
|
+
const stems = listSourcePaths(project.root)
|
|
104
|
+
.filter((path) => path.startsWith(`${WORKFLOWS_DIR}/`))
|
|
105
|
+
.map((path) => path.slice(path.lastIndexOf('/') + 1).split('.')[0] ?? '')
|
|
106
|
+
.filter((stem) => stem !== '' && !stem.startsWith('_'))
|
|
107
|
+
.flatMap((stem) => (stem.includes('_') ? [stem, stem.replace(/_/g, '-')] : [stem]));
|
|
108
|
+
return [...new Set([...requested, ...Object.keys(project.lock.workflows), ...stems])].sort();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The connection index for lowering this project: the latest stored version of
|
|
112
|
+
* every key the project probably defines is read first, because those say
|
|
113
|
+
* which adapter each connection is bound to.
|
|
114
|
+
*/
|
|
115
|
+
export async function projectConnectionIndex(api, project, keys, latest = new RemoteWorkflows(api, 'latest')) {
|
|
116
|
+
const prefetched = await Promise.all(likelyKeys(project, keys).map((key) => latest.get(key)));
|
|
117
|
+
const { index } = await loadConnectionIndex(api, prefetched.flatMap((entry) => (entry.export ? [entry.export.definitionJson] : [])));
|
|
118
|
+
return index;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/code-first/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAC5E,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,kBAAkB,CAAC;AAE1B,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,6BAA6B;AAC7B,MAAM,UAAU,YAAY,CAAC,QAAkC;IAC7D,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACjC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,C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AU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9F,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,mBAAmB,CACzC,GAAG,EACH,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CACnF,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Helpers shared by the code-first commands. */
|
|
2
|
+
import { type CLIContext, type TableConfig } from '@burdenoff/cli-sdk/core';
|
|
3
|
+
import type { Command } from 'commander';
|
|
4
|
+
import { type DeviceLoginResult } from '../auth/device-login.js';
|
|
5
|
+
import { type CodeFirstApi } from './api.js';
|
|
6
|
+
export interface OutputOptions {
|
|
7
|
+
format?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProjectOptions extends OutputOptions {
|
|
10
|
+
project?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Dependencies a command needs; tests substitute them. */
|
|
13
|
+
export interface CommandEnv {
|
|
14
|
+
ctx: CLIContext;
|
|
15
|
+
api: CodeFirstApi;
|
|
16
|
+
cwd: () => string;
|
|
17
|
+
/** True when a person can answer the device-code prompt (stdin and stdout are terminals). */
|
|
18
|
+
interactive: () => boolean;
|
|
19
|
+
/** The device-code login (`fluidgrids auth login`'s flow, without prompts). */
|
|
20
|
+
login: (workspaceId?: string) => Promise<DeviceLoginResult>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createCommandEnv(ctx: CLIContext): CommandEnv;
|
|
23
|
+
/**
|
|
24
|
+
* Print a result: the table plus detail lines for people, the data itself for
|
|
25
|
+
* `--format json|yaml` (where the details are already part of the data).
|
|
26
|
+
*/
|
|
27
|
+
export declare function emit(env: CommandEnv, options: OutputOptions, data: unknown, table: TableConfig, details?: readonly string[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* The command's options with the CLI-wide `-f/--format` filled in. Commander
|
|
30
|
+
* lets the program claim `-f` wherever it appears on the line, so a command's
|
|
31
|
+
* own `format` option can stay undefined; this reads the program's value then.
|
|
32
|
+
*/
|
|
33
|
+
export declare function withGlobalFormat<T extends OutputOptions>(options: T, command: Command): T;
|
|
34
|
+
/** A closed-set option value; undefined passes through. */
|
|
35
|
+
export declare function parseChoice<T extends string>(raw: string | undefined, flag: string, allowed: readonly T[]): T | undefined;
|
|
36
|
+
/** Keys named on the command line that the local project does not define. */
|
|
37
|
+
export declare function requireKnownKeys(requested: readonly string[], known: readonly string[]): void;
|
|
38
|
+
export declare function describeError(error: unknown): string;
|
|
39
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/code-first/shared.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,EAAgB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,UAAU,CAAC;IAChB,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,6FAA6F;IAC7F,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,+EAA+E;IAC/E,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC7D;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAQ5D;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAClB,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,SAAS,MAAM,EAAO,GAC9B,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,aAAa,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,CAIzF;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,CAAC,EAAE,GACpB,CAAC,GAAG,SAAS,CAOf;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAQ7F;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Helpers shared by the code-first commands. */
|
|
2
|
+
import { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
3
|
+
import { deviceCodeLogin } from '../auth/device-login.js';
|
|
4
|
+
import { createCodeFirstApi } from './api.js';
|
|
5
|
+
export function createCommandEnv(ctx) {
|
|
6
|
+
return {
|
|
7
|
+
ctx,
|
|
8
|
+
api: createCodeFirstApi(ctx),
|
|
9
|
+
cwd: () => process.cwd(),
|
|
10
|
+
interactive: () => process.stdin.isTTY === true && process.stdout.isTTY === true,
|
|
11
|
+
login: (workspaceId) => deviceCodeLogin(ctx, workspaceId ? { workspaceId } : {}),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Print a result: the table plus detail lines for people, the data itself for
|
|
16
|
+
* `--format json|yaml` (where the details are already part of the data).
|
|
17
|
+
*/
|
|
18
|
+
export function emit(env, options, data, table, details = []) {
|
|
19
|
+
const { output } = env.ctx;
|
|
20
|
+
output.formatAndOutput(options, data, table);
|
|
21
|
+
if (output.getFormat(options) === 'table') {
|
|
22
|
+
for (const line of details)
|
|
23
|
+
console.log(line);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The command's options with the CLI-wide `-f/--format` filled in. Commander
|
|
28
|
+
* lets the program claim `-f` wherever it appears on the line, so a command's
|
|
29
|
+
* own `format` option can stay undefined; this reads the program's value then.
|
|
30
|
+
*/
|
|
31
|
+
export function withGlobalFormat(options, command) {
|
|
32
|
+
if (options.format !== undefined)
|
|
33
|
+
return options;
|
|
34
|
+
const format = command.optsWithGlobals()['format'];
|
|
35
|
+
return typeof format === 'string' ? { ...options, format } : options;
|
|
36
|
+
}
|
|
37
|
+
/** A closed-set option value; undefined passes through. */
|
|
38
|
+
export function parseChoice(raw, flag, allowed) {
|
|
39
|
+
if (raw === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
const match = allowed.find((value) => value === raw);
|
|
42
|
+
if (match === undefined) {
|
|
43
|
+
throw new CliUserError(`Invalid value '${raw}' for ${flag}. Allowed: ${allowed.join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
return match;
|
|
46
|
+
}
|
|
47
|
+
/** Keys named on the command line that the local project does not define. */
|
|
48
|
+
export function requireKnownKeys(requested, known) {
|
|
49
|
+
const missing = requested.filter((key) => !known.includes(key));
|
|
50
|
+
if (missing.length > 0) {
|
|
51
|
+
throw new CliUserError(`Not defined in this project: ${missing.join(', ')}`, known.length > 0 ? { hint: `Defined here: ${known.join(', ')}` } : undefined);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function describeError(error) {
|
|
55
|
+
return error instanceof Error ? error.message : String(error);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/code-first/shared.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,EAAE,YAAY,EAAqC,MAAM,yBAAyB,CAAC;AAG1F,OAAO,EAAE,eAAe,EAA0B,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAqB,MAAM,UAAU,CAAC;AAqBjE,MAAM,UAAU,gBAAgB,CAAC,GAAe;IAC9C,OAAO;QACL,GAAG;QACH,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC;QAC5B,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;QAChF,KAAK,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,IAAI,CAClB,GAAe,EACf,OAAsB,EACtB,IAAa,EACb,KAAkB,EAClB,UAA6B,EAAE;IAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC;IAC3B,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,OAAO,EAAE,C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E,EACpD,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAC7E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cli-sdk modules this shell mounts: the FluidGrids domain module plus the
|
|
3
|
+
* shared platform modules. Kept in one list so the shell and its tests mount
|
|
4
|
+
* exactly the same surface.
|
|
5
|
+
*
|
|
6
|
+
* `codeFirstModule` is product-local (src/code-first/): the code-first workflow
|
|
7
|
+
* commands depend on @fluidgrids/workflows, which other product CLIs must not
|
|
8
|
+
* pull in through cli-sdk.
|
|
9
|
+
*
|
|
10
|
+
* Not mounted: `vibecontrols` (another product; it also owns a top-level
|
|
11
|
+
* `webhooks` group) and `sandbox` (VibeControls dev environments).
|
|
12
|
+
*/
|
|
13
|
+
import type { CliModule } from '@burdenoff/cli-sdk/core';
|
|
14
|
+
export declare const modules: readonly CliModule[];
|
|
15
|
+
//# sourceMappingURL=modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AA0BzD,eAAO,MAAM,OAAO,EAAE,SAAS,SAAS,EAwBvC,CAAC"}
|
package/dist/modules.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cli-sdk modules this shell mounts: the FluidGrids domain module plus the
|
|
3
|
+
* shared platform modules. Kept in one list so the shell and its tests mount
|
|
4
|
+
* exactly the same surface.
|
|
5
|
+
*
|
|
6
|
+
* `codeFirstModule` is product-local (src/code-first/): the code-first workflow
|
|
7
|
+
* commands depend on @fluidgrids/workflows, which other product CLIs must not
|
|
8
|
+
* pull in through cli-sdk.
|
|
9
|
+
*
|
|
10
|
+
* Not mounted: `vibecontrols` (another product; it also owns a top-level
|
|
11
|
+
* `webhooks` group) and `sandbox` (VibeControls dev environments).
|
|
12
|
+
*/
|
|
13
|
+
import authModule from '@burdenoff/cli-sdk/modules/auth';
|
|
14
|
+
import workspacesModule from '@burdenoff/cli-sdk/modules/workspaces';
|
|
15
|
+
import organizationsModule from '@burdenoff/cli-sdk/modules/organizations';
|
|
16
|
+
import toursModule from '@burdenoff/cli-sdk/modules/tours';
|
|
17
|
+
import rbacModule from '@burdenoff/cli-sdk/modules/rbac';
|
|
18
|
+
import fluidgridsModule from '@burdenoff/cli-sdk/modules/fluidgrids';
|
|
19
|
+
import tagsModule from '@burdenoff/cli-sdk/modules/tags';
|
|
20
|
+
import filesModule from '@burdenoff/cli-sdk/modules/files';
|
|
21
|
+
import groupsModule from '@burdenoff/cli-sdk/modules/groups';
|
|
22
|
+
import conversationsModule from '@burdenoff/cli-sdk/modules/conversations';
|
|
23
|
+
import securityModule from '@burdenoff/cli-sdk/modules/security';
|
|
24
|
+
import integrationsModule from '@burdenoff/cli-sdk/modules/integrations';
|
|
25
|
+
import channelsModule from '@burdenoff/cli-sdk/modules/channels';
|
|
26
|
+
import schedulerModule from '@burdenoff/cli-sdk/modules/scheduler';
|
|
27
|
+
import exportModule from '@burdenoff/cli-sdk/modules/export';
|
|
28
|
+
import notificationsModule from '@burdenoff/cli-sdk/modules/notifications';
|
|
29
|
+
import supportModule from '@burdenoff/cli-sdk/modules/support';
|
|
30
|
+
import productsModule from '@burdenoff/cli-sdk/modules/products';
|
|
31
|
+
import billingModule from '@burdenoff/cli-sdk/modules/billing';
|
|
32
|
+
import storeModule from '@burdenoff/cli-sdk/modules/store';
|
|
33
|
+
import devportalModule from '@burdenoff/cli-sdk/modules/devportal';
|
|
34
|
+
import healthModule from '@burdenoff/cli-sdk/modules/health';
|
|
35
|
+
import codeFirstModule from './code-first/index.js';
|
|
36
|
+
export const modules = [
|
|
37
|
+
authModule,
|
|
38
|
+
workspacesModule,
|
|
39
|
+
organizationsModule,
|
|
40
|
+
toursModule,
|
|
41
|
+
rbacModule,
|
|
42
|
+
fluidgridsModule,
|
|
43
|
+
tagsModule,
|
|
44
|
+
filesModule,
|
|
45
|
+
groupsModule,
|
|
46
|
+
conversationsModule,
|
|
47
|
+
securityModule,
|
|
48
|
+
integrationsModule,
|
|
49
|
+
channelsModule,
|
|
50
|
+
schedulerModule,
|
|
51
|
+
exportModule,
|
|
52
|
+
notificationsModule,
|
|
53
|
+
supportModule,
|
|
54
|
+
productsModule,
|
|
55
|
+
billingModule,
|
|
56
|
+
storeModule,
|
|
57
|
+
devportalModule,
|
|
58
|
+
healthModule,
|
|
59
|
+
codeFirstModule,
|
|
60
|
+
];
|
|
61
|
+
//# sourceMappingURL=modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,UAAU,MAAM,iCAAiC,CAAC;AACzD,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AACrE,OAAO,mBAAmB,MAAM,0CAA0C,CAAC;AAC3E,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,UAAU,MAAM,iCAAiC,CAAC;AACzD,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AACrE,OAAO,UAAU,MAAM,iCAAiC,CAAC;AACzD,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAC7D,OAAO,mBAAmB,MAAM,0CAA0C,CAAC;AAC3E,OAAO,cAAc,MAAM,qCAAqC,CAAC;AACjE,OAAO,kBAAkB,MAAM,yCAAyC,CAAC;AACzE,OAAO,cAAc,MAAM,qCAAqC,CAAC;AACjE,OAAO,eAAe,MAAM,sCAAsC,CAAC;AACnE,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAC7D,OAAO,mBAAmB,MAAM,0CAA0C,CAAC;AAC3E,OAAO,aAAa,MAAM,oCAAoC,CAAC;AAC/D,OAAO,cAAc,MAAM,qCAAqC,CAAC;AACjE,OAAO,aAAa,MAAM,oCAAoC,CAAC;AAC/D,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,eAAe,MAAM,sCAAsC,CAAC;AACnE,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAE7D,OAAO,eAAe,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,MAAM,OAAO,GAAyB;IAC3C,UAAU;IACV,gBAAgB;IAChB,mBAAmB;IACnB,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,UAAU;IACV,WAAW;IACX,YAAY;IACZ,mBAAmB;IACnB,cAAc;IACd,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,YAAY;IACZ,mBAAmB;IACnB,aAAa;IACb,cAAc;IACd,aAAa;IACb,WAAW;IACX,eAAe;IACf,YAAY;IACZ,eAAe;CAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product-specific defaults injected into CLIContext via buildContext().
|
|
3
|
+
* Anything specific to "fluidgrids" (vs other product CLIs) lives here.
|
|
4
|
+
*
|
|
5
|
+
* Defaults point at PROD. Dev users override per-config or via env vars:
|
|
6
|
+
* FLUIDGRIDS_WORKSPACE_ENDPOINT, FLUIDGRIDS_GLOBAL_ENDPOINT, FLUIDGRIDS_OIDC_ISSUER,
|
|
7
|
+
* FLUIDGRIDS_ORIGIN.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProductDefaults } from '@burdenoff/cli-sdk/core';
|
|
10
|
+
export declare const productDefaults: ProductDefaults;
|
|
11
|
+
//# sourceMappingURL=product-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-defaults.d.ts","sourceRoot":"","sources":["../src/product-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,eAAO,MAAM,eAAe,EAAE,eAe7B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product-specific defaults injected into CLIContext via buildContext().
|
|
3
|
+
* Anything specific to "fluidgrids" (vs other product CLIs) lives here.
|
|
4
|
+
*
|
|
5
|
+
* Defaults point at PROD. Dev users override per-config or via env vars:
|
|
6
|
+
* FLUIDGRIDS_WORKSPACE_ENDPOINT, FLUIDGRIDS_GLOBAL_ENDPOINT, FLUIDGRIDS_OIDC_ISSUER,
|
|
7
|
+
* FLUIDGRIDS_ORIGIN.
|
|
8
|
+
*/
|
|
9
|
+
export const productDefaults = {
|
|
10
|
+
configDirName: 'fluidgrids-cli',
|
|
11
|
+
// First-party device-code client registered by global-auth-svc system-apps.
|
|
12
|
+
oidcClientId: 'burdenoff_cli_fluidgrids',
|
|
13
|
+
oidcIssuerProd: 'https://graphql.burdenoff.com/global',
|
|
14
|
+
workspaceEndpointDefault: 'https://graphqlworkspaces.burdenoff.com/workspaces/graphql',
|
|
15
|
+
globalEndpointDefault: 'https://graphql.burdenoff.com/global/graphql',
|
|
16
|
+
envPrefix: 'FLUIDGRIDS',
|
|
17
|
+
// wspace-workflow-svc is product-scoped: the gateway derives the product from
|
|
18
|
+
// Origin, which Node does not send. Override with FLUIDGRIDS_ORIGIN for custom
|
|
19
|
+
// or local gateways.
|
|
20
|
+
productOrigins: {
|
|
21
|
+
'graphqlworkspaces.burdenoff.com': 'https://app.fluidgrids.ai',
|
|
22
|
+
'alphagraphqlworkspaces.burdenoff.com': 'https://alphaapp.fluidgrids.ai',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=product-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-defaults.js","sourceRoot":"","sources":["../src/product-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,aAAa,EAAE,gBAAgB;IAC/B,4EAA4E;IAC5E,YAAY,EAAE,0BAA0B;IACxC,cAAc,EAAE,sCAAsC;IACtD,wBAAwB,EAAE,4DAA4D;IACtF,qBAAqB,EAAE,8CAA8C;IACrE,SAAS,EAAE,YAAY;IACvB,8EAA8E;IAC9E,+EAA+E;IAC/E,qBAAqB;IACrB,cAAc,EAAE;QACd,iCAAiC,EAAE,2BAA2B;QAC9D,sCAAsC,EAAE,gCAAgC;KACzE;CACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the FluidGrids CLI program: the CLIContext with product defaults
|
|
3
|
+
* (switched to token mode when FLUIDGRIDS_TOKEN / --token is set), the mounted
|
|
4
|
+
* modules, and the global options. `cli.ts` runs it; tests build it directly.
|
|
5
|
+
*/
|
|
6
|
+
import { type CLIContext, type OutputAdapter, type ProgramFactoryResult } from '@burdenoff/cli-sdk/core';
|
|
7
|
+
export interface CreateCliOptions {
|
|
8
|
+
argv: readonly string[];
|
|
9
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
10
|
+
version: string;
|
|
11
|
+
output?: OutputAdapter;
|
|
12
|
+
}
|
|
13
|
+
export interface FluidgridsCli extends ProgramFactoryResult {
|
|
14
|
+
ctx: CLIContext;
|
|
15
|
+
/** True when FLUIDGRIDS_TOKEN or --token supplied the credentials. */
|
|
16
|
+
tokenMode: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const HELP_EXAMPLES: readonly string[];
|
|
19
|
+
export declare function createCli(options: CreateCliOptions): FluidgridsCli;
|
|
20
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAMjC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACzD,GAAG,EAAE,UAAU,CAAC;IAChB,sEAAsE;IACtE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAa1C,CAAC;AAEF,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAqBlE"}
|
package/dist/program.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the FluidGrids CLI program: the CLIContext with product defaults
|
|
3
|
+
* (switched to token mode when FLUIDGRIDS_TOKEN / --token is set), the mounted
|
|
4
|
+
* modules, and the global options. `cli.ts` runs it; tests build it directly.
|
|
5
|
+
*/
|
|
6
|
+
import { buildContext, createProgram, } from '@burdenoff/cli-sdk/core';
|
|
7
|
+
import { applyTokenAuth, readTokenAuthSettings, TOKEN_FLAG } from './auth/token-auth.js';
|
|
8
|
+
import { modules } from './modules.js';
|
|
9
|
+
import { productDefaults } from './product-defaults.js';
|
|
10
|
+
export const HELP_EXAMPLES = [
|
|
11
|
+
'$ fluidgrids auth login # OAuth2 Device Code login',
|
|
12
|
+
'$ fluidgrids workspace set <id> # Pick workspace',
|
|
13
|
+
'$ fluidgrids workflows list --status ACTIVE # Workflow definitions',
|
|
14
|
+
'$ fluidgrids workflows trigger <key> --wf-version 1.0.0 --trigger-node start',
|
|
15
|
+
'$ fluidgrids runs wait <runId> # Block until a run finishes',
|
|
16
|
+
'$ fluidgrids init --lang ts # Code-first project',
|
|
17
|
+
'$ fluidgrids pull lead-enrichment --as ts # Workflow as TypeScript',
|
|
18
|
+
'$ fluidgrids push --dry-run # What a push would change',
|
|
19
|
+
'$ FLUIDGRIDS_TOKEN=... fluidgrids diff --exit-code # CI: non-interactive auth',
|
|
20
|
+
'',
|
|
21
|
+
'Configuration: ~/.config/fluidgrids-cli/ (FLUIDGRIDS_TOKEN skips the stored login)',
|
|
22
|
+
'Documentation: https://docs.fluidgrids.ai/developers/cli-reference',
|
|
23
|
+
];
|
|
24
|
+
export function createCli(options) {
|
|
25
|
+
const settings = readTokenAuthSettings(options.argv, options.env);
|
|
26
|
+
const base = buildContext({
|
|
27
|
+
productName: 'fluidgrids',
|
|
28
|
+
productVersion: options.version,
|
|
29
|
+
defaults: productDefaults,
|
|
30
|
+
...(options.output ? { output: options.output } : {}),
|
|
31
|
+
});
|
|
32
|
+
const ctx = settings ? applyTokenAuth(base, settings) : base;
|
|
33
|
+
const factory = createProgram(ctx, modules, {
|
|
34
|
+
name: 'fluidgrids',
|
|
35
|
+
description: 'FluidGrids CLI — workflow automation from the terminal',
|
|
36
|
+
version: options.version,
|
|
37
|
+
helpExamples: [...HELP_EXAMPLES],
|
|
38
|
+
});
|
|
39
|
+
// Read before the program parses (see readTokenAuthSettings); declared so commander accepts it.
|
|
40
|
+
factory.program.option(`${TOKEN_FLAG} <token>`, 'Platform access token for non-interactive use (prefer the FLUIDGRIDS_TOKEN variable)');
|
|
41
|
+
return { ...factory, ctx, tokenMode: settings !== null };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.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AAC,CAAC;IACH,gGAAgG;IAChG,OAAO,CAAC,OAAO,CAAC,MAAM,CACpB,GAAG,UAAU,UAAU,EACvB,sFAAsF,CACvF,CAAC;IACF,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,KAAK,IAAI,EAAE,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,102 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidgrids/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2026.1028.1",
|
|
4
|
+
"description": "CLI tool for FluidGrids — workflow automation management (thin shell over @burdenoff/cli-sdk)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"bin": {
|
|
8
|
+
"fluidgrids": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc && tsc-alias",
|
|
16
|
+
"build:watch": "tsc -w",
|
|
17
|
+
"dev": "tsx src/cli.ts",
|
|
18
|
+
"test": "bash scripts/build-limits.sh vitest run",
|
|
19
|
+
"test:coverage": "bash scripts/build-limits.sh vitest run --coverage",
|
|
20
|
+
"test:ui": "vitest --ui",
|
|
21
|
+
"lint": "eslint src --fix",
|
|
22
|
+
"lint:sanity": "if [ \"${CI:-}\" = \"true\" ]; then bun run lint; else bun run lint -- --cache --cache-location .eslintcache; fi",
|
|
23
|
+
"lint:check": "eslint src",
|
|
24
|
+
"format": "prettier --write \"src/**/*.{ts,js,json,md}\" \"tests/**/*.{ts,js,json,md}\"",
|
|
25
|
+
"format:check": "prettier --check \"src/**/*.{ts,js,json,md}\" \"tests/**/*.{ts,js,json,md}\"",
|
|
26
|
+
"type-check": "bash scripts/build-limits.sh tsc --noEmit",
|
|
27
|
+
"schema:pull": "bash scripts/schema-pull.sh",
|
|
28
|
+
"clean": "rimraf dist",
|
|
29
|
+
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run format:check && bun run lint:sanity && bun run type-check && bun run test && bun run build'",
|
|
30
|
+
"prepublishOnly": "bun run clean && bun run build",
|
|
31
|
+
"start": "bun dist/cli.js"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"fluidgrids",
|
|
35
|
+
"cli",
|
|
36
|
+
"graphql",
|
|
37
|
+
"typescript",
|
|
38
|
+
"workflow-automation"
|
|
39
|
+
],
|
|
40
|
+
"author": {
|
|
41
|
+
"name": "Vignesh T.V",
|
|
42
|
+
"url": "https://github.com/tvvignesh"
|
|
43
|
+
},
|
|
44
|
+
"license": "UNLICENSED",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/Algoshred/fluidgrids-cli.git"
|
|
48
|
+
},
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/Algoshred/fluidgrids-cli/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/Algoshred/fluidgrids-cli#readme",
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public",
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@burdenoff/cli-sdk": "^2026.1021.2",
|
|
59
|
+
"@fluidgrids/workflows": "2026.1027.1",
|
|
60
|
+
"commander": "^14.0.3",
|
|
61
|
+
"graphql": "^16.13.2",
|
|
62
|
+
"graphql-request": "^7.4.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^24.12.2",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
67
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
68
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
69
|
+
"@vitest/ui": "^3.2.4",
|
|
70
|
+
"eslint": "^9.39.4",
|
|
71
|
+
"eslint-config-prettier": "^10.1.8",
|
|
72
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
73
|
+
"globals": "^16.5.0",
|
|
74
|
+
"prettier": "^3.8.1",
|
|
75
|
+
"rimraf": "^6.1.3",
|
|
76
|
+
"tsc-alias": "^1.8.16",
|
|
77
|
+
"tsx": "^4.21.0",
|
|
78
|
+
"typescript": "^5.9.3",
|
|
79
|
+
"vitest": "^3.2.4"
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=24.11.0",
|
|
83
|
+
"bun": ">=1.3.14"
|
|
84
|
+
},
|
|
85
|
+
"overrides": {
|
|
86
|
+
"lodash": ">=4.17.21",
|
|
87
|
+
"lodash-es": ">=4.17.21",
|
|
88
|
+
"dompurify": ">=3.3.4",
|
|
89
|
+
"fast-xml-parser": ">=4.5.5",
|
|
90
|
+
"@xmldom/xmldom": ">=0.8.12",
|
|
91
|
+
"swiper": ">=12.1.2",
|
|
92
|
+
"brace-expansion": ">=1.1.13",
|
|
93
|
+
"follow-redirects": ">=1.15.12",
|
|
94
|
+
"smol-toml": ">=1.6.1",
|
|
95
|
+
"axios": ">=1.15.0",
|
|
96
|
+
"flatted": ">=3.4.1",
|
|
97
|
+
"yaml": ">=2.8.3",
|
|
98
|
+
"picomatch": ">=2.3.2",
|
|
99
|
+
"immutable": ">=3.8.3",
|
|
100
|
+
"minimatch": ">=3.1.3"
|
|
101
|
+
}
|
|
102
|
+
}
|