mirror of
https://github.com/cocoindex-io/cocoindex-code.git
synced 2026-09-14 16:39:38 +08:00
92d611968e
* feat: unified Docker workspace mount with supervised daemon Reshape the Docker experience around a single bind mount and a single named volume. Global settings live on the host under $HOME/.cocoindex_code/ (visible and editable); index data and the model cache persist in one cocoindex-data volume; daemon runtime state stays on the container's native filesystem. CLI and MCP output now show host-side paths via a bidirectional COCOINDEX_CODE_HOST_PATH_MAPPING translator. A shell wrapper that forwards $PWD (COCOINDEX_CODE_HOST_CWD) lets ccc work from any project subdirectory on the host. The daemon tolerates a missing global_settings.yml (starts in no-settings mode) so ccc init's interactive picker works in Docker on first run. A supervisor restart loop in the entrypoint, driven by a new COCOINDEX_CODE_DAEMON_SUPERVISED contract, makes settings-change auto-restart safe — editing global_settings.yml triggers an in-place daemon respawn without taking the container down. Linux ownership alignment via PUID/PGID, gosu privilege drop, and a coco user baked into the image. Release workflow now publishes to both Docker Hub (cocoindex/cocoindex-code) and GHCR (ghcr.io/cocoindex-io/cocoindex-code). Also: - Merge cocoindex-db and cocoindex-model-cache into a single volume - find_parent_with_marker requires .cocoindex_code/settings.yml, so a workspace-root global-only dir doesn't trigger nested-init warnings - New pytest marker `docker_e2e` gates the Docker-backed E2E suite (excluded from default pytest runs) * fix: mypy on Windows for POSIX-only os.getuid/getgid calls
14 lines
375 B
TypeScript
14 lines
375 B
TypeScript
// Small utility helpers for the sample project.
|
|
|
|
export function clamp(value: number, min: number, max: number): number {
|
|
return Math.min(Math.max(value, min), max);
|
|
}
|
|
|
|
export function chunk<T>(items: T[], size: number): T[][] {
|
|
const chunks: T[][] = [];
|
|
for (let i = 0; i < items.length; i += size) {
|
|
chunks.push(items.slice(i, i + size));
|
|
}
|
|
return chunks;
|
|
}
|