@fiftth/fiftth-cli 0.1.0 → 1.0.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 (40) hide show
  1. package/.github/workflows/publish-npm.yml +62 -0
  2. package/README.md +123 -111
  3. package/dist/api/client.d.ts +1 -0
  4. package/dist/api/client.d.ts.map +1 -1
  5. package/dist/api/client.js +4 -0
  6. package/dist/api/client.js.map +1 -1
  7. package/dist/commands/checkout.d.ts +1 -1
  8. package/dist/commands/checkout.d.ts.map +1 -1
  9. package/dist/commands/checkout.js +63 -31
  10. package/dist/commands/checkout.js.map +1 -1
  11. package/dist/commands/tasks.d.ts.map +1 -1
  12. package/dist/commands/tasks.js +4 -1
  13. package/dist/commands/tasks.js.map +1 -1
  14. package/dist/config/configService.d.ts.map +1 -1
  15. package/dist/config/configService.js +17 -4
  16. package/dist/config/configService.js.map +1 -1
  17. package/dist/index.js +25 -25
  18. package/dist/index.js.map +1 -1
  19. package/dist/services/taskService.d.ts +1 -0
  20. package/dist/services/taskService.d.ts.map +1 -1
  21. package/dist/services/taskService.js +7 -0
  22. package/dist/services/taskService.js.map +1 -1
  23. package/package.json +56 -56
  24. package/src/api/client.ts +31 -26
  25. package/src/commands/checkout.ts +101 -68
  26. package/src/commands/login.ts +145 -145
  27. package/src/commands/repo.ts +113 -113
  28. package/src/commands/tasks.ts +86 -83
  29. package/src/commands/use.ts +149 -149
  30. package/src/config/configService.ts +56 -40
  31. package/src/context/runtimeContext.ts +42 -42
  32. package/src/git/gitService.ts +29 -29
  33. package/src/index.ts +133 -133
  34. package/src/services/taskContext.ts +32 -32
  35. package/src/services/taskService.ts +53 -45
  36. package/src/utils/api.ts +41 -41
  37. package/src/utils/config.ts +48 -48
  38. package/src/utils/ui.ts +46 -46
  39. package/tsconfig.json +18 -18
  40. package/vitest.config.ts +8 -8
@@ -1,48 +1,48 @@
1
- import os from 'os'
2
- import path from 'path'
3
- import fs from 'fs'
4
-
5
- export interface Config {
6
- token?: string
7
- host: string
8
- workspace?: string
9
- workspaceId?: string
10
- }
11
-
12
- const CONFIG_DIR = path.join(os.homedir(), '.fiftth')
13
- const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json')
14
-
15
- const DEFAULT_CONFIG: Config = {
16
- host: 'https://fiftth.com/api',
17
- }
18
-
19
- export function loadConfig(): Config {
20
- try {
21
- if (!fs.existsSync(CONFIG_FILE)) {
22
- return { ...DEFAULT_CONFIG }
23
- }
24
- const raw = fs.readFileSync(CONFIG_FILE, 'utf-8')
25
- return { ...DEFAULT_CONFIG, ...JSON.parse(raw) }
26
- } catch {
27
- return { ...DEFAULT_CONFIG }
28
- }
29
- }
30
-
31
- export function saveConfig(config: Config): void {
32
- if (!fs.existsSync(CONFIG_DIR)) {
33
- fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 })
34
- }
35
- fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), {
36
- mode: 0o600,
37
- encoding: 'utf-8',
38
- })
39
- }
40
-
41
- export function isAuthenticated(): boolean {
42
- const config = loadConfig()
43
- return Boolean(config.token)
44
- }
45
-
46
- export function getConfigPath(): string {
47
- return CONFIG_FILE
48
- }
1
+ import os from 'os'
2
+ import path from 'path'
3
+ import fs from 'fs'
4
+
5
+ export interface Config {
6
+ token?: string
7
+ host: string
8
+ workspace?: string
9
+ workspaceId?: string
10
+ }
11
+
12
+ const CONFIG_DIR = path.join(os.homedir(), '.fiftth')
13
+ const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json')
14
+
15
+ const DEFAULT_CONFIG: Config = {
16
+ host: 'https://fiftth.com/api',
17
+ }
18
+
19
+ export function loadConfig(): Config {
20
+ try {
21
+ if (!fs.existsSync(CONFIG_FILE)) {
22
+ return { ...DEFAULT_CONFIG }
23
+ }
24
+ const raw = fs.readFileSync(CONFIG_FILE, 'utf-8')
25
+ return { ...DEFAULT_CONFIG, ...JSON.parse(raw) }
26
+ } catch {
27
+ return { ...DEFAULT_CONFIG }
28
+ }
29
+ }
30
+
31
+ export function saveConfig(config: Config): void {
32
+ if (!fs.existsSync(CONFIG_DIR)) {
33
+ fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 })
34
+ }
35
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), {
36
+ mode: 0o600,
37
+ encoding: 'utf-8',
38
+ })
39
+ }
40
+
41
+ export function isAuthenticated(): boolean {
42
+ const config = loadConfig()
43
+ return Boolean(config.token)
44
+ }
45
+
46
+ export function getConfigPath(): string {
47
+ return CONFIG_FILE
48
+ }
package/src/utils/ui.ts CHANGED
@@ -1,46 +1,46 @@
1
- import chalk from 'chalk'
2
-
3
- export const BRAND_COLOR = '#C8A96A'
4
-
5
- export const ICONS = {
6
- brand: '◆',
7
- success: '✓',
8
- error: '✕',
9
- info: 'ℹ',
10
- arrow: '→',
11
- spark: '✦',
12
- } as const
13
-
14
- export const brand = chalk.hex(BRAND_COLOR)
15
-
16
- export function cmd(text: string): string {
17
- return brand(text)
18
- }
19
-
20
- export function title(text: string): string {
21
- return `${brand(ICONS.brand)} ${chalk.bold(text)}`
22
- }
23
-
24
- export function ok(text: string): string {
25
- return `${chalk.green(ICONS.success)} ${text}`
26
- }
27
-
28
- export function fail(text: string): string {
29
- return `${chalk.red(ICONS.error)} ${text}`
30
- }
31
-
32
- export function info(text: string): string {
33
- return `${brand(ICONS.info)} ${text}`
34
- }
35
-
36
- export function muted(text: string): string {
37
- return chalk.dim(text)
38
- }
39
-
40
- export function section(text: string): string {
41
- return `${brand(ICONS.spark)} ${chalk.bold(text)}`
42
- }
43
-
44
- export function kv(key: string, value: string): string {
45
- return `${brand(ICONS.arrow)} ${chalk.bold(`${key}:`)} ${value}`
46
- }
1
+ import chalk from 'chalk'
2
+
3
+ export const BRAND_COLOR = '#C8A96A'
4
+
5
+ export const ICONS = {
6
+ brand: '◆',
7
+ success: '✓',
8
+ error: '✕',
9
+ info: 'ℹ',
10
+ arrow: '→',
11
+ spark: '✦',
12
+ } as const
13
+
14
+ export const brand = chalk.hex(BRAND_COLOR)
15
+
16
+ export function cmd(text: string): string {
17
+ return brand(text)
18
+ }
19
+
20
+ export function title(text: string): string {
21
+ return `${brand(ICONS.brand)} ${chalk.bold(text)}`
22
+ }
23
+
24
+ export function ok(text: string): string {
25
+ return `${chalk.green(ICONS.success)} ${text}`
26
+ }
27
+
28
+ export function fail(text: string): string {
29
+ return `${chalk.red(ICONS.error)} ${text}`
30
+ }
31
+
32
+ export function info(text: string): string {
33
+ return `${brand(ICONS.info)} ${text}`
34
+ }
35
+
36
+ export function muted(text: string): string {
37
+ return chalk.dim(text)
38
+ }
39
+
40
+ export function section(text: string): string {
41
+ return `${brand(ICONS.spark)} ${chalk.bold(text)}`
42
+ }
43
+
44
+ export function kv(key: string, value: string): string {
45
+ return `${brand(ICONS.arrow)} ${chalk.bold(`${key}:`)} ${value}`
46
+ }
package/tsconfig.json CHANGED
@@ -1,18 +1,18 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "outDir": "dist",
7
- "rootDir": "src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "skipLibCheck": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true
15
- },
16
- "include": ["src/**/*"],
17
- "exclude": ["node_modules", "dist", "tests"]
18
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "skipLibCheck": true,
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "sourceMap": true
15
+ },
16
+ "include": ["src/**/*"],
17
+ "exclude": ["node_modules", "dist", "tests"]
18
+ }
package/vitest.config.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { defineConfig } from 'vitest/config'
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: 'node',
6
- globals: true,
7
- },
8
- })
1
+ import { defineConfig } from 'vitest/config'
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: 'node',
6
+ globals: true,
7
+ },
8
+ })