@take-out/cli 0.4.3 → 0.4.5
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/cli.cjs +53 -35
- package/dist/cjs/commands/changed.cjs +133 -95
- package/dist/cjs/commands/docs.cjs +276 -203
- package/dist/cjs/commands/env-setup.cjs +45 -33
- package/dist/cjs/commands/onboard.cjs +668 -224
- package/dist/cjs/commands/run-all.cjs +54 -45
- package/dist/cjs/commands/run.cjs +80 -65
- package/dist/cjs/commands/script.cjs +263 -187
- package/dist/cjs/commands/skills.cjs +174 -118
- package/dist/cjs/commands/sync.cjs +193 -93
- package/dist/cjs/constants/ascii.cjs +14 -12
- package/dist/cjs/index.cjs +12 -10
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/utils/env-categories.cjs +53 -48
- package/dist/cjs/utils/env-setup.cjs +214 -106
- package/dist/cjs/utils/env.cjs +65 -44
- package/dist/cjs/utils/files.cjs +186 -113
- package/dist/cjs/utils/parallel-runner.cjs +125 -75
- package/dist/cjs/utils/ports.cjs +21 -21
- package/dist/cjs/utils/prerequisites.cjs +42 -34
- package/dist/cjs/utils/prompts.cjs +66 -41
- package/dist/cjs/utils/script-listing.cjs +130 -60
- package/dist/cjs/utils/script-utils.cjs +29 -19
- package/dist/cjs/utils/sync.cjs +67 -45
- package/dist/esm/cli.mjs +40 -24
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/commands/changed.mjs +104 -68
- package/dist/esm/commands/changed.mjs.map +1 -1
- package/dist/esm/commands/docs.mjs +245 -174
- package/dist/esm/commands/docs.mjs.map +1 -1
- package/dist/esm/commands/env-setup.mjs +18 -8
- package/dist/esm/commands/env-setup.mjs.map +1 -1
- package/dist/esm/commands/onboard.mjs +631 -189
- package/dist/esm/commands/onboard.mjs.map +1 -1
- package/dist/esm/commands/run-all.mjs +26 -19
- package/dist/esm/commands/run-all.mjs.map +1 -1
- package/dist/esm/commands/run.mjs +52 -39
- package/dist/esm/commands/run.mjs.map +1 -1
- package/dist/esm/commands/script.mjs +230 -156
- package/dist/esm/commands/script.mjs.map +1 -1
- package/dist/esm/commands/skills.mjs +143 -89
- package/dist/esm/commands/skills.mjs.map +1 -1
- package/dist/esm/commands/sync.mjs +160 -62
- package/dist/esm/commands/sync.mjs.map +1 -1
- package/dist/esm/constants/ascii.mjs +2 -2
- package/dist/esm/constants/ascii.mjs.map +1 -1
- package/dist/esm/utils/env-categories.mjs +29 -26
- package/dist/esm/utils/env-categories.mjs.map +1 -1
- package/dist/esm/utils/env-setup.mjs +184 -78
- package/dist/esm/utils/env-setup.mjs.map +1 -1
- package/dist/esm/utils/env.mjs +50 -31
- package/dist/esm/utils/env.mjs.map +1 -1
- package/dist/esm/utils/files.mjs +171 -100
- package/dist/esm/utils/files.mjs.map +1 -1
- package/dist/esm/utils/parallel-runner.mjs +111 -63
- package/dist/esm/utils/parallel-runner.mjs.map +1 -1
- package/dist/esm/utils/ports.mjs +9 -11
- package/dist/esm/utils/ports.mjs.map +1 -1
- package/dist/esm/utils/prerequisites.mjs +30 -24
- package/dist/esm/utils/prerequisites.mjs.map +1 -1
- package/dist/esm/utils/prompts.mjs +40 -17
- package/dist/esm/utils/prompts.mjs.map +1 -1
- package/dist/esm/utils/script-listing.mjs +101 -33
- package/dist/esm/utils/script-listing.mjs.map +1 -1
- package/dist/esm/utils/script-utils.mjs +14 -6
- package/dist/esm/utils/script-utils.mjs.map +1 -1
- package/dist/esm/utils/sync.mjs +38 -18
- package/dist/esm/utils/sync.mjs.map +1 -1
- package/package.json +5 -5
package/dist/cjs/utils/ports.cjs
CHANGED
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var ports_exports = {};
|
|
22
24
|
__export(ports_exports, {
|
|
@@ -36,30 +38,28 @@ function isPortInUse(port) {
|
|
|
36
38
|
stdio: ["pipe", "pipe", "ignore"]
|
|
37
39
|
}).trim();
|
|
38
40
|
if (!output) return {
|
|
39
|
-
inUse:
|
|
41
|
+
inUse: false
|
|
40
42
|
};
|
|
41
|
-
const lines = output.split(
|
|
42
|
-
`);
|
|
43
|
+
const lines = output.split("\n");
|
|
43
44
|
for (const line of lines) {
|
|
44
45
|
const parts = line.trim().split(/\s+/);
|
|
45
46
|
if (parts[1]?.includes(`:${port}`) && parts[3] === "LISTENING") {
|
|
46
47
|
const pid = Number.parseInt(parts[4] || "", 10);
|
|
47
48
|
return {
|
|
48
|
-
inUse:
|
|
49
|
+
inUse: true,
|
|
49
50
|
pid: Number.isNaN(pid) ? void 0 : pid
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
return {
|
|
54
|
-
inUse:
|
|
55
|
+
inUse: false
|
|
55
56
|
};
|
|
56
57
|
} else {
|
|
57
58
|
const output = (0, import_node_child_process.execSync)(`lsof -i :${port} -t`, {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
`)[0] || "", 10) : void 0;
|
|
59
|
+
encoding: "utf-8",
|
|
60
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
61
|
+
}).trim();
|
|
62
|
+
const pid = output ? Number.parseInt(output.split("\n")[0] || "", 10) : void 0;
|
|
63
63
|
return {
|
|
64
64
|
inUse: !!output,
|
|
65
65
|
pid: Number.isNaN(pid) ? void 0 : pid
|
|
@@ -67,7 +67,7 @@ function isPortInUse(port) {
|
|
|
67
67
|
}
|
|
68
68
|
} catch {
|
|
69
69
|
return {
|
|
70
|
-
inUse:
|
|
70
|
+
inUse: false
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
14
|
get: () => from[key],
|
|
14
15
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
21
|
+
value: true
|
|
20
22
|
}), mod);
|
|
21
23
|
var prerequisites_exports = {};
|
|
22
24
|
__export(prerequisites_exports, {
|
|
@@ -46,57 +48,63 @@ function getVersion(command) {
|
|
|
46
48
|
return match ? match[0] : output;
|
|
47
49
|
}
|
|
48
50
|
function compareVersions(current, required) {
|
|
49
|
-
const parseCurrent = current.replace(/^v/, "").split(".").map(Number)
|
|
50
|
-
|
|
51
|
+
const parseCurrent = current.replace(/^v/, "").split(".").map(Number);
|
|
52
|
+
const parseRequired = required.replace(/^v/, "").split(".").map(Number);
|
|
51
53
|
for (let i = 0; i < 3; i++) {
|
|
52
|
-
const curr = parseCurrent[i] || 0
|
|
53
|
-
|
|
54
|
-
if (curr > req) return
|
|
55
|
-
if (curr < req) return
|
|
54
|
+
const curr = parseCurrent[i] || 0;
|
|
55
|
+
const req = parseRequired[i] || 0;
|
|
56
|
+
if (curr > req) return true;
|
|
57
|
+
if (curr < req) return false;
|
|
56
58
|
}
|
|
57
|
-
return
|
|
59
|
+
return true;
|
|
58
60
|
}
|
|
59
61
|
function checkBun() {
|
|
60
|
-
const version = getVersion("bun --version") ?? void 0
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
const version = getVersion("bun --version") ?? void 0;
|
|
63
|
+
const requiredVersion = "1.0.0";
|
|
64
|
+
const hasBunv = !!execCommand("bunv --version");
|
|
63
65
|
let message = version ? compareVersions(version, requiredVersion) ? `Bun ${version} installed` : `Bun ${version} installed (${requiredVersion}+ recommended)` : "Bun not found";
|
|
64
|
-
|
|
66
|
+
if (version && !hasBunv) {
|
|
67
|
+
message += " (consider installing bunv for auto version switching)";
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
65
70
|
name: "Bun",
|
|
66
|
-
required:
|
|
71
|
+
required: true,
|
|
67
72
|
installed: !!version,
|
|
68
73
|
version,
|
|
69
74
|
requiredVersion,
|
|
70
75
|
message,
|
|
71
76
|
installUrl: "https://bun.sh",
|
|
72
|
-
recommendation: hasBunv ?
|
|
77
|
+
recommendation: !hasBunv ? "Install bunv to automatically switch bun versions: https://github.com/aklinker1/bunv" : void 0
|
|
73
78
|
};
|
|
74
79
|
}
|
|
75
80
|
function checkNode() {
|
|
76
|
-
const version = getVersion("node --version") ?? void 0
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
const version = getVersion("node --version") ?? void 0;
|
|
82
|
+
const requiredVersion = "20.0.0";
|
|
83
|
+
const hasFnm = !!execCommand("fnm --version");
|
|
79
84
|
let message = version ? compareVersions(version, requiredVersion) ? `Node.js ${version} installed` : `Node.js ${version} installed (${requiredVersion}+ recommended)` : "Node.js not found (optional)";
|
|
80
|
-
|
|
85
|
+
if (version && !hasFnm) {
|
|
86
|
+
message += " (consider installing fnm for auto version switching)";
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
81
89
|
name: "Node.js",
|
|
82
|
-
required:
|
|
90
|
+
required: false,
|
|
83
91
|
installed: !!version,
|
|
84
92
|
version,
|
|
85
93
|
requiredVersion,
|
|
86
94
|
message,
|
|
87
95
|
installUrl: "https://nodejs.org",
|
|
88
|
-
recommendation: hasFnm ?
|
|
96
|
+
recommendation: !hasFnm ? "Install fnm to automatically switch node versions: https://github.com/Schniz/fnm" : void 0
|
|
89
97
|
};
|
|
90
98
|
}
|
|
91
99
|
function checkDocker() {
|
|
92
|
-
const version = getVersion("docker --version") ?? void 0
|
|
93
|
-
|
|
100
|
+
const version = getVersion("docker --version") ?? void 0;
|
|
101
|
+
const isRunning = !!execCommand("docker ps");
|
|
94
102
|
return {
|
|
95
103
|
name: "Docker",
|
|
96
|
-
required:
|
|
104
|
+
required: true,
|
|
97
105
|
installed: !!version,
|
|
98
106
|
version,
|
|
99
|
-
message: version ?
|
|
107
|
+
message: !version ? "Docker not found" : !isRunning ? "Docker installed but not running" : `Docker ${version} running`,
|
|
100
108
|
installUrl: "https://docs.docker.com/get-docker/"
|
|
101
109
|
};
|
|
102
110
|
}
|
|
@@ -104,7 +112,7 @@ function checkGit() {
|
|
|
104
112
|
const version = getVersion("git --version") ?? void 0;
|
|
105
113
|
return {
|
|
106
114
|
name: "Git",
|
|
107
|
-
required:
|
|
115
|
+
required: true,
|
|
108
116
|
installed: !!version,
|
|
109
117
|
version,
|
|
110
118
|
message: version ? `Git ${version} installed` : "Git not found",
|
|
@@ -2,33 +2,35 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var prompts_exports = {};
|
|
33
35
|
__export(prompts_exports, {
|
|
34
36
|
confirmContinue: () => confirmContinue,
|
|
@@ -49,25 +51,26 @@ __export(prompts_exports, {
|
|
|
49
51
|
showWarning: () => showWarning
|
|
50
52
|
});
|
|
51
53
|
module.exports = __toCommonJS(prompts_exports);
|
|
52
|
-
var p = __toESM(require("@clack/prompts"), 1)
|
|
53
|
-
|
|
54
|
+
var p = __toESM(require("@clack/prompts"), 1);
|
|
55
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
54
56
|
function displayWelcome(projectName = "Takeout") {
|
|
55
|
-
console.info()
|
|
56
|
-
|
|
57
|
+
console.info();
|
|
58
|
+
p.intro(import_picocolors.default.bgCyan(import_picocolors.default.black(` ${projectName} Starter Kit `)));
|
|
59
|
+
console.info();
|
|
60
|
+
p.note(import_picocolors.default.dim("You can re-run 'bun onboard' anytime to reconfigure or skip to specific steps.\nNo need to decide everything upfront!"), import_picocolors.default.cyan("Tip"));
|
|
57
61
|
}
|
|
58
62
|
function displayOutro(message) {
|
|
59
63
|
p.outro(import_picocolors.default.green(message));
|
|
60
64
|
}
|
|
61
65
|
function displayPrerequisites(checks) {
|
|
62
66
|
const items = checks.map(check => {
|
|
63
|
-
const icon = check.installed ? import_picocolors.default.green("\u2713") : import_picocolors.default.red("\u2717")
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
const icon = check.installed ? import_picocolors.default.green("\u2713") : import_picocolors.default.red("\u2717");
|
|
68
|
+
const message = check.message || "";
|
|
69
|
+
const recommendation = check.recommendation ? `
|
|
66
70
|
${import_picocolors.default.dim(check.recommendation)}` : "";
|
|
67
71
|
return `${icon} ${import_picocolors.default.bold(check.name)}: ${message}${recommendation}`;
|
|
68
72
|
});
|
|
69
|
-
p.note(items.join(
|
|
70
|
-
`), "Prerequisites");
|
|
73
|
+
p.note(items.join("\n"), "Prerequisites");
|
|
71
74
|
}
|
|
72
75
|
function displayPortConflicts(conflicts) {
|
|
73
76
|
if (conflicts.length === 0) return;
|
|
@@ -75,15 +78,18 @@ function displayPortConflicts(conflicts) {
|
|
|
75
78
|
const pid = conflict.pid ? ` (PID: ${conflict.pid})` : "";
|
|
76
79
|
return `${import_picocolors.default.yellow("\u26A0")} Port ${conflict.port} (${conflict.name})${pid}`;
|
|
77
80
|
});
|
|
78
|
-
p.note(items.join(
|
|
79
|
-
`), import_picocolors.default.yellow("Port Conflicts Detected"));
|
|
81
|
+
p.note(items.join("\n"), import_picocolors.default.yellow("Port Conflicts Detected"));
|
|
80
82
|
}
|
|
81
|
-
async function confirmContinue(message, defaultValue =
|
|
83
|
+
async function confirmContinue(message, defaultValue = true) {
|
|
82
84
|
const result = await p.confirm({
|
|
83
85
|
message,
|
|
84
86
|
initialValue: defaultValue
|
|
85
87
|
});
|
|
86
|
-
|
|
88
|
+
if (p.isCancel(result)) {
|
|
89
|
+
p.cancel("Operation cancelled.");
|
|
90
|
+
process.exit(0);
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
87
93
|
}
|
|
88
94
|
async function promptText(message, defaultValue, placeholder) {
|
|
89
95
|
const result = await p.text({
|
|
@@ -91,23 +97,37 @@ async function promptText(message, defaultValue, placeholder) {
|
|
|
91
97
|
defaultValue,
|
|
92
98
|
placeholder
|
|
93
99
|
});
|
|
94
|
-
|
|
100
|
+
if (p.isCancel(result)) {
|
|
101
|
+
p.cancel("Operation cancelled.");
|
|
102
|
+
process.exit(0);
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
95
105
|
}
|
|
96
106
|
async function promptPassword(message) {
|
|
97
107
|
const result = await p.password({
|
|
98
108
|
message
|
|
99
109
|
});
|
|
100
|
-
|
|
110
|
+
if (p.isCancel(result)) {
|
|
111
|
+
p.cancel("Operation cancelled.");
|
|
112
|
+
process.exit(0);
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
101
115
|
}
|
|
102
116
|
async function promptSelect(message, options) {
|
|
103
117
|
const result = await p.select({
|
|
104
118
|
message,
|
|
105
119
|
options
|
|
106
120
|
});
|
|
107
|
-
|
|
121
|
+
if (p.isCancel(result)) {
|
|
122
|
+
return "cancel";
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
108
125
|
}
|
|
109
126
|
async function promptStartStep() {
|
|
110
|
-
|
|
127
|
+
console.info();
|
|
128
|
+
console.info(import_picocolors.default.gray("What would you like to do?"));
|
|
129
|
+
console.info();
|
|
130
|
+
return promptSelect("Select starting point:", [{
|
|
111
131
|
value: "full",
|
|
112
132
|
label: "Complete setup",
|
|
113
133
|
hint: "Run through all setup steps"
|
|
@@ -138,11 +158,16 @@ async function promptOldSelect(message, options) {
|
|
|
138
158
|
message,
|
|
139
159
|
options
|
|
140
160
|
});
|
|
141
|
-
|
|
161
|
+
if (p.isCancel(result)) {
|
|
162
|
+
p.cancel("Operation cancelled.");
|
|
163
|
+
process.exit(0);
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
142
166
|
}
|
|
143
167
|
function showSpinner(message) {
|
|
144
168
|
const s = p.spinner();
|
|
145
|
-
|
|
169
|
+
s.start(message);
|
|
170
|
+
return s;
|
|
146
171
|
}
|
|
147
172
|
function showError(message) {
|
|
148
173
|
p.log.error(import_picocolors.default.red(message));
|
|
@@ -2,105 +2,175 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf
|
|
6
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
16
|
get: () => from[key],
|
|
16
17
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
32
34
|
var script_listing_exports = {};
|
|
33
35
|
__export(script_listing_exports, {
|
|
34
36
|
listAllScripts: () => listAllScripts,
|
|
35
37
|
listCategoryScripts: () => listCategoryScripts
|
|
36
38
|
});
|
|
37
39
|
module.exports = __toCommonJS(script_listing_exports);
|
|
38
|
-
var import_node_fs = require("node:fs")
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
var import_node_fs = require("node:fs");
|
|
41
|
+
var import_node_path = require("node:path");
|
|
42
|
+
var import_node_url = require("node:url");
|
|
43
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
44
|
+
var import_script_utils = require("./script-utils.cjs");
|
|
43
45
|
const import_meta = {};
|
|
44
46
|
function findScriptsPackageRoot() {
|
|
45
47
|
try {
|
|
46
|
-
const resolved = import_meta.resolve("@take-out/scripts/package.json")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if ((0, import_node_fs.existsSync)(srcPath))
|
|
48
|
+
const resolved = import_meta.resolve("@take-out/scripts/package.json");
|
|
49
|
+
const packageJsonPath = (0, import_node_url.fileURLToPath)(new URL(resolved));
|
|
50
|
+
const packageRoot = (0, import_node_path.join)(packageJsonPath, "..");
|
|
51
|
+
const srcPath = (0, import_node_path.join)(packageRoot, "src");
|
|
52
|
+
if ((0, import_node_fs.existsSync)(srcPath)) {
|
|
53
|
+
return srcPath;
|
|
54
|
+
}
|
|
51
55
|
} catch {}
|
|
52
56
|
return null;
|
|
53
57
|
}
|
|
54
58
|
function formatScriptList(title, scripts, metadata) {
|
|
55
59
|
if (scripts.size === 0) return;
|
|
56
|
-
console.info()
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
console.info();
|
|
61
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.cyan(title)));
|
|
62
|
+
console.info();
|
|
63
|
+
const categories = /* @__PURE__ */new Map();
|
|
64
|
+
const rootScripts = [];
|
|
65
|
+
for (const [name, path] of scripts) {
|
|
66
|
+
if (name.includes("/")) {
|
|
67
|
+
const category = name.split("/")[0];
|
|
68
|
+
if (!categories.has(category)) {
|
|
69
|
+
categories.set(category, []);
|
|
70
|
+
}
|
|
71
|
+
categories.get(category).push([name, path]);
|
|
72
|
+
} else {
|
|
73
|
+
rootScripts.push([name, path]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
63
76
|
for (const [name] of rootScripts) {
|
|
64
77
|
let line = ` ${import_picocolors.default.green(name)}`;
|
|
65
78
|
const meta = metadata.get(name);
|
|
66
|
-
|
|
79
|
+
if (meta?.description) {
|
|
80
|
+
line += import_picocolors.default.dim(` - ${meta.description}`);
|
|
81
|
+
}
|
|
82
|
+
console.info(line);
|
|
67
83
|
}
|
|
68
84
|
for (const [category, categoryScripts] of categories) {
|
|
69
|
-
console.info()
|
|
85
|
+
console.info();
|
|
86
|
+
console.info(` ${import_picocolors.default.yellow(category)}/`);
|
|
70
87
|
for (const [name] of categoryScripts) {
|
|
71
88
|
const shortName = name.substring(category.length + 1);
|
|
72
89
|
let line = ` ${import_picocolors.default.green(shortName)}`;
|
|
73
90
|
const meta = metadata.get(name);
|
|
74
|
-
|
|
91
|
+
if (meta?.description) {
|
|
92
|
+
line += import_picocolors.default.dim(` - ${meta.description}`);
|
|
93
|
+
}
|
|
94
|
+
console.info(line);
|
|
75
95
|
}
|
|
76
96
|
}
|
|
77
97
|
}
|
|
78
|
-
async function listAllScripts(includeCommands =
|
|
79
|
-
console.info()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
async function listAllScripts(includeCommands = true) {
|
|
99
|
+
console.info();
|
|
100
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.cyan("Takeout CLI - Project Scripts & Commands")));
|
|
101
|
+
console.info();
|
|
102
|
+
console.info(import_picocolors.default.dim(" Manage scripts, run tasks, and configure your project"));
|
|
103
|
+
console.info();
|
|
104
|
+
if (includeCommands) {
|
|
105
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.cyan("Built-in Commands")));
|
|
106
|
+
console.info();
|
|
107
|
+
console.info(` ${import_picocolors.default.green("onboard")} - Setup wizard for new projects`);
|
|
108
|
+
console.info(` ${import_picocolors.default.green("docs")} - View documentation`);
|
|
109
|
+
console.info(` ${import_picocolors.default.green("env:setup")} - Setup environment variables`);
|
|
110
|
+
console.info(` ${import_picocolors.default.green("run")} - Run scripts in parallel`);
|
|
111
|
+
console.info(` ${import_picocolors.default.green("script")} - Manage and run scripts`);
|
|
112
|
+
console.info(` ${import_picocolors.default.green("skills")} - Manage Claude Code skills`);
|
|
113
|
+
console.info(` ${import_picocolors.default.green("sync")} - Sync fork with upstream Takeout`);
|
|
114
|
+
console.info(` ${import_picocolors.default.green("changed")} - Show changes since last sync`);
|
|
115
|
+
console.info(` ${import_picocolors.default.green("completion")} - Shell completion setup`);
|
|
116
|
+
}
|
|
117
|
+
const localScripts = (0, import_script_utils.discoverScripts)((0, import_script_utils.getLocalScriptsDir)());
|
|
118
|
+
const builtInDir = findScriptsPackageRoot();
|
|
119
|
+
const builtInScripts = builtInDir ? (0, import_script_utils.discoverScripts)(builtInDir) : /* @__PURE__ */new Map();
|
|
120
|
+
const allScripts = new Map([...localScripts, ...builtInScripts]);
|
|
121
|
+
const metadata = await (0, import_script_utils.getAllScriptMetadata)(allScripts);
|
|
122
|
+
if (localScripts.size > 0) {
|
|
123
|
+
formatScriptList("Local Scripts", localScripts, metadata);
|
|
124
|
+
}
|
|
125
|
+
if (builtInScripts.size > 0) {
|
|
126
|
+
formatScriptList("Built-in Scripts", builtInScripts, metadata);
|
|
127
|
+
}
|
|
128
|
+
if (localScripts.size === 0 && builtInScripts.size === 0) {
|
|
129
|
+
console.info();
|
|
130
|
+
console.info(import_picocolors.default.yellow("No scripts found"));
|
|
131
|
+
console.info();
|
|
132
|
+
console.info(import_picocolors.default.dim(`Create scripts in ${(0, import_node_path.relative)(process.cwd(), (0, import_script_utils.getLocalScriptsDir)())}/`));
|
|
133
|
+
console.info(import_picocolors.default.dim(`Or install @take-out/scripts package for built-in scripts`));
|
|
134
|
+
}
|
|
135
|
+
console.info();
|
|
136
|
+
console.info(import_picocolors.default.bold("Usage:"));
|
|
137
|
+
console.info(` ${import_picocolors.default.cyan("tko <command>")} ${import_picocolors.default.dim("Run a built-in command")}`);
|
|
138
|
+
console.info(` ${import_picocolors.default.cyan("tko <script-name>")} ${import_picocolors.default.dim("Execute direct script")}`);
|
|
139
|
+
console.info(` ${import_picocolors.default.cyan("tko <group> <script>")} ${import_picocolors.default.dim("Execute nested script")}`);
|
|
140
|
+
console.info(` ${import_picocolors.default.cyan("tko script new <path>")} ${import_picocolors.default.dim("Create a new script")}`);
|
|
141
|
+
console.info();
|
|
86
142
|
}
|
|
87
143
|
async function listCategoryScripts(categoryName) {
|
|
88
|
-
const localDir = (0, import_script_utils.getLocalScriptsDir)()
|
|
89
|
-
|
|
144
|
+
const localDir = (0, import_script_utils.getLocalScriptsDir)();
|
|
145
|
+
const categoryPath = (0, import_node_path.join)(localDir, categoryName);
|
|
90
146
|
if ((0, import_node_fs.existsSync)(categoryPath) && (0, import_node_fs.statSync)(categoryPath).isDirectory()) {
|
|
91
147
|
const categoryScripts = (0, import_script_utils.discoverScripts)(categoryPath);
|
|
92
148
|
if (categoryScripts.size > 0) {
|
|
93
149
|
const metadata = await (0, import_script_utils.getAllScriptMetadata)(categoryScripts);
|
|
94
|
-
console.info()
|
|
150
|
+
console.info();
|
|
151
|
+
console.info(import_picocolors.default.bold(import_picocolors.default.cyan(`${categoryName} Scripts`)));
|
|
152
|
+
console.info();
|
|
95
153
|
for (const [name] of categoryScripts) {
|
|
96
|
-
const shortName = name.replace(`${categoryName}/`, "")
|
|
97
|
-
|
|
154
|
+
const shortName = name.replace(`${categoryName}/`, "");
|
|
155
|
+
const meta = metadata.get(name);
|
|
98
156
|
let line = ` ${import_picocolors.default.green(shortName)}`;
|
|
99
|
-
|
|
157
|
+
if (meta?.description) {
|
|
158
|
+
line += import_picocolors.default.dim(` - ${meta.description}`);
|
|
159
|
+
}
|
|
160
|
+
if (meta?.args && meta.args.length > 0) {
|
|
161
|
+
line += import_picocolors.default.dim(` [${meta.args.join(", ")}]`);
|
|
162
|
+
}
|
|
163
|
+
console.info(line);
|
|
100
164
|
}
|
|
101
|
-
console.info()
|
|
102
|
-
|
|
103
|
-
|
|
165
|
+
console.info();
|
|
166
|
+
console.info(import_picocolors.default.dim(`Run: tko ${categoryName}/<name> [args...] to execute`));
|
|
167
|
+
console.info();
|
|
168
|
+
} else {
|
|
169
|
+
console.info();
|
|
170
|
+
console.info(import_picocolors.default.yellow(`No scripts found in ${categoryName}/`));
|
|
171
|
+
console.info();
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
104
174
|
}
|
|
105
|
-
return
|
|
175
|
+
return false;
|
|
106
176
|
}
|