Skip to content

Commit 0805ec2

Browse files
authored
Merge pull request #134 from auths-dev/dev-initRepoAutomation
refactor: make init simpler by auto populating .auths/ in repo and removing registration as default
2 parents 3a3f71f + 2469d7a commit 0805ec2

15 files changed

Lines changed: 43 additions & 88 deletions

File tree

.github/workflows/publish-node.yml

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -119,48 +119,9 @@ jobs:
119119
working-directory: packages/auths-node
120120
run: pnpm test
121121

122-
universal-macos:
123-
name: Universal macOS binary
124-
needs: [build]
125-
runs-on: macos-latest
126-
steps:
127-
- uses: actions/checkout@v4
128-
129-
- uses: actions/setup-node@v4
130-
with:
131-
node-version: 22
132-
133-
- name: Install pnpm
134-
run: npm install -g pnpm
135-
136-
- name: Install dependencies
137-
working-directory: packages/auths-node
138-
run: pnpm install
139-
140-
- uses: actions/download-artifact@v4
141-
with:
142-
name: bindings-aarch64-apple-darwin
143-
path: packages/auths-node/artifacts
144-
145-
- uses: actions/download-artifact@v4
146-
with:
147-
name: bindings-x86_64-apple-darwin
148-
path: packages/auths-node/artifacts
149-
150-
- name: Build universal binary
151-
working-directory: packages/auths-node
152-
run: |
153-
pnpm artifacts
154-
pnpm universal
155-
156-
- uses: actions/upload-artifact@v4
157-
with:
158-
name: bindings-universal-apple-darwin
159-
path: packages/auths-node/auths.darwin-universal.node
160-
161122
publish:
162123
name: Publish to npm
163-
needs: [build, test, universal-macos]
124+
needs: [build, test]
164125
runs-on: ubuntu-latest
165126
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'npm')
166127
permissions:

crates/auths-cli/src/commands/init/gather.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub(crate) fn gather_developer_config(
4343
.with_conflict_policy(conflict_policy)
4444
.with_git_signing_scope(git_scope);
4545

46-
if !cmd.skip_registration {
46+
if cmd.register {
4747
builder = builder.with_registration(&cmd.registry);
4848
}
4949

@@ -134,7 +134,7 @@ pub(crate) fn submit_registration(
134134
out: &Output,
135135
) -> Option<String> {
136136
if skip {
137-
out.print_info("Registration skipped (--skip-registration)");
137+
out.print_info("Registration skipped (pass --register to publish to the registry)");
138138
return None;
139139
}
140140

crates/auths-cli/src/commands/init/mod.rs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mod prompts;
1212
use anyhow::{Result, anyhow};
1313
use clap::{Args, ValueEnum};
1414
use std::io::IsTerminal;
15+
use std::path::PathBuf;
1516
use std::sync::Arc;
1617

1718
use auths_core::PrefilledPassphraseProvider;
@@ -29,6 +30,7 @@ use crate::config::CliConfig;
2930
use crate::factories::storage::build_auths_context;
3031
use crate::ux::format::Output;
3132

33+
use super::signers::{SignersSyncArgs, handle_sync};
3234
use display::{
3335
display_agent_dry_run, display_agent_result, display_ci_result, display_developer_result,
3436
};
@@ -118,13 +120,13 @@ pub struct InitCommand {
118120
#[clap(long)]
119121
pub dry_run: bool,
120122

121-
/// Registry URL for automatic identity registration
123+
/// Registry URL for identity registration
122124
#[clap(long, default_value = DEFAULT_REGISTRY_URL)]
123125
pub registry: String,
124126

125-
/// Skip automatic registry registration during setup
127+
/// Register identity with the Auths Registry after creation
126128
#[clap(long)]
127-
pub skip_registration: bool,
129+
pub register: bool,
128130

129131
/// Scaffold a GitHub Actions workflow using the auths attest-action
130132
#[clap(long)]
@@ -240,7 +242,7 @@ fn run_developer_setup(
240242

241243
// PLATFORM VERIFICATION
242244
guide.section("Platform Verification");
243-
let proof_url = if interactive && !cmd.skip_registration {
245+
let proof_url = if interactive && cmd.register {
244246
out.print_info("Claim your Developer Passport");
245247
out.newline();
246248
match prompt_platform_verification(
@@ -267,13 +269,28 @@ fn run_developer_setup(
267269
offer_shell_completions(interactive, out)?;
268270
write_allowed_signers(&result.key_alias, out)?;
269271

272+
// Also write repo-local .auths/allowed_signers if we're inside a git repo,
273+
// so `auths verify` works immediately without extra flags.
274+
if let Ok(output) = std::process::Command::new("git")
275+
.args(["rev-parse", "--show-toplevel"])
276+
.output()
277+
&& output.status.success()
278+
{
279+
let root = PathBuf::from(String::from_utf8_lossy(&output.stdout).trim());
280+
let repo_signers = root.join(".auths").join("allowed_signers");
281+
let _ = handle_sync(&SignersSyncArgs {
282+
repo: "~/.auths".into(),
283+
output_file: Some(repo_signers),
284+
});
285+
}
286+
270287
// REGISTRATION & DISPLAY
271288
guide.section("Registration & Summary");
272289
let registered = submit_registration(
273290
&get_auths_repo_path()?,
274291
&cmd.registry,
275292
proof_url,
276-
cmd.skip_registration,
293+
!cmd.register, // skip unless --register is explicitly passed
277294
out,
278295
);
279296
display_developer_result(out, &result, registered.as_deref());
@@ -390,7 +407,7 @@ mod tests {
390407
force: false,
391408
dry_run: false,
392409
registry: DEFAULT_REGISTRY_URL.to_string(),
393-
skip_registration: false,
410+
register: false,
394411
github_action: false,
395412
};
396413
assert!(!cmd.interactive);
@@ -400,7 +417,7 @@ mod tests {
400417
assert!(!cmd.force);
401418
assert!(!cmd.dry_run);
402419
assert_eq!(cmd.registry, "https://auths-registry.fly.dev");
403-
assert!(!cmd.skip_registration);
420+
assert!(!cmd.register);
404421
assert!(!cmd.github_action);
405422
}
406423

@@ -414,7 +431,7 @@ mod tests {
414431
force: true,
415432
dry_run: false,
416433
registry: DEFAULT_REGISTRY_URL.to_string(),
417-
skip_registration: false,
434+
register: false,
418435
github_action: false,
419436
};
420437
assert!(cmd.non_interactive);
@@ -446,7 +463,7 @@ mod tests {
446463
force: false,
447464
dry_run: false,
448465
registry: DEFAULT_REGISTRY_URL.to_string(),
449-
skip_registration: false,
466+
register: false,
450467
github_action: false,
451468
};
452469
assert!(!resolve_interactive(&cmd).unwrap());
@@ -462,7 +479,7 @@ mod tests {
462479
force: false,
463480
dry_run: false,
464481
registry: DEFAULT_REGISTRY_URL.to_string(),
465-
skip_registration: false,
482+
register: false,
466483
github_action: false,
467484
};
468485
// Auto-detect returns is_terminal() — result depends on environment

crates/auths-cli/src/commands/signers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ fn handle_remove(args: &SignersRemoveArgs) -> Result<()> {
208208
Ok(())
209209
}
210210

211-
fn handle_sync(args: &SignersSyncArgs) -> Result<()> {
211+
pub(crate) fn handle_sync(args: &SignersSyncArgs) -> Result<()> {
212212
let repo_path = expand_tilde(&args.repo)?;
213213
let storage = RegistryAttestationStorage::new(&repo_path);
214214

crates/auths-cli/tests/cases/helpers.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,7 @@ impl TestEnv {
9494
pub fn init_identity(&self) {
9595
let output = self
9696
.cmd("auths")
97-
.args([
98-
"init",
99-
"--non-interactive",
100-
"--profile",
101-
"developer",
102-
"--skip-registration",
103-
])
97+
.args(["init", "--non-interactive", "--profile", "developer"])
10498
.output()
10599
.unwrap();
106100
assert!(

crates/auths-cli/tests/cases/init.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,7 @@ fn test_init_happy_path() {
7878

7979
let output = env
8080
.cmd("auths")
81-
.args([
82-
"init",
83-
"--non-interactive",
84-
"--profile",
85-
"developer",
86-
"--skip-registration",
87-
])
81+
.args(["init", "--non-interactive", "--profile", "developer"])
8882
.output()
8983
.unwrap();
9084

crates/auths-cli/tests/cases/revocation.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ fn test_emergency_revoke_device() {
1919
// Run init and capture device DID from output
2020
let init_output = env
2121
.cmd("auths")
22-
.args([
23-
"init",
24-
"--non-interactive",
25-
"--profile",
26-
"developer",
27-
"--skip-registration",
28-
])
22+
.args(["init", "--non-interactive", "--profile", "developer"])
2923
.output()
3024
.unwrap();
3125
assert!(init_output.status.success());

docs/cli/commands/primary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Set up your cryptographic identity and Git signing
1818
| `--force` || Force overwrite if identity already exists |
1919
| `--dry-run` || Preview agent configuration without creating files or identities |
2020
| `--registry <REGISTRY>` | `https://auths-registry.fly.dev` | Registry URL for automatic identity registration |
21-
| `--skip-registration` || Skip automatic registry registration during setup |
21+
| `--register` || Register identity with the Auths Registry after creation |
2222
| `--json` || Emit machine-readable JSON |
2323
| `-q, --quiet` || Suppress non-essential output |
2424
| `--repo <REPO>` || Override the local storage directory (default: ~/.auths) |

docs/guides/identity/profiles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ auths init --profile developer --non-interactive --key-alias my-key
5252
| `--force` | `false` | Overwrite existing identity |
5353
| `--non-interactive` | `false` | Skip all prompts, use defaults |
5454
| `--registry` | `https://auths-registry.fly.dev` | Registry URL for identity registration |
55-
| `--skip-registration` | `false` | Skip automatic registry registration |
55+
| `--register` | `false` | Register identity with the Auths Registry |
5656

5757
### CI profile
5858

packages/auths-mobile-swift/build-xcframework.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fi
2121
echo "Checking Rust targets..."
2222
TARGETS=(
2323
"aarch64-apple-darwin" # macOS Apple Silicon
24-
"x86_64-apple-darwin" # macOS Intel
2524
"aarch64-apple-ios" # iOS device
2625
"aarch64-apple-ios-sim" # iOS Simulator (Apple Silicon)
2726
"x86_64-apple-ios" # iOS Simulator (Intel)

0 commit comments

Comments
 (0)