B4J Code Snippet [B4X] Tips for AI - Vibe Coding !!!!

B4J 10.5 is a fact, and I think Erel should take the next step—we can help him somehow. I've already made some presentations on B4X and AI-powered coding to our Greek Union for Business Programmers... I believe B4X will gain more fans.

After some weeks of many tests and Excellent results - i am here to share some knowledge to all members of forums that will help them go at next level...

First of all I want to check this thread (@Blueforcer gave me great instructions):

After a lot of tests and creation of projects - I am sure that... gemini-cli can help you a lot !

I have some tips to share for GEMINI-CLI and specifically for GEMINI.MD - add those lines and you will remember me:
B4X:
## Project Overview
...
- **SQLite**: In the `b4j/yourproject` directory, you'll find all SQLite command-line tools. Use them to export SQLite schemas or work directly on `objects/yourdb.db`—but only after asking me twice if it involves anything beyond reading the schema.
...

## Using External APIs Instructions
1. In the `external_api` folder, you'll find plenty of information about the structure of XML and JSON files. PDF, DOC, XLS file can be here.
2. In the `external_api/examples` folder, you'll find some examples.

## File Handling
- When adding modules, classes, or handlers, also add them to the project file `yourproject.b4j` in the way B4X (specifically B4J) expects. This allows them to appear in the project with just a refresh, without needing manual imports.
- Note: When we say "main," we mean `yourproject.b4j`.

## Syntax Error Checking
- Compile the project after every change using this command:
"C:\Program Files\Anywhere Software\B4J\B4JBuilder.exe" -Task=Build -BaseFolder="D:\B4J\yourproject\" -Project="yourproject.b4j"
- If it returns an errorlevel different from 0, review your changes. Ultimately, consult the B4X documentation for correct syntax: [B4X Documentation](https://www.b4x.com/android/documentation.html).

2nd Step - very semantic - if you are using sqlite database...
Download SQLite CMD Line tools from here, unzip them in root folder of project and the gemini-cli will now have the hands to use them !

Also the Syntax Error Checking, give extra hands to your gemini-cli...

For those believe need to pay something... I am gonna say... that gemini cli.. no need a penny (until today) and using it with /auth (Login with Google account) - no need API key !!!

So I hope @Erel think next step for an extra window frame in b4j - as i have it as vision here:

* ;-) With 10% from sales, I can be a great consultant!
 
Last edited:

Magma

Expert
Licensed User
Longtime User
Another tip:

Someone gonna say... hey your solution can't create automatically ui... i m gonna say... you are wrong!

check this: https://www.b4x.com/android/forum/t...e-layouts-files-to-json-and-vice-versa.41623/

Now use your fantasy and make the changes to give the bal files with cmd arguments... to convert bal to json... and vice versa

Give the rules in MD file...

Now the AI can design too... not only write code...
 

aeric

Expert
Licensed User
Longtime User
Hi Magma,
Can you write a short tutorial how you use the CLI?
Which software we need to download?
Which file do we need to prepare? SKILL.MD or GEMINI.MD?
How do we upload this file in CLI?
 

Magma

Expert
Licensed User
Longtime User
Hi Magma,
Can you write a short tutorial how you use the CLI?
Which software we need to download?
Which file do we need to prepare? SKILL.MD or GEMINI.MD?
How do we upload this file in CLI?
i would try... to create a small video...

no need to upload anything all work at the project folder...for example if project folder is d:\b4j\test.

into there you gonna create a GEMINI
MD file... text with some headlines as i ve written
 

aeric

Expert
Licensed User
Longtime User
I will try to install using the Console Emulator of Laragon which has already have NodeJS and npm installed.
I hope it doesn't required big disk space or hungry like the "lobster".
 

Magma

Expert
Licensed User
Longtime User
I will try to install using the Console Emulator of Laragon which has already have NodeJS and npm installed.
I hope it doesn't required big disk space or hungry like the "lobster".
why taking different path... powershell is using node.js / npm very good... is like using terminal of debian...
 

aeric

Expert
Licensed User
Longtime User
why taking different path... powershell is using node.js / npm very good... is like using terminal of debian...
Just my personally dislike of Powershell. imo, Powershell is not as good as linux terminal or bash.
 

aeric

Expert
Licensed User
Longtime User
Installed.

1773681419443.png
 

Magma

Expert
Licensed User
Longtime User

Magma

Expert
Licensed User
Longtime User

aeric

Expert
Licensed User
Longtime User
GEMINI.MD and trust folder must be per Project !!! - otherwise the context will be huge for it... and not good for you ;-)
Great tips! Thanks.
 
Top