explainmyrepo 0.1.1 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "explainmyrepo",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Turn any GitHub repo into a bespoke, art-directed explainer site — for humans and their AI — in one command.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -85,14 +85,10 @@ async function kbRegisterStation({ buildDir, env, model, apiKey, opts }) {
85
85
  fs.writeFileSync(genPath, `// GENERATED kb.config target entry for "${slug}" — paste into kb/kb.config.mjs targets{}.\nexport default ${JSON.stringify({ [slug]: entry }, null, 2)};\n`);
86
86
  log(`${C.dim}wrote generated entry → ${path.relative(process.cwd(), genPath)}${C.reset}`);
87
87
 
88
- if (!opts.registerKb) {
89
- throw new Error(
90
- `kb:register "${slug}" must be a registered kb.config target before build-kb can index it.\n` +
91
- ` A generated entry was written to ${genPath}.\n` +
92
- ` • Re-run with --register-kb to inject it into kb/kb.config.mjs automatically (the one step that edits the shared registry), or paste it in by hand.`,
93
- );
94
- }
95
- // --register-kb (opt-in, CLEARLY the single step that mutates kb/kb.config.mjs) ----------------
88
+ // Auto-register (no flag needed) so ANY repo just works. Inject the AI-authored entry into THIS
89
+ // build's kb.config copy. In real use that copy is ephemeral — a fresh CI checkout on the hosted
90
+ // path, or the throwaway npx install locally so this never mutates a shared/committed registry.
91
+ // (--register-kb is now a no-op alias, kept for backward compatibility.)
96
92
  let src = fs.readFileSync(cfgPath, 'utf8');
97
93
  const anchor = 'export const targets = {';
98
94
  const at = src.indexOf(anchor);
@@ -100,7 +96,7 @@ async function kbRegisterStation({ buildDir, env, model, apiKey, opts }) {
100
96
  const inject = `\n ${JSON.stringify(slug)}: ${JSON.stringify(entry, null, 2).replace(/\n/g, '\n ')},`;
101
97
  src = src.slice(0, at + anchor.length) + inject + src.slice(at + anchor.length);
102
98
  fs.writeFileSync(cfgPath, src);
103
- log(`${C.yellow}injected "${slug}" into kb/kb.config.mjs (--register-kb).${C.reset}`);
99
+ log(`${C.yellow}auto-registered "${slug}" into this build's kb.config.${C.reset}`);
104
100
  const m2 = await importCfg();
105
101
  try { m2.getTarget(slug); } catch (e) { throw new Error(`kb:register — injection did not take: ${e.message}`); }
106
102
  return { ok: true, registered: true };