feat: Add api example in new abi module creation#787
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Free Tier Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| @@ -1,3 +1,4 @@ | |||
| from fastapi import FastAPI | |||
There was a problem hiding this comment.
Unconditional Import for Optional API Hook
Low Severity
from fastapi import FastAPI is an unconditional top-level import in the template, while every other optional import (ObjectStorageService, Secret, TripleStoreService, VectorStoreService) is commented out. The api method it supports is explicitly documented as optional, yet the import it depends on is always active. This breaks the template's established convention: optional capabilities are shown as commented examples that developers uncomment when needed. As a result, every generated module carries a live fastapi import regardless of whether the author ever uses the API hook.


Summary
Why
Notes
Note
Low Risk
Low risk: only updates the module scaffold template used by
naas-abi-cli, adding an optional no-op method and import with no runtime behavior changes unless newly generated modules override it.Overview
New modules generated from the
naas-abi-clitemplate are now API-ready by default: the scaffold importsFastAPIand includes an optionalABIModule.api(self, app: FastAPI)hook.The new
apimethod is a no-op with inline examples showing how to attach engine services toapp.stateand how to mount module routes/app factories when a module chooses to expose HTTP endpoints.Written by Cursor Bugbot for commit 735931e. This will update automatically on new commits. Configure here.