@pkgseer/cli 0.2.0 → 0.2.2
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/dist/cli.js +398 -117
- package/dist/index.js +1 -1
- package/dist/shared/{chunk-1m9g9ehr.js → chunk-jyykfhaq.js} +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
version
|
|
4
|
-
} from "./shared/chunk-
|
|
4
|
+
} from "./shared/chunk-jyykfhaq.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -3839,6 +3839,333 @@ function registerProjectInitCommand(program) {
|
|
|
3839
3839
|
});
|
|
3840
3840
|
}
|
|
3841
3841
|
|
|
3842
|
+
// src/commands/skill-init.ts
|
|
3843
|
+
function getCliInvocation() {
|
|
3844
|
+
const argv1 = process.argv[1] ?? "";
|
|
3845
|
+
const npmExecPath = process.env.npm_execpath ?? "";
|
|
3846
|
+
const npmCommand = process.env.npm_command ?? "";
|
|
3847
|
+
const isNpx = npmCommand === "exec" || argv1.includes("/_npx/") || argv1.includes("\\_npx\\") || npmExecPath.includes("npx");
|
|
3848
|
+
if (isNpx) {
|
|
3849
|
+
return "npx @pkgseer/cli";
|
|
3850
|
+
}
|
|
3851
|
+
const isBunx = process.env.BUN_INSTALL !== undefined && (argv1.includes("/.bun/") || argv1.includes("\\.bun\\") || argv1.includes("/bunx/") || argv1.includes("\\bunx\\"));
|
|
3852
|
+
if (isBunx) {
|
|
3853
|
+
return "bunx @pkgseer/cli";
|
|
3854
|
+
}
|
|
3855
|
+
return "pkgseer";
|
|
3856
|
+
}
|
|
3857
|
+
function generateSkillContent(invocation = "pkgseer") {
|
|
3858
|
+
return `---
|
|
3859
|
+
name: pkgseer
|
|
3860
|
+
version: ${version}
|
|
3861
|
+
description: >-
|
|
3862
|
+
Search code and documentation across npm, PyPI, and Hex packages.
|
|
3863
|
+
Find functions, classes, APIs, and usage examples. Also provides
|
|
3864
|
+
quality scores, security vulnerabilities, dependencies, and comparisons.
|
|
3865
|
+
Triggers on: "how does X work", "find examples of", "search for",
|
|
3866
|
+
"is X secure", "compare X vs Y", package evaluation, dependency decisions,
|
|
3867
|
+
"what package should I use for", API lookup, security audits.
|
|
3868
|
+
---
|
|
3869
|
+
|
|
3870
|
+
# PkgSeer - Package Intelligence
|
|
3871
|
+
|
|
3872
|
+
Search and analyze packages across npm, PyPI, and Hex. All commands support \`--json\`.
|
|
3873
|
+
|
|
3874
|
+
## Search (Primary Use Case)
|
|
3875
|
+
|
|
3876
|
+
\`\`\`bash
|
|
3877
|
+
# Search code and docs across packages
|
|
3878
|
+
${invocation} search "<query>" -P lodash,express # npm packages
|
|
3879
|
+
${invocation} search "<query>" -P requests -r pypi # PyPI packages
|
|
3880
|
+
${invocation} search "authentication" -P phoenix,plug -r hex
|
|
3881
|
+
|
|
3882
|
+
# Search modes
|
|
3883
|
+
${invocation} search "<query>" -P <packages> --code # Code only
|
|
3884
|
+
${invocation} search "<query>" -P <packages> --docs # Docs only
|
|
3885
|
+
|
|
3886
|
+
# Search project dependencies (requires pkgseer.yml)
|
|
3887
|
+
${invocation} docs search "<query>"
|
|
3888
|
+
\`\`\`
|
|
3889
|
+
|
|
3890
|
+
## Package Analysis
|
|
3891
|
+
|
|
3892
|
+
\`\`\`bash
|
|
3893
|
+
# Overview: metadata, versions, quickstart
|
|
3894
|
+
${invocation} pkg info <package> [-r npm|pypi|hex]
|
|
3895
|
+
|
|
3896
|
+
# Quality score (0-100) with category breakdown
|
|
3897
|
+
${invocation} pkg quality <package> [-r registry] [-v version]
|
|
3898
|
+
|
|
3899
|
+
# Security: CVEs, severity, upgrade paths
|
|
3900
|
+
${invocation} pkg vulns <package> [-r registry] [-v version]
|
|
3901
|
+
|
|
3902
|
+
# Dependencies: direct, transitive, tree view
|
|
3903
|
+
${invocation} pkg deps <package> [-r registry] [-t] [-d depth]
|
|
3904
|
+
|
|
3905
|
+
# Compare up to 10 packages
|
|
3906
|
+
${invocation} pkg compare lodash underscore ramda
|
|
3907
|
+
${invocation} pkg compare npm:axios pypi:httpx # cross-registry
|
|
3908
|
+
\`\`\`
|
|
3909
|
+
|
|
3910
|
+
## Documentation
|
|
3911
|
+
|
|
3912
|
+
\`\`\`bash
|
|
3913
|
+
${invocation} docs list <package> [-r registry] # List pages
|
|
3914
|
+
${invocation} docs get <package>/<page-id> # Fetch content
|
|
3915
|
+
\`\`\`
|
|
3916
|
+
|
|
3917
|
+
## Tips
|
|
3918
|
+
|
|
3919
|
+
- Default registry: npm. Use \`-r pypi\` or \`-r hex\` for others
|
|
3920
|
+
- Use \`--json\` for structured output when parsing
|
|
3921
|
+
- Version defaults to latest; use \`-v\` for specific
|
|
3922
|
+
`;
|
|
3923
|
+
}
|
|
3924
|
+
function extractSkillVersion(content) {
|
|
3925
|
+
const match = content.match(/^version:\s*["']?([^"'\n]+)["']?/m);
|
|
3926
|
+
return match?.[1]?.trim() ?? null;
|
|
3927
|
+
}
|
|
3928
|
+
function getClaudeCodeSkillPaths(fs, scope) {
|
|
3929
|
+
const baseDir = scope === "user" ? fs.joinPath(fs.getHomeDir(), ".claude", "skills", "pkgseer") : fs.joinPath(fs.getCwd(), ".claude", "skills", "pkgseer");
|
|
3930
|
+
return {
|
|
3931
|
+
skillDir: baseDir,
|
|
3932
|
+
skillPath: fs.joinPath(baseDir, "SKILL.md")
|
|
3933
|
+
};
|
|
3934
|
+
}
|
|
3935
|
+
function getCodexSkillPaths(fs, scope) {
|
|
3936
|
+
const baseDir = scope === "user" ? fs.joinPath(fs.getHomeDir(), ".codex", "skills", "pkgseer") : fs.joinPath(fs.getCwd(), ".codex", "skills", "pkgseer");
|
|
3937
|
+
return {
|
|
3938
|
+
skillDir: baseDir,
|
|
3939
|
+
skillPath: fs.joinPath(baseDir, "SKILL.md")
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3942
|
+
async function installSkill(fs, skillDir, skillPath, invocation) {
|
|
3943
|
+
try {
|
|
3944
|
+
const exists = await fs.exists(skillPath);
|
|
3945
|
+
let updated = false;
|
|
3946
|
+
if (exists) {
|
|
3947
|
+
const existingContent = await fs.readFile(skillPath);
|
|
3948
|
+
const existingVersion = extractSkillVersion(existingContent);
|
|
3949
|
+
if (existingVersion === version) {
|
|
3950
|
+
return {
|
|
3951
|
+
success: true,
|
|
3952
|
+
path: skillPath,
|
|
3953
|
+
updated: false
|
|
3954
|
+
};
|
|
3955
|
+
}
|
|
3956
|
+
updated = true;
|
|
3957
|
+
}
|
|
3958
|
+
await fs.ensureDir(skillDir);
|
|
3959
|
+
const content = generateSkillContent(invocation);
|
|
3960
|
+
await fs.writeFile(skillPath, content);
|
|
3961
|
+
return {
|
|
3962
|
+
success: true,
|
|
3963
|
+
path: skillPath,
|
|
3964
|
+
updated
|
|
3965
|
+
};
|
|
3966
|
+
} catch (err) {
|
|
3967
|
+
return {
|
|
3968
|
+
success: false,
|
|
3969
|
+
error: err instanceof Error ? err.message : String(err)
|
|
3970
|
+
};
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
async function skillInitAction(deps) {
|
|
3974
|
+
const { fileSystemService: fs, promptService } = deps;
|
|
3975
|
+
const useColors = shouldUseColors2();
|
|
3976
|
+
const invocation = getCliInvocation();
|
|
3977
|
+
console.log("Skill Setup");
|
|
3978
|
+
console.log(`───────────
|
|
3979
|
+
`);
|
|
3980
|
+
console.log(`Install PkgSeer as an agent skill for your AI assistant.
|
|
3981
|
+
`);
|
|
3982
|
+
console.log(dim(`Skills provide Claude/Codex with package intelligence capabilities
|
|
3983
|
+
` + `through natural language - no MCP server required.
|
|
3984
|
+
`, useColors));
|
|
3985
|
+
const tool = await promptService.select("Which AI tool would you like to configure?", [
|
|
3986
|
+
{
|
|
3987
|
+
value: "claude-code",
|
|
3988
|
+
name: "Claude Code",
|
|
3989
|
+
description: "Install skill for Claude Code CLI"
|
|
3990
|
+
},
|
|
3991
|
+
{
|
|
3992
|
+
value: "codex",
|
|
3993
|
+
name: "Codex CLI",
|
|
3994
|
+
description: "Install skill for OpenAI Codex CLI"
|
|
3995
|
+
},
|
|
3996
|
+
{
|
|
3997
|
+
value: "other",
|
|
3998
|
+
name: "Other / Manual",
|
|
3999
|
+
description: "Show SKILL.md content for manual installation"
|
|
4000
|
+
}
|
|
4001
|
+
]);
|
|
4002
|
+
if (tool === "other") {
|
|
4003
|
+
showManualInstructions2(useColors, invocation);
|
|
4004
|
+
return;
|
|
4005
|
+
}
|
|
4006
|
+
const scope = await promptService.select("Where should the skill be installed?", [
|
|
4007
|
+
{
|
|
4008
|
+
value: "user",
|
|
4009
|
+
name: "User-level (recommended)",
|
|
4010
|
+
description: "Available in all your projects"
|
|
4011
|
+
},
|
|
4012
|
+
{
|
|
4013
|
+
value: "project",
|
|
4014
|
+
name: "Project-level",
|
|
4015
|
+
description: "Only available in this project"
|
|
4016
|
+
}
|
|
4017
|
+
]);
|
|
4018
|
+
const paths = tool === "claude-code" ? getClaudeCodeSkillPaths(fs, scope) : getCodexSkillPaths(fs, scope);
|
|
4019
|
+
const exists = await fs.exists(paths.skillPath);
|
|
4020
|
+
if (exists) {
|
|
4021
|
+
const existingContent = await fs.readFile(paths.skillPath);
|
|
4022
|
+
const existingVersion = extractSkillVersion(existingContent);
|
|
4023
|
+
if (existingVersion === version) {
|
|
4024
|
+
console.log(success(`
|
|
4025
|
+
PkgSeer skill already installed (v${version})`, useColors));
|
|
4026
|
+
console.log(`Location: ${highlight(paths.skillPath, useColors)}`);
|
|
4027
|
+
return;
|
|
4028
|
+
}
|
|
4029
|
+
console.log(`
|
|
4030
|
+
Existing skill found: v${existingVersion ?? "unknown"} → v${version}`);
|
|
4031
|
+
const proceed = await promptService.confirm("Update to latest version?", true);
|
|
4032
|
+
if (!proceed) {
|
|
4033
|
+
console.log(dim(`
|
|
4034
|
+
Skip update.`, useColors));
|
|
4035
|
+
return;
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
console.log(dim(`
|
|
4039
|
+
Installing skill...`, useColors));
|
|
4040
|
+
const result = await installSkill(fs, paths.skillDir, paths.skillPath, invocation);
|
|
4041
|
+
if (!result.success) {
|
|
4042
|
+
console.log(error(`
|
|
4043
|
+
Failed to install skill: ${result.error}`, useColors));
|
|
4044
|
+
showManualInstructions2(useColors, invocation);
|
|
4045
|
+
return;
|
|
4046
|
+
}
|
|
4047
|
+
const toolName = tool === "claude-code" ? "Claude Code" : "Codex";
|
|
4048
|
+
const action = result.updated ? "updated" : "installed";
|
|
4049
|
+
console.log(success(`
|
|
4050
|
+
PkgSeer skill ${action} for ${toolName}!`, useColors));
|
|
4051
|
+
console.log(`Location: ${highlight(paths.skillPath, useColors)}`);
|
|
4052
|
+
console.log(dim(`
|
|
4053
|
+
The skill is now available. Try asking:
|
|
4054
|
+
` + ` "Search for authentication examples in express"
|
|
4055
|
+
` + ` "Is lodash secure? Check for vulnerabilities"
|
|
4056
|
+
` + ' "Compare axios vs fetch vs got"', useColors));
|
|
4057
|
+
}
|
|
4058
|
+
function showManualInstructions2(useColors, invocation) {
|
|
4059
|
+
console.log(`
|
|
4060
|
+
Manual Installation`);
|
|
4061
|
+
console.log(`───────────────────
|
|
4062
|
+
`);
|
|
4063
|
+
console.log(`Create a SKILL.md file in your skills directory:
|
|
4064
|
+
`);
|
|
4065
|
+
console.log("Claude Code:");
|
|
4066
|
+
console.log(` User: ${highlight("~/.claude/skills/pkgseer/SKILL.md", useColors)}`);
|
|
4067
|
+
console.log(` Project: ${highlight(".claude/skills/pkgseer/SKILL.md", useColors)}
|
|
4068
|
+
`);
|
|
4069
|
+
console.log("Codex:");
|
|
4070
|
+
console.log(` User: ${highlight("~/.codex/skills/pkgseer/SKILL.md", useColors)}`);
|
|
4071
|
+
console.log(` Project: ${highlight(".codex/skills/pkgseer/SKILL.md", useColors)}
|
|
4072
|
+
`);
|
|
4073
|
+
console.log(`Content:
|
|
4074
|
+
`);
|
|
4075
|
+
console.log("─".repeat(60));
|
|
4076
|
+
console.log(generateSkillContent(invocation));
|
|
4077
|
+
console.log("─".repeat(60));
|
|
4078
|
+
}
|
|
4079
|
+
async function skillUpdateAction(deps) {
|
|
4080
|
+
const { fileSystemService: fs } = deps;
|
|
4081
|
+
const useColors = shouldUseColors2();
|
|
4082
|
+
const invocation = getCliInvocation();
|
|
4083
|
+
console.log(`Checking for skill updates...
|
|
4084
|
+
`);
|
|
4085
|
+
const locations = [
|
|
4086
|
+
{
|
|
4087
|
+
name: "Claude Code (user)",
|
|
4088
|
+
...getClaudeCodeSkillPaths(fs, "user")
|
|
4089
|
+
},
|
|
4090
|
+
{
|
|
4091
|
+
name: "Claude Code (project)",
|
|
4092
|
+
...getClaudeCodeSkillPaths(fs, "project")
|
|
4093
|
+
},
|
|
4094
|
+
{
|
|
4095
|
+
name: "Codex (user)",
|
|
4096
|
+
...getCodexSkillPaths(fs, "user")
|
|
4097
|
+
},
|
|
4098
|
+
{
|
|
4099
|
+
name: "Codex (project)",
|
|
4100
|
+
...getCodexSkillPaths(fs, "project")
|
|
4101
|
+
}
|
|
4102
|
+
];
|
|
4103
|
+
let foundAny = false;
|
|
4104
|
+
let updatedAny = false;
|
|
4105
|
+
for (const loc of locations) {
|
|
4106
|
+
const exists = await fs.exists(loc.skillPath);
|
|
4107
|
+
if (!exists)
|
|
4108
|
+
continue;
|
|
4109
|
+
foundAny = true;
|
|
4110
|
+
const content = await fs.readFile(loc.skillPath);
|
|
4111
|
+
const existingVersion = extractSkillVersion(content);
|
|
4112
|
+
if (existingVersion === version) {
|
|
4113
|
+
console.log(`${loc.name}: ${highlight(`v${version}`, useColors)} (current)`);
|
|
4114
|
+
continue;
|
|
4115
|
+
}
|
|
4116
|
+
const result = await installSkill(fs, loc.skillDir, loc.skillPath, invocation);
|
|
4117
|
+
if (result.success) {
|
|
4118
|
+
console.log(`${loc.name}: ${dim(`v${existingVersion ?? "unknown"}`, useColors)} → ${highlight(`v${version}`, useColors)}`);
|
|
4119
|
+
updatedAny = true;
|
|
4120
|
+
} else {
|
|
4121
|
+
console.log(error(`${loc.name}: Failed to update - ${result.error}`, useColors));
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
if (!foundAny) {
|
|
4125
|
+
console.log(dim("No installed skills found.", useColors));
|
|
4126
|
+
console.log(dim(`Run '${invocation} skill init' to install the skill.
|
|
4127
|
+
`, useColors));
|
|
4128
|
+
return;
|
|
4129
|
+
}
|
|
4130
|
+
if (updatedAny) {
|
|
4131
|
+
console.log(success(`
|
|
4132
|
+
Skills updated successfully!`, useColors));
|
|
4133
|
+
} else {
|
|
4134
|
+
console.log(dim(`
|
|
4135
|
+
All skills are up to date.`, useColors));
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
var SKILL_INIT_DESCRIPTION = `Install PkgSeer as an agent skill for AI assistants.
|
|
4139
|
+
|
|
4140
|
+
Skills provide package intelligence through natural language:
|
|
4141
|
+
• Search code and documentation across packages
|
|
4142
|
+
• Check security vulnerabilities and quality scores
|
|
4143
|
+
• Compare packages and analyze dependencies
|
|
4144
|
+
|
|
4145
|
+
Supports Claude Code and Codex CLI with user or project scope.`;
|
|
4146
|
+
var SKILL_UPDATE_DESCRIPTION = `Update installed PkgSeer skills to the latest version.
|
|
4147
|
+
|
|
4148
|
+
Checks all installed skill locations and updates any that are outdated.`;
|
|
4149
|
+
function registerSkillCommand(program) {
|
|
4150
|
+
const skillCmd = program.command("skill").summary("Manage PkgSeer agent skill").description("Install and manage PkgSeer as an agent skill for AI assistants.");
|
|
4151
|
+
skillCmd.command("init").summary("Install skill for AI assistants").description(SKILL_INIT_DESCRIPTION).action(async () => {
|
|
4152
|
+
const deps = await createContainer();
|
|
4153
|
+
await skillInitAction({
|
|
4154
|
+
fileSystemService: deps.fileSystemService,
|
|
4155
|
+
promptService: deps.promptService,
|
|
4156
|
+
shellService: deps.shellService
|
|
4157
|
+
});
|
|
4158
|
+
});
|
|
4159
|
+
skillCmd.command("update").summary("Update installed skills").description(SKILL_UPDATE_DESCRIPTION).action(async () => {
|
|
4160
|
+
const deps = await createContainer();
|
|
4161
|
+
await skillUpdateAction({
|
|
4162
|
+
fileSystemService: deps.fileSystemService,
|
|
4163
|
+
promptService: deps.promptService,
|
|
4164
|
+
shellService: deps.shellService
|
|
4165
|
+
});
|
|
4166
|
+
});
|
|
4167
|
+
}
|
|
4168
|
+
|
|
3842
4169
|
// src/commands/init.ts
|
|
3843
4170
|
async function initAction(options, deps) {
|
|
3844
4171
|
const useColors = shouldUseColors2();
|
|
@@ -3847,22 +4174,43 @@ async function initAction(options, deps) {
|
|
|
3847
4174
|
`);
|
|
3848
4175
|
console.log(`Set up PkgSeer for your project:
|
|
3849
4176
|
` + ` 1. Project configuration – track dependencies and monitor vulnerabilities
|
|
3850
|
-
` + ` 2.
|
|
4177
|
+
` + ` 2. AI integration – enable AI assistant capabilities
|
|
3851
4178
|
`);
|
|
3852
|
-
console.log(dim(`Or run separately: pkgseer project init, pkgseer mcp init
|
|
4179
|
+
console.log(dim(`Or run separately: pkgseer project init, pkgseer skill init, pkgseer mcp init
|
|
3853
4180
|
`, useColors));
|
|
3854
4181
|
let setupProject = !options.skipProject;
|
|
3855
|
-
let
|
|
3856
|
-
if (options.skipProject && options.skipMcp) {
|
|
4182
|
+
let aiIntegration = "none";
|
|
4183
|
+
if (options.skipProject && options.skipMcp && options.skipSkill) {
|
|
3857
4184
|
showCliUsage(useColors);
|
|
3858
4185
|
return;
|
|
3859
4186
|
}
|
|
3860
|
-
|
|
3861
|
-
|
|
4187
|
+
const promptForAiIntegration = async () => {
|
|
4188
|
+
return deps.promptService.select("Which AI integration would you like?", [
|
|
4189
|
+
{
|
|
4190
|
+
value: "skill",
|
|
4191
|
+
name: "Skill (recommended for Claude Code / Codex)",
|
|
4192
|
+
description: "Lightweight file-based integration, auto-triggers on package queries"
|
|
4193
|
+
},
|
|
4194
|
+
{
|
|
4195
|
+
value: "mcp",
|
|
4196
|
+
name: "MCP server (for Cursor / advanced use)",
|
|
4197
|
+
description: "Structured tool integration via Model Context Protocol"
|
|
4198
|
+
}
|
|
4199
|
+
]);
|
|
4200
|
+
};
|
|
4201
|
+
if (options.skipMcp && !options.skipSkill) {
|
|
4202
|
+
aiIntegration = "skill";
|
|
4203
|
+
} else if (!options.skipMcp && options.skipSkill) {
|
|
4204
|
+
aiIntegration = "mcp";
|
|
4205
|
+
} else if (options.skipMcp && options.skipSkill) {
|
|
4206
|
+
aiIntegration = "none";
|
|
4207
|
+
}
|
|
4208
|
+
if (!options.skipProject && !options.skipMcp && !options.skipSkill) {
|
|
4209
|
+
const setupChoice = await deps.promptService.select("What would you like to set up?", [
|
|
3862
4210
|
{
|
|
3863
|
-
value: "
|
|
3864
|
-
name: "
|
|
3865
|
-
description: "Full setup: dependency tracking + AI assistant
|
|
4211
|
+
value: "full",
|
|
4212
|
+
name: "Project + AI integration (recommended)",
|
|
4213
|
+
description: "Full setup: dependency tracking + AI assistant capabilities"
|
|
3866
4214
|
},
|
|
3867
4215
|
{
|
|
3868
4216
|
value: "project",
|
|
@@ -3870,9 +4218,9 @@ async function initAction(options, deps) {
|
|
|
3870
4218
|
description: "Track dependencies and monitor for vulnerabilities"
|
|
3871
4219
|
},
|
|
3872
4220
|
{
|
|
3873
|
-
value: "
|
|
3874
|
-
name: "
|
|
3875
|
-
description: "Enable AI assistant
|
|
4221
|
+
value: "ai",
|
|
4222
|
+
name: "AI integration only",
|
|
4223
|
+
description: "Enable AI assistant capabilities"
|
|
3876
4224
|
},
|
|
3877
4225
|
{
|
|
3878
4226
|
value: "cli",
|
|
@@ -3880,15 +4228,21 @@ async function initAction(options, deps) {
|
|
|
3880
4228
|
description: "Use PkgSeer as a command-line tool"
|
|
3881
4229
|
}
|
|
3882
4230
|
]);
|
|
3883
|
-
if (
|
|
4231
|
+
if (setupChoice === "cli") {
|
|
3884
4232
|
showCliUsage(useColors);
|
|
3885
4233
|
return;
|
|
3886
4234
|
}
|
|
3887
|
-
setupProject =
|
|
3888
|
-
|
|
4235
|
+
setupProject = setupChoice === "full" || setupChoice === "project";
|
|
4236
|
+
const setupAi = setupChoice === "full" || setupChoice === "ai";
|
|
4237
|
+
if (setupAi) {
|
|
4238
|
+
aiIntegration = await promptForAiIntegration();
|
|
4239
|
+
}
|
|
4240
|
+
} else if (!options.skipMcp && !options.skipSkill) {
|
|
4241
|
+
aiIntegration = await promptForAiIntegration();
|
|
3889
4242
|
}
|
|
3890
4243
|
const projectInit = deps.projectInitAction ?? projectInitAction;
|
|
3891
4244
|
const mcpInit = deps.mcpInitAction ?? mcpInitAction;
|
|
4245
|
+
const skillInit = deps.skillInitAction ?? skillInitAction;
|
|
3892
4246
|
if (setupProject) {
|
|
3893
4247
|
const existingConfig = await deps.configService.loadProjectConfig();
|
|
3894
4248
|
if (existingConfig?.config.project) {
|
|
@@ -3920,7 +4274,21 @@ ${highlight("✓", useColors)} Project setup complete!
|
|
|
3920
4274
|
}
|
|
3921
4275
|
}
|
|
3922
4276
|
}
|
|
3923
|
-
if (
|
|
4277
|
+
if (aiIntegration === "skill") {
|
|
4278
|
+
console.log(`
|
|
4279
|
+
` + "=".repeat(50));
|
|
4280
|
+
console.log("Skill Setup");
|
|
4281
|
+
console.log("=".repeat(50) + `
|
|
4282
|
+
`);
|
|
4283
|
+
await skillInit({
|
|
4284
|
+
fileSystemService: deps.fileSystemService,
|
|
4285
|
+
promptService: deps.promptService,
|
|
4286
|
+
shellService: deps.shellService
|
|
4287
|
+
});
|
|
4288
|
+
console.log(`
|
|
4289
|
+
${highlight("✓", useColors)} Skill setup complete!
|
|
4290
|
+
`);
|
|
4291
|
+
} else if (aiIntegration === "mcp") {
|
|
3924
4292
|
const currentConfig = await deps.configService.loadProjectConfig();
|
|
3925
4293
|
const hasProjectNow = currentConfig?.config.project !== undefined;
|
|
3926
4294
|
console.log(`
|
|
@@ -3951,15 +4319,18 @@ ${highlight("✓", useColors)} MCP setup complete!
|
|
|
3951
4319
|
console.log(dim(` View at: ${deps.baseUrl}/projects/${finalConfig.config.project}`, useColors));
|
|
3952
4320
|
}
|
|
3953
4321
|
}
|
|
3954
|
-
if (
|
|
3955
|
-
console.log("
|
|
4322
|
+
if (aiIntegration === "skill") {
|
|
4323
|
+
console.log("AI Integration: Skill installed");
|
|
4324
|
+
console.log(dim(" The skill is available immediately.", useColors));
|
|
4325
|
+
} else if (aiIntegration === "mcp") {
|
|
4326
|
+
console.log("AI Integration: MCP server configured");
|
|
3956
4327
|
console.log(dim(" Restart your AI assistant to activate the MCP server.", useColors));
|
|
3957
4328
|
}
|
|
3958
4329
|
console.log(dim(`
|
|
3959
4330
|
Next steps:
|
|
3960
4331
|
` + ` • Use CLI commands: pkgseer pkg info <package>
|
|
3961
|
-
` + ` • Search
|
|
3962
|
-
` + " •
|
|
4332
|
+
` + ` • Search packages: pkgseer search <query> -P <packages>
|
|
4333
|
+
` + " • Search project docs: pkgseer docs search <query>", useColors));
|
|
3963
4334
|
}
|
|
3964
4335
|
function showCliUsage(useColors) {
|
|
3965
4336
|
console.log("Using PkgSeer via CLI");
|
|
@@ -3984,13 +4355,13 @@ function showCliUsage(useColors) {
|
|
|
3984
4355
|
` + "Tip: Run 'pkgseer quickstart' for a quick reference guide.", useColors));
|
|
3985
4356
|
}
|
|
3986
4357
|
function registerInitCommand(program) {
|
|
3987
|
-
program.command("init").summary("Set up project and
|
|
4358
|
+
program.command("init").summary("Set up project and AI integration").description(`Set up PkgSeer for your project.
|
|
3988
4359
|
|
|
3989
4360
|
Guides you through:
|
|
3990
4361
|
• Project configuration – track dependencies, monitor vulnerabilities
|
|
3991
|
-
• MCP server
|
|
4362
|
+
• AI integration – skill or MCP server for AI assistants
|
|
3992
4363
|
|
|
3993
|
-
Run separately: pkgseer project init, pkgseer mcp init`).option("--skip-project", "Skip project setup").option("--skip-mcp", "Skip MCP setup").action(async (options) => {
|
|
4364
|
+
Run separately: pkgseer project init, pkgseer skill init, pkgseer mcp init`).option("--skip-project", "Skip project setup").option("--skip-mcp", "Skip MCP setup (use skill instead)").option("--skip-skill", "Skip skill setup (use MCP instead)").action(async (options) => {
|
|
3994
4365
|
const deps = await createContainer();
|
|
3995
4366
|
await initAction(options, deps);
|
|
3996
4367
|
});
|
|
@@ -5665,103 +6036,13 @@ function registerProjectUploadCommand(program) {
|
|
|
5665
6036
|
});
|
|
5666
6037
|
});
|
|
5667
6038
|
}
|
|
5668
|
-
// src/commands/quickstart.ts
|
|
5669
|
-
var QUICKSTART_TEXT = `# PkgSeer CLI - Quick Reference for AI Agents
|
|
5670
|
-
|
|
5671
|
-
PkgSeer provides package intelligence for npm, PyPI, and Hex registries.
|
|
5672
|
-
|
|
5673
|
-
## Package Commands (pkgseer pkg)
|
|
5674
|
-
|
|
5675
|
-
### Get package info
|
|
5676
|
-
\`pkgseer pkg info <package> [-r npm|pypi|hex] [--json]\`
|
|
5677
|
-
Returns: metadata, versions, security advisories, quickstart
|
|
5678
|
-
|
|
5679
|
-
### Check quality score
|
|
5680
|
-
\`pkgseer pkg quality <package> [-r registry] [-v pkg-version] [--json]\`
|
|
5681
|
-
Returns: overall score, category breakdown, rule details
|
|
5682
|
-
|
|
5683
|
-
### List dependencies
|
|
5684
|
-
\`pkgseer pkg deps <package> [-r registry] [-v pkg-version] [-t] [-d depth] [--json]\`
|
|
5685
|
-
Returns: direct deps, transitive count, dependency tree (with -t)
|
|
5686
|
-
|
|
5687
|
-
### Check vulnerabilities
|
|
5688
|
-
\`pkgseer pkg vulns <package> [-r registry] [-v pkg-version] [--json]\`
|
|
5689
|
-
Returns: CVEs, severity, affected versions, upgrade guidance
|
|
5690
|
-
|
|
5691
|
-
### Compare packages
|
|
5692
|
-
\`pkgseer pkg compare <pkg1> <pkg2> [...] [--json]\`
|
|
5693
|
-
Format: [registry:]name[@version] (e.g., npm:lodash, pypi:requests@2.31.0)
|
|
5694
|
-
Returns: side-by-side quality, downloads, vulnerabilities
|
|
5695
|
-
|
|
5696
|
-
## Documentation Commands (pkgseer docs)
|
|
5697
|
-
|
|
5698
|
-
### List doc pages
|
|
5699
|
-
\`pkgseer docs list <package> [-r registry] [-v pkg-version] [--json]\`
|
|
5700
|
-
Returns: page titles, IDs (slugs), word counts
|
|
5701
|
-
|
|
5702
|
-
### Get doc page
|
|
5703
|
-
\`pkgseer docs get <package>/<page-id> [<package>/<page-id> ...] [-r registry] [-v pkg-version] [--json]\`
|
|
5704
|
-
Returns: full page content (markdown), breadcrumbs, source URL
|
|
5705
|
-
Supports multiple pages: \`pkgseer docs get express/readme express/api\`
|
|
5706
|
-
|
|
5707
|
-
### Search docs
|
|
5708
|
-
\`pkgseer docs search "<query>" [-p package] [-r registry] [--json]\`
|
|
5709
|
-
\`pkgseer docs search --keywords term1,term2 [-s] [-l limit]\`
|
|
5710
|
-
Default: searches project docs (if project configured)
|
|
5711
|
-
With -p: searches specific package docs
|
|
5712
|
-
Returns: ranked results with relevance scores
|
|
5713
|
-
|
|
5714
|
-
## Tips for AI Agents
|
|
5715
|
-
|
|
5716
|
-
1. Use \`--json\` for structured data parsing
|
|
5717
|
-
2. Default registry is npm; use \`-r pypi\` or \`-r hex\` for others
|
|
5718
|
-
3. Version defaults to latest; use \`-v <version>\` for specific version
|
|
5719
|
-
4. For docs search, configure project in pkgseer.yml for project-wide search
|
|
5720
|
-
5. Compare up to 10 packages at once with \`pkg compare\`
|
|
5721
|
-
|
|
5722
|
-
## MCP Server
|
|
5723
|
-
|
|
5724
|
-
For Model Context Protocol integration:
|
|
5725
|
-
\`pkgseer mcp\`
|
|
5726
|
-
|
|
5727
|
-
Add to MCP config:
|
|
5728
|
-
{
|
|
5729
|
-
"pkgseer": {
|
|
5730
|
-
"command": "pkgseer",
|
|
5731
|
-
"args": ["mcp"]
|
|
5732
|
-
}
|
|
5733
|
-
}
|
|
5734
|
-
`;
|
|
5735
|
-
function quickstartAction(options) {
|
|
5736
|
-
if (options.json) {
|
|
5737
|
-
console.log(JSON.stringify({
|
|
5738
|
-
version,
|
|
5739
|
-
quickstart: QUICKSTART_TEXT
|
|
5740
|
-
}));
|
|
5741
|
-
} else {
|
|
5742
|
-
console.log(QUICKSTART_TEXT);
|
|
5743
|
-
}
|
|
5744
|
-
}
|
|
5745
|
-
var QUICKSTART_DESCRIPTION = `Show quick reference for AI agents.
|
|
5746
|
-
|
|
5747
|
-
Displays a concise guide to pkgseer CLI commands optimized
|
|
5748
|
-
for LLM agents. Includes command syntax, options, and tips
|
|
5749
|
-
for effective usage.
|
|
5750
|
-
|
|
5751
|
-
Use --json for structured output.`;
|
|
5752
|
-
function registerQuickstartCommand(program) {
|
|
5753
|
-
program.command("quickstart").summary("Show quick reference for AI agents").description(QUICKSTART_DESCRIPTION).option("--json", "Output as JSON").action((options) => {
|
|
5754
|
-
quickstartAction(options);
|
|
5755
|
-
});
|
|
5756
|
-
}
|
|
5757
|
-
|
|
5758
6039
|
// src/cli.ts
|
|
5759
6040
|
var program = new Command;
|
|
5760
6041
|
program.name("pkgseer").description("Package intelligence for your AI assistant").version(version).addHelpText("after", `
|
|
5761
6042
|
Getting started:
|
|
5762
|
-
pkgseer init Interactive setup wizard (project +
|
|
6043
|
+
pkgseer init Interactive setup wizard (project + AI)
|
|
5763
6044
|
pkgseer login Authenticate with your account
|
|
5764
|
-
pkgseer
|
|
6045
|
+
pkgseer skill init Install AI agent skill
|
|
5765
6046
|
|
|
5766
6047
|
Package commands:
|
|
5767
6048
|
pkgseer pkg info <package> Get package summary
|
|
@@ -5778,9 +6059,9 @@ Documentation commands:
|
|
|
5778
6059
|
Learn more at https://pkgseer.dev`);
|
|
5779
6060
|
registerInitCommand(program);
|
|
5780
6061
|
registerMcpCommand(program);
|
|
6062
|
+
registerSkillCommand(program);
|
|
5781
6063
|
registerLoginCommand(program);
|
|
5782
6064
|
registerLogoutCommand(program);
|
|
5783
|
-
registerQuickstartCommand(program);
|
|
5784
6065
|
var auth = program.command("auth").description("View and manage authentication");
|
|
5785
6066
|
registerAuthStatusCommand(auth);
|
|
5786
6067
|
var config = program.command("config").description("View and manage configuration");
|
package/dist/index.js
CHANGED