@keystrokehq/cli 0.0.16 → 0.0.18
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.
- package/dist/{accept.handler-BPwp_UAE.mjs → accept.handler-B7QzdKCh.mjs} +4 -4
- package/dist/{admin-Bb9Hx-gO.mjs → admin-CYpulx_A.mjs} +11 -11
- package/dist/{agents-CbmvvOAx.mjs → agents-Co6Jy_N8.mjs} +10 -10
- package/dist/{api-jkf0TTgD.mjs → api-DsK8M-ZH.mjs} +1 -1
- package/dist/{api-keys-DJlyIf10.mjs → api-keys-BUCLzRv_.mjs} +6 -6
- package/dist/{auth-DpDEkJz7.mjs → auth-niNm-yNT.mjs} +12 -7
- package/dist/{auth.handler-u3qmoUX0.mjs → auth.handler-BTH-Qb00.mjs} +59 -26
- package/dist/{build-agents-DseUtzd4-VYWtIZy9.mjs → build-agents-DseUtzd4-CthuIecx.mjs} +6 -6
- package/dist/{build-metadata-C8Ra_Gi--BdoyLQMl.mjs → build-metadata-C8Ra_Gi--L3l8w0rh.mjs} +7 -7
- package/dist/{build-progress-BZivcVz4.mjs → build-progress-AR8xow4_.mjs} +2 -2
- package/dist/{build-tasks-GVuMLS0h-p08mMOyK.mjs → build-tasks-GVuMLS0h-CCxCqd02.mjs} +3 -3
- package/dist/{build-workflows-CV4tBo6S-knCnBKTc.mjs → build-workflows-CV4tBo6S-DhFBlp6m.mjs} +10 -10
- package/dist/{build.handler-BNSC_zhQ.mjs → build.handler-BmlXPhed.mjs} +7 -7
- package/dist/{clear-cache.handler-gr5VmEYB.mjs → clear-cache.handler-CTLQ1PIN.mjs} +3 -3
- package/dist/clear.handler-BDlwBzX4.mjs +68 -0
- package/dist/{clear.handler-CtOZ4aRn.mjs → clear.handler-C_pXAeBG.mjs} +3 -2
- package/dist/{commander-D15UZVjp.mjs → commander-BE37hxR3.mjs} +4 -4
- package/dist/{connect-DzSNDSmI.mjs → connect-C9NMD8Ky.mjs} +3 -3
- package/dist/{connect.handler-DRO05ak3.mjs → connect.handler-C7kysvhz.mjs} +5 -5
- package/dist/{context-B1L8pZsH.mjs → context-Bid-Rqj7.mjs} +49 -17
- package/dist/{create.handler-DF1Ye4nr.mjs → create.handler-Cp9CV6SN.mjs} +3 -3
- package/dist/{credential-env-map-B2nVJXPn.mjs → credential-env-map-BA4LNI7x.mjs} +6 -5
- package/dist/{credential-requirements-FtBk5JVB.mjs → credential-requirements-DrrQ9x9P.mjs} +3 -3
- package/dist/{credential-schema-mismatch-CfyBUMPS.mjs → credential-schema-mismatch-z74ud-YZ.mjs} +1 -1
- package/dist/{credentials-CiOwDS5y.mjs → credentials-DUkVbhvj.mjs} +1 -1
- package/dist/{credentials-VidBoOd7.mjs → credentials-fMfKVlEn.mjs} +7 -7
- package/dist/{current-deployment-workflow-BRUEdPrN.mjs → current-deployment-workflow-DiwUcKoB.mjs} +6 -6
- package/dist/{current.handler-QZQ-l84v.mjs → current.handler-eCR4nClu.mjs} +3 -3
- package/dist/{delete.handler-Bude0SVP.mjs → delete.handler-D4ElSAcr.mjs} +2 -2
- package/dist/{deploy-eshEEiP-.mjs → deploy-B7LRWcp6.mjs} +2 -2
- package/dist/{deploy-CJbVB7e2.mjs → deploy-DyZh--f7.mjs} +1 -1
- package/dist/{deploy-progress-DJHph1Fz.mjs → deploy-progress-DK87VKJ-.mjs} +2 -2
- package/dist/{deploy.handler-BxxWI7nV.mjs → deploy.handler-DVnH-Niv.mjs} +20 -20
- package/dist/{detect-env-access-CwkOYeYM-CZIixHeR.mjs → detect-env-access-CwkOYeYM-CNTyUzme.mjs} +1 -1
- package/dist/{diff-utils-4OQTpP5s.mjs → diff-utils-B0ED-Igv.mjs} +1 -1
- package/dist/{diff.handler-CzrKCj7N.mjs → diff.handler-lIA2pRBX.mjs} +7 -7
- package/dist/dist-CIInPRGh.mjs +1071 -0
- package/dist/{dist-FQYQ2FLm.mjs → dist-WFPTDQB3.mjs} +15 -15
- package/dist/{env.handler-B3YDQIVE.mjs → env.handler-BIzQLlmo.mjs} +10 -10
- package/dist/{error-boundary-CyLcinp1.mjs → error-boundary-B8cmSwJH.mjs} +3 -3
- package/dist/{file-metadata-DaPPpiTh.mjs → file-metadata-lrX05iRt.mjs} +1 -1
- package/dist/{iam-command-utils-ByLX0A-V.mjs → iam-command-utils-CSZj4XlH.mjs} +2 -2
- package/dist/{import-module--8x5SLum-DaUNACER.mjs → import-module--8x5SLum-D7EiPjwl.mjs} +6 -6
- package/dist/{init-PTwX63_P.mjs → init-jaqNLGmB.mjs} +3 -3
- package/dist/{init.handler-CdytFiFt.mjs → init.handler-DamvbPEw.mjs} +11 -9
- package/dist/{inspect.handler-umc7of-r.mjs → inspect.handler-_UcN7dxE.mjs} +8 -8
- package/dist/{integration-catalog-BgT4mLzW.mjs → integration-catalog-m8tj_XlD.mjs} +3 -3
- package/dist/{integrations-B0Gv-L0s.mjs → integrations-DRL3JmC8.mjs} +12 -7
- package/dist/{invites-Cqi7iyIN.mjs → invites-VntHNMYk.mjs} +5 -5
- package/dist/{invites.list.handler-CErgY35S.mjs → invites.list.handler-CPl4QHfc.mjs} +4 -4
- package/dist/{invites.resend.handler-DRCRIA4F.mjs → invites.resend.handler-BAtb3AX4.mjs} +4 -4
- package/dist/{invites.revoke.handler-C0FZdAR0.mjs → invites.revoke.handler-qXOF1Vgx.mjs} +4 -4
- package/dist/keystroke.mjs +558 -207
- package/dist/{list-enrichment-C6u5eI0j.mjs → list-enrichment-DYvr3XDb.mjs} +3 -3
- package/dist/{list.handler-c-8RpgB9.mjs → list.handler-BLkQKiV1.mjs} +17 -16
- package/dist/{list.handler-CBEXiTAK.mjs → list.handler-BdRsjRlf.mjs} +3 -3
- package/dist/{list.handler-BjutlIkE.mjs → list.handler-CEjKSezx.mjs} +59 -13
- package/dist/{list2.handler-T5v4EK20.mjs → list.handler-CJUFdmaU.mjs} +7 -7
- package/dist/{list.handler-Cr_DFAae.mjs → list.handler-C_iBLBmS.mjs} +3 -3
- package/dist/{list.handler-FlchXrKz.mjs → list.handler-DUz1bJ4x.mjs} +4 -4
- package/dist/{list.handler-D-YFoKLU.mjs → list.handler-pHnPFep8.mjs} +7 -7
- package/dist/{listen-rHLiCWbn.mjs → listen-DLGZEQRL.mjs} +3 -3
- package/dist/{listen.handler-B9T58yAj.mjs → listen.handler-kaAvYk-B.mjs} +4 -4
- package/dist/logs-CcYqFKRU.mjs +58 -0
- package/dist/logs.handler-DyRoevtO.mjs +53 -0
- package/dist/{logs.handler-DGcGN2qb.mjs → logs.handler-lboRKNoE.mjs} +4 -4
- package/dist/{members.add.handler-DmYI43rZ.mjs → members.add.handler-DBydP0SR.mjs} +4 -4
- package/dist/{members.invite.handler-B_KVxv5m.mjs → members.invite.handler-D4-7fiYC.mjs} +4 -4
- package/dist/{members.list.handler-BtuuIgQS.mjs → members.list.handler-Z4cIbcNg.mjs} +4 -4
- package/dist/{members.remove.handler-Lvg-CqVv.mjs → members.remove.handler-J56D83O7.mjs} +4 -4
- package/dist/{members.update.handler-D-8izeso.mjs → members.update.handler-B5rBv6dt.mjs} +4 -4
- package/dist/{normalize-path-CojS-CgQ-DFTvyA27.mjs → normalize-path-CojS-CgQ-D4wSBHgG.mjs} +1 -1
- package/dist/{org-DUCts2MV.mjs → org-DGS91uc-.mjs} +17 -17
- package/dist/{orgs.create.handler-vXQgDJZ_.mjs → orgs.create.handler-B4naNUSN.mjs} +4 -4
- package/dist/{orgs.get.handler-D_Jfl18x.mjs → orgs.get.handler-Ci_JrT08.mjs} +4 -4
- package/dist/{orgs.list.handler-BNjoTJvV.mjs → orgs.list.handler-CJ2byIEj.mjs} +4 -4
- package/dist/{output-CGdYhH0p.mjs → output-BWcVRt-T.mjs} +1 -1
- package/dist/paths-JzzFkXQA-CEipIeVl.mjs +36 -0
- package/dist/{paused.handler-ST9dCe8E.mjs → paused.handler-BQSQvQhB.mjs} +3 -3
- package/dist/{projects-CbquwUlm.mjs → projects-D90_uEC2.mjs} +5 -5
- package/dist/{projects-DfaG_3WP.mjs → projects-fWvIJQ80.mjs} +1 -1
- package/dist/{register.handler-BAx0IC-u.mjs → register.handler-CleQJhtQ.mjs} +2 -2
- package/dist/{requirements.handler-D5dFi7XZ.mjs → requirements.handler-B51sxQSy.mjs} +7 -7
- package/dist/resolve-cli-credentials-DytxgMwn.mjs +47 -0
- package/dist/{resolve-project-CURYMjex.mjs → resolve-project-CNQtOWE4.mjs} +7 -7
- package/dist/{run-polling-BWcLQvm0.mjs → run-polling-CC6y2XXI.mjs} +5 -5
- package/dist/{run.handler-BiBDLoeH.mjs → run.handler-B31BpZJP.mjs} +9 -9
- package/dist/{runs-Bc3zjk7V.mjs → runs-Bg_qDeQi.mjs} +4 -4
- package/dist/{skill-installer-DkRJ6oLi.mjs → skill-installer-BBgN2tzW.mjs} +2 -2
- package/dist/{skills-sync.handler-C4ztv1Vu.mjs → skills-sync.handler-DOxudKmV.mjs} +3 -3
- package/dist/{skills.command-DuL4kLUi.mjs → skills.command-JwKWpGvU.mjs} +5 -5
- package/dist/{skills.handler-R5KAbioE.mjs → skills.handler-Do9I3dQS.mjs} +1 -1
- package/dist/{source-analysis-BBg2E_6G-BQqm16RR.mjs → source-analysis-BBg2E_6G-Ut7kYHOz.mjs} +4 -4
- package/dist/{spinner-progress-DfkMzwGx.mjs → spinner-progress-Bx-fYItP.mjs} +1 -1
- package/dist/{src-BQdOWkyv.mjs → src-B0tNjKMg.mjs} +1 -1
- package/dist/{status.handler-DxCJRm1n.mjs → status.handler-BsVtDW_V.mjs} +19 -4
- package/dist/{switch.handler-CTwhIcaQ.mjs → switch.handler-Cu81T2HY.mjs} +5 -5
- package/dist/{sync-Pssitj6K.mjs → sync-CXNveL61.mjs} +2 -2
- package/dist/{sync.handler-Be0U3x-n.mjs → sync.handler-7g1yDt0H.mjs} +9 -9
- package/dist/{task-BNXDZU71.mjs → task-BguWXIiH.mjs} +2 -2
- package/dist/{task-target-build-BG6cC3bz.mjs → task-target-build-BaMtXnN7.mjs} +8 -7
- package/dist/{task-target-deploy-CZBGNC0H-Ck724yF4.mjs → task-target-deploy-CZBGNC0H-I-tvkGCC.mjs} +1 -1
- package/dist/{task-target-deploy-gMQC8kXU.mjs → task-target-deploy-DmpCWE3u.mjs} +1 -1
- package/dist/task-target-deploy-runner.mjs +22 -17
- package/dist/{test-BISghlKg.mjs → test-A5hz3c7j.mjs} +4 -4
- package/dist/{test.handler-DkizZhVu.mjs → test.handler-CJtaMZVy.mjs} +12 -12
- package/dist/{test.handler-Dk3CmTa7.mjs → test.handler-Cq2l7SAr.mjs} +2 -2
- package/dist/{tool.handler-Bu130Vcz.mjs → tool.handler-B-mOL128.mjs} +115 -95
- package/dist/{trigger-artifacts-RizI57RC-CxHwCkQ_.mjs → trigger-artifacts-RizI57RC-DjhOsdOm.mjs} +4 -4
- package/dist/{trigger-manifest-PTjVYL1r.mjs → trigger-manifest-Bq2zRbkV.mjs} +1 -1
- package/dist/{upgrade-cH9I_pZq.mjs → upgrade-DhfpoyRV.mjs} +2 -2
- package/dist/{upgrade.handler-CXEF4ue0.mjs → upgrade.handler-5qSzPC7D.mjs} +1 -1
- package/dist/{upload.handler-CpKuAaQ_.mjs → upload.handler-D3-W_1kq.mjs} +10 -10
- package/dist/{users.get.handler-D0WO6D1K.mjs → users.get.handler-Bd0OBI-E.mjs} +4 -4
- package/dist/{users.list.handler-BSTIniF1.mjs → users.list.handler-CacJz6eC.mjs} +4 -4
- package/dist/{users.set-role.handler-DAKdSkbn.mjs → users.set-role.handler-bZMQtUR0.mjs} +4 -4
- package/dist/{utils-VC0Vl_pm.mjs → utils-BMUWnz1P.mjs} +2 -2
- package/dist/{validate.handler-I8LY-UkG.mjs → validate.handler-Ccq66ki4.mjs} +8 -8
- package/dist/{workflow-build-C9rQQ4qU.mjs → workflow-build-_WNsLKwW.mjs} +23 -23
- package/dist/{workflow-build-manifest-OPFqFD6f.mjs → workflow-build-manifest-B2GqHyWE.mjs} +3 -3
- package/dist/{workflow-bundler-BzHk73PM-AIB4-u4Y.mjs → workflow-bundler-BzHk73PM-WI31RJjH.mjs} +3 -3
- package/dist/{workflows-CL1jYSLR.mjs → workflows-Dy2M9bEr.mjs} +16 -16
- package/dist/{writer-B-SpZ0G2-olEAgSLc.mjs → writer-B-SpZ0G2-tq1MFgid.mjs} +6 -6
- package/package.json +6 -6
- package/dist/clear.handler-Dpe05eTq.mjs +0 -42
- package/dist/dist-BF6r1hfv.mjs +0 -308
- package/dist/logs-DUwdYZB-.mjs +0 -28
- package/dist/logs.handler-dcRq-zoc.mjs +0 -35
- package/dist/{agent-bundle-package-DWV6B_5q-rRTPU13L.mjs → agent-bundle-package-DWV6B_5q-FPT0bJaA.mjs} +0 -0
- package/dist/{agent-manifest-CZdlCTFs.mjs → agent-manifest-tIsqF2OP.mjs} +0 -0
- package/dist/{browser-3cUiPlk2.mjs → browser-BpJ8ut9z.mjs} +0 -0
- package/dist/{common-BaGFkj3n.mjs → common-AK0q0Oz0.mjs} +0 -0
- package/dist/{concurrency-gXn9Rw8x-BI6HQNfC.mjs → concurrency-gXn9Rw8x-BTlfau8D.mjs} +0 -0
- package/dist/{cron-parser-C2eJD0yD.mjs → cron-parser-Dw_cWzFu.mjs} +0 -0
- package/dist/{declared-credential-requirements-B6h4WRv4.mjs → declared-credential-requirements-D6KT-r-e.mjs} +0 -0
- package/dist/{default-urls-BS4twrsS.mjs → default-urls-CTQqM1_A.mjs} +0 -0
- package/dist/{layout-CXkZEsXI.mjs → layout-P1v-Gssz.mjs} +0 -0
- package/dist/{metadata-layout-Bv-B0nHj-CqlcZz_g.mjs → metadata-layout-Bv-B0nHj-B1c5giJ7.mjs} +1 -1
- package/dist/{oxc-B3KI3rf_-DdiZWqe2.mjs → oxc-B3KI3rf_-Cvx4Z-4H.mjs} +0 -0
- package/dist/{project-config-CsBMT4TL.mjs → project-config-DudGRFPO.mjs} +1 -1
- package/dist/{read-credential-keys-77a91T8M-DMmY6oDW.mjs → read-credential-keys-77a91T8M-B0eiobOd.mjs} +0 -0
- package/dist/{rolldown-runtime-twds-ZHy-CO5ir_za.mjs → rolldown-runtime-twds-ZHy-8uqgIurC.mjs} +0 -0
- package/dist/{run-polling-CwlzB5-9.mjs → run-polling-DARidqo-.mjs} +0 -0
- package/dist/{schema-O9xTWad_.mjs → schema-BjH_e4Fo.mjs} +0 -0
- package/dist/{schema-_FQrHcIS.mjs → schema-Lbp5lGJu.mjs} +0 -0
- package/dist/{schema-display-CNqiYBIb.mjs → schema-display-NVEl_DFY.mjs} +0 -0
- package/dist/{schemas-DodkHgnS.mjs → schemas-B8c7Z5Iy.mjs} +0 -0
- package/dist/{source-analysis-CJPymdaA.mjs → source-analysis-Cs0CTBQk.mjs} +0 -0
- package/dist/{types-D04ah3uY.mjs → types-BMBuhHhW.mjs} +0 -0
- package/dist/{upload-wwSPAC5_.mjs → upload-BbcMkyVl.mjs} +1 -1
package/dist/dist-BF6r1hfv.mjs
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import * as fs$1 from "node:fs/promises";
|
|
4
|
-
import * as os from "node:os";
|
|
5
|
-
import * as path$1 from "node:path";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region ../../packages/local-memory/dist/index.mjs
|
|
8
|
-
const KEYSTROKE_CREDENTIALS_DIR = ".keystroke";
|
|
9
|
-
const KEYSTROKE_CREDENTIALS_FILE = "credentials.json";
|
|
10
|
-
const credentialUserSchema = z.object({
|
|
11
|
-
id: z.string().min(1),
|
|
12
|
-
email: z.email(),
|
|
13
|
-
name: z.string().optional()
|
|
14
|
-
});
|
|
15
|
-
const storedCredentialsSchemaV1 = z.object({
|
|
16
|
-
version: z.literal(1),
|
|
17
|
-
apiKey: z.string().min(1),
|
|
18
|
-
apiKeyId: z.uuid().optional(),
|
|
19
|
-
serverUrl: z.url(),
|
|
20
|
-
webUrl: z.url(),
|
|
21
|
-
createdAt: z.string().min(1),
|
|
22
|
-
organizationId: z.uuid().optional(),
|
|
23
|
-
organizationName: z.string().optional(),
|
|
24
|
-
user: credentialUserSchema.optional()
|
|
25
|
-
});
|
|
26
|
-
const orgEntrySchema = z.object({
|
|
27
|
-
organizationId: z.uuid(),
|
|
28
|
-
organizationName: z.string().min(1),
|
|
29
|
-
apiKey: z.string().min(1),
|
|
30
|
-
apiKeyId: z.uuid().optional(),
|
|
31
|
-
createdAt: z.string().min(1)
|
|
32
|
-
});
|
|
33
|
-
const storedCredentialsSchema = z.object({
|
|
34
|
-
version: z.literal(2),
|
|
35
|
-
serverUrl: z.url(),
|
|
36
|
-
webUrl: z.url(),
|
|
37
|
-
user: credentialUserSchema.optional(),
|
|
38
|
-
activeOrgId: z.uuid().optional(),
|
|
39
|
-
orgs: z.array(orgEntrySchema)
|
|
40
|
-
});
|
|
41
|
-
function getCredentialsDirPath(homeDir = os.homedir()) {
|
|
42
|
-
return path$1.join(homeDir, KEYSTROKE_CREDENTIALS_DIR);
|
|
43
|
-
}
|
|
44
|
-
function getCredentialsFilePath(homeDir = os.homedir()) {
|
|
45
|
-
return path$1.join(getCredentialsDirPath(homeDir), KEYSTROKE_CREDENTIALS_FILE);
|
|
46
|
-
}
|
|
47
|
-
function migrateV1ToV2(v1) {
|
|
48
|
-
const orgs = [];
|
|
49
|
-
if (v1.organizationId && v1.apiKey) orgs.push({
|
|
50
|
-
organizationId: v1.organizationId,
|
|
51
|
-
organizationName: v1.organizationName ?? "Unknown",
|
|
52
|
-
apiKey: v1.apiKey,
|
|
53
|
-
apiKeyId: v1.apiKeyId,
|
|
54
|
-
createdAt: v1.createdAt
|
|
55
|
-
});
|
|
56
|
-
return {
|
|
57
|
-
version: 2,
|
|
58
|
-
serverUrl: v1.serverUrl,
|
|
59
|
-
webUrl: v1.webUrl,
|
|
60
|
-
user: v1.user,
|
|
61
|
-
activeOrgId: v1.organizationId,
|
|
62
|
-
orgs
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async function readStoredCredentials(filePath = getCredentialsFilePath()) {
|
|
66
|
-
try {
|
|
67
|
-
const raw = await fs$1.readFile(filePath, "utf-8");
|
|
68
|
-
const parsed = JSON.parse(raw);
|
|
69
|
-
const v2 = storedCredentialsSchema.safeParse(parsed);
|
|
70
|
-
if (v2.success) return v2.data;
|
|
71
|
-
const v1 = storedCredentialsSchemaV1.safeParse(parsed);
|
|
72
|
-
if (v1.success) return migrateV1ToV2(v1.data);
|
|
73
|
-
throw new Error(`Invalid credentials file: ${filePath}`);
|
|
74
|
-
} catch (error) {
|
|
75
|
-
if (error.code === "ENOENT") return null;
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function deleteStoredCredentials(filePath = getCredentialsFilePath()) {
|
|
80
|
-
try {
|
|
81
|
-
await fs$1.unlink(filePath);
|
|
82
|
-
return true;
|
|
83
|
-
} catch (error) {
|
|
84
|
-
if (error.code === "ENOENT") return false;
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async function writeStoredCredentials(credentials, filePath = getCredentialsFilePath()) {
|
|
89
|
-
const parsed = storedCredentialsSchema.parse(credentials);
|
|
90
|
-
await fs$1.mkdir(path$1.dirname(filePath), { recursive: true });
|
|
91
|
-
await fs$1.writeFile(filePath, `${JSON.stringify(parsed, null, 2)}\n`, { mode: 384 });
|
|
92
|
-
try {
|
|
93
|
-
await fs$1.chmod(filePath, 384);
|
|
94
|
-
} catch {}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Adds or replaces an org entry in stored credentials. Sets it as the active org.
|
|
98
|
-
* Creates the credentials file if it doesn't exist (requires shared fields).
|
|
99
|
-
*/
|
|
100
|
-
async function upsertOrgCredentials(params, filePath = getCredentialsFilePath()) {
|
|
101
|
-
const existing = await readStoredCredentials(filePath);
|
|
102
|
-
if (existing) {
|
|
103
|
-
const orgs = existing.orgs.filter((o) => o.organizationId !== params.orgEntry.organizationId);
|
|
104
|
-
orgs.push(params.orgEntry);
|
|
105
|
-
await writeStoredCredentials({
|
|
106
|
-
...existing,
|
|
107
|
-
serverUrl: params.serverUrl,
|
|
108
|
-
webUrl: params.webUrl,
|
|
109
|
-
user: params.user ?? existing.user,
|
|
110
|
-
activeOrgId: params.orgEntry.organizationId,
|
|
111
|
-
orgs
|
|
112
|
-
}, filePath);
|
|
113
|
-
} else await writeStoredCredentials({
|
|
114
|
-
version: 2,
|
|
115
|
-
serverUrl: params.serverUrl,
|
|
116
|
-
webUrl: params.webUrl,
|
|
117
|
-
user: params.user,
|
|
118
|
-
activeOrgId: params.orgEntry.organizationId,
|
|
119
|
-
orgs: [params.orgEntry]
|
|
120
|
-
}, filePath);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Sets the active org. Validates the org exists in the stored orgs array.
|
|
124
|
-
* @throws Error if no stored credentials or org not found
|
|
125
|
-
*/
|
|
126
|
-
async function setActiveOrg(orgId, filePath = getCredentialsFilePath()) {
|
|
127
|
-
const existing = await readStoredCredentials(filePath);
|
|
128
|
-
if (!existing) throw new Error("No stored credentials found. Run `keystroke auth` first.");
|
|
129
|
-
if (!existing.orgs.find((o) => o.organizationId === orgId)) throw new Error(`No stored API key for organization ${orgId}. Run \`keystroke auth\` to add credentials for this org.`);
|
|
130
|
-
await writeStoredCredentials({
|
|
131
|
-
...existing,
|
|
132
|
-
activeOrgId: orgId
|
|
133
|
-
}, filePath);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Removes a single org entry from stored credentials.
|
|
137
|
-
* If it was the active org, clears activeOrgId (falls back to first remaining org).
|
|
138
|
-
* Returns the removed entry (for key revocation), or null if not found.
|
|
139
|
-
*/
|
|
140
|
-
async function removeOrgCredentials(orgId, filePath = getCredentialsFilePath()) {
|
|
141
|
-
const existing = await readStoredCredentials(filePath);
|
|
142
|
-
if (!existing) return null;
|
|
143
|
-
const removed = existing.orgs.find((o) => o.organizationId === orgId);
|
|
144
|
-
if (!removed) return null;
|
|
145
|
-
const remainingOrgs = existing.orgs.filter((o) => o.organizationId !== orgId);
|
|
146
|
-
if (remainingOrgs.length === 0) {
|
|
147
|
-
await deleteStoredCredentials(filePath);
|
|
148
|
-
return removed;
|
|
149
|
-
}
|
|
150
|
-
const newActiveId = existing.activeOrgId === orgId ? remainingOrgs[0]?.organizationId : existing.activeOrgId;
|
|
151
|
-
await writeStoredCredentials({
|
|
152
|
-
...existing,
|
|
153
|
-
orgs: remainingOrgs,
|
|
154
|
-
activeOrgId: newActiveId
|
|
155
|
-
}, filePath);
|
|
156
|
-
return removed;
|
|
157
|
-
}
|
|
158
|
-
function toErrorMessage(error) {
|
|
159
|
-
return error instanceof Error ? error.message : String(error);
|
|
160
|
-
}
|
|
161
|
-
function findActiveOrg(creds) {
|
|
162
|
-
if (!creds.activeOrgId) return creds.orgs[0];
|
|
163
|
-
return creds.orgs.find((o) => o.organizationId === creds.activeOrgId) ?? creds.orgs[0];
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Resolves API auth options using explicit overrides first, then ~/.keystroke credentials.
|
|
167
|
-
* When a logger is provided, it emits consistent fallback/read diagnostics.
|
|
168
|
-
*/
|
|
169
|
-
async function resolveAuthOptions(input) {
|
|
170
|
-
const credentialsPath = input.credentialsPath ?? getCredentialsFilePath();
|
|
171
|
-
let storedCredentials = null;
|
|
172
|
-
try {
|
|
173
|
-
storedCredentials = await readStoredCredentials(credentialsPath);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
input.logger?.warn(`Could not read saved credentials from ${credentialsPath}: ${toErrorMessage(error)}`);
|
|
176
|
-
}
|
|
177
|
-
const activeOrg = storedCredentials ? findActiveOrg(storedCredentials) : void 0;
|
|
178
|
-
const apiKey = input.apiKey ?? activeOrg?.apiKey;
|
|
179
|
-
const serverUrl = input.serverUrl ?? storedCredentials?.serverUrl;
|
|
180
|
-
if (!input.apiKey && activeOrg?.apiKey) input.logger?.info(`Using saved API key from ${credentialsPath}`);
|
|
181
|
-
if (!input.serverUrl && storedCredentials?.serverUrl) input.logger?.info(`Using saved API URL from ${credentialsPath}`);
|
|
182
|
-
return {
|
|
183
|
-
apiKey,
|
|
184
|
-
serverUrl,
|
|
185
|
-
credentialsPath,
|
|
186
|
-
storedCredentials,
|
|
187
|
-
activeOrg
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const KEYSTROKE_LOGS_DIR = "logs";
|
|
191
|
-
const KEYSTROKE_LOG_FILE = "cli.jsonl";
|
|
192
|
-
function getLogFilePath(homeDir = os.homedir()) {
|
|
193
|
-
return path$1.join(homeDir, KEYSTROKE_CREDENTIALS_DIR, KEYSTROKE_LOGS_DIR, KEYSTROKE_LOG_FILE);
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Reads the last `count` lines from the log file as raw strings.
|
|
197
|
-
* Returns an empty array if the file does not exist.
|
|
198
|
-
*/
|
|
199
|
-
async function readLogFile(count = 100, homeDir = os.homedir()) {
|
|
200
|
-
const filePath = getLogFilePath(homeDir);
|
|
201
|
-
let content;
|
|
202
|
-
try {
|
|
203
|
-
content = await fs$1.readFile(filePath, "utf-8");
|
|
204
|
-
} catch {
|
|
205
|
-
return [];
|
|
206
|
-
}
|
|
207
|
-
const lines = content.split("\n");
|
|
208
|
-
if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
|
|
209
|
-
return lines.slice(-count);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Deletes the log file. Returns true if the file existed and was deleted,
|
|
213
|
-
* false if it did not exist.
|
|
214
|
-
*/
|
|
215
|
-
async function clearLogFile(homeDir = os.homedir()) {
|
|
216
|
-
const filePath = getLogFilePath(homeDir);
|
|
217
|
-
try {
|
|
218
|
-
await fs$1.unlink(filePath);
|
|
219
|
-
return true;
|
|
220
|
-
} catch (err) {
|
|
221
|
-
if (err.code === "ENOENT") return false;
|
|
222
|
-
throw err;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
const KEYSTROKE_PROJECTS_FILE = "projects.json";
|
|
226
|
-
const projectEntrySchema = z.object({
|
|
227
|
-
lastAccessed: z.string().min(1),
|
|
228
|
-
name: z.string().min(1).optional()
|
|
229
|
-
});
|
|
230
|
-
const storedProjectsSchema = z.object({
|
|
231
|
-
version: z.literal(1),
|
|
232
|
-
projects: z.record(z.string(), projectEntrySchema),
|
|
233
|
-
lastProject: z.string().optional()
|
|
234
|
-
});
|
|
235
|
-
function getProjectsFilePath(homeDir = os.homedir()) {
|
|
236
|
-
return path$1.join(homeDir, KEYSTROKE_CREDENTIALS_DIR, KEYSTROKE_PROJECTS_FILE);
|
|
237
|
-
}
|
|
238
|
-
async function readStoredProjects(filePath = getProjectsFilePath()) {
|
|
239
|
-
try {
|
|
240
|
-
const raw = await fs$1.readFile(filePath, "utf-8");
|
|
241
|
-
const parsed = JSON.parse(raw);
|
|
242
|
-
const result = storedProjectsSchema.safeParse(parsed);
|
|
243
|
-
if (!result.success) return null;
|
|
244
|
-
return result.data;
|
|
245
|
-
} catch (error) {
|
|
246
|
-
if (error.code === "ENOENT") return null;
|
|
247
|
-
if (error instanceof SyntaxError) return null;
|
|
248
|
-
throw error;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
async function writeStoredProjects(projects, filePath = getProjectsFilePath()) {
|
|
252
|
-
const parsed = storedProjectsSchema.parse(projects);
|
|
253
|
-
await fs$1.mkdir(path$1.dirname(filePath), { recursive: true });
|
|
254
|
-
await fs$1.writeFile(filePath, `${JSON.stringify(parsed, null, 2)}\n`);
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Upsert a project entry. Fire-and-forget safe — catches all errors internally.
|
|
258
|
-
* Never throws. Call without `await` if you don't need to wait.
|
|
259
|
-
*/
|
|
260
|
-
async function trackProject(projectPath, options) {
|
|
261
|
-
const filePath = options?.filePath ?? getProjectsFilePath();
|
|
262
|
-
const absolutePath = path$1.resolve(projectPath);
|
|
263
|
-
try {
|
|
264
|
-
const data = await readStoredProjects(filePath) ?? {
|
|
265
|
-
version: 1,
|
|
266
|
-
projects: {}
|
|
267
|
-
};
|
|
268
|
-
const previousEntry = data.projects[absolutePath];
|
|
269
|
-
const entry = {
|
|
270
|
-
lastAccessed: (/* @__PURE__ */ new Date()).toISOString(),
|
|
271
|
-
...options?.name ? { name: options.name } : previousEntry?.name ? { name: previousEntry.name } : {}
|
|
272
|
-
};
|
|
273
|
-
data.projects[absolutePath] = entry;
|
|
274
|
-
data.lastProject = absolutePath;
|
|
275
|
-
await writeStoredProjects(data, filePath);
|
|
276
|
-
} catch {}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Clears the stored projects file (projects.json). Returns true if the file
|
|
280
|
-
* existed and was deleted, false if it did not exist.
|
|
281
|
-
*/
|
|
282
|
-
async function clearStoredProjects(filePath = getProjectsFilePath()) {
|
|
283
|
-
try {
|
|
284
|
-
await fs$1.unlink(filePath);
|
|
285
|
-
return true;
|
|
286
|
-
} catch (error) {
|
|
287
|
-
if (error.code === "ENOENT") return false;
|
|
288
|
-
throw error;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
/** Base directory name for all Keystroke local storage (user and project-local). */
|
|
292
|
-
const KEYSTROKE_DIR = KEYSTROKE_CREDENTIALS_DIR;
|
|
293
|
-
/**
|
|
294
|
-
* Returns the Keystroke temp directory path.
|
|
295
|
-
*
|
|
296
|
-
* - `getKeystrokeTmpDir({ projectRoot })` → `projectRoot/.keystroke/tmp` — for build
|
|
297
|
-
* artifacts that require module resolution from the project (workflow-builder).
|
|
298
|
-
* - `getKeystrokeTmpDir()` → `~/.keystroke/tmp` — for general temporary storage.
|
|
299
|
-
*
|
|
300
|
-
* Callers must create the directory (e.g. `mkdir(path, { recursive: true })`)
|
|
301
|
-
* before use.
|
|
302
|
-
*/
|
|
303
|
-
function getKeystrokeTmpDir(options) {
|
|
304
|
-
const baseDir = options?.projectRoot ? path$1.resolve(options.projectRoot) : os.homedir();
|
|
305
|
-
return path$1.join(baseDir, KEYSTROKE_DIR, "tmp");
|
|
306
|
-
}
|
|
307
|
-
//#endregion
|
|
308
|
-
export { getKeystrokeTmpDir as a, removeOrgCredentials as c, trackProject as d, upsertOrgCredentials as f, getCredentialsFilePath as i, resolveAuthOptions as l, clearStoredProjects as n, readLogFile as o, deleteStoredCredentials as r, readStoredProjects as s, clearLogFile as t, setActiveOrg as u };
|
package/dist/logs-DUwdYZB-.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { t as createTypedCommand } from "./commander-D15UZVjp.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/commands/logs/logs.command.ts
|
|
6
|
-
const LogsOptionsSchema = z.object({ count: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of log entries to display") });
|
|
7
|
-
const LOGS_OPTIONS_CONFIG = { count: {
|
|
8
|
-
flag: "--count <n>",
|
|
9
|
-
description: "Number of log entries to display (default: 100)"
|
|
10
|
-
} };
|
|
11
|
-
function createLogsCommand() {
|
|
12
|
-
return createTypedCommand({
|
|
13
|
-
name: "logs",
|
|
14
|
-
description: "Display recent CLI log entries",
|
|
15
|
-
schema: LogsOptionsSchema,
|
|
16
|
-
optionsConfig: LOGS_OPTIONS_CONFIG,
|
|
17
|
-
loadHandler: async () => (await import("./logs.handler-dcRq-zoc.mjs")).handleLogs,
|
|
18
|
-
subcommands: [createTypedCommand({
|
|
19
|
-
name: "clear",
|
|
20
|
-
description: "Delete the CLI log file",
|
|
21
|
-
schema: z.object({}),
|
|
22
|
-
optionsConfig: {},
|
|
23
|
-
loadHandler: async () => (await import("./clear.handler-CtOZ4aRn.mjs")).handleLogsClear
|
|
24
|
-
})]
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { createLogsCommand };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { d as originalConsole, f as ANSI, n as ui, p as style } from "./keystroke.mjs";
|
|
4
|
-
import { o as readLogFile } from "./dist-BF6r1hfv.mjs";
|
|
5
|
-
//#region src/commands/logs/logs.handler.ts
|
|
6
|
-
const LEVEL_STYLES = {
|
|
7
|
-
debug: ANSI.dim,
|
|
8
|
-
info: ANSI.cyan,
|
|
9
|
-
warn: ANSI.yellow,
|
|
10
|
-
error: ANSI.red
|
|
11
|
-
};
|
|
12
|
-
function formatEntry(line) {
|
|
13
|
-
let entry;
|
|
14
|
-
try {
|
|
15
|
-
entry = JSON.parse(line);
|
|
16
|
-
} catch {
|
|
17
|
-
return line;
|
|
18
|
-
}
|
|
19
|
-
const ts = style(entry.timestamp, ANSI.dim);
|
|
20
|
-
const levelStyled = style(`[${entry.level.toUpperCase()}]`, LEVEL_STYLES[entry.level] ?? "");
|
|
21
|
-
const meta = entry.meta !== void 0 ? ` ${style(JSON.stringify(entry.meta), ANSI.dim)}` : "";
|
|
22
|
-
return `${ts} ${levelStyled} ${entry.message}${meta}`;
|
|
23
|
-
}
|
|
24
|
-
async function handleLogs(options, _ctx) {
|
|
25
|
-
const lines = await readLogFile(options.count);
|
|
26
|
-
if (lines.length === 0) {
|
|
27
|
-
ui.hint("No log entries found.");
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
for (const line of lines) originalConsole.info(formatEntry(line));
|
|
31
|
-
ui.br();
|
|
32
|
-
ui.hint(`Showing ${lines.length} log ${lines.length === 1 ? "entry" : "entries"}.`);
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { handleLogs };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/{metadata-layout-Bv-B0nHj-CqlcZz_g.mjs → metadata-layout-Bv-B0nHj-B1c5giJ7.mjs}
RENAMED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-CH6r78ws.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import { readFile } from "node:fs/promises";
|
|
6
5
|
import * as path$1 from "node:path";
|
|
6
|
+
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
|
|
9
9
|
var require_array = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { access, mkdir, stat, writeFile } from "node:fs/promises";
|
|
4
3
|
import path from "node:path";
|
|
4
|
+
import { access, mkdir, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region ../../packages/project-config/src/config.ts
|
|
File without changes
|
package/dist/{rolldown-runtime-twds-ZHy-CO5ir_za.mjs → rolldown-runtime-twds-ZHy-8uqgIurC.mjs}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { n as __exportAll } from "./chunk-CH6r78ws.mjs";
|
|
4
|
-
import { createReadStream, promises } from "node:fs";
|
|
5
4
|
import path from "node:path";
|
|
5
|
+
import { createReadStream, promises } from "node:fs";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import http from "node:http";
|
|
8
8
|
import https from "node:https";
|