Skip to content

feat: add add command , new skills addon, new history command - #848

Merged
AmanVarshney01 merged 3 commits into
mainfrom
add-addons
Jan 28, 2026
Merged

AmanVarshney01 merged 3 commits into
mainfrom
add-addons

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Jan 27, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Skills addon to install AI coding-assistant skills; CLI add and history commands; generated projects can include a reproducible BTS config and a new external “Demo” link.
  • Documentation

    • Expanded developer workflow, code style, CLI options (history & skills), and BTS config docs.
  • Chores

    • Dependency/version bumps, deterministic generator output, runtime script adjustments, and other generator/tooling improvements.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Jan 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
create-better-t-stack-web Ready Ready Preview, Comment Jan 28, 2026 9:06pm

Request Review

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jan 27, 2026
@dosubot dosubot Bot added cli Changes to the CLI tool enhancement New feature or request labels Jan 27, 2026
@coderabbitai

coderabbitai Bot commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a new "skills" addon and guided installer, a CLI add workflow and programmatic add() API, persistent project history storage, moves BTS config write into template-generator, extends generator APIs/options, updates tooling/runtime versions, and adds related docs and UI content.

Changes

Cohort / File(s) Summary
Skills addon & prompts
apps/cli/src/constants.ts, apps/cli/src/helpers/addons/skills-setup.ts, apps/cli/src/helpers/addons/addons-setup.ts, apps/cli/src/helpers/addons/ruler-setup.ts, apps/cli/src/prompts/addons.ts, packages/types/src/schemas.ts, apps/web/src/lib/constant.ts, apps/web/content/docs/cli/options.mdx
Introduces skills addon and guided installer; registers skills across constants, prompts, schema, and web UI; moves ruler into new AI group; adds two editor options to ruler setup. Review new CLI prompts and schema enum additions.
CLI add flow & programmatic API
apps/cli/src/helpers/core/add-handler.ts, apps/cli/src/index.ts, apps/cli/src/helpers/core/command-handlers.ts
Adds addHandler, exported add() API and AddResult types; integrates VFS-based template processing, optional install, and records reproducible commands into history. Check silent/CI behavior and exported surface changes.
Project history persistence
apps/cli/src/utils/project-history.ts, apps/cli/package.json
New file-backed project history API (read/add/get/clear/remove) persisted via env-paths; added env-paths dependency. Pay attention to storage path, versioning, and error handling semantics.
BTS config refactor & VFS write
apps/cli/src/utils/bts-config.ts, packages/template-generator/src/bts-config.ts, packages/template-generator/src/generator.ts, apps/cli/src/helpers/core/create-project.ts
Removes CLI writeBtsConfig; replaces with readBtsConfig/updateBtsConfig; adds writeBtsConfigToVfs in template-generator and writes bts.jsonc into VFS when a version is supplied. Verify interplay between generator versioning and CLI config updates.
Template-generator API & options
packages/template-generator/src/index.ts, packages/template-generator/src/types.ts, packages/template-generator/src/utils/reproducible-command.ts, packages/template-generator/src/bts-config.ts, packages/template-generator/src/generator.ts
Exposes addon-processing and BTS config writer, adds version?: string to GeneratorOptions, tightens reproducible command signature, and wires reproducibleCommand into generated bts.jsonc. Review public API changes and signature updates.
Tooling & runtime updates
packages/template-generator/src/processors/runtime-deps.ts, packages/template-generator/src/processors/turbo-generator.ts, packages/template-generator/src/utils/add-deps.ts
Start scripts now reference dist/index.mjs; db:migrate marked persistent: true; bumps oxlint → ^1.41.0 and oxfmt → ^0.26.0. Confirm packaging/runtime expectations for .mjs entrypoints.
Fumadocs & addon templates
apps/cli/src/helpers/addons/fumadocs-setup.ts, packages/template-generator/scripts/generate-templates.ts
Adds new Fumadocs templates and makes template generation deterministic (sorted outputs). Review new template options and deterministic ordering.
Env var generation tweaks
packages/template-generator/src/processors/env-vars.ts
Restricts BETTER_AUTH_* env vars to only when better-auth is selected (conditional generation). Verify env-var expectations for other auth choices.
Docs & developer content
AGENTS.md, apps/web/content/docs/cli/options.mdx, apps/web/content/docs/bts-config.mdx
Adds AGENTS.md, documents skills addon, project history CLI options, and reproducibleCommand in bts.jsonc docs. Check for doc accuracy vs CLI behavior.
UI/navigation change
apps/web/src/app/layout.config.tsx
Adds an external "Demo" link to navigation links.

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately captures the three main features: the new add command for installing addons, the new skills addon, and the new history command. It directly reflects the primary changes across the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (7)
packages/template-generator/src/processors/runtime-deps.ts (1)

25-37: Align start scripts with Bun execution guidelines.
Guidelines specify bun <file> for running JS/TS; current scripts use bun run and node. Consider switching both to bun dist/index.mjs, or document an explicit exception if Node execution is required. As per coding guidelines, ...

♻️ Suggested adjustment
-    pkgJson.scripts.start = "bun run dist/index.mjs";
+    pkgJson.scripts.start = "bun dist/index.mjs";
...
-    pkgJson.scripts.start = "node dist/index.mjs";
+    pkgJson.scripts.start = "bun dist/index.mjs";
apps/cli/src/utils/bts-config.ts (2)

13-25: Consider adding validation after parsing to ensure type safety.

The parse function returns unknown, and the cast to BetterTStackConfig doesn't validate the structure. If the file contains malformed JSON or unexpected schema, downstream code may fail with confusing errors.

♻️ Suggested improvement with basic validation
   const configContent = await fs.readFile(configPath, "utf-8");
-  const config = parse(configContent) as BetterTStackConfig;
-  return config;
+  const config = parse(configContent);
+  if (config && typeof config === "object") {
+    return config as BetterTStackConfig;
+  }
+  return null;

35-53: Silent failures may hide configuration issues.

Both readBtsConfig and updateBtsConfig silently swallow errors. While this prevents crashes, it can make debugging difficult when config updates don't persist. Consider logging a debug-level message or returning a status indicator.

apps/cli/src/helpers/addons/skills-setup.ts (3)

3-3: Consider using Bun.$ instead of execa for shell execution.

Per coding guidelines, Bun.$ template literal syntax is preferred over execa for shell command execution. However, if there are specific reasons for using execa (e.g., better cross-platform support or specific features), this can be kept.


219-227: Add defensive handling for the :: delimiter split.

If a source string unexpectedly contains ::, the split will produce more than 2 elements, and skillName will be incorrect. Consider using a more robust approach.

♻️ Suggested fix using indexOf for safer splitting
   for (const skillKey of selectedSkills) {
-    const [source, skillName] = (skillKey as string).split("::");
+    const key = skillKey as string;
+    const separatorIndex = key.indexOf("::");
+    if (separatorIndex === -1) continue;
+    const source = key.substring(0, separatorIndex);
+    const skillName = key.substring(separatorIndex + 2);
     if (!skillsBySource[source]) {
       skillsBySource[source] = [];
     }
     skillsBySource[source].push(skillName);
   }

232-248: Shell command injection risk with string interpolation.

Building shell commands via string concatenation with user-selected values could be risky if any skill names or sources contain shell metacharacters. The execa array form would be safer than string interpolation.

♻️ Consider using array-based command execution

Instead of building a single command string like skills@latest add ${source} ${skillFlags} ${agentFlags} -y, consider passing arguments as an array to avoid potential issues with special characters in skill names or sources.

apps/cli/src/utils/project-history.ts (1)

56-69: Consider validating the history data structure after reading.

Similar to the bts-config issue, readJson returns data that's cast without validation. If the history file is corrupted or has an unexpected schema, it could cause issues downstream.

♻️ Suggested validation
   try {
     if (await fs.pathExists(historyPath)) {
       const data = await fs.readJson(historyPath);
-      return data as HistoryData;
+      if (data && typeof data === "object" && Array.isArray(data.entries)) {
+        return data as HistoryData;
+      }
     }
   } catch {
     // If file is corrupted, return empty history
   }

Comment on lines +25 to +34
export interface AddHandlerOptions {
silent?: boolean;
}

export interface AddResult {
success: boolean;
addedAddons: Addons[];
projectDir: string;
error?: string;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check if file exists and view the relevant section
cd /tmp/repo && find . -name "add-handler.ts" -type f

Repository: AmanVarshney01/create-better-t-stack

Length of output: 139


🏁 Script executed:

# Display the file content to verify current state
cat -n apps/cli/src/helpers/core/add-handler.ts | sed -n '20,40p'

Repository: AmanVarshney01/create-better-t-stack

Length of output: 801


🏁 Script executed:

# Search for usages of AddHandlerOptions and AddResult in the codebase
rg "AddHandlerOptions|AddResult" --type ts --type tsx -B 2 -A 2

Repository: AmanVarshney01/create-better-t-stack

Length of output: 107


🏁 Script executed:

# Search for usages of AddHandlerOptions and AddResult
rg "AddHandlerOptions|AddResult" -A 2 -B 2

Repository: AmanVarshney01/create-better-t-stack

Length of output: 2111


🏁 Script executed:

# Check if these interfaces are extended or used in type hierarchies
rg "extends.*AddHandlerOptions|extends.*AddResult|implements.*AddHandlerOptions|implements.*AddResult"

Repository: AmanVarshney01/create-better-t-stack

Length of output: 62


🏁 Script executed:

# Look for imports of these types from this file
rg "from.*add-handler|import.*AddHandlerOptions|import.*AddResult"

Repository: AmanVarshney01/create-better-t-stack

Length of output: 174


Replace interfaces with type aliases.

Project TS rules prefer type over interface. This aligns with the project's documented guidelines for TypeScript files.

♻️ Proposed fix
-export interface AddHandlerOptions {
-  silent?: boolean;
-}
-
-export interface AddResult {
-  success: boolean;
-  addedAddons: Addons[];
-  projectDir: string;
-  error?: string;
-}
+export type AddHandlerOptions = {
+  silent?: boolean;
+};
+
+export type AddResult = {
+  success: boolean;
+  addedAddons: Addons[];
+  projectDir: string;
+  error?: string;
+};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export interface AddHandlerOptions {
silent?: boolean;
}
export interface AddResult {
success: boolean;
addedAddons: Addons[];
projectDir: string;
error?: string;
}
export type AddHandlerOptions = {
silent?: boolean;
};
export type AddResult = {
success: boolean;
addedAddons: Addons[];
projectDir: string;
error?: string;
};

Comment thread apps/cli/src/index.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/template-generator/src/utils/reproducible-command.ts (1)

3-3: Drop the explicit return type to match TS style rules.

♻️ Proposed fix
-export function generateReproducibleCommand(config: ProjectConfig): string {
+export function generateReproducibleCommand(config: ProjectConfig) {

As per coding guidelines: **/*.{ts,tsx}: Do not use explicit return types.

apps/cli/src/helpers/addons/skills-setup.ts (2)

126-163: Remove explicit return type annotations in TS functions.

The file specifies explicit return types on multiple functions; the guidelines ask to omit these and rely on inference.
As per coding guidelines: Do not use explicit return types.

♻️ Proposed change
-function parseSkillsFromOutput(output: string): string[] {
+function parseSkillsFromOutput(output: string) {
@@
-async function fetchSkillsFromSource(
+async function fetchSkillsFromSource(
   source: SkillSource,
   packageManager: ProjectConfig["packageManager"],
   projectDir: string,
-): Promise<string[]> {
+) {
@@
-export async function setupSkills(
-  config: ProjectConfig,
-): Promise<Result<void, AddonSetupError | UserCancelledError>> {
+export async function setupSkills(config: ProjectConfig) {

198-203: Avoid arrow callbacks; extract named functions instead.

The guidelines prefer standard function declarations over arrow functions. Consider extracting named helpers for map callbacks here (and similarly for other inline arrows in this file).
As per coding guidelines: Define functions using the standard function declaration syntax, not arrow functions.

♻️ Example refactor
+function toSkillOption(skill: FetchedSkill) {
+  return {
+    value: `${skill.source}::${skill.name}`,
+    label: skill.name,
+    hint: skill.sourceLabel,
+  };
+}
+
-  const skillOptions = allSkills.map((skill) => ({
-    value: `${skill.source}::${skill.name}`,
-    label: skill.name,
-    hint: skill.sourceLabel,
-  }));
+  const skillOptions = allSkills.map(toSkillOption);

Also applies to: 250-256

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/cli/src/helpers/addons/skills-setup.ts (1)

174-183: Static analysis false positive - consider adding a suppression comment.

The regex \x1b\[[0-9;]*m is intentional for stripping ANSI escape codes from CLI output. The static analysis tool flags it as "unexpected control character," but this is the correct pattern for ANSI sequence removal.

Consider adding a suppression comment for clarity:

♻️ Suggested change
   for (const line of lines) {
     // Strip ANSI codes first
+    // biome-ignore lint/suspicious/noControlCharactersInRegex: Intentional ANSI escape sequence stripping
     const cleanLine = line.replace(/\x1b\[[0-9;]*m/g, "");

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (6)
AGENTS.md (1)

29-31: Consider varying sentence structure for readability.

Three consecutive bullet points start with "Use". A minor rewording could improve flow.

📝 Suggested rewording
 - **Runtime:** This is a **Bun** project.
-  - Use `Bun.file` over `node:fs`.
-  - Use `Bun.serve` over `express`.
-  - Use `Bun.env` or just `process.env` (auto-loaded).
+  - Prefer `Bun.file` over `node:fs`.
+  - Prefer `Bun.serve` over `express`.
+  - Environment variables: use `Bun.env` or `process.env` (auto-loaded).
apps/cli/src/utils/bts-config.ts (1)

31-54: Silent failure in updateBtsConfig may mask issues.

The empty catch block silently swallows all errors, including legitimate issues like malformed JSONC content or disk write failures. Consider at least logging a debug message or returning a boolean to indicate success/failure.

Proposed improvement
   } catch {
-    // Silent failure
+    // Config update is non-critical; log for debugging if needed
+    // Consider: return false; or log.debug("Failed to update BTS config")
   }
 }
apps/cli/src/helpers/addons/skills-setup.ts (2)

290-298: Potential runtime error if skill key doesn't contain the :: delimiter.

The split assumes the format source::skillName, but if a malformed key is present, skillName will be undefined. Consider adding defensive handling.

Proposed fix
   for (const skillKey of selectedSkills) {
     const [source, skillName] = (skillKey as string).split("::");
+    if (!source || !skillName) continue;
     if (!skillsBySource[source]) {
       skillsBySource[source] = [];
     }
     skillsBySource[source].push(skillName);
   }

303-319: Consider escaping or validating skill/agent names before building command arguments.

If skill or agent names contain special shell characters, the current string interpolation approach could cause command injection or parsing issues. The values come from controlled sources (SKILL_SOURCES and AVAILABLE_AGENTS), so this is low risk, but worth noting for future maintenance.

apps/cli/src/index.ts (1)

56-93: Remove explicit return type annotations from new helpers/add API.

Let TS infer these return types.

♻️ Proposed fix
-function formatStackSummary(entry: ProjectHistoryEntry): string {
+function formatStackSummary(entry: ProjectHistoryEntry) {
   const parts: string[] = [];
   ...
 }

-function formatDate(isoString: string): string {
+function formatDate(isoString: string) {
   const date = new Date(isoString);
   ...
 }

-async function historyHandler(input: {
+async function historyHandler(input: {
   limit: number;
   clear: boolean;
   json: boolean;
-}): Promise<void> {
+}) {
   ...
 }

-export async function add(
+export async function add(
   options: {
     addons?: Addons[];
     install?: boolean;
     packageManager?: PackageManager;
     projectDir?: string;
   } = {},
-): Promise<AddResult | undefined> {
+ ) {
   return addHandler(options, { silent: true });
 }

As per coding guidelines, Do not use explicit return types.

Also applies to: 477-485

apps/cli/src/helpers/core/add-handler.ts (1)

191-198: Prefer Bun.file for reading package.json and remove fs-extra dependency.

Align with Bun-first guidelines by replacing fs-extra methods with Bun.file().exists() and Bun.file().text(). Since fs-extra is only used in this section, it can be removed entirely from the imports.

♻️ Proposed fix
   const packageJsonPaths = ["package.json", "apps/web/package.json"];
   for (const pkgPath of packageJsonPaths) {
     const fullPath = path.join(projectDir, pkgPath);
-    if (await fs.pathExists(fullPath)) {
-      const content = await fs.readFile(fullPath, "utf-8");
+    const file = Bun.file(fullPath);
+    if (await file.exists()) {
+      const content = await file.text();
       vfs.writeFile(pkgPath, content);
     }
   }

Remove the fs-extra import from line 10.

This branch was successfully deployed

1 active deployment
Preview — a77cbcab Deployed Jan 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Changes to the CLI tool enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant