@take-out/cli 0.2.10 → 0.3.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 (114) hide show
  1. package/dist/cjs/cli.cjs +0 -0
  2. package/dist/esm/cli.mjs +0 -0
  3. package/dist/esm/index.js +1 -3
  4. package/dist/esm/index.js.map +1 -6
  5. package/package.json +7 -6
  6. package/src/commands/changed.ts +6 -6
  7. package/src/commands/onboard.ts +63 -63
  8. package/src/commands/run.ts +1 -1
  9. package/src/commands/script.ts +3 -3
  10. package/src/commands/skills.ts +6 -6
  11. package/src/commands/sync.ts +3 -3
  12. package/src/utils/env-setup.ts +8 -8
  13. package/src/utils/env.ts +3 -3
  14. package/src/utils/files.ts +6 -6
  15. package/src/utils/parallel-runner.ts +1 -1
  16. package/src/utils/prompts.ts +6 -6
  17. package/src/utils/script-listing.ts +5 -5
  18. package/src/utils/script-utils.ts +1 -1
  19. package/src/utils/sync.ts +1 -1
  20. package/src/withExpoModulesCoreSwift6Fix.cjs +58 -0
  21. package/dist/cjs/cli.js +0 -123
  22. package/dist/cjs/cli.js.map +0 -6
  23. package/dist/cjs/commands/changed.js +0 -214
  24. package/dist/cjs/commands/changed.js.map +0 -6
  25. package/dist/cjs/commands/docs.js +0 -174
  26. package/dist/cjs/commands/docs.js.map +0 -6
  27. package/dist/cjs/commands/env-setup.js +0 -78
  28. package/dist/cjs/commands/env-setup.js.map +0 -6
  29. package/dist/cjs/commands/onboard.js +0 -641
  30. package/dist/cjs/commands/onboard.js.map +0 -6
  31. package/dist/cjs/commands/run-all.js +0 -74
  32. package/dist/cjs/commands/run-all.js.map +0 -6
  33. package/dist/cjs/commands/run.js +0 -95
  34. package/dist/cjs/commands/run.js.map +0 -6
  35. package/dist/cjs/commands/script.js +0 -261
  36. package/dist/cjs/commands/script.js.map +0 -6
  37. package/dist/cjs/commands/skills.js +0 -168
  38. package/dist/cjs/commands/skills.js.map +0 -6
  39. package/dist/cjs/commands/sync.js +0 -187
  40. package/dist/cjs/commands/sync.js.map +0 -6
  41. package/dist/cjs/constants/ascii.js +0 -30
  42. package/dist/cjs/constants/ascii.js.map +0 -6
  43. package/dist/cjs/index.js +0 -21
  44. package/dist/cjs/index.js.map +0 -6
  45. package/dist/cjs/types.js +0 -14
  46. package/dist/cjs/types.js.map +0 -6
  47. package/dist/cjs/utils/env-categories.js +0 -296
  48. package/dist/cjs/utils/env-categories.js.map +0 -6
  49. package/dist/cjs/utils/env-setup.js +0 -190
  50. package/dist/cjs/utils/env-setup.js.map +0 -6
  51. package/dist/cjs/utils/env.js +0 -97
  52. package/dist/cjs/utils/env.js.map +0 -6
  53. package/dist/cjs/utils/files.js +0 -164
  54. package/dist/cjs/utils/files.js.map +0 -6
  55. package/dist/cjs/utils/parallel-runner.js +0 -113
  56. package/dist/cjs/utils/parallel-runner.js.map +0 -6
  57. package/dist/cjs/utils/ports.js +0 -81
  58. package/dist/cjs/utils/ports.js.map +0 -6
  59. package/dist/cjs/utils/prerequisites.js +0 -107
  60. package/dist/cjs/utils/prerequisites.js.map +0 -6
  61. package/dist/cjs/utils/prompts.js +0 -162
  62. package/dist/cjs/utils/prompts.js.map +0 -6
  63. package/dist/cjs/utils/script-listing.js +0 -97
  64. package/dist/cjs/utils/script-listing.js.map +0 -6
  65. package/dist/cjs/utils/script-utils.js +0 -82
  66. package/dist/cjs/utils/script-utils.js.map +0 -6
  67. package/dist/cjs/utils/sync.js +0 -70
  68. package/dist/cjs/utils/sync.js.map +0 -6
  69. package/dist/esm/cli.js +0 -106
  70. package/dist/esm/cli.js.map +0 -6
  71. package/dist/esm/commands/changed.js +0 -194
  72. package/dist/esm/commands/changed.js.map +0 -6
  73. package/dist/esm/commands/docs.js +0 -159
  74. package/dist/esm/commands/docs.js.map +0 -6
  75. package/dist/esm/commands/env-setup.js +0 -56
  76. package/dist/esm/commands/env-setup.js.map +0 -6
  77. package/dist/esm/commands/onboard.js +0 -655
  78. package/dist/esm/commands/onboard.js.map +0 -6
  79. package/dist/esm/commands/run-all.js +0 -53
  80. package/dist/esm/commands/run-all.js.map +0 -6
  81. package/dist/esm/commands/run.js +0 -74
  82. package/dist/esm/commands/run.js.map +0 -6
  83. package/dist/esm/commands/script.js +0 -255
  84. package/dist/esm/commands/script.js.map +0 -6
  85. package/dist/esm/commands/skills.js +0 -159
  86. package/dist/esm/commands/skills.js.map +0 -6
  87. package/dist/esm/commands/sync.js +0 -177
  88. package/dist/esm/commands/sync.js.map +0 -6
  89. package/dist/esm/constants/ascii.js +0 -14
  90. package/dist/esm/constants/ascii.js.map +0 -6
  91. package/dist/esm/types.js +0 -1
  92. package/dist/esm/types.js.map +0 -6
  93. package/dist/esm/utils/env-categories.js +0 -272
  94. package/dist/esm/utils/env-categories.js.map +0 -6
  95. package/dist/esm/utils/env-setup.js +0 -171
  96. package/dist/esm/utils/env-setup.js.map +0 -6
  97. package/dist/esm/utils/env.js +0 -83
  98. package/dist/esm/utils/env.js.map +0 -6
  99. package/dist/esm/utils/files.js +0 -150
  100. package/dist/esm/utils/files.js.map +0 -6
  101. package/dist/esm/utils/parallel-runner.js +0 -98
  102. package/dist/esm/utils/parallel-runner.js.map +0 -6
  103. package/dist/esm/utils/ports.js +0 -65
  104. package/dist/esm/utils/ports.js.map +0 -6
  105. package/dist/esm/utils/prerequisites.js +0 -91
  106. package/dist/esm/utils/prerequisites.js.map +0 -6
  107. package/dist/esm/utils/prompts.js +0 -139
  108. package/dist/esm/utils/prompts.js.map +0 -6
  109. package/dist/esm/utils/script-listing.js +0 -80
  110. package/dist/esm/utils/script-listing.js.map +0 -6
  111. package/dist/esm/utils/script-utils.js +0 -68
  112. package/dist/esm/utils/script-utils.js.map +0 -6
  113. package/dist/esm/utils/sync.js +0 -50
  114. package/dist/esm/utils/sync.js.map +0 -6
@@ -18,7 +18,7 @@ interface SetupOptions {
18
18
 
19
19
  export async function setupProductionEnv(
20
20
  cwd: string,
21
- options: SetupOptions = {}
21
+ options: SetupOptions = {},
22
22
  ): Promise<boolean> {
23
23
  const envFile = options.envFile || '.env.production'
24
24
  const fullPath = resolve(cwd, envFile)
@@ -28,7 +28,7 @@ export async function setupProductionEnv(
28
28
  console.info('\n' + pc.yellow('Setup interrupted. You can resume anytime with:'))
29
29
  console.info(pc.cyan(' bun takeout env:setup'))
30
30
  console.info(
31
- pc.gray('\nNote: All environment variables are optional for local development.')
31
+ pc.gray('\nNote: All environment variables are optional for local development.'),
32
32
  )
33
33
  process.exit(0)
34
34
  }
@@ -89,7 +89,7 @@ export async function setupProductionEnv(
89
89
  if (clack.isCancel(setupProd) || !setupProd) {
90
90
  clack.note(
91
91
  `You can set up production environment later with:\n${pc.cyan('bun takeout env:setup')}`,
92
- pc.yellow('Skipping production setup')
92
+ pc.yellow('Skipping production setup'),
93
93
  )
94
94
  process.removeListener('SIGINT', cleanup)
95
95
  process.removeListener('SIGTERM', cleanup)
@@ -123,14 +123,14 @@ export async function setupProductionEnv(
123
123
  if (configuredVars.length > 0) {
124
124
  clack.outro(pc.green('✓ Environment setup complete!'))
125
125
  console.info(
126
- pc.gray(`\nConfigured ${configuredVars.length} variables in ${envFile}`)
126
+ pc.gray(`\nConfigured ${configuredVars.length} variables in ${envFile}`),
127
127
  )
128
128
 
129
129
  if (skippedVars.length > 0) {
130
130
  console.info(
131
131
  pc.yellow(
132
- `\nNote: Some required variables were skipped. You'll need to configure these before deploying:`
133
- )
132
+ `\nNote: Some required variables were skipped. You'll need to configure these before deploying:`,
133
+ ),
134
134
  )
135
135
  skippedVars.forEach((v) => console.info(pc.gray(` - ${v}`)))
136
136
  }
@@ -163,7 +163,7 @@ async function setupCategory(
163
163
  category: EnvCategory,
164
164
  envFile: string,
165
165
  cwd: string,
166
- options: SetupOptions
166
+ options: SetupOptions,
167
167
  ): Promise<boolean> {
168
168
  const spinner = clack.spinner()
169
169
 
@@ -200,7 +200,7 @@ async function setupCategory(
200
200
  async function setupVariable(
201
201
  variable: EnvVariable,
202
202
  envFile: string,
203
- cwd: string
203
+ cwd: string,
204
204
  ): Promise<void> {
205
205
  // check if already configured
206
206
  const existingValue = readEnvVariable(cwd, variable.key, envFile)
package/src/utils/env.ts CHANGED
@@ -17,7 +17,7 @@ export function envFileExists(cwd: string, filename = '.env'): boolean {
17
17
  export function copyEnvFile(
18
18
  cwd: string,
19
19
  source: string,
20
- target: string
20
+ target: string,
21
21
  ): { success: boolean; error?: string } {
22
22
  const sourcePath = join(cwd, source)
23
23
  const targetPath = join(cwd, target)
@@ -45,7 +45,7 @@ export function updateEnvVariable(
45
45
  cwd: string,
46
46
  key: string,
47
47
  value: string,
48
- filename = '.env'
48
+ filename = '.env',
49
49
  ): { success: boolean; error?: string } {
50
50
  const envPath = join(cwd, filename)
51
51
 
@@ -108,7 +108,7 @@ export function createEnvLocal(cwd: string): { success: boolean; error?: string
108
108
  export function readEnvVariable(
109
109
  cwd: string,
110
110
  key: string,
111
- filename = '.env'
111
+ filename = '.env',
112
112
  ): string | null {
113
113
  const envPath = join(cwd, filename)
114
114
 
@@ -8,7 +8,7 @@ import { join } from 'node:path'
8
8
 
9
9
  export function updatePackageJson(
10
10
  cwd: string,
11
- updates: { name?: string; description?: string }
11
+ updates: { name?: string; description?: string },
12
12
  ): { success: boolean; error?: string } {
13
13
  const packagePath = join(cwd, 'package.json')
14
14
 
@@ -35,7 +35,7 @@ export function updatePackageJson(
35
35
 
36
36
  export function updateAppConfig(
37
37
  cwd: string,
38
- updates: { name?: string; slug?: string; bundleId?: string }
38
+ updates: { name?: string; slug?: string; bundleId?: string },
39
39
  ): { success: boolean; error?: string } {
40
40
  const configPath = join(cwd, 'app.config.ts')
41
41
 
@@ -60,12 +60,12 @@ export function updateAppConfig(
60
60
  // Update iOS bundle identifier
61
61
  content = content.replace(
62
62
  /(bundleIdentifier:\s*['"])([^'"]+)(['"])/,
63
- `$1${updates.bundleId}$3`
63
+ `$1${updates.bundleId}$3`,
64
64
  )
65
65
  // Update Android package
66
66
  content = content.replace(
67
67
  /(package:\s*['"])([^'"]+)(['"])/,
68
- `$1${updates.bundleId}$3`
68
+ `$1${updates.bundleId}$3`,
69
69
  )
70
70
  }
71
71
 
@@ -122,7 +122,7 @@ export function markOnboarded(cwd: string): { success: boolean; error?: string }
122
122
  */
123
123
  export function updatePackageJsonEnv(
124
124
  cwd: string,
125
- platform: 'sst' | 'uncloud'
125
+ platform: 'sst' | 'uncloud',
126
126
  ): { success: boolean; error?: string } {
127
127
  const packagePath = join(cwd, 'package.json')
128
128
 
@@ -176,7 +176,7 @@ export interface EjectResult {
176
176
  */
177
177
  export async function ejectFromMonorepo(
178
178
  cwd: string,
179
- options: EjectOptions = {}
179
+ options: EjectOptions = {},
180
180
  ): Promise<EjectResult> {
181
181
  const { dryRun = false } = options
182
182
  const packagePath = join(cwd, 'package.json')
@@ -81,7 +81,7 @@ export async function runScriptsInParallel(
81
81
  title?: string
82
82
  onError?: 'continue' | 'exit'
83
83
  maxParallelism?: number
84
- } = {}
84
+ } = {},
85
85
  ): Promise<void> {
86
86
  const { title, onError = 'exit', maxParallelism = cpus().length } = options
87
87
 
@@ -13,9 +13,9 @@ export function displayWelcome(projectName = 'Takeout'): void {
13
13
  console.info()
14
14
  p.note(
15
15
  pc.dim(
16
- "You can re-run 'bun onboard' anytime to reconfigure or skip to specific steps.\nNo need to decide everything upfront!"
16
+ "You can re-run 'bun onboard' anytime to reconfigure or skip to specific steps.\nNo need to decide everything upfront!",
17
17
  ),
18
- pc.cyan('Tip')
18
+ pc.cyan('Tip'),
19
19
  )
20
20
  }
21
21
 
@@ -49,7 +49,7 @@ export function displayPortConflicts(conflicts: PortCheck[]): void {
49
49
 
50
50
  export async function confirmContinue(
51
51
  message: string,
52
- defaultValue = true
52
+ defaultValue = true,
53
53
  ): Promise<boolean> {
54
54
  const result = await p.confirm({
55
55
  message,
@@ -67,7 +67,7 @@ export async function confirmContinue(
67
67
  export async function promptText(
68
68
  message: string,
69
69
  defaultValue?: string,
70
- placeholder?: string
70
+ placeholder?: string,
71
71
  ): Promise<string> {
72
72
  const result = await p.text({
73
73
  message,
@@ -98,7 +98,7 @@ export async function promptPassword(message: string): Promise<string> {
98
98
 
99
99
  export async function promptSelect<T extends string>(
100
100
  message: string,
101
- options: { value: T; label: string; hint?: string }[]
101
+ options: { value: T; label: string; hint?: string }[],
102
102
  ): Promise<T | 'cancel'> {
103
103
  const result = await p.select({
104
104
  message,
@@ -155,7 +155,7 @@ export async function promptStartStep(): Promise<
155
155
 
156
156
  export async function promptOldSelect<T extends string>(
157
157
  message: string,
158
- options: { value: T; label: string; hint?: string }[]
158
+ options: { value: T; label: string; hint?: string }[],
159
159
  ): Promise<T> {
160
160
  const result = await p.select<string>({
161
161
  message,
@@ -37,7 +37,7 @@ function findScriptsPackageRoot(): string | null {
37
37
  function formatScriptList(
38
38
  title: string,
39
39
  scripts: Map<string, string>,
40
- metadata: Map<string, ScriptMetadata>
40
+ metadata: Map<string, ScriptMetadata>,
41
41
  ): void {
42
42
  if (scripts.size === 0) return
43
43
 
@@ -127,7 +127,7 @@ export async function listAllScripts(includeCommands = true) {
127
127
  console.info(pc.yellow('No scripts found'))
128
128
  console.info()
129
129
  console.info(
130
- pc.dim(`Create scripts in ${relative(process.cwd(), getLocalScriptsDir())}/`)
130
+ pc.dim(`Create scripts in ${relative(process.cwd(), getLocalScriptsDir())}/`),
131
131
  )
132
132
  console.info(pc.dim(`Or install @take-out/scripts package for built-in scripts`))
133
133
  }
@@ -135,13 +135,13 @@ export async function listAllScripts(includeCommands = true) {
135
135
  console.info()
136
136
  console.info(pc.bold('Usage:'))
137
137
  console.info(
138
- ` ${pc.cyan('tko <command>')} ${pc.dim('Run a built-in command')}`
138
+ ` ${pc.cyan('tko <command>')} ${pc.dim('Run a built-in command')}`,
139
139
  )
140
140
  console.info(
141
- ` ${pc.cyan('tko <script-name>')} ${pc.dim('Execute direct script')}`
141
+ ` ${pc.cyan('tko <script-name>')} ${pc.dim('Execute direct script')}`,
142
142
  )
143
143
  console.info(
144
- ` ${pc.cyan('tko <group> <script>')} ${pc.dim('Execute nested script')}`
144
+ ` ${pc.cyan('tko <group> <script>')} ${pc.dim('Execute nested script')}`,
145
145
  )
146
146
  console.info(` ${pc.cyan('tko script new <path>')} ${pc.dim('Create a new script')}`)
147
147
  console.info()
@@ -19,7 +19,7 @@ export function getLocalScriptsDir(): string {
19
19
 
20
20
  // batch extract metadata for all scripts via import interception
21
21
  export async function getAllScriptMetadata(
22
- scripts: Map<string, string>
22
+ scripts: Map<string, string>,
23
23
  ): Promise<Map<string, ScriptMetadata>> {
24
24
  const collected = new Map<string, { description: string; args?: string }>()
25
25
  let currentName = ''
package/src/utils/sync.ts CHANGED
@@ -25,7 +25,7 @@ export function getFileHash(filePath: string): string {
25
25
 
26
26
  export function compareFiles(
27
27
  sourcePath: string,
28
- targetPath: string
28
+ targetPath: string,
29
29
  ): 'new' | 'modified' | 'identical' {
30
30
  if (!existsSync(targetPath)) {
31
31
  return 'new'
@@ -0,0 +1,58 @@
1
+ const { withDangerousMod } = require('@expo/config-plugins')
2
+ const fs = require('node:fs')
3
+ const path = require('node:path')
4
+
5
+ /**
6
+ * expo config plugin to fix expo-modules-core 55.x swift 6 strict concurrency errors
7
+ * that break TurboModule registration (PlatformConstants not found)
8
+ * adapted from tamagui/kitchen-sink
9
+ * see: https://github.com/expo/expo/issues/42525
10
+ */
11
+ function withExpoModulesCoreSwift6Fix(config) {
12
+ return withDangerousMod(config, [
13
+ 'ios',
14
+ async (config) => {
15
+ const podfilePath = path.join(config.modRequest.platformProjectRoot, 'Podfile')
16
+
17
+ if (!fs.existsSync(podfilePath)) {
18
+ return config
19
+ }
20
+
21
+ let podfile = fs.readFileSync(podfilePath, 'utf8')
22
+
23
+ if (podfile.includes('# workaround: expo-modules-core 55.x')) {
24
+ return config
25
+ }
26
+
27
+ const workaround = `
28
+ # workaround: expo-modules-core 55.x requires Swift 6 mode with isolated
29
+ # conformances (SE-0470) for @MainActor in protocol conformance syntax.
30
+ # SWIFT_STRICT_CONCURRENCY=minimal suppresses concurrency warnings/errors.
31
+ installer.pods_project.targets.each do |target|
32
+ if target.name == 'ExpoModulesCore'
33
+ target.build_configurations.each do |build_config|
34
+ build_config.build_settings['SWIFT_VERSION'] = '6'
35
+ build_config.build_settings['SWIFT_STRICT_CONCURRENCY'] = 'minimal'
36
+ flags = build_config.build_settings['OTHER_SWIFT_FLAGS'] || '$(inherited)'
37
+ unless flags.include?('IsolatedConformances')
38
+ build_config.build_settings['OTHER_SWIFT_FLAGS'] = "#{flags} -enable-upcoming-feature IsolatedConformances"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ `
44
+ const updated = podfile.replace(
45
+ /(post_install do \|installer\|.*?)(^\s+end\s*\nend)/ms,
46
+ `$1${workaround}$2`,
47
+ )
48
+
49
+ if (updated !== podfile) {
50
+ fs.writeFileSync(podfilePath, updated)
51
+ }
52
+
53
+ return config
54
+ },
55
+ ])
56
+ }
57
+
58
+ module.exports = withExpoModulesCoreSwift6Fix
package/dist/cjs/cli.js DELETED
@@ -1,123 +0,0 @@
1
- #!/usr/bin/env bun
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function")
9
- for (let key of __getOwnPropNames(from))
10
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- return to;
12
- };
13
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
14
- // If the importer is in node compatibility mode or this is not an ESM
15
- // file that has been converted to a CommonJS file using a Babel-
16
- // compatible transform (i.e. "__esModule" has not been set), then set
17
- // "default" to the CommonJS "module.exports" for node compatibility.
18
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
19
- mod
20
- ));
21
- var import_node_child_process = require("node:child_process"), import_node_fs = require("node:fs"), import_node_path = require("node:path"), import_citty = require("citty");
22
- const import_meta = {};
23
- function isScriptCategory(name) {
24
- const scriptsDir = (0, import_node_path.join)(process.cwd(), "scripts"), categoryPath = (0, import_node_path.join)(scriptsDir, name);
25
- try {
26
- return (0, import_node_fs.existsSync)(categoryPath) && (0, import_node_fs.statSync)(categoryPath).isDirectory();
27
- } catch {
28
- return !1;
29
- }
30
- }
31
- function findLocalScript(name) {
32
- const scriptsDir = (0, import_node_path.join)(process.cwd(), "scripts"), normalizedName = name.replace(/:/g, "/");
33
- for (const ext of [".ts", ".js", ""]) {
34
- const scriptPath = (0, import_node_path.join)(scriptsDir, `${normalizedName}${ext}`);
35
- if ((0, import_node_fs.existsSync)(scriptPath))
36
- return scriptPath;
37
- }
38
- return null;
39
- }
40
- function isLocalScript(name) {
41
- return findLocalScript(name) !== null;
42
- }
43
- function findBuiltInScript(name) {
44
- try {
45
- const resolved = import_meta.resolve("@take-out/scripts/package.json"), packageJsonPath = new URL(resolved).pathname, packageRoot = (0, import_node_path.join)(packageJsonPath, ".."), srcPath = (0, import_node_path.join)(packageRoot, "src"), normalizedName = name.replace(/:/g, "/");
46
- for (const ext of [".ts", ".js", ""]) {
47
- const scriptPath = (0, import_node_path.join)(srcPath, `${normalizedName}${ext}`);
48
- if ((0, import_node_fs.existsSync)(scriptPath))
49
- return scriptPath;
50
- }
51
- } catch {
52
- }
53
- return null;
54
- }
55
- function isBuiltInScript(name) {
56
- return findBuiltInScript(name) !== null;
57
- }
58
- const isShorthand = !0;
59
- if (isShorthand) {
60
- const firstArg = process.argv[2];
61
- if (firstArg && ![
62
- "docs",
63
- "onboard",
64
- "run",
65
- "run-all",
66
- "script",
67
- "skills",
68
- "env:setup",
69
- "sync",
70
- "changed",
71
- "--help",
72
- "-h",
73
- "--version",
74
- "-v"
75
- ].includes(firstArg)) {
76
- let resolvedScriptName;
77
- if (isScriptCategory(firstArg)) {
78
- const restArgs = process.argv.slice(3), subScriptIdx = restArgs.findIndex((a) => !a.startsWith("-"));
79
- if (subScriptIdx !== -1) {
80
- const subScript = restArgs[subScriptIdx];
81
- resolvedScriptName = `${firstArg}/${subScript}`, process.argv.splice(3 + subScriptIdx, 1), process.argv[2] = resolvedScriptName;
82
- }
83
- process.argv.splice(2, 0, "run");
84
- } else firstArg?.includes("/") || isLocalScript(firstArg) || isBuiltInScript(firstArg) ? (resolvedScriptName = firstArg, process.argv.splice(2, 0, "run")) : process.argv.splice(2, 0, "script");
85
- const hasHelp = process.argv.includes("--help") || process.argv.includes("-h");
86
- if (resolvedScriptName && hasHelp) {
87
- const scriptPath = findLocalScript(resolvedScriptName) || findBuiltInScript(resolvedScriptName);
88
- if (scriptPath) {
89
- const flagArgs = process.argv.slice(3).filter((a) => a !== resolvedScriptName), result = (0, import_node_child_process.spawnSync)("bun", [scriptPath, ...flagArgs], {
90
- stdio: "inherit",
91
- shell: !1
92
- });
93
- process.exit(result.status || 0);
94
- }
95
- }
96
- }
97
- }
98
- const main = (0, import_citty.defineCommand)({
99
- meta: {
100
- name: isShorthand ? "tko" : "takeout",
101
- version: "0.0.2",
102
- description: "CLI tools for Takeout starter kit"
103
- },
104
- subCommands: {
105
- onboard: () => import("./commands/onboard").then((m) => m.onboardCommand),
106
- docs: () => import("./commands/docs").then((m) => m.docsCommand),
107
- "env:setup": () => import("./commands/env-setup").then((m) => m.envSetupCommand),
108
- run: () => import("./commands/run").then((m) => m.runCommand),
109
- "run-all": () => import("./commands/run-all").then((m) => m.runAllCommand),
110
- script: () => import("./commands/script").then((m) => m.scriptCommand),
111
- skills: () => import("./commands/skills").then((m) => m.skillsCommand),
112
- sync: () => import("./commands/sync").then((m) => m.syncCommand),
113
- changed: () => import("./commands/changed").then((m) => m.changedCommand)
114
- },
115
- async run() {
116
- if (!(process.argv.length > 2)) {
117
- const { listAllScripts } = await import("./utils/script-listing");
118
- await listAllScripts();
119
- }
120
- }
121
- });
122
- (0, import_citty.runMain)(main);
123
- //# sourceMappingURL=cli.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/cli.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAOA,gCAA0B,+BAC1B,iBAAqC,oBACrC,mBAAqB,sBAErB,eAAuC;AAXvC;AAcA,SAAS,iBAAiB,MAAuB;AAC/C,QAAM,iBAAa,uBAAK,QAAQ,IAAI,GAAG,SAAS,GAC1C,mBAAe,uBAAK,YAAY,IAAI;AAE1C,MAAI;AACF,eAAO,2BAAW,YAAY,SAAK,yBAAS,YAAY,EAAE,YAAY;AAAA,EACxE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,SAAS,gBAAgB,MAA6B;AACpD,QAAM,iBAAa,uBAAK,QAAQ,IAAI,GAAG,SAAS,GAC1C,iBAAiB,KAAK,QAAQ,MAAM,GAAG;AAE7C,aAAW,OAAO,CAAC,OAAO,OAAO,EAAE,GAAG;AACpC,UAAM,iBAAa,uBAAK,YAAY,GAAG,cAAc,GAAG,GAAG,EAAE;AAC7D,YAAI,2BAAW,UAAU;AACvB,aAAO;AAAA,EAEX;AAEA,SAAO;AACT;AAEA,SAAS,cAAc,MAAuB;AAC5C,SAAO,gBAAgB,IAAI,MAAM;AACnC;AAGA,SAAS,kBAAkB,MAA6B;AACtD,MAAI;AACF,UAAM,WAAW,YAAY,QAAQ,gCAAgC,GAC/D,kBAAkB,IAAI,IAAI,QAAQ,EAAE,UACpC,kBAAc,uBAAK,iBAAiB,IAAI,GACxC,cAAU,uBAAK,aAAa,KAAK,GAGjC,iBAAiB,KAAK,QAAQ,MAAM,GAAG;AAG7C,eAAW,OAAO,CAAC,OAAO,OAAO,EAAE,GAAG;AACpC,YAAM,iBAAa,uBAAK,SAAS,GAAG,cAAc,GAAG,GAAG,EAAE;AAC1D,cAAI,2BAAW,UAAU;AACvB,eAAO;AAAA,IAEX;AAAA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0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var changed_exports = {};
24
- __export(changed_exports, {
25
- changedCommand: () => changedCommand
26
- });
27
- module.exports = __toCommonJS(changed_exports);
28
- var import_node_child_process = require("node:child_process"), import_node_fs = require("node:fs"), import_node_path = require("node:path"), import_citty = require("citty"), import_picocolors = __toESM(require("picocolors"), 1);
29
- const UPSTREAM_REPO = "tamagui/takeout2", UPSTREAM_REMOTE = "takeout-upstream", TAKEOUT_FILE = ".takeout", COMMIT_TYPE_ORDER = [
30
- "feat",
31
- "fix",
32
- "perf",
33
- "refactor",
34
- "docs",
35
- "chore",
36
- "test",
37
- "ci"
38
- ];
39
- function readTakeoutConfig() {
40
- const configPath = (0, import_node_path.join)(process.cwd(), TAKEOUT_FILE);
41
- if (!(0, import_node_fs.existsSync)(configPath))
42
- return null;
43
- try {
44
- const content = (0, import_node_fs.readFileSync)(configPath, "utf-8"), config = {};
45
- for (const line of content.split(`
46
- `)) {
47
- const trimmed = line.trim();
48
- if (trimmed.startsWith("#") || !trimmed) continue;
49
- const [key, ...valueParts] = trimmed.split("="), value = valueParts.join("=").trim();
50
- key === "sha" && (config.sha = value), key === "date" && (config.date = value);
51
- }
52
- return config;
53
- } catch {
54
- return null;
55
- }
56
- }
57
- function parseConventionalCommit(message) {
58
- const match = message.match(/^(\w+)(?:\(([^)]+)\))?(!)?: (.+)$/);
59
- if (!match) return null;
60
- const [, type, scope, breaking, msg] = match;
61
- return !type || ![
62
- "feat",
63
- "fix",
64
- "perf",
65
- "refactor",
66
- "docs",
67
- "chore",
68
- "test",
69
- "ci",
70
- "build",
71
- "style"
72
- ].includes(type) ? null : {
73
- type,
74
- scope,
75
- message: msg || message,
76
- breaking: !!breaking || message.toLowerCase().includes("breaking")
77
- };
78
- }
79
- function ensureUpstreamRemote() {
80
- try {
81
- return (0, import_node_child_process.execSync)("git remote", { encoding: "utf-8" }).includes(UPSTREAM_REMOTE) || (console.info(import_picocolors.default.dim(` adding ${UPSTREAM_REMOTE} remote...`)), (0, import_node_child_process.execSync)(`git remote add ${UPSTREAM_REMOTE} git@github.com:${UPSTREAM_REPO}.git`, {
82
- stdio: "pipe"
83
- })), console.info(import_picocolors.default.dim(` fetching from ${UPSTREAM_REMOTE}...`)), (0, import_node_child_process.execSync)(`git fetch ${UPSTREAM_REMOTE} --quiet`, { stdio: "pipe" }), !0;
84
- } catch (err) {
85
- return console.error(import_picocolors.default.red(`failed to setup upstream remote: ${err}`)), !1;
86
- }
87
- }
88
- function getCommitsBetween(fromSha, toRef) {
89
- const commits = [];
90
- try {
91
- const lines = (0, import_node_child_process.execSync)(
92
- `git log ${fromSha}..${toRef} --pretty=format:"%H|%ad|%s" --date=short 2>/dev/null`,
93
- { encoding: "utf-8", maxBuffer: 10485760 }
94
- ).trim().split(`
95
- `).filter(Boolean);
96
- for (const line of lines) {
97
- const [hash = "", date = "", ...messageParts] = line.split("|"), message = messageParts.join("|"), parsed = parseConventionalCommit(message);
98
- commits.push({
99
- hash: hash.slice(0, 7),
100
- type: parsed?.type || "other",
101
- scope: parsed?.scope,
102
- message: parsed?.message || message,
103
- breaking: parsed?.breaking || !1,
104
- date
105
- });
106
- }
107
- } catch {
108
- }
109
- return commits;
110
- }
111
- function formatChangelog(commits) {
112
- if (commits.length === 0) {
113
- console.info(import_picocolors.default.dim(" no changes found"));
114
- return;
115
- }
116
- const grouped = /* @__PURE__ */ new Map();
117
- for (const commit of commits) {
118
- const existing = grouped.get(commit.type) || [];
119
- existing.push(commit), grouped.set(commit.type, existing);
120
- }
121
- const sortedTypes = Array.from(grouped.keys()).sort((a, b) => {
122
- const aIdx = COMMIT_TYPE_ORDER.indexOf(a), bIdx = COMMIT_TYPE_ORDER.indexOf(b);
123
- return (aIdx === -1 ? 999 : aIdx) - (bIdx === -1 ? 999 : bIdx);
124
- }), breakingChanges = commits.filter((c) => c.breaking);
125
- if (breakingChanges.length > 0) {
126
- console.info(), console.info(import_picocolors.default.red(import_picocolors.default.bold(" BREAKING CHANGES")));
127
- for (const commit of breakingChanges) {
128
- const scope = commit.scope ? import_picocolors.default.cyan(`(${commit.scope})`) : "";
129
- console.info(
130
- ` ${import_picocolors.default.red("!")} ${scope} ${commit.message} ${import_picocolors.default.dim(`(${commit.hash})`)}`
131
- );
132
- }
133
- }
134
- const typeLabels = {
135
- feat: "Features",
136
- fix: "Bug Fixes",
137
- perf: "Performance",
138
- refactor: "Refactoring",
139
- docs: "Documentation",
140
- chore: "Maintenance",
141
- test: "Tests",
142
- ci: "CI",
143
- build: "Build",
144
- style: "Style",
145
- other: "Other"
146
- }, typeColors = {
147
- feat: import_picocolors.default.green,
148
- fix: import_picocolors.default.yellow,
149
- perf: import_picocolors.default.magenta,
150
- refactor: import_picocolors.default.blue,
151
- docs: import_picocolors.default.dim,
152
- chore: import_picocolors.default.dim,
153
- test: import_picocolors.default.dim,
154
- ci: import_picocolors.default.dim,
155
- build: import_picocolors.default.dim,
156
- style: import_picocolors.default.dim,
157
- other: import_picocolors.default.white
158
- };
159
- for (const type of sortedTypes) {
160
- const typeCommits = grouped.get(type).filter((c) => !c.breaking);
161
- if (typeCommits.length === 0) continue;
162
- const label = typeLabels[type] || type, color = typeColors[type] || import_picocolors.default.white;
163
- console.info(), console.info(color(import_picocolors.default.bold(` ${label}`)));
164
- for (const commit of typeCommits) {
165
- const scope = commit.scope ? import_picocolors.default.cyan(`(${commit.scope}) `) : "";
166
- console.info(
167
- ` ${import_picocolors.default.dim("-")} ${scope}${commit.message} ${import_picocolors.default.dim(`(${commit.hash})`)}`
168
- );
169
- }
170
- }
171
- }
172
- const changedCommand = (0, import_citty.defineCommand)({
173
- meta: {
174
- name: "changed",
175
- description: "Show changes in upstream Takeout since last sync"
176
- },
177
- args: {
178
- from: {
179
- type: "string",
180
- description: "Starting commit SHA (defaults to .takeout file)"
181
- },
182
- to: {
183
- type: "string",
184
- description: "Ending commit ref (defaults to upstream main)"
185
- }
186
- },
187
- async run({ args }) {
188
- console.info(), console.info(import_picocolors.default.bold(import_picocolors.default.cyan("Takeout Changes"))), console.info();
189
- let fromSha = args.from;
190
- const config = readTakeoutConfig();
191
- if (!fromSha) {
192
- if (!config?.sha) {
193
- console.info(import_picocolors.default.yellow("No .takeout file found with last sync SHA.")), console.info(), console.info(import_picocolors.default.dim("Either:")), console.info(import_picocolors.default.dim(" 1. Create a .takeout file with: sha=<commit-sha>")), console.info(import_picocolors.default.dim(" 2. Run with --from <sha> to specify starting point")), console.info(import_picocolors.default.dim(" 3. Run `tko sync` to sync and create the file")), console.info();
194
- return;
195
- }
196
- fromSha = config.sha;
197
- }
198
- if (!ensureUpstreamRemote())
199
- return;
200
- const toRef = args.to || `${UPSTREAM_REMOTE}/main`;
201
- console.info(import_picocolors.default.dim(` from: ${fromSha.slice(0, 7)}`)), console.info(import_picocolors.default.dim(` to: ${toRef}`)), config?.date && console.info(import_picocolors.default.dim(` last sync: ${config.date}`));
202
- const commits = getCommitsBetween(fromSha, toRef);
203
- if (commits.length === 0) {
204
- console.info(), console.info(import_picocolors.default.green("\u2713 Already up to date with upstream!")), console.info();
205
- return;
206
- }
207
- console.info(), console.info(
208
- import_picocolors.default.bold(
209
- `${commits.length} commit${commits.length === 1 ? "" : "s"} since last sync:`
210
- )
211
- ), formatChangelog(commits), console.info(), console.info(import_picocolors.default.dim("Run `tko sync` to sync these changes into your fork.")), console.info();
212
- }
213
- });
214
- //# sourceMappingURL=changed.js.map