Skip to content

feat(core,cli): lifecycle hooks, @Controller decorator, and agent-skills installer with auto-upgrade#52

Open
hemantj-cloud wants to merge 13 commits into
mainfrom
feat/nestjs-lifecycles-controller-skills
Open

feat(core,cli): lifecycle hooks, @Controller decorator, and agent-skills installer with auto-upgrade#52
hemantj-cloud wants to merge 13 commits into
mainfrom
feat/nestjs-lifecycles-controller-skills

Conversation

@hemantj-cloud

@hemantj-cloud hemantj-cloud commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR lands three coordinated features across the core and cli packages: NestJS-style lifecycle hooks, an @Controller decorator with tool-name prefixing, and a full agent-skills installer (with automatic upgrades) supporting 13 AI coding agents across project/global scopes. It also refines the Streamable HTTP transport UI and trims an unused dependency.

Type of Change

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation update
  • refactor: Internal code change
  • test: Test-only changes
  • chore: Build, CI, or tooling changes

Related Issues

Changes Made

Core Package (packages/core)

  • Lifecycle hooks in core/lifecycle.ts, core/server.ts, and core/index.ts:
    • Implements NestJS-style lifecycle hooks (OnModuleInit, OnApplicationBootstrap, OnModuleDestroy, BeforeApplicationShutdown, OnApplicationShutdown).
    • Eagerly instantiates all registered providers and controllers (instantiateAll).
    • Supports idempotent shutdown hook listeners (enableShutdownHooks) and guarantees clean, ordered teardown.
    • Publicly exports triggerLifecycleHook and the lifecycle hook types from core/index.ts.
  • Controller & Tool prefixing in core/decorators.ts, core/builders.ts, and core/di/container.ts:
    • Adds @Controller(prefix | { prefix }) to auto-register classes and support namespaces (tool prefixing) without mutating shared metadata.
    • Exports ControllerDecorator, getControllerPrefix, getInitialToolMetadata, and the ControllerOptions type from core/index.ts.
  • Decorator Metadata Isolation in core/decorators.ts, core/di/injectable.decorator.ts, core/events/event.decorator.ts, and core/pipes/pipe.decorator.ts:
    • Clones metadata structures on class/property/parameter decorator applications to prevent metadata leaking/pollution between parent and sub-classes.
  • UI & UX Refinement in core/transports/streamable-http.ts:
    • Cleans up unnecessary cursor: pointer attributes, redundant focus classes, and unused hover styles from HTML/CSS mockups.
  • Dependency cleanup:
    • Removes the unused better-sqlite3 / @types/better-sqlite3 dependency and its NOTICE attribution from core, cli, and widgets packages.
  • Tests:
    • Adds unit test coverage for lifecycle sequence, DI eager instantiation, decorator inheritance isolation, and @Controller tool prefixing in src/core/__tests__/server.test.ts, src/core/__tests__/server.extended.test.ts, src/core/__tests__/di.test.ts, and src/core/decorators/__tests__/decorators.test.ts.

CLI Package (packages/cli)

  • Agent Detection & Skills Installation Flow in src/skills/...:
    • Implements an automated workflow to shallow-clone the skills repository, discover skills, detect 13 supported AI coding agents, and install/overwrite skills to local projects or global paths.
    • Adds a createAgentDescriptor factory/helper to reduce boilerplate and structure command/directory presence detection.
    • Expands agent coverage to 13 total agents: Cursor, Codex, Claude Code, Gemini CLI, Antigravity, Windsurf, Continue.dev, VS Code Agent Mode, Zed, GitHub Copilot, Goose, Aider, OpenHands.
    • Configures the CLI multi-select menu choices for detected agents to be unchecked by default.
    • init now installs agent skills unconditionally (no more yes/no prompt) via runSkillsFlow; adds a --force flag to overwrite existing skill files.
  • Automated skill upgrades in src/commands/upgrade.ts:
    • Tracks the installed skills version in a new nitrostack.skillsVersion field in the project's package.json.
    • On upgrade, clones the skills repo, compares versions, and reinstalls skills when a newer version is available (supports --dry-run).
  • TTY Interface & Command Prompts in src/commands/init.ts and src/index.ts:
    • Adds support for horizontal choices (promptYesNoHorizontal) and vertical scope prompts.
    • Refactors the init flow to remove a redundant dependency installation prompt.
    • Renames the OAuth starter template's display label from "OAuth" to "Flight booking" in the template picker.
  • Tests:
    • Implements unit tests for cloning, skills discovery, agent detection, and installation logic in src/__tests__/skills.test.ts.
    • Adds src/__tests__/upgrade.test.ts covering skill-upgrade version comparison and install logic.

Testing

  • npm run lint
  • npm test
  • Manual testing performed (if applicable)

Jest suites cover the lifecycle runner, @Controller, DI eager instantiation, the CLI skills flow, and the new skills-upgrade logic.

Checklist

  • I have read and followed CONTRIBUTING.md
  • I have added/updated tests where appropriate
  • I have updated docs where appropriate
  • I have kept this PR focused and scoped
  • I have used conventional commits

@hemantj-cloud hemantj-cloud changed the title Feat/nestjs lifecycles controller skills feat(core,cli): lifecycle hooks, @Controller decorator with tool prefixing, and agent-skills installer Jul 11, 2026
@hemantj-cloud hemantj-cloud changed the title feat(core,cli): lifecycle hooks, @Controller decorator with tool prefixing, and agent-skills installer feat(core,cli): lifecycle hooks, @Controller decorator, and agent-skills installer Jul 13, 2026
@hemantj-cloud hemantj-cloud marked this pull request as ready for review July 13, 2026 07:38
@hemantj-cloud hemantj-cloud force-pushed the feat/nestjs-lifecycles-controller-skills branch from e022fdb to bfdd33e Compare July 13, 2026 14:58
@hemantj-cloud hemantj-cloud changed the title feat(core,cli): lifecycle hooks, @Controller decorator, and agent-skills installer feat(core,cli): lifecycle hooks, @Controller decorator, and agent-skills installer with auto-upgrade Jul 13, 2026
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