Compare commits
12 Commits
d2b09eefbe
...
0.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
a31a1bd3e2
|
|||
|
d6450fd597
|
|||
|
c4f97e252d
|
|||
|
77e4df420e
|
|||
|
f6467a82c2
|
|||
|
d895f58963
|
|||
| d9e44b78ce | |||
|
4b38333d23
|
|||
|
bea2ea2a0f
|
|||
|
8246879bea
|
|||
| 72f21325dd | |||
|
7aece43a6b
|
84
.gitea/workflows/release.yaml
Normal file
84
.gitea/workflows/release.yaml
Normal 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
|
||||||
24
package.json
24
package.json
@@ -2,9 +2,9 @@
|
|||||||
"name": "prompter",
|
"name": "prompter",
|
||||||
"displayName": "Prompter",
|
"displayName": "Prompter",
|
||||||
"description": "Easy prompt generation and apply edits using prompter.",
|
"description": "Easy prompt generation and apply edits using prompter.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"publisher": "abhishekbhakat",
|
"publisher": "abhishekbhakat",
|
||||||
"repository": "https://github.com/abhishekbhakat/prompter",
|
"repository": "https://git.bhakat.dev/abhishekbhakat/Prompter",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.98.0"
|
"vscode": "^1.98.0"
|
||||||
},
|
},
|
||||||
@@ -21,7 +21,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "prompter.generatePrompt",
|
"command": "prompter.generatePrompt",
|
||||||
"title": "Copy"
|
"title": "Copy",
|
||||||
|
"icon": "$(clippy)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "prompter.openTreeView",
|
||||||
|
"title": "Show Tree View",
|
||||||
|
"icon": "$(list-tree)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "prompter.openSettings",
|
"command": "prompter.openSettings",
|
||||||
@@ -42,7 +48,8 @@
|
|||||||
"prompter-sidebar": [
|
"prompter-sidebar": [
|
||||||
{
|
{
|
||||||
"id": "prompterView",
|
"id": "prompterView",
|
||||||
"name": "Prompter"
|
"name": "Prompter",
|
||||||
|
"icon": "resources/icon.svg"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -54,9 +61,14 @@
|
|||||||
"when": "view == prompterView"
|
"when": "view == prompterView"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "prompter.openSettings",
|
"command": "prompter.openTreeView",
|
||||||
"group": "navigation@2",
|
"group": "navigation@2",
|
||||||
"when": "view == prompterView"
|
"when": "view == prompterView"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "prompter.openSettings",
|
||||||
|
"group": "navigation@3",
|
||||||
|
"when": "view == prompterView"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"view/item/context": [
|
"view/item/context": [
|
||||||
@@ -85,6 +97,7 @@
|
|||||||
"@typescript-eslint/parser": "^8.25.0",
|
"@typescript-eslint/parser": "^8.25.0",
|
||||||
"@vscode/test-cli": "^0.0.10",
|
"@vscode/test-cli": "^0.0.10",
|
||||||
"@vscode/test-electron": "^2.4.1",
|
"@vscode/test-electron": "^2.4.1",
|
||||||
|
"ajv": "^8.17.0",
|
||||||
"eslint": "^9.21.0",
|
"eslint": "^9.21.0",
|
||||||
"ts-loader": "^9.5.2",
|
"ts-loader": "^9.5.2",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
@@ -92,7 +105,6 @@
|
|||||||
"webpack-cli": "^6.0.1"
|
"webpack-cli": "^6.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vscode/vsce": "^3.2.2",
|
|
||||||
"ignore": "^7.0.3"
|
"ignore": "^7.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,26 +60,33 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
// Update formatting instructions button text if that setting changed
|
// Update formatting instructions button text if that setting changed
|
||||||
if (item.settingKey === 'includeFormattingInstructions') {
|
if (item.settingKey === 'includeFormattingInstructions') {
|
||||||
xmlEditsButton.text = prompterTreeProvider.isXmlEditsEnabled() ?
|
xmlEditsButton.text = prompterTreeProvider.isXmlEditsEnabled() ?
|
||||||
"$(check) Formatting Instructions" : "$(diff-added) Formatting Instructions";
|
"$(check) Formatting Instructions" : "$(diff-added) XML Edits";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create formatting instructions toggle button
|
// Create formatting instructions toggle button
|
||||||
const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
const xmlEditsButton = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 1);
|
||||||
xmlEditsButton.text = "$(diff-added) Formatting Instructions";
|
xmlEditsButton.text = "$(diff-added) XML Edits";
|
||||||
xmlEditsButton.tooltip = "Toggle formatting instructions mode";
|
xmlEditsButton.tooltip = "Toggle formatting instructions mode";
|
||||||
xmlEditsButton.command = 'prompter.toggleXmlEdits';
|
xmlEditsButton.command = 'prompter.toggleXmlEdits';
|
||||||
xmlEditsButton.show();
|
xmlEditsButton.show();
|
||||||
|
|
||||||
// Create copy button
|
// 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.text = "$(clippy) Copy";
|
||||||
copyButton.tooltip = "Generate and copy prompt";
|
copyButton.tooltip = "Generate and copy prompt";
|
||||||
copyButton.command = 'prompter.generatePrompt';
|
copyButton.command = 'prompter.generatePrompt';
|
||||||
copyButton.show();
|
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
|
// Register command to toggle file selection
|
||||||
let toggleSelectionCommand = vscode.commands.registerCommand('prompter.toggleSelection', (item: FileTreeItem) => {
|
let toggleSelectionCommand = vscode.commands.registerCommand('prompter.toggleSelection', (item: FileTreeItem) => {
|
||||||
if (item.resourceUri) {
|
if (item.resourceUri) {
|
||||||
@@ -95,13 +102,6 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
"$(check) XML Edits" : "$(diff-added) XML Edits";
|
"$(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
|
// Register command to open settings
|
||||||
let openSettingsCommand = vscode.commands.registerCommand('prompter.openSettings', () => {
|
let openSettingsCommand = vscode.commands.registerCommand('prompter.openSettings', () => {
|
||||||
prompterTreeProvider.toggleSettingsView();
|
prompterTreeProvider.toggleSettingsView();
|
||||||
@@ -113,6 +113,11 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
"Show Files" : "Prompter Settings";
|
"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
|
// Register command to generate prompt from selected files
|
||||||
let generatePromptCommand = vscode.commands.registerCommand('prompter.generatePrompt', async () => {
|
let generatePromptCommand = vscode.commands.registerCommand('prompter.generatePrompt', async () => {
|
||||||
const selectedFiles = prompterTreeProvider.getSelectedFiles();
|
const selectedFiles = prompterTreeProvider.getSelectedFiles();
|
||||||
@@ -155,7 +160,8 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
toggleSelectionCommand,
|
toggleSelectionCommand,
|
||||||
toggleXmlEditsCommand,
|
toggleXmlEditsCommand,
|
||||||
generatePromptCommand,
|
generatePromptCommand,
|
||||||
openSettingsCommand
|
openSettingsCommand,
|
||||||
|
openTreeViewCommand
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,16 @@ export class PrompterTreeProvider implements vscode.TreeDataProvider<FileTreeIte
|
|||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showSettingsView(): void {
|
||||||
|
this.showingSettings = true;
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
showFilesView(): void {
|
||||||
|
this.showingSettings = false;
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
getTreeItem(element: FileTreeItem | SettingTreeItem): vscode.TreeItem {
|
getTreeItem(element: FileTreeItem | SettingTreeItem): vscode.TreeItem {
|
||||||
// Return the element as is if it's a SettingTreeItem
|
// Return the element as is if it's a SettingTreeItem
|
||||||
if (element instanceof SettingTreeItem) {
|
if (element instanceof SettingTreeItem) {
|
||||||
@@ -75,7 +85,21 @@ export class PrompterTreeProvider implements vscode.TreeDataProvider<FileTreeIte
|
|||||||
try {
|
try {
|
||||||
const files = await vscode.workspace.fs.readDirectory(vscode.Uri.file(dirPath));
|
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 filePath = path.join(dirPath, name);
|
||||||
const uri = vscode.Uri.file(filePath);
|
const uri = vscode.Uri.file(filePath);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user