-
Notifications
You must be signed in to change notification settings - Fork 37
feat(SLAC-5): Make a alias for featurerequest command, "fr" #279
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
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,6 +22,26 @@ describe('Feature Request Integration', function() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check handler function exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(content).to.include('async function _featurerequest(input, channel, userName)'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should have "fr" alias registered pointing to the same handler as featurerequest', function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const indexPath = path.join(process.cwd(), 'index.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const content = fs.readFileSync(indexPath, 'utf8'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check that 'fr' alias is registered with the same handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(content).to.include("['fr', { fn: _featurerequest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should register "fr" and "featurerequest" with the same handler function', function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const indexPath = path.join(process.cwd(), 'index.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const content = fs.readFileSync(indexPath, 'utf8'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Both should reference _featurerequest as their handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const featureRequestMatch = content.includes("['featurerequest', { fn: _featurerequest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const frMatch = content.includes("['fr', { fn: _featurerequest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(featureRequestMatch).to.be.true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(frMatch).to.be.true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+26
to
+43
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should have "fr" alias registered pointing to the same handler as featurerequest', function() { | |
| const indexPath = path.join(process.cwd(), 'index.js'); | |
| const content = fs.readFileSync(indexPath, 'utf8'); | |
| // Check that 'fr' alias is registered with the same handler | |
| expect(content).to.include("['fr', { fn: _featurerequest"); | |
| }); | |
| it('should register "fr" and "featurerequest" with the same handler function', function() { | |
| const indexPath = path.join(process.cwd(), 'index.js'); | |
| const content = fs.readFileSync(indexPath, 'utf8'); | |
| // Both should reference _featurerequest as their handler | |
| const featureRequestMatch = content.includes("['featurerequest', { fn: _featurerequest"); | |
| const frMatch = content.includes("['fr', { fn: _featurerequest"); | |
| expect(featureRequestMatch).to.be.true; | |
| expect(frMatch).to.be.true; | |
| it('should have "fr" alias registered on the featurerequest command', function() { | |
| const indexPath = path.join(process.cwd(), 'index.js'); | |
| const content = fs.readFileSync(indexPath, 'utf8'); | |
| // Check that 'fr' is declared via the command alias mechanism | |
| expect(content).to.match(/\['featurerequest',\s*\{\s*fn:\s*_featurerequest[\s\S]*?aliases:\s*\[[^\]]*['"]fr['"][^\]]*\]/); | |
| }); | |
| it('should register "featurerequest" with _featurerequest and include "fr" in its aliases', function() { | |
| const indexPath = path.join(process.cwd(), 'index.js'); | |
| const content = fs.readFileSync(indexPath, 'utf8'); | |
| // The command should use _featurerequest as its handler and expose 'fr' as an alias | |
| const featureRequestMatch = /\['featurerequest',\s*\{\s*fn:\s*_featurerequest/.test(content); | |
| const frAliasMatch = /\['featurerequest',\s*\{\s*fn:\s*_featurerequest[\s\S]*?aliases:\s*\[[^\]]*['"]fr['"][^\]]*\]/.test(content); | |
| expect(featureRequestMatch).to.be.true; | |
| expect(frAliasMatch).to.be.true; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,184 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Tests for SLAC-5 β Add "fr" Alias for `featurerequest` Command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Verifies that: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - "fr" is registered as an alias pointing to the same handler as "featurerequest" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - The existing "featurerequest" command is unchanged | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - Help text documents the "fr" alias | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - No duplicated handler logic exists for "fr" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { describe, it } from 'mocha'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { expect } from 'chai'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import fs from 'fs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import path from 'path'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // --------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Helpers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // --------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function readFile(relativePath) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return fs.readFileSync(path.join(process.cwd(), relativePath), 'utf8'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // --------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Suite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // --------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('SLAC-5 β "fr" alias for featurerequest', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Command Registration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe('Command Registration (index.js)', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should still have the original "featurerequest" command registered', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const content = readFile('index.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(content).to.include("['featurerequest', { fn: _featurerequest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should have the "fr" alias registered', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const content = readFile('index.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(content).to.include("['fr', { fn: _featurerequest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should register "fr" with the same handler function as "featurerequest"', function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const content = readFile('index.js'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Both entries must reference _featurerequest β no separate handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const featureRequestRegistered = content.includes("['featurerequest', { fn: _featurerequest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const frRegistered = content.includes("['fr', { fn: _featurerequest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(featureRequestRegistered, '"featurerequest" registration with _featurerequest handler').to.be.true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(frRegistered, '"fr" registration with _featurerequest handler').to.be.true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+54
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it('should have the "fr" alias registered', function () { | |
| const content = readFile('index.js'); | |
| expect(content).to.include("['fr', { fn: _featurerequest"); | |
| }); | |
| it('should register "fr" with the same handler function as "featurerequest"', function () { | |
| const content = readFile('index.js'); | |
| // Both entries must reference _featurerequest β no separate handler | |
| const featureRequestRegistered = content.includes("['featurerequest', { fn: _featurerequest"); | |
| const frRegistered = content.includes("['fr', { fn: _featurerequest"); | |
| expect(featureRequestRegistered, '"featurerequest" registration with _featurerequest handler').to.be.true; | |
| expect(frRegistered, '"fr" registration with _featurerequest handler').to.be.true; | |
| it('should register "fr" as an alias on the "featurerequest" command', function () { | |
| const content = readFile('index.js'); | |
| const featureRequestEntryWithAlias = /\['featurerequest',\s*\{\s*fn:\s*_featurerequest[\s\S]*?aliases:\s*\[[^\]]*['"]fr['"][^\]]*\]/m; | |
| expect( | |
| featureRequestEntryWithAlias.test(content), | |
| '"featurerequest" command should declare an aliases array containing "fr"' | |
| ).to.be.true; | |
| }); | |
| it('should resolve aliases via alias metadata rather than a duplicate "fr" registry entry', function () { | |
| const content = readFile('index.js'); | |
| const featureRequestRegistered = content.includes("['featurerequest', { fn: _featurerequest"); | |
| const duplicateFrRegistryEntry = content.includes("['fr', { fn: _featurerequest"); | |
| const hasAliasMapSupport = /aliasMap/.test(content) && /aliases/.test(content); | |
| expect(featureRequestRegistered, '"featurerequest" registration with _featurerequest handler').to.be.true; | |
| expect(duplicateFrRegistryEntry, '"fr" should not be registered as a separate commandRegistry entry').to.be.false; | |
| expect(hasAliasMapSupport, 'index.js should use alias metadata / aliasMap for alias resolution').to.be.true; |
Copilot
AI
Apr 12, 2026
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 tests in this section are unrelated to adding the fr alias (they re-check GitHub API endpoint, labels, and issue body strings) and largely duplicate coverage already present in test/aicode-agent.test.mjs. Keeping both increases maintenance cost and makes tests brittle to harmless refactors; consider removing these checks from this SLAC-5-specific suite and focusing on alias behavior only.
| // Handler Behaviour β source-level checks | |
| // ------------------------------------------------------------------------- | |
| describe('Handler Behaviour', function () { | |
| it('should use the GitHub Issues API endpoint in the handler', function () { | |
| const content = readFile('index.js'); | |
| expect(content).to.include('api.github.com/repos/htilly/SlackONOS/issues'); | |
| }); | |
| it('should apply the "enhancement" label when creating a GitHub issue', function () { | |
| const content = readFile('index.js'); | |
| expect(content).to.include("labels: ['enhancement']"); | |
| }); | |
| it('should include requester information in the issue body', function () { | |
| const content = readFile('index.js'); | |
| expect(content).to.include('Requested by'); | |
| }); | |
| }); | |
| // ------------------------------------------------------------------------- |
Copilot
AI
Apr 12, 2026
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.
Acceptance criteria calls for verifying that invoking fr produces the same observable response/behavior as featurerequest (including on Slack and Discord). This suite only performs source-level string checks against index.js/templates, so it wonβt catch runtime routing/response differences. Consider adding an executable test that runs the command router with fr vs featurerequest and asserts the same output is sent (with Slack/Discord message functions stubbed).
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.
This help text change documents
fras an alias, but this PR doesnβt include the corresponding command registration change inindex.js. Either addfras an alias forfeaturerequestin the command registry (so users can actually invoke it) or avoid documenting the alias until it is implemented, otherwise help output will be misleading.