Skip to content

Mulang a pilas-app#355

Merged
rgonzalezt merged 14 commits into
developfrom
mulang
Jun 29, 2026
Merged

Mulang a pilas-app#355
rgonzalezt merged 14 commits into
developfrom
mulang

Conversation

@rgonzalezt

@rgonzalezt rgonzalezt commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Hago el draft con el trabajazo de @danielferro69 así lo podemos ver mejor!!

resolves #255
resolves #256

@rgonzalezt rgonzalezt marked this pull request as ready for review June 22, 2026 18:12
@rgonzalezt rgonzalezt requested a review from a team as a code owner June 22, 2026 18:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates Mulang-based static analysis/expectations into the Blockly execution flow, surfacing feedback both as block warnings and in the end-of-challenge dialog, and wires Mulang into the build/runtime via a copied browser bundle.

Changes:

  • Adds Mulang parsing/expectations + validation pipeline (runBlocklyValidations) and connects it to run/step execution.
  • Updates the end dialog to display “scored expectations” results alongside the solved status.
  • Adds build/runtime wiring for Mulang (dependency + postinstall copy to public/assets + script include) and new i18n resources.

Reviewed changes

Copilot reviewed 28 out of 32 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
src/types/mulang.d.ts Declares global mulang / window.mulang types.
src/test/unit/components/interpreter.test.tsx Updates mocks for i18n + blockly/core and new hook return fields.
src/components/challengeView/SceneButtons/useInterpreterRunner.ts Adds validation hook-in + mulang results/solved state + clears highlights.
src/components/challengeView/SceneButtons/StepByStep.tsx Runs Blockly validations before step execution; passes results to end dialog.
src/components/challengeView/SceneButtons/Execute.tsx Runs Blockly validations before full execution; passes results to end dialog.
src/components/challengeView/SceneButtons/interpreterFactory.ts Implements block highlighting + clearing.
src/components/challengeView/SceneButtons/EndChallengeDialog.tsx Replaces old “congratulations” modal with scored-expectations UI.
src/components/blockly/utils.ts Updates warning visibility API usage.
src/components/blockly/blockly.ts Updates warning visibility API usage in variable revalidation.
src/components/blockly/blocklyValidations.ts Adds missing-input validation + Mulang analysis + block feedback.
src/components/blockly/mulang/pilasMulangAnalyzer.ts Adds Mulang analysis bridge (AST -> mulang -> expectation results).
src/components/blockly/mulang/pilasMulang.ts Adds Blockly workspace -> Mulang AST parsing.
src/components/blockly/mulang/pilasAst.ts Adds minimal AST node helpers/types.
src/components/blockly/mulang/mulangResults.ts Adds Mulang result decoding/typing.
src/components/blockly/mulang/expectations.ts Adds expectation DSL builders + encoding/decoding helpers.
src/components/blockly/mulang/expectationMessages.ts Adds i18n message lookup for failed expectations.
src/components/blockly/mulang/challengeExpectations.ts Maps challenge config -> expectation generation.
src/components/blockly/mulang/blockUtils.ts Adds workspace utilities used by expectations.
src/components/blockly/mulang/blockFeedback.ts Shows Mulang feedback as Blockly warnings on relevant blocks.
scripts/copyMulang.js Copies/paches Mulang bundle into public/assets and exposes window.mulang.
scripts/remove-mulang-require.js Adds a patch helper (currently not wired into scripts).
package.json / package-lock.json Adds Mulang dependency and postinstall hook to copy it.
locales/*/mulang.json Adds Mulang expectation/suggestion translations.
locales/*/challenge.json Adds scored-expectations modal translations.
index.html Loads Mulang bundle at runtime.
.gitignore Ignores .vscode/settings.json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +84 to 96
highlightBlock(id: any) {
const blockId = id ? id.toString() : ''
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg

if (!blockId || !workspace) return

workspace.highlightBlock(blockId)
}

clearHighlight() {
const workspace = Blockly.getMainWorkspace() as Blockly.WorkspaceSvg
workspace?.highlightBlock(null)
}
@@ -91,23 +109,33 @@ export const useInterpreterRunner = (
}, [challenge, mode, setRunning, getBlocklyXML]);

setMulangResults(validationResult?.mulangResults || [])

executeUntilEnd();
Comment on lines 250 to 252
if (block.warning && typeof block.warning.setVisible === 'function') {
block.warning.setVisible(false);
block.warning.setBubbleVisible(false);
}
Comment on lines 109 to 114
const addWarningToBlock = (block: { setWarningText?: any; warning: any; }, itemChar: string, message: string, index: any, colour: string, secondaryColour: string, visible = true) => {
const text = `${itemChar} ${lineWrap(message)}`
block.setWarningText(text, index)
setWarningColour(block, colour, secondaryColour)
block.warning.setVisible(visible)
block.warning.setBubbleVisible(visible)
}
Comment on lines +19 to +25
console.log(
'MULANG CODE CONTENT',
JSON.stringify(astCode.content, null, 2)
)

console.log('MULANG AST CODE OK', astCode)

Comment on lines +31 to +32
console.log('MULANG RESULTS', results)
console.log('MULANG PARSED RESULTS', parsedResults)
Comment thread package.json
Comment on lines 82 to 86
"js-interpreter": "^5.1.2",
"makensis": "^2.0.8",
"mini-css-extract-plugin": "^2.4.5",
"mulang": "^6.0.5",
"pilas-bloques-exercises": "^1.4.34",
Comment thread index.html
<div id="root"></div>
<!--
<body>
<script id="mulang.js" src="/assets/mulang.js"></script>
Comment thread index.html
Comment on lines +53 to +59
<script>
console.log('MULANG SCRIPT LOADED?', {
windowMulang: window.mulang,
globalMulang: globalThis.mulang,
keys: Object.keys(window).filter(k => k.toLowerCase().includes('mulang'))
})
</script>
@rgonzalezt rgonzalezt merged commit 99d87ff into develop Jun 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diálogo final con resultados de expects Mulang runValidations: errores y sugerencias

4 participants