@localskills/cli 0.2.0 → 0.3.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.
- package/dist/index.js +31 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -166,7 +166,7 @@ import { Command as Command7 } from "commander";
|
|
|
166
166
|
// src/commands/auth.ts
|
|
167
167
|
import { Command } from "commander";
|
|
168
168
|
import { randomBytes, createHash } from "crypto";
|
|
169
|
-
import {
|
|
169
|
+
import { spawn } from "child_process";
|
|
170
170
|
|
|
171
171
|
// ../../node_modules/.pnpm/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
|
|
172
172
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -1101,7 +1101,7 @@ ${l}
|
|
|
1101
1101
|
} }).prompt();
|
|
1102
1102
|
|
|
1103
1103
|
// src/lib/config.ts
|
|
1104
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
1104
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync } from "fs";
|
|
1105
1105
|
import { join } from "path";
|
|
1106
1106
|
import { homedir } from "os";
|
|
1107
1107
|
var CONFIG_DIR = join(homedir(), ".localskills");
|
|
@@ -1131,8 +1131,15 @@ function loadConfig() {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
function saveConfig(config) {
|
|
1134
|
-
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
1135
|
-
writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n"
|
|
1134
|
+
mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
|
|
1135
|
+
writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n", {
|
|
1136
|
+
mode: 384
|
|
1137
|
+
});
|
|
1138
|
+
try {
|
|
1139
|
+
chmodSync(CONFIG_DIR, 448);
|
|
1140
|
+
chmodSync(CONFIG_PATH, 384);
|
|
1141
|
+
} catch {
|
|
1142
|
+
}
|
|
1136
1143
|
}
|
|
1137
1144
|
function migrateV1toV2(v1) {
|
|
1138
1145
|
const v2 = {
|
|
@@ -1256,13 +1263,24 @@ function generateUserCode(length = 8) {
|
|
|
1256
1263
|
function openBrowser(url) {
|
|
1257
1264
|
try {
|
|
1258
1265
|
const platform = process.platform;
|
|
1266
|
+
let command = "";
|
|
1267
|
+
let args = [];
|
|
1259
1268
|
if (platform === "darwin") {
|
|
1260
|
-
|
|
1269
|
+
command = "open";
|
|
1270
|
+
args = [url];
|
|
1261
1271
|
} else if (platform === "win32") {
|
|
1262
|
-
|
|
1272
|
+
command = "rundll32";
|
|
1273
|
+
args = ["url.dll,FileProtocolHandler", url];
|
|
1263
1274
|
} else {
|
|
1264
|
-
|
|
1275
|
+
command = "xdg-open";
|
|
1276
|
+
args = [url];
|
|
1265
1277
|
}
|
|
1278
|
+
const child = spawn(command, args, {
|
|
1279
|
+
stdio: "ignore",
|
|
1280
|
+
detached: true,
|
|
1281
|
+
shell: false
|
|
1282
|
+
});
|
|
1283
|
+
child.unref();
|
|
1266
1284
|
} catch {
|
|
1267
1285
|
}
|
|
1268
1286
|
}
|
|
@@ -1593,7 +1611,7 @@ var claudeAdapter = {
|
|
|
1593
1611
|
// src/lib/installers/codex.ts
|
|
1594
1612
|
import { join as join4 } from "path";
|
|
1595
1613
|
import { homedir as homedir4 } from "os";
|
|
1596
|
-
import { execSync
|
|
1614
|
+
import { execSync } from "child_process";
|
|
1597
1615
|
|
|
1598
1616
|
// src/lib/marked-sections.ts
|
|
1599
1617
|
import { existsSync as existsSync5, readFileSync as readFileSync2, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5 } from "fs";
|
|
@@ -1662,7 +1680,7 @@ var descriptor3 = {
|
|
|
1662
1680
|
function detect3() {
|
|
1663
1681
|
let hasCommand = false;
|
|
1664
1682
|
try {
|
|
1665
|
-
|
|
1683
|
+
execSync("which codex", { stdio: "ignore" });
|
|
1666
1684
|
hasCommand = true;
|
|
1667
1685
|
} catch {
|
|
1668
1686
|
}
|
|
@@ -1879,7 +1897,7 @@ var copilotAdapter = {
|
|
|
1879
1897
|
import { existsSync as existsSync9, mkdirSync as mkdirSync8, writeFileSync as writeFileSync7, unlinkSync as unlinkSync6 } from "fs";
|
|
1880
1898
|
import { join as join8 } from "path";
|
|
1881
1899
|
import { homedir as homedir6 } from "os";
|
|
1882
|
-
import { execSync as
|
|
1900
|
+
import { execSync as execSync2 } from "child_process";
|
|
1883
1901
|
var descriptor7 = {
|
|
1884
1902
|
id: "opencode",
|
|
1885
1903
|
name: "OpenCode",
|
|
@@ -1892,7 +1910,7 @@ function detect7(projectDir) {
|
|
|
1892
1910
|
const cwd = projectDir || process.cwd();
|
|
1893
1911
|
let hasCommand = false;
|
|
1894
1912
|
try {
|
|
1895
|
-
|
|
1913
|
+
execSync2("which opencode", { stdio: "ignore" });
|
|
1896
1914
|
hasCommand = true;
|
|
1897
1915
|
} catch {
|
|
1898
1916
|
}
|
|
@@ -1944,7 +1962,7 @@ var opencodeAdapter = {
|
|
|
1944
1962
|
// src/lib/installers/aider.ts
|
|
1945
1963
|
import { existsSync as existsSync10, mkdirSync as mkdirSync9, writeFileSync as writeFileSync8, unlinkSync as unlinkSync7, readFileSync as readFileSync3 } from "fs";
|
|
1946
1964
|
import { join as join9 } from "path";
|
|
1947
|
-
import { execSync as
|
|
1965
|
+
import { execSync as execSync3 } from "child_process";
|
|
1948
1966
|
var descriptor8 = {
|
|
1949
1967
|
id: "aider",
|
|
1950
1968
|
name: "Aider",
|
|
@@ -1956,7 +1974,7 @@ var descriptor8 = {
|
|
|
1956
1974
|
function detect8() {
|
|
1957
1975
|
let hasCommand = false;
|
|
1958
1976
|
try {
|
|
1959
|
-
|
|
1977
|
+
execSync3("which aider", { stdio: "ignore" });
|
|
1960
1978
|
hasCommand = true;
|
|
1961
1979
|
} catch {
|
|
1962
1980
|
}
|