@embeddables/cli 0.7.13 → 0.7.14
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/.prompts/custom/build-funnel.md +1 -1
- package/.prompts/embeddables-cli.md +9 -2
- package/package.json +1 -1
- package/dist/auth/index.d.ts +0 -43
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -102
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -174
- package/dist/commands/branch.d.ts +0 -4
- package/dist/commands/branch.d.ts.map +0 -1
- package/dist/commands/branch.js +0 -68
- package/dist/commands/build-workbench.d.ts +0 -5
- package/dist/commands/build-workbench.d.ts.map +0 -1
- package/dist/commands/build-workbench.js +0 -128
- package/dist/commands/build.d.ts +0 -8
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/build.js +0 -55
- package/dist/commands/dev.d.ts +0 -12
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -221
- package/dist/commands/experiments-connect.d.ts +0 -6
- package/dist/commands/experiments-connect.d.ts.map +0 -1
- package/dist/commands/experiments-connect.js +0 -140
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -327
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -122
- package/dist/commands/logout.d.ts +0 -2
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -22
- package/dist/commands/pull.d.ts +0 -14
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -383
- package/dist/commands/save.d.ts +0 -30
- package/dist/commands/save.d.ts.map +0 -1
- package/dist/commands/save.js +0 -591
- package/dist/commands/upgrade.d.ts +0 -2
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -51
- package/dist/compiler/errors.d.ts +0 -20
- package/dist/compiler/errors.d.ts.map +0 -1
- package/dist/compiler/errors.js +0 -35
- package/dist/compiler/evalStatic.d.ts +0 -3
- package/dist/compiler/evalStatic.d.ts.map +0 -1
- package/dist/compiler/evalStatic.js +0 -57
- package/dist/compiler/flatten.js +0 -1
- package/dist/compiler/helpers/duplicateIds.d.ts +0 -9
- package/dist/compiler/helpers/duplicateIds.d.ts.map +0 -1
- package/dist/compiler/helpers/duplicateIds.js +0 -71
- package/dist/compiler/helpers/numericLeadingKeys.d.ts +0 -8
- package/dist/compiler/helpers/numericLeadingKeys.d.ts.map +0 -1
- package/dist/compiler/helpers/numericLeadingKeys.js +0 -17
- package/dist/compiler/index.d.ts +0 -18
- package/dist/compiler/index.d.ts.map +0 -1
- package/dist/compiler/index.js +0 -1245
- package/dist/compiler/parsePage.d.ts +0 -15
- package/dist/compiler/parsePage.d.ts.map +0 -1
- package/dist/compiler/parsePage.js +0 -631
- package/dist/compiler/registry.d.ts +0 -4
- package/dist/compiler/registry.d.ts.map +0 -1
- package/dist/compiler/registry.js +0 -44
- package/dist/compiler/reverse.d.ts +0 -23
- package/dist/compiler/reverse.d.ts.map +0 -1
- package/dist/compiler/reverse.js +0 -1875
- package/dist/compiler/types.d.ts +0 -21
- package/dist/compiler/types.d.ts.map +0 -1
- package/dist/compiler/types.js +0 -1
- package/dist/components/index.d.ts +0 -21
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -21
- package/dist/components/primitives/BaseComponent.d.ts +0 -32
- package/dist/components/primitives/BaseComponent.d.ts.map +0 -1
- package/dist/components/primitives/BaseComponent.js +0 -26
- package/dist/components/primitives/BookMeeting.d.ts +0 -18
- package/dist/components/primitives/BookMeeting.d.ts.map +0 -1
- package/dist/components/primitives/BookMeeting.js +0 -5
- package/dist/components/primitives/Chart.d.ts +0 -41
- package/dist/components/primitives/Chart.d.ts.map +0 -1
- package/dist/components/primitives/Chart.js +0 -5
- package/dist/components/primitives/Container.d.ts +0 -8
- package/dist/components/primitives/Container.d.ts.map +0 -1
- package/dist/components/primitives/Container.js +0 -5
- package/dist/components/primitives/CustomButton.d.ts +0 -37
- package/dist/components/primitives/CustomButton.d.ts.map +0 -1
- package/dist/components/primitives/CustomButton.js +0 -10
- package/dist/components/primitives/CustomHTML.d.ts +0 -8
- package/dist/components/primitives/CustomHTML.d.ts.map +0 -1
- package/dist/components/primitives/CustomHTML.js +0 -5
- package/dist/components/primitives/FileUpload.d.ts +0 -18
- package/dist/components/primitives/FileUpload.d.ts.map +0 -1
- package/dist/components/primitives/FileUpload.js +0 -16
- package/dist/components/primitives/InputBox.d.ts +0 -34
- package/dist/components/primitives/InputBox.d.ts.map +0 -1
- package/dist/components/primitives/InputBox.js +0 -25
- package/dist/components/primitives/Lottie.d.ts +0 -11
- package/dist/components/primitives/Lottie.d.ts.map +0 -1
- package/dist/components/primitives/Lottie.js +0 -5
- package/dist/components/primitives/MediaEmbed.d.ts +0 -13
- package/dist/components/primitives/MediaEmbed.d.ts.map +0 -1
- package/dist/components/primitives/MediaEmbed.js +0 -6
- package/dist/components/primitives/MediaImage.d.ts +0 -8
- package/dist/components/primitives/MediaImage.d.ts.map +0 -1
- package/dist/components/primitives/MediaImage.js +0 -5
- package/dist/components/primitives/OptionSelector.d.ts +0 -35
- package/dist/components/primitives/OptionSelector.d.ts.map +0 -1
- package/dist/components/primitives/OptionSelector.js +0 -8
- package/dist/components/primitives/PaypalCheckout.d.ts +0 -25
- package/dist/components/primitives/PaypalCheckout.d.ts.map +0 -1
- package/dist/components/primitives/PaypalCheckout.js +0 -5
- package/dist/components/primitives/PlainText.d.ts +0 -6
- package/dist/components/primitives/PlainText.d.ts.map +0 -1
- package/dist/components/primitives/PlainText.js +0 -5
- package/dist/components/primitives/ProgressBar.d.ts +0 -15
- package/dist/components/primitives/ProgressBar.d.ts.map +0 -1
- package/dist/components/primitives/ProgressBar.js +0 -5
- package/dist/components/primitives/RichText.d.ts +0 -6
- package/dist/components/primitives/RichText.d.ts.map +0 -1
- package/dist/components/primitives/RichText.js +0 -5
- package/dist/components/primitives/RichTextMarkdown.d.ts +0 -6
- package/dist/components/primitives/RichTextMarkdown.d.ts.map +0 -1
- package/dist/components/primitives/RichTextMarkdown.js +0 -5
- package/dist/components/primitives/Rive.d.ts +0 -16
- package/dist/components/primitives/Rive.d.ts.map +0 -1
- package/dist/components/primitives/Rive.js +0 -8
- package/dist/components/primitives/StripeCheckout.d.ts +0 -52
- package/dist/components/primitives/StripeCheckout.d.ts.map +0 -1
- package/dist/components/primitives/StripeCheckout.js +0 -5
- package/dist/components/primitives/StripeCheckout2.d.ts +0 -30
- package/dist/components/primitives/StripeCheckout2.d.ts.map +0 -1
- package/dist/components/primitives/StripeCheckout2.js +0 -7
- package/dist/config/index.d.ts +0 -23
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -42
- package/dist/constants.d.ts +0 -9
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -9
- package/dist/helpers/TEMP helpers file.d.ts +0 -1
- package/dist/helpers/TEMP helpers file.d.ts.map +0 -1
- package/dist/helpers/TEMP helpers file.js +0 -1
- package/dist/helpers/dates.d.ts +0 -5
- package/dist/helpers/dates.d.ts.map +0 -1
- package/dist/helpers/dates.js +0 -7
- package/dist/helpers/json.d.ts +0 -47
- package/dist/helpers/json.d.ts.map +0 -1
- package/dist/helpers/json.js +0 -622
- package/dist/helpers/utils.d.ts +0 -13
- package/dist/helpers/utils.d.ts.map +0 -1
- package/dist/helpers/utils.js +0 -28
- package/dist/logger.d.ts +0 -11
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -21
- package/dist/prompts/branches.d.ts +0 -20
- package/dist/prompts/branches.d.ts.map +0 -1
- package/dist/prompts/branches.js +0 -90
- package/dist/prompts/embeddables.d.ts +0 -43
- package/dist/prompts/embeddables.d.ts.map +0 -1
- package/dist/prompts/embeddables.js +0 -198
- package/dist/prompts/experiments.d.ts +0 -28
- package/dist/prompts/experiments.d.ts.map +0 -1
- package/dist/prompts/experiments.js +0 -87
- package/dist/prompts/index.d.ts +0 -11
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/index.js +0 -6
- package/dist/prompts/projects.d.ts +0 -22
- package/dist/prompts/projects.d.ts.map +0 -1
- package/dist/prompts/projects.js +0 -86
- package/dist/prompts/versions.d.ts +0 -18
- package/dist/prompts/versions.d.ts.map +0 -1
- package/dist/prompts/versions.js +0 -99
- package/dist/proxy/injectApiInterceptor.d.ts +0 -6
- package/dist/proxy/injectApiInterceptor.d.ts.map +0 -1
- package/dist/proxy/injectApiInterceptor.js +0 -66
- package/dist/proxy/injectReload.d.ts +0 -2
- package/dist/proxy/injectReload.d.ts.map +0 -1
- package/dist/proxy/injectReload.js +0 -14
- package/dist/proxy/injectWorkbench.d.ts +0 -5
- package/dist/proxy/injectWorkbench.d.ts.map +0 -1
- package/dist/proxy/injectWorkbench.js +0 -22
- package/dist/proxy/server.d.ts +0 -11
- package/dist/proxy/server.d.ts.map +0 -1
- package/dist/proxy/server.js +0 -316
- package/dist/proxy/sse.d.ts +0 -5
- package/dist/proxy/sse.d.ts.map +0 -1
- package/dist/proxy/sse.js +0 -17
- package/dist/sentry-context.d.ts +0 -48
- package/dist/sentry-context.d.ts.map +0 -1
- package/dist/sentry-context.js +0 -156
- package/dist/stdout.d.ts +0 -17
- package/dist/stdout.d.ts.map +0 -1
- package/dist/stdout.js +0 -23
- package/dist/types-builder.d.ts +0 -800
- package/dist/types-builder.d.ts.map +0 -1
- package/dist/types-builder.js +0 -20
- package/dist/workbench/ActionsPanel.d.ts +0 -6
- package/dist/workbench/ActionsPanel.d.ts.map +0 -1
- package/dist/workbench/ActionsPanel.js +0 -47
- package/dist/workbench/AutofillPanel.d.ts +0 -6
- package/dist/workbench/AutofillPanel.d.ts.map +0 -1
- package/dist/workbench/AutofillPanel.js +0 -543
- package/dist/workbench/ComputedFieldsPanel.d.ts +0 -6
- package/dist/workbench/ComputedFieldsPanel.d.ts.map +0 -1
- package/dist/workbench/ComputedFieldsPanel.js +0 -31
- package/dist/workbench/ExperimentsPanel.d.ts +0 -6
- package/dist/workbench/ExperimentsPanel.d.ts.map +0 -1
- package/dist/workbench/ExperimentsPanel.js +0 -182
- package/dist/workbench/FieldEditorPanel.d.ts +0 -9
- package/dist/workbench/FieldEditorPanel.d.ts.map +0 -1
- package/dist/workbench/FieldEditorPanel.js +0 -650
- package/dist/workbench/InspectorPanel.d.ts +0 -6
- package/dist/workbench/InspectorPanel.d.ts.map +0 -1
- package/dist/workbench/InspectorPanel.js +0 -341
- package/dist/workbench/PageNavigator.d.ts +0 -6
- package/dist/workbench/PageNavigator.d.ts.map +0 -1
- package/dist/workbench/PageNavigator.js +0 -123
- package/dist/workbench/SchemaPanel.d.ts +0 -6
- package/dist/workbench/SchemaPanel.d.ts.map +0 -1
- package/dist/workbench/SchemaPanel.js +0 -222
- package/dist/workbench/UserDataPanel.d.ts +0 -6
- package/dist/workbench/UserDataPanel.d.ts.map +0 -1
- package/dist/workbench/UserDataPanel.js +0 -350
- package/dist/workbench/WorkbenchApp.d.ts +0 -7
- package/dist/workbench/WorkbenchApp.d.ts.map +0 -1
- package/dist/workbench/WorkbenchApp.js +0 -193
- package/dist/workbench/cloudflare-worker/README.md +0 -31
- package/dist/workbench/cloudflare-worker/public/workbench.css +0 -1614
- package/dist/workbench/cloudflare-worker/public/workbench.js +0 -77
- package/dist/workbench/cloudflare-worker/worker.js +0 -40
- package/dist/workbench/cloudflare-worker/wrangler.toml +0 -10
- package/dist/workbench/index.d.ts +0 -10
- package/dist/workbench/index.d.ts.map +0 -1
- package/dist/workbench/index.js +0 -44
- package/dist/workbench/workbench.css +0 -1614
- package/dist/workbench/workbench.js +0 -77
package/dist/logger.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/node';
|
|
2
|
-
export function createLogger(fn) {
|
|
3
|
-
return {
|
|
4
|
-
info(message, ctx) {
|
|
5
|
-
Sentry.logger.info(message, { fn, ...ctx });
|
|
6
|
-
},
|
|
7
|
-
warn(message, ctx) {
|
|
8
|
-
Sentry.logger.warn(message, { fn, ...ctx });
|
|
9
|
-
},
|
|
10
|
-
error(message, ctx) {
|
|
11
|
-
Sentry.logger.error(message, { fn, ...ctx });
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function captureException(error) {
|
|
16
|
-
Sentry.captureException(error);
|
|
17
|
-
}
|
|
18
|
-
export async function exit(code) {
|
|
19
|
-
await Sentry.flush(2000);
|
|
20
|
-
process.exit(code);
|
|
21
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BranchStatus } from '../constants.js';
|
|
2
|
-
export interface BranchInfo {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
status: BranchStatus;
|
|
6
|
-
created_at: string;
|
|
7
|
-
origin_version: number | null;
|
|
8
|
-
origin_branch: string | null;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Fetch all branches for an embeddable from Supabase
|
|
12
|
-
*/
|
|
13
|
-
export declare function fetchBranches(flowId: string): Promise<BranchInfo[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Prompt the user to select a branch
|
|
16
|
-
* Returns null if user selects "main" or cancels
|
|
17
|
-
* The "main" option is always included at the top
|
|
18
|
-
*/
|
|
19
|
-
export declare function promptForBranch(branches: BranchInfo[]): Promise<BranchInfo | null>;
|
|
20
|
-
//# sourceMappingURL=branches.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"branches.d.ts","sourceRoot":"","sources":["../../src/prompts/branches.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9C,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA8BzE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA8DxF"}
|
package/dist/prompts/branches.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import pc from 'picocolors';
|
|
2
|
-
import prompts from 'prompts';
|
|
3
|
-
import { getAuthenticatedSupabaseClient } from '../auth/index.js';
|
|
4
|
-
import * as stdout from '../stdout.js';
|
|
5
|
-
import { BranchStatus } from '../constants.js';
|
|
6
|
-
import { formatDate } from '../helpers/dates.js';
|
|
7
|
-
/**
|
|
8
|
-
* Fetch all branches for an embeddable from Supabase
|
|
9
|
-
*/
|
|
10
|
-
export async function fetchBranches(flowId) {
|
|
11
|
-
const supabase = await getAuthenticatedSupabaseClient();
|
|
12
|
-
if (!supabase) {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
const { data, error } = await supabase
|
|
17
|
-
.from('branches')
|
|
18
|
-
.select('id, name, status, created_at, origin_version, origin_branch')
|
|
19
|
-
.eq('flow_id', flowId)
|
|
20
|
-
.order('created_at', { ascending: false });
|
|
21
|
-
if (error) {
|
|
22
|
-
stdout.warn(pc.yellow(`Could not fetch branches: ${error.message}`));
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
return (data || []).map((row) => ({
|
|
26
|
-
id: row.id,
|
|
27
|
-
name: row.name,
|
|
28
|
-
status: row.status,
|
|
29
|
-
created_at: row.created_at,
|
|
30
|
-
origin_version: row.origin_version,
|
|
31
|
-
origin_branch: row.origin_branch,
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
stdout.warn(pc.yellow(`Could not fetch branches: ${err}`));
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Prompt the user to select a branch
|
|
41
|
-
* Returns null if user selects "main" or cancels
|
|
42
|
-
* The "main" option is always included at the top
|
|
43
|
-
*/
|
|
44
|
-
export async function promptForBranch(branches) {
|
|
45
|
-
// Separate active and merged branches
|
|
46
|
-
const activeBranches = branches.filter((b) => b.status === BranchStatus.ACTIVE);
|
|
47
|
-
const mergedBranches = branches.filter((b) => b.status === BranchStatus.MERGED);
|
|
48
|
-
const choices = [];
|
|
49
|
-
// Add "main" option first
|
|
50
|
-
choices.push({
|
|
51
|
-
title: pc.bold('main'),
|
|
52
|
-
value: 'main',
|
|
53
|
-
description: 'Latest published version',
|
|
54
|
-
});
|
|
55
|
-
// Add active branches
|
|
56
|
-
for (const branch of activeBranches) {
|
|
57
|
-
const date = formatDate(branch.created_at);
|
|
58
|
-
choices.push({
|
|
59
|
-
title: branch.name,
|
|
60
|
-
value: branch.id,
|
|
61
|
-
description: `Active · Created ${date}`,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
// Add merged branches (dimmed)
|
|
65
|
-
for (const branch of mergedBranches) {
|
|
66
|
-
const date = formatDate(branch.created_at);
|
|
67
|
-
choices.push({
|
|
68
|
-
title: pc.dim(branch.name),
|
|
69
|
-
value: branch.id,
|
|
70
|
-
description: pc.dim(`Merged · Created ${date}`),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
const response = await prompts({
|
|
74
|
-
type: 'autocomplete',
|
|
75
|
-
name: 'branchId',
|
|
76
|
-
message: 'Select a branch:',
|
|
77
|
-
choices,
|
|
78
|
-
suggest: (input, choices) => Promise.resolve(choices.filter((c) => c.value === 'main' ||
|
|
79
|
-
(c.title?.toLowerCase().includes(input.toLowerCase()) ?? false) ||
|
|
80
|
-
String(c.value).toLowerCase().includes(input.toLowerCase()))),
|
|
81
|
-
}, {
|
|
82
|
-
onCancel: () => {
|
|
83
|
-
process.exit(0);
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
if (!response.branchId || response.branchId === 'main') {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
return branches.find((b) => b.id === response.branchId) || null;
|
|
90
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export interface EmbeddableInfo {
|
|
2
|
-
id: string;
|
|
3
|
-
title: string | null;
|
|
4
|
-
}
|
|
5
|
-
export interface EmbeddableMetadata {
|
|
6
|
-
title: string | null;
|
|
7
|
-
archived: boolean;
|
|
8
|
-
created_at: string | null;
|
|
9
|
-
}
|
|
10
|
-
export interface LocalEmbeddable {
|
|
11
|
-
id: string;
|
|
12
|
-
title: string | null;
|
|
13
|
-
}
|
|
14
|
-
export interface PromptForEmbeddableOptions {
|
|
15
|
-
/** Custom message for the prompt */
|
|
16
|
-
message?: string;
|
|
17
|
-
/** When true, sort so embeddables already present in embeddables/ appear first */
|
|
18
|
-
prioritizeLocal?: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Fetch all embeddables for a project from Supabase
|
|
22
|
-
*/
|
|
23
|
-
export declare function fetchProjectEmbeddables(projectId: string): Promise<EmbeddableInfo[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Fetch metadata for a single embeddable from the flows table.
|
|
26
|
-
* Returns title, archived, and created_at from the DB (not from the version-specific embeddable.json).
|
|
27
|
-
*/
|
|
28
|
-
export declare function fetchEmbeddableMetadata(embeddableId: string): Promise<EmbeddableMetadata | null>;
|
|
29
|
-
/**
|
|
30
|
-
* Prompt the user to select an embeddable from a project
|
|
31
|
-
* Returns null if no embeddables found or user cancels
|
|
32
|
-
*/
|
|
33
|
-
export declare function promptForEmbeddable(projectId: string, options?: PromptForEmbeddableOptions): Promise<string | null>;
|
|
34
|
-
/**
|
|
35
|
-
* Discover embeddables in the local embeddables/ directory
|
|
36
|
-
*/
|
|
37
|
-
export declare function discoverLocalEmbeddables(): Promise<LocalEmbeddable[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Prompt the user to select a local embeddable
|
|
40
|
-
* Returns null if no embeddables found or user cancels
|
|
41
|
-
*/
|
|
42
|
-
export declare function promptForLocalEmbeddable(options?: PromptForEmbeddableOptions): Promise<string | null>;
|
|
43
|
-
//# sourceMappingURL=embeddables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"embeddables.d.ts","sourceRoot":"","sources":["../../src/prompts/embeddables.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,0BAA0B;IACzC,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kFAAkF;IAClF,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA2B1F;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA2BpC;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4ExB;AAED;;GAEG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAqC3E;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuCxB"}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import pc from 'picocolors';
|
|
4
|
-
import prompts from 'prompts';
|
|
5
|
-
import { getAuthenticatedSupabaseClient } from '../auth/index.js';
|
|
6
|
-
import * as stdout from '../stdout.js';
|
|
7
|
-
/**
|
|
8
|
-
* Fetch all embeddables for a project from Supabase
|
|
9
|
-
*/
|
|
10
|
-
export async function fetchProjectEmbeddables(projectId) {
|
|
11
|
-
const supabase = await getAuthenticatedSupabaseClient();
|
|
12
|
-
if (!supabase) {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
const { data, error } = await supabase
|
|
17
|
-
.from('flows')
|
|
18
|
-
.select('id, title')
|
|
19
|
-
.eq('project_id', projectId)
|
|
20
|
-
.not('archived', 'is', 'true')
|
|
21
|
-
.order('title', { ascending: true });
|
|
22
|
-
if (error) {
|
|
23
|
-
stdout.warn(pc.yellow(`Could not fetch embeddables: ${error.message}`));
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
return (data || []).map((row) => ({
|
|
27
|
-
id: row.id,
|
|
28
|
-
title: row.title || null,
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
stdout.warn(pc.yellow(`Could not fetch embeddables: ${err}`));
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Fetch metadata for a single embeddable from the flows table.
|
|
38
|
-
* Returns title, archived, and created_at from the DB (not from the version-specific embeddable.json).
|
|
39
|
-
*/
|
|
40
|
-
export async function fetchEmbeddableMetadata(embeddableId) {
|
|
41
|
-
const supabase = await getAuthenticatedSupabaseClient();
|
|
42
|
-
if (!supabase) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
const { data, error } = await supabase
|
|
47
|
-
.from('flows')
|
|
48
|
-
.select('title, archived, created_at')
|
|
49
|
-
.eq('id', embeddableId)
|
|
50
|
-
.single();
|
|
51
|
-
if (error) {
|
|
52
|
-
stdout.warn(pc.yellow(`Could not fetch embeddable metadata: ${error.message}`));
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
title: data.title || null,
|
|
57
|
-
archived: data.archived ?? false,
|
|
58
|
-
created_at: data.created_at || null,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
stdout.warn(pc.yellow(`Could not fetch embeddable metadata: ${err}`));
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Prompt the user to select an embeddable from a project
|
|
68
|
-
* Returns null if no embeddables found or user cancels
|
|
69
|
-
*/
|
|
70
|
-
export async function promptForEmbeddable(projectId, options = {}) {
|
|
71
|
-
const { message = 'Select an embeddable:', prioritizeLocal = false } = options;
|
|
72
|
-
let embeddables = await fetchProjectEmbeddables(projectId);
|
|
73
|
-
const SEPARATOR_VALUE = '__separator__';
|
|
74
|
-
let inRepo = [];
|
|
75
|
-
let notInRepo = [];
|
|
76
|
-
if (prioritizeLocal && embeddables.length > 0) {
|
|
77
|
-
const local = await discoverLocalEmbeddables();
|
|
78
|
-
const localIds = new Set(local.map((e) => e.id));
|
|
79
|
-
inRepo = embeddables.filter((e) => localIds.has(e.id));
|
|
80
|
-
notInRepo = embeddables.filter((e) => !localIds.has(e.id));
|
|
81
|
-
embeddables = [...inRepo, ...notInRepo];
|
|
82
|
-
}
|
|
83
|
-
if (embeddables.length === 0) {
|
|
84
|
-
stdout.print(pc.yellow('No embeddables found in this project.'));
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const hasTwoSections = prioritizeLocal && inRepo.length > 0 && notInRepo.length > 0;
|
|
88
|
-
const separatorChoice = {
|
|
89
|
-
title: pc.dim('── Other embeddables in project ──'),
|
|
90
|
-
value: SEPARATOR_VALUE,
|
|
91
|
-
disabled: true,
|
|
92
|
-
};
|
|
93
|
-
const choices = embeddables.map((e) => ({
|
|
94
|
-
title: e.title || e.id,
|
|
95
|
-
description: e.id,
|
|
96
|
-
value: e.id,
|
|
97
|
-
}));
|
|
98
|
-
if (hasTwoSections) {
|
|
99
|
-
choices.splice(inRepo.length, 0, separatorChoice);
|
|
100
|
-
}
|
|
101
|
-
const response = await prompts({
|
|
102
|
-
type: 'autocomplete',
|
|
103
|
-
name: 'id',
|
|
104
|
-
message,
|
|
105
|
-
choices,
|
|
106
|
-
suggest: (input, list) => {
|
|
107
|
-
const realChoices = list.filter((c) => c.value !== SEPARATOR_VALUE);
|
|
108
|
-
const filtered = input
|
|
109
|
-
? realChoices.filter((c) => (c.title?.toLowerCase().includes(input.toLowerCase()) ?? false) ||
|
|
110
|
-
String(c.value).toLowerCase().includes(input.toLowerCase()))
|
|
111
|
-
: realChoices;
|
|
112
|
-
if (hasTwoSections && !input) {
|
|
113
|
-
return Promise.resolve([
|
|
114
|
-
...filtered.slice(0, inRepo.length),
|
|
115
|
-
separatorChoice,
|
|
116
|
-
...filtered.slice(inRepo.length),
|
|
117
|
-
]);
|
|
118
|
-
}
|
|
119
|
-
return Promise.resolve(filtered);
|
|
120
|
-
},
|
|
121
|
-
}, {
|
|
122
|
-
onCancel: () => {
|
|
123
|
-
process.exit(0);
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
if (response.id === SEPARATOR_VALUE) {
|
|
127
|
-
return promptForEmbeddable(projectId, options);
|
|
128
|
-
}
|
|
129
|
-
return response.id || null;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Discover embeddables in the local embeddables/ directory
|
|
133
|
-
*/
|
|
134
|
-
export async function discoverLocalEmbeddables() {
|
|
135
|
-
const embeddablesDir = 'embeddables';
|
|
136
|
-
if (!fs.existsSync(embeddablesDir)) {
|
|
137
|
-
return [];
|
|
138
|
-
}
|
|
139
|
-
const entries = fs.readdirSync(embeddablesDir, { withFileTypes: true });
|
|
140
|
-
const embeddables = [];
|
|
141
|
-
for (const entry of entries) {
|
|
142
|
-
if (!entry.isDirectory())
|
|
143
|
-
continue;
|
|
144
|
-
const id = entry.name;
|
|
145
|
-
const metadataPath = path.join(embeddablesDir, id, 'metadata.json');
|
|
146
|
-
let title = null;
|
|
147
|
-
if (fs.existsSync(metadataPath)) {
|
|
148
|
-
try {
|
|
149
|
-
const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf-8'));
|
|
150
|
-
title = metadata.title || null;
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
// Ignore JSON parse errors
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
embeddables.push({ id, title });
|
|
157
|
-
}
|
|
158
|
-
// Sort by title first, then by id
|
|
159
|
-
return embeddables.sort((a, b) => {
|
|
160
|
-
if (a.title && !b.title)
|
|
161
|
-
return -1;
|
|
162
|
-
if (!a.title && b.title)
|
|
163
|
-
return 1;
|
|
164
|
-
const aLabel = a.title || a.id;
|
|
165
|
-
const bLabel = b.title || b.id;
|
|
166
|
-
return aLabel.localeCompare(bLabel);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Prompt the user to select a local embeddable
|
|
171
|
-
* Returns null if no embeddables found or user cancels
|
|
172
|
-
*/
|
|
173
|
-
export async function promptForLocalEmbeddable(options = {}) {
|
|
174
|
-
const { message = 'Select an embeddable:' } = options;
|
|
175
|
-
const embeddables = await discoverLocalEmbeddables();
|
|
176
|
-
if (embeddables.length === 0) {
|
|
177
|
-
stdout.error(pc.red('No embeddables found in the embeddables/ directory.'));
|
|
178
|
-
stdout.print(pc.gray('Run `embeddables pull` to pull an embeddable first.'));
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
const choices = embeddables.map((e) => ({
|
|
182
|
-
title: e.title ? `${e.title} (${e.id})` : e.id,
|
|
183
|
-
value: e.id,
|
|
184
|
-
}));
|
|
185
|
-
const response = await prompts({
|
|
186
|
-
type: 'autocomplete',
|
|
187
|
-
name: 'id',
|
|
188
|
-
message,
|
|
189
|
-
choices,
|
|
190
|
-
suggest: (input, choices) => Promise.resolve(choices.filter((c) => (c.title?.toLowerCase().includes(input.toLowerCase()) ?? false) ||
|
|
191
|
-
String(c.value).toLowerCase().includes(input.toLowerCase()))),
|
|
192
|
-
}, {
|
|
193
|
-
onCancel: () => {
|
|
194
|
-
process.exit(0);
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
return response.id || null;
|
|
198
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface ExperimentInfo {
|
|
2
|
-
id: string;
|
|
3
|
-
experiment_id: string;
|
|
4
|
-
experiment_key: string;
|
|
5
|
-
name: string | null;
|
|
6
|
-
status: string;
|
|
7
|
-
flow_id: string;
|
|
8
|
-
flow_ids: string[] | null;
|
|
9
|
-
}
|
|
10
|
-
export interface PromptForExperimentOptions {
|
|
11
|
-
/** Custom message for the prompt */
|
|
12
|
-
message?: string;
|
|
13
|
-
/** Filter out experiments already connected to this embeddable ID */
|
|
14
|
-
excludeConnectedTo?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Fetch experiments for a project from Supabase (using experiments_extended view)
|
|
18
|
-
*/
|
|
19
|
-
export declare function fetchProjectExperiments(projectId: string): Promise<ExperimentInfo[]>;
|
|
20
|
-
/**
|
|
21
|
-
* Prompt the user to select an experiment from the project
|
|
22
|
-
* Returns null if no experiments found or user cancels
|
|
23
|
-
*/
|
|
24
|
-
export declare function promptForExperiment(projectId: string, options?: PromptForExperimentOptions): Promise<{
|
|
25
|
-
experiment_id: string;
|
|
26
|
-
experiment_key: string;
|
|
27
|
-
} | null>;
|
|
28
|
-
//# sourceMappingURL=experiments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../src/prompts/experiments.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,0BAA0B;IACzC,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA+B1F;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA4DnE"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import pc from 'picocolors';
|
|
2
|
-
import prompts from 'prompts';
|
|
3
|
-
import { getAuthenticatedSupabaseClient } from '../auth/index.js';
|
|
4
|
-
import * as stdout from '../stdout.js';
|
|
5
|
-
/**
|
|
6
|
-
* Fetch experiments for a project from Supabase (using experiments_extended view)
|
|
7
|
-
*/
|
|
8
|
-
export async function fetchProjectExperiments(projectId) {
|
|
9
|
-
const supabase = await getAuthenticatedSupabaseClient();
|
|
10
|
-
if (!supabase) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
const { data, error } = await supabase
|
|
15
|
-
.from('experiments_extended')
|
|
16
|
-
.select('id, experiment_id, experiment_key, name, status, flow_id, flow_ids')
|
|
17
|
-
.eq('project_id', projectId)
|
|
18
|
-
.order('name', { ascending: true, nullsFirst: false });
|
|
19
|
-
if (error) {
|
|
20
|
-
stdout.warn(pc.yellow(`Could not fetch experiments: ${error.message}`));
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
return (data || []).map((row) => ({
|
|
24
|
-
id: row.id,
|
|
25
|
-
experiment_id: row.experiment_id,
|
|
26
|
-
experiment_key: row.experiment_key,
|
|
27
|
-
name: row.name || null,
|
|
28
|
-
status: row.status || 'draft',
|
|
29
|
-
flow_id: row.flow_id,
|
|
30
|
-
flow_ids: row.flow_ids || null,
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
stdout.warn(pc.yellow(`Could not fetch experiments: ${err}`));
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Prompt the user to select an experiment from the project
|
|
40
|
-
* Returns null if no experiments found or user cancels
|
|
41
|
-
*/
|
|
42
|
-
export async function promptForExperiment(projectId, options = {}) {
|
|
43
|
-
const { message = 'Select an experiment to connect:', excludeConnectedTo } = options;
|
|
44
|
-
const experiments = await fetchProjectExperiments(projectId);
|
|
45
|
-
let filtered = experiments;
|
|
46
|
-
if (excludeConnectedTo) {
|
|
47
|
-
filtered = experiments.filter((e) => {
|
|
48
|
-
const connected = e.flow_ids ?? [e.flow_id];
|
|
49
|
-
return !connected.includes(excludeConnectedTo);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (filtered.length === 0) {
|
|
53
|
-
if (excludeConnectedTo && experiments.length > 0) {
|
|
54
|
-
stdout.print(pc.yellow('All experiments in this project are already connected to this embeddable.'));
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
stdout.print(pc.yellow('No experiments found in this project.'));
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
const choices = filtered.map((e) => ({
|
|
62
|
-
title: e.name || e.experiment_key,
|
|
63
|
-
description: `${e.experiment_key} (${e.experiment_id})`,
|
|
64
|
-
value: e,
|
|
65
|
-
}));
|
|
66
|
-
const response = await prompts({
|
|
67
|
-
type: 'autocomplete',
|
|
68
|
-
name: 'experiment',
|
|
69
|
-
message,
|
|
70
|
-
choices,
|
|
71
|
-
suggest: (input, choices) => Promise.resolve(choices.filter((c) => (c.title?.toLowerCase().includes(input.toLowerCase()) ?? false) ||
|
|
72
|
-
String(c.value.experiment_key).toLowerCase().includes(input.toLowerCase()) ||
|
|
73
|
-
String(c.value.experiment_id).toLowerCase().includes(input.toLowerCase()))),
|
|
74
|
-
}, {
|
|
75
|
-
onCancel: () => {
|
|
76
|
-
process.exit(0);
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
const selected = response.experiment;
|
|
80
|
-
if (!selected) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
experiment_id: selected.experiment_id,
|
|
85
|
-
experiment_key: selected.experiment_key,
|
|
86
|
-
};
|
|
87
|
-
}
|
package/dist/prompts/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { fetchProjects, promptForProject } from './projects.js';
|
|
2
|
-
export type { ProjectInfo, PromptForProjectOptions } from './projects.js';
|
|
3
|
-
export { fetchProjectEmbeddables, fetchEmbeddableMetadata, promptForEmbeddable, discoverLocalEmbeddables, promptForLocalEmbeddable, } from './embeddables.js';
|
|
4
|
-
export type { EmbeddableInfo, EmbeddableMetadata, LocalEmbeddable, PromptForEmbeddableOptions, } from './embeddables.js';
|
|
5
|
-
export { fetchBranches, promptForBranch } from './branches.js';
|
|
6
|
-
export type { BranchInfo } from './branches.js';
|
|
7
|
-
export { fetchRecentVersions, promptForVersion } from './versions.js';
|
|
8
|
-
export type { VersionInfo } from './versions.js';
|
|
9
|
-
export { fetchProjectExperiments, promptForExperiment, } from './experiments.js';
|
|
10
|
-
export type { ExperimentInfo, PromptForExperimentOptions } from './experiments.js';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC/D,YAAY,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAEzE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,0BAA0B,GAC3B,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC9D,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/prompts/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Centralized prompts for CLI commands
|
|
2
|
-
export { fetchProjects, promptForProject } from './projects.js';
|
|
3
|
-
export { fetchProjectEmbeddables, fetchEmbeddableMetadata, promptForEmbeddable, discoverLocalEmbeddables, promptForLocalEmbeddable, } from './embeddables.js';
|
|
4
|
-
export { fetchBranches, promptForBranch } from './branches.js';
|
|
5
|
-
export { fetchRecentVersions, promptForVersion } from './versions.js';
|
|
6
|
-
export { fetchProjectExperiments, promptForExperiment, } from './experiments.js';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface ProjectInfo {
|
|
2
|
-
id: string;
|
|
3
|
-
title: string | null;
|
|
4
|
-
org_id: string | null;
|
|
5
|
-
org_title: string | null;
|
|
6
|
-
}
|
|
7
|
-
export interface PromptForProjectOptions {
|
|
8
|
-
/** Include a "Skip for now" option (default: false) */
|
|
9
|
-
allowSkip?: boolean;
|
|
10
|
-
/** Custom message for the prompt (default: "Select a project:") */
|
|
11
|
-
message?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Fetch all non-archived projects from Supabase
|
|
15
|
-
*/
|
|
16
|
-
export declare function fetchProjects(): Promise<ProjectInfo[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Prompt the user to select a project from the list
|
|
19
|
-
* Returns null if no projects found, user cancels, or user selects "skip"
|
|
20
|
-
*/
|
|
21
|
-
export declare function promptForProject(options?: PromptForProjectOptions): Promise<ProjectInfo | null>;
|
|
22
|
-
//# sourceMappingURL=projects.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/prompts/projects.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,uDAAuD;IACvD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAwC5D;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAqD7B"}
|
package/dist/prompts/projects.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import pc from 'picocolors';
|
|
2
|
-
import prompts from 'prompts';
|
|
3
|
-
import { getAuthenticatedSupabaseClient } from '../auth/index.js';
|
|
4
|
-
import * as stdout from '../stdout.js';
|
|
5
|
-
/**
|
|
6
|
-
* Fetch all non-archived projects from Supabase
|
|
7
|
-
*/
|
|
8
|
-
export async function fetchProjects() {
|
|
9
|
-
const supabase = await getAuthenticatedSupabaseClient();
|
|
10
|
-
if (!supabase) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
const { data, error } = await supabase
|
|
15
|
-
.from('projects')
|
|
16
|
-
.select(`
|
|
17
|
-
id,
|
|
18
|
-
title,
|
|
19
|
-
group_id,
|
|
20
|
-
groups (
|
|
21
|
-
title
|
|
22
|
-
)
|
|
23
|
-
`)
|
|
24
|
-
.not('archived', 'is', 'true')
|
|
25
|
-
.order('title', { ascending: true });
|
|
26
|
-
if (error) {
|
|
27
|
-
stdout.warn(pc.yellow(`Could not fetch projects: ${error.message}`));
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
return (data || []).map((row) => ({
|
|
31
|
-
id: row.id,
|
|
32
|
-
title: row.title || null,
|
|
33
|
-
org_id: row.group_id || null,
|
|
34
|
-
org_title:
|
|
35
|
-
// For some reason, I can't get Supabase typings to return this as an object
|
|
36
|
-
// (not an array of objects) so I have to convert it manually
|
|
37
|
-
row.groups?.title || null,
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
stdout.warn(pc.yellow(`Could not fetch projects: ${err}`));
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Prompt the user to select a project from the list
|
|
47
|
-
* Returns null if no projects found, user cancels, or user selects "skip"
|
|
48
|
-
*/
|
|
49
|
-
export async function promptForProject(options = {}) {
|
|
50
|
-
const { allowSkip = false, message = 'Select a project:' } = options;
|
|
51
|
-
const projects = await fetchProjects();
|
|
52
|
-
if (projects.length === 0) {
|
|
53
|
-
stdout.print(pc.yellow('No projects found.'));
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
const choices = projects.map((p) => ({
|
|
57
|
-
title: p.title || p.id,
|
|
58
|
-
description: p.org_title ? `${p.org_title} (${p.id})` : p.id,
|
|
59
|
-
value: p.id,
|
|
60
|
-
}));
|
|
61
|
-
if (allowSkip) {
|
|
62
|
-
choices.push({
|
|
63
|
-
title: pc.dim('Skip for now'),
|
|
64
|
-
description: 'You can set this later',
|
|
65
|
-
value: '__skip__',
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
const response = await prompts({
|
|
69
|
-
type: 'autocomplete',
|
|
70
|
-
name: 'id',
|
|
71
|
-
message,
|
|
72
|
-
choices,
|
|
73
|
-
suggest: (input, choices) => Promise.resolve(choices.filter((c) => c.value === '__skip__' ||
|
|
74
|
-
(c.title?.toLowerCase().includes(input.toLowerCase()) ?? false) ||
|
|
75
|
-
String(c.value).toLowerCase().includes(input.toLowerCase()) ||
|
|
76
|
-
c.description?.toLowerCase().includes(input.toLowerCase()))),
|
|
77
|
-
}, {
|
|
78
|
-
onCancel: () => {
|
|
79
|
-
process.exit(0);
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
if (!response.id || response.id === '__skip__') {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
return projects.find((p) => p.id === response.id) || null;
|
|
86
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface VersionInfo {
|
|
2
|
-
version_number: number;
|
|
3
|
-
created_at: string | null;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Fetch up to 100 most recent version numbers for an embeddable (flow).
|
|
7
|
-
* Uses flow_versions for the given flow_id and branch (null = main).
|
|
8
|
-
* Returns unique version numbers in descending order.
|
|
9
|
-
*/
|
|
10
|
-
export declare function fetchRecentVersions(flowId: string, branchId: string | null): Promise<VersionInfo[]>;
|
|
11
|
-
/**
|
|
12
|
-
* Prompt the user to select a version from the list.
|
|
13
|
-
* Returns the selected version number, or null for "Latest".
|
|
14
|
-
*/
|
|
15
|
-
export declare function promptForVersion(versions: VersionInfo[], options?: {
|
|
16
|
-
message?: string;
|
|
17
|
-
}): Promise<number | null>;
|
|
18
|
-
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/prompts/versions.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAID;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,WAAW,EAAE,CAAC,CA8CxB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACjC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkDxB"}
|