@eide/foir-cli 0.1.21 → 0.1.23

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.
@@ -7,23 +7,25 @@ export interface StoredCredentials {
7
7
  email: string;
8
8
  name: string;
9
9
  };
10
- selectedProject?: {
11
- id: string;
12
- name: string;
13
- tenantId: string;
14
- apiKey?: string;
15
- apiKeyId?: string;
16
- };
17
10
  }
18
11
  export declare function getCredentialsDir(): string;
19
12
  export declare function getCredentialsPath(): string;
20
13
  export declare function getCredentials(): Promise<StoredCredentials | null>;
21
14
  export declare function writeCredentials(credentials: StoredCredentials): Promise<void>;
22
- export declare function updateCredentials(updates: Partial<StoredCredentials>): Promise<void>;
23
15
  export declare function deleteCredentials(): Promise<void>;
24
16
  export declare function isTokenExpired(credentials: StoredCredentials): boolean;
25
17
  export declare function getValidCredentials(refreshFn?: (refreshToken: string) => Promise<{
26
18
  accessToken: string;
27
19
  expiresAt: string;
28
20
  }>): Promise<StoredCredentials | null>;
21
+ export interface ProjectContext {
22
+ id: string;
23
+ name: string;
24
+ tenantId: string;
25
+ apiKey?: string;
26
+ apiKeyId?: string;
27
+ }
28
+ export declare function getProjectContext(): Promise<ProjectContext | null>;
29
+ export declare function writeProjectContext(project: ProjectContext): Promise<void>;
30
+ export declare function deleteProjectContext(): Promise<void>;
29
31
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/auth/credentials.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,eAAe,CAAC,EAAE;QAChB,EAAE,EAAE,M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;AAYD,wBAAsB,cAAc,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAUxE;AAED,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQvD;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAItE;AAED,wBAAsB,mBAAmB,CACvC,SAAS,CAAC,EAAE,CACV,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACvD,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAoBnC;AAMD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA4CD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAUxE;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ1D"}
@@ -1,5 +1,5 @@
1
- import { promises as fs } from 'fs';
2
- import { join } from 'path';
1
+ import { promises as fs, statSync } from 'fs';
2
+ import { join, dirname } from 'path';
3
3
  import { homedir } from 'os';
4
4
  export function getCredentialsDir() {
5
5
  return join(homedir(), '.foir');
@@ -7,8 +7,7 @@ export function getCredentialsDir() {
7
7
  export function getCredentialsPath() {
8
8
  return join(getCredentialsDir(), 'credentials.json');
9
9
  }
10
- async function ensureCredentialsDir() {
11
- const dir = getCredentialsDir();
10
+ async function ensureDir(dir) {
12
11
  try {
13
12
  await fs.mkdir(dir, { recursive: true, mode: 0o700 });
14
13
  }
@@ -31,19 +30,12 @@ export async function getCredentials() {
31
30
  }
32
31
  }
33
32
  export async function writeCredentials(credentials) {
34
- await ensureCredentialsDir();
33
+ await ensureDir(getCredentialsDir());
35
34
  const path = getCredentialsPath();
36
35
  await fs.writeFile(path, JSON.stringify(credentials, null, 2), {
37
36
  mode: 0o600,
38
37
  });
39
38
  }
40
- export async function updateCredentials(updates) {
41
- const existing = await getCredentials();
42
- if (!existing) {
43
- throw new Error('No credentials found. Run `foir login` first.');
44
- }
45
- await writeCredentials({ ...existing, ...updates });
46
- }
47
39
  export async function deleteCredentials() {
48
40
  try {
49
41
  await fs.unlink(getCredentialsPath());
@@ -77,3 +69,72 @@ export async function getValidCredentials(refreshFn) {
77
69
  }
78
70
  return credentials;
79
71
  }
72
+ const REPO_ROOT_MARKERS = [
73
+ '.git',
74
+ 'foir.config.ts',
75
+ '.foirrc.ts',
76
+ 'foir.config.js',
77
+ '.foirrc.js',
78
+ 'foir.config.mjs',
79
+ '.foirrc.mjs',
80
+ ];
81
+ /**
82
+ * Walk up from cwd looking for markers that indicate the repo root.
83
+ * Returns cwd as fallback if no marker is found.
84
+ */
85
+ function findRepoRoot(from = process.cwd()) {
86
+ let dir = from;
87
+ // eslint-disable-next-line no-constant-condition
88
+ while (true) {
89
+ for (const marker of REPO_ROOT_MARKERS) {
90
+ try {
91
+ statSync(join(dir, marker));
92
+ return dir;
93
+ }
94
+ catch {
95
+ // not found, continue
96
+ }
97
+ }
98
+ const parent = dirname(dir);
99
+ if (parent === dir) {
100
+ return from; // filesystem root reached, fallback to cwd
101
+ }
102
+ dir = parent;
103
+ }
104
+ }
105
+ function getProjectContextDir() {
106
+ return join(findRepoRoot(), '.foir');
107
+ }
108
+ function getProjectContextPath() {
109
+ return join(getProjectContextDir(), 'project.json');
110
+ }
111
+ export async function getProjectContext() {
112
+ try {
113
+ const content = await fs.readFile(getProjectContextPath(), 'utf-8');
114
+ return JSON.parse(content);
115
+ }
116
+ catch (error) {
117
+ if (error.code === 'ENOENT') {
118
+ return null;
119
+ }
120
+ throw error;
121
+ }
122
+ }
123
+ export async function writeProjectContext(project) {
124
+ const dir = getProjectContextDir();
125
+ await ensureDir(dir);
126
+ const filePath = getProjectContextPath();
127
+ await fs.writeFile(filePath, JSON.stringify(project, null, 2), {
128
+ mode: 0o600,
129
+ });
130
+ }
131
+ export async function deleteProjectContext() {
132
+ try {
133
+ await fs.unlink(getProjectContextPath());
134
+ }
135
+ catch (error) {
136
+ if (error.code !== 'ENOENT') {
137
+ throw error;
138
+ }
139
+ }
140
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AA8B1B,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAmIN"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AA8B1B,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAkIN"}
@@ -1,4 +1,4 @@
1
- import { getCredentials, updateCredentials } from '../auth/credentials.js';
1
+ import { getCredentials, getProjectContext, writeProjectContext, } from '../auth/credentials.js';
2
2
  import { getApiUrl, getGraphQLEndpoint, } from '../lib/config.js';
3
3
  import { withErrorHandler } from '../lib/errors.js';
4
4
  import { formatList, success } from '../lib/output.js';
@@ -34,9 +34,10 @@ export function registerContextCommands(program, globalOpts) {
34
34
  throw new Error('Not logged in. Run `foir login` first.');
35
35
  const apiUrl = getApiUrl(opts);
36
36
  const data = await gqlRequest(apiUrl, credentials.accessToken, `query { sessionContext { projectId availableProjects { id name tenantId } } }`);
37
+ const projectContext = await getProjectContext();
37
38
  const projects = data.sessionContext.availableProjects.map((p) => ({
38
39
  ...p,
39
- current: p.id === credentials.selectedProject?.id ? '*' : '',
40
+ current: p.id === projectContext?.id ? '*' : '',
40
41
  }));
41
42
  formatList(projects, opts, {
42
43
  columns: [
@@ -61,12 +62,10 @@ export function registerContextCommands(program, globalOpts) {
61
62
  const project = data.sessionContext.availableProjects.find((p) => p.id === projectId);
62
63
  if (!project)
63
64
  throw new Error(`Project "${projectId}" not found.`);
64
- await updateCredentials({
65
- selectedProject: {
66
- id: project.id,
67
- name: project.name,
68
- tenantId: project.tenantId,
69
- },
65
+ await writeProjectContext({
66
+ id: project.id,
67
+ name: project.name,
68
+ tenantId: project.tenantId,
70
69
  });
71
70
  success(`Switched to project: ${project.name}`);
72
71
  console.log('Run `foir select-project` to provision a new API key for this project.');
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/commands/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA6BtD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CA2YN"}
1
+ {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/commands/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA6BtD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAwYN"}
@@ -30,8 +30,7 @@ export function registerRecordsCommands(program, globalOpts) {
30
30
  columns: [
31
31
  { key: 'id', header: 'ID', width: 28 },
32
32
  { key: 'naturalKey', header: 'Key', width: 24 },
33
- { key: 'recordType', header: 'Type', width: 10 },
34
- { key: 'publishStatus', header: 'Status', width: 12 },
33
+ { key: 'versionNumber', header: 'Version', width: 8 },
35
34
  {
36
35
  key: 'updatedAt',
37
36
  header: 'Updated',
@@ -199,7 +198,6 @@ export function registerRecordsCommands(program, globalOpts) {
199
198
  columns: [
200
199
  { key: 'id', header: 'Version ID', width: 28 },
201
200
  { key: 'versionNumber', header: '#', width: 5 },
202
- { key: 'publishStatus', header: 'Status', width: 12 },
203
201
  { key: 'changeDescription', header: 'Description', width: 30 },
204
202
  {
205
203
  key: 'createdAt',
@@ -222,7 +220,6 @@ export function registerRecordsCommands(program, globalOpts) {
222
220
  columns: [
223
221
  { key: 'id', header: 'Variant ID', width: 28 },
224
222
  { key: 'variantKey', header: 'Key', width: 20 },
225
- { key: 'variantName', header: 'Name', width: 20 },
226
223
  { key: 'isDefault', header: 'Default', width: 8 },
227
224
  {
228
225
  key: 'createdAt',
@@ -1 +1 @@
1
- {"version":3,"file":"select-project.d.ts","sourceRoot":"","sources":["../../src/commands/select-project.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAgL1B,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAoGN"}
1
+ {"version":3,"file":"select-project.d.ts","sourceRoot":"","sources":["../../src/commands/select-project.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAgL1B,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAmGN"}
@@ -1,5 +1,5 @@
1
1
  import inquirer from 'inquirer';
2
- import { getCredentials, updateCredentials } from '../auth/credentials.js';
2
+ import { getCredentials, writeProjectContext } from '../auth/credentials.js';
3
3
  import { getApiUrl, getGraphQLEndpoint, } from '../lib/config.js';
4
4
  import { withErrorHandler } from '../lib/errors.js';
5
5
  const CLI_API_KEY_NAME = 'Foir CLI';
@@ -130,16 +130,15 @@ export function registerSelectProjectCommand(program, globalOpts) {
130
130
  }
131
131
  console.log('\nProvisioning API key for CLI access...');
132
132
  const { apiKey, apiKeyId } = await provisionApiKey(apiUrl, credentials.accessToken, selectedProject.id, selectedProject.tenantId);
133
- await updateCredentials({
134
- selectedProject: {
135
- id: selectedProject.id,
136
- name: selectedProject.name,
137
- tenantId: selectedProject.tenantId,
138
- apiKey,
139
- apiKeyId,
140
- },
133
+ await writeProjectContext({
134
+ id: selectedProject.id,
135
+ name: selectedProject.name,
136
+ tenantId: selectedProject.tenantId,
137
+ apiKey,
138
+ apiKeyId,
141
139
  });
142
140
  console.log(`\n✓ Selected project: ${selectedProject.name}`);
143
141
  console.log('✓ API key provisioned for CLI access');
142
+ console.log(' (stored in .foir/project.json for this repository)');
144
143
  }));
145
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAwDN"}
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,aAAa,GAC9B,IAAI,CAyDN"}
@@ -1,4 +1,4 @@
1
- import { getCredentials, isTokenExpired } from '../auth/credentials.js';
1
+ import { getCredentials, getProjectContext, isTokenExpired, } from '../auth/credentials.js';
2
2
  import { withErrorHandler } from '../lib/errors.js';
3
3
  import { formatOutput } from '../lib/output.js';
4
4
  export function registerWhoamiCommand(program, globalOpts) {
@@ -19,12 +19,13 @@ export function registerWhoamiCommand(program, globalOpts) {
19
19
  process.exit(1);
20
20
  }
21
21
  const expired = isTokenExpired(credentials);
22
+ const projectContext = await getProjectContext();
22
23
  if (opts.json || opts.jsonl) {
23
24
  formatOutput({
24
25
  authenticated: true,
25
26
  tokenValid: !expired,
26
27
  user: credentials.user,
27
- selectedProject: credentials.selectedProject ?? null,
28
+ selectedProject: projectContext ?? null,
28
29
  }, opts);
29
30
  return;
30
31
  }
@@ -33,17 +34,17 @@ export function registerWhoamiCommand(program, globalOpts) {
33
34
  console.log(`User: ${credentials.user.name} <${credentials.user.email}>`);
34
35
  console.log(`User ID: ${credentials.user.id}`);
35
36
  console.log(`Token: ${expired ? '⚠ Expired' : '✓ Valid'}`);
36
- if (credentials.selectedProject) {
37
+ if (projectContext) {
37
38
  console.log('');
38
- console.log('Selected Project');
39
+ console.log('Selected Project (this repo)');
39
40
  console.log('─'.repeat(40));
40
- console.log(`Name: ${credentials.selectedProject.name}`);
41
- console.log(`ID: ${credentials.selectedProject.id}`);
42
- console.log(`Tenant ID: ${credentials.selectedProject.tenantId}`);
41
+ console.log(`Name: ${projectContext.name}`);
42
+ console.log(`ID: ${projectContext.id}`);
43
+ console.log(`Tenant ID: ${projectContext.tenantId}`);
43
44
  }
44
45
  else {
45
46
  console.log('');
46
- console.log('No project selected.');
47
+ console.log('No project selected for this repository.');
47
48
  console.log('Run `foir select-project` to choose a project.');
48
49
  }
49
50
  }));
@@ -9,12 +9,12 @@ export declare const GET_AUTH_PROVIDER = "\n query($id: ID!) {\n customerAut
9
9
  export declare const CREATE_AUTH_PROVIDER = "\n mutation($input: CreateAuthProviderInput!) {\n createCustomerAuthProvider(input: $input) {\n id key name type enabled isDefault priority createdAt\n }\n }\n";
10
10
  export declare const UPDATE_AUTH_PROVIDER = "\n mutation($id: ID!, $input: UpdateAuthProviderInput!) {\n updateCustomerAuthProvider(id: $id, input: $input) {\n id key name type enabled isDefault priority updatedAt\n }\n }\n";
11
11
  export declare const DELETE_AUTH_PROVIDER = "\n mutation($id: ID!) { deleteCustomerAuthProvider(id: $id) }\n";
12
- export declare const RECORD = "\n query($id: ID!) { record(id: $id) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }\n";
13
- export declare const RECORD_RESOLVED = "\n query($id: ID!, $locale: String, $preview: Boolean) {\n record(id: $id) {\n id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy\n resolved(locale: $locale, preview: $preview) {\n content\n record { id modelKey naturalKey }\n variant { id variantKey }\n version { id versionNumber publishStatus }\n }\n }\n }\n";
14
- export declare const RECORD_BY_KEY = "\n query($modelKey: String!, $naturalKey: String!) { recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }\n";
15
- export declare const RECORD_BY_KEY_RESOLVED = "\n query($modelKey: String!, $naturalKey: String!, $locale: String, $preview: Boolean) {\n recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) {\n id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy\n resolved(locale: $locale, preview: $preview) {\n content\n record { id modelKey naturalKey }\n variant { id variantKey }\n version { id versionNumber publishStatus }\n }\n }\n }\n";
16
- export declare const RECORDS = "\n query($modelKey: String!, $limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput) {\n records(modelKey: $modelKey, limit: $limit, offset: $offset, filters: $filters, sort: $sort) {\n items { id modelKey naturalKey recordType publishStatus versionNumber customerId createdAt updatedAt }\n total\n }\n }\n";
17
- export declare const CREATE_RECORD = "\n mutation($input: CreateRecordInput!) { createRecord(input: $input) { record { id modelKey naturalKey recordType data metadata createdAt } variant { id variantKey } version { id versionNumber } } }\n";
12
+ export declare const RECORD = "\n query($id: ID!) { record(id: $id) { id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt } }\n";
13
+ export declare const RECORD_RESOLVED = "\n query($id: ID!, $locale: String, $preview: Boolean) {\n record(id: $id) {\n id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt\n resolved(locale: $locale, preview: $preview) {\n content\n record { id modelKey naturalKey }\n variant { id variantKey }\n version { id versionNumber }\n }\n }\n }\n";
14
+ export declare const RECORD_BY_KEY = "\n query($modelKey: String!, $naturalKey: String!) { recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) { id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt } }\n";
15
+ export declare const RECORD_BY_KEY_RESOLVED = "\n query($modelKey: String!, $naturalKey: String!, $locale: String, $preview: Boolean) {\n recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) {\n id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt\n resolved(locale: $locale, preview: $preview) {\n content\n record { id modelKey naturalKey }\n variant { id variantKey }\n version { id versionNumber }\n }\n }\n }\n";
16
+ export declare const RECORDS = "\n query($modelKey: String!, $limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput) {\n records(modelKey: $modelKey, limit: $limit, offset: $offset, filters: $filters, sort: $sort) {\n items { id modelKey naturalKey versionNumber createdAt updatedAt }\n total\n }\n }\n";
17
+ export declare const CREATE_RECORD = "\n mutation($input: CreateRecordInput!) { createRecord(input: $input) { record { id modelKey naturalKey data metadata createdAt } } }\n";
18
18
  export declare const UPDATE_RECORD = "\n mutation($input: UpdateRecordInput!) { updateRecord(input: $input) { record { id modelKey naturalKey data metadata updatedAt } matched } }\n";
19
19
  export declare const DELETE_RECORD = "\n mutation($id: ID!) { deleteRecord(id: $id) { id modelKey naturalKey } }\n";
20
20
  export declare const PUBLISH_VERSION = "\n mutation($versionId: ID!) { publishVersion(versionId: $versionId) }\n";
@@ -22,7 +22,7 @@ export declare const UNPUBLISH_RECORD = "\n mutation($id: ID!) { unpublishRecor
22
22
  export declare const DUPLICATE_RECORD = "\n mutation($input: DuplicateRecordInput!) { duplicateRecord(input: $input) { record { id modelKey naturalKey } variant { id variantKey } version { id versionNumber } } }\n";
23
23
  export declare const CREATE_VERSION = "\n mutation($input: CreateVersionInput!) { createVersion(input: $input) { id modelKey recordType parentId data metadata versionNumber contentHash changeDescription publishStatus createdAt } }\n";
24
24
  export declare const CREATE_VARIANT = "\n mutation($input: CreateVariantInput!) { createVariant(input: $input) { id modelKey recordType parentId variantKey variantName isDefault priority createdAt } }\n";
25
- export declare const RECORD_VERSIONS = "\n query($parentId: ID!, $limit: Int, $offset: Int) { recordVersions(parentId: $parentId, limit: $limit, offset: $offset) { items { id versionNumber publishStatus data contentHash changeDescription createdAt createdBy } } }\n";
25
+ export declare const RECORD_VERSIONS = "\n query($parentId: ID!, $limit: Int, $offset: Int) { recordVersions(parentId: $parentId, limit: $limit, offset: $offset) { items { id versionNumber data changeDescription createdAt } } }\n";
26
26
  export declare const RECORD_VARIANTS = "\n query($recordId: ID!, $limit: Int, $offset: Int) { recordVariants(recordId: $recordId, limit: $limit, offset: $offset) { items { id variantKey variantName isDefault priority createdAt } } }\n";
27
27
  export declare const MODELS_FOR_CODEGEN = "\n query($limit: Int) {\n models(limit: $limit) {\n items { id key name pluralName description category fields config hooks }\n total\n }\n }\n";
28
28
  export declare const MODEL_BY_KEY = "\n query($key: String!) { modelByKey(key: $key) { id key name pluralName description category icon fields config hooks displayField extensionId systemEntity deletable editable currentVersionId publishedVersionNumber createdAt updatedAt } }\n";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/graphql/queries.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,8HAE/B,CAAC;AAIF,eAAO,MAAM,aAAa,oVAOzB,CAAC;AAEF,eAAO,MAAM,WAAW,oOAEvB,CAAC;AAEF,eAAO,MAAM,cAAc,2JAE1B,CAAC;AAEF,eAAO,MAAM,cAAc,mHAE1B,CAAC;AAEF,eAAO,MAAM,cAAc,sFAE1B,CAAC;AAIF,eAAO,MAAM,mBAAmB,oLAM/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,oOAO7B,CAAC;AAEF,eAAO,MAAM,oBAAoB,iLAMhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,oMAMhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,qEAEhC,CAAC;AAIF,eAAO,MAAM,MAAM,6QAElB,CAAC;AAEF,eAAO,MAAM,eAAe,uhBAY3B,CAAC;AAEF,eAAO,MAAM,aAAa,uVAEzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,imBAYlC,CAAC;AAEF,eAAO,MAAM,OAAO,wVAOnB,CAAC;AAEF,eAAO,MAAM,aAAa,+MAEzB,CAAC;AAEF,eAAO,MAAM,aAAa,qJAEzB,CAAC;AAEF,eAAO,MAAM,aAAa,kFAEzB,CAAC;AAEF,eAAO,MAAM,eAAe,8EAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,0DAE5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,kLAE5B,CAAC;AAEF,eAAO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a,6HAEzB,CAAC;AAEF,eAAO,MAAM,aAAa,gJAEzB,CAAC;AAEF,eAAO,MAAM,aAAa,uDAEzB,CAAC;AAIF,eAAO,MAAM,KAAK,+VAOjB,CAAC;AAEF,eAAO,MAAM,IAAI,yKAEhB,CAAC;AAEF,eAAO,MAAM,kBAAkB,uFAE9B,CAAC;AAEF,eAAO,MAAM,WAAW,uRAEvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,qOAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,qDAEvB,CAAC;AAIF,eAAO,MAAM,KAAK,6XAOjB,CAAC;AAEF,eAAO,MAAM,IAAI,qLAEhB,CAAC;AAEF,eAAO,MAAM,WAAW,8HAEvB,CAAC;AAEF,eAAO,MAAM,YAAY,qHAExB,CAAC;AAEF,eAAO,MAAM,WAAW,iEAEvB,CAAC;AAIF,eAAO,MAAM,eAAe,qNAE3B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yIAEjC,CAAC;AAEF,eAAO,MAAM,4BAA4B,qJAExC,CAAC;AAEF,eAAO,MAAM,4BAA4B,iJAExC,CAAC;AAEF,eAAO,MAAM,4BAA4B,oKAExC,CAAC;AAEF,eAAO,MAAM,4BAA4B,oEAExC,CAAC"}
@@ -62,33 +62,33 @@ export const DELETE_AUTH_PROVIDER = `
62
62
  `;
63
63
  // --- Records ---
64
64
  export const RECORD = `
65
- query($id: ID!) { record(id: $id) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }
65
+ query($id: ID!) { record(id: $id) { id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt } }
66
66
  `;
67
67
  export const RECORD_RESOLVED = `
68
68
  query($id: ID!, $locale: String, $preview: Boolean) {
69
69
  record(id: $id) {
70
- id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy
70
+ id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt
71
71
  resolved(locale: $locale, preview: $preview) {
72
72
  content
73
73
  record { id modelKey naturalKey }
74
74
  variant { id variantKey }
75
- version { id versionNumber publishStatus }
75
+ version { id versionNumber }
76
76
  }
77
77
  }
78
78
  }
79
79
  `;
80
80
  export const RECORD_BY_KEY = `
81
- query($modelKey: String!, $naturalKey: String!) { recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) { id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy } }
81
+ query($modelKey: String!, $naturalKey: String!) { recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) { id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt } }
82
82
  `;
83
83
  export const RECORD_BY_KEY_RESOLVED = `
84
84
  query($modelKey: String!, $naturalKey: String!, $locale: String, $preview: Boolean) {
85
85
  recordByKey(modelKey: $modelKey, naturalKey: $naturalKey) {
86
- id modelKey naturalKey recordType parentId data metadata currentVersionId publishedVersionId publishedVersionNumber publishedAt publishedBy publishStatus versionNumber customerId createdAt updatedAt createdBy updatedBy
86
+ id modelKey naturalKey data metadata publishedVersionNumber publishedAt versionNumber changeDescription createdAt updatedAt
87
87
  resolved(locale: $locale, preview: $preview) {
88
88
  content
89
89
  record { id modelKey naturalKey }
90
90
  variant { id variantKey }
91
- version { id versionNumber publishStatus }
91
+ version { id versionNumber }
92
92
  }
93
93
  }
94
94
  }
@@ -96,13 +96,13 @@ export const RECORD_BY_KEY_RESOLVED = `
96
96
  export const RECORDS = `
97
97
  query($modelKey: String!, $limit: Int, $offset: Int, $filters: [FilterInput!], $sort: SortInput) {
98
98
  records(modelKey: $modelKey, limit: $limit, offset: $offset, filters: $filters, sort: $sort) {
99
- items { id modelKey naturalKey recordType publishStatus versionNumber customerId createdAt updatedAt }
99
+ items { id modelKey naturalKey versionNumber createdAt updatedAt }
100
100
  total
101
101
  }
102
102
  }
103
103
  `;
104
104
  export const CREATE_RECORD = `
105
- mutation($input: CreateRecordInput!) { createRecord(input: $input) { record { id modelKey naturalKey recordType data metadata createdAt } variant { id variantKey } version { id versionNumber } } }
105
+ mutation($input: CreateRecordInput!) { createRecord(input: $input) { record { id modelKey naturalKey data metadata createdAt } } }
106
106
  `;
107
107
  export const UPDATE_RECORD = `
108
108
  mutation($input: UpdateRecordInput!) { updateRecord(input: $input) { record { id modelKey naturalKey data metadata updatedAt } matched } }
@@ -126,7 +126,7 @@ export const CREATE_VARIANT = `
126
126
  mutation($input: CreateVariantInput!) { createVariant(input: $input) { id modelKey recordType parentId variantKey variantName isDefault priority createdAt } }
127
127
  `;
128
128
  export const RECORD_VERSIONS = `
129
- query($parentId: ID!, $limit: Int, $offset: Int) { recordVersions(parentId: $parentId, limit: $limit, offset: $offset) { items { id versionNumber publishStatus data contentHash changeDescription createdAt createdBy } } }
129
+ query($parentId: ID!, $limit: Int, $offset: Int) { recordVersions(parentId: $parentId, limit: $limit, offset: $offset) { items { id versionNumber data changeDescription createdAt } } }
130
130
  `;
131
131
  export const RECORD_VARIANTS = `
132
132
  query($recordId: ID!, $limit: Int, $offset: Int) { recordVariants(recordId: $recordId, limit: $limit, offset: $offset) { items { id variantKey variantName isDefault priority createdAt } } }
@@ -5,6 +5,7 @@ import { type GlobalOptions } from './config.js';
5
5
  * Auth priority:
6
6
  * 1. FOIR_API_KEY env var (CI / headless / LLM mode)
7
7
  * 2. Stored credentials from ~/.foir/credentials.json (interactive)
8
+ * Project context is read from .foir/project.json in the current repo.
8
9
  */
9
10
  export declare function createClient(options?: GlobalOptions): Promise<GraphQLClient>;
10
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhF;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,aAAa,CAAC,CAiCxB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CA2B9D"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMhD,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhF;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,aAAa,CAAC,CAkCxB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CA4B9D"}
@@ -1,11 +1,12 @@
1
1
  import { GraphQLClient } from 'graphql-request';
2
- import { getCredentials, isTokenExpired } from '../auth/credentials.js';
2
+ import { getCredentials, getProjectContext, isTokenExpired, } from '../auth/credentials.js';
3
3
  import { getApiUrl, getGraphQLEndpoint } from './config.js';
4
4
  /**
5
5
  * Create an authenticated GraphQL client.
6
6
  * Auth priority:
7
7
  * 1. FOIR_API_KEY env var (CI / headless / LLM mode)
8
8
  * 2. Stored credentials from ~/.foir/credentials.json (interactive)
9
+ * Project context is read from .foir/project.json in the current repo.
9
10
  */
10
11
  export async function createClient(options) {
11
12
  const apiUrl = getApiUrl(options);
@@ -28,9 +29,10 @@ export async function createClient(options) {
28
29
  throw new Error('Session expired. Run `foir login` to re-authenticate.');
29
30
  }
30
31
  headers['Authorization'] = `Bearer ${credentials.accessToken}`;
31
- if (credentials.selectedProject) {
32
- headers['x-tenant-id'] = credentials.selectedProject.tenantId;
33
- headers['x-project-id'] = credentials.selectedProject.id;
32
+ const project = await getProjectContext();
33
+ if (project) {
34
+ headers['x-tenant-id'] = project.tenantId;
35
+ headers['x-project-id'] = project.id;
34
36
  }
35
37
  return new GraphQLClient(endpoint, { headers });
36
38
  }
@@ -53,9 +55,10 @@ export async function getRestAuth(options) {
53
55
  throw new Error('Session expired. Run `foir login` to re-authenticate.');
54
56
  }
55
57
  headers['Authorization'] = `Bearer ${credentials.accessToken}`;
56
- if (credentials.selectedProject) {
57
- headers['x-tenant-id'] = credentials.selectedProject.tenantId;
58
- headers['x-project-id'] = credentials.selectedProject.id;
58
+ const project = await getProjectContext();
59
+ if (project) {
60
+ headers['x-tenant-id'] = project.tenantId;
61
+ headers['x-project-id'] = project.id;
59
62
  }
60
63
  return { apiUrl, headers };
61
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Universal platform CLI for EIDE — scriptable, composable resource management",
5
5
  "type": "module",
6
6
  "publishConfig": {