@take-out/cli 0.0.50 → 0.0.52
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/dist/cjs/commands/docs.cjs +17 -9
- package/dist/cjs/commands/docs.js +8 -2
- package/dist/cjs/commands/docs.js.map +1 -1
- package/dist/cjs/commands/docs.native.js +23 -14
- package/dist/cjs/commands/docs.native.js.map +1 -1
- package/dist/cjs/commands/script.js.map +1 -1
- package/dist/cjs/commands/script.native.js.map +1 -1
- package/dist/cjs/commands/sync.cjs +51 -34
- package/dist/cjs/commands/sync.js +54 -35
- package/dist/cjs/commands/sync.js.map +1 -1
- package/dist/cjs/commands/sync.native.js +56 -39
- package/dist/cjs/commands/sync.native.js.map +1 -1
- package/dist/esm/commands/docs.js +8 -2
- package/dist/esm/commands/docs.js.map +1 -1
- package/dist/esm/commands/docs.mjs +17 -9
- package/dist/esm/commands/docs.mjs.map +1 -1
- package/dist/esm/commands/docs.native.js +23 -14
- package/dist/esm/commands/docs.native.js.map +1 -1
- package/dist/esm/commands/script.js.map +1 -1
- package/dist/esm/commands/script.mjs.map +1 -1
- package/dist/esm/commands/sync.js +54 -35
- package/dist/esm/commands/sync.js.map +1 -1
- package/dist/esm/commands/sync.mjs +51 -34
- package/dist/esm/commands/sync.mjs.map +1 -1
- package/dist/esm/commands/sync.native.js +56 -39
- package/dist/esm/commands/sync.native.js.map +1 -1
- package/package.json +5 -5
- package/src/commands/docs.ts +24 -11
- package/src/commands/script.ts +2 -2
- package/src/commands/sync.ts +96 -69
- package/types/commands/docs.d.ts.map +1 -1
- package/types/commands/sync.d.ts +12 -1
- package/types/commands/sync.d.ts.map +1 -1
|
@@ -14,16 +14,12 @@ var UPSTREAM_REPO = "tamagui/takeout2",
|
|
|
14
14
|
TAKEOUT_FILE = ".takeout";
|
|
15
15
|
function getSyncPrompt() {
|
|
16
16
|
try {
|
|
17
|
-
for (var currentDir = dirname(fileURLToPath(import.meta.url)),
|
|
18
|
-
var
|
|
19
|
-
if (existsSync(
|
|
20
|
-
|
|
21
|
-
if (pkg.name === "@take-out/cli") break;
|
|
22
|
-
}
|
|
23
|
-
packageRoot = dirname(packageRoot);
|
|
17
|
+
for (var currentDir = dirname(fileURLToPath(import.meta.url)), monorepoRoot = currentDir; monorepoRoot !== parse(monorepoRoot).root;) {
|
|
18
|
+
var promptPath = join(monorepoRoot, "packages", "docs", "sync-prompt.md");
|
|
19
|
+
if (existsSync(promptPath)) return readFileSync(promptPath, "utf-8");
|
|
20
|
+
monorepoRoot = dirname(monorepoRoot);
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
return readFileSync(promptPath, "utf-8");
|
|
22
|
+
throw new Error("Could not find sync-prompt.md in packages/docs");
|
|
27
23
|
} catch (error) {
|
|
28
24
|
throw new Error(`Could not load sync prompt: ${_instanceof(error, Error) ? error.message : "Unknown error"}`);
|
|
29
25
|
}
|
|
@@ -76,35 +72,54 @@ var syncCommand = defineCommand({
|
|
|
76
72
|
name: "sync",
|
|
77
73
|
description: "Sync your fork with the latest Takeout repository"
|
|
78
74
|
},
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
args: {
|
|
76
|
+
auto: {
|
|
77
|
+
type: "boolean",
|
|
78
|
+
description: "Auto-run with claude-code without prompts (for non-TTY environments)",
|
|
79
|
+
default: !1
|
|
80
|
+
},
|
|
81
|
+
print: {
|
|
82
|
+
type: "boolean",
|
|
83
|
+
description: "Print the sync prompt and exit",
|
|
84
|
+
default: !1
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
async run(param) {
|
|
88
|
+
var {
|
|
89
|
+
args
|
|
90
|
+
} = param,
|
|
91
|
+
isAuto = args.auto,
|
|
92
|
+
isPrint = args.print;
|
|
93
|
+
showStep("Takeout Repository Sync"), console.info(), !isAuto && !isPrint && (showInfo("Takeout sync uses AI to intelligently merge upstream changes"), console.info(), console.info(pc.gray("How it works:")), console.info(pc.gray(" \u2022 Analyzes commits from upstream Takeout repository")), console.info(pc.gray(" \u2022 Determines which changes are relevant to your fork")), console.info(pc.gray(" \u2022 Applies changes while preserving your customizations")), console.info(pc.gray(" \u2022 Handles package ejection automatically")), console.info(pc.gray(" \u2022 Asks for your input when decisions are needed")), console.info());
|
|
81
94
|
var hasClaudeCode = checkToolAvailable("claude"),
|
|
82
95
|
hasCursor = checkToolAvailable("cursor-agent"),
|
|
83
96
|
hasAider = checkToolAvailable("aider"),
|
|
84
|
-
|
|
85
|
-
hasClaudeCode
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
choice;
|
|
98
|
+
if (isAuto) hasClaudeCode || (showError("--auto requires claude CLI to be installed"), process.exit(1)), choice = "claude-code";else if (isPrint) choice = "show-prompt";else {
|
|
99
|
+
var options = [];
|
|
100
|
+
if (hasClaudeCode && options.push({
|
|
101
|
+
value: "claude-code",
|
|
102
|
+
label: "Claude Code (recommended)",
|
|
103
|
+
hint: "Run sync automatically with Claude Code CLI"
|
|
104
|
+
}), hasCursor && options.push({
|
|
105
|
+
value: "cursor",
|
|
106
|
+
label: "Cursor Agent",
|
|
107
|
+
hint: "Run sync automatically with Cursor CLI"
|
|
108
|
+
}), hasAider && options.push({
|
|
109
|
+
value: "aider",
|
|
110
|
+
label: "Aider",
|
|
111
|
+
hint: "Run sync automatically with Aider CLI"
|
|
112
|
+
}), options.push({
|
|
113
|
+
value: "show-prompt",
|
|
114
|
+
label: "Show prompt (copy & paste manually)",
|
|
115
|
+
hint: "Display the full prompt to use with any LLM"
|
|
116
|
+
}), choice = await promptSelect("How would you like to sync?", options), choice === "cancel") {
|
|
117
|
+
console.info(), showInfo("Sync cancelled");
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
console.info();
|
|
106
121
|
}
|
|
107
|
-
if (console.info(
|
|
122
|
+
if (console.info(pc.dim("Fetching upstream repository...")), !ensureUpstreamRemote()) {
|
|
108
123
|
showError("Failed to fetch upstream repository");
|
|
109
124
|
return;
|
|
110
125
|
}
|
|
@@ -118,11 +133,13 @@ var syncCommand = defineCommand({
|
|
|
118
133
|
var prompt = getSyncPrompt();
|
|
119
134
|
if (choice === "show-prompt") console.info(pc.dim("=".repeat(80))), console.info(prompt), console.info(pc.dim("=".repeat(80))), console.info(), showInfo("Copy the prompt above and paste it into your preferred LLM"), console.info(), console.info(pc.gray("Recommended LLMs:")), console.info(pc.gray(" \u2022 Claude Code (best for complex instructions)")), console.info(pc.gray(" \u2022 ChatGPT")), console.info(pc.gray(" \u2022 Cursor")), console.info(pc.gray(" \u2022 Aider")), console.info();else if (choice === "claude-code") {
|
|
120
135
|
var _claude_stdin, _claude_stdin1;
|
|
121
|
-
showInfo("Starting Claude Code with sync prompt..."), console.info(),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
if (showInfo("Starting Claude Code with sync prompt..."), console.info(), !isAuto) {
|
|
137
|
+
console.info(pc.dim("Note: Claude Code will run in headless mode and make changes automatically.")), console.info(pc.dim("You will be asked to confirm important decisions.")), console.info();
|
|
138
|
+
var shouldContinue = await confirmContinue("Continue with Claude Code?", !0);
|
|
139
|
+
if (!shouldContinue) {
|
|
140
|
+
showInfo("Sync cancelled");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
126
143
|
}
|
|
127
144
|
var tempDir = mkdtempSync(join(tmpdir(), "takeout-sync-")),
|
|
128
145
|
promptFile = join(tempDir, "prompt.md");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["execSync","spawn","spawnSync","existsSync","mkdtempSync","readFileSync","writeFileSync","tmpdir","dirname","join","parse","fileURLToPath","defineCommand","pc","confirmContinue","promptSelect","showError","showInfo","showStep","showSuccess","_instanceof","left","right","Symbol","hasInstance","UPSTREAM_REPO","UPSTREAM_REMOTE","TAKEOUT_FILE","getSyncPrompt","currentDir","import","meta","url","
|
|
1
|
+
{"version":3,"names":["execSync","spawn","spawnSync","existsSync","mkdtempSync","readFileSync","writeFileSync","tmpdir","dirname","join","parse","fileURLToPath","defineCommand","pc","confirmContinue","promptSelect","showError","showInfo","showStep","showSuccess","_instanceof","left","right","Symbol","hasInstance","UPSTREAM_REPO","UPSTREAM_REMOTE","TAKEOUT_FILE","getSyncPrompt","currentDir","import","meta","url","monorepoRoot","root","promptPath","Error","error","message","checkToolAvailable","command","checkCmd","process","platform","result","status","ensureUpstreamRemote","remotes","encoding","includes","stdio","getUpstreamHeadSha","sha","trim","writeTakeoutConfig","configPath","cwd","date","Date","toISOString","split","content","syncCommand","name","description","args","auto","type","default","print","run","param","isAuto","isPrint","console","info","gray","hasClaudeCode","hasCursor","hasAider","choice","exit","options","push","value","label","hint","dim","upstreamSha","slice","prompt","repeat","_claude_stdin","_claude_stdin1","shouldContinue","tempDir","promptFile","claude","stdin","write","end","on","code","_cursor_stdin","_cursor_stdin1","shouldContinue1","cursor"],"sources":["../../../src/commands/sync.ts"],"sourcesContent":[null],"mappings":"AAIA,SAASA,QAAA,EAAUC,KAAA,EAAOC,SAAA,QAAiB;AAC3C,SAASC,UAAA,EAAYC,WAAA,EAAaC,YAAA,EAAcC,aAAA,QAAqB;AACrE,SAASC,MAAA,QAAc;AACvB,SAASC,OAAA,EAASC,IAAA,EAAMC,KAAA,QAAa;AACrC,SAASC,aAAA,QAAqB;AAE9B,SAASC,aAAA,QAAqB;AAC9B,OAAOC,EAAA,MAAQ;AAEf,SAAAC,eAAA,EAAAC,YAAA,EAAAC,SAAA,EAAAC,QAAA,EAAAC,QAAA,EAAAC,WAAA;AAAA,SACEC,YAAAC,IAAA,EAAAC,KAAA;EACA,OAAAA,KAAA,mBAAAC,MAAA,UAAAD,KAAA,CAAAC,MAAA,CAAAC,WAA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,MAAA,CAAAC,KAAA,cAAAL,cAAA,eAAAA,cAAA,CAAAO,GAAA,IAAAH,MAAA,CAAAI,EAAA,oBAAAC,IAAA;UAED5B,OAAO,CAAAC,IAAO,IAAA2B,IAAM,KAAM,KAC1BhD,kBAEA,CAAAkC,WAAU,GAAArE,WAAU,+BAAS,GAAAuD,OAAA,CAAAC,IAAA,CAAA9D,EAAA,CAAA0E,GAAA,wBAAAC,WAAA,CAAAC,KAAA,cAAAzE,SAAA,iCAAAsF,IAAA;QAC3B;MAMmD,OAEpD,IAAAtB,MAAA;QACH,IAAAuB,aAAW,EAAAC,cAAoB;QAK7BvF,QAJA,4CACA,GAAAyD,OAAQ,CAAAC,IAAK,CAGT,CADmB;QAErB,IAAA8B,eAAS,SAAgB3F,eAAA;QACzB,KAAA2F,eAAA;UACFxF,QAAA;UAGA;QAEA;QAG4E,IAC1EyF,MAAO,GAAAzG,KAAA,kBACR,IAEQ,EACP,IAQD;UACHiD,KAAA,GACF,MAAS,EACP,SAAU,EACZ;QAEH","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@take-out/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"description": "CLI tools for Takeout starter kit - interactive onboarding and project setup",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tamagui-build",
|
|
43
|
-
"watch": "tamagui-build --watch",
|
|
43
|
+
"watch": "SKIP_INITIAL_BUILD=1 tamagui-build --watch",
|
|
44
44
|
"typecheck": "tko run typecheck",
|
|
45
45
|
"lint": "oxlint src",
|
|
46
46
|
"lint:fix": "oxfmt src && oxlint --fix --fix-suggestions src",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@clack/prompts": "^0.8.2",
|
|
53
|
-
"@take-out/docs": "0.0.
|
|
54
|
-
"@take-out/scripts": "0.0.
|
|
53
|
+
"@take-out/docs": "0.0.52",
|
|
54
|
+
"@take-out/scripts": "0.0.52",
|
|
55
55
|
"citty": "^0.1.6",
|
|
56
56
|
"picocolors": "^1.1.1"
|
|
57
57
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@tamagui/build": "^2.0.0-
|
|
67
|
+
"@tamagui/build": "^2.0.0-1769320275396",
|
|
68
68
|
"@types/node": "24.0.3",
|
|
69
69
|
"bun-types": "latest",
|
|
70
70
|
"oxfmt": "^0.16.0",
|
package/src/commands/docs.ts
CHANGED
|
@@ -453,22 +453,25 @@ const skillsCommand = defineCommand({
|
|
|
453
453
|
let unchanged = 0
|
|
454
454
|
|
|
455
455
|
for (const doc of docs) {
|
|
456
|
-
const baseName = toSkillName(doc.name)
|
|
457
|
-
const skillName = `${SKILL_PREFIX}${baseName}`
|
|
458
|
-
const skillDir = join(skillsDir, skillName)
|
|
459
|
-
const skillFile = join(skillDir, 'SKILL.md')
|
|
460
|
-
|
|
461
456
|
// read doc content
|
|
462
457
|
const content = readFileSync(doc.path, 'utf-8')
|
|
463
458
|
const hasFrontmatter = hasSkillFrontmatter(content)
|
|
464
459
|
|
|
465
|
-
// ensure skill directory exists
|
|
466
|
-
if (!existsSync(skillDir)) {
|
|
467
|
-
mkdirSync(skillDir, { recursive: true })
|
|
468
|
-
}
|
|
469
|
-
|
|
470
460
|
if (hasFrontmatter) {
|
|
471
|
-
//
|
|
461
|
+
// extract skill name from frontmatter
|
|
462
|
+
const nameMatch = content.match(/^---\s*\nname:\s*([^\n]+)/m)
|
|
463
|
+
if (!nameMatch) continue
|
|
464
|
+
|
|
465
|
+
const skillName = nameMatch[1].trim()
|
|
466
|
+
const skillDir = join(skillsDir, skillName)
|
|
467
|
+
const skillFile = join(skillDir, 'SKILL.md')
|
|
468
|
+
|
|
469
|
+
// ensure skill directory exists
|
|
470
|
+
if (!existsSync(skillDir)) {
|
|
471
|
+
mkdirSync(skillDir, { recursive: true })
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// symlink it directly
|
|
472
475
|
const relativePath = relative(skillDir, doc.path)
|
|
473
476
|
|
|
474
477
|
// check if symlink already exists and points to same target
|
|
@@ -499,6 +502,16 @@ const skillsCommand = defineCommand({
|
|
|
499
502
|
)
|
|
500
503
|
} else {
|
|
501
504
|
// doc lacks frontmatter - generate skill file with frontmatter
|
|
505
|
+
const baseName = toSkillName(doc.name)
|
|
506
|
+
const skillName = `${SKILL_PREFIX}${baseName}`
|
|
507
|
+
const skillDir = join(skillsDir, skillName)
|
|
508
|
+
const skillFile = join(skillDir, 'SKILL.md')
|
|
509
|
+
|
|
510
|
+
// ensure skill directory exists
|
|
511
|
+
if (!existsSync(skillDir)) {
|
|
512
|
+
mkdirSync(skillDir, { recursive: true })
|
|
513
|
+
}
|
|
514
|
+
|
|
502
515
|
const { title, description } = extractDocMeta(content)
|
|
503
516
|
const skillDescription = description
|
|
504
517
|
? `${title}. ${description}`.slice(0, 1024)
|
package/src/commands/script.ts
CHANGED
package/src/commands/sync.ts
CHANGED
|
@@ -26,24 +26,20 @@ const TAKEOUT_FILE = '.takeout'
|
|
|
26
26
|
|
|
27
27
|
function getSyncPrompt(): string {
|
|
28
28
|
try {
|
|
29
|
-
// find
|
|
29
|
+
// find monorepo root by looking for packages/docs
|
|
30
30
|
const currentDir = dirname(fileURLToPath(import.meta.url))
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
// go up directories until we find
|
|
34
|
-
while (
|
|
35
|
-
const
|
|
36
|
-
if (existsSync(
|
|
37
|
-
|
|
38
|
-
if (pkg.name === '@take-out/cli') {
|
|
39
|
-
break
|
|
40
|
-
}
|
|
31
|
+
let monorepoRoot = currentDir
|
|
32
|
+
|
|
33
|
+
// go up directories until we find packages/docs/sync-prompt.md
|
|
34
|
+
while (monorepoRoot !== parse(monorepoRoot).root) {
|
|
35
|
+
const promptPath = join(monorepoRoot, 'packages', 'docs', 'sync-prompt.md')
|
|
36
|
+
if (existsSync(promptPath)) {
|
|
37
|
+
return readFileSync(promptPath, 'utf-8')
|
|
41
38
|
}
|
|
42
|
-
|
|
39
|
+
monorepoRoot = dirname(monorepoRoot)
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
return readFileSync(promptPath, 'utf-8')
|
|
42
|
+
throw new Error('Could not find sync-prompt.md in packages/docs')
|
|
47
43
|
} catch (error) {
|
|
48
44
|
throw new Error(
|
|
49
45
|
`Could not load sync prompt: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
@@ -103,71 +99,99 @@ export const syncCommand = defineCommand({
|
|
|
103
99
|
name: 'sync',
|
|
104
100
|
description: 'Sync your fork with the latest Takeout repository',
|
|
105
101
|
},
|
|
106
|
-
|
|
102
|
+
args: {
|
|
103
|
+
auto: {
|
|
104
|
+
type: 'boolean',
|
|
105
|
+
description: 'Auto-run with claude-code without prompts (for non-TTY environments)',
|
|
106
|
+
default: false,
|
|
107
|
+
},
|
|
108
|
+
print: {
|
|
109
|
+
type: 'boolean',
|
|
110
|
+
description: 'Print the sync prompt and exit',
|
|
111
|
+
default: false,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
async run({ args }) {
|
|
115
|
+
const isAuto = args.auto
|
|
116
|
+
const isPrint = args.print
|
|
107
117
|
showStep('Takeout Repository Sync')
|
|
108
118
|
console.info()
|
|
109
119
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
if (!isAuto && !isPrint) {
|
|
121
|
+
showInfo('Takeout sync uses AI to intelligently merge upstream changes')
|
|
122
|
+
console.info()
|
|
123
|
+
console.info(pc.gray('How it works:'))
|
|
124
|
+
console.info(pc.gray(' • Analyzes commits from upstream Takeout repository'))
|
|
125
|
+
console.info(pc.gray(' • Determines which changes are relevant to your fork'))
|
|
126
|
+
console.info(pc.gray(' • Applies changes while preserving your customizations'))
|
|
127
|
+
console.info(pc.gray(' • Handles package ejection automatically'))
|
|
128
|
+
console.info(pc.gray(' • Asks for your input when decisions are needed'))
|
|
129
|
+
console.info()
|
|
130
|
+
}
|
|
119
131
|
|
|
120
132
|
// check what tools are available
|
|
121
133
|
const hasClaudeCode = checkToolAvailable('claude')
|
|
122
134
|
const hasCursor = checkToolAvailable('cursor-agent')
|
|
123
135
|
const hasAider = checkToolAvailable('aider')
|
|
124
136
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
137
|
+
// handle --auto mode
|
|
138
|
+
let choice: string
|
|
139
|
+
if (isAuto) {
|
|
140
|
+
if (!hasClaudeCode) {
|
|
141
|
+
showError('--auto requires claude CLI to be installed')
|
|
142
|
+
process.exit(1)
|
|
143
|
+
}
|
|
144
|
+
choice = 'claude-code'
|
|
145
|
+
} else if (isPrint) {
|
|
146
|
+
choice = 'show-prompt'
|
|
147
|
+
} else {
|
|
148
|
+
const options: Array<{
|
|
149
|
+
value: string
|
|
150
|
+
label: string
|
|
151
|
+
hint: string
|
|
152
|
+
}> = []
|
|
153
|
+
|
|
154
|
+
if (hasClaudeCode) {
|
|
155
|
+
options.push({
|
|
156
|
+
value: 'claude-code',
|
|
157
|
+
label: 'Claude Code (recommended)',
|
|
158
|
+
hint: 'Run sync automatically with Claude Code CLI',
|
|
159
|
+
})
|
|
160
|
+
}
|
|
130
161
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
162
|
+
if (hasCursor) {
|
|
163
|
+
options.push({
|
|
164
|
+
value: 'cursor',
|
|
165
|
+
label: 'Cursor Agent',
|
|
166
|
+
hint: 'Run sync automatically with Cursor CLI',
|
|
167
|
+
})
|
|
168
|
+
}
|
|
138
169
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
170
|
+
if (hasAider) {
|
|
171
|
+
options.push({
|
|
172
|
+
value: 'aider',
|
|
173
|
+
label: 'Aider',
|
|
174
|
+
hint: 'Run sync automatically with Aider CLI',
|
|
175
|
+
})
|
|
176
|
+
}
|
|
146
177
|
|
|
147
|
-
if (hasAider) {
|
|
148
178
|
options.push({
|
|
149
|
-
value: '
|
|
150
|
-
label: '
|
|
151
|
-
hint: '
|
|
179
|
+
value: 'show-prompt',
|
|
180
|
+
label: 'Show prompt (copy & paste manually)',
|
|
181
|
+
hint: 'Display the full prompt to use with any LLM',
|
|
152
182
|
})
|
|
153
|
-
}
|
|
154
183
|
|
|
155
|
-
|
|
156
|
-
value: 'show-prompt',
|
|
157
|
-
label: 'Show prompt (copy & paste manually)',
|
|
158
|
-
hint: 'Display the full prompt to use with any LLM',
|
|
159
|
-
})
|
|
184
|
+
choice = await promptSelect<string>('How would you like to sync?', options)
|
|
160
185
|
|
|
161
|
-
|
|
186
|
+
if (choice === 'cancel') {
|
|
187
|
+
console.info()
|
|
188
|
+
showInfo('Sync cancelled')
|
|
189
|
+
return
|
|
190
|
+
}
|
|
162
191
|
|
|
163
|
-
if (choice === 'cancel') {
|
|
164
192
|
console.info()
|
|
165
|
-
showInfo('Sync cancelled')
|
|
166
|
-
return
|
|
167
193
|
}
|
|
168
194
|
|
|
169
|
-
console.info()
|
|
170
|
-
|
|
171
195
|
// fetch upstream to get the target SHA before syncing
|
|
172
196
|
console.info(pc.dim('Fetching upstream repository...'))
|
|
173
197
|
if (!ensureUpstreamRemote()) {
|
|
@@ -202,18 +226,21 @@ export const syncCommand = defineCommand({
|
|
|
202
226
|
} else if (choice === 'claude-code') {
|
|
203
227
|
showInfo('Starting Claude Code with sync prompt...')
|
|
204
228
|
console.info()
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
229
|
+
|
|
230
|
+
if (!isAuto) {
|
|
231
|
+
console.info(
|
|
232
|
+
pc.dim(
|
|
233
|
+
'Note: Claude Code will run in headless mode and make changes automatically.'
|
|
234
|
+
)
|
|
208
235
|
)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
console.info()
|
|
236
|
+
console.info(pc.dim('You will be asked to confirm important decisions.'))
|
|
237
|
+
console.info()
|
|
212
238
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
239
|
+
const shouldContinue = await confirmContinue('Continue with Claude Code?', true)
|
|
240
|
+
if (!shouldContinue) {
|
|
241
|
+
showInfo('Sync cancelled')
|
|
242
|
+
return
|
|
243
|
+
}
|
|
217
244
|
}
|
|
218
245
|
|
|
219
246
|
// write prompt to temp file to avoid shell escaping issues
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAujBH,eAAO,MAAM,WAAW,qDAYtB,CAAA"}
|
package/types/commands/sync.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sync command - sync fork with upstream Takeout repository
|
|
3
3
|
*/
|
|
4
|
-
export declare const syncCommand: import("citty").CommandDef<
|
|
4
|
+
export declare const syncCommand: import("citty").CommandDef<{
|
|
5
|
+
auto: {
|
|
6
|
+
type: "boolean";
|
|
7
|
+
description: string;
|
|
8
|
+
default: false;
|
|
9
|
+
};
|
|
10
|
+
print: {
|
|
11
|
+
type: "boolean";
|
|
12
|
+
description: string;
|
|
13
|
+
default: false;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
5
16
|
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AA8FH,eAAO,MAAM,WAAW;;;;;;;;;;;EA2OtB,CAAA"}
|