@corenel/cli 0.4.0 → 0.4.1

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 (3) hide show
  1. package/LICENSE +93 -0
  2. package/dist/cli.js +260 -140
  3. package/package.json +5 -5
package/LICENSE ADDED
@@ -0,0 +1,93 @@
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject to
14
+ the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor's trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising out
70
+ of these terms or the use or nature of the software, under any kind of legal
71
+ claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is the
76
+ software the licensor makes available under these terms, including any portion of
77
+ it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over, are
83
+ under the control of, or are under common control with that organization.
84
+ **control** means ownership of substantially all the assets of an entity, or the
85
+ power to direct its management and policies by vote, contract, or otherwise.
86
+ Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under these
89
+ terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
package/dist/cli.js CHANGED
@@ -1177,8 +1177,8 @@ var require_stringifyString = __commonJS({
1177
1177
  case "u":
1178
1178
  {
1179
1179
  str += json.slice(start, i);
1180
- const code = json.substr(i + 2, 4);
1181
- switch (code) {
1180
+ const code2 = json.substr(i + 2, 4);
1181
+ switch (code2) {
1182
1182
  case "0000":
1183
1183
  str += "\\0";
1184
1184
  break;
@@ -1204,8 +1204,8 @@ var require_stringifyString = __commonJS({
1204
1204
  str += "\\P";
1205
1205
  break;
1206
1206
  default:
1207
- if (code.substr(0, 2) === "00")
1208
- str += "\\x" + code.substr(2);
1207
+ if (code2.substr(0, 2) === "00")
1208
+ str += "\\x" + code2.substr(2);
1209
1209
  else
1210
1210
  str += json.substr(i, 6);
1211
1211
  }
@@ -3704,22 +3704,22 @@ var require_errors = __commonJS({
3704
3704
  "../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/errors.js"(exports) {
3705
3705
  "use strict";
3706
3706
  var YAMLError = class extends Error {
3707
- constructor(name, pos, code, message) {
3707
+ constructor(name, pos, code2, message) {
3708
3708
  super();
3709
3709
  this.name = name;
3710
- this.code = code;
3710
+ this.code = code2;
3711
3711
  this.message = message;
3712
3712
  this.pos = pos;
3713
3713
  }
3714
3714
  };
3715
3715
  var YAMLParseError = class extends YAMLError {
3716
- constructor(pos, code, message) {
3717
- super("YAMLParseError", pos, code, message);
3716
+ constructor(pos, code2, message) {
3717
+ super("YAMLParseError", pos, code2, message);
3718
3718
  }
3719
3719
  };
3720
3720
  var YAMLWarning = class extends YAMLError {
3721
- constructor(pos, code, message) {
3722
- super("YAMLWarning", pos, code, message);
3721
+ constructor(pos, code2, message) {
3722
+ super("YAMLWarning", pos, code2, message);
3723
3723
  }
3724
3724
  };
3725
3725
  var prettifyError = (src, lc) => (error) => {
@@ -4625,7 +4625,7 @@ var require_resolve_flow_scalar = __commonJS({
4625
4625
  const { offset, type, source, end } = scalar;
4626
4626
  let _type;
4627
4627
  let value;
4628
- const _onError = (rel, code, msg) => onError(offset + rel, code, msg);
4628
+ const _onError = (rel, code2, msg) => onError(offset + rel, code2, msg);
4629
4629
  switch (type) {
4630
4630
  case "scalar":
4631
4631
  _type = Scalar.Scalar.PLAIN;
@@ -4820,9 +4820,9 @@ var require_resolve_flow_scalar = __commonJS({
4820
4820
  function parseCharCode(source, offset, length, onError) {
4821
4821
  const cc = source.substr(offset, length);
4822
4822
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
4823
- const code = ok ? parseInt(cc, 16) : NaN;
4823
+ const code2 = ok ? parseInt(cc, 16) : NaN;
4824
4824
  try {
4825
- return String.fromCodePoint(code);
4825
+ return String.fromCodePoint(code2);
4826
4826
  } catch {
4827
4827
  const raw = source.substr(offset - 2, length + 2);
4828
4828
  onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
@@ -5144,12 +5144,12 @@ var require_composer = __commonJS({
5144
5144
  this.prelude = [];
5145
5145
  this.errors = [];
5146
5146
  this.warnings = [];
5147
- this.onError = (source, code, message, warning) => {
5147
+ this.onError = (source, code2, message, warning) => {
5148
5148
  const pos = getErrorPos(source);
5149
5149
  if (warning)
5150
- this.warnings.push(new errors.YAMLWarning(pos, code, message));
5150
+ this.warnings.push(new errors.YAMLWarning(pos, code2, message));
5151
5151
  else
5152
- this.errors.push(new errors.YAMLParseError(pos, code, message));
5152
+ this.errors.push(new errors.YAMLParseError(pos, code2, message));
5153
5153
  };
5154
5154
  this.directives = new directives.Directives({ version: options.version || "1.2" });
5155
5155
  this.options = options;
@@ -5311,12 +5311,12 @@ var require_cst_scalar = __commonJS({
5311
5311
  var stringifyString = require_stringifyString();
5312
5312
  function resolveAsScalar(token, strict = true, onError) {
5313
5313
  if (token) {
5314
- const _onError = (pos, code, message) => {
5314
+ const _onError = (pos, code2, message) => {
5315
5315
  const offset = typeof pos === "number" ? pos : Array.isArray(pos) ? pos[0] : pos.offset;
5316
5316
  if (onError)
5317
- onError(offset, code, message);
5317
+ onError(offset, code2, message);
5318
5318
  else
5319
- throw new errors.YAMLParseError([offset, offset + 1], code, message);
5319
+ throw new errors.YAMLParseError([offset, offset + 1], code2, message);
5320
5320
  };
5321
5321
  switch (token.type) {
5322
5322
  case "scalar":
@@ -6897,14 +6897,14 @@ var require_parser = __commonJS({
6897
6897
  case "scalar":
6898
6898
  case "single-quoted-scalar":
6899
6899
  case "double-quoted-scalar": {
6900
- const fs3 = this.flowScalar(this.type);
6900
+ const fs4 = this.flowScalar(this.type);
6901
6901
  if (atNextItem || it.value) {
6902
- map.items.push({ start, key: fs3, sep: [] });
6902
+ map.items.push({ start, key: fs4, sep: [] });
6903
6903
  this.onKeyLine = true;
6904
6904
  } else if (it.sep) {
6905
- this.stack.push(fs3);
6905
+ this.stack.push(fs4);
6906
6906
  } else {
6907
- Object.assign(it, { key: fs3, sep: [] });
6907
+ Object.assign(it, { key: fs4, sep: [] });
6908
6908
  this.onKeyLine = true;
6909
6909
  }
6910
6910
  return;
@@ -7032,13 +7032,13 @@ var require_parser = __commonJS({
7032
7032
  case "scalar":
7033
7033
  case "single-quoted-scalar":
7034
7034
  case "double-quoted-scalar": {
7035
- const fs3 = this.flowScalar(this.type);
7035
+ const fs4 = this.flowScalar(this.type);
7036
7036
  if (!it || it.value)
7037
- fc.items.push({ start: [], key: fs3, sep: [] });
7037
+ fc.items.push({ start: [], key: fs4, sep: [] });
7038
7038
  else if (it.sep)
7039
- this.stack.push(fs3);
7039
+ this.stack.push(fs4);
7040
7040
  else
7041
- Object.assign(it, { key: fs3, sep: [] });
7041
+ Object.assign(it, { key: fs4, sep: [] });
7042
7042
  return;
7043
7043
  }
7044
7044
  case "flow-map-end":
@@ -12241,11 +12241,11 @@ var require_compiler = __commonJS({
12241
12241
  _proto._popBuffer = function _popBuffer() {
12242
12242
  this.buffer = this.bufferStack.pop();
12243
12243
  };
12244
- _proto._emit = function _emit(code) {
12245
- this.codebuf.push(code);
12244
+ _proto._emit = function _emit(code2) {
12245
+ this.codebuf.push(code2);
12246
12246
  };
12247
- _proto._emitLine = function _emitLine(code) {
12248
- this._emit(code + "\n");
12247
+ _proto._emitLine = function _emitLine(code2) {
12248
+ this._emit(code2 + "\n");
12249
12249
  };
12250
12250
  _proto._emitLines = function _emitLines() {
12251
12251
  var _this = this;
@@ -13704,7 +13704,7 @@ var require_node_loaders = __commonJS({
13704
13704
  };
13705
13705
  return _setPrototypeOf(o, p);
13706
13706
  }
13707
- var fs3 = __require("fs");
13707
+ var fs4 = __require("fs");
13708
13708
  var path = __require("path");
13709
13709
  var Loader2 = require_loader();
13710
13710
  var _require = require_precompiled_loader();
@@ -13733,7 +13733,7 @@ var require_node_loaders = __commonJS({
13733
13733
  } catch (e) {
13734
13734
  throw new Error("watch requires chokidar to be installed");
13735
13735
  }
13736
- var paths = _this.searchPaths.filter(fs3.existsSync);
13736
+ var paths = _this.searchPaths.filter(fs4.existsSync);
13737
13737
  var watcher = chokidar.watch(paths);
13738
13738
  watcher.on("all", function(event, fullname) {
13739
13739
  fullname = path.resolve(fullname);
@@ -13754,7 +13754,7 @@ var require_node_loaders = __commonJS({
13754
13754
  for (var i = 0; i < paths.length; i++) {
13755
13755
  var basePath = path.resolve(paths[i]);
13756
13756
  var p = path.resolve(paths[i], name);
13757
- if (p.indexOf(basePath) === 0 && fs3.existsSync(p)) {
13757
+ if (p.indexOf(basePath) === 0 && fs4.existsSync(p)) {
13758
13758
  fullpath = p;
13759
13759
  break;
13760
13760
  }
@@ -13764,7 +13764,7 @@ var require_node_loaders = __commonJS({
13764
13764
  }
13765
13765
  this.pathsToNames[fullpath] = name;
13766
13766
  var source = {
13767
- src: fs3.readFileSync(fullpath, "utf-8"),
13767
+ src: fs4.readFileSync(fullpath, "utf-8"),
13768
13768
  path: fullpath,
13769
13769
  noCache: this.noCache
13770
13770
  };
@@ -13816,7 +13816,7 @@ var require_node_loaders = __commonJS({
13816
13816
  }
13817
13817
  this.pathsToNames[fullpath] = name;
13818
13818
  var source = {
13819
- src: fs3.readFileSync(fullpath, "utf-8"),
13819
+ src: fs4.readFileSync(fullpath, "utf-8"),
13820
13820
  path: fullpath,
13821
13821
  noCache: this.noCache
13822
13822
  };
@@ -14573,7 +14573,7 @@ var require_precompile_global = __commonJS({
14573
14573
  var require_precompile = __commonJS({
14574
14574
  "../../node_modules/.pnpm/nunjucks@3.2.4/node_modules/nunjucks/src/precompile.js"(exports, module) {
14575
14575
  "use strict";
14576
- var fs3 = __require("fs");
14576
+ var fs4 = __require("fs");
14577
14577
  var path = __require("path");
14578
14578
  var _require = require_lib();
14579
14579
  var _prettifyError = _require._prettifyError;
@@ -14606,14 +14606,14 @@ var require_precompile = __commonJS({
14606
14606
  if (opts.isString) {
14607
14607
  return precompileString(input, opts);
14608
14608
  }
14609
- var pathStats = fs3.existsSync(input) && fs3.statSync(input);
14609
+ var pathStats = fs4.existsSync(input) && fs4.statSync(input);
14610
14610
  var precompiled = [];
14611
14611
  var templates = [];
14612
14612
  function addTemplates(dir) {
14613
- fs3.readdirSync(dir).forEach(function(file) {
14613
+ fs4.readdirSync(dir).forEach(function(file) {
14614
14614
  var filepath = path.join(dir, file);
14615
14615
  var subpath = filepath.substr(path.join(input, "/").length);
14616
- var stat = fs3.statSync(filepath);
14616
+ var stat = fs4.statSync(filepath);
14617
14617
  if (stat && stat.isDirectory()) {
14618
14618
  subpath += "/";
14619
14619
  if (!match(subpath, opts.exclude)) {
@@ -14625,13 +14625,13 @@ var require_precompile = __commonJS({
14625
14625
  });
14626
14626
  }
14627
14627
  if (pathStats.isFile()) {
14628
- precompiled.push(_precompile(fs3.readFileSync(input, "utf-8"), opts.name || input, env));
14628
+ precompiled.push(_precompile(fs4.readFileSync(input, "utf-8"), opts.name || input, env));
14629
14629
  } else if (pathStats.isDirectory()) {
14630
14630
  addTemplates(input);
14631
14631
  for (var i = 0; i < templates.length; i++) {
14632
14632
  var name = templates[i].replace(path.join(input, "/"), "");
14633
14633
  try {
14634
- precompiled.push(_precompile(fs3.readFileSync(templates[i], "utf-8"), name, env));
14634
+ precompiled.push(_precompile(fs4.readFileSync(templates[i], "utf-8"), name, env));
14635
14635
  } catch (e) {
14636
14636
  if (opts.force) {
14637
14637
  console.error(e);
@@ -15707,8 +15707,8 @@ var require_validation = __commonJS({
15707
15707
  0
15708
15708
  // 112 - 127
15709
15709
  ];
15710
- function isValidStatusCode(code) {
15711
- return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
15710
+ function isValidStatusCode(code2) {
15711
+ return code2 >= 1e3 && code2 <= 1014 && code2 !== 1004 && code2 !== 1005 && code2 !== 1006 || code2 >= 3e3 && code2 <= 4999;
15712
15712
  }
15713
15713
  function _isValidUTF8(buf) {
15714
15714
  const len = buf.length;
@@ -16321,11 +16321,11 @@ var require_receiver = __commonJS({
16321
16321
  this.emit("conclude", 1005, EMPTY_BUFFER);
16322
16322
  this.end();
16323
16323
  } else {
16324
- const code = data.readUInt16BE(0);
16325
- if (!isValidStatusCode(code)) {
16324
+ const code2 = data.readUInt16BE(0);
16325
+ if (!isValidStatusCode(code2)) {
16326
16326
  const error = this.createError(
16327
16327
  RangeError,
16328
- `invalid status code ${code}`,
16328
+ `invalid status code ${code2}`,
16329
16329
  true,
16330
16330
  1002,
16331
16331
  "WS_ERR_INVALID_CLOSE_CODE"
@@ -16350,7 +16350,7 @@ var require_receiver = __commonJS({
16350
16350
  return;
16351
16351
  }
16352
16352
  this._loop = false;
16353
- this.emit("conclude", code, buf);
16353
+ this.emit("conclude", code2, buf);
16354
16354
  this.end();
16355
16355
  }
16356
16356
  this._state = GET_INFO;
@@ -16540,22 +16540,22 @@ var require_sender = __commonJS({
16540
16540
  * @param {Function} [cb] Callback
16541
16541
  * @public
16542
16542
  */
16543
- close(code, data, mask, cb) {
16543
+ close(code2, data, mask, cb) {
16544
16544
  let buf;
16545
- if (code === void 0) {
16545
+ if (code2 === void 0) {
16546
16546
  buf = EMPTY_BUFFER;
16547
- } else if (typeof code !== "number" || !isValidStatusCode(code)) {
16547
+ } else if (typeof code2 !== "number" || !isValidStatusCode(code2)) {
16548
16548
  throw new TypeError("First argument must be a valid error code number");
16549
16549
  } else if (data === void 0 || !data.length) {
16550
16550
  buf = Buffer.allocUnsafe(2);
16551
- buf.writeUInt16BE(code, 0);
16551
+ buf.writeUInt16BE(code2, 0);
16552
16552
  } else {
16553
16553
  const length = Buffer.byteLength(data);
16554
16554
  if (length > 123) {
16555
16555
  throw new RangeError("The message must not be greater than 123 bytes");
16556
16556
  }
16557
16557
  buf = Buffer.allocUnsafe(2 + length);
16558
- buf.writeUInt16BE(code, 0);
16558
+ buf.writeUInt16BE(code2, 0);
16559
16559
  if (typeof data === "string") {
16560
16560
  buf.write(data, 2);
16561
16561
  } else if (isUint8Array(data)) {
@@ -17050,9 +17050,9 @@ var require_event_target = __commonJS({
17050
17050
  callListener(handler, this, event);
17051
17051
  };
17052
17052
  } else if (type === "close") {
17053
- wrapper = function onClose(code, message) {
17053
+ wrapper = function onClose(code2, message) {
17054
17054
  const event = new CloseEvent("close", {
17055
- code,
17055
+ code: code2,
17056
17056
  reason: message.toString(),
17057
17057
  wasClean: this._closeFrameReceived && this._closeFrameSent
17058
17058
  });
@@ -17136,23 +17136,23 @@ var require_extension = __commonJS({
17136
17136
  let extensionName;
17137
17137
  let paramName;
17138
17138
  let start = -1;
17139
- let code = -1;
17139
+ let code2 = -1;
17140
17140
  let end = -1;
17141
17141
  let i = 0;
17142
17142
  for (; i < header.length; i++) {
17143
- code = header.charCodeAt(i);
17143
+ code2 = header.charCodeAt(i);
17144
17144
  if (extensionName === void 0) {
17145
- if (end === -1 && tokenChars[code] === 1) {
17145
+ if (end === -1 && tokenChars[code2] === 1) {
17146
17146
  if (start === -1) start = i;
17147
- } else if (i !== 0 && (code === 32 || code === 9)) {
17147
+ } else if (i !== 0 && (code2 === 32 || code2 === 9)) {
17148
17148
  if (end === -1 && start !== -1) end = i;
17149
- } else if (code === 59 || code === 44) {
17149
+ } else if (code2 === 59 || code2 === 44) {
17150
17150
  if (start === -1) {
17151
17151
  throw new SyntaxError(`Unexpected character at index ${i}`);
17152
17152
  }
17153
17153
  if (end === -1) end = i;
17154
17154
  const name = header.slice(start, end);
17155
- if (code === 44) {
17155
+ if (code2 === 44) {
17156
17156
  push(offers, name, params);
17157
17157
  params = /* @__PURE__ */ Object.create(null);
17158
17158
  } else {
@@ -17163,23 +17163,23 @@ var require_extension = __commonJS({
17163
17163
  throw new SyntaxError(`Unexpected character at index ${i}`);
17164
17164
  }
17165
17165
  } else if (paramName === void 0) {
17166
- if (end === -1 && tokenChars[code] === 1) {
17166
+ if (end === -1 && tokenChars[code2] === 1) {
17167
17167
  if (start === -1) start = i;
17168
- } else if (code === 32 || code === 9) {
17168
+ } else if (code2 === 32 || code2 === 9) {
17169
17169
  if (end === -1 && start !== -1) end = i;
17170
- } else if (code === 59 || code === 44) {
17170
+ } else if (code2 === 59 || code2 === 44) {
17171
17171
  if (start === -1) {
17172
17172
  throw new SyntaxError(`Unexpected character at index ${i}`);
17173
17173
  }
17174
17174
  if (end === -1) end = i;
17175
17175
  push(params, header.slice(start, end), true);
17176
- if (code === 44) {
17176
+ if (code2 === 44) {
17177
17177
  push(offers, extensionName, params);
17178
17178
  params = /* @__PURE__ */ Object.create(null);
17179
17179
  extensionName = void 0;
17180
17180
  }
17181
17181
  start = end = -1;
17182
- } else if (code === 61 && start !== -1 && end === -1) {
17182
+ } else if (code2 === 61 && start !== -1 && end === -1) {
17183
17183
  paramName = header.slice(start, i);
17184
17184
  start = end = -1;
17185
17185
  } else {
@@ -17187,30 +17187,30 @@ var require_extension = __commonJS({
17187
17187
  }
17188
17188
  } else {
17189
17189
  if (isEscaping) {
17190
- if (tokenChars[code] !== 1) {
17190
+ if (tokenChars[code2] !== 1) {
17191
17191
  throw new SyntaxError(`Unexpected character at index ${i}`);
17192
17192
  }
17193
17193
  if (start === -1) start = i;
17194
17194
  else if (!mustUnescape) mustUnescape = true;
17195
17195
  isEscaping = false;
17196
17196
  } else if (inQuotes) {
17197
- if (tokenChars[code] === 1) {
17197
+ if (tokenChars[code2] === 1) {
17198
17198
  if (start === -1) start = i;
17199
- } else if (code === 34 && start !== -1) {
17199
+ } else if (code2 === 34 && start !== -1) {
17200
17200
  inQuotes = false;
17201
17201
  end = i;
17202
- } else if (code === 92) {
17202
+ } else if (code2 === 92) {
17203
17203
  isEscaping = true;
17204
17204
  } else {
17205
17205
  throw new SyntaxError(`Unexpected character at index ${i}`);
17206
17206
  }
17207
- } else if (code === 34 && header.charCodeAt(i - 1) === 61) {
17207
+ } else if (code2 === 34 && header.charCodeAt(i - 1) === 61) {
17208
17208
  inQuotes = true;
17209
- } else if (end === -1 && tokenChars[code] === 1) {
17209
+ } else if (end === -1 && tokenChars[code2] === 1) {
17210
17210
  if (start === -1) start = i;
17211
- } else if (start !== -1 && (code === 32 || code === 9)) {
17211
+ } else if (start !== -1 && (code2 === 32 || code2 === 9)) {
17212
17212
  if (end === -1) end = i;
17213
- } else if (code === 59 || code === 44) {
17213
+ } else if (code2 === 59 || code2 === 44) {
17214
17214
  if (start === -1) {
17215
17215
  throw new SyntaxError(`Unexpected character at index ${i}`);
17216
17216
  }
@@ -17221,7 +17221,7 @@ var require_extension = __commonJS({
17221
17221
  mustUnescape = false;
17222
17222
  }
17223
17223
  push(params, paramName, value);
17224
- if (code === 44) {
17224
+ if (code2 === 44) {
17225
17225
  push(offers, extensionName, params);
17226
17226
  params = /* @__PURE__ */ Object.create(null);
17227
17227
  extensionName = void 0;
@@ -17233,7 +17233,7 @@ var require_extension = __commonJS({
17233
17233
  }
17234
17234
  }
17235
17235
  }
17236
- if (start === -1 || inQuotes || code === 32 || code === 9) {
17236
+ if (start === -1 || inQuotes || code2 === 32 || code2 === 9) {
17237
17237
  throw new SyntaxError("Unexpected end of input");
17238
17238
  }
17239
17239
  if (end === -1) end = i;
@@ -17524,7 +17524,7 @@ var require_websocket = __commonJS({
17524
17524
  * closing
17525
17525
  * @public
17526
17526
  */
17527
- close(code, data) {
17527
+ close(code2, data) {
17528
17528
  if (this.readyState === _WebSocket.CLOSED) return;
17529
17529
  if (this.readyState === _WebSocket.CONNECTING) {
17530
17530
  const msg = "WebSocket was closed before the connection was established";
@@ -17538,7 +17538,7 @@ var require_websocket = __commonJS({
17538
17538
  return;
17539
17539
  }
17540
17540
  this._readyState = _WebSocket.CLOSING;
17541
- this._sender.close(code, data, !this._isServer, (err) => {
17541
+ this._sender.close(code2, data, !this._isServer, (err) => {
17542
17542
  if (err) return;
17543
17543
  this._closeFrameSent = true;
17544
17544
  if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) {
@@ -18061,16 +18061,16 @@ var require_websocket = __commonJS({
18061
18061
  process.nextTick(cb, err);
18062
18062
  }
18063
18063
  }
18064
- function receiverOnConclude(code, reason) {
18064
+ function receiverOnConclude(code2, reason) {
18065
18065
  const websocket = this[kWebSocket];
18066
18066
  websocket._closeFrameReceived = true;
18067
18067
  websocket._closeMessage = reason;
18068
- websocket._closeCode = code;
18068
+ websocket._closeCode = code2;
18069
18069
  if (websocket._socket[kWebSocket] === void 0) return;
18070
18070
  websocket._socket.removeListener("data", socketOnData);
18071
18071
  process.nextTick(resume, websocket._socket);
18072
- if (code === 1005) websocket.close();
18073
- else websocket.close(code, reason);
18072
+ if (code2 === 1005) websocket.close();
18073
+ else websocket.close(code2, reason);
18074
18074
  }
18075
18075
  function receiverOnDrain() {
18076
18076
  const websocket = this[kWebSocket];
@@ -18276,12 +18276,12 @@ var require_subprotocol = __commonJS({
18276
18276
  let end = -1;
18277
18277
  let i = 0;
18278
18278
  for (i; i < header.length; i++) {
18279
- const code = header.charCodeAt(i);
18280
- if (end === -1 && tokenChars[code] === 1) {
18279
+ const code2 = header.charCodeAt(i);
18280
+ if (end === -1 && tokenChars[code2] === 1) {
18281
18281
  if (start === -1) start = i;
18282
- } else if (i !== 0 && (code === 32 || code === 9)) {
18282
+ } else if (i !== 0 && (code2 === 32 || code2 === 9)) {
18283
18283
  if (end === -1 && start !== -1) end = i;
18284
- } else if (code === 44) {
18284
+ } else if (code2 === 44) {
18285
18285
  if (start === -1) {
18286
18286
  throw new SyntaxError(`Unexpected character at index ${i}`);
18287
18287
  }
@@ -18583,9 +18583,9 @@ var require_websocket_server = __commonJS({
18583
18583
  req
18584
18584
  };
18585
18585
  if (this.options.verifyClient.length === 2) {
18586
- this.options.verifyClient(info, (verified, code, message, headers) => {
18586
+ this.options.verifyClient(info, (verified, code2, message, headers) => {
18587
18587
  if (!verified) {
18588
- return abortHandshake(socket, code || 401, message, headers);
18588
+ return abortHandshake(socket, code2 || 401, message, headers);
18589
18589
  }
18590
18590
  this.completeUpgrade(
18591
18591
  extensions,
@@ -18685,8 +18685,8 @@ var require_websocket_server = __commonJS({
18685
18685
  function socketOnError() {
18686
18686
  this.destroy();
18687
18687
  }
18688
- function abortHandshake(socket, code, message, headers) {
18689
- message = message || http.STATUS_CODES[code];
18688
+ function abortHandshake(socket, code2, message, headers) {
18689
+ message = message || http.STATUS_CODES[code2];
18690
18690
  headers = {
18691
18691
  Connection: "close",
18692
18692
  "Content-Type": "text/html",
@@ -18695,17 +18695,17 @@ var require_websocket_server = __commonJS({
18695
18695
  };
18696
18696
  socket.once("finish", socket.destroy);
18697
18697
  socket.end(
18698
- `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
18698
+ `HTTP/1.1 ${code2} ${http.STATUS_CODES[code2]}\r
18699
18699
  ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
18700
18700
  );
18701
18701
  }
18702
- function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
18702
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code2, message, headers) {
18703
18703
  if (server.listenerCount("wsClientError")) {
18704
18704
  const err = new Error(message);
18705
18705
  Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
18706
18706
  server.emit("wsClientError", err, socket, req);
18707
18707
  } else {
18708
- abortHandshake(socket, code, message, headers);
18708
+ abortHandshake(socket, code2, message, headers);
18709
18709
  }
18710
18710
  }
18711
18711
  }
@@ -18715,7 +18715,6 @@ var require_websocket_server = __commonJS({
18715
18715
  import { runAgent as runAgent2 } from "@corenel/harness/core/loop";
18716
18716
  import { createChatClient as createChatClient2, setGatewayBase as setGatewayBase2 } from "@corenel/harness/providers/gateway";
18717
18717
  import { resolveContextWindow as resolveContextWindow2 } from "@corenel/harness/providers/contextWindow";
18718
- import { join as join6 } from "node:path";
18719
18718
  import { allTools as allTools3 } from "@corenel/harness/tools/builtins";
18720
18719
  import { registerGuard as registerGuard2 } from "@corenel/harness/guards";
18721
18720
  import { setPromptHost } from "@corenel/harness/prompts/host";
@@ -18912,11 +18911,14 @@ import { promises as fs2 } from "node:fs";
18912
18911
  import { homedir } from "node:os";
18913
18912
  import { join as join2 } from "node:path";
18914
18913
  import { stateDirName } from "@corenel/protocol";
18915
- function corenelDir() {
18916
- return join2(homedir(), stateDirName());
18914
+ function corenelDir(base = homedir()) {
18915
+ return join2(base, stateDirName());
18916
+ }
18917
+ function sidecarDir(base = homedir()) {
18918
+ return join2(corenelDir(base), "sidecar");
18917
18919
  }
18918
- function authTokenPath() {
18919
- return join2(corenelDir(), "token");
18920
+ function authTokenPath(base = homedir()) {
18921
+ return join2(corenelDir(base), "token");
18920
18922
  }
18921
18923
  async function writeAuthToken(token) {
18922
18924
  await fs2.mkdir(corenelDir(), { recursive: true, mode: 448 });
@@ -20703,12 +20705,12 @@ var TemplateProcessingStage = class {
20703
20705
  */
20704
20706
  async loadPackageResource(context, packagePath, resourcePath, prefix) {
20705
20707
  try {
20706
- const fs3 = context.fileSystem;
20708
+ const fs4 = context.fileSystem;
20707
20709
  const possibleExtensions = ["", ".prmd", ".md", ".txt"];
20708
20710
  for (const ext of possibleExtensions) {
20709
20711
  const filePath = resolvePackageFile(packagePath, resourcePath + ext);
20710
- if (await fs3.exists(filePath)) {
20711
- const contentData = await fs3.readFile(filePath);
20712
+ if (await fs4.exists(filePath)) {
20713
+ const contentData = await fs4.readFile(filePath);
20712
20714
  if (isPrompdFile(filePath)) {
20713
20715
  const parser2 = new PrompdParser();
20714
20716
  try {
@@ -20742,16 +20744,16 @@ var TemplateProcessingStage = class {
20742
20744
  return content;
20743
20745
  }
20744
20746
  try {
20745
- const fs3 = context.fileSystem;
20747
+ const fs4 = context.fileSystem;
20746
20748
  const parser2 = new PrompdParser();
20747
20749
  let parentFile = null;
20748
- if (isPrompdFile(parentPath) && await fs3.exists(parentPath)) {
20750
+ if (isPrompdFile(parentPath) && await fs4.exists(parentPath)) {
20749
20751
  parentFile = parentPath;
20750
- } else if (await fs3.exists(parentPath) && await fs3.isDirectory(parentPath)) {
20751
- const files = (await fs3.readdir(parentPath)).filter((f) => isPrompdFile(f));
20752
+ } else if (await fs4.exists(parentPath) && await fs4.isDirectory(parentPath)) {
20753
+ const files = (await fs4.readdir(parentPath)).filter((f) => isPrompdFile(f));
20752
20754
  if (files.length > 0) {
20753
20755
  const mainFile = files.find((f) => f === "main.prmd" || f === "main.md");
20754
- parentFile = fs3.join(parentPath, mainFile || files[0]);
20756
+ parentFile = fs4.join(parentPath, mainFile || files[0]);
20755
20757
  }
20756
20758
  }
20757
20759
  if (!parentFile) {
@@ -20765,14 +20767,14 @@ var TemplateProcessingStage = class {
20765
20767
  });
20766
20768
  return content;
20767
20769
  }
20768
- const parentFileContent = await fs3.readFile(parentFile);
20770
+ const parentFileContent = await fs4.readFile(parentFile);
20769
20771
  const parentData = parser2.parseContent(parentFileContent);
20770
- await this.validateParentFileReferences(context, parentData.metadata, fs3, parentFile);
20772
+ await this.validateParentFileReferences(context, parentData.metadata, fs4, parentFile);
20771
20773
  if (context.hasErrors()) {
20772
20774
  return content;
20773
20775
  }
20774
20776
  if (parentData.content) {
20775
- const parentDir = fs3.dirname(parentFile);
20777
+ const parentDir = fs4.dirname(parentFile);
20776
20778
  parentData.content = this.resolveIncludePaths(parentData.content, parentDir);
20777
20779
  }
20778
20780
  const overrides = context.metadata?.override || {};
@@ -21323,10 +21325,10 @@ ${content}` : parentData.content;
21323
21325
  * Called during inheritance processing because AssetExtractionStage only runs on
21324
21326
  * the child file's metadata — the parent is only parsed, never fully compiled.
21325
21327
  */
21326
- async validateParentFileReferences(context, metadata, fs3, parentFile) {
21328
+ async validateParentFileReferences(context, metadata, fs4, parentFile) {
21327
21329
  if (!metadata) return;
21328
21330
  const metadataAsRecord = metadata;
21329
- const parentDir = fs3.dirname(parentFile);
21331
+ const parentDir = fs4.dirname(parentFile);
21330
21332
  const fileFields = ["system", "task", "user", "assistant", "response", "output", "context"];
21331
21333
  for (const field of fileFields) {
21332
21334
  const fieldValue = metadataAsRecord[field];
@@ -21334,8 +21336,8 @@ ${content}` : parentData.content;
21334
21336
  const refs = Array.isArray(fieldValue) ? fieldValue.filter((v) => typeof v === "string") : typeof fieldValue === "string" ? [fieldValue] : [];
21335
21337
  for (const ref of refs) {
21336
21338
  if (!ref.startsWith("./") && !ref.startsWith("../")) continue;
21337
- const resolvedPath = fs3.resolve(parentDir, ref);
21338
- const exists = await Promise.resolve(fs3.exists(resolvedPath));
21339
+ const resolvedPath = fs4.resolve(parentDir, ref);
21340
+ const exists = await Promise.resolve(fs4.exists(resolvedPath));
21339
21341
  if (!exists) {
21340
21342
  const location = context.findLocation(/inherits:/);
21341
21343
  context.addDiagnostic({
@@ -21922,15 +21924,20 @@ async function preload(svc) {
21922
21924
  }
21923
21925
  async function compile(src, values, fileSystem, mainPath) {
21924
21926
  const mp = mainPath || "/main.prmd";
21925
- const fs3 = fileSystem || new MemoryFileSystem({ [mp]: src });
21926
- const ctx = await compiler.compileWithContext(mp, { parameters: values || {}, fileSystem: fs3, outputFormat: "markdown" });
21927
+ const fs4 = fileSystem || new MemoryFileSystem({ [mp]: src });
21928
+ const ctx = await compiler.compileWithContext(mp, { parameters: values || {}, fileSystem: fs4, outputFormat: "markdown" });
21927
21929
  const compiled = ctx.compiledResult;
21928
21930
  const output = typeof compiled === "string" ? compiled : compiled ? new TextDecoder().decode(compiled) : "";
21929
21931
  return { output };
21930
21932
  }
21931
- function nodePromptHost(workspace) {
21933
+ function nodePromptHost(workspace, project) {
21932
21934
  return {
21933
21935
  workspace,
21936
+ /* The user's PROJECT files, when the caller has them, so skills installed
21937
+ * into `.prompd/skills/` are visible. Omitted rather than faked when there
21938
+ * is none: a CLI invoked outside a project genuinely has no installed
21939
+ * skills, and saying so beats inventing an empty directory. */
21940
+ ...project ? { projectWorkspace: () => project } : {},
21934
21941
  seed: async (defaults) => {
21935
21942
  for (const [p, content] of Object.entries(defaults)) {
21936
21943
  if (!await workspace.stat(p)) await workspace.write(p, content);
@@ -21949,8 +21956,98 @@ function nodePromptHost(workspace) {
21949
21956
  };
21950
21957
  }
21951
21958
 
21959
+ // ../tools-node/migrateHome.ts
21960
+ import { promises as fs3 } from "node:fs";
21961
+ import { homedir as homedir2 } from "node:os";
21962
+ import { join as join3, dirname as dirname2 } from "node:path";
21963
+ var SIDECAR_FILES = [
21964
+ "daemon.id",
21965
+ "daemon.token",
21966
+ "hosts.json",
21967
+ "sidecar.crt",
21968
+ "sidecar.key",
21969
+ "sidecar.sans.json"
21970
+ ];
21971
+ var SIDECAR_DIRS = ["hosts"];
21972
+ async function isDir(p) {
21973
+ return fs3.stat(p).then((s) => s.isDirectory()).catch(() => false);
21974
+ }
21975
+ async function present(p) {
21976
+ return fs3.stat(p).then(() => true).catch(() => false);
21977
+ }
21978
+ function code(e) {
21979
+ return e?.code;
21980
+ }
21981
+ async function moveEntry(from, to, report) {
21982
+ if (!await present(from)) return;
21983
+ if (await present(to)) {
21984
+ report.skipped.push({ path: to, reason: "destination already exists" });
21985
+ return;
21986
+ }
21987
+ await fs3.mkdir(dirname2(to), { recursive: true });
21988
+ try {
21989
+ await fs3.rename(from, to);
21990
+ report.moved.push(to);
21991
+ } catch (e) {
21992
+ const c = code(e);
21993
+ if (c === "EEXIST" || c === "ENOTEMPTY") {
21994
+ report.skipped.push({ path: to, reason: "moved concurrently" });
21995
+ return;
21996
+ }
21997
+ if (c === "ENOENT") {
21998
+ report.skipped.push({ path: to, reason: "moved concurrently" });
21999
+ return;
22000
+ }
22001
+ if (c === "EXDEV") {
22002
+ await fs3.cp(from, to, { recursive: true });
22003
+ await fs3.rm(from, { recursive: true, force: true });
22004
+ report.moved.push(to);
22005
+ return;
22006
+ }
22007
+ throw e;
22008
+ }
22009
+ }
22010
+ async function mergeDir(from, to, report) {
22011
+ const entries = await fs3.readdir(from, { withFileTypes: true }).catch(() => []);
22012
+ for (const e of entries) {
22013
+ const src = join3(from, e.name);
22014
+ const dst = join3(to, e.name);
22015
+ if (e.isDirectory() && await isDir(dst)) await mergeDir(src, dst, report);
22016
+ else await moveEntry(src, dst, report);
22017
+ }
22018
+ await fs3.rmdir(from).catch(() => {
22019
+ });
22020
+ }
22021
+ async function migrateHomeLayout(base = homedir2()) {
22022
+ const report = { moved: [], skipped: [] };
22023
+ const home = corenelDir(base);
22024
+ if (!await present(home)) return report;
22025
+ const config = join3(home, "config");
22026
+ if (await isDir(config)) await mergeDir(config, home, report);
22027
+ const side = sidecarDir(base);
22028
+ for (const name of SIDECAR_FILES) {
22029
+ await moveEntry(join3(home, name), join3(side, name), report);
22030
+ }
22031
+ for (const name of SIDECAR_DIRS) {
22032
+ const src = join3(home, name);
22033
+ if (!await isDir(src)) continue;
22034
+ const dst = join3(side, name);
22035
+ if (await isDir(dst)) await mergeDir(src, dst, report);
22036
+ else await moveEntry(src, dst, report);
22037
+ }
22038
+ if (report.moved.length) await fs3.chmod(home, 448).catch(() => {
22039
+ });
22040
+ return report;
22041
+ }
22042
+
22043
+ // src/configRoot.ts
22044
+ function configWorkspaceRoot(base) {
22045
+ return corenelDir(base);
22046
+ }
22047
+
21952
22048
  // src/cli.ts
21953
22049
  import { FileRecallStore, UNATTACHED_SESSION } from "@corenel/harness/sessions/fileRecallStore";
22050
+ import { stateDirName as stateDirName6 } from "@corenel/protocol";
21954
22051
  import { PermissionService as PermissionService3 } from "@corenel/harness/guardrail/permission-service";
21955
22052
 
21956
22053
  // src/nodeContext.ts
@@ -22047,10 +22144,10 @@ function tokenGuard(getToken) {
22047
22144
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
22048
22145
  var MIN_POLL_MS = 1e3;
22049
22146
  var DEFAULT_LIFETIME_S = 900;
22050
- function defaultOpen(uri, code) {
22147
+ function defaultOpen(uri, code2) {
22051
22148
  process.stdout.write(`
22052
22149
  To authorize, open: ${uri}
22053
- and enter the code: ${code}
22150
+ and enter the code: ${code2}
22054
22151
 
22055
22152
  Waiting for authorization\u2026
22056
22153
  `);
@@ -22293,6 +22390,14 @@ function parseCanCall(meta) {
22293
22390
  if (!Array.isArray(raw)) return [];
22294
22391
  return raw.filter((x) => typeof x === "string" && isValidAgentName(x));
22295
22392
  }
22393
+ function parseWorkRoots(raw) {
22394
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
22395
+ const out = {};
22396
+ for (const [id, dir] of Object.entries(raw)) {
22397
+ if (typeof dir === "string" && dir) out[id] = dir;
22398
+ }
22399
+ return Object.keys(out).length ? out : void 0;
22400
+ }
22296
22401
  function parseSettings(text) {
22297
22402
  try {
22298
22403
  const raw = JSON.parse(text);
@@ -22300,7 +22405,13 @@ function parseSettings(text) {
22300
22405
  const o = raw;
22301
22406
  return {
22302
22407
  model: typeof o.model === "string" ? o.model : void 0,
22303
- temperature: typeof o.temperature === "number" ? o.temperature : void 0
22408
+ temperature: typeof o.temperature === "number" ? o.temperature : void 0,
22409
+ /* Carried through as-is. Validation belongs to the daemon, which is the
22410
+ * only side that knows its own approved roots -- checking here would be
22411
+ * checking against the wrong list, on the wrong machine. Non-string
22412
+ * values are dropped per entry rather than failing the whole file: one
22413
+ * bad key must not cost an agent every other machine's setting. */
22414
+ workRoots: parseWorkRoots(o.workRoots)
22304
22415
  };
22305
22416
  }
22306
22417
  } catch {
@@ -22467,7 +22578,7 @@ ${extra}` : base;
22467
22578
  import { spawn } from "node:child_process";
22468
22579
  import { createRequire } from "node:module";
22469
22580
  import { existsSync, readFileSync } from "node:fs";
22470
- import { dirname as dirname2, join as join3 } from "node:path";
22581
+ import { dirname as dirname3, join as join4 } from "node:path";
22471
22582
  import { fileURLToPath } from "node:url";
22472
22583
 
22473
22584
  // src/extensions.ts
@@ -22535,12 +22646,12 @@ function findExtensionEntry(pkg, entry, look = {}) {
22535
22646
  if (exists(direct)) return direct;
22536
22647
  } catch {
22537
22648
  }
22538
- let dir = look.fromDir ?? dirname2(fileURLToPath(import.meta.url));
22649
+ let dir = look.fromDir ?? dirname3(fileURLToPath(import.meta.url));
22539
22650
  const parts = [...pkg.split("/"), ...entry.split("/")];
22540
22651
  for (let up = 0; up < 8; up++) {
22541
- const candidate = join3(dir, "node_modules", ...parts);
22652
+ const candidate = join4(dir, "node_modules", ...parts);
22542
22653
  if (exists(candidate)) return candidate;
22543
- const parent = dirname2(dir);
22654
+ const parent = dirname3(dir);
22544
22655
  if (parent === dir) break;
22545
22656
  dir = parent;
22546
22657
  }
@@ -22548,7 +22659,7 @@ function findExtensionEntry(pkg, entry, look = {}) {
22548
22659
  }
22549
22660
  function versionAt(entry, read = readFileSyncUtf8) {
22550
22661
  try {
22551
- const parsed = JSON.parse(read(join3(dirname2(dirname2(entry)), "package.json")));
22662
+ const parsed = JSON.parse(read(join4(dirname3(dirname3(entry)), "package.json")));
22552
22663
  const v = parsed.version;
22553
22664
  return typeof v === "string" ? v : "?";
22554
22665
  } catch {
@@ -22592,8 +22703,8 @@ async function runExtension(ext, rest, look = {}) {
22592
22703
  try {
22593
22704
  return await new Promise((resolve2, reject) => {
22594
22705
  child.on("error", reject);
22595
- child.on("exit", (code, signal) => {
22596
- resolve2(code ?? (signal === "SIGINT" ? 130 : signal ? 143 : 1));
22706
+ child.on("exit", (code2, signal) => {
22707
+ resolve2(code2 ?? (signal === "SIGINT" ? 130 : signal ? 143 : 1));
22597
22708
  });
22598
22709
  });
22599
22710
  } finally {
@@ -22674,7 +22785,7 @@ function helpText(version2) {
22674
22785
  // src/version.ts
22675
22786
  import { createRequire as createRequire2 } from "node:module";
22676
22787
  import { readFileSync as readFileSync2 } from "node:fs";
22677
- import { dirname as dirname3, join as join4 } from "node:path";
22788
+ import { dirname as dirname4, join as join5 } from "node:path";
22678
22789
  import { fileURLToPath as fileURLToPath2 } from "node:url";
22679
22790
  function selfPath() {
22680
22791
  try {
@@ -22684,15 +22795,15 @@ function selfPath() {
22684
22795
  }
22685
22796
  }
22686
22797
  function version(read = (p) => readFileSync2(p, "utf8")) {
22687
- let dir = dirname3(selfPath());
22798
+ let dir = dirname4(selfPath());
22688
22799
  for (let up = 0; up < 4; up++) {
22689
22800
  try {
22690
- const parsed = JSON.parse(read(join4(dir, "package.json")));
22801
+ const parsed = JSON.parse(read(join5(dir, "package.json")));
22691
22802
  const v = parsed;
22692
22803
  if (v.name === "@corenel/cli" && typeof v.version === "string") return v.version;
22693
22804
  } catch {
22694
22805
  }
22695
- const parent = dirname3(dir);
22806
+ const parent = dirname4(dir);
22696
22807
  if (parent === dir) break;
22697
22808
  dir = parent;
22698
22809
  }
@@ -23139,16 +23250,16 @@ function execute(command, opts) {
23139
23250
  killTree(child);
23140
23251
  };
23141
23252
  opts.signal?.addEventListener("abort", onAbort, { once: true });
23142
- const finish = (code) => {
23253
+ const finish = (code2) => {
23143
23254
  clearTimeout(timer);
23144
23255
  opts.signal?.removeEventListener("abort", onAbort);
23145
- resolve2({ code, stdout, stderr, timedOut });
23256
+ resolve2({ code: code2, stdout, stderr, timedOut });
23146
23257
  };
23147
23258
  child.on("error", (e) => {
23148
23259
  stderr += String(e);
23149
23260
  finish(null);
23150
23261
  });
23151
- child.on("close", (code) => finish(code));
23262
+ child.on("close", (code2) => finish(code2));
23152
23263
  });
23153
23264
  }
23154
23265
  function shellTool(cwd) {
@@ -23620,8 +23731,8 @@ async function resolveStrategyPrompt(files, id) {
23620
23731
 
23621
23732
  // src/policyResolve.ts
23622
23733
  import { readFile } from "node:fs/promises";
23623
- import { homedir as homedir2 } from "node:os";
23624
- import { join as join5 } from "node:path";
23734
+ import { homedir as homedir3 } from "node:os";
23735
+ import { join as join6 } from "node:path";
23625
23736
  import { stateDirName as stateDirName5 } from "@corenel/protocol";
23626
23737
  import { BUILTIN_POLICIES, STANDARD_POLICY as STANDARD_POLICY3, policyFromYaml } from "@corenel/harness/guardrail";
23627
23738
  var PolicyResolutionError = class extends Error {
@@ -23681,10 +23792,10 @@ async function resolvePolicy(opts) {
23681
23792
  );
23682
23793
  return { policy, source: { kind: "file", path: flag2 } };
23683
23794
  }
23684
- const projectPath = join5(cwd, stateDirName5(), "policy.yaml");
23795
+ const projectPath = join6(cwd, stateDirName5(), "policy.yaml");
23685
23796
  const project = await loadDiscoveredPolicyFile(projectPath);
23686
23797
  if (project) return { policy: project, source: { kind: "project", path: projectPath } };
23687
- const userPath = join5(homedir2(), stateDirName5(), "policy.yaml");
23798
+ const userPath = join6(homedir3(), stateDirName5(), "policy.yaml");
23688
23799
  const user = await loadDiscoveredPolicyFile(userPath);
23689
23800
  if (user) return { policy: user, source: { kind: "user", path: userPath } };
23690
23801
  return { policy: STANDARD_POLICY3, source: { kind: "default" } };
@@ -23703,7 +23814,16 @@ async function agentSetup(argv) {
23703
23814
  const tools = [...allTools3(), shellTool(process.cwd())];
23704
23815
  const sidecarProcs = await connectSidecarProcs();
23705
23816
  if (sidecarProcs) tools.push(...procTools(sidecarProcs.procs, { session: "corenel-cli" }));
23706
- setPromptHost(nodePromptHost(new NodeFileService(join6(corenelDir(), "config"))));
23817
+ try {
23818
+ const migrated = await migrateHomeLayout();
23819
+ if (migrated.moved.length) {
23820
+ console.error(`layout: moved ${migrated.moved.length} item(s) into the current ~/${stateDirName6()} layout`);
23821
+ }
23822
+ for (const left of migrated.skipped) console.error(`layout: left ${left.path} alone (${left.reason})`);
23823
+ } catch (e) {
23824
+ console.error(`layout: migration skipped (${e instanceof Error ? e.message : String(e)})`);
23825
+ }
23826
+ setPromptHost(nodePromptHost(new NodeFileService(configWorkspaceRoot()), new NodeFileService(process.cwd())));
23707
23827
  const identity = createIdentityState();
23708
23828
  let system = "You are corenel, a concise CLI assistant.";
23709
23829
  try {
@@ -23942,7 +24062,7 @@ async function main() {
23942
24062
  process.exit(2);
23943
24063
  }
23944
24064
  const policyOverride = hasValueFlag(rest, "policy") ? (await resolvePolicy({ flag: flag(rest, "policy", ""), cwd: process.cwd() })).policy : void 0;
23945
- const code = await runCrewAgentCli({
24065
+ const code2 = await runCrewAgentCli({
23946
24066
  cwd: process.cwd(),
23947
24067
  agent,
23948
24068
  input: flag(rest, "input", ""),
@@ -23958,7 +24078,7 @@ async function main() {
23958
24078
  warn: (line) => process.stderr.write(`corenel: ${line}
23959
24079
  `)
23960
24080
  });
23961
- process.exitCode = code;
24081
+ process.exitCode = code2;
23962
24082
  break;
23963
24083
  }
23964
24084
  case "sidecar":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corenel/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Corenel CLI — runs the harness in node, in-proc, no transport. The headless proof the kernel is host-agnostic. (corenel run/ask/chat/login + start --sidecar to follow.)",
6
6
  "bin": {
@@ -9,9 +9,9 @@
9
9
  "dependencies": {
10
10
  "openai": "^4.77.0",
11
11
  "ws": "^8.18.0",
12
- "@corenel/protocol": "0.4.0",
13
- "@corenel/harness": "0.4.0",
14
- "@corenel/term": "0.2.0"
12
+ "@corenel/harness": "0.4.1",
13
+ "@corenel/protocol": "0.4.1",
14
+ "@corenel/term": "0.2.1"
15
15
  },
16
16
  "devDependencies": {
17
17
  "esbuild": "^0.21.5",
@@ -20,7 +20,7 @@
20
20
  "tsx": "^4.19.2",
21
21
  "typescript": "^5.9.3",
22
22
  "@corenel/crew": "0.0.0",
23
- "@corenel/tools-node": "0.2.1"
23
+ "@corenel/tools-node": "0.2.2"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public"