create-agit 0.1.2 → 0.2.0

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 +34 -2
  2. package/package.json +2 -2
package/bin.mjs CHANGED
@@ -28,6 +28,23 @@ function fail(m) { console.error(`\x1b[31m✗ ${m}\x1b[0m`) }
28
28
  const { packageKey, binaryName } = require('@einsia/agent-git/npm/lib/platform.js')
29
29
 
30
30
  function main() {
31
+ const args = process.argv.slice(2)
32
+ const attributionIndex = args.indexOf('--acquisition-id')
33
+ const acquisitionId = attributionIndex >= 0 ? args[attributionIndex + 1] : undefined
34
+ if (attributionIndex >= 0 && !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(acquisitionId ?? '')) {
35
+ fail('--acquisition-id requires a random UUID.')
36
+ process.exit(1)
37
+ }
38
+ const campaignIndex = args.indexOf('--campaign-url')
39
+ const campaignUrl = campaignIndex >= 0 ? args[campaignIndex + 1] : undefined
40
+ if (campaignIndex >= 0) {
41
+ try {
42
+ if (!campaignUrl || campaignUrl.length > 8192 || !['http:', 'https:'].includes(new URL(campaignUrl).protocol)) throw new Error()
43
+ } catch {
44
+ fail('--campaign-url requires an HTTP or HTTPS URL of at most 8192 characters.')
45
+ process.exit(1)
46
+ }
47
+ }
31
48
  const t = packageKey()
32
49
  if (!t) {
33
50
  fail(`no prebuilt binary for ${platform()}/${arch()}.`)
@@ -54,7 +71,7 @@ function main() {
54
71
  copyFileSync(bin, target)
55
72
  chmodSync(target, 0o755)
56
73
 
57
- const check = spawnSync(target, ['--version'], { encoding: 'utf8' })
74
+ const check = spawnSync(target, ['--version'], { encoding: 'utf8', env: { ...process.env, AGIT_TELEMETRY_DEFER: '1' } })
58
75
  if (check.error || check.status !== 0) {
59
76
  fail(`the binary did not run: ${(check.stderr || check.error?.message || `exit ${check.status}`).trim()}`)
60
77
  process.exit(1)
@@ -68,7 +85,22 @@ function main() {
68
85
  // "installed by default at download time": hooks + skill + MCP + AGENTS.md in one pass. A
69
86
  // failure does not block the install itself — the binary is already there, and setup can be
70
87
  // re-run by hand later.
71
- const setup = spawnSync(target, ['setup'], { stdio: 'inherit' })
88
+ const yes = ['1', 'true'].includes(process.env.npm_config_yes?.toLowerCase()) || process.argv.slice(2).some(a => a === '--yes' || a === '-y')
89
+ spawnSync(target, ['--internal-install-completed'], {
90
+ stdio: ['ignore', 'inherit', 'inherit'],
91
+ env: { ...process.env, AGIT_INSTALL_CHANNEL: 'create_agit', AGIT_INSTALLER_YES: yes ? '1' : '0',
92
+ ...(acquisitionId ? { AGIT_ACQUISITION_ID: acquisitionId } : {}),
93
+ ...(campaignUrl ? { AGIT_CAMPAIGN_URL: campaignUrl } : {}) },
94
+ })
95
+ const skipSetup = process.env.AGIT_SKIP_SETUP && !['0', 'false'].includes(process.env.AGIT_SKIP_SETUP.toLowerCase())
96
+ if (skipSetup) {
97
+ dim('Setup skipped by AGIT_SKIP_SETUP. Run `agit setup` when ready.')
98
+ return
99
+ }
100
+ const setup = spawnSync(target, yes ? ['setup', '--yes'] : ['setup'], {
101
+ stdio: 'inherit',
102
+ env: { ...process.env, AGIT_INSTALL_CHANNEL: 'create_agit', AGIT_INSTALLER_YES: yes ? '1' : '0' },
103
+ })
72
104
  if (setup.status === 0) {
73
105
  ok('integrations installed (skills · hooks · MCP · AGENTS.md)')
74
106
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agit",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
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.2"
11
+ "@einsia/agent-git": "0.2.0"
12
12
  },
13
13
  "engines": {
14
14
  "node": ">=20"