What are the best open-source licenses to publish a project, without taking the risk to see it repacked into another project or commercial product? AGPL?
Open source licenses permit commercial usage. AGPL still fully permits it. Someone can still take your code and sell it as a commercial product. AGPL requires them to make the source code available to users even for a service. They aren't required to make it available to others.
A lot of companies will avoid GPLv3 code due to the terms conflicting with what they want and that's even more true for AGPLv3. If you release an application as AGPLv3, nothing in the license stops someone taking it and selling a product based on it without giving anything back.
Nope. It's designed to make sure that users (not the public or the project) are provided with the source code and can use it. It's based around giving users control. It's not meant to help the developers of the project, to make it sustainable, or to stop any commercial usage.
A lot of companies like Google and Amazon outright forbid using AGPL (any version). Many companies heavily restrict or outright forbid using GPLv3.
However, a company can still take your AGPLv3 code and sell it as a product as long as they release their derived source to users.
Companies like Google forbid it because they don't want to risk ending up in a situation where they end up with AGPLv3-based code in their services and would be in violation of the license without releasing their proprietary source code derived from the code.
See https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)….
There are licenses forbidding commercial usage, but they aren't considered open source licenses.
Part of the commonly accepted definition of open source is that the source code can be used for any endeavor including commercially.