-
Notifications
You must be signed in to change notification settings - Fork 0
chore(plugin-git): normalize branding to elizaos #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.x
Are you sure you want to change the base?
Changes from all commits
afb710c
f4eb98e
bc8c62b
cd0dac5
690e7a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Build outputs | ||
| dist/ | ||
| node_modules/ | ||
|
|
||
| # Turbo cache (monorepo) | ||
| .turbo/ | ||
|
|
||
| # Environment files | ||
| .env | ||
| .env.local | ||
| .env.production | ||
| .env.staging | ||
| .env.development | ||
| .env.bak | ||
| *.env | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # IDE files | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Coverage | ||
| coverage/ | ||
|
|
||
| # Cache directories | ||
| .cache/ | ||
| .npm/ | ||
| .eslintcache | ||
| *.tsbuildinfo | ||
|
|
||
| # Temporary folders | ||
| tmp/ | ||
| temp/ | ||
|
|
||
| # ElizaOS specific | ||
| .eliza/ | ||
| .elizadb/ | ||
| cache/ | ||
| data/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,5 +83,4 @@ | |
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,23 +19,52 @@ import { getActiveRepository, setActiveRepository } from '../utils/state'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { isValidBranchName } from '../utils/security'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Extracts branch name from message text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Extracts branch name from message text. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Strategy: find text after a known command keyword, then scan words | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * left-to-right skipping English filler words. Returns the first token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * that looks like a valid git branch name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * This avoids fragile regex with dynamic construction (new RegExp + template | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * strings) and greedy-match ordering issues that silently mangle branch names. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function extractBranchName(text: string): string | null { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "checkout X", "switch to X", "branch X" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const checkoutMatch = text.match( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /(?:checkout|switch(?:\s+to)?|branch)\s+["\']?([a-zA-Z0-9._\/-]+)["\']?/i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // English filler words that appear between commands and branch names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // e.g. "checkout THE odi-dev", "switch to A feature/login" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const FILLER_WORDS = new Set(['the', 'a', 'an', 'to', 'into', 'on', 'for']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Words that signal we've gone past the branch name in the sentence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const STOP_WORDS = new Set(['branch', 'and', 'then', 'first', 'now', 'from', 'called', 'named']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 1. Quoted branch names are unambiguous -- highest priority | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const quotedMatch = text.match(/(?:checkout|switch|branch|create|new)\b.*?["'`]([a-zA-Z0-9._\/-]+)["'`]/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (quotedMatch?.[1]) return quotedMatch[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 2. Find text after a command keyword, scan for first branch-like token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const afterCommand = text.match( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /(?:checkout|switch(?:\s+to)?|(?:create|new)\s+(?:branch\s+)?|branch)\s+(.*)/i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (checkoutMatch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return checkoutMatch[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (afterCommand?.[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const raw of afterCommand[1].trim().split(/\s+/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const word = raw.replace(/^["'`]+|["'`]+$/g, ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!word) continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Stop scanning at meta words (not part of the branch name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (STOP_WORDS.has(word.toLowerCase())) break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Skip filler words -- but NOT if they contain branch-name chars (- / .) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // so "the-great-refactor" is kept, but standalone "the" is skipped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (FILLER_WORDS.has(word.toLowerCase()) && !/[-/.]/.test(word)) continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Must be valid git branch characters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (/^[a-zA-Z0-9._\/-]+$/.test(word)) return word; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| break; // invalid chars = stop scanning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+34
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parser can incorrectly choose In phrases like “create a new branch called feature/user-auth” (Line 249), the current scan may return 💡 Proposed fix- const FILLER_WORDS = new Set(['the', 'a', 'an', 'to', 'into', 'on', 'for']);
- // Words that signal we've gone past the branch name in the sentence
- const STOP_WORDS = new Set(['branch', 'and', 'then', 'first', 'now', 'from', 'called', 'named']);
+ const FILLER_WORDS = new Set([
+ 'the', 'a', 'an', 'to', 'into', 'on', 'for',
+ 'new', 'branch', 'called', 'named',
+ ]);
+ // Words that usually indicate a new clause, not a branch token
+ const STOP_WORDS = new Set(['and', 'then', 'first', 'now', 'from']);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "create X branch", "new branch X" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const createMatch = text.match( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /(?:create|new)\s+(?:branch\s+)?["\']?([a-zA-Z0-9._\/-]+)["\']?(?:\s+branch)?/i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (createMatch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return createMatch[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 3. Reverse pattern: "odi-dev branch" (branch name BEFORE the keyword) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const reverseMatch = text.match(/\b([a-zA-Z0-9._\/-]+)\s+branch\b/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (reverseMatch?.[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const w = reverseMatch[1].toLowerCase(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!FILLER_WORDS.has(w) && !STOP_WORDS.has(w) && w !== 'create' && w !== 'new') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return reverseMatch[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -46,20 +46,25 @@ function extractRepoUrl(text: string): string | null { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Extracts branch name from message text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Extracts branch name from message text. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Uses conservative patterns to avoid false positives from common English | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * (e.g. "clone repo on the server" should NOT extract "the" as a branch). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function extractBranch(text: string): string | undefined { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "branch X", "on branch X", "checkout X branch" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const FILLER_WORDS = new Set(['the', 'a', 'an', 'to', 'into', 'for', 'this', 'that']); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "on branch X", "branch X", "checkout X" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const branchMatch = text.match( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /(?:branch|checkout|switch to)\s+["\']?([a-zA-Z0-9._\/-]+)["\']?/i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /(?:branch|checkout|switch to)\s+["']?([a-zA-Z0-9._\/-]+)["']?/i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (branchMatch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (branchMatch?.[1] && !FILLER_WORDS.has(branchMatch[1].toLowerCase())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return branchMatch[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "on X", at the end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // "on X" at the end of the message -- only if X is not a filler word | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const onMatch = text.match(/\bon\s+([a-zA-Z0-9._\/-]+)\s*$/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (onMatch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (onMatch?.[1] && !FILLER_WORDS.has(onMatch[1].toLowerCase())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return onMatch[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+55
to
68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With the current patterns, Line 254’s example phrasing (“on the canary branch”) won’t extract 💡 Proposed fix function extractBranch(text: string): string | undefined {
const FILLER_WORDS = new Set(['the', 'a', 'an', 'to', 'into', 'for', 'this', 'that']);
+ // "on the canary branch", "from develop branch"
+ const namedBranch = text.match(/\b(?:on|from|in)\s+(?:the\s+)?([a-zA-Z0-9._\/-]+)\s+branch\b/i);
+ if (namedBranch?.[1] && !FILLER_WORDS.has(namedBranch[1].toLowerCase())) {
+ return namedBranch[1];
+ }
+
// "on branch X", "branch X", "checkout X"
const branchMatch = text.match(
/(?:branch|checkout|switch to)\s+["']?([a-zA-Z0-9._\/-]+)["']?/i
);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,14 +34,24 @@ function extractCount(text: string): number | undefined { | |
| } | ||
|
|
||
| /** | ||
| * Extracts branch name from message text | ||
| * Extracts branch name from message text. | ||
| * | ||
| * Only matches when the word "branch" appears explicitly, to avoid | ||
| * false positives from common English prepositions ("in the", "on the"). | ||
| */ | ||
| function extractBranch(text: string): string | undefined { | ||
| // Look for patterns like "on branch main", "from develop", "in feature/xyz" | ||
| const branchMatch = text.match(/(?:on|from|in|branch)\s+(?:branch\s+)?([a-zA-Z0-9/_-]+)/i); | ||
| if (branchMatch) { | ||
| return branchMatch[1]; | ||
| const FILLER_WORDS = new Set(['the', 'a', 'an', 'to', 'into', 'on', 'for', 'this', 'that']); | ||
|
|
||
| // "on branch main", "from branch develop", "in branch feature/xyz" | ||
| const withBranchKeyword = text.match(/(?:on|from|in)\s+branch\s+([a-zA-Z0-9/_.-]+)/i); | ||
| if (withBranchKeyword?.[1]) return withBranchKeyword[1]; | ||
|
|
||
| // "branch main", "branch develop" | ||
| const directBranch = text.match(/\bbranch\s+([a-zA-Z0-9/_.-]+)/i); | ||
| if (directBranch?.[1] && !FILLER_WORDS.has(directBranch[1].toLowerCase())) { | ||
| return directBranch[1]; | ||
| } | ||
|
Comment on lines
+46
to
53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Branch parser does not handle The new patterns miss common input like Line 279 (“from develop branch”), so 💡 Proposed fix function extractBranch(text: string): string | undefined {
const FILLER_WORDS = new Set(['the', 'a', 'an', 'to', 'into', 'on', 'for', 'this', 'that']);
+ // "from develop branch", "on main branch", "in release/v1 branch"
+ const preposedBranch = text.match(/(?:on|from|in)\s+([a-zA-Z0-9/_.-]+)\s+branch\b/i);
+ if (preposedBranch?.[1] && !FILLER_WORDS.has(preposedBranch[1].toLowerCase())) {
+ return preposedBranch[1];
+ }
+
// "on branch main", "from branch develop", "in branch feature/xyz"
const withBranchKeyword = text.match(/(?:on|from|in)\s+branch\s+([a-zA-Z0-9/_.-]+)/i);
if (withBranchKeyword?.[1]) return withBranchKeyword[1];🤖 Prompt for AI Agents |
||
|
|
||
| return undefined; | ||
| } | ||
|
|
||
|
|
@@ -98,7 +108,7 @@ export const gitLogAction: Action = { | |
| message: Memory, | ||
| _state: State | undefined | ||
| ): Promise<boolean> => { | ||
| const text = message.content.text.toLowerCase(); | ||
| const text = (message.content.text || '').toLowerCase(); | ||
|
|
||
| // Check for git log related keywords | ||
| const hasLogKeywords = ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,7 +65,8 @@ export const gitPullAction: Action = { | |
|
|
||
| // Extract remote and branch from text | ||
| const remoteMatch = text.match(/from\s+(\w+)(?:\s+remote)?/i); | ||
| const branchMatch = text.match(/(?:branch\s+)?([a-zA-Z0-9._\/-]+)(?:\s+branch)?/i); | ||
| // Require "branch" keyword to avoid capturing random words from the message | ||
| const branchMatch = text.match(/\bbranch\s+([a-zA-Z0-9._\/-]+)/i); | ||
|
|
||
| const remote = options?.remote || remoteMatch?.[1]; | ||
| const branch = options?.branch || branchMatch?.[1]; | ||
|
Comment on lines
+68
to
72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Branch extraction now misses Line 69 only captures 💡 Proposed fix- const branchMatch = text.match(/\bbranch\s+([a-zA-Z0-9._\/-]+)/i);
+ const branchMatch = text.match(
+ /\b(?:branch\s+([a-zA-Z0-9._\/-]+)|([a-zA-Z0-9._\/-]+)\s+branch)\b/i
+ );
const remote = options?.remote || remoteMatch?.[1];
- const branch = options?.branch || branchMatch?.[1];
+ const branch = options?.branch || branchMatch?.[1] || branchMatch?.[2];🤖 Prompt for AI Agents |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| /** | ||
| * GIT_SETTINGS Provider | ||
| * | ||
| * Exposes current git plugin settings (non-sensitive only). | ||
| * Helps users understand their current configuration. | ||
| */ | ||
|
|
||
| import type { | ||
| IAgentRuntime, | ||
| Memory, | ||
| Provider, | ||
| ProviderResult, | ||
| State, | ||
| } from '@elizaos/core'; | ||
| import { GitService } from '../services/git'; | ||
| import { getActiveRepository, getWorkingCopies } from '../utils/state'; | ||
|
|
||
| export const gitSettingsProvider: Provider = { | ||
| name: 'GIT_SETTINGS', | ||
| description: 'Current git plugin configuration and settings (non-sensitive)', | ||
|
|
||
| get: async ( | ||
| runtime: IAgentRuntime, | ||
| message: Memory, | ||
| _state?: State | ||
| ): Promise<ProviderResult> => { | ||
| const gitService = runtime.getService<GitService>('git'); | ||
|
|
||
| // Get non-sensitive settings | ||
| const allowedPath = runtime.getSetting('GIT_ALLOWED_PATH') || 'not restricted'; | ||
| const authorName = runtime.getSetting('GIT_AUTHOR_NAME') || 'not set'; | ||
| const authorEmail = runtime.getSetting('GIT_AUTHOR_EMAIL') || 'not set'; | ||
| const cloneTimeout = runtime.getSetting('GIT_CLONE_TIMEOUT') || '300'; | ||
| const workingCopiesDir = runtime.getSetting('GIT_WORKING_COPIES_DIR') || '~/.eliza/git'; | ||
|
|
||
| // Check auth status without exposing credentials | ||
| const hasToken = !!runtime.getSetting('GIT_TOKEN'); | ||
| const hasUserPass = !!runtime.getSetting('GIT_USERNAME') && !!runtime.getSetting('GIT_PASSWORD'); | ||
| const authConfigured = hasToken || hasUserPass; | ||
| const authMethod = hasToken ? 'token' : hasUserPass ? 'username/password' : 'none'; | ||
|
|
||
| // Get git CLI status | ||
| let gitVersion = 'unknown'; | ||
| let gitInstalled = false; | ||
| if (gitService) { | ||
| gitInstalled = await gitService.isGitInstalled(); | ||
| if (gitInstalled) { | ||
| gitVersion = (await gitService.getGitVersion()) || 'unknown'; | ||
| } | ||
| } | ||
|
|
||
| // Get repository state | ||
| const activeRepo = await getActiveRepository(runtime, message.roomId); | ||
| const workingCopies = await getWorkingCopies(runtime, message.roomId); | ||
|
|
||
| // Check for workspace integration | ||
| const workspaceService = runtime.getService('workspace'); | ||
| const usingWorkspace = !!workspaceService; | ||
|
|
||
| const settings = { | ||
| gitInstalled, | ||
| gitVersion, | ||
| allowedPath, | ||
| workingCopiesDir, | ||
| cloneTimeoutSeconds: parseInt(String(cloneTimeout)), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guard timeout parsing to avoid At Line 65, invalid 💡 Proposed fix- cloneTimeoutSeconds: parseInt(String(cloneTimeout)),
+ cloneTimeoutSeconds: (() => {
+ const parsed = Number.parseInt(String(cloneTimeout), 10);
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 300;
+ })(),Also applies to: 97-97 🤖 Prompt for AI Agents |
||
| author: { | ||
| name: authorName, | ||
| email: authorEmail, | ||
| }, | ||
| authentication: { | ||
| configured: authConfigured, | ||
| method: authMethod, | ||
| }, | ||
| state: { | ||
| activeRepo: activeRepo | ||
| ? { | ||
| path: activeRepo.path, | ||
| branch: activeRepo.branch, | ||
| remote: activeRepo.remote, | ||
| } | ||
| : null, | ||
| workingCopiesCount: workingCopies.length, | ||
| }, | ||
| usingWorkspace, | ||
| }; | ||
|
|
||
| const lines = [ | ||
| '## Git Plugin Settings', | ||
| '', | ||
| `**Git CLI:** ${settings.gitInstalled ? `Installed (${settings.gitVersion})` : 'Not installed'}`, | ||
| '', | ||
| '**Directories:**', | ||
| `- Allowed Path: \`${settings.allowedPath}\``, | ||
| `- Working Copies: \`${settings.workingCopiesDir}\``, | ||
| `- Using Workspace: ${settings.usingWorkspace ? 'Yes' : 'No'}`, | ||
| '', | ||
| '**Clone Timeout:** ' + settings.cloneTimeoutSeconds + 's', | ||
| '', | ||
| '**Author:**', | ||
| `- Name: ${settings.author.name}`, | ||
| `- Email: ${settings.author.email}`, | ||
| '', | ||
| '**Authentication:**', | ||
| `- Configured: ${settings.authentication.configured ? 'Yes' : 'No'}`, | ||
| `- Method: ${settings.authentication.method}`, | ||
| '', | ||
| '**State:**', | ||
| `- Working Copies: ${settings.state.workingCopiesCount}`, | ||
| ]; | ||
|
|
||
| if (settings.state.activeRepo) { | ||
| lines.push(`- Active Repo: \`${settings.state.activeRepo.path}\``); | ||
| lines.push(`- Branch: ${settings.state.activeRepo.branch}`); | ||
| } else { | ||
| lines.push('- Active Repo: None'); | ||
| } | ||
|
|
||
| return { | ||
| text: lines.join('\n'), | ||
| values: settings, | ||
| data: { settings }, | ||
| }; | ||
| }, | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description mentions "Update package description to use lowercase elizaos", but the actual diff for package.json only shows removal of a trailing blank line. There don't appear to be any branding changes in the description field. Either the description field was already using lowercase "elizaos", or the PR description is inaccurate.