create-agent 0.0.15 → 0.0.17

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.
@@ -14,11 +14,13 @@ function isGitRepo() {
14
14
  }
15
15
  }
16
16
 
17
- // Check if privkey already exists
18
- function hasPrivkey() {
17
+ // Check if agent identity already exists in THIS repo (not inherited from parent)
18
+ function hasIdentity() {
19
19
  try {
20
- const result = execSync('git config nostr.privkey', { encoding: 'utf8' }).trim()
21
- return result.length > 0
20
+ const result = execSync('git config --local nostr.privkey', { encoding: 'utf8' }).trim()
21
+ const hasLocalPrivkey = result.length > 0
22
+ const hasDIDFile = fs.existsSync('agent.did.json')
23
+ return hasLocalPrivkey && hasDIDFile
22
24
  } catch {
23
25
  return false
24
26
  }
@@ -26,12 +28,11 @@ function hasPrivkey() {
26
28
 
27
29
  // Main
28
30
  if (!isGitRepo()) {
29
- console.error('\x1b[31mError: Not in a git repository.\x1b[0m')
30
- console.error('Run \x1b[33mgit init\x1b[0m first.')
31
- process.exit(1)
31
+ console.error('\x1b[36mInitializing git repository...\x1b[0m')
32
+ execSync('git init', { stdio: 'inherit' })
32
33
  }
33
34
 
34
- if (hasPrivkey()) {
35
+ if (hasIdentity()) {
35
36
  console.error('\x1b[33mAgent identity already exists.\x1b[0m')
36
37
  console.error('Privkey found in: git config nostr.privkey')
37
38
  console.error('To regenerate, first run: git config --unset nostr.privkey')
package/index.html CHANGED
@@ -11,11 +11,13 @@
11
11
  <meta property="og:url" content="https://init-agent.com/">
12
12
  <meta property="og:title" content="npm init agent - Identity for AI Agents">
13
13
  <meta property="og:description" content="Give your AI agent an identity. Generate cryptographic keys with did:nostr in one command.">
14
+ <meta property="og:image" content="https://init-agent.com/og-image.png">
14
15
 
15
16
  <!-- Twitter -->
16
17
  <meta name="twitter:card" content="summary_large_image">
17
18
  <meta name="twitter:title" content="npm init agent - Identity for AI Agents">
18
19
  <meta name="twitter:description" content="Give your AI agent an identity. Generate cryptographic keys with did:nostr in one command.">
20
+ <meta name="twitter:image" content="https://init-agent.com/og-image.png">
19
21
 
20
22
  <link rel="preconnect" href="https://fonts.googleapis.com">
21
23
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
package/og-image.png ADDED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-agent",
3
3
  "type": "module",
4
- "version": "0.0.15",
4
+ "version": "0.0.17",
5
5
  "description": "create an agent",
6
6
  "scripts": {
7
7
  "test": "node --test"