phewsh 0.15.68 → 0.15.69

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/commands/task.js +30 -1
  2. package/package.json +1 -1
package/commands/task.js CHANGED
@@ -142,6 +142,33 @@ async function listTasks(config) {
142
142
  console.log(`\n ${g('Claim one:')} ${w('phewsh task claim <id>')}\n`);
143
143
  }
144
144
 
145
+ async function inviteTeammate(config, email) {
146
+ if (!email || !email.includes('@')) throw new Error('Usage: phewsh task invite <email>');
147
+ const project = await loadProject(config);
148
+ if (project.user_id !== config.supabaseUserId) throw new Error('Only the project owner can invite (Phase 2).');
149
+ await supa.insert('project_invites', {
150
+ project_id: project.id, email, invited_by: config.supabaseUserId,
151
+ }, config.supabaseAccessToken);
152
+ console.log(`\n ${green('✓')} Invited ${w(email)} to ${w(project.name)}`);
153
+ console.log(` ${g('They join with')} ${w('phewsh task join')} ${g('(CLI) or the Join banner on phewsh.com/intent/dashboard')}\n`);
154
+ }
155
+
156
+ async function joinProjects(config) {
157
+ // RLS also shows an owner their own outbound invites — only accept ours.
158
+ const invites = (await supa.select('project_invites',
159
+ 'accepted_at=is.null&select=id,project_id,email,created_at', config.supabaseAccessToken))
160
+ .filter((inv) => inv.email?.toLowerCase() === (config.email || '').toLowerCase());
161
+ if (!invites.length) {
162
+ console.log(`\n ${g('No pending invites for your account.')}\n`);
163
+ return;
164
+ }
165
+ for (const inv of invites) {
166
+ await supa.rpc('accept_project_invite', { invite_id: inv.id }, config.supabaseAccessToken);
167
+ console.log(`\n ${green('✓')} Joined project ${w(inv.project_id)}`);
168
+ }
169
+ console.log(` ${g('See its tasks from the project repo:')} ${w('phewsh task')}\n`);
170
+ }
171
+
145
172
  async function newTask(config, title) {
146
173
  if (!title) throw new Error('Usage: phewsh task new "<title>"');
147
174
  const project = await loadProject(config);
@@ -251,7 +278,9 @@ module.exports = async function run() {
251
278
  if (sub === 'list') return await listTasks(config);
252
279
  if (sub === 'new') return await newTask(config, rest.join(' ').trim());
253
280
  if (sub === 'claim') return await claimTask(config, rest[0], via);
254
- console.log(`\n Usage: phewsh task [list | new "<title>" | claim <id> [--via <harness>]]\n`);
281
+ if (sub === 'invite') return await inviteTeammate(config, rest[0]);
282
+ if (sub === 'join') return await joinProjects(config);
283
+ console.log(`\n Usage: phewsh task [list | new "<title>" | claim <id> [--via <harness>] | invite <email> | join]\n`);
255
284
  } catch (err) {
256
285
  console.error(`\n ${red('✗')} ${err.message}\n`);
257
286
  process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phewsh",
3
- "version": "0.15.68",
3
+ "version": "0.15.69",
4
4
  "description": "Turn intent into action. Structure your thinking, execute your next step.",
5
5
  "bin": {
6
6
  "phewsh": "bin/phewsh.js"