UNPKG

hataraku

Version:

An autonomous coding agent for building AI-powered development tools. The name "Hataraku" (働く) means "to work" in Japanese.

80 lines 3.58 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.getFilesInCurrentDirectory = getFilesInCurrentDirectory; exports.getEnvironmentInfo = getEnvironmentInfo; const os = __importStar(require("node:os")); const node_fs_1 = require("node:fs"); const process = __importStar(require("node:process")); const shell_1 = require("../lib/utils/shell"); // Should only return max files at most, evenly divided into three sections with ellipsis in between function getFilesInCurrentDirectory(max = 30) { const files = (0, node_fs_1.readdirSync)(process.cwd()); const n = Math.floor(max / 3); if (files.length <= max) { return files; } const firstFiles = files.slice(0, n); const midIndex = Math.floor(files.length / 2); const half = Math.floor(n / 2); const middleFiles = files.slice(midIndex - half, midIndex - half + n); const lastFiles = files.slice(-n); return [...firstFiles, '...', ...middleFiles, '...', ...lastFiles]; } function getEnvironmentInfo() { return ` <environment_details> Environment Information: Operating System: ${os.platform()} ${os.release()} Architecture: ${os.arch()} CPU Cores: ${os.cpus().length} Total Memory: ${Math.round(os.totalmem() / (1024 * 1024 * 1024))}GB Free Memory: ${Math.round(os.freemem() / (1024 * 1024 * 1024))}GB Default Shell: ${(0, shell_1.getDefaultShell)()} Home Directory: ${os.homedir()} Current Working Directory: ${process.cwd()} Files in Current Directory: ${getFilesInCurrentDirectory()} Node Version: ${process.version} Current Time: ${new Date().toLocaleString(Intl.DateTimeFormat().resolvedOptions().locale, { timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone })} Locale: ${Intl.DateTimeFormat().resolvedOptions().locale} Timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone} User Info: ${os.userInfo().username} Package Manager: ${process.env.npm_config_user_agent?.split('/')[0] || 'npm'} Terminal: ${process.env.TERM_PROGRAM || process.env.TERM || 'unknown'} Git Branch: ${require('child_process').execSync('git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "not a git repo"').toString().trim()} </environment_details> `; } //# sourceMappingURL=environment.js.map