@webmaster-droid/cli 0.2.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +15 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -127,44 +127,36 @@ async function readJson(filePath) {
127
127
  return JSON.parse(raw);
128
128
  }
129
129
  program.name("webmaster-droid").description("Webmaster Droid CLI").version(CLI_VERSION);
130
- program.command("init").description("Initialize optional webmaster-droid config in current project").option("--framework <framework>", "framework", "next").option("--backend <backend>", "backend (supabase|aws)", "supabase").option("--out <dir>", "output dir", ".").action(async (opts) => {
130
+ program.command("init").description("Initialize webmaster-droid environment template in current project").option("--backend <backend>", "backend (supabase|aws)", "supabase").option("--out <dir>", "output dir", ".").action(async (opts) => {
131
131
  const backendRaw = String(opts.backend ?? "supabase").trim().toLowerCase();
132
132
  if (backendRaw !== "supabase" && backendRaw !== "aws") {
133
133
  throw new Error(`Unsupported backend '${opts.backend}'. Expected 'supabase' or 'aws'.`);
134
134
  }
135
135
  const backend = backendRaw;
136
136
  const outDir = path2.resolve(process.cwd(), opts.out);
137
- const configPath = path2.join(outDir, "webmaster-droid.config.ts");
138
- await ensureDir(configPath);
139
- const config = `export default {
140
- framework: "${opts.framework}",
141
- backend: "${backend}",
142
- apiBaseUrlEnv: "NEXT_PUBLIC_AGENT_API_BASE_URL"
143
- };
144
- `;
145
- try {
146
- await fs.access(configPath);
147
- console.log(`Config already exists: ${configPath}`);
148
- } catch {
149
- await fs.writeFile(configPath, config, "utf8");
150
- console.log(`Created: ${configPath}`);
151
- }
152
137
  const envExample = path2.join(outDir, ".env.webmaster-droid.example");
138
+ let createdEnvTemplate = false;
153
139
  try {
154
140
  await fs.access(envExample);
155
141
  } catch {
142
+ await ensureDir(envExample);
156
143
  await fs.writeFile(
157
144
  envExample,
158
145
  [
159
146
  "NEXT_PUBLIC_AGENT_API_BASE_URL=http://localhost:8787",
160
147
  "",
161
148
  "# Supabase (default backend)",
149
+ "# Supabase Edge blocks user-defined secrets with SUPABASE_ prefix.",
150
+ "# Use CMS_* overrides for custom secrets and leave built-in SUPABASE_* values as provided by Supabase.",
162
151
  "NEXT_PUBLIC_SUPABASE_URL=",
163
152
  "NEXT_PUBLIC_SUPABASE_ANON_KEY=",
164
153
  "SUPABASE_URL=",
165
154
  "SUPABASE_ANON_KEY=",
166
155
  "SUPABASE_SERVICE_ROLE_KEY=",
167
- "SUPABASE_JWKS_URL=",
156
+ "CMS_SUPABASE_URL=",
157
+ "CMS_SUPABASE_JWKS_URL=",
158
+ "CMS_SUPABASE_AUTH_KEY=",
159
+ "CMS_SUPABASE_JWT_SECRET=",
168
160
  "CMS_SUPABASE_BUCKET=webmaster-droid-cms",
169
161
  "CMS_STORAGE_PREFIX=cms",
170
162
  "",
@@ -180,8 +172,14 @@ program.command("init").description("Initialize optional webmaster-droid config
180
172
  ].join("\n") + "\n",
181
173
  "utf8"
182
174
  );
175
+ createdEnvTemplate = true;
176
+ }
177
+ if (createdEnvTemplate) {
183
178
  console.log(`Created: ${envExample}`);
179
+ } else {
180
+ console.log(`Env template already exists: ${envExample}`);
184
181
  }
182
+ console.log(`Backend preset: ${backend}`);
185
183
  });
186
184
  var schema = program.command("schema").description("Optional schema helpers");
187
185
  schema.command("init").description("Create starter schema file").option("--out <file>", "schema output", "cms/schema.webmaster.ts").action(async (opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmaster-droid/cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "webmaster-droid": "dist/index.js"