Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
export const DEFAULT_REPO_TEXT_MAX_FILES = 60
|
|
export const MIN_REPO_TEXT_MAX_FILES = 1
|
|
export const MAX_REPO_TEXT_MAX_FILES = 200
|
|
|
|
export const DEFAULT_REPO_TEXT_MAX_FILE_BYTES = 20_000
|
|
export const MIN_REPO_TEXT_MAX_FILE_BYTES = 1_000
|
|
export const MAX_REPO_TEXT_MAX_FILE_BYTES = 100_000
|
|
|
|
export interface RepoTextExportOptions {
|
|
maxFiles: number
|
|
maxFileBytes: number
|
|
}
|
|
|
|
type QueryValue = string | number | null | undefined
|
|
|
|
export const clampRepoTextMaxFiles = (value: QueryValue) =>
|
|
clampInteger(value, DEFAULT_REPO_TEXT_MAX_FILES, MIN_REPO_TEXT_MAX_FILES, MAX_REPO_TEXT_MAX_FILES)
|
|
|
|
export const clampRepoTextMaxFileBytes = (value: QueryValue) =>
|
|
clampInteger(
|
|
value,
|
|
DEFAULT_REPO_TEXT_MAX_FILE_BYTES,
|
|
MIN_REPO_TEXT_MAX_FILE_BYTES,
|
|
MAX_REPO_TEXT_MAX_FILE_BYTES
|
|
)
|
|
|
|
export const normalizeRepoTextExportOptions = (input: {
|
|
maxFiles?: QueryValue
|
|
maxFileBytes?: QueryValue
|
|
}): RepoTextExportOptions => ({
|
|
maxFiles: clampRepoTextMaxFiles(input.maxFiles),
|
|
maxFileBytes: clampRepoTextMaxFileBytes(input.maxFileBytes),
|
|
})
|
|
|
|
export const buildRepoTextExportSearchParams = (options: RepoTextExportOptions) => {
|
|
const params = new URLSearchParams()
|
|
|
|
if (options.maxFiles !== DEFAULT_REPO_TEXT_MAX_FILES) {
|
|
params.set('maxFiles', String(options.maxFiles))
|
|
}
|
|
|
|
if (options.maxFileBytes !== DEFAULT_REPO_TEXT_MAX_FILE_BYTES) {
|
|
params.set('maxFileBytes', String(options.maxFileBytes))
|
|
}
|
|
|
|
return params
|
|
}
|
|
|
|
function clampInteger(value: QueryValue, fallback: number, min: number, max: number) {
|
|
const parsed = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : NaN
|
|
|
|
if (!Number.isFinite(parsed)) {
|
|
return fallback
|
|
}
|
|
|
|
return Math.min(max, Math.max(min, Math.floor(parsed)))
|
|
}
|