Skip to content

Refactor package metadata and implement auto-approval for permissions#18

Merged
gitricko merged 4 commits into
mainfrom
clause-allow-always
May 25, 2026
Merged

Refactor package metadata and implement auto-approval for permissions#18
gitricko merged 4 commits into
mainfrom
clause-allow-always

Conversation

@gitricko

Copy link
Copy Markdown
Owner

This pull request updates the extension's branding and enhances its permission system. The most significant changes are the renaming of the extension to "Hermes Code Agent" and the addition of a configuration-based mechanism to disable permission approval dialogs.

Branding updates:

  • Renamed the extension from "Hermes AI Agent" to "Hermes Code Agent" throughout package.json, including the name, displayName, activity bar title, and relevant keywords. [1] [2] [3]

Permission system improvements:

  • Added a new readApprovalsDisabled function in src/extension.ts to detect if permission approvals are disabled via ~/.hermes/config.yaml (by setting approvals.mode to false, off, or no).
  • Updated the permissionHandler logic to:
    • Automatically allow permission requests without showing a dialog if approvals are disabled in config.
    • Introduce an "Allow Always" option in the permission dialog, which, once selected, auto-approves future requests for the session.
    • Refactor dialog options for clarity and safety, including explicit "Allow Once" and "Allow Always" choices.…issions

Copilot AI review requested due to automatic review settings May 25, 2026 16:50

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

This PR updates the VS Code extension’s branding (renaming to “Hermes Code Agent”) and refactors the permission-approval flow to support config-based auto-approval plus a session-scoped “Allow Always” option.

Changes:

  • Renames the extension/package metadata and bumps the version to 3.0.2.
  • Adds readApprovalsDisabled() to detect approvals.mode in ~/.hermes/config.yaml and auto-allow permission requests when disabled.
  • Updates the permission dialog to include “Allow Once” and “Allow Always”, with “Allow Always” suppressing future dialogs for the session.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/extension.ts Adds config-based approvals disabling and refactors the permission handler (auto-allow + allow-always session toggle).
package.json Renames extension branding/keywords and bumps version.
package-lock.json Aligns lockfile package name/version with the updated package metadata.
Comments suppressed due to low confidence (1)

src/extension.ts:328

  • If the user selects “Allow Once” but allowOptionId is null, the code falls through and will return the denyOptionId (if present), effectively denying despite the user choosing allow. Handle the “no allow optionId” case explicitly (e.g., show an error and deny consistently, or treat as protocol error) rather than silently converting an allow into a deny.
    if (choice === allowOnce && allowOptionId) {
      outputChannel.appendLine('[security] permission granted once');
      return { outcome: 'selected', optionId: allowOptionId };
    }

    if (denyOptionId) {
      outputChannel.appendLine('[security] permission denied');
      return { outcome: 'selected', optionId: denyOptionId };
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/extension.ts
Comment on lines +59 to +64
function readApprovalsDisabled(): boolean {
// Returns true when ~/.hermes/config.yaml has `approvals.mode: false|off|no`.
try {
const configPath = path.join(os.homedir(), '.hermes', 'config.yaml');
const content = fs.readFileSync(configPath, 'utf8');
const lines = content.split(/\r?\n/);
Comment thread src/extension.ts
Comment on lines +84 to +88
const modeMatch = trimmed.match(/^mode:\s*(.+)/);
if (modeMatch) {
const value = modeMatch[1].trim().toLowerCase();
return value === 'false' || value === 'off' || value === 'no';
}
Comment thread src/extension.ts Outdated
Comment thread src/extension.ts
Comment on lines +282 to +289
// Approvals disabled via config — auto-allow without dialog.
if (readApprovalsDisabled()) {
outputChannel.appendLine('[security] approvals disabled in config, auto-allowing');
if (allowOptionId) {
return { outcome: 'selected', optionId: allowOptionId };
}
throw new Error('Permission denied: no allow option');
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

Comment thread package.json
"displayName": "Hermes AI Agent",
"name": "hermes-code-agent",
"displayName": "Hermes Code Agent",
"description": "VS Code sidebar for the Hermes AI agent. Streams chat, runs tools, manages sessions. Multi-model (Claude, Codex). Communicates over ACP.",
Comment thread src/extension.ts
Comment on lines +75 to +79
if (trimmed === 'approvals:') {
inApprovals = true;
approvalsIndent = indent;
continue;
}
Comment thread src/extension.ts
Comment thread src/extension.ts
Comment on lines +289 to +292
return { outcome: 'selected', optionId: allowOptionId };
}
throw new Error('Permission denied: no allow option');
}
@gitricko gitricko merged commit edb67f7 into main May 25, 2026
5 checks passed
@gitricko gitricko deleted the clause-allow-always branch May 25, 2026 17:21
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