skills-manifest 0.3.1 → 0.3.3

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,12 +1,12 @@
1
1
  import { t as add } from "../add-CmzBK4br.mjs";
2
- import { t as init } from "../init-4enI_4o6.mjs";
2
+ import { t as init } from "../init-DbLmaD0L.mjs";
3
3
  import { t as install } from "../install-CmdQl0XL.mjs";
4
4
  import { t as remove } from "../remove-ByCBLakw.mjs";
5
5
  import { t as sync } from "../sync-1OE33hei.mjs";
6
6
  import { defineCommand, runMain } from "citty";
7
7
 
8
8
  //#region package.json
9
- var version = "0.3.1";
9
+ var version = "0.3.3";
10
10
 
11
11
  //#endregion
12
12
  //#region src/cli/index.ts
package/dist/cli/init.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as init } from "../init-4enI_4o6.mjs";
1
+ import { t as init } from "../init-DbLmaD0L.mjs";
2
2
 
3
3
  export { init };
@@ -29,8 +29,11 @@ const init = defineCommand({
29
29
  await fs.writeFile(manifestPath, JSON.stringify(content, null, 2));
30
30
  }
31
31
  const gitignorePath = path.join(cwd, ".gitignore");
32
- const gitignore = await fs.readFile(gitignorePath, "utf-8").catch(() => "");
33
- if (!gitignore.split("\n").includes("skills")) await fs.appendFile(gitignorePath, gitignore.endsWith("\n") ? "skills\n" : "\nskills\n");
32
+ if (!(await fs.readFile(gitignorePath, "utf-8").catch(() => "")).split("\n").includes("skills")) await fs.appendFile(gitignorePath, [
33
+ "**/skills",
34
+ "!/skills",
35
+ "!/skills/**"
36
+ ].join("\n"));
34
37
  const pkgPath = path.join(cwd, "package.json");
35
38
  const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
36
39
  const prepare = pkg.scripts?.prepare;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "skills-manifest",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "description": "A lightweight manifest manager for skills, enabling project-level skill synchronization and collaborative configuration.",
6
6
  "author": "Hairyf <wwu710632@gmail.com>",
7
7
  "license": "MIT",
@@ -58,7 +58,7 @@
58
58
  "vitest": "^4.0.15",
59
59
  "vitest-package-exports": "^0.1.1",
60
60
  "yaml": "^2.8.2",
61
- "skills-manifest": "0.3.1"
61
+ "skills-manifest": "0.3.3"
62
62
  },
63
63
  "simple-git-hooks": {
64
64
  "pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
@@ -1,27 +1,22 @@
1
1
  #!/usr/bin/env node
2
+ import { enableCompileCache } from 'node:module';
2
3
  import { spawnSync } from 'node:child_process';
3
4
  import { createRequire } from 'node:module';
4
- import { fileURLToPath } from 'node:url';
5
5
  import { join, dirname } from 'node:path';
6
6
 
7
- const require = createRequire(import.meta.url);
8
- const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ if (enableCompileCache)
8
+ try { enableCompileCache(); } catch {}
9
9
 
10
10
  const argv = process.argv.slice(2);
11
11
  const skipManifest = argv.includes('--skip-manifest');
12
12
  const forwardArgs = argv.filter(arg => arg !== '--skip-manifest');
13
13
  const [cmd] = forwardArgs;
14
14
 
15
- // 1. 执行主 CLI 程序
16
- const mainResult = spawnSync(process.execPath, [join(__dirname, '../dist/cli.mjs'), ...forwardArgs], { stdio: 'inherit' });
17
-
18
- if (mainResult.status === 0 && !skipManifest && ['add', 'remove'].includes(cmd)) {
19
- try {
20
- const binPath = require.resolve('skills-manifest/bin/skills-manifest', { paths: [process.cwd()] });
21
- spawnSync(process.execPath, [binPath, 'sync', ...forwardArgs], { stdio: 'inherit' });
22
- } catch {
23
- console.warn('skills-manifest: failed to sync from skills. Sync add/remove with manifest will not run.')
24
- }
15
+ if (!skipManifest && ['add', 'remove'].includes(cmd)) {
16
+ const require = createRequire(import.meta.url);
17
+ const manifestPkg = require.resolve('skills-manifest/package.json', { paths: [process.cwd()] });
18
+ const binPath = join(dirname(manifestPkg), 'bin/index.mjs');
19
+ spawnSync(process.execPath, [binPath, 'sync', ...forwardArgs], { stdio: 'inherit' });
25
20
  }
26
21
 
27
- process.exit(mainResult.status ?? 1);
22
+ await import('../dist/cli.mjs');