@askewly/design 0.6.4 → 0.7.0
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 +36 -34
- package/data/askewly.css +56 -56
- package/data/assets.json +1 -1
- package/data/knowledge.json +1 -1
- package/data/recipes.json +1 -1
- package/dist/data.js +25 -6
- package/dist/index.js +75 -33
- package/dist/local.js +36 -0
- package/dist/mascot.js +25 -25
- package/package.json +50 -50
package/dist/data.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
// M110 앞단 — 레포 자산 조회
|
|
1
|
+
// M110 앞단 — 레포 자산 조회 통합. 정식 이름 `find`, `data recall` 은 영구 별칭(cs724).
|
|
2
2
|
// design-intake.md §5단계와 askewly-design SKILL §2.7 이 약속해 온 `askewly data recall`
|
|
3
3
|
// 이 유령 명령이었다(이 기기 어디에도 `data` 커맨드가 없었다) — 그 약속을 실재하게 만든다.
|
|
4
4
|
//
|
|
5
5
|
// 번들된 두 축(terms · recipes) + knowledge 축을 한 번에 훑는다. methodology/ 는
|
|
6
6
|
// build-data.mjs 가 애초에 번들하지 않으므로(knowledge/*.md 만 읽는다) 여기서도 다루지
|
|
7
7
|
// 않는다 — 새 데이터 로더를 만들지 않고 기존 load.ts 만 재사용한다는 이 step 의 원칙.
|
|
8
|
-
//
|
|
9
|
-
// 로 보완한다(design-intake.md 가 그 경계를 함께 적는다).
|
|
8
|
+
// 여러 축을 넓게 찾는 일은 `askda recall` 소관이다(design-intake.md 가 그 경계를 함께 적는다).
|
|
10
9
|
import { loadKnowledge, loadRecipes, loadTerms, searchKnowledge, searchTerms, } from "./load.js";
|
|
11
|
-
|
|
10
|
+
import { assetUrl, loadAssets, searchAssets } from "./assets.js";
|
|
11
|
+
export const RECALL_AXES = ["terms", "recipes", "assets", "knowledge"];
|
|
12
12
|
function summarize(text, max = 120) {
|
|
13
13
|
if (!text)
|
|
14
14
|
return "";
|
|
@@ -46,6 +46,7 @@ function termHit(term) {
|
|
|
46
46
|
id: term.id,
|
|
47
47
|
path: `docs/ui-vocabulary/terms.yml#${term.id}`,
|
|
48
48
|
summary: summarize(term.one_liner ?? term.en?.name ?? term.id),
|
|
49
|
+
next: `terms show ${term.id}`,
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
function recipeHit(recipe) {
|
|
@@ -54,35 +55,53 @@ function recipeHit(recipe) {
|
|
|
54
55
|
id: recipe.id,
|
|
55
56
|
path: recipe.source_path,
|
|
56
57
|
summary: summarize(`${recipe.name ? `${recipe.name} (${recipe.pattern_group ?? "-"})` : recipe.id}${recipe.status ? ` [${recipe.status}]` : ""}`),
|
|
58
|
+
next: `recipes show ${recipe.id}`,
|
|
57
59
|
status: recipe.status,
|
|
58
60
|
};
|
|
59
61
|
}
|
|
62
|
+
function assetHit(asset) {
|
|
63
|
+
return {
|
|
64
|
+
axis: "assets",
|
|
65
|
+
id: asset.id,
|
|
66
|
+
path: assetUrl(asset),
|
|
67
|
+
summary: summarize(`${asset.definition} [${asset.install ? "installable" : "recipe only"}]`),
|
|
68
|
+
next: `assets show ${asset.id}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
60
71
|
function knowledgeHit(doc) {
|
|
61
72
|
return {
|
|
62
73
|
axis: "knowledge",
|
|
63
74
|
id: doc.id,
|
|
64
75
|
path: doc.source_path,
|
|
65
76
|
summary: summarize(doc.description),
|
|
77
|
+
next: `knowledge show ${doc.id}`,
|
|
66
78
|
};
|
|
67
79
|
}
|
|
68
80
|
/**
|
|
69
|
-
* Search terms + recipes + knowledge in one pass and return path + one-line
|
|
81
|
+
* Search terms + recipes + assets + knowledge in one pass and return path + one-line
|
|
70
82
|
* summary per hit. This is an index, not the source text — the caller must
|
|
71
83
|
* still open `path` and read the body before judging.
|
|
72
84
|
*/
|
|
73
85
|
export function recall(query, limit) {
|
|
74
86
|
const terms = searchTerms(loadTerms(), query).map(termHit);
|
|
75
87
|
const recipes = searchRecipes(loadRecipes(), query).map(recipeHit);
|
|
88
|
+
// Most assets share an id with a recipe; keep one row so duplicates don't eat the --limit window.
|
|
89
|
+
const recipeIds = new Set(recipes.map((hit) => hit.id));
|
|
90
|
+
const assets = searchAssets(loadAssets(), query)
|
|
91
|
+
.filter((asset) => !recipeIds.has(asset.id))
|
|
92
|
+
.map(assetHit);
|
|
76
93
|
const knowledge = searchKnowledge(loadKnowledge(), query).map(knowledgeHit);
|
|
77
94
|
// Interleave by axis (round-robin) so a query that happens to match many
|
|
78
95
|
// terms doesn't crowd recipes/knowledge out of a small --limit window.
|
|
79
96
|
const merged = [];
|
|
80
|
-
const maxLen = Math.max(terms.length, recipes.length, knowledge.length);
|
|
97
|
+
const maxLen = Math.max(terms.length, recipes.length, assets.length, knowledge.length);
|
|
81
98
|
for (let i = 0; i < maxLen; i++) {
|
|
82
99
|
if (terms[i])
|
|
83
100
|
merged.push(terms[i]);
|
|
84
101
|
if (recipes[i])
|
|
85
102
|
merged.push(recipes[i]);
|
|
103
|
+
if (assets[i])
|
|
104
|
+
merged.push(assets[i]);
|
|
86
105
|
if (knowledge[i])
|
|
87
106
|
merged.push(knowledge[i]);
|
|
88
107
|
}
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,13 @@ import { loadKnowledge, loadRecipes, loadTerms, loadTokens, loadTokensCss, searc
|
|
|
11
11
|
import { recall, RECALL_AXES } from "./data.js";
|
|
12
12
|
import { assetUrl, buildPrompt, loadAssets, searchAssets, suggestAssets } from "./assets.js";
|
|
13
13
|
import { getSite, listSites, siteNextStep, SiteError } from "./site.js";
|
|
14
|
+
import { localRepo, LocalToolError, siteFind, siteResolve } from "./local.js";
|
|
14
15
|
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
16
|
+
// Set only by the local `askde` shim; npm and npx users never see the repo-only commands.
|
|
17
|
+
const repo = localRepo();
|
|
15
18
|
const program = new Command();
|
|
16
19
|
program
|
|
17
|
-
.name("askewly-design")
|
|
20
|
+
.name(repo ? "askde" : "askewly-design")
|
|
18
21
|
.description("Query the Askewly Design system: UI vocabulary terms, design tokens, and component recipes.")
|
|
19
22
|
.version(pkg.version);
|
|
20
23
|
function fail(message) {
|
|
@@ -388,37 +391,40 @@ program
|
|
|
388
391
|
const color = options.color && Boolean(process.stdout.isTTY);
|
|
389
392
|
console.log(renderMascot(pose, { color }));
|
|
390
393
|
});
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
}
|
|
394
|
+
function addFindCommand(parent, name) {
|
|
395
|
+
parent
|
|
396
|
+
.command(name)
|
|
397
|
+
.argument("<query>", "text to match across terms / recipes / assets / knowledge")
|
|
398
|
+
.option("--limit <n>", "max results", "5")
|
|
399
|
+
.option("--json", "machine-readable output")
|
|
400
|
+
.description("search terms + recipes + assets + knowledge in one pass — an index of paths, not the source text")
|
|
401
|
+
.action((query, options) => {
|
|
402
|
+
const limit = Number(options.limit) || 5;
|
|
403
|
+
const hits = recall(query, limit);
|
|
404
|
+
if (options.json) {
|
|
405
|
+
console.log(JSON.stringify({
|
|
406
|
+
note: "index only — read `path` before judging",
|
|
407
|
+
axes: RECALL_AXES,
|
|
408
|
+
query,
|
|
409
|
+
hits,
|
|
410
|
+
}, null, 2));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
console.log("색인이지 본문이 아니다 — 후보 경로를 받은 뒤 판단은 본문을 읽고 한다.");
|
|
414
|
+
if (hits.length === 0) {
|
|
415
|
+
console.log(`no matches for "${query}" across axes: ${RECALL_AXES.join(", ")} (methodology/ is not bundled here)`);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
for (const hit of hits) {
|
|
419
|
+
console.log(`[${hit.axis}] ${hit.id} — ${hit.path}`);
|
|
420
|
+
console.log(` ${hit.summary}`);
|
|
421
|
+
console.log(` next: ${hit.next}`);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
addFindCommand(program, "find");
|
|
426
|
+
// Permanent alias: 0.5.1+ users and published docs call `data recall`.
|
|
427
|
+
addFindCommand(program.command("data").description("alias of `find`, kept for existing callers"), "recall");
|
|
422
428
|
// step-11 (M141): 자산별 md(공개 URL https://ui.askewly.com/llms/assets/<id>.md) 를 번들에서 오프라인으로 읽는다.
|
|
423
429
|
const assetsCmd = program.command("assets").description("registry + recipe assets (one md per asset: definition, usage rules, install command)");
|
|
424
430
|
assetsCmd
|
|
@@ -497,7 +503,7 @@ siteCmd
|
|
|
497
503
|
try {
|
|
498
504
|
const target = dir ?? slug;
|
|
499
505
|
const n = await getSite(slug, target);
|
|
500
|
-
console.log(`${n} files -> ${target}
|
|
506
|
+
console.log(`${n} files -> ${target}
|
|
501
507
|
${siteNextStep(target)}`);
|
|
502
508
|
}
|
|
503
509
|
catch (error) {
|
|
@@ -506,4 +512,40 @@ ${siteNextStep(target)}`);
|
|
|
506
512
|
throw error;
|
|
507
513
|
}
|
|
508
514
|
});
|
|
515
|
+
if (repo) {
|
|
516
|
+
siteCmd
|
|
517
|
+
.command("find")
|
|
518
|
+
.argument("<query>", "element or site, e.g. menu")
|
|
519
|
+
.option("--limit <n>", "max results", "5")
|
|
520
|
+
.description("local: search approved recreated-site modules in this repo")
|
|
521
|
+
.action((query, options) => {
|
|
522
|
+
const limit = Number(options.limit);
|
|
523
|
+
if (!Number.isInteger(limit) || limit < 1)
|
|
524
|
+
fail("--limit must be a positive integer");
|
|
525
|
+
try {
|
|
526
|
+
process.exitCode = siteFind(repo, query, limit);
|
|
527
|
+
}
|
|
528
|
+
catch (error) {
|
|
529
|
+
if (error instanceof LocalToolError)
|
|
530
|
+
fail(error.message);
|
|
531
|
+
throw error;
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
siteCmd
|
|
535
|
+
.command("resolve")
|
|
536
|
+
.argument("<reference>", "copied site pointer or URL")
|
|
537
|
+
.option("--file <path>", "save this manifest file under tmp/site-references after verifying its hash")
|
|
538
|
+
.option("--local", "read the same revision from the local snapshot")
|
|
539
|
+
.description("local: verify a copied site pointer and optionally fetch one pinned source file")
|
|
540
|
+
.action((reference, options) => {
|
|
541
|
+
try {
|
|
542
|
+
process.exitCode = siteResolve(repo, reference, options);
|
|
543
|
+
}
|
|
544
|
+
catch (error) {
|
|
545
|
+
if (error instanceof LocalToolError)
|
|
546
|
+
fail(error.message);
|
|
547
|
+
throw error;
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
509
551
|
await program.parseAsync();
|
package/dist/local.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Repo-only commands for the local `askde` shim (cs724). They run the existing scripts, so the
|
|
2
|
+
// repo keeps one source of truth, and they never appear for npm users.
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
export class LocalToolError extends Error {
|
|
7
|
+
}
|
|
8
|
+
export function localRepo() {
|
|
9
|
+
return process.env.ASKDE_REPO?.trim() || null;
|
|
10
|
+
}
|
|
11
|
+
function runRepoTool(repo, command, script, args) {
|
|
12
|
+
const file = path.join(repo, script);
|
|
13
|
+
if (!existsSync(file))
|
|
14
|
+
throw new LocalToolError(`${script} not found under ASKDE_REPO=${repo}`);
|
|
15
|
+
const result = spawnSync(command, [file, ...args], {
|
|
16
|
+
cwd: repo,
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
env: { ...process.env, PYTHONUTF8: "1" },
|
|
19
|
+
});
|
|
20
|
+
if (result.error)
|
|
21
|
+
throw new LocalToolError(`could not run ${command}: ${result.error.message}`);
|
|
22
|
+
return result.status ?? 1;
|
|
23
|
+
}
|
|
24
|
+
export function siteFind(repo, query, limit) {
|
|
25
|
+
const python = process.platform === "win32" ? "python" : "python3";
|
|
26
|
+
// `--` keeps a query like "--approve" from reaching catalog.py's write options.
|
|
27
|
+
return runRepoTool(repo, python, "scripts/recreate/catalog.py", ["--limit", String(limit), "--", query]);
|
|
28
|
+
}
|
|
29
|
+
export function siteResolve(repo, reference, options) {
|
|
30
|
+
const args = [reference];
|
|
31
|
+
if (options.local)
|
|
32
|
+
args.push("--local");
|
|
33
|
+
if (options.file)
|
|
34
|
+
args.push("--file", options.file);
|
|
35
|
+
return runRepoTool(repo, process.execPath, "scripts/recreate/resolve-site-reference.mjs", args);
|
|
36
|
+
}
|
package/dist/mascot.js
CHANGED
|
@@ -4,34 +4,34 @@
|
|
|
4
4
|
// 사용 규칙(정본 §3): 라벤더 #B298DC 단색 고정 · 등폭 전제 · 기계 소비 출력 금지.
|
|
5
5
|
export const MASCOT_POSES = ["lying", "standing", "sleepy", "mini"];
|
|
6
6
|
const ART = {
|
|
7
|
-
lying: ` ▄██▄ ▄██▄
|
|
8
|
-
█ ██ █ ██
|
|
9
|
-
▄██████████████████▄
|
|
10
|
-
█▄ █████████████████████
|
|
11
|
-
▀█▄ ████ ████ █████████
|
|
12
|
-
▀██▄████ ████ █████████
|
|
13
|
-
▀███████████████████▀
|
|
7
|
+
lying: ` ▄██▄ ▄██▄
|
|
8
|
+
█ ██ █ ██
|
|
9
|
+
▄██████████████████▄
|
|
10
|
+
█▄ █████████████████████
|
|
11
|
+
▀█▄ ████ ████ █████████
|
|
12
|
+
▀██▄████ ████ █████████
|
|
13
|
+
▀███████████████████▀
|
|
14
14
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀`,
|
|
15
|
-
standing: ` ▄██▄ ▄██▄
|
|
16
|
-
█ ██ █ ██
|
|
17
|
-
▄██████████████▄
|
|
18
|
-
███ ████ █████
|
|
19
|
-
███ ████ █████
|
|
20
|
-
████████████████
|
|
21
|
-
████████████████
|
|
22
|
-
▀████▀▀▀████▀▀██
|
|
15
|
+
standing: ` ▄██▄ ▄██▄
|
|
16
|
+
█ ██ █ ██
|
|
17
|
+
▄██████████████▄
|
|
18
|
+
███ ████ █████
|
|
19
|
+
███ ████ █████
|
|
20
|
+
████████████████
|
|
21
|
+
████████████████
|
|
22
|
+
▀████▀▀▀████▀▀██
|
|
23
23
|
████ ████ ▀███▄▄▄`,
|
|
24
|
-
sleepy: ` ▄██▄ ▄██▄
|
|
25
|
-
█ ██ █ ██
|
|
26
|
-
▄██████████████████▄
|
|
27
|
-
█▄ █████████████████████
|
|
28
|
-
▀█▄ █████████████████████
|
|
29
|
-
▀██▄███ ██ ████████
|
|
30
|
-
▀███████████████████▀
|
|
24
|
+
sleepy: ` ▄██▄ ▄██▄
|
|
25
|
+
█ ██ █ ██
|
|
26
|
+
▄██████████████████▄
|
|
27
|
+
█▄ █████████████████████
|
|
28
|
+
▀█▄ █████████████████████
|
|
29
|
+
▀██▄███ ██ ████████
|
|
30
|
+
▀███████████████████▀
|
|
31
31
|
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀`,
|
|
32
|
-
mini: ` ▄██▄▄▄▄██▄
|
|
33
|
-
██████████
|
|
34
|
-
██ ██ ██
|
|
32
|
+
mini: ` ▄██▄▄▄▄██▄
|
|
33
|
+
██████████
|
|
34
|
+
██ ██ ██
|
|
35
35
|
▀████████▀`,
|
|
36
36
|
};
|
|
37
37
|
/** askewly.lavender #B298DC — ANSI 24-bit. */
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@askewly/design",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Query, inject, and verify the Askewly Design system (tokens, UI vocabulary, recipes) from your terminal or coding agent.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"homepage": "https://ui.askewly.com",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/lumatic2/ui-dictionary.git",
|
|
10
|
-
"directory": "packages/cli"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"design-system",
|
|
14
|
-
"design-tokens",
|
|
15
|
-
"linter",
|
|
16
|
-
"ui",
|
|
17
|
-
"coding-agent"
|
|
18
|
-
],
|
|
19
|
-
"type": "module",
|
|
20
|
-
"bin": {
|
|
21
|
-
"askewly-design": "./dist/index.js"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist",
|
|
25
|
-
"data",
|
|
26
|
-
"README.md",
|
|
27
|
-
"LICENSE"
|
|
28
|
-
],
|
|
29
|
-
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
31
|
-
},
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=18"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build:data": "node scripts/build-data.mjs",
|
|
37
|
-
"build": "npm run build:data && tsc",
|
|
38
|
-
"test": "vitest run",
|
|
39
|
-
"prepack": "npm run build"
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"commander": "^13.1.0"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/node": "^22.10.0",
|
|
46
|
-
"typescript": "^5.7.0",
|
|
47
|
-
"vitest": "^3.0.0",
|
|
48
|
-
"yaml": "^2.6.0"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@askewly/design",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Query, inject, and verify the Askewly Design system (tokens, UI vocabulary, recipes) from your terminal or coding agent.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://ui.askewly.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/lumatic2/ui-dictionary.git",
|
|
10
|
+
"directory": "packages/cli"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"design-system",
|
|
14
|
+
"design-tokens",
|
|
15
|
+
"linter",
|
|
16
|
+
"ui",
|
|
17
|
+
"coding-agent"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"bin": {
|
|
21
|
+
"askewly-design": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"data",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build:data": "node scripts/build-data.mjs",
|
|
37
|
+
"build": "npm run build:data && tsc",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"prepack": "npm run build"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"commander": "^13.1.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^22.10.0",
|
|
46
|
+
"typescript": "^5.7.0",
|
|
47
|
+
"vitest": "^3.0.0",
|
|
48
|
+
"yaml": "^2.6.0"
|
|
49
|
+
}
|
|
50
|
+
}
|