@telemetryos/cli 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +2 -2
  3. package/dist/commands/archive.d.ts +0 -13
  4. package/dist/commands/archive.js +0 -49
  5. package/dist/commands/auth.d.ts +0 -2
  6. package/dist/commands/auth.js +0 -60
  7. package/dist/commands/claude-code.d.ts +0 -2
  8. package/dist/commands/claude-code.js +0 -29
  9. package/dist/commands/init.d.ts +0 -2
  10. package/dist/commands/init.js +0 -176
  11. package/dist/commands/publish.d.ts +0 -22
  12. package/dist/commands/publish.js +0 -238
  13. package/dist/commands/root.d.ts +0 -2
  14. package/dist/commands/root.js +0 -5
  15. package/dist/commands/serve.d.ts +0 -2
  16. package/dist/commands/serve.js +0 -7
  17. package/dist/index.d.ts +0 -2
  18. package/dist/index.js +0 -13
  19. package/dist/plugins/math-tools.d.ts +0 -2
  20. package/dist/plugins/math-tools.js +0 -18
  21. package/dist/services/api-client.d.ts +0 -18
  22. package/dist/services/api-client.js +0 -70
  23. package/dist/services/archiver.d.ts +0 -4
  24. package/dist/services/archiver.js +0 -65
  25. package/dist/services/build-poller.d.ts +0 -10
  26. package/dist/services/build-poller.js +0 -63
  27. package/dist/services/cli-config.d.ts +0 -10
  28. package/dist/services/cli-config.js +0 -45
  29. package/dist/services/config.d.ts +0 -5
  30. package/dist/services/config.js +0 -23
  31. package/dist/services/create-project.d.ts +0 -13
  32. package/dist/services/create-project.js +0 -188
  33. package/dist/services/generate-application.d.ts +0 -12
  34. package/dist/services/generate-application.js +0 -206
  35. package/dist/services/project-config.d.ts +0 -27
  36. package/dist/services/project-config.js +0 -54
  37. package/dist/services/run-server.d.ts +0 -5
  38. package/dist/services/run-server.js +0 -327
  39. package/dist/types/api.d.ts +0 -44
  40. package/dist/types/api.js +0 -1
  41. package/dist/types/applications.d.ts +0 -44
  42. package/dist/types/applications.js +0 -1
  43. package/dist/utils/ansi.d.ts +0 -11
  44. package/dist/utils/ansi.js +0 -11
  45. package/dist/utils/path-utils.d.ts +0 -55
  46. package/dist/utils/path-utils.js +0 -99
  47. package/dist/utils/template.d.ts +0 -2
  48. package/dist/utils/template.js +0 -30
  49. package/dist/utils/validate-project-name.d.ts +0 -19
  50. package/dist/utils/validate-project-name.js +0 -44
@@ -1,44 +0,0 @@
1
- export type ApplicationKind = 'git' | 'github' | 'uploaded' | null;
2
- export type Application = {
3
- id: string;
4
- title: string;
5
- description: string;
6
- kind: ApplicationKind;
7
- baseImage: string;
8
- buildWorkingPath?: string;
9
- buildScript?: string;
10
- buildOutputPath?: string;
11
- buildEnvironmentVariables?: Record<string, string>;
12
- versions?: ApplicationVersion[];
13
- createdAt?: string;
14
- updatedAt?: string;
15
- };
16
- export type ApplicationVersion = {
17
- name?: string;
18
- version?: string;
19
- applicationId: string;
20
- buildId: string;
21
- applicationSpecifier: string;
22
- publishedAt: string;
23
- };
24
- export type ApplicationBuild = {
25
- id: string;
26
- applicationId: string;
27
- index: number;
28
- state: 'pending' | 'building' | 'success' | 'failure' | 'failed' | 'cancelled';
29
- logs: string[];
30
- scheduledAt?: string;
31
- startedAt?: string;
32
- finishedAt?: string;
33
- };
34
- export type CreateApplicationRequest = {
35
- kind: 'uploaded';
36
- title: string;
37
- description?: string;
38
- baseImage: string;
39
- baseImageRegistryAuth: string;
40
- buildWorkingPath: string;
41
- buildScript: string;
42
- buildOutputPath: string;
43
- buildEnvironmentVariables?: Record<string, string>;
44
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- export declare const ansi: {
2
- readonly white: "\u001B[37m";
3
- readonly yellow: "\u001B[33m";
4
- readonly green: "\u001B[32m";
5
- readonly cyan: "\u001B[36m";
6
- readonly red: "\u001B[31m";
7
- readonly bold: "\u001B[1m";
8
- readonly dim: "\u001B[2m";
9
- readonly reset: "\u001B[0m";
10
- };
11
- export declare const ansiRegex: RegExp;
@@ -1,11 +0,0 @@
1
- export const ansi = {
2
- white: '\u001b[37m',
3
- yellow: '\u001b[33m',
4
- green: '\u001b[32m',
5
- cyan: '\u001b[36m',
6
- red: '\u001b[31m',
7
- bold: '\u001b[1m',
8
- dim: '\u001b[2m',
9
- reset: '\u001b[0m',
10
- };
11
- export const ansiRegex = new RegExp(String.fromCharCode(27) + '\\[[0-9;]*m', 'g');
@@ -1,55 +0,0 @@
1
- /**
2
- * Converts a string to kebab-case
3
- *
4
- * @param str - The string to convert
5
- * @returns The kebab-cased string
6
- *
7
- * @example
8
- * toKebabCase('MyApp') // 'my-app'
9
- * toKebabCase('my_app') // 'my-app'
10
- * toKebabCase('My App!') // 'my-app'
11
- * toKebabCase('my--app') // 'my-app'
12
- */
13
- export declare function toKebabCase(str: string): string;
14
- /**
15
- * Derives a project name from a given path
16
- *
17
- * @param projectPath - The path to derive the name from
18
- * @param currentWorkingDirectory - The current working directory (defaults to process.cwd())
19
- * @returns The derived project name in kebab-case
20
- *
21
- * @example
22
- * deriveProjectName('my-project') // 'my-project'
23
- * deriveProjectName('apps/MyApp') // 'my-app'
24
- * deriveProjectName('./', '/Users/test/MyProject') // 'my-project'
25
- * deriveProjectName('../parent') // 'parent'
26
- * deriveProjectName('/absolute/path/to/app') // 'app'
27
- */
28
- export declare function deriveProjectName(projectPath: string, currentWorkingDirectory?: string): string;
29
- /**
30
- * Resolves a project path and derives the name
31
- *
32
- * @param projectPath - The path to resolve
33
- * @param currentWorkingDirectory - The current working directory (defaults to process.cwd())
34
- * @returns An object containing the resolved path and derived name
35
- *
36
- * @example
37
- * resolveProjectPathAndName('apps/MyApp')
38
- * // { resolvedPath: '/Users/user/cwd/apps/MyApp', derivedName: 'my-app' }
39
- */
40
- export declare function resolveProjectPathAndName(projectPath: string, currentWorkingDirectory?: string): {
41
- resolvedPath: string;
42
- derivedName: string;
43
- };
44
- /**
45
- * Validates a project name according to npm package name requirements
46
- *
47
- * @param name - The project name to validate
48
- * @returns true if valid, or an error message string if invalid
49
- *
50
- * @example
51
- * validateProjectName('my-app') // true
52
- * validateProjectName('') // 'Project name cannot be empty'
53
- * validateProjectName('MyApp') // 'Project name must contain only lowercase letters, numbers, and hyphens'
54
- */
55
- export declare function validateProjectName(name: string): true | string;
@@ -1,99 +0,0 @@
1
- /**
2
- * Utility functions for path handling and project name derivation
3
- */
4
- import path from 'node:path';
5
- /**
6
- * Converts a string to kebab-case
7
- *
8
- * @param str - The string to convert
9
- * @returns The kebab-cased string
10
- *
11
- * @example
12
- * toKebabCase('MyApp') // 'my-app'
13
- * toKebabCase('my_app') // 'my-app'
14
- * toKebabCase('My App!') // 'my-app'
15
- * toKebabCase('my--app') // 'my-app'
16
- */
17
- export function toKebabCase(str) {
18
- return (str
19
- .trim()
20
- // Remove special characters except spaces, underscores, and hyphens
21
- .replace(/[^a-zA-Z0-9\s_-]/g, '')
22
- // Replace spaces and underscores with hyphens
23
- .replace(/[\s_]+/g, '-')
24
- // Insert hyphen before uppercase letters preceded by lowercase
25
- .replace(/([a-z])([A-Z])/g, '$1-$2')
26
- // Convert to lowercase
27
- .toLowerCase()
28
- // Replace multiple consecutive hyphens with single hyphen
29
- .replace(/-+/g, '-')
30
- // Remove leading/trailing hyphens
31
- .replace(/^-+|-+$/g, ''));
32
- }
33
- /**
34
- * Derives a project name from a given path
35
- *
36
- * @param projectPath - The path to derive the name from
37
- * @param currentWorkingDirectory - The current working directory (defaults to process.cwd())
38
- * @returns The derived project name in kebab-case
39
- *
40
- * @example
41
- * deriveProjectName('my-project') // 'my-project'
42
- * deriveProjectName('apps/MyApp') // 'my-app'
43
- * deriveProjectName('./', '/Users/test/MyProject') // 'my-project'
44
- * deriveProjectName('../parent') // 'parent'
45
- * deriveProjectName('/absolute/path/to/app') // 'app'
46
- */
47
- export function deriveProjectName(projectPath, currentWorkingDirectory = process.cwd()) {
48
- // Resolve the path to handle relative paths
49
- const resolvedPath = path.resolve(currentWorkingDirectory, projectPath);
50
- // Get the last segment of the path
51
- const basename = path.basename(resolvedPath);
52
- // Convert to kebab-case
53
- return toKebabCase(basename);
54
- }
55
- /**
56
- * Resolves a project path and derives the name
57
- *
58
- * @param projectPath - The path to resolve
59
- * @param currentWorkingDirectory - The current working directory (defaults to process.cwd())
60
- * @returns An object containing the resolved path and derived name
61
- *
62
- * @example
63
- * resolveProjectPathAndName('apps/MyApp')
64
- * // { resolvedPath: '/Users/user/cwd/apps/MyApp', derivedName: 'my-app' }
65
- */
66
- export function resolveProjectPathAndName(projectPath, currentWorkingDirectory = process.cwd()) {
67
- const resolvedPath = path.resolve(currentWorkingDirectory, projectPath);
68
- const derivedName = deriveProjectName(projectPath, currentWorkingDirectory);
69
- return { resolvedPath, derivedName };
70
- }
71
- /**
72
- * Validates a project name according to npm package name requirements
73
- *
74
- * @param name - The project name to validate
75
- * @returns true if valid, or an error message string if invalid
76
- *
77
- * @example
78
- * validateProjectName('my-app') // true
79
- * validateProjectName('') // 'Project name cannot be empty'
80
- * validateProjectName('MyApp') // 'Project name must contain only lowercase letters, numbers, and hyphens'
81
- */
82
- export function validateProjectName(name) {
83
- if (!name || name.length === 0) {
84
- return 'Project name cannot be empty';
85
- }
86
- if (name.length > 214) {
87
- return 'Project name must be 214 characters or less';
88
- }
89
- if (name.startsWith('.') || name.startsWith('_')) {
90
- return 'Project name cannot start with . or _';
91
- }
92
- if (!/^[a-z0-9-]+$/.test(name)) {
93
- return 'Project name must contain only lowercase letters, numbers, and hyphens';
94
- }
95
- if (name.startsWith('-') || name.endsWith('-')) {
96
- return 'Project name cannot start or end with a hyphen';
97
- }
98
- return true;
99
- }
@@ -1,2 +0,0 @@
1
- export declare const templatesDir: string;
2
- export declare function copyDir(source: string, destination: string, replacements: Record<string, string>, progressFn: (createdFilePath: string) => void): Promise<void>;
@@ -1,30 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- export const templatesDir = path.join(import.meta.dirname, '../../templates');
4
- const ignoredTemplateFiles = ['.DS_Store', 'thumbs.db', 'node_modules', '.git', 'dist'];
5
- const dotfileNames = ['_gitignore', '_claude'];
6
- export async function copyDir(source, destination, replacements, progressFn) {
7
- const dirListing = await fs.readdir(source);
8
- for (const dirEntry of dirListing) {
9
- if (ignoredTemplateFiles.includes(dirEntry))
10
- continue;
11
- const sourcePath = path.join(source, dirEntry);
12
- const destinationPath = path.join(destination, dotfileNames.includes(dirEntry) ? `.${dirEntry.slice(1)}` : dirEntry);
13
- const stats = await fs.stat(sourcePath);
14
- if (stats.isDirectory()) {
15
- await fs.mkdir(destinationPath, { recursive: true });
16
- await copyDir(sourcePath, destinationPath, replacements, progressFn);
17
- }
18
- else if (stats.isFile()) {
19
- await copyFile(sourcePath, destinationPath, replacements, progressFn);
20
- }
21
- }
22
- }
23
- async function copyFile(source, destination, replacements, progressFn) {
24
- let contents = await fs.readFile(source, 'utf-8');
25
- for (const [key, value] of Object.entries(replacements)) {
26
- contents = contents.replace(new RegExp(`{{${key}}}`, 'g'), value);
27
- }
28
- await fs.writeFile(destination, contents, 'utf-8');
29
- progressFn(destination);
30
- }
@@ -1,19 +0,0 @@
1
- export type ValidationResult = {
2
- valid: true;
3
- } | {
4
- valid: false;
5
- errors: string[];
6
- };
7
- /**
8
- * Validates a project name against npm naming conventions.
9
- */
10
- export declare function validateProjectName(name: string): ValidationResult;
11
- /**
12
- * Formats validation errors for CLI display.
13
- */
14
- export declare function formatValidationErrors(errors: string[]): string;
15
- /**
16
- * Validator for Inquirer prompts.
17
- * Returns true if valid, or an error message string if invalid.
18
- */
19
- export declare function validateProjectNameForPrompt(input: string): string | true;
@@ -1,44 +0,0 @@
1
- import validateNpmPackageName from 'validate-npm-package-name';
2
- /**
3
- * Validates a project name against npm naming conventions.
4
- */
5
- export function validateProjectName(name) {
6
- const result = validateNpmPackageName(name);
7
- if (result.validForNewPackages) {
8
- return { valid: true };
9
- }
10
- const problems = [];
11
- if (result.errors) {
12
- problems.push(...result.errors);
13
- }
14
- if (result.warnings) {
15
- problems.push(...result.warnings);
16
- }
17
- return {
18
- valid: false,
19
- errors: problems.length > 0 ? problems : ['Invalid package name'],
20
- };
21
- }
22
- /**
23
- * Formats validation errors for CLI display.
24
- */
25
- export function formatValidationErrors(errors) {
26
- if (errors.length === 1) {
27
- return `Invalid project name: ${errors[0]}`;
28
- }
29
- return `Invalid project name:\n${errors.map((e) => ` - ${e}`).join('\n')}`;
30
- }
31
- /**
32
- * Validator for Inquirer prompts.
33
- * Returns true if valid, or an error message string if invalid.
34
- */
35
- export function validateProjectNameForPrompt(input) {
36
- if (!input || input.trim().length === 0) {
37
- return 'Project name cannot be empty';
38
- }
39
- const result = validateProjectName(input.trim());
40
- if (result.valid) {
41
- return true;
42
- }
43
- return formatValidationErrors(result.errors);
44
- }