Skip to content

Interactive manager hardening#531

Open
eltonacosta wants to merge 3 commits into
TheNetsky:v4from
eltonacosta:interactive-manager-hardening
Open

Interactive manager hardening#531
eltonacosta wants to merge 3 commits into
TheNetsky:v4from
eltonacosta:interactive-manager-hardening

Conversation

@eltonacosta

Copy link
Copy Markdown

Just an interactive CLI to add and set up accounts, via npm run manage

…enta funções utilitárias para manipulação de arquivos de ambiente
Copilot AI review requested due to automatic review settings July 4, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .env account 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 test and npm 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 thread src/cli/manage.ts
Comment on lines +90 to +91
const raw = fs.readFileSync(configSource, 'utf-8')
return validateConfig(JSON.parse(raw))
Comment thread src/cli/manage.ts
Comment on lines +70 to +73
private resolveWritableFile(filename: string): string {
const resolved = resolveProjectFile(filename)
return resolved ?? path.join(process.cwd(), filename)
}
Comment thread src/util/EnvAccounts.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@TheNetsky

Copy link
Copy Markdown
Owner

Not sure what co-pilot is doing here, but I'll look at this when I have the time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants