@acta-dev/cli 1.3.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.
Files changed (2) hide show
  1. package/dist/index.js +237 -7
  2. 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";
@@ -418,6 +418,187 @@ async function installAgentSkill(cwd, format) {
418
418
  return format === "both" ? { skillPaths, agentsPath: join2(cwd, "AGENTS.md") } : { skillPaths };
419
419
  }
420
420
 
421
+ // src/commands/deploy-workflows.ts
422
+ var DEPLOY_PROVIDERS = ["pages", "cloudflare", "vercel", "netlify"];
423
+ var DEPLOY_WORKFLOW_TEMPLATES = {
424
+ pages: `name: Deploy Acta Pages
425
+
426
+ on:
427
+ push:
428
+ branches:
429
+ - main
430
+ workflow_dispatch:
431
+
432
+ permissions:
433
+ contents: read
434
+ pages: write
435
+ id-token: write
436
+
437
+ concurrency:
438
+ group: acta-pages
439
+ cancel-in-progress: false
440
+
441
+ jobs:
442
+ build:
443
+ name: Build Acta static viewer
444
+ runs-on: ubuntu-latest
445
+ steps:
446
+ - name: Checkout
447
+ uses: actions/checkout@v4
448
+
449
+ - name: Setup pnpm
450
+ uses: pnpm/action-setup@v4
451
+ with:
452
+ version: 11
453
+
454
+ - name: Setup Node
455
+ uses: actions/setup-node@v4
456
+ with:
457
+ node-version: 22
458
+
459
+ - name: Build Acta site
460
+ run: pnpm dlx @acta-dev/cli site --base "/\${{ github.event.repository.name }}"
461
+
462
+ - name: Configure Pages
463
+ uses: actions/configure-pages@v5
464
+
465
+ - name: Upload Pages artifact
466
+ uses: actions/upload-pages-artifact@v4
467
+ with:
468
+ path: .acta/site
469
+
470
+ deploy:
471
+ name: Deploy to GitHub Pages
472
+ needs: build
473
+ runs-on: ubuntu-latest
474
+ environment:
475
+ name: github-pages
476
+ url: \${{ steps.deployment.outputs.page_url }}
477
+ steps:
478
+ - name: Deploy Pages
479
+ id: deployment
480
+ uses: actions/deploy-pages@v4
481
+ `,
482
+ cloudflare: `name: Deploy Acta to Cloudflare Pages
483
+
484
+ on:
485
+ push:
486
+ branches:
487
+ - main
488
+ workflow_dispatch:
489
+
490
+ permissions:
491
+ contents: read
492
+
493
+ jobs:
494
+ deploy:
495
+ name: Deploy Acta static viewer
496
+ runs-on: ubuntu-latest
497
+ steps:
498
+ - name: Checkout
499
+ uses: actions/checkout@v4
500
+
501
+ - name: Setup pnpm
502
+ uses: pnpm/action-setup@v4
503
+ with:
504
+ version: 11
505
+
506
+ - name: Setup Node
507
+ uses: actions/setup-node@v4
508
+ with:
509
+ node-version: 22
510
+
511
+ - name: Build Acta site
512
+ run: pnpm dlx @acta-dev/cli site
513
+
514
+ - name: Deploy to Cloudflare Pages
515
+ uses: cloudflare/wrangler-action@v3
516
+ with:
517
+ apiToken: \${{ secrets.CLOUDFLARE_API_TOKEN }}
518
+ accountId: \${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
519
+ command: pages deploy .acta/site --project-name="\${{ vars.CLOUDFLARE_PROJECT_NAME }}"
520
+ `,
521
+ vercel: `name: Deploy Acta to Vercel
522
+
523
+ on:
524
+ push:
525
+ branches:
526
+ - main
527
+ workflow_dispatch:
528
+
529
+ permissions:
530
+ contents: read
531
+
532
+ jobs:
533
+ deploy:
534
+ name: Deploy Acta static viewer
535
+ runs-on: ubuntu-latest
536
+ steps:
537
+ - name: Checkout
538
+ uses: actions/checkout@v4
539
+
540
+ - name: Setup pnpm
541
+ uses: pnpm/action-setup@v4
542
+ with:
543
+ version: 11
544
+
545
+ - name: Setup Node
546
+ uses: actions/setup-node@v4
547
+ with:
548
+ node-version: 22
549
+
550
+ - name: Build Acta site
551
+ run: pnpm dlx @acta-dev/cli site
552
+
553
+ - name: Deploy to Vercel
554
+ run: pnpm dlx vercel .acta/site --prod --yes --token="\${{ secrets.VERCEL_TOKEN }}"
555
+ env:
556
+ VERCEL_ORG_ID: \${{ secrets.VERCEL_ORG_ID }}
557
+ VERCEL_PROJECT_ID: \${{ secrets.VERCEL_PROJECT_ID }}
558
+ `,
559
+ netlify: `name: Deploy Acta to Netlify
560
+
561
+ on:
562
+ push:
563
+ branches:
564
+ - main
565
+ workflow_dispatch:
566
+
567
+ permissions:
568
+ contents: read
569
+
570
+ jobs:
571
+ deploy:
572
+ name: Deploy Acta static viewer
573
+ runs-on: ubuntu-latest
574
+ steps:
575
+ - name: Checkout
576
+ uses: actions/checkout@v4
577
+
578
+ - name: Setup pnpm
579
+ uses: pnpm/action-setup@v4
580
+ with:
581
+ version: 11
582
+
583
+ - name: Setup Node
584
+ uses: actions/setup-node@v4
585
+ with:
586
+ node-version: 22
587
+
588
+ - name: Build Acta site
589
+ run: pnpm dlx @acta-dev/cli site
590
+
591
+ - name: Deploy to Netlify
592
+ run: pnpm dlx netlify-cli deploy --dir=.acta/site --prod
593
+ env:
594
+ NETLIFY_AUTH_TOKEN: \${{ secrets.NETLIFY_AUTH_TOKEN }}
595
+ NETLIFY_SITE_ID: \${{ secrets.NETLIFY_SITE_ID }}
596
+ `
597
+ };
598
+ function isDeployProvider(value) {
599
+ return DEPLOY_PROVIDERS.includes(value);
600
+ }
601
+
421
602
  // src/commands/init.ts
422
603
  var ADR_TEMPLATE = `---
423
604
  id: ADR-0000
@@ -585,6 +766,11 @@ jobs:
585
766
  - name: Build Acta artifacts
586
767
  run: pnpm exec acta build
587
768
  `;
769
+ var ACTA_MCP_SERVER_CONFIG = {
770
+ command: "npx",
771
+ args: ["-y", "@acta-dev/mcp-server"],
772
+ env: {}
773
+ };
588
774
  async function confirm(message) {
589
775
  return new Promise((resolvePromise) => {
590
776
  const rl = createInterface({ input: process.stdin, output: process.stdout });
@@ -631,11 +817,20 @@ var initCommand = defineCommand3({
631
817
  description: "Install GitHub Actions workflow template",
632
818
  default: false
633
819
  },
820
+ deploy: {
821
+ type: "string",
822
+ description: "Install a deploy workflow template: pages, cloudflare, vercel or netlify"
823
+ },
634
824
  skill: {
635
825
  type: "boolean",
636
826
  description: "Compatibility alias for `acta skill --init` after scaffolding",
637
827
  default: false
638
828
  },
829
+ mcp: {
830
+ type: "boolean",
831
+ description: "Install an MCP server config for acta-mcp",
832
+ default: false
833
+ },
639
834
  config: {
640
835
  type: "string",
641
836
  alias: "c",
@@ -645,6 +840,10 @@ var initCommand = defineCommand3({
645
840
  async run({ args }) {
646
841
  const cwd = resolve2(process.cwd());
647
842
  const yes = args.yes;
843
+ const deploy = args.deploy;
844
+ if (deploy !== void 0 && !isDeployProvider(deploy)) {
845
+ return exitUsage(`Expected --deploy to be one of: ${DEPLOY_PROVIDERS.join(", ")}.`);
846
+ }
648
847
  const config = resolveConfig3({}, { rootDir: cwd });
649
848
  printLine("Initializing Acta docs structure...");
650
849
  printLine();
@@ -668,8 +867,8 @@ var initCommand = defineCommand3({
668
867
  if (specWritten) printSuccess(`Created ${specTplPath}`);
669
868
  const gitignorePath = join3(cwd, ".gitignore");
670
869
  if (existsSync3(gitignorePath)) {
671
- const { readFile: readFile4, appendFile } = await import("fs/promises");
672
- const content = await readFile4(gitignorePath, "utf8");
870
+ const { appendFile } = await import("fs/promises");
871
+ const content = await readFile2(gitignorePath, "utf8");
673
872
  if (!content.includes(".acta/")) {
674
873
  await appendFile(gitignorePath, "\n# Acta build artifacts\n.acta/\n");
675
874
  printSuccess(`Added .acta/ to .gitignore`);
@@ -687,6 +886,17 @@ var initCommand = defineCommand3({
687
886
  const workflowWritten = await safeWriteFile(workflowPath, GITHUB_ACTION_TEMPLATE, yes);
688
887
  if (workflowWritten) printSuccess(`Created ${workflowPath}`);
689
888
  }
889
+ if (deploy !== void 0) {
890
+ const workflowsDir = join3(cwd, ".github", "workflows");
891
+ await mkdir2(workflowsDir, { recursive: true });
892
+ const workflowPath = join3(workflowsDir, `acta-deploy-${deploy}.yml`);
893
+ const workflowWritten = await safeWriteFile(
894
+ workflowPath,
895
+ DEPLOY_WORKFLOW_TEMPLATES[deploy],
896
+ yes
897
+ );
898
+ if (workflowWritten) printSuccess(`Created ${workflowPath}`);
899
+ }
690
900
  if (args.skill) {
691
901
  const result = await installAgentSkill(cwd, "both");
692
902
  for (const skillPath of result.skillPaths) {
@@ -696,10 +906,30 @@ var initCommand = defineCommand3({
696
906
  printSuccess(`Updated ${result.agentsPath} with Acta agent guidance`);
697
907
  }
698
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
+ }
699
914
  printLine();
700
915
  printSuccess("Acta initialized. Run `acta validate` to check your documents.");
701
916
  }
702
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
+ }
703
933
 
704
934
  // src/commands/list.ts
705
935
  import { loadProject as loadProject2 } from "@acta-dev/core";
@@ -831,11 +1061,11 @@ function titleToSlug(title) {
831
1061
  }
832
1062
 
833
1063
  // src/template.ts
834
- import { readFile as readFile2 } from "fs/promises";
1064
+ import { readFile as readFile3 } from "fs/promises";
835
1065
  import { join as join4 } from "path";
836
1066
  async function renderTemplate(kind, vars, config) {
837
1067
  const templateFile = join4(config.resolvedDocs.templatesDir, `${kind}.md`);
838
- const raw = await readFile2(templateFile, "utf8");
1068
+ const raw = await readFile3(templateFile, "utf8");
839
1069
  return interpolate(raw, vars);
840
1070
  }
841
1071
  function interpolate(raw, vars) {
@@ -997,7 +1227,7 @@ function parseTags(value) {
997
1227
  }
998
1228
 
999
1229
  // src/commands/renumber.ts
1000
- import { readFile as readFile3, rename, writeFile as writeFile4 } from "fs/promises";
1230
+ import { readFile as readFile4, rename, writeFile as writeFile4 } from "fs/promises";
1001
1231
  import { basename, dirname, join as join6 } from "path";
1002
1232
  import { internalLinkKeys as internalLinkKeys2, loadProject as loadProject3 } from "@acta-dev/core";
1003
1233
  import { defineCommand as defineCommand6 } from "citty";
@@ -1033,7 +1263,7 @@ function buildRenumberPlan(fromId, toId, project) {
1033
1263
  };
1034
1264
  }
1035
1265
  async function rewriteDocument(filePath, oldId, newId, isTarget) {
1036
- const raw = await readFile3(filePath, "utf8");
1266
+ const raw = await readFile4(filePath, "utf8");
1037
1267
  const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
1038
1268
  if (!match) {
1039
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.0",
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.1.0",
49
- "@acta-dev/web": "1.0.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",