Skip to content

feat: add web project templates (HTML, PHP, JS)#66

Open
Degrace15 wants to merge 12 commits into
Acode-Foundation:mainfrom
Degrace15:main
Open

feat: add web project templates (HTML, PHP, JS)#66
Degrace15 wants to merge 12 commits into
Acode-Foundation:mainfrom
Degrace15:main

Conversation

@Degrace15

Copy link
Copy Markdown

Ce plugin permet de générer rapidement des structures de dossiers et de fichiers de base pour les projets web (HTML, PHP, JavaScript). Cela permet de gagner du temps lors de la création d'un nouveau projet dans Acode.

Pourquoi ce changement ?

Faciliter le démarrage des nouveaux projets pour les utilisateurs.

Comment tester ?

  1. Installer le plugin.
  2. Accéder au menu de création de projet.
  3. Sélectionner le template voulu.

Degrace15 added 3 commits July 3, 2026 18:03
Quickly generate boilerplate project templates for HTML, PHP, and JavaScript.
@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the placeholder stub with a working Acode plugin that generates boilerplate project files (HTML5, PHP, or JavaScript) in the user's active workspace folder using Acode's native acode.require() API pattern throughout.

  • main.js (new): registers a project-creator command that prompts the user to pick a template via acode.require(\"select\"), then writes the starter files using acode.require(\"fsOperation\"), with a guarded fileList.refresh() call afterwards.
  • plugin.json: updated with a proper plugin ID, author, description, keywords, and corrected schema URL; minVersionCode, license, and price are all retained.
  • README.md (new): documents features, usage steps, and the folder structure each template creates.

Confidence Score: 4/5

The core template-generation logic works correctly when all Acode modules are available, but two require() calls sit outside the try/catch, leaving a silent failure path if either module is absent.

The acode.require("openFolder") and acode.require("select") calls on lines 11 and 20 are executed before the try block begins. If either returns null, the very next line throws a TypeError that is never caught, so the user gets no error dialog and the command silently fails.

main.js — the error-handling boundary needs to extend up to cover the openFolder and select require() calls.

Important Files Changed

Filename Overview
main.js New plugin implementation: properly uses acode.require() for all APIs, but two require() calls and the select() invocation sit outside the try/catch, leaving an unhandled TypeError path if either module is unavailable.
plugin.json Manifest updated with correct plugin ID, author, description, keywords, and schema URL; minVersionCode, license, and price fields are retained.
README.md New documentation file describing features, usage steps, and generated project structure.
icon.png Plugin icon replaced with a new image.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant Acode
    participant Plugin as Project Creator Plugin
    participant FS as fsOperation

    User->>Acode: Runs "Open Project Creator" command
    Acode->>Plugin: exec()
    Plugin->>Acode: require("openFolder")
    Acode-->>Plugin: openFolder module
    Plugin->>Plugin: read openFolder.target (active folder)
    alt No active folder
        Plugin->>User: alert("Please open a folder first")
    else Active folder found
        Plugin->>Acode: require("select")
        Acode-->>Plugin: select function
        Plugin->>User: Show template picker (HTML / PHP / JS)
        User-->>Plugin: choice
        Plugin->>Acode: require("fsOperation")
        Acode-->>Plugin: fsOperation
        Plugin->>FS: createFile(filename, content)
        FS-->>Plugin: done
        Plugin->>Acode: require("fileList")
        Plugin->>Acode: fileList.refresh()
        Plugin->>User: toast("Created successfully")
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant Acode
    participant Plugin as Project Creator Plugin
    participant FS as fsOperation

    User->>Acode: Runs "Open Project Creator" command
    Acode->>Plugin: exec()
    Plugin->>Acode: require("openFolder")
    Acode-->>Plugin: openFolder module
    Plugin->>Plugin: read openFolder.target (active folder)
    alt No active folder
        Plugin->>User: alert("Please open a folder first")
    else Active folder found
        Plugin->>Acode: require("select")
        Acode-->>Plugin: select function
        Plugin->>User: Show template picker (HTML / PHP / JS)
        User-->>Plugin: choice
        Plugin->>Acode: require("fsOperation")
        Acode-->>Plugin: fsOperation
        Plugin->>FS: createFile(filename, content)
        FS-->>Plugin: done
        Plugin->>Acode: require("fileList")
        Plugin->>Acode: fileList.refresh()
        Plugin->>User: toast("Created successfully")
    end
Loading

Reviews (4): Last reviewed commit: "Update plugin.json" | Re-trigger Greptile

Comment thread main.js Outdated
Comment thread plugin.json Outdated
Comment thread plug.json Outdated
Deleting of this files
@Degrace15

Copy link
Copy Markdown
Author

Thanks for the review! You are completely right, it's still a work in progress. I will close this PR for now and work on the project creation logic locally. I'll submit a new PR once the templates are fully functional!"

@Degrace15 Degrace15 closed this Jul 3, 2026
@Degrace15 Degrace15 reopened this Jul 3, 2026
@Degrace15

Copy link
Copy Markdown
Author

Thanks for the review! You are completely right, it's still a work in progress. I will close this PR for now and work on the project creation logic locally. I'll submit a new PR once the templates are fully functional!"

@Degrace15 Degrace15 closed this Jul 3, 2026
I do an update of main.js
@Degrace15 Degrace15 reopened this Jul 3, 2026
Comment thread main.js Outdated
Comment thread main.js
@Degrace15

Degrace15 commented Jul 3, 2026 via email

Copy link
Copy Markdown
Author

@Degrace15

Copy link
Copy Markdown
Author

Greptile Summary

This PR replaces the earlier stub with a real implementation of the Project Creator plugin, adding template generation for HTML5, PHP, and JavaScript projects. However, the core command handler calls several Acode API methods that do not exist on the global acode object, making the plugin non-functional at runtime.

  • main.js: Registers a command that lets users pick a project type and writes starter files into the current folder, but uses acode.getFolder(), acode.select(), and acode.refreshFileList() — none of which exist; the correct pattern is acode.require('openFolder'), acode.require('select'), and acode.require('fileList'). fsOperation is also referenced as a bare global instead of being obtained via acode.require('fsOperation').
  • plugin.json: Plugin identity updated to com.degrace.projectcreator, but several ecosystem-required fields ($schema, minVersionCode, license, permissions, keywords, price) were removed in a prior diff.
  • README.md: New documentation added, though the Roadmap section still marks all three templates as incomplete.

Confidence Score: 3/5

The plugin will throw a TypeError on every invocation and produce no output for users — not ready to merge.

Every call path through the command handler hits at least one non-existent Acode API (acode.getFolder, acode.select, acode.refreshFileList). The first call fails immediately, so no template is ever written. A secondary issue — fsOperation used as an undeclared global — would break file creation even if the earlier calls were fixed. The plugin is fully broken at runtime despite appearing structurally complete.

main.js requires the most attention: all Acode API calls need to be replaced with their acode.require(...) equivalents before the plugin can function.

Important Files Changed

Filename Overview
main.js Implements template generation logic but calls three non-existent Acode API methods (acode.getFolder, acode.select, acode.refreshFileList) and uses fsOperation as an undeclared global — the plugin will throw on every invocation.
plugin.json Plugin ID and name updated to reflect the new feature; several important manifest fields (minVersionCode, $schema, license, permissions, keywords, price) were removed.
README.md New documentation file added; roadmap still lists all three templates as unchecked even though the implementation is present.
icon.png Binary icon replaced — no code-level concerns.

Flowchart

mermaid %%{init: {'theme': 'neutral'}}%% flowchart TD A[User runs project-creator command] --> B["acode.getFolder() ❌ does not exist"] B -->|TypeError thrown| Z[Command silently fails] B -->|If folder found| C["acode.select(...) ❌ does not exist"] C -->|TypeError thrown| Z C -->|If choice made| D["fsOperation(url) ⚠️ undeclared global"] D --> E{Template choice} E -->|html| F["fs.createFile × 3"] E -->|php| G["fs.createFile × 1"] E -->|js| H["fs.createFile × 1"] F & G & H --> I["acode.refreshFileList() ❌ does not exist"] I -->|TypeError caught| J["catch: shows error dialog even though files were created"] I -->|If exists| K[window.toast success] Loading %%{init: {'theme': 'neutral'}}%% flowchart TD A[User runs project-creator command] --> B["acode.getFolder() ❌ does not exist"] B -->|TypeError thrown| Z[Command silently fails] B -->|If folder found| C["acode.select(...) ❌ does not exist"] C -->|TypeError thrown| Z C -->|If choice made| D["fsOperation(url) ⚠️ undeclared global"] D --> E{Template choice} E -->|html| F["fs.createFile × 3"] E -->|php| G["fs.createFile × 1"] E -->|js| H["fs.createFile × 1"] F & G & H --> I["acode.refreshFileList() ❌ does not exist"] I -->|TypeError caught| J["catch: shows error dialog even though files were created"] I -->|If exists| K[window.toast success] mermaid %%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[User runs project-creator command] --> B["acode.getFolder() ❌ does not exist"] B -->|TypeError thrown| Z[Command silently fails] B -->|If folder found| C["acode.select(...) ❌ does not exist"] C -->|TypeError thrown| Z C -->|If choice made| D["fsOperation(url) ⚠️ undeclared global"] D --> E{Template choice} E -->|html| F["fs.createFile × 3"] E -->|php| G["fs.createFile × 1"] E -->|js| H["fs.createFile × 1"] F & G & H --> I["acode.refreshFileList() ❌ does not exist"] I -->|TypeError caught| J["catch: shows error dialog even though files were created"] I -->|If exists| K[window.toast success] Loading Unable to render rich display Could not find a suitable point for the given distance For more information, see https://docs.github.com/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams %%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[User runs project-creator command] --> B["acode.getFolder() ❌ does not exist"] B -->|TypeError thrown| Z[Command silently fails] B -->|If folder found| C["acode.select(...) ❌ does not exist"] C -->|TypeError thrown| Z C -->|If choice made| D["fsOperation(url) ⚠️ undeclared global"] D --> E{Template choice} E -->|html| F["fs.createFile × 3"] E -->|php| G["fs.createFile × 1"] E -->|js| H["fs.createFile × 1"] F & G & H --> I["acode.refreshFileList() ❌ does not exist"] I -->|TypeError caught| J["catch: shows error dialog even though files were created"] I -->|If exists| K[window.toast success]
Reviews (3): Last reviewed commit: "Update main.js" | Re-trigger Greptile

@Degrace15 Degrace15 closed this Jul 4, 2026
@Degrace15 Degrace15 reopened this Jul 4, 2026
Comment thread main.js Outdated
New update
@Degrace15

Degrace15 commented Jul 4, 2026 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant