@amistio/cli 0.1.4 → 0.1.5

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 CHANGED
@@ -2645,7 +2645,7 @@ function buildImportedBrainDocuments(options) {
2645
2645
  documentId,
2646
2646
  documentType: candidate.documentType,
2647
2647
  title: candidate.title,
2648
- status: "reviewing",
2648
+ status: "approved",
2649
2649
  repoPath: candidate.repoPath,
2650
2650
  content: candidate.content,
2651
2651
  contentHash: candidate.contentHash,
@@ -2658,10 +2658,10 @@ function buildImportedBrainDocuments(options) {
2658
2658
  },
2659
2659
  revision,
2660
2660
  source: "repo",
2661
- syncState: "dirtyInRepo",
2661
+ syncState: "approved",
2662
2662
  createdAt: existing?.createdAt ?? importedAt,
2663
2663
  updatedAt: importedAt,
2664
- ...existing?.approvedRevision !== void 0 ? { approvedRevision: existing.approvedRevision } : {}
2664
+ approvedRevision: revision
2665
2665
  };
2666
2666
  });
2667
2667
  }
@@ -2880,12 +2880,22 @@ function truncateProcessOutput(value) {
2880
2880
  return trimmed.length > 1200 ? `${trimmed.slice(0, 1200)}...` : trimmed;
2881
2881
  }
2882
2882
 
2883
+ // src/version.ts
2884
+ import { readFileSync } from "node:fs";
2885
+ function readCliPackageVersion() {
2886
+ const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
2887
+ if (typeof packageJson.version !== "string" || !packageJson.version.trim()) {
2888
+ throw new Error("@amistio/cli package version is missing.");
2889
+ }
2890
+ return packageJson.version.trim();
2891
+ }
2892
+ var CLI_VERSION = readCliPackageVersion();
2893
+
2883
2894
  // src/index.ts
2884
2895
  var program = new Command();
2885
2896
  var defaultRoot = process.env.INIT_CWD ?? process.cwd();
2886
2897
  var apiUrlOptionDescription = `Amistio API URL override (or ${AMISTIO_API_URL_ENV})`;
2887
- program.name("amistio").description("Amistio project brain CLI").version("0.1.4");
2888
- var CLI_VERSION = "0.1.4";
2898
+ program.name("amistio").description("Amistio project brain CLI").version(CLI_VERSION);
2889
2899
  program.command("init").description("Create Amistio control-plane folders for a new project").option("--root <path>", "Repository root", defaultRoot).action(async (options) => {
2890
2900
  const created = await initControlPlane(options.root);
2891
2901
  console.log(created.length ? `Created ${created.length} control-plane folders.` : "Control-plane folders already exist.");
@@ -2926,7 +2936,7 @@ program.command("bootstrap").description("Clone a linked repository locally, pre
2926
2936
  console.log(`Wrote non-secret project metadata to ${filePath}.`);
2927
2937
  console.log(`Next: cd ${formatShellArg(checkout.targetDir)} && amistio run${formatApiUrlFlag(options.apiUrl)} --watch`);
2928
2938
  });
2929
- program.command("import").description("Pair an existing checkout and import legacy Markdown docs for review").argument("[code]", "Short-lived pairing code from the Amistio app").option("--pairing-code <code>", "Short-lived pairing code from the Amistio app").option("--root <path>", "Repository root", defaultRoot).option("--api-url <url>", apiUrlOptionDescription, defaultApiUrl()).option("--default-branch <branch>", "Default branch fallback", "main").option("--include <glob>", "Only import files matching a repo-relative glob", collectRepeatedOption, []).option("--exclude <glob>", "Exclude files matching a repo-relative glob", collectRepeatedOption, []).option("--max-file-kb <kb>", "Maximum Markdown file size to import", parsePositiveInteger, 256).option("--dry-run", "Inspect and print import candidates without consuming the code or uploading documents").action(async (code, options) => {
2939
+ program.command("import").description("Pair an existing checkout and import legacy Markdown docs as accepted brain records").argument("[code]", "Short-lived pairing code from the Amistio app").option("--pairing-code <code>", "Short-lived pairing code from the Amistio app").option("--root <path>", "Repository root", defaultRoot).option("--api-url <url>", apiUrlOptionDescription, defaultApiUrl()).option("--default-branch <branch>", "Default branch fallback", "main").option("--include <glob>", "Only import files matching a repo-relative glob", collectRepeatedOption, []).option("--exclude <glob>", "Exclude files matching a repo-relative glob", collectRepeatedOption, []).option("--max-file-kb <kb>", "Maximum Markdown file size to import", parsePositiveInteger, 256).option("--dry-run", "Inspect and print import candidates without consuming the code or uploading documents").action(async (code, options) => {
2930
2940
  const pairingCode = (options.pairingCode ?? code)?.trim();
2931
2941
  if (!pairingCode) {
2932
2942
  throw new Error("Provide a pairing code as `amistio import <code>` or with `--pairing-code <code>`.");
@@ -2991,7 +3001,7 @@ program.command("import").description("Pair an existing checkout and import lega
2991
3001
  }
2992
3002
  console.log(`Pairing confirmed for ${pairing.repositoryLink.repoName}; repository link ${pairing.repositoryLinkAction}.`);
2993
3003
  console.log(`Wrote non-secret project metadata to ${metadataFilePath}.`);
2994
- console.log(`Imported ${documents.length} legacy document${documents.length === 1 ? "" : "s"} for review.`);
3004
+ console.log(`Imported ${documents.length} legacy document${documents.length === 1 ? "" : "s"} as accepted brain record${documents.length === 1 ? "" : "s"}.`);
2995
3005
  console.log(`Next: amistio sync status${formatApiUrlFlag(options.apiUrl)}`);
2996
3006
  });
2997
3007
  program.command("pair").description("Pair this repository with an Amistio web project").requiredOption("--account <accountId>", "Amistio account ID").requiredOption("--project <projectId>", "Amistio project ID").option("--repository-link <repositoryLinkId>", "Existing repository link ID").option("--default-branch <branch>", "Default branch", "main").option("--api-url <url>", apiUrlOptionDescription, defaultApiUrl()).option("--pairing-code <code>", "Short-lived pairing code from the Amistio app").option("--token <token>", "Runner/device credential to store outside the repository").option("--root <path>", "Repository root", defaultRoot).action(async (options, command) => {