explainthisrepo 0.1.6 → 0.1.7
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/cli.js +19 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,11 +4,13 @@ import process from "node:process";
|
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { fetchRepo, fetchReadme } from "./github.js";
|
|
7
|
+
import { fetchRepo, fetchReadme, fetchLanguages } from "./github.js";
|
|
8
8
|
import { buildPrompt, buildSimplePrompt } from "./prompt.js";
|
|
9
9
|
import { generateExplanation } from "./generate.js";
|
|
10
10
|
import { writeOutput } from "./writer.js";
|
|
11
11
|
import { readRepoSignalFiles } from "./repo_reader.js";
|
|
12
|
+
import { detectStack } from "./stack-detector.js";
|
|
13
|
+
import { printStack } from "./stack_printer.js";
|
|
12
14
|
function usage() {
|
|
13
15
|
const version = getPkgVersion();
|
|
14
16
|
console.log(`ExplainThisRepo v${version}`);
|
|
@@ -19,7 +21,6 @@ function usage() {
|
|
|
19
21
|
console.log(" explainthisrepo owner/repo --quick");
|
|
20
22
|
console.log(" explainthisrepo owner/repo --simple");
|
|
21
23
|
console.log(" explainthisrepo owner/repo --stack");
|
|
22
|
-
console.log(" explainthisrepo owner/repo --tree");
|
|
23
24
|
console.log(" explainthisrepo --doctor");
|
|
24
25
|
console.log(" explainthisrepo --version");
|
|
25
26
|
}
|
|
@@ -95,6 +96,7 @@ async function main() {
|
|
|
95
96
|
let detailed = false;
|
|
96
97
|
let quick = false;
|
|
97
98
|
let simple = false;
|
|
99
|
+
let stack = false;
|
|
98
100
|
if (args.length === 2) {
|
|
99
101
|
if (args[1] === "--detailed")
|
|
100
102
|
detailed = true;
|
|
@@ -111,7 +113,10 @@ async function main() {
|
|
|
111
113
|
usage();
|
|
112
114
|
process.exit(1);
|
|
113
115
|
}
|
|
114
|
-
if ((quick && simple) ||
|
|
116
|
+
if ((quick && simple) ||
|
|
117
|
+
(detailed && simple) ||
|
|
118
|
+
(detailed && quick) ||
|
|
119
|
+
(stack && (quick || simple || detailed))) {
|
|
115
120
|
usage();
|
|
116
121
|
process.exit(1);
|
|
117
122
|
}
|
|
@@ -126,6 +131,17 @@ async function main() {
|
|
|
126
131
|
process.exit(1);
|
|
127
132
|
}
|
|
128
133
|
console.log(`Fetching ${owner}/${repo}...`);
|
|
134
|
+
if (stack) {
|
|
135
|
+
const languages = await fetchLanguages(owner, repo);
|
|
136
|
+
const read = await readRepoSignalFiles(owner, repo);
|
|
137
|
+
const report = detectStack({
|
|
138
|
+
languages,
|
|
139
|
+
tree: read.tree,
|
|
140
|
+
keyFiles: read.keyFiles,
|
|
141
|
+
});
|
|
142
|
+
printStack(report, owner, repo);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
129
145
|
try {
|
|
130
146
|
const repoData = await fetchRepo(owner, repo);
|
|
131
147
|
const readme = await fetchReadme(owner, repo);
|