* @brief Returns project structure assembled from a curated set of safe list commands. */
| 2337 | * @brief Returns project structure assembled from a curated set of safe list commands. |
| 2338 | */ |
| 2339 | QJsonObject AI::ToolDispatcher::getProjectState() const |
| 2340 | { |
| 2341 | static const QStringList kSafeListCommands = { |
| 2342 | QStringLiteral("project.group.list"), |
| 2343 | QStringLiteral("project.dataset.list"), |
| 2344 | QStringLiteral("project.action.list"), |
| 2345 | QStringLiteral("project.source.list"), |
| 2346 | QStringLiteral("project.dataTable.list"), |
| 2347 | QStringLiteral("project.workspace.list"), |
| 2348 | QStringLiteral("project.frameParser.getCode"), |
| 2349 | QStringLiteral("project.frameParser.getConfig"), |
| 2350 | }; |
| 2351 | |
| 2352 | QJsonObject state; |
| 2353 | for (const auto& name : kSafeListCommands) { |
| 2354 | if (!API::CommandRegistry::instance().hasCommand(name)) |
| 2355 | continue; |
| 2356 | |
| 2357 | state.insert(name, runSafeCommand(name)); |
| 2358 | } |
| 2359 | |
| 2360 | return state; |
| 2361 | } |
| 2362 | |
| 2363 | /** |
| 2364 | * @brief Returns the markdown reference body for the given scripting kind. |
no test coverage detected