@tanagram/cli 0.2.0 → 0.2.1
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.
- package/install.js +3 -1
- package/main.go +9 -0
- package/metrics/metrics.go +7 -2
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -4,6 +4,7 @@ const { execSync } = require('child_process');
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const os = require('os');
|
|
7
|
+
const pkg = require('./package.json');
|
|
7
8
|
|
|
8
9
|
const GO_VERSION = '1.21.0';
|
|
9
10
|
const GO_CACHE_DIR = path.join(os.homedir(), '.tanagram', `go-${GO_VERSION}`);
|
|
@@ -80,7 +81,8 @@ function buildBinary(goCommand) {
|
|
|
80
81
|
console.log('🔧 Building Tanagram CLI...');
|
|
81
82
|
|
|
82
83
|
try {
|
|
83
|
-
|
|
84
|
+
const ldflags = `-X 'main.Version=${pkg.version}'`;
|
|
85
|
+
execSync(`"${goCommand}" build -ldflags "${ldflags}" -o "${binaryPath}" .`, {
|
|
84
86
|
cwd: __dirname,
|
|
85
87
|
stdio: 'inherit',
|
|
86
88
|
env: {
|
package/main.go
CHANGED
|
@@ -9,7 +9,11 @@ import (
|
|
|
9
9
|
"github.com/tanagram/cli/tui"
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
+
// Version is set in install.js via `-X` ldflags
|
|
13
|
+
var Version = "dev"
|
|
14
|
+
|
|
12
15
|
func main() {
|
|
16
|
+
metrics.SetVersion(Version)
|
|
13
17
|
metrics.Init()
|
|
14
18
|
|
|
15
19
|
exitCode := 0
|
|
@@ -114,6 +118,9 @@ func main() {
|
|
|
114
118
|
return
|
|
115
119
|
}
|
|
116
120
|
return
|
|
121
|
+
case "version", "-v", "--version":
|
|
122
|
+
fmt.Println(Version)
|
|
123
|
+
return
|
|
117
124
|
case "help", "-h", "--help":
|
|
118
125
|
printHelp()
|
|
119
126
|
return
|
|
@@ -148,6 +155,7 @@ COMMANDS:
|
|
|
148
155
|
list Show all cached policies
|
|
149
156
|
config claude Setup Claude Code hook automatically
|
|
150
157
|
config list Show hook installation status
|
|
158
|
+
version Show the CLI version
|
|
151
159
|
help Show this help message
|
|
152
160
|
|
|
153
161
|
EXAMPLES:
|
|
@@ -158,6 +166,7 @@ EXAMPLES:
|
|
|
158
166
|
tanagram list # View all cached policies
|
|
159
167
|
tanagram config claude # Setup Claude Code hooks in ~/.claude/settings.json
|
|
160
168
|
tanagram config list # Show where hooks are installed
|
|
169
|
+
tanagram version # Show the version
|
|
161
170
|
|
|
162
171
|
INSTRUCTION FILES:
|
|
163
172
|
Tanagram looks for instruction files in your git repository:
|
package/metrics/metrics.go
CHANGED
|
@@ -14,8 +14,14 @@ var (
|
|
|
14
14
|
// Injected at build time via -ldflags
|
|
15
15
|
posthogWriteKey = "phc_sMsUvf0nK50rZdztSlX9rDJqIreLcXj4dyGS0tORQpQ"
|
|
16
16
|
posthogHost = "https://us.i.posthog.com"
|
|
17
|
+
version = "dev"
|
|
17
18
|
)
|
|
18
19
|
|
|
20
|
+
// SetVersion sets the CLI version
|
|
21
|
+
func SetVersion(v string) {
|
|
22
|
+
version = v
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
// Init initializes the PostHog client
|
|
20
26
|
// Similar to PosthogService.py and webui/app/lib/posthog.ts
|
|
21
27
|
func Init() {
|
|
@@ -117,6 +123,5 @@ func getDeploymentEnv() string {
|
|
|
117
123
|
|
|
118
124
|
// getVersion returns the CLI version
|
|
119
125
|
func getVersion() string {
|
|
120
|
-
|
|
121
|
-
return "0.1.14"
|
|
126
|
+
return version
|
|
122
127
|
}
|