@h-rig/cli 0.0.6-alpha.90 → 0.0.6-alpha.91

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 (118) hide show
  1. package/README.md +18 -19
  2. package/dist/bin/build-rig-binaries.js +22 -10
  3. package/dist/bin/rig.d.ts +71 -1
  4. package/dist/bin/rig.js +15078 -11169
  5. package/dist/config/rig-default-config.yml +5 -0
  6. package/dist/src/app/drone-ui.d.ts +11 -14
  7. package/dist/src/app/drone-ui.js +70 -86
  8. package/dist/src/commands/_async-ui.d.ts +1 -4
  9. package/dist/src/commands/_async-ui.js +9 -111
  10. package/dist/src/commands/_cli-format.d.ts +16 -9
  11. package/dist/src/commands/_cli-format.js +167 -295
  12. package/dist/src/commands/_connection-state.d.ts +11 -1
  13. package/dist/src/commands/_connection-state.js +50 -5
  14. package/dist/src/commands/_doctor-checks.d.ts +0 -6
  15. package/dist/src/commands/_doctor-checks.js +79 -382
  16. package/dist/src/commands/_help-catalog.d.ts +1 -1
  17. package/dist/src/commands/_help-catalog.js +217 -157
  18. package/dist/src/commands/_inprocess-services.d.ts +33 -0
  19. package/dist/src/commands/_inprocess-services.js +102 -0
  20. package/dist/src/commands/_json-output.js +4 -0
  21. package/dist/src/commands/_lazy-reconcile.d.ts +34 -0
  22. package/dist/src/commands/_lazy-reconcile.js +102 -0
  23. package/dist/src/commands/_paths.js +1 -1
  24. package/dist/src/commands/_pi-frontend.d.ts +18 -10
  25. package/dist/src/commands/_pi-frontend.js +37 -715
  26. package/dist/src/commands/_pi-install.js +18 -36
  27. package/dist/src/commands/_policy.d.ts +1 -1
  28. package/dist/src/commands/_policy.js +56 -15
  29. package/dist/src/commands/_run-bridge.d.ts +114 -0
  30. package/dist/src/commands/_run-bridge.js +387 -0
  31. package/dist/src/commands/_run-diagnostics.d.ts +9 -0
  32. package/dist/src/commands/_run-diagnostics.js +51 -0
  33. package/dist/src/commands/_run-driver-helpers.d.ts +8 -81
  34. package/dist/src/commands/_run-driver-helpers.js +79 -283
  35. package/dist/src/commands/_run-projection.d.ts +50 -0
  36. package/dist/src/commands/_run-projection.js +349 -0
  37. package/dist/src/commands/_run-subcommands.d.ts +3 -0
  38. package/dist/src/commands/_run-subcommands.js +31 -0
  39. package/dist/src/commands/_spinner.js +1 -1
  40. package/dist/src/commands/agent.d.ts +1 -1
  41. package/dist/src/commands/agent.js +8559 -239
  42. package/dist/src/commands/dist.d.ts +1 -1
  43. package/dist/src/commands/dist.js +27 -19
  44. package/dist/src/commands/doctor.d.ts +1 -1
  45. package/dist/src/commands/doctor.js +93 -475
  46. package/dist/src/commands/github.d.ts +1 -1
  47. package/dist/src/commands/github.js +113 -387
  48. package/dist/src/commands/inbox.d.ts +22 -24
  49. package/dist/src/commands/inbox.js +420 -691
  50. package/dist/src/commands/init.d.ts +6 -16
  51. package/dist/src/commands/init.js +334 -971
  52. package/dist/src/commands/inspect.d.ts +19 -2
  53. package/dist/src/commands/inspect.js +644 -610
  54. package/dist/src/commands/pi.d.ts +1 -1
  55. package/dist/src/commands/plugin.d.ts +1 -1
  56. package/dist/src/commands/plugin.js +486 -7
  57. package/dist/src/commands/profile-and-review.d.ts +1 -1
  58. package/dist/src/commands/profile-and-review.js +94 -56
  59. package/dist/src/commands/queue.js +1 -21
  60. package/dist/src/commands/remote.d.ts +1 -1
  61. package/dist/src/commands/remote.js +837 -14
  62. package/dist/src/commands/repo-git-harness.d.ts +1 -1
  63. package/dist/src/commands/repo-git-harness.js +57 -14
  64. package/dist/src/commands/run.d.ts +20 -2
  65. package/dist/src/commands/run.js +17579 -1759
  66. package/dist/src/commands/server.d.ts +2 -6
  67. package/dist/src/commands/server.js +141 -723
  68. package/dist/src/commands/setup.d.ts +1 -1
  69. package/dist/src/commands/setup.js +102 -484
  70. package/dist/src/commands/stats.d.ts +13 -10
  71. package/dist/src/commands/stats.js +689 -761
  72. package/dist/src/commands/task-run-driver.d.ts +50 -88
  73. package/dist/src/commands/task-run-driver.js +116 -2717
  74. package/dist/src/commands/task.d.ts +34 -13
  75. package/dist/src/commands/task.js +668 -2523
  76. package/dist/src/commands/test.d.ts +1 -1
  77. package/dist/src/commands/triage.d.ts +11 -0
  78. package/dist/src/commands/triage.js +227 -0
  79. package/dist/src/commands/workspace.d.ts +1 -1
  80. package/dist/src/commands.d.ts +0 -16
  81. package/dist/src/commands.js +16657 -12250
  82. package/dist/src/index.js +16528 -12497
  83. package/dist/src/launcher.js +4 -0
  84. package/dist/src/operator-cli.d.ts +2 -0
  85. package/dist/src/operator-cli.js +17837 -0
  86. package/dist/src/operator-entry.d.ts +1 -0
  87. package/dist/src/operator-entry.js +3 -0
  88. package/package.json +18 -12
  89. package/dist/src/app/board.d.ts +0 -23
  90. package/dist/src/app/board.js +0 -1786
  91. package/dist/src/app/theme.d.ts +0 -47
  92. package/dist/src/app/theme.js +0 -150
  93. package/dist/src/commands/_authority-runs.d.ts +0 -22
  94. package/dist/src/commands/_authority-runs.js +0 -110
  95. package/dist/src/commands/_operator-surface.d.ts +0 -34
  96. package/dist/src/commands/_operator-surface.js +0 -220
  97. package/dist/src/commands/_operator-view.d.ts +0 -30
  98. package/dist/src/commands/_operator-view.js +0 -1070
  99. package/dist/src/commands/_preflight.d.ts +0 -22
  100. package/dist/src/commands/_preflight.js +0 -540
  101. package/dist/src/commands/_run-replay.d.ts +0 -24
  102. package/dist/src/commands/_run-replay.js +0 -142
  103. package/dist/src/commands/_server-client.d.ts +0 -186
  104. package/dist/src/commands/_server-client.js +0 -681
  105. package/dist/src/commands/_snapshot-upload.d.ts +0 -39
  106. package/dist/src/commands/_snapshot-upload.js +0 -455
  107. package/dist/src/commands/_task-picker.d.ts +0 -9
  108. package/dist/src/commands/_task-picker.js +0 -201
  109. package/dist/src/commands/browser.d.ts +0 -65
  110. package/dist/src/commands/browser.js +0 -1173
  111. package/dist/src/commands/connect.d.ts +0 -7
  112. package/dist/src/commands/connect.js +0 -419
  113. package/dist/src/commands/inspector.d.ts +0 -3
  114. package/dist/src/commands/inspector.js +0 -263
  115. package/dist/src/commands/task-report-bug.d.ts +0 -19
  116. package/dist/src/commands/task-report-bug.js +0 -1281
  117. package/dist/src/report-bug.d.ts +0 -44
  118. package/dist/src/report-bug.js +0 -260
@@ -100,12 +100,28 @@ function readRepoConnection(projectRoot) {
100
100
  selected,
101
101
  project: typeof record.project === "string" ? record.project : undefined,
102
102
  linkedAt: typeof record.linkedAt === "string" ? record.linkedAt : undefined,
103
- serverProjectRoot: typeof record.serverProjectRoot === "string" && record.serverProjectRoot.trim() ? record.serverProjectRoot.trim() : undefined
103
+ serverProjectRoot: typeof record.serverProjectRoot === "string" && record.serverProjectRoot.trim() ? record.serverProjectRoot.trim() : undefined,
104
+ serverProjectRootAlias: typeof record.serverProjectRootAlias === "string" && record.serverProjectRootAlias.trim() ? record.serverProjectRootAlias.trim() : undefined,
105
+ serverProjectRootBaseUrl: typeof record.serverProjectRootBaseUrl === "string" && record.serverProjectRootBaseUrl.trim() ? record.serverProjectRootBaseUrl.trim().replace(/\/+$/, "") : undefined
104
106
  };
105
107
  }
106
108
  function writeRepoConnection(projectRoot, state) {
107
109
  writeJsonFile(resolveRepoConnectionPath(projectRoot), state);
108
110
  }
111
+ function rootAllowedForSelection(repo, connection) {
112
+ const root = repo.serverProjectRoot?.trim();
113
+ if (!root)
114
+ return;
115
+ if (connection.kind === "remote") {
116
+ if (repo.serverProjectRootAlias !== repo.selected)
117
+ return;
118
+ if (repo.serverProjectRootBaseUrl !== connection.baseUrl)
119
+ return;
120
+ } else if (repo.serverProjectRootAlias && repo.serverProjectRootAlias !== repo.selected) {
121
+ return;
122
+ }
123
+ return root;
124
+ }
109
125
  function resolveSelectedConnection(projectRoot, options = {}) {
110
126
  const repo = readRepoConnection(projectRoot);
111
127
  if (!repo)
@@ -117,13 +133,41 @@ function resolveSelectedConnection(projectRoot, options = {}) {
117
133
  if (!connection) {
118
134
  throw new CliError(`Selected Rig server "${repo.selected}" was not found. Run \`rig server list\` or \`rig server use local\`.`, 1);
119
135
  }
120
- return { alias: repo.selected, connection, serverProjectRoot: repo.serverProjectRoot };
136
+ return { alias: repo.selected, connection, serverProjectRoot: rootAllowedForSelection(repo, connection) };
137
+ }
138
+ function writeRepoServerProjectRoot(projectRoot, serverProjectRoot, metadata = {}) {
139
+ const repo = readRepoConnection(projectRoot);
140
+ if (!repo)
141
+ return;
142
+ let inferred = metadata;
143
+ if (!inferred.alias || !inferred.baseUrl) {
144
+ try {
145
+ const selected = resolveSelectedConnection(projectRoot);
146
+ if (selected?.connection.kind === "remote") {
147
+ inferred = {
148
+ alias: inferred.alias ?? selected.alias,
149
+ baseUrl: inferred.baseUrl ?? selected.connection.baseUrl
150
+ };
151
+ }
152
+ } catch {}
153
+ }
154
+ writeRepoConnection(projectRoot, {
155
+ ...repo,
156
+ ...metadata.project ? { project: metadata.project } : {},
157
+ serverProjectRoot,
158
+ ...inferred.alias ? { serverProjectRootAlias: inferred.alias } : {},
159
+ ...inferred.baseUrl ? { serverProjectRootBaseUrl: inferred.baseUrl.replace(/\/+$/, "") } : {}
160
+ });
121
161
  }
122
- function writeRepoServerProjectRoot(projectRoot, serverProjectRoot) {
162
+ function clearRepoServerProjectRoot(projectRoot) {
123
163
  const repo = readRepoConnection(projectRoot);
124
164
  if (!repo)
125
165
  return;
126
- writeRepoConnection(projectRoot, { ...repo, serverProjectRoot });
166
+ writeRepoConnection(projectRoot, {
167
+ selected: repo.selected,
168
+ ...repo.project ? { project: repo.project } : {},
169
+ ...repo.linkedAt ? { linkedAt: repo.linkedAt } : {}
170
+ });
127
171
  }
128
172
  function isRemoteConnectionSelected(projectRoot) {
129
173
  return resolveSelectedConnection(projectRoot)?.connection.kind === "remote";
@@ -138,5 +182,6 @@ export {
138
182
  resolveGlobalConnectionsPath,
139
183
  readRepoConnection,
140
184
  readGlobalConnections,
141
- isRemoteConnectionSelected
185
+ isRemoteConnectionSelected,
186
+ clearRepoServerProjectRoot
142
187
  };
@@ -29,14 +29,8 @@ export type RigDoctorCheck = {
29
29
  readonly detail?: string;
30
30
  readonly remediation?: string;
31
31
  };
32
- export type RigDoctorServer = {
33
- readonly baseUrl: string;
34
- readonly authToken: string | null;
35
- readonly connectionKind: "local" | "remote";
36
- };
37
32
  export type RunRigDoctorChecksOptions = {
38
33
  readonly projectRoot: string;
39
- readonly resolveServer?: (projectRoot: string) => Promise<RigDoctorServer>;
40
34
  readonly requestJson?: (pathname: string, init?: RequestInit) => Promise<unknown>;
41
35
  readonly piChecks?: () => Promise<readonly PiInstallCheck[]>;
42
36
  readonly which?: (binary: string) => string | null;