sf-agentpmd 0.1.1 → 0.1.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.
@@ -1,15 +1,23 @@
1
1
  // src/commands/agentpmd/install-skill.ts
2
2
  import { SfCommand } from "@salesforce/sf-plugins-core";
3
- import { existsSync } from "node:fs";
4
- import { cp } from "node:fs/promises";
3
+ import { existsSync, lstatSync } from "node:fs";
4
+ import { cp, mkdir, rm } from "node:fs/promises";
5
5
  import { homedir } from "node:os";
6
- import { join } from "node:path";
6
+ import { dirname, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  var SKILL_DEST = join(homedir(), ".claude", "skills", "agentforcepmd");
9
+ function isSymlink(p) {
10
+ try {
11
+ return lstatSync(p).isSymbolicLink();
12
+ } catch {
13
+ return false;
14
+ }
15
+ }
9
16
  var AgentpmdInstallSkill = class extends SfCommand {
10
17
  static description = `Recursively copies the bundled skill tree (SKILL.md plus its references/
11
18
  pages) to ~/.claude/skills/agentforcepmd/ so Claude Code can use it as a
12
- skill. Restart Claude Code (or reload skills) afterward to activate it.`;
19
+ skill. Any existing install at that path (including a dev symlink into a
20
+ checkout) is replaced. Restart Claude Code (or reload skills) afterward.`;
13
21
  static examples = ["$ sf agentpmd install-skill"];
14
22
  static summary = "Install the agentforcepmd Claude Code skill to ~/.claude/skills/.";
15
23
  async run() {
@@ -18,7 +26,13 @@ skill. Restart Claude Code (or reload skills) afterward to activate it.`;
18
26
  if (!existsSync(skillSrc)) {
19
27
  this.error(`Skill source not found at ${skillSrc} \u2014 is the package installed correctly?`);
20
28
  }
29
+ const wasSymlink = isSymlink(SKILL_DEST);
30
+ await rm(SKILL_DEST, { force: true, recursive: true });
31
+ await mkdir(dirname(SKILL_DEST), { recursive: true });
21
32
  await cp(skillSrc, SKILL_DEST, { recursive: true });
33
+ if (wasSymlink) {
34
+ this.warn(`Replaced an existing symlink at ${SKILL_DEST} with a copy of the bundled skill.`);
35
+ }
22
36
  this.log(`Skill installed to ${SKILL_DEST}`);
23
37
  this.log("Restart Claude Code (or reload skills) to activate.");
24
38
  return { installed: SKILL_DEST };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/commands/agentpmd/install-skill.ts"],
4
- "sourcesContent": ["import { SfCommand } from '@salesforce/sf-plugins-core';\nimport { existsSync } from 'node:fs';\n// `cp` is stable since Node 16.7; the plugin runtime targets Node >= 20.\n// eslint-disable-next-line n/no-unsupported-features/node-builtins\nimport { cp } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst SKILL_DEST = join(homedir(), '.claude', 'skills', 'agentforcepmd');\n\nexport default class AgentpmdInstallSkill extends SfCommand<{ installed: string }> {\n public static readonly description = `Recursively copies the bundled skill tree (SKILL.md plus its references/\npages) to ~/.claude/skills/agentforcepmd/ so Claude Code can use it as a\nskill. Restart Claude Code (or reload skills) afterward to activate it.`;\n public static readonly examples = ['$ sf agentpmd install-skill'];\n public static readonly summary = 'Install the agentforcepmd Claude Code skill to ~/.claude/skills/.';\n\n public async run(): Promise<{ installed: string }> {\n // Resolve the skill source relative to this package's installed location.\n // Compiled file lives at dist/commands/agentpmd/install-skill.js. Joining\n // '..' from the file path strips the filename first, so reaching the\n // package root (above dist/) takes four hops: install-skill.js \u2192 agentpmd\n // \u2192 commands \u2192 dist \u2192 <pkgRoot>.\n const pkgRoot = join(fileURLToPath(import.meta.url), '..', '..', '..', '..');\n const skillSrc = join(pkgRoot, 'skill');\n\n if (!existsSync(skillSrc)) {\n this.error(`Skill source not found at ${skillSrc} \u2014 is the package installed correctly?`);\n }\n\n await cp(skillSrc, SKILL_DEST, { recursive: true });\n\n this.log(`Skill installed to ${SKILL_DEST}`);\n this.log('Restart Claude Code (or reload skills) to activate.');\n\n return { installed: SKILL_DEST };\n }\n}\n"],
5
- "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAG3B,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAE9B,IAAM,aAAa,KAAK,QAAQ,GAAG,WAAW,UAAU,eAAe;AAEvE,IAAqB,uBAArB,cAAkD,UAAiC;AAAA,EACjF,OAAuB,cAAc;AAAA;AAAA;AAAA,EAGrC,OAAuB,WAAW,CAAC,6BAA6B;AAAA,EAChE,OAAuB,UAAU;AAAA,EAEjC,MAAa,MAAsC;AAMjD,UAAM,UAAU,KAAK,cAAc,YAAY,GAAG,GAAG,MAAM,MAAM,MAAM,IAAI;AAC3E,UAAM,WAAW,KAAK,SAAS,OAAO;AAEtC,QAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,WAAK,MAAM,6BAA6B,QAAQ,6CAAwC;AAAA,IAC1F;AAEA,UAAM,GAAG,UAAU,YAAY,EAAE,WAAW,KAAK,CAAC;AAElD,SAAK,IAAI,sBAAsB,UAAU,EAAE;AAC3C,SAAK,IAAI,qDAAqD;AAE9D,WAAO,EAAE,WAAW,WAAW;AAAA,EACjC;AACF;",
4
+ "sourcesContent": ["import { SfCommand } from '@salesforce/sf-plugins-core';\nimport { existsSync, lstatSync } from 'node:fs';\n// `cp`/`rm`/`mkdir` are stable since Node >= 16; the plugin runtime targets Node >= 20.\n// eslint-disable-next-line n/no-unsupported-features/node-builtins\nimport { cp, mkdir, rm } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst SKILL_DEST = join(homedir(), '.claude', 'skills', 'agentforcepmd');\n\nfunction isSymlink(p: string): boolean {\n try {\n return lstatSync(p).isSymbolicLink();\n } catch {\n return false;\n }\n}\n\nexport default class AgentpmdInstallSkill extends SfCommand<{ installed: string }> {\n public static readonly description = `Recursively copies the bundled skill tree (SKILL.md plus its references/\npages) to ~/.claude/skills/agentforcepmd/ so Claude Code can use it as a\nskill. Any existing install at that path (including a dev symlink into a\ncheckout) is replaced. Restart Claude Code (or reload skills) afterward.`;\n public static readonly examples = ['$ sf agentpmd install-skill'];\n public static readonly summary = 'Install the agentforcepmd Claude Code skill to ~/.claude/skills/.';\n\n public async run(): Promise<{ installed: string }> {\n // Resolve the skill source relative to this package's installed location.\n // Compiled file lives at dist/commands/agentpmd/install-skill.js. Joining\n // '..' from the file path strips the filename first, so reaching the\n // package root (above dist/) takes four hops: install-skill.js \u2192 agentpmd\n // \u2192 commands \u2192 dist \u2192 <pkgRoot>.\n const pkgRoot = join(fileURLToPath(import.meta.url), '..', '..', '..', '..');\n const skillSrc = join(pkgRoot, 'skill');\n\n if (!existsSync(skillSrc)) {\n this.error(`Skill source not found at ${skillSrc} \u2014 is the package installed correctly?`);\n }\n\n // Clear any prior install first. node:fs cp refuses to overwrite a symlink\n // (e.g. a dev `ln -s` into a checkout) with a directory, and it won't prune\n // files removed upstream \u2014 so we replace the destination wholesale. rm on a\n // symlink unlinks the link only; it never follows into (or deletes) the\n // link's target.\n const wasSymlink = isSymlink(SKILL_DEST);\n await rm(SKILL_DEST, { force: true, recursive: true });\n await mkdir(dirname(SKILL_DEST), { recursive: true });\n await cp(skillSrc, SKILL_DEST, { recursive: true });\n\n if (wasSymlink) {\n this.warn(`Replaced an existing symlink at ${SKILL_DEST} with a copy of the bundled skill.`);\n }\n\n this.log(`Skill installed to ${SKILL_DEST}`);\n this.log('Restart Claude Code (or reload skills) to activate.');\n\n return { installed: SKILL_DEST };\n }\n}\n"],
5
+ "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,YAAY,iBAAiB;AAGtC,SAAS,IAAI,OAAO,UAAU;AAC9B,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,aAAa,KAAK,QAAQ,GAAG,WAAW,UAAU,eAAe;AAEvE,SAAS,UAAU,GAAoB;AACrC,MAAI;AACF,WAAO,UAAU,CAAC,EAAE,eAAe;AAAA,EACrC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,IAAqB,uBAArB,cAAkD,UAAiC;AAAA,EACjF,OAAuB,cAAc;AAAA;AAAA;AAAA;AAAA,EAIrC,OAAuB,WAAW,CAAC,6BAA6B;AAAA,EAChE,OAAuB,UAAU;AAAA,EAEjC,MAAa,MAAsC;AAMjD,UAAM,UAAU,KAAK,cAAc,YAAY,GAAG,GAAG,MAAM,MAAM,MAAM,IAAI;AAC3E,UAAM,WAAW,KAAK,SAAS,OAAO;AAEtC,QAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,WAAK,MAAM,6BAA6B,QAAQ,6CAAwC;AAAA,IAC1F;AAOA,UAAM,aAAa,UAAU,UAAU;AACvC,UAAM,GAAG,YAAY,EAAE,OAAO,MAAM,WAAW,KAAK,CAAC;AACrD,UAAM,MAAM,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AACpD,UAAM,GAAG,UAAU,YAAY,EAAE,WAAW,KAAK,CAAC;AAElD,QAAI,YAAY;AACd,WAAK,KAAK,mCAAmC,UAAU,oCAAoC;AAAA,IAC7F;AAEA,SAAK,IAAI,sBAAsB,UAAU,EAAE;AAC3C,SAAK,IAAI,qDAAqD;AAE9D,WAAO,EAAE,WAAW,WAAW;AAAA,EACjC;AACF;",
6
6
  "names": []
7
7
  }
package/dist/index.js CHANGED
@@ -3754,7 +3754,7 @@ function regionFromAntlr(loc) {
3754
3754
  };
3755
3755
  }
3756
3756
  function pluginVersion() {
3757
- return "0.1.1";
3757
+ return "0.1.2";
3758
3758
  }
3759
3759
 
3760
3760
  // src/renderers/text.ts