@vsuryav/agent-sim 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +4 -4
  3. package/src/cli.ts +44 -28
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # agent sim
2
2
 
3
- a cute pastel idle world that grows from your agentic coding sessions.
3
+ an idle world that grows from your agentic coding sessions.
4
4
 
5
5
  ## install
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsuryav/agent-sim",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Local TUI and sync client for Agent Sim",
5
5
  "type": "module",
6
6
  "files": [
@@ -14,11 +14,11 @@
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "git+https://github.com/vsuryav/agent-wars.git"
17
+ "url": "git+https://github.com/vsuryav/agent-sim.git"
18
18
  },
19
- "homepage": "https://github.com/vsuryav/agent-wars",
19
+ "homepage": "https://github.com/vsuryav/agent-sim",
20
20
  "bugs": {
21
- "url": "https://github.com/vsuryav/agent-wars/issues"
21
+ "url": "https://github.com/vsuryav/agent-sim/issues"
22
22
  },
23
23
  "publishConfig": {
24
24
  "access": "public"
package/src/cli.ts CHANGED
@@ -53,7 +53,7 @@ function printHelp() {
53
53
 
54
54
  console.log(`\n ${APP_NAME}`);
55
55
  console.log(' ──────────');
56
- console.log(' whimsical local TUI for your agentic coding life\n');
56
+ console.log(' an idle world that grows from your agentic coding sessions\n');
57
57
  console.log(' Commands:');
58
58
  console.log(` ${APP_NAME} Start the game`);
59
59
  console.log(` ${APP_NAME} login [url] Login for cross-machine sync (default: ${DEFAULT_SERVER_URL})`);
@@ -74,53 +74,69 @@ async function main() {
74
74
  try {
75
75
  if (command === 'help' || command === '--help' || command === '-h') {
76
76
  printHelp();
77
- } else if (command === 'login') {
77
+ return;
78
+ }
79
+
80
+ if (command === 'login') {
78
81
  const serverUrl = process.argv[3] ?? DEFAULT_SERVER_URL;
79
82
  await login(serverUrl);
80
- } else if (command === 'set-token') {
83
+ return;
84
+ }
85
+
86
+ if (command === 'set-token') {
81
87
  const token = process.argv[3];
82
88
  if (!token) { console.error(`Usage: ${APP_NAME} set-token <token>`); process.exit(1); }
83
89
  setToken(token);
84
- } else if (command === 'pull') {
90
+ return;
91
+ }
92
+
93
+ if (command === 'pull') {
85
94
  ensureDb();
86
95
  const remote = await pullFromServer();
87
96
  const merge = mergeRemoteState(remote);
88
97
  console.log(` Pulled ${remote.agents.length} agent(s) for ${remote.world.github_login}.`);
89
98
  console.log(` Added ${merge.inserted} new local agent(s), updated ${merge.updated}.`);
90
- } else if (command === 'push') {
99
+ return;
100
+ }
101
+
102
+ if (command === 'push') {
91
103
  ensureDb();
92
104
  const pushResult = await runRemotePush();
93
105
  if (!pushResult) {
94
106
  throw new Error(`Not logged in. Run: ${APP_NAME} login <server-url>`);
95
107
  }
96
108
  console.log(` Pushed ${pushResult.synced} agents to server.`);
97
- } else {
98
- if (command === 'sync') {
99
- ensureDb();
100
- const { runStartupSync } = await import('./app-sync.js');
101
- const result = await runStartupSync();
102
- printStartupSyncSummary(result);
103
- } else if (command === 'status') {
104
- ensureDb();
105
- const result = syncAll();
106
- if (result.newAgents > 0) {
107
- console.log(` Synced ${result.newAgents} new agent(s). Total: ${result.totalAgents}`);
108
- }
109
- }
109
+ return;
110
+ }
110
111
 
111
- if (command === 'status' || command === 'sync') {
112
- printStatus();
113
- }
112
+ if (command === 'sync') {
113
+ ensureDb();
114
+ const { runStartupSync } = await import('./app-sync.js');
115
+ const result = await runStartupSync();
116
+ printStartupSyncSummary(result);
117
+ printStatus();
118
+ return;
119
+ }
114
120
 
115
- if (!command) {
116
- ensureDb();
117
- await runInteractiveSession();
118
- } else if (command) {
119
- console.error(`Unknown command: ${command}`);
120
- printHelp();
121
- process.exitCode = 1;
121
+ if (command === 'status') {
122
+ ensureDb();
123
+ const result = syncAll();
124
+ if (result.newAgents > 0) {
125
+ console.log(` Synced ${result.newAgents} new agent(s). Total: ${result.totalAgents}`);
122
126
  }
127
+ printStatus();
128
+ return;
123
129
  }
130
+
131
+ if (!command) {
132
+ ensureDb();
133
+ await runInteractiveSession();
134
+ return;
135
+ }
136
+
137
+ console.error(`Unknown command: ${command}`);
138
+ printHelp();
139
+ process.exitCode = 1;
124
140
  } finally {
125
141
  closeDb();
126
142
  }