create-agit 0.1.1 → 0.1.2

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.mjs +8 -24
  2. package/package.json +2 -2
package/bin.mjs CHANGED
@@ -13,9 +13,9 @@
13
13
  */
14
14
 
15
15
  import { createRequire } from 'node:module'
16
- import { chmodSync, copyFileSync, existsSync, mkdirSync } from 'node:fs'
17
- import { homedir, platform, arch, tmpdir } from 'node:os'
18
- import { join } from 'node:path'
16
+ import { chmodSync, copyFileSync, mkdirSync } from 'node:fs'
17
+ import { homedir, platform, arch } from 'node:os'
18
+ import { join, delimiter } from 'node:path'
19
19
  import { spawnSync } from 'node:child_process'
20
20
 
21
21
  const require = createRequire(import.meta.url)
@@ -25,23 +25,7 @@ function dim(m) { console.log(`\x1b[2m${m}\x1b[0m`) }
25
25
  function ok(m) { console.log(`\x1b[32m✓\x1b[0m ${m}`) }
26
26
  function fail(m) { console.error(`\x1b[31m✗ ${m}\x1b[0m`) }
27
27
 
28
- // node os/arch names platform package suffix (one for one with the optionalDependencies of
29
- // @einsia/agent-git). Under Rosetta node reports x64, so probe the real hardware and install the
30
- // arm64 package instead.
31
- function packageKey() {
32
- let a = arch()
33
- if (platform() === 'darwin' && a === 'x64') {
34
- const r = spawnSync('sysctl', ['-n', 'sysctl.proc_translated'], { encoding: 'utf8' })
35
- if (!r.error && r.status === 0 && (r.stdout || '').trim() === '1') a = 'arm64'
36
- }
37
- const map = {
38
- 'linux/x64': 'linux-x64',
39
- 'linux/arm64': 'linux-arm64',
40
- 'darwin/x64': 'darwin-x64',
41
- 'darwin/arm64': 'darwin-arm64',
42
- }
43
- return map[`${platform()}/${a}`] || null
44
- }
28
+ const { packageKey, binaryName } = require('@einsia/agent-git/npm/lib/platform.js')
45
29
 
46
30
  function main() {
47
31
  const t = packageKey()
@@ -54,7 +38,7 @@ function main() {
54
38
 
55
39
  let bin
56
40
  try {
57
- bin = require.resolve(`@einsia/agent-git-${t}/bin/agit`)
41
+ bin = require.resolve(`@einsia/agent-git-${t}/bin/${binaryName()}`)
58
42
  } catch {
59
43
  fail(`platform package @einsia/agent-git-${t} is missing (npm skipped it as an optional dep?).`)
60
44
  say('If you are on an unsupported platform, build from source:')
@@ -66,7 +50,7 @@ function main() {
66
50
 
67
51
  const targetDir = join(homedir(), '.local', 'bin')
68
52
  mkdirSync(targetDir, { recursive: true })
69
- const target = join(targetDir, 'agit')
53
+ const target = join(targetDir, binaryName())
70
54
  copyFileSync(bin, target)
71
55
  chmodSync(target, 0o755)
72
56
 
@@ -77,8 +61,8 @@ function main() {
77
61
  }
78
62
  ok(`installed ${check.stdout.trim()} → ${target}`)
79
63
 
80
- if (!process.env.PATH?.split(':').includes(targetDir)) {
81
- dim(`note: ${targetDir} is not on your PATH — add it (e.g. in ~/.profile)`)
64
+ if (!process.env.PATH?.split(delimiter).includes(targetDir)) {
65
+ dim(`note: ${targetDir} is not on your PATH — add it to your ${platform() === 'win32' ? 'user environment variables' : 'shell profile'}`)
82
66
  }
83
67
 
84
68
  // "installed by default at download time": hooks + skill + MCP + AGENTS.md in one pass. A
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "One-line installer for agit (npx create-agit) — thin wrapper around @einsia/agent-git that lands the CLI at ~/.local/bin and wires skills/hooks/MCP.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,7 +8,7 @@
8
8
  "create-agit": "./bin.mjs"
9
9
  },
10
10
  "dependencies": {
11
- "@einsia/agent-git": "0.1.1"
11
+ "@einsia/agent-git": "0.1.2"
12
12
  },
13
13
  "engines": {
14
14
  "node": ">=20"