unrag 0.2.1 → 0.2.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/dist/cli/index.js +56 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -578,6 +578,17 @@ async function initCommand(args) {
|
|
|
578
578
|
import { outro as outro2 } from "@clack/prompts";
|
|
579
579
|
import path6 from "node:path";
|
|
580
580
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
581
|
+
|
|
582
|
+
// cli/lib/constants.ts
|
|
583
|
+
var UNRAG_SITE_URL = (process.env.UNRAG_SITE_URL ?? process.env.UNRAG_DOCS_BASE_URL)?.trim() || "https://unrag.dev";
|
|
584
|
+
var UNRAG_GITHUB_REPO_URL = "https://github.com/BetterStacks/unrag";
|
|
585
|
+
function docsUrl(siteRelativePath) {
|
|
586
|
+
const p = siteRelativePath.startsWith("/") ? siteRelativePath : `/${siteRelativePath}`;
|
|
587
|
+
const base = UNRAG_SITE_URL.endsWith("/") ? UNRAG_SITE_URL : `${UNRAG_SITE_URL}/`;
|
|
588
|
+
return new URL(p.replace(/^\/+/, "/"), base).toString();
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// cli/commands/add.ts
|
|
581
592
|
var CONFIG_FILE2 = "unrag.json";
|
|
582
593
|
var __filename3 = fileURLToPath2(import.meta.url);
|
|
583
594
|
var __dirname3 = path6.dirname(__filename3);
|
|
@@ -589,7 +600,7 @@ var parseAddArgs = (args) => {
|
|
|
589
600
|
out.yes = true;
|
|
590
601
|
continue;
|
|
591
602
|
}
|
|
592
|
-
if (!out.connector && !a.startsWith("-")) {
|
|
603
|
+
if (!out.connector && a && !a.startsWith("-")) {
|
|
593
604
|
out.connector = a;
|
|
594
605
|
continue;
|
|
595
606
|
}
|
|
@@ -645,7 +656,7 @@ Available connectors: notion`);
|
|
|
645
656
|
`Installed connector: ${connector}.`,
|
|
646
657
|
"",
|
|
647
658
|
`- Code: ${path6.join(config.installDir, "connectors", connector)}`,
|
|
648
|
-
`- Docs:
|
|
659
|
+
`- Docs: ${docsUrl(`/docs/connectors/${connector}`)}`,
|
|
649
660
|
"",
|
|
650
661
|
merged.changes.length > 0 ? `Added deps: ${merged.changes.map((c) => c.name).join(", ")}` : "Added deps: none",
|
|
651
662
|
nonInteractive ? "" : "Tip: keep NOTION_TOKEN server-side only (env var)."
|
|
@@ -654,12 +665,51 @@ Available connectors: notion`);
|
|
|
654
665
|
}
|
|
655
666
|
|
|
656
667
|
// cli/run.ts
|
|
668
|
+
function renderHelp() {
|
|
669
|
+
return [
|
|
670
|
+
"unrag — vendor-in RAG primitives (ingest/retrieve + adapters) into your repo.",
|
|
671
|
+
"",
|
|
672
|
+
"Usage:",
|
|
673
|
+
" bunx unrag <command> [options]",
|
|
674
|
+
" npx unrag <command> [options]",
|
|
675
|
+
"",
|
|
676
|
+
"Commands:",
|
|
677
|
+
" init Install core files (config + store adapter templates)",
|
|
678
|
+
" add <connector> Install a connector (currently: notion)",
|
|
679
|
+
" help Show this help",
|
|
680
|
+
"",
|
|
681
|
+
"Global options:",
|
|
682
|
+
" -h, --help Show help",
|
|
683
|
+
" -y, --yes Non-interactive; accept defaults",
|
|
684
|
+
"",
|
|
685
|
+
"init options:",
|
|
686
|
+
" --store <adapter> drizzle | prisma | raw-sql",
|
|
687
|
+
" --dir <path> Install directory (alias: --install-dir)",
|
|
688
|
+
" --alias <@name> Import alias base (e.g. @unrag)",
|
|
689
|
+
"",
|
|
690
|
+
"Examples:",
|
|
691
|
+
" bunx unrag init",
|
|
692
|
+
" bunx unrag init --yes --store drizzle --dir lib/unrag --alias @unrag",
|
|
693
|
+
" bunx unrag add notion --yes",
|
|
694
|
+
"",
|
|
695
|
+
"Docs:",
|
|
696
|
+
` - Quickstart: ${docsUrl("/docs/getting-started/quickstart")}`,
|
|
697
|
+
` - CLI: ${docsUrl("/docs/reference/cli")}`,
|
|
698
|
+
` - Notion: ${docsUrl("/docs/connectors/notion")}`,
|
|
699
|
+
"",
|
|
700
|
+
"Repo:",
|
|
701
|
+
` ${UNRAG_GITHUB_REPO_URL}`,
|
|
702
|
+
"",
|
|
703
|
+
"Tip:",
|
|
704
|
+
" After `init`, open the generated unrag.md for schema + env vars (DATABASE_URL)."
|
|
705
|
+
].join(`
|
|
706
|
+
`);
|
|
707
|
+
}
|
|
657
708
|
async function run(argv) {
|
|
658
709
|
const [, , command, ...rest] = argv;
|
|
659
710
|
intro("unrag");
|
|
660
711
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
661
|
-
outro3(
|
|
662
|
-
`));
|
|
712
|
+
outro3(renderHelp());
|
|
663
713
|
return;
|
|
664
714
|
}
|
|
665
715
|
if (command === "init") {
|
|
@@ -670,7 +720,8 @@ async function run(argv) {
|
|
|
670
720
|
await addCommand(rest);
|
|
671
721
|
return;
|
|
672
722
|
}
|
|
673
|
-
outro3(`Unknown command: ${command}`
|
|
723
|
+
outro3([`Unknown command: ${command}`, "", renderHelp()].join(`
|
|
724
|
+
`));
|
|
674
725
|
process.exitCode = 1;
|
|
675
726
|
}
|
|
676
727
|
|