@wayai/cli 0.3.68 → 0.3.70

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.
package/dist/index.js CHANGED
@@ -9373,6 +9373,41 @@ var init_hub_binding = __esm({
9373
9373
  }
9374
9374
  });
9375
9375
 
9376
+ // src/lib/skill-symlink.ts
9377
+ import { existsSync as existsSync8, lstatSync, mkdirSync as mkdirSync4, rmSync, symlinkSync } from "fs";
9378
+ import { join as join11 } from "path";
9379
+ function healClaudeSkillLink(root) {
9380
+ try {
9381
+ const source = join11(root, ".agents", "skills", SKILL_NAME);
9382
+ if (!existsSync8(join11(source, SKILL_FILENAME))) return false;
9383
+ const link = join11(root, ".claude", "skills", SKILL_NAME);
9384
+ if (existsSync8(join11(link, SKILL_FILENAME))) return false;
9385
+ let entry = null;
9386
+ try {
9387
+ entry = lstatSync(link);
9388
+ } catch {
9389
+ entry = null;
9390
+ }
9391
+ if (entry) {
9392
+ if (!entry.isSymbolicLink()) return false;
9393
+ rmSync(link, { force: true });
9394
+ }
9395
+ mkdirSync4(join11(root, ".claude", "skills"), { recursive: true });
9396
+ symlinkSync(join11("..", "..", ".agents", "skills", SKILL_NAME), link, "dir");
9397
+ return true;
9398
+ } catch {
9399
+ return false;
9400
+ }
9401
+ }
9402
+ var SKILL_NAME;
9403
+ var init_skill_symlink = __esm({
9404
+ "src/lib/skill-symlink.ts"() {
9405
+ "use strict";
9406
+ init_skill_version();
9407
+ SKILL_NAME = "wayai";
9408
+ }
9409
+ });
9410
+
9376
9411
  // src/commands/status.ts
9377
9412
  var status_exports = {};
9378
9413
  __export(status_exports, {
@@ -9383,8 +9418,7 @@ import * as path8 from "path";
9383
9418
  function parseArgs(args2) {
9384
9419
  return { json: args2.includes("--json") };
9385
9420
  }
9386
- function buildSkillState() {
9387
- const projectRoot = findGitRoot() ?? process.cwd();
9421
+ function buildSkillState(projectRoot) {
9388
9422
  const installs = findInstalledSkills(projectRoot);
9389
9423
  if (installs.length === 0) {
9390
9424
  return { installed: false, version: null, latest: null, paths: [] };
@@ -9414,7 +9448,13 @@ async function statusCommand(args2, pkg2) {
9414
9448
  const workspace = buildWorkspaceState(repoConfig);
9415
9449
  const cachedCliLatest = readCachedLatest(CLI_CACHE_FILE);
9416
9450
  const cliLatest = cachedCliLatest && isNewerVersion(cachedCliLatest, pkg2.version) ? cachedCliLatest : null;
9417
- const skill = buildSkillState();
9451
+ const projectRoot = findGitRoot() ?? process.cwd();
9452
+ if (healClaudeSkillLink(projectRoot)) {
9453
+ console.error(
9454
+ "Linked .claude/skills/wayai \u2192 .agents/skills/wayai so Claude Code can load the WayAI skill."
9455
+ );
9456
+ }
9457
+ const skill = buildSkillState(projectRoot);
9418
9458
  let boundHubId = null;
9419
9459
  try {
9420
9460
  boundHubId = readBinding();
@@ -9537,6 +9577,7 @@ var init_status = __esm({
9537
9577
  init_api_client();
9538
9578
  init_version_cache();
9539
9579
  init_skill_version();
9580
+ init_skill_symlink();
9540
9581
  init_utils();
9541
9582
  init_report_inbox();
9542
9583
  }
@@ -9580,27 +9621,17 @@ var init_whoami = __esm({
9580
9621
  var init_exports = {};
9581
9622
  __export(init_exports, {
9582
9623
  SKILL_INSTALL_CMD: () => SKILL_INSTALL_CMD,
9624
+ ensureHubsDir: () => ensureHubsDir,
9583
9625
  initCommand: () => initCommand,
9584
- parseArgs: () => parseArgs3,
9585
- writeWorkspaceFiles: () => writeWorkspaceFiles
9626
+ parseArgs: () => parseArgs3
9586
9627
  });
9587
- import { existsSync as existsSync8, mkdirSync as mkdirSync4, writeFileSync as writeFileSync6 } from "fs";
9628
+ import { mkdirSync as mkdirSync5 } from "fs";
9588
9629
  import path9 from "path";
9589
- function writeWorkspaceFiles(gitRoot) {
9590
- const created = [];
9591
- for (const { name, content } of SHIM_FILES) {
9592
- const filePath = path9.join(gitRoot, name);
9593
- if (!existsSync8(filePath)) {
9594
- writeFileSync6(filePath, content);
9595
- created.push(name);
9596
- }
9597
- }
9630
+ function ensureHubsDir(gitRoot) {
9598
9631
  const hubsDir = resolveLayout(gitRoot).hubsDir;
9599
- if (!existsSync8(hubsDir)) {
9600
- mkdirSync4(hubsDir, { recursive: true });
9601
- created.push(`${path9.relative(gitRoot, hubsDir)}/`);
9602
- }
9603
- return created;
9632
+ if (isDirectory(hubsDir)) return null;
9633
+ mkdirSync5(hubsDir, { recursive: true });
9634
+ return `${path9.relative(gitRoot, hubsDir)}/`;
9604
9635
  }
9605
9636
  function parseArgs3(args2) {
9606
9637
  let orgId;
@@ -9639,9 +9670,9 @@ async function initCommand(args2) {
9639
9670
  }
9640
9671
  const gitRoot = findGitRoot();
9641
9672
  if (gitRoot) {
9642
- const created = writeWorkspaceFiles(gitRoot);
9643
- if (created.length > 0) {
9644
- console.log(`Created ${created.join(", ")}`);
9673
+ const createdDir = ensureHubsDir(gitRoot);
9674
+ if (createdDir) {
9675
+ console.log(`Created ${createdDir}`);
9645
9676
  }
9646
9677
  }
9647
9678
  console.log(
@@ -9714,7 +9745,7 @@ Select organization [1-${organizations.length}]: `);
9714
9745
  console.log(`
9715
9746
  Wrote ${configPath3}`);
9716
9747
  }
9717
- var SKILL_INSTALL_CMD, AGENTS_MD, CLAUDE_MD, AGENTS_LOCAL_MD, SHIM_FILES;
9748
+ var SKILL_INSTALL_CMD;
9718
9749
  var init_init = __esm({
9719
9750
  "src/commands/init.ts"() {
9720
9751
  "use strict";
@@ -9725,43 +9756,6 @@ var init_init = __esm({
9725
9756
  init_layout();
9726
9757
  init_utils();
9727
9758
  SKILL_INSTALL_CMD = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
9728
- AGENTS_MD = `# WayAI Workspace
9729
-
9730
- This is a WayAI hub-as-code workspace. Hub configuration is stored as files (\`hub.yaml\`, \`agents/*.yaml\`, \`agents/*.md\`) and synced bidirectionally with the WayAI platform via the \`wayai\` CLI.
9731
-
9732
- **Always start by reading the WayAI skill.** Install it with \`${SKILL_INSTALL_CMD}\` if you haven't already; the skill covers:
9733
- - Platform entities, hub types, AI modes, agent roles, connection types
9734
- - Workflow (\`wayai update\` \u2192 \`wayai pull\` \u2192 edit \u2192 \`wayai push\`)
9735
- - Common CLI commands and the decision matrix (CLI vs UI)
9736
- - Repository structure and YAML shapes (\`hub.yaml\`, \`agents/<slug>.yaml\`)
9737
- - Pointers to per-domain references (Connections, Agents, Resources, States, Outbound, Evals, Analytics, Templates)
9738
-
9739
- Project-specific overrides live in \`AGENTS.local.md\` \u2014 read it after the skill if it exists.
9740
-
9741
- This file is created once on \`wayai init\` and never overwritten \u2014 edit freely.
9742
- `;
9743
- CLAUDE_MD = `@AGENTS.md
9744
- @AGENTS.local.md
9745
- `;
9746
- AGENTS_LOCAL_MD = `# Project-specific instructions
9747
-
9748
- This file holds project-specific overrides and additional instructions for AI coding agents working on this hub. It is **never overwritten by \`wayai\` commands** \u2014 edit freely.
9749
-
9750
- Use it for things like:
9751
-
9752
- - Domain glossary and terminology specific to this hub
9753
- - Business rules the AI should always apply
9754
- - Conventions or constraints that override defaults in \`AGENTS.md\`
9755
- - Notes about external systems, integrations, or quirks
9756
- - Pointers to other repo files the agent should read first
9757
-
9758
- Leave this file empty (or delete its body) if you have nothing to add \u2014 \`AGENTS.md\` is sufficient on its own.
9759
- `;
9760
- SHIM_FILES = [
9761
- { name: "AGENTS.md", content: AGENTS_MD },
9762
- { name: "CLAUDE.md", content: CLAUDE_MD },
9763
- { name: "AGENTS.local.md", content: AGENTS_LOCAL_MD }
9764
- ];
9765
9759
  }
9766
9760
  });
9767
9761
 
@@ -18502,11 +18496,11 @@ var init_admin = __esm({
18502
18496
 
18503
18497
  // src/commands/report-create.ts
18504
18498
  import { readFileSync as readFileSync16 } from "fs";
18505
- import { dirname as dirname8, join as join23 } from "path";
18499
+ import { dirname as dirname8, join as join24 } from "path";
18506
18500
  import { fileURLToPath as fileURLToPath2 } from "url";
18507
18501
  function getCliVersion() {
18508
18502
  try {
18509
- const pkg2 = JSON.parse(readFileSync16(join23(__dirname, "..", "..", "package.json"), "utf-8"));
18503
+ const pkg2 = JSON.parse(readFileSync16(join24(__dirname, "..", "..", "package.json"), "utf-8"));
18510
18504
  return `cli@${pkg2.version}`;
18511
18505
  } catch {
18512
18506
  return "cli@unknown";
@@ -18890,7 +18884,7 @@ var init_update = __esm({
18890
18884
  init_sentry();
18891
18885
  import { readFileSync as readFileSync17 } from "fs";
18892
18886
  import { fileURLToPath as fileURLToPath3 } from "url";
18893
- import { dirname as dirname9, join as join24 } from "path";
18887
+ import { dirname as dirname9, join as join25 } from "path";
18894
18888
 
18895
18889
  // src/lib/errors.ts
18896
18890
  init_api_client();
@@ -19067,7 +19061,7 @@ Run \`wayai admin skill install\` to update.`);
19067
19061
 
19068
19062
  // src/index.ts
19069
19063
  var __dirname2 = dirname9(fileURLToPath3(import.meta.url));
19070
- var pkg = JSON.parse(readFileSync17(join24(__dirname2, "..", "package.json"), "utf-8"));
19064
+ var pkg = JSON.parse(readFileSync17(join25(__dirname2, "..", "package.json"), "utf-8"));
19071
19065
  var [, , command, ...args] = process.argv;
19072
19066
  var isBackgroundRefresh = command === REFRESH_COMMAND;
19073
19067
  if (!isBackgroundRefresh) initSentry(command);