@c15t/cli 2.0.0-rc.6 → 2.0.0-rc.8
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 +1 -1
- package/dist/145.mjs +1208 -316
- package/dist/generate-files.mjs +51 -77
- package/dist-types/auth/base-url.d.ts +1 -1
- package/dist-types/auth/config-store.d.ts +2 -2
- package/dist-types/auth/types.d.ts +1 -1
- package/dist-types/commands/generate/templates/css.d.ts +10 -11
- package/dist-types/commands/generate/templates/shared/components.d.ts +1 -1
- package/dist-types/commands/generate/templates/shared/framework-config.d.ts +0 -4
- package/dist-types/commands/index.d.ts +1 -1
- package/dist-types/commands/instances/index.d.ts +13 -8
- package/dist-types/commands/self-host/migrate/migrator-result.d.ts +1 -1
- package/dist-types/commands/self-host/migrate/orm-result.d.ts +1 -1
- package/dist-types/commands/self-host/migrate/read-config.d.ts +1 -1
- package/dist-types/commands/shared/stylesheets.d.ts +19 -0
- package/dist-types/constants.d.ts +12 -0
- package/dist-types/context/types.d.ts +3 -1
- package/dist-types/control-plane/client.d.ts +6 -6
- package/dist-types/control-plane/types.d.ts +5 -5
- package/dist-types/core/errors.d.ts +5 -5
- package/dist-types/core/telemetry.d.ts +2 -77
- package/dist-types/machines/generate/machine.d.ts +7 -7
- package/dist-types/types.d.ts +8 -18
- package/dist-types/utils/logger.d.ts +7 -6
- package/dist-types/utils/telemetry.d.ts +61 -117
- package/dist-types/utils/validation.d.ts +2 -2
- package/package.json +6 -6
package/dist/generate-files.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import promises from "node:fs/promises";
|
|
|
2
2
|
import node_path from "node:path";
|
|
3
3
|
import picocolors from "picocolors";
|
|
4
4
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
5
|
-
import {
|
|
5
|
+
import { formatSearchedCssPaths, ensureGlobalCssStylesheetImports, STORAGE_MODES, LAYOUT_PATTERNS, logger_formatLogMessage, PAGES_APP_PATTERNS as constants_PAGES_APP_PATTERNS, constants_REGEX } from "./145.mjs";
|
|
6
6
|
function generateClientConfigContent(mode, backendURL, useEnvFile, enableDevTools = false) {
|
|
7
7
|
switch(mode){
|
|
8
8
|
case STORAGE_MODES.HOSTED:
|
|
@@ -19,7 +19,7 @@ function generateClientConfigContent(mode, backendURL, useEnvFile, enableDevTool
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
function generateHostedConfig(backendURL, useEnvFile, enableDevTools = false) {
|
|
22
|
-
const url = useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL' : `'${backendURL || 'https://your-
|
|
22
|
+
const url = useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL' : `'${backendURL || 'https://your-project.c15t.dev'}'`;
|
|
23
23
|
const devToolsImport = enableDevTools ? "import { createDevTools } from '@c15t/dev-tools';\n" : '';
|
|
24
24
|
const devToolsCall = enableDevTools ? 'createDevTools();\n' : '';
|
|
25
25
|
return `import { getOrCreateConsentRuntime } from 'c15t';
|
|
@@ -165,51 +165,16 @@ ${devToolsCall}
|
|
|
165
165
|
// store.getState().saveConsents("necessary")
|
|
166
166
|
`;
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
'src/App.css'
|
|
179
|
-
];
|
|
180
|
-
async function updateTailwindCss(projectRoot, tailwindVersion) {
|
|
181
|
-
if (!tailwindVersion || !tailwindVersion.match(/^(?:\^|~)?3/)) return {
|
|
182
|
-
updated: false,
|
|
183
|
-
filePath: null
|
|
184
|
-
};
|
|
185
|
-
for (const pattern of CSS_PATTERNS){
|
|
186
|
-
const filePath = node_path.join(projectRoot, pattern);
|
|
187
|
-
try {
|
|
188
|
-
await promises.access(filePath);
|
|
189
|
-
const content = await promises.readFile(filePath, 'utf-8');
|
|
190
|
-
if (content.includes('@layer base, components, c15t;') || content.includes('@layer base, components;')) return {
|
|
191
|
-
updated: false,
|
|
192
|
-
filePath
|
|
193
|
-
};
|
|
194
|
-
if (content.includes('@tailwind base') || content.includes('@tailwind components') || content.includes('@tailwind utilities')) {
|
|
195
|
-
let newContent = content;
|
|
196
|
-
if (newContent.includes('@tailwind base')) {
|
|
197
|
-
newContent = newContent.replace('@tailwind base;', '@layer base {\n @tailwind base;\n}');
|
|
198
|
-
newContent = newContent.replace('@tailwind base\n', '@layer base {\n @tailwind base;\n}\n');
|
|
199
|
-
}
|
|
200
|
-
if (!newContent.includes('@layer base, components, c15t;')) newContent = `@layer base, components, c15t;\n\n${newContent}`;
|
|
201
|
-
await promises.writeFile(filePath, newContent, 'utf-8');
|
|
202
|
-
return {
|
|
203
|
-
updated: true,
|
|
204
|
-
filePath
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
} catch {}
|
|
208
|
-
}
|
|
209
|
-
return {
|
|
210
|
-
updated: false,
|
|
211
|
-
filePath: null
|
|
212
|
-
};
|
|
168
|
+
async function updateAppStylesheetImports(options) {
|
|
169
|
+
return ensureGlobalCssStylesheetImports({
|
|
170
|
+
projectRoot: options.projectRoot,
|
|
171
|
+
packageName: options.packageName,
|
|
172
|
+
tailwindVersion: options.tailwindVersion,
|
|
173
|
+
entrypointPath: options.entrypointPath,
|
|
174
|
+
includeBase: true,
|
|
175
|
+
includeIab: options.includeIab ?? false,
|
|
176
|
+
dryRun: options.dryRun
|
|
177
|
+
});
|
|
213
178
|
}
|
|
214
179
|
function getEnvVarName(pkg) {
|
|
215
180
|
return '@c15t/nextjs' === pkg ? 'NEXT_PUBLIC_C15T_URL' : 'PUBLIC_C15T_URL';
|
|
@@ -220,7 +185,7 @@ function generateEnvFileContent(backendURL, pkg) {
|
|
|
220
185
|
}
|
|
221
186
|
function generateEnvExampleContent(pkg) {
|
|
222
187
|
const envVarName = getEnvVarName(pkg);
|
|
223
|
-
return `\n# c15t Configuration\n${envVarName}=https://your-
|
|
188
|
+
return `\n# c15t Configuration\n${envVarName}=https://your-project.c15t.dev\n`;
|
|
224
189
|
}
|
|
225
190
|
async function findMatchingFiles(projectRoot, patterns, logger) {
|
|
226
191
|
const matches = [];
|
|
@@ -369,7 +334,7 @@ function generateConsentComponent({ importSource, optionsText, selectedScripts =
|
|
|
369
334
|
const scriptsConfig = selectedScripts.length ? generateScriptsConfig(selectedScripts) : generateScriptsCommentPlaceholder();
|
|
370
335
|
const ssrDataLine = ssrDataOption ? '\n\t\t\t\tssrData,' : '';
|
|
371
336
|
const themeLine = includeTheme ? '\n\t\t\t\ttheme,' : '';
|
|
372
|
-
const overridesLine =
|
|
337
|
+
const overridesLine = '';
|
|
373
338
|
const fullOptionsText = `{
|
|
374
339
|
${optionsText}${ssrDataLine}${themeLine}
|
|
375
340
|
${scriptsConfig}${overridesLine}
|
|
@@ -538,14 +503,16 @@ export default function ConsentManagerClient(${propsDestructure}) {
|
|
|
538
503
|
function generateExpandedConsentDialogTemplate(framework) {
|
|
539
504
|
return `'use client';
|
|
540
505
|
|
|
541
|
-
import {
|
|
542
|
-
import { ConsentDialog } from '${framework.consentDialogImport}';
|
|
506
|
+
import { useState } from 'react';
|
|
507
|
+
import { ConsentDialog, ConsentWidget } from '${framework.consentDialogImport}';
|
|
543
508
|
|
|
544
509
|
/**
|
|
545
510
|
* Consent dialog using compound components.
|
|
546
511
|
* @see https://v2.c15t.com/docs/frameworks/${framework.docsSlug}/components/consent-dialog
|
|
547
512
|
*/
|
|
548
513
|
export default function () {
|
|
514
|
+
const [openItem, setOpenItem] = useState('');
|
|
515
|
+
|
|
549
516
|
return (
|
|
550
517
|
<ConsentDialog.Root>
|
|
551
518
|
<ConsentDialog.Card>
|
|
@@ -554,7 +521,19 @@ export default function () {
|
|
|
554
521
|
<ConsentDialog.HeaderDescription />
|
|
555
522
|
</ConsentDialog.Header>
|
|
556
523
|
<ConsentDialog.Content>
|
|
557
|
-
<ConsentWidget
|
|
524
|
+
<ConsentWidget.Root>
|
|
525
|
+
<ConsentWidget.Accordion
|
|
526
|
+
type="single"
|
|
527
|
+
value={openItem}
|
|
528
|
+
onValueChange={(value) => {
|
|
529
|
+
setOpenItem(Array.isArray(value) ? (value[0] ?? '') : (value ?? ''));
|
|
530
|
+
}}
|
|
531
|
+
>
|
|
532
|
+
<ConsentWidget.AccordionItems />
|
|
533
|
+
</ConsentWidget.Accordion>
|
|
534
|
+
{/* Pass renderAction to customize mapping. Stock c15t buttons render by default. */}
|
|
535
|
+
<ConsentWidget.PolicyActions />
|
|
536
|
+
</ConsentWidget.Root>
|
|
558
537
|
</ConsentDialog.Content>
|
|
559
538
|
<ConsentDialog.Footer />
|
|
560
539
|
</ConsentDialog.Card>
|
|
@@ -582,13 +561,8 @@ export default function () {
|
|
|
582
561
|
legalLinks={['privacyPolicy', 'termsOfService']}
|
|
583
562
|
/>
|
|
584
563
|
</ConsentBanner.Header>
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
<ConsentBanner.RejectButton />
|
|
588
|
-
<ConsentBanner.AcceptButton />
|
|
589
|
-
</ConsentBanner.FooterSubGroup>
|
|
590
|
-
<ConsentBanner.CustomizeButton />
|
|
591
|
-
</ConsentBanner.Footer>
|
|
564
|
+
{/* Pass renderAction to customize mapping. Stock c15t buttons render by default. */}
|
|
565
|
+
<ConsentBanner.PolicyActions />
|
|
592
566
|
</ConsentBanner.Card>
|
|
593
567
|
</ConsentBanner.Root>
|
|
594
568
|
);
|
|
@@ -861,9 +835,7 @@ const NEXTJS_CONFIG = {
|
|
|
861
835
|
ssrMechanism: 'Next.js headers() API',
|
|
862
836
|
docsSlug: 'nextjs',
|
|
863
837
|
envVarPrefix: 'NEXT_PUBLIC',
|
|
864
|
-
hasSSRProps: true
|
|
865
|
-
stylesheetImport: '@c15t/nextjs/styles.css',
|
|
866
|
-
iabStylesheetImport: '@c15t/nextjs/iab/styles.css'
|
|
838
|
+
hasSSRProps: true
|
|
867
839
|
};
|
|
868
840
|
const REACT_CONFIG = {
|
|
869
841
|
importSource: '@c15t/react',
|
|
@@ -873,9 +845,7 @@ const REACT_CONFIG = {
|
|
|
873
845
|
ssrMechanism: '',
|
|
874
846
|
docsSlug: 'react',
|
|
875
847
|
envVarPrefix: '',
|
|
876
|
-
hasSSRProps: false
|
|
877
|
-
stylesheetImport: '@c15t/react/styles.css',
|
|
878
|
-
iabStylesheetImport: '@c15t/react/iab/styles.css'
|
|
848
|
+
hasSSRProps: false
|
|
879
849
|
};
|
|
880
850
|
function computeRelativeModuleSpecifier(fromFilePath, toFilePath) {
|
|
881
851
|
const fromDir = node_path.dirname(fromFilePath);
|
|
@@ -958,7 +928,7 @@ async function runLayoutUpdatePipeline(config) {
|
|
|
958
928
|
function getBackendURLValue(backendURL, useEnvFile, proxyNextjs, envVarPrefix = 'NEXT_PUBLIC') {
|
|
959
929
|
if (proxyNextjs) return '"/api/c15t"';
|
|
960
930
|
if (useEnvFile) return `process.env.${envVarPrefix}_C15T_URL!`;
|
|
961
|
-
return `'${backendURL || 'https://your-
|
|
931
|
+
return `'${backendURL || 'https://your-project.c15t.dev'}'`;
|
|
962
932
|
}
|
|
963
933
|
function generateOptionsText(mode, backendURL, useEnvFile, proxyNextjs, inlineCustomHandlers, envVarPrefix = 'NEXT_PUBLIC') {
|
|
964
934
|
switch(mode){
|
|
@@ -1007,8 +977,6 @@ import ConsentManagerProvider from './provider';
|
|
|
1007
977
|
export function ConsentManager({ children }: { children: ReactNode }) {
|
|
1008
978
|
const ssrData = fetchInitialData({
|
|
1009
979
|
backendURL: ${backendURLValue},
|
|
1010
|
-
// Shows banner during development. Remove for production.
|
|
1011
|
-
overrides: { country: 'DE' },
|
|
1012
980
|
});
|
|
1013
981
|
|
|
1014
982
|
return (
|
|
@@ -1234,7 +1202,7 @@ async function createConsentManagerComponent(projectRoot, pagesDir, optionsText,
|
|
|
1234
1202
|
function addServerSideDataComment(appFile, backendURL, useEnvFile, proxyNextjs) {
|
|
1235
1203
|
const existingComments = appFile.getLeadingCommentRanges();
|
|
1236
1204
|
let urlExample;
|
|
1237
|
-
urlExample = proxyNextjs ? "'/api/c15t'" : useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL!' : `'${backendURL || 'https://your-
|
|
1205
|
+
urlExample = proxyNextjs ? "'/api/c15t'" : useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL!' : `'${backendURL || 'https://your-project.c15t.dev'}'`;
|
|
1238
1206
|
const serverSideComment = `/**
|
|
1239
1207
|
* Note: To get the initial server-side data on other pages, add this to each page:
|
|
1240
1208
|
*
|
|
@@ -1497,7 +1465,7 @@ function generateRewriteDestination(backendURL, useEnvFile) {
|
|
|
1497
1465
|
isTemplateLiteral: true
|
|
1498
1466
|
};
|
|
1499
1467
|
return {
|
|
1500
|
-
destination: `${backendURL || 'https://your-
|
|
1468
|
+
destination: `${backendURL || 'https://your-project.c15t.dev'}/:path*`,
|
|
1501
1469
|
isTemplateLiteral: false
|
|
1502
1470
|
};
|
|
1503
1471
|
}
|
|
@@ -1783,14 +1751,20 @@ async function generateFiles({ context, mode, spinner, useEnvFile, proxyNextjs,
|
|
|
1783
1751
|
spinner,
|
|
1784
1752
|
cwd: context.cwd
|
|
1785
1753
|
});
|
|
1786
|
-
if (
|
|
1787
|
-
spinner.start('
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1754
|
+
if ('@c15t/react' === pkg || '@c15t/nextjs' === pkg) {
|
|
1755
|
+
spinner.start('Configuring app stylesheet...');
|
|
1756
|
+
const stylesheetResult = await updateAppStylesheetImports({
|
|
1757
|
+
projectRoot,
|
|
1758
|
+
packageName: pkg,
|
|
1759
|
+
tailwindVersion: context.framework.tailwindVersion,
|
|
1760
|
+
entrypointPath: result.layoutPath
|
|
1761
|
+
});
|
|
1762
|
+
if (stylesheetResult.updated) {
|
|
1790
1763
|
result.tailwindCssUpdated = true;
|
|
1791
|
-
result.tailwindCssPath =
|
|
1792
|
-
spinner.stop(logger_formatLogMessage('info', `
|
|
1793
|
-
} else spinner.stop(logger_formatLogMessage('debug', '
|
|
1764
|
+
result.tailwindCssPath = stylesheetResult.filePath;
|
|
1765
|
+
spinner.stop(logger_formatLogMessage('info', `App stylesheet updated: ${picocolors.cyan(node_path.relative(context.cwd, stylesheetResult.filePath || ''))}`));
|
|
1766
|
+
} else if (stylesheetResult.filePath) spinner.stop(logger_formatLogMessage('debug', 'App stylesheet already had the correct c15t imports.'));
|
|
1767
|
+
else spinner.stop(logger_formatLogMessage('warn', `Could not find a global CSS entrypoint. Checked: ${formatSearchedCssPaths(projectRoot, stylesheetResult.searchedPaths)}`));
|
|
1794
1768
|
}
|
|
1795
1769
|
return result;
|
|
1796
1770
|
}
|
|
@@ -45,11 +45,11 @@ export declare function isLoggedIn(): Promise<boolean>;
|
|
|
45
45
|
*/
|
|
46
46
|
export declare function getAccessToken(): Promise<string | null>;
|
|
47
47
|
/**
|
|
48
|
-
* Get the selected
|
|
48
|
+
* Get the selected project ID
|
|
49
49
|
*/
|
|
50
50
|
export declare function getSelectedInstanceId(): Promise<string | null>;
|
|
51
51
|
/**
|
|
52
|
-
* Set the selected
|
|
52
|
+
* Set the selected project ID
|
|
53
53
|
*/
|
|
54
54
|
export declare function setSelectedInstanceId(instanceId: string): Promise<void>;
|
|
55
55
|
/**
|
|
@@ -11,7 +11,7 @@ export interface C15tConfig {
|
|
|
11
11
|
refreshToken?: string;
|
|
12
12
|
/** Token expiration timestamp (unix ms) */
|
|
13
13
|
expiresAt?: number;
|
|
14
|
-
/** Currently selected
|
|
14
|
+
/** Currently selected project ID */
|
|
15
15
|
selectedInstanceId?: string;
|
|
16
16
|
/** Last login timestamp */
|
|
17
17
|
lastLogin?: number;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}>;
|
|
1
|
+
import { type EnsureGlobalCssStylesheetImportsResult, type StyledPackageName } from '../../shared/stylesheets';
|
|
2
|
+
export interface UpdateAppStylesheetImportsOptions {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
packageName: Exclude<StyledPackageName, '@c15t/ui'>;
|
|
5
|
+
tailwindVersion: string | null;
|
|
6
|
+
entrypointPath?: string | null;
|
|
7
|
+
dryRun?: boolean;
|
|
8
|
+
includeIab?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function updateAppStylesheetImports(options: UpdateAppStylesheetImportsOptions): Promise<EnsureGlobalCssStylesheetImportsResult>;
|
|
@@ -17,7 +17,7 @@ interface GenerateConsentComponentOptions {
|
|
|
17
17
|
defaultExport?: boolean;
|
|
18
18
|
/** Whether to add ssrData prop passed inside options object (App Dir client with SSR) */
|
|
19
19
|
ssrDataOption?: boolean;
|
|
20
|
-
/** Whether to add geo override for development
|
|
20
|
+
/** Whether to add geo override for development */
|
|
21
21
|
includeOverrides?: boolean;
|
|
22
22
|
/** Whether to add c15t DevTools component */
|
|
23
23
|
enableDevTools?: boolean;
|
|
@@ -12,10 +12,6 @@ export interface FrameworkConfig {
|
|
|
12
12
|
docsSlug: string;
|
|
13
13
|
envVarPrefix: string;
|
|
14
14
|
hasSSRProps: boolean;
|
|
15
|
-
/** CSS stylesheet import path for prebuilt (styled) components, or null for unstyled. */
|
|
16
|
-
stylesheetImport: string | null;
|
|
17
|
-
/** CSS stylesheet import path for IAB components, or null if IAB is not applicable. */
|
|
18
|
-
iabStylesheetImport: string | null;
|
|
19
15
|
}
|
|
20
16
|
export declare const NEXTJS_CONFIG: FrameworkConfig;
|
|
21
17
|
export declare const REACT_CONFIG: FrameworkConfig;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
export { authCommands, loginCommand, logoutCommand } from './auth';
|
|
5
5
|
export { codemodsCommand, runCodemods } from './codemods';
|
|
6
6
|
export { generate, generateCommand } from './generate';
|
|
7
|
-
export {
|
|
7
|
+
export { instancesAliasCommand, projectsCommand } from './instances';
|
|
8
8
|
export { selfHost } from './self-host';
|
|
9
9
|
export { installSkills } from './skills';
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Project management commands
|
|
3
3
|
*/
|
|
4
|
-
import type { CliCommand, CliContext } from '../../types';
|
|
4
|
+
import type { CliCommand, CliContext } from '../../context/types';
|
|
5
5
|
/**
|
|
6
|
-
* List
|
|
6
|
+
* List projects command
|
|
7
7
|
*/
|
|
8
8
|
declare function listAction(context: CliContext): Promise<void>;
|
|
9
9
|
/**
|
|
10
|
-
* Select
|
|
10
|
+
* Select project command
|
|
11
11
|
*/
|
|
12
12
|
declare function selectAction(context: CliContext): Promise<void>;
|
|
13
13
|
/**
|
|
14
|
-
* Create
|
|
14
|
+
* Create project command
|
|
15
15
|
*/
|
|
16
16
|
declare function createAction(context: CliContext): Promise<void>;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Main projects command (defaults to list)
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
declare function projectsAction(context: CliContext): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Projects command definition
|
|
23
|
+
*/
|
|
24
|
+
export declare const projectsCommand: CliCommand;
|
|
25
|
+
export declare const instancesAliasCommand: CliCommand;
|
|
26
|
+
export { createAction, listAction, projectsAction, selectAction };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { MigrationResult } from '
|
|
1
|
+
import type { MigrationResult } from '@c15t/backend/db/migrator';
|
|
2
2
|
import type { CliContext } from '../../../context/types';
|
|
3
3
|
export declare function handleMigrationResult(context: CliContext, result: MigrationResult): Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ORMResult } from '
|
|
1
|
+
import type { ORMResult } from '@c15t/backend/db/migrator';
|
|
2
2
|
import type { CliContext } from '../../../context/types';
|
|
3
3
|
export declare function handleORMResult(context: CliContext, result: ORMResult): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DB } from '
|
|
1
|
+
import { DB } from '@c15t/backend/db/schema';
|
|
2
2
|
import type { CliContext } from '../../../context/types';
|
|
3
3
|
export declare function readConfigAndGetDb(context: CliContext, absoluteConfigPath: string): Promise<{
|
|
4
4
|
db: ReturnType<typeof DB.client>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type StyledPackageName = '@c15t/react' | '@c15t/nextjs' | '@c15t/ui';
|
|
2
|
+
export interface EnsureGlobalCssStylesheetImportsOptions {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
packageName: StyledPackageName;
|
|
5
|
+
tailwindVersion: string | null;
|
|
6
|
+
entrypointPath?: string | null;
|
|
7
|
+
includeBase: boolean;
|
|
8
|
+
includeIab: boolean;
|
|
9
|
+
dryRun?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface EnsureGlobalCssStylesheetImportsResult {
|
|
12
|
+
updated: boolean;
|
|
13
|
+
filePath: string | null;
|
|
14
|
+
searchedPaths: string[];
|
|
15
|
+
changes: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function formatSearchedCssPaths(projectRoot: string, searchedPaths: string[]): string;
|
|
18
|
+
export declare function isTailwindV3(version: string | null): boolean;
|
|
19
|
+
export declare function ensureGlobalCssStylesheetImports(options: EnsureGlobalCssStylesheetImportsOptions): Promise<EnsureGlobalCssStylesheetImportsResult>;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
export declare const URLS: {
|
|
8
8
|
/** Default c15t cloud platform URL */
|
|
9
9
|
readonly CONSENT_IO: "https://consent.io";
|
|
10
|
+
/** First-party telemetry logs endpoint */
|
|
11
|
+
readonly TELEMETRY: "https://telemetry.c15t.com/c15t/v1/logs";
|
|
10
12
|
/** Documentation website */
|
|
11
13
|
readonly DOCS: "https://v2.c15t.com/docs";
|
|
12
14
|
/** GitHub repository */
|
|
@@ -25,6 +27,10 @@ export declare const PATHS: {
|
|
|
25
27
|
readonly CONFIG_DIR: ".c15t";
|
|
26
28
|
/** Config file name */
|
|
27
29
|
readonly CONFIG_FILE: "config.json";
|
|
30
|
+
/** Telemetry state file name */
|
|
31
|
+
readonly TELEMETRY_STATE_FILE: "telemetry.json";
|
|
32
|
+
/** Telemetry retry queue file name */
|
|
33
|
+
readonly TELEMETRY_QUEUE_FILE: "telemetry-queue.json";
|
|
28
34
|
/** Project config file name */
|
|
29
35
|
readonly PROJECT_CONFIG: "c15t.config.ts";
|
|
30
36
|
/** Alternative project config file name */
|
|
@@ -71,6 +77,12 @@ export declare const ENV_VARS: {
|
|
|
71
77
|
readonly V2: "V2";
|
|
72
78
|
/** Disable telemetry */
|
|
73
79
|
readonly TELEMETRY_DISABLED: "C15T_TELEMETRY_DISABLED";
|
|
80
|
+
/** Override telemetry ingest endpoint */
|
|
81
|
+
readonly TELEMETRY_ENDPOINT: "C15T_TELEMETRY_ENDPOINT";
|
|
82
|
+
/** Optional write key for telemetry ingest */
|
|
83
|
+
readonly TELEMETRY_WRITE_KEY: "C15T_TELEMETRY_WRITE_KEY";
|
|
84
|
+
/** Optional Axiom org ID for telemetry ingest */
|
|
85
|
+
readonly TELEMETRY_ORG_ID: "C15T_TELEMETRY_ORG_ID";
|
|
74
86
|
/** Control-plane/dashboard base URL override */
|
|
75
87
|
readonly CONSENT_URL: "CONSENT_URL";
|
|
76
88
|
/** c15t backend URL */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { C15TOptions } from '
|
|
1
|
+
import type { C15TOptions } from '@c15t/backend/core';
|
|
2
2
|
import type { CliLogger } from '../utils/logger';
|
|
3
3
|
import type { Telemetry } from '../utils/telemetry';
|
|
4
4
|
import type { FrameworkDetectionResult } from './framework-detection';
|
|
@@ -9,6 +9,8 @@ export interface CliCommand {
|
|
|
9
9
|
hint: string;
|
|
10
10
|
description: string;
|
|
11
11
|
action: (context: CliContext) => Promise<void>;
|
|
12
|
+
subcommands?: CliCommand[];
|
|
13
|
+
hidden?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export type FlagType = 'boolean' | 'string' | 'special';
|
|
14
16
|
export interface CliFlag {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Control-plane client for c15t
|
|
2
|
+
* Control-plane client for c15t hosted projects.
|
|
3
3
|
*/
|
|
4
4
|
import type { Instance } from '../types';
|
|
5
5
|
import type { ControlPlaneClientConfig, ControlPlaneConnectionState, ControlPlaneOrganization, ControlPlaneRegion, CreateInstanceRequest } from './types';
|
|
6
6
|
/**
|
|
7
|
-
* Client for c15t
|
|
7
|
+
* Client for c15t hosted projects.
|
|
8
8
|
*
|
|
9
9
|
* Uses direct control-plane HTTP endpoints under /api/v1.
|
|
10
10
|
*/
|
|
@@ -30,19 +30,19 @@ export declare class ControlPlaneClient {
|
|
|
30
30
|
listOrganizations(): Promise<ControlPlaneOrganization[]>;
|
|
31
31
|
listRegions(): Promise<ControlPlaneRegion[]>;
|
|
32
32
|
/**
|
|
33
|
-
* List all
|
|
33
|
+
* List all hosted projects for the authenticated user.
|
|
34
34
|
*/
|
|
35
35
|
listInstances(): Promise<Instance[]>;
|
|
36
36
|
/**
|
|
37
|
-
* Get a specific
|
|
37
|
+
* Get a specific hosted project by ID.
|
|
38
38
|
*/
|
|
39
39
|
getInstance(id: string): Promise<Instance>;
|
|
40
40
|
/**
|
|
41
|
-
* Create a new
|
|
41
|
+
* Create a new hosted project.
|
|
42
42
|
*/
|
|
43
43
|
createInstance(request: CreateInstanceRequest): Promise<Instance>;
|
|
44
44
|
/**
|
|
45
|
-
* Delete
|
|
45
|
+
* Delete a hosted project.
|
|
46
46
|
*/
|
|
47
47
|
deleteInstance(id: string): Promise<void>;
|
|
48
48
|
}
|
|
@@ -39,14 +39,14 @@ export interface ControlPlaneCapabilities {
|
|
|
39
39
|
version?: string;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Create
|
|
42
|
+
* Create hosted project request
|
|
43
43
|
*/
|
|
44
44
|
export interface CreateInstanceRequest {
|
|
45
|
-
/**
|
|
45
|
+
/** Project slug */
|
|
46
46
|
name: string;
|
|
47
|
-
/**
|
|
47
|
+
/** Project configuration */
|
|
48
48
|
config: {
|
|
49
|
-
/** Organization slug to create the
|
|
49
|
+
/** Organization slug to create the project under */
|
|
50
50
|
organizationSlug: string;
|
|
51
51
|
/** Region ID for provisioning */
|
|
52
52
|
region: string;
|
|
@@ -64,7 +64,7 @@ export interface ControlPlaneOrganization {
|
|
|
64
64
|
role: string;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* Provisioning region for control-plane
|
|
67
|
+
* Provisioning region for control-plane projects
|
|
68
68
|
*/
|
|
69
69
|
export interface ControlPlaneRegion {
|
|
70
70
|
id: string;
|
|
@@ -92,17 +92,17 @@ export declare const ERROR_CATALOG: {
|
|
|
92
92
|
readonly URL_INVALID: {
|
|
93
93
|
readonly code: "URL_INVALID";
|
|
94
94
|
readonly message: "Invalid URL format";
|
|
95
|
-
readonly hint: "Expected format: https://your-
|
|
95
|
+
readonly hint: "Expected format: https://your-project.c15t.dev";
|
|
96
96
|
};
|
|
97
97
|
readonly INSTANCE_NOT_FOUND: {
|
|
98
98
|
readonly code: "INSTANCE_NOT_FOUND";
|
|
99
|
-
readonly message: "
|
|
100
|
-
readonly hint: "Run `c15t
|
|
99
|
+
readonly message: "Project not found";
|
|
100
|
+
readonly hint: "Run `c15t projects list` to see available projects";
|
|
101
101
|
};
|
|
102
102
|
readonly INSTANCE_NAME_INVALID: {
|
|
103
103
|
readonly code: "INSTANCE_NAME_INVALID";
|
|
104
|
-
readonly message: "Invalid
|
|
105
|
-
readonly hint: "
|
|
104
|
+
readonly message: "Invalid project slug";
|
|
105
|
+
readonly hint: "Project slugs must be alphanumeric with hyphens";
|
|
106
106
|
};
|
|
107
107
|
readonly FILE_NOT_FOUND: {
|
|
108
108
|
readonly code: "FILE_NOT_FOUND";
|
|
@@ -1,77 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Provides anonymous usage tracking to help improve the CLI.
|
|
5
|
-
* Respects user preferences and can be disabled via --no-telemetry flag
|
|
6
|
-
* or C15T_TELEMETRY_DISABLED environment variable.
|
|
7
|
-
*/
|
|
8
|
-
import { PostHog } from 'posthog-node';
|
|
9
|
-
import type { CliLogger, Telemetry } from '../types';
|
|
10
|
-
export declare const TelemetryEventName: {
|
|
11
|
-
readonly CLI_INVOKED: "cli.invoked";
|
|
12
|
-
readonly CLI_COMPLETED: "cli.completed";
|
|
13
|
-
readonly CLI_EXITED: "cli.exited";
|
|
14
|
-
readonly CLI_ENVIRONMENT_DETECTED: "cli.environment_detected";
|
|
15
|
-
readonly COMMAND_EXECUTED: "command.executed";
|
|
16
|
-
readonly COMMAND_SUCCEEDED: "command.succeeded";
|
|
17
|
-
readonly COMMAND_FAILED: "command.failed";
|
|
18
|
-
readonly COMMAND_UNKNOWN: "command.unknown";
|
|
19
|
-
readonly INTERACTIVE_MENU_OPENED: "ui.menu.opened";
|
|
20
|
-
readonly INTERACTIVE_MENU_EXITED: "ui.menu.exited";
|
|
21
|
-
readonly AUTH_LOGIN_STARTED: "auth.login.started";
|
|
22
|
-
readonly AUTH_LOGIN_SUCCEEDED: "auth.login.succeeded";
|
|
23
|
-
readonly AUTH_LOGIN_FAILED: "auth.login.failed";
|
|
24
|
-
readonly AUTH_LOGOUT: "auth.logout";
|
|
25
|
-
readonly CONFIG_LOADED: "config.loaded";
|
|
26
|
-
readonly CONFIG_ERROR: "config.error";
|
|
27
|
-
readonly CONFIG_UPDATED: "config.updated";
|
|
28
|
-
readonly HELP_DISPLAYED: "help.displayed";
|
|
29
|
-
readonly VERSION_DISPLAYED: "version.displayed";
|
|
30
|
-
readonly ONBOARDING_STARTED: "onboarding.started";
|
|
31
|
-
readonly ONBOARDING_COMPLETED: "onboarding.completed";
|
|
32
|
-
readonly ONBOARDING_EXITED: "onboarding.exited";
|
|
33
|
-
readonly ONBOARDING_STORAGE_MODE_SELECTED: "onboarding.storage_mode_selected";
|
|
34
|
-
readonly ONBOARDING_C15T_MODE_CONFIGURED: "onboarding.c15t_mode_configured";
|
|
35
|
-
readonly ONBOARDING_OFFLINE_MODE_CONFIGURED: "onboarding.offline_mode_configured";
|
|
36
|
-
readonly ONBOARDING_SELF_HOSTED_CONFIGURED: "onboarding.self_hosted_configured";
|
|
37
|
-
readonly ONBOARDING_CUSTOM_MODE_CONFIGURED: "onboarding.custom_mode_configured";
|
|
38
|
-
readonly ONBOARDING_DEPENDENCIES_CHOICE: "onboarding.dependencies_choice";
|
|
39
|
-
readonly ONBOARDING_DEPENDENCIES_INSTALLED: "onboarding.dependencies_installed";
|
|
40
|
-
readonly ONBOARDING_GITHUB_STAR: "onboarding.github_star";
|
|
41
|
-
readonly INSTANCES_LISTED: "instances.listed";
|
|
42
|
-
readonly INSTANCE_SELECTED: "instance.selected";
|
|
43
|
-
readonly INSTANCE_CREATED: "instance.created";
|
|
44
|
-
readonly ERROR_OCCURRED: "error.occurred";
|
|
45
|
-
readonly MIGRATION_STARTED: "migration.started";
|
|
46
|
-
readonly MIGRATION_PLANNED: "migration.planned";
|
|
47
|
-
readonly MIGRATION_EXECUTED: "migration.executed";
|
|
48
|
-
readonly MIGRATION_COMPLETED: "migration.completed";
|
|
49
|
-
readonly MIGRATION_FAILED: "migration.failed";
|
|
50
|
-
readonly GENERATE_STARTED: "generate.started";
|
|
51
|
-
readonly GENERATE_COMPLETED: "generate.completed";
|
|
52
|
-
readonly GENERATE_FAILED: "generate.failed";
|
|
53
|
-
readonly SELF_HOST_STARTED: "self-host.started";
|
|
54
|
-
readonly SELF_HOST_COMPLETED: "self-host.completed";
|
|
55
|
-
readonly SELF_HOST_FAILED: "self-host.failed";
|
|
56
|
-
};
|
|
57
|
-
export type TelemetryEventNameType = (typeof TelemetryEventName)[keyof typeof TelemetryEventName];
|
|
58
|
-
export interface TelemetryOptions {
|
|
59
|
-
/** Custom PostHog client instance */
|
|
60
|
-
client?: PostHog;
|
|
61
|
-
/** Disable telemetry */
|
|
62
|
-
disabled?: boolean;
|
|
63
|
-
/** Enable debug mode */
|
|
64
|
-
debug?: boolean;
|
|
65
|
-
/** Default properties for all events */
|
|
66
|
-
defaultProperties?: Record<string, string | number | boolean>;
|
|
67
|
-
/** Logger instance */
|
|
68
|
-
logger?: CliLogger;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Create a telemetry instance
|
|
72
|
-
*/
|
|
73
|
-
export declare function createTelemetry(options?: TelemetryOptions): Telemetry;
|
|
74
|
-
/**
|
|
75
|
-
* Create a disabled telemetry instance (for testing)
|
|
76
|
-
*/
|
|
77
|
-
export declare function createDisabledTelemetry(): Telemetry;
|
|
1
|
+
export { createTelemetry, Telemetry, TelemetryEventName, type TelemetryEventName as TelemetryEventNameType, type TelemetryOptions, } from '../utils/telemetry';
|
|
2
|
+
export declare function createDisabledTelemetry(): import("./telemetry").Telemetry;
|