@elevasis/sdk 1.8.2 → 1.9.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 (62) hide show
  1. package/dist/cli.cjs +289 -105
  2. package/dist/index.d.ts +90 -39
  3. package/dist/types/worker/adapters/lead.d.ts +1 -1
  4. package/dist/worker/index.js +2 -0
  5. package/package.json +2 -2
  6. package/reference/_navigation.md +7 -1
  7. package/reference/_reference-manifest.json +14 -0
  8. package/reference/claude-config/logs/scaffold-registry-reminder.log +3 -0
  9. package/reference/claude-config/rules/agent-start-here.md +254 -254
  10. package/reference/claude-config/rules/frontend.md +43 -43
  11. package/reference/claude-config/rules/operations.md +64 -64
  12. package/reference/claude-config/rules/organization-model.md +42 -43
  13. package/reference/claude-config/rules/organization-os.md +107 -107
  14. package/reference/claude-config/rules/shared-types.md +2 -2
  15. package/reference/claude-config/rules/task-tracking.md +1 -1
  16. package/reference/claude-config/rules/ui.md +202 -202
  17. package/reference/claude-config/rules/vibe.md +202 -202
  18. package/reference/claude-config/skills/configure/SKILL.md +98 -98
  19. package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -100
  20. package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -158
  21. package/reference/claude-config/skills/configure/operations/customers.md +150 -150
  22. package/reference/claude-config/skills/configure/operations/features.md +162 -162
  23. package/reference/claude-config/skills/configure/operations/goals.md +147 -147
  24. package/reference/claude-config/skills/configure/operations/identity.md +133 -133
  25. package/reference/claude-config/skills/configure/operations/labels.md +128 -128
  26. package/reference/claude-config/skills/configure/operations/offerings.md +159 -159
  27. package/reference/claude-config/skills/configure/operations/roles.md +153 -153
  28. package/reference/claude-config/skills/configure/operations/techStack.md +139 -139
  29. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  30. package/reference/claude-config/skills/git-sync/SKILL.md +126 -0
  31. package/reference/claude-config/skills/save/SKILL.md +183 -183
  32. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  33. package/reference/claude-config/skills/sync/SKILL.md +10 -44
  34. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -0
  35. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -0
  36. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -0
  37. package/reference/claude-config/sync-notes/README.md +43 -0
  38. package/reference/deployment/index.mdx +42 -7
  39. package/reference/examples/organization-model.ts +689 -0
  40. package/reference/index.mdx +6 -5
  41. package/reference/packages/core/src/README.md +39 -36
  42. package/reference/packages/core/src/business/README.md +52 -52
  43. package/reference/packages/core/src/organization-model/README.md +97 -97
  44. package/reference/packages/core/src/test-utils/README.md +42 -0
  45. package/reference/scaffold/core/organization-graph.mdx +272 -272
  46. package/reference/scaffold/core/organization-model.mdx +320 -320
  47. package/reference/scaffold/index.mdx +64 -64
  48. package/reference/scaffold/operations/propagation-pipeline.md +125 -104
  49. package/reference/scaffold/operations/scaffold-maintenance.md +122 -122
  50. package/reference/scaffold/operations/workflow-recipes.md +436 -436
  51. package/reference/scaffold/recipes/add-a-feature.md +158 -158
  52. package/reference/scaffold/recipes/add-a-resource.md +158 -158
  53. package/reference/scaffold/recipes/customize-organization-model.md +400 -400
  54. package/reference/scaffold/recipes/extend-a-base-entity.md +140 -140
  55. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +158 -158
  56. package/reference/scaffold/recipes/index.md +32 -32
  57. package/reference/scaffold/reference/contracts.md +608 -607
  58. package/reference/scaffold/reference/feature-registry.md +2 -0
  59. package/reference/scaffold/reference/glossary.md +105 -105
  60. package/reference/scaffold/ui/composition-extensibility.mdx +1 -1
  61. package/reference/scaffold/ui/feature-flags-and-gating.md +1 -1
  62. package/reference/claude-config/commands/submit-request.md +0 -11
package/dist/cli.cjs CHANGED
@@ -6623,14 +6623,14 @@ var require_async_iterator = __commonJS({
6623
6623
  };
6624
6624
  }
6625
6625
  function readAndResolve(iter) {
6626
- var resolve5 = iter[kLastResolve];
6627
- if (resolve5 !== null) {
6626
+ var resolve3 = iter[kLastResolve];
6627
+ if (resolve3 !== null) {
6628
6628
  var data = iter[kStream].read();
6629
6629
  if (data !== null) {
6630
6630
  iter[kLastPromise] = null;
6631
6631
  iter[kLastResolve] = null;
6632
6632
  iter[kLastReject] = null;
6633
- resolve5(createIterResult(data, false));
6633
+ resolve3(createIterResult(data, false));
6634
6634
  }
6635
6635
  }
6636
6636
  }
@@ -6638,13 +6638,13 @@ var require_async_iterator = __commonJS({
6638
6638
  process.nextTick(readAndResolve, iter);
6639
6639
  }
6640
6640
  function wrapForNext(lastPromise, iter) {
6641
- return function(resolve5, reject) {
6641
+ return function(resolve3, reject) {
6642
6642
  lastPromise.then(function() {
6643
6643
  if (iter[kEnded]) {
6644
- resolve5(createIterResult(void 0, true));
6644
+ resolve3(createIterResult(void 0, true));
6645
6645
  return;
6646
6646
  }
6647
- iter[kHandlePromise](resolve5, reject);
6647
+ iter[kHandlePromise](resolve3, reject);
6648
6648
  }, reject);
6649
6649
  };
6650
6650
  }
@@ -6664,12 +6664,12 @@ var require_async_iterator = __commonJS({
6664
6664
  return Promise.resolve(createIterResult(void 0, true));
6665
6665
  }
6666
6666
  if (this[kStream].destroyed) {
6667
- return new Promise(function(resolve5, reject) {
6667
+ return new Promise(function(resolve3, reject) {
6668
6668
  process.nextTick(function() {
6669
6669
  if (_this[kError]) {
6670
6670
  reject(_this[kError]);
6671
6671
  } else {
6672
- resolve5(createIterResult(void 0, true));
6672
+ resolve3(createIterResult(void 0, true));
6673
6673
  }
6674
6674
  });
6675
6675
  });
@@ -6692,13 +6692,13 @@ var require_async_iterator = __commonJS({
6692
6692
  return this;
6693
6693
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
6694
6694
  var _this2 = this;
6695
- return new Promise(function(resolve5, reject) {
6695
+ return new Promise(function(resolve3, reject) {
6696
6696
  _this2[kStream].destroy(null, function(err) {
6697
6697
  if (err) {
6698
6698
  reject(err);
6699
6699
  return;
6700
6700
  }
6701
- resolve5(createIterResult(void 0, true));
6701
+ resolve3(createIterResult(void 0, true));
6702
6702
  });
6703
6703
  });
6704
6704
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -6720,15 +6720,15 @@ var require_async_iterator = __commonJS({
6720
6720
  value: stream._readableState.endEmitted,
6721
6721
  writable: true
6722
6722
  }), _defineProperty(_Object$create, kHandlePromise, {
6723
- value: function value(resolve5, reject) {
6723
+ value: function value(resolve3, reject) {
6724
6724
  var data = iterator[kStream].read();
6725
6725
  if (data) {
6726
6726
  iterator[kLastPromise] = null;
6727
6727
  iterator[kLastResolve] = null;
6728
6728
  iterator[kLastReject] = null;
6729
- resolve5(createIterResult(data, false));
6729
+ resolve3(createIterResult(data, false));
6730
6730
  } else {
6731
- iterator[kLastResolve] = resolve5;
6731
+ iterator[kLastResolve] = resolve3;
6732
6732
  iterator[kLastReject] = reject;
6733
6733
  }
6734
6734
  },
@@ -6747,12 +6747,12 @@ var require_async_iterator = __commonJS({
6747
6747
  iterator[kError] = err;
6748
6748
  return;
6749
6749
  }
6750
- var resolve5 = iterator[kLastResolve];
6751
- if (resolve5 !== null) {
6750
+ var resolve3 = iterator[kLastResolve];
6751
+ if (resolve3 !== null) {
6752
6752
  iterator[kLastPromise] = null;
6753
6753
  iterator[kLastResolve] = null;
6754
6754
  iterator[kLastReject] = null;
6755
- resolve5(createIterResult(void 0, true));
6755
+ resolve3(createIterResult(void 0, true));
6756
6756
  }
6757
6757
  iterator[kEnded] = true;
6758
6758
  });
@@ -6767,7 +6767,7 @@ var require_async_iterator = __commonJS({
6767
6767
  var require_from = __commonJS({
6768
6768
  "../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
6769
6769
  "use strict";
6770
- function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
6770
+ function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
6771
6771
  try {
6772
6772
  var info = gen[key](arg);
6773
6773
  var value = info.value;
@@ -6776,7 +6776,7 @@ var require_from = __commonJS({
6776
6776
  return;
6777
6777
  }
6778
6778
  if (info.done) {
6779
- resolve5(value);
6779
+ resolve3(value);
6780
6780
  } else {
6781
6781
  Promise.resolve(value).then(_next, _throw);
6782
6782
  }
@@ -6784,13 +6784,13 @@ var require_from = __commonJS({
6784
6784
  function _asyncToGenerator(fn) {
6785
6785
  return function() {
6786
6786
  var self2 = this, args = arguments;
6787
- return new Promise(function(resolve5, reject) {
6787
+ return new Promise(function(resolve3, reject) {
6788
6788
  var gen = fn.apply(self2, args);
6789
6789
  function _next(value) {
6790
- asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
6790
+ asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
6791
6791
  }
6792
6792
  function _throw(err) {
6793
- asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
6793
+ asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err);
6794
6794
  }
6795
6795
  _next(void 0);
6796
6796
  });
@@ -23012,6 +23012,8 @@ __export(index_exports, {
23012
23012
  });
23013
23013
  module.exports = __toCommonJS(index_exports);
23014
23014
  var import_dotenv = __toESM(require_main(), 1);
23015
+ var import_fs2 = require("fs");
23016
+ var import_path3 = require("path");
23015
23017
 
23016
23018
  // ../../node_modules/.pnpm/commander@11.1.0/node_modules/commander/esm.mjs
23017
23019
  var import_index = __toESM(require_commander(), 1);
@@ -23525,9 +23527,6 @@ var chalk = createChalk();
23525
23527
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
23526
23528
  var source_default = chalk;
23527
23529
 
23528
- // src/cli/commands/check.ts
23529
- var import_path3 = require("path");
23530
-
23531
23530
  // ../../node_modules/.pnpm/ora@7.0.1/node_modules/ora/index.js
23532
23531
  var import_node_process6 = __toESM(require("node:process"), 1);
23533
23532
 
@@ -36586,6 +36585,31 @@ config(en_default());
36586
36585
  // src/cli/commands/deploy.ts
36587
36586
  var import_module = require("module");
36588
36587
 
36588
+ // ../core/src/platform/utils/validation.ts
36589
+ var UuidSchema = external_exports.string().uuid();
36590
+ var NonEmptyStringSchema = external_exports.string().trim().min(1).max(1e3);
36591
+ var ResourceTypeSchema = external_exports.enum(["agent", "workflow"]);
36592
+ var OriginResourceTypeSchema = external_exports.enum(["agent", "workflow", "scheduler", "api"]);
36593
+ var CredentialNameSchema = external_exports.string().trim().toLowerCase().min(1, "Credential name required").max(100, "Credential name too long (max 100 chars)").regex(
36594
+ /^[a-z0-9]+(-[a-z0-9]+)+$/,
36595
+ "Credential name must be lowercase letters, numbers, and hyphens in format: service-environment (e.g., gmail-prod, attio-dev)"
36596
+ );
36597
+ var OAuthProviderSchema = external_exports.enum(["google-sheets", "dropbox"]);
36598
+ var OAuthCodeSchema = external_exports.string().min(10, "Authorization code too short").max(1e3, "Authorization code too long");
36599
+ var OAuthStateParamSchema = external_exports.string().min(10, "State parameter too short").max(2048, "State parameter too long");
36600
+ var SanitizedStringSchema = external_exports.string().trim().transform((str) => str.replace(/[<>'"]/g, ""));
36601
+ var EmailSchema = external_exports.string().email();
36602
+ var UrlSchema = external_exports.string().url();
36603
+ var PaginationSchema = external_exports.object({
36604
+ limit: external_exports.coerce.number().int().min(1).max(100).default(20),
36605
+ offset: external_exports.coerce.number().int().min(0).default(0)
36606
+ });
36607
+ var TimestampSchema = external_exports.string().datetime();
36608
+ var DateRangeSchema = external_exports.object({
36609
+ startDate: external_exports.string().datetime(),
36610
+ endDate: external_exports.string().datetime()
36611
+ });
36612
+
36589
36613
  // ../core/src/platform/registry/domains.ts
36590
36614
  var DOMAINS = {
36591
36615
  // Business domains
@@ -40384,7 +40408,7 @@ function resolveApiKey(prod) {
40384
40408
  }
40385
40409
  return process.env.ELEVASIS_PLATFORM_KEY ?? "";
40386
40410
  }
40387
- function findProjectRoot(startDir) {
40411
+ function tryFindProjectRoot(startDir) {
40388
40412
  const raw = (0, import_path.resolve)(startDir);
40389
40413
  let dir;
40390
40414
  try {
@@ -40398,6 +40422,11 @@ function findProjectRoot(startDir) {
40398
40422
  if (parent === dir) break;
40399
40423
  dir = parent;
40400
40424
  }
40425
+ return null;
40426
+ }
40427
+ function findProjectRoot(startDir) {
40428
+ const root = tryFindProjectRoot(startDir);
40429
+ if (root !== null) return root;
40401
40430
  process.stderr.write(
40402
40431
  "Not inside an Elevasis project. Run this command from a project directory (an Elevasis project has a .elevasis file at its root).\n"
40403
40432
  );
@@ -40421,6 +40450,37 @@ function findEnvFile(_startDir) {
40421
40450
  const candidate = (0, import_path.join)(getProjectRoot(), ".env");
40422
40451
  return (0, import_fs.existsSync)(candidate) ? candidate : void 0;
40423
40452
  }
40453
+ function findPackageRoot(startDir) {
40454
+ const raw = (0, import_path.resolve)(startDir);
40455
+ let dir;
40456
+ try {
40457
+ dir = (0, import_fs.realpathSync)(raw);
40458
+ } catch {
40459
+ dir = raw;
40460
+ }
40461
+ const projectRoot = tryFindProjectRoot(dir);
40462
+ while (true) {
40463
+ if ((0, import_fs.existsSync)((0, import_path.join)(dir, "package.json"))) return dir;
40464
+ const parent = (0, import_path.dirname)(dir);
40465
+ if (parent === dir) break;
40466
+ if (projectRoot !== null && dir === projectRoot) break;
40467
+ dir = parent;
40468
+ }
40469
+ process.stderr.write(
40470
+ "No package.json found between the current directory and the project root.\nRemediation: run this command from inside a package directory (one that contains package.json).\n"
40471
+ );
40472
+ process.exit(1);
40473
+ }
40474
+ var _packageRoot;
40475
+ function getPackageRoot() {
40476
+ if (_packageRoot !== void 0) return _packageRoot;
40477
+ _packageRoot = isHelpOrVersionOnly() ? process.cwd() : findPackageRoot(process.cwd());
40478
+ return _packageRoot;
40479
+ }
40480
+ function resolvePackageRelative(relOrAbsPath) {
40481
+ if ((0, import_path.isAbsolute)(relOrAbsPath)) return relOrAbsPath;
40482
+ return (0, import_path.resolve)(getPackageRoot(), relOrAbsPath);
40483
+ }
40424
40484
 
40425
40485
  // src/cli/api-client.ts
40426
40486
  function getApiKey(apiUrl) {
@@ -40520,7 +40580,7 @@ function wrapAction(commandName, fn) {
40520
40580
  // package.json
40521
40581
  var package_default = {
40522
40582
  name: "@elevasis/sdk",
40523
- version: "1.8.2",
40583
+ version: "1.9.0",
40524
40584
  description: "SDK for building Elevasis organization resources",
40525
40585
  type: "module",
40526
40586
  bin: {
@@ -40581,13 +40641,13 @@ var SDK_VERSION = package_default.version;
40581
40641
 
40582
40642
  // src/cli/commands/deploy.ts
40583
40643
  function getEsbuild() {
40584
- const consumerRequire = (0, import_module.createRequire)((0, import_path2.resolve)(process.cwd(), "package.json"));
40644
+ const consumerRequire = (0, import_module.createRequire)(resolvePackageRelative("package.json"));
40585
40645
  return consumerRequire("esbuild");
40586
40646
  }
40587
40647
  async function loadTsModule(filePath) {
40588
40648
  const esbuild = getEsbuild();
40589
- const absPath = (0, import_path2.resolve)(filePath);
40590
- const tmpOut = (0, import_path2.resolve)(`.elevasis-tmp-${Date.now()}.mjs`);
40649
+ const absPath = resolvePackageRelative(filePath);
40650
+ const tmpOut = (0, import_path2.resolve)(getPackageRoot(), `.elevasis-tmp-${Date.now()}.mjs`);
40591
40651
  try {
40592
40652
  await esbuild.build({
40593
40653
  entryPoints: [absPath],
@@ -40685,7 +40745,7 @@ function registerDeployCommand(program3) {
40685
40745
  org = entryModule.default;
40686
40746
  if (!org) {
40687
40747
  validateSpinner.fail("Invalid entry: no default export found");
40688
- console.error(source_default.gray(` Entry file: ${(0, import_path2.resolve)(entryPath)}`));
40748
+ console.error(source_default.gray(` Entry file: ${resolvePackageRelative(entryPath)}`));
40689
40749
  throw new Error("Invalid entry: no default export found");
40690
40750
  }
40691
40751
  new ResourceRegistry({ [orgName]: org });
@@ -40703,7 +40763,7 @@ function registerDeployCommand(program3) {
40703
40763
  const currentVersion = org.version;
40704
40764
  if (bumpType !== null) {
40705
40765
  const newVersion = bumpVersion(currentVersion, bumpType);
40706
- const absEntryPath = (0, import_path2.resolve)(entryPath);
40766
+ const absEntryPath = resolvePackageRelative(entryPath);
40707
40767
  const entryContent = await (0, import_promises.readFile)(absEntryPath, "utf-8");
40708
40768
  const updatedContent = entryContent.replace(
40709
40769
  /version:\s*['"][\d]+\.[\d]+\.[\d]+['"]/,
@@ -40764,16 +40824,16 @@ function registerDeployCommand(program3) {
40764
40824
  console.log("");
40765
40825
  }
40766
40826
  const bundleSpinner = ora("Bundling...").start();
40767
- const wrapperPath = (0, import_path2.resolve)("__elevasis_worker.ts");
40768
- const bundleOutfile = (0, import_path2.resolve)("dist/bundle.js");
40827
+ const wrapperPath = resolvePackageRelative("__elevasis_worker.ts");
40828
+ const bundleOutfile = resolvePackageRelative("dist/bundle.js");
40769
40829
  try {
40770
- const entryImport = entryPath.replace(/\.ts$/, ".js");
40771
- const wrapperContent = `import org from ${JSON.stringify(entryImport)}
40830
+ const absEntryForImport = resolvePackageRelative(entryPath).replace(/\.ts$/, ".js");
40831
+ const wrapperContent = `import org from ${JSON.stringify(absEntryForImport)}
40772
40832
  import { startWorker } from '@elevasis/sdk/worker'
40773
40833
  startWorker(org)
40774
40834
  `;
40775
40835
  await (0, import_promises.writeFile)(wrapperPath, wrapperContent, "utf-8");
40776
- await (0, import_promises.mkdir)((0, import_path2.resolve)("dist"), { recursive: true });
40836
+ await (0, import_promises.mkdir)(resolvePackageRelative("dist"), { recursive: true });
40777
40837
  const esbuild = getEsbuild();
40778
40838
  await esbuild.build({
40779
40839
  entryPoints: [wrapperPath],
@@ -40882,7 +40942,7 @@ function registerCheckCommand(program3) {
40882
40942
  const org = entryModule.default;
40883
40943
  if (!org) {
40884
40944
  spinner.fail("Invalid entry: no default export found");
40885
- console.error(source_default.gray(` Entry file: ${(0, import_path3.resolve)(entryPath)}`));
40945
+ console.error(source_default.gray(` Entry file: ${resolvePackageRelative(entryPath)}`));
40886
40946
  console.error(source_default.gray(" Expected: export default { workflows: [...], agents: [...] }"));
40887
40947
  throw new Error("Invalid entry");
40888
40948
  }
@@ -40965,7 +41025,7 @@ async function pollForCompletion(resourceId, executionId, apiUrl) {
40965
41025
  if (interrupted) {
40966
41026
  return;
40967
41027
  }
40968
- await new Promise((resolve5) => setTimeout(resolve5, POLL_INTERVAL_MS));
41028
+ await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
40969
41029
  if (interrupted) {
40970
41030
  return;
40971
41031
  }
@@ -41580,10 +41640,10 @@ Credential renamed successfully!`));
41580
41640
  var import_readline = require("readline");
41581
41641
  function confirm(message) {
41582
41642
  const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
41583
- return new Promise((resolve5) => {
41643
+ return new Promise((resolve3) => {
41584
41644
  rl.question(message, (answer) => {
41585
41645
  rl.close();
41586
- resolve5(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
41646
+ resolve3(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
41587
41647
  });
41588
41648
  });
41589
41649
  }
@@ -42198,13 +42258,14 @@ Milestone created: ${m.name}`));
42198
42258
  );
42199
42259
  }
42200
42260
  function registerMilestoneUpdate(program3) {
42201
- program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--due-date <date>", "New due date (ISO 8601)").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
42261
+ program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
42202
42262
  wrapAction(
42203
42263
  "project:milestone:update",
42204
42264
  async (id, options) => {
42205
42265
  const body = {};
42206
42266
  if (options.name !== void 0) body.name = options.name;
42207
42267
  if (options.status !== void 0) body.status = options.status;
42268
+ if (options.description !== void 0) body.description = options.description;
42208
42269
  if (options.dueDate !== void 0) body.due_date = options.dueDate;
42209
42270
  if (options.checklist !== void 0) {
42210
42271
  try {
@@ -42219,7 +42280,7 @@ function registerMilestoneUpdate(program3) {
42219
42280
  if (Object.keys(body).length === 0) {
42220
42281
  process.stderr.write(
42221
42282
  JSON.stringify({
42222
- error: "At least one field must be provided (--name, --status, --due-date, --checklist)",
42283
+ error: "At least one field must be provided (--name, --status, --description, --due-date, --checklist)",
42223
42284
  code: "MISSING_FIELDS"
42224
42285
  }) + "\n"
42225
42286
  );
@@ -42535,7 +42596,148 @@ Resume context saved for task ${id}`));
42535
42596
  );
42536
42597
  }
42537
42598
 
42599
+ // ../core/src/projects/api-schemas.ts
42600
+ var ProjectKindSchema = external_exports.enum(["client_engagement", "internal", "research", "other"]);
42601
+ var ProjectStatusSchema = external_exports.enum(["active", "on_track", "at_risk", "blocked", "completed", "paused"]);
42602
+ var MilestoneStatusSchema = external_exports.enum(["upcoming", "in_progress", "completed", "overdue", "blocked"]);
42603
+ var TaskStatusSchema = external_exports.enum([
42604
+ "planned",
42605
+ "in_progress",
42606
+ "blocked",
42607
+ "completed",
42608
+ "cancelled",
42609
+ "submitted",
42610
+ "approved",
42611
+ "rejected",
42612
+ "revision_requested"
42613
+ ]);
42614
+ var TaskTypeSchema = external_exports.enum([
42615
+ "documentation",
42616
+ "code",
42617
+ "report",
42618
+ "design",
42619
+ "refactor",
42620
+ "feature",
42621
+ "bug",
42622
+ "research",
42623
+ "other"
42624
+ ]);
42625
+ var NoteTypeSchema = external_exports.enum(["call_note", "status_update", "issue", "blocker", "agent_learning"]);
42626
+ var ChecklistItemSchema = external_exports.object({
42627
+ id: external_exports.string(),
42628
+ label: external_exports.string(),
42629
+ completed: external_exports.boolean()
42630
+ });
42631
+ var ChecklistSchema = external_exports.array(ChecklistItemSchema);
42632
+ var ResumeContextSchema = external_exports.record(external_exports.string(), external_exports.unknown());
42633
+ var CreateProjectRequestSchema = external_exports.object({
42634
+ name: external_exports.string().trim().min(1).max(255),
42635
+ kind: ProjectKindSchema,
42636
+ status: ProjectStatusSchema.optional(),
42637
+ description: external_exports.string().nullable().optional(),
42638
+ deal_id: UuidSchema.nullable().optional(),
42639
+ client_company_id: UuidSchema.nullable().optional(),
42640
+ start_date: external_exports.string().nullable().optional(),
42641
+ target_end_date: external_exports.string().nullable().optional(),
42642
+ contract_value: external_exports.number().nullable().optional(),
42643
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42644
+ }).strict();
42645
+ var UpdateProjectRequestSchema = external_exports.object({
42646
+ name: external_exports.string().trim().min(1).max(255).optional(),
42647
+ kind: ProjectKindSchema.optional(),
42648
+ status: ProjectStatusSchema.optional(),
42649
+ description: external_exports.string().nullable().optional(),
42650
+ deal_id: UuidSchema.nullable().optional(),
42651
+ client_company_id: UuidSchema.nullable().optional(),
42652
+ start_date: external_exports.string().nullable().optional(),
42653
+ target_end_date: external_exports.string().nullable().optional(),
42654
+ actual_end_date: external_exports.string().nullable().optional(),
42655
+ contract_value: external_exports.number().nullable().optional(),
42656
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42657
+ }).strict().refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" });
42658
+ var GetProjectsQuerySchema = external_exports.object({
42659
+ kind: ProjectKindSchema.optional(),
42660
+ status: ProjectStatusSchema.optional(),
42661
+ search: external_exports.string().trim().min(1).max(255).optional()
42662
+ }).strict();
42663
+ var ProjectIdParamsSchema = external_exports.object({ id: UuidSchema });
42664
+ var CreateMilestoneRequestSchema = external_exports.object({
42665
+ name: external_exports.string().trim().min(1).max(255),
42666
+ status: MilestoneStatusSchema.optional(),
42667
+ description: external_exports.string().nullable().optional(),
42668
+ due_date: external_exports.string().nullable().optional(),
42669
+ sequence: external_exports.number().int().min(0).optional(),
42670
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42671
+ }).strict();
42672
+ var UpdateMilestoneRequestSchema = external_exports.object({
42673
+ name: external_exports.string().trim().min(1).max(255).optional(),
42674
+ status: MilestoneStatusSchema.optional(),
42675
+ description: external_exports.string().nullable().optional(),
42676
+ due_date: external_exports.string().nullable().optional(),
42677
+ completed_at: external_exports.string().nullable().optional(),
42678
+ sequence: external_exports.number().int().min(0).optional(),
42679
+ checklist: ChecklistSchema.optional(),
42680
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42681
+ }).strict().refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" });
42682
+ var ProjectIdPathParamsSchema = external_exports.object({ projectId: UuidSchema });
42683
+ var MilestoneIdParamsSchema = external_exports.object({ id: UuidSchema });
42684
+ var CreateTaskRequestSchema = external_exports.object({
42685
+ project_id: UuidSchema,
42686
+ name: external_exports.string().trim().min(1).max(255),
42687
+ type: TaskTypeSchema.optional(),
42688
+ status: TaskStatusSchema.optional(),
42689
+ description: external_exports.string().nullable().optional(),
42690
+ milestone_id: UuidSchema.nullable().optional(),
42691
+ parent_task_id: UuidSchema.nullable().optional(),
42692
+ due_date: external_exports.string().nullable().optional(),
42693
+ checklist: ChecklistSchema.optional(),
42694
+ resume_context: ResumeContextSchema.nullable().optional(),
42695
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42696
+ }).strict();
42697
+ var UpdateTaskRequestSchema = external_exports.object({
42698
+ name: external_exports.string().trim().min(1).max(255).optional(),
42699
+ type: TaskTypeSchema.optional(),
42700
+ status: TaskStatusSchema.optional(),
42701
+ description: external_exports.string().nullable().optional(),
42702
+ milestone_id: UuidSchema.nullable().optional(),
42703
+ parent_task_id: UuidSchema.nullable().optional(),
42704
+ due_date: external_exports.string().nullable().optional(),
42705
+ completed_at: external_exports.string().nullable().optional(),
42706
+ checklist: ChecklistSchema.optional(),
42707
+ resume_context: ResumeContextSchema.nullable().optional(),
42708
+ file_url: external_exports.string().nullable().optional(),
42709
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42710
+ }).strict().refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" });
42711
+ var MergeResumeContextRequestSchema = external_exports.record(external_exports.string(), external_exports.unknown()).refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" });
42712
+ var GetTasksQuerySchema = external_exports.object({
42713
+ status: TaskStatusSchema.optional(),
42714
+ milestone_id: UuidSchema.optional(),
42715
+ parent_task_id: UuidSchema.optional()
42716
+ }).strict();
42717
+ var TaskIdParamsSchema = external_exports.object({ id: UuidSchema });
42718
+ var CreateNoteRequestSchema = external_exports.object({
42719
+ project_id: UuidSchema,
42720
+ content: external_exports.string().trim().min(1),
42721
+ type: NoteTypeSchema.optional(),
42722
+ summary: external_exports.string().nullable().optional(),
42723
+ task_id: UuidSchema.nullable().optional(),
42724
+ milestone_id: UuidSchema.nullable().optional(),
42725
+ occurred_at: external_exports.string().optional(),
42726
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42727
+ }).strict();
42728
+ var UpdateNoteRequestSchema = external_exports.object({
42729
+ content: external_exports.string().trim().min(1).optional(),
42730
+ type: NoteTypeSchema.optional(),
42731
+ summary: external_exports.string().nullable().optional(),
42732
+ task_id: UuidSchema.nullable().optional(),
42733
+ milestone_id: UuidSchema.nullable().optional(),
42734
+ occurred_at: external_exports.string().optional(),
42735
+ metadata: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional()
42736
+ }).strict().refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" });
42737
+ var NoteIdParamsSchema = external_exports.object({ id: UuidSchema });
42738
+
42538
42739
  // src/cli/commands/project/notes.ts
42740
+ var NOTE_TYPE_HELP = NoteTypeSchema.options.join(" | ");
42539
42741
  function registerNoteList(program3) {
42540
42742
  program3.command("project:note:list").description("List notes for a project\n Example: elevasis-sdk project:note:list --project <uuid>").requiredOption("--project <project-id>", "Project ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
42541
42743
  wrapAction("project:note:list", async (options) => {
@@ -42565,7 +42767,7 @@ Notes (${notes.length}):
42565
42767
  function registerNoteCreate(program3) {
42566
42768
  program3.command("project:note:create").description(
42567
42769
  'Create a note\n Example: elevasis-sdk project:note:create --project <uuid> --content "Status update"'
42568
- ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--content <content>", "Note content").option("--task <task-id>", "Attach to a task (UUID)").option("--milestone <milestone-id>", "Attach to a milestone (UUID)").option("--type <type>", "Note type: call_note | status_update | issue | blocker | agent_learning").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
42770
+ ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--content <content>", "Note content").option("--task <task-id>", "Attach to a task (UUID)").option("--milestone <milestone-id>", "Attach to a milestone (UUID)").option("--type <type>", `Note type: ${NOTE_TYPE_HELP}`).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
42569
42771
  wrapAction(
42570
42772
  "project:note:create",
42571
42773
  async (options) => {
@@ -42694,9 +42896,16 @@ var ListRequestsQuerySchema = external_exports.object({
42694
42896
  });
42695
42897
 
42696
42898
  // src/cli/commands/request/request.ts
42899
+ var REQUEST_TYPE_HELP = RequestTypeEnum.options.join(" | ");
42900
+ var REQUEST_CATEGORY_HELP = RequestCategoryEnum.options.join(" | ");
42901
+ var REQUEST_SEVERITY_HELP = RequestSeverityEnum.options.join(" | ");
42697
42902
  function registerRequestCommands(program3) {
42698
42903
  program3.command("request:submit").description(
42699
- "Submit a structured request report via POST /api/external/requests\n Example: elevasis-sdk request:submit -f ./request-report.json"
42904
+ `Submit a structured request report via POST /api/external/requests
42905
+ Example: elevasis-sdk request:submit -f ./request-report.json
42906
+ type: ${REQUEST_TYPE_HELP}
42907
+ category: ${REQUEST_CATEGORY_HELP}
42908
+ severity: ${REQUEST_SEVERITY_HELP}`
42700
42909
  ).option("-i, --input <json>", "Request body as JSON string").option(
42701
42910
  "-f, --input-file <path>",
42702
42911
  "Read request body from a JSON file (e.g. request-report.json, avoids shell escaping). Relative paths resolve against the project root."
@@ -42873,74 +43082,48 @@ function printSummary(failCount) {
42873
43082
  }
42874
43083
  }
42875
43084
 
42876
- // src/cli/commands/init-claude.ts
42877
- var import_path4 = require("path");
42878
- var import_fs2 = require("fs");
42879
- var import_url = require("url");
42880
- var import_meta = {};
42881
- var _filename = import_meta.url ? (0, import_url.fileURLToPath)(import_meta.url) : process.argv[1];
42882
- var _dirname = (0, import_path4.dirname)(_filename);
42883
- function copyDirectoryRecursive(sourceDir, targetDir) {
42884
- if (!(0, import_fs2.existsSync)(sourceDir)) return 0;
42885
- let count = 0;
42886
- for (const entry of (0, import_fs2.readdirSync)(sourceDir, { withFileTypes: true })) {
42887
- const srcPath = (0, import_path4.join)(sourceDir, entry.name);
42888
- const destPath = (0, import_path4.join)(targetDir, entry.name);
42889
- if (entry.isDirectory()) {
42890
- count += copyDirectoryRecursive(srcPath, destPath);
42891
- } else {
42892
- (0, import_fs2.mkdirSync)((0, import_path4.dirname)(destPath), { recursive: true });
42893
- (0, import_fs2.writeFileSync)(destPath, (0, import_fs2.readFileSync)(srcPath, "utf-8"), "utf-8");
42894
- count++;
42895
- }
43085
+ // src/cli/index.ts
43086
+ var PREFLIGHT_SKIP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V"]);
43087
+ function shouldSkipPreflight() {
43088
+ const args = process.argv.slice(2);
43089
+ if (args.length === 0) return true;
43090
+ return args.every((a) => PREFLIGHT_SKIP_FLAGS.has(a));
43091
+ }
43092
+ function runPreflight() {
43093
+ if (shouldSkipPreflight()) return;
43094
+ const projectRoot = tryFindProjectRoot(process.cwd());
43095
+ if (projectRoot === null) {
43096
+ process.stderr.write(
43097
+ source_default.red("Not inside an Elevasis project. Run from a directory under one containing `.elevasis`.\n")
43098
+ );
43099
+ process.stderr.write(
43100
+ source_default.gray("Remediation: cd into your Elevasis project (e.g. external/my-project/) and retry.\n")
43101
+ );
43102
+ process.exit(1);
42896
43103
  }
42897
- return count;
42898
- }
42899
- function listFilesRecursive(dir, prefix = "") {
42900
- for (const entry of (0, import_fs2.readdirSync)(dir, { withFileTypes: true })) {
42901
- const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
42902
- if (entry.isDirectory()) {
42903
- listFilesRecursive((0, import_path4.join)(dir, entry.name), rel);
42904
- } else {
42905
- console.log(source_default.gray(` .claude/${rel}`));
42906
- }
43104
+ const envPath2 = (0, import_path3.join)(projectRoot, ".env");
43105
+ if (!(0, import_fs2.existsSync)(envPath2)) {
43106
+ process.stderr.write(source_default.red(`No \`.env\` found at \`${envPath2}\`. Set \`ELEVASIS_PLATFORM_KEY\`.
43107
+ `));
43108
+ process.stderr.write(
43109
+ source_default.gray(`Remediation: copy \`.env.example\` to \`${envPath2}\` and fill in ELEVASIS_PLATFORM_KEY.
43110
+ `)
43111
+ );
43112
+ process.exit(1);
43113
+ }
43114
+ if (!process.env.ELEVASIS_PLATFORM_KEY) {
43115
+ process.stderr.write(source_default.red(`\`ELEVASIS_PLATFORM_KEY\` missing from \`${envPath2}\`.
43116
+ `));
43117
+ process.stderr.write(source_default.gray("Remediation: add ELEVASIS_PLATFORM_KEY=sk_... to your .env file.\n"));
43118
+ process.exit(1);
42907
43119
  }
42908
43120
  }
42909
- function registerInitClaudeCommand(program3) {
42910
- program3.command("init-claude").description("Initialize or update .claude/ configuration from SDK defaults").option("--dry-run", "Show what would be copied without writing files").action(
42911
- wrapAction("init-claude", async (options) => {
42912
- const spinner = ora("Initializing .claude/ configuration...").start();
42913
- const claudeConfigSource = (0, import_path4.resolve)(_dirname, "..", "reference", "claude-config");
42914
- if (!(0, import_fs2.existsSync)(claudeConfigSource)) {
42915
- spinner.fail("Claude config source not found in SDK package");
42916
- console.error(source_default.gray(` Expected: ${claudeConfigSource}`));
42917
- console.error(source_default.gray(" This may indicate an incomplete SDK build."));
42918
- throw new Error("Claude config source not found");
42919
- }
42920
- const targetDir = (0, import_path4.resolve)(process.cwd(), ".claude");
42921
- if (options.dryRun) {
42922
- spinner.info("Dry run -- listing files that would be copied:");
42923
- listFilesRecursive(claudeConfigSource);
42924
- return;
42925
- }
42926
- const count = copyDirectoryRecursive(claudeConfigSource, targetDir);
42927
- spinner.succeed(
42928
- source_default.green(".claude/ configuration initialized") + source_default.gray(` (${count} file${count !== 1 ? "s" : ""} written)`)
42929
- );
42930
- })
42931
- );
42932
- }
42933
-
42934
- // src/cli/index.ts
42935
43121
  var envPath = findEnvFile();
42936
43122
  if (envPath) {
42937
43123
  const result = (0, import_dotenv.config)({ path: envPath, override: true });
42938
43124
  if (result.error) {
42939
43125
  console.error(source_default.yellow(`\u26A0 Found .env at ${envPath} but failed to load it: ${result.error.message}`));
42940
43126
  }
42941
- } else if (!process.env.ELEVASIS_PLATFORM_KEY) {
42942
- console.error(source_default.yellow(`\u26A0 No .env file found at ${getProjectRoot()}/.env`));
42943
- console.error(source_default.gray(" Set ELEVASIS_PLATFORM_KEY in a .env at your project root."));
42944
43127
  }
42945
43128
  var program2 = new Command();
42946
43129
  program2.name("elevasis-sdk").description(
@@ -42960,11 +43143,13 @@ Commands:
42960
43143
  elevasis-sdk project:work <query> Open a lifecycle-aware project work brief
42961
43144
  elevasis-sdk request:submit -f <path> Submit a structured request report
42962
43145
  elevasis-sdk rename <id> --to <newId> [--prod] Rename resource across platform tables
42963
- elevasis-sdk init-claude Initialize .claude/ config from SDK
42964
43146
  elevasis-sdk doctor [--verbose] Check project environment and API connectivity
42965
43147
 
42966
43148
  Use "elevasis-sdk <command> --help" for more information about a command.`
42967
43149
  ).version(SDK_VERSION);
43150
+ program2.hook("preAction", () => {
43151
+ runPreflight();
43152
+ });
42968
43153
  registerCheckCommand(program2);
42969
43154
  registerDeployCommand(program2);
42970
43155
  registerExecCommand(program2);
@@ -42979,7 +43164,6 @@ registerRenameCommand(program2);
42979
43164
  registerProjectCommands(program2);
42980
43165
  registerRequestCommands(program2);
42981
43166
  registerDoctorCommand(program2);
42982
- registerInitClaudeCommand(program2);
42983
43167
  program2.parse();
42984
43168
  // Annotate the CommonJS export names for ESM import in node:
42985
43169
  0 && (module.exports = {