packmd 1.0.0 → 1.0.2
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/README.md +2 -0
- package/dist/index.js +40 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
## packmd
|
|
2
4
|
|
|
3
5
|
**PackMD** is a command‑line tool that converts any GitHub repository, local directory, or web page into a clean, token‑efficient Markdown digest – ready to paste into ChatGPT, Claude, or any LLM.
|
package/dist/index.js
CHANGED
|
@@ -7,13 +7,14 @@ import { Command } from "commander";
|
|
|
7
7
|
import color2 from "picocolors";
|
|
8
8
|
import clipboard from "clipboardy";
|
|
9
9
|
import fs4 from "fs/promises";
|
|
10
|
+
import path5 from "path";
|
|
10
11
|
import inquirer2 from "inquirer";
|
|
11
12
|
import ora from "ora";
|
|
12
13
|
|
|
13
14
|
// package.json
|
|
14
15
|
var name = "packmd";
|
|
15
16
|
var description = "Convert GitHub repositories and webpages into AI-ready Markdown digests";
|
|
16
|
-
var version = "1.0.
|
|
17
|
+
var version = "1.0.2";
|
|
17
18
|
|
|
18
19
|
// src/utils/version-check.ts
|
|
19
20
|
import fs from "fs/promises";
|
|
@@ -90,7 +91,7 @@ function printUpdateNotice(currentVersion, latestVersion) {
|
|
|
90
91
|
import { fetchGithubRepo } from "@packmd/core";
|
|
91
92
|
async function handleGitHub(target, options, spinner) {
|
|
92
93
|
const result = await fetchGithubRepo(target, {
|
|
93
|
-
token: options.token
|
|
94
|
+
token: options.token,
|
|
94
95
|
maxFiles: Number(options.maxFiles),
|
|
95
96
|
maxFileSizeKB: Number(options.maxFileSize),
|
|
96
97
|
includeGlobs: options.include || [],
|
|
@@ -225,7 +226,7 @@ ${file.content}
|
|
|
225
226
|
import { buildDigestHeader as buildDigestHeader2, scrapeWebPage } from "@packmd/core";
|
|
226
227
|
async function handleWebpage(target, options) {
|
|
227
228
|
const scraped = await scrapeWebPage(target, {
|
|
228
|
-
jinaApiKey: options.jinaApiKey
|
|
229
|
+
jinaApiKey: options.jinaApiKey
|
|
229
230
|
});
|
|
230
231
|
const estTokens = Math.round((scraped.content?.length || 0) / 4);
|
|
231
232
|
const header = buildDigestHeader2({
|
|
@@ -281,7 +282,17 @@ async function promptGithubOptions(currentOptions) {
|
|
|
281
282
|
|
|
282
283
|
// src/actions/run.ts
|
|
283
284
|
async function runAction(target, options) {
|
|
284
|
-
|
|
285
|
+
const asciiText = `
|
|
286
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
287
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
288
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
289
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
290
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
291
|
+
\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D
|
|
292
|
+
`;
|
|
293
|
+
console.log(color2.cyanBright(asciiText));
|
|
294
|
+
console.log(color2.dim(` ${name} v${version} \u2014 AI Markdown Packager
|
|
295
|
+
`));
|
|
285
296
|
const updateCheck = checkForUpdate(version).catch(() => null);
|
|
286
297
|
let finalOptions = { ...options };
|
|
287
298
|
try {
|
|
@@ -342,6 +353,31 @@ async function runAction(target, options) {
|
|
|
342
353
|
}
|
|
343
354
|
await fs4.writeFile(finalPath, digest, { encoding: "utf-8", flag: "w" });
|
|
344
355
|
spinner.succeed("Markdown generated successfully!");
|
|
356
|
+
const gitignorePath = path5.join(process.cwd(), ".gitignore");
|
|
357
|
+
let gitignoreContent = "";
|
|
358
|
+
try {
|
|
359
|
+
gitignoreContent = await fs4.readFile(gitignorePath, "utf-8");
|
|
360
|
+
} catch {
|
|
361
|
+
}
|
|
362
|
+
const isIgnored = gitignoreContent.split("\n").map((line) => line.trim()).includes(finalPath);
|
|
363
|
+
if (!isIgnored) {
|
|
364
|
+
const { addToGitignore } = await inquirer2.prompt([
|
|
365
|
+
{
|
|
366
|
+
type: "confirm",
|
|
367
|
+
name: "addToGitignore",
|
|
368
|
+
message: `Would you like to add ${color2.cyan(finalPath)} to your .gitignore?`,
|
|
369
|
+
default: true
|
|
370
|
+
}
|
|
371
|
+
]);
|
|
372
|
+
if (addToGitignore) {
|
|
373
|
+
const prefix = gitignoreContent.endsWith("\n") || gitignoreContent === "" ? "" : "\n";
|
|
374
|
+
await fs4.appendFile(gitignorePath, `${prefix}${finalPath}
|
|
375
|
+
`, "utf-8");
|
|
376
|
+
console.log(
|
|
377
|
+
color2.green("\u2714 ") + color2.cyan(finalPath) + color2.white(" is now safely hidden in .gitignore \u{1F512}")
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
345
381
|
}
|
|
346
382
|
if (finalOptions.copy) {
|
|
347
383
|
await clipboard.write(digest);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "packmd",
|
|
3
3
|
"description": "Convert GitHub repositories and webpages into AI-ready Markdown digests",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"typescript": "^5"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@packmd/core": "^1.0.0",
|
|
32
33
|
"chalk": "^5.6.2",
|
|
33
34
|
"clipboardy": "^5.3.2",
|
|
34
35
|
"commander": "^15.0.0",
|
|
@@ -36,7 +37,6 @@
|
|
|
36
37
|
"inquirer": "^14.0.2",
|
|
37
38
|
"minimatch": "^10.2.5",
|
|
38
39
|
"ora": "^9.4.1",
|
|
39
|
-
"@packmd/core": "^1.0.0",
|
|
40
40
|
"picocolors": "^1.1.1"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
@@ -63,4 +63,4 @@
|
|
|
63
63
|
"url": "https://github.com/thelastofinusa/packmd/issues"
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://packmd.vercel.app/docs"
|
|
66
|
-
}
|
|
66
|
+
}
|