Skip to content

feat(nx-plugin): add git initialization to workspace generator with fallback for missing git#304

Merged
frontegg-david merged 2 commits intorelease/1.0.xfrom
improvements
Mar 23, 2026
Merged

feat(nx-plugin): add git initialization to workspace generator with fallback for missing git#304
frontegg-david merged 2 commits intorelease/1.0.xfrom
improvements

Conversation

@frontegg-david
Copy link
Contributor

@frontegg-david frontegg-david commented Mar 23, 2026

Summary by CodeRabbit

  • Documentation

    • Clarified CLI docs (doctor --fix, create initializes git), quickstart, and deployment notes; updated decorator docs with stronger type-safety guidance.
  • New Features

    • Scaffolded projects now attempt git init + initial commit (silently skipped if unavailable).
    • Docker Compose templates include selective-rebuild instructions, configurable ports/env, Redis persistence and tighter healthchecks.
  • Tests

    • Added tests covering git initialization, scaffolded E2E template contents, and compose-file behaviors.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6750da07-ed63-4702-a0a4-15ee492b38cb

📥 Commits

Reviewing files that changed from the base of the PR and between 847deba and ca3df2a.

📒 Files selected for processing (4)
  • docs/frontmcp/sdk-reference/decorators/prompt.mdx
  • docs/frontmcp/sdk-reference/decorators/resource.mdx
  • docs/frontmcp/sdk-reference/decorators/tool.mdx
  • libs/cli/src/commands/scaffold/create.ts
✅ Files skipped from review due to trivial changes (2)
  • docs/frontmcp/sdk-reference/decorators/resource.mdx
  • docs/frontmcp/sdk-reference/decorators/tool.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/cli/src/commands/scaffold/create.ts

📝 Walkthrough

Walkthrough

Adds automatic git initialization to scaffolding (CLI and NX generator), refines Docker Compose templates with selective rebuild notes and Redis persistence, updates scaffolded E2E test and file I/O usage, and documents TypeScript-typed SDK decorators with compile-time type-safety notes.

Changes

Cohort / File(s) Summary
Docs — Deployment & CLI
docs/frontmcp/deployment/local-dev-server.mdx, docs/frontmcp/getting-started/cli-reference.mdx, docs/frontmcp/getting-started/quickstart.mdx, docs/frontmcp/nx-plugin/generators/workspace.mdx
Added Docker selective-rebuild instruction; documented doctor --fix; documented create scaffolding initializes git (skipped silently if git missing); clarified skipGit behavior.
Docs — SDK Decorators
docs/frontmcp/sdk-reference/decorators/agent.mdx, docs/frontmcp/sdk-reference/decorators/job.mdx, docs/frontmcp/sdk-reference/decorators/prompt.mdx, docs/frontmcp/sdk-reference/decorators/resource.mdx, docs/frontmcp/sdk-reference/decorators/tool.mdx
Updated documented TypeScript signatures to use TypedClassDecorator, tightened generic constraints (e.g., ZodRawShape, OutputSchema), and added "Type Safety" sections describing compile-time schema/context checks.
CLI Scaffolding Implementation
libs/cli/src/commands/scaffold/create.ts, libs/cli/src/commands/scaffold/__tests__/create.spec.ts
Switched to @frontmcp/utils writeFile helper; added E2E test that asserts resources.list(); added docker-compose selective rebuild comments; implemented git init/add/commit with silent failure handling; tests mock execSync and validate git/dockerdoc behaviors.
NX Plugin — Workspace Generator
libs/nx-plugin/src/generators/workspace/workspace.ts, libs/nx-plugin/src/generators/workspace/workspace.spec.ts
Generator now conditionally runs git init/add/commit (after install or when install skipped), gated by skipGit and wrapped in try/catch to ignore failures; tests added to assert git behavior and error-silent skipping.
Docker Compose Template
libs/nx-plugin/src/generators/server/files/node/docker-compose.yml__tmpl__
Removed explicit compose version, made PORT and NODE_ENV configurable via env vars, added Redis named volume and AOF persistence, tightened Redis healthcheck interval, and appended selective-rebuild comments.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as Scaffold CLI
    participant FS as File System (write templates)
    participant Installer as installPackagesTask
    participant Git as system git (execSync)

    CLI->>FS: create project files (README, docker-compose, e2e test)
    alt skipInstall == false
        CLI->>Installer: install packages
        Installer-->>CLI: install done
    else skipInstall == true
        Note over CLI,Installer: skip installations
    end
    CLI->>Git: run `git init` (if !skipGit)
    CLI->>Git: run `git add -A`
    CLI->>Git: run `git commit -m "Initial commit"`
    Git-->>CLI: success or throws (caught, silently skipped)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped through files and wrote a line,
Git's first commit now makes the project shine,
Docker hums and Redis keeps each byte,
Typed decorators guard the compile-time light,
Hooray — a scaffolded garden, snug and fine!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 65.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 title accurately describes the main change: adding git initialization to the workspace generator with a fallback for when git is missing.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improvements

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
docs/frontmcp/sdk-reference/decorators/resource.mdx (1)

34-39: Consider using a section header for consistency.

Similar to the @Prompt documentation, this uses inline paragraphs for type safety information instead of a ## Type Safety section header like @Tool, @Job, and @Agent use. Consider aligning the format for consistency across decorator documentation.

📝 Suggested formatting
 function Resource(opts: ResourceMetadata): TypedClassDecorator

-The @Resource decorator validates at compile time that the decorated class extends ResourceContext. Using it on a plain class produces a descriptive compile error.

-The same applies to @ResourceTemplate.
+## Type Safety
+
+The @Resource decorator validates at compile time that the decorated class extends ResourceContext. Using it on a plain class produces a descriptive compile error.
+
+The same applies to @ResourceTemplate.

Configuration Options

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/frontmcp/sdk-reference/decorators/resource.mdx around lines 34 - 39,
Add a "## Type Safety" section header above the paragraphs describing
type-checking for the decorators and move the two sentences about compile-time
validation under that header; specifically update the documentation around the
Resource declaration (function Resource(opts: ResourceMetadata):
TypedClassDecorator) so the lines about "@resource" and "@ResourceTemplate"
validation are grouped under a new "## Type Safety" header for consistency with
other decorator docs.


</details>

</blockquote></details>
<details>
<summary>docs/frontmcp/sdk-reference/decorators/prompt.mdx (1)</summary><blockquote>

`43-47`: **Consider using a section header for consistency.**

Other decorator docs (`@Job`, `@Tool`, `@Agent`) use a `## Type Safety` section header, but here the type safety information is an inline paragraph. For consistency across the SDK reference documentation, consider converting this to a proper section.



<details>
<summary>📝 Suggested formatting</summary>

```diff
 function Prompt(opts: PromptMetadata): TypedClassDecorator

-The @Prompt decorator validates at compile time that the decorated class extends PromptContext. Using it on a plain class produces a descriptive compile error.
+## Type Safety
+
+The @Prompt decorator validates at compile time that the decorated class extends PromptContext. Using it on a plain class produces a descriptive compile error.

Configuration Options

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/frontmcp/sdk-reference/decorators/prompt.mdx around lines 43 - 47, Add
a "## Type Safety" section header above the existing sentence about compile-time
validation for the @Prompt decorator so it matches the other decorator docs
(@Job, @Tool, @Agent); update the block immediately after the function signature
function Prompt(opts: PromptMetadata): TypedClassDecorator to replace the
inline paragraph about PromptContext with a titled "## Type Safety" paragraph
that states "The @Prompt decorator validates at compile time that the
decorated class extends PromptContext. Using it on a plain class produces a
descriptive compile error."


</details>

</blockquote></details>
<details>
<summary>libs/cli/src/commands/scaffold/create.ts (1)</summary><blockquote>

`3-3`: **Consider using `@frontmcp/utils` for file operations.**

The direct import from `fs` conflicts with the coding guideline requiring `@frontmcp/utils` for file system operations. Line 5 already imports utilities like `stat` from `@frontmcp/utils`.

The `fsp.writeFile` on line 133 and `fsp.stat` on line 1523 could potentially use the utilities already imported.



<details>
<summary>Suggested refactor</summary>

```diff
-import { promises as fsp } from 'fs';

Then update usages:

  • Line 133: Check if @frontmcp/utils provides a writeFile that accepts the same signature, or use the already-imported utilities
  • Line 1523: The stat function is already imported from @frontmcp/utils on line 5

As per coding guidelines: "Use @frontmcp/utils for all file system operations. Do NOT use fs/promises or node:fs directly."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@libs/cli/src/commands/scaffold/create.ts` at line 3, Replace direct use of fs
promises with the project's file utilities: remove the "import { promises as fsp
} from 'fs'" and switch calls that use fsp.writeFile to the writeFile helper
from `@frontmcp/utils` (or the equivalent already-exported utility), and ensure
any fsp.stat calls are replaced by the already-imported stat function; update
all references of fsp.writeFile and fsp.stat in this file (e.g., in create.ts)
to call the `@frontmcp/utils` writeFile/stat helpers so the file I/O follows the
coding guideline.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/frontmcp/sdk-reference/decorators/tool.mdx`:
- Around line 46-51: The code example for class BadTool uses the invalid
TypeScript token "..." inside the async execute method; replace the "..." with a
valid placeholder (e.g., a single-line comment or a minimal valid statement) and
ensure the method signature on BadTool.execute matches the inputSchema type
shown in the `@Tool` decorator; update the execute method body in the BadTool
class (method name: execute, decorator: `@Tool`) to a syntactically valid
placeholder implementation that also demonstrates the type mismatch (or corrects
it) so the snippet compiles.

---

Nitpick comments:
In `@docs/frontmcp/sdk-reference/decorators/prompt.mdx`:
- Around line 43-47: Add a "## Type Safety" section header above the existing
sentence about compile-time validation for the `@Prompt` decorator so it matches
the other decorator docs (`@Job`, `@Tool`, `@Agent`); update the block immediately
after the function signature `function Prompt(opts: PromptMetadata):
TypedClassDecorator` to replace the inline paragraph about `PromptContext` with
a titled "## Type Safety" paragraph that states "The `@Prompt` decorator
validates at compile time that the decorated class extends `PromptContext`.
Using it on a plain class produces a descriptive compile error."

In `@docs/frontmcp/sdk-reference/decorators/resource.mdx`:
- Around line 34-39: Add a "## Type Safety" section header above the paragraphs
describing type-checking for the decorators and move the two sentences about
compile-time validation under that header; specifically update the documentation
around the Resource declaration (function Resource(opts: ResourceMetadata):
TypedClassDecorator) so the lines about "@Resource" and "@ResourceTemplate"
validation are grouped under a new "## Type Safety" header for consistency with
other decorator docs.

In `@libs/cli/src/commands/scaffold/create.ts`:
- Line 3: Replace direct use of fs promises with the project's file utilities:
remove the "import { promises as fsp } from 'fs'" and switch calls that use
fsp.writeFile to the writeFile helper from `@frontmcp/utils` (or the equivalent
already-exported utility), and ensure any fsp.stat calls are replaced by the
already-imported stat function; update all references of fsp.writeFile and
fsp.stat in this file (e.g., in create.ts) to call the `@frontmcp/utils`
writeFile/stat helpers so the file I/O follows the coding guideline.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b023836f-3636-4b89-b6c7-a8ba6f2928c5

📥 Commits

Reviewing files that changed from the base of the PR and between 68d8cbf and 847deba.

⛔ Files ignored due to path filters (4)
  • libs/cli/src/commands/build/exec/__tests__/daemon-client.spec.ts is excluded by !**/build/**
  • libs/cli/src/commands/build/exec/__tests__/generate-cli-entry.spec.ts is excluded by !**/build/**
  • libs/cli/src/commands/build/exec/cli-runtime/daemon-client.ts is excluded by !**/build/**
  • libs/cli/src/commands/build/exec/cli-runtime/generate-cli-entry.ts is excluded by !**/build/**
📒 Files selected for processing (14)
  • docs/frontmcp/deployment/local-dev-server.mdx
  • docs/frontmcp/getting-started/cli-reference.mdx
  • docs/frontmcp/getting-started/quickstart.mdx
  • docs/frontmcp/nx-plugin/generators/workspace.mdx
  • docs/frontmcp/sdk-reference/decorators/agent.mdx
  • docs/frontmcp/sdk-reference/decorators/job.mdx
  • docs/frontmcp/sdk-reference/decorators/prompt.mdx
  • docs/frontmcp/sdk-reference/decorators/resource.mdx
  • docs/frontmcp/sdk-reference/decorators/tool.mdx
  • libs/cli/src/commands/scaffold/__tests__/create.spec.ts
  • libs/cli/src/commands/scaffold/create.ts
  • libs/nx-plugin/src/generators/server/files/node/docker-compose.yml__tmpl__
  • libs/nx-plugin/src/generators/workspace/workspace.spec.ts
  • libs/nx-plugin/src/generators/workspace/workspace.ts

@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

Performance Test Results

Status: ✅ All tests passed

Summary

Project Tests Passed Warnings Failed Leaks
✅ demo-e2e-agents 4 4 0 0 0
✅ demo-e2e-cache 11 11 0 0 0
✅ demo-e2e-codecall 4 4 0 0 0
✅ demo-e2e-config 4 4 0 0 0
✅ demo-e2e-direct 3 3 0 0 0
✅ demo-e2e-elicitation 1 1 0 0 0
✅ demo-e2e-errors 4 4 0 0 0
✅ demo-e2e-hooks 3 3 0 0 0
✅ demo-e2e-multiapp 4 4 0 0 0
✅ demo-e2e-notifications 3 3 0 0 0
✅ demo-e2e-openapi 2 2 0 0 0
✅ demo-e2e-providers 4 4 0 0 0
✅ demo-e2e-public 4 4 0 0 0
✅ demo-e2e-redis 14 14 0 0 0
✅ demo-e2e-remember 4 4 0 0 0
✅ demo-e2e-remote 5 5 0 0 0
✅ demo-e2e-serverless 2 2 0 0 0
✅ demo-e2e-skills 15 15 0 0 0
✅ demo-e2e-standalone 2 2 0 0 0
✅ demo-e2e-transport-recreation 3 3 0 0 0
✅ demo-e2e-ui 4 4 0 0 0

Total: 100 tests across 21 projects

📊 View full report in workflow run


Generated at: 2026-03-23T19:23:45.573Z
Commit: 37443656

@frontegg-david frontegg-david merged commit a6eef41 into release/1.0.x Mar 23, 2026
63 checks passed
@frontegg-david frontegg-david deleted the improvements branch March 23, 2026 19:30
github-actions bot pushed a commit that referenced this pull request Mar 23, 2026
…erator with fallback for missing git

Cherry-picked from #304 (merged to release/1.0.x)
Original commit: a6eef41

Co-Authored-By: frontegg-david <69419539+frontegg-david@users.noreply.github.com>
@github-actions
Copy link
Contributor

Cherry-pick Created

A cherry-pick PR to main has been automatically created.

Please review and merge if this change should also be in main.

If the cherry-pick is not needed, close the PR.

frontegg-david added a commit that referenced this pull request Mar 23, 2026
…erator with fallback for missing git (#305)

Cherry-picked from #304 (merged to release/1.0.x)
Original commit: a6eef41

Co-authored-by: agentfront[bot] <agentfront[bot]@users.noreply.github.com>
Co-authored-by: frontegg-david <69419539+frontegg-david@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant