clawcompany 0.18.0 → 0.19.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 +28 -59
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1508,7 +1508,7 @@ import { join } from "path";
1508
1508
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
1509
1509
  function banner() {
1510
1510
  console.log("");
1511
- console.log(" \u{1F99E} ClawCompany v0.18.0");
1511
+ console.log(" \u{1F99E} ClawCompany v0.19.0");
1512
1512
  console.log(" Build for OPC. Every human being is a chairman.");
1513
1513
  console.log("");
1514
1514
  }
@@ -1566,27 +1566,6 @@ async function apiPost(path, body, port = 3200) {
1566
1566
  }
1567
1567
  return res.json();
1568
1568
  }
1569
- async function validateClawApiKey(key) {
1570
- try {
1571
- const res = await fetch("https://clawapi.org/api/v1/chat/completions", {
1572
- method: "POST",
1573
- headers: {
1574
- "Authorization": `Bearer ${key}`,
1575
- "Content-Type": "application/json"
1576
- },
1577
- body: JSON.stringify({
1578
- model: "gpt-oss-20b",
1579
- messages: [{ role: "user", content: "hi" }],
1580
- max_tokens: 5
1581
- })
1582
- });
1583
- if (res.status === 401) return { valid: false, error: "Invalid key. Check your key at clawapi.org" };
1584
- if (!res.ok) return { valid: false, error: `ClawAPI returned ${res.status}. Try again later.` };
1585
- return { valid: true };
1586
- } catch (err) {
1587
- return { valid: false, error: `Cannot reach ClawAPI: ${err.message}. Check your internet connection.` };
1588
- }
1589
- }
1590
1569
  async function isServerRunning(port = 3200) {
1591
1570
  try {
1592
1571
  const res = await fetch(`http://localhost:${port}/api/health`);
@@ -1826,6 +1805,8 @@ import { Command } from "commander";
1826
1805
  // src/commands/init.ts
1827
1806
  init_utils();
1828
1807
  init_src();
1808
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
1809
+ import { join as join2 } from "path";
1829
1810
  import { input, select, confirm } from "@inquirer/prompts";
1830
1811
  async function initCommand() {
1831
1812
  banner();
@@ -1848,65 +1829,53 @@ async function initCommand() {
1848
1829
  }
1849
1830
  }
1850
1831
  console.log(" Welcome! Let's set up your AI company.\n");
1851
- console.log(" Step 1/3: Connect to ClawAPI\n");
1852
- let apiKey = "";
1853
- let keyValid = false;
1854
- while (!keyValid) {
1855
- apiKey = await input({
1856
- message: "Enter your ClawAPI key:",
1857
- validate: (v) => {
1858
- if (!v.trim()) return "Key is required.";
1859
- if (!v.startsWith("sk-claw-")) return "Key should start with sk-claw-";
1860
- return true;
1861
- }
1862
- });
1863
- console.log("");
1864
- console.log(" Verifying key...");
1865
- const result = await validateClawApiKey(apiKey.trim());
1866
- if (result.valid) {
1867
- console.log(" \u2713 Key verified\n");
1868
- keyValid = true;
1869
- } else {
1870
- console.log(` \u2717 ${result.error}`);
1871
- console.log(" Get a key at https://clawapi.org\n");
1872
- }
1873
- }
1874
- console.log(" Step 2/3: Name your company\n");
1832
+ console.log(" Step 1/2: Name your company\n");
1875
1833
  const companyName = await input({
1876
1834
  message: "Company name:",
1877
1835
  default: "My AI Company"
1878
1836
  });
1879
1837
  console.log("");
1880
- console.log(" Step 3/3: Choose a template\n");
1838
+ console.log(" Step 2/2: Choose a template\n");
1881
1839
  const template = await select({
1882
1840
  message: "Template:",
1883
1841
  choices: [
1884
1842
  {
1885
- name: "Default (CEO + CTO + CFO + CMO + Researcher + Analyst + Engineer + Secretary + Worker)",
1843
+ name: "\u{1F99E} Default \u2014 9 roles, general purpose",
1886
1844
  value: "default"
1887
1845
  },
1888
1846
  {
1889
- name: "Trading Desk (+ Trader + Data Collector)",
1890
- value: "trading-desk"
1847
+ name: "\u{1F680} YC Startup \u2014 7 roles, ship fast",
1848
+ value: "yc_startup"
1891
1849
  },
1892
1850
  {
1893
- name: "Content Agency (+ Writer + Editor + SEO)",
1894
- value: "content-agency"
1851
+ name: "\u{1F4C8} Trading Desk \u2014 7 roles, Bull vs Bear",
1852
+ value: "trading"
1895
1853
  },
1896
1854
  {
1897
- name: "Dev Shop (+ QA + DevOps)",
1898
- value: "dev-shop"
1899
- },
1900
- {
1901
- name: "Solo Founder (CEO + Worker only \u2014 cheapest)",
1902
- value: "solo-founder"
1855
+ name: "\u{1F52C} AutoResearch Lab \u2014 5 roles, Karpathy Loop",
1856
+ value: "research_lab"
1903
1857
  }
1904
1858
  ]
1905
1859
  });
1906
1860
  console.log("");
1861
+ let apiKey = "";
1862
+ const envPath = join2(process.cwd(), ".env");
1863
+ if (existsSync2(envPath)) {
1864
+ const envContent = readFileSync2(envPath, "utf-8");
1865
+ const match = envContent.match(/CLAWAPI_KEY=(.+)/);
1866
+ if (match && match[1].trim()) {
1867
+ apiKey = match[1].trim();
1868
+ console.log(" \u2713 Found ClawAPI key in .env\n");
1869
+ }
1870
+ }
1871
+ if (!apiKey) {
1872
+ console.log(" \u2139 API key not set. You can add it later in Dashboard \u2192 Settings.");
1873
+ console.log(" Code Manager, Roles, and Studio work without an API key.");
1874
+ console.log(" To run Missions and Chat, add your key at http://localhost:3200 \u2192 Settings.\n");
1875
+ }
1907
1876
  console.log(" Creating company...\n");
1908
1877
  const config = {
1909
- apiKey: apiKey.trim(),
1878
+ apiKey,
1910
1879
  companyName,
1911
1880
  template,
1912
1881
  serverPort: 3200,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawcompany",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Build for OPC. Every human being is a chairman. AI company infrastructure — one key, 9 roles, 4 models.",
5
5
  "type": "module",
6
6
  "bin": { "clawcompany": "dist/index.js" },