promptgraph-mcp 2.3.4 → 2.3.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.
Files changed (2) hide show
  1. package/github-import.js +32 -0
  2. package/package.json +1 -1
package/github-import.js CHANGED
@@ -97,6 +97,37 @@ function sparseClone(url, dest, subdir) {
97
97
  return false;
98
98
  }
99
99
 
100
+ // After full-clone root: remove files that are not skills and dirs we don't need
101
+ function cleanupRepoRoot(repoRoot) {
102
+ const SKIP_RE = /^(readme|changelog|license|contributing|code.of.conduct|security|authors|credits|install|installation|usage|promotion|faq|glossary|index|overview|summary|roadmap|todo|notes|template|example|sample|demo|guide|tutorial|walkthrough|architecture|design|spec|requirements|privacy|terms|disclaimer|notice|copying|warranty|funding)/i;
103
+ const SKIP_DIRS_LOCAL = new Set(['.github', 'docs', 'doc', 'assets', 'images', 'img', 'screenshots', 'media', 'static', 'scripts', 'ci_scripts', 'node_modules', 'vendor', 'dist', 'build', 'tests', 'test']);
104
+
105
+ let removed = 0;
106
+ const entries = fs.readdirSync(repoRoot, { withFileTypes: true });
107
+ for (const entry of entries) {
108
+ if (entry.name === '.git') continue;
109
+ const fullPath = path.join(repoRoot, entry.name);
110
+ if (entry.isDirectory()) {
111
+ if (SKIP_DIRS_LOCAL.has(entry.name.toLowerCase())) {
112
+ fs.rmSync(fullPath, { recursive: true, force: true });
113
+ removed++;
114
+ }
115
+ } else if (entry.isFile() && entry.name.endsWith('.md')) {
116
+ const base = entry.name.replace(/\.md$/i, '').toLowerCase();
117
+ if (SKIP_RE.test(base)) {
118
+ fs.unlinkSync(fullPath);
119
+ removed++;
120
+ }
121
+ } else if (entry.isFile() && !entry.name.endsWith('.md')) {
122
+ // Remove non-md files (gitignore, LICENSE, Makefile, etc.) — keep only .md
123
+ if (entry.name !== '.gitignore') {
124
+ try { fs.unlinkSync(fullPath); removed++; } catch {}
125
+ }
126
+ }
127
+ }
128
+ if (removed > 0) console.log(`Cleaned up ${removed} non-skill files/dirs from root`);
129
+ }
130
+
100
131
  // Update sparse repo — fetch + reset
101
132
  function sparseUpdate(dest, subdir) {
102
133
  const fetch = git(['fetch', '--depth=1', 'origin'], dest);
@@ -182,6 +213,7 @@ export async function importFromGitHub(repoUrl) {
182
213
  } else {
183
214
  console.log(`no subdir found, cloning root...`);
184
215
  cloneOk = fullClone(url, dest);
216
+ if (cloneOk) cleanupRepoRoot(dest);
185
217
  }
186
218
 
187
219
  if (!cloneOk) throw new Error(`Clone failed for ${url}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {