Sign In

@intent-driven/importer-controllers

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intent-driven/importer-controllers

AST-парсер controllers (Express, Fastify, Nest, Rails) → IDF intent suggestions

latest
Source
npmnpm
Version
0.6.0
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

@intent-driven/importer-controllers

AST-парсер controllers (Express, Fastify, Nest, Rails — постепенно) → suggested IDF intents.

Текущая поддержка

FrameworkСтатус
Express✅ v0.1
Fastify✅ v0.2 — все 4 patterns: app.<method>(path, handler), 3-arg form (path, opts, handler), declarative app.route({...}), array app.route([{...}])
NestJSвынесено в @intent-driven/importer-nestjs-typeorm (декораторы Nest + TypeORM в одном пакете)
Railsпланируется (PR 4d, opt-in deps)

Fastify-specific patterns

// Все четыре формы понимаются:

fastify.get('/api/orders', listOrders);

fastify.get('/api/orders', { schema: orderSchema }, listOrders);   // 3-arg

fastify.route({                                                     // declarative
  method: 'POST',
  url: '/api/orders',
  preHandler: [authenticated, validateBody],
  handler: createOrder,
});

fastify.route([                                                     // array
  { method: 'GET', url: '/api/products', handler: list },
  { method: 'POST', url: '/api/products', handler: create },
]);

method: ['GET', 'POST'] (Fastify multi-method) — берётся первый. url или path — оба ключа допустимы.

Использование

import { importControllers } from "@intent-driven/importer-controllers";

const { intents, routes, files } = await importControllers("./src/routes");
console.log(intents);
// [
//   {
//     name: "create_order",
//     target: "Order",
//     alpha: "insert",
//     method: "POST",
//     httpPath: "/api/orders",
//     handlerNames: ["validateBody", "createOrderHandler"],
//     sources: [{ file: "./src/routes/orders.js", line: 42 }]
//   },
//   ...
// ]

Naming heuristics

POST   /api/orders            → create_order   (alpha=insert)
GET    /api/orders            → list_orders    (alpha=null, read-only)
GET    /api/orders/:id        → read_order     (alpha=null)
PUT    /api/orders/:id        → update_order   (alpha=replace)
PATCH  /api/orders/:id        → patch_order    (alpha=replace)
DELETE /api/orders/:id        → delete_order   (alpha=remove)
POST   /api/orders/:id/cancel → cancel_order   (alpha=replace, action-segment)

Распознаваемые actions: cancel, approve, reject, publish, archive, unarchive, submit, complete, restore, lock, unlock.

Limitations (PR 4a)

  • Только Express-style app.get|post|put|delete|patch|head|options|all(path, handlers)
  • Только app / router / api / server whitelist — myCustomThing.get(...) пропускается
  • Path должен быть string-literal — динамические path игнорируются
  • Без TypeScript decorators (Nest) и без routes.rb (Rails)

Roadmap

  • 4b — Fastify (server.get({ url, handler }))
  • 4d — Rails (Rails.application.routes.draw через ruby parser)
  • 4e — CLI integration: idf import controllers <dir> в @intent-driven/cli
  • 4f — LLM enrichment: synergy с enricher-claude для уточнения intent.alpha и invariants

License

MIT.

Keywords

intent-driven

FAQs

Package last updated on 10 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts