@cmodjs/core 0.1.8 → 0.1.10

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 (86) hide show
  1. package/docs/commands.md +2 -2
  2. package/docs/hooks.md +62 -6
  3. package/docs/index.md +7 -4
  4. package/docs/install-steps.md +3 -3
  5. package/docs/jobs.md +5 -4
  6. package/docs/mod.md +57 -7
  7. package/docs/testing.md +25 -9
  8. package/docs/ui.md +134 -5
  9. package/jobs/check.js +2 -2
  10. package/jobs/context.d.ts.map +1 -1
  11. package/jobs/context.js +2 -0
  12. package/jobs/permissions/decide-permission.js +2 -2
  13. package/jobs/permissions/find-project-scope.d.ts +1 -1
  14. package/jobs/permissions/find-project-scope.d.ts.map +1 -1
  15. package/jobs/permissions/find-project-scope.js +9 -9
  16. package/jobs/permissions/match-target.d.ts.map +1 -1
  17. package/jobs/permissions/match-target.js +4 -3
  18. package/mod.d.ts +16 -6
  19. package/mod.d.ts.map +1 -1
  20. package/package.json +2 -1
  21. package/path.d.ts +2 -0
  22. package/path.d.ts.map +1 -0
  23. package/path.js +1 -0
  24. package/register.d.ts.map +1 -1
  25. package/register.js +8 -2
  26. package/runtime/claude.d.ts +4 -1
  27. package/runtime/claude.d.ts.map +1 -1
  28. package/runtime/hooks.d.ts +10 -2
  29. package/runtime/hooks.d.ts.map +1 -1
  30. package/runtime/hooks.js +56 -18
  31. package/runtime/lifecycle.d.ts.map +1 -1
  32. package/runtime/lifecycle.js +12 -2
  33. package/runtime/ui.d.ts.map +1 -1
  34. package/runtime/ui.js +42 -26
  35. package/shell.d.ts +2 -0
  36. package/shell.d.ts.map +1 -0
  37. package/shell.js +1 -0
  38. package/src/jobs/check.ts +2 -2
  39. package/src/jobs/context.ts +2 -0
  40. package/src/jobs/permissions/decide-permission.ts +2 -2
  41. package/src/jobs/permissions/find-project-scope.ts +11 -10
  42. package/src/jobs/permissions/match-target.ts +4 -3
  43. package/src/mod.ts +24 -4
  44. package/src/path.ts +1 -0
  45. package/src/register.ts +8 -2
  46. package/src/runtime/claude.ts +11 -1
  47. package/src/runtime/hooks.ts +62 -23
  48. package/src/runtime/lifecycle.ts +11 -4
  49. package/src/runtime/ui.ts +39 -26
  50. package/src/shell.ts +1 -0
  51. package/src/testing/fake-claude.ts +14 -5
  52. package/src/testing/fake-elements.ts +5 -7
  53. package/src/testing/fake-files.ts +5 -5
  54. package/src/testing.ts +83 -11
  55. package/src/ui/components.ts +70 -0
  56. package/src/ui/define-pane.ts +5 -1
  57. package/src/utils/call-effects.ts +12 -11
  58. package/src/utils/parse-shell.ts +28 -36
  59. package/src/utils/paths.ts +4 -19
  60. package/src/vendor.ts +1 -0
  61. package/testing/fake-claude.d.ts +5 -0
  62. package/testing/fake-claude.d.ts.map +1 -1
  63. package/testing/fake-claude.js +13 -3
  64. package/testing/fake-elements.d.ts +5 -8
  65. package/testing/fake-elements.d.ts.map +1 -1
  66. package/testing/fake-elements.js +6 -6
  67. package/testing/fake-files.js +5 -5
  68. package/testing.d.ts +4 -2
  69. package/testing.d.ts.map +1 -1
  70. package/testing.js +65 -9
  71. package/ui/components.d.ts +48 -0
  72. package/ui/components.d.ts.map +1 -0
  73. package/ui/components.js +56 -0
  74. package/ui/define-pane.d.ts +5 -1
  75. package/ui/define-pane.d.ts.map +1 -1
  76. package/utils/call-effects.d.ts.map +1 -1
  77. package/utils/call-effects.js +12 -11
  78. package/utils/parse-shell.d.ts +5 -9
  79. package/utils/parse-shell.d.ts.map +1 -1
  80. package/utils/parse-shell.js +5 -10
  81. package/utils/paths.d.ts +0 -3
  82. package/utils/paths.d.ts.map +1 -1
  83. package/utils/paths.js +3 -18
  84. package/vendor.d.ts +1 -0
  85. package/vendor.d.ts.map +1 -1
  86. package/vendor.js +209 -12
package/vendor.js CHANGED
@@ -796,7 +796,7 @@ var require_parse = __commonJS((exports, module) => {
796
796
  }
797
797
  return { risky: false };
798
798
  };
799
- var parse = (input, options) => {
799
+ var parse2 = (input, options) => {
800
800
  if (typeof input !== "string") {
801
801
  throw new TypeError("Expected a string");
802
802
  }
@@ -967,7 +967,7 @@ var require_parse = __commonJS((exports, module) => {
967
967
  output = token.close = `)$))${extglobStar}`;
968
968
  }
969
969
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
970
- const expression = parse(rest, { ...options, fastpaths: false }).output;
970
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
971
971
  output = token.close = `)${expression})${extglobStar})`;
972
972
  }
973
973
  if (token.prev.type === "bos") {
@@ -1494,7 +1494,7 @@ var require_parse = __commonJS((exports, module) => {
1494
1494
  }
1495
1495
  return state;
1496
1496
  };
1497
- parse.fastpaths = (input, options) => {
1497
+ parse2.fastpaths = (input, options) => {
1498
1498
  const opts = { ...options };
1499
1499
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1500
1500
  const len = input.length;
@@ -1562,13 +1562,13 @@ var require_parse = __commonJS((exports, module) => {
1562
1562
  }
1563
1563
  return source;
1564
1564
  };
1565
- module.exports = parse;
1565
+ module.exports = parse2;
1566
1566
  });
1567
1567
 
1568
1568
  // node_modules/picomatch/lib/picomatch.js
1569
1569
  var require_picomatch = __commonJS((exports, module) => {
1570
1570
  var scan = require_scan();
1571
- var parse = require_parse();
1571
+ var parse2 = require_parse();
1572
1572
  var utils = require_utils();
1573
1573
  var constants = require_constants();
1574
1574
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -1634,11 +1634,11 @@ var require_picomatch = __commonJS((exports, module) => {
1634
1634
  return { isMatch: false, output: "" };
1635
1635
  }
1636
1636
  const opts = options || {};
1637
- const format2 = opts.format || (posix ? utils.toPosixSlashes : null);
1637
+ const format3 = opts.format || (posix ? utils.toPosixSlashes : null);
1638
1638
  let match = input === glob;
1639
- let output = match && format2 ? format2(input) : input;
1639
+ let output = match && format3 ? format3(input) : input;
1640
1640
  if (match === false) {
1641
- output = format2 ? format2(input) : input;
1641
+ output = format3 ? format3(input) : input;
1642
1642
  match = output === glob;
1643
1643
  }
1644
1644
  if (match === false || opts.capture === true) {
@@ -1658,7 +1658,7 @@ var require_picomatch = __commonJS((exports, module) => {
1658
1658
  picomatch.parse = (pattern, options) => {
1659
1659
  if (Array.isArray(pattern))
1660
1660
  return pattern.map((p) => picomatch.parse(p, options));
1661
- return parse(pattern, { ...options, fastpaths: false });
1661
+ return parse2(pattern, { ...options, fastpaths: false });
1662
1662
  };
1663
1663
  picomatch.scan = (input, options) => scan(input, options);
1664
1664
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -1684,10 +1684,10 @@ var require_picomatch = __commonJS((exports, module) => {
1684
1684
  }
1685
1685
  let parsed = { negated: false, fastpaths: true };
1686
1686
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
1687
- parsed.output = parse.fastpaths(input, options);
1687
+ parsed.output = parse2.fastpaths(input, options);
1688
1688
  }
1689
1689
  if (!parsed.output) {
1690
- parsed = parse(input, options);
1690
+ parsed = parse2(input, options);
1691
1691
  }
1692
1692
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
1693
1693
  };
@@ -3155,7 +3155,196 @@ class Validator {
3155
3155
  dereference(schema, this.lookup);
3156
3156
  }
3157
3157
  }
3158
-
3158
+ // node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
3159
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
3160
+ function normalizeWindowsPath(input = "") {
3161
+ if (!input) {
3162
+ return input;
3163
+ }
3164
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
3165
+ }
3166
+ var _UNC_REGEX = /^[/\\]{2}/;
3167
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
3168
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
3169
+ var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
3170
+ var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
3171
+ var normalize = function(path) {
3172
+ if (path.length === 0) {
3173
+ return ".";
3174
+ }
3175
+ path = normalizeWindowsPath(path);
3176
+ const isUNCPath = path.match(_UNC_REGEX);
3177
+ const isPathAbsolute = isAbsolute(path);
3178
+ const trailingSeparator = path[path.length - 1] === "/";
3179
+ path = normalizeString(path, !isPathAbsolute);
3180
+ if (path.length === 0) {
3181
+ if (isPathAbsolute) {
3182
+ return "/";
3183
+ }
3184
+ return trailingSeparator ? "./" : ".";
3185
+ }
3186
+ if (trailingSeparator) {
3187
+ path += "/";
3188
+ }
3189
+ if (_DRIVE_LETTER_RE.test(path)) {
3190
+ path += "/";
3191
+ }
3192
+ if (isUNCPath) {
3193
+ if (!isPathAbsolute) {
3194
+ return `//./${path}`;
3195
+ }
3196
+ return `//${path}`;
3197
+ }
3198
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
3199
+ };
3200
+ var join = function(...segments) {
3201
+ let path = "";
3202
+ for (const seg of segments) {
3203
+ if (!seg) {
3204
+ continue;
3205
+ }
3206
+ if (path.length > 0) {
3207
+ const pathTrailing = path[path.length - 1] === "/";
3208
+ const segLeading = seg[0] === "/";
3209
+ const both = pathTrailing && segLeading;
3210
+ if (both) {
3211
+ path += seg.slice(1);
3212
+ } else {
3213
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
3214
+ }
3215
+ } else {
3216
+ path += seg;
3217
+ }
3218
+ }
3219
+ return normalize(path);
3220
+ };
3221
+ function cwd() {
3222
+ if (false) {}
3223
+ return "/";
3224
+ }
3225
+ var resolve = function(...arguments_) {
3226
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
3227
+ let resolvedPath = "";
3228
+ let resolvedAbsolute = false;
3229
+ for (let index = arguments_.length - 1;index >= -1 && !resolvedAbsolute; index--) {
3230
+ const path = index >= 0 ? arguments_[index] : cwd();
3231
+ if (!path || path.length === 0) {
3232
+ continue;
3233
+ }
3234
+ resolvedPath = `${path}/${resolvedPath}`;
3235
+ resolvedAbsolute = isAbsolute(path);
3236
+ }
3237
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
3238
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
3239
+ return `/${resolvedPath}`;
3240
+ }
3241
+ return resolvedPath.length > 0 ? resolvedPath : ".";
3242
+ };
3243
+ function normalizeString(path, allowAboveRoot) {
3244
+ let res = "";
3245
+ let lastSegmentLength = 0;
3246
+ let lastSlash = -1;
3247
+ let dots = 0;
3248
+ let char = null;
3249
+ for (let index = 0;index <= path.length; ++index) {
3250
+ if (index < path.length) {
3251
+ char = path[index];
3252
+ } else if (char === "/") {
3253
+ break;
3254
+ } else {
3255
+ char = "/";
3256
+ }
3257
+ if (char === "/") {
3258
+ if (lastSlash === index - 1 || dots === 1)
3259
+ ;
3260
+ else if (dots === 2) {
3261
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
3262
+ if (res.length > 2) {
3263
+ const lastSlashIndex = res.lastIndexOf("/");
3264
+ if (lastSlashIndex === -1) {
3265
+ res = "";
3266
+ lastSegmentLength = 0;
3267
+ } else {
3268
+ res = res.slice(0, lastSlashIndex);
3269
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
3270
+ }
3271
+ lastSlash = index;
3272
+ dots = 0;
3273
+ continue;
3274
+ } else if (res.length > 0) {
3275
+ res = "";
3276
+ lastSegmentLength = 0;
3277
+ lastSlash = index;
3278
+ dots = 0;
3279
+ continue;
3280
+ }
3281
+ }
3282
+ if (allowAboveRoot) {
3283
+ res += res.length > 0 ? "/.." : "..";
3284
+ lastSegmentLength = 2;
3285
+ }
3286
+ } else {
3287
+ if (res.length > 0) {
3288
+ res += `/${path.slice(lastSlash + 1, index)}`;
3289
+ } else {
3290
+ res = path.slice(lastSlash + 1, index);
3291
+ }
3292
+ lastSegmentLength = index - lastSlash - 1;
3293
+ }
3294
+ lastSlash = index;
3295
+ dots = 0;
3296
+ } else if (char === "." && dots !== -1) {
3297
+ ++dots;
3298
+ } else {
3299
+ dots = -1;
3300
+ }
3301
+ }
3302
+ return res;
3303
+ }
3304
+ var isAbsolute = function(p) {
3305
+ return _IS_ABSOLUTE_RE.test(p);
3306
+ };
3307
+ var extname = function(p) {
3308
+ if (p === "..")
3309
+ return "";
3310
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
3311
+ return match && match[1] || "";
3312
+ };
3313
+ var relative = function(from, to) {
3314
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
3315
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
3316
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
3317
+ return _to.join("/");
3318
+ }
3319
+ const _fromCopy = [..._from];
3320
+ for (const segment of _fromCopy) {
3321
+ if (_to[0] !== segment) {
3322
+ break;
3323
+ }
3324
+ _from.shift();
3325
+ _to.shift();
3326
+ }
3327
+ return [..._from.map(() => ".."), ..._to].join("/");
3328
+ };
3329
+ var dirname = function(p) {
3330
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
3331
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
3332
+ segments[0] += "/";
3333
+ }
3334
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
3335
+ };
3336
+ var basename = function(p, extension) {
3337
+ const segments = normalizeWindowsPath(p).split("/");
3338
+ let lastSegment = "";
3339
+ for (let i = segments.length - 1;i >= 0; i--) {
3340
+ const val = segments[i];
3341
+ if (val) {
3342
+ lastSegment = val;
3343
+ break;
3344
+ }
3345
+ }
3346
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
3347
+ };
3159
3348
  // src/vendor.ts
3160
3349
  var import_posix = __toESM(require_picomatch(), 1);
3161
3350
 
@@ -3165,8 +3354,16 @@ var $parse = require_parse2();
3165
3354
  var export_picomatch = import_posix.default;
3166
3355
 
3167
3356
  export {
3357
+ resolve,
3358
+ relative,
3168
3359
  $quote as quote,
3169
3360
  export_picomatch as picomatch,
3170
3361
  $parse as parse,
3362
+ normalize,
3363
+ join,
3364
+ isAbsolute,
3365
+ extname,
3366
+ dirname,
3367
+ basename,
3171
3368
  Validator
3172
3369
  };