glyria generate
Usage
npm run generate
# or
npx glyria generate
What it does
glyria generate scans your project and regenerates .glyria/imports.d.ts — the TypeScript declaration file that makes auto-imports work in your IDE.
It runs automatically on glyria init and glyria dev. You only need to run it manually in production after adding new utilities.
What gets scanned
Framework globals
All glyria.js utilities are declared globally automatically:
GlyriaClient, GlyriaCommand, GlyriaUserCommand, GlyriaMessageCommand,
GlyriaEvent, EmbedV2Builder, GlyriaBus, globalBus,
createReplyableContext, useCommands, defineGlyriaConfig, logger,
hexToNumber, Events
discord.js globals
The entire discord.js library is available globally under the djs namespace:
djs.PermissionsBitField.Flags.BanMembers
djs.GatewayIntentBits.Guilds
djs.ButtonStyle.Primary
// ... everything discord.js exports
User globals
glyria generate scans the following folders and files for exported functions, classes, and constants:
| Source | Description |
|---|---|
src/utils/** | Utility functions |
src/composables/** | Composables |
src/index.ts | Root exports |
By default src/utils/ and src/composables/ are scanned. You can customize this in glyria.config.ts:
export default defineGlyriaConfig({
dev: {
autoImportDirs: ['utils', 'composables', 'helpers', 'lib']
}
})
Any export const, export function, or export class found in these files is added to the global scope automatically.
// src/utils/useDatabase.ts
export const useDatabase = () => { ... }
export const formatDate = (date: Date) => { ... }
After running glyria generate:
// src/commands/ping.ts — no import needed
const db = useDatabase()
const date = formatDate(new Date())
Output
The generated .glyria/imports.d.ts looks like this:
// auto-généré par glyria — ne pas modifier
export {}
declare global {
const djs: typeof import("discord.js")
const GlyriaClient: typeof import("@glyria/bot")["GlyriaClient"]
const GlyriaCommand: typeof import("@glyria/bot")["GlyriaCommand"]
const useDatabase: typeof import("../src/utils/useDatabase.ts")["useDatabase"]
// ...
}
glyria generate runs. Any manual changes will be lost.When to run manually
Run glyria generate when:
- You add a new file to
src/utils/orsrc/composables/in production - Your IDE doesn't recognize a global that should be available
- After a glyria.js update that adds new globals
In dev mode, glyria dev handles this automatically — types are regenerated whenever a file in your auto-import folders changes.

