sealos-cli 0.1.0 → 1.1.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sealos-cli",
3
- "version": "0.1.0",
4
- "description": "Official CLI tool for Sealos Cloud - Manage devbox, applications, databases, and object storage",
3
+ "version": "1.1.0",
4
+ "description": "Official CLI tool for Sealos Cloud - Manage auth, workspaces, devboxes, databases, and templates",
5
5
  "types": "dist/main.d.ts",
6
6
  "type": "module",
7
7
  "bin": {
@@ -36,7 +36,7 @@
36
36
  ],
37
37
  "scripts": {
38
38
  "start": "node --import tsx src/bin/cli.ts",
39
- "generate:api": "openapi-typescript src/docs/template_openapi.json -o src/generated/template.ts && openapi-typescript src/docs/database_openapi.json -o src/generated/database.ts",
39
+ "generate:api": "openapi-typescript src/docs/template_openapi.json -o src/generated/template.ts && openapi-typescript src/docs/database_openapi.json -o src/generated/database.ts && openapi-typescript src/docs/devbox_openapi.json -o src/generated/devbox.ts",
40
40
  "build": "npm run generate:api && tsc && tsup",
41
41
  "lint": "eslint . && npm run lint:lockfile && npm run lint:markdown",
42
42
  "lint:markdown": "npx -y markdownlint-cli@0.45.0 -c .github/.markdownlint.yml -i '.git' -i '__tests__' -i '.github' -i '.changeset' -i 'CODE_OF_CONDUCT.md' -i 'CHANGELOG.md' -i 'docs/**' -i 'node_modules' -i 'dist' '**/**.md' --fix",
@@ -64,10 +64,11 @@
64
64
  "cli",
65
65
  "cloud",
66
66
  "devbox",
67
- "s3",
68
67
  "database",
69
68
  "kubernetes",
70
- "deployment"
69
+ "deployment",
70
+ "template",
71
+ "workspace"
71
72
  ],
72
73
  "homepage": "https://github.com/zjy365/sealos-cli.git",
73
74
  "bugs": {
@@ -3,16 +3,17 @@ import { handleError } from '../../lib/errors.ts'
3
3
 
4
4
  export function createAppCommand (): Command {
5
5
  const appCmd = new Command('app')
6
- .description('Manage applications')
6
+ .description('Future application placeholder outside the v1 release surface')
7
7
 
8
- // TODO: 实现应用相关命令
8
+ // Future, non-v1 placeholder. Do not register this command until application
9
+ // APIs are implemented and ready for release.
9
10
 
10
11
  appCmd
11
12
  .command('list')
12
- .description('List all applications')
13
+ .description('Future application list placeholder outside the v1 release surface')
13
14
  .action(async () => {
14
15
  try {
15
- console.log('TODO: Implement app list')
16
+ console.log('Application commands are not part of the v1 release surface yet.')
16
17
  } catch (error) {
17
18
  handleError(error)
18
19
  }
@@ -37,11 +37,11 @@ type DatabaseType = typeof SUPPORTED_DATABASE_TYPES[number]
37
37
  type LogDbType = typeof SUPPORTED_LOG_DB_TYPES[number]
38
38
  type LogType = typeof SUPPORTED_LOG_TYPES[number]
39
39
 
40
- function collectOption (value: string, previous: string[]): string[] {
40
+ export function collectOption (value: string, previous: string[]): string[] {
41
41
  return [...previous, value]
42
42
  }
43
43
 
44
- function parseKeyValueArgs (pairs: string[]): Record<string, string> {
44
+ export function parseKeyValueArgs (pairs: string[]): Record<string, string> {
45
45
  const values: Record<string, string> = {}
46
46
  for (const pair of pairs) {
47
47
  const index = pair.indexOf('=')
@@ -53,7 +53,7 @@ function parseKeyValueArgs (pairs: string[]): Record<string, string> {
53
53
  return values
54
54
  }
55
55
 
56
- function normalizeDatabaseType (type: string): DatabaseType {
56
+ export function normalizeDatabaseType (type: string): DatabaseType {
57
57
  const normalized = type.trim().toLowerCase()
58
58
  const aliases: Record<string, DatabaseType> = {
59
59
  postgres: 'postgresql',
@@ -70,7 +70,7 @@ function normalizeDatabaseType (type: string): DatabaseType {
70
70
  return resolved
71
71
  }
72
72
 
73
- function normalizeLogDbType (type: string): LogDbType {
73
+ export function normalizeLogDbType (type: string): LogDbType {
74
74
  const normalized = normalizeDatabaseType(type)
75
75
  if (!SUPPORTED_LOG_DB_TYPES.includes(normalized as LogDbType)) {
76
76
  throw new Error(`Logs API only supports db types: ${SUPPORTED_LOG_DB_TYPES.join(', ')}`)
@@ -79,7 +79,7 @@ function normalizeLogDbType (type: string): LogDbType {
79
79
  return normalized as LogDbType
80
80
  }
81
81
 
82
- function normalizeLogType (type: string): LogType {
82
+ export function normalizeLogType (type: string): LogType {
83
83
  const normalized = type.trim() as LogType
84
84
  if (!SUPPORTED_LOG_TYPES.includes(normalized)) {
85
85
  throw new Error(`Unsupported log type "${type}". Use one of: ${SUPPORTED_LOG_TYPES.join(', ')}`)
@@ -88,7 +88,7 @@ function normalizeLogType (type: string): LogType {
88
88
  return normalized
89
89
  }
90
90
 
91
- function parseNumericValue (value: string, field: string): number {
91
+ export function parseNumericValue (value: string, field: string): number {
92
92
  const normalized = value.trim().toLowerCase()
93
93
  let raw = normalized
94
94
 
@@ -108,7 +108,7 @@ function parseNumericValue (value: string, field: string): number {
108
108
  return parsed
109
109
  }
110
110
 
111
- function parseIntegerValue (value: string, field: string): number {
111
+ export function parseIntegerValue (value: string, field: string): number {
112
112
  const parsed = parseNumericValue(value, field)
113
113
  if (!Number.isInteger(parsed)) {
114
114
  throw new Error(`${field} must be an integer`)
@@ -116,7 +116,7 @@ function parseIntegerValue (value: string, field: string): number {
116
116
  return parsed
117
117
  }
118
118
 
119
- function buildQuota (options: { cpu?: string; memory?: string; storage?: string; replicas?: string }): Record<string, number> {
119
+ export function buildQuota (options: { cpu?: string; memory?: string; storage?: string; replicas?: string }): Record<string, number> {
120
120
  const quota: Record<string, number> = {}
121
121
 
122
122
  if (options.cpu !== undefined) quota.cpu = parseNumericValue(options.cpu, 'cpu')
@@ -127,7 +127,7 @@ function buildQuota (options: { cpu?: string; memory?: string; storage?: string;
127
127
  return quota
128
128
  }
129
129
 
130
- function buildAutoBackup (options: {
130
+ export function buildAutoBackup (options: {
131
131
  backupStart?: boolean
132
132
  backupType?: string
133
133
  backupWeek: string[]
@@ -154,12 +154,12 @@ function formatValue (value: unknown): string {
154
154
  return String(value)
155
155
  }
156
156
 
157
- function summarizeVersions (versions: string[]): string {
157
+ export function summarizeVersions (versions: string[]): string {
158
158
  if (versions.length <= 3) return versions.join(', ')
159
159
  return `${versions.slice(0, 3).join(', ')} ... (${versions.length} total)`
160
160
  }
161
161
 
162
- function extractVersionsMap (payload: any): Record<string, string[]> {
162
+ export function extractVersionsMap (payload: any): Record<string, string[]> {
163
163
  if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
164
164
  if (payload.data && typeof payload.data === 'object' && !Array.isArray(payload.data)) {
165
165
  return payload.data as Record<string, string[]>
@@ -445,7 +445,7 @@ export function createDatabaseCommand (): Command {
445
445
 
446
446
  ctx.spinner.succeed(`Database "${data.name}" created successfully`)
447
447
  console.log(chalk.dim(` Provisioning status: ${data.status}`))
448
- console.log(chalk.dim(` Next: sealos database get ${data.name}`))
448
+ console.log(chalk.dim(` Next: sealos-cli database get ${data.name}`))
449
449
  }))
450
450
 
451
451
  dbCmd