@looplia/looplia-cli 0.6.7 → 0.6.8

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 +118 -68
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ var getDirname = () => path.dirname(getFilename());
13
13
  var __dirname = /* @__PURE__ */ getDirname();
14
14
 
15
15
  // src/commands/build.ts
16
- import { existsSync as existsSync4, mkdirSync as mkdirSync5 } from "fs";
16
+ import { existsSync as existsSync5, mkdirSync as mkdirSync5 } from "fs";
17
17
  import { homedir as homedir5 } from "os";
18
18
  import { resolve as resolve2 } from "path";
19
19
 
@@ -243,6 +243,12 @@ async function getPluginPaths() {
243
243
  return await getProdPluginPaths();
244
244
  }
245
245
 
246
+ // ../../packages/provider/dist/chunk-4PGJBKLH.js
247
+ import { execSync } from "child_process";
248
+ import { existsSync as existsSync3 } from "fs";
249
+ import { homedir as homedir3 } from "os";
250
+ import { join as join4 } from "path";
251
+
246
252
  // ../../node_modules/zod-to-json-schema/dist/esm/Options.js
247
253
  var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
248
254
  var defaultOptions = {
@@ -27363,9 +27369,9 @@ function query({
27363
27369
  return queryInstance;
27364
27370
  }
27365
27371
 
27366
- // ../../packages/provider/dist/chunk-MM4XVM5O.js
27372
+ // ../../packages/provider/dist/chunk-4PGJBKLH.js
27367
27373
  import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "fs";
27368
- import { join as join4 } from "path";
27374
+ import { join as join23 } from "path";
27369
27375
  import {
27370
27376
  chmod,
27371
27377
  mkdir as mkdir2,
@@ -27374,11 +27380,52 @@ import {
27374
27380
  rm as rm2,
27375
27381
  writeFile as writeFile2
27376
27382
  } from "fs/promises";
27377
- import { homedir as homedir3 } from "os";
27378
- import { join as join23 } from "path";
27379
- import { cp as cp2, mkdir as mkdir22, readFile as readFile22, rm as rm22, stat as stat2, writeFile as writeFile22 } from "fs/promises";
27380
27383
  import { homedir as homedir22 } from "os";
27381
- import { isAbsolute, join as join32, normalize, resolve } from "path";
27384
+ import { join as join32 } from "path";
27385
+ import { cp as cp2, mkdir as mkdir22, readFile as readFile22, rm as rm22, stat as stat2, writeFile as writeFile22 } from "fs/promises";
27386
+ import { homedir as homedir32 } from "os";
27387
+ import { isAbsolute, join as join42, normalize, resolve } from "path";
27388
+ var CLAUDE_CODE_PATHS = [
27389
+ // User's local bin (npm global install location)
27390
+ join4(homedir3(), ".local", "bin", "claude"),
27391
+ // System-wide installations
27392
+ "/usr/local/bin/claude",
27393
+ // macOS Homebrew
27394
+ "/opt/homebrew/bin/claude",
27395
+ // Windows (if applicable)
27396
+ join4(homedir3(), "AppData", "Local", "Programs", "claude", "claude.exe")
27397
+ ];
27398
+ function findClaudeCodePath() {
27399
+ const envPath = process.env.CLAUDE_CODE_PATH;
27400
+ if (envPath && existsSync3(envPath)) {
27401
+ return envPath;
27402
+ }
27403
+ for (const path3 of CLAUDE_CODE_PATHS) {
27404
+ if (existsSync3(path3)) {
27405
+ return path3;
27406
+ }
27407
+ }
27408
+ try {
27409
+ const whichResult = execSync("which claude", {
27410
+ encoding: "utf-8",
27411
+ stdio: ["pipe", "pipe", "pipe"]
27412
+ }).trim();
27413
+ if (whichResult && existsSync3(whichResult)) {
27414
+ return whichResult;
27415
+ }
27416
+ } catch {
27417
+ }
27418
+ throw new Error(
27419
+ `Claude Code not found. Looplia requires Claude Code to be installed.
27420
+
27421
+ Install Claude Code:
27422
+ npm install -g @anthropic-ai/claude-code
27423
+
27424
+ Or set CLAUDE_CODE_PATH environment variable to your Claude installation.
27425
+
27426
+ More info: https://docs.anthropic.com/claude-code`
27427
+ );
27428
+ }
27382
27429
  var DEFAULT_CONFIG = {
27383
27430
  model: "claude-haiku-4-5-20251001",
27384
27431
  workspace: "~/.looplia",
@@ -27404,10 +27451,10 @@ function createQueryLogger(workspace) {
27404
27451
  let logPath = null;
27405
27452
  return {
27406
27453
  init(sandboxId) {
27407
- const logsDir = join4(workspace, "sandbox", sandboxId, "logs");
27454
+ const logsDir = join23(workspace, "sandbox", sandboxId, "logs");
27408
27455
  mkdirSync3(logsDir, { recursive: true });
27409
27456
  const filename = generateLogFilename();
27410
- logPath = join4(logsDir, filename);
27457
+ logPath = join23(logsDir, filename);
27411
27458
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
27412
27459
  writeFileSync2(
27413
27460
  logPath,
@@ -27561,10 +27608,10 @@ var PRESETS = {
27561
27608
  };
27562
27609
  var CONFIG_FILE = "looplia.setting.json";
27563
27610
  function getLoopliaHome() {
27564
- return join23(homedir3(), ".looplia");
27611
+ return join32(homedir22(), ".looplia");
27565
27612
  }
27566
27613
  function getConfigPath() {
27567
- return join23(getLoopliaHome(), CONFIG_FILE);
27614
+ return join32(getLoopliaHome(), CONFIG_FILE);
27568
27615
  }
27569
27616
  async function readLoopliaSettings() {
27570
27617
  const configPath = getConfigPath();
@@ -27762,11 +27809,11 @@ function extractSandboxIdFromPrompt(prompt) {
27762
27809
  var extractContentIdFromPrompt = extractSandboxIdFromPrompt;
27763
27810
  function expandPath(path3) {
27764
27811
  if (path3.startsWith("~/") || path3 === "~") {
27765
- const home = homedir22();
27812
+ const home = homedir32();
27766
27813
  if (!home) {
27767
27814
  throw new Error("Unable to determine home directory");
27768
27815
  }
27769
- const expanded = path3 === "~" ? home : join32(home, path3.slice(2));
27816
+ const expanded = path3 === "~" ? home : join42(home, path3.slice(2));
27770
27817
  return normalize(expanded);
27771
27818
  }
27772
27819
  if (isAbsolute(path3)) {
@@ -27783,23 +27830,23 @@ async function pathExists2(path3) {
27783
27830
  }
27784
27831
  }
27785
27832
  function getPluginPaths2() {
27786
- const base = join32(process.cwd(), "plugins");
27833
+ const base = join42(process.cwd(), "plugins");
27787
27834
  return {
27788
- core: join32(base, "looplia-core"),
27789
- writer: join32(base, "looplia-writer")
27835
+ core: join42(base, "looplia-core"),
27836
+ writer: join42(base, "looplia-writer")
27790
27837
  };
27791
27838
  }
27792
27839
  async function checkRequiredFiles(workspaceDir) {
27793
27840
  const requiredPaths = [
27794
27841
  // Core structure
27795
- join32(workspaceDir, "CLAUDE.md"),
27796
- join32(workspaceDir, ".claude", "agents"),
27797
- join32(workspaceDir, ".claude", "skills"),
27798
- join32(workspaceDir, "workflows"),
27842
+ join42(workspaceDir, "CLAUDE.md"),
27843
+ join42(workspaceDir, ".claude", "agents"),
27844
+ join42(workspaceDir, ".claude", "skills"),
27845
+ join42(workspaceDir, "workflows"),
27799
27846
  // From looplia-core plugin
27800
- join32(workspaceDir, ".claude", "commands"),
27801
- join32(workspaceDir, ".claude", "skills", "workflow-executor"),
27802
- join32(workspaceDir, ".claude", "skills", "workflow-validator")
27847
+ join42(workspaceDir, ".claude", "commands"),
27848
+ join42(workspaceDir, ".claude", "skills", "workflow-executor"),
27849
+ join42(workspaceDir, ".claude", "skills", "workflow-validator")
27803
27850
  ];
27804
27851
  for (const path3 of requiredPaths) {
27805
27852
  if (!await pathExists2(path3)) {
@@ -27828,33 +27875,33 @@ async function createTestWorkspace(workspaceDir, force) {
27828
27875
  await rm22(workspaceDir, { recursive: true, force: true });
27829
27876
  }
27830
27877
  await mkdir22(workspaceDir, { recursive: true });
27831
- await mkdir22(join32(workspaceDir, ".claude", "agents"), { recursive: true });
27832
- await mkdir22(join32(workspaceDir, ".claude", "skills"), { recursive: true });
27833
- await mkdir22(join32(workspaceDir, "sandbox"), { recursive: true });
27878
+ await mkdir22(join42(workspaceDir, ".claude", "agents"), { recursive: true });
27879
+ await mkdir22(join42(workspaceDir, ".claude", "skills"), { recursive: true });
27880
+ await mkdir22(join42(workspaceDir, "sandbox"), { recursive: true });
27834
27881
  const plugins = getPluginPaths2();
27835
- const writerWorkflowsDir = join32(plugins.writer, "workflows");
27882
+ const writerWorkflowsDir = join42(plugins.writer, "workflows");
27836
27883
  if (await pathExists2(writerWorkflowsDir)) {
27837
- await cp2(writerWorkflowsDir, join32(workspaceDir, "workflows"), {
27884
+ await cp2(writerWorkflowsDir, join42(workspaceDir, "workflows"), {
27838
27885
  recursive: true
27839
27886
  });
27840
27887
  } else {
27841
- await mkdir22(join32(workspaceDir, "workflows"), { recursive: true });
27888
+ await mkdir22(join42(workspaceDir, "workflows"), { recursive: true });
27842
27889
  }
27843
- const coreValidatorDir = join32(plugins.core, "skills", "workflow-validator");
27890
+ const coreValidatorDir = join42(plugins.core, "skills", "workflow-validator");
27844
27891
  if (await pathExists2(coreValidatorDir)) {
27845
27892
  await cp2(
27846
27893
  coreValidatorDir,
27847
- join32(workspaceDir, ".claude", "skills", "workflow-validator"),
27894
+ join42(workspaceDir, ".claude", "skills", "workflow-validator"),
27848
27895
  { recursive: true }
27849
27896
  );
27850
27897
  }
27851
27898
  await writeFile22(
27852
- join32(workspaceDir, "CLAUDE.md"),
27899
+ join42(workspaceDir, "CLAUDE.md"),
27853
27900
  "# Test Workspace\n",
27854
27901
  "utf-8"
27855
27902
  );
27856
27903
  await writeFile22(
27857
- join32(workspaceDir, "user-profile.json"),
27904
+ join42(workspaceDir, "user-profile.json"),
27858
27905
  JSON.stringify(createDefaultProfile2(), null, 2),
27859
27906
  "utf-8"
27860
27907
  );
@@ -27865,63 +27912,63 @@ async function bootstrapFromPlugins(workspaceDir, plugins) {
27865
27912
  await rm22(workspaceDir, { recursive: true, force: true });
27866
27913
  }
27867
27914
  await mkdir22(workspaceDir, { recursive: true });
27868
- await mkdir22(join32(workspaceDir, ".claude"), { recursive: true });
27869
- await mkdir22(join32(workspaceDir, "sandbox"), { recursive: true });
27870
- const coreCommandsDir = join32(plugins.core, "commands");
27915
+ await mkdir22(join42(workspaceDir, ".claude"), { recursive: true });
27916
+ await mkdir22(join42(workspaceDir, "sandbox"), { recursive: true });
27917
+ const coreCommandsDir = join42(plugins.core, "commands");
27871
27918
  if (await pathExists2(coreCommandsDir)) {
27872
- await cp2(coreCommandsDir, join32(workspaceDir, ".claude", "commands"), {
27919
+ await cp2(coreCommandsDir, join42(workspaceDir, ".claude", "commands"), {
27873
27920
  recursive: true
27874
27921
  });
27875
27922
  }
27876
- const coreSkillsDir = join32(plugins.core, "skills");
27923
+ const coreSkillsDir = join42(plugins.core, "skills");
27877
27924
  if (await pathExists2(coreSkillsDir)) {
27878
- await cp2(coreSkillsDir, join32(workspaceDir, ".claude", "skills"), {
27925
+ await cp2(coreSkillsDir, join42(workspaceDir, ".claude", "skills"), {
27879
27926
  recursive: true
27880
27927
  });
27881
27928
  }
27882
- const coreHooksDir = join32(plugins.core, "hooks");
27929
+ const coreHooksDir = join42(plugins.core, "hooks");
27883
27930
  if (await pathExists2(coreHooksDir)) {
27884
- await cp2(coreHooksDir, join32(workspaceDir, ".claude", "hooks"), {
27931
+ await cp2(coreHooksDir, join42(workspaceDir, ".claude", "hooks"), {
27885
27932
  recursive: true
27886
27933
  });
27887
27934
  }
27888
- const coreAgentsDir = join32(plugins.core, "agents");
27935
+ const coreAgentsDir = join42(plugins.core, "agents");
27889
27936
  if (await pathExists2(coreAgentsDir)) {
27890
- await mkdir22(join32(workspaceDir, ".claude", "agents"), { recursive: true });
27891
- await cp2(coreAgentsDir, join32(workspaceDir, ".claude", "agents"), {
27937
+ await mkdir22(join42(workspaceDir, ".claude", "agents"), { recursive: true });
27938
+ await cp2(coreAgentsDir, join42(workspaceDir, ".claude", "agents"), {
27892
27939
  recursive: true
27893
27940
  });
27894
27941
  }
27895
- const coreScriptsDir = join32(plugins.core, "scripts");
27942
+ const coreScriptsDir = join42(plugins.core, "scripts");
27896
27943
  if (await pathExists2(coreScriptsDir)) {
27897
- await cp2(coreScriptsDir, join32(workspaceDir, "scripts"), {
27944
+ await cp2(coreScriptsDir, join42(workspaceDir, "scripts"), {
27898
27945
  recursive: true
27899
27946
  });
27900
27947
  }
27901
- const coreClaudeMd = join32(plugins.core, "CLAUDE.md");
27948
+ const coreClaudeMd = join42(plugins.core, "CLAUDE.md");
27902
27949
  if (await pathExists2(coreClaudeMd)) {
27903
- await cp2(coreClaudeMd, join32(workspaceDir, "CLAUDE.md"));
27950
+ await cp2(coreClaudeMd, join42(workspaceDir, "CLAUDE.md"));
27904
27951
  }
27905
- const writerAgentsDir = join32(plugins.writer, "agents");
27952
+ const writerAgentsDir = join42(plugins.writer, "agents");
27906
27953
  if (await pathExists2(writerAgentsDir)) {
27907
- await cp2(writerAgentsDir, join32(workspaceDir, ".claude", "agents"), {
27954
+ await cp2(writerAgentsDir, join42(workspaceDir, ".claude", "agents"), {
27908
27955
  recursive: true
27909
27956
  });
27910
27957
  }
27911
- const writerSkillsDir = join32(plugins.writer, "skills");
27958
+ const writerSkillsDir = join42(plugins.writer, "skills");
27912
27959
  if (await pathExists2(writerSkillsDir)) {
27913
- await cp2(writerSkillsDir, join32(workspaceDir, ".claude", "skills"), {
27960
+ await cp2(writerSkillsDir, join42(workspaceDir, ".claude", "skills"), {
27914
27961
  recursive: true
27915
27962
  });
27916
27963
  }
27917
- const writerWorkflowsDir = join32(plugins.writer, "workflows");
27964
+ const writerWorkflowsDir = join42(plugins.writer, "workflows");
27918
27965
  if (await pathExists2(writerWorkflowsDir)) {
27919
- await cp2(writerWorkflowsDir, join32(workspaceDir, "workflows"), {
27966
+ await cp2(writerWorkflowsDir, join42(workspaceDir, "workflows"), {
27920
27967
  recursive: true
27921
27968
  });
27922
27969
  }
27923
27970
  await writeFile22(
27924
- join32(workspaceDir, "user-profile.json"),
27971
+ join42(workspaceDir, "user-profile.json"),
27925
27972
  JSON.stringify(createDefaultProfile2(), null, 2),
27926
27973
  "utf-8"
27927
27974
  );
@@ -27956,12 +28003,12 @@ async function ensureWorkspace(options) {
27956
28003
  return workspaceDir;
27957
28004
  }
27958
28005
  async function readUserProfile(workspaceDir) {
27959
- const profilePath = join32(workspaceDir, "user-profile.json");
28006
+ const profilePath = join42(workspaceDir, "user-profile.json");
27960
28007
  const content = await readFile22(profilePath, "utf-8");
27961
28008
  return JSON.parse(content);
27962
28009
  }
27963
28010
  async function writeUserProfile(workspaceDir, profile) {
27964
- const profilePath = join32(workspaceDir, "user-profile.json");
28011
+ const profilePath = join42(workspaceDir, "user-profile.json");
27965
28012
  await writeFile22(profilePath, JSON.stringify(profile, null, 2), "utf-8");
27966
28013
  }
27967
28014
  var workspaceCache = /* @__PURE__ */ new Map();
@@ -28542,9 +28589,12 @@ YOU MUST CALL THE WRITE TOOL before completing. If you don't write the file, the
28542
28589
  model: executorModel
28543
28590
  }
28544
28591
  };
28592
+ const claudeCodePath = findClaudeCodePath();
28545
28593
  const result = query({
28546
28594
  prompt,
28547
28595
  options: {
28596
+ // v0.6.8: Use system-installed Claude Code
28597
+ pathToClaudeCodeExecutable: claudeCodePath,
28548
28598
  // v0.6.6: Use configured main model
28549
28599
  model: mainModel,
28550
28600
  // v0.6.5: SDK works relative to ~/.looplia (sandbox, workflows, etc.)
@@ -29833,14 +29883,14 @@ import { Box as Box20, Text as Text21, useApp, useInput as useInput6 } from "ink
29833
29883
  import { useCallback as useCallback2, useEffect as useEffect6, useMemo as useMemo2, useState as useState6 } from "react";
29834
29884
 
29835
29885
  // src/utils/agent-logger.ts
29836
- import { appendFileSync as appendFileSync4, existsSync as existsSync3, mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "fs";
29886
+ import { appendFileSync as appendFileSync4, existsSync as existsSync4, mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "fs";
29837
29887
  import { homedir as homedir4 } from "os";
29838
29888
  import { join as join6 } from "path";
29839
29889
  var isDebugEnabled = () => process.env.LOOPLIA_DEBUG === "1";
29840
29890
  var getLogsDir = (context) => join6(homedir4(), ".looplia", "logs", context);
29841
29891
  function ensureLogsDir(context) {
29842
29892
  const logsDir = getLogsDir(context);
29843
- if (!existsSync3(logsDir)) {
29893
+ if (!existsSync4(logsDir)) {
29844
29894
  mkdirSync4(logsDir, { recursive: true });
29845
29895
  }
29846
29896
  return logsDir;
@@ -31338,14 +31388,14 @@ function getWorkspacePath2() {
31338
31388
  function ensureWorkspace2(mock) {
31339
31389
  const workspace = getWorkspacePath2();
31340
31390
  const workflowsDir = resolve2(workspace, "workflows");
31341
- if (!existsSync4(workspace)) {
31391
+ if (!existsSync5(workspace)) {
31342
31392
  if (mock) {
31343
31393
  mkdirSync5(workflowsDir, { recursive: true });
31344
31394
  } else {
31345
31395
  console.error("Workspace not initialized. Run: looplia init");
31346
31396
  process.exit(1);
31347
31397
  }
31348
- } else if (!existsSync4(workflowsDir)) {
31398
+ } else if (!existsSync5(workflowsDir)) {
31349
31399
  mkdirSync5(workflowsDir, { recursive: true });
31350
31400
  }
31351
31401
  return workspace;
@@ -32711,7 +32761,7 @@ async function runInitCommand(args) {
32711
32761
  import { randomBytes } from "crypto";
32712
32762
  import {
32713
32763
  copyFileSync as copyFileSync2,
32714
- existsSync as existsSync5,
32764
+ existsSync as existsSync6,
32715
32765
  mkdirSync as mkdirSync6,
32716
32766
  readFileSync as readFileSync2,
32717
32767
  writeFileSync as writeFileSync4
@@ -32790,7 +32840,7 @@ function createSandboxWithInputs(workspace, workflowId, inputs) {
32790
32840
  );
32791
32841
  } else {
32792
32842
  const absolutePath = resolve3(parsedInput.value);
32793
- if (!existsSync5(absolutePath)) {
32843
+ if (!existsSync6(absolutePath)) {
32794
32844
  throw new Error(`Input file not found: ${parsedInput.value}`);
32795
32845
  }
32796
32846
  copyFileSync2(absolutePath, join8(sandboxDir, "inputs", `${name}.md`));
@@ -32958,7 +33008,7 @@ function getWorkspacePath3() {
32958
33008
  }
32959
33009
  function ensureWorkspace3(mock) {
32960
33010
  const workspace = getWorkspacePath3();
32961
- if (!existsSync5(workspace)) {
33011
+ if (!existsSync6(workspace)) {
32962
33012
  if (mock) {
32963
33013
  mkdirSync6(join8(workspace, "sandbox"), { recursive: true });
32964
33014
  } else {
@@ -32986,7 +33036,7 @@ function buildRunPrompt(workflowId, sandboxId) {
32986
33036
  }
32987
33037
  function checkWorkflowInputless(workspace, workflowId) {
32988
33038
  const workflowPath = join8(workspace, "workflows", `${workflowId}.md`);
32989
- if (!existsSync5(workflowPath)) {
33039
+ if (!existsSync6(workflowPath)) {
32990
33040
  return false;
32991
33041
  }
32992
33042
  try {
@@ -33055,7 +33105,7 @@ async function executeBatch2(prompt, workspace, workflowId) {
33055
33105
  function resolveSandboxId(workspace, parsed, allowInputless) {
33056
33106
  if (parsed.sandboxId) {
33057
33107
  const sandboxDir = join8(workspace, "sandbox", parsed.sandboxId);
33058
- if (!existsSync5(sandboxDir)) {
33108
+ if (!existsSync6(sandboxDir)) {
33059
33109
  console.error(`Error: Sandbox not found: ${parsed.sandboxId}`);
33060
33110
  console.error(`Path: ${sandboxDir}`);
33061
33111
  process.exit(1);
@@ -33072,7 +33122,7 @@ function resolveSandboxId(workspace, parsed, allowInputless) {
33072
33122
  return sandboxId;
33073
33123
  }
33074
33124
  if (parsed.file) {
33075
- if (!existsSync5(parsed.file)) {
33125
+ if (!existsSync6(parsed.file)) {
33076
33126
  console.error(`Error: File not found: ${parsed.file}`);
33077
33127
  process.exit(1);
33078
33128
  }
@@ -33152,7 +33202,7 @@ async function runRunCommand(args) {
33152
33202
  }
33153
33203
 
33154
33204
  // src/index.ts
33155
- var VERSION = "0.6.7";
33205
+ var VERSION = "0.6.8";
33156
33206
  function printHelp3() {
33157
33207
  console.log(`
33158
33208
  looplia - Content intelligence CLI (v${VERSION})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@looplia/looplia-cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Looplia CLI - AI-powered workflow automation tool",
5
5
  "type": "module",
6
6
  "license": "Elastic-2.0",