import-pilot 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/pre-commit +4 -0
- package/.import-pilot.json +16 -0
- package/.prettierignore +4 -0
- package/.prettierrc +6 -0
- package/CHANGELOG.md +41 -0
- package/CODE_OF_CONDUCT.md +133 -0
- package/CONTRIBUTING.md +156 -0
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/SECURITY.md +78 -0
- package/bin/import-pilot.js +6 -0
- package/bun.lock +1022 -0
- package/dist/cli/autoImportCli.d.ts +32 -0
- package/dist/cli/autoImportCli.d.ts.map +1 -0
- package/dist/cli/autoImportCli.js +283 -0
- package/dist/cli/autoImportCli.js.map +1 -0
- package/dist/cli/setupWizard.d.ts +4 -0
- package/dist/cli/setupWizard.d.ts.map +1 -0
- package/dist/cli/setupWizard.js +324 -0
- package/dist/cli/setupWizard.js.map +1 -0
- package/dist/cli/wizardUtils.d.ts +22 -0
- package/dist/cli/wizardUtils.d.ts.map +1 -0
- package/dist/cli/wizardUtils.js +83 -0
- package/dist/cli/wizardUtils.js.map +1 -0
- package/dist/constants/jstsKeywords.d.ts +7 -0
- package/dist/constants/jstsKeywords.d.ts.map +1 -0
- package/dist/constants/jstsKeywords.js +34 -0
- package/dist/constants/jstsKeywords.js.map +1 -0
- package/dist/detector/languageDetector.d.ts +7 -0
- package/dist/detector/languageDetector.d.ts.map +1 -0
- package/dist/detector/languageDetector.js +65 -0
- package/dist/detector/languageDetector.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/astParser.d.ts +30 -0
- package/dist/parser/astParser.d.ts.map +1 -0
- package/dist/parser/astParser.js +142 -0
- package/dist/parser/astParser.js.map +1 -0
- package/dist/parser/frameworkParser.d.ts +39 -0
- package/dist/parser/frameworkParser.d.ts.map +1 -0
- package/dist/parser/frameworkParser.js +174 -0
- package/dist/parser/frameworkParser.js.map +1 -0
- package/dist/plugins/elixirPlugin.d.ts +17 -0
- package/dist/plugins/elixirPlugin.d.ts.map +1 -0
- package/dist/plugins/elixirPlugin.js +230 -0
- package/dist/plugins/elixirPlugin.js.map +1 -0
- package/dist/plugins/goPlugin.d.ts +18 -0
- package/dist/plugins/goPlugin.d.ts.map +1 -0
- package/dist/plugins/goPlugin.js +243 -0
- package/dist/plugins/goPlugin.js.map +1 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +29 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/jsTsPlugin.d.ts +19 -0
- package/dist/plugins/jsTsPlugin.d.ts.map +1 -0
- package/dist/plugins/jsTsPlugin.js +143 -0
- package/dist/plugins/jsTsPlugin.js.map +1 -0
- package/dist/plugins/languagePlugin.d.ts +14 -0
- package/dist/plugins/languagePlugin.d.ts.map +1 -0
- package/dist/plugins/languagePlugin.js +2 -0
- package/dist/plugins/languagePlugin.js.map +1 -0
- package/dist/plugins/pythonPlugin.d.ts +17 -0
- package/dist/plugins/pythonPlugin.d.ts.map +1 -0
- package/dist/plugins/pythonPlugin.js +337 -0
- package/dist/plugins/pythonPlugin.js.map +1 -0
- package/dist/plugins/rustPlugin.d.ts +20 -0
- package/dist/plugins/rustPlugin.d.ts.map +1 -0
- package/dist/plugins/rustPlugin.js +355 -0
- package/dist/plugins/rustPlugin.js.map +1 -0
- package/dist/reporter/reportGenerator.d.ts +25 -0
- package/dist/reporter/reportGenerator.d.ts.map +1 -0
- package/dist/reporter/reportGenerator.js +117 -0
- package/dist/reporter/reportGenerator.js.map +1 -0
- package/dist/resolver/importResolver.d.ts +33 -0
- package/dist/resolver/importResolver.d.ts.map +1 -0
- package/dist/resolver/importResolver.js +182 -0
- package/dist/resolver/importResolver.js.map +1 -0
- package/dist/scanner/fileScanner.d.ts +17 -0
- package/dist/scanner/fileScanner.d.ts.map +1 -0
- package/dist/scanner/fileScanner.js +65 -0
- package/dist/scanner/fileScanner.js.map +1 -0
- package/dist/sorter/importSorter.d.ts +7 -0
- package/dist/sorter/importSorter.d.ts.map +1 -0
- package/dist/sorter/importSorter.js +242 -0
- package/dist/sorter/importSorter.js.map +1 -0
- package/eslint.config.js +31 -0
- package/jest.config.js +32 -0
- package/package.json +75 -0
- package/tsconfig.test.json +7 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extensions": [".ts", ".tsx", ".js", ".jsx", ".vue", ".svelte", ".astro"],
|
|
3
|
+
"ignore": [
|
|
4
|
+
"**/*.test.ts",
|
|
5
|
+
"**/*.test.tsx",
|
|
6
|
+
"**/*.spec.ts",
|
|
7
|
+
"**/*.spec.tsx",
|
|
8
|
+
"**/node_modules/**",
|
|
9
|
+
"**/dist/**",
|
|
10
|
+
"**/build/**",
|
|
11
|
+
"**/.next/**",
|
|
12
|
+
"**/coverage/**"
|
|
13
|
+
],
|
|
14
|
+
"dryRun": false,
|
|
15
|
+
"verbose": false
|
|
16
|
+
}
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Comprehensive CI/CD pipeline with GitHub Actions
|
|
12
|
+
- Professional issue templates (Bug Report, Feature Request, Documentation, Question)
|
|
13
|
+
- Pull request template
|
|
14
|
+
- Security policy (SECURITY.md)
|
|
15
|
+
- Code of Conduct (CODE_OF_CONDUCT.md)
|
|
16
|
+
- Automated npm publishing workflow
|
|
17
|
+
|
|
18
|
+
## [1.0.0] - 2026-02-09
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- Initial release
|
|
22
|
+
- Automatic import detection for TypeScript/JavaScript files
|
|
23
|
+
- Support for JSX components and plain functions
|
|
24
|
+
- Multi-framework support (Vue.js, Svelte, Astro)
|
|
25
|
+
- Path alias support (@/ instead of ../)
|
|
26
|
+
- CLI with dry-run and verbose modes
|
|
27
|
+
- Configurable file extensions and ignore patterns
|
|
28
|
+
- Beautiful colored terminal output
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
- 🔍 Automatic scanning of project files
|
|
32
|
+
- 🎯 Smart detection using AST parsing
|
|
33
|
+
- 📦 Function and component detection
|
|
34
|
+
- 🔗 Import resolution across codebase
|
|
35
|
+
- 🚀 Fast regex-based parser
|
|
36
|
+
- 🎨 Beautiful CLI output
|
|
37
|
+
- 🧪 Dry run mode
|
|
38
|
+
- 🌐 Multi-framework support
|
|
39
|
+
|
|
40
|
+
[Unreleased]: https://github.com/YosefHayim/auto-import-cli/compare/v1.0.0...HEAD
|
|
41
|
+
[1.0.0]: https://github.com/YosefHayim/auto-import-cli/releases/tag/v1.0.0
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Project maintainers are responsible for clarifying and enforcing our standards
|
|
42
|
+
of acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the project maintainers responsible for enforcement at
|
|
63
|
+
yosefisabag+03@gmail.com.
|
|
64
|
+
|
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
66
|
+
|
|
67
|
+
All project maintainers are obligated to respect the privacy and security of the
|
|
68
|
+
reporter of any incident.
|
|
69
|
+
|
|
70
|
+
## Enforcement Guidelines
|
|
71
|
+
|
|
72
|
+
Project maintainers will follow these Community Impact Guidelines in determining
|
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
74
|
+
|
|
75
|
+
### 1. Correction
|
|
76
|
+
|
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
78
|
+
unprofessional or unwelcome in the community.
|
|
79
|
+
|
|
80
|
+
**Consequence**: A private, written warning from project maintainers, providing
|
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
|
83
|
+
|
|
84
|
+
### 2. Warning
|
|
85
|
+
|
|
86
|
+
**Community Impact**: A violation through a single incident or series of
|
|
87
|
+
actions.
|
|
88
|
+
|
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
93
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
94
|
+
ban.
|
|
95
|
+
|
|
96
|
+
### 3. Temporary Ban
|
|
97
|
+
|
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
|
99
|
+
sustained inappropriate behavior.
|
|
100
|
+
|
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
102
|
+
communication with the community for a specified period of time. No public or
|
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
105
|
+
Violating these terms may lead to a permanent ban.
|
|
106
|
+
|
|
107
|
+
### 4. Permanent Ban
|
|
108
|
+
|
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
112
|
+
|
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
114
|
+
community.
|
|
115
|
+
|
|
116
|
+
## Attribution
|
|
117
|
+
|
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
119
|
+
version 2.1, available at
|
|
120
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
121
|
+
|
|
122
|
+
Community Impact Guidelines were inspired by
|
|
123
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
124
|
+
|
|
125
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
127
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
128
|
+
|
|
129
|
+
[homepage]: https://www.contributor-covenant.org
|
|
130
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
131
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
132
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
133
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Contributing to Auto Import CLI
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Auto Import CLI! This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. **Clone the repository**
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/YosefHayim/auto-import-cli.git
|
|
10
|
+
cd auto-import-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. **Install dependencies**
|
|
14
|
+
```bash
|
|
15
|
+
npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
3. **Build the project**
|
|
19
|
+
```bash
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
4. **Run tests**
|
|
24
|
+
```bash
|
|
25
|
+
npm test
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Project Structure
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
auto-import-cli/
|
|
32
|
+
├── src/
|
|
33
|
+
│ ├── scanner/ # File scanning functionality
|
|
34
|
+
│ ├── parser/ # AST parsing and import detection
|
|
35
|
+
│ ├── resolver/ # Import resolution logic
|
|
36
|
+
│ ├── cli/ # CLI interface
|
|
37
|
+
│ └── __tests__/ # Unit tests
|
|
38
|
+
├── bin/ # Executable entry point
|
|
39
|
+
├── tests/
|
|
40
|
+
│ └── sample-project/ # Sample test project
|
|
41
|
+
└── dist/ # Compiled output (generated)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Development Workflow
|
|
45
|
+
|
|
46
|
+
1. **Watch mode for development**
|
|
47
|
+
```bash
|
|
48
|
+
npm run dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. **Run tests in watch mode**
|
|
52
|
+
```bash
|
|
53
|
+
npm run test:watch
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
3. **Test your changes**
|
|
57
|
+
```bash
|
|
58
|
+
node bin/auto-import.js tests/sample-project --dry-run --verbose
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Guidelines
|
|
62
|
+
|
|
63
|
+
### Code Style
|
|
64
|
+
|
|
65
|
+
- Use TypeScript with strict mode enabled
|
|
66
|
+
- Follow existing code patterns and naming conventions
|
|
67
|
+
- Use meaningful variable and function names
|
|
68
|
+
- Add comments for complex logic
|
|
69
|
+
|
|
70
|
+
### Testing
|
|
71
|
+
|
|
72
|
+
- Write unit tests for new features
|
|
73
|
+
- Ensure all existing tests pass
|
|
74
|
+
- Aim for high test coverage
|
|
75
|
+
- Test edge cases
|
|
76
|
+
|
|
77
|
+
### Commit Messages
|
|
78
|
+
|
|
79
|
+
Follow conventional commit format:
|
|
80
|
+
```
|
|
81
|
+
<type>(<scope>): <description>
|
|
82
|
+
|
|
83
|
+
Examples:
|
|
84
|
+
feat(parser): add support for dynamic imports
|
|
85
|
+
fix(resolver): correct relative path resolution
|
|
86
|
+
docs(readme): update usage examples
|
|
87
|
+
test(scanner): add tests for ignore patterns
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Adding New Features
|
|
91
|
+
|
|
92
|
+
1. **Create a feature branch**
|
|
93
|
+
```bash
|
|
94
|
+
git checkout -b feat/your-feature-name
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
2. **Implement your feature**
|
|
98
|
+
- Add source code in appropriate module
|
|
99
|
+
- Write unit tests
|
|
100
|
+
- Update documentation
|
|
101
|
+
|
|
102
|
+
3. **Test thoroughly**
|
|
103
|
+
```bash
|
|
104
|
+
npm test
|
|
105
|
+
npm run build
|
|
106
|
+
node bin/auto-import.js tests/sample-project
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
4. **Submit a pull request**
|
|
110
|
+
- Describe the feature clearly
|
|
111
|
+
- Reference any related issues
|
|
112
|
+
- Include examples if applicable
|
|
113
|
+
|
|
114
|
+
## Reporting Issues
|
|
115
|
+
|
|
116
|
+
When reporting issues, please include:
|
|
117
|
+
|
|
118
|
+
- Auto Import CLI version
|
|
119
|
+
- Node.js version
|
|
120
|
+
- Operating system
|
|
121
|
+
- Steps to reproduce
|
|
122
|
+
- Expected vs actual behavior
|
|
123
|
+
- Sample code or project structure (if possible)
|
|
124
|
+
|
|
125
|
+
## Feature Requests
|
|
126
|
+
|
|
127
|
+
Feature requests are welcome! Please:
|
|
128
|
+
|
|
129
|
+
- Check if the feature has already been requested
|
|
130
|
+
- Clearly describe the use case
|
|
131
|
+
- Explain why this feature would be valuable
|
|
132
|
+
- Provide examples if possible
|
|
133
|
+
|
|
134
|
+
## Pull Request Process
|
|
135
|
+
|
|
136
|
+
1. Fork the repository
|
|
137
|
+
2. Create your feature branch
|
|
138
|
+
3. Make your changes
|
|
139
|
+
4. Run tests and build
|
|
140
|
+
5. Update documentation
|
|
141
|
+
6. Submit pull request
|
|
142
|
+
|
|
143
|
+
Your PR will be reviewed and feedback provided. Please be patient and responsive to feedback.
|
|
144
|
+
|
|
145
|
+
## Code of Conduct
|
|
146
|
+
|
|
147
|
+
- Be respectful and professional
|
|
148
|
+
- Welcome newcomers and help them learn
|
|
149
|
+
- Focus on constructive feedback
|
|
150
|
+
- Collaborate openly
|
|
151
|
+
|
|
152
|
+
## Questions?
|
|
153
|
+
|
|
154
|
+
Feel free to open an issue for any questions or reach out to the maintainers.
|
|
155
|
+
|
|
156
|
+
Thank you for contributing! 🎉
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yosef Hayim Sabag
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# import-pilot
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**Stop adding imports by hand. Let the CLI do it.**
|
|
6
|
+
|
|
7
|
+
[](https://github.com/YosefHayim/auto-import-cli/actions)
|
|
8
|
+
[](https://www.npmjs.com/package/import-pilot)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## The Problem
|
|
16
|
+
|
|
17
|
+
You write `<Card>` or `formatName()` in your code, but the import is missing. Your editor might catch it — or it might not. In large codebases with hundreds of components, this becomes a constant friction point.
|
|
18
|
+
|
|
19
|
+
**import-pilot** scans your project, finds every missing import, resolves where it lives, and inserts the correct `import` statement. It works across frameworks (React, Vue, Angular, Svelte, Astro) and languages (TypeScript, JavaScript, Python), respects your `tsconfig.json` path aliases, and runs in under a second.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Pick your package manager:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# npm
|
|
29
|
+
npm install -g import-pilot
|
|
30
|
+
|
|
31
|
+
# yarn
|
|
32
|
+
yarn global add import-pilot
|
|
33
|
+
|
|
34
|
+
# pnpm
|
|
35
|
+
pnpm add -g import-pilot
|
|
36
|
+
|
|
37
|
+
# bun
|
|
38
|
+
bun add -g import-pilot
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or install locally as a dev dependency:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install --save-dev import-pilot
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Requires Node.js >= 18**
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Fix missing imports in current directory
|
|
55
|
+
import-pilot
|
|
56
|
+
|
|
57
|
+
# Preview what would change (no file modifications)
|
|
58
|
+
import-pilot --dry-run
|
|
59
|
+
|
|
60
|
+
# Scan a specific directory with verbose output
|
|
61
|
+
import-pilot ./src --verbose
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Interactive Setup
|
|
65
|
+
|
|
66
|
+
Run the setup wizard to configure import-pilot for your project. It detects your file types, creates a `.import-pilot.json` config, adds npm scripts, and optionally sets up husky pre-commit hooks — all interactively.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
import-pilot init
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## How It Works
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
scan files → find used identifiers → check what's imported → resolve the rest → insert imports
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
1. **Scan** — Discovers all files matching your configured extensions
|
|
81
|
+
2. **Parse** — Extracts existing imports and used identifiers (regex-based, no heavy AST deps)
|
|
82
|
+
3. **Resolve** — Matches unimported identifiers against an export cache built from your project
|
|
83
|
+
4. **Fix** — Generates and inserts the correct import statements
|
|
84
|
+
|
|
85
|
+
Path aliases from `tsconfig.json` (e.g. `@/components/Card`) are used automatically when available. Disable with `--no-alias`.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Supported Languages & Frameworks
|
|
90
|
+
|
|
91
|
+
| Language | Extensions | Frameworks |
|
|
92
|
+
|----------|-----------|------------|
|
|
93
|
+
| TypeScript / JavaScript | `.ts` `.tsx` `.js` `.jsx` | React, Angular, Next.js, Nuxt |
|
|
94
|
+
| Vue | `.vue` | Vue 2 & 3 (SFC `<script>` / `<script setup>`) |
|
|
95
|
+
| Svelte | `.svelte` | SvelteKit |
|
|
96
|
+
| Astro | `.astro` | Astro frontmatter |
|
|
97
|
+
| Python | `.py` | `from`/`import` statements, `def`/`class` exports |
|
|
98
|
+
| Elixir | `.ex` `.exs` | Mix projects |
|
|
99
|
+
| Go | `.go` | Go modules |
|
|
100
|
+
| Rust | `.rs` | Cargo projects |
|
|
101
|
+
|
|
102
|
+
See [open issues](https://github.com/YosefHayim/auto-import-cli/issues) for additional language support.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Reports
|
|
107
|
+
|
|
108
|
+
After each run, import-pilot can generate a report file at your project root. Configure via `.import-pilot.json` or the setup wizard.
|
|
109
|
+
|
|
110
|
+
| Format | Flag | Output file |
|
|
111
|
+
|--------|------|-------------|
|
|
112
|
+
| Markdown | `--report md` | `import-pilot-report.md` |
|
|
113
|
+
| JSON | `--report json` | `import-pilot-report.json` |
|
|
114
|
+
| Text | `--report txt` | `import-pilot-report.txt` |
|
|
115
|
+
| Off | `--report none` | *(no file)* |
|
|
116
|
+
|
|
117
|
+
Reports include: time taken, files scanned, files changed, each import added (before → after), and any unresolved identifiers.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## CLI Options
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
import-pilot [directory] [options]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
| Option | Short | Description | Default |
|
|
128
|
+
|--------|-------|-------------|---------|
|
|
129
|
+
| `--dry-run` | `-d` | Preview changes without writing files | `false` |
|
|
130
|
+
| `--verbose` | `-v` | Detailed output | `false` |
|
|
131
|
+
| `--extensions` | `-e` | File extensions to scan (comma-separated) | `.ts,.tsx,.js,.jsx,.vue,.svelte,.astro,.py` |
|
|
132
|
+
| `--ignore` | `-i` | Glob patterns to ignore (comma-separated) | — |
|
|
133
|
+
| `--config` | `-c` | Path to config file | `.import-pilot.json` |
|
|
134
|
+
| `--no-alias` | — | Disable tsconfig path alias resolution | `false` |
|
|
135
|
+
| `--report` | `-r` | Report format: `md`, `json`, `txt`, or `none` | `none` |
|
|
136
|
+
|
|
137
|
+
### Subcommands
|
|
138
|
+
|
|
139
|
+
| Command | Description |
|
|
140
|
+
|---------|-------------|
|
|
141
|
+
| `import-pilot init` | Interactive setup wizard |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
Create `.import-pilot.json` in your project root (or run `import-pilot init`):
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"extensions": [".ts", ".tsx", ".vue", ".py"],
|
|
152
|
+
"ignore": ["**/node_modules/**", "**/dist/**", "**/*.test.ts"],
|
|
153
|
+
"useAliases": true,
|
|
154
|
+
"verbose": false,
|
|
155
|
+
"dryRun": false,
|
|
156
|
+
"report": "md"
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
CLI flags override config file values.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Integration
|
|
165
|
+
|
|
166
|
+
### npm scripts
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"scripts": {
|
|
171
|
+
"import-pilot": "import-pilot",
|
|
172
|
+
"import-pilot:check": "import-pilot --dry-run --verbose",
|
|
173
|
+
"import-pilot:fix": "import-pilot"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Pre-commit hook (husky)
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npx husky add .husky/pre-commit "npx import-pilot --dry-run"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Or let `import-pilot init` set this up for you.
|
|
185
|
+
|
|
186
|
+
### CI
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
- name: Check imports
|
|
190
|
+
run: npx import-pilot --dry-run --verbose
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Contributing
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
git clone https://github.com/YosefHayim/auto-import-cli.git
|
|
199
|
+
cd auto-import-cli
|
|
200
|
+
npm install
|
|
201
|
+
npm run build
|
|
202
|
+
npm test
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
See [open issues](https://github.com/YosefHayim/auto-import-cli/issues) for planned features and language support.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
MIT
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
<div align="center">
|
|
216
|
+
|
|
217
|
+
Built by [**Yosef Hayim Sabag**](https://github.com/YosefHayim)
|
|
218
|
+
|
|
219
|
+
[Bug Reports](https://github.com/YosefHayim/auto-import-cli/issues) · [Buy Me a Coffee](https://buymeacoffee.com/yosefhayim)
|
|
220
|
+
|
|
221
|
+
</div>
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
We release patches for security vulnerabilities in the following versions:
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | ------------------ |
|
|
9
|
+
| 1.x.x | :white_check_mark: |
|
|
10
|
+
| < 1.0 | :x: |
|
|
11
|
+
|
|
12
|
+
## Reporting a Vulnerability
|
|
13
|
+
|
|
14
|
+
We take the security of auto-import-cli seriously. If you believe you have found a security vulnerability, please report it to us as described below.
|
|
15
|
+
|
|
16
|
+
### How to Report
|
|
17
|
+
|
|
18
|
+
**Please do NOT report security vulnerabilities through public GitHub issues.**
|
|
19
|
+
|
|
20
|
+
Instead, please email security concerns to: yosefisabag+03@gmail.com
|
|
21
|
+
|
|
22
|
+
You should receive a response within 48 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
|
|
23
|
+
|
|
24
|
+
### What to Include
|
|
25
|
+
|
|
26
|
+
Please include the following information in your report:
|
|
27
|
+
|
|
28
|
+
- Type of vulnerability
|
|
29
|
+
- Full path of source file(s) related to the manifestation of the vulnerability
|
|
30
|
+
- The location of the affected source code (tag/branch/commit or direct URL)
|
|
31
|
+
- Any special configuration required to reproduce the issue
|
|
32
|
+
- Step-by-step instructions to reproduce the issue
|
|
33
|
+
- Proof-of-concept or exploit code (if possible)
|
|
34
|
+
- Impact of the issue, including how an attacker might exploit it
|
|
35
|
+
|
|
36
|
+
### What to Expect
|
|
37
|
+
|
|
38
|
+
- Acknowledgment of your report within 48 hours
|
|
39
|
+
- Regular updates on the progress of fixing the vulnerability
|
|
40
|
+
- Credit for your discovery in the release notes (unless you prefer to remain anonymous)
|
|
41
|
+
|
|
42
|
+
## Security Best Practices for Users
|
|
43
|
+
|
|
44
|
+
When using auto-import-cli:
|
|
45
|
+
|
|
46
|
+
1. **Keep the tool updated**: Always use the latest version
|
|
47
|
+
2. **Review changes**: Use `--dry-run` flag before applying changes to your codebase
|
|
48
|
+
3. **Backup your code**: Always commit your changes before running auto-import
|
|
49
|
+
4. **Validate imports**: Review the imports added by the tool to ensure they're correct
|
|
50
|
+
5. **Use in trusted environments**: Be cautious when running on untrusted codebases
|
|
51
|
+
|
|
52
|
+
## Scope
|
|
53
|
+
|
|
54
|
+
The following are considered in scope for security vulnerabilities:
|
|
55
|
+
|
|
56
|
+
- Code injection vulnerabilities
|
|
57
|
+
- Path traversal vulnerabilities
|
|
58
|
+
- Arbitrary file read/write vulnerabilities
|
|
59
|
+
- Denial of service vulnerabilities
|
|
60
|
+
- Privilege escalation vulnerabilities
|
|
61
|
+
|
|
62
|
+
The following are considered out of scope:
|
|
63
|
+
|
|
64
|
+
- Issues in dependencies (please report these to the respective maintainers)
|
|
65
|
+
- Social engineering attacks
|
|
66
|
+
- Physical attacks
|
|
67
|
+
|
|
68
|
+
## Disclosure Policy
|
|
69
|
+
|
|
70
|
+
We follow a coordinated disclosure model:
|
|
71
|
+
|
|
72
|
+
1. Security issue is reported privately
|
|
73
|
+
2. Issue is validated and a fix is developed
|
|
74
|
+
3. Fix is tested and validated
|
|
75
|
+
4. New version is released with the fix
|
|
76
|
+
5. Security advisory is published
|
|
77
|
+
|
|
78
|
+
Thank you for helping keep auto-import-cli and its users safe!
|