Interactive manager hardening#531
Open
eltonacosta wants to merge 3 commits into
Open
Conversation
…enta funções utilitárias para manipulação de arquivos de ambiente
…tualizar a documentação e testes
There was a problem hiding this comment.
Pull request overview
Adds an interactive npm run manage CLI for editing account credentials (.env) and runtime settings (config.json), supported by new utilities for locating project files and parsing/saving account blocks, plus a minimal Node test harness.
Changes:
- Introduce interactive manager CLI (
src/cli/manage.ts) and an in-terminal arrow-key menu (src/cli/InteractiveMenu.ts). - Add helpers to locate project-root files and manage
.envaccount blocks (src/util/ProjectFiles.ts,src/util/EnvAccounts.ts). - Add Node test runner + unit tests for the new utilities and menu controller; document the workflow; add
npm run testandnpm run manage.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/ProjectFiles.ts | Locates project root and resolves files across root/dist/src. |
| src/util/EnvAccounts.ts | Parses/saves ACCOUNT_N_* blocks in .env for the manager. |
| src/test/util/ProjectFiles.test.ts | Tests project-root discovery behavior. |
| src/test/util/EnvAccounts.test.ts | Tests parsing validation and stale-entry cleanup when saving .env. |
| src/test/run-tests.ts | Simple test entrypoint importing test files. |
| src/test/cli/InteractiveMenu.test.ts | Tests menu controller logic and formatting helpers. |
| src/cli/manage.ts | Implements interactive CLI for accounts/config management. |
| src/cli/InteractiveMenu.ts | Implements raw-mode interactive selection UI/controller. |
| scripts/utils.js | Hardens existing project-root search loop termination. |
| README.md | Documents the new interactive manager command and scope. |
| package.json | Adds test and manage scripts. |
| package-lock.json | Lockfile updates consistent with npm regeneration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+90
to
+91
| const raw = fs.readFileSync(configSource, 'utf-8') | ||
| return validateConfig(JSON.parse(raw)) |
Comment on lines
+70
to
+73
| private resolveWritableFile(filename: string): string { | ||
| const resolved = resolveProjectFile(filename) | ||
| return resolved ?? path.join(process.cwd(), filename) | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Owner
|
Not sure what co-pilot is doing here, but I'll look at this when I have the time! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Just an interactive CLI to add and set up accounts, via npm run manage