Repository navigation
fix(skills): Windows/AppLocker portability + ordering fixes for scan scripts - #2729
noliverbked wants to merge 4 commits into
Conversation
…scripts - Replace find|sort with bash globstar and sort|uniq -c with awk counting (AppLocker-shimmed find/sort return silent empty on GNU flags) - Replace jq process substitution with --argjson (native Windows jq cannot open MSYS /proc fd paths; failure was hidden by 2>/dev/null) - Zero-pad per-file tmp JSON names (printf -v fname '%06d.json') so the jq -s glob preserves insertion order past 9 files - Delete dead count_obs() in skill-stocktake/scan.sh (replaced by two-pass jq pre-aggregation; zero call sites) Verified: bash -n clean on all three; 12-skill fixture returns count 12 in exact insertion order for both skill scanners; 3-rule fixture total 3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Zw3jpqfpiZzjSdRK25RiJ
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe three Bash scanners now use recursive, sorted discovery; zero-padded temporary JSON files; streamed ChangesScanner portability
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/rules-distill/scripts/scan-rules.sh`:
- Around line 22-24: Make recursive rule-file discovery Bash 3.x-compatible by
replacing the globstar-based traversal around files in
skills/rules-distill/scripts/scan-rules.sh lines 22-24,
skills/rules-distill/scripts/scan-skills.sh lines 69-70, and
skills/skill-stocktake/scripts/scan.sh lines 93-94 with a compatible find-based
traversal, or add an explicit Bash 4+ version check before enabling globstar.
Preserve nullglob-equivalent behavior and existing file processing in each
script.
In `@skills/rules-distill/scripts/scan-skills.sh`:
- Line 126: Replace the --argjson-based inventory merge in scan-skills.sh at
skills/rules-distill/scripts/scan-skills.sh:126 with temporary JSON files in the
existing mktemp -d directory and merge them via jq file input such as jq -s
'add'; apply the same change to scan.sh at
skills/skill-stocktake/scripts/scan.sh:158. Preserve the resulting combined
global-and-project inventory.
In `@skills/skill-stocktake/scripts/scan.sh`:
- Around line 80-85: Update the path-count handling in the scan logic so paths
containing whitespace are preserved: when processing the count output from
obs_7d_counts and obs_30d_counts, parse only the leading count field and compare
the complete remaining text against $file. Keep the existing zero-count fallback
for paths with no matching entry.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 42ec7282-de9f-41fe-9c4c-772110445d5e
📒 Files selected for processing (3)
skills/rules-distill/scripts/scan-rules.shskills/rules-distill/scripts/scan-skills.shskills/skill-stocktake/scripts/scan.sh
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (5)
**/*.sh
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Before running shell commands, explain destructive or networked actions and prefer read-only inspection first
Files:
skills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-rules.shskills/rules-distill/scripts/scan-skills.sh
**/*
📄 CodeRabbit inference engine (AGENTS.md)
**/*: Delegate complex features to a planner agent, architectural decisions to an architect agent, modified code to a code-reviewer agent, and security-sensitive work to a security-reviewer agent; use parallel agents for independent operations.
Never compromise security; validate all inputs and prevent hardcoded secrets, injection, XSS, CSRF, authentication or authorization failures, sensitive error leakage, and missing rate limits.
Never hardcode secrets; use environment variables or a secret manager, validate required secrets at startup, and rotate exposed secrets immediately.
Always create new objects and never mutate existing ones.
Plan complex features before implementation, identifying dependencies, risks, and phases.
Prefer many small, focused files; keep functions under 50 lines, files under 800 lines where practical, avoid nesting deeper than four levels, and use readable, well-named identifiers.
Handle errors at every level, provide user-friendly UI messages, log detailed server-side context, and never silently swallow errors.
Validate all user input at system boundaries using schema-based validation; fail fast with clear messages and never trust external data.
Required tests include unit tests, integration tests for APIs and database operations, and end-to-end tests for critical user flows.
Follow the mandatory TDD cycle: write a failing test, implement the minimum passing solution, then refactor and verify coverage.
Use a consistent API response envelope containing a success indicator, data payload, error message, and pagination metadata.
Encapsulate data access behind a repository interface with operations such asfindAll,findById,create,update, anddelete; business logic must depend on the abstraction rather than storage details.
Files:
skills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-rules.shskills/rules-distill/scripts/scan-skills.sh
skills/**
📄 CodeRabbit inference engine (AGENTS.md)
Treat
skills/as the canonical workflow surface; add new workflow contributions there first.
Files:
skills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-rules.shskills/rules-distill/scripts/scan-skills.sh
skills/**/scripts/**
⚙️ CodeRabbit configuration file
skills/**/scripts/**: Review generated or imported scripts as untrusted-input tooling. Flag RCE, path traversal, network fetches without validation, and writes outside the expected workspace.
Files:
skills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-rules.shskills/rules-distill/scripts/scan-skills.sh
{skills,commands,agents,rules}/**
⚙️ CodeRabbit configuration file
{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.
Files:
skills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-rules.shskills/rules-distill/scripts/scan-skills.sh
|
| # Bash globstar instead of `find | sort`: AppLocker-hardened machines shim | ||
| # find/sort (silent-empty on GNU flags), and glob expansion is already | ||
| # lexicographically sorted with no external processes. | ||
| shopt -s globstar nullglob |
There was a problem hiding this comment.
Globstar terminates scanners on macOS Bash 3.2
macOS ships Bash 3.2, where globstar is not a recognized shopt option. With set -e enabled, shopt -s globstar nullglob exits with status 1 before this scanner produces JSON. The same unsupported command appears in scan-skills.sh and skill-stocktake/scripts/scan.sh; use Bash-3.2-compatible recursive discovery, or guard globstar and provide a fallback.
Artifacts
- This uploaded script executes the exact `set -e; shopt -s globstar nullglob` sequence in Bash 3.2 and Bash 5.2, showing the Bash 3.2 failure.
- This uploaded executed log records Bash 3.2 exiting 1 with an invalid globstar option and Bash 5.2 continuing successfully, confirming the compatibility defect.
- This uploaded Bash 3.2 capture shows the exact shopt command reporting an invalid globstar option and exiting 1, confirming the scanner failure path.
- This uploaded Bash 5.2 comparison shows the same command printing its continuation marker and exiting 0, isolating the behavior to Bash 3.2 support.
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
haelyra
left a comment
There was a problem hiding this comment.
Thank you for identifying the macOS Bash 3.2 portability failures. I completed the maintainer patch with deterministic recursive traversal, streamed jq input, whitespace-safe counting, and portability regression tests, then refreshed it on current main. Bash 3.2 syntax, portability, and Unicode checks pass. Approving this exact head for hosted CI.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/rules-distill/scripts/scan-rules.sh`:
- Around line 30-31: Update the file-discovery branches in
skills/rules-distill/scripts/scan-rules.sh lines 30-31,
skills/skill-stocktake/scripts/scan.sh lines 66-67, and
skills/rules-distill/scripts/scan-skills.sh lines 64-65 to require both a
regular file check and a non-symbolic-link check before appending Markdown or
SKILL.md paths. Ensure these untrusted-input scanners exclude symlinks resolving
outside the scan directory and do not introduce path traversal exposure.
In `@skills/skill-stocktake/scripts/scan.sh`:
- Around line 118-125: Update the observation-counting logic in the scan flow
around OBSERVATIONS to preserve jq diagnostics, validate each jq invocation
before passing output to awk, and write a clear failure message to stderr
followed by a nonzero return when either query fails. Keep successful 7-day and
30-day aggregation behavior unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6c6657ba-f576-4a22-a9be-0574d0e1d08a
📒 Files selected for processing (4)
skills/rules-distill/scripts/scan-rules.shskills/rules-distill/scripts/scan-skills.shskills/skill-stocktake/scripts/scan.shtests/scripts/scan-portability.test.js
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (18)
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}
📄 CodeRabbit inference engine (.cursor/rules/common-coding-style.md)
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}: Always create new objects, never mutate existing ones. Use immutable patterns to prevent hidden side effects and enable safe concurrency
Organize code into many small files (200-400 lines typical, 800 lines max) organized by feature/domain rather than by type
Always handle errors explicitly at every level and never silently swallow errors
Always validate all user input before processing at system boundaries
Use schema-based validation where available
Fail fast with clear error messages when validation fails
Never trust external data (API responses, user input, file content)
Ensure code is readable and well-named
Keep functions small (less than 50 lines)
Keep files focused (less than 800 lines)
Avoid deep nesting (more than 4 levels)
Do not use hardcoded values; use constants or configuration instead
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp}
📄 CodeRabbit inference engine (.cursor/rules/common-security.md)
No hardcoded secrets (API keys, passwords, tokens) - validate before any commit
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}
📄 CodeRabbit inference engine (.cursor/rules/common-security.md)
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}: All user inputs must be validated
Enable CSRF protection on all state-changing endpoints
Verify authentication and authorization for all protected endpoints
Implement rate limiting on all endpoints to prevent abuse
Ensure error messages do not leak sensitive data in responses
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,sql}
📄 CodeRabbit inference engine (.cursor/rules/common-security.md)
Use parameterized queries to prevent SQL injection
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,jsx,tsx,html,php,java,cs,rb,go}
📄 CodeRabbit inference engine (.cursor/rules/common-security.md)
Implement XSS prevention by sanitizing HTML output
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}
📄 CodeRabbit inference engine (.cursor/rules/common-security.md)
NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager
Files:
tests/scripts/scan-portability.test.js
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)
**/*.{ts,tsx,js,jsx}: Use spread operator for immutable updates in TypeScript/JavaScript instead of direct mutation
Use async/await with try-catch for error handling in TypeScript/JavaScript
Use Zod for schema-based input validation in TypeScript/JavaScript
No console.log statements in production code; use proper logging libraries instead
**/*.{ts,tsx,js,jsx}: Auto-format JavaScript/TypeScript files using Prettier after edit
Warn aboutconsole.logstatements in edited files
Check all modified files forconsole.logstatements before session ends
**/*.{ts,tsx,js,jsx}: Use the ApiResponse interface pattern with generic type parameter:interface ApiResponse<T> { success: boolean; data?: T; error?: string; meta?: { total: number; page: number; limit: number; } }
Implement custom React hooks following the pattern: export a named function with use prefix, generic type parameters, and proper useEffect cleanup for side effects
**/*.{ts,tsx,js,jsx}: Never hardcode secrets; always use environment variables for sensitive credentials like API keys
Throw an error when required environment variables are not configured to fail fast and ensure security prerequisites are metUse Playwright as the E2E testing framework for critical user flows in TypeScript/JavaScript
Files:
tests/scripts/scan-portability.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{test,spec}.{js,ts,jsx,tsx}: Write tests before implementation (test-driven development); target 80%+ coverage
Achieve minimum 80% test coverage across all three layers: Unit, Integration, and E2E
Use AAA structure (Arrange / Act / Assert) in tests with descriptive test names that explain behavior under test
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{js,ts,jsx,tsx}: Always create new objects and never mutate in place; return new copies instead
Keep files between 200–400 lines typical, with a maximum of 800 lines
Extract helpers when a file exceeds 200 lines
Handle errors explicitly at every level; never swallow errors silently
Validate all user input before processing; use schema-based validation where available
Never trust external data (API responses, file content, query params); always validate
All user inputs must be validated and sanitized
Error messages must be scrubbed of sensitive internals
Use readable, well-named identifiers in all code
Keep functions under 50 lines
Keep files under 800 lines
Avoid nesting deeper than 4 levels
Implement comprehensive error handling in all code
Do not hardcode values; use constants or environment configuration instead
Do not use in-place mutation; always return new objects or state
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,jsx,tsx,json,env*}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Do not hardcode secrets, API keys, passwords, or tokens
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{js,ts}: Use parameterized queries for all database writes (no string interpolation)
Auth/authz must be checked server-side for every sensitive path
Rate limiting must be applied to all public endpoints
Files:
tests/scripts/scan-portability.test.js
**/*.{jsx,tsx,js,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
HTML output must be sanitized where applicable
Files:
tests/scripts/scan-portability.test.js
**/*.{js,ts,env*}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Required environment variables must be validated at startup
Files:
tests/scripts/scan-portability.test.js
tests/**
📄 CodeRabbit inference engine (AGENTS.md)
Maintain the project's test suite under the
tests/directory.
Files:
tests/scripts/scan-portability.test.js
**/*.sh
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Before running shell commands, explain destructive or networked actions and prefer read-only inspection first
Files:
skills/rules-distill/scripts/scan-rules.shskills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-skills.sh
skills/**
📄 CodeRabbit inference engine (AGENTS.md)
Treat
skills/as the canonical workflow surface; add new workflow contributions there first.
Files:
skills/rules-distill/scripts/scan-rules.shskills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-skills.sh
skills/**/scripts/**
⚙️ CodeRabbit configuration file
skills/**/scripts/**: Review generated or imported scripts as untrusted-input tooling. Flag RCE, path traversal, network fetches without validation, and writes outside the expected workspace.
Files:
skills/rules-distill/scripts/scan-rules.shskills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-skills.sh
{skills,commands,agents,rules}/**
⚙️ CodeRabbit configuration file
{skills,commands,agents,rules}/**: Focus on prompt-injection resilience, tool-permission scope, destructive action guards, and secret exfiltration risks.
Files:
skills/rules-distill/scripts/scan-rules.shskills/skill-stocktake/scripts/scan.shskills/rules-distill/scripts/scan-skills.sh
🧠 Learnings (2)
📚 Learning: 2026-07-17T04:35:58.631Z
Learnt from: Seekers2001
Repo: affaan-m/ECC PR: 2281
File: tests/scripts/council-multi-model.test.js:24-34
Timestamp: 2026-07-17T04:35:58.631Z
Learning: In standalone JavaScript test harness files under `tests/scripts/` (e.g., `*.test.js` harnesses), it’s acceptable—and intended—for tests to report results via `console.log` using `PASS`/`FAIL` style output. Do not require introducing a dedicated test-reporting/logging library solely because these harnesses use `console.log` for reporting. Failures should be signaled by exiting the process with a non-zero exit code.
Applied to files:
tests/scripts/scan-portability.test.js
📚 Learning: 2026-08-11T18:21:10.213Z
Learnt from: CR
Repo: affaan-m/ECC PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-08-11T18:21:10.213Z
Learning: Applies to skills/** : Treat `skills/` as the canonical workflow surface; add new workflow contributions there first.
Applied to files:
skills/rules-distill/scripts/scan-skills.sh
🪛 ast-grep (0.45.1)
tests/scripts/scan-portability.test.js
[warning] 13-13: Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: require('child_process')
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(detect-child-process)
[warning] 38-38: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.writeFileSync(file, content)
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
(detect-non-literal-fs-filename)
[warning] 151-151: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(script, 'utf8')
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
(detect-non-literal-fs-filename)
🪛 Shellcheck (0.11.0)
skills/rules-distill/scripts/scan-rules.sh
[style] 40-40: Array indices are already arithmetic contexts. Prefer removing the $(( and )).
(SC2321)
[style] 43-43: Array indices are already arithmetic contexts. Prefer removing the $(( and )).
(SC2321)
skills/skill-stocktake/scripts/scan.sh
[style] 78-78: Array indices are already arithmetic contexts. Prefer removing the $(( and )).
(SC2321)
[style] 81-81: Array indices are already arithmetic contexts. Prefer removing the $(( and )).
(SC2321)
skills/rules-distill/scripts/scan-skills.sh
[style] 76-76: Array indices are already arithmetic contexts. Prefer removing the $(( and )).
(SC2321)
[style] 79-79: Array indices are already arithmetic contexts. Prefer removing the $(( and )).
(SC2321)
🔇 Additional comments (4)
skills/rules-distill/scripts/scan-rules.sh (1)
36-85: LGTM!skills/skill-stocktake/scripts/scan.sh (1)
197-210: LGTM!skills/rules-distill/scripts/scan-skills.sh (1)
158-171: LGTM!tests/scripts/scan-portability.test.js (1)
1-166: LGTM!
| elif [[ -f "$entry" && "$entry" == *.md ]]; then | ||
| files+=("$entry") |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Exclude symbolic links to files outside the scan directory.
[[ -f "$entry" ]] dereferences symbolic links. A linked Markdown or SKILL.md file can resolve outside the supplied scan directory, and the scanners then read and serialize its metadata. Require both -f and ! -L in each file branch.
skills/rules-distill/scripts/scan-rules.sh#L30-L31: exclude linked Markdown files before appending tofiles.skills/skill-stocktake/scripts/scan.sh#L66-L67: exclude linked Markdown files before appending todiscovered_files.skills/rules-distill/scripts/scan-skills.sh#L64-L65: exclude linkedSKILL.mdfiles before appending todiscovered_files.
As per path instructions, treat skills/**/scripts/** as untrusted-input tooling and flag path traversal risks.
📍 Affects 3 files
skills/rules-distill/scripts/scan-rules.sh#L30-L31(this comment)skills/skill-stocktake/scripts/scan.sh#L66-L67skills/rules-distill/scripts/scan-skills.sh#L64-L65
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/rules-distill/scripts/scan-rules.sh` around lines 30 - 31, Update the
file-discovery branches in skills/rules-distill/scripts/scan-rules.sh lines
30-31, skills/skill-stocktake/scripts/scan.sh lines 66-67, and
skills/rules-distill/scripts/scan-skills.sh lines 64-65 to require both a
regular file check and a non-symbolic-link check before appending Markdown or
SKILL.md paths. Ensure these untrusted-input scanners exclude symlinks resolving
outside the scan directory and do not introduce path traversal exposure.
Source: Path instructions
| if [[ -f "$OBSERVATIONS" ]]; then | ||
| obs_7d_counts=$(jq -r --arg c "$c7" \ | ||
| 'select(.tool=="Read" and .timestamp>=$c) | .path' \ | ||
| "$OBSERVATIONS" 2>/dev/null | sort | uniq -c) | ||
| "$OBSERVATIONS" 2>/dev/null | awk '{c[$0]++} END {for (p in c) printf "%d %s\n", c[p], p}') | ||
| obs_30d_counts=$(jq -r --arg c "$c30" \ | ||
| 'select(.tool=="Read" and .timestamp>=$c) | .path' \ | ||
| "$OBSERVATIONS" 2>/dev/null | sort | uniq -c) | ||
| "$OBSERVATIONS" 2>/dev/null | awk '{c[$0]++} END {for (p in c) printf "%d %s\n", c[p], p}') | ||
| fi |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Report invalid observation data.
Lines 119-124 discard jq diagnostics for the external OBSERVATIONS file. If the file is malformed or unreadable, the scan can emit partial counts or fail without a clear error.
Remove 2>/dev/null. Check each jq result before aggregation. Write a clear error to stderr and return nonzero on failure.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/skill-stocktake/scripts/scan.sh` around lines 118 - 125, Update the
observation-counting logic in the scan flow around OBSERVATIONS to preserve jq
diagnostics, validate each jq invocation before passing output to awk, and write
a clear failure message to stderr followed by a nonzero return when either query
fails. Keep successful 7-day and 30-day aggregation behavior unchanged.
Source: Coding guidelines
haelyra
left a comment
There was a problem hiding this comment.
Thank you for the careful Windows and Bash portability work, and I am sorry the final integration review took this long. I previously approved this direction, but the exact head now needs reconciliation with the newer #2640 discovery contract before it is safe to merge. A current-main forward-port must keep AppLocker and Bash 3.2 portability while also preserving linked skill-directory discovery, visible traversal errors, and deterministic NUL-safe handling. It must also exclude direct symlink files that can escape the scan boundary and return a clear nonzero error for malformed or unreadable observation data. This is good work, but resolving those contracts is larger than a safe conflict patch in this batch. If you do not have bandwidth, that is completely okay; I queued ECC-040 for maintainers to finish after ECC 2.2. Thank you again for the strong portability foundation.
|
Thank you for the careful Windows and Bash portability work, and I am sorry the integration review took this long. Your ordering finding was spot on: the We are closing this version because the rest of the branch conflicts with the newer stocktake discovery contract (#2640, landed through #2902), and reconciling the AppLocker and Bash 3.2 changes with it is tracked as a maintainer task (ECC-040). If you would like to pick up the AppLocker piece, a small PR on current main covering just that, with a test, would be very welcome. |
…#2729) # Conflicts: # manifests/context-packs/skill-triggers@1.json
scan.sh and quick-diff.sh name each per-skill record "$i.json" and merge them with a "$tmpdir"/*.json glob. The glob sorts names as text, so once a scan finds ten or more skills 10.json lands before 2.json and the output no longer follows the NUL-sorted discovery order. Zero-pad the record names so glob order matches insertion order, and pin both scripts with a twelve-skill regression test. Rebind the skill-triggers registry digest for the changed skill sources. Carried forward from the ordering fix in affaan-m#2729. Co-authored-by: Nathan Oliver <nathan.oliver@emecogroup.com>
|
Quick follow-up: the numeric ordering fix for the stocktake scan scripts has now landed on main through integration #3959, with you credited as co-author, plus a 12-skill regression test. Thank you again! |
Ports the rules-distill and skill-stocktake scan scripts off
find | sortand jq process substitution — both break silently on AppLocker-hardened Windows machines (shimmed find/sort return empty on GNU flags; native Windows jq cannot open MSYS /proc fd paths, hidden by 2>/dev/null). Also:printf -v fname '%06d.json' "$i") so thejq -s '.' "$tmpdir"/*.jsonmerge keeps insertion order past 9 files (unpadded, 10.json sorts before 2.json)count_obs()in skill-stocktake/scan.sh (superseded by the two-pass jq pre-aggregation; zero call sites)Verified:
bash -nclean on all three; 12-skill fixture returns count 12 in exact insertion order on both skill scanners; 3-rule fixture returns total 3. Pure-bash globstar + awk counting, no new dependencies; behavior on Linux/macOS unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_014Zw3jpqfpiZzjSdRK25RiJ