@latent-space-labs/open-auto-doc 0.5.5 → 0.5.6
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/index.js +76 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3403,14 +3403,14 @@ function loadTemplates() {
|
|
|
3403
3403
|
}
|
|
3404
3404
|
templatesLoaded = true;
|
|
3405
3405
|
}
|
|
3406
|
-
async function writeContent(contentDir, results, crossRepo, changelogs) {
|
|
3406
|
+
async function writeContent(contentDir, results, crossRepo, changelogs, options) {
|
|
3407
3407
|
loadTemplates();
|
|
3408
3408
|
await fs23.ensureDir(contentDir);
|
|
3409
3409
|
if (results.length === 1) {
|
|
3410
3410
|
const changelog = changelogs?.get(results[0].repoName);
|
|
3411
3411
|
await writeRepoContent(contentDir, results[0], changelog);
|
|
3412
3412
|
} else {
|
|
3413
|
-
await writeMultiRepoIndex(contentDir, results);
|
|
3413
|
+
await writeMultiRepoIndex(contentDir, results, options?.repoStatus);
|
|
3414
3414
|
if (crossRepo && templates["cross-repo"]) {
|
|
3415
3415
|
await fs23.writeFile(
|
|
3416
3416
|
path23.join(contentDir, "cross-repo.mdx"),
|
|
@@ -3424,7 +3424,7 @@ async function writeContent(contentDir, results, crossRepo, changelogs) {
|
|
|
3424
3424
|
}
|
|
3425
3425
|
}
|
|
3426
3426
|
}
|
|
3427
|
-
async function writeMultiRepoIndex(contentDir, results) {
|
|
3427
|
+
async function writeMultiRepoIndex(contentDir, results, repoStatus) {
|
|
3428
3428
|
const repoCards = results.map((r) => {
|
|
3429
3429
|
const slug = slugify2(r.repoName);
|
|
3430
3430
|
const stack = r.architecture.techStack.slice(0, 5).join(", ");
|
|
@@ -3433,13 +3433,32 @@ async function writeMultiRepoIndex(contentDir, results) {
|
|
|
3433
3433
|
r.components.length > 0 ? `${r.components.length} components` : null,
|
|
3434
3434
|
r.dataModels.length > 0 ? `${r.dataModels.length} data models` : null
|
|
3435
3435
|
].filter(Boolean).join(" \xB7 ");
|
|
3436
|
+
const status = repoStatus?.[r.repoName];
|
|
3437
|
+
const statusParts = [];
|
|
3438
|
+
if (status?.lastAnalyzed) {
|
|
3439
|
+
const date = new Date(status.lastAnalyzed).toLocaleDateString("en-US", {
|
|
3440
|
+
year: "numeric",
|
|
3441
|
+
month: "short",
|
|
3442
|
+
day: "numeric"
|
|
3443
|
+
});
|
|
3444
|
+
statusParts.push(`Last analyzed: ${date}`);
|
|
3445
|
+
}
|
|
3446
|
+
if (status?.ciEnabled) {
|
|
3447
|
+
statusParts.push(`CI: auto-sync on \`${status.ciBranch || "main"}\``);
|
|
3448
|
+
}
|
|
3449
|
+
if (status?.htmlUrl) {
|
|
3450
|
+
statusParts.push(`[GitHub](${status.htmlUrl})`);
|
|
3451
|
+
}
|
|
3452
|
+
const statusLine = statusParts.length > 0 ? `
|
|
3453
|
+
|
|
3454
|
+
${statusParts.join(" \xB7 ")}` : "";
|
|
3436
3455
|
return `### [${r.repoName}](/docs/${slug})
|
|
3437
3456
|
|
|
3438
3457
|
${r.architecture.summary.split("\n")[0]}
|
|
3439
3458
|
|
|
3440
3459
|
**Stack:** ${stack || "N/A"}${stats ? `
|
|
3441
3460
|
|
|
3442
|
-
${stats}` : ""}`;
|
|
3461
|
+
${stats}` : ""}${statusLine}`;
|
|
3443
3462
|
}).join("\n\n---\n\n");
|
|
3444
3463
|
const mdx = `---
|
|
3445
3464
|
title: Documentation
|
|
@@ -4304,7 +4323,20 @@ Try reinstalling: npm install -g @latent-space-labs/open-auto-doc`
|
|
|
4304
4323
|
try {
|
|
4305
4324
|
genSpinner.start("Writing documentation content...");
|
|
4306
4325
|
const contentDir = path10.join(outputDir, "content", "docs");
|
|
4307
|
-
|
|
4326
|
+
const contentOptions = {};
|
|
4327
|
+
if (results.length > 1) {
|
|
4328
|
+
const repoStatus = {};
|
|
4329
|
+
for (const repo of repos) {
|
|
4330
|
+
const cached = loadCache(cacheDir, repo.name);
|
|
4331
|
+
repoStatus[repo.name] = {
|
|
4332
|
+
htmlUrl: repo.htmlUrl,
|
|
4333
|
+
lastAnalyzed: cached?.timestamp,
|
|
4334
|
+
commitSha: cached?.commitSha
|
|
4335
|
+
};
|
|
4336
|
+
}
|
|
4337
|
+
contentOptions.repoStatus = repoStatus;
|
|
4338
|
+
}
|
|
4339
|
+
await writeContent(contentDir, results, crossRepo, void 0, contentOptions);
|
|
4308
4340
|
await writeMeta(contentDir, results, crossRepo);
|
|
4309
4341
|
genSpinner.stop("Documentation content written");
|
|
4310
4342
|
} catch (err) {
|
|
@@ -4356,7 +4388,7 @@ Try reinstalling: npm install -g @latent-space-labs/open-auto-doc`
|
|
|
4356
4388
|
"To start the dev server again"
|
|
4357
4389
|
);
|
|
4358
4390
|
p8.outro("Done!");
|
|
4359
|
-
|
|
4391
|
+
process.exit(0);
|
|
4360
4392
|
}
|
|
4361
4393
|
if (devServer) {
|
|
4362
4394
|
killDevServer(devServer);
|
|
@@ -4373,9 +4405,9 @@ Try reinstalling: npm install -g @latent-space-labs/open-auto-doc`
|
|
|
4373
4405
|
"Next steps"
|
|
4374
4406
|
);
|
|
4375
4407
|
p8.outro("Done!");
|
|
4376
|
-
|
|
4408
|
+
process.exit(0);
|
|
4377
4409
|
}
|
|
4378
|
-
let
|
|
4410
|
+
let vercelDeploymentUrl;
|
|
4379
4411
|
if (wantsVercel && vercelToken) {
|
|
4380
4412
|
const vercelResult = await deployToVercel({
|
|
4381
4413
|
token: vercelToken,
|
|
@@ -4387,7 +4419,7 @@ Try reinstalling: npm install -g @latent-space-labs/open-auto-doc`
|
|
|
4387
4419
|
});
|
|
4388
4420
|
if (vercelResult) {
|
|
4389
4421
|
p8.log.success(`Live at: ${vercelResult.deploymentUrl}`);
|
|
4390
|
-
|
|
4422
|
+
vercelDeploymentUrl = vercelResult.deploymentUrl;
|
|
4391
4423
|
}
|
|
4392
4424
|
}
|
|
4393
4425
|
if (wantsCi) {
|
|
@@ -4403,12 +4435,27 @@ Try reinstalling: npm install -g @latent-space-labs/open-auto-doc`
|
|
|
4403
4435
|
config,
|
|
4404
4436
|
branch: ciBranch
|
|
4405
4437
|
});
|
|
4438
|
+
config.ciEnabled = true;
|
|
4439
|
+
config.ciBranch = ciBranch || "main";
|
|
4440
|
+
try {
|
|
4441
|
+
saveConfig(config);
|
|
4442
|
+
} catch {
|
|
4443
|
+
}
|
|
4406
4444
|
}
|
|
4407
4445
|
}
|
|
4408
|
-
|
|
4446
|
+
const docsRepoUrl = `https://github.com/${deployResult.owner}/${deployResult.repoName}`;
|
|
4447
|
+
if (vercelDeploymentUrl) {
|
|
4448
|
+
p8.note(
|
|
4449
|
+
`Docs repo: ${docsRepoUrl}
|
|
4450
|
+
Live site: ${vercelDeploymentUrl}`,
|
|
4451
|
+
"Your documentation is ready!"
|
|
4452
|
+
);
|
|
4453
|
+
p8.outro(vercelDeploymentUrl);
|
|
4454
|
+
} else {
|
|
4409
4455
|
showVercelInstructions(deployResult.owner, deployResult.repoName);
|
|
4456
|
+
p8.outro(`Docs repo: ${docsRepoUrl}`);
|
|
4410
4457
|
}
|
|
4411
|
-
|
|
4458
|
+
process.exit(0);
|
|
4412
4459
|
}
|
|
4413
4460
|
function resolveTemplateDir() {
|
|
4414
4461
|
const candidates = [
|
|
@@ -4650,7 +4697,22 @@ async function generateCommand(options) {
|
|
|
4650
4697
|
}
|
|
4651
4698
|
}
|
|
4652
4699
|
const contentDir = path11.join(config.outputDir, "content", "docs");
|
|
4653
|
-
|
|
4700
|
+
const contentOptions = {};
|
|
4701
|
+
if (results.length > 1) {
|
|
4702
|
+
const repoStatus = {};
|
|
4703
|
+
for (const repo of config.repos) {
|
|
4704
|
+
const cached = loadCache(cacheDir, repo.name);
|
|
4705
|
+
repoStatus[repo.name] = {
|
|
4706
|
+
htmlUrl: repo.htmlUrl,
|
|
4707
|
+
ciEnabled: config.ciEnabled,
|
|
4708
|
+
ciBranch: config.ciBranch,
|
|
4709
|
+
lastAnalyzed: cached?.timestamp,
|
|
4710
|
+
commitSha: cached?.commitSha
|
|
4711
|
+
};
|
|
4712
|
+
}
|
|
4713
|
+
contentOptions.repoStatus = repoStatus;
|
|
4714
|
+
}
|
|
4715
|
+
await writeContent(contentDir, results, crossRepo, changelogs.size > 0 ? changelogs : void 0, contentOptions);
|
|
4654
4716
|
await writeMeta(contentDir, results, crossRepo, changelogs.size > 0 ? changelogs : void 0);
|
|
4655
4717
|
try {
|
|
4656
4718
|
await runBuildCheck({ docsDir: config.outputDir, apiKey, model });
|
|
@@ -4663,6 +4725,7 @@ async function generateCommand(options) {
|
|
|
4663
4725
|
cleanupClone(clone);
|
|
4664
4726
|
}
|
|
4665
4727
|
p9.outro("Done!");
|
|
4728
|
+
process.exit(0);
|
|
4666
4729
|
}
|
|
4667
4730
|
|
|
4668
4731
|
// src/commands/deploy.ts
|
|
@@ -4811,7 +4874,7 @@ async function logoutCommand() {
|
|
|
4811
4874
|
|
|
4812
4875
|
// src/index.ts
|
|
4813
4876
|
var program = new Command();
|
|
4814
|
-
program.name("open-auto-doc").description("Auto-generate beautiful documentation websites from GitHub repositories using AI").version("0.5.
|
|
4877
|
+
program.name("open-auto-doc").description("Auto-generate beautiful documentation websites from GitHub repositories using AI").version("0.5.6");
|
|
4815
4878
|
program.command("init", { isDefault: true }).description("Initialize and generate documentation for your repositories").option("-o, --output <dir>", "Output directory", "docs-site").action(initCommand);
|
|
4816
4879
|
program.command("generate").description("Regenerate documentation using existing configuration").option("--incremental", "Only re-analyze changed files (uses cached results)").option("--force", "Force full regeneration (ignore cache)").option("--repo <name>", "Only analyze this repo (uses cache for others)").action(generateCommand);
|
|
4817
4880
|
program.command("deploy").description("Create a GitHub repo for docs and push (connect to Vercel for auto-deploy)").option("-d, --dir <path>", "Docs site directory").action(deployCommand);
|