@acta-dev/cli 1.4.0 → 1.5.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 +37 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -223,7 +223,7 @@ var graphCommand = defineCommand2({
|
|
|
223
223
|
|
|
224
224
|
// src/commands/init.ts
|
|
225
225
|
import { existsSync as existsSync3 } from "fs";
|
|
226
|
-
import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
|
|
226
|
+
import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
227
227
|
import { join as join3, resolve as resolve2 } from "path";
|
|
228
228
|
import { createInterface } from "readline";
|
|
229
229
|
import { resolveConfig as resolveConfig3 } from "@acta-dev/core";
|
|
@@ -766,6 +766,11 @@ jobs:
|
|
|
766
766
|
- name: Build Acta artifacts
|
|
767
767
|
run: pnpm exec acta build
|
|
768
768
|
`;
|
|
769
|
+
var ACTA_MCP_SERVER_CONFIG = {
|
|
770
|
+
command: "npx",
|
|
771
|
+
args: ["-y", "@acta-dev/mcp-server"],
|
|
772
|
+
env: {}
|
|
773
|
+
};
|
|
769
774
|
async function confirm(message) {
|
|
770
775
|
return new Promise((resolvePromise) => {
|
|
771
776
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -821,6 +826,11 @@ var initCommand = defineCommand3({
|
|
|
821
826
|
description: "Compatibility alias for `acta skill --init` after scaffolding",
|
|
822
827
|
default: false
|
|
823
828
|
},
|
|
829
|
+
mcp: {
|
|
830
|
+
type: "boolean",
|
|
831
|
+
description: "Install an MCP server config for acta-mcp",
|
|
832
|
+
default: false
|
|
833
|
+
},
|
|
824
834
|
config: {
|
|
825
835
|
type: "string",
|
|
826
836
|
alias: "c",
|
|
@@ -857,8 +867,8 @@ var initCommand = defineCommand3({
|
|
|
857
867
|
if (specWritten) printSuccess(`Created ${specTplPath}`);
|
|
858
868
|
const gitignorePath = join3(cwd, ".gitignore");
|
|
859
869
|
if (existsSync3(gitignorePath)) {
|
|
860
|
-
const {
|
|
861
|
-
const content = await
|
|
870
|
+
const { appendFile } = await import("fs/promises");
|
|
871
|
+
const content = await readFile2(gitignorePath, "utf8");
|
|
862
872
|
if (!content.includes(".acta/")) {
|
|
863
873
|
await appendFile(gitignorePath, "\n# Acta build artifacts\n.acta/\n");
|
|
864
874
|
printSuccess(`Added .acta/ to .gitignore`);
|
|
@@ -896,10 +906,30 @@ var initCommand = defineCommand3({
|
|
|
896
906
|
printSuccess(`Updated ${result.agentsPath} with Acta agent guidance`);
|
|
897
907
|
}
|
|
898
908
|
}
|
|
909
|
+
if (args.mcp) {
|
|
910
|
+
const mcpPath = join3(cwd, ".mcp.json");
|
|
911
|
+
await installMcpConfig(mcpPath);
|
|
912
|
+
printSuccess(`Updated ${mcpPath} with Acta MCP server config`);
|
|
913
|
+
}
|
|
899
914
|
printLine();
|
|
900
915
|
printSuccess("Acta initialized. Run `acta validate` to check your documents.");
|
|
901
916
|
}
|
|
902
917
|
});
|
|
918
|
+
async function installMcpConfig(path) {
|
|
919
|
+
const existing = existsSync3(path) ? JSON.parse(await readFile2(path, "utf8")) : {};
|
|
920
|
+
const next = {
|
|
921
|
+
...existing,
|
|
922
|
+
mcpServers: {
|
|
923
|
+
...isRecord(existing.mcpServers) ? existing.mcpServers : {},
|
|
924
|
+
acta: ACTA_MCP_SERVER_CONFIG
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
await writeFile2(path, `${JSON.stringify(next, null, 2)}
|
|
928
|
+
`, "utf8");
|
|
929
|
+
}
|
|
930
|
+
function isRecord(value) {
|
|
931
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
932
|
+
}
|
|
903
933
|
|
|
904
934
|
// src/commands/list.ts
|
|
905
935
|
import { loadProject as loadProject2 } from "@acta-dev/core";
|
|
@@ -1031,11 +1061,11 @@ function titleToSlug(title) {
|
|
|
1031
1061
|
}
|
|
1032
1062
|
|
|
1033
1063
|
// src/template.ts
|
|
1034
|
-
import { readFile as
|
|
1064
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
1035
1065
|
import { join as join4 } from "path";
|
|
1036
1066
|
async function renderTemplate(kind, vars, config) {
|
|
1037
1067
|
const templateFile = join4(config.resolvedDocs.templatesDir, `${kind}.md`);
|
|
1038
|
-
const raw = await
|
|
1068
|
+
const raw = await readFile3(templateFile, "utf8");
|
|
1039
1069
|
return interpolate(raw, vars);
|
|
1040
1070
|
}
|
|
1041
1071
|
function interpolate(raw, vars) {
|
|
@@ -1197,7 +1227,7 @@ function parseTags(value) {
|
|
|
1197
1227
|
}
|
|
1198
1228
|
|
|
1199
1229
|
// src/commands/renumber.ts
|
|
1200
|
-
import { readFile as
|
|
1230
|
+
import { readFile as readFile4, rename, writeFile as writeFile4 } from "fs/promises";
|
|
1201
1231
|
import { basename, dirname, join as join6 } from "path";
|
|
1202
1232
|
import { internalLinkKeys as internalLinkKeys2, loadProject as loadProject3 } from "@acta-dev/core";
|
|
1203
1233
|
import { defineCommand as defineCommand6 } from "citty";
|
|
@@ -1233,7 +1263,7 @@ function buildRenumberPlan(fromId, toId, project) {
|
|
|
1233
1263
|
};
|
|
1234
1264
|
}
|
|
1235
1265
|
async function rewriteDocument(filePath, oldId, newId, isTarget) {
|
|
1236
|
-
const raw = await
|
|
1266
|
+
const raw = await readFile4(filePath, "utf8");
|
|
1237
1267
|
const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
1238
1268
|
if (!match) {
|
|
1239
1269
|
throw new Error(`Cannot parse frontmatter in ${filePath}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acta-dev/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Acta CLI — TypeScript-first docs-as-code tooling for ADR and spec documents in Git. Provides the `acta` binary.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adr",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"citty": "^0.2.2",
|
|
46
46
|
"kleur": "^4.1.5",
|
|
47
47
|
"yaml": "^2.8.3",
|
|
48
|
-
"@acta-dev/core": "1.
|
|
49
|
-
"@acta-dev/web": "1.0.
|
|
48
|
+
"@acta-dev/core": "1.2.0",
|
|
49
|
+
"@acta-dev/web": "1.0.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"execa": "^9.6.1",
|