@draig/lexis-two 1.2.0 → 1.2.2

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.
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ // lexis: thin bin shim — npm links this file; keeps install.js testable as a module
3
+ const { spawnSync } = require('child_process');
4
+ const path = require('path');
5
+
6
+ const installScript = path.join(__dirname, '..', 'scripts', 'install.js');
7
+ const result = spawnSync(process.execPath, [installScript, ...process.argv.slice(2)], {
8
+ stdio: 'inherit',
9
+ });
10
+
11
+ if (result.error) {
12
+ console.error(`lexis-two failed: ${result.error.message}`);
13
+ process.exit(1);
14
+ }
15
+
16
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@draig/lexis-two",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "The simple way to obtain the best code. Portable rules, skills, and slash commands for AI agents with lowest tokens usage.",
5
5
  "bin": {
6
- "lexis-two": "scripts/install.js"
6
+ "lexis-two": "bin/lexis-two.js"
7
7
  },
8
8
  "main": "./.opencode/plugins/lexis-two.mjs",
9
9
  "exports": {
@@ -30,6 +30,7 @@
30
30
  "skills/",
31
31
  "templates/",
32
32
  "scripts/",
33
+ "bin/",
33
34
  "pi-extension/index.js"
34
35
  ],
35
36
  "keywords": [
@@ -39,8 +40,12 @@
39
40
  "lexis-two"
40
41
  ],
41
42
  "license": "MIT",
43
+ "devDependencies": {
44
+ "@draig/lexis-two": "file:."
45
+ },
42
46
  "scripts": {
43
47
  "postinstall": "node scripts/opencode-wrapper-postinstall.mjs",
48
+ "lexis-two": "node scripts/install.js",
44
49
  "test": "node --test tests/*.test.js && npm test --prefix pi-extension",
45
50
  "benchmark:opencode-go": "node benchmarks/benchmark-opencode-go.js --repeat 3 --write-md",
46
51
  "benchmark:report": "node benchmarks/render-opencode-go-report.js",
@@ -288,6 +288,70 @@ function listOpencodeCommandFiles() {
288
288
  }));
289
289
  }
290
290
 
291
+ function listPortableSkillDirs() {
292
+ const dir = path.join(PACKAGE_ROOT, 'skills');
293
+ return fs
294
+ .readdirSync(dir, { withFileTypes: true })
295
+ .filter((entry) => entry.isDirectory())
296
+ .map((entry) => entry.name)
297
+ .filter((name) => fs.existsSync(path.join(dir, name, 'SKILL.md')))
298
+ .map((name) => ({
299
+ name,
300
+ src: path.join(dir, name, 'SKILL.md'),
301
+ }));
302
+ }
303
+
304
+ function cursorSkillDest(ctx, installScope, skillName) {
305
+ const base = installScope === 'project' ? ctx.projectDir : ctx.home;
306
+ return path.join(base, '.cursor', 'skills', skillName, 'SKILL.md');
307
+ }
308
+
309
+ function planCursorSkillCopies(options, ctx) {
310
+ const host = RULE_HOSTS.cursor;
311
+ const scopes = resolveScopes(options.scope, host);
312
+ /** @type {InstallAction[]} */
313
+ const actions = [];
314
+
315
+ for (const installScope of scopes) {
316
+ for (const skill of listPortableSkillDirs()) {
317
+ actions.push(
318
+ planFileCopy(
319
+ 'cursor',
320
+ installScope,
321
+ skill.src,
322
+ cursorSkillDest(ctx, installScope, skill.name),
323
+ options,
324
+ false,
325
+ ),
326
+ );
327
+ }
328
+ }
329
+
330
+ return actions;
331
+ }
332
+
333
+ function planCursorSkillRemoves(ctx, options) {
334
+ const host = RULE_HOSTS.cursor;
335
+ const scopes = resolveScopes(options.scope, host);
336
+ /** @type {InstallAction[]} */
337
+ const actions = [];
338
+
339
+ for (const installScope of scopes) {
340
+ for (const skill of listPortableSkillDirs()) {
341
+ actions.push(
342
+ planFileRemove(
343
+ 'cursor',
344
+ installScope,
345
+ cursorSkillDest(ctx, installScope, skill.name),
346
+ skill.src,
347
+ ),
348
+ );
349
+ }
350
+ }
351
+
352
+ return actions;
353
+ }
354
+
291
355
  function readJsonConfig(configPath) {
292
356
  if (!fs.existsSync(configPath)) {
293
357
  return {};
@@ -749,6 +813,10 @@ function buildUninstallPlan(hostIds, options, ctx) {
749
813
 
750
814
  actions.push(planFileRemove(host.id, installScope, targetPath, packageSrc));
751
815
  }
816
+
817
+ if (hostId === 'cursor') {
818
+ actions.push(...planCursorSkillRemoves(ctx, options));
819
+ }
752
820
  }
753
821
 
754
822
  return actions;
@@ -777,6 +845,10 @@ function buildPlan(hostIds, options, ctx) {
777
845
 
778
846
  actions.push(planCopyAction(host, installScope, destPath, options));
779
847
  }
848
+
849
+ if (hostId === 'cursor') {
850
+ actions.push(...planCursorSkillCopies(options, ctx));
851
+ }
780
852
  }
781
853
 
782
854
  return actions;
@@ -941,7 +1013,9 @@ function printNextSteps(hostIds) {
941
1013
  const lines = ['Done. Next steps:'];
942
1014
 
943
1015
  if (hostIds.includes('cursor')) {
944
- lines.push(' • Cursor: open your project — lexis-two.mdc should be active.');
1016
+ lines.push(
1017
+ ' • Cursor: open your project — lexis-two.mdc + skills under .cursor/skills/ should load.',
1018
+ );
945
1019
  }
946
1020
  if (hostIds.includes('agents')) {
947
1021
  lines.push(' • Generic agents: load AGENTS.md from your project root.');
@@ -1037,5 +1111,7 @@ module.exports = {
1037
1111
  isHintHost,
1038
1112
  planOpencodeConfigMerge,
1039
1113
  planOpencodeConfigUninstall,
1114
+ listPortableSkillDirs,
1115
+ cursorSkillDest,
1040
1116
  backupPath,
1041
1117
  };