@rayul/kordis 0.0.2 → 0.1.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.
- package/dist/index.js +33 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -956,12 +956,12 @@ async function loadCliConfig() {
|
|
|
956
956
|
const raw = await readFile(configPath(), "utf8");
|
|
957
957
|
const parsed = JSON.parse(raw);
|
|
958
958
|
return {
|
|
959
|
-
apiUrl: apiUrlFromEnv ?? parsed.apiUrl ?? "https://api.kordis.
|
|
959
|
+
apiUrl: apiUrlFromEnv ?? parsed.apiUrl ?? "https://api.kordis.store",
|
|
960
960
|
...parsed.username ? { username: parsed.username } : {},
|
|
961
961
|
...parsed.sessionId ? { sessionId: parsed.sessionId } : {}
|
|
962
962
|
};
|
|
963
963
|
} catch {
|
|
964
|
-
return { apiUrl: apiUrlFromEnv ?? "https://api.kordis.
|
|
964
|
+
return { apiUrl: apiUrlFromEnv ?? "https://api.kordis.store" };
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
967
|
async function saveCliConfig(cfg) {
|
|
@@ -1031,6 +1031,22 @@ async function readAll() {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
1033
|
|
|
1034
|
+
// src/version.ts
|
|
1035
|
+
import { readFileSync } from "fs";
|
|
1036
|
+
import { fileURLToPath } from "url";
|
|
1037
|
+
import { dirname, join as join3 } from "path";
|
|
1038
|
+
var __dir = dirname(fileURLToPath(import.meta.url));
|
|
1039
|
+
var pkgPath = join3(__dir, "..", "package.json");
|
|
1040
|
+
var VERSION = (() => {
|
|
1041
|
+
try {
|
|
1042
|
+
const raw = readFileSync(pkgPath, "utf8");
|
|
1043
|
+
const parsed = JSON.parse(raw);
|
|
1044
|
+
return typeof parsed.version === "string" ? parsed.version : "0.0.0-unknown";
|
|
1045
|
+
} catch {
|
|
1046
|
+
return "0.0.0-unknown";
|
|
1047
|
+
}
|
|
1048
|
+
})();
|
|
1049
|
+
|
|
1034
1050
|
// src/client.ts
|
|
1035
1051
|
async function useClient() {
|
|
1036
1052
|
const cfg = await loadCliConfig();
|
|
@@ -1039,7 +1055,7 @@ async function useClient() {
|
|
|
1039
1055
|
let currentTokens = username ? await keychain.load(username) : null;
|
|
1040
1056
|
const api = new KordisClient({
|
|
1041
1057
|
baseUrl: cfg.apiUrl,
|
|
1042
|
-
userAgent: `kordis-cli
|
|
1058
|
+
userAgent: `kordis-cli/${VERSION} node/${process.version}`,
|
|
1043
1059
|
getAccessToken: async () => currentTokens?.access_token
|
|
1044
1060
|
});
|
|
1045
1061
|
const authedRequest = async (fn) => {
|
|
@@ -1269,7 +1285,7 @@ function pushCommand() {
|
|
|
1269
1285
|
// src/commands/pull.ts
|
|
1270
1286
|
import { Command as Command5 } from "commander";
|
|
1271
1287
|
import { mkdir as mkdir3, writeFile as writeFile3 } from "fs/promises";
|
|
1272
|
-
import { dirname, join as
|
|
1288
|
+
import { dirname as dirname2, join as join4 } from "path";
|
|
1273
1289
|
|
|
1274
1290
|
// ../../packages/harness-schema/src/parser.ts
|
|
1275
1291
|
import { parse as parseYaml } from "yaml";
|
|
@@ -2137,8 +2153,8 @@ function pullCommand() {
|
|
|
2137
2153
|
version: contentRes.version
|
|
2138
2154
|
});
|
|
2139
2155
|
for (const f of result.files) {
|
|
2140
|
-
const abs =
|
|
2141
|
-
await mkdir3(
|
|
2156
|
+
const abs = join4(installRoot, f.path);
|
|
2157
|
+
await mkdir3(dirname2(abs), { recursive: true });
|
|
2142
2158
|
await writeFile3(abs, f.content, "utf8");
|
|
2143
2159
|
written.push(abs);
|
|
2144
2160
|
}
|
|
@@ -2156,8 +2172,8 @@ function pullCommand() {
|
|
|
2156
2172
|
`Tool "${format}" is not supported for type "${parsed.type}"; installed canonical form instead.`
|
|
2157
2173
|
);
|
|
2158
2174
|
for (const f of result.files) {
|
|
2159
|
-
const abs =
|
|
2160
|
-
await mkdir3(
|
|
2175
|
+
const abs = join4(installRoot, f.path);
|
|
2176
|
+
await mkdir3(dirname2(abs), { recursive: true });
|
|
2161
2177
|
await writeFile3(abs, f.content, "utf8");
|
|
2162
2178
|
written.push(abs);
|
|
2163
2179
|
}
|
|
@@ -2202,7 +2218,7 @@ async function detectTool(root) {
|
|
|
2202
2218
|
];
|
|
2203
2219
|
for (const [path, tool] of checks) {
|
|
2204
2220
|
try {
|
|
2205
|
-
await stat(
|
|
2221
|
+
await stat(join4(root, path));
|
|
2206
2222
|
return tool;
|
|
2207
2223
|
} catch {
|
|
2208
2224
|
}
|
|
@@ -2308,8 +2324,8 @@ function logoutCommand() {
|
|
|
2308
2324
|
// src/commands/setup.ts
|
|
2309
2325
|
import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4, access } from "fs/promises";
|
|
2310
2326
|
import { homedir as homedir3 } from "os";
|
|
2311
|
-
import { join as
|
|
2312
|
-
import { fileURLToPath } from "url";
|
|
2327
|
+
import { join as join5, dirname as dirname3 } from "path";
|
|
2328
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2313
2329
|
import { Command as Command9 } from "commander";
|
|
2314
2330
|
var MARKER_START = "<!-- kordis-start -->";
|
|
2315
2331
|
var MARKER_END = "<!-- kordis-end -->";
|
|
@@ -2327,9 +2343,9 @@ async function exists(path) {
|
|
|
2327
2343
|
}
|
|
2328
2344
|
}
|
|
2329
2345
|
async function loadGuideContent() {
|
|
2330
|
-
const
|
|
2331
|
-
const bundled =
|
|
2332
|
-
const source =
|
|
2346
|
+
const __dir2 = dirname3(fileURLToPath2(import.meta.url));
|
|
2347
|
+
const bundled = join5(__dir2, "..", "assets", "KORDIS.md");
|
|
2348
|
+
const source = join5(__dir2, "..", "..", "..", "..", "packages", "skills", "KORDIS.md");
|
|
2333
2349
|
const path = await exists(bundled) ? bundled : source;
|
|
2334
2350
|
const raw = await readFile4(path, "utf-8");
|
|
2335
2351
|
if (raw.startsWith("---")) {
|
|
@@ -2351,7 +2367,7 @@ ${MARKER_END}`;
|
|
|
2351
2367
|
}
|
|
2352
2368
|
if (!fileExists) {
|
|
2353
2369
|
if (!dryRun) {
|
|
2354
|
-
await mkdir4(
|
|
2370
|
+
await mkdir4(dirname3(filePath), { recursive: true });
|
|
2355
2371
|
await writeFile4(filePath, block + "\n", "utf-8");
|
|
2356
2372
|
}
|
|
2357
2373
|
return "injected";
|
|
@@ -2386,8 +2402,8 @@ function setupCommand() {
|
|
|
2386
2402
|
let anyFound = false;
|
|
2387
2403
|
const changedTools = [];
|
|
2388
2404
|
for (const target of TARGETS) {
|
|
2389
|
-
const dirPath =
|
|
2390
|
-
const filePath =
|
|
2405
|
+
const dirPath = join5(home, target.dir);
|
|
2406
|
+
const filePath = join5(home, target.file);
|
|
2391
2407
|
if (!await exists(dirPath)) {
|
|
2392
2408
|
if (!opts.silent) {
|
|
2393
2409
|
printHuman(c.gray(` - ${target.tool.padEnd(12)} not installed, skipped`));
|
|
@@ -2429,7 +2445,6 @@ function setupCommand() {
|
|
|
2429
2445
|
}
|
|
2430
2446
|
|
|
2431
2447
|
// src/index.ts
|
|
2432
|
-
var VERSION = "0.0.1";
|
|
2433
2448
|
function buildProgram() {
|
|
2434
2449
|
const program = new Command10("kordis").version(VERSION).description("Kordis \u2014 registry for agentic-coding packages").option("--json", "emit JSON output to stdout (default: human)", false).hook("preAction", (thisCommand) => {
|
|
2435
2450
|
const opts = thisCommand.optsWithGlobals();
|