create-guardio 0.0.5 → 0.0.6

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.
Files changed (2) hide show
  1. package/index.mjs +5 -22
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createInterface } from "node:readline";
3
- import { mkdir, writeFile, chmod } from "node:fs/promises";
3
+ import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { resolve, dirname } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
 
@@ -46,7 +46,6 @@ async function main() {
46
46
  };
47
47
 
48
48
  await mkdir(guardioPath, { recursive: true });
49
- await mkdir(resolve(guardioPath, "bin"), { recursive: true });
50
49
  await mkdir(resolve(guardioPath, "plugins", "example"), { recursive: true });
51
50
 
52
51
  const packageJson = {
@@ -56,12 +55,13 @@ async function main() {
56
55
  description: "Guardio-gated MCP server with optional local plugins",
57
56
  scripts: {
58
57
  build: "tsc",
59
- guardio: "node bin/guardio.mjs",
58
+ guardio: "node --import tsx ./node_modules/@guardiojs/guardio/dist/cli.js --config guardio.config.ts",
60
59
  },
61
60
  dependencies: { "@guardiojs/guardio": "*" },
62
61
  devDependencies: {
63
62
  typescript: "^5.6.0",
64
63
  "@types/node": "^22.0.0",
64
+ tsx: "^4.19.0",
65
65
  },
66
66
  };
67
67
  await writeFile(
@@ -99,24 +99,6 @@ export default config;
99
99
  "utf-8",
100
100
  );
101
101
 
102
- const binContent = `#!/usr/bin/env node
103
- import { spawnSync } from "child_process";
104
- import path from "path";
105
- import { fileURLToPath } from "url";
106
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
107
- const configPath = path.resolve(__dirname, "..", "guardio.config.ts");
108
- const result = spawnSync(
109
- "npx",
110
- ["-y", "@guardiojs/guardio", "--config", configPath],
111
- { stdio: "inherit" }
112
- );
113
- process.exit(result.status ?? 1);
114
- `;
115
-
116
- const binPath = resolve(guardioPath, "bin", "guardio.mjs");
117
- await writeFile(binPath, binContent, "utf-8");
118
- await chmod(binPath, 0o755);
119
-
120
102
  const examplePluginContent = `import type {
121
103
  PolicyPluginInterface,
122
104
  PolicyRequestContext,
@@ -169,7 +151,8 @@ Import types from "@guardiojs/guardio". See example/ for a policy plugin.
169
151
  console.log(" npm run build # compile plugins (index.ts → index.js)");
170
152
  console.log("");
171
153
  console.log("Run Guardio as HTTP server:");
172
- console.log(" guardio --config guardio.config.ts");
154
+ console.log(" pnpm guardio");
155
+ console.log(" (uses tsx so guardio.config.ts loads without compiling)");
173
156
  console.log("");
174
157
  console.log("Add to MCP client (use URL):");
175
158
  console.log(' "url": "http://127.0.0.1:' + port + '"');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-guardio",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Scaffold a Guardio project",
5
5
  "type": "module",
6
6
  "bin": {