chipfoundry-cli 2.3.12__tar.gz → 2.3.14__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chipfoundry-cli
3
- Version: 2.3.12
3
+ Version: 2.3.14
4
4
  Summary: CLI tool to automate ChipFoundry project submission to SFTP server
5
5
  Home-page: https://chipfoundry.io
6
6
  License: Apache-2.0
@@ -176,21 +176,40 @@ def main():
176
176
 
177
177
  @main.command('config')
178
178
  def config_cmd():
179
- """Configure user-level SFTP credentials (username and key)."""
180
- console.print("[bold cyan]ChipFoundry CLI User Configuration[/bold cyan]")
181
- username = console.input("Enter your ChipFoundry SFTP username: ").strip()
182
- key_path = console.input("Enter path to your SFTP private key (leave blank for ~/.ssh/chipfoundry-key): ").strip()
179
+ """Configure a custom SSH private key path for SFTP access."""
180
+ console.print("[bold cyan]ChipFoundry CLI Configuration[/bold cyan]")
181
+ key_path = console.input("Enter path to your SSH private key (leave blank for ~/.ssh/chipfoundry-key): ").strip()
183
182
  if not key_path:
184
183
  key_path = os.path.expanduser('~/.ssh/chipfoundry-key')
185
184
  else:
186
185
  key_path = os.path.abspath(os.path.expanduser(key_path))
187
- config = {
188
- "sftp_username": username,
189
- "sftp_key": key_path,
190
- }
186
+ config = load_user_config()
187
+ config["sftp_key"] = key_path
191
188
  save_user_config(config)
192
189
  console.print(f"[green]Configuration saved to {get_config_path()}[/green]")
193
190
 
191
+ def _try_register_ssh_key(public_key: str) -> bool:
192
+ """Attempt to register the SSH public key on the user's platform profile.
193
+
194
+ Returns True if the key was registered successfully, False otherwise.
195
+ """
196
+ config = load_user_config()
197
+ if not config.get("api_key"):
198
+ return False
199
+ try:
200
+ _api_put("/users/me", {"ssh_public_key": public_key})
201
+ return True
202
+ except SystemExit:
203
+ return False
204
+
205
+
206
+ def _print_manual_key_instructions():
207
+ """Print fallback instructions when auto-registration is not available."""
208
+ console.print("[bold cyan]To register this key:[/bold cyan]")
209
+ console.print(" Run [bold]cf login[/bold] first, then [bold]cf keygen --overwrite[/bold] to auto-register.")
210
+ console.print(" Or paste the public key at [bold]https://platform.chipfoundry.io/ssh-key[/bold]")
211
+
212
+
194
213
  @main.command('keygen')
195
214
  @click.option('--overwrite', is_flag=True, help='Overwrite existing key if it already exists.')
196
215
  def keygen(overwrite):
@@ -211,11 +230,10 @@ def keygen(overwrite):
211
230
  public_key = f.read().strip()
212
231
  print(f"{public_key}", end="")
213
232
  print("")
214
- console.print("[bold cyan]Next steps:[/bold cyan]")
215
- console.print("1. Copy the public key above")
216
- console.print("2. Submit it to the registration form at: https://chipfoundry.io/sftp-registration")
217
- console.print("3. Wait for account approval")
218
- console.print("4. Use 'cf config' to configure your SFTP credentials")
233
+ if _try_register_ssh_key(public_key):
234
+ console.print("[green]✓ Key registered on your ChipFoundry profile. SFTP access is ready.[/green]")
235
+ else:
236
+ _print_manual_key_instructions()
219
237
  return
220
238
  else:
221
239
  console.print(f"[yellow]Overwriting existing key at {private_key_path}[/yellow]")
@@ -229,7 +247,6 @@ def keygen(overwrite):
229
247
  console.print("[cyan]Generating new RSA SSH key for ChipFoundry...[/cyan]")
230
248
 
231
249
  try:
232
- # Use ssh-keygen to generate the key
233
250
  cmd = [
234
251
  'ssh-keygen',
235
252
  '-t', 'rsa',
@@ -256,12 +273,10 @@ def keygen(overwrite):
256
273
  print(f"{public_key}", end="")
257
274
  print("")
258
275
 
259
- # Display instructions
260
- console.print("[bold cyan]Next steps:[/bold cyan]")
261
- console.print("1. Copy the public key above")
262
- console.print("2. Submit it to the registration form at: https://chipfoundry.io/sftp-registration")
263
- console.print("3. Wait for account approval")
264
- console.print("4. Use 'cf config' to configure your SFTP credentials")
276
+ if _try_register_ssh_key(public_key):
277
+ console.print("[green] Key registered on your ChipFoundry profile. SFTP access is ready.[/green]")
278
+ else:
279
+ _print_manual_key_instructions()
265
280
 
266
281
  except subprocess.CalledProcessError as e:
267
282
  console.print(f"[red]Failed to generate SSH key: {e}[/red]")
@@ -289,11 +304,7 @@ def keyview():
289
304
  public_key = f.read().strip()
290
305
  print(f"{public_key}")
291
306
  print("")
292
- console.print("[bold cyan]Next steps:[/bold cyan]")
293
- console.print("1. Copy the public key above")
294
- console.print("2. Submit it to the registration form at: https://chipfoundry.io/sftp-registration")
295
- console.print("3. Wait for account approval")
296
- console.print("4. Use 'cf config' to configure your SFTP credentials")
307
+ _print_manual_key_instructions()
297
308
 
298
309
  @main.command('init')
299
310
  @click.option('--project-root', required=False, type=click.Path(file_okay=False), help='Directory to create the project in (defaults to current directory).')
@@ -3278,7 +3289,7 @@ def _upload_precheck_results(project_json_path: Path):
3278
3289
  @click.option('--magic-drc', is_flag=True, help='Include Magic DRC check (optional, off by default)')
3279
3290
  @click.option('--checks', multiple=True, help='Specific checks to run (can be specified multiple times)')
3280
3291
  @click.option('--dry-run', is_flag=True, help='Show the command without running')
3281
- @click.option('--remote', is_flag=True, help='Queue precheck on the chipIgnite platform (requires cf login + linked project)')
3292
+ @click.option('--remote', is_flag=True, help='Queue precheck on the ChipFoundry platform (requires cf login + linked project)')
3282
3293
  @click.option(
3283
3294
  '--poll',
3284
3295
  is_flag=True,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "chipfoundry-cli"
3
- version = "2.3.12"
3
+ version = "2.3.14"
4
4
  description = "CLI tool to automate ChipFoundry project submission to SFTP server"
5
5
  authors = ["ChipFoundry <marwan.abbas@chipfoundry.io>"]
6
6
  readme = "README.md"