@olorehq/olore 0.2.1 → 0.3.0
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/cli.js +35 -26
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -712,33 +712,42 @@ import pc3 from "picocolors";
|
|
|
712
712
|
var MARKER_START = "<!-- olore:start -->";
|
|
713
713
|
var MARKER_END = "<!-- olore:end -->";
|
|
714
714
|
var TARGET_FILES = ["AGENTS.md", "CLAUDE.md"];
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
715
|
+
function formatLibraryName(name) {
|
|
716
|
+
const specialNames = {
|
|
717
|
+
nextjs: "Next.js",
|
|
718
|
+
"nextjs-docs": "Next.js",
|
|
719
|
+
"t3-env": "T3 Env",
|
|
720
|
+
rhf: "React Hook Form",
|
|
721
|
+
"tanstack-query": "TanStack Query",
|
|
722
|
+
"tanstack-form": "TanStack Form",
|
|
723
|
+
"ms-agent-framework": "MS Agent Framework"
|
|
724
|
+
};
|
|
725
|
+
if (specialNames[name]) return specialNames[name];
|
|
726
|
+
return name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
721
727
|
}
|
|
722
728
|
async function buildInjectedContent() {
|
|
723
729
|
const packages = await getInstalledPackages();
|
|
724
|
-
|
|
725
|
-
let count = 0;
|
|
726
|
-
for (const pkg of packages) {
|
|
727
|
-
const indexPath = path6.join(pkg.path, "INDEX.md");
|
|
728
|
-
if (!fs6.existsSync(indexPath)) continue;
|
|
729
|
-
const rawContent = fs6.readFileSync(indexPath, "utf-8");
|
|
730
|
-
const sectionLines = extractSectionLines(rawContent);
|
|
731
|
-
if (sectionLines.length === 0) continue;
|
|
732
|
-
const resolvedBase = fs6.realpathSync(pkg.path);
|
|
733
|
-
const rootPath = path6.join(resolvedBase, "contents");
|
|
734
|
-
packageLines.push(renderCompactBlock(sectionLines, pkg.name, pkg.version, rootPath));
|
|
735
|
-
count++;
|
|
736
|
-
}
|
|
737
|
-
if (count === 0) {
|
|
730
|
+
if (packages.length === 0) {
|
|
738
731
|
return { content: "", count: 0 };
|
|
739
732
|
}
|
|
740
|
-
const
|
|
741
|
-
|
|
733
|
+
const rows = packages.map((pkg) => {
|
|
734
|
+
const library = formatLibraryName(pkg.name);
|
|
735
|
+
const version2 = pkg.version !== "latest" ? ` ${pkg.version}` : "";
|
|
736
|
+
const skillCommand = `/olore-${pkg.name}-${pkg.version}`;
|
|
737
|
+
return `| ${library}${version2} | \`${skillCommand}\` |`;
|
|
738
|
+
});
|
|
739
|
+
const lines = [
|
|
740
|
+
MARKER_START,
|
|
741
|
+
"## Documentation Reference",
|
|
742
|
+
"",
|
|
743
|
+
"Use these skill commands to access up-to-date documentation. Your training data may be outdated.",
|
|
744
|
+
"",
|
|
745
|
+
"| Library | Skill Command |",
|
|
746
|
+
"|---------|---------------|",
|
|
747
|
+
...rows,
|
|
748
|
+
MARKER_END
|
|
749
|
+
];
|
|
750
|
+
return { content: lines.join("\n"), count: packages.length };
|
|
742
751
|
}
|
|
743
752
|
function smartMerge(filePath, injectedContent) {
|
|
744
753
|
if (!fs6.existsSync(filePath)) {
|
|
@@ -812,8 +821,8 @@ async function inject(options) {
|
|
|
812
821
|
console.log(JSON.stringify(result, null, 2));
|
|
813
822
|
return;
|
|
814
823
|
}
|
|
815
|
-
console.log(pc3.yellow("No installed packages
|
|
816
|
-
console.log(pc3.gray("
|
|
824
|
+
console.log(pc3.yellow("No installed packages found."));
|
|
825
|
+
console.log(pc3.gray("Run olore install <package> to install documentation packages."));
|
|
817
826
|
return;
|
|
818
827
|
}
|
|
819
828
|
const filesWritten = [];
|
|
@@ -932,7 +941,7 @@ import pc4 from "picocolors";
|
|
|
932
941
|
// package.json
|
|
933
942
|
var package_default = {
|
|
934
943
|
name: "@olorehq/olore",
|
|
935
|
-
version: "0.
|
|
944
|
+
version: "0.3.0",
|
|
936
945
|
description: "Universal documentation for any AI coding agent",
|
|
937
946
|
keywords: [
|
|
938
947
|
"ai",
|
|
@@ -1764,7 +1773,7 @@ program.command("prune").description("Remove dangling symlinks, orphaned package
|
|
|
1764
1773
|
process.exit(1);
|
|
1765
1774
|
}
|
|
1766
1775
|
});
|
|
1767
|
-
program.command("inject").description("Inject
|
|
1776
|
+
program.command("inject").description("Inject documentation skill reference table into AGENTS.md and CLAUDE.md").option("--remove", "Remove injected content from project files").option("--json", "Output as JSON").action(async (options) => {
|
|
1768
1777
|
try {
|
|
1769
1778
|
await inject(options);
|
|
1770
1779
|
} catch (error) {
|