LUKE TOOLS — AUTOMATIC LOADING FOR WICK EDITOR FORKS
For Stickmanred, Candlestick, and other Wick Editor-based forks

WHAT THIS DOES

At present, LukeTools can be added to a Wick project as a .wickobj. That works,
but it means the LukeTools object has to be added again for each new project.

LukeToolsAutoLoad.js moves the LukeTools bridge out of the individual Wick
project and into the editor application itself.

Once the fork maintainer adds the JavaScript file to the editor, LukeTools
loads automatically whenever the editor opens.

Users do not need to:
1. Import a LukeTools .wickobj.
2. Add anything to the Wick project timeline.
3. Copy the LukeTools object into every new project.

The Wick project remains separate from LukeTools.


FILE TO ADD

Use:

LukeToolsAutoLoad_GPT.js

For a production repository I recommend renaming it to:

LukeToolsAutoLoad.js


OPTION A — SIMPLEST METHOD: ADD IT TO THE PUBLIC FOLDER

This is the easiest method for most Wick Editor forks.

1. Copy LukeToolsAutoLoad.js into the fork's public folder.

For example:

public/LukeToolsAutoLoad.js

2. Open the HTML file used to start the editor.

Depending on the fork this may be:

public/index.html

or another HTML entry file.

3. Add this line immediately before the closing </body> tag:

<script src="%PUBLIC_URL%/LukeToolsAutoLoad.js"></script>

If the fork does not use Create React App's %PUBLIC_URL%, use:

<script src="/LukeToolsAutoLoad.js"></script>

4. Rebuild or restart the fork.

5. Open the editor.

LukeTools should create its launcher automatically after the Wick interface
has mounted.


OPTION B — IMPORT IT FROM THE APPLICATION SOURCE

If the fork maintainer prefers LukeTools to be part of the JavaScript build,
place the file somewhere under src.

For example:

src/LukeTools/LukeToolsAutoLoad.js

Then import it once from the editor application's main entry file:

import "./LukeTools/LukeToolsAutoLoad";

The important point is that it must be imported only once.

Do not import it from a component that repeatedly mounts and unmounts.

LukeTools has its own guard against duplicate loading, but loading it once from
the application entry point is cleaner.


GOOD PLACES TO IMPORT IT

Typical entry files include:

src/index.js
src/index.jsx
src/main.js
src/main.jsx
src/App.js

The exact filename depends on the fork.


HOW IT STARTS

LukeTools waits briefly for the Wick interface to appear.

It looks for the Wick canvas container:

wick-canvas-container

If that is present, the LukeTools launcher is attached there.

If it is not present immediately, LukeTools observes the document until the
editor interface has been created.

This makes it suitable for React-based Wick forks where the interface appears
after the initial HTML document loads.


EDITOR ACCESS

LukeTools attempts to locate the Wick editor through several common globals:

window.wickEditor
window.WickEditor.editor
window.editor
window.app

This is deliberate so that it can work across Wick Editor and compatible
forks without requiring the LukeTools .wickobj.


CONFIGURATION

LukeTools currently loads its tool configuration from:

https://raw.githubusercontent.com/lukeo25/WickTools/main/Config.json

That means the individual tool list can continue to be updated from the
WickTools repository without requiring the fork to be rebuilt every time the
Config.json file changes.

IMPORTANT:

Config.json must contain valid JSON.

The first non-whitespace character should normally be:

{

Do not place version notes, filenames, comments, or other text before the JSON.


HOW TO TEST THE INSTALLATION

Open the fork and then open the browser developer console.

You should see LukeTools activity.

The LukeTools button should appear with the Wick editor controls.

Click the LukeTools button.

The LukeTools panel should open and the Config.json tool buttons should be
available.


QUICK CONSOLE CHECK

Paste this into the browser console:

console.log("LukeTools runtime:", window.LukeToolsRuntime);
console.log("LukeTools panel:", document.getElementById("luke_tools_panel_271"));
console.log("LukeTools launcher:", document.getElementById("luke_tools_launcher_271"));

If LukeTools has loaded, the runtime and interface elements should be visible.


IF THE BUTTON DOES NOT APPEAR

First check:

document.getElementById("wick-canvas-container")

If it returns an element, LukeTools has found the expected Wick canvas
container.

Then check:

window.wickEditor
window.WickEditor
window.editor
window.app

The fork may expose its editor instance differently from the original Wick
Editor.

If Stickmanred or Candlestick uses a different editor global, that global can
be added to the getEditor() function in LukeToolsAutoLoad.js.


IF CONFIG.JSON REPORTS BADJSON

Test the configuration directly:

fetch("https://raw.githubusercontent.com/lukeo25/WickTools/main/Config.json?t=" + Date.now())
    .then(function (response) {
        return response.text();
    })
    .then(function (text) {
        console.log(text);
        console.log(JSON.parse(text));
    })
    .catch(function (error) {
        console.error(error);
    });

If JSON.parse fails, the problem is in Config.json rather than in the fork.


FOR STICKMANRED AND CANDLESTICK MAINTAINERS

The intended integration is deliberately small:

1. Add LukeToolsAutoLoad.js to the editor application.
2. Load/import it once when the editor starts.
3. Do not add the LukeTools .wickobj to projects.
4. Leave the user's Wick document untouched.
5. LukeTools retrieves its current Config.json from the WickTools repository.

The main advantage is that LukeTools becomes an editor-level optional toolset
rather than project content.


UPDATING LUKE TOOLS

If LukeToolsAutoLoad.js itself changes, replace the copy held by the fork and
rebuild.

Changes made only to Config.json or the individual remote LukeTools scripts do
not normally require a rebuild of the fork because LukeTools retrieves those
resources at runtime.


ABOUT THIS VERSION

This standalone file was made from the LukeTools V4 bridge, version 2.8.12.

The significant difference is that the JavaScript is loaded by the editor
application rather than being executed from a Clip inside a .wickobj.

That is what removes the need to insert LukeTools into every project.
