datagrok-tools 6.0.5 → 6.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,17 +29,17 @@ else
29
29
  else
30
30
  BRANCH=$(resolve_branch "${DG_VERSION:-latest}")
31
31
  fi
32
- # Sparse checkout: only fetch dirs needed for package context (js-api, libraries, help, packages)
33
- # plus root files (CLAUDE.md, .claude/, etc.). Much faster than a full clone.
32
+ # Sparse checkout (cone mode) with partial clone: only fetch js-api, libraries, and
33
+ # ApiSamples. Cone mode integrates with --filter=blob:none so the server only sends
34
+ # blobs for the included directories (~3 MB vs 1.67 GB for the full tree).
34
35
  sparse_clone() {
35
36
  local branch="$1"
36
37
  # Use init+fetch instead of clone to handle pre-existing directories (e.g. mount points)
37
38
  git init "$PUBLIC_DIR" \
38
39
  && git -C "$PUBLIC_DIR" remote add origin "$REPO" \
39
- && git -C "$PUBLIC_DIR" sparse-checkout set --no-cone \
40
- '/*' '!connectors/' '!docker/' '!docusaurus/' '!docusaurus-static/' \
41
- '!environments/' '!hooks/' '!misc/' 'python-api/' '!datagrok-celery-task/' \
42
- '/js-api/**' '/libraries/**' '/packages/**' \
40
+ && git -C "$PUBLIC_DIR" config remote.origin.promisor true \
41
+ && git -C "$PUBLIC_DIR" config remote.origin.partialclonefilter blob:none \
42
+ && git -C "$PUBLIC_DIR" sparse-checkout set --cone js-api libraries packages/ApiSamples \
43
43
  && git -C "$PUBLIC_DIR" fetch --depth 1 --filter=blob:none origin "$branch" \
44
44
  && git -C "$PUBLIC_DIR" checkout -B "$branch" FETCH_HEAD
45
45
  }
@@ -333,6 +333,11 @@ function writeProjectFiles(taskKey, args, worktreeRoot, dgPort) {
333
333
  // Resolve Docker socket path
334
334
  const dockerSock = process.platform === 'win32' ? '//var/run/docker.sock' : '/var/run/docker.sock';
335
335
 
336
+ // Resolve entrypoint.sh path — bind-mount from repo so fixes take effect without image rebuild
337
+ const entrypointPath = _path.default.resolve(__dirname, '..', '..', '.devcontainer', 'entrypoint.sh');
338
+ const hasLocalEntrypoint = _fs.default.existsSync(entrypointPath);
339
+ if (!hasLocalEntrypoint) color.warn('Local entrypoint.sh not found — using image built-in.');
340
+
336
341
  // Generate .env — all paths use forward slashes for Docker compatibility
337
342
  const envLines = [`WORKTREE_PATH=${toDockerPath(worktreeRoot)}`, `DG_PORT=${dgPort}`, `TASK_KEY=${taskKey.toLowerCase()}`, `DOCKER_SOCK=${dockerSock}`, `DATAGROK_VERSION=${args.version || 'latest'}`, `DG_VERSION=${args.version || 'latest'}`, `GROK_CONNECT_VERSION=${args['grok-connect-version'] || 'latest'}`, `GROK_SPAWNER_VERSION=${args['grok-spawner-version'] || 'latest'}`, `JKG_VERSION=${args['jkg-version'] || 'latest'}`, `TOOLS_DEV_VERSION=${args['tools-dev-version'] || 'latest'}`, `FOLDER_NAME=${_path.default.basename(worktreeRoot)}`];
338
343
  for (const env of ['ANTHROPIC_API_KEY', 'DG_PUBLIC_BRANCH', 'JIRA_URL', 'JIRA_USERNAME', 'JIRA_TOKEN', 'GITHUB_TOKEN']) if (process.env[env]) envLines.push(`${env}=${process.env[env]}`);
@@ -341,12 +346,21 @@ function writeProjectFiles(taskKey, args, worktreeRoot, dgPort) {
341
346
  // Write host config compose override (mirrors deploy/fat_dev/dg-claude approach)
342
347
  const volumes = [];
343
348
 
344
- // Claude profile (~/.claude + ~/.claude.json)
349
+ // Bind-mount local entrypoint so fixes take effect without rebuilding the image
350
+ if (hasLocalEntrypoint) volumes.push(` - "${toDockerPath(entrypointPath)}:/usr/local/bin/entrypoint.sh"`);
351
+
352
+ // Claude profile: mount only credential/settings files, not the whole directory.
353
+ // Mounting ~/.claude entirely makes subdirs (session-env/, sessions/) unwritable by the
354
+ // container's node user due to host filesystem permission mapping.
345
355
  const claudeHome = findClaudeHome();
346
356
  if (claudeHome) {
347
- volumes.push(` - "${toDockerPath(claudeHome)}:/home/node/.claude"`);
357
+ const claudeFiles = ['.credentials.json', 'settings.json', 'settings.local.json'];
358
+ for (const file of claudeFiles) {
359
+ const filePath = _path.default.join(claudeHome, file);
360
+ if (_fs.default.existsSync(filePath) && _fs.default.statSync(filePath).isFile()) volumes.push(` - "${toDockerPath(filePath)}:/home/node/.claude/${file}:ro"`);
361
+ }
348
362
  const claudeState = _path.default.join(_path.default.dirname(claudeHome), '.claude.json');
349
- if (_fs.default.existsSync(claudeState) && _fs.default.statSync(claudeState).isFile()) volumes.push(` - "${toDockerPath(claudeState)}:/home/node/.claude.json"`);
363
+ if (_fs.default.existsSync(claudeState) && _fs.default.statSync(claudeState).isFile()) volumes.push(` - "${toDockerPath(claudeState)}:/home/node/.claude.json:ro"`);
350
364
  color.info(`Claude profile: ${claudeHome}`);
351
365
  } else color.warn('No Claude profile found. Set CLAUDE_HOME or run "claude" locally to log in.');
352
366
  const overridePath = _path.default.join(projectDir, 'docker-compose.override.yaml');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "6.0.5",
3
+ "version": "6.0.7",
4
4
  "description": "Utility to upload and publish packages to Datagrok",
5
5
  "homepage": "https://github.com/datagrok-ai/public/tree/master/tools#readme",
6
6
  "dependencies": {