-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdump.json
38 lines (38 loc) · 58.6 KB
/
dump.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[
{
"path": ".eslintrc.js",
"content": "module.exports = {\n env: {\n browser: true,\n es2021: true,\n },\n extends: ['airbnb-base' , 'prettier'],\n parserOptions: {\n ecmaVersion: 12,\n sourceType: 'module',\n },\n plugins: ['prettier'],\n rules: {\n indent: 'off',\n quotes: ['error', 'single'],\n 'no-var': 'error',\n 'no-console:': 'off',\n },\n};\n"
},
{
"path": ".github/workflows/action.yml",
"content": "# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created\n# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages\nname: Building & Publishing to NPM\non:\n push:\n branches:\n - main\njobs:\n build-and-publish:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v3\n - name: Set up Node.js\n uses: actions/setup-node@v3\n with:\n node-version: 16\n registry-url: https://registry.npmjs.org/\n \n # Caching dependencies\n - name: Cache dependencies\n uses: actions/cache@v3\n with:\n path: ~/.npm\n key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}\n restore-keys: |\n ${{ runner.os }}-node-\n\n - name: Install dependencies\n run: npm ci\n - name: Run changeset version\n run: npx changeset version\n \n - name: Commit version changes\n run: |\n git config user.name \"GitHub Actions\"\n git config user.email \"[email protected]\"\n git add .\n git commit -m \"chore: Bump versions\" || echo \"No changes to commit\"\n git push\n - name: Publish to npm\n run: npm publish\n env:\n NODE_AUTH_TOKEN: ${{ secrets.npm_token }}"
},
{
"path": "index.js",
"content": "#!/usr/bin/env node\n/**\n * source-code-spitter\n * A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\n *\n * @author Mohannad F. Otaibi <https://www.mohannadotaibi.com>\n */\nconst fs = require('fs-extra');\nconst path = require('path');\nconst ignore = require('ignore');\nconst chalk = require('chalk');\n// const { Octokit } = require('@octokit/rest');\n// const open = require('open');\nconst init = require('./utils/init');\nconst cli = require('./utils/cli');\nconst log = require('./utils/log');\nconst DEFAULT_IGNORED_FILES = require('./utils/ignore-config');\n// const clientId = 'f7ec24587e812f6ce928';\nconst { input, flags } = cli;\nconst { clear, debug, include, exclude, json } = flags;\nconst includeExtensions = include ? include.split(',') : null;\nconst excludeExtensions = exclude ? exclude.split(',') : null;\n\n// Function to traverse a directory and return source code files\nconst traverseDirectory = (dir, ig) => {\ntry {\nconst files = fs.readdirSync(dir);\n const sourceCodeFiles = [];\n files.forEach(file => {\n const filePath = path.join(dir, file);\n const stats = fs.statSync(filePath);\n const fileExtension = path.extname(filePath);\n if (stats.isDirectory()) {\n sourceCodeFiles.push(...traverseDirectory(filePath, ig));\n } else if ((!includeExtensions || includeExtensions.includes(fileExtension)) &&\n (!excludeExtensions || !excludeExtensions.includes(fileExtension))) {\n const relativePath = path.relative(process.cwd(), filePath);\n if (!ig.ignores(relativePath)) {\n sourceCodeFiles.push(filePath);\n }\n }\n });\n return sourceCodeFiles;\n} catch (error) {\nconsole.error(`An error occurred while traversing the directory ${dir}:`, error);\nreturn [];\n}\n};\n// Function to parse ignore files like .gitignore and .spitignore\nconst parseIgnoreFiles = () => {\nconst gitignorePath = path.join(process.cwd(), '.gitignore');\nconst spitignorePath = path.join(process.cwd(), '.spitignore');\nconst ig = ignore();\nif (fs.existsSync(gitignorePath)) {\nig.add(fs.readFileSync(gitignorePath, 'utf8'));\n}\nif (fs.existsSync(spitignorePath)) {\nig.add(fs.readFileSync(spitignorePath, 'utf8'));\n}\nig.add(DEFAULT_IGNORED_FILES);\nreturn ig;\n};\n// Todo: Function to create a GitHub Gist\n// const createGist = async (code) => {\n// open(`https://github.com/login/oauth/authorize?client_id=${clientId}&scope=gist`);\n// const octokit = new Octokit({\n// auth: 'YOUR_PERSONAL_ACCESS_TOKEN', // You'll need to handle authentication\n// });\n// const response = await octokit.gists.create({\n// description: 'Extracted code snippet',\n// public: true,\n// files: {\n// 'snippet.txt': {\n// content: code\n// }\n// }\n// });\n// return response.data.html_url;\n// };\n// Function to generate a dump of source code from a directory\nconst generateSourceCodeDump = directory => {\nconst ig = parseIgnoreFiles();\nconst sourceCodeFiles = traverseDirectory(directory, ig);\nconsole.log(chalk.italic(`Found ${sourceCodeFiles.length} source code files.`));\nconst dumpFilePath = path.join(process.cwd(), 'dump');\nconst dumpFileExt = json ? '.json' : '.txt';\nconst dumpFileContent = [];\nsourceCodeFiles.forEach(file => {\nconst relativePath = path.relative(process.cwd(), file).replace(/\\\\/g, '/');\nconst fileContent = fs.readFileSync(file, 'utf8');\ndumpFileContent.push({path: relativePath, content: fileContent});\n});\nif (json) { // Check if JSON flag is set\nconst cleanedOutput = dumpFileContent.map(item => ({\npath: item.path,\ncontent: item.content.replace(/\\r\\n/g, '\\n').replace(/\\t/g, '').replace(/ +/g, ' ').replace(/\\n\\n/g, '\\n')\n }));\n \n fs.writeFileSync(dumpFilePath + dumpFileExt, JSON.stringify(cleanedOutput, null, 2));\n } else {\nconst textOutput = dumpFileContent.map(item => `// ${item.path}\\n${item.content}`).join('\\n\\n');\n fs.writeFileSync(dumpFilePath + dumpFileExt, textOutput);\n }\n// fs.writeFileSync(dumpFilePath + dumpFileExt, dumpFileContent.join('\\n\\n'));\nif (flags.gist) {\n// this function still needs to be implement3ed\nconsole.log('Gist feature is not implemented yet.');\n // createGist(dumpFileContent.join('\\n\\n')).then(gistUrl => {\n // console.log(`Gist created: ${gistUrl}`);\n // }).catch(error => {\n // console.error('Failed to create gist:', error);\n // });\n }\nconsole.log(chalk.greenBright(`Source code dump generated successfully at ${dumpFilePath + dumpFileExt} \\n\\n`));\n};\n// Main async function to initialize and generate the source code dump\n(async () => {\ninit({ clear });\n// eslint-disable-next-line no-unused-expressions\ndebug && log(flags);\nconst directory = input[0];\nconsole.log(`Generating out file for directory: ${directory}`);\nif (!directory) {\nconsole.error('Please provide the directory path as an argument.');\nprocess.exit(1);\n}\ngenerateSourceCodeDump(directory);\n})();\n"
},
{
"path": "package.json",
"content": "{\n\"name\": \"@6degrees/source-code-spitter\",\n\"description\": \"A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\",\n\"version\": \"2.0.3\",\n\"license\": \"MIT\",\n\"bin\": {\n\"source-code-spitter\": \"index.js\",\n\"spitit\": \"index.js\"\n},\n\"author\": {\n\"name\": \"Mohannad F. Otaibi\",\n\"email\": \"[email protected]\",\n\"url\": \"https://www.mohannadotaibi.com\"\n},\n\"repository\": {\n\"type\": \"git\",\n\"url\": \"git+https://github.com/6degrees/SourceCodeSpitter.git\"\n},\n\"publishConfig\": {\n\"access\": \"public\"\n},\n\"homepage\": \"https://github.com/6degrees/SourceCodeSpitter#readme\",\n\"keywords\": [\n\"source-code-spitter\",\n\"Mohannad F. Otaibi\",\n\"source code\",\n\"dump\",\n\"generator\",\n\"command-line\"\n],\n\"files\": [\n\"index.js\",\n\"utils\"\n],\n\"scripts\": {\n\"format\": \"prettier --write \\\"./**/*.{js,json}\\\"\"\n},\n\"dependencies\": {\n\"@changesets/cli\": \"^2.26.2\",\n\"@octokit/rest\": \"^20.0.1\",\n\"chalk\": \"^4.1.2\",\n\"cli-alerts\": \"^1.2.2\",\n\"cli-handle-error\": \"^4.4.0\",\n\"cli-handle-unhandled\": \"^1.1.1\",\n\"cli-meow-help\": \"^3.1.0\",\n\"cli-welcome\": \"^2.2.2\",\n\"fs-extra\": \"^11.1.1\",\n\"ignore\": \"^5.2.4\",\n\"meow\": \"^9.0.0\",\n\"open\": \"^9.1.0\"\n},\n\"devDependencies\": {\n\"eslint\": \"^8.2.0\",\n\"eslint-config-airbnb\": \"^19.0.4\",\n\"eslint-config-prettier\": \"^9.0.0\",\n\"eslint-plugin-import\": \"^2.25.3\",\n\"eslint-plugin-jsx-a11y\": \"^6.5.1\",\n\"eslint-plugin-prettier\": \"^5.0.0\",\n\"eslint-plugin-react\": \"^7.28.0\",\n\"eslint-plugin-react-hooks\": \"^4.3.0\",\n\"prettier\": \"^3.0.1\"\n}\n}\n"
},
{
"path": "source_code_dump.json",
"content": "[\n {\n \"path\": \".eslintrc.js\",\n \"content\": \"module.exports = {\\n env: {\\n browser: true,\\n es2021: true,\\n },\\n extends: ['airbnb-base' , 'prettier'],\\n parserOptions: {\\n ecmaVersion: 12,\\n sourceType: 'module',\\n },\\n plugins: ['prettier'],\\n rules: {\\n indent: 'off',\\n quotes: ['error', 'single'],\\n 'no-var': 'error',\\n 'no-console:': 'off',\\n },\\n};\\n\"\n },\n {\n \"path\": \".github/workflows/action.yml\",\n \"content\": \"# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created\\n# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages\\nname: Building & Publishing to NPM\\non:\\n push:\\n branches:\\n - main\\njobs:\\n build-and-publish:\\n runs-on: ubuntu-latest\\n steps:\\n - name: Checkout code\\n uses: actions/checkout@v3\\n - name: Set up Node.js\\n uses: actions/setup-node@v3\\n with:\\n node-version: 16\\n registry-url: https://registry.npmjs.org/\\n \\n # Caching dependencies\\n - name: Cache dependencies\\n uses: actions/cache@v3\\n with:\\n path: ~/.npm\\n key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}\\n restore-keys: |\\n ${{ runner.os }}-node-\\n\\n - name: Install dependencies\\n run: npm ci\\n - name: Run changeset version\\n run: npx changeset version\\n \\n - name: Commit version changes\\n run: |\\n git config user.name \\\"GitHub Actions\\\"\\n git config user.email \\\"[email protected]\\\"\\n git add .\\n git commit -m \\\"chore: Bump versions\\\" || echo \\\"No changes to commit\\\"\\n git push\\n - name: Publish to npm\\n run: npm publish\\n env:\\n NODE_AUTH_TOKEN: ${{ secrets.npm_token }}\"\n },\n {\n \"path\": \"index.js\",\n \"content\": \"#!/usr/bin/env node\\n/**\\n * source-code-spitter\\n * A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\\n *\\n * @author Mohannad F. Otaibi <https://www.mohannadotaibi.com>\\n */\\nconst fs = require('fs-extra');\\nconst path = require('path');\\nconst ignore = require('ignore');\\nconst chalk = require('chalk');\\n// const { Octokit } = require('@octokit/rest');\\n// const open = require('open');\\nconst init = require('./utils/init');\\nconst cli = require('./utils/cli');\\nconst log = require('./utils/log');\\nconst DEFAULT_IGNORED_FILES = require('./utils/ignore-config');\\n// const clientId = 'f7ec24587e812f6ce928';\\nconst { input, flags } = cli;\\nconst { clear, debug, include, exclude, json } = flags;\\nconst includeExtensions = include ? include.split(',') : null;\\nconst excludeExtensions = exclude ? exclude.split(',') : null;\\n\\n// Function to traverse a directory and return source code files\\nconst traverseDirectory = (dir, ig) => {\\ntry {\\nconst files = fs.readdirSync(dir);\\n const sourceCodeFiles = [];\\n files.forEach(file => {\\n const filePath = path.join(dir, file);\\n const stats = fs.statSync(filePath);\\n const fileExtension = path.extname(filePath);\\n if (stats.isDirectory()) {\\n sourceCodeFiles.push(...traverseDirectory(filePath, ig));\\n } else if ((!includeExtensions || includeExtensions.includes(fileExtension)) &&\\n (!excludeExtensions || !excludeExtensions.includes(fileExtension))) {\\n const relativePath = path.relative(process.cwd(), filePath);\\n if (!ig.ignores(relativePath)) {\\n sourceCodeFiles.push(filePath);\\n }\\n }\\n });\\n return sourceCodeFiles;\\n} catch (error) {\\nconsole.error(`An error occurred while traversing the directory ${dir}:`, error);\\nreturn [];\\n}\\n};\\n// Function to parse ignore files like .gitignore and .spitignore\\nconst parseIgnoreFiles = () => {\\nconst gitignorePath = path.join(process.cwd(), '.gitignore');\\nconst spitignorePath = path.join(process.cwd(), '.spitignore');\\nconst ig = ignore();\\nif (fs.existsSync(gitignorePath)) {\\nig.add(fs.readFileSync(gitignorePath, 'utf8'));\\n}\\nif (fs.existsSync(spitignorePath)) {\\nig.add(fs.readFileSync(spitignorePath, 'utf8'));\\n}\\nig.add(DEFAULT_IGNORED_FILES);\\nreturn ig;\\n};\\n// Todo: Function to create a GitHub Gist\\n// const createGist = async (code) => {\\n// open(`https://github.com/login/oauth/authorize?client_id=${clientId}&scope=gist`);\\n// const octokit = new Octokit({\\n// auth: 'YOUR_PERSONAL_ACCESS_TOKEN', // You'll need to handle authentication\\n// });\\n// const response = await octokit.gists.create({\\n// description: 'Extracted code snippet',\\n// public: true,\\n// files: {\\n// 'snippet.txt': {\\n// content: code\\n// }\\n// }\\n// });\\n// return response.data.html_url;\\n// };\\n// Function to generate a dump of source code from a directory\\nconst generateSourceCodeDump = directory => {\\nconst ig = parseIgnoreFiles();\\nconst sourceCodeFiles = traverseDirectory(directory, ig);\\nconsole.log(chalk.italic(`Found ${sourceCodeFiles.length} source code files.`));\\nconst dumpFilePath = path.join(process.cwd(), 'source_code_dump');\\nconst dumpFileExt = json ? '.json' : '.txt';\\nconst dumpFileContent = [];\\nsourceCodeFiles.forEach(file => {\\nconst relativePath = path.relative(process.cwd(), file).replace(/\\\\\\\\/g, '/');\\nconst fileContent = fs.readFileSync(file, 'utf8');\\ndumpFileContent.push({path: relativePath, content: fileContent});\\n});\\nif (json) { // Check if JSON flag is set\\nconst cleanedOutput = dumpFileContent.map(item => ({\\npath: item.path,\\ncontent: item.content.replace(/\\\\r\\\\n/g, '\\\\n').replace(/\\\\t/g, '').replace(/ +/g, ' ').replace(/\\\\n\\\\n/g, '\\\\n')\\n }));\\n \\n fs.writeFileSync(dumpFilePath + dumpFileExt, JSON.stringify(cleanedOutput, null, 2));\\n } else {\\nconst textOutput = dumpFileContent.map(item => `// ${item.path}\\\\n${item.content}`).join('\\\\n\\\\n');\\n fs.writeFileSync(dumpFilePath + dumpFileExt, textOutput);\\n }\\n// fs.writeFileSync(dumpFilePath + dumpFileExt, dumpFileContent.join('\\\\n\\\\n'));\\nif (flags.gist) {\\n// this function still needs to be implement3ed\\nconsole.log('Gist feature is not implemented yet.');\\n // createGist(dumpFileContent.join('\\\\n\\\\n')).then(gistUrl => {\\n // console.log(`Gist created: ${gistUrl}`);\\n // }).catch(error => {\\n // console.error('Failed to create gist:', error);\\n // });\\n }\\nconsole.log(chalk.greenBright(`Source code dump generated successfully at ${dumpFilePath + dumpFileExt} \\\\n\\\\n`));\\n};\\n// Main async function to initialize and generate the source code dump\\n(async () => {\\ninit({ clear });\\n// eslint-disable-next-line no-unused-expressions\\ndebug && log(flags);\\nconst directory = input[0];\\nconsole.log(`Generating out file for directory: ${directory}`);\\nif (!directory) {\\nconsole.error('Please provide the directory path as an argument.');\\nprocess.exit(1);\\n}\\ngenerateSourceCodeDump(directory);\\n})();\\n\"\n },\n {\n \"path\": \"package.json\",\n \"content\": \"{\\n\\\"name\\\": \\\"@6degrees/source-code-spitter\\\",\\n\\\"description\\\": \\\"A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\\\",\\n\\\"version\\\": \\\"2.0.3\\\",\\n\\\"license\\\": \\\"MIT\\\",\\n\\\"bin\\\": {\\n\\\"source-code-spitter\\\": \\\"index.js\\\",\\n\\\"spitit\\\": \\\"index.js\\\"\\n},\\n\\\"author\\\": {\\n\\\"name\\\": \\\"Mohannad F. Otaibi\\\",\\n\\\"email\\\": \\\"[email protected]\\\",\\n\\\"url\\\": \\\"https://www.mohannadotaibi.com\\\"\\n},\\n\\\"repository\\\": {\\n\\\"type\\\": \\\"git\\\",\\n\\\"url\\\": \\\"git+https://github.com/6degrees/SourceCodeSpitter.git\\\"\\n},\\n\\\"publishConfig\\\": {\\n\\\"access\\\": \\\"public\\\"\\n},\\n\\\"homepage\\\": \\\"https://github.com/6degrees/SourceCodeSpitter#readme\\\",\\n\\\"keywords\\\": [\\n\\\"source-code-spitter\\\",\\n\\\"Mohannad F. Otaibi\\\",\\n\\\"source code\\\",\\n\\\"dump\\\",\\n\\\"generator\\\",\\n\\\"command-line\\\"\\n],\\n\\\"files\\\": [\\n\\\"index.js\\\",\\n\\\"utils\\\"\\n],\\n\\\"scripts\\\": {\\n\\\"format\\\": \\\"prettier --write \\\\\\\"./**/*.{js,json}\\\\\\\"\\\"\\n},\\n\\\"dependencies\\\": {\\n\\\"@changesets/cli\\\": \\\"^2.26.2\\\",\\n\\\"@octokit/rest\\\": \\\"^20.0.1\\\",\\n\\\"chalk\\\": \\\"^4.1.2\\\",\\n\\\"cli-alerts\\\": \\\"^1.2.2\\\",\\n\\\"cli-handle-error\\\": \\\"^4.4.0\\\",\\n\\\"cli-handle-unhandled\\\": \\\"^1.1.1\\\",\\n\\\"cli-meow-help\\\": \\\"^3.1.0\\\",\\n\\\"cli-welcome\\\": \\\"^2.2.2\\\",\\n\\\"fs-extra\\\": \\\"^11.1.1\\\",\\n\\\"ignore\\\": \\\"^5.2.4\\\",\\n\\\"meow\\\": \\\"^9.0.0\\\",\\n\\\"open\\\": \\\"^9.1.0\\\"\\n},\\n\\\"devDependencies\\\": {\\n\\\"eslint\\\": \\\"^8.2.0\\\",\\n\\\"eslint-config-airbnb\\\": \\\"^19.0.4\\\",\\n\\\"eslint-config-prettier\\\": \\\"^9.0.0\\\",\\n\\\"eslint-plugin-import\\\": \\\"^2.25.3\\\",\\n\\\"eslint-plugin-jsx-a11y\\\": \\\"^6.5.1\\\",\\n\\\"eslint-plugin-prettier\\\": \\\"^5.0.0\\\",\\n\\\"eslint-plugin-react\\\": \\\"^7.28.0\\\",\\n\\\"eslint-plugin-react-hooks\\\": \\\"^4.3.0\\\",\\n\\\"prettier\\\": \\\"^3.0.1\\\"\\n}\\n}\\n\"\n },\n {\n \"path\": \"source_code_dump.json\",\n \"content\": \"[\\n {\\n \\\"path\\\": \\\".eslintrc.js\\\",\\n \\\"content\\\": \\\"module.exports = {\\\\n env: {\\\\n browser: true,\\\\n es2021: true,\\\\n },\\\\n extends: ['airbnb-base' , 'prettier'],\\\\n parserOptions: {\\\\n ecmaVersion: 12,\\\\n sourceType: 'module',\\\\n },\\\\n plugins: ['prettier'],\\\\n\\\\n rules: {\\\\n indent: 'off',\\\\n quotes: ['error', 'single'],\\\\n 'no-var': 'error',\\\\n 'no-console:': 'off',\\\\n },\\\\n};\\\\n\\\"\\n },\\n {\\n \\\"path\\\": \\\".github/workflows/action.yml\\\",\\n \\\"content\\\": \\\"# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created\\\\n# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages\\\\n\\\\nname: Building & Publishing to NPM\\\\n\\\\non:\\\\n push:\\\\n branches:\\\\n - main\\\\n\\\\njobs:\\\\n build-and-publish:\\\\n runs-on: ubuntu-latest\\\\n steps:\\\\n - name: Checkout code\\\\n uses: actions/checkout@v3\\\\n\\\\n - name: Set up Node.js\\\\n uses: actions/setup-node@v3\\\\n with:\\\\n node-version: 16\\\\n registry-url: https://registry.npmjs.org/\\\\n \\\\n # Caching dependencies\\\\n - name: Cache dependencies\\\\n uses: actions/cache@v3\\\\n with:\\\\n path: ~/.npm\\\\n key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}\\\\n restore-keys: |\\\\n ${{ runner.os }}-node-\\\\n\\\\n\\\\n - name: Install dependencies\\\\n run: npm ci\\\\n\\\\n - name: Run changeset version\\\\n run: npx changeset version\\\\n \\\\n - name: Commit version changes\\\\n run: |\\\\n git config user.name \\\\\\\"GitHub Actions\\\\\\\"\\\\n git config user.email \\\\\\\"[email protected]\\\\\\\"\\\\n git add .\\\\n git commit -m \\\\\\\"chore: Bump versions\\\\\\\" || echo \\\\\\\"No changes to commit\\\\\\\"\\\\n git push\\\\n\\\\n - name: Publish to npm\\\\n run: npm publish\\\\n env:\\\\n NODE_AUTH_TOKEN: ${{ secrets.npm_token }}\\\"\\n },\\n {\\n \\\"path\\\": \\\"index.js\\\",\\n \\\"content\\\": \\\"#!/usr/bin/env node\\\\n\\\\n/**\\\\n * source-code-spitter\\\\n * A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\\\\n *\\\\n * @author Mohannad F. Otaibi <https://www.mohannadotaibi.com>\\\\n */\\\\nconst fs = require('fs-extra');\\\\nconst path = require('path');\\\\nconst ignore = require('ignore');\\\\nconst chalk = require('chalk');\\\\n// const { Octokit } = require('@octokit/rest');\\\\n\\\\n// const open = require('open');\\\\nconst init = require('./utils/init');\\\\nconst cli = require('./utils/cli');\\\\nconst log = require('./utils/log');\\\\nconst DEFAULT_IGNORED_FILES = require('./utils/ignore-config');\\\\n\\\\n// const clientId = 'f7ec24587e812f6ce928';\\\\n\\\\nconst { input, flags } = cli;\\\\nconst { clear, debug, include, exclude, json } = flags;\\\\n\\\\nconst includeExtensions = include ? include.split(',') : null;\\\\nconst excludeExtensions = exclude ? exclude.split(',') : null;\\\\n\\\\n\\\\n// Function to traverse a directory and return source code files\\\\nconst traverseDirectory = (dir, ig) => {\\\\ntry {\\\\nconst files = fs.readdirSync(dir);\\\\n const sourceCodeFiles = [];\\\\n\\\\n files.forEach(file => {\\\\n const filePath = path.join(dir, file);\\\\n const stats = fs.statSync(filePath);\\\\n const fileExtension = path.extname(filePath);\\\\n\\\\n if (stats.isDirectory()) {\\\\n sourceCodeFiles.push(...traverseDirectory(filePath, ig));\\\\n } else if ((!includeExtensions || includeExtensions.includes(fileExtension)) &&\\\\n (!excludeExtensions || !excludeExtensions.includes(fileExtension))) {\\\\n const relativePath = path.relative(process.cwd(), filePath);\\\\n if (!ig.ignores(relativePath)) {\\\\n sourceCodeFiles.push(filePath);\\\\n }\\\\n }\\\\n });\\\\n\\\\n return sourceCodeFiles;\\\\n\\\\n} catch (error) {\\\\nconsole.error(`An error occurred while traversing the directory ${dir}:`, error);\\\\nreturn [];\\\\n}\\\\n};\\\\n\\\\n// Function to parse ignore files like .gitignore and .spitignore\\\\nconst parseIgnoreFiles = () => {\\\\nconst gitignorePath = path.join(process.cwd(), '.gitignore');\\\\nconst spitignorePath = path.join(process.cwd(), '.spitignore');\\\\nconst ig = ignore();\\\\n\\\\nif (fs.existsSync(gitignorePath)) {\\\\nig.add(fs.readFileSync(gitignorePath, 'utf8'));\\\\n}\\\\n\\\\nif (fs.existsSync(spitignorePath)) {\\\\nig.add(fs.readFileSync(spitignorePath, 'utf8'));\\\\n}\\\\n\\\\nig.add(DEFAULT_IGNORED_FILES);\\\\n\\\\nreturn ig;\\\\n};\\\\n\\\\n// Todo: Function to create a GitHub Gist\\\\n// const createGist = async (code) => {\\\\n// open(`https://github.com/login/oauth/authorize?client_id=${clientId}&scope=gist`);\\\\n\\\\n// const octokit = new Octokit({\\\\n// auth: 'YOUR_PERSONAL_ACCESS_TOKEN', // You'll need to handle authentication\\\\n// });\\\\n\\\\n// const response = await octokit.gists.create({\\\\n// description: 'Extracted code snippet',\\\\n// public: true,\\\\n// files: {\\\\n// 'snippet.txt': {\\\\n// content: code\\\\n// }\\\\n// }\\\\n// });\\\\n\\\\n// return response.data.html_url;\\\\n// };\\\\n\\\\n// Function to generate a dump of source code from a directory\\\\nconst generateSourceCodeDump = directory => {\\\\nconst ig = parseIgnoreFiles();\\\\nconst sourceCodeFiles = traverseDirectory(directory, ig);\\\\n\\\\nconsole.log(chalk.italic(`Found ${sourceCodeFiles.length} source code files.`));\\\\nconst dumpFilePath = path.join(process.cwd(), 'source_code_dump');\\\\nconst dumpFileExt = json ? '.json' : '.txt';\\\\n\\\\nconst dumpFileContent = [];\\\\nsourceCodeFiles.forEach(file => {\\\\nconst relativePath = path.relative(process.cwd(), file).replace(/\\\\\\\\\\\\\\\\/g, '/');\\\\nconst fileContent = fs.readFileSync(file, 'utf8');\\\\ndumpFileContent.push({path: relativePath, content: fileContent});\\\\n});\\\\n\\\\nif (json) { // Check if JSON flag is set\\\\nconst cleanedOutput = dumpFileContent.map(item => ({\\\\npath: item.path,\\\\ncontent: item.content.replace(/\\\\\\\\r\\\\\\\\n/g, '\\\\\\\\n').replace(/\\\\\\\\t/g, '').replace(/ +/g, ' ')\\\\n }));\\\\n \\\\n fs.writeFileSync(dumpFilePath + dumpFileExt, JSON.stringify(cleanedOutput, null, 2));\\\\n } else {\\\\nconst textOutput = dumpFileContent.map(item => `// ${item.path}\\\\\\\\n${item.content}`).join('\\\\\\\\n\\\\\\\\n');\\\\n fs.writeFileSync(dumpFilePath + dumpFileExt, textOutput);\\\\n }\\\\n\\\\n// fs.writeFileSync(dumpFilePath + dumpFileExt, dumpFileContent.join('\\\\\\\\n\\\\\\\\n'));\\\\n\\\\nif (flags.gist) {\\\\n// this function still needs to be implement3ed\\\\nconsole.log('Gist feature is not implemented yet.');\\\\n // createGist(dumpFileContent.join('\\\\\\\\n\\\\\\\\n')).then(gistUrl => {\\\\n // console.log(`Gist created: ${gistUrl}`);\\\\n // }).catch(error => {\\\\n // console.error('Failed to create gist:', error);\\\\n // });\\\\n }\\\\n\\\\nconsole.log(chalk.greenBright(`Source code dump generated successfully at ${dumpFilePath + dumpFileExt} \\\\\\\\n\\\\\\\\n`));\\\\n};\\\\n\\\\n// Main async function to initialize and generate the source code dump\\\\n(async () => {\\\\ninit({ clear });\\\\n\\\\n// eslint-disable-next-line no-unused-expressions\\\\ndebug && log(flags);\\\\n\\\\nconst directory = input[0];\\\\n\\\\nconsole.log(`Generating out file for directory: ${directory}`);\\\\n\\\\nif (!directory) {\\\\nconsole.error('Please provide the directory path as an argument.');\\\\nprocess.exit(1);\\\\n}\\\\n\\\\ngenerateSourceCodeDump(directory);\\\\n})();\\\\n\\\"\\n },\\n {\\n \\\"path\\\": \\\"package.json\\\",\\n \\\"content\\\": \\\"{\\\\n\\\\\\\"name\\\\\\\": \\\\\\\"@6degrees/source-code-spitter\\\\\\\",\\\\n\\\\\\\"description\\\\\\\": \\\\\\\"A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\\\\\\\",\\\\n\\\\\\\"version\\\\\\\": \\\\\\\"2.0.3\\\\\\\",\\\\n\\\\\\\"license\\\\\\\": \\\\\\\"MIT\\\\\\\",\\\\n\\\\\\\"bin\\\\\\\": {\\\\n\\\\\\\"source-code-spitter\\\\\\\": \\\\\\\"index.js\\\\\\\",\\\\n\\\\\\\"spitit\\\\\\\": \\\\\\\"index.js\\\\\\\"\\\\n},\\\\n\\\\\\\"author\\\\\\\": {\\\\n\\\\\\\"name\\\\\\\": \\\\\\\"Mohannad F. Otaibi\\\\\\\",\\\\n\\\\\\\"email\\\\\\\": \\\\\\\"[email protected]\\\\\\\",\\\\n\\\\\\\"url\\\\\\\": \\\\\\\"https://www.mohannadotaibi.com\\\\\\\"\\\\n},\\\\n\\\\\\\"repository\\\\\\\": {\\\\n\\\\\\\"type\\\\\\\": \\\\\\\"git\\\\\\\",\\\\n\\\\\\\"url\\\\\\\": \\\\\\\"git+https://github.com/6degrees/SourceCodeSpitter.git\\\\\\\"\\\\n},\\\\n\\\\\\\"publishConfig\\\\\\\": {\\\\n\\\\\\\"access\\\\\\\": \\\\\\\"public\\\\\\\"\\\\n},\\\\n\\\\\\\"homepage\\\\\\\": \\\\\\\"https://github.com/6degrees/SourceCodeSpitter#readme\\\\\\\",\\\\n\\\\\\\"keywords\\\\\\\": [\\\\n\\\\\\\"source-code-spitter\\\\\\\",\\\\n\\\\\\\"Mohannad F. Otaibi\\\\\\\",\\\\n\\\\\\\"source code\\\\\\\",\\\\n\\\\\\\"dump\\\\\\\",\\\\n\\\\\\\"generator\\\\\\\",\\\\n\\\\\\\"command-line\\\\\\\"\\\\n],\\\\n\\\\\\\"files\\\\\\\": [\\\\n\\\\\\\"index.js\\\\\\\",\\\\n\\\\\\\"utils\\\\\\\"\\\\n],\\\\n\\\\\\\"scripts\\\\\\\": {\\\\n\\\\\\\"format\\\\\\\": \\\\\\\"prettier --write \\\\\\\\\\\\\\\"./**/*.{js,json}\\\\\\\\\\\\\\\"\\\\\\\"\\\\n},\\\\n\\\\\\\"dependencies\\\\\\\": {\\\\n\\\\\\\"@changesets/cli\\\\\\\": \\\\\\\"^2.26.2\\\\\\\",\\\\n\\\\\\\"@octokit/rest\\\\\\\": \\\\\\\"^20.0.1\\\\\\\",\\\\n\\\\\\\"chalk\\\\\\\": \\\\\\\"^4.1.2\\\\\\\",\\\\n\\\\\\\"cli-alerts\\\\\\\": \\\\\\\"^1.2.2\\\\\\\",\\\\n\\\\\\\"cli-handle-error\\\\\\\": \\\\\\\"^4.4.0\\\\\\\",\\\\n\\\\\\\"cli-handle-unhandled\\\\\\\": \\\\\\\"^1.1.1\\\\\\\",\\\\n\\\\\\\"cli-meow-help\\\\\\\": \\\\\\\"^3.1.0\\\\\\\",\\\\n\\\\\\\"cli-welcome\\\\\\\": \\\\\\\"^2.2.2\\\\\\\",\\\\n\\\\\\\"fs-extra\\\\\\\": \\\\\\\"^11.1.1\\\\\\\",\\\\n\\\\\\\"ignore\\\\\\\": \\\\\\\"^5.2.4\\\\\\\",\\\\n\\\\\\\"meow\\\\\\\": \\\\\\\"^9.0.0\\\\\\\",\\\\n\\\\\\\"open\\\\\\\": \\\\\\\"^9.1.0\\\\\\\"\\\\n},\\\\n\\\\\\\"devDependencies\\\\\\\": {\\\\n\\\\\\\"eslint\\\\\\\": \\\\\\\"^8.2.0\\\\\\\",\\\\n\\\\\\\"eslint-config-airbnb\\\\\\\": \\\\\\\"^19.0.4\\\\\\\",\\\\n\\\\\\\"eslint-config-prettier\\\\\\\": \\\\\\\"^9.0.0\\\\\\\",\\\\n\\\\\\\"eslint-plugin-import\\\\\\\": \\\\\\\"^2.25.3\\\\\\\",\\\\n\\\\\\\"eslint-plugin-jsx-a11y\\\\\\\": \\\\\\\"^6.5.1\\\\\\\",\\\\n\\\\\\\"eslint-plugin-prettier\\\\\\\": \\\\\\\"^5.0.0\\\\\\\",\\\\n\\\\\\\"eslint-plugin-react\\\\\\\": \\\\\\\"^7.28.0\\\\\\\",\\\\n\\\\\\\"eslint-plugin-react-hooks\\\\\\\": \\\\\\\"^4.3.0\\\\\\\",\\\\n\\\\\\\"prettier\\\\\\\": \\\\\\\"^3.0.1\\\\\\\"\\\\n}\\\\n}\\\\n\\\"\\n },\\n {\\n \\\"path\\\": \\\"source_code_dump.json\\\",\\n \\\"content\\\": \\\"[\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\".eslintrc.js\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"module.exports = {\\\\\\\\r\\\\\\\\n env: {\\\\\\\\r\\\\\\\\n browser: true,\\\\\\\\r\\\\\\\\n es2021: true,\\\\\\\\r\\\\\\\\n },\\\\\\\\r\\\\\\\\n extends: ['airbnb-base' , 'prettier'],\\\\\\\\r\\\\\\\\n parserOptions: {\\\\\\\\r\\\\\\\\n ecmaVersion: 12,\\\\\\\\r\\\\\\\\n sourceType: 'module',\\\\\\\\r\\\\\\\\n },\\\\\\\\r\\\\\\\\n plugins: ['prettier'],\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n rules: {\\\\\\\\r\\\\\\\\n indent: 'off',\\\\\\\\r\\\\\\\\n quotes: ['error', 'single'],\\\\\\\\r\\\\\\\\n 'no-var': 'error',\\\\\\\\r\\\\\\\\n 'no-console:': 'off',\\\\\\\\r\\\\\\\\n },\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\".github/workflows/action.yml\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created\\\\\\\\r\\\\\\\\n# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\nname: Building & Publishing to NPM\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\non:\\\\\\\\r\\\\\\\\n push:\\\\\\\\r\\\\\\\\n branches:\\\\\\\\r\\\\\\\\n - main\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\njobs:\\\\\\\\r\\\\\\\\n build-and-publish:\\\\\\\\r\\\\\\\\n runs-on: ubuntu-latest\\\\\\\\r\\\\\\\\n steps:\\\\\\\\r\\\\\\\\n - name: Checkout code\\\\\\\\r\\\\\\\\n uses: actions/checkout@v3\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n - name: Set up Node.js\\\\\\\\r\\\\\\\\n uses: actions/setup-node@v3\\\\\\\\r\\\\\\\\n with:\\\\\\\\r\\\\\\\\n node-version: 16\\\\\\\\r\\\\\\\\n registry-url: https://registry.npmjs.org/\\\\\\\\r\\\\\\\\n \\\\\\\\r\\\\\\\\n # Caching dependencies\\\\\\\\r\\\\\\\\n - name: Cache dependencies\\\\\\\\r\\\\\\\\n uses: actions/cache@v3\\\\\\\\r\\\\\\\\n with:\\\\\\\\r\\\\\\\\n path: ~/.npm\\\\\\\\r\\\\\\\\n key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}\\\\\\\\r\\\\\\\\n restore-keys: |\\\\\\\\r\\\\\\\\n ${{ runner.os }}-node-\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n - name: Install dependencies\\\\\\\\r\\\\\\\\n run: npm ci\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n - name: Run changeset version\\\\\\\\r\\\\\\\\n run: npx changeset version\\\\\\\\r\\\\\\\\n \\\\\\\\r\\\\\\\\n - name: Commit version changes\\\\\\\\r\\\\\\\\n run: |\\\\\\\\r\\\\\\\\n git config user.name \\\\\\\\\\\\\\\"GitHub Actions\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n git config user.email \\\\\\\\\\\\\\\"[email protected]\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n git add .\\\\\\\\r\\\\\\\\n git commit -m \\\\\\\\\\\\\\\"chore: Bump versions\\\\\\\\\\\\\\\" || echo \\\\\\\\\\\\\\\"No changes to commit\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n git push\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n - name: Publish to npm\\\\\\\\r\\\\\\\\n run: npm publish\\\\\\\\r\\\\\\\\n env:\\\\\\\\r\\\\\\\\n NODE_AUTH_TOKEN: ${{ secrets.npm_token }}\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\"index.js\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"#!/usr/bin/env node\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n/**\\\\\\\\r\\\\\\\\n * source-code-spitter\\\\\\\\r\\\\\\\\n * A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\\\\\\\\r\\\\\\\\n *\\\\\\\\r\\\\\\\\n * @author Mohannad F. Otaibi <https://www.mohannadotaibi.com>\\\\\\\\r\\\\\\\\n */\\\\\\\\r\\\\\\\\nconst fs = require('fs-extra');\\\\\\\\r\\\\\\\\nconst path = require('path');\\\\\\\\r\\\\\\\\nconst ignore = require('ignore');\\\\\\\\r\\\\\\\\nconst chalk = require('chalk');\\\\\\\\r\\\\\\\\n// const { Octokit } = require('@octokit/rest');\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// const open = require('open');\\\\\\\\r\\\\\\\\nconst init = require('./utils/init');\\\\\\\\r\\\\\\\\nconst cli = require('./utils/cli');\\\\\\\\r\\\\\\\\nconst log = require('./utils/log');\\\\\\\\r\\\\\\\\nconst DEFAULT_IGNORED_FILES = require('./utils/ignore-config');\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// const clientId = 'f7ec24587e812f6ce928';\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\nconst { input, flags } = cli;\\\\\\\\r\\\\\\\\nconst { clear, debug, include, exclude, json } = flags;\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\nconst includeExtensions = include ? include.split(',') : null;\\\\\\\\r\\\\\\\\nconst excludeExtensions = exclude ? exclude.split(',') : null;\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Function to traverse a directory and return source code files\\\\\\\\r\\\\\\\\nconst traverseDirectory = (dir, ig) => {\\\\\\\\r\\\\\\\\n\\\\\\\\ttry {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tconst files = fs.readdirSync(dir);\\\\\\\\r\\\\\\\\n const sourceCodeFiles = [];\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n files.forEach(file => {\\\\\\\\r\\\\\\\\n const filePath = path.join(dir, file);\\\\\\\\r\\\\\\\\n const stats = fs.statSync(filePath);\\\\\\\\r\\\\\\\\n const fileExtension = path.extname(filePath);\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n if (stats.isDirectory()) {\\\\\\\\r\\\\\\\\n sourceCodeFiles.push(...traverseDirectory(filePath, ig));\\\\\\\\r\\\\\\\\n } else if ((!includeExtensions || includeExtensions.includes(fileExtension)) &&\\\\\\\\r\\\\\\\\n (!excludeExtensions || !excludeExtensions.includes(fileExtension))) {\\\\\\\\r\\\\\\\\n const relativePath = path.relative(process.cwd(), filePath);\\\\\\\\r\\\\\\\\n if (!ig.ignores(relativePath)) {\\\\\\\\r\\\\\\\\n sourceCodeFiles.push(filePath);\\\\\\\\r\\\\\\\\n }\\\\\\\\r\\\\\\\\n }\\\\\\\\r\\\\\\\\n });\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n return sourceCodeFiles;\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\t} catch (error) {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tconsole.error(`An error occurred while traversing the directory ${dir}:`, error);\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\treturn [];\\\\\\\\r\\\\\\\\n\\\\\\\\t}\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Function to parse ignore files like .gitignore and .spitignore\\\\\\\\r\\\\\\\\nconst parseIgnoreFiles = () => {\\\\\\\\r\\\\\\\\n\\\\\\\\tconst gitignorePath = path.join(process.cwd(), '.gitignore');\\\\\\\\r\\\\\\\\n\\\\\\\\tconst spitignorePath = path.join(process.cwd(), '.spitignore');\\\\\\\\r\\\\\\\\n\\\\\\\\tconst ig = ignore();\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tif (fs.existsSync(gitignorePath)) {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tig.add(fs.readFileSync(gitignorePath, 'utf8'));\\\\\\\\r\\\\\\\\n\\\\\\\\t}\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tif (fs.existsSync(spitignorePath)) {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tig.add(fs.readFileSync(spitignorePath, 'utf8'));\\\\\\\\r\\\\\\\\n\\\\\\\\t}\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tig.add(DEFAULT_IGNORED_FILES);\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\treturn ig;\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Todo: Function to create a GitHub Gist\\\\\\\\r\\\\\\\\n// const createGist = async (code) => {\\\\\\\\r\\\\\\\\n// \\\\\\\\topen(`https://github.com/login/oauth/authorize?client_id=${clientId}&scope=gist`);\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// const octokit = new Octokit({\\\\\\\\r\\\\\\\\n// auth: 'YOUR_PERSONAL_ACCESS_TOKEN', // You'll need to handle authentication\\\\\\\\r\\\\\\\\n// });\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// const response = await octokit.gists.create({\\\\\\\\r\\\\\\\\n// description: 'Extracted code snippet',\\\\\\\\r\\\\\\\\n// public: true,\\\\\\\\r\\\\\\\\n// files: {\\\\\\\\r\\\\\\\\n// 'snippet.txt': {\\\\\\\\r\\\\\\\\n// content: code\\\\\\\\r\\\\\\\\n// }\\\\\\\\r\\\\\\\\n// }\\\\\\\\r\\\\\\\\n// });\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// return response.data.html_url;\\\\\\\\r\\\\\\\\n// };\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Function to generate a dump of source code from a directory\\\\\\\\r\\\\\\\\nconst generateSourceCodeDump = directory => {\\\\\\\\r\\\\\\\\n\\\\\\\\tconst ig = parseIgnoreFiles();\\\\\\\\r\\\\\\\\n\\\\\\\\tconst sourceCodeFiles = traverseDirectory(directory, ig);\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tconsole.log(chalk.italic(`Found ${sourceCodeFiles.length} source code files.`));\\\\\\\\r\\\\\\\\n\\\\\\\\tconst dumpFilePath = path.join(process.cwd(), 'source_code_dump');\\\\\\\\r\\\\\\\\n\\\\\\\\tconst dumpFileExt = json ? '.json' : '.txt';\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\r\\\\\\\\n\\\\\\\\tconst dumpFileContent = [];\\\\\\\\r\\\\\\\\n\\\\\\\\tsourceCodeFiles.forEach(file => {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tconst relativePath = path.relative(process.cwd(), file).replace(/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/g, '/');\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tconst fileContent = fs.readFileSync(file, 'utf8');\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdumpFileContent.push({path: relativePath, content: fileContent});\\\\\\\\r\\\\\\\\n\\\\\\\\t});\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tif (json) { // Check if JSON flag is set\\\\\\\\r\\\\\\\\n fs.writeFileSync(dumpFilePath + dumpFileExt, JSON.stringify(dumpFileContent, null, 2));\\\\\\\\r\\\\\\\\n } else {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tconst textOutput = dumpFileContent.map(item => `// ${item.path}\\\\\\\\\\\\\\\\n${item.content}`).join('\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\n');\\\\\\\\r\\\\\\\\n fs.writeFileSync(dumpFilePath + dumpFileExt, textOutput);\\\\\\\\r\\\\\\\\n }\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\t// fs.writeFileSync(dumpFilePath + dumpFileExt, dumpFileContent.join('\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\n'));\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tif (flags.gist) {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t// this function still needs to be implement3ed\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tconsole.log('Gist feature is not implemented yet.');\\\\\\\\r\\\\\\\\n // createGist(dumpFileContent.join('\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\n')).then(gistUrl => {\\\\\\\\r\\\\\\\\n // console.log(`Gist created: ${gistUrl}`);\\\\\\\\r\\\\\\\\n // }).catch(error => {\\\\\\\\r\\\\\\\\n // console.error('Failed to create gist:', error);\\\\\\\\r\\\\\\\\n // });\\\\\\\\r\\\\\\\\n }\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tconsole.log(chalk.greenBright(`Source code dump generated successfully at ${dumpFilePath + dumpFileExt} \\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\n`));\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Main async function to initialize and generate the source code dump\\\\\\\\r\\\\\\\\n(async () => {\\\\\\\\r\\\\\\\\n\\\\\\\\tinit({ clear });\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\t// eslint-disable-next-line no-unused-expressions\\\\\\\\r\\\\\\\\n\\\\\\\\tdebug && log(flags);\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tconst directory = input[0];\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tconsole.log(`Generating out file for directory: ${directory}`);\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tif (!directory) {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tconsole.error('Please provide the directory path as an argument.');\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tprocess.exit(1);\\\\\\\\r\\\\\\\\n\\\\\\\\t}\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tgenerateSourceCodeDump(directory);\\\\\\\\r\\\\\\\\n})();\\\\\\\\r\\\\\\\\n\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\"package.json\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"{\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"name\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"@6degrees/source-code-spitter\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"description\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"A command-line tool to extract and organize source code snippets from projects, enabling easy sharing and collaboration.\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"version\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"2.0.3\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"license\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"MIT\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"bin\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"source-code-spitter\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"index.js\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"spitit\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"index.js\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"author\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"name\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"Mohannad F. Otaibi\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"email\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"[email protected]\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"url\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"https://www.mohannadotaibi.com\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"repository\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"type\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"git\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"url\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"git+https://github.com/6degrees/SourceCodeSpitter.git\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"publishConfig\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"access\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"public\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"homepage\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"https://github.com/6degrees/SourceCodeSpitter#readme\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"keywords\\\\\\\\\\\\\\\": [\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"source-code-spitter\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"Mohannad F. Otaibi\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"source code\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"dump\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"generator\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"command-line\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t],\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"files\\\\\\\\\\\\\\\": [\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"index.js\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"utils\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t],\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"scripts\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"format\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"prettier --write \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"./**/*.{js,json}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"dependencies\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"@changesets/cli\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^2.26.2\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"@octokit/rest\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^20.0.1\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"chalk\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^4.1.2\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"cli-alerts\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^1.2.2\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"cli-handle-error\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^4.4.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"cli-handle-unhandled\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^1.1.1\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"cli-meow-help\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^3.1.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"cli-welcome\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^2.2.2\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"fs-extra\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^11.1.1\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"ignore\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^5.2.4\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"meow\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^9.0.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"open\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^9.1.0\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\\\\\\\\"devDependencies\\\\\\\\\\\\\\\": {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^8.2.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint-config-airbnb\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^19.0.4\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint-config-prettier\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^9.0.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint-plugin-import\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^2.25.3\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint-plugin-jsx-a11y\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^6.5.1\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint-plugin-prettier\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^5.0.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint-plugin-react\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^7.28.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"eslint-plugin-react-hooks\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^4.3.0\\\\\\\\\\\\\\\",\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\t\\\\\\\\\\\\\\\"prettier\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"^3.0.1\\\\\\\\\\\\\\\"\\\\\\\\r\\\\\\\\n\\\\\\\\t}\\\\\\\\r\\\\\\\\n}\\\\\\\\r\\\\\\\\n\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\"utils/cli.js\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"const meow = require('meow');\\\\\\\\r\\\\\\\\nconst meowHelp = require('cli-meow-help');\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Function to define CLI flags and commands\\\\\\\\r\\\\\\\\nconst flags = {\\\\\\\\r\\\\\\\\n\\\\\\\\tclear: {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttype: 'boolean',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdefault: false,\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\talias: 'c',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdesc: 'Clear the console'\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\tnoClear: {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttype: 'boolean',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdefault: false,\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdesc: 'Don\\\\\\\\\\\\\\\\'t clear the console'\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\tdebug: {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttype: 'boolean',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdefault: false,\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\talias: 'd',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdesc: 'Print debug info'\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\tversion: {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttype: 'boolean',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\talias: 'v',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdesc: 'Print CLI version'\\\\\\\\r\\\\\\\\n\\\\\\\\t},\\\\\\\\r\\\\\\\\n\\\\\\\\tinclude: {\\\\\\\\r\\\\\\\\n type: 'string',\\\\\\\\r\\\\\\\\n alias: 'i',\\\\\\\\r\\\\\\\\n desc: 'Include only specific file types (comma-separated, e.g., .js,.css)'\\\\\\\\r\\\\\\\\n },\\\\\\\\r\\\\\\\\n exclude: {\\\\\\\\r\\\\\\\\n type: 'string',\\\\\\\\r\\\\\\\\n alias: 'e',\\\\\\\\r\\\\\\\\n desc: 'Exclude specific file types (comma-separated, e.g., .log,.txt)'\\\\\\\\r\\\\\\\\n },\\\\\\\\r\\\\\\\\n\\\\\\\\tgist: {\\\\\\\\r\\\\\\\\n type: 'boolean',\\\\\\\\r\\\\\\\\n alias: 'g',\\\\\\\\r\\\\\\\\n desc: 'Share the extracted code as a GitHub Gist'\\\\\\\\r\\\\\\\\n },\\\\\\\\r\\\\\\\\n\\\\\\\\tjson: {\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttype: 'boolean',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\talias: 'j',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tdesc: 'Output in JSON format'\\\\\\\\r\\\\\\\\n\\\\\\\\t}\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\nconst commands = {\\\\\\\\r\\\\\\\\n\\\\\\\\thelp: { desc: 'Print help info' }\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Function to generate help text for the CLI\\\\\\\\r\\\\\\\\nconst helpText = meowHelp({\\\\\\\\r\\\\\\\\n\\\\\\\\tname: 'spitit',\\\\\\\\r\\\\\\\\n\\\\\\\\tflags,\\\\\\\\r\\\\\\\\n\\\\\\\\tcommands\\\\\\\\r\\\\\\\\n});\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Options for the CLI\\\\\\\\r\\\\\\\\nconst options = {\\\\\\\\r\\\\\\\\n\\\\\\\\tinferType: true,\\\\\\\\r\\\\\\\\n\\\\\\\\tdescription: false,\\\\\\\\r\\\\\\\\n\\\\\\\\thardRejection: false,\\\\\\\\r\\\\\\\\n\\\\\\\\tflags\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Export the CLI configuration\\\\\\\\r\\\\\\\\nmodule.exports = meow(helpText, options);\\\\\\\\r\\\\\\\\n\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\"utils/ignore-config.js\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"module.exports = [\\\\\\\\r\\\\\\\\n '.git',\\\\\\\\r\\\\\\\\n '.gitignore',\\\\\\\\r\\\\\\\\n '.gitattributes',\\\\\\\\r\\\\\\\\n 'package-lock.json',\\\\\\\\r\\\\\\\\n '*.md',\\\\\\\\r\\\\\\\\n 'source_code_dump.txt',\\\\\\\\r\\\\\\\\n '.changeset/',\\\\\\\\r\\\\\\\\n 'node_modules/',\\\\\\\\r\\\\\\\\n 'build/',\\\\\\\\r\\\\\\\\n 'coverage/',\\\\\\\\r\\\\\\\\n '*.log',\\\\\\\\r\\\\\\\\n '*.lock',\\\\\\\\r\\\\\\\\n 'node_modules',\\\\\\\\r\\\\\\\\n '*.jpg',\\\\\\\\r\\\\\\\\n '*.gif',\\\\\\\\r\\\\\\\\n '*.svg',\\\\\\\\r\\\\\\\\n '*.png',\\\\\\\\r\\\\\\\\n '*.ico',\\\\\\\\r\\\\\\\\n '*.eot',\\\\\\\\r\\\\\\\\n '*.ttf',\\\\\\\\r\\\\\\\\n '*.woff',\\\\\\\\r\\\\\\\\n '*.woff2',\\\\\\\\r\\\\\\\\n '*.mp4',\\\\\\\\r\\\\\\\\n '.vscode/',\\\\\\\\r\\\\\\\\n '.idea/',\\\\\\\\r\\\\\\\\n '.DS_Store',\\\\\\\\r\\\\\\\\n '.env',\\\\\\\\r\\\\\\\\n '.spitignore',\\\\\\\\r\\\\\\\\n '.prettierrc.json',\\\\\\\\r\\\\\\\\n '.prettierrc',\\\\\\\\r\\\\\\\\n '.spitignore.example',\\\\\\\\r\\\\\\\\n];\\\\\\\\r\\\\\\\\n\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\"utils/init.js\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"const welcome = require('cli-welcome');\\\\\\\\r\\\\\\\\nconst unhandled = require('cli-handle-unhandled');\\\\\\\\r\\\\\\\\nconst pkg = require('../package.json');\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Function to initialize the CLI with welcome message and unhandled rejection handling\\\\\\\\r\\\\\\\\nmodule.exports = ({ clear = true }) => {\\\\\\\\r\\\\\\\\n\\\\\\\\tunhandled();\\\\\\\\r\\\\\\\\n\\\\\\\\twelcome({\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttitle: 'source-code-spitter',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttagLine: 'by Mohannad F. Otaibi',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tversion: pkg.version,\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tbgColor: '#36BB09',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tcolor: '#000000',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tbold: true,\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tclear\\\\\\\\r\\\\\\\\n\\\\\\\\t});\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"path\\\\\\\": \\\\\\\"utils/log.js\\\\\\\",\\\\n \\\\\\\"content\\\\\\\": \\\\\\\"/* eslint-disable no-console */\\\\\\\\r\\\\\\\\nconst alert = require('cli-alerts');\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n// Function to log debug information with a warning alert\\\\\\\\r\\\\\\\\nmodule.exports = info => {\\\\\\\\r\\\\\\\\n\\\\\\\\talert({\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\ttype: 'warning',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tname: 'DEBUG LOG',\\\\\\\\r\\\\\\\\n\\\\\\\\t\\\\\\\\tmsg: ''\\\\\\\\r\\\\\\\\n\\\\\\\\t});\\\\\\\\r\\\\\\\\n\\\\\\\\r\\\\\\\\n\\\\\\\\tconsole.log(info);\\\\\\\\r\\\\\\\\n\\\\\\\\tconsole.log();\\\\\\\\r\\\\\\\\n};\\\\\\\\r\\\\\\\\n\\\\\\\"\\\\n }\\\\n]\\\"\\n },\\n {\\n \\\"path\\\": \\\"utils/cli.js\\\",\\n \\\"content\\\": \\\"const meow = require('meow');\\\\nconst meowHelp = require('cli-meow-help');\\\\n\\\\n// Function to define CLI flags and commands\\\\nconst flags = {\\\\nclear: {\\\\ntype: 'boolean',\\\\ndefault: false,\\\\nalias: 'c',\\\\ndesc: 'Clear the console'\\\\n},\\\\nnoClear: {\\\\ntype: 'boolean',\\\\ndefault: false,\\\\ndesc: 'Don\\\\\\\\'t clear the console'\\\\n},\\\\ndebug: {\\\\ntype: 'boolean',\\\\ndefault: false,\\\\nalias: 'd',\\\\ndesc: 'Print debug info'\\\\n},\\\\nversion: {\\\\ntype: 'boolean',\\\\nalias: 'v',\\\\ndesc: 'Print CLI version'\\\\n},\\\\ninclude: {\\\\n type: 'string',\\\\n alias: 'i',\\\\n desc: 'Include only specific file types (comma-separated, e.g., .js,.css)'\\\\n },\\\\n exclude: {\\\\n type: 'string',\\\\n alias: 'e',\\\\n desc: 'Exclude specific file types (comma-separated, e.g., .log,.txt)'\\\\n },\\\\ngist: {\\\\n type: 'boolean',\\\\n alias: 'g',\\\\n desc: 'Share the extracted code as a GitHub Gist'\\\\n },\\\\njson: {\\\\ntype: 'boolean',\\\\nalias: 'j',\\\\ndesc: 'Output in JSON format'\\\\n}\\\\n\\\\n\\\\n};\\\\n\\\\nconst commands = {\\\\nhelp: { desc: 'Print help info' }\\\\n};\\\\n\\\\n// Function to generate help text for the CLI\\\\nconst helpText = meowHelp({\\\\nname: 'spitit',\\\\nflags,\\\\ncommands\\\\n});\\\\n\\\\n// Options for the CLI\\\\nconst options = {\\\\ninferType: true,\\\\ndescription: false,\\\\nhardRejection: false,\\\\nflags\\\\n};\\\\n\\\\n// Export the CLI configuration\\\\nmodule.exports = meow(helpText, options);\\\\n\\\"\\n },\\n {\\n \\\"path\\\": \\\"utils/ignore-config.js\\\",\\n \\\"content\\\": \\\"module.exports = [\\\\n '.git',\\\\n '.gitignore',\\\\n '.gitattributes',\\\\n 'package-lock.json',\\\\n '*.md',\\\\n 'source_code_dump.txt',\\\\n '.changeset/',\\\\n 'node_modules/',\\\\n 'build/',\\\\n 'coverage/',\\\\n '*.log',\\\\n '*.lock',\\\\n 'node_modules',\\\\n '*.jpg',\\\\n '*.gif',\\\\n '*.svg',\\\\n '*.png',\\\\n '*.ico',\\\\n '*.eot',\\\\n '*.ttf',\\\\n '*.woff',\\\\n '*.woff2',\\\\n '*.mp4',\\\\n '.vscode/',\\\\n '.idea/',\\\\n '.DS_Store',\\\\n '.env',\\\\n '.spitignore',\\\\n '.prettierrc.json',\\\\n '.prettierrc',\\\\n '.spitignore.example',\\\\n];\\\\n\\\"\\n },\\n {\\n \\\"path\\\": \\\"utils/init.js\\\",\\n \\\"content\\\": \\\"const welcome = require('cli-welcome');\\\\nconst unhandled = require('cli-handle-unhandled');\\\\nconst pkg = require('../package.json');\\\\n\\\\n// Function to initialize the CLI with welcome message and unhandled rejection handling\\\\nmodule.exports = ({ clear = true }) => {\\\\nunhandled();\\\\nwelcome({\\\\ntitle: 'source-code-spitter',\\\\ntagLine: 'by Mohannad F. Otaibi',\\\\nversion: pkg.version,\\\\nbgColor: '#36BB09',\\\\ncolor: '#000000',\\\\nbold: true,\\\\nclear\\\\n});\\\\n};\\\\n\\\"\\n },\\n {\\n \\\"path\\\": \\\"utils/log.js\\\",\\n \\\"content\\\": \\\"/* eslint-disable no-console */\\\\nconst alert = require('cli-alerts');\\\\n\\\\n// Function to log debug information with a warning alert\\\\nmodule.exports = info => {\\\\nalert({\\\\ntype: 'warning',\\\\nname: 'DEBUG LOG',\\\\nmsg: ''\\\\n});\\\\n\\\\nconsole.log(info);\\\\nconsole.log();\\\\n};\\\\n\\\"\\n }\\n]\"\n },\n {\n \"path\": \"utils/cli.js\",\n \"content\": \"const meow = require('meow');\\nconst meowHelp = require('cli-meow-help');\\n// Function to define CLI flags and commands\\nconst flags = {\\nclear: {\\ntype: 'boolean',\\ndefault: false,\\nalias: 'c',\\ndesc: 'Clear the console'\\n},\\nnoClear: {\\ntype: 'boolean',\\ndefault: false,\\ndesc: 'Don\\\\'t clear the console'\\n},\\ndebug: {\\ntype: 'boolean',\\ndefault: false,\\nalias: 'd',\\ndesc: 'Print debug info'\\n},\\nversion: {\\ntype: 'boolean',\\nalias: 'v',\\ndesc: 'Print CLI version'\\n},\\ninclude: {\\n type: 'string',\\n alias: 'i',\\n desc: 'Include only specific file types (comma-separated, e.g., .js,.css)'\\n },\\n exclude: {\\n type: 'string',\\n alias: 'e',\\n desc: 'Exclude specific file types (comma-separated, e.g., .log,.txt)'\\n },\\ngist: {\\n type: 'boolean',\\n alias: 'g',\\n desc: 'Share the extracted code as a GitHub Gist'\\n },\\njson: {\\ntype: 'boolean',\\nalias: 'j',\\ndesc: 'Output in JSON format'\\n}\\n\\n};\\nconst commands = {\\nhelp: { desc: 'Print help info' }\\n};\\n// Function to generate help text for the CLI\\nconst helpText = meowHelp({\\nname: 'spitit',\\nflags,\\ncommands\\n});\\n// Options for the CLI\\nconst options = {\\ninferType: true,\\ndescription: false,\\nhardRejection: false,\\nflags\\n};\\n// Export the CLI configuration\\nmodule.exports = meow(helpText, options);\\n\"\n },\n {\n \"path\": \"utils/ignore-config.js\",\n \"content\": \"module.exports = [\\n '.git',\\n '.gitignore',\\n '.gitattributes',\\n 'package-lock.json',\\n '*.md',\\n 'source_code_dump.txt',\\n '.changeset/',\\n 'node_modules/',\\n 'build/',\\n 'coverage/',\\n '*.log',\\n '*.lock',\\n 'node_modules',\\n '*.jpg',\\n '*.gif',\\n '*.svg',\\n '*.png',\\n '*.ico',\\n '*.eot',\\n '*.ttf',\\n '*.woff',\\n '*.woff2',\\n '*.mp4',\\n '.vscode/',\\n '.idea/',\\n '.DS_Store',\\n '.env',\\n '.spitignore',\\n '.prettierrc.json',\\n '.prettierrc',\\n '.spitignore.example',\\n];\\n\"\n },\n {\n \"path\": \"utils/init.js\",\n \"content\": \"const welcome = require('cli-welcome');\\nconst unhandled = require('cli-handle-unhandled');\\nconst pkg = require('../package.json');\\n// Function to initialize the CLI with welcome message and unhandled rejection handling\\nmodule.exports = ({ clear = true }) => {\\nunhandled();\\nwelcome({\\ntitle: 'source-code-spitter',\\ntagLine: 'by Mohannad F. Otaibi',\\nversion: pkg.version,\\nbgColor: '#36BB09',\\ncolor: '#000000',\\nbold: true,\\nclear\\n});\\n};\\n\"\n },\n {\n \"path\": \"utils/log.js\",\n \"content\": \"/* eslint-disable no-console */\\nconst alert = require('cli-alerts');\\n// Function to log debug information with a warning alert\\nmodule.exports = info => {\\nalert({\\ntype: 'warning',\\nname: 'DEBUG LOG',\\nmsg: ''\\n});\\nconsole.log(info);\\nconsole.log();\\n};\\n\"\n }\n]"
},
{
"path": "utils/cli.js",
"content": "const meow = require('meow');\nconst meowHelp = require('cli-meow-help');\n// Function to define CLI flags and commands\nconst flags = {\nclear: {\ntype: 'boolean',\ndefault: false,\nalias: 'c',\ndesc: 'Clear the console'\n},\nnoClear: {\ntype: 'boolean',\ndefault: false,\ndesc: 'Don\\'t clear the console'\n},\ndebug: {\ntype: 'boolean',\ndefault: false,\nalias: 'd',\ndesc: 'Print debug info'\n},\nversion: {\ntype: 'boolean',\nalias: 'v',\ndesc: 'Print CLI version'\n},\ninclude: {\n type: 'string',\n alias: 'i',\n desc: 'Include only specific file types (comma-separated, e.g., .js,.css)'\n },\n exclude: {\n type: 'string',\n alias: 'e',\n desc: 'Exclude specific file types (comma-separated, e.g., .log,.txt)'\n },\ngist: {\n type: 'boolean',\n alias: 'g',\n desc: 'Share the extracted code as a GitHub Gist'\n },\njson: {\ntype: 'boolean',\nalias: 'j',\ndesc: 'Output in JSON format'\n}\n\n};\nconst commands = {\nhelp: { desc: 'Print help info' }\n};\n// Function to generate help text for the CLI\nconst helpText = meowHelp({\nname: 'spitit',\nflags,\ncommands\n});\n// Options for the CLI\nconst options = {\ninferType: true,\ndescription: false,\nhardRejection: false,\nflags\n};\n// Export the CLI configuration\nmodule.exports = meow(helpText, options);\n"
},
{
"path": "utils/ignore-config.js",
"content": "module.exports = [\n '.git',\n '.gitignore',\n '.gitattributes',\n 'package-lock.json',\n '*.md',\n 'source_code_dump.txt',\n '.changeset/',\n 'node_modules/',\n 'build/',\n 'coverage/',\n '*.log',\n '*.lock',\n 'node_modules',\n '*.jpg',\n '*.gif',\n '*.svg',\n '*.png',\n '*.ico',\n '*.eot',\n '*.ttf',\n '*.woff',\n '*.woff2',\n '*.mp4',\n '.vscode/',\n '.idea/',\n '.DS_Store',\n '.env',\n '.spitignore',\n '.prettierrc.json',\n '.prettierrc',\n '.spitignore.example',\n];\n"
},
{
"path": "utils/init.js",
"content": "const welcome = require('cli-welcome');\nconst unhandled = require('cli-handle-unhandled');\nconst pkg = require('../package.json');\n// Function to initialize the CLI with welcome message and unhandled rejection handling\nmodule.exports = ({ clear = true }) => {\nunhandled();\nwelcome({\ntitle: 'source-code-spitter',\ntagLine: 'by Mohannad F. Otaibi',\nversion: pkg.version,\nbgColor: '#36BB09',\ncolor: '#000000',\nbold: true,\nclear\n});\n};\n"
},
{
"path": "utils/log.js",
"content": "/* eslint-disable no-console */\nconst alert = require('cli-alerts');\n// Function to log debug information with a warning alert\nmodule.exports = info => {\nalert({\ntype: 'warning',\nname: 'DEBUG LOG',\nmsg: ''\n});\nconsole.log(info);\nconsole.log();\n};\n"
}
]