@fenwave/agent 1.1.4 → 1.1.5

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/cli-commands.js CHANGED
@@ -127,7 +127,6 @@ function setupCLICommands(program, startServerFunction) {
127
127
  .action(async () => {
128
128
  try {
129
129
  const { loadDeviceCredential, isDeviceRegistered } = await import('./store/deviceCredentialStore.js');
130
- const { hasNpmToken } = await import('./store/npmTokenStore.js');
131
130
 
132
131
  console.log(chalk.bold('\nšŸ“Š Fenwave Agent Status\n'));
133
132
 
@@ -233,7 +232,6 @@ function setupCLICommands(program, startServerFunction) {
233
232
  try {
234
233
  const { getDeviceMetadata } = await import('./utils/deviceInfo.js');
235
234
  const { saveDeviceCredential, isDeviceRegistered } = await import('./store/deviceCredentialStore.js');
236
- const { saveNpmToken } = await import('./store/npmTokenStore.js');
237
235
 
238
236
  // Check if already registered
239
237
  if (isDeviceRegistered()) {
@@ -299,11 +297,6 @@ function setupCLICommands(program, startServerFunction) {
299
297
  agentVersion: deviceMetadata.agentVersion,
300
298
  });
301
299
 
302
- // Save NPM token if provided
303
- if (response.data.npmToken) {
304
- saveNpmToken(response.data.npmToken);
305
- }
306
-
307
300
  spinner.succeed('Device registered successfully');
308
301
  console.log(chalk.green('\nāœ… Registration Complete'));
309
302
  console.log(chalk.gray(` Device ID: ${response.data.deviceId}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fenwave/agent",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Fenwave Docker Agent and CLI",
5
5
  "keywords": [
6
6
  "fenwave",
@@ -0,0 +1,212 @@
1
+ #!/bin/bash
2
+
3
+ # Fenwave Agent Release Script
4
+ # Usage: ./scripts/release.sh [patch|minor|major|x.x.x]
5
+
6
+ set -e
7
+
8
+ # Colors
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Functions
16
+ log_info() { echo -e "${BLUE}ℹ ${NC}$1"; }
17
+ log_success() { echo -e "${GREEN}āœ“ ${NC}$1"; }
18
+ log_warning() { echo -e "${YELLOW}⚠ ${NC}$1"; }
19
+ log_error() { echo -e "${RED}āœ— ${NC}$1"; exit 1; }
20
+
21
+ # Check prerequisites
22
+ check_prerequisites() {
23
+ log_info "Checking prerequisites..."
24
+
25
+ command -v node >/dev/null 2>&1 || log_error "Node.js is required"
26
+ command -v npm >/dev/null 2>&1 || log_error "npm is required"
27
+ command -v gh >/dev/null 2>&1 || log_error "GitHub CLI (gh) is required"
28
+ command -v git >/dev/null 2>&1 || log_error "git is required"
29
+
30
+ # Check if logged into npm
31
+ npm whoami >/dev/null 2>&1 || log_error "Not logged into npm. Run 'npm login' first"
32
+
33
+ # Check if logged into GitHub CLI
34
+ gh auth status >/dev/null 2>&1 || log_error "Not logged into GitHub CLI. Run 'gh auth login' first"
35
+
36
+ # Check for uncommitted changes
37
+ if [[ -n $(git status --porcelain) ]]; then
38
+ log_error "Working directory has uncommitted changes. Commit or stash them first"
39
+ fi
40
+
41
+ # Check we're on main branch
42
+ CURRENT_BRANCH=$(git branch --show-current)
43
+ if [[ "$CURRENT_BRANCH" != "main" ]]; then
44
+ log_warning "Not on main branch (currently on: $CURRENT_BRANCH)"
45
+ read -p "Continue anyway? (y/N) " -n 1 -r
46
+ echo
47
+ [[ ! $REPLY =~ ^[Yy]$ ]] && exit 1
48
+ fi
49
+
50
+ # Pull latest changes
51
+ log_info "Pulling latest changes..."
52
+ git pull origin "$CURRENT_BRANCH"
53
+
54
+ log_success "Prerequisites check passed"
55
+ }
56
+
57
+ # Get version argument
58
+ get_version() {
59
+ VERSION_ARG=$1
60
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
61
+
62
+ if [[ -z "$VERSION_ARG" ]]; then
63
+ echo "" >&2
64
+ echo "Current version: $CURRENT_VERSION" >&2
65
+ echo "" >&2
66
+ echo "Select version bump:" >&2
67
+ echo " 1) patch (x.x.X) - Bug fixes" >&2
68
+ echo " 2) minor (x.X.0) - New features" >&2
69
+ echo " 3) major (X.0.0) - Breaking changes" >&2
70
+ echo " 4) custom - Enter specific version" >&2
71
+ echo "" >&2
72
+ read -p "Choice [1-4]: " choice
73
+
74
+ case $choice in
75
+ 1) VERSION_ARG="patch" ;;
76
+ 2) VERSION_ARG="minor" ;;
77
+ 3) VERSION_ARG="major" ;;
78
+ 4) read -p "Enter version (e.g., 1.2.3): " VERSION_ARG ;;
79
+ *) log_error "Invalid choice" ;;
80
+ esac
81
+ fi
82
+
83
+ echo "$VERSION_ARG"
84
+ }
85
+
86
+ # Bump version
87
+ bump_version() {
88
+ local VERSION_TYPE=$1
89
+
90
+ log_info "Bumping version ($VERSION_TYPE)..." >&2
91
+
92
+ if [[ "$VERSION_TYPE" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
93
+ # Specific version provided
94
+ npm version "$VERSION_TYPE" --no-git-tag-version >/dev/null
95
+ else
96
+ # patch, minor, or major
97
+ npm version "$VERSION_TYPE" --no-git-tag-version >/dev/null
98
+ fi
99
+
100
+ NEW_VERSION=$(node -p "require('./package.json').version")
101
+ log_success "Version bumped to $NEW_VERSION" >&2
102
+
103
+ echo "$NEW_VERSION"
104
+ }
105
+
106
+ # Commit and tag
107
+ commit_and_tag() {
108
+ local VERSION=$1
109
+
110
+ log_info "Committing version bump..."
111
+
112
+ git add package.json package-lock.json 2>/dev/null || git add package.json
113
+ git commit -m "chore: release v$VERSION"
114
+
115
+ log_info "Creating git tag v$VERSION..."
116
+ git tag -a "v$VERSION" -m "Release v$VERSION"
117
+
118
+ log_success "Committed and tagged"
119
+ }
120
+
121
+ # Push to remote
122
+ push_to_remote() {
123
+ local VERSION=$1
124
+
125
+ log_info "Pushing to remote..."
126
+
127
+ git push origin "$(git branch --show-current)"
128
+ git push origin "v$VERSION"
129
+
130
+ log_success "Pushed to remote"
131
+ }
132
+
133
+ # Create GitHub release
134
+ create_github_release() {
135
+ local VERSION=$1
136
+
137
+ log_info "Creating GitHub release..."
138
+
139
+ # Get commits since last tag
140
+ LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
141
+
142
+ if [[ -n "$LAST_TAG" ]]; then
143
+ CHANGES=$(git log "$LAST_TAG"..HEAD --pretty=format:"- %s" --no-merges | grep -v "chore: release")
144
+ else
145
+ CHANGES="- Initial release"
146
+ fi
147
+
148
+ # Create release notes
149
+ RELEASE_NOTES="## What's Changed
150
+
151
+ $CHANGES
152
+
153
+ **Full Changelog**: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/compare/${LAST_TAG:-v0.0.0}...v$VERSION"
154
+
155
+ gh release create "v$VERSION" \
156
+ --title "v$VERSION" \
157
+ --notes "$RELEASE_NOTES"
158
+
159
+ log_success "GitHub release created"
160
+ }
161
+
162
+ # Publish to npm
163
+ publish_to_npm() {
164
+ log_info "Publishing to npm..."
165
+
166
+ # Check if OTP is needed
167
+ read -p "Enter npm OTP (leave empty if not using 2FA): " OTP
168
+
169
+ if [[ -n "$OTP" ]]; then
170
+ npm publish --access public --otp="$OTP"
171
+ else
172
+ npm publish --access public
173
+ fi
174
+
175
+ log_success "Published to npm"
176
+ }
177
+
178
+ # Main
179
+ main() {
180
+ echo ""
181
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
182
+ echo " Fenwave Agent Release Script"
183
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
184
+ echo ""
185
+
186
+ check_prerequisites
187
+
188
+ VERSION_ARG=$(get_version "$1")
189
+ NEW_VERSION=$(bump_version "$VERSION_ARG")
190
+
191
+ echo ""
192
+ log_info "Ready to release v$NEW_VERSION"
193
+ read -p "Continue with release? (y/N) " -n 1 -r
194
+ echo ""
195
+ [[ ! $REPLY =~ ^[Yy]$ ]] && { log_warning "Release cancelled"; exit 0; }
196
+
197
+ commit_and_tag "$NEW_VERSION"
198
+ push_to_remote "$NEW_VERSION"
199
+ create_github_release "$NEW_VERSION"
200
+ publish_to_npm
201
+
202
+ echo ""
203
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
204
+ echo -e "${GREEN} Release v$NEW_VERSION completed successfully!${NC}"
205
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
206
+ echo ""
207
+ echo " npm: https://www.npmjs.com/package/@fenwave/agent"
208
+ echo " GitHub: $(gh repo view --json url -q .url)/releases/tag/v$NEW_VERSION"
209
+ echo ""
210
+ }
211
+
212
+ main "$@"
@@ -29,7 +29,6 @@ import {
29
29
  saveDeviceCredential,
30
30
  isDeviceRegistered,
31
31
  } from "../store/deviceCredentialStore.js";
32
- import { saveNpmToken } from "../store/npmTokenStore.js";
33
32
  import {
34
33
  saveSetupProgress,
35
34
  clearSetupState,
@@ -38,7 +37,7 @@ import {
38
37
  } from "../store/setupState.js";
39
38
  import { initializeConfig } from "../store/configStore.js";
40
39
 
41
- const TOTAL_STEPS = 6; // Reduced from 7 - no ECR auth step needed for GHCR
40
+ const TOTAL_STEPS = 5; // Reduced - no ECR auth or NPM config needed (public package and GHCR)
42
41
 
43
42
  /**
44
43
  * Setup Wizard Orchestrator
@@ -110,13 +109,10 @@ export class SetupWizard {
110
109
  // Step 3: Pull DevApp Image (GHCR is public, no auth required)
111
110
  await this.pullImageStep(registrationData);
112
111
 
113
- // Step 4: NPM Configuration
114
- await this.npmConfigStep(registrationData);
115
-
116
- // Step 5: Start Agent (optional)
112
+ // Step 4: Start Agent (optional)
117
113
  await this.startAgentStep();
118
114
 
119
- // Step 6: Complete
115
+ // Step 5: Complete
120
116
  this.displayComplete(registrationData);
121
117
 
122
118
  // Clear setup state
@@ -254,7 +250,6 @@ export class SetupWizard {
254
250
  return {
255
251
  deviceId: response.data.deviceId,
256
252
  deviceCredential: response.data.deviceCredential,
257
- npmToken: response.data.npmToken,
258
253
  registryConfig: response.data.registryConfig,
259
254
  userEntityRef: response.data.userEntityRef || "unknown",
260
255
  };
@@ -337,28 +332,10 @@ export class SetupWizard {
337
332
  }
338
333
 
339
334
  /**
340
- * Step 4: NPM Configuration
341
- */
342
- async npmConfigStep(registrationData) {
343
- displayStep(4, TOTAL_STEPS, "NPM Configuration");
344
-
345
- const { npmToken } = registrationData;
346
-
347
- if (npmToken) {
348
- saveNpmToken(npmToken);
349
- displaySuccess("NPM token configured for future updates");
350
- saveSetupProgress(SetupStep.NPM_CONFIG, { configured: true });
351
- } else {
352
- displayWarning("No NPM token provided by backend");
353
- saveSetupProgress(SetupStep.NPM_CONFIG, { configured: false });
354
- }
355
- }
356
-
357
- /**
358
- * Step 5: Start Agent (optional)
335
+ * Step 4: Start Agent (optional)
359
336
  */
360
337
  async startAgentStep() {
361
- displayStep(5, TOTAL_STEPS, "Start Agent Service");
338
+ displayStep(4, TOTAL_STEPS, "Start Agent Service");
362
339
 
363
340
  const shouldStart = await promptConfirmation("Start the agent now?", true);
364
341
 
@@ -378,7 +355,7 @@ export class SetupWizard {
378
355
  * Display completion message
379
356
  */
380
357
  displayComplete(registrationData) {
381
- displayStep(6, TOTAL_STEPS, "Setup Complete! šŸŽ‰");
358
+ displayStep(5, TOTAL_STEPS, "Setup Complete! šŸŽ‰");
382
359
 
383
360
  console.log("");
384
361
  displayHeader("Setup Summary");