@pkgseer/cli 0.2.0 → 0.2.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/dist/cli.js +382 -117
- package/dist/index.js +1 -1
- package/dist/shared/{chunk-1m9g9ehr.js → chunk-9016p6c6.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-9016p6c6.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -3839,6 +3839,317 @@ function registerProjectInitCommand(program) {
|
|
|
3839
3839
|
});
|
|
3840
3840
|
}
|
|
3841
3841
|
|
|
3842
|
+
// src/commands/skill-init.ts
|
|
3843
|
+
function generateSkillContent() {
|
|
3844
|
+
return `---
|
|
3845
|
+
name: pkgseer
|
|
3846
|
+
version: ${version}
|
|
3847
|
+
description: >-
|
|
3848
|
+
Search code and documentation across npm, PyPI, and Hex packages.
|
|
3849
|
+
Find functions, classes, APIs, and usage examples. Also provides
|
|
3850
|
+
quality scores, security vulnerabilities, dependencies, and comparisons.
|
|
3851
|
+
Triggers on: "how does X work", "find examples of", "search for",
|
|
3852
|
+
"is X secure", "compare X vs Y", package evaluation, dependency decisions,
|
|
3853
|
+
"what package should I use for", API lookup, security audits.
|
|
3854
|
+
---
|
|
3855
|
+
|
|
3856
|
+
# PkgSeer - Package Intelligence
|
|
3857
|
+
|
|
3858
|
+
Search and analyze packages across npm, PyPI, and Hex. All commands support \`--json\`.
|
|
3859
|
+
|
|
3860
|
+
## Search (Primary Use Case)
|
|
3861
|
+
|
|
3862
|
+
\`\`\`bash
|
|
3863
|
+
# Search code and docs across packages
|
|
3864
|
+
pkgseer search "<query>" -P lodash,express # npm packages
|
|
3865
|
+
pkgseer search "<query>" -P requests -r pypi # PyPI packages
|
|
3866
|
+
pkgseer search "authentication" -P phoenix,plug -r hex
|
|
3867
|
+
|
|
3868
|
+
# Search modes
|
|
3869
|
+
pkgseer search "<query>" -P <packages> --code # Code only
|
|
3870
|
+
pkgseer search "<query>" -P <packages> --docs # Docs only
|
|
3871
|
+
|
|
3872
|
+
# Search project dependencies (requires pkgseer.yml)
|
|
3873
|
+
pkgseer docs search "<query>"
|
|
3874
|
+
\`\`\`
|
|
3875
|
+
|
|
3876
|
+
## Package Analysis
|
|
3877
|
+
|
|
3878
|
+
\`\`\`bash
|
|
3879
|
+
# Overview: metadata, versions, quickstart
|
|
3880
|
+
pkgseer pkg info <package> [-r npm|pypi|hex]
|
|
3881
|
+
|
|
3882
|
+
# Quality score (0-100) with category breakdown
|
|
3883
|
+
pkgseer pkg quality <package> [-r registry] [-v version]
|
|
3884
|
+
|
|
3885
|
+
# Security: CVEs, severity, upgrade paths
|
|
3886
|
+
pkgseer pkg vulns <package> [-r registry] [-v version]
|
|
3887
|
+
|
|
3888
|
+
# Dependencies: direct, transitive, tree view
|
|
3889
|
+
pkgseer pkg deps <package> [-r registry] [-t] [-d depth]
|
|
3890
|
+
|
|
3891
|
+
# Compare up to 10 packages
|
|
3892
|
+
pkgseer pkg compare lodash underscore ramda
|
|
3893
|
+
pkgseer pkg compare npm:axios pypi:httpx # cross-registry
|
|
3894
|
+
\`\`\`
|
|
3895
|
+
|
|
3896
|
+
## Documentation
|
|
3897
|
+
|
|
3898
|
+
\`\`\`bash
|
|
3899
|
+
pkgseer docs list <package> [-r registry] # List pages
|
|
3900
|
+
pkgseer docs get <package>/<page-id> # Fetch content
|
|
3901
|
+
\`\`\`
|
|
3902
|
+
|
|
3903
|
+
## Tips
|
|
3904
|
+
|
|
3905
|
+
- Default registry: npm. Use \`-r pypi\` or \`-r hex\` for others
|
|
3906
|
+
- Use \`--json\` for structured output when parsing
|
|
3907
|
+
- Version defaults to latest; use \`-v\` for specific
|
|
3908
|
+
`;
|
|
3909
|
+
}
|
|
3910
|
+
function extractSkillVersion(content) {
|
|
3911
|
+
const match = content.match(/^version:\s*["']?([^"'\n]+)["']?/m);
|
|
3912
|
+
return match?.[1]?.trim() ?? null;
|
|
3913
|
+
}
|
|
3914
|
+
function getClaudeCodeSkillPaths(fs, scope) {
|
|
3915
|
+
const baseDir = scope === "user" ? fs.joinPath(fs.getHomeDir(), ".claude", "skills", "pkgseer") : fs.joinPath(fs.getCwd(), ".claude", "skills", "pkgseer");
|
|
3916
|
+
return {
|
|
3917
|
+
skillDir: baseDir,
|
|
3918
|
+
skillPath: fs.joinPath(baseDir, "SKILL.md")
|
|
3919
|
+
};
|
|
3920
|
+
}
|
|
3921
|
+
function getCodexSkillPaths(fs, scope) {
|
|
3922
|
+
const baseDir = scope === "user" ? fs.joinPath(fs.getHomeDir(), ".codex", "skills", "pkgseer") : fs.joinPath(fs.getCwd(), ".codex", "skills", "pkgseer");
|
|
3923
|
+
return {
|
|
3924
|
+
skillDir: baseDir,
|
|
3925
|
+
skillPath: fs.joinPath(baseDir, "SKILL.md")
|
|
3926
|
+
};
|
|
3927
|
+
}
|
|
3928
|
+
async function installSkill(fs, skillDir, skillPath) {
|
|
3929
|
+
try {
|
|
3930
|
+
const exists = await fs.exists(skillPath);
|
|
3931
|
+
let updated = false;
|
|
3932
|
+
if (exists) {
|
|
3933
|
+
const existingContent = await fs.readFile(skillPath);
|
|
3934
|
+
const existingVersion = extractSkillVersion(existingContent);
|
|
3935
|
+
if (existingVersion === version) {
|
|
3936
|
+
return {
|
|
3937
|
+
success: true,
|
|
3938
|
+
path: skillPath,
|
|
3939
|
+
updated: false
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3942
|
+
updated = true;
|
|
3943
|
+
}
|
|
3944
|
+
await fs.ensureDir(skillDir);
|
|
3945
|
+
const content = generateSkillContent();
|
|
3946
|
+
await fs.writeFile(skillPath, content);
|
|
3947
|
+
return {
|
|
3948
|
+
success: true,
|
|
3949
|
+
path: skillPath,
|
|
3950
|
+
updated
|
|
3951
|
+
};
|
|
3952
|
+
} catch (err) {
|
|
3953
|
+
return {
|
|
3954
|
+
success: false,
|
|
3955
|
+
error: err instanceof Error ? err.message : String(err)
|
|
3956
|
+
};
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
async function skillInitAction(deps) {
|
|
3960
|
+
const { fileSystemService: fs, promptService } = deps;
|
|
3961
|
+
const useColors = shouldUseColors2();
|
|
3962
|
+
console.log("Skill Setup");
|
|
3963
|
+
console.log(`───────────
|
|
3964
|
+
`);
|
|
3965
|
+
console.log(`Install PkgSeer as an agent skill for your AI assistant.
|
|
3966
|
+
`);
|
|
3967
|
+
console.log(dim(`Skills provide Claude/Codex with package intelligence capabilities
|
|
3968
|
+
` + `through natural language - no MCP server required.
|
|
3969
|
+
`, useColors));
|
|
3970
|
+
const tool = await promptService.select("Which AI tool would you like to configure?", [
|
|
3971
|
+
{
|
|
3972
|
+
value: "claude-code",
|
|
3973
|
+
name: "Claude Code",
|
|
3974
|
+
description: "Install skill for Claude Code CLI"
|
|
3975
|
+
},
|
|
3976
|
+
{
|
|
3977
|
+
value: "codex",
|
|
3978
|
+
name: "Codex CLI",
|
|
3979
|
+
description: "Install skill for OpenAI Codex CLI"
|
|
3980
|
+
},
|
|
3981
|
+
{
|
|
3982
|
+
value: "other",
|
|
3983
|
+
name: "Other / Manual",
|
|
3984
|
+
description: "Show SKILL.md content for manual installation"
|
|
3985
|
+
}
|
|
3986
|
+
]);
|
|
3987
|
+
if (tool === "other") {
|
|
3988
|
+
showManualInstructions2(useColors);
|
|
3989
|
+
return;
|
|
3990
|
+
}
|
|
3991
|
+
const scope = await promptService.select("Where should the skill be installed?", [
|
|
3992
|
+
{
|
|
3993
|
+
value: "user",
|
|
3994
|
+
name: "User-level (recommended)",
|
|
3995
|
+
description: "Available in all your projects"
|
|
3996
|
+
},
|
|
3997
|
+
{
|
|
3998
|
+
value: "project",
|
|
3999
|
+
name: "Project-level",
|
|
4000
|
+
description: "Only available in this project"
|
|
4001
|
+
}
|
|
4002
|
+
]);
|
|
4003
|
+
const paths = tool === "claude-code" ? getClaudeCodeSkillPaths(fs, scope) : getCodexSkillPaths(fs, scope);
|
|
4004
|
+
const exists = await fs.exists(paths.skillPath);
|
|
4005
|
+
if (exists) {
|
|
4006
|
+
const existingContent = await fs.readFile(paths.skillPath);
|
|
4007
|
+
const existingVersion = extractSkillVersion(existingContent);
|
|
4008
|
+
if (existingVersion === version) {
|
|
4009
|
+
console.log(success(`
|
|
4010
|
+
PkgSeer skill already installed (v${version})`, useColors));
|
|
4011
|
+
console.log(`Location: ${highlight(paths.skillPath, useColors)}`);
|
|
4012
|
+
return;
|
|
4013
|
+
}
|
|
4014
|
+
console.log(`
|
|
4015
|
+
Existing skill found: v${existingVersion ?? "unknown"} → v${version}`);
|
|
4016
|
+
const proceed = await promptService.confirm("Update to latest version?", true);
|
|
4017
|
+
if (!proceed) {
|
|
4018
|
+
console.log(dim(`
|
|
4019
|
+
Skip update.`, useColors));
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
console.log(dim(`
|
|
4024
|
+
Installing skill...`, useColors));
|
|
4025
|
+
const result = await installSkill(fs, paths.skillDir, paths.skillPath);
|
|
4026
|
+
if (!result.success) {
|
|
4027
|
+
console.log(error(`
|
|
4028
|
+
Failed to install skill: ${result.error}`, useColors));
|
|
4029
|
+
showManualInstructions2(useColors);
|
|
4030
|
+
return;
|
|
4031
|
+
}
|
|
4032
|
+
const toolName = tool === "claude-code" ? "Claude Code" : "Codex";
|
|
4033
|
+
const action = result.updated ? "updated" : "installed";
|
|
4034
|
+
console.log(success(`
|
|
4035
|
+
PkgSeer skill ${action} for ${toolName}!`, useColors));
|
|
4036
|
+
console.log(`Location: ${highlight(paths.skillPath, useColors)}`);
|
|
4037
|
+
console.log(dim(`
|
|
4038
|
+
The skill is now available. Try asking:
|
|
4039
|
+
` + ` "Search for authentication examples in express"
|
|
4040
|
+
` + ` "Is lodash secure? Check for vulnerabilities"
|
|
4041
|
+
` + ' "Compare axios vs fetch vs got"', useColors));
|
|
4042
|
+
}
|
|
4043
|
+
function showManualInstructions2(useColors) {
|
|
4044
|
+
console.log(`
|
|
4045
|
+
Manual Installation`);
|
|
4046
|
+
console.log(`───────────────────
|
|
4047
|
+
`);
|
|
4048
|
+
console.log(`Create a SKILL.md file in your skills directory:
|
|
4049
|
+
`);
|
|
4050
|
+
console.log("Claude Code:");
|
|
4051
|
+
console.log(` User: ${highlight("~/.claude/skills/pkgseer/SKILL.md", useColors)}`);
|
|
4052
|
+
console.log(` Project: ${highlight(".claude/skills/pkgseer/SKILL.md", useColors)}
|
|
4053
|
+
`);
|
|
4054
|
+
console.log("Codex:");
|
|
4055
|
+
console.log(` User: ${highlight("~/.codex/skills/pkgseer/SKILL.md", useColors)}`);
|
|
4056
|
+
console.log(` Project: ${highlight(".codex/skills/pkgseer/SKILL.md", useColors)}
|
|
4057
|
+
`);
|
|
4058
|
+
console.log(`Content:
|
|
4059
|
+
`);
|
|
4060
|
+
console.log("─".repeat(60));
|
|
4061
|
+
console.log(generateSkillContent());
|
|
4062
|
+
console.log("─".repeat(60));
|
|
4063
|
+
}
|
|
4064
|
+
async function skillUpdateAction(deps) {
|
|
4065
|
+
const { fileSystemService: fs } = deps;
|
|
4066
|
+
const useColors = shouldUseColors2();
|
|
4067
|
+
console.log(`Checking for skill updates...
|
|
4068
|
+
`);
|
|
4069
|
+
const locations = [
|
|
4070
|
+
{
|
|
4071
|
+
name: "Claude Code (user)",
|
|
4072
|
+
...getClaudeCodeSkillPaths(fs, "user")
|
|
4073
|
+
},
|
|
4074
|
+
{
|
|
4075
|
+
name: "Claude Code (project)",
|
|
4076
|
+
...getClaudeCodeSkillPaths(fs, "project")
|
|
4077
|
+
},
|
|
4078
|
+
{
|
|
4079
|
+
name: "Codex (user)",
|
|
4080
|
+
...getCodexSkillPaths(fs, "user")
|
|
4081
|
+
},
|
|
4082
|
+
{
|
|
4083
|
+
name: "Codex (project)",
|
|
4084
|
+
...getCodexSkillPaths(fs, "project")
|
|
4085
|
+
}
|
|
4086
|
+
];
|
|
4087
|
+
let foundAny = false;
|
|
4088
|
+
let updatedAny = false;
|
|
4089
|
+
for (const loc of locations) {
|
|
4090
|
+
const exists = await fs.exists(loc.skillPath);
|
|
4091
|
+
if (!exists)
|
|
4092
|
+
continue;
|
|
4093
|
+
foundAny = true;
|
|
4094
|
+
const content = await fs.readFile(loc.skillPath);
|
|
4095
|
+
const existingVersion = extractSkillVersion(content);
|
|
4096
|
+
if (existingVersion === version) {
|
|
4097
|
+
console.log(`${loc.name}: ${highlight(`v${version}`, useColors)} (current)`);
|
|
4098
|
+
continue;
|
|
4099
|
+
}
|
|
4100
|
+
const result = await installSkill(fs, loc.skillDir, loc.skillPath);
|
|
4101
|
+
if (result.success) {
|
|
4102
|
+
console.log(`${loc.name}: ${dim(`v${existingVersion ?? "unknown"}`, useColors)} → ${highlight(`v${version}`, useColors)}`);
|
|
4103
|
+
updatedAny = true;
|
|
4104
|
+
} else {
|
|
4105
|
+
console.log(error(`${loc.name}: Failed to update - ${result.error}`, useColors));
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
if (!foundAny) {
|
|
4109
|
+
console.log(dim("No installed skills found.", useColors));
|
|
4110
|
+
console.log(dim(`Run 'pkgseer skill init' to install the skill.
|
|
4111
|
+
`, useColors));
|
|
4112
|
+
return;
|
|
4113
|
+
}
|
|
4114
|
+
if (updatedAny) {
|
|
4115
|
+
console.log(success(`
|
|
4116
|
+
Skills updated successfully!`, useColors));
|
|
4117
|
+
} else {
|
|
4118
|
+
console.log(dim(`
|
|
4119
|
+
All skills are up to date.`, useColors));
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
var SKILL_INIT_DESCRIPTION = `Install PkgSeer as an agent skill for AI assistants.
|
|
4123
|
+
|
|
4124
|
+
Skills provide package intelligence through natural language:
|
|
4125
|
+
• Search code and documentation across packages
|
|
4126
|
+
• Check security vulnerabilities and quality scores
|
|
4127
|
+
• Compare packages and analyze dependencies
|
|
4128
|
+
|
|
4129
|
+
Supports Claude Code and Codex CLI with user or project scope.`;
|
|
4130
|
+
var SKILL_UPDATE_DESCRIPTION = `Update installed PkgSeer skills to the latest version.
|
|
4131
|
+
|
|
4132
|
+
Checks all installed skill locations and updates any that are outdated.`;
|
|
4133
|
+
function registerSkillCommand(program) {
|
|
4134
|
+
const skillCmd = program.command("skill").summary("Manage PkgSeer agent skill").description("Install and manage PkgSeer as an agent skill for AI assistants.");
|
|
4135
|
+
skillCmd.command("init").summary("Install skill for AI assistants").description(SKILL_INIT_DESCRIPTION).action(async () => {
|
|
4136
|
+
const deps = await createContainer();
|
|
4137
|
+
await skillInitAction({
|
|
4138
|
+
fileSystemService: deps.fileSystemService,
|
|
4139
|
+
promptService: deps.promptService,
|
|
4140
|
+
shellService: deps.shellService
|
|
4141
|
+
});
|
|
4142
|
+
});
|
|
4143
|
+
skillCmd.command("update").summary("Update installed skills").description(SKILL_UPDATE_DESCRIPTION).action(async () => {
|
|
4144
|
+
const deps = await createContainer();
|
|
4145
|
+
await skillUpdateAction({
|
|
4146
|
+
fileSystemService: deps.fileSystemService,
|
|
4147
|
+
promptService: deps.promptService,
|
|
4148
|
+
shellService: deps.shellService
|
|
4149
|
+
});
|
|
4150
|
+
});
|
|
4151
|
+
}
|
|
4152
|
+
|
|
3842
4153
|
// src/commands/init.ts
|
|
3843
4154
|
async function initAction(options, deps) {
|
|
3844
4155
|
const useColors = shouldUseColors2();
|
|
@@ -3847,22 +4158,43 @@ async function initAction(options, deps) {
|
|
|
3847
4158
|
`);
|
|
3848
4159
|
console.log(`Set up PkgSeer for your project:
|
|
3849
4160
|
` + ` 1. Project configuration – track dependencies and monitor vulnerabilities
|
|
3850
|
-
` + ` 2.
|
|
4161
|
+
` + ` 2. AI integration – enable AI assistant capabilities
|
|
3851
4162
|
`);
|
|
3852
|
-
console.log(dim(`Or run separately: pkgseer project init, pkgseer mcp init
|
|
4163
|
+
console.log(dim(`Or run separately: pkgseer project init, pkgseer skill init, pkgseer mcp init
|
|
3853
4164
|
`, useColors));
|
|
3854
4165
|
let setupProject = !options.skipProject;
|
|
3855
|
-
let
|
|
3856
|
-
if (options.skipProject && options.skipMcp) {
|
|
4166
|
+
let aiIntegration = "none";
|
|
4167
|
+
if (options.skipProject && options.skipMcp && options.skipSkill) {
|
|
3857
4168
|
showCliUsage(useColors);
|
|
3858
4169
|
return;
|
|
3859
4170
|
}
|
|
3860
|
-
|
|
3861
|
-
|
|
4171
|
+
const promptForAiIntegration = async () => {
|
|
4172
|
+
return deps.promptService.select("Which AI integration would you like?", [
|
|
4173
|
+
{
|
|
4174
|
+
value: "skill",
|
|
4175
|
+
name: "Skill (recommended for Claude Code / Codex)",
|
|
4176
|
+
description: "Lightweight file-based integration, auto-triggers on package queries"
|
|
4177
|
+
},
|
|
4178
|
+
{
|
|
4179
|
+
value: "mcp",
|
|
4180
|
+
name: "MCP server (for Cursor / advanced use)",
|
|
4181
|
+
description: "Structured tool integration via Model Context Protocol"
|
|
4182
|
+
}
|
|
4183
|
+
]);
|
|
4184
|
+
};
|
|
4185
|
+
if (options.skipMcp && !options.skipSkill) {
|
|
4186
|
+
aiIntegration = "skill";
|
|
4187
|
+
} else if (!options.skipMcp && options.skipSkill) {
|
|
4188
|
+
aiIntegration = "mcp";
|
|
4189
|
+
} else if (options.skipMcp && options.skipSkill) {
|
|
4190
|
+
aiIntegration = "none";
|
|
4191
|
+
}
|
|
4192
|
+
if (!options.skipProject && !options.skipMcp && !options.skipSkill) {
|
|
4193
|
+
const setupChoice = await deps.promptService.select("What would you like to set up?", [
|
|
3862
4194
|
{
|
|
3863
|
-
value: "
|
|
3864
|
-
name: "
|
|
3865
|
-
description: "Full setup: dependency tracking + AI assistant
|
|
4195
|
+
value: "full",
|
|
4196
|
+
name: "Project + AI integration (recommended)",
|
|
4197
|
+
description: "Full setup: dependency tracking + AI assistant capabilities"
|
|
3866
4198
|
},
|
|
3867
4199
|
{
|
|
3868
4200
|
value: "project",
|
|
@@ -3870,9 +4202,9 @@ async function initAction(options, deps) {
|
|
|
3870
4202
|
description: "Track dependencies and monitor for vulnerabilities"
|
|
3871
4203
|
},
|
|
3872
4204
|
{
|
|
3873
|
-
value: "
|
|
3874
|
-
name: "
|
|
3875
|
-
description: "Enable AI assistant
|
|
4205
|
+
value: "ai",
|
|
4206
|
+
name: "AI integration only",
|
|
4207
|
+
description: "Enable AI assistant capabilities"
|
|
3876
4208
|
},
|
|
3877
4209
|
{
|
|
3878
4210
|
value: "cli",
|
|
@@ -3880,15 +4212,21 @@ async function initAction(options, deps) {
|
|
|
3880
4212
|
description: "Use PkgSeer as a command-line tool"
|
|
3881
4213
|
}
|
|
3882
4214
|
]);
|
|
3883
|
-
if (
|
|
4215
|
+
if (setupChoice === "cli") {
|
|
3884
4216
|
showCliUsage(useColors);
|
|
3885
4217
|
return;
|
|
3886
4218
|
}
|
|
3887
|
-
setupProject =
|
|
3888
|
-
|
|
4219
|
+
setupProject = setupChoice === "full" || setupChoice === "project";
|
|
4220
|
+
const setupAi = setupChoice === "full" || setupChoice === "ai";
|
|
4221
|
+
if (setupAi) {
|
|
4222
|
+
aiIntegration = await promptForAiIntegration();
|
|
4223
|
+
}
|
|
4224
|
+
} else if (!options.skipMcp && !options.skipSkill) {
|
|
4225
|
+
aiIntegration = await promptForAiIntegration();
|
|
3889
4226
|
}
|
|
3890
4227
|
const projectInit = deps.projectInitAction ?? projectInitAction;
|
|
3891
4228
|
const mcpInit = deps.mcpInitAction ?? mcpInitAction;
|
|
4229
|
+
const skillInit = deps.skillInitAction ?? skillInitAction;
|
|
3892
4230
|
if (setupProject) {
|
|
3893
4231
|
const existingConfig = await deps.configService.loadProjectConfig();
|
|
3894
4232
|
if (existingConfig?.config.project) {
|
|
@@ -3920,7 +4258,21 @@ ${highlight("✓", useColors)} Project setup complete!
|
|
|
3920
4258
|
}
|
|
3921
4259
|
}
|
|
3922
4260
|
}
|
|
3923
|
-
if (
|
|
4261
|
+
if (aiIntegration === "skill") {
|
|
4262
|
+
console.log(`
|
|
4263
|
+
` + "=".repeat(50));
|
|
4264
|
+
console.log("Skill Setup");
|
|
4265
|
+
console.log("=".repeat(50) + `
|
|
4266
|
+
`);
|
|
4267
|
+
await skillInit({
|
|
4268
|
+
fileSystemService: deps.fileSystemService,
|
|
4269
|
+
promptService: deps.promptService,
|
|
4270
|
+
shellService: deps.shellService
|
|
4271
|
+
});
|
|
4272
|
+
console.log(`
|
|
4273
|
+
${highlight("✓", useColors)} Skill setup complete!
|
|
4274
|
+
`);
|
|
4275
|
+
} else if (aiIntegration === "mcp") {
|
|
3924
4276
|
const currentConfig = await deps.configService.loadProjectConfig();
|
|
3925
4277
|
const hasProjectNow = currentConfig?.config.project !== undefined;
|
|
3926
4278
|
console.log(`
|
|
@@ -3951,15 +4303,18 @@ ${highlight("✓", useColors)} MCP setup complete!
|
|
|
3951
4303
|
console.log(dim(` View at: ${deps.baseUrl}/projects/${finalConfig.config.project}`, useColors));
|
|
3952
4304
|
}
|
|
3953
4305
|
}
|
|
3954
|
-
if (
|
|
3955
|
-
console.log("
|
|
4306
|
+
if (aiIntegration === "skill") {
|
|
4307
|
+
console.log("AI Integration: Skill installed");
|
|
4308
|
+
console.log(dim(" The skill is available immediately.", useColors));
|
|
4309
|
+
} else if (aiIntegration === "mcp") {
|
|
4310
|
+
console.log("AI Integration: MCP server configured");
|
|
3956
4311
|
console.log(dim(" Restart your AI assistant to activate the MCP server.", useColors));
|
|
3957
4312
|
}
|
|
3958
4313
|
console.log(dim(`
|
|
3959
4314
|
Next steps:
|
|
3960
4315
|
` + ` • Use CLI commands: pkgseer pkg info <package>
|
|
3961
|
-
` + ` • Search
|
|
3962
|
-
` + " •
|
|
4316
|
+
` + ` • Search packages: pkgseer search <query> -P <packages>
|
|
4317
|
+
` + " • Search project docs: pkgseer docs search <query>", useColors));
|
|
3963
4318
|
}
|
|
3964
4319
|
function showCliUsage(useColors) {
|
|
3965
4320
|
console.log("Using PkgSeer via CLI");
|
|
@@ -3984,13 +4339,13 @@ function showCliUsage(useColors) {
|
|
|
3984
4339
|
` + "Tip: Run 'pkgseer quickstart' for a quick reference guide.", useColors));
|
|
3985
4340
|
}
|
|
3986
4341
|
function registerInitCommand(program) {
|
|
3987
|
-
program.command("init").summary("Set up project and
|
|
4342
|
+
program.command("init").summary("Set up project and AI integration").description(`Set up PkgSeer for your project.
|
|
3988
4343
|
|
|
3989
4344
|
Guides you through:
|
|
3990
4345
|
• Project configuration – track dependencies, monitor vulnerabilities
|
|
3991
|
-
• MCP server
|
|
4346
|
+
• AI integration – skill or MCP server for AI assistants
|
|
3992
4347
|
|
|
3993
|
-
Run separately: pkgseer project init, pkgseer mcp init`).option("--skip-project", "Skip project setup").option("--skip-mcp", "Skip MCP setup").action(async (options) => {
|
|
4348
|
+
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
4349
|
const deps = await createContainer();
|
|
3995
4350
|
await initAction(options, deps);
|
|
3996
4351
|
});
|
|
@@ -5665,103 +6020,13 @@ function registerProjectUploadCommand(program) {
|
|
|
5665
6020
|
});
|
|
5666
6021
|
});
|
|
5667
6022
|
}
|
|
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
6023
|
// src/cli.ts
|
|
5759
6024
|
var program = new Command;
|
|
5760
6025
|
program.name("pkgseer").description("Package intelligence for your AI assistant").version(version).addHelpText("after", `
|
|
5761
6026
|
Getting started:
|
|
5762
|
-
pkgseer init Interactive setup wizard (project +
|
|
6027
|
+
pkgseer init Interactive setup wizard (project + AI)
|
|
5763
6028
|
pkgseer login Authenticate with your account
|
|
5764
|
-
pkgseer
|
|
6029
|
+
pkgseer skill init Install AI agent skill
|
|
5765
6030
|
|
|
5766
6031
|
Package commands:
|
|
5767
6032
|
pkgseer pkg info <package> Get package summary
|
|
@@ -5778,9 +6043,9 @@ Documentation commands:
|
|
|
5778
6043
|
Learn more at https://pkgseer.dev`);
|
|
5779
6044
|
registerInitCommand(program);
|
|
5780
6045
|
registerMcpCommand(program);
|
|
6046
|
+
registerSkillCommand(program);
|
|
5781
6047
|
registerLoginCommand(program);
|
|
5782
6048
|
registerLogoutCommand(program);
|
|
5783
|
-
registerQuickstartCommand(program);
|
|
5784
6049
|
var auth = program.command("auth").description("View and manage authentication");
|
|
5785
6050
|
registerAuthStatusCommand(auth);
|
|
5786
6051
|
var config = program.command("config").description("View and manage configuration");
|
package/dist/index.js
CHANGED