seclaw 0.1.13 → 0.1.15

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/cli.js +6 -19
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1441,7 +1441,6 @@ function getTemplatePath(template, targetDir) {
1441
1441
  import { resolve as resolve6 } from "path";
1442
1442
  import { existsSync as existsSync6 } from "fs";
1443
1443
  import { writeFile as writeFile3, mkdir as mkdir3, readFile as readFile3, cp as cp3 } from "fs/promises";
1444
- import { execSync } from "child_process";
1445
1444
  import * as p3 from "@clack/prompts";
1446
1445
  import pc3 from "picocolors";
1447
1446
  var API_URL = process.env.SECLAW_API || "https://seclawai.com";
@@ -1450,8 +1449,9 @@ async function add(template, options) {
1450
1449
  p3.intro(`${pc3.bgCyan(pc3.black(" seclaw "))} Adding template: ${template}`);
1451
1450
  const isFree = FREE_TEMPLATES.includes(template);
1452
1451
  const s = p3.spinner();
1452
+ const projectDir = findProjectDir() || process.cwd();
1453
1453
  const monorepoTemplatesDir = resolve6(import.meta.dirname, "..", "..", "templates", "paid");
1454
- const templateDir = !isFree && existsSync6(resolve6(import.meta.dirname, "..", "..", "templates")) ? resolve6(monorepoTemplatesDir, template) : resolve6(process.cwd(), "templates", template);
1454
+ const templateDir = !isFree && existsSync6(resolve6(import.meta.dirname, "..", "..", "templates")) ? resolve6(monorepoTemplatesDir, template) : resolve6(projectDir, "templates", template);
1455
1455
  if (isFree) {
1456
1456
  s.start("Setting up free template...");
1457
1457
  const bundledPath = resolve6(
@@ -1506,23 +1506,10 @@ async function add(template, options) {
1506
1506
  }
1507
1507
  const data = await res.json();
1508
1508
  s.stop(`Template ready: ${pc3.green(data.templateName)}`);
1509
- s.start("Writing template files...");
1510
1509
  await mkdir3(templateDir, { recursive: true });
1511
1510
  for (const [filename, content] of Object.entries(data.files)) {
1512
1511
  await writeFile3(resolve6(templateDir, filename), content);
1513
1512
  }
1514
- s.stop(`${Object.keys(data.files).length} files written to ${pc3.dim(templateDir)}`);
1515
- const cliDir = resolve6(import.meta.dirname, "..");
1516
- const cliPkgPath = resolve6(cliDir, "package.json");
1517
- if (existsSync6(cliPkgPath)) {
1518
- s.start("Rebuilding CLI...");
1519
- try {
1520
- execSync("pnpm build", { cwd: cliDir, stdio: "pipe" });
1521
- s.stop("CLI rebuilt with new template.");
1522
- } catch {
1523
- s.stop("CLI rebuild failed \u2014 run `pnpm build` manually.");
1524
- }
1525
- }
1526
1513
  } catch (err) {
1527
1514
  s.stop("Failed.");
1528
1515
  p3.log.error(`Network error: ${err}`);
@@ -1532,12 +1519,12 @@ async function add(template, options) {
1532
1519
  }
1533
1520
  let wsHostPath = "shared";
1534
1521
  try {
1535
- const envContent = await readFile3(resolve6(process.cwd(), ".env"), "utf-8");
1522
+ const envContent = await readFile3(resolve6(projectDir, ".env"), "utf-8");
1536
1523
  const wsMatch = envContent.match(/WORKSPACE_HOST_PATH=(.+)/);
1537
1524
  if (wsMatch?.[1]?.trim()) wsHostPath = wsMatch[1].trim();
1538
1525
  } catch {
1539
1526
  }
1540
- const configDir = resolve6(process.cwd(), wsHostPath, "config");
1527
+ const configDir = resolve6(projectDir, wsHostPath, "config");
1541
1528
  if (existsSync6(configDir)) {
1542
1529
  const capDir = resolve6(configDir, "capabilities", template);
1543
1530
  await mkdir3(capDir, { recursive: true });
@@ -1571,9 +1558,9 @@ async function add(template, options) {
1571
1558
  } catch {
1572
1559
  }
1573
1560
  p3.log.success(
1574
- `Capability '${pc3.bold(templateName)}' added. ${pc3.cyan(String(installed.capabilities.length))} capabilities active.`
1561
+ `Capability '${pc3.bold(templateName)}' installed. ${pc3.cyan(String(installed.capabilities.length))} capabilities active.`
1575
1562
  );
1576
- p3.log.info("Restart agent to apply changes.");
1563
+ p3.log.info(`Run ${pc3.cyan("docker compose restart agent")} to apply.`);
1577
1564
  }
1578
1565
  p3.outro(`${pc3.green("Done!")} Template ${pc3.bold(template)} is ready.`);
1579
1566
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seclaw",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Secure autonomous AI agents in 60 seconds",
5
5
  "type": "module",
6
6
  "bin": {