-
Notifications
You must be signed in to change notification settings - Fork 18
AI appmixer context: update instructions #590
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
Conversation
WalkthroughThe document .github/copilot-instructions.md was completely rewritten and expanded from a brief code style note into a comprehensive technical guide covering Appmixer connectors and components. It now includes architecture guidelines, JSON schemas, authentication and quota management, component structure, and behavior implementation details. Changes
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/copilot-instructions.md (2)
211-215
: Fix typo in JSDoc – should bePromise
, notproimise
A misspelled return type reduces IDE / TS-server intelligence and undermines credibility of the docs.
- * @returns {proimise} + * @returns {Promise}
30-35
: Promote emphasis lines to proper Markdown headingsUsing
**package.json**
as a heading triggersmarkdownlint
rule MD036 and hurts document navigability. Prefer third-level headings:- **package.json** + ### package.jsonApply the same change to
service.json
,quota.j 8000 s
,auth.js
,bundle.json
, andcomponent.json
for consistency.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/copilot-instructions.md
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
.github/copilot-instructions.md (1)
Learnt from: CR
PR: clientIO/appmixer-connectors#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-23T12:30:01.008Z
Learning: A component in the Appmixer system is a self-contained unit of functionality, defined by a component.json file and a behavior file with the same name as the component folder. Components can have multiple inPorts and outPorts, and are used to process data, trigger actions, or perform other tasks in workflows.
🪛 LanguageTool
.github/copilot-instructions.md
[style] ~95-~95: To form a complete sentence, be sure to include a subject.
Context: ...throttling**: The throttling mechanism. Can be either a string 'window-sliding' or ...
(MISSING_IT_THERE)
[uncategorized] ~343-~343: You might be missing the article “a” here.
Context: ...the component folder. #### When adding new field to component.json > Use-case: "I ...
(AI_EN_LECTOR_MISSING_DETERMINER_A)
[uncategorized] ~346-~346: You might be missing the article “the” here.
Context: ...json schema format. - Add the fields to behavior JS file, especially in `context.httpReq...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🪛 markdownlint-cli2 (0.17.2)
.github/copilot-instructions.md
28-28: Bare URL used
null
(MD034, no-bare-urls)
33-33: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
98-98: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
349-349: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
600-600: Bare URL used
null
(MD034, no-bare-urls)
605-605: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
611-611: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
613-613: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
614-614: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
615-615: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
617-617: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
618-618: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
619-619: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
|
||
// curl https://mydomain.freshdesk.com/api/v2/agents/me \ | ||
// -u myApiKey:X' | ||
const credentials = `${context.apiKey}:X`; | ||
const encoded = (new Buffer(credentials)).toString('base64'); | ||
await context.httpRequest({ | ||
method: 'GET', |
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.
🛠️ Refactor suggestion
Replace deprecated new Buffer()
usage in the Freshdesk example
new Buffer()
has been deprecated since Node v6. Using it in a reference snippet might encourage the same pattern in production code. Replace it with Buffer.from
to avoid deprecation warnings and potential security flags.
- const encoded = (new Buffer(credentials)).toString('base64');
+ const encoded = Buffer.from(credentials, 'utf8').toString('base64');
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// curl https://mydomain.freshdesk.com/api/v2/agents/me \ | |
// -u myApiKey:X' | |
const credentials = `${context.apiKey}:X`; | |
const encoded = (new Buffer(credentials)).toString('base64'); | |
await context.httpRequest({ | |
method: 'GET', | |
// curl https://mydomain.freshdesk.com/api/v2/agents/me \ | |
// -u myApiKey:X' | |
const credentials = `${context.apiKey}:X`; | |
const encoded = Buffer.from(credentials, 'utf8').toString('base64'); | |
await context.httpRequest({ | |
method: 'GET', |
🤖 Prompt for AI Agents
In .github/copilot-instructions.md around lines 145 to 151, the code uses the
deprecated `new Buffer()` constructor to encode credentials. Replace `new
Buffer(credentials)` with `Buffer.from(credentials)` to avoid deprecation
warnings and follow current Node.js best practices.
const response = await context.httpRequest({ | ||
method: 'POST', | ||
url: 'https://oauth2.googleapis.com/token', | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
}, | ||
data | ||
}); | ||
|
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.
🛠️ Refactor suggestion
❓ Verification inconclusive
Body formatting mismatch in OAuth requestAccessToken
example
The snippet sets Content-Type: application/x-www-form-urlencoded
but sends a plain JS object. Most HTTP clients will JSON-stringify the object, resulting in an invalid request body for the token endpoint.
Add URL-encoded serialisation (or drop the header) to keep the example copy-paste-ready:
- const response = await context.httpRequest({
- method: 'POST',
- url: 'https://oauth2.googleapis.com/token',
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- data
- });
+ const response = await context.httpRequest({
+ method: 'POST',
+ url: 'https://oauth2.googleapis.com/token',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ data: new URLSearchParams(data).toString()
+ });
Body formatting mismatch in OAuth requestAccessToken
example
The snippet sets Content-Type: application/x-www-form-urlencoded
but sends a plain JS object. Most HTTP clients will JSON-stringify the object, resulting in an invalid request body for the token endpoint.
Add URL-encoded serialisation (or drop the header) to keep the example copy-paste-ready:
- const response = await context.httpRequest({
- method: 'POST',
- url: 'https://oauth2.googleapis.com/token',
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- data
- });
+ const response = await context.httpRequest({
+ method: 'POST',
+ url: 'https://oauth2.googleapis.com/token',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ data: new URLSearchParams(data).toString()
+ });
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In .github/copilot-instructions.md around lines 225 to 233, the OAuth
requestAccessToken example sets the Content-Type header to
application/x-www-form-urlencoded but sends a plain JavaScript object as the
data, which will be JSON-stringified by most HTTP clients and cause an invalid
request body. To fix this, serialize the data as a URL-encoded string before
sending or remove the Content-Type header to match the data format, ensuring the
example works correctly when copy-pasted.
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.
Actionable comments posted: 0
♻️ Duplicate comments (2)
.github/copilot-instructions.md (2)
148-150
: Replace deprecatednew Buffer()
usage (still unfixed)The example continues to use
new Buffer()
, which is deprecated and may raise runtime warnings. Switch toBuffer.from
to follow current Node best-practices.- const encoded = (new Buffer(credentials)).toString('base64'); + const encoded = Buffer.from(credentials, 'utf8').toString('base64');
225-231
: Body mismatch forapplication/x-www-form-urlencoded
request (still unfixed)
data
is sent as a plain object even though the header advertises a URL-encoded body. Most HTTP clients will JSON-stringify the object and the request will fail. Encode the body explicitly (or drop the header).- const response = await context.httpRequest({ + const response = await context.httpRequest({ method: 'POST', url: 'https://oauth2.googleapis.com/token', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - data + data: new URLSearchParams(data).toString() });
🧹 Nitpick comments (3)
.github/copilot-instructions.md (3)
28-28
: Convert bare URL to Markdown linkBare URLs trigger MD034 warnings and reduce readability. Wrap the address in Markdown syntax:
- documentation: https://docs.appmixer.com/building-connectors/example-component#component-behaviour-sms-sendsms-sendsms.js + [Documentation](https://docs.appmixer.com/building-connectors/example-component#component-behaviour-sms-sendsms-sendsms.js)
30-33
: Use proper heading levels instead of bold text for section titlesLines such as
**package.json**
are rendered as italicised text rather than semantic headings and trigger MD036. Replace with a heading (###
) for consistency with the rest of the doc:-**package.json** +### package.jsonRepeat for similar occurrences (
quota.js
,auth.js
,bundle.json
,component.json
,behavior file
).
617-625
: Fix unordered-list indentationNested list items are indented with four spaces but Markdown-lint expects two (MD007). Align indentation to keep linter green.
- - pagination - - caching (Airtable bases, HubSpot properties) - - locking (goes in hand with caching usually, not always) + - pagination + - caching (Airtable bases, HubSpot properties) + - locking (goes in hand with caching usually, not always)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/copilot-instructions.md
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
.github/copilot-instructions.md (1)
Learnt from: CR
PR: clientIO/appmixer-connectors#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-06-23T12:30:01.008Z
Learning: A component in the Appmixer system is a self-contained unit of functionality, defined by a component.json file and a behavior file with the same name as the component folder. Components can have multiple inPorts and outPorts, and are used to process data, trigger actions, or perform other tasks in workflows.
🪛 LanguageTool
.github/copilot-instructions.md
[style] ~95-~95: To form a complete sentence, be sure to include a subject.
Context: ...throttling**: The throttling mechanism. Can be either a string 'window-sliding' or ...
(MISSING_IT_THERE)
[uncategorized] ~343-~343: You might be missing the article “a” here.
Context: ...the component folder. #### When adding new field to component.json > Use-case: "I ...
(AI_EN_LECTOR_MISSING_DETERMINER_A)
[uncategorized] ~346-~346: You might be missing the article “the” here.
Context: ...json schema format. - Add the fields to behavior JS file, especially in `context.httpReq...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🪛 markdownlint-cli2 (0.17.2)
.github/copilot-instructions.md
28-28: Bare URL used
null
(MD034, no-bare-urls)
33-33: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
98-98: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
349-349: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
599-599: Emphasis used instead of a heading
null
(MD036, no-emphasis-as-heading)
609-609: Bare URL used
null
(MD034, no-bare-urls)
617-617: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
619-619: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
620-620: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
621-621: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
623-623: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
624-624: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
625-625: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
Summary by CodeRabbit