Here is the code that does that. In this example, you write a regular Alloy model file (where you specify the scope) and use this code then to run it, i.e., enumerate all solutions for each command present in the model file.
public void run(String filename) {
A4Reporter rep = new A4Reporter();
Module world = CompUtil.parseEverything_fromFile(rep, null, filename);
A4Options options = new A4Options();
options.solver = A4Options.SatSolver.SAT4J;
// options.symmetry = 0; // optionally turn off symmetry breaking
for (Command command: world.getAllCommands()) {
// Execute the command
A4Solution sol = TranslateAlloyToKodkod.execute_command(rep, world.getAllReachableSigs(), command, options);
while (sol.satisfiable()) {
System.out.println("[Solution]:");
System.out.println(sol.toString());
sol = sol.next();
}
}
}