agent-factorio 0.4.0 → 0.4.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.
@@ -136,7 +136,7 @@ export async function loginCommand(options = {}) {
136
136
  }
137
137
 
138
138
  const { orgId, orgName: name, inviteCode, memberId, authToken } = res.data;
139
- upsertOrg({ hubUrl, orgId, orgName: name, inviteCode, memberName, email, memberId, userId, authToken });
139
+ upsertOrg({ hubUrl, orgId, orgName: name, inviteCode, memberName, email, memberId, userId, authToken }, { setAsDefault: true });
140
140
 
141
141
  success(`Created "${name}" (${orgId})`);
142
142
  info(`Invite code: ${inviteCode} — share with your team!`);
@@ -158,7 +158,7 @@ export async function loginCommand(options = {}) {
158
158
  }
159
159
 
160
160
  const { orgId, orgName, memberId, authToken } = res.data;
161
- upsertOrg({ hubUrl, orgId, orgName, inviteCode: inviteCode.toUpperCase(), memberName, email, memberId, userId, authToken });
161
+ upsertOrg({ hubUrl, orgId, orgName, inviteCode: inviteCode.toUpperCase(), memberName, email, memberId, userId, authToken }, { setAsDefault: true });
162
162
 
163
163
  success(`Joined "${orgName}" (${orgId})`);
164
164
  }
package/commands/org.mjs CHANGED
@@ -89,7 +89,7 @@ export async function orgCreateCommand(name) {
89
89
  memberId,
90
90
  userId: org.userId,
91
91
  authToken,
92
- });
92
+ }, { setAsDefault: true });
93
93
 
94
94
  success(`Created "${createdName}" (${orgId})`);
95
95
  info(`Invite code: ${inviteCode} — share with your team!`);
@@ -137,7 +137,7 @@ export async function orgJoinCommand(code) {
137
137
  memberId,
138
138
  userId: org.userId,
139
139
  authToken,
140
- });
140
+ }, { setAsDefault: true });
141
141
 
142
142
  success(`Joined "${orgName}" (${orgId})`);
143
143
  }
package/lib/config.mjs CHANGED
@@ -60,7 +60,7 @@ export function getDefaultOrg() {
60
60
  * Add or update an organization in global config
61
61
  * @param {OrgEntry} org
62
62
  */
63
- export function upsertOrg(org) {
63
+ export function upsertOrg(org, { setAsDefault = false } = {}) {
64
64
  const config = readGlobalConfig() || { organizations: [] };
65
65
  const idx = config.organizations.findIndex(
66
66
  (o) => o.orgId === org.orgId && o.hubUrl === org.hubUrl
@@ -70,7 +70,7 @@ export function upsertOrg(org) {
70
70
  } else {
71
71
  config.organizations.push(org);
72
72
  }
73
- if (!config.defaultOrg) {
73
+ if (!config.defaultOrg || setAsDefault) {
74
74
  config.defaultOrg = org.orgId;
75
75
  }
76
76
  writeGlobalConfig(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-factorio",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "CLI for AgentFactorio — AI Agent Fleet Management hub",
5
5
  "type": "module",
6
6
  "bin": {