|
|
#1 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,421
Karma: 6733960
Join Date: Nov 2009
Device: many
|
Claude AI to generate Sigil Plugins?
Hi All,
I wanted to pick people's brain about using the Claude AI to create a working Sigil plugin. Obviously I could do that myself easily but I wanted to see how hard/easy it would be for someone without any python coding experience to actually create a simple plugin using Claude. So I had some questions: 1. Do I have to pay for using Claude to make a simple plugin for Sigil? Do they have any free subscriptions for OpenSource developers? 2. Have you tried something similar with Claude or OpenAI Coder? 3. If so, how good or bad was the attempt and how much manual work was needed to actually get things to work. As an example project, I want to try using Claude to code up a Sigil edit plugin to allow a user select one or more html files and have them be read in (with all supporting resources via their links) and pre-process each html file by removing all <script> tags that do not have a src attribute. This is really trivial to do in Sigil with PySide6 and regex, but I wanted to see for myself how this is done and what the state of the art can accomplish right now and as a learning experience for me to see how quickly I will become obsolete! So happy to hear any thoughts, suggestions, and hints on how to go about doing this myself so I can see how things turn out. And I have enough plugins of my own that I can use them to "train" Clause if needed, and I will NOT give it anyone else's code, only my own to learn from if needed. So if anyone has any tips on how to go about this on Linux, I would really like to hear your thoughts? Thanks, KevinH |
|
|
|
|
|
#2 |
|
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,349
Karma: 113121827
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
If it works, it's using code copied from elsewhere.
I know someone ordered by management to use AI and everything is far slower as it all has to be tested and re-written. It's a scam. |
|
|
|
|
|
#3 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,421
Karma: 6733960
Join Date: Nov 2009
Device: many
|
There is no exact code that does what I hoped to do in a plugin right now. Perhaps you missed the part about doing this as a learning experience and to see the state of the art myself to judge. If it fails miserably, then I will not be obsolete quickly. If it succeeds with just a little hand holding and guidance then I can point people who request Sigil features that are not a good fit for Sigil to try their hand at a plugin.
As a learning experience, it is a win win for me no matter how it turns out. And as for licensing, I give my plugin code away, so if it trains on it, nothing is lost. Last edited by KevinH; 03-08-2026 at 05:30 PM. |
|
|
|
|
|
#4 | |||
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,800
Karma: 24088595
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
I tested both Claude and Perplexity. They can both generate simple plugins with minimal corrections. BeckyEbook also experimented with this. Quote:
Quote:
I tested this with Claude. The first version was this: Spoiler:
It hallucinated quite a bit. When I pointed out that Sigil uses bk not bc it slightly changed the code and came up with: Spoiler:
It also generated this incorrect plugin.xml file: Spoiler:
After fixing plugin.xml the plugin kind of works. For example it'll remove: Code:
<link rel="manifest" href="https://www.alternatehistory.com/forum/webmanifest.php"> Code:
<link href="../Styles/sgc-nav.css" rel="stylesheet" type="text/css"/> Claude also has a skills concept. I haven't tested it, though. Maybe you could define a Sigil plugin skill? Last edited by Doitsu; 03-08-2026 at 06:14 PM. |
|||
|
|
|
|
|
#5 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,164
Karma: 211504714
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Please take your bias elsewhere. No one asked for your opinions on AI generated code in general. Answer the questions asked or refrain from commenting please.
|
|
|
|
|
|
#6 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,421
Karma: 6733960
Join Date: Nov 2009
Device: many
|
That is interesting. I had never heard of Perplexity before. Did you ask Claude to read the Sigil Plugin Framework document and use its api, or just give it a few example Sigil plugins? If not, how else would it know the structure a Sigil plugin requires? As the author of the Sigil Plugin Framework, I would be okay with that, especially if it helps novices write their own Sigil plugins.
And, I just noticed that Anthropic is giving away 10,000 free Claude Max accounts for 6 months to active OpenSource developers with public projects on github with more than 5000 stars. Sigil has 6,700 stars so I think DiapDealer or I (or both of us) may qualify. If not, I will look at other free account options. Thanks for your tips! KevinH Quote:
|
|
|
|
|
|
|
#7 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,800
Karma: 24088595
Join Date: Dec 2010
Device: Kindle PW2
|
No, I just gave it an incorrectly formatted HTML file and told it to write a Sigil plugin that removes all problematic sections using python.
|
|
|
|
|
|
#8 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,421
Karma: 6733960
Join Date: Nov 2009
Device: many
|
|
|
|
|
|
|
#9 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,066
Karma: 29579868
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@KevinH: You will likely already have free access to claude (and other models) via GitHub copilot. And yes this kind of thing will be fairly trivial for copilot to get almost entirely correct in agentic mode. And you dont need to install anything on your computer to use it. Simply go to https://github.com/copilot and use the chat interface to ask copilot to send a PR or generate code whatever suits the use case. A few sentences (3-4) of instructions will likely generate largely working code. I'll leave you a couple of examples of doing this via PRs in calibre. Note that though the PRs are marked closed they were actually merged (I squash the commits and merge as a single commit).
https://github.com/kovidgoyal/calibre/pull/3023 https://github.com/kovidgoyal/calibre/pull/3024 https://github.com/kovidgoyal/calibre/pull/3026 |
|
|
|
|
|
#10 | ||
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,421
Karma: 6733960
Join Date: Nov 2009
Device: many
|
Wow I am astonished! I created an empty repo in my personal github account just as a playground: (notice I could not spell generator correctly but !)
https://github.com/kevinhendricks/plugin_generatior And used the initial following prompt: Quote:
https://github.com/kevinhendricks/pl...1-4e23cf279e7a So after accepting their initial attempt, I added the Sigil_Plugin_Framework_rev15.epub file to the repo and then opened a second agent request: Quote:
https://github.com/kevinhendricks/pl...8-4019c89bea1b I then built and tested the resulting plugin (zipping it by hand) and it actually worked correctly. I never actually touched one line of code and instead just gave commands to fix errors in the plugin.xml file based on the api docs alone. I am truly astonished. Copilot does store your the exact text of your request but it was not easy to find (you have to look in a PR's edit history) so I quickly learned to copy each one of them to a separate text editor for safe keeping). What is more fun is looking at the Agents tab in my repo and seeing the reasoning and logic for what it did in response to each of my two queries. It is truly amazing. I can easily see how continuously refining requests from an experienced programmer could easily speed up creation of coding project. I am still not sure that a non-programmer could actually succeed with this tool as it stands now. My plan it to use the Agent to refine the existing plugin to use chardet to handle the cases where the base html encoding is not utf-8 but Windows-1252 or some other iso 8 bit encoding. Then have it run each page though our sigil_gumbo library to handle any other issues in its structure before adding it to the existing epub. This technology is going to make experienced programmers much more effective as the Agent will listen to the programmer's preferred tools and approaches and can absorb and use api documentation. Thank you to everyone for their guidance and especially Kovid in his examples and where exactly to go to get started and Doitsu for his specific examples. Last edited by KevinH; Today at 04:27 PM. Reason: update with info from Comfy.n |
||
|
|
|
|
|
#11 | |
|
want to learn what I want
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,007
Karma: 7955879
Join Date: Sep 2020
Device: none
|
Quote:
![]() BTW, I can see the original prompt under PR edits: |
|
|
|
|
|
|
#12 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,421
Karma: 6733960
Join Date: Nov 2009
Device: many
|
Quote:
Thank you! Last edited by KevinH; Today at 04:28 PM. |
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Errors Using plugins with Sigil | increase | Plugins | 3 | 03-06-2020 05:08 AM |
| Sigil Plugins! | DiapDealer | Sigil | 33 | 03-19-2016 08:18 PM |
| Sigil Plugins (for Sigil 0.7xx Alpha) | DiapDealer | Sigil | 15 | 09-27-2014 05:21 PM |
| Sigil translations: how to generate .qm from .ts? | yucca | Sigil | 8 | 04-10-2013 09:25 PM |
| Have sigil not generate inline CSS | Hellmark | Sigil | 3 | 01-27-2012 01:16 PM |