nexscope 1.0.0
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/README.md +93 -0
- package/bin/nexscope.js +7 -0
- package/package.json +20 -0
- package/src/commands/hello.js +36 -0
- package/src/commands/install.js +180 -0
- package/src/index.js +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# npx
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
8
|
+
|
|
9
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
+
|
|
11
|
+
## Add your files
|
|
12
|
+
|
|
13
|
+
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
|
14
|
+
- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
cd existing_repo
|
|
18
|
+
git remote add origin https://git.ziniao.com/nexscope/cient/npx.git
|
|
19
|
+
git branch -M master
|
|
20
|
+
git push -uf origin master
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Integrate with your tools
|
|
24
|
+
|
|
25
|
+
- [ ] [Set up project integrations](https://git.ziniao.com/nexscope/cient/npx/-/settings/integrations)
|
|
26
|
+
|
|
27
|
+
## Collaborate with your team
|
|
28
|
+
|
|
29
|
+
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
|
30
|
+
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
31
|
+
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
32
|
+
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
33
|
+
- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
|
34
|
+
|
|
35
|
+
## Test and Deploy
|
|
36
|
+
|
|
37
|
+
Use the built-in continuous integration in GitLab.
|
|
38
|
+
|
|
39
|
+
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
|
|
40
|
+
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
|
41
|
+
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
|
42
|
+
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
|
43
|
+
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
# Editing this README
|
|
48
|
+
|
|
49
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
50
|
+
|
|
51
|
+
## Suggestions for a good README
|
|
52
|
+
|
|
53
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
54
|
+
|
|
55
|
+
## Name
|
|
56
|
+
Choose a self-explaining name for your project.
|
|
57
|
+
|
|
58
|
+
## Description
|
|
59
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
60
|
+
|
|
61
|
+
## Badges
|
|
62
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
63
|
+
|
|
64
|
+
## Visuals
|
|
65
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
72
|
+
|
|
73
|
+
## Support
|
|
74
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
75
|
+
|
|
76
|
+
## Roadmap
|
|
77
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
81
|
+
|
|
82
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
83
|
+
|
|
84
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
85
|
+
|
|
86
|
+
## Authors and acknowledgment
|
|
87
|
+
Show your appreciation to those who have contributed to the project.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
For open source projects, say how it is licensed.
|
|
91
|
+
|
|
92
|
+
## Project status
|
|
93
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
package/bin/nexscope.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nexscope",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "NexScope CLI tool",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"nexscope": "bin/nexscope.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "node bin/nexscope.js --help"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"nexscope",
|
|
14
|
+
"cli"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=14.0.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* hello command - example command showing how to write subcommands
|
|
5
|
+
* Usage: nexscope hello [name]
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
function printHelp() {
|
|
9
|
+
console.log(`
|
|
10
|
+
Usage: nexscope hello [name]
|
|
11
|
+
|
|
12
|
+
Say hello to someone.
|
|
13
|
+
|
|
14
|
+
Arguments:
|
|
15
|
+
name The name to greet (default: World)
|
|
16
|
+
|
|
17
|
+
Options:
|
|
18
|
+
--help, -h Show help
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
nexscope hello
|
|
22
|
+
nexscope hello Alice
|
|
23
|
+
`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function run(args) {
|
|
27
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
28
|
+
printHelp();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const name = args[0] || 'World';
|
|
33
|
+
console.log(`Hello, ${name}! Welcome to NexScope.`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { run };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const https = require('https');
|
|
5
|
+
|
|
6
|
+
const SKILLS_REPO = 'nexscope-ai/eCommerce-Skills';
|
|
7
|
+
const REPO_API = 'https://api.github.com/repos/nexscope-ai/eCommerce-Skills/contents';
|
|
8
|
+
|
|
9
|
+
function printHelp() {
|
|
10
|
+
console.log(`
|
|
11
|
+
Usage: nexscope install [options]
|
|
12
|
+
|
|
13
|
+
Install eCommerce skills from the official NexScope skills repository.
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
-name <skill> Install a specific skill by name
|
|
17
|
+
--list List all available skills
|
|
18
|
+
-g, --global Install globally (user-level)
|
|
19
|
+
-a, --agent <agent> Install to a specific agent directory (e.g. claude-code, cursor)
|
|
20
|
+
--help, -h Show help
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
nexscope install Install all skills
|
|
24
|
+
nexscope install -name brand-monitoring Install a specific skill
|
|
25
|
+
nexscope install -g Install all skills globally
|
|
26
|
+
nexscope install -a claude-code Install to claude-code agent directory
|
|
27
|
+
nexscope install -name brand-monitoring -g Install specific skill globally
|
|
28
|
+
nexscope install --list List available skills
|
|
29
|
+
`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function get(url) {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
https.get(url, { headers: { 'User-Agent': 'nexscope-cli' } }, (res) => {
|
|
35
|
+
let data = '';
|
|
36
|
+
res.on('data', (chunk) => (data += chunk));
|
|
37
|
+
res.on('end', () => {
|
|
38
|
+
if (res.statusCode === 200) resolve(data);
|
|
39
|
+
else reject(new Error(`HTTP ${res.statusCode}: ${url}`));
|
|
40
|
+
});
|
|
41
|
+
}).on('error', reject);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function fetchSkillList() {
|
|
46
|
+
const data = await get(REPO_API);
|
|
47
|
+
return JSON.parse(data).filter((i) => i.type === 'dir').map((i) => i.name);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Parse directory-related flags to pass through to npx skills
|
|
51
|
+
function parseDirFlags(args) {
|
|
52
|
+
const flags = [];
|
|
53
|
+
|
|
54
|
+
if (args.includes('--global') || args.includes('-g')) {
|
|
55
|
+
flags.push('-g');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const agentIndex = args.findIndex((a) => a === '--agent' || a === '-a');
|
|
59
|
+
if (agentIndex !== -1 && args[agentIndex + 1]) {
|
|
60
|
+
flags.push('--agent', args[agentIndex + 1]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return flags;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function installOne(skillName, dirFlags) {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
const skillsArgs = ['skills', 'add', SKILLS_REPO, '--skill', skillName, '-y', ...dirFlags];
|
|
69
|
+
const proc = spawn('npx', skillsArgs, { shell: true });
|
|
70
|
+
|
|
71
|
+
let output = '';
|
|
72
|
+
proc.stdout.on('data', (d) => (output += d.toString()));
|
|
73
|
+
proc.stderr.on('data', (d) => (output += d.toString()));
|
|
74
|
+
|
|
75
|
+
proc.on('close', (code) => {
|
|
76
|
+
resolve({ skillName, success: code === 0, output });
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function runSkillsSync(skillsArgs) {
|
|
82
|
+
return new Promise((resolve) => {
|
|
83
|
+
const proc = spawn('npx', ['skills', ...skillsArgs], { shell: true, stdio: 'inherit' });
|
|
84
|
+
proc.on('close', (code) => resolve(code));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function run(args) {
|
|
89
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
90
|
+
printHelp();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (args.includes('--list')) {
|
|
95
|
+
await runSkillsSync(['add', SKILLS_REPO, '--list']);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const dirFlags = parseDirFlags(args);
|
|
100
|
+
const nameIndex = args.indexOf('-name');
|
|
101
|
+
|
|
102
|
+
if (nameIndex !== -1) {
|
|
103
|
+
const skillName = args[nameIndex + 1];
|
|
104
|
+
if (!skillName) {
|
|
105
|
+
console.error('Error: -name requires a skill name.');
|
|
106
|
+
console.error("Run 'nexscope install --help' for usage.");
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
// Single skill: pass through output directly
|
|
110
|
+
const code = await runSkillsSync(['add', SKILLS_REPO, '--skill', skillName, '-y', ...dirFlags]);
|
|
111
|
+
printThankYou();
|
|
112
|
+
process.exit(code || 0);
|
|
113
|
+
} else {
|
|
114
|
+
// All skills: fetch list then install concurrently
|
|
115
|
+
process.stdout.write('Fetching skill list... ');
|
|
116
|
+
const skills = await fetchSkillList();
|
|
117
|
+
console.log(`${skills.length} skills found.\n`);
|
|
118
|
+
|
|
119
|
+
console.log(`Installing all skills concurrently...\n`);
|
|
120
|
+
|
|
121
|
+
// Track per-skill status
|
|
122
|
+
const status = {};
|
|
123
|
+
skills.forEach((s) => (status[s] = 'pending'));
|
|
124
|
+
|
|
125
|
+
function printStatus() {
|
|
126
|
+
process.stdout.write('\x1B[2J\x1B[0f'); // clear screen
|
|
127
|
+
console.log(`Installing ${skills.length} skills concurrently...\n`);
|
|
128
|
+
for (const s of skills) {
|
|
129
|
+
const icon =
|
|
130
|
+
status[s] === 'pending' ? '⏳' :
|
|
131
|
+
status[s] === 'running' ? '⚙ ' :
|
|
132
|
+
status[s] === 'done' ? '✓ ' : '✗ ';
|
|
133
|
+
console.log(` ${icon} ${s}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
printStatus();
|
|
138
|
+
|
|
139
|
+
const promises = skills.map((skillName) => {
|
|
140
|
+
status[skillName] = 'running';
|
|
141
|
+
printStatus();
|
|
142
|
+
return installOne(skillName, dirFlags).then((result) => {
|
|
143
|
+
status[skillName] = result.success ? 'done' : 'failed';
|
|
144
|
+
printStatus();
|
|
145
|
+
return result;
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const results = await Promise.all(promises);
|
|
150
|
+
|
|
151
|
+
const succeeded = results.filter((r) => r.success);
|
|
152
|
+
const failed = results.filter((r) => !r.success);
|
|
153
|
+
|
|
154
|
+
console.log(`\n${succeeded.length}/${skills.length} skills installed successfully.`);
|
|
155
|
+
|
|
156
|
+
if (failed.length > 0) {
|
|
157
|
+
console.log('\nFailed skills:');
|
|
158
|
+
failed.forEach((r) => console.log(` ✗ ${r.skillName}`));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
printThankYou();
|
|
162
|
+
process.exit(failed.length > 0 ? 1 : 0);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function printThankYou() {
|
|
167
|
+
const purple = '\x1B[95m';
|
|
168
|
+
const reset = '\x1B[0m';
|
|
169
|
+
console.log(`
|
|
170
|
+
${purple}╔═══════════════════════════════════════════════╗
|
|
171
|
+
║ ║
|
|
172
|
+
║ Thank you for using NexScope Skills! ║
|
|
173
|
+
║ ║
|
|
174
|
+
║ Visit us at: https://www.nexscope.ai/ ║
|
|
175
|
+
║ ║
|
|
176
|
+
╚═══════════════════════════════════════════════╝${reset}
|
|
177
|
+
`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
module.exports = { run };
|
package/src/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const commands = {
|
|
4
|
+
hello: require('./commands/hello'),
|
|
5
|
+
install: require('./commands/install'),
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function printHelp() {
|
|
9
|
+
console.log(`
|
|
10
|
+
Usage: nexscope <command> [options]
|
|
11
|
+
|
|
12
|
+
Commands:
|
|
13
|
+
hello [name] Say hello (example command)
|
|
14
|
+
install Install eCommerce skills
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--help, -h Show help
|
|
18
|
+
--version, -v Show version
|
|
19
|
+
|
|
20
|
+
Run 'nexscope <command> --help' for more info on a command.
|
|
21
|
+
`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function printVersion() {
|
|
25
|
+
const pkg = require('../package.json');
|
|
26
|
+
console.log(pkg.version);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function run(args) {
|
|
30
|
+
if (!args.length || args[0] === '--help' || args[0] === '-h') {
|
|
31
|
+
printHelp();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (args[0] === '--version' || args[0] === '-v') {
|
|
36
|
+
printVersion();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const commandName = args[0];
|
|
41
|
+
const commandArgs = args.slice(1);
|
|
42
|
+
const command = commands[commandName];
|
|
43
|
+
|
|
44
|
+
if (!command) {
|
|
45
|
+
console.error(`Unknown command: ${commandName}`);
|
|
46
|
+
console.error(`Run 'nexscope --help' to see available commands.`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
command.run(commandArgs);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = { run };
|