Compare commits

14 Commits

Author SHA1 Message Date
a89b6d757e Update .vscodeignore to exclude additional asset directories and files 2025-03-28 04:27:09 +00:00
1924971d22 Add avatar image asset 2025-03-28 04:27:05 +00:00
a31a1bd3e2 fix upload path
All checks were successful
Release VSCode Extension / release (push) Successful in 33s
2025-03-27 10:04:39 +00:00
d6450fd597 Add ajv
Some checks failed
Release VSCode Extension / release (push) Failing after 43s
2025-03-27 10:02:27 +00:00
c4f97e252d Bump node 2025-03-27 10:01:46 +00:00
77e4df420e Deps sorting and codegen for build
Some checks failed
Release VSCode Extension / release (push) Failing after 40s
2025-03-27 07:23:40 +00:00
f6467a82c2 refactor comments 2025-03-27 07:17:22 +00:00
d895f58963 no global vsce and using new name
Some checks failed
Release VSCode Extension / release (push) Failing after 26s
2025-03-27 07:14:53 +00:00
d9e44b78ce Merge pull request 'sorting-files' (#2) from sorting-files into main
Some checks failed
Release VSCode Extension / release (push) Failing after 1m22s
Reviewed-on: #2
2025-03-27 07:10:17 +00:00
4b38333d23 Release workflow 2025-03-27 07:08:29 +00:00
bea2ea2a0f Sort folders first then files 2025-03-27 06:28:16 +00:00
8246879bea Fix missing newline at end of file in extension.ts 2025-03-17 07:24:19 +00:00
72f21325dd Merge pull request 'feat-filter-ignore' (#1) from feat-filter-ignore into main
Reviewed-on: #1
2025-03-17 07:23:37 +00:00
7aece43a6b Enhance status bar with new buttons for tree view and settings; refactor existing button setup 2025-03-17 07:22:40 +00:00
6 changed files with 150 additions and 20 deletions

View File

@@ -0,0 +1,84 @@
name: Release VSCode Extension
run-name: ${{ gitea.actor }} is releasing a new version 🚀
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '23.9.0'
# Step 3: Install jq for JSON parsing
- name: Install jq
run: sudo apt-get install -y jq
# Step 4: Install project dependencies inside prompter directory
- name: Install dependencies
run: npm install
# Step 5: Install vsce
- name: Install vsce
run: npm install @vscode/vsce
# Step 6: Install additional dev dependencies for building inside prompter directory
- name: Install build tools
run: npm install --save-dev webpack webpack-cli ts-loader codegen
# Step 7: Build the extension inside prompter directory
- name: Build the extension
run: npm run webpack:prod
# Step 8: Package the extension into a VSIX file inside prompter directory
- name: Package the extension
run: npx vsce package
# Step 9: Extract the tag name from gitea.ref
- name: Extract tag name
run: |
TAG_NAME=$(echo "${{ gitea.ref }}" | sed 's/refs\/tags\///')
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
# Step 10: Determine the VSIX file name from package.json inside prompter directory
- name: Get VSIX file name
run: |
NAME=$(jq -r .name package.json)
VERSION=$(jq -r .version package.json)
VSIX_FILE="${NAME}-${VERSION}.vsix"
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_ENV
# Step 11: Create a new release in Gitea
- name: Create release
run: |
curl -X POST \
-H "Authorization: token ${{ gitea.token }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"Release $TAG_NAME\", \"body\": \"Automated release for version $TAG_NAME\"}" \
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases
# Step 12: Retrieve the release ID
- name: Get release ID
run: |
RELEASE_ID=$(curl -s -H "Authorization: token ${{ gitea.token }}" \
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases/tags/$TAG_NAME | jq .id)
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
# Step 13: Upload the VSIX file as a release asset (from prompter directory)
- name: Upload VSIX to release
run: |
curl -X POST \
-H "Authorization: token ${{ gitea.token }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$VSIX_FILE" \
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases/$RELEASE_ID/assets?name=$VSIX_FILE

View File

@@ -29,3 +29,7 @@ package-lock.json
# Assets not needed in the final package
attached_assets/**
.config
assets/
.gitea/**
*.md
.vscode-test.mjs

BIN
assets/avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 KiB

View File

@@ -2,9 +2,9 @@
"name": "prompter",
"displayName": "Prompter",
"description": "Easy prompt generation and apply edits using prompter.",
"version": "0.0.1",
"version": "0.0.2",
"publisher": "abhishekbhakat",
"repository": "https://github.com/abhishekbhakat/prompter",
"repository": "https://git.bhakat.dev/abhishekbhakat/Prompter",
"engines": {
"vscode": "^1.98.0"
},
@@ -21,7 +21,13 @@
},
{
"command": "prompter.generatePrompt",
"title": "Copy"
"title": "Copy",
"icon": "$(clippy)"
},
{
"command": "prompter.openTreeView",
"title": "Show Tree View",
"icon": "$(list-tree)"
},
{
"command": "prompter.openSettings",
@@ -42,7 +48,8 @@
"prompter-sidebar": [
{
"id": "prompterView",
"name": "Prompter"
"name": "Prompter",
"icon": "resources/icon.svg"
}
]
},
@@ -54,9 +61,14 @@
"when": "view == prompterView"
},
{
"command": "prompter.openSettings",
"command": "prompter.openTreeView",
"group": "navigation@2",
"when": "view == prompterView"
},
{
"command": "prompter.openSettings",
"group": "navigation@3",
"when": "view == prompterView"
}
],
"view/item/context": [
@@ -85,6 +97,7 @@
"@typescript-eslint/parser": "^8.25.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"ajv": "^8.17.0",
"eslint": "^9.21.0",
"ts-loader": "^9.5.2",
"typescript": "^5.7.3",
@@ -92,7 +105,6 @@
"webpack-cli": "^6.0.1"
},
"dependencies": {
"@vscode/vsce": "^3.2.2",
"ignore": "^7.0.3"
}
}

View File

@@ -60,26 +60,33 @@ export function activate(context: vscode.ExtensionContext) {
// Update formatting instructions button text if that setting changed
if (item.settingKey === 'includeFormattingInstructions') {
xmlEditsButton.text = prompterTreeProvider.isXmlEditsEnabled() ?
"$(check) Formatting Instructions" : "$(diff-added) Formatting Instructions";
"$(check) Formatting Instructions" : "$(diff-added) XML Edits";
}
}
}
});
// Create formatting instructions toggle button
const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
xmlEditsButton.text = "$(diff-added) Formatting Instructions";
const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 1);
xmlEditsButton.text = "$(diff-added) XML Edits";
xmlEditsButton.tooltip = "Toggle formatting instructions mode";
xmlEditsButton.command = 'prompter.toggleXmlEdits';
xmlEditsButton.show();
// Create copy button
const copyButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
const copyButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 3);
copyButton.text = "$(clippy) Copy";
copyButton.tooltip = "Generate and copy prompt";
copyButton.command = 'prompter.generatePrompt';
copyButton.show();
// Create settings button
const settingsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 2);
settingsButton.text = "$(settings-gear)";
settingsButton.tooltip = "Prompter Settings";
settingsButton.command = 'prompter.openSettings';
settingsButton.show();
// Register command to toggle file selection
let toggleSelectionCommand = vscode.commands.registerCommand('prompter.toggleSelection', (item: FileTreeItem) => {
if (item.resourceUri) {
@@ -95,13 +102,6 @@ export function activate(context: vscode.ExtensionContext) {
"$(check) XML Edits" : "$(diff-added) XML Edits";
});
// Create settings button
const settingsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
settingsButton.text = "$(settings-gear)";
settingsButton.tooltip = "Prompter Settings";
settingsButton.command = 'prompter.openSettings';
settingsButton.show();
// Register command to open settings
let openSettingsCommand = vscode.commands.registerCommand('prompter.openSettings', () => {
prompterTreeProvider.toggleSettingsView();
@@ -113,6 +113,11 @@ export function activate(context: vscode.ExtensionContext) {
"Show Files" : "Prompter Settings";
});
// Register command to show the tree view
let openTreeViewCommand = vscode.commands.registerCommand('prompter.openTreeView', () => {
prompterTreeProvider.showFilesView();
});
// Register command to generate prompt from selected files
let generatePromptCommand = vscode.commands.registerCommand('prompter.generatePrompt', async () => {
const selectedFiles = prompterTreeProvider.getSelectedFiles();
@@ -155,7 +160,8 @@ export function activate(context: vscode.ExtensionContext) {
toggleSelectionCommand,
toggleXmlEditsCommand,
generatePromptCommand,
openSettingsCommand
openSettingsCommand,
openTreeViewCommand
);
}
@@ -164,4 +170,4 @@ export function activate(context: vscode.ExtensionContext) {
*/
export function deactivate() {
// Clean up resources when the extension is deactivated
}
}

View File

@@ -32,6 +32,16 @@ export class PrompterTreeProvider implements vscode.TreeDataProvider<FileTreeIte
this.refresh();
}
showSettingsView(): void {
this.showingSettings = true;
this.refresh();
}
showFilesView(): void {
this.showingSettings = false;
this.refresh();
}
getTreeItem(element: FileTreeItem | SettingTreeItem): vscode.TreeItem {
// Return the element as is if it's a SettingTreeItem
if (element instanceof SettingTreeItem) {
@@ -75,7 +85,21 @@ export class PrompterTreeProvider implements vscode.TreeDataProvider<FileTreeIte
try {
const files = await vscode.workspace.fs.readDirectory(vscode.Uri.file(dirPath));
return files.map(([name, type]) => {
// Sort by type first (directories first), then alphabetically by name
const sortedFiles = [...files].sort((a, b) => {
const [nameA, typeA] = a;
const [nameB, typeB] = b;
// If types are different, directories (type 2) come before files (type 1)
if (typeA !== typeB) {
return typeB - typeA; // Descending order by type puts directories first
}
// If types are the same, sort alphabetically by name
return nameA.localeCompare(nameB, undefined, { sensitivity: 'base' });
});
return sortedFiles.map(([name, type]) => {
const filePath = path.join(dirPath, name);
const uri = vscode.Uri.file(filePath);