packmd 1.0.0 → 1.0.1

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 CHANGED
@@ -1,3 +1,5 @@
1
+ ![PackMD Opengraph Image](https://packmd.vercel.app/og.png)
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.0";
17
+ var version = "1.0.1";
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 || process.env.GITHUB_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 || process.env.JINA_API_KEY
229
+ jinaApiKey: options.jinaApiKey
229
230
  });
230
231
  const estTokens = Math.round((scraped.content?.length || 0) / 4);
231
232
  const header = buildDigestHeader2({
@@ -281,6 +282,7 @@ async function promptGithubOptions(currentOptions) {
281
282
 
282
283
  // src/actions/run.ts
283
284
  async function runAction(target, options) {
285
+ console.log("");
284
286
  console.log(color2.cyan(`${name} \u2014 AI Markdown Packager`));
285
287
  const updateCheck = checkForUpdate(version).catch(() => null);
286
288
  let finalOptions = { ...options };
@@ -341,7 +343,23 @@ async function runAction(target, options) {
341
343
  }
342
344
  }
343
345
  await fs4.writeFile(finalPath, digest, { encoding: "utf-8", flag: "w" });
344
- spinner.succeed("Markdown generated successfully!");
346
+ const gitignorePath = path5.join(process.cwd(), ".gitignore");
347
+ let gitignoreContent = "";
348
+ try {
349
+ gitignoreContent = await fs4.readFile(gitignorePath, "utf-8");
350
+ } catch {
351
+ }
352
+ const isIgnored = gitignoreContent.split("\n").map((line) => line.trim()).includes(finalPath);
353
+ if (!isIgnored) {
354
+ const prefix = gitignoreContent.endsWith("\n") || gitignoreContent === "" ? "" : "\n";
355
+ await fs4.appendFile(gitignorePath, `${prefix}${finalPath}
356
+ `, "utf-8");
357
+ spinner.succeed(
358
+ `Generated successfully! ${color2.cyan(finalPath)} was added to .gitignore.`
359
+ );
360
+ } else {
361
+ spinner.succeed("Markdown generated successfully!");
362
+ }
345
363
  }
346
364
  if (finalOptions.copy) {
347
365
  await clipboard.write(digest);
@@ -349,6 +367,7 @@ async function runAction(target, options) {
349
367
  }
350
368
  const latestVersion = await updateCheck;
351
369
  if (latestVersion) printUpdateNotice(version, latestVersion);
370
+ console.log("");
352
371
  } catch (error) {
353
372
  console.error(
354
373
  color2.red(`
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.0",
4
+ "version": "1.0.1",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "bin": {