@inkeep/agents-cli 0.0.0-dev-20251012052609 → 0.0.0-dev-20251012062813

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 +53 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -236342,6 +236342,27 @@ export { ${exportStatement} };
236342
236342
  }
236343
236343
 
236344
236344
  // src/commands/pull.ts
236345
+ async function detectCurrentProject() {
236346
+ const indexPath = join7(process.cwd(), "index.ts");
236347
+ if (!existsSync6(indexPath)) {
236348
+ return null;
236349
+ }
236350
+ try {
236351
+ const module = await importWithTypeScriptSupport(indexPath);
236352
+ const exports = Object.keys(module);
236353
+ for (const exportKey of exports) {
236354
+ const value = module[exportKey];
236355
+ if (value && typeof value === "object" && value.__type === "project") {
236356
+ if (typeof value.getId === "function") {
236357
+ return value.getId();
236358
+ }
236359
+ }
236360
+ }
236361
+ return null;
236362
+ } catch (error) {
236363
+ return null;
236364
+ }
236365
+ }
236345
236366
  async function verifyGeneratedFiles(projectDir, originalProjectData, debug = false) {
236346
236367
  const errors = [];
236347
236368
  const warnings = [];
@@ -236507,9 +236528,14 @@ function ensureDirectoryExists(dirPath) {
236507
236528
  mkdirSync(dirPath, { recursive: true });
236508
236529
  }
236509
236530
  }
236510
- function createProjectStructure(projectDir, projectId) {
236511
- const dirName = projectDir.split("/").pop() || projectDir;
236512
- const projectRoot = dirName === projectId ? projectDir : join7(projectDir, projectId);
236531
+ function createProjectStructure(projectDir, projectId, useCurrentDirectory = false) {
236532
+ let projectRoot;
236533
+ if (useCurrentDirectory) {
236534
+ projectRoot = projectDir;
236535
+ } else {
236536
+ const dirName = projectDir.split("/").pop() || projectDir;
236537
+ projectRoot = dirName === projectId ? projectDir : join7(projectDir, projectId);
236538
+ }
236513
236539
  const agentsDir = join7(projectRoot, "agents");
236514
236540
  const toolsDir = join7(projectRoot, "tools");
236515
236541
  const dataComponentsDir = join7(projectRoot, "data-components");
@@ -236754,7 +236780,29 @@ async function pullProjectCommand(options) {
236754
236780
  agentsManageApiUrl: config.agentsManageApi.url,
236755
236781
  agentsManageApiKey: config.agentsManageApi.apiKey
236756
236782
  };
236757
- if (!options.project) {
236783
+ spinner.text = "Detecting project in current directory...";
236784
+ const currentProjectId = await detectCurrentProject();
236785
+ let useCurrentDirectory = false;
236786
+ if (options.project) {
236787
+ if (currentProjectId) {
236788
+ spinner.fail("Conflicting project specification");
236789
+ console.error(chalk7.red("Error: Cannot specify --project argument when in a project directory"));
236790
+ console.error(chalk7.yellow(` \u2022 Current directory project: ${currentProjectId}`));
236791
+ console.error(chalk7.yellow(` \u2022 Specified project argument: ${options.project}`));
236792
+ console.error(chalk7.gray("\nTo pull to this directory, run without --project argument:"));
236793
+ console.error(chalk7.gray(" inkeep pull"));
236794
+ console.error(chalk7.gray("\nTo pull a different project, run from a non-project directory."));
236795
+ process.exit(1);
236796
+ }
236797
+ const projectIdFromPath = options.project.split("/").pop() || options.project;
236798
+ finalConfig.projectId = projectIdFromPath;
236799
+ } else if (currentProjectId) {
236800
+ finalConfig.projectId = currentProjectId;
236801
+ useCurrentDirectory = true;
236802
+ baseDir = process.cwd();
236803
+ spinner.succeed(`Detected project in current directory: ${currentProjectId}`);
236804
+ console.log(chalk7.gray(` \u2022 Will pull to current directory (directory-aware mode)`));
236805
+ } else {
236758
236806
  spinner.stop();
236759
236807
  const response = await prompts({
236760
236808
  type: "text",
@@ -236768,9 +236816,6 @@ async function pullProjectCommand(options) {
236768
236816
  }
236769
236817
  finalConfig.projectId = response.projectId;
236770
236818
  spinner.start("Configuration loaded");
236771
- } else {
236772
- const projectIdFromPath = options.project.split("/").pop() || options.project;
236773
- finalConfig.projectId = projectIdFromPath;
236774
236819
  }
236775
236820
  spinner.succeed("Configuration loaded");
236776
236821
  console.log(chalk7.gray("Configuration:"));
@@ -236834,7 +236879,7 @@ async function pullProjectCommand(options) {
236834
236879
  );
236835
236880
  }
236836
236881
  spinner.start("Creating project structure...");
236837
- const dirs = createProjectStructure(baseDir, finalConfig.projectId);
236882
+ const dirs = createProjectStructure(baseDir, finalConfig.projectId, useCurrentDirectory);
236838
236883
  spinner.succeed("Project structure created");
236839
236884
  if (options.json) {
236840
236885
  const jsonFilePath = join7(dirs.projectRoot, `${finalConfig.projectId}.json`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-cli",
3
- "version": "0.0.0-dev-20251012052609",
3
+ "version": "0.0.0-dev-20251012062813",
4
4
  "description": "Inkeep CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,8 +46,8 @@
46
46
  "recast": "^0.23.0",
47
47
  "ts-morph": "^26.0.0",
48
48
  "tsx": "^4.20.5",
49
- "@inkeep/agents-core": "^0.0.0-dev-20251012052609",
50
- "@inkeep/agents-sdk": "^0.0.0-dev-20251012052609"
49
+ "@inkeep/agents-core": "^0.0.0-dev-20251012062813",
50
+ "@inkeep/agents-sdk": "^0.0.0-dev-20251012062813"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/degit": "^2.8.6",
@@ -62,7 +62,7 @@
62
62
  "vitest": "^3.2.4"
63
63
  },
64
64
  "peerDependencies": {
65
- "@inkeep/agents-manage-ui": "0.0.0-dev-20251012052609",
65
+ "@inkeep/agents-manage-ui": "0.0.0-dev-20251012062813",
66
66
  "zod": "^4.1.11"
67
67
  },
68
68
  "engines": {