From 2f8feabcba47c9e55796f0364504417f516345c4 Mon Sep 17 00:00:00 2001
From: Thuc Pham <51660321+thucpn@users.noreply.github.com>
Date: Wed, 28 Aug 2024 17:28:29 +0700
Subject: [PATCH] feat: simplify CLI interface (#265)

---
 .changeset/wicked-numbers-approve.md |  5 +++++
 README.md                            |  2 +-
 index.ts                             |  8 ++++++++
 questions.ts                         | 23 ++++++++++++++---------
 4 files changed, 28 insertions(+), 10 deletions(-)
 create mode 100644 .changeset/wicked-numbers-approve.md

diff --git a/.changeset/wicked-numbers-approve.md b/.changeset/wicked-numbers-approve.md
new file mode 100644
index 00000000..98578400
--- /dev/null
+++ b/.changeset/wicked-numbers-approve.md
@@ -0,0 +1,5 @@
+---
+"create-llama": patch
+---
+
+feat: simplify CLI interface
diff --git a/README.md b/README.md
index 444fe30b..daa2c4e0 100644
--- a/README.md
+++ b/README.md
@@ -94,7 +94,7 @@ Need to install the following packages:
   create-llama@latest
 Ok to proceed? (y) y
 ✔ What is your project named? … my-app
-✔ Which template would you like to use? › Agentic RAG (single agent)
+✔ Which template would you like to use? › Agentic RAG (e.g. chat with docs)
 ✔ Which framework would you like to use? › NextJS
 ✔ Would you like to set up observability? › No
 ✔ Please provide your OpenAI API key (leave blank to skip): …
diff --git a/index.ts b/index.ts
index 10dec40b..8bef22df 100644
--- a/index.ts
+++ b/index.ts
@@ -174,6 +174,13 @@ const program = new Commander.Command(packageJson.name)
     `
 
   Select LLM and embedding models.
+`,
+  )
+  .option(
+    "--ask-examples",
+    `
+
+  Select community templates and LlamaPacks.
 `,
   )
   .allowUnknownOption()
@@ -195,6 +202,7 @@ if (
   program.useLlamaParse = false;
 }
 program.askModels = process.argv.includes("--ask-models");
+program.askExamples = process.argv.includes("--ask-examples");
 if (process.argv.includes("--no-files")) {
   program.dataSources = [];
 } else if (process.argv.includes("--example-file")) {
diff --git a/questions.ts b/questions.ts
index 0ed90b7d..4b1f61f3 100644
--- a/questions.ts
+++ b/questions.ts
@@ -28,6 +28,7 @@ export type QuestionArgs = Omit<
   "appPath" | "packageManager"
 > & {
   askModels?: boolean;
+  askExamples?: boolean;
 };
 const supportedContextFileTypes = [
   ".pdf",
@@ -338,20 +339,24 @@ export const askQuestions = async (
           name: "template",
           message: "Which template would you like to use?",
           choices: [
-            { title: "Agentic RAG (single agent)", value: "streaming" },
+            { title: "Agentic RAG (e.g. chat with docs)", value: "streaming" },
             {
               title: "Multi-agent app (using llama-agents)",
               value: "multiagent",
             },
             { title: "Structured Extractor", value: "extractor" },
-            {
-              title: `Community template from ${styledRepo}`,
-              value: "community",
-            },
-            {
-              title: "Example using a LlamaPack",
-              value: "llamapack",
-            },
+            ...(program.askExamples
+              ? [
+                  {
+                    title: `Community template from ${styledRepo}`,
+                    value: "community",
+                  },
+                  {
+                    title: "Example using a LlamaPack",
+                    value: "llamapack",
+                  },
+                ]
+              : []),
           ],
           initial: 0,
         },
-- 
GitLab