shakers-cli 0.16.0 → 0.18.0

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 (69) hide show
  1. package/README.md +21 -6
  2. package/bin/ai-usage.js +31 -12
  3. package/bin/command-audit-worker.js +19 -0
  4. package/bin/login.js +4 -8
  5. package/bin/mcp.js +32 -21
  6. package/bin/register.js +12 -30
  7. package/bin/shakers-cli.js +15 -10
  8. package/package.json +1 -1
  9. package/src/account-marker.js +40 -0
  10. package/src/account-trace.js +23 -0
  11. package/src/agents-client.js +1 -0
  12. package/src/ai-usage-review.js +103 -0
  13. package/src/auth-client.js +7 -107
  14. package/src/auth-session-store.js +12 -11
  15. package/src/backend-request.js +3 -24
  16. package/src/cli-skill.js +77 -0
  17. package/src/command-audit.js +47 -4
  18. package/src/config.js +2 -16
  19. package/src/consent-flow.js +9 -3
  20. package/src/detect-repos.js +4 -8
  21. package/src/detectors.js +23 -0
  22. package/src/device-auth-store.js +2 -2
  23. package/src/device-login.js +11 -9
  24. package/src/env-paths.js +9 -1
  25. package/src/i18n.js +186 -102
  26. package/src/mcp-ai-usage-result-tool.js +38 -14
  27. package/src/mcp-ai-usage-tool.js +317 -172
  28. package/src/mcp-choice.js +171 -34
  29. package/src/mcp-detector.js +26 -2
  30. package/src/mcp-device-login-tools.js +40 -8
  31. package/src/mcp-install.js +292 -53
  32. package/src/mcp-instructions.js +43 -17
  33. package/src/mcp-onboarding-tools.js +1 -3
  34. package/src/mcp-prompts.js +8 -6
  35. package/src/mcp-register-tools.js +25 -14
  36. package/src/mcp-role-tools.js +59 -18
  37. package/src/mcp-server-name.js +7 -0
  38. package/src/mcp-server.js +35 -7
  39. package/src/mcp-signup-client.js +3 -6
  40. package/src/mcp-signup-flow.js +389 -0
  41. package/src/mcp-signup-tools.js +250 -133
  42. package/src/onboarding-flow.js +72 -146
  43. package/src/onboarding-funnel.js +46 -6
  44. package/src/opencode-sessions.js +92 -0
  45. package/src/profile-agents.js +26 -0
  46. package/src/render-report-text.js +1 -1
  47. package/src/report-gating.js +4 -2
  48. package/src/report-store.js +7 -2
  49. package/src/roles-flow.js +8 -5
  50. package/src/saved-positions-flow.js +3 -3
  51. package/src/scanner.js +104 -12
  52. package/src/session-gate.js +1 -4
  53. package/src/session-normalizers.js +114 -8
  54. package/src/session-refresh.js +5 -16
  55. package/src/session-scan.js +167 -22
  56. package/src/share-consent-state.js +2 -2
  57. package/src/share-payload.js +4 -1
  58. package/src/share.js +2 -2
  59. package/src/signup-client.js +12 -39
  60. package/src/signup-copy.js +545 -58
  61. package/src/skill-install.js +102 -0
  62. package/src/stdin-ask.js +13 -1
  63. package/src/tier-engine.js +14 -2
  64. package/src/trust-narration.js +32 -0
  65. package/src/usage-run-steps.js +68 -6
  66. package/src/usage-scan.js +11 -8
  67. package/src/brand-svg.js +0 -9
  68. package/src/inter-fonts.js +0 -6
  69. package/src/mcp-auth-form.js +0 -480
@@ -10,15 +10,16 @@ function defaultSleep(ms) {
10
10
  return new Promise((resolve) => { setTimeout(resolve, ms); });
11
11
  }
12
12
 
13
- // The /cli-login page reads `provider` from the query to pick the social button.
14
- function appendProviderParam(url, provider) {
15
- if (!url || !provider) return url;
13
+ function withDeviceParams(url, params = {}) {
14
+ const entries = Object.entries(params).filter(([, v]) => typeof v === 'string' && v);
15
+ if (!url || !entries.length) return url;
16
16
  try {
17
17
  const u = new URL(url);
18
- u.searchParams.set('provider', provider);
18
+ for (const [k, v] of entries) u.searchParams.set(k, v);
19
19
  return u.href;
20
20
  } catch {
21
- return `${url}${url.includes('?') ? '&' : '?'}provider=${encodeURIComponent(provider)}`;
21
+ const query = entries.map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join('&');
22
+ return `${url}${url.includes('?') ? '&' : '?'}${query}`;
22
23
  }
23
24
  }
24
25
 
@@ -32,7 +33,7 @@ async function pollDeviceToken({ deviceCode, tokenEndpoint, clientId, timeoutMs
32
33
 
33
34
  // ORDER: a NEW user needs complete-registration BEFORE GET /auth/token (else the Hub 500s: no domain user).
34
35
  async function finalizeDeviceSession(
35
- { sessionToken, isNewUser, authTokenEndpoint, completeRegistrationEndpoint = null, registrationContext = null, claimCode = null, timeoutMs } = {},
36
+ { sessionToken, isNewUser, authTokenEndpoint, completeRegistrationEndpoint = null, registrationContext = null, consent = null, claimCode = null, timeoutMs } = {},
36
37
  {
37
38
  requestCompleteRegistration = require('./signup-client').requestCompleteRegistration,
38
39
  requestApiToken: apiToken = requestApiToken,
@@ -42,7 +43,7 @@ async function finalizeDeviceSession(
42
43
 
43
44
  let claimed = false;
44
45
  if (isNewUser && completeRegistrationEndpoint) {
45
- const done = await requestCompleteRegistration(registrationContext || {}, { endpoint: completeRegistrationEndpoint, bearerToken: sessionToken, claimCode, timeoutMs });
46
+ const done = await requestCompleteRegistration(registrationContext || {}, { endpoint: completeRegistrationEndpoint, bearerToken: sessionToken, claimCode, consent, timeoutMs });
46
47
  if (!done.ok) return { ok: false, reason: done.reason || 'complete-registration-failed' };
47
48
  claimed = done.claimed === true;
48
49
  }
@@ -53,7 +54,7 @@ async function finalizeDeviceSession(
53
54
  }
54
55
 
55
56
  async function runDeviceLogin(
56
- { authorizeEndpoint, tokenEndpoint, authTokenEndpoint, completeRegistrationEndpoint = null, registrationContext = null, clientId, scope, timeoutMs } = {},
57
+ { authorizeEndpoint, tokenEndpoint, authTokenEndpoint, completeRegistrationEndpoint = null, registrationContext = null, consent = null, clientId, scope, timeoutMs } = {},
57
58
  {
58
59
  onPrompt = null,
59
60
  onWaiting = null,
@@ -92,6 +93,7 @@ async function runDeviceLogin(
92
93
  authTokenEndpoint,
93
94
  completeRegistrationEndpoint,
94
95
  registrationContext,
96
+ consent,
95
97
  timeoutMs,
96
98
  });
97
99
  if (!fin.ok) return { ok: false, reason: fin.reason };
@@ -124,7 +126,7 @@ module.exports = {
124
126
  pollDeviceToken,
125
127
  finalizeDeviceSession,
126
128
  runDeviceLogin,
127
- appendProviderParam,
129
+ withDeviceParams,
128
130
  defaultSleep,
129
131
  SLOW_DOWN_STEP_SECONDS,
130
132
  DEFAULT_MAX_WAIT_MS,
package/src/env-paths.js CHANGED
@@ -13,6 +13,14 @@ function getHomeDir(env = process.env) {
13
13
  return readEnv(env, 'HOME_DIR') || os.homedir();
14
14
  }
15
15
 
16
+ function codexHome(env = process.env) {
17
+ return env.CODEX_HOME || require('path').join(getHomeDir(env), '.codex');
18
+ }
19
+
20
+ function piAgentDir(env = process.env) {
21
+ return env.PI_CODING_AGENT_DIR ? expandHome(env.PI_CODING_AGENT_DIR, env) : require('path').join(getHomeDir(env), '.pi', 'agent');
22
+ }
23
+
16
24
  // `~/Documents/cv.pdf` -> absolute, so a model can pass the short form it was shown.
17
25
  function expandHome(file, env = process.env) {
18
26
  if (typeof file !== 'string') return file;
@@ -27,4 +35,4 @@ function tildify(file, env = process.env) {
27
35
  return typeof file === 'string' && file.startsWith(`${home}/`) ? `~/${file.slice(home.length + 1)}` : file;
28
36
  }
29
37
 
30
- module.exports = { getHomeDir, readEnv, expandHome, tildify };
38
+ module.exports = { getHomeDir, codexHome, piAgentDir, readEnv, expandHome, tildify };