## Summary
The following improvements have been made:
- Added `--json` flag to CLI command to output result as JSON
- Terminology updated to more accurately reflect object contents
- Code owner teams are always returned as an array
- Search path validation (is under repo root, exists)
- Proper handling of inline comments
- Better logging for `scripts/check_ftr_code_owners.js`
Existing usage of the `@kbn/code-owners` package has been updated
accordingly, without modifying outcomes.
## Summary
Node script to report ownership of a given file in our repo.
The script's source of truth is `.github/CODEOWNERS`, which is generated
by `@kbn/generate`
In order to reach the goal of have zero files without code ownership,
this is one small step along the way.
### To Test
#### Happy Path
`node scripts/get_owners_for_file.js --file
packages/kbn-ace/src/ace/modes/index.ts`
```
succ elastic/kibana-management
```
#### Unknown Path
`node scripts/get_owners_for_file.js --file some-file.txt`
```
ERROR Ownership of file [some-file.txt] is UNKNOWN
```
#### Error Path
`node scripts/get_owners_for_file.js`
```
ERROR Missing --flag argument
node scripts/get_owners_for_file.js
Report file ownership from GitHub CODEOWNERS file.
Options:
--file Required, path to the file to report owners for.
--verbose, -v Log verbosely
--debug Log debug messages (less than verbose)
--quiet Only log errors
--silent Don't log anything
--help Show this message
```
### Notes
Along with this small pr, next will be to ensure owners are assigned to
all ES and KBN Archives. See more info in the link below:
Contributes to: https://github.com/elastic/kibana/issues/192979
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>