Django ORM

Models of the MCPServer app: the search index of The Smarter Project’s repositories.

RepositoryIndex records, for each repository of SMARTER_PROJECT_REPOSITORIES, the commit that is indexed, and RepositoryFile holds the text of each of its files. The index is built by smarter.apps.mcpserver.indexer.index_repository(), and replaced whenever the repository’s branch moves to a new commit.

Note

Experimental. The MCPServer was designed and coded by Claude Code (Anthropic’s Claude Opus 5.5), with Lawrence McDaniel as co-author. It is experimental, and will be documented.

class smarter.apps.mcpserver.models.RepositoryFile(*args, **kwargs)[source]

Bases: TimestampedModel

One text file of an indexed repository.

Parameters:
  • id (Unknown) – Primary key: ID

  • created_at (Unknown) – Created at

  • updated_at (Unknown) – Updated at

  • path (Unknown) – Path. The file’s path in the repository.

  • kind (Unknown) – Kind

  • title (Unknown) – Title. A document’s first heading.

  • content (Unknown) – Content

  • size (Unknown) – Size. Bytes.

  • line_count (Unknown) – Line count

Relationship fields:

Parameters:

index (Unknown) – Index (related name: files)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

content

TextField

Content

Type:

Type

created_at

DateTimeField

Created at

Timestamp indicating when the model instance was created.

This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.

Type:

Type

get_kind_display(*, field=<django.db.models.CharField: kind>)

Shows the label of the kind. See get_FOO_display() for more information.

id

BigAutoField

Primary key: ID

Type:

Type

index

ForeignKey to RepositoryIndex

Index (related name: files)

Type:

Type

index_id

Internal field, use index instead.

kind

CharField

Kind

Choices:

  • documentation

  • code

Type:

Type

line_count

PositiveIntegerField

Line count

Type:

Type

objects = <django.db.models.Manager object>
path

CharField

Path. The file’s path in the repository.

Type:

Type

size

PositiveIntegerField

Size. Bytes.

Type:

Type

title

CharField

Title. A document’s first heading.

Type:

Type

updated_at

DateTimeField

Updated at

Timestamp indicating when the model instance was last updated.

This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.

Type:

Type

class smarter.apps.mcpserver.models.RepositoryFileKind(*values)[source]

Bases: TextChoices

What a file of a repository is.

CODE = 'code'

Source code and configuration.

DOCUMENTATION = 'documentation'

Prose, e.g. reStructuredText and Markdown.

class smarter.apps.mcpserver.models.RepositoryIndex(*args, **kwargs)[source]

Bases: TimestampedModel

The index of one of The Smarter Project’s repositories.

Parameters:
  • id (Unknown) – Primary key: ID

  • created_at (Unknown) – Created at

  • updated_at (Unknown) – Updated at

  • repository (Unknown) – Repository. The repository’s name, e.g. smarter-cli.

  • commit_sha (Unknown) – Commit sha. The indexed commit.

  • status (Unknown) – Status

  • indexed_at (Unknown) – Indexed at. When the indexed commit was indexed.

  • file_count (Unknown) – File count

  • total_bytes (Unknown) – Total bytes

  • error (Unknown) – Error. Why the last attempt to index the repository failed.

Reverse relationships:

Parameters:

files (Unknown) – All files of this repository index (related name of index)

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

exception NotUpdated

Bases: ObjectNotUpdated, DatabaseError

commit_sha

CharField

Commit sha. The indexed commit.

Type:

Type

created_at

DateTimeField

Created at

Timestamp indicating when the model instance was created.

This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.

Type:

Type

error

TextField

Error. Why the last attempt to index the repository failed.

Type:

Type

file_count

PositiveIntegerField

File count

Type:

Type

files

Reverse ForeignKey from RepositoryFile

All files of this repository index (related name of index)

Type:

Type

get_status_display(*, field=<django.db.models.CharField: status>)

Shows the label of the status. See get_FOO_display() for more information.

id

BigAutoField

Primary key: ID

Type:

Type

indexed_at

DateTimeField

Indexed at. When the indexed commit was indexed.

Type:

Type

property is_ready: bool

Whether the repository has an index to search.

objects = <django.db.models.Manager object>
repository

CharField

Repository. The repository’s name, e.g. smarter-cli.

Type:

Type

status

CharField

Status

Choices:

  • pending

  • ready

  • failed

Type:

Type

total_bytes

PositiveBigIntegerField

Total bytes

Type:

Type

updated_at

DateTimeField

Updated at

Timestamp indicating when the model instance was last updated.

This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.

Type:

Type

class smarter.apps.mcpserver.models.RepositoryIndexStatus(*values)[source]

Bases: TextChoices

The status of a repository’s index.

FAILED = 'failed'

The repository could not be indexed, and has no index.

PENDING = 'pending'

The repository has not been indexed yet.

READY = 'ready'

The repository is indexed.

The last attempt to refresh it may have failed: see error.