@stream44.studio/t44-blockchaincommons.com 0.1.0-rc.7 → 0.1.0-rc.9

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/bin/oi +20 -4
  2. package/package.json +3 -3
package/bin/oi CHANGED
@@ -42,6 +42,19 @@ async function bootCapsule() {
42
42
  return { spine, run }
43
43
  }
44
44
 
45
+ async function getGitConfig(key: string, cwd: string): Promise<string | undefined> {
46
+ try {
47
+ const proc = Bun.spawn(['git', 'config', '--get', key], { cwd, stdout: 'pipe', stderr: 'pipe' })
48
+ const stdout = await new Response(proc.stdout).text()
49
+ const exitCode = await proc.exited
50
+ if (exitCode !== 0) return undefined
51
+ const value = stdout.trim()
52
+ return value || undefined
53
+ } catch {
54
+ return undefined
55
+ }
56
+ }
57
+
45
58
  function validateSystem(system: string) {
46
59
  if (!SUPPORTED_SYSTEMS.includes(system)) {
47
60
  console.error(chalk.red(`Unsupported system: ${system}`))
@@ -60,14 +73,17 @@ program
60
73
  .description('Initialize a Gordian Open Integrity repository in the current directory')
61
74
  .argument('[system]', `Integrity system to initialize (${SUPPORTED_SYSTEMS.join(', ')})`, 'GordianOpenIntegrity')
62
75
  .requiredOption('--inception-key <path>', 'Path to the SSH private key for inception signing')
63
- .option('--author-name <name>', 'Author name for git commits', 'Author')
64
- .option('--author-email <email>', 'Author email for git commits', 'author@example.com')
76
+ .option('--author-name <name>', 'Author name for git commits')
77
+ .option('--author-email <email>', 'Author email for git commits')
65
78
  .action(async (system, opts) => {
66
79
  validateSystem(system)
67
80
 
68
81
  const repoDir = resolve(process.cwd())
69
82
  const inceptionKeyPath = resolve(opts.inceptionKey)
70
83
 
84
+ const authorName = opts.authorName || await getGitConfig('user.name', repoDir) || 'Author'
85
+ const authorEmail = opts.authorEmail || await getGitConfig('user.email', repoDir) || 'author@example.com'
86
+
71
87
  const { spine, run } = await bootCapsule()
72
88
 
73
89
  await run({}, async ({ apis }) => {
@@ -76,8 +92,8 @@ program
76
92
  console.log(chalk.blue('Creating identity...'))
77
93
  const author = await oi.createIdentity({
78
94
  privateKeyPath: inceptionKeyPath,
79
- authorName: opts.authorName,
80
- authorEmail: opts.authorEmail,
95
+ authorName,
96
+ authorEmail,
81
97
  })
82
98
 
83
99
  console.log(chalk.blue('Creating repository...'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream44.studio/t44-blockchaincommons.com",
3
- "version": "0.1.0-rc.7",
3
+ "version": "0.1.0-rc.9",
4
4
  "private": false,
5
5
  "license": "BSD-2-Clause-Patent",
6
6
  "type": "module",
@@ -28,8 +28,8 @@
28
28
  "@bcts/lifehash": "^1.0.0-alpha.20",
29
29
  "commander": "^14.0.0",
30
30
  "chalk": "^5.6.2",
31
- "t44": "^0.4.0-rc.6",
32
- "@stream44.studio/encapsulate": "^0.4.0-rc.7"
31
+ "t44": "^0.4.0-rc.7",
32
+ "@stream44.studio/encapsulate": "^0.4.0-rc.8"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/bun": "^1.3.4",