@notis_ai/cli 0.2.31 → 0.2.32
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 +14 -0
- package/config/notis_app_design_rules.json +22 -0
- package/dist/agent-hooks/notis-agent-hook.mjs +352 -27
- package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-spaces/SKILL.md +4 -1
- package/dist/base-skills/notis-spaces/references/fixtures.md +4 -2
- package/dist/base-skills/notis-spaces/references/reading.md +3 -1
- package/dist/base-skills/notis-spaces/references/release.md +3 -1
- package/dist/base-skills/notis-spaces/references/sdk.md +25 -5
- package/dist/sdk/src/ui/icons.tsx +17 -1
- package/dist/space-harness/host.js +83 -79
- package/dist/space-sdk/dist/{chunk-3DFOGU26.js → chunk-I4Z4UFGB.js} +1 -1
- package/dist/space-sdk/dist/index.js +1 -1
- package/dist/space-sdk/dist/ui.js +5 -5
- package/dist/space-sdk/src/tailwind-candidates.d.ts +42 -0
- package/dist/space-sdk/src/ui/blocks/blocks.d.ts +18 -0
- package/dist/space-sdk/src/ui/blocks/index.d.ts +2 -2
- package/dist/space-sdk/src/ui/icons.d.ts +6 -0
- package/dist/space-sdk/src/ui/index.d.ts +1 -1
- package/dist/space-sdk/src/ui/list/ListReader.d.ts +8 -0
- package/dist/view-renderer/dist/host.js +151 -147
- package/package.json +3 -3
- package/skills/notis-spaces/cli.md +14 -0
- package/src/command-specs/spaces.js +67 -0
- package/src/runtime/app-boundary-validator.js +248 -3
- package/src/runtime/app-data-literals.js +32 -23
- package/src/runtime/space-test-server.js +22 -3
package/README.md
CHANGED
|
@@ -407,6 +407,20 @@ When to use: Find a link binding and its revision before removing it, including
|
|
|
407
407
|
Examples:
|
|
408
408
|
- `npx --package @notis_ai/cli@latest -- notis spaces links list <space-id>`
|
|
409
409
|
|
|
410
|
+
### `npx --package @notis_ai/cli@latest -- notis spaces records <space-id> <binding>`
|
|
411
|
+
|
|
412
|
+
List the records of one database linked into a Space you edit: record key and title, oldest first, one page at a time.
|
|
413
|
+
|
|
414
|
+
When to use: Find the record keys and titles of a linked database, for example to write fixtures or link to one record. Editors only; anyone else reads through the Space's declared actions.
|
|
415
|
+
|
|
416
|
+
Options:
|
|
417
|
+
- `--limit <number>` — Records per page, 1 to 100; defaults to 20.
|
|
418
|
+
- `--offset <number>` — Zero-based start; pass next_offset from the previous page.
|
|
419
|
+
- `--record <record-key>` — Fixed record context, when this is a record-scoped Space.
|
|
420
|
+
|
|
421
|
+
Examples:
|
|
422
|
+
- `npx --package @notis_ai/cli@latest -- notis spaces records <space-id> tasks --limit 20`
|
|
423
|
+
|
|
410
424
|
### `npx --package @notis_ai/cli@latest -- notis spaces links remove <space-id> <binding-id>`
|
|
411
425
|
|
|
412
426
|
Remove one database, Skill or automation link from a Space by its binding.
|
|
@@ -20,6 +20,28 @@
|
|
|
20
20
|
},
|
|
21
21
|
"toolkit_live_pieces": [],
|
|
22
22
|
"toolkit_note": "Rules with a toolkit_piece point at a hand-rolled pattern the live Notis toolkit replaces. They stay warnings until that piece name is added to toolkit_live_pieces, then they refuse like any error.",
|
|
23
|
+
"icons": {
|
|
24
|
+
"id": "space-unknown-icon",
|
|
25
|
+
"profiles": ["space"],
|
|
26
|
+
"description": "Every name the toolkit's Icon draws (SHAPES in packages/sdk/src/ui/icons.tsx, exported as ICON_NAMES; packages/sdk/src/ui/icons.test.tsx fails when this list drifts from it). A kebab-case string literal handed to a toolkit icon input must be one of them: name on Icon and icon on any other component imported from @notis/sdk (aliases and namespaces resolved), and an icon field of an object that also has a label (reader actions, menu items, tabs). Only whole literal values are read, never text inside strings or comments; Phosphor stored names (phosphor:x), emoji, URLs and the Space config files (whose icon is a phosphor:<name> the deploy checks) are not checked. {name} and {suggestions} fill the message.",
|
|
27
|
+
"message": "Unknown icon \"{name}\": the toolkit has no icon by that name, so it draws nothing. Closest names: {suggestions}. Use a name from the toolkit set (every name is listed in the notis-spaces SDK reference) or pass a @phosphor-icons/react element as the icon.",
|
|
28
|
+
"suggestions": 3,
|
|
29
|
+
"exclude": ["**/space.config.*", "**/notis.config.*"],
|
|
30
|
+
"names": [
|
|
31
|
+
"archive", "arrow-bend-up-right", "arrow-clockwise", "arrow-counter-clockwise", "arrow-left", "arrow-square-out",
|
|
32
|
+
"arrows-clockwise", "arrows-left-right", "arrows-out", "caret-down", "caret-left", "caret-right",
|
|
33
|
+
"caret-up", "chart-line-up", "chat-circle-text", "chats", "check", "check-circle",
|
|
34
|
+
"check-circle-fill", "circle", "circle-dashed", "circle-half", "circle-three-quarter", "clipboard-text",
|
|
35
|
+
"clock", "clock-countdown", "copy", "corners-out", "dots-three", "download-simple",
|
|
36
|
+
"envelope-open", "envelope-simple", "file", "file-audio", "file-image", "file-text",
|
|
37
|
+
"file-video", "flask", "fork-knife", "funnel-simple", "hourglass", "info",
|
|
38
|
+
"kanban", "link", "magnifying-glass-minus", "magnifying-glass-plus", "minus-circle", "paper-plane-right",
|
|
39
|
+
"paper-plane-tilt", "paperclip", "pause", "pencil-simple", "play", "plus",
|
|
40
|
+
"rocket-launch", "sidebar-simple", "sparkle", "square-center", "star", "star-fill",
|
|
41
|
+
"toggle-left", "toggle-right", "trash", "tray-arrow-up", "user-plus", "x",
|
|
42
|
+
"x-circle-fill"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
23
45
|
"rules": [
|
|
24
46
|
{
|
|
25
47
|
"id": "no-side-bar",
|
|
@@ -26084,7 +26084,7 @@ var require_eventsource_stream = __commonJS({
|
|
|
26084
26084
|
var COLON = 58;
|
|
26085
26085
|
var SPACE = 32;
|
|
26086
26086
|
var defaultMaxEventSize = buffer.kStringMaxLength;
|
|
26087
|
-
var
|
|
26087
|
+
var DATA2 = Buffer.from("data");
|
|
26088
26088
|
var EVENT = Buffer.from("event");
|
|
26089
26089
|
var ID = Buffer.from("id");
|
|
26090
26090
|
var RETRY = Buffer.from("retry");
|
|
@@ -26279,7 +26279,7 @@ var require_eventsource_stream = __commonJS({
|
|
|
26279
26279
|
++valueStart;
|
|
26280
26280
|
}
|
|
26281
26281
|
}
|
|
26282
|
-
if (isFieldName(line, fieldLength,
|
|
26282
|
+
if (isFieldName(line, fieldLength, DATA2)) {
|
|
26283
26283
|
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
|
|
26284
26284
|
throw createMaxEventSizeExceededError();
|
|
26285
26285
|
}
|
|
@@ -65747,20 +65747,30 @@ function isJsonParse(node) {
|
|
|
65747
65747
|
const callee = node.callee;
|
|
65748
65748
|
return node.type === "CallExpression" && callee?.type === "MemberExpression" && !callee.computed && callee.object?.type === "Identifier" && callee.object.name === "JSON" && callee.property?.type === "Identifier" && callee.property.name === "parse";
|
|
65749
65749
|
}
|
|
65750
|
-
|
|
65751
|
-
|
|
65752
|
-
|
|
65753
|
-
|
|
65754
|
-
|
|
65755
|
-
|
|
65756
|
-
|
|
65757
|
-
|
|
65758
|
-
|
|
65759
|
-
|
|
65760
|
-
|
|
65761
|
-
|
|
65750
|
+
var NOT_DATA = /* @__PURE__ */ new Set([
|
|
65751
|
+
"JSXAttribute",
|
|
65752
|
+
"ImportDeclaration",
|
|
65753
|
+
"ImportExpression",
|
|
65754
|
+
"TSImportType",
|
|
65755
|
+
"ExportAllDeclaration",
|
|
65756
|
+
"ExportNamedDeclaration",
|
|
65757
|
+
"NewExpression",
|
|
65758
|
+
"TaggedTemplateExpression",
|
|
65759
|
+
"MemberExpression",
|
|
65760
|
+
"OptionalMemberExpression"
|
|
65761
|
+
]);
|
|
65762
|
+
var DATA = /* @__PURE__ */ new Set(["VariableDeclarator", "ExportDefaultDeclaration", "ReturnStatement"]);
|
|
65763
|
+
function decides(node) {
|
|
65764
|
+
if (NOT_DATA.has(node.type)) return false;
|
|
65765
|
+
if ((node.type === "CallExpression" || node.type === "OptionalCallExpression") && !isJsonParse(node)) return false;
|
|
65766
|
+
if (DATA.has(node.type)) return true;
|
|
65767
|
+
if (node.type === "ExpressionStatement") return false;
|
|
65768
|
+
return null;
|
|
65762
65769
|
}
|
|
65763
65770
|
function maskSerializedJsonData(content, extension = ".js") {
|
|
65771
|
+
return maskSerializedJsonDataOrNull(content, extension) ?? content;
|
|
65772
|
+
}
|
|
65773
|
+
function maskSerializedJsonDataOrNull(content, extension = ".js") {
|
|
65764
65774
|
let ast;
|
|
65765
65775
|
try {
|
|
65766
65776
|
babelParse ||= require2("@babel/parser").parse;
|
|
@@ -65772,16 +65782,16 @@ function maskSerializedJsonData(content, extension = ".js") {
|
|
|
65772
65782
|
...extension !== ".ts" ? ["jsx"] : []
|
|
65773
65783
|
]
|
|
65774
65784
|
});
|
|
65775
|
-
} catch {
|
|
65776
|
-
return content;
|
|
65785
|
+
} catch (error) {
|
|
65786
|
+
return error instanceof RangeError ? null : content;
|
|
65777
65787
|
}
|
|
65778
65788
|
const ranges = [];
|
|
65779
|
-
const pending = [[ast,
|
|
65789
|
+
const pending = [[ast, false, null]];
|
|
65780
65790
|
while (pending.length) {
|
|
65781
|
-
const [node,
|
|
65791
|
+
const [node, underAttribute, decided] = pending.pop();
|
|
65782
65792
|
if (!node || typeof node !== "object") continue;
|
|
65783
65793
|
const literal = node.type === "StringLiteral" ? node.value : node.type === "TemplateLiteral" && node.expressions.length === 0 ? node.quasis[0]?.value.cooked : null;
|
|
65784
|
-
if (typeof literal === "string" &&
|
|
65794
|
+
if (typeof literal === "string" && !underAttribute && decided === true) {
|
|
65785
65795
|
try {
|
|
65786
65796
|
const value = JSON.parse(literal);
|
|
65787
65797
|
if (value !== null && typeof value === "object") {
|
|
@@ -65791,12 +65801,13 @@ function maskSerializedJsonData(content, extension = ".js") {
|
|
|
65791
65801
|
} catch {
|
|
65792
65802
|
}
|
|
65793
65803
|
}
|
|
65794
|
-
const
|
|
65804
|
+
const own = node.type ? decides(node) : null;
|
|
65805
|
+
const below = [underAttribute || node.type === "JSXAttribute", own ?? decided];
|
|
65795
65806
|
for (const [key2, value] of Object.entries(node)) {
|
|
65796
65807
|
if (["loc", "extra", "tokens", "comments", "errors"].includes(key2)) continue;
|
|
65797
65808
|
if (Array.isArray(value)) {
|
|
65798
|
-
for (const child of value) if (child?.type) pending.push([child,
|
|
65799
|
-
} else if (value?.type) pending.push([value,
|
|
65809
|
+
for (const child of value) if (child?.type) pending.push([child, ...below]);
|
|
65810
|
+
} else if (value?.type) pending.push([value, ...below]);
|
|
65800
65811
|
}
|
|
65801
65812
|
}
|
|
65802
65813
|
let cursor = 0;
|
|
@@ -66077,7 +66088,7 @@ function loadDesignRules({ rulesPath = resolveDesignRulesPath(), profile = "app"
|
|
|
66077
66088
|
);
|
|
66078
66089
|
}
|
|
66079
66090
|
if (!payload) {
|
|
66080
|
-
return { profile, include: [], exclude: [], extensions: DEFAULT_DESIGN_EXTENSIONS, rules: [], allowDirective: "notis-design-allow", allowReasonMinLength: 12 };
|
|
66091
|
+
return { profile, include: [], exclude: [], extensions: DEFAULT_DESIGN_EXTENSIONS, rules: [], icons: null, allowDirective: "notis-design-allow", allowReasonMinLength: 12 };
|
|
66081
66092
|
}
|
|
66082
66093
|
const profiles = payload.profiles && typeof payload.profiles === "object" && !Array.isArray(payload.profiles) ? payload.profiles : {};
|
|
66083
66094
|
const selected2 = profile !== "app" && profiles[profile] && typeof profiles[profile] === "object" ? profiles[profile] : null;
|
|
@@ -66091,6 +66102,7 @@ function loadDesignRules({ rulesPath = resolveDesignRulesPath(), profile = "app"
|
|
|
66091
66102
|
extensions: Array.isArray(payload.extensions) ? payload.extensions : DEFAULT_DESIGN_EXTENSIONS,
|
|
66092
66103
|
allowDirective: typeof payload.allow_directive === "string" ? payload.allow_directive : "notis-design-allow",
|
|
66093
66104
|
allowReasonMinLength: Number.isInteger(payload.allow_reason_min_length) ? payload.allow_reason_min_length : 12,
|
|
66105
|
+
icons: loadIconCheck(payload.icons, profile),
|
|
66094
66106
|
rules: (Array.isArray(payload.rules) ? payload.rules : []).filter((rule) => !Array.isArray(rule.profiles) || rule.profiles.includes(profile)).map((rule) => ({
|
|
66095
66107
|
id: rule.id,
|
|
66096
66108
|
severity: typeof rule.toolkit_piece === "string" ? livePieces.has(rule.toolkit_piece) ? "error" : "warn" : (rule.profile_severity?.[profile] ?? rule.severity) === "warn" ? "warn" : "error",
|
|
@@ -66103,6 +66115,205 @@ function loadDesignRules({ rulesPath = resolveDesignRulesPath(), profile = "app"
|
|
|
66103
66115
|
}))
|
|
66104
66116
|
};
|
|
66105
66117
|
}
|
|
66118
|
+
var ICON_NAME_SHAPE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
66119
|
+
var SDK_IMPORTS = /(?<![\w$.])import\s+([\w$\s{},*]+?)\s+from\s*(["'])@notis\/sdk(?:\/[^"'\s]*)?\2/g;
|
|
66120
|
+
var JSX_TAG = /<([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)?)(?=[\s/>])/g;
|
|
66121
|
+
var JSX_ATTRIBUTE = /(?<![\w$.-])(icon|name)\s*=\s*/g;
|
|
66122
|
+
var ICON_FIELD = /(?<![\w$.-])icon\s*:\s*/g;
|
|
66123
|
+
var LABEL_KEY = /(?<![\w$.-])label\s*[:,}]/g;
|
|
66124
|
+
var TAG_TEXT = /[\w$\-:.=\t\n\v\f\r /]/;
|
|
66125
|
+
function sdkBindings(text2) {
|
|
66126
|
+
const components = /* @__PURE__ */ new Map(), namespaces = /* @__PURE__ */ new Set();
|
|
66127
|
+
for (const match of text2.matchAll(SDK_IMPORTS)) {
|
|
66128
|
+
const clause = match[1].trim();
|
|
66129
|
+
if (/^type\s/.test(clause)) continue;
|
|
66130
|
+
const namespace = clause.match(/\*\s*as\s+([\w$]+)/);
|
|
66131
|
+
if (namespace) namespaces.add(namespace[1]);
|
|
66132
|
+
const named = clause.match(/\{([^}]*)\}/);
|
|
66133
|
+
for (const part of named ? named[1].split(",") : []) {
|
|
66134
|
+
const item = part.trim();
|
|
66135
|
+
if (!item || /^type\s/.test(item)) continue;
|
|
66136
|
+
const [exported, local = exported] = item.split(/\s+as\s+/).map((value) => value.trim());
|
|
66137
|
+
components.set(local, exported);
|
|
66138
|
+
}
|
|
66139
|
+
}
|
|
66140
|
+
return { components, namespaces };
|
|
66141
|
+
}
|
|
66142
|
+
function sourceShape(text2) {
|
|
66143
|
+
const length = text2.length;
|
|
66144
|
+
const inString = new Uint8Array(length), owner = new Int32Array(length).fill(-1), closes = /* @__PURE__ */ new Map(), stack = [];
|
|
66145
|
+
let index = 0;
|
|
66146
|
+
while (index < length) {
|
|
66147
|
+
const char = text2[index];
|
|
66148
|
+
const top = stack.length ? stack[stack.length - 1] : -1;
|
|
66149
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
66150
|
+
let cursor = index + 1, closed = false;
|
|
66151
|
+
while (cursor < length) {
|
|
66152
|
+
const inner = text2[cursor];
|
|
66153
|
+
if (inner === "\\") {
|
|
66154
|
+
cursor += 2;
|
|
66155
|
+
continue;
|
|
66156
|
+
}
|
|
66157
|
+
if (inner === char) {
|
|
66158
|
+
cursor += 1;
|
|
66159
|
+
closed = true;
|
|
66160
|
+
break;
|
|
66161
|
+
}
|
|
66162
|
+
if (inner === "\n" && char !== "`") break;
|
|
66163
|
+
cursor += 1;
|
|
66164
|
+
}
|
|
66165
|
+
if (closed) {
|
|
66166
|
+
for (let at = index; at < cursor; at += 1) {
|
|
66167
|
+
inString[at] = 1;
|
|
66168
|
+
owner[at] = top;
|
|
66169
|
+
}
|
|
66170
|
+
index = cursor;
|
|
66171
|
+
continue;
|
|
66172
|
+
}
|
|
66173
|
+
}
|
|
66174
|
+
owner[index] = top;
|
|
66175
|
+
if (char === "{") stack.push(index);
|
|
66176
|
+
else if (char === "}" && stack.length) closes.set(stack.pop(), index);
|
|
66177
|
+
index += 1;
|
|
66178
|
+
}
|
|
66179
|
+
return { inString, owner, closes };
|
|
66180
|
+
}
|
|
66181
|
+
function literalAt(text2, shape, at, { braced = false } = {}) {
|
|
66182
|
+
let start = at;
|
|
66183
|
+
if (braced && text2[at] === "{" && shape.closes.has(at)) {
|
|
66184
|
+
const inner = text2.slice(at + 1, shape.closes.get(at));
|
|
66185
|
+
const match2 = inner.match(/^\s*(["'`])([^"'`\n\\$]*)\1\s*$/);
|
|
66186
|
+
if (!match2) return null;
|
|
66187
|
+
start = at + 1 + inner.indexOf(match2[1]);
|
|
66188
|
+
return { name: match2[2], index: start + 1 };
|
|
66189
|
+
}
|
|
66190
|
+
const match = text2.slice(start).match(/^(["'`])([^"'`\n\\$]*)\1/);
|
|
66191
|
+
return match ? { name: match[2], index: start + 1, end: start + match[0].length } : null;
|
|
66192
|
+
}
|
|
66193
|
+
function tagEnd(text2, shape, from) {
|
|
66194
|
+
const level = shape.owner[from];
|
|
66195
|
+
let index = from + 1;
|
|
66196
|
+
while (index < text2.length) {
|
|
66197
|
+
const char = text2[index];
|
|
66198
|
+
if (shape.inString[index]) {
|
|
66199
|
+
index += 1;
|
|
66200
|
+
continue;
|
|
66201
|
+
}
|
|
66202
|
+
if (char === ">") return index;
|
|
66203
|
+
if (char === "{") {
|
|
66204
|
+
if (!shape.closes.has(index)) return index;
|
|
66205
|
+
index = shape.closes.get(index) + 1;
|
|
66206
|
+
continue;
|
|
66207
|
+
}
|
|
66208
|
+
if (shape.owner[index] !== level || !TAG_TEXT.test(char)) return index;
|
|
66209
|
+
index += 1;
|
|
66210
|
+
}
|
|
66211
|
+
return text2.length;
|
|
66212
|
+
}
|
|
66213
|
+
function keyPosition(text2, shape, at) {
|
|
66214
|
+
let index = at - 1;
|
|
66215
|
+
while (index >= 0 && " \n\v\f\r".includes(text2[index])) index -= 1;
|
|
66216
|
+
return index >= 0 && !shape.inString[index] && (text2[index] === "{" || text2[index] === ",");
|
|
66217
|
+
}
|
|
66218
|
+
function iconCandidates(text2) {
|
|
66219
|
+
const { components, namespaces } = sdkBindings(text2);
|
|
66220
|
+
if (!components.size && !namespaces.size) return [];
|
|
66221
|
+
const shape = sourceShape(text2), found = [];
|
|
66222
|
+
for (const match of text2.matchAll(JSX_TAG)) {
|
|
66223
|
+
if (shape.inString[match.index]) continue;
|
|
66224
|
+
const [first, second] = match[1].split(".");
|
|
66225
|
+
const exported = second === void 0 ? components.get(first) : namespaces.has(first) ? second : void 0;
|
|
66226
|
+
if (!exported) continue;
|
|
66227
|
+
const wanted = exported === "Icon" ? "name" : "icon";
|
|
66228
|
+
const end = tagEnd(text2, shape, match.index);
|
|
66229
|
+
const level = shape.owner[match.index];
|
|
66230
|
+
JSX_ATTRIBUTE.lastIndex = match.index + match[0].length;
|
|
66231
|
+
let attribute;
|
|
66232
|
+
while ((attribute = JSX_ATTRIBUTE.exec(text2)) !== null && attribute.index < end) {
|
|
66233
|
+
if (attribute[1] !== wanted || shape.inString[attribute.index] || shape.owner[attribute.index] !== level) continue;
|
|
66234
|
+
const literal = literalAt(text2, shape, attribute.index + attribute[0].length, { braced: true });
|
|
66235
|
+
if (literal) found.push(literal);
|
|
66236
|
+
}
|
|
66237
|
+
}
|
|
66238
|
+
for (const match of text2.matchAll(ICON_FIELD)) {
|
|
66239
|
+
if (shape.inString[match.index] || !keyPosition(text2, shape, match.index)) continue;
|
|
66240
|
+
const literal = literalAt(text2, shape, match.index + match[0].length);
|
|
66241
|
+
if (!literal || !/^\s*[,}]/.test(text2.slice(literal.end))) continue;
|
|
66242
|
+
const object4 = shape.owner[match.index];
|
|
66243
|
+
if (object4 < 0 || !shape.closes.has(object4)) continue;
|
|
66244
|
+
const body = text2.slice(object4, shape.closes.get(object4) + 1);
|
|
66245
|
+
const labelled = [...body.matchAll(LABEL_KEY)].some((key2) => !shape.inString[object4 + key2.index] && shape.owner[object4 + key2.index] === object4 && keyPosition(text2, shape, object4 + key2.index));
|
|
66246
|
+
if (labelled) found.push(literal);
|
|
66247
|
+
}
|
|
66248
|
+
return found;
|
|
66249
|
+
}
|
|
66250
|
+
function loadIconCheck(icons, profile) {
|
|
66251
|
+
if (!icons || typeof icons !== "object" || !Array.isArray(icons.names) || icons.names.length === 0) return null;
|
|
66252
|
+
if (Array.isArray(icons.profiles) && !icons.profiles.includes(profile)) return null;
|
|
66253
|
+
const names = icons.names.filter((name) => typeof name === "string");
|
|
66254
|
+
return {
|
|
66255
|
+
id: typeof icons.id === "string" ? icons.id : "space-unknown-icon",
|
|
66256
|
+
message: typeof icons.message === "string" ? icons.message : 'Unknown icon "{name}". Closest names: {suggestions}.',
|
|
66257
|
+
suggestions: Number.isInteger(icons.suggestions) && icons.suggestions > 0 ? icons.suggestions : 3,
|
|
66258
|
+
exclude: Array.isArray(icons.exclude) ? icons.exclude : [],
|
|
66259
|
+
names,
|
|
66260
|
+
known: new Set(names)
|
|
66261
|
+
};
|
|
66262
|
+
}
|
|
66263
|
+
function editDistance2(a, b) {
|
|
66264
|
+
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
66265
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
66266
|
+
const current = [i];
|
|
66267
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
66268
|
+
current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
66269
|
+
}
|
|
66270
|
+
previous = current;
|
|
66271
|
+
}
|
|
66272
|
+
return previous[b.length];
|
|
66273
|
+
}
|
|
66274
|
+
function closestIconNames(name, names, count = 3) {
|
|
66275
|
+
const words = new Set(name.split("-"));
|
|
66276
|
+
return names.map((candidate) => ({
|
|
66277
|
+
candidate,
|
|
66278
|
+
shared: candidate.split("-").some((word) => words.has(word)) ? 0 : 1,
|
|
66279
|
+
distance: editDistance2(name, candidate)
|
|
66280
|
+
})).sort((left, right) => left.shared - right.shared || left.distance - right.distance || (left.candidate < right.candidate ? -1 : left.candidate > right.candidate ? 1 : 0)).slice(0, count).map((entry) => entry.candidate);
|
|
66281
|
+
}
|
|
66282
|
+
function iconViolations(normalized, content, checked, lines, config) {
|
|
66283
|
+
const icons = config.icons;
|
|
66284
|
+
if (!icons || matchesAny(normalized, icons.exclude)) return [];
|
|
66285
|
+
const found = /* @__PURE__ */ new Map(), suggestions = /* @__PURE__ */ new Map(), lineStarts = [0];
|
|
66286
|
+
for (let cursor = 0; cursor < content.length; cursor += 1) if (content.charCodeAt(cursor) === 10) lineStarts.push(cursor + 1);
|
|
66287
|
+
const lineAt = (index) => {
|
|
66288
|
+
let low = 0, high = lineStarts.length - 1;
|
|
66289
|
+
while (low < high) {
|
|
66290
|
+
const middle = low + high + 1 >> 1;
|
|
66291
|
+
if (lineStarts[middle] <= index) low = middle;
|
|
66292
|
+
else high = middle - 1;
|
|
66293
|
+
}
|
|
66294
|
+
return low + 1;
|
|
66295
|
+
};
|
|
66296
|
+
for (const { index, name } of iconCandidates(checked)) {
|
|
66297
|
+
if (!ICON_NAME_SHAPE.test(name) || icons.known.has(name)) continue;
|
|
66298
|
+
const line = lineAt(index);
|
|
66299
|
+
const key2 = `${line}:${name}`;
|
|
66300
|
+
if (!found.has(key2)) found.set(key2, { line, name });
|
|
66301
|
+
}
|
|
66302
|
+
return [...found.values()].sort((left, right) => left.line - right.line).map(({ line, name }) => {
|
|
66303
|
+
const message = icons.message.replace("{name}", name).replace("{suggestions}", suggestions.get(name) ?? suggestions.set(name, closestIconNames(name, icons.names, icons.suggestions).join(", ")).get(name));
|
|
66304
|
+
const reason = findAllowDirective(lines, line, icons.id, config.allowDirective);
|
|
66305
|
+
const allowed = reason !== null && reason.length >= config.allowReasonMinLength;
|
|
66306
|
+
return {
|
|
66307
|
+
file: normalized,
|
|
66308
|
+
line,
|
|
66309
|
+
ruleId: icons.id,
|
|
66310
|
+
severity: allowed ? "warn" : "error",
|
|
66311
|
+
message: reason !== null && !allowed ? `${message} (a notis-design-allow directive needs a reason of at least ${config.allowReasonMinLength} characters)` : message,
|
|
66312
|
+
allowed,
|
|
66313
|
+
reason: allowed ? reason : null
|
|
66314
|
+
};
|
|
66315
|
+
});
|
|
66316
|
+
}
|
|
66106
66317
|
function getCompiledDesignRules(profile = "app") {
|
|
66107
66318
|
if (!compiledDesignRules.has(profile)) {
|
|
66108
66319
|
compiledDesignRules.set(profile, loadDesignRules({ profile }));
|
|
@@ -66133,7 +66344,18 @@ function collectDesignViolationsForFile(relPath, content, config = getCompiledDe
|
|
|
66133
66344
|
if (!matchesAny(normalized, config.include)) return [];
|
|
66134
66345
|
if (matchesAny(normalized, config.exclude)) return [];
|
|
66135
66346
|
const extension = extname2(normalized);
|
|
66136
|
-
const unserialized = [".js", ".jsx", ".ts", ".tsx"].includes(extension) ?
|
|
66347
|
+
const unserialized = [".js", ".jsx", ".ts", ".tsx"].includes(extension) ? maskSerializedJsonDataOrNull(content, extension) : content;
|
|
66348
|
+
if (unserialized === null) {
|
|
66349
|
+
return [{
|
|
66350
|
+
file: normalized,
|
|
66351
|
+
line: 1,
|
|
66352
|
+
ruleId: "too-deep",
|
|
66353
|
+
severity: "info",
|
|
66354
|
+
allowed: false,
|
|
66355
|
+
reason: null,
|
|
66356
|
+
message: "nested too deep to check here; the server checks this file when you deploy"
|
|
66357
|
+
}];
|
|
66358
|
+
}
|
|
66137
66359
|
const checked = maskComments(unserialized, extension);
|
|
66138
66360
|
const lines = unserialized.split("\n");
|
|
66139
66361
|
const violations = [];
|
|
@@ -66170,6 +66392,7 @@ function collectDesignViolationsForFile(relPath, content, config = getCompiledDe
|
|
|
66170
66392
|
});
|
|
66171
66393
|
}
|
|
66172
66394
|
}
|
|
66395
|
+
if (extension !== ".css") violations.push(...iconViolations(normalized, content, checked, lines, config));
|
|
66173
66396
|
return violations;
|
|
66174
66397
|
}
|
|
66175
66398
|
function collectProjectDesignViolations(projectDir, config = getCompiledDesignRules()) {
|
|
@@ -68853,11 +69076,24 @@ function checkContextFields(value, where) {
|
|
|
68853
69076
|
throw usageError(`${where} now must be a date string, such as "2026-03-01T09:00:00Z".`);
|
|
68854
69077
|
}
|
|
68855
69078
|
}
|
|
68856
|
-
function fixtureContexts(fixtures) {
|
|
69079
|
+
function fixtureContexts(fixtures, declared = {}) {
|
|
68857
69080
|
if (fixtures.contexts === void 0) {
|
|
68858
69081
|
const value = fixtures.context || {};
|
|
68859
69082
|
checkContextFields(value, "The fixture context");
|
|
68860
|
-
return [{ name: "default", context: value }];
|
|
69083
|
+
if (value.views === void 0) return [{ name: "default", context: value }];
|
|
69084
|
+
if (!Array.isArray(value.views) || value.views.some((item) => !object(item))) {
|
|
69085
|
+
throw usageError('The fixture context views must be a list of view params, such as [{"period": "week"}].');
|
|
69086
|
+
}
|
|
69087
|
+
const { views, ...base } = value;
|
|
69088
|
+
const link = (params) => JSON.stringify(Object.entries(params || {}).filter(([name, item]) => !(object(declared[name]) && Object.hasOwn(declared[name], "default") && String(declared[name].default) === String(item))).map(([name, item]) => [name, String(item)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
69089
|
+
const seen = /* @__PURE__ */ new Set([link(base.params)]), extra = [];
|
|
69090
|
+
views.forEach((params, index) => {
|
|
69091
|
+
checkContextFields({ params }, `The fixture context view ${index + 1}`);
|
|
69092
|
+
if (seen.has(link(params)) || extra.length >= FIXTURE_CONTEXTS_MAX - 1) return;
|
|
69093
|
+
seen.add(link(params));
|
|
69094
|
+
extra.push({ name: `view-${index + 1}`, context: { ...base, params } });
|
|
69095
|
+
});
|
|
69096
|
+
return [{ name: "default", context: base }, ...extra];
|
|
68861
69097
|
}
|
|
68862
69098
|
if (fixtures.context !== void 0) throw usageError("Verification fixtures declare either context or contexts, not both. Move context into contexts as one named entry.");
|
|
68863
69099
|
const list = fixtures.contexts;
|
|
@@ -68930,7 +69166,7 @@ function createSpaceFixtureEngine(release) {
|
|
|
68930
69166
|
}
|
|
68931
69167
|
}
|
|
68932
69168
|
if (!object(fixtures) || Object.keys(fixtures).some((key2) => !["actions", "context", "contexts", "documentBodies", "viewerReads", "shown", "recordViews", "images"].includes(key2)) || !object(fixtures.actions) || fixtures.context !== void 0 && !object(fixtures.context)) throw usageError("Verification fixtures declare actions and optional synthetic context.");
|
|
68933
|
-
const contexts = fixtureContexts(fixtures);
|
|
69169
|
+
const contexts = fixtureContexts(fixtures, release.manifest.params || {});
|
|
68934
69170
|
const images = new Map(fixtureImageEntries(fixtures, release.fixturePath).map((entry) => {
|
|
68935
69171
|
const encoded = release.sourceFiles[entry.path];
|
|
68936
69172
|
if (typeof encoded !== "string") throw usageError(`Fixture image ${entry.path} for ${entry.url} is missing from the Space folder.`);
|
|
@@ -71475,6 +71711,75 @@ function refreshPulledSdk(projectDir) {
|
|
|
71475
71711
|
warnings: messages.filter((message) => warning.test(message)).map((message) => message.replace(warning, ""))
|
|
71476
71712
|
};
|
|
71477
71713
|
}
|
|
71714
|
+
function pageNumber(value, { flag, fallback, minimum, maximum }) {
|
|
71715
|
+
if (value === void 0) return fallback;
|
|
71716
|
+
const number = Number(value);
|
|
71717
|
+
if (!Number.isSafeInteger(number) || number < minimum || number > maximum) {
|
|
71718
|
+
throw usageError(`Pass ${flag} as a whole number from ${minimum} to ${maximum}.`);
|
|
71719
|
+
}
|
|
71720
|
+
return number;
|
|
71721
|
+
}
|
|
71722
|
+
var flatTitle = (title) => title.replace(/[\t\r\n]+/g, " ");
|
|
71723
|
+
async function listSpaceRecords(ctx) {
|
|
71724
|
+
const limit2 = pageNumber(ctx.options.limit, { flag: "--limit", fallback: 20, minimum: 1, maximum: 100 });
|
|
71725
|
+
const offset = pageNumber(ctx.options.offset, { flag: "--offset", fallback: 0, minimum: 0, maximum: 1e6 });
|
|
71726
|
+
const spaceId = ctx.args.spaceId, wanted = ctx.args.binding;
|
|
71727
|
+
const query = new URLSearchParams({ space_id: spaceId });
|
|
71728
|
+
const links = (await httpRequest({
|
|
71729
|
+
runtime: ctx.runtime,
|
|
71730
|
+
method: "GET",
|
|
71731
|
+
path: `/portal_spaces/space-links?${query}`,
|
|
71732
|
+
spacesProtocol: true
|
|
71733
|
+
})).payload?.links;
|
|
71734
|
+
const link = (Array.isArray(links) ? links : []).find((entry) => entry?.kind === "database" && (entry.binding_id === wanted || entry.alias === wanted));
|
|
71735
|
+
if (!link) {
|
|
71736
|
+
throw usageError(`This Space has no database link "${wanted}" you can open. List its links with notis spaces links list ${spaceId}.`);
|
|
71737
|
+
}
|
|
71738
|
+
const target = { space_id: spaceId, binding: link.binding_id, ...ctx.options.record ? { document_id: ctx.options.record } : {} };
|
|
71739
|
+
const sorts = [{ field: { column: "created_at" }, direction: "asc" }, { field: { column: "record_key" }, direction: "asc" }];
|
|
71740
|
+
let result;
|
|
71741
|
+
try {
|
|
71742
|
+
result = await httpRequest({
|
|
71743
|
+
runtime: ctx.runtime,
|
|
71744
|
+
method: "POST",
|
|
71745
|
+
path: "/portal_spaces/data",
|
|
71746
|
+
spacesProtocol: true,
|
|
71747
|
+
body: { operation: "query", target, input: { mode: "rows", sorts, page_size: limit2, offset, include_content: false } }
|
|
71748
|
+
});
|
|
71749
|
+
} catch (error) {
|
|
71750
|
+
if (error instanceof CliError && error.details?.error === "action_required") {
|
|
71751
|
+
throw new CliError({
|
|
71752
|
+
code: error.code,
|
|
71753
|
+
message: "Only an editor of this Space can list a linked database's records; anyone else reads them through the Space's declared actions.",
|
|
71754
|
+
exitCode: error.exitCode,
|
|
71755
|
+
details: error.details
|
|
71756
|
+
});
|
|
71757
|
+
}
|
|
71758
|
+
throw error;
|
|
71759
|
+
}
|
|
71760
|
+
const answer = result.payload || {};
|
|
71761
|
+
const records = (Array.isArray(answer.rows) ? answer.rows : []).map((row) => ({
|
|
71762
|
+
record_key: row.record_key,
|
|
71763
|
+
title: typeof row.title === "string" ? row.title : ""
|
|
71764
|
+
}));
|
|
71765
|
+
const data = {
|
|
71766
|
+
space_id: spaceId,
|
|
71767
|
+
alias: link.alias,
|
|
71768
|
+
target,
|
|
71769
|
+
records,
|
|
71770
|
+
has_more: Boolean(answer.has_more),
|
|
71771
|
+
next_offset: answer.next_offset ?? null,
|
|
71772
|
+
schema_revision: answer.schema_revision ?? null
|
|
71773
|
+
};
|
|
71774
|
+
const lines = records.map((record) => `${record.record_key} ${flatTitle(record.title)}`);
|
|
71775
|
+
if (data.has_more && data.next_offset !== null) lines.push(`More records: --offset ${data.next_offset}`);
|
|
71776
|
+
return ctx.output.emitSuccess({
|
|
71777
|
+
command: ctx.spec.command_path.join(" "),
|
|
71778
|
+
data,
|
|
71779
|
+
humanSummary: lines.length ? lines.join("\n") : "No records.",
|
|
71780
|
+
meta: { mutating: false, request_id: result.requestId }
|
|
71781
|
+
});
|
|
71782
|
+
}
|
|
71478
71783
|
var idArgument = { token: "<space-id>", key: "spaceId", description: "Exact existing Space ID." };
|
|
71479
71784
|
var recordOption = { flags: "--record <record-key>", description: "Fixed record context, when this is a record-scoped Space." };
|
|
71480
71785
|
var requestOption = { flags: "--request-id <key>", description: "Stable intent key. Reuse after timeouts or lost replies." };
|
|
@@ -71731,6 +72036,26 @@ var spacesCommandSpecs = [
|
|
|
71731
72036
|
return remote(ctx, "space-links", { method: "GET", query: { space_id: ctx.args.spaceId } });
|
|
71732
72037
|
}
|
|
71733
72038
|
},
|
|
72039
|
+
{
|
|
72040
|
+
command_path: ["spaces", "records"],
|
|
72041
|
+
summary: "List the records of one database linked into a Space you edit: record key and title, oldest first, one page at a time.",
|
|
72042
|
+
when_to_use: "Find the record keys and titles of a linked database, for example to write fixtures or link to one record. Editors only; anyone else reads through the Space's declared actions.",
|
|
72043
|
+
args_schema: { arguments: [idArgument, {
|
|
72044
|
+
token: "<binding>",
|
|
72045
|
+
key: "binding",
|
|
72046
|
+
description: "Database link alias or binding ID from spaces links list."
|
|
72047
|
+
}], options: [
|
|
72048
|
+
{ flags: "--limit <number>", description: "Records per page, 1 to 100; defaults to 20." },
|
|
72049
|
+
{ flags: "--offset <number>", description: "Zero-based start; pass next_offset from the previous page." },
|
|
72050
|
+
recordOption
|
|
72051
|
+
] },
|
|
72052
|
+
examples: ["notis spaces records <space-id> tasks --limit 20"],
|
|
72053
|
+
mutates: false,
|
|
72054
|
+
idempotent: true,
|
|
72055
|
+
require_auth: true,
|
|
72056
|
+
backend_call: { type: "http", path: "/portal_spaces/data" },
|
|
72057
|
+
handler: listSpaceRecords
|
|
72058
|
+
},
|
|
71734
72059
|
{
|
|
71735
72060
|
command_path: ["spaces", "links", "remove"],
|
|
71736
72061
|
summary: "Remove one database, Skill or automation link from a Space by its binding.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schema":1,"stamp":
|
|
1
|
+
{"schema":1,"stamp":1794969379,"commit":"73f9e76d42341e84ac32ae1a25ee7f2a8e51052e"}
|
|
@@ -90,6 +90,7 @@ user asked, and quote their words in `user_words`. The CLI equivalents are
|
|
|
90
90
|
| Build or change a Space | [View authoring](references/views.md), [Design](references/design.md), then [Delivery](references/release.md); list filters (`in` for several options): [Params and declared lists](references/views.md#params-and-declared-lists) |
|
|
91
91
|
| Verification fixtures, one view in several states (`contexts`) | [Fixtures](references/fixtures.md): one verify draws every state in English and French |
|
|
92
92
|
| Read a saved view, chart, report or HTML page | [Read and render](references/reading.md) |
|
|
93
|
+
| Check a view in a browser with `agent-browser` (open it, click, compare 390 and 1440 px) | The notis-browser-control skill (hosted guide: `notis://docs/notis-browser-control`): which runtime, the profile, the saved state |
|
|
93
94
|
| Save or revise a Notes report or interactive report | [Reports](references/reports.md) |
|
|
94
95
|
| Choose a memory policy | [Memory](references/memory.md) |
|
|
95
96
|
| Data hooks, record pages and the toolkit pieces | [SDK](references/sdk.md); rows and counts (`useNativeDocuments`, `useNativeCount`): [Records and declared reads](references/sdk.md#records-and-declared-reads) |
|
|
@@ -175,7 +176,9 @@ stops receiving that piece's fixes.
|
|
|
175
176
|
read ([Fixtures](references/fixtures.md)). Look at EN and FR at 390 and 1440 px; fix failed reads, clipping, wrong
|
|
176
177
|
data and state transitions before release.
|
|
177
178
|
5. Deploy within the user's authorization. Read back the exact published
|
|
178
|
-
revision, render its live view link and inspect the affected interaction
|
|
179
|
+
revision, render its live view link and inspect the affected interaction
|
|
180
|
+
(in a browser: the notis-browser-control skill, hosted guide
|
|
181
|
+
`notis://docs/notis-browser-control`).
|
|
179
182
|
A successful local build is not proof of deployment or live data.
|
|
180
183
|
6. Return the view-qualified link and distinguish local checks, publication to
|
|
181
184
|
the installed Space, and Store publication. Reconcile uncertain outcomes with
|
|
@@ -29,7 +29,9 @@ When a view reads a record view its fixtures lack, verify names the view, the re
|
|
|
29
29
|
the record key and the missing field, and prints a valid entry to copy.
|
|
30
30
|
`context` sets how verify opens the view: `params` (the opening view params,
|
|
31
31
|
a flat object of text, numbers or true/false), `now` (an ISO time that pins the clock, so a view showing
|
|
32
|
-
how old its data is can be checked with a later `now`)
|
|
32
|
+
how old its data is can be checked with a later `now`), `views` (other params,
|
|
33
|
+
each a state of its own with the same `now`, named `view-<place in the list>`;
|
|
34
|
+
verify checks the first 3 that open another link, the review deck draws all) and `skeletonParams`
|
|
33
35
|
(other params whose loading skeletons are measured too). Verify always draws
|
|
34
36
|
the view in English and in French, so `locale` no longer changes the
|
|
35
37
|
screenshots (still accepted). To check several states in one run, declare
|
|
@@ -41,7 +43,7 @@ and languages (`.notis/view-<key>.<name>-<width>-<locale>.png`), measures the
|
|
|
41
43
|
loading skeleton of each, and for one whose params open a list item (`open`)
|
|
42
44
|
also saves the reader while the item loads
|
|
43
45
|
(`.notis/pending-<key>.<name>.reader-<width>-<locale>.png`); with one context
|
|
44
|
-
the names leave out `.<name>`, and a `context` whose params open an item gets the
|
|
46
|
+
and no `views` the names leave out `.<name>`, and a `context` whose params open an item gets the
|
|
45
47
|
reader screenshot too. The `shown`, `actions` and other cases are shared by
|
|
46
48
|
every context.
|
|
47
49
|
A photo or cover shows in verify when `images` maps the exact URL a fixture
|
|
@@ -58,7 +58,9 @@ cite the returned current link, not the historical memory URL or index excerpt.
|
|
|
58
58
|
## Browser interaction when rendering is insufficient
|
|
59
59
|
|
|
60
60
|
Use an available isolated browser session for hover details, pagination, input
|
|
61
|
-
changes or installed-host behavior.
|
|
61
|
+
changes or installed-host behavior. Drive it as the notis-browser-control skill
|
|
62
|
+
says (hosted guide: `notis://docs/notis-browser-control`): which runtime, the
|
|
63
|
+
profile and the saved state. Reading does not authorize regenerating a
|
|
62
64
|
historical report, modifying data, enabling sharing or deploying source.
|
|
63
65
|
|
|
64
66
|
If sign-in is needed, discover `LOCAL_NOTIS_GET_PORTAL_URL`, inspect its schema
|
|
@@ -28,7 +28,9 @@ Ordinary data and resource edits apply immediately; only source needs a release.
|
|
|
28
28
|
action/list/body/record fixtures. A denied read, write-on-load or failed width
|
|
29
29
|
is a failure, not a passing empty page. Inspect both locales and intended states.
|
|
30
30
|
Missing browser tooling blocks release: install `agent-browser` and make it
|
|
31
|
-
available on PATH.
|
|
31
|
+
available on PATH. To drive it (check a live view, open a menu, compare
|
|
32
|
+
widths), follow the notis-browser-control skill (hosted guide:
|
|
33
|
+
`notis://docs/notis-browser-control`).
|
|
32
34
|
4. **Publish source.** Deploy the frozen, verified snapshot, not edits made after
|
|
33
35
|
verification: `spaces deploy <dir> --request-id <stable-id>`. Or `spaces preview` seals a candidate, and
|
|
34
36
|
`spaces promote <release-id> <dir>` publishes that exact candidate. Preview
|