Repository navigation
Description
Migrated from NobleFactor/noblefactor-engprod#62 (star now lives in this repository; GitHub blocks private→public transfers). Original discussion remains there.
Coverage
| Phase | Plan Item | Status | Evidence |
|---|---|---|---|
| 1 | Generate .pre-commit-config.yaml from star.yaml |
Done | internal/config/sync.go — syncPrecommitConfig(), tests in sync_test.go |
| 2 | star lint starlark (buildifier + complexity) |
Not done | No LintStarlark extension, no buildifier integration |
| 3 | star lint all |
Done | com.noblefactor.star.LintAll — discovers siblings, runs all, collects failures |
| 4 | Copyright header checks (star lint copyright --fix) |
Done | com.noblefactor.star.LintCopyright — license detection, check, fix, config-driven |
| 5 | Frontmatter validation | Done | Built into lint.markdown() — reports frontmatter_issues, checks frontmatter_passed |
| 6 | YAML/JSON schema validation | Not done | No LintYaml extension exists |
| 7 | Native git hooks (replace pre-commit framework) | Done | com.noblefactor.star.SetupHooks + HookPreCommit + HookPrePush |
| 8 | Migration complete | Partial | Hooks and lint-all exist; CI migration not verified |
Continues work from #25 (closed with phases incomplete).
Summary
Make star the single source of truth for pre-commit hooks and quality gates across all NobleFactor repositories. Running star setup config generates .pre-commit-config.yaml (and other tool configs) from star.yaml, ensuring consistent quality gates everywhere.
What's Implemented
Phase 1: Generate .pre-commit-config.yaml — Done
internal/config/sync.go has syncPrecommitConfig() that generates .pre-commit-config.yaml from the precommit.hooks section of star.yaml. Includes:
precommitConfig,precommitRepo,precommitHookstructs- Generated file header:
# GENERATED BY star lint sync - DO NOT EDIT - Clean and EnsureGitignore support
- Full test coverage in
sync_test.go(generation, default language, clean, gitignore)
Note: The Starlark config.sync() result exposes golangci_lint and markdown_lint but does not surface precommit_config — the pre-commit generation happens in the Go layer during sync.
Phase 3: star lint all — Done
com.noblefactor.star.LintAll/commands/lint-all.star:
- Uses
commands.siblings()to discover all sibling lint commands - Runs each, collects pass/fail results
- Respects config (skips copyright if
cfg.lint.copyright.enabledis false) - Propagates
--fixflag - Prints summary and fails if any linter failed
Phase 4: Copyright header checks — Done
com.noblefactor.star.LintCopyright/commands/lint-copyright.star (373 lines):
- License auto-detection from LICENSE file (MIT, Apache-2.0, BSD, GPL, MPL, ISC, Unlicense)
- Comment style detection for 40+ file extensions
- SPDX + copyright line checking with regex
- Fix mode: adds missing headers, replaces wrong license/holder, handles shebangs
- Config-driven:
cfg.lint.copyright.enabled,.license,.holder,.exclude - File collection via
file.glob()respecting .gitignore + explicit exclude patterns
Phase 5: Frontmatter validation — Done
Built into lint.markdown() in the Go layer (internal/starlark/receiver_lint.go). The markdown linter:
- Reports
result.frontmatter_issues(list of file + message) - Reports
result.frontmatter_passed(bool) - Both
lint-markdown.starand the hook extensions check frontmatter results
Phase 7: Native git hooks — Done
Three extensions working together:
com.noblefactor.star.SetupHooks— installs native git hooks viasetup.install_hook(name="pre-commit")com.noblefactor.star.HookPreCommit— runs go, shell, markdown linters on pre-commitcom.noblefactor.star.HookPrePush— runs go, shell, markdown linters on pre-push
The Go layer (internal/starlark/receiver_setup.go) provides:
setup.install_hook/setup.uninstall_hook/setup.check_hooksetup.precommit_install/setup.precommit_check(for pre-commit framework compat)
Supporting infrastructure — Done
com.noblefactor.star.LintGo—star lint go(golangci-lint)com.noblefactor.star.LintShell—star lint shell(shellcheck, shfmt)com.noblefactor.star.LintMarkdown—star lint markdown(markdownlint-cli2 + frontmatter)com.noblefactor.star.LintTools—star lint tools(check tool availability)com.noblefactor.star.ConfigSync—star setup config(sync .golangci.yaml, .markdownlint-cli2.yaml)
Remaining Work
Phase 2: star lint starlark — Not started
Lint .star files for formatting and complexity.
Tools needed:
- Buildifier — Standard Starlark formatter/linter (~100 checks)
- Custom complexity — Function length, nesting depth, conditionals
Configuration (star.yaml):
lint:
starlark:
enabled: true
buildifier:
warnings: all # or specific: [+-warn1, +-warn2]
complexity:
max_function_lines: 50
max_nesting_depth: 4
max_conditionals: 10Commands:
star lint starlark # Check formatting and complexity
star lint starlark --fix # Auto-format with buildifierImplementation:
- Create
com.noblefactor.star.LintStarlarkextension - Add
starlark_lintbuiltin receiver withcheck(paths),format(paths),complexity(paths, config) - Add buildifier to
lint.ensure_tools()inreceiver_lint.go - Starlark script: glob
**/*.star, run buildifier checks, compute complexity metrics
Why custom complexity: Starlark is a Python dialect but lacks import, class, try/except. Python tools (ruff, pylint) produce false positives. Buildifier handles formatting; we add simple complexity metrics.
Phase 6: YAML/JSON schema validation — Not started
Validate config files against JSON schemas.
Configuration (star.yaml):
lint:
yaml:
enabled: true
schemas:
- pattern: "star.yaml"
schema: "https://noblefactor.com/schemas/star-v1.json"
- pattern: "**/packages-manifest.yaml"
schema: "https://noblefactor.com/schemas/packages-manifest-v1.json"
- pattern: ".github/workflows/*.yaml"
schema: "https://json.schemastore.org/github-workflow.json"
exclude:
- "**/testdata/**"Commands:
star lint yaml # Validate YAML/JSON against schemasImplementation:
- Create
com.noblefactor.star.LintYamlextension - Add
yaml_lintbuiltin receiver withvalidate(path, schema),fetch_schema(url)(fetch and cache remote schemas) - Starlark script: read schema mappings from config, glob matching files, validate against schemas
Phase 8: Migration complete — Partial
Remaining:
- Verify all repos use generated
.pre-commit-config.yaml(not manually maintained) - Update CI (
.github/workflows/ci.yaml) to usestar lint allinstead of individual lint commands - Update documentation
Files to Create/Modify
| File | Action | Phase |
|---|---|---|
star/extensions/com.noblefactor.star.LintStarlark/ |
Create extension | 2 |
internal/starlark/receiver_starlark_lint.go |
Create — buildifier + complexity builtins | 2 |
internal/starlark/receiver_lint.go |
Modify — add buildifier to tools check | 2 |
star/extensions/com.noblefactor.star.LintYaml/ |
Create extension | 6 |
internal/starlark/receiver_yaml_lint.go |
Create — JSON schema validation builtins | 6 |
.github/workflows/ci.yaml |
Modify — use star lint all |
8 |
Configuration Schema
Full star.yaml quality gate schema (implemented sections marked):
lint:
go: # ✅ Implemented
enabled: true
config:
linters:
enable: [gofmt, govet, errcheck, staticcheck]
shell: # ✅ Implemented
enabled: true
shellcheck:
severity: warning
shfmt:
indent: 4
markdown: # ✅ Implemented (includes frontmatter)
enabled: true
config:
MD013: false
MD033: false
starlark: # ❌ Not implemented
enabled: true
buildifier:
warnings: all
complexity:
max_function_lines: 50
max_nesting_depth: 4
max_conditionals: 10
copyright: # ✅ Implemented
enabled: true
license: MIT
holder: Noble Factor
exclude:
- "**/testdata/**"
- "**/vendor/**"
yaml: # ❌ Not implemented
enabled: true
schemas:
- pattern: "star.yaml"
schema: "https://noblefactor.com/schemas/star-v1.json"
precommit: # ✅ Implemented (generation)
hooks:
- id: star-lint-all
name: Star quality gate
entry: star lint all
language: system
hooks: # ✅ Implemented (native)
pre-commit:
- lint all
pre-push:
- test goDependencies
- Use star lint commands from noblefactor-ops #61 — Star release process and self-install (repos need a
starbinary to runstar setup config)
Related
- Remove writ repo commands to make writ VCS-agnostic #25 (closed) — Original tracking issue
- Use star lint commands from noblefactor-ops #61 — Star release process and self-install
Open Questions
- Should
star lint yamlvalidatestar.yamlagainst its own schema (self-referential)? - What's the minimum set of linters for a repo? (Go-only repo doesn't need shellcheck)
- Should there be a
star lint --listto show available linters and their status?
Activity
David-Noble-at-work commentedon Sep 5, 2026
Phase 2,
star lint starlark, is #721. Its charter (docs/plans/lint-starlark.md) makes the case thatbuildifieralone would have caught none of the registry's 28 broken.starfiles — every one was syntactically valid — and that the useful check is resolution against the generated provider surface, whichstarindexalready parses. So Phase 2 is larger than "buildifier + complexity" and #721 is where that is worked out. Placed 2026-09-05 as a task under this feature; its plan should move todocs/plans/feature/721-lint-starlark.mdwhen a branch opens.For what it is worth: noblefactor-ops#140's four new
.starfiles are gated locally withbuildifier -mode=check -lint=warnin the PR script, because nothing in either repository's CI reads Starlark yet. That is the gap this row closes.David-Noble-at-work commentedon Sep 5, 2026
Correction to the comment above, on where Phase 2 lives: ruled 2026-09-05, the Starlark linter is a built-in in Go beside the code model, not an extension.
star lint starlarkstays as the row's name; #721 is its implementation. Interim:buildifieras a gate now.11 remaining items
David-Noble-at-work commentedon Nov 7, 2026
Restructured on 2026-11-06 by the owner's word, in the Area review of NobleFactor/noblefactor-engprod#452.
This feature is now Engineering: devlore-cli's own quality gate run through star, under Epic #452, Code quality, coverage, and the lint gates. Its star work, which ships in the star binary and is Product, moved to the command features of Epic #1065, Star:
It keeps Bug #964 (CI runs none of star lint's four checks), Bug #1006 (
make complexityand GOBIN), Task #672 (the pre-commit hook runsstar lint shell) and Task NobleFactor/noblefactor-engprod#231 (Test-Frontmatter.sh is deleted). Its closing still waits on its compliance audit and code review, with the owner's sign-off.David-Noble-at-work commentedon Nov 9, 2026
star github triage sweep added this issue to Triage: devlore, for the rule it breaks:
no-evidence: no Evidence of completion section