@techninja/clearstack 0.4.25 → 0.4.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/check.js CHANGED
@@ -12,7 +12,7 @@ import { checkI18n } from './spec-i18n.js';
12
12
  import { loadConfig, buildCmds, detectRunner } from './spec-config.js';
13
13
  import { findTypeConfigs } from './spec-types.js';
14
14
 
15
- export { runCmd, elapsed } from './spec-utils.js';
15
+ export { runCmd, runExtCmd, elapsed } from './spec-utils.js';
16
16
  export { findFiles, countFiles, checkFileLines, checkImports } from './spec-scan.js';
17
17
  export { checkI18n } from './spec-i18n.js';
18
18
  export { loadConfig, buildCmds, detectRunner } from './spec-config.js';
@@ -69,9 +69,9 @@ export async function buildChecks(dir, cfg, cmds) {
69
69
  export function resolveChecks(checks, scope) {
70
70
  const [first, second] = scope.split(/\s+/);
71
71
  if (second) { const match = checks.find((c) => c.parent === first && c.key === second); return match ? [match] : null; }
72
- const children = checks.filter((c) => c.parent === first);
72
+ const children = checks.filter((c) => c.parent === first || c.aliases?.includes(first));
73
73
  if (children.length) return children;
74
- const exact = checks.find((c) => c.key === first && !c.parent);
74
+ const exact = checks.find((c) => (c.key === first || c.aliases?.includes(first)) && !c.parent);
75
75
  return exact ? [exact] : null;
76
76
  }
77
77
 
package/lib/spec-utils.js CHANGED
@@ -49,3 +49,43 @@ export function runCmd(label, cmd, cwd, stats, opts) {
49
49
  return { pass: false, label, time: elapsed(start), errors: display };
50
50
  }
51
51
  }
52
+
53
+ /**
54
+ * Run an arbitrary shell command for a custom extension check.
55
+ * Handles timing, output filtering, and consistent ✅/❌ printing.
56
+ * Ignores lines matching node_modules or any paths in `ignorePaths`.
57
+ * Use this in clearstack.spec.js extensions instead of execSync directly.
58
+ *
59
+ * @param {string} label - Display name for the check
60
+ * @param {string} cmd - Shell command to run
61
+ * @param {{ quiet?: boolean, cwd?: string, ignorePaths?: string[] }} [opts]
62
+ * @returns {CheckResult}
63
+ */
64
+ export function runExtCmd(label, cmd, opts = {}) {
65
+ const start = performance.now();
66
+ const cwd = opts.cwd ?? process.cwd();
67
+ const suffix = () => ` (${elapsed(start)})`;
68
+ const ignoreRe = [
69
+ /[/\\]node_modules[/\\]/,
70
+ ...(opts.ignorePaths ?? []).map((p) => new RegExp(p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))),
71
+ ];
72
+ try {
73
+ execSync(cmd, { cwd, stdio: 'pipe', encoding: 'utf-8' });
74
+ if (!opts.quiet) console.log(` ✅ ${label}${suffix()}`);
75
+ return { pass: true, label, time: elapsed(start) };
76
+ } catch (err) {
77
+ const out = ((err.stdout || '') + (err.stderr || '')).trim();
78
+ const errors = out.split('\n')
79
+ .filter((l) => l.trim())
80
+ .filter((l) => !ignoreRe.some((re) => re.test(l)));
81
+ if (errors.length === 0) {
82
+ if (!opts.quiet) console.log(` ✅ ${label}${suffix()}`);
83
+ return { pass: true, label, time: elapsed(start) };
84
+ }
85
+ if (!opts.quiet) {
86
+ console.log(` ❌ ${label}${suffix()}`);
87
+ for (const line of errors) console.log(` ${line}`);
88
+ }
89
+ return { pass: false, label, time: elapsed(start), errors };
90
+ }
91
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techninja/clearstack",
3
- "version": "0.4.25",
3
+ "version": "0.4.27",
4
4
  "type": "module",
5
5
  "description": "A no-build web component framework specification — scaffold, validate, and evolve spec-compliant projects",
6
6
  "bin": {