All files / src/core-entities context-snippet.entity.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 0/0
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 3645x 45x 45x                   45x               45x             45x           45x    
import { Entity, Column, Index } from 'typeorm';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { BaseEntity } from './base.entity';
 
/**
 * ContextSnippet is a reusable Eta template snippet for context generation.
 * Use these to quickly include common context blocks in prompts.
 *
 * Access via it.snippets.handle in context templates.
 * Useful for frequently needed context like git status, package info, etc.
 */
@Entity('context_snippets')
export class ContextSnippet extends BaseEntity {
  @ApiProperty({
    description:
      'Unique handle/identifier for this snippet (used in templates)',
    example: 'git-status',
  })
  @Index({ unique: true })
  @Column({ type: 'text' })
  handle: string;
 
  @ApiPropertyOptional({
    description: 'Description of what context this snippet provides',
    example: 'Includes current git branch and recent commits',
  })
  @Column({ type: 'text', nullable: true })
  description: string;
 
  @ApiProperty({
    description: 'Eta template content for this snippet',
  })
  @Column({ type: 'text' })
  template_content: string;
}