@sequenceholdings/studio-cli 0.5.3 → 0.5.5
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/README.md +220 -12
- package/dist/agents/bundle.d.ts +8 -0
- package/dist/agents/bundle.js +38 -0
- package/dist/agents/commands.d.ts +6 -1
- package/dist/agents/commands.js +17 -20
- package/dist/agents/selection.d.ts +3 -0
- package/dist/agents/selection.js +17 -0
- package/dist/agents/source.js +2 -1
- package/dist/app/adapters.js +2 -1
- package/dist/app/application-registration.d.ts +1 -1
- package/dist/app/application-registration.js +6 -2
- package/dist/app/commands.d.ts +6 -0
- package/dist/app/commands.js +13 -4
- package/dist/app/primitive-scaffold.js +8 -1
- package/dist/app/readme.js +1 -1
- package/dist/app/scaffold.js +1 -1
- package/dist/artifact/delegate.js +16 -4
- package/dist/atlas-client.js +5 -1
- package/dist/auth-cmds/commands.d.ts +1 -1
- package/dist/auth-cmds/commands.js +3 -0
- package/dist/auth.d.ts +2 -1
- package/dist/auth.js +16 -0
- package/dist/command-contract.d.ts +9 -9
- package/dist/command-contract.js +7 -7
- package/dist/command-help.d.ts +3 -2
- package/dist/command-help.js +31 -3
- package/dist/command-input.js +2 -2
- package/dist/config.d.ts +5 -0
- package/dist/config.js +14 -1
- package/dist/env-flags.d.ts +6 -0
- package/dist/env-flags.js +9 -0
- package/dist/functions/commands.d.ts +5 -2
- package/dist/functions/commands.js +36 -10
- package/dist/functions/deploy-preflight.js +2 -2
- package/dist/functions/manifest.d.ts +43 -29
- package/dist/functions/manifest.js +37 -74
- package/dist/main.js +43 -3
- package/dist/orm/delegate.js +25 -4
- package/dist/orm/read.d.ts +54 -0
- package/dist/orm/read.js +308 -0
- package/dist/pipeline/commands.js +10 -0
- package/dist/pipeline/discovery.js +3 -16
- package/dist/pipeline/retirement.d.ts +3 -0
- package/dist/pipeline/retirement.js +34 -0
- package/dist/process/build.js +4 -0
- package/dist/process/codegen.js +2 -0
- package/dist/process/commands.js +66 -25
- package/dist/process/plan-diff.js +1 -0
- package/dist/process/runs.d.ts +14 -0
- package/dist/process/runs.js +238 -0
- package/dist/repos/ci-status.js +28 -0
- package/dist/repos/commands.d.ts +2 -2
- package/dist/repos/commands.js +11 -4
- package/dist/repos/git-credential.d.ts +3 -2
- package/dist/repos/git-credential.js +52 -3
- package/dist/repos/pulls.d.ts +7 -1
- package/dist/repos/pulls.js +162 -22
- package/dist/sandbox-auth.d.ts +52 -0
- package/dist/sandbox-auth.js +105 -0
- package/dist/storage/commands.js +6 -5
- package/dist/text-table.d.ts +7 -0
- package/dist/text-table.js +16 -0
- package/package.json +9 -9
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `seq-studio orm read` / `orm sql` — ad-hoc reads of a deployed ORM v2
|
|
3
|
+
* namespace as the caller.
|
|
4
|
+
*
|
|
5
|
+
* Both run the namespace's built-in read-only SQL operation through the
|
|
6
|
+
* published ORM client (`createOperationExecutorWithTransport(...).sql()`),
|
|
7
|
+
* which owns the `{ op, variables }` wire format. Requests go through the CLI's
|
|
8
|
+
* Atlas client so environment resolution, sandbox tokens, and edge headers
|
|
9
|
+
* behave like every other command. The server compiles the SQL in its closed
|
|
10
|
+
* read-only grammar and enforces grants, row-level security, and its row,
|
|
11
|
+
* size, and time bounds.
|
|
12
|
+
*/
|
|
13
|
+
import type { SqlQueryParameter, SqlQueryVariables } from '@sequenceholdings/orm/client';
|
|
14
|
+
import type { ParsedArgs } from '../process/commands.js';
|
|
15
|
+
export declare const ORM_READ_USAGE = "usage:\n seq-studio orm read <namespace> <table> -e <env> [--where <column>=<op>.<value>]...\n [--select <col,...>] [--order <column>[.asc|.desc]]... [--limit N] [--offset N] [--json | --jsonl]\n seq-studio orm sql <namespace> (--query <sql> | --file <path>) -e <env>\n [--param <name>[:<type>]=<value>]... | [--params <json-object>] [--json | --jsonl]\n\n Reads run as you against an ORM v2 namespace: its grants, row-level security,\n and a read-only SQL grammar apply on the server, which returns at most 1,000 rows.\n\n --where operators: eq, ne, gt, gte, lt, lte, in, is\n --where status=eq.open --where balance=gte.1000 --where id=in.(a,b,c) --where closed_at=is.null\n sql binds :name placeholders. --param types: text (default), uuid, date, timestamptz,\n numeric, bigint, integer, double, boolean. --params takes the wire shape, e.g.\n '{\"limit\": {\"type\": \"integer\", \"value\": 5}}', and allows null values.\n sql must reference every table as <namespace>.<table> (SELECT id FROM lending.loans, not\n FROM loans); unqualified names and queries without a table (SELECT 1) are rejected.\n The grammar is read-only SELECT with joins, CTEs, UNION, aggregates, and comparison\n operators (no LIKE or IN).\n --json prints a JSON array of row objects; --jsonl prints one row object per line.\n Without either, rows print as a table. Counts, truncation, and paging hints go to stderr.\n";
|
|
16
|
+
export interface ReadFilter {
|
|
17
|
+
column: string;
|
|
18
|
+
op: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
interface ReadPlan {
|
|
22
|
+
namespace: string;
|
|
23
|
+
table: string;
|
|
24
|
+
select: string[];
|
|
25
|
+
filters: ReadFilter[];
|
|
26
|
+
orderings: Array<{
|
|
27
|
+
column: string;
|
|
28
|
+
direction: 'asc' | 'desc';
|
|
29
|
+
}>;
|
|
30
|
+
limit?: number;
|
|
31
|
+
offset?: number;
|
|
32
|
+
}
|
|
33
|
+
/** Parse `<column>=<op>.<value>`, the PostgREST spelling. */
|
|
34
|
+
export declare function parseFilter(raw: string): ReadFilter;
|
|
35
|
+
/** A typed SQL parameter from text, as the server's parameter schema expects. */
|
|
36
|
+
export declare function sqlParameter({ type, raw, label }: {
|
|
37
|
+
type: string;
|
|
38
|
+
raw: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}): SqlQueryParameter;
|
|
41
|
+
/** `--param name[:type]=value` (repeatable) or `--params '<json object>'` in the wire shape. */
|
|
42
|
+
export declare function parseSqlParams(args: ParsedArgs): Record<string, SqlQueryParameter> | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Lower a read into the server's SQL grammar. Values are always bound
|
|
45
|
+
* parameters typed from the table's column types, never spliced into the SQL.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildReadSql({ plan, columnTypes }: {
|
|
48
|
+
plan: ReadPlan;
|
|
49
|
+
columnTypes: ReadonlyMap<string, string>;
|
|
50
|
+
}): SqlQueryVariables;
|
|
51
|
+
export declare function ormReadCommand(args: ParsedArgs): Promise<number>;
|
|
52
|
+
export declare function ormSqlCommand(args: ParsedArgs): Promise<number>;
|
|
53
|
+
export declare function sqlGrammarHint(namespace: string): string;
|
|
54
|
+
export {};
|
package/dist/orm/read.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `seq-studio orm read` / `orm sql` — ad-hoc reads of a deployed ORM v2
|
|
3
|
+
* namespace as the caller.
|
|
4
|
+
*
|
|
5
|
+
* Both run the namespace's built-in read-only SQL operation through the
|
|
6
|
+
* published ORM client (`createOperationExecutorWithTransport(...).sql()`),
|
|
7
|
+
* which owns the `{ op, variables }` wire format. Requests go through the CLI's
|
|
8
|
+
* Atlas client so environment resolution, sandbox tokens, and edge headers
|
|
9
|
+
* behave like every other command. The server compiles the SQL in its closed
|
|
10
|
+
* read-only grammar and enforces grants, row-level security, and its row,
|
|
11
|
+
* size, and time bounds.
|
|
12
|
+
*/
|
|
13
|
+
import { readFile } from 'node:fs/promises';
|
|
14
|
+
import { postJsonResponse } from '../atlas-client.js';
|
|
15
|
+
import { printCliError } from '../cli-errors.js';
|
|
16
|
+
import { validateCommandInput } from '../command-input.js';
|
|
17
|
+
import { buildContext, clientOptions } from '../functions/commands.js';
|
|
18
|
+
import { table } from '../text-table.js';
|
|
19
|
+
export const ORM_READ_USAGE = `usage:
|
|
20
|
+
seq-studio orm read <namespace> <table> -e <env> [--where <column>=<op>.<value>]...
|
|
21
|
+
[--select <col,...>] [--order <column>[.asc|.desc]]... [--limit N] [--offset N] [--json | --jsonl]
|
|
22
|
+
seq-studio orm sql <namespace> (--query <sql> | --file <path>) -e <env>
|
|
23
|
+
[--param <name>[:<type>]=<value>]... | [--params <json-object>] [--json | --jsonl]
|
|
24
|
+
|
|
25
|
+
Reads run as you against an ORM v2 namespace: its grants, row-level security,
|
|
26
|
+
and a read-only SQL grammar apply on the server, which returns at most 1,000 rows.
|
|
27
|
+
|
|
28
|
+
--where operators: eq, ne, gt, gte, lt, lte, in, is
|
|
29
|
+
--where status=eq.open --where balance=gte.1000 --where id=in.(a,b,c) --where closed_at=is.null
|
|
30
|
+
sql binds :name placeholders. --param types: text (default), uuid, date, timestamptz,
|
|
31
|
+
numeric, bigint, integer, double, boolean. --params takes the wire shape, e.g.
|
|
32
|
+
'{"limit": {"type": "integer", "value": 5}}', and allows null values.
|
|
33
|
+
sql must reference every table as <namespace>.<table> (SELECT id FROM lending.loans, not
|
|
34
|
+
FROM loans); unqualified names and queries without a table (SELECT 1) are rejected.
|
|
35
|
+
The grammar is read-only SELECT with joins, CTEs, UNION, aggregates, and comparison
|
|
36
|
+
operators (no LIKE or IN).
|
|
37
|
+
--json prints a JSON array of row objects; --jsonl prints one row object per line.
|
|
38
|
+
Without either, rows print as a table. Counts, truncation, and paging hints go to stderr.
|
|
39
|
+
`;
|
|
40
|
+
const COMPARISONS = { eq: '=', ne: '<>', gt: '>', gte: '>=', lt: '<', lte: '<=' };
|
|
41
|
+
const FILTER_OPS = [...Object.keys(COMPARISONS), 'in', 'is'];
|
|
42
|
+
const PARAMETER_TYPES = ['text', 'uuid', 'date', 'timestamptz', 'numeric', 'bigint', 'integer', 'double', 'boolean'];
|
|
43
|
+
/** Namespace, table, and column names; quoted when emitted, so they keep their case. */
|
|
44
|
+
const IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
45
|
+
const PARAMETER_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
46
|
+
function identifier({ label, value }) {
|
|
47
|
+
if (!IDENTIFIER.test(value))
|
|
48
|
+
throw new Error(`Invalid ${label} '${value}': use letters, digits, and '_'.`);
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
const quoted = (name) => `"${name}"`;
|
|
52
|
+
function repeated({ args, key }) {
|
|
53
|
+
const values = args.repeatedFlags?.[key] ?? (typeof args.flags[key] === 'string' ? [args.flags[key]] : []);
|
|
54
|
+
return values.filter((value) => typeof value === 'string');
|
|
55
|
+
}
|
|
56
|
+
function integer({ args, key, min }) {
|
|
57
|
+
const raw = args.flags[key];
|
|
58
|
+
if (raw === undefined)
|
|
59
|
+
return undefined;
|
|
60
|
+
const value = typeof raw === 'string' && /^\d+$/.test(raw) ? Number(raw) : Number.NaN;
|
|
61
|
+
if (!Number.isSafeInteger(value) || value < min)
|
|
62
|
+
throw new Error(`--${key} must be an integer >= ${min}.`);
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
function outputFormat(args) {
|
|
66
|
+
if (args.flags.json === true && args.flags.jsonl === true)
|
|
67
|
+
throw new Error('Pass only one of --json or --jsonl.');
|
|
68
|
+
if (args.flags.json === true)
|
|
69
|
+
return 'json';
|
|
70
|
+
if (args.flags.jsonl === true)
|
|
71
|
+
return 'jsonl';
|
|
72
|
+
return 'table';
|
|
73
|
+
}
|
|
74
|
+
/** Parse `<column>=<op>.<value>`, the PostgREST spelling. */
|
|
75
|
+
export function parseFilter(raw) {
|
|
76
|
+
const eq = raw.indexOf('=');
|
|
77
|
+
const dot = raw.indexOf('.', eq + 1);
|
|
78
|
+
if (eq < 1 || dot < 0)
|
|
79
|
+
throw new Error(`Invalid --where '${raw}': expected <column>=<op>.<value>, e.g. status=eq.open.`);
|
|
80
|
+
const column = identifier({ label: 'column', value: raw.slice(0, eq) });
|
|
81
|
+
const op = raw.slice(eq + 1, dot);
|
|
82
|
+
if (!FILTER_OPS.includes(op))
|
|
83
|
+
throw new Error(`Invalid --where operator '${op}': use one of ${FILTER_OPS.join(', ')}.`);
|
|
84
|
+
const value = raw.slice(dot + 1);
|
|
85
|
+
if (op === 'is' && !['null', 'true', 'false'].includes(value)) {
|
|
86
|
+
throw new Error(`Invalid --where '${raw}': is takes null, true, or false.`);
|
|
87
|
+
}
|
|
88
|
+
return { column, op, value };
|
|
89
|
+
}
|
|
90
|
+
function parseOrder(raw) {
|
|
91
|
+
return raw.split(',').map((entry) => {
|
|
92
|
+
const match = /^(.+?)(?:\.(asc|desc))?$/.exec(entry.trim());
|
|
93
|
+
const column = identifier({ label: 'order column', value: match?.[1] ?? '' });
|
|
94
|
+
return { column, direction: match?.[2] === 'desc' ? 'desc' : 'asc' };
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function isParameterType(type) {
|
|
98
|
+
return PARAMETER_TYPES.includes(type);
|
|
99
|
+
}
|
|
100
|
+
/** A typed SQL parameter from text, as the server's parameter schema expects. */
|
|
101
|
+
export function sqlParameter({ type, raw, label }) {
|
|
102
|
+
if (!isParameterType(type))
|
|
103
|
+
throw new Error(`${label}: unsupported type '${type}'; use ${PARAMETER_TYPES.join(', ')}.`);
|
|
104
|
+
if (type === 'boolean') {
|
|
105
|
+
if (raw !== 'true' && raw !== 'false')
|
|
106
|
+
throw new Error(`${label}: a boolean must be true or false.`);
|
|
107
|
+
return { type, value: raw === 'true' };
|
|
108
|
+
}
|
|
109
|
+
if (type === 'integer' || type === 'double') {
|
|
110
|
+
const value = Number(raw);
|
|
111
|
+
if (raw.trim() === '' || !Number.isFinite(value) || (type === 'integer' && !Number.isSafeInteger(value))) {
|
|
112
|
+
throw new Error(`${label}: '${raw}' is not a valid ${type}.`);
|
|
113
|
+
}
|
|
114
|
+
return { type, value };
|
|
115
|
+
}
|
|
116
|
+
return { type, value: raw };
|
|
117
|
+
}
|
|
118
|
+
/** `--param name[:type]=value` (repeatable) or `--params '<json object>'` in the wire shape. */
|
|
119
|
+
export function parseSqlParams(args) {
|
|
120
|
+
const textParams = repeated({ args, key: 'param' });
|
|
121
|
+
const json = args.flags.params;
|
|
122
|
+
if (textParams.length > 0 && json !== undefined)
|
|
123
|
+
throw new Error('Pass --param or --params, not both.');
|
|
124
|
+
if (json !== undefined) {
|
|
125
|
+
let parsed;
|
|
126
|
+
try {
|
|
127
|
+
parsed = JSON.parse(String(json));
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
throw new Error('--params must be a JSON object, e.g. --params \'{"status": {"type": "text", "value": "open"}}\'.');
|
|
131
|
+
}
|
|
132
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
133
|
+
throw new Error('--params must be a JSON object.');
|
|
134
|
+
// The server validates each entry's type/value pairing; names are checked here.
|
|
135
|
+
for (const name of Object.keys(parsed)) {
|
|
136
|
+
if (!PARAMETER_NAME.test(name))
|
|
137
|
+
throw new Error(`--params: invalid parameter name '${name}'.`);
|
|
138
|
+
}
|
|
139
|
+
return parsed;
|
|
140
|
+
}
|
|
141
|
+
if (textParams.length === 0)
|
|
142
|
+
return undefined;
|
|
143
|
+
const parameters = {};
|
|
144
|
+
for (const entry of textParams) {
|
|
145
|
+
const match = /^([A-Za-z_][A-Za-z0-9_]*)(?::([a-z]+))?=(.*)$/s.exec(entry);
|
|
146
|
+
if (!match)
|
|
147
|
+
throw new Error(`Invalid --param '${entry}': expected <name>[:<type>]=<value>, e.g. status=open or n:integer=5.`);
|
|
148
|
+
const [, name, type, raw] = match;
|
|
149
|
+
if (Object.hasOwn(parameters, name))
|
|
150
|
+
throw new Error(`--param ${name} is given more than once.`);
|
|
151
|
+
parameters[name] = sqlParameter({ type: type ?? 'text', raw: raw, label: `--param ${name}` });
|
|
152
|
+
}
|
|
153
|
+
return parameters;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Lower a read into the server's SQL grammar. Values are always bound
|
|
157
|
+
* parameters typed from the table's column types, never spliced into the SQL.
|
|
158
|
+
*/
|
|
159
|
+
export function buildReadSql({ plan, columnTypes }) {
|
|
160
|
+
const parameters = {};
|
|
161
|
+
const bind = ({ name, column, raw }) => {
|
|
162
|
+
const type = columnTypes.get(column);
|
|
163
|
+
if (type === undefined)
|
|
164
|
+
throw new Error(`Unknown column '${column}' on ${plan.namespace}.${plan.table}.`);
|
|
165
|
+
parameters[name] = sqlParameter({ type, raw, label: `--where ${column}` });
|
|
166
|
+
return `:${name}`;
|
|
167
|
+
};
|
|
168
|
+
const conditions = plan.filters.map(({ column, op, value }, index) => {
|
|
169
|
+
const target = quoted(column);
|
|
170
|
+
if (op === 'is')
|
|
171
|
+
return value === 'null' ? `${target} IS NULL` : `${target} = ${value === 'true' ? 'TRUE' : 'FALSE'}`;
|
|
172
|
+
if (op === 'in') {
|
|
173
|
+
const list = value.startsWith('(') && value.endsWith(')') ? value.slice(1, -1) : value;
|
|
174
|
+
const values = list === '' ? [] : list.split(',');
|
|
175
|
+
if (values.length === 0)
|
|
176
|
+
return 'FALSE';
|
|
177
|
+
return `(${values.map((raw, item) => `${target} = ${bind({ name: `w${index}_${item}`, column, raw })}`).join(' OR ')})`;
|
|
178
|
+
}
|
|
179
|
+
return `${target} ${COMPARISONS[op]} ${bind({ name: `w${index}`, column, raw: value })}`;
|
|
180
|
+
});
|
|
181
|
+
let sql = `SELECT ${plan.select.length ? plan.select.map(quoted).join(', ') : '*'} FROM ${quoted(plan.namespace)}.${quoted(plan.table)}`;
|
|
182
|
+
if (conditions.length)
|
|
183
|
+
sql += ` WHERE ${conditions.join(' AND ')}`;
|
|
184
|
+
if (plan.orderings.length)
|
|
185
|
+
sql += ` ORDER BY ${plan.orderings.map(({ column, direction }) => `${quoted(column)} ${direction.toUpperCase()}`).join(', ')}`;
|
|
186
|
+
if (plan.limit !== undefined)
|
|
187
|
+
sql += ` LIMIT ${plan.limit}`;
|
|
188
|
+
if (plan.offset !== undefined)
|
|
189
|
+
sql += ` OFFSET ${plan.offset}`;
|
|
190
|
+
return Object.keys(parameters).length ? { sql, parameters } : { sql };
|
|
191
|
+
}
|
|
192
|
+
/** The ORM client's operation transport, served by the CLI's Atlas client. */
|
|
193
|
+
function atlasTransport({ baseUrl, token }) {
|
|
194
|
+
return async ({ namespace, op, variables }) => {
|
|
195
|
+
// /_data/v2 is the canonical execution route, the same one `orm execute` uses.
|
|
196
|
+
const response = await postJsonResponse({ baseUrl, token, path: `/_data/v2/${namespace}`, body: { op, variables } });
|
|
197
|
+
let body = null;
|
|
198
|
+
try {
|
|
199
|
+
body = JSON.parse(response.body);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
body = null;
|
|
203
|
+
}
|
|
204
|
+
return { ok: response.status >= 200 && response.status < 300, status: response.status, body };
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
async function runSql({ args, namespace }) {
|
|
208
|
+
const { createOperationExecutorWithTransport } = await import('@sequenceholdings/orm/client');
|
|
209
|
+
const executor = createOperationExecutorWithTransport({ namespace, transport: atlasTransport(clientOptions(await buildContext(args))) });
|
|
210
|
+
return (variables) => executor.sql(variables);
|
|
211
|
+
}
|
|
212
|
+
function rowObjects(result) {
|
|
213
|
+
const names = result.columns.map((column) => column.name);
|
|
214
|
+
return result.rows.map((row) => Object.fromEntries(names.map((name, index) => [name, row[index]])));
|
|
215
|
+
}
|
|
216
|
+
function printRows({ result, format }) {
|
|
217
|
+
const rows = rowObjects(result);
|
|
218
|
+
if (format === 'json')
|
|
219
|
+
console.log(JSON.stringify(rows, null, 2));
|
|
220
|
+
else if (format === 'jsonl')
|
|
221
|
+
for (const row of rows)
|
|
222
|
+
console.log(JSON.stringify(row));
|
|
223
|
+
else {
|
|
224
|
+
table({ headers: result.columns.map((column) => column.name), rows: result.rows });
|
|
225
|
+
console.error(`${rows.length} row(s)`);
|
|
226
|
+
}
|
|
227
|
+
if (result.truncated) {
|
|
228
|
+
console.error('Results were truncated at the server limit (1,000 rows or 8 MiB). Narrow the query or page with LIMIT/OFFSET.');
|
|
229
|
+
}
|
|
230
|
+
return rows;
|
|
231
|
+
}
|
|
232
|
+
function readPlan(args) {
|
|
233
|
+
return {
|
|
234
|
+
namespace: identifier({ label: 'namespace', value: args.positional[0] }),
|
|
235
|
+
table: identifier({ label: 'table', value: args.positional[1] }),
|
|
236
|
+
select: typeof args.flags.select === 'string'
|
|
237
|
+
? args.flags.select.split(',').map((column) => identifier({ label: 'column', value: column.trim() }))
|
|
238
|
+
: [],
|
|
239
|
+
filters: repeated({ args, key: 'where' }).map(parseFilter),
|
|
240
|
+
orderings: repeated({ args, key: 'order' }).flatMap(parseOrder),
|
|
241
|
+
...(args.flags.limit !== undefined ? { limit: integer({ args, key: 'limit', min: 1 }) } : {}),
|
|
242
|
+
...(args.flags.offset !== undefined ? { offset: integer({ args, key: 'offset', min: 0 }) } : {}),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
export async function ormReadCommand(args) {
|
|
246
|
+
try {
|
|
247
|
+
validateCommandInput({
|
|
248
|
+
args,
|
|
249
|
+
flags: { where: 'string', select: 'string', order: 'string', limit: 'string', offset: 'string', jsonl: 'boolean' },
|
|
250
|
+
positional: 2,
|
|
251
|
+
});
|
|
252
|
+
const format = outputFormat(args);
|
|
253
|
+
const plan = readPlan(args);
|
|
254
|
+
const sql = await runSql({ args, namespace: plan.namespace });
|
|
255
|
+
// Filter values bind as parameters typed like their columns; read the types first.
|
|
256
|
+
const needsTypes = plan.filters.some((filter) => filter.op !== 'is');
|
|
257
|
+
const columnTypes = new Map(needsTypes
|
|
258
|
+
? (await sql({ sql: `SELECT * FROM ${quoted(plan.namespace)}.${quoted(plan.table)} LIMIT 0` })).columns.map((column) => [column.name, column.type])
|
|
259
|
+
: []);
|
|
260
|
+
const rows = printRows({ result: await sql(buildReadSql({ plan, columnTypes })), format });
|
|
261
|
+
if (plan.limit !== undefined && rows.length === plan.limit) {
|
|
262
|
+
console.error(`More rows may exist. Next page: --offset ${(plan.offset ?? 0) + plan.limit} --limit ${plan.limit}`);
|
|
263
|
+
}
|
|
264
|
+
return 0;
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
printCliError(error);
|
|
268
|
+
return 1;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
export async function ormSqlCommand(args) {
|
|
272
|
+
try {
|
|
273
|
+
validateCommandInput({
|
|
274
|
+
args,
|
|
275
|
+
flags: { query: 'string', file: 'string', param: 'string', params: 'string', jsonl: 'boolean' },
|
|
276
|
+
positional: 1,
|
|
277
|
+
});
|
|
278
|
+
const format = outputFormat(args);
|
|
279
|
+
const namespace = identifier({ label: 'namespace', value: args.positional[0] });
|
|
280
|
+
const inline = args.flags.query;
|
|
281
|
+
const file = args.flags.file;
|
|
282
|
+
if ((inline === undefined) === (file === undefined))
|
|
283
|
+
throw new Error('Pass exactly one of --query <sql> or --file <path>.');
|
|
284
|
+
const statement = typeof inline === 'string' ? inline : await readFile(String(file), 'utf8');
|
|
285
|
+
if (!statement.trim())
|
|
286
|
+
throw new Error('The SQL statement is empty.');
|
|
287
|
+
const parameters = parseSqlParams(args);
|
|
288
|
+
const sql = await runSql({ args, namespace });
|
|
289
|
+
printRows({ result: await sql(parameters ? { sql: statement, parameters } : { sql: statement }), format });
|
|
290
|
+
return 0;
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
printCliError(error);
|
|
294
|
+
if (isRejectedSql(error))
|
|
295
|
+
console.error(sqlGrammarHint(args.positional[0] ?? '<namespace>'));
|
|
296
|
+
return 1;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/** The server answers any SQL its grammar cannot compile with this code and no detail. */
|
|
300
|
+
function isRejectedSql(error) {
|
|
301
|
+
return error instanceof Error && error.name === 'OrmOperationError' && Reflect.get(error, 'code') === 'BAD_USER_INPUT';
|
|
302
|
+
}
|
|
303
|
+
export function sqlGrammarHint(namespace) {
|
|
304
|
+
return `[seq-studio] hint: reference every table as <namespace>.<table> (e.g. SELECT count(*) FROM ${namespace}.<table>); `
|
|
305
|
+
+ 'unqualified names and queries without a table are rejected. The grammar is read-only SELECT with joins, '
|
|
306
|
+
+ 'CTEs, UNION, aggregates (count, sum, avg, min, max), lower/upper/length, and comparison operators; '
|
|
307
|
+
+ 'it has no LIKE or IN. See: seq-studio orm sql --help.';
|
|
308
|
+
}
|
|
@@ -42,6 +42,12 @@ ${PIPELINE_DISCOVERY_USAGE}
|
|
|
42
42
|
then update orm-contracts.json and every matching satisfies.content_hash;
|
|
43
43
|
target is inferred when the environment exposes exactly one
|
|
44
44
|
|
|
45
|
+
seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--json]
|
|
46
|
+
preview whole-pipeline retirement; retain data and history
|
|
47
|
+
approve the exact inventory with --plan-hash <hash> --yes
|
|
48
|
+
inspect with --retirement-id <id>; resume a stopped operation with
|
|
49
|
+
--retirement-id <id> --resume --yes (never creates a replacement plan)
|
|
50
|
+
|
|
45
51
|
seq-studio pipeline codegen tables [--from <authoring.ts>] [--dir <dir>] [--dry-run] [--force]
|
|
46
52
|
emit one <stage>.stage.yml per table from a typed PerTableIngestionAuthoring
|
|
47
53
|
module (default export, authoring, or silverlakeAuthoring export name)
|
|
@@ -460,6 +466,10 @@ export async function runPipelineCommand(sub, args) {
|
|
|
460
466
|
const { pipelineUnbindCommand } = await import('./lifecycle.js');
|
|
461
467
|
return pipelineUnbindCommand(args);
|
|
462
468
|
}
|
|
469
|
+
case 'retire': {
|
|
470
|
+
const { pipelineRetireCommand } = await import('./retirement.js');
|
|
471
|
+
return pipelineRetireCommand(args);
|
|
472
|
+
}
|
|
463
473
|
case 'plan': {
|
|
464
474
|
const { pipelinePlanCommand } = await import('./lifecycle.js');
|
|
465
475
|
return pipelinePlanCommand(args);
|
|
@@ -2,7 +2,8 @@ import { getAccessToken } from '../auth.js';
|
|
|
2
2
|
import { getJson, postJson } from '../atlas-client.js';
|
|
3
3
|
import { printCliError } from '../cli-errors.js';
|
|
4
4
|
import { resolveConfiguredEnv } from '../config.js';
|
|
5
|
-
import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
|
|
5
|
+
import { REQUIRE_EXPLICIT_ENV_MESSAGE, explicitOrSandboxEnv } from '../env-flags.js';
|
|
6
|
+
import { cell, table } from '../text-table.js';
|
|
6
7
|
import { resolvePipelineTarget } from './lifecycle.js';
|
|
7
8
|
export const PIPELINE_DISCOVERY_USAGE = ` seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]
|
|
8
9
|
list pipeline repositories (default 50 per page), health and descriptions
|
|
@@ -58,7 +59,7 @@ function discoveryEnvironment(args) {
|
|
|
58
59
|
const values = [shortEnv, longEnv, ...args.repeatedFlags?.env ?? [], ...args.repeatedFlags?.e ?? []].filter(Boolean);
|
|
59
60
|
if (new Set(values).size > 1)
|
|
60
61
|
throw new Error('-e and --env must select the same environment');
|
|
61
|
-
const environment = shortEnv ?? longEnv;
|
|
62
|
+
const environment = explicitOrSandboxEnv(shortEnv ?? longEnv);
|
|
62
63
|
if (!environment)
|
|
63
64
|
throw new Error(REQUIRE_EXPLICIT_ENV_MESSAGE);
|
|
64
65
|
return environment;
|
|
@@ -105,20 +106,6 @@ function discoveryOptions({ sub, args }) {
|
|
|
105
106
|
const offset = integerFlag({ args, name: 'offset', min: 0, max: Number.MAX_SAFE_INTEGER });
|
|
106
107
|
return { environment, json: args.flags.json === true || args.flags.json === 'true', repo, sql, query, limit, offset };
|
|
107
108
|
}
|
|
108
|
-
function cell(value) {
|
|
109
|
-
if (value === undefined)
|
|
110
|
-
return '—';
|
|
111
|
-
if (typeof value !== 'string')
|
|
112
|
-
return JSON.stringify(value) ?? '—';
|
|
113
|
-
// Preserve readable text while escaping control characters from source data.
|
|
114
|
-
return value.replace(/\p{Cc}/gu, (char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
115
|
-
}
|
|
116
|
-
function table({ headers, rows }) {
|
|
117
|
-
const lines = [headers, ...rows].map((row) => row.map(cell));
|
|
118
|
-
const widths = headers.map((_, index) => Math.max(...lines.map((line) => line[index]?.length ?? 0)));
|
|
119
|
-
for (const line of lines)
|
|
120
|
-
console.log(line.map((value, index) => value.padEnd(widths[index] ?? 0)).join(' ').trimEnd());
|
|
121
|
-
}
|
|
122
109
|
function printAssetResult(result) {
|
|
123
110
|
console.log(`Asset: ${cell(result.assetId)}`);
|
|
124
111
|
console.log(`Target: ${cell(result.environment)} | ${cell(result.target.engine)} | ${cell(result.target.fullName)}`);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { postJson } from '../atlas-client.js';
|
|
2
|
+
import { envAndToken, resolvePipelineTarget } from './lifecycle.js';
|
|
3
|
+
/** Retirement is deliberately preview-first; neither --yes nor a hash alone mutates. */
|
|
4
|
+
export async function pipelineRetireCommand(args) {
|
|
5
|
+
const string = (name) => {
|
|
6
|
+
const value = args.flags[name];
|
|
7
|
+
if (value === true)
|
|
8
|
+
throw new Error(`--${name} requires a value`);
|
|
9
|
+
return value;
|
|
10
|
+
};
|
|
11
|
+
const repo = string('repo');
|
|
12
|
+
const planHash = string('plan-hash');
|
|
13
|
+
const retirementId = string('retirement-id');
|
|
14
|
+
const resume = args.flags.resume === true;
|
|
15
|
+
const confirmed = args.flags.yes === true;
|
|
16
|
+
if (!repo || ((planHash || resume) && !confirmed) || (resume && !retirementId) || (confirmed && !planHash && !resume)) {
|
|
17
|
+
console.error('usage: seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--plan-hash <hash> --yes | --retirement-id <id> [--resume --yes]] [--json]');
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
const { env, token } = await envAndToken(args, { human: true });
|
|
21
|
+
const target = await resolvePipelineTarget({ args, env, token });
|
|
22
|
+
const result = await postJson({ baseUrl: env.url, token, path: '/api/data-pipelines/pipelines/retire', body: { repo, environment: target.id, ...(planHash ? { planHash } : {}), ...(retirementId ? { retirementId } : {}), resume } });
|
|
23
|
+
if (args.flags.json)
|
|
24
|
+
console.log(JSON.stringify(result, null, 2));
|
|
25
|
+
else if (result.plan) {
|
|
26
|
+
console.log(`Retire ${repo} in ${target.id}: ${result.plan.inventory.stageRows.length} stages. Data and history retained.`);
|
|
27
|
+
for (const r of result.plan.inventory.resources)
|
|
28
|
+
console.log(` ${['job', 'dlt_pipeline', 'synced_table'].includes(r.kind) ? 'Verify/remove execution resource' : 'Retain data object'}: ${r.kind} ${r.nativeId} (${r.resourceKey})`);
|
|
29
|
+
console.log(`Review the inventory, then approve with --plan-hash ${result.plan.planHash} --yes. Native preflight can still block unsafe deletion.`);
|
|
30
|
+
}
|
|
31
|
+
else
|
|
32
|
+
console.log(`Retirement ${result.retirementId}: ${result.status}${result.statusDetail ? ` — ${result.statusDetail}` : ''}\nCheck with --retirement-id ${result.retirementId}. Resume a stopped failure with --retirement-id ${result.retirementId} --resume --yes.`);
|
|
33
|
+
return result.status === 'failed' ? 1 : 0;
|
|
34
|
+
}
|
package/dist/process/build.js
CHANGED
|
@@ -197,6 +197,8 @@ function serializeNodeMetadata(node) {
|
|
|
197
197
|
meta.output_mode = agent.outputMode;
|
|
198
198
|
if (agent.workflowId !== undefined)
|
|
199
199
|
meta.workflow_id = agent.workflowId;
|
|
200
|
+
if (agent.expectedIdentity !== undefined)
|
|
201
|
+
meta.expected_identity = { ...agent.expectedIdentity };
|
|
200
202
|
if (agent.on_reset_edge_id)
|
|
201
203
|
meta.on_reset_edge_id = agent.on_reset_edge_id;
|
|
202
204
|
if (agent.bindings)
|
|
@@ -316,6 +318,8 @@ function serializeNodeMetadata(node) {
|
|
|
316
318
|
? { join_source: parallel.join.toString() }
|
|
317
319
|
: { join_expr: parallel.join.expr }),
|
|
318
320
|
};
|
|
321
|
+
if (parallel.captureProvenance === true)
|
|
322
|
+
pmeta.capture_provenance = true;
|
|
319
323
|
// Serialized only when non-default ('eager') so existing barrier
|
|
320
324
|
// bundles keep their hashes; a missing field reads as 'barrier'.
|
|
321
325
|
if (parallel.join_mode === 'eager') {
|
package/dist/process/codegen.js
CHANGED
|
@@ -105,6 +105,7 @@ function emitNode(node, ctx) {
|
|
|
105
105
|
m.allowed_tools !== undefined ? ` allowedTools: ${JSON.stringify(m.allowed_tools)},` : null,
|
|
106
106
|
m.output_mode !== undefined ? ` outputMode: ${value(m.output_mode)},` : null,
|
|
107
107
|
m.workflow_id != null ? ` workflowId: ${lit(String(m.workflow_id))},` : null,
|
|
108
|
+
m.expected_identity !== undefined ? ` expectedIdentity: ${JSON.stringify(m.expected_identity)},` : null,
|
|
108
109
|
m.on_reset_edge_id != null ? ` on_reset_edge_id: ${lit(String(m.on_reset_edge_id))},` : null,
|
|
109
110
|
m.timeout !== undefined ? ` timeout: ${value(m.timeout)},` : null,
|
|
110
111
|
bindings(m.bindings),
|
|
@@ -194,6 +195,7 @@ function emitNode(node, ctx) {
|
|
|
194
195
|
...head,
|
|
195
196
|
...branchFields,
|
|
196
197
|
par.max_concurrency !== undefined ? ` max_concurrency: ${par.max_concurrency},` : null,
|
|
198
|
+
par.capture_provenance === true ? ` captureProvenance: true,` : null,
|
|
197
199
|
par.supervisor_retry !== undefined
|
|
198
200
|
? ` supervisor_retry: ${retryConfig(par.supervisor_retry, ctx)},`
|
|
199
201
|
: null,
|
package/dist/process/commands.js
CHANGED
|
@@ -12,6 +12,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
12
12
|
import { forEachSerializedNode, } from '@sequenceholdings/lattice/bundle';
|
|
13
13
|
import { getJson, getJsonOr404, postJson, AtlasApiError } from '../atlas-client.js';
|
|
14
14
|
import { generateProcessFiles } from './codegen.js';
|
|
15
|
+
import { readSandboxToken, sandboxTarget, sourceAuthMode } from '../sandbox-auth.js';
|
|
15
16
|
import { getAccessToken, getAccessTokenWithMode, inspectAuthPreflight, AuthTokenStoreError, NotLoggedInError, } from '../auth.js';
|
|
16
17
|
import { readConfig, resolveEnv, resolveConfiguredEnv } from '../config.js';
|
|
17
18
|
import { currentVersion } from '../update-check.js';
|
|
@@ -403,7 +404,7 @@ async function applyLocal(args) {
|
|
|
403
404
|
}
|
|
404
405
|
async function applyFromRepo(args, spec) {
|
|
405
406
|
const { authMode, env, token } = await getEnvAndAuth(args);
|
|
406
|
-
const source = await resolveArtifactSource({ kind: 'git-service', namespace: spec.namespace, name: spec.name, ref: spec.ref }, { authMode, baseUrl: env.url, token });
|
|
407
|
+
const source = await resolveArtifactSource({ kind: 'git-service', namespace: spec.namespace, name: spec.name, ref: spec.ref }, { authMode: sourceAuthMode(authMode), baseUrl: env.url, token });
|
|
407
408
|
try {
|
|
408
409
|
await prepareProcessBuildRoot(source.dir);
|
|
409
410
|
const compiled = await compileProcessSourceIsolated({
|
|
@@ -916,6 +917,24 @@ function doctorBooleanFlag({ key, value }) {
|
|
|
916
917
|
return true;
|
|
917
918
|
throw new Error(`--${key} accepts only true or false.`);
|
|
918
919
|
}
|
|
920
|
+
async function sandboxAuthPreflight(sandbox) {
|
|
921
|
+
try {
|
|
922
|
+
await readSandboxToken(sandbox);
|
|
923
|
+
return {
|
|
924
|
+
ok: true,
|
|
925
|
+
line: `auth preflight: ok — sandbox token readable at ${sandbox.tokenFile}; login, token cache, and environment registry are not used`,
|
|
926
|
+
diagnostics: { status: 'sandbox', tokenFile: sandbox.tokenFile, tokenReadable: true },
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
catch (err) {
|
|
930
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
931
|
+
return {
|
|
932
|
+
ok: false,
|
|
933
|
+
line: `auth preflight: FAIL — ${detail}`,
|
|
934
|
+
diagnostics: { status: 'sandbox', tokenFile: sandbox.tokenFile, tokenReadable: false, detail },
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
}
|
|
919
938
|
export async function doctorCommand(args) {
|
|
920
939
|
if (args.flags.help || args.positional.includes('-h') || args.positional[0] === 'help') {
|
|
921
940
|
console.log('usage: seq-studio doctor [-e <env>] [--json] [--offline]\n\nDiagnose configuration, authentication, local service availability, CLI/SDK resolution, and deployment access. Does not open a browser. --offline reads only local config and token metadata; it performs no discovery or HTTP requests.');
|
|
@@ -979,6 +998,17 @@ export async function doctorCommand(args) {
|
|
|
979
998
|
lines.push(`config: ok — default_env=${config.defaultEnv}, envs=${Object.keys(config.envs).join(',')}`);
|
|
980
999
|
}
|
|
981
1000
|
const requested = typeof args.flags.env === 'string' ? args.flags.env : undefined;
|
|
1001
|
+
let sandbox = null;
|
|
1002
|
+
try {
|
|
1003
|
+
sandbox = sandboxTarget();
|
|
1004
|
+
if (sandbox) {
|
|
1005
|
+
lines.push(`sandbox: token-file mode — ${sandbox.baseUrl}, token read from ${sandbox.tokenFile} on every request; -e is ignored`);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
catch (err) {
|
|
1009
|
+
lines.push(`sandbox: FAIL — ${err instanceof Error ? err.message : String(err)}`);
|
|
1010
|
+
ok = false;
|
|
1011
|
+
}
|
|
982
1012
|
let env = null;
|
|
983
1013
|
if (config) {
|
|
984
1014
|
try {
|
|
@@ -1010,24 +1040,33 @@ export async function doctorCommand(args) {
|
|
|
1010
1040
|
else if (!offline && isLoopbackUrl(env.url)) {
|
|
1011
1041
|
lines.push(`local service: ok — ${env.url}`);
|
|
1012
1042
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
diagnostics.auth = authPreflight;
|
|
1020
|
-
lines.push(`auth cache: ${authPreflight.tokenCache}; user token ${authPreflight.cachedUserToken}; ` +
|
|
1021
|
-
`M2M credential ${authPreflight.m2mCredentialConfigured ? 'configured' : 'not configured'} ` +
|
|
1022
|
-
`(mode=${authPreflight.authMode}, realm=${authPreflight.realm}${authPreflight.realmVerified ? '' : ', unverified offline'})`);
|
|
1043
|
+
if (sandbox) {
|
|
1044
|
+
// No login, token cache, or registry exists in a sandbox; inspect the token source instead.
|
|
1045
|
+
const result = await sandboxAuthPreflight(sandbox);
|
|
1046
|
+
diagnostics.auth = result.diagnostics;
|
|
1047
|
+
lines.push(result.line);
|
|
1048
|
+
ok &&= result.ok;
|
|
1023
1049
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1050
|
+
else {
|
|
1051
|
+
try {
|
|
1052
|
+
authPreflight = await inspectAuthPreflight({
|
|
1053
|
+
env: env.name,
|
|
1054
|
+
offline,
|
|
1055
|
+
...(offline ? {} : { targetUrl: env.url }),
|
|
1056
|
+
});
|
|
1057
|
+
diagnostics.auth = authPreflight;
|
|
1058
|
+
lines.push(`auth cache: ${authPreflight.tokenCache}; user token ${authPreflight.cachedUserToken}; ` +
|
|
1059
|
+
`M2M credential ${authPreflight.m2mCredentialConfigured ? 'configured' : 'not configured'} ` +
|
|
1060
|
+
`(mode=${authPreflight.authMode}, realm=${authPreflight.realm}${authPreflight.realmVerified ? '' : ', unverified offline'})`);
|
|
1061
|
+
}
|
|
1062
|
+
catch (err) {
|
|
1063
|
+
diagnostics.auth = {
|
|
1064
|
+
status: 'unavailable',
|
|
1065
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
1066
|
+
};
|
|
1067
|
+
lines.push(`auth preflight: FAIL — ${err instanceof Error ? err.message : String(err)}`);
|
|
1068
|
+
ok = false;
|
|
1069
|
+
}
|
|
1031
1070
|
}
|
|
1032
1071
|
}
|
|
1033
1072
|
try {
|
|
@@ -1055,9 +1094,10 @@ export async function doctorCommand(args) {
|
|
|
1055
1094
|
if (!offline && env && token) {
|
|
1056
1095
|
// Hit a writer-gated endpoint with a fake hash so the request
|
|
1057
1096
|
// either:
|
|
1058
|
-
// - 404 NOT_FOUND → writer gate passed (
|
|
1059
|
-
//
|
|
1060
|
-
// - 403 FORBIDDEN → not
|
|
1097
|
+
// - 404 NOT_FOUND → writer gate passed (this credential may author
|
|
1098
|
+
// Lattice processes; the hash just doesn't exist), OR
|
|
1099
|
+
// - 403 FORBIDDEN → this credential may not author (an untrusted
|
|
1100
|
+
// machine client, or a Sequence account whose membership isn't synced).
|
|
1061
1101
|
// The GET /processes/:id endpoint uses plain `authenticate` so it
|
|
1062
1102
|
// cannot distinguish these cases. GET /bundles/:hash is gated by
|
|
1063
1103
|
// `authenticateLatticeWriter` and is the right probe.
|
|
@@ -1073,16 +1113,17 @@ export async function doctorCommand(args) {
|
|
|
1073
1113
|
token,
|
|
1074
1114
|
path: `/api/lattice/bundles/${PROBE_HASH}`,
|
|
1075
1115
|
});
|
|
1076
|
-
lines.push('writer gate: ok —
|
|
1116
|
+
lines.push('writer gate: ok — this account can author Lattice processes (probe via GET /bundles/<zeros>)');
|
|
1077
1117
|
}
|
|
1078
1118
|
catch (err) {
|
|
1079
1119
|
if (err instanceof AtlasApiError) {
|
|
1080
1120
|
if (err.status === 404) {
|
|
1081
|
-
lines.push('writer gate: ok —
|
|
1121
|
+
lines.push('writer gate: ok — this account can author Lattice processes (GET /bundles/<zeros> → 404 means we passed the writer gate, the probe hash is fake)');
|
|
1082
1122
|
}
|
|
1083
1123
|
else if (err.status === 403) {
|
|
1084
|
-
lines.push('writer gate: FAIL — 403 from Atlas
|
|
1085
|
-
'
|
|
1124
|
+
lines.push('writer gate: FAIL — 403 from Atlas: this credential cannot author Lattice processes. ' +
|
|
1125
|
+
'Sign in as yourself with `seq-studio login` (machine credentials must be on Sequence\'s trusted list); ' +
|
|
1126
|
+
'a new Sequence account may need to sign in to Atlas once first.');
|
|
1086
1127
|
ok = false;
|
|
1087
1128
|
}
|
|
1088
1129
|
else if (err.status === 401) {
|