catenext 0.1.0 → 0.1.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.
- package/CHANGELOG.md +70 -0
- package/dist/index.js +65 -58
- package/dist/index.js.map +4 -4
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Semua perubahan penting Catenext dicatat di sini, satu bagian per versi rilis CLI
|
|
4
|
+
(`catenext` di npm). Format mengikuti [Keep a Changelog](https://keepachangelog.com/id/1.1.0/)
|
|
5
|
+
dan versi memakai [SemVer](https://semver.org/lang/id/).
|
|
6
|
+
|
|
7
|
+
Aturan: setiap PR yang mengubah perilaku menambah baris di **Belum dirilis**. Saat rilis, bagian
|
|
8
|
+
itu diganti judul versi + tanggal (`## [X.Y.Z] - YYYY-MM-DD`), dan workflow *Release CLI* menolak
|
|
9
|
+
tag yang versinya belum ada di file ini. Perbarui juga [docs/STATUS.md](docs/STATUS.md).
|
|
10
|
+
|
|
11
|
+
## [Belum dirilis]
|
|
12
|
+
|
|
13
|
+
### Diperbaiki
|
|
14
|
+
- Workflow Release CLI: typecheck/test lewat turbo sehingga `@catenext/shared` di-build lebih dulu;
|
|
15
|
+
root monorepo diganti nama `catenext-monorepo` agar `--filter catenext` tidak ikut menjalankan root.
|
|
16
|
+
- `scripts/build-cli-mirror.mjs` menyalin file dengan baca/tulis biasa, bukan `fs.cpSync`, yang gagal
|
|
17
|
+
EACCES di workspace runner self-hosted.
|
|
18
|
+
- CI dan Release CLI memakai `shell: bash` (di container, default `sh` gagal "Bad substitution"
|
|
19
|
+
pada `${GITHUB_SHA::7}` saat push ke mirror).
|
|
20
|
+
|
|
21
|
+
### Diubah
|
|
22
|
+
- CI dan Release CLI di repo `catenext` berjalan di runner self-hosted (`docs/runner.md`);
|
|
23
|
+
job berjalan di container `node:22-bookworm` (Postgres lewat nama service, store pnpm di volume Docker lokal tanpa cache GitHub). Publish npm tetap di runner GitHub demi provenance.
|
|
24
|
+
|
|
25
|
+
## [0.1.2] - 2026-11-25
|
|
26
|
+
|
|
27
|
+
### Diperbaiki
|
|
28
|
+
- `npx catenext init` kini menulis entri MCP `npx -y catenext mcp`. Di 0.1.1 entri menunjuk ke
|
|
29
|
+
skrip di cache `~/.npm/_npx/...` yang bisa terhapus kapan saja, sehingga server MCP berhenti
|
|
30
|
+
jalan. Pasang ulang dengan `npx -y catenext@latest sync --fix` atau `init` ulang.
|
|
31
|
+
|
|
32
|
+
### Diubah
|
|
33
|
+
- README CLI: alur pemasangan per repo tanpa instalasi global.
|
|
34
|
+
|
|
35
|
+
## [0.1.1] - 2026-11-25
|
|
36
|
+
|
|
37
|
+
### Diperbaiki
|
|
38
|
+
- CLI kini terhubung ke server resmi `https://catenext.mapan.digital` secara default. Di 0.1.0
|
|
39
|
+
default-nya `http://localhost:8787`, sehingga `catenext login` perlu `--api-url`.
|
|
40
|
+
Server lokal tetap bisa dipakai lewat `--api-url http://localhost:8787` atau `CATENEXT_API_URL`.
|
|
41
|
+
|
|
42
|
+
### Ditambahkan
|
|
43
|
+
- `CHANGELOG.md` dan `docs/STATUS.md`; rilis CLI gagal bila versinya belum dicatat di changelog.
|
|
44
|
+
- Paket npm menyertakan `CHANGELOG.md`.
|
|
45
|
+
|
|
46
|
+
## [0.1.0] - 2026-11-25
|
|
47
|
+
|
|
48
|
+
Rilis publik pertama. Web + API live di https://catenext.mapan.digital (paket Free; Pro/Team
|
|
49
|
+
sudah dibangun tetapi terkunci, "Segera hadir").
|
|
50
|
+
|
|
51
|
+
### Ditambahkan
|
|
52
|
+
- **CLI `catenext`**: `login` lewat browser (device flow, API key dikirim terenkripsi X25519 +
|
|
53
|
+
AES-GCM, opsi `--with-key`/`--no-browser`), `init` (konfigurasi MCP untuk Claude Code, Cursor,
|
|
54
|
+
OpenCode + blok `AGENTS.md`), `verify`, `sync` (`--dry-run`/`--fix`), `remove`, perintah
|
|
55
|
+
epic/task/persona, dan fallback tanpa MCP: `next`, `claim`, `done`, `block`.
|
|
56
|
+
- **Server MCP (stdio)**: konteks proyek dan handoff hulu, ambil/klaim/selesaikan task, rencana
|
|
57
|
+
epic → task, persona, `load_skill` dan `save_repo_skill` (skill repo di `.catenext/skills/`).
|
|
58
|
+
- **API** (Hono + Better-Auth + Drizzle, Postgres dengan RLS per workspace): proyek, epic, task
|
|
59
|
+
dengan dependensi (`is_ready`, `blocked_by`), handoff, persona, API key, activity dengan nama
|
|
60
|
+
agen, SSE.
|
|
61
|
+
- **Kuota paket Free** (1 proyek, 1 epic aktif, 25 task/bulan, 500 panggilan tulis, 5.000 baca,
|
|
62
|
+
60 req/menit, retensi 14 hari) dengan 402/429 dan header peringatan ≥80%.
|
|
63
|
+
- **Web**: dashboard proyek, onboarding 6 langkah, 2 template epic (fitur login, CRUD API), kartu
|
|
64
|
+
kuota, halaman paket, Keamanan & Akses, halaman persetujuan `/device` untuk login CLI.
|
|
65
|
+
- **Deploy**: Docker Compose + Caddy, skrip VPS, `.env` acak, backup terenkripsi harian, restore,
|
|
66
|
+
update; runbook untuk VPS bersama di belakang nginx.
|
|
67
|
+
- **Rilis npm** lewat mirror publik `TenkuryuCode/catenext-cli` dengan provenance SLSA.
|
|
68
|
+
|
|
69
|
+
### Catatan
|
|
70
|
+
- Default API URL 0.1.0 masih `http://localhost:8787` (diperbaiki di 0.1.1).
|
package/dist/index.js
CHANGED
|
@@ -942,7 +942,8 @@ function catenextHome() {
|
|
|
942
942
|
function credentialsPath() {
|
|
943
943
|
return join2(catenextHome(), "credentials.json");
|
|
944
944
|
}
|
|
945
|
-
var
|
|
945
|
+
var PRODUCTION_API_URL = "https://catenext.mapan.digital";
|
|
946
|
+
var DEFAULT_API_URL = PRODUCTION_API_URL;
|
|
946
947
|
var CredentialsSchema = z10.object({
|
|
947
948
|
api_key: z10.string().startsWith(API_KEY_PREFIX),
|
|
948
949
|
api_url: z10.url().optional(),
|
|
@@ -1733,14 +1734,51 @@ async function applyInit(root, changes) {
|
|
|
1733
1734
|
// src/maintenance.ts
|
|
1734
1735
|
import { existsSync } from "node:fs";
|
|
1735
1736
|
import { copyFile, mkdir as mkdir4, readFile as readFile7, rename as rename4, rm, rmdir, writeFile as writeFile4 } from "node:fs/promises";
|
|
1736
|
-
import { dirname as dirname3, isAbsolute, join as
|
|
1737
|
+
import { dirname as dirname3, isAbsolute, join as join7, resolve as resolve3 } from "node:path";
|
|
1737
1738
|
import { applyEdits as applyEdits2, modify as modify2, parse as parse4, visit } from "jsonc-parser";
|
|
1738
1739
|
|
|
1740
|
+
// src/node-command.ts
|
|
1741
|
+
import { accessSync, constants, realpathSync } from "node:fs";
|
|
1742
|
+
import { delimiter, join as join5 } from "node:path";
|
|
1743
|
+
function stableNodeCommand(execPath, pathEnv, resolveReal = realpathSync, isExecutable = defaultIsExecutable) {
|
|
1744
|
+
const target = safeReal(execPath, resolveReal);
|
|
1745
|
+
for (const dir of (pathEnv ?? "").split(delimiter)) {
|
|
1746
|
+
if (!dir) continue;
|
|
1747
|
+
for (const name of process.platform === "win32" ? ["node.exe", "node"] : ["node"]) {
|
|
1748
|
+
const candidate = join5(dir, name);
|
|
1749
|
+
if (!isExecutable(candidate)) continue;
|
|
1750
|
+
return safeReal(candidate, resolveReal) === target ? "node" : execPath;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
return execPath;
|
|
1754
|
+
}
|
|
1755
|
+
function hasVersionedSegment(path) {
|
|
1756
|
+
return /[\\/]v?\d+\.\d+\.\d+[\\/]/.test(path);
|
|
1757
|
+
}
|
|
1758
|
+
function safeReal(p, resolveReal) {
|
|
1759
|
+
try {
|
|
1760
|
+
return resolveReal(p);
|
|
1761
|
+
} catch {
|
|
1762
|
+
return p;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
function defaultIsExecutable(p) {
|
|
1766
|
+
try {
|
|
1767
|
+
accessSync(p, constants.X_OK);
|
|
1768
|
+
return true;
|
|
1769
|
+
} catch {
|
|
1770
|
+
return false;
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
function npxLaunch(entry) {
|
|
1774
|
+
return /[\\/]_npx[\\/]/.test(entry) ? { command: "npx", args: ["-y", "catenext"] } : null;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1739
1777
|
// src/skills.ts
|
|
1740
1778
|
import { mkdir as mkdir3, readdir, readFile as readFile6, rename as rename3, writeFile as writeFile3 } from "node:fs/promises";
|
|
1741
|
-
import { join as
|
|
1779
|
+
import { join as join6 } from "node:path";
|
|
1742
1780
|
import { parse as parse3, stringify } from "yaml";
|
|
1743
|
-
var SKILLS_DIR =
|
|
1781
|
+
var SKILLS_DIR = join6(".catenext", "skills");
|
|
1744
1782
|
var SkillError = class extends Error {
|
|
1745
1783
|
constructor(message) {
|
|
1746
1784
|
super(message);
|
|
@@ -1780,7 +1818,7 @@ ${skill.content.trim()}
|
|
|
1780
1818
|
async function listSkills(root) {
|
|
1781
1819
|
let files;
|
|
1782
1820
|
try {
|
|
1783
|
-
files = await readdir(
|
|
1821
|
+
files = await readdir(join6(root, SKILLS_DIR));
|
|
1784
1822
|
} catch {
|
|
1785
1823
|
return { skills: [], invalid: [] };
|
|
1786
1824
|
}
|
|
@@ -1788,7 +1826,7 @@ async function listSkills(root) {
|
|
|
1788
1826
|
const invalid = [];
|
|
1789
1827
|
for (const file of files.filter((f) => f.endsWith(".md")).sort()) {
|
|
1790
1828
|
try {
|
|
1791
|
-
const skill = parseSkill(await readFile6(
|
|
1829
|
+
const skill = parseSkill(await readFile6(join6(root, SKILLS_DIR, file), "utf8"), file);
|
|
1792
1830
|
if (`${skill.name}.md` !== file) {
|
|
1793
1831
|
throw new SkillError(`${file}: name "${skill.name}" harus sama dengan nama file.`);
|
|
1794
1832
|
}
|
|
@@ -1808,7 +1846,7 @@ async function loadSkill(root, name) {
|
|
|
1808
1846
|
const file = `${parsedName.data}.md`;
|
|
1809
1847
|
let source;
|
|
1810
1848
|
try {
|
|
1811
|
-
source = await readFile6(
|
|
1849
|
+
source = await readFile6(join6(root, SKILLS_DIR, file), "utf8");
|
|
1812
1850
|
} catch {
|
|
1813
1851
|
const { skills } = await listSkills(root);
|
|
1814
1852
|
const names = skills.map((s) => s.name).join(", ") || "(belum ada)";
|
|
@@ -1823,9 +1861,9 @@ async function saveSkill(root, input, now = /* @__PURE__ */ new Date()) {
|
|
|
1823
1861
|
if (!when || when.length > SKILL_LIMITS.maxWhenToUseLength) {
|
|
1824
1862
|
throw new SkillError(`when_to_use wajib, maks ${SKILL_LIMITS.maxWhenToUseLength} karakter.`);
|
|
1825
1863
|
}
|
|
1826
|
-
const dir =
|
|
1864
|
+
const dir = join6(root, SKILLS_DIR);
|
|
1827
1865
|
await mkdir3(dir, { recursive: true });
|
|
1828
|
-
const target =
|
|
1866
|
+
const target = join6(dir, `${name}.md`);
|
|
1829
1867
|
let created = true;
|
|
1830
1868
|
try {
|
|
1831
1869
|
await readFile6(target);
|
|
@@ -1836,7 +1874,7 @@ async function saveSkill(root, input, now = /* @__PURE__ */ new Date()) {
|
|
|
1836
1874
|
const tmp = `${target}.${process.pid}.tmp`;
|
|
1837
1875
|
await writeFile3(tmp, renderSkill(skill), "utf8");
|
|
1838
1876
|
await rename3(tmp, target);
|
|
1839
|
-
return { path:
|
|
1877
|
+
return { path: join6(SKILLS_DIR, `${name}.md`), created, skill };
|
|
1840
1878
|
}
|
|
1841
1879
|
|
|
1842
1880
|
// src/maintenance.ts
|
|
@@ -1887,7 +1925,8 @@ function isValidJsonObject(source) {
|
|
|
1887
1925
|
function entryIsStale(entry) {
|
|
1888
1926
|
if (isAbsolute(entry.command) && !existsSync(entry.command)) return true;
|
|
1889
1927
|
const script = entry.args[0];
|
|
1890
|
-
|
|
1928
|
+
if (!script || !isAbsolute(script) || !/\.[cm]?js$/.test(script)) return false;
|
|
1929
|
+
return !existsSync(script) || npxLaunch(script) !== null;
|
|
1891
1930
|
}
|
|
1892
1931
|
function baseCommand(entry, adapter) {
|
|
1893
1932
|
const suffix = ["mcp", ...adapter.extraArgs];
|
|
@@ -1900,7 +1939,7 @@ async function planSync(opts) {
|
|
|
1900
1939
|
const edits = [];
|
|
1901
1940
|
const findings = [];
|
|
1902
1941
|
for (const adapter of ADAPTERS) {
|
|
1903
|
-
const before = await readOrNull2(
|
|
1942
|
+
const before = await readOrNull2(join7(root, adapter.path));
|
|
1904
1943
|
if (before !== null && before.trim() !== "" && !isValidJsonObject(before)) {
|
|
1905
1944
|
if (!opts.fix) {
|
|
1906
1945
|
findings.push({
|
|
@@ -1963,12 +2002,12 @@ async function planSync(opts) {
|
|
|
1963
2002
|
);
|
|
1964
2003
|
if (after !== before) edits.push({ path: adapter.path, before, after });
|
|
1965
2004
|
}
|
|
1966
|
-
const gitignore = await readOrNull2(
|
|
2005
|
+
const gitignore = await readOrNull2(join7(root, ".gitignore"));
|
|
1967
2006
|
const gitignoreAfter = ensureGitignore(gitignore);
|
|
1968
2007
|
if (gitignoreAfter !== gitignore) {
|
|
1969
2008
|
edits.push({ path: ".gitignore", before: gitignore, after: gitignoreAfter });
|
|
1970
2009
|
}
|
|
1971
|
-
const agents = await readOrNull2(
|
|
2010
|
+
const agents = await readOrNull2(join7(root, AGENTS_MD));
|
|
1972
2011
|
if (agents?.includes(BLOCK_START)) {
|
|
1973
2012
|
const after = upsertAgentsBlock(agents);
|
|
1974
2013
|
if (after !== agents) edits.push({ path: AGENTS_MD, before: agents, after });
|
|
@@ -1984,7 +2023,7 @@ async function planRemove(opts) {
|
|
|
1984
2023
|
const root = resolve3(opts.root);
|
|
1985
2024
|
const edits = [];
|
|
1986
2025
|
for (const adapter of ADAPTERS) {
|
|
1987
|
-
const before = await readOrNull2(
|
|
2026
|
+
const before = await readOrNull2(join7(root, adapter.path));
|
|
1988
2027
|
if (before === null || countEntries(before) === 0) continue;
|
|
1989
2028
|
const stripped = removeMcpEntries(before);
|
|
1990
2029
|
const doc = parse4(stripped, [], { allowTrailingComma: true });
|
|
@@ -1992,7 +2031,7 @@ async function planRemove(opts) {
|
|
|
1992
2031
|
const emptyDoc = Object.keys(doc ?? {}).every((k) => k === "mcpServers") && Object.keys(servers ?? {}).length === 0 && !/\/\/|\/\*/.test(stripped);
|
|
1993
2032
|
edits.push({ path: adapter.path, before, after: emptyDoc ? null : stripped });
|
|
1994
2033
|
}
|
|
1995
|
-
const gitignore = await readOrNull2(
|
|
2034
|
+
const gitignore = await readOrNull2(join7(root, ".gitignore"));
|
|
1996
2035
|
if (gitignore !== null) {
|
|
1997
2036
|
const eol = gitignore.includes("\r\n") ? "\r\n" : "\n";
|
|
1998
2037
|
const lines = gitignore.split(/\r?\n/);
|
|
@@ -2004,19 +2043,19 @@ async function planRemove(opts) {
|
|
|
2004
2043
|
edits.push({ path: ".gitignore", before: gitignore, after: text2 ? `${text2}${eol}` : null });
|
|
2005
2044
|
}
|
|
2006
2045
|
}
|
|
2007
|
-
const agents = await readOrNull2(
|
|
2046
|
+
const agents = await readOrNull2(join7(root, AGENTS_MD));
|
|
2008
2047
|
if (agents?.includes(BLOCK_START)) {
|
|
2009
2048
|
edits.push({ path: AGENTS_MD, before: agents, after: removeAgentsBlock(agents) });
|
|
2010
2049
|
}
|
|
2011
|
-
for (const p of [CONFIG_PATH,
|
|
2012
|
-
const before = await readOrNull2(
|
|
2050
|
+
for (const p of [CONFIG_PATH, join7(".catenext", "cache.json")]) {
|
|
2051
|
+
const before = await readOrNull2(join7(root, p));
|
|
2013
2052
|
if (before !== null) edits.push({ path: p, before, after: null });
|
|
2014
2053
|
}
|
|
2015
2054
|
if (opts.all) {
|
|
2016
2055
|
const { skills, invalid } = await listSkills(root);
|
|
2017
2056
|
for (const f of [...skills.map((s) => `${s.name}.md`), ...invalid.map((i) => i.file)]) {
|
|
2018
|
-
const p =
|
|
2019
|
-
edits.push({ path: p, before: await readOrNull2(
|
|
2057
|
+
const p = join7(SKILLS_DIR, f);
|
|
2058
|
+
edits.push({ path: p, before: await readOrNull2(join7(root, p)), after: null });
|
|
2020
2059
|
}
|
|
2021
2060
|
}
|
|
2022
2061
|
return edits;
|
|
@@ -2024,7 +2063,7 @@ async function planRemove(opts) {
|
|
|
2024
2063
|
async function applyFileEdits(root, edits) {
|
|
2025
2064
|
const base = resolve3(root);
|
|
2026
2065
|
for (const e of edits) {
|
|
2027
|
-
const target =
|
|
2066
|
+
const target = join7(base, e.path);
|
|
2028
2067
|
if (e.after === null) {
|
|
2029
2068
|
await rm(target, { force: true });
|
|
2030
2069
|
continue;
|
|
@@ -2036,7 +2075,7 @@ async function applyFileEdits(root, edits) {
|
|
|
2036
2075
|
await rename4(tmp, target);
|
|
2037
2076
|
}
|
|
2038
2077
|
for (const dir of [SKILLS_DIR, ".catenext", ".cursor"]) {
|
|
2039
|
-
await rmdir(
|
|
2078
|
+
await rmdir(join7(base, dir)).catch(() => {
|
|
2040
2079
|
});
|
|
2041
2080
|
}
|
|
2042
2081
|
}
|
|
@@ -2341,40 +2380,6 @@ async function runMcpServer(opts) {
|
|
|
2341
2380
|
await server.connect(new StdioServerTransport());
|
|
2342
2381
|
}
|
|
2343
2382
|
|
|
2344
|
-
// src/node-command.ts
|
|
2345
|
-
import { accessSync, constants, realpathSync } from "node:fs";
|
|
2346
|
-
import { delimiter, join as join7 } from "node:path";
|
|
2347
|
-
function stableNodeCommand(execPath, pathEnv, resolveReal = realpathSync, isExecutable = defaultIsExecutable) {
|
|
2348
|
-
const target = safeReal(execPath, resolveReal);
|
|
2349
|
-
for (const dir of (pathEnv ?? "").split(delimiter)) {
|
|
2350
|
-
if (!dir) continue;
|
|
2351
|
-
for (const name of process.platform === "win32" ? ["node.exe", "node"] : ["node"]) {
|
|
2352
|
-
const candidate = join7(dir, name);
|
|
2353
|
-
if (!isExecutable(candidate)) continue;
|
|
2354
|
-
return safeReal(candidate, resolveReal) === target ? "node" : execPath;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
return execPath;
|
|
2358
|
-
}
|
|
2359
|
-
function hasVersionedSegment(path) {
|
|
2360
|
-
return /[\\/]v?\d+\.\d+\.\d+[\\/]/.test(path);
|
|
2361
|
-
}
|
|
2362
|
-
function safeReal(p, resolveReal) {
|
|
2363
|
-
try {
|
|
2364
|
-
return resolveReal(p);
|
|
2365
|
-
} catch {
|
|
2366
|
-
return p;
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
function defaultIsExecutable(p) {
|
|
2370
|
-
try {
|
|
2371
|
-
accessSync(p, constants.X_OK);
|
|
2372
|
-
return true;
|
|
2373
|
-
} catch {
|
|
2374
|
-
return false;
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
2383
|
// src/verify.ts
|
|
2379
2384
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
2380
2385
|
import { join as join8 } from "node:path";
|
|
@@ -2441,7 +2446,7 @@ function formatChecks(lines) {
|
|
|
2441
2446
|
}
|
|
2442
2447
|
|
|
2443
2448
|
// src/index.ts
|
|
2444
|
-
var VERSION = "0.1.
|
|
2449
|
+
var VERSION = "0.1.2";
|
|
2445
2450
|
var program = new Command();
|
|
2446
2451
|
program.name("catenext").description("Estafet tugas & konteks antar-agen AI coding").version(VERSION);
|
|
2447
2452
|
async function friendly(fn) {
|
|
@@ -2466,6 +2471,8 @@ async function friendly(fn) {
|
|
|
2466
2471
|
function defaultMcpCommand() {
|
|
2467
2472
|
const self = fileURLToPath(import.meta.url);
|
|
2468
2473
|
const entry = self.endsWith(".ts") ? resolve4(dirname4(self), "../dist/index.js") : self;
|
|
2474
|
+
const viaNpx = npxLaunch(entry);
|
|
2475
|
+
if (viaNpx) return viaNpx;
|
|
2469
2476
|
if (!existsSync2(entry)) {
|
|
2470
2477
|
console.error(
|
|
2471
2478
|
`! ${entry} belum ada. Jalankan \`pnpm --filter catenext build\` agar IDE bisa menjalankan server MCP.`
|