Commit Graph

78 Commits

Author SHA1 Message Date
c24ae6b1f8 docs: add comprehensive grammar documentation and precedence explanation
Medium Priority Enhancement:
- Added detailed precedence strategy comments explaining how ShellSpec extends bash
- Documented all 5 conflicts with resolution strategies
- Explained why conflicts are necessary and optimal
- Added context about GLR parsing and precedence hints

Documentation improvements:
- Precedence levels clearly explained (bash: 1, ShellSpec: 2)
- Each conflict documented with resolution strategy
- Notes on intentional design decisions
- Helps future maintainers understand grammar design
2026-01-04 15:33:00 +02:00
82f5f399b1 enhance: add Data block test coverage and improve syntax highlighting
High Priority Enhancements:
- Added 2 new Data block test cases for :raw and :expand modifiers
- Enhanced syntax highlighting with "End" keyword (block terminator)
- Added Data block modifiers (:raw, :expand, #|) to highlighting

Test Coverage:
- 63/63 tests passing (100%)
- Test count increased from 61 to 63
- Average parse speed: 623 bytes/ms
2026-01-04 15:33:00 +02:00
18138d7588 fix: address code review findings and critical issues
Critical Fixes:
- Fixed EditorConfig violations in grammar.js, scanner.c, README.md, .mega-linter.yml
  - Changed JSDoc comments from 1-space to 2-space indent per .editorconfig
  - Fixed line length violations in README.md and .mega-linter.yml
- Updated test count badge from 59/59 to 61/61 in README.md
- Created queries/highlights.scm for syntax highlighting support
- Updated package.json with repository and files fields

Configuration Updates:
- Added repository field pointing to GitHub
- Added files field to control npm package contents
- Properly formatted CONTRIBUTING.md with prettier

All 61 tests passing (100% success rate)
All critical EditorConfig violations resolved
2026-01-04 15:33:00 +02:00
a0bbc781f6 feat: add post-generation script to preserve buffer overflow fix
Created scripts/post-generate.sh that automatically re-applies the critical
buffer overflow fix to parser.h after tree-sitter generate runs. This fix
prevents undefined behavior in set_contains() when accessing an empty array.

The script is automatically executed after tree-sitter generate via the npm
generate script. Added generate:only for cases where post-processing should
be skipped.
2026-01-04 15:32:59 +02:00
8ad4483b0b chore: add eclint for editorconfig linting and fix violations
- Install eclint ^2.8.1 for editorconfig validation and fixing
- Add .eclintignore to exclude generated files and dependencies
- Add npm scripts: lint:editorconfig and lint:editorconfig:fix
- Fix indentation issues in CONTRIBUTING.md (3 spaces -> 2 spaces)
- Fix code alignment in scanner.c to match editorconfig rules
- Regenerate parser after scanner.c formatting changes
2026-01-04 15:32:59 +02:00
41b3c5d345 chore: add prettier and format all files
- Install prettier ^3.6.2
- Add .prettierrc with project formatting rules
- Add .prettierignore to exclude generated files and dependencies
- Add npm scripts: format and format:check
- Format all files with prettier
2026-01-04 15:32:59 +02:00
dcad1573a8 fix(ci): remove unsupported --language flag from tree-sitter parse
The --language flag is not supported in tree-sitter-cli 0.25.10.
Tree-sitter correctly auto-detects the grammar based on file extension.
2026-01-04 15:32:40 +02:00
56a716a09e chore: update dependencies and workflow actions
- Update GitHub Actions to latest versions (checkout v6, setup-node v6, cache v4.3)
- Update package dependencies
- Format workflow files
- Update .gitignore and project configuration
2026-01-04 15:32:40 +02:00
59b45f8505 docs: update Node.js requirement to match CI configuration
- Change Node.js requirement from v16 to v22+ to align with CI matrix
- Update tree-sitter CLI recommendation from global install to npx usage
- Matches actual devDependency configuration in package.json

Addresses PR #1 review comment from CodeRabbit.
2026-01-04 15:32:40 +02:00
dd2b306852 test: fix typos and incorrect hook usage in spec files
- Fix 'yot' → 'yet' typos in test/spec/03.example_spec.sh
- Fix 'Sometime' → 'Sometimes' and cpunum.sh references in test/spec/22.sourcced_spec.sh
- Fix Before → After in after hook section of test/spec/07.before_after_hook_spec.sh
- Improve wording and capitalization throughout hook spec file

All 61 tests still passing after corrections.

Addresses PR #1 review comments from Copilot and CodeRabbit.
2026-01-04 15:32:40 +02:00
9208f7ff8c ci: improve workflow determinism and security scanning
- Add --language=shellspec flag to tree-sitter parse for deterministic grammar selection
- Add C++ language to CodeQL analysis to scan src/scanner.c for security issues

Addresses PR #1 review comments from CodeRabbit.
2026-01-04 15:32:40 +02:00
dc672f8485 fix(scanner): address memory safety and correctness issues in C code
- Add len==0 check in set_contains() to prevent buffer overflow
- Add missing stdlib.h include in scanner.c
- Clear heredoc stack properly in deserialize when length==0
- Ensure NUL termination in delimiter deserialization
- Create alloc.c to define ts_current_* symbols for TREE_SITTER_REUSE_ALLOCATOR

All changes tested with full test suite: 61/61 tests passing.

Addresses PR #1 review comments from CodeRabbit.
2026-01-04 15:32:40 +02:00
4344567555 chore: tweaks to megalinter and grammar.js 2026-01-04 15:32:40 +02:00
3f6411b23f feat(ci): expand cache paths to support all Node.js package managers
- Add comprehensive caching for npm, yarn, and pnpm package managers
- Cache paths now include:
  - npm: ~/.npm, node_modules/.cache
  - yarn: ~/.yarn, ~/.cache/yarn, ~/.cache/yarn/global
  - pnpm: ~/.pnpm-store, ~/.cache/pnpm, ~/.local/share/pnpm/global
- Update cache keys to include all lockfile types (package-lock.json, yarn.lock, pnpm-lock.yaml)
- Rename 'Cache Tree-sitter CLI' to 'Cache npx store' for clarity
- Apply changes consistently across test, lint, and coverage jobs

This improves cache hit rates and build performance regardless of which
Node.js package manager is used in the development environment.
2026-01-04 15:32:40 +02:00
c5334da82f fix(ci): ensure parser is built before testing in GitHub workflows
- Add explicit parser build step before sample code testing
- Remove --scope parameter that requires parser to be compiled first
- Fix tree-sitter CLI v0.25.0 compatibility issue in CI environment

The issue was that tree-sitter CLI v0.25.0 requires the parser to be
compiled before it can recognize custom language scopes. This fix
ensures the parser is always built before attempting to parse test files,
resolving the 'Unknown scope' error in GitHub Actions.
2026-01-04 15:32:40 +02:00
b88b851a74 perf: optimize grammar for 32x faster parsing performance
- Reduce grammar conflicts to essential bash and ShellSpec rules only
- Restore original precedence values for consistent rule ordering
- Simplify Data block rule while maintaining all functionality
- Add required statements field to match test expectations

Performance improvements:
- Parse speed: ~55 bytes/ms → 1784 bytes/ms (32x faster)
- All 61 tests still pass (100% success rate)
- Significantly reduced parser generation time and runtime complexity

The optimizations focused on minimizing unnecessary conflicts and
simplifying complex choice structures while preserving full ShellSpec
grammar compatibility and correctness.
2026-01-04 15:32:39 +02:00
193f8871b6 fix: apply CodeRabbit nitpick suggestions and improve code quality
- Fix grammar.js TypeScript errors by correcting optional field usage
- Update .yamlignore to use more robust glob pattern (**/node_modules/**)
- Remove hard-coded test count from README.md for maintainability
- Fix shellcheck directive format (add space after #) in all test specs
- Fix typos throughout test specifications:
  - 'can not' → 'cannot'
  - 'expantion' → 'expansion'
  - 'singnal' → 'signal'
  - 'It mean' → 'It means'
- Update CODE_OF_CONDUCT.md HTTP links to HTTPS
- Update tree-sitter parse command to use --scope instead of --language
- Add comments to .mega-linter.yml explaining disabled linters

All grammar tests still pass (61/61) and the parser functions correctly
with the updated tree-sitter CLI v0.25.0.
2026-01-04 15:32:39 +02:00
d65c6e6ec4 refactor: enhance CI/CD workflows and apply CodeRabbit suggestions
- Convert GitHub Actions from local to inline actions for better maintainability
- Add comprehensive caching for npm dependencies, tree-sitter CLI, and build artifacts
- Fix checkout steps missing in test matrix jobs
- Apply defensive programming in test coverage validation
- Use local tree-sitter CLI via npx instead of global installation
- Update tree-sitter-cli to v0.25.0 for compatibility with tree-sitter-bash
- Add proper tree-sitter field to package.json with grammar metadata
- Fix grammar precedence for Data blocks (#| lines now have higher precedence)
- Standardize dates in memory files to September 12, 2025
- Enhance workflow robustness with dynamic workflow ID resolution
- Improve test file pattern matching and error handling

This commit addresses all CodeRabbit review suggestions and optimizes
GitHub Actions workflows for better performance and reliability.
2026-01-04 15:32:39 +02:00
dd21bc5107 chore(ci): update workflows 2026-01-04 15:32:39 +02:00
b180fbeb48 chore: lint and code review fixes 2026-01-04 15:32:39 +02:00
13a00d2f0f chore(ci): add coderabbit config 2026-01-04 15:32:39 +02:00
19b7b27ceb fix(ci): add checkout before testing, cleanup 2026-01-04 15:32:39 +02:00
de1b21e88d fix(ci): use inline steps instead of actions 2026-01-04 15:32:39 +02:00
66f2aa1099 fix(ci): checkout before using local actions 2026-01-04 15:32:39 +02:00
c8ba576b4e feat: implement complete tree-sitter-shellspec grammar with comprehensive testing
- Add full ShellSpec grammar extending tree-sitter-bash
- Support all ShellSpec constructs: Describe, Context, It, hooks, utilities
- Include Data block parsing with statements and argument styles
- Add 61 comprehensive test cases covering real-world patterns
- Implement optimized GitHub workflows with CI/CD automation
- Configure complete development tooling (linting, formatting, pre-commit)
- Add comprehensive documentation and contribution guidelines
- Optimize grammar conflicts to zero warnings
- Support editor integration for Neovim, VS Code, Emacs

Breaking Changes:
- Initial release, no previous API to break

BREAKING CHANGE: Initial implementation of tree-sitter-shellspec grammar

# Conflicts:
#	.github/workflows/codeql.yml
#	.github/workflows/pr-lint.yml
#	.pre-commit-config.yaml

# Conflicts:
#	.github/workflows/pr-lint.yml

# Conflicts:
#	.github/workflows/pr-lint.yml
2026-01-04 15:32:39 +02:00
renovate[bot]
12d20a17b4 chore(deps): update pre-commit hook bridgecrewio/checkov (3.2.496 → 3.2.497) (#52)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-02 12:28:05 +02:00
renovate[bot]
08b460f0a9 chore(deps): update pre-commit hook rhysd/actionlint (v1.7.9 → v1.7.10) (#53)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-02 10:21:50 +02:00
renovate[bot]
a54653aec1 chore(deps)!: update ivuorinen/actions (v2025.11.28 → v2026.01.01) (#54) 2026-01-02 09:49:08 +02:00
renovate[bot]
d580097759 chore(deps): update pre-commit hook bridgecrewio/checkov (3.2.495 → 3.2.496) (#51)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-29 21:05:33 +02:00
renovate[bot]
42241b8499 chore(deps): update pre-commit hook renovatebot/pre-commit-hooks (42.64.1 → 42.66.8) (#50)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-27 12:01:16 +02:00
renovate[bot]
90bff1cec4 chore(deps): update pre-commit hook renovatebot/pre-commit-hooks (42.26.11 → 42.64.1) (#49)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-20 12:51:37 +02:00
renovate[bot]
7362a26865 chore(deps): update github/codeql-action action (v4.31.7 → v4.31.9) (#48)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-17 07:48:30 +02:00
renovate[bot]
c443e12cea chore(deps): update pre-commit hook igorshubovych/markdownlint-cli (v0.46.0 → v0.47.0) (#47)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-13 11:10:49 +02:00
renovate[bot]
2a2018313b chore(deps): update github/codeql-action action (v4.31.6 → v4.31.7) (#46)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-07 05:49:49 +02:00
renovate[bot]
762bf92544 chore(deps): update actions/checkout action (v6.0.0 → v6.0.1) (#45)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-05 16:57:55 +02:00
renovate[bot]
ef684994d2 chore(deps): update github/codeql-action action (v4.31.5 → v4.31.6) (#44)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-03 14:50:37 +02:00
renovate[bot]
e7bcdb8776 chore(deps): update pre-commit hook renovatebot/pre-commit-hooks (42.20.1 → 42.26.11) (#43)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-30 14:54:37 +02:00
renovate[bot]
3c68cd2d5e chore(deps)!: update ivuorinen/actions (v25.11.26 → v2025.11.28) (#27) 2025-11-29 10:00:45 +02:00
renovate[bot]
1f60912b47 chore(deps): update ivuorinen/actions action (25.11.24 → v25.11.26) (#42)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-28 16:38:09 +02:00
renovate[bot]
5cb9382b03 chore(deps): update pre-commit hook bridgecrewio/checkov (3.2.492 → 3.2.495) (#35)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 22:39:06 +02:00
renovate[bot]
661afa9a7b chore(deps): update pre-commit hook renovatebot/pre-commit-hooks (42.1.3 → 42.20.1) (#37)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 22:38:49 +02:00
renovate[bot]
5bdc5cd0f8 chore(deps): update pre-commit hook igorshubovych/markdownlint-cli (v0.45.0 → v0.46.0) (#39)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 22:38:26 +02:00
renovate[bot]
55f5500ace chore(deps): update pre-commit hook rhysd/actionlint (v1.7.8 → v1.7.9) (#41)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 22:38:00 +02:00
renovate[bot]
9fd0403c52 chore(deps): update ivuorinen/actions action (25.10.7 → 25.11.24) (#21)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 22:37:32 +02:00
renovate[bot]
0ea5f92a9b chore(deps): update github/codeql-action action (v4.31.2 → v4.31.5) (#36)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 10:52:13 +02:00
renovate[bot]
9e427f55a7 chore(deps)!: update actions/checkout (v5.0.0 → v6.0.0) (#40)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 10:12:31 +02:00
b2b319ddd2 fix(ci): switch CodeQL language from 'javascript' to 'actions' 2025-11-25 10:06:25 +02:00
renovate[bot]
7395a55dd6 chore(deps): update pre-commit hook bridgecrewio/checkov (3.2.490 → 3.2.492) (#34)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-12 13:03:50 +02:00
renovate[bot]
770e8ac1ad chore(deps): update pre-commit hook renovatebot/pre-commit-hooks (42.0.1 → 42.1.3) (#33)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-09 09:23:21 +02:00
renovate[bot]
c45e992052 chore(deps)!: update renovatebot/pre-commit-hooks (41.159.4 → 42.0.1) (#32) 2025-11-07 18:57:37 +02:00