<commit_before>import butler from "../../util/butler";

import { Logger } from "../../logger";
import Context from "../../context";

interface IWalkDirOpts {
  logger: Logger;
  ctx: Context;
  destPath: string;
}

/**
 * Uses butler's walk command to find all files (and symlinks) in a directory,
 * recursively.
 */
export default async function walkDir(opts: IWalkDirOpts): Promise<string[]> {
  const { ctx, logger, destPath } = opts;

  const res = await butler.walk({
    ctx,
    logger,
    dir: destPath,
  });
  return res.files;
}<commit_msg>Ignore .itch when walking dir, closes #1401<commit_after>import butler from "../../util/butler";

import { Logger } from "../../logger";
import Context from "../../context";

import { dirname } from "path";
import { reject } from "underscore";

interface IWalkDirOpts {
  logger: Logger;
  ctx: Context;
  destPath: string;
}

/**
 * Uses butler's walk command to find all files (and symlinks) in a directory,
 * recursively.
 */
export default async function walkDir(opts: IWalkDirOpts): Promise<string[]> {
  const { ctx, logger, destPath } = opts;

  const res = await butler.walk({
    ctx,
    logger,
    dir: destPath,
  });

  const files = reject(res.files, f => dirname(f) === ".itch");

  return files;
}
{'fraction_non_alphanumeric': 0.15141955835962145, 'fraction_numerical': 0.0031545741324921135, 'mean_word_length': 3.3910034602076125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4318904', 'n_tokens_mistral': 400, 'n_tokens_neox': 400, 'n_words': 132}