mancode 0.6.0 → 0.6.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/cli.js CHANGED
@@ -3,7 +3,6 @@ import {
3
3
  VERSION
4
4
  } from "./chunk-57PJQDQ3.js";
5
5
  import {
6
- PROJECT_MANIFESTS,
7
6
  V3ContextStore,
8
7
  assertActivationRollbackManifestTransition,
9
8
  assertClaimTransition,
@@ -51,6 +50,7 @@ import {
51
50
  formatTaskRef,
52
51
  gitRefWorkflowRepairJournalPath,
53
52
  handoffDirectory,
53
+ hasProjectEvidence,
54
54
  implementationScopeIsExecutable,
55
55
  isUlid,
56
56
  listGitRefWorkflowRepairJournalSummaries,
@@ -114,7 +114,7 @@ import {
114
114
  workflowMetadataDigest,
115
115
  writeOperationReservation,
116
116
  writeProjectFacts
117
- } from "./chunk-LXRKJBSG.js";
117
+ } from "./chunk-44UHUCE6.js";
118
118
  import {
119
119
  DEFAULT_MANCODE_END_MARKER,
120
120
  DEFAULT_MANCODE_START_MARKER,
@@ -9677,7 +9677,7 @@ async function activateLegacyMigration(input) {
9677
9677
  if (session === null || session.status !== "active") {
9678
9678
  throw new Error("MANCODE_SESSION_NOT_FOUND");
9679
9679
  }
9680
- const store = new (await import("./store-XJX424E3.js")).V3ContextStore(root);
9680
+ const store = new (await import("./store-TQFQCAAF.js")).V3ContextStore(root);
9681
9681
  const project = await store.readProjectSnapshot();
9682
9682
  const stage = await readMigrationStage(root, input.stageId);
9683
9683
  if (stage.state !== "staged" || stage.revision !== input.expectedStageRevision) {
@@ -28709,11 +28709,15 @@ async function init(rootDir = process6.cwd(), options = {}) {
28709
28709
  }
28710
28710
  return initializeV3(rootDir, options);
28711
28711
  }
28712
+ const genericSafety = await canInitializeGenericProject(rootDir);
28713
+ if (!genericSafety.ok && genericSafety.reason === "unsafe") {
28714
+ printNotProjectDirectory(rootDir, locale, "unsafe");
28715
+ return EXIT_NOT_A_PROJECT_DIR;
28716
+ }
28712
28717
  const isGitRepo = await pathExists6(path55.join(rootDir, ".git"));
28713
- const hasManifest = await hasProjectManifest(rootDir);
28718
+ const hasEvidence = await hasProjectEvidence(rootDir);
28714
28719
  let isGenericProject = false;
28715
- if (!isGitRepo && !hasManifest) {
28716
- const genericSafety = await canInitializeGenericProject(rootDir);
28720
+ if (!isGitRepo && !hasEvidence) {
28717
28721
  if (!genericSafety.ok && !(wasInitialized && genericSafety.reason === "nonempty")) {
28718
28722
  printNotProjectDirectory(rootDir, locale, genericSafety.reason);
28719
28723
  return EXIT_NOT_A_PROJECT_DIR;
@@ -28767,12 +28771,12 @@ async function init(rootDir = process6.cwd(), options = {}) {
28767
28771
  if (uiLibrary) {
28768
28772
  console.log(` UI: ${uiLibraryStr}`);
28769
28773
  }
28770
- } else if (hasManifest) {
28774
+ } else if (hasEvidence) {
28771
28775
  console.log(
28772
28776
  localize(
28773
28777
  locale,
28774
- " \u5DF2\u53D1\u73B0\u9879\u76EE manifest\uFF0C\u672A\u8BC6\u522B\u5230\u6846\u67B6\u4F9D\u8D56",
28775
- " Project manifest found; no known framework dependencies"
28778
+ " \u5DF2\u53D1\u73B0\u9879\u76EE\u6E90\u7801\uFF0C\u672A\u8BC6\u522B\u5230\u6846\u67B6\u4F9D\u8D56",
28779
+ " Project source found; no known framework dependencies"
28776
28780
  )
28777
28781
  );
28778
28782
  } else {
@@ -29290,12 +29294,6 @@ async function selectInitPlatforms(input) {
29290
29294
  }
29291
29295
  return [DEFAULT_INIT_PLATFORM];
29292
29296
  }
29293
- async function hasProjectManifest(rootDir) {
29294
- for (const name of PROJECT_MANIFESTS) {
29295
- if (await pathExists6(path55.join(rootDir, name))) return true;
29296
- }
29297
- return false;
29298
- }
29299
29297
  async function canInitializeGenericProject(rootDir) {
29300
29298
  const resolved = path55.resolve(rootDir);
29301
29299
  if (resolved === path55.parse(resolved).root || resolved === path55.resolve(os.homedir())) {
@@ -29312,14 +29310,18 @@ async function canInitializeGenericProject(rootDir) {
29312
29310
  }
29313
29311
  }
29314
29312
  async function validateV3CliProjectBoundary(rootDir, options, locale, legacyInitialized) {
29313
+ const genericSafety = await canInitializeGenericProject(rootDir);
29314
+ if (!genericSafety.ok && genericSafety.reason === "unsafe") {
29315
+ printNotProjectDirectory(rootDir, locale, "unsafe");
29316
+ return EXIT_NOT_A_PROJECT_DIR;
29317
+ }
29315
29318
  const isGitRepo = await pathExists6(path55.join(rootDir, ".git"));
29316
- const hasManifest = await hasProjectManifest(rootDir);
29317
- if (isGitRepo || hasManifest) return null;
29319
+ const hasEvidence = await hasProjectEvidence(rootDir);
29320
+ if (isGitRepo || hasEvidence) return null;
29318
29321
  const v3Initialized = await pathExists6(
29319
29322
  path55.join(rootDir, ".mancode", "schema.json")
29320
29323
  );
29321
29324
  const legacyAuthorityPresent = legacyInitialized || (await scanLegacyAuthority(rootDir)).authorityPresent;
29322
- const genericSafety = await canInitializeGenericProject(rootDir);
29323
29325
  if (!genericSafety.ok && !((legacyAuthorityPresent || v3Initialized) && genericSafety.reason === "nonempty")) {
29324
29326
  printNotProjectDirectory(rootDir, locale, genericSafety.reason);
29325
29327
  return EXIT_NOT_A_PROJECT_DIR;
@@ -29340,7 +29342,7 @@ function printNotProjectDirectory(rootDir, locale, reason) {
29340
29342
  console.error(" \u4E3A\u907F\u514D\u8BEF\u5199\uFF0C\u4E0D\u80FD\u5728 Home \u76EE\u5F55\u6216\u78C1\u76D8\u6839\u76EE\u5F55\u521D\u59CB\u5316\u3002");
29341
29343
  } else if (reason === "nonempty") {
29342
29344
  console.error(
29343
- " \u672A\u8BC6\u522B\u5230\u9879\u76EE\u6587\u4EF6\uFF0C\u4E14\u76EE\u5F55\u4E2D\u5DF2\u6709\u6587\u4EF6\u3002\u8BF7\u5148\u8FDB\u5165\u9879\u76EE\u76EE\u5F55\u3002"
29345
+ " \u672A\u8BC6\u522B\u5230\u9876\u5C42\u9879\u76EE\u6E05\u5355\u3001\u6E90\u7801\u6587\u4EF6\u6216\u6E90\u7801\u76EE\u5F55\u3002\u8BF7\u5148\u8FDB\u5165\u5B9E\u9645\u9879\u76EE\u6839\u76EE\u5F55\u3002"
29344
29346
  );
29345
29347
  } else {
29346
29348
  console.error(
@@ -29356,7 +29358,7 @@ function printNotProjectDirectory(rootDir, locale, reason) {
29356
29358
  );
29357
29359
  } else if (reason === "nonempty") {
29358
29360
  console.error(
29359
- " No project files were detected and the directory is not empty."
29361
+ " No top-level manifest, source file, or source directory was detected."
29360
29362
  );
29361
29363
  } else {
29362
29364
  console.error(
@@ -31829,11 +31831,11 @@ async function refreshProject(rootDir = process9.cwd()) {
31829
31831
  }
31830
31832
  let factsWritten = false;
31831
31833
  try {
31832
- const [profile, team, hasGit, hasManifest] = await Promise.all([
31834
+ const [profile, team, hasGit, hasEvidence] = await Promise.all([
31833
31835
  detectProjectProfile(rootDir),
31834
31836
  detectTeamStatus(rootDir),
31835
31837
  pathExists11(path62.join(rootDir, ".git")),
31836
- hasProjectManifest2(rootDir)
31838
+ hasProjectEvidence(rootDir)
31837
31839
  ]);
31838
31840
  const uiLibrary = primaryUiLibrary(profile);
31839
31841
  const stack = [...profile.languages, ...profile.frameworks];
@@ -31843,7 +31845,7 @@ async function refreshProject(rootDir = process9.cwd()) {
31843
31845
  ...state,
31844
31846
  techStack: stack.join(" + ") || profile.projectKind,
31845
31847
  uiLibrary: uiLibrary ?? "None",
31846
- projectMode: hasGit || hasManifest ? "detected" : "generic",
31848
+ projectMode: hasGit || hasEvidence ? "detected" : "generic",
31847
31849
  teamModeAutoDetected: configuredTeam,
31848
31850
  contributors: team.contributors
31849
31851
  };
@@ -31866,7 +31868,7 @@ async function refreshProject(rootDir = process9.cwd()) {
31866
31868
  );
31867
31869
  console.log("\u2713 Project facts refreshed.");
31868
31870
  console.log(
31869
- ` ${hasGit ? "Git detected" : "No Git repository"} | ${hasManifest ? "project manifest detected" : "generic project"}`
31871
+ ` ${hasGit ? "Git detected" : "No Git repository"} | ${hasEvidence ? "project source detected" : "generic project"}`
31870
31872
  );
31871
31873
  console.log(
31872
31874
  ` Stack: ${nextState.techStack} | UI: ${nextState.uiLibrary}`
@@ -31914,12 +31916,6 @@ async function refreshV3Project(rootDir) {
31914
31916
  return EXIT_REFRESH_FAILED;
31915
31917
  }
31916
31918
  }
31917
- async function hasProjectManifest2(rootDir) {
31918
- for (const manifest of PROJECT_MANIFESTS) {
31919
- if (await pathExists11(path62.join(rootDir, manifest))) return true;
31920
- }
31921
- return false;
31922
- }
31923
31919
  async function writeProjectFacts2(statePath, profilePath, stateContent, profileContent) {
31924
31920
  await Promise.all([
31925
31921
  ensureReplaceableFile(statePath),
@@ -32704,10 +32700,7 @@ async function shouldRefreshProject(rootDir, state) {
32704
32700
  if (state.projectMode !== "generic") return false;
32705
32701
  const hasGit = await pathExists13(path64.join(rootDir, ".git"));
32706
32702
  if (hasGit) return true;
32707
- for (const manifest of PROJECT_MANIFESTS) {
32708
- if (await pathExists13(path64.join(rootDir, manifest))) return true;
32709
- }
32710
- return false;
32703
+ return hasProjectEvidence(rootDir);
32711
32704
  }
32712
32705
  async function checkPlatformStatus2(rootDir, installedPlatforms) {
32713
32706
  const installed = new Set(installedPlatforms);