Metadata-Version: 2.4
Name: sinol-make-ai-tools
Version: 0.1.0
Summary: A wrapper for sinol-make with tools for generating packages with AI.
Author-email: Wojciech Malinowski <wojciech.malinowski.100@gmail.com>
License-Expression: GPL-3.0
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

sinol-make-ai-tools is a wrapper for sinol-make that quickens the package building process. It is intended primarily for the organizers of WWI 2025. Future support and functionality are probably nonexistant, especially if sinol-make or the template package get changed.

Installation
First, install sinol-make. Refer to their repo for details:
https://github.com/sio2project/sinol-make/tree/main

Then install sinol-make-ai-tools with pipx:
pipx install sinol-make-ai-tools

Usage
sinol-make-ai-tools has an alias: smat.
Available commands:
smat init [id]
calls sinol-make init [id] -t https://git.staszic.waw.pl/top/template/default and creates the following folders and files in the root package directory:
in/
out/
description.txt - more on this in the workflow section
ai_file_blacklist.txt - more on this in the workflow section

smat prompt
Creats a prompt for an LLM of your choosing based on description.txt.

smat unserialize
Accepts LLM output through stdin (copy-paste) and modifies selected files.

smat clear
Clears in/ and out/ directories. I made this because sinol-make has a problem with overwriting previously generated tests.

Workflow
First and foremost, read the documentation of sinol-make:
https://github.com/sio2project/sinol-make/tree/main
Seriously, this is worth your time.

Let's say you want to build a package for a simple problem named Calculate Absolute Value. After reading the packaging channels on the SIO2 discord server and the sinol-make documentation and installing smat as per the instructions above, run
smat init abs
This creates a standard package with id abs with such a directory structure:
.
├── ai_file_blacklist.txt
├── config.yml
├── description.txt
├── doc
│   ├── abszad.tex
│   ├── licencja.pdf
│   ├── logo.pdf
│   └── spiral.cls
├── in
├── out
├── prog
│   ├── abs2.cpp
│   ├── absb1.cpp
│   ├── abschk.cpp
│   ├── abs.cpp
│   ├── absingen.cpp
│   ├── absinwer.cpp
│   ├── abss1.cpp
│   └── oi.h
└── README.md

You may want to remove and/or modify by yourself the following files: abs2.cpp, absb1.cpp, and abschk.cpp, because the current prompts generated by smat do not take into account these files and the features of sinol-make that they represent. Also, you may want to remove abss1.cpp and abss2.cpp, because it is up to the LLM how many subtasks and brute-force solutions it generates, and if it doesn't generate abss1.cpp or abss2.cpp, then the default contents (from the problem Sumżyce) will remain.

Except for the usual files, you also have description.txt and ai_file_blacklist.txt. description.txt only contains the package id by default:
description.txt
Kod zadania: abs.

ai_file_blacklist.txt only lists prog/oi.h and doc/spiral.cls by default:
ai_file_blacklist.txt
doc/spiral.cls
prog/oi.h

Append the problem statement to the contents of description.txt. It's better to use Polish, or else the LLM will have to translate the text. This can be copied from a pdf of an old problem or a codeforces problem, but make sure that the Input and Output sections are formatted nicely.

Save description.txt, make sure you're in the root package directory and call:
smat prompt
This creates a prompt from description.txt and saves it in prompt.txt. Copy the prompt and paste it into a LLM of your choice (I recommend google ai pro with gemini 2.5, the first month is free, and it's free for students for longer than a month). Before you hit enter (or ctrl-enter in gemini), you can modify the prompt. For example, you can add a hint for the LLM:
prompt.txt (after adding the hint)
...
Kod zadania: abs.
Oblicz wartość bezwględną x.
How would you solve this problem? Don't generate any code yet, just describe your solution. Hint: use abs from stl.

By default, the LLM is instructed to start with designing algorithms for all subtasks and not generate any code until instructed to do so. Sometimes it may generate code anyway, maybe because it's an important part of the explanation. After reviewing it's algorithm and maybe suggesting some changes, prompt it with the following question:
What tests will you include in the ingen file?

Review the proposed test classes and maybe suggest some changes. After that, prompt it with:
Now generate all package files.

The LLM should generate a single fenced code block with all the package files in a serialized format. Copy the contents. On some ai webpages clicking the copy button also copies other output and the fenced code block markers (three backticks); smat supports this by extracting what's inside the backticks.
Make sure you're in the root package directory and type this into your command line:
smat unserialize

You will be prompted for the LLM output. Hit enter to insert one more line and ctrl-D to input EOF (end of file, or end of input in this case). This will take the generated file contents and create or modify package file.

In an ideal world, this would be it. The package would always be bug-free and you could just call sinol-make verify and sinol-make export and add the package to your contest. Unfortunately, this is not the case. Please adhere to the following steps to minimize the chances of a problem:
- Write a solution to one of the subtasks by yourself. If you choose a brute-force solution to overwrite, check the main solution for obvious bugs regarding the input limits. I (the author of smat) think that this is a reasonable standard of decency that we should all follow. I already had a problem where a package seemed ok, but it turned out that gemini made the same mistake in both solutions.
- Run sinol-make gen, sinol-make run, sinol-make doc and sinol-make inwer to check if the generated code actually works.
- Take a look at the ingen, inwer, problem statement pdf, solution pdf, config.yml, ... that the LLM generated.
- Have someone else verify the package. You are not the verifier.

Also, here are some tips for quick bug elimination and general package creation:
- If you decide to overwrite some file generated by the LLM and you don't want your implementation to be overwritten by a future call to smat unserialize, then you can add the name of the file (with path relative to the root package directory) to ai_file_blacklist.txt.
- You can also change a file, but still have the LLM modify it if needed by saying: FYI, I changed file xyz, here is the new content: ...
- It is more effective to check and correct the LLM's ideas before it generates any code, as described above; this way the LLM doesn't generate new code based on previous bad code.
