Skip to content

Hide defaults & extra upgrades#10

Merged
MilhoNerfado merged 3 commits into
mainfrom
9-hide-defaults
May 5, 2026
Merged

Hide defaults & extra upgrades#10
MilhoNerfado merged 3 commits into
mainfrom
9-hide-defaults

Conversation

@MilhoNerfado
Copy link
Copy Markdown
Collaborator

@MilhoNerfado MilhoNerfado commented May 5, 2026

This pull request introduces several improvements to the project’s structure, documentation, and configuration, focusing on making external component support clearer and more flexible. The main changes include reorganizing built-in components into an example_components directory, updating documentation for external component usage, and adding pre-commit hooks for consistent formatting and linting.

Component system restructuring and externalization:

  • Moved built-in component definitions (driver, lib, sample) from scaffold/components/ to example_components/, updated their imports, and set templates_dir to use a path relative to each component’s location for better modularity. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Updated template files for the lib component to use variables for path and to prefix Kconfig symbols with LIB_ for clarity and consistency. [1] [2]

Documentation and developer workflow improvements:

  • Expanded and clarified the README.md with detailed instructions and examples for using external components, overriding built-ins, and using new options like --hide-defaults. The process for adding new built-in and external components is now more explicit. [1] [2] [3] [4] [5] [6] [7]
  • Added a new CONTRIBUTING.md with clear setup, linting, and testing instructions, including the use of pre-commit for local checks.

Pre-commit and linting setup:

  • Introduced a .pre-commit-config.yaml to enforce linting and formatting for Python and YAML files using ruff and yamllint, ensuring code quality and consistency before commits.

Signed-off-by: Emilio Bottoni <emilio.bottoni@edge.ufal.br>
Signed-off-by: Emilio Bottoni <emilio.bottoni@edge.ufal.br>
@MilhoNerfado MilhoNerfado requested a review from Copilot May 5, 2026 14:49
@MilhoNerfado MilhoNerfado self-assigned this May 5, 2026
@MilhoNerfado MilhoNerfado added the enhancement New feature or request label May 5, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request expands the scaffolding system by adding an "append" mode for file patching, introducing specialized field types for path normalization, and allowing built-in components to be hidden. It also includes several example components and a new devicetree compatibility validator. Review feedback highlights a critical bug in the line-by-line deduplication logic for file appending and suggests more robust path handling to prevent potential crashes when calculating relative paths.

Comment thread scaffold/engine.py Outdated
Comment thread scaffold/engine.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

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 extends scaffold’s component discovery and generation pipeline: it adds a hide_defaults option for suppressing built-in components, repackages the built-in component definitions under example_components, and broadens descriptor/template support with path normalization and append-style rendering.

Changes:

  • Adds config/CLI handling for hide_defaults plus an empty-component warning/clean exit path.
  • Moves built-in component definitions/templates into packaged example_components/* subpackages and updates registry/package wiring.
  • Expands descriptor/engine/template behavior with path normalization, new generated files, and refreshed built-in templates.

Reviewed changes

Copilot reviewed 26 out of 52 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/test_descriptors.py Adds descriptor normalization tests.
scaffold/validators.py Adds devicetree compatible validator.
scaffold/engine.py Normalizes field values and adds append/patch rendering flow.
scaffold/descriptors.py Introduces FieldDir, FieldPath, and append-capable TemplateFile.
scaffold/config_schema.json Adds hide_defaults config key.
scaffold/components/__init__.py Loads packaged example components and adds default-purging logic.
scaffold/cli.py Wires hide_defaults into CLI flow and empty-registry warning.
pyproject.toml Packages example_components and their template data.
external_templates/templates/shell_cmd/name_cmd.c.j2 Removes old external shell command example template.
external_templates/templates/shell_cmd/CMakeLists.txt.j2 Removes old external shell command CMake template.
external_templates/templates/module/name.h.j2 Removes old external module header template.
external_templates/templates/module/name.c.j2 Removes old external module source template.
external_templates/templates/module/CMakeLists.txt.j2 Removes old external module CMake template.
external_templates/shell_cmd.py Removes old external shell command example component.
external_templates/module.py Removes old external module example component.
example_components/test/test.py Reworks built-in test component descriptor.
example_components/test/templates/testcase.yaml.j2 Adds testcase manifest template.
example_components/test/templates/README.md.j2 Updates generated test README path usage.
example_components/test/templates/prj.conf.j2 Adds default test config template.
example_components/test/templates/main.c.j2 Renames generated test source file and adds header block.
example_components/test/templates/CMakeLists.txt.j2 Updates generated test target/source naming.
example_components/test/__init__.py Marks packaged test component module.
example_components/service/templates/README.md.j2 Adds generated service README template.
example_components/service/templates/Kconfig.j2 Adds service Kconfig/logging template.
example_components/service/templates/internal.h.j2 Adds internal service header template.
example_components/service/templates/impl.c.j2 Adds service implementation template.
example_components/service/templates/CMakeLists.txt.j2 Adds service CMake template.
example_components/service/templates/access.h.j2 Adds public service API header template.
example_components/service/service.py Reworks built-in service component descriptor.
example_components/service/__init__.py Marks packaged service component module.
example_components/sample/templates/sample.yaml.j2 Adds sample manifest template.
example_components/sample/templates/README.md.j2 Updates generated sample README path usage.
example_components/sample/templates/prj.conf.j2 Adds sample config template.
example_components/sample/templates/main.c.j2 Adds sample source template.
example_components/sample/templates/CMakeLists.txt.j2 Adds sample CMake template.
example_components/sample/sample.py Reworks built-in sample component descriptor.
example_components/sample/__init__.py Marks packaged sample component module.
example_components/lib/templates/README.md.j2 Updates generated library README path usage.
example_components/lib/templates/name.h.j2 Adds library API header template.
example_components/lib/templates/name.c.j2 Adds library source template.
example_components/lib/templates/Kconfig.j2 Changes library Kconfig symbol naming.
example_components/lib/templates/CMakeLists.txt.j2 Adds library CMake template.
example_components/lib/lib.py Reworks built-in library component descriptor.
example_components/lib/__init__.py Marks packaged library component module.
example_components/driver/templates/README.md.j2 Adds generated driver README template.
example_components/driver/templates/name.h.j2 Adds driver API header template.
example_components/driver/templates/name.c.j2 Adds driver source template.
example_components/driver/templates/Kconfig.j2 Adds driver Kconfig/logging template.
example_components/driver/templates/CMakeLists.txt.j2 Adds driver CMake template.
example_components/driver/driver.py Reworks built-in driver component descriptor.
example_components/driver/__init__.py Marks packaged driver component module.
example_components/__init__.py Marks top-level packaged built-in components namespace.
Comments suppressed due to low confidence (1)

example_components/lib/templates/Kconfig.j2:1

  • After changing the Kconfig symbol prefix to LIB_..., the other library templates still use the old unprefixed name. In particular the generated C file still references CONFIG_<NAME>_LOG_LEVEL, so newly generated libraries will fail to build because that symbol is no longer defined by the Kconfig template.

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

Comment thread scaffold/components/__init__.py
Comment thread scaffold/descriptors.py Outdated
Comment thread scaffold/cli.py
Comment thread scaffold/validators.py
Comment thread scaffold/engine.py
Comment thread pyproject.toml
Comment thread scaffold/cli.py
Comment thread scaffold/descriptors.py Outdated
@MilhoNerfado MilhoNerfado force-pushed the 9-hide-defaults branch 4 times, most recently from 878e29c to 98f724a Compare May 5, 2026 15:52
Signed-off-by: Emilio Bottoni <emilio.bottoni@edge.ufal.br>
@MilhoNerfado MilhoNerfado merged commit 9857187 into main May 5, 2026
6 checks passed
@MilhoNerfado MilhoNerfado deleted the 9-hide-defaults branch May 5, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants