Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.
TypeScript agent-skillsai-agentsautomationcopilotcopilot-clicopilot-coworkcopilot-studioelectronmicrosoft-scoutscreen-recording
Fix Microsoft SSO browser authorization
Giorgio Ughini389161623a84
diff --git a/README.md b/README.mdindex 9f6152c..0cb1dfd 100644--- a/README.md+++ b/README.md@@ -86,11 +86,26 @@ This adds **Skill Recorder (Source)** shortcuts to your desktop and Start Menu.On Windows, a local Microsoft Entra tenant hint can offer a choice between**Microsoft Enterprise SSO** and a **Personal GitHub account**. This is only a-routing hint, not proof of employment. The SSO choice opens the enterprise sign-in-page first; finish SSO, return to Skill Recorder, and choose **Continue to Copilot**-to authorize the CLI in the same browser profile. Without a hint, and on macOS/Linux,+routing hint, not proof of employment. Microsoft sign-in has two separate steps:+finish SSO in the browser, then authorize the GitHub Copilot app. When SSO lands on+`github.com/enterprises/microsoft`, close that tab, return to Skill Recorder, and+choose **Authorize Copilot**. SSO alone does not authorize the app. Use the same+browser profile and Microsoft-linked GitHub account for both steps.+Without a hint, and on macOS/Linux,sign-in goes directly to the standard GitHub flow. No work-email prompt is required.+The authorization step opens the default browser using the CLI's web OAuth flow,+not a device code. Keeping the same browser profile lets GitHub reuse the session+from SSO, so you can approve the GitHub Copilot app without entering a code.+If GitHub asks you to sign in again, check that you are using the same browser profile.+After authorization, close that tab and return to Skill Recorder; the app verifies+access before continuing.++Skill Recorder pins Copilot CLI 1.0.78, which supports web OAuth without a terminal,+and runs `--no-auto-update login --web-flow` so sign-in does not depend on a+different CLI version in the user's auto-update cache. Older bundled versions+such as 1.0.71 do not support `--web-flow`.+Sign-in can be canceled and times out after five minutes. If browser login fails,the app shows an error and a manual command for the bundled CLI (use PowerShell onWindows). After manual sign-in, retry the analysis yourself. Signing in from a skilldiff --git a/electron/copilot-signin-flow.test.ts b/electron/copilot-signin-flow.test.tsindex 067ac40..dd40bfc 100644--- a/electron/copilot-signin-flow.test.ts+++ b/electron/copilot-signin-flow.test.ts@@ -16,7 +16,7 @@ function fixture(overrides: Partial<SignInOperations> = {}) {prepareEnterprise: async () => { calls.push("enterprise"); return true; },login: async () => { calls.push("login"); },verifyAuthentication: async () => { calls.push("verify"); return true; },- manualCommand: "copilot login --web-flow",+ manualCommand: "copilot --no-auto-update login --web-flow",...overrides,};return { calls, operations };@@ -36,8 +36,21 @@ test("unknown user sees no enterprise choice and succeeds only after verificatio});test("positive hint offers choice, with enterprise SSO before CLI authorization", async () => {- const { calls, operations } = fixture({ hasMicrosoftHint: async () => true });- assert.equal((await new SignInCoordinator().signIn("attempt", 1, operations)).ok, true);+ const entered = deferred<void>();+ const sso = deferred<boolean>();+ const { calls, operations } = fixture({+ hasMicrosoftHint: async () => true,+ prepareEnterprise: () => {+ calls.push("enterprise");+ entered.resolve();+ return sso.promise;+ },+ });+ const result = new SignInCoordinator().signIn("attempt", 1, operations);+ await entered.promise;+ assert.deepEqual(calls, ["choose", "enterprise"]);+ sso.resolve(true);+ assert.equal((await result).ok, true);assert.deepEqual(calls, ["choose", "enterprise", "login", "verify"]);});diff --git a/electron/copilot-signin-process.test.ts b/electron/copilot-signin-process.test.tsindex 0033665..04cd865 100644--- a/electron/copilot-signin-process.test.ts+++ b/electron/copilot-signin-process.test.ts@@ -1,27 +1,31 @@import assert from "node:assert/strict";import { spawn } from "node:child_process";+import { mkdtemp, rm } from "node:fs/promises";+import { tmpdir } from "node:os";+import path from "node:path";import test from "node:test";+import { resolveCopilotCliPath } from "./copilot-cli-path";import { copilotSignInCommand, runCopilotLogin } from "./copilot-signin-process";test("login runs the bundled executable without a shell, terminal, or writable stdin", async () => {await runCopilotLogin("C:\\Program Files\\Recorder & More\\copilot.exe", new AbortController().signal,(file, args, options) => {assert.equal(file, "C:\\Program Files\\Recorder & More\\copilot.exe");- assert.deepEqual(args, ["login", "--web-flow"]);+ assert.deepEqual(args, ["--no-auto-update", "login", "--web-flow"]);assert.equal(options.windowsHide, true);assert.equal(options.shell, undefined);assert.equal(options.detached, undefined);- assert.equal(options.stdio, "ignore");+ assert.deepEqual(options.stdio, ["ignore", "ignore", "pipe"]);return spawn(process.execPath, ["-e", "process.exit(0)"], options);});});test("manual commands quote spaces and apostrophes for PowerShell and POSIX shells", () => {assert.equal(copilotSignInCommand("C:\\User's files\\copilot.exe", "win32"),- "& 'C:\\User''s files\\copilot.exe' login --web-flow");+ "& 'C:\\User''s files\\copilot.exe' --no-auto-update login --web-flow");assert.equal(copilotSignInCommand("/User's files/copilot", "darwin"),- "'/User'\\''s files/copilot' login --web-flow");+ "'/User'\\''s files/copilot' --no-auto-update login --web-flow");});test("nonzero exit surfaces a safe error and never emits buffered CLI output", async () => {@@ -57,3 +61,78 @@ test("an already canceled attempt does not start a process", () => {assert.fail("must not spawn");}), { name: "AbortError" });});++test("unsupported browser login fails explicitly rather than falling back to device codes", async () => {+ let launches = 0;+ await assert.rejects(runCopilotLogin("copilot", new AbortController().signal, (_file, _args, options) => {+ launches++;+ return spawn(process.execPath, ["-e", `+ process.stderr.write("error: unknown option '--web");+ setTimeout(() => {+ console.error("-flow'");+ process.exitCode = 1;+ }, 20);+ `], options);+ }), /^Error: The bundled Copilot CLI does not support browser authorization\./);+ assert.equal(launches, 1);+});++test("credential storage failure is actionable without revealing raw CLI output", async () => {+ await assert.rejects(runCopilotLogin("copilot", new AbortController().signal,+ (_file, _args, options) => spawn(process.execPath, ["-e", `+ console.error("Login succeeded, but the token was not saved. private details");+ process.exitCode = 1;+ `], options)),+ /^Error: GitHub authorization completed, but the CLI could not save your credentials securely\./);+});++test("the reviewed CLI starts web OAuth without a TTY, device code or real browser", async () => {+ const cliPath = resolveCopilotCliPath();+ assert.ok(cliPath, "install the bundled CLI before running sign-in tests");+ const home = await mkdtemp(path.join(tmpdir(), "skill-recorder-oauth-"));+ let stderr = "";+ const browser = `+ const assert = require("node:assert/strict");+ const url = new URL(process.argv[1]);+ assert.equal(url.origin, "https://github.com");+ assert.equal(url.pathname, "/login/oauth/authorize");+ assert.equal(url.searchParams.get("code_challenge_method"), "S256");+ assert.ok(url.searchParams.get("code_challenge"));+ assert.ok(url.searchParams.get("state"));+ const callback = new URL(url.searchParams.get("redirect_uri"));+ assert.equal(callback.protocol, "http:");+ assert.equal(callback.hostname, "127.0.0.1");+ assert.equal(callback.pathname, "/callback");+ assert.ok(callback.port);+ callback.searchParams.set("state", url.searchParams.get("state"));+ callback.searchParams.set("error", "skill_recorder_web_flow_test");+ require("node:http").get(callback, response => response.resume())+ .on("error", () => process.exitCode = 1)+ .setTimeout(5000, function () { this.destroy(); });+ `;+ try {+ await assert.rejects(runCopilotLogin(cliPath, AbortSignal.timeout(30_000), (file, args, options) => {+ const env = { ...process.env };+ for (const key of Object.keys(env)) {+ if (/^(COPILOT_GITHUB_TOKEN|GH_TOKEN|GITHUB_TOKEN|COPILOT_SDK_AUTH_TOKEN|COPILOT_OFFLINE)$/i.test(key)) {+ delete env[key];+ }+ }+ // The fake browser only denies the loopback callback: no GitHub request,+ // account authorization, user credentials or clipboard access is involved.+ const child = spawn(file, args, {+ ...options,+ env: {+ ...env,+ COPILOT_HOME: home,+ COPILOT_DEBUG_BROWSER: JSON.stringify([process.execPath, "-e", browser]),+ },+ });+ child.stderr?.on("data", (chunk) => { stderr = (stderr + chunk).slice(-4096); });+ return child;+ }), /Copilot login did not complete/);+ assert.match(stderr, /skill_recorder_web_flow_test/);+ } finally {+ await rm(home, { recursive: true, force: true });+ }+});diff --git a/electron/copilot-signin-process.ts b/electron/copilot-signin-process.tsindex f243a87..5ae8782 100644--- a/electron/copilot-signin-process.ts+++ b/electron/copilot-signin-process.ts@@ -6,7 +6,7 @@ export function copilotSignInCommand(cliPath: string, platform = process.platforconst quoted = platform === "win32"? `& '${cliPath.replace(/'/g, "''")}'`: `'${cliPath.replace(/'/g, `'\\''`)}'`;- return `${quoted} login --web-flow`;+ return `${quoted} --no-auto-update login --web-flow`;}/**@@ -20,10 +20,21 @@ export function runCopilotLogin(): Promise<void> {signal.throwIfAborted();return new Promise<void>((resolve, reject) => {- const child = spawnProcess(cliPath, ["login", "--web-flow"], {+ // Use the reviewed bundled version, not a newer CLI from the user's update cache.+ const child = spawnProcess(cliPath, ["--no-auto-update", "login", "--web-flow"], {windowsHide: true,// No stdin means no automatic consent to plaintext credential storage.- stdio: "ignore",+ stdio: ["ignore", "ignore", "pipe"],+ });+ let output = "";+ let storageFailed = false;+ let unsupportedWebFlow = false;+ child.stderr?.setEncoding("utf8").on("data", (chunk: string) => {+ // Recognize only authored diagnostics, including split chunks; never expose output.+ output += chunk;+ storageFailed ||= output.includes("Login succeeded, but the token was not saved.");+ unsupportedWebFlow ||= output.includes("unknown option '--web-flow'");+ output = output.slice(-4096);});const abort = () => {child.kill("SIGKILL");@@ -35,10 +46,13 @@ export function runCopilotLogin(// Spawn failures also emit close; wait for it before releasing the sign-in lock.});child.once("close", (code) => {+ output = "";signal.removeEventListener("abort", abort);if (signal.aborted) reject(signal.reason);else if (launchFailed) reject(new SignInError("Could not start the bundled Copilot CLI. Reinstall the app or use the command below."));else if (code === 0) resolve();+ else if (unsupportedWebFlow) reject(new SignInError("The bundled Copilot CLI does not support browser authorization. Update or reinstall Skill Recorder."));+ else if (storageFailed) reject(new SignInError("GitHub authorization completed, but the CLI could not save your credentials securely. Run the command below in a terminal to review its storage options."));else reject(new SignInError("Copilot login did not complete. Try again, or run the command below in a terminal to see the CLI's instructions."));});if (signal.aborted) abort();diff --git a/electron/copilot-signin.ts b/electron/copilot-signin.tsindex b540623..c774aea 100644--- a/electron/copilot-signin.ts+++ b/electron/copilot-signin.ts@@ -45,7 +45,7 @@ export async function openCopilotSignIn(type: "question",title: "Sign in to GitHub Copilot",message: "Use Microsoft Enterprise SSO or a personal GitHub account?",- detail: "This Windows account or device appears to be associated with Microsoft. Choose the account you want to use.",+ detail: "This Windows account or device appears to be associated with Microsoft. Microsoft sign-in has two steps: complete SSO in your browser, then authorize the GitHub Copilot app. When the Microsoft enterprise page appears, close that tab and return to Skill Recorder for step 2.",buttons: ["Microsoft Enterprise SSO", "Personal GitHub account", "Cancel"],defaultId: 0,cancelId: 2,@@ -65,9 +65,9 @@ export async function openCopilotSignIn(const { response } = await show({type: "info",title: "Microsoft Enterprise SSO",- message: "Finish Microsoft SSO in your browser, then continue here.",- detail: "Copilot authorization opens next. Use the same browser profile and the GitHub account linked to your Microsoft enterprise access.",- buttons: ["Continue to Copilot", "Cancel"],+ message: "Step 1 of 2: Complete Microsoft SSO",+ detail: "When SSO finishes on github.com/enterprises/microsoft, close that tab and return here. SSO alone does not authorize Copilot.\n\nChoose \"Authorize Copilot\" to open step 2. Use the same browser profile and Microsoft-linked GitHub account, then approve the GitHub Copilot app. No device code is needed.\n\nAfter authorization, close that tab and return to Skill Recorder. If GitHub says to return to your terminal, return here instead.",+ buttons: ["Authorize Copilot", "Cancel"],defaultId: 0,cancelId: 1,noLink: true,diff --git a/package-lock.json b/package-lock.jsonindex a337b4e..947424d 100644--- a/package-lock.json+++ b/package-lock.json@@ -9,6 +9,7 @@"version": "0.6.1","license": "MIT","dependencies": {+ "@github/copilot": "1.0.78","@github/copilot-sdk": "^1.0.6","@huggingface/transformers": "^4.2.0","@secretlint/core": "^13.0.4",@@ -390,9 +391,9 @@}},"node_modules/@github/copilot": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.71.tgz",- "integrity": "sha1-qfslXZyT7W6RLbxQauAFX+FGawU=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.78.tgz",+ "integrity": "sha1-a/H/kmI1WSUSs0Q/22NtmqjIafI=","license": "SEE LICENSE IN LICENSE.md","dependencies": {"detect-libc": "^2.1.2"@@ -401,20 +402,20 @@"copilot": "npm-loader.js"},"optionalDependencies": {- "@github/copilot-darwin-arm64": "1.0.71",- "@github/copilot-darwin-x64": "1.0.71",- "@github/copilot-linux-arm64": "1.0.71",- "@github/copilot-linux-x64": "1.0.71",- "@github/copilot-linuxmusl-arm64": "1.0.71",- "@github/copilot-linuxmusl-x64": "1.0.71",- "@github/copilot-win32-arm64": "1.0.71",- "@github/copilot-win32-x64": "1.0.71"+ "@github/copilot-darwin-arm64": "1.0.78",+ "@github/copilot-darwin-x64": "1.0.78",+ "@github/copilot-linux-arm64": "1.0.78",+ "@github/copilot-linux-x64": "1.0.78",+ "@github/copilot-linuxmusl-arm64": "1.0.78",+ "@github/copilot-linuxmusl-x64": "1.0.78",+ "@github/copilot-win32-arm64": "1.0.78",+ "@github/copilot-win32-x64": "1.0.78"}},"node_modules/@github/copilot-darwin-arm64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.71.tgz",- "integrity": "sha1-oJN6YmXMs8QSEDCpMZB+/bVoPh0=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.78.tgz",+ "integrity": "sha1-4fdXK6vHIGDzVr0k4cCRO+8v/wg=","cpu": ["arm64"],@@ -428,9 +429,9 @@}},"node_modules/@github/copilot-darwin-x64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.71.tgz",- "integrity": "sha1-Z16zgpTufMUogjN4C4VHN8YcgfQ=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.78.tgz",+ "integrity": "sha1-3C7GHwJmHFDDzx4P+a1oLu2aff8=","cpu": ["x64"],@@ -444,12 +445,15 @@}},"node_modules/@github/copilot-linux-arm64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.71.tgz",- "integrity": "sha1-h+m9TgXvPg9fOdIX0Lb6/Ynl9XM=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.78.tgz",+ "integrity": "sha1-3scu87wsTj/oPqh7oMwWDd/XQ1o=","cpu": ["arm64"],+ "libc": [+ "glibc"+ ],"license": "SEE LICENSE IN LICENSE.md","optional": true,"os": [@@ -460,12 +464,15 @@}},"node_modules/@github/copilot-linux-x64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.71.tgz",- "integrity": "sha1-9BwtUbwXXy+RrUtZRlbU2IdC85g=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.78.tgz",+ "integrity": "sha1-vONd01Wd4bg+wgSrB5niY/cZadw=","cpu": ["x64"],+ "libc": [+ "glibc"+ ],"license": "SEE LICENSE IN LICENSE.md","optional": true,"os": [@@ -476,12 +483,15 @@}},"node_modules/@github/copilot-linuxmusl-arm64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.71.tgz",- "integrity": "sha1-lk7OeAX0J16RvB2Fo/FMLHFS15o=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.78.tgz",+ "integrity": "sha1-1jsCxsjTpgKmN0ZwjKoMwaz3sOM=","cpu": ["arm64"],+ "libc": [+ "musl"+ ],"license": "SEE LICENSE IN LICENSE.md","optional": true,"os": [@@ -492,12 +502,15 @@}},"node_modules/@github/copilot-linuxmusl-x64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.71.tgz",- "integrity": "sha1-ncPmnC+w4Ea3piz/f267CRcov/s=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.78.tgz",+ "integrity": "sha1-M6llEedAbri7saLa3NpWhhHi9xY=","cpu": ["x64"],+ "libc": [+ "musl"+ ],"license": "SEE LICENSE IN LICENSE.md","optional": true,"os": [@@ -523,9 +536,9 @@}},"node_modules/@github/copilot-win32-arm64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.71.tgz",- "integrity": "sha1-ZFwwVoPGoWfToNyhk4rRFN9O4mE=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.78.tgz",+ "integrity": "sha1-sPUz645kXZ2RXcLvbep4Hz9tZ+I=","cpu": ["arm64"],@@ -539,9 +552,9 @@}},"node_modules/@github/copilot-win32-x64": {- "version": "1.0.71",- "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.71.tgz",- "integrity": "sha1-LzyWpWloTZhn0YrmZ4akGH7PYfA=",+ "version": "1.0.78",+ "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.78.tgz",+ "integrity": "sha1-MkYXTxg7LvBS/SlOK+ADvDbsZok=","cpu": ["x64"],diff --git a/package.json b/package.jsonindex b4d6144..f45d7a4 100644--- a/package.json+++ b/package.json@@ -41,6 +41,7 @@"start": "node scripts/run-reviewed-electron.mjs start"},"dependencies": {+ "@github/copilot": "1.0.78","@github/copilot-sdk": "^1.0.6","@huggingface/transformers": "^4.2.0","@secretlint/core": "^13.0.4",diff --git a/third_party/compliance-policy.json b/third_party/compliance-policy.jsonindex 2d477ad..d34868d 100644--- a/third_party/compliance-policy.json+++ b/third_party/compliance-policy.json@@ -1,6 +1,6 @@{"schemaVersion": 1,- "copilotCli": "1.0.71",+ "copilotCli": "1.0.78","copilotSdk": "1.0.7","electron": {"version": "43.1.1",