-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(wand): added more wands #2756
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,33 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = { | |
| type: 'short-input', | ||
| placeholder: 'Sheet name and cell range (e.g., Sheet1!A1:D10)', | ||
| condition: { field: 'operation', value: ['read', 'write', 'update'] }, | ||
| wandConfig: { | ||
| enabled: true, | ||
| prompt: `Generate a valid Microsoft Excel range based on the user's description. | ||
|
|
||
| ### FORMAT (REQUIRED) | ||
| SheetName!StartCell:EndCell | ||
|
|
||
| Excel ALWAYS requires the full range format with both sheet name and cell range. | ||
|
|
||
| ### RANGE RULES | ||
| - Sheet names with spaces must be quoted: 'My Sheet'!A1:B10 | ||
| - Column letters are uppercase: A, B, C, ... Z, AA, AB, etc. | ||
| - Row numbers start at 1 (not 0) | ||
| - For entire columns: Sheet1!A:Z | ||
| - For entire rows: Sheet1!1:100 | ||
|
|
||
| ### EXAMPLES | ||
| - "the first sheet" -> Sheet1!A1:Z1000 | ||
| - "data sheet from A1 to E100" -> 'Data Sheet'!A1:E100 | ||
| - "cells A1 through C50 on Sheet2" -> Sheet2!A1:C50 | ||
| - "column A of inventory" -> Inventory!A:A | ||
| - "just the headers row on Sheet1" -> Sheet1!1:1 | ||
| - "all data on sales sheet" -> 'Sales'!A1:Z1000 | ||
|
|
||
| Return ONLY the range string - no explanations, no quotes around the entire output, no extra text.`, | ||
| placeholder: 'Describe the range (e.g., "A1 to D50 on Sheet1")...', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'tableName', | ||
|
|
@@ -95,6 +122,22 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = { | |
| 'Enter values as JSON array of arrays (e.g., [["A1", "B1"], ["A2", "B2"]]) or an array of objects (e.g., [{"name":"John", "age":30}, {"name":"Jane", "age":25}])', | ||
| condition: { field: 'operation', value: 'write' }, | ||
| required: true, | ||
| wandConfig: { | ||
| enabled: true, | ||
| prompt: `Generate Microsoft Excel data as a JSON array based on the user's description. | ||
|
|
||
| Format options: | ||
| 1. Array of arrays: [["Header1", "Header2"], ["Value1", "Value2"]] | ||
| 2. Array of objects: [{"column1": "value1", "column2": "value2"}] | ||
|
|
||
| Examples: | ||
| - "sales data with product and revenue columns" -> [["Product", "Revenue"], ["Widget A", 1500], ["Widget B", 2300]] | ||
| - "list of employees with name and email" -> [{"name": "John Doe", "email": "[email protected]"}, {"name": "Jane Smith", "email": "[email protected]"}] | ||
|
|
||
| Return ONLY the JSON array - no explanations, no markdown, no extra text.`, | ||
| placeholder: 'Describe the data you want to write...', | ||
| generationType: 'json-object', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'valueInputOption', | ||
|
|
@@ -114,6 +157,22 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = { | |
| 'Enter values as JSON array of arrays (e.g., [["A1", "B1"], ["A2", "B2"]]) or an array of objects (e.g., [{"name":"John", "age":30}, {"name":"Jane", "age":25}])', | ||
| condition: { field: 'operation', value: 'update' }, | ||
| required: true, | ||
| wandConfig: { | ||
| enabled: true, | ||
| prompt: `Generate Microsoft Excel data as a JSON array based on the user's description. | ||
|
|
||
| Format options: | ||
| 1. Array of arrays: [["Header1", "Header2"], ["Value1", "Value2"]] | ||
| 2. Array of objects: [{"column1": "value1", "column2": "value2"}] | ||
|
|
||
| Examples: | ||
| - "update with new prices" -> [["Product", "Price"], ["Widget A", 29.99], ["Widget B", 49.99]] | ||
| - "quarterly targets" -> [{"Q1": 10000, "Q2": 12000, "Q3": 15000, "Q4": 18000}] | ||
|
|
||
| Return ONLY the JSON array - no explanations, no markdown, no extra text.`, | ||
| placeholder: 'Describe the data you want to update...', | ||
| generationType: 'json-object', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'valueInputOption', | ||
|
|
@@ -133,6 +192,25 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = { | |
| 'Enter values as JSON array of arrays (e.g., [["A1", "B1"], ["A2", "B2"]]) or an array of objects (e.g., [{"name":"John", "age":30}, {"name":"Jane", "age":25}])', | ||
| condition: { field: 'operation', value: 'table_add' }, | ||
| required: true, | ||
| wandConfig: { | ||
| enabled: true, | ||
| prompt: `Generate Microsoft Excel table row data as a JSON array based on the user's description. | ||
|
|
||
| Format options: | ||
| 1. Array of arrays: [["Value1", "Value2"], ["Value3", "Value4"]] | ||
| 2. Array of objects: [{"column1": "value1", "column2": "value2"}] | ||
|
|
||
| Note: When adding to an existing table, do NOT include headers - only data rows. | ||
|
|
||
| Examples: | ||
| - "add new sales record" -> [["2024-01-15", "Widget Pro", 5, 249.99]] | ||
| - "append customer info" -> [{"name": "Acme Corp", "contact": "John Smith", "status": "Active"}] | ||
| - "add multiple rows with name, age, city" -> [["Alice", 28, "NYC"], ["Bob", 35, "LA"]] | ||
|
|
||
| Return ONLY the JSON array - no explanations, no markdown, no extra text.`, | ||
| placeholder: 'Describe the data you want to add to the table...', | ||
| generationType: 'json-object', | ||
| }, | ||
| }, | ||
| ], | ||
| tools: { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,14 +132,108 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = { | |
| type: 'short-input', | ||
| placeholder: "Template (e.g., 'genericList')", | ||
| condition: { field: 'operation', value: 'create_list' }, | ||
| wandConfig: { | ||
| enabled: true, | ||
| prompt: `Generate a SharePoint list template name based on the user's description. | ||
|
|
||
| ### AVAILABLE TEMPLATES | ||
| - genericList - Standard list for general data (default) | ||
| - documentLibrary - For storing and managing documents | ||
| - survey - For creating surveys and polls | ||
| - links - For storing hyperlinks | ||
| - announcements - For news and announcements | ||
| - contacts - For contact information (name, email, phone) | ||
| - events - For calendar events and scheduling | ||
| - tasks - For task tracking and project management | ||
| - discussionBoard - For team discussions and forums | ||
| - pictureLibrary - For storing images and photos | ||
| - issue - For issue/bug tracking | ||
|
|
||
| ### EXAMPLES | ||
| - "I want to track tasks" -> tasks | ||
| - "store documents" -> documentLibrary | ||
| - "team announcements" -> announcements | ||
| - "contact list" -> contacts | ||
| - "calendar events" -> events | ||
| - "general data" -> genericList | ||
| - "bug tracking" -> issue | ||
| - "photo gallery" -> pictureLibrary | ||
|
|
||
| Return ONLY the template name - no explanations, no quotes, no extra text.`, | ||
| placeholder: 'Describe what kind of list you need...', | ||
| }, | ||
| }, | ||
|
|
||
| { | ||
| id: 'pageContent', | ||
| title: 'Page Content', | ||
| id: 'columnDefinitions', | ||
| title: 'Column Definitions', | ||
| type: 'long-input', | ||
| placeholder: 'Provide page content', | ||
| placeholder: 'Optional: Define custom columns as JSON array', | ||
| condition: { field: 'operation', value: ['create_list'] }, | ||
| wandConfig: { | ||
| enabled: true, | ||
| prompt: `Generate a JSON array of SharePoint list column definitions based on the user's description. | ||
|
|
||
| ### FORMAT | ||
| A JSON array of column definition objects. Each column needs at minimum a "name" and column type properties. | ||
|
|
||
| ### COLUMN TYPES AND PROPERTIES | ||
|
|
||
| **Text Column:** | ||
| {"name": "ColumnName", "text": {}} | ||
| - For single line of text | ||
|
|
||
| **Multi-line Text:** | ||
| {"name": "ColumnName", "text": {"allowMultipleLines": true}} | ||
|
|
||
| **Number Column:** | ||
| {"name": "ColumnName", "number": {}} | ||
| - Optional: "minimum", "maximum", "decimalPlaces" | ||
|
|
||
| **DateTime Column:** | ||
| {"name": "ColumnName", "dateTime": {"format": "dateOnly"}} | ||
| - format: "dateOnly" or "dateTime" | ||
|
|
||
| **Boolean (Yes/No):** | ||
| {"name": "ColumnName", "boolean": {}} | ||
|
|
||
| **Choice Column:** | ||
| {"name": "ColumnName", "choice": {"choices": ["Option1", "Option2", "Option3"]}} | ||
|
|
||
| **Person Column:** | ||
| {"name": "ColumnName", "personOrGroup": {}} | ||
|
|
||
| **Currency:** | ||
| {"name": "ColumnName", "currency": {"locale": "en-US"}} | ||
|
|
||
| ### EXAMPLES | ||
|
|
||
| "add columns for status (choice: Active, Completed, On Hold), due date, and priority number" | ||
| -> [ | ||
| {"name": "Status", "choice": {"choices": ["Active", "Completed", "On Hold"]}}, | ||
| {"name": "DueDate", "dateTime": {"format": "dateOnly"}}, | ||
| {"name": "Priority", "number": {"minimum": 1, "maximum": 5}} | ||
| ] | ||
|
|
||
| "text column for description, yes/no for completed, date for start" | ||
| -> [ | ||
| {"name": "Description", "text": {"allowMultipleLines": true}}, | ||
| {"name": "Completed", "boolean": {}}, | ||
| {"name": "StartDate", "dateTime": {"format": "dateOnly"}} | ||
| ] | ||
|
|
||
| "assignee (person), budget (currency), category (choice: Marketing, Sales, Engineering)" | ||
| -> [ | ||
| {"name": "Assignee", "personOrGroup": {}}, | ||
| {"name": "Budget", "currency": {"locale": "en-US"}}, | ||
| {"name": "Category", "choice": {"choices": ["Marketing", "Sales", "Engineering"]}} | ||
| ] | ||
|
|
||
| Return ONLY the JSON array - no explanations, no markdown, no extra text.`, | ||
| placeholder: | ||
| 'Describe the columns you want to add (e.g., "status dropdown, due date, priority number")...', | ||
| generationType: 'json-object', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'listDescription', | ||
|
|
@@ -164,9 +258,50 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = { | |
| id: 'listItemFields', | ||
| title: 'List Item Fields', | ||
| type: 'long-input', | ||
| placeholder: 'Enter list item fields', | ||
| placeholder: | ||
| 'Enter list item fields as JSON (e.g., {"Title": "My Item", "Status": "Active"})', | ||
| canonicalParamId: 'listItemFields', | ||
| condition: { field: 'operation', value: ['update_list', 'add_list_items'] }, | ||
| wandConfig: { | ||
| enabled: true, | ||
| prompt: `Generate a JSON object for SharePoint list item fields based on the user's description. | ||
|
|
||
| ### FORMAT | ||
| A JSON object where keys are column internal names and values are the data to set. | ||
|
|
||
| ### RULES | ||
| - Use the column's internal name (often same as display name, but spaces become _x0020_) | ||
| - Common field names: Title, Status, Description, Priority, DueDate, AssignedTo, Category | ||
| - Date fields should use ISO 8601 format: "2024-01-15" or "2024-01-15T10:30:00Z" | ||
| - Number fields should be numeric, not strings | ||
| - Boolean fields use true/false | ||
| - Choice fields use the exact choice value as a string | ||
| - Person fields use the person's email or ID | ||
|
|
||
| ### READ-ONLY FIELDS (automatically filtered out) | ||
| Id, UniqueId, GUID, Created, Modified, Author, Editor, ContentTypeId | ||
|
|
||
| ### EXAMPLES | ||
|
|
||
| "set title to Project Alpha and status to In Progress" | ||
| -> {"Title": "Project Alpha", "Status": "In Progress"} | ||
|
|
||
| "update priority to high and due date to next Friday" | ||
| -> {"Priority": "High", "DueDate": "2024-01-19"} | ||
|
|
||
| "add task with title Review Document, assigned to [email protected]" | ||
| -> {"Title": "Review Document", "AssignedToLookupId": "[email protected]"} | ||
|
|
||
| "create contact with name John Smith, email [email protected], phone 555-1234" | ||
| -> {"Title": "John Smith", "Email": "[email protected]", "WorkPhone": "555-1234"} | ||
|
|
||
| "set completed to true and notes to Task finished successfully" | ||
| -> {"Completed": true, "Notes": "Task finished successfully"} | ||
|
|
||
| Return ONLY the JSON object - no explanations, no markdown, no extra text.`, | ||
| placeholder: 'Describe the fields and values you want to set...', | ||
| generationType: 'json-object', | ||
| }, | ||
| }, | ||
|
|
||
| // Upload File operation fields | ||
|
|
@@ -267,6 +402,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = { | |
| includeItems, | ||
| uploadFiles, | ||
| files, | ||
| columnDefinitions, | ||
| ...others | ||
| } = rest as any | ||
|
|
||
|
|
@@ -314,7 +450,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = { | |
|
|
||
| // Handle file upload files parameter | ||
| const fileParam = uploadFiles || files | ||
| const baseParams = { | ||
| const baseParams: Record<string, any> = { | ||
| credential, | ||
| siteId: effectiveSiteId || undefined, | ||
| pageSize: others.pageSize ? Number.parseInt(others.pageSize as string, 10) : undefined, | ||
|
|
@@ -331,6 +467,10 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = { | |
| baseParams.files = fileParam | ||
| } | ||
|
|
||
| if (columnDefinitions) { | ||
| baseParams.pageContent = columnDefinitions | ||
| } | ||
|
|
||
| return baseParams | ||
| }, | ||
| }, | ||
|
|
@@ -339,7 +479,10 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = { | |
| operation: { type: 'string', description: 'Operation to perform' }, | ||
| credential: { type: 'string', description: 'Microsoft account credential' }, | ||
| pageName: { type: 'string', description: 'Page name' }, | ||
| pageContent: { type: 'string', description: 'Page content' }, | ||
| columnDefinitions: { | ||
| type: 'string', | ||
| description: 'Column definitions for list creation (JSON array)', | ||
| }, | ||
| pageTitle: { type: 'string', description: 'Page title' }, | ||
| pageId: { type: 'string', description: 'Page ID' }, | ||
| siteSelector: { type: 'string', description: 'Site selector' }, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 field is named
columnDefinitionsin the UI but gets mapped topageContentin the transform function (line 471). This creates a disconnect between the field name users see and the actual parameter name sent to the API. Consider either:pageContentand updating just the title/placeholder to be more descriptivecolumnDefinitionsas the parameter name instead ofpageContentThis improves maintainability by keeping field IDs aligned with parameter names.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI