memshell-party-cli 0.5.0 → 0.6.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/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { Command as Command10, CommanderError as CommanderError2 } from "commander";
4
+ import { Command as Command11, CommanderError as CommanderError2 } from "commander";
5
5
 
6
6
  // src/api/client.ts
7
7
  var ApiError = class extends Error {
@@ -4793,6 +4793,101 @@ ${lines.join("\n")}
4793
4793
  });
4794
4794
  }
4795
4795
 
4796
+ // src/commands/skill.ts
4797
+ import { Command as Command7 } from "commander";
4798
+
4799
+ // src/core/skill-install.ts
4800
+ import { cpSync, existsSync as existsSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync2 } from "fs";
4801
+ import { homedir as homedir5 } from "os";
4802
+ import { join as join7 } from "path";
4803
+ import { fileURLToPath as fileURLToPath2 } from "url";
4804
+ var SKILL_NAME = "memshell-party";
4805
+ function skillSourceDir() {
4806
+ const candidates = [
4807
+ new URL(`../skills/${SKILL_NAME}`, import.meta.url),
4808
+ // dist/*.js
4809
+ new URL(`../../skills/${SKILL_NAME}`, import.meta.url)
4810
+ // src/core/*.ts
4811
+ ];
4812
+ for (const candidate of candidates) {
4813
+ const p = fileURLToPath2(candidate);
4814
+ if (existsSync6(p)) return p;
4815
+ }
4816
+ throw new Error(`bundled skill not found (expected skills/${SKILL_NAME} in the package)`);
4817
+ }
4818
+ function skillTargetDir(scope, projectDir) {
4819
+ switch (scope) {
4820
+ case "user":
4821
+ return join7(homedir5(), ".agents", "skills", SKILL_NAME);
4822
+ case "claude":
4823
+ return join7(homedir5(), ".claude", "skills", SKILL_NAME);
4824
+ case "project":
4825
+ return join7(projectDir ?? process.cwd(), "skills", SKILL_NAME);
4826
+ }
4827
+ }
4828
+ function installSkill(scopes, opts = {}) {
4829
+ const src = opts.sourceDir ?? skillSourceDir();
4830
+ return scopes.map((scope) => {
4831
+ const dir = skillTargetDir(scope, opts.projectDir);
4832
+ mkdirSync5(dir, { recursive: true });
4833
+ cpSync(src, dir, { recursive: true });
4834
+ return { scope, dir, files: readdirSync2(dir).sort() };
4835
+ });
4836
+ }
4837
+
4838
+ // src/commands/skill.ts
4839
+ function registerSkillCommand(program) {
4840
+ program.command("skill").description("Manage the bundled agent skill (skills/memshell-party)").addCommand(
4841
+ new Command7("install").description("Install the memshell-party skill into an agent's skill directory").option("--user", "install to ~/.agents/skills (default)").option("--claude", "install to ~/.claude/skills (Claude Code)").option("--project [dir]", "install to <dir>/skills (default: current directory)").option("--json", "output raw JSON").addHelpText(
4842
+ "after",
4843
+ `
4844
+ The package ships skills/memshell-party/SKILL.md \u2014 the workflow guide that
4845
+ teaches an agent how to write site profiles, build custom shells and connect.
4846
+ This command copies it where agents look for skills. Re-run after a CLI
4847
+ upgrade to refresh the skill. Restart/rescan your agent to pick it up.
4848
+
4849
+ Examples:
4850
+ $ memparty skill install # ~/.agents/skills/memshell-party
4851
+ $ memparty skill install --claude # ~/.claude/skills/memshell-party
4852
+ $ memparty skill install --project # ./skills/memshell-party
4853
+ $ memparty skill install --user --claude # both
4854
+ `
4855
+ ).action((opts) => {
4856
+ const scopes = [];
4857
+ if (opts.user) scopes.push("user");
4858
+ if (opts.claude) scopes.push("claude");
4859
+ if (opts.project !== void 0 && opts.project !== false) {
4860
+ scopes.push("project");
4861
+ }
4862
+ if (scopes.length === 0) scopes.push("user");
4863
+ const projectDir = typeof opts.project === "string" ? opts.project : void 0;
4864
+ try {
4865
+ const results = installSkill(scopes, { projectDir });
4866
+ logOp({
4867
+ category: "gen",
4868
+ action: "skill-install",
4869
+ ok: true,
4870
+ detail: results.map((r) => `${r.scope}:${r.dir}`).join(", ")
4871
+ });
4872
+ if (opts.json) {
4873
+ process.stdout.write(`${JSON.stringify({ ok: true, installed: results }, null, 2)}
4874
+ `);
4875
+ return;
4876
+ }
4877
+ for (const r of results) {
4878
+ logInfo(`installed [${r.scope}] ${r.dir} (${r.files.join(", ")})`);
4879
+ }
4880
+ process.stdout.write(
4881
+ "\nskill installed \u2014 restart or rescan your agent to pick it up.\n"
4882
+ );
4883
+ } catch (err) {
4884
+ reportError(err instanceof Error ? err.message : String(err), opts.json ? ["--json"] : []);
4885
+ process.exitCode = 1;
4886
+ }
4887
+ })
4888
+ );
4889
+ }
4890
+
4796
4891
  // src/commands/target.ts
4797
4892
  import { Option as Option6 } from "commander";
4798
4893
  function parseExtraHeaders3(lines) {
@@ -5371,7 +5466,7 @@ async function startRepl(build) {
5371
5466
 
5372
5467
  // src/cli.ts
5373
5468
  function buildProgram() {
5374
- const program = new Command10();
5469
+ const program = new Command11();
5375
5470
  program.name("memparty").description("CLI + MCP client for MemShellParty (party.mem.mk)").version(CLI_VERSION, "-v, --version", "output the CLI version").option(
5376
5471
  "--api <url>",
5377
5472
  `MemShellParty backend URL (env ${ENV_VAR}, default ${DEFAULT_API_URL})`
@@ -5387,6 +5482,12 @@ Quick start:
5387
5482
  $ memparty list # saved targets
5388
5483
  $ memparty log # recent operations
5389
5484
 
5485
+ Site-mimicking (mimic) flow:
5486
+ $ memparty skill install # teach your agent this workflow
5487
+ $ memparty profile init acme --site http://192.0.2.1:8080 # then write the profile
5488
+ $ memparty custom build --profile acme --server Tomcat # -> injectable payload
5489
+ $ memparty demo # local end-to-end walkthrough
5490
+
5390
5491
  Every subcommand has its own examples: memparty <command> --help
5391
5492
  `
5392
5493
  );
@@ -5401,6 +5502,7 @@ Every subcommand has its own examples: memparty <command> --help
5401
5502
  registerLogCommand(program);
5402
5503
  registerParseClassNameCommand(program);
5403
5504
  registerProfileCommand(program);
5505
+ registerSkillCommand(program);
5404
5506
  registerCustomCommand(program);
5405
5507
  registerDemoCommand(program);
5406
5508
  registerVersionCommand(program);