hunter-harness 0.1.2 → 0.1.3

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/bin.js +64 -47
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -3426,7 +3426,7 @@ function normalizeProfile(value) {
3426
3426
  if (value === void 0) return void 0;
3427
3427
  if (value === "" || value === "1" || value === "general") return "general";
3428
3428
  if (value === "2" || value === "java") return "java";
3429
- throw new InitConfigurationError("profile must be general or java");
3429
+ throw new InitConfigurationError("\u914D\u7F6E\u7C7B\u578B\u5FC5\u987B\u4E3A general \u6216 java");
3430
3430
  }
3431
3431
  async function resolveInitConfig(cwd, flags, promptMissing) {
3432
3432
  let fileConfig = {};
@@ -3501,7 +3501,7 @@ function parseProfile(value, current) {
3501
3501
  }
3502
3502
  if (value === "1" || value === "general") return "general";
3503
3503
  if (value === "2" || value === "java") return "java";
3504
- throw new Error("profile must be general or java");
3504
+ throw new Error("\u914D\u7F6E\u7C7B\u578B\u5FC5\u987B\u4E3A general \u6216 java");
3505
3505
  }
3506
3506
  function summarize(result) {
3507
3507
  const items = [
@@ -3538,17 +3538,34 @@ function renderProfileTransitionPreview(result) {
3538
3538
  ...result.preserved,
3539
3539
  ...result.unchanged
3540
3540
  ];
3541
- return "Preview profile transition:\n" + items.map((item2) => `- ${item2.action}: ${item2.target_path} (${item2.reason})`).join("\n") + "\n";
3541
+ const actionLabel = {
3542
+ add: "\u65B0\u589E",
3543
+ replace: "\u66FF\u6362",
3544
+ delete: "\u5220\u9664",
3545
+ preserve: "\u4FDD\u7559",
3546
+ unchanged: "\u65E0\u9700\u53D8\u66F4"
3547
+ };
3548
+ const reasonLabel = {
3549
+ MISSING_TARGET: "\u76EE\u6807\u7F3A\u5931",
3550
+ BASELINE_CLEAN: "\u57FA\u7EBF\u672A\u4FEE\u6539",
3551
+ ALREADY_CURRENT: "\u5DF2\u662F\u6700\u65B0",
3552
+ LOCAL_MODIFICATION: "\u68C0\u6D4B\u5230\u672C\u5730\u4FEE\u6539",
3553
+ MALFORMED_MANAGED_BLOCK: "\u53D7\u7BA1\u533A\u5757\u683C\u5F0F\u5F02\u5E38",
3554
+ LEGACY_PROFILE_FILE_MODIFIED: "\u65E7\u914D\u7F6E\u6587\u4EF6\u5DF2\u4FEE\u6539",
3555
+ LEGACY_BASELINE_UNKNOWN: "\u65E7\u7248\u57FA\u7EBF\u672A\u77E5",
3556
+ FORCE_MANAGED: "\u5F3A\u5236\u66F4\u65B0"
3557
+ };
3558
+ return "\u914D\u7F6E\u5207\u6362\u9884\u89C8\uFF1A\n" + items.map((item2) => `- ${actionLabel[item2.action]}\uFF1A${item2.target_path}\uFF08${reasonLabel[item2.reason]}\uFF09`).join("\n") + "\n";
3542
3559
  }
3543
3560
  async function runRefresh(options, dependencies) {
3544
3561
  const requestId = uuidV7();
3545
3562
  const detection = await detectProject(dependencies.cwd);
3546
3563
  if (detection.status === "absent") {
3547
- dependencies.stderr("Hunter Harness is not initialized; run `hunter-harness` first.\n");
3564
+ dependencies.stderr("\u5C1A\u672A\u521D\u59CB\u5316 Hunter Harness\uFF1B\u8BF7\u5148\u8FD0\u884C `hunter-harness`\u3002\n");
3548
3565
  return 3;
3549
3566
  }
3550
3567
  if (detection.status === "invalid") {
3551
- dependencies.stderr("PROJECT_CONFIG_INVALID: .harness/project.yaml is invalid\n");
3568
+ dependencies.stderr("PROJECT_CONFIG_INVALID\uFF1A.harness/project.yaml \u65E0\u6548\n");
3552
3569
  return 3;
3553
3570
  }
3554
3571
  const currentProfile = detection.config.project.profiles[0] ?? "general";
@@ -3585,12 +3602,12 @@ async function runRefresh(options, dependencies) {
3585
3602
  if (options.confirmed !== true) {
3586
3603
  if (options.nonInteractive === true) {
3587
3604
  if (!options.yes && !dryRun) {
3588
- dependencies.stderr("non-interactive refresh requires --yes\n");
3605
+ dependencies.stderr("\u975E\u4EA4\u4E92\u6A21\u5F0F\u5237\u65B0\u9700\u8981 --yes\n");
3589
3606
  return 2;
3590
3607
  }
3591
3608
  } else if (!options.yes && !dryRun) {
3592
- const label = targetProfile === currentProfile ? `Refresh current profile (${currentProfile})` : `Switch profile ${currentProfile} -> ${targetProfile}`;
3593
- const answer = await dependencies.prompt(`${label}? [y/N]: `);
3609
+ const label = targetProfile === currentProfile ? `\u5237\u65B0\u5F53\u524D\u914D\u7F6E\uFF08${currentProfile}\uFF09` : `\u5207\u6362\u914D\u7F6E\uFF1A${currentProfile} \u2192 ${targetProfile}`;
3610
+ const answer = await dependencies.prompt(`${label}\uFF1F[y/N]\uFF1A`);
3594
3611
  if (!/^(?:y|yes)$/i.test(answer.trim())) {
3595
3612
  return 2;
3596
3613
  }
@@ -3609,11 +3626,11 @@ async function runRefresh(options, dependencies) {
3609
3626
  dependencies.stdout(serializeCliResult({ ...output, request_id: requestId }));
3610
3627
  } else {
3611
3628
  const parts = [];
3612
- if (result.applied.length > 0) parts.push(`applied ${result.applied.length}`);
3613
- if (result.removed.length > 0) parts.push(`removed ${result.removed.length}`);
3614
- if (result.preserved.length > 0) parts.push(`preserved ${result.preserved.length}`);
3615
- if (result.unchanged.length > 0) parts.push(`unchanged ${result.unchanged.length}`);
3616
- dependencies.stdout(`Harness refresh (${targetProfile}): ${parts.join(", ") || "no changes"}.
3629
+ if (result.applied.length > 0) parts.push(`\u5DF2\u66F4\u65B0 ${result.applied.length} \u4E2A`);
3630
+ if (result.removed.length > 0) parts.push(`\u5DF2\u5220\u9664 ${result.removed.length} \u4E2A`);
3631
+ if (result.preserved.length > 0) parts.push(`\u5DF2\u4FDD\u7559 ${result.preserved.length} \u4E2A`);
3632
+ if (result.unchanged.length > 0) parts.push(`\u65E0\u9700\u53D8\u66F4 ${result.unchanged.length} \u4E2A`);
3633
+ dependencies.stdout(`Harness \u5237\u65B0\uFF08${targetProfile}\uFF09\uFF1A${parts.join("\uFF0C") || "\u6CA1\u6709\u53D8\u66F4"}\u3002
3617
3634
  `);
3618
3635
  }
3619
3636
  return output.exit_code;
@@ -3654,7 +3671,7 @@ async function runFirstInstall(options, dependencies) {
3654
3671
  ).then((answer) => answer.trim())
3655
3672
  );
3656
3673
  if (options.nonInteractive === true && options.yes !== true && options.dryRun !== true) {
3657
- dependencies.stderr("non-interactive writes require --yes\n");
3674
+ dependencies.stderr("\u975E\u4EA4\u4E92\u6A21\u5F0F\u6267\u884C\u5199\u5165\u64CD\u4F5C\u9700\u8981 --yes\n");
3658
3675
  return 2;
3659
3676
  }
3660
3677
  const result = await initializeProject({
@@ -3676,7 +3693,7 @@ async function runFirstInstall(options, dependencies) {
3676
3693
  warnings: [],
3677
3694
  errors: []
3678
3695
  };
3679
- dependencies.stdout(options.json === true ? serializeCliResult(output) : "Hunter Harness initialized " + result.paths.length + " files.\n");
3696
+ dependencies.stdout(options.json === true ? serializeCliResult(output) : "Hunter Harness \u521D\u59CB\u5316\u5B8C\u6210\uFF0C\u5171\u5904\u7406 " + result.paths.length + " \u4E2A\u6587\u4EF6\u3002\n");
3680
3697
  return 0;
3681
3698
  } catch (error) {
3682
3699
  const exitCode = error instanceof InitConfigurationError ? error.exitCode : 1;
@@ -3713,9 +3730,9 @@ async function runExistingProject(options, dependencies, currentProfile) {
3713
3730
  }
3714
3731
  const menu = await dependencies.prompt(
3715
3732
  `Hunter Harness \u5DF2\u521D\u59CB\u5316\uFF08profile: ${currentProfile}\uFF09\u3002
3716
- 1. Refresh current profile\uFF08\u9ED8\u8BA4\u4E14\u63A8\u8350\uFF09
3717
- 2. Switch to the other profile
3718
- 3. Cancel
3733
+ 1. \u5237\u65B0\u5F53\u524D\u914D\u7F6E\uFF08\u9ED8\u8BA4\u4E14\u63A8\u8350\uFF09
3734
+ 2. \u5207\u6362\u5230\u53E6\u4E00\u79CD\u914D\u7F6E
3735
+ 3. \u53D6\u6D88
3719
3736
  \u8BF7\u9009\u62E9 [1]: `
3720
3737
  );
3721
3738
  const choice = menu.trim();
@@ -3763,7 +3780,7 @@ async function runCleanup(options, dependencies) {
3763
3780
  const requestId = uuidV7();
3764
3781
  const dryRun = options.dryRun === true;
3765
3782
  if (options.nonInteractive === true && options.yes !== true && !dryRun) {
3766
- dependencies.stderr("non-interactive cleanup requires --yes\n");
3783
+ dependencies.stderr("\u975E\u4EA4\u4E92\u6A21\u5F0F\u6E05\u7406\u9700\u8981 --yes\n");
3767
3784
  return 2;
3768
3785
  }
3769
3786
  try {
@@ -3791,7 +3808,7 @@ async function runCleanup(options, dependencies) {
3791
3808
  dependencies.stdout(serializeCliResult(output));
3792
3809
  } else {
3793
3810
  dependencies.stdout(
3794
- `Harness cleanup: pruned ${result.pruned_transactions.length} transaction(s), removed ${result.removed_cache.length} cache entr(ies).
3811
+ `Harness \u6E05\u7406\u5B8C\u6210\uFF1A\u5DF2\u88C1\u526A ${result.pruned_transactions.length} \u4E2A\u4E8B\u52A1\uFF0C\u5DF2\u5220\u9664 ${result.removed_cache.length} \u4E2A\u7F13\u5B58\u6761\u76EE\u3002
3795
3812
  `
3796
3813
  );
3797
3814
  }
@@ -3822,7 +3839,7 @@ async function runCleanup(options, dependencies) {
3822
3839
  async function runPush(options, dependencies) {
3823
3840
  const requestId = uuidV7();
3824
3841
  if (options.nonInteractive === true && options.yes !== true && options.dryRun !== true) {
3825
- dependencies.stderr("non-interactive push requires --yes\n");
3842
+ dependencies.stderr("\u975E\u4EA4\u4E92\u6A21\u5F0F\u63A8\u9001\u9700\u8981 --yes\n");
3826
3843
  return 2;
3827
3844
  }
3828
3845
  try {
@@ -3901,7 +3918,7 @@ async function runPush(options, dependencies) {
3901
3918
  async function runUpdate(options, dependencies) {
3902
3919
  const requestId = uuidV7();
3903
3920
  if (options.nonInteractive === true && options.yes !== true && options.dryRun !== true) {
3904
- dependencies.stderr("non-interactive update requires --yes\n");
3921
+ dependencies.stderr("\u975E\u4EA4\u4E92\u6A21\u5F0F\u66F4\u65B0\u9700\u8981 --yes\n");
3905
3922
  return 2;
3906
3923
  }
3907
3924
  const execute = async (dryRun) => updateProject({
@@ -3917,7 +3934,7 @@ async function runUpdate(options, dependencies) {
3917
3934
  if (options.dryRun !== true && options.yes !== true && options.nonInteractive !== true) {
3918
3935
  const preview = await execute(true);
3919
3936
  const answer = await dependencies.prompt(
3920
- "Apply " + preview.applied.length + " eligible update items? [y/N]: "
3937
+ "\u5E94\u7528 " + preview.applied.length + " \u4E2A\u53EF\u66F4\u65B0\u6761\u76EE\uFF1F[y/N]\uFF1A"
3921
3938
  );
3922
3939
  if (!/^(?:y|yes)$/i.test(answer.trim())) {
3923
3940
  return 2;
@@ -3960,7 +3977,7 @@ async function runUpdate(options, dependencies) {
3960
3977
  warnings: result.skipped,
3961
3978
  errors: []
3962
3979
  };
3963
- dependencies.stdout(options.json === true ? serializeCliResult(output) : result.artifactId === null ? "No approved updates are available.\n" : "Update applied " + result.applied.length + " items; skipped " + result.skipped.length + ".\n");
3980
+ dependencies.stdout(options.json === true ? serializeCliResult(output) : result.artifactId === null ? "\u6CA1\u6709\u53EF\u5E94\u7528\u7684\u5DF2\u6279\u51C6\u66F4\u65B0\u3002\n" : "\u66F4\u65B0\u5B8C\u6210\uFF1A\u5DF2\u5E94\u7528 " + result.applied.length + " \u4E2A\u6761\u76EE\uFF0C\u8DF3\u8FC7 " + result.skipped.length + " \u4E2A\u3002\n");
3964
3981
  return exitCode;
3965
3982
  } catch (error) {
3966
3983
  const exitCode = error instanceof UpdateWorkflowError ? error.exitCode : 1;
@@ -4006,16 +4023,16 @@ async function runRecoveryMenuIfApplicable(options, dependencies) {
4006
4023
  const pending = await pendingTransactions(dependencies.cwd);
4007
4024
  if (pending.length > 0) {
4008
4025
  if (options.nonInteractive === true) {
4009
- dependencies.stderr("unfinished transaction requires interactive recovery\n");
4026
+ dependencies.stderr("\u5B58\u5728\u672A\u5B8C\u6210\u4E8B\u52A1\uFF0C\u9700\u8981\u4EE5\u4EA4\u4E92\u6A21\u5F0F\u6062\u590D\u3002\n");
4010
4027
  return 5;
4011
4028
  }
4012
4029
  const answer2 = await dependencies.prompt([
4013
- "Unfinished Hunter Harness transaction detected.",
4014
- "1. Recover last failed update",
4015
- "2. Roll back last committed update",
4016
- "3. View transaction status",
4017
- "4. Clean old transactions",
4018
- "Choose [1-4]: "
4030
+ "\u68C0\u6D4B\u5230\u672A\u5B8C\u6210\u7684 Hunter Harness \u4E8B\u52A1\u3002",
4031
+ "1. \u6062\u590D\u6700\u8FD1\u4E00\u6B21\u5931\u8D25\u7684\u66F4\u65B0",
4032
+ "2. \u56DE\u6EDA\u6700\u8FD1\u4E00\u6B21\u5DF2\u63D0\u4EA4\u7684\u66F4\u65B0",
4033
+ "3. \u67E5\u770B\u4E8B\u52A1\u72B6\u6001",
4034
+ "4. \u6E05\u7406\u65E7\u4E8B\u52A1",
4035
+ "\u8BF7\u9009\u62E9 [1-4]\uFF1A"
4019
4036
  ].join("\n"));
4020
4037
  try {
4021
4038
  if (answer2.trim() === "1") {
@@ -4023,12 +4040,12 @@ async function runRecoveryMenuIfApplicable(options, dependencies) {
4023
4040
  dependencies.cwd,
4024
4041
  pending[0]?.transactionId ?? ""
4025
4042
  );
4026
- dependencies.stdout("Recovery completed: " + result.status + ".\n");
4043
+ dependencies.stdout("\u6062\u590D\u5B8C\u6210\uFF1A" + result.status + "\u3002\n");
4027
4044
  return 0;
4028
4045
  }
4029
4046
  if (answer2.trim() === "2") {
4030
4047
  const result = await rollbackLatestCommittedUpdate(dependencies.cwd);
4031
- dependencies.stdout("Rollback completed: " + result.status + ".\n");
4048
+ dependencies.stdout("\u56DE\u6EDA\u5B8C\u6210\uFF1A" + result.status + "\u3002\n");
4032
4049
  return 0;
4033
4050
  }
4034
4051
  if (answer2.trim() === "3") {
@@ -4041,7 +4058,7 @@ async function runRecoveryMenuIfApplicable(options, dependencies) {
4041
4058
  }
4042
4059
  if (answer2.trim() === "4") {
4043
4060
  const removed = await cleanupOldTransactions(dependencies.cwd);
4044
- dependencies.stdout("Cleaned " + removed.length + " old transactions.\n");
4061
+ dependencies.stdout("\u5DF2\u6E05\u7406 " + removed.length + " \u4E2A\u65E7\u4E8B\u52A1\u3002\n");
4045
4062
  return 0;
4046
4063
  }
4047
4064
  return 2;
@@ -4055,13 +4072,13 @@ async function runRecoveryMenuIfApplicable(options, dependencies) {
4055
4072
  return null;
4056
4073
  }
4057
4074
  const answer = await dependencies.prompt([
4058
- "Hunter Harness project menu.",
4059
- "1. Configure project",
4060
- "2. Roll back last update",
4061
- "3. Clean old transactions",
4062
- "4. View transaction status",
4063
- "5. Exit",
4064
- "Choose [1-5]: "
4075
+ "Hunter Harness \u9879\u76EE\u83DC\u5355\u3002",
4076
+ "1. \u914D\u7F6E\u9879\u76EE",
4077
+ "2. \u56DE\u6EDA\u6700\u8FD1\u4E00\u6B21\u66F4\u65B0",
4078
+ "3. \u6E05\u7406\u65E7\u4E8B\u52A1",
4079
+ "4. \u67E5\u770B\u4E8B\u52A1\u72B6\u6001",
4080
+ "5. \u9000\u51FA",
4081
+ "\u8BF7\u9009\u62E9 [1-5]\uFF1A"
4065
4082
  ].join("\n"));
4066
4083
  try {
4067
4084
  if (answer.trim() === "1") {
@@ -4069,12 +4086,12 @@ async function runRecoveryMenuIfApplicable(options, dependencies) {
4069
4086
  }
4070
4087
  if (answer.trim() === "2") {
4071
4088
  const result = await rollbackLatestCommittedUpdate(dependencies.cwd);
4072
- dependencies.stdout("Rollback completed: " + result.status + ".\n");
4089
+ dependencies.stdout("\u56DE\u6EDA\u5B8C\u6210\uFF1A" + result.status + "\u3002\n");
4073
4090
  return 0;
4074
4091
  }
4075
4092
  if (answer.trim() === "3") {
4076
4093
  const removed = await cleanupOldTransactions(dependencies.cwd);
4077
- dependencies.stdout("Cleaned " + removed.length + " old transactions.\n");
4094
+ dependencies.stdout("\u5DF2\u6E05\u7406 " + removed.length + " \u4E2A\u65E7\u4E8B\u52A1\u3002\n");
4078
4095
  return 0;
4079
4096
  }
4080
4097
  if (answer.trim() === "4") {
@@ -4131,22 +4148,22 @@ async function runCli(argv, overrides = {}) {
4131
4148
  }
4132
4149
  exitCode = await runConfigure(options, dependencies);
4133
4150
  });
4134
- addCommonOptions(program.command("refresh")).description("Local Conservative Refresh of an installed Harness project").option("--profile <name>").option("--force-managed").action(async (options) => {
4151
+ addCommonOptions(program.command("refresh")).description("\u672C\u5730\u4FDD\u5B88\u5237\u65B0\u5DF2\u5B89\u88C5\u7684 Harness \u9879\u76EE").option("--profile <name>").option("--force-managed").action(async (options) => {
4135
4152
  exitCode = await runRefresh(
4136
4153
  { ...program.opts(), ...options },
4137
4154
  dependencies
4138
4155
  );
4139
4156
  });
4140
- addCommonOptions(program.command("update")).description("Apply approved server artifacts").action(async (options) => {
4157
+ addCommonOptions(program.command("update")).description("\u5E94\u7528\u5DF2\u6279\u51C6\u7684\u670D\u52A1\u7AEF\u4EA7\u7269").action(async (options) => {
4141
4158
  exitCode = await runUpdate(
4142
4159
  { ...program.opts(), ...options },
4143
4160
  dependencies
4144
4161
  );
4145
4162
  });
4146
- addCommonOptions(program.command("push")).description("Create a governed proposal").action(async (options) => {
4163
+ addCommonOptions(program.command("push")).description("\u521B\u5EFA\u53D7\u6CBB\u7406\u7684\u53D8\u66F4\u63D0\u6848").action(async (options) => {
4147
4164
  exitCode = await runPush({ ...program.opts(), ...options }, dependencies);
4148
4165
  });
4149
- addCommonOptions(program.command("cleanup")).description("Prune completed transactions and obsolete server cache").action(async (options) => {
4166
+ addCommonOptions(program.command("cleanup")).description("\u6E05\u7406\u5DF2\u5B8C\u6210\u4E8B\u52A1\u548C\u8FC7\u671F\u670D\u52A1\u7AEF\u7F13\u5B58").action(async (options) => {
4150
4167
  exitCode = await runCleanup(
4151
4168
  { ...program.opts(), ...options },
4152
4169
  dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hunter-harness",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local-first, server-governed agent harness",
5
5
  "license": "MIT",
6
6
  "type": "module",