skill-chef 0.1.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.
Files changed (81) hide show
  1. package/dist/cli/cmd_read.d.ts +3 -0
  2. package/dist/cli/cmd_read.d.ts.map +1 -0
  3. package/dist/cli/cmd_read.js +434 -0
  4. package/dist/cli/cmd_read.js.map +1 -0
  5. package/dist/fetch/db.d.ts +112 -0
  6. package/dist/fetch/db.d.ts.map +1 -0
  7. package/dist/fetch/db.js +463 -0
  8. package/dist/fetch/db.js.map +1 -0
  9. package/dist/fetch/errors.d.ts +13 -0
  10. package/dist/fetch/errors.d.ts.map +1 -0
  11. package/dist/fetch/errors.js +18 -0
  12. package/dist/fetch/errors.js.map +1 -0
  13. package/dist/fetch/index.d.ts +6 -0
  14. package/dist/fetch/index.d.ts.map +1 -0
  15. package/dist/fetch/index.js +4 -0
  16. package/dist/fetch/index.js.map +1 -0
  17. package/dist/fetch/paths.d.ts +6 -0
  18. package/dist/fetch/paths.d.ts.map +1 -0
  19. package/dist/fetch/paths.js +31 -0
  20. package/dist/fetch/paths.js.map +1 -0
  21. package/dist/help/index.d.ts +2 -0
  22. package/dist/help/index.d.ts.map +1 -0
  23. package/dist/help/index.js +2 -0
  24. package/dist/help/index.js.map +1 -0
  25. package/dist/help/lookup.d.ts +11 -0
  26. package/dist/help/lookup.d.ts.map +1 -0
  27. package/dist/help/lookup.js +49 -0
  28. package/dist/help/lookup.js.map +1 -0
  29. package/dist/index.d.ts +5 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +5 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/policy/category.d.ts +10 -0
  34. package/dist/policy/category.d.ts.map +1 -0
  35. package/dist/policy/category.js +45 -0
  36. package/dist/policy/category.js.map +1 -0
  37. package/dist/policy/index.d.ts +6 -0
  38. package/dist/policy/index.d.ts.map +1 -0
  39. package/dist/policy/index.js +4 -0
  40. package/dist/policy/index.js.map +1 -0
  41. package/dist/policy/recipe.d.ts +10 -0
  42. package/dist/policy/recipe.d.ts.map +1 -0
  43. package/dist/policy/recipe.js +52 -0
  44. package/dist/policy/recipe.js.map +1 -0
  45. package/dist/policy/wakewords.d.ts +14 -0
  46. package/dist/policy/wakewords.d.ts.map +1 -0
  47. package/dist/policy/wakewords.js +67 -0
  48. package/dist/policy/wakewords.js.map +1 -0
  49. package/dist/render/envelope.d.ts +6 -0
  50. package/dist/render/envelope.d.ts.map +1 -0
  51. package/dist/render/envelope.js +48 -0
  52. package/dist/render/envelope.js.map +1 -0
  53. package/dist/render/errors.d.ts +5 -0
  54. package/dist/render/errors.d.ts.map +1 -0
  55. package/dist/render/errors.js +9 -0
  56. package/dist/render/errors.js.map +1 -0
  57. package/dist/render/html.d.ts +13 -0
  58. package/dist/render/html.d.ts.map +1 -0
  59. package/dist/render/html.js +75 -0
  60. package/dist/render/html.js.map +1 -0
  61. package/dist/render/index.d.ts +8 -0
  62. package/dist/render/index.d.ts.map +1 -0
  63. package/dist/render/index.js +6 -0
  64. package/dist/render/index.js.map +1 -0
  65. package/dist/render/templates.d.ts +5 -0
  66. package/dist/render/templates.d.ts.map +1 -0
  67. package/dist/render/templates.js +42 -0
  68. package/dist/render/templates.js.map +1 -0
  69. package/dist/render/views.d.ts +85 -0
  70. package/dist/render/views.d.ts.map +1 -0
  71. package/dist/render/views.js +93 -0
  72. package/dist/render/views.js.map +1 -0
  73. package/package.json +32 -0
  74. package/templates/cooking_run.html +16 -0
  75. package/templates/help.html +16 -0
  76. package/templates/history_query.html +16 -0
  77. package/templates/history_record.html +16 -0
  78. package/templates/recipe_search.html +16 -0
  79. package/templates/recipe_view.html +16 -0
  80. package/templates/recipe_write.html +16 -0
  81. package/templates/shopping_query.html +16 -0
@@ -0,0 +1,5 @@
1
+ export declare const CHEF_TEMPLATES: readonly ["recipe_view", "recipe_search", "recipe_write", "cooking_run", "shopping_query", "history_record", "history_query", "help"];
2
+ export type ChefTemplate = (typeof CHEF_TEMPLATES)[number];
3
+ export declare function templateFor(key: string): ChefTemplate;
4
+ export declare function loadTemplate(name: string): string;
5
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/render/templates.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,uIASjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAG3D,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAYrD;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD"}
@@ -0,0 +1,42 @@
1
+ // 渲染层·模板装载:8 模板随包发布;未知/缺失大声失败。
2
+ import { readFileSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { ChefRenderError } from './errors.js';
6
+ export const CHEF_TEMPLATES = [
7
+ 'recipe_view',
8
+ 'recipe_search',
9
+ 'recipe_write',
10
+ 'cooking_run',
11
+ 'shopping_query',
12
+ 'history_record',
13
+ 'history_query',
14
+ 'help',
15
+ ];
16
+ // key → 模板(1 键 1 模板)。
17
+ export function templateFor(key) {
18
+ switch (key) {
19
+ case 'chef.recipe.view': return 'recipe_view';
20
+ case 'chef.recipe.search': return 'recipe_search';
21
+ case 'chef.recipe.write': return 'recipe_write';
22
+ case 'chef.cooking.run': return 'cooking_run';
23
+ case 'chef.shopping.query': return 'shopping_query';
24
+ case 'chef.history.record': return 'history_record';
25
+ case 'chef.history.query': return 'history_query';
26
+ case 'chef.help.lookup': return 'help';
27
+ default: throw new ChefRenderError('CHEF_UNKNOWN_KEY', '无模板映射:' + key);
28
+ }
29
+ }
30
+ const templatesDir = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'templates');
31
+ export function loadTemplate(name) {
32
+ if (!CHEF_TEMPLATES.includes(name)) {
33
+ throw new ChefRenderError('CHEF_TEMPLATE_MISSING', '未知模板:' + name);
34
+ }
35
+ try {
36
+ return readFileSync(join(templatesDir, name + '.html'), 'utf8');
37
+ }
38
+ catch (e) {
39
+ throw new ChefRenderError('CHEF_TEMPLATE_MISSING', '模板缺失:' + name);
40
+ }
41
+ }
42
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/render/templates.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa;IACb,eAAe;IACf,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,MAAM;CACE,CAAC;AAGX,sBAAsB;AACtB,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,kBAAkB,CAAC,CAAC,OAAO,aAAa,CAAC;QAC9C,KAAK,oBAAoB,CAAC,CAAC,OAAO,eAAe,CAAC;QAClD,KAAK,mBAAmB,CAAC,CAAC,OAAO,cAAc,CAAC;QAChD,KAAK,kBAAkB,CAAC,CAAC,OAAO,aAAa,CAAC;QAC9C,KAAK,qBAAqB,CAAC,CAAC,OAAO,gBAAgB,CAAC;QACpD,KAAK,qBAAqB,CAAC,CAAC,OAAO,gBAAgB,CAAC;QACpD,KAAK,oBAAoB,CAAC,CAAC,OAAO,eAAe,CAAC;QAClD,KAAK,kBAAkB,CAAC,CAAC,OAAO,MAAM,CAAC;QACvC,OAAO,CAAC,CAAC,MAAM,IAAI,eAAe,CAAC,kBAAkB,EAAE,QAAQ,GAAG,GAAG,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAE5F,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAoB,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,eAAe,CAAC,uBAAuB,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,CAAC;QAAC,OAAO,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;IAAC,CAAC;IACxE,OAAO,CAAC,EAAE,CAAC;QAAC,MAAM,IAAI,eAAe,CAAC,uBAAuB,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC;IAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,85 @@
1
+ import type { RecipeRow, IngredientRow, StepRow, HistoryRow, ShoppingItem } from '../fetch/db.js';
2
+ export interface RecipeItem {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ difficulty: string;
7
+ servings: number;
8
+ total_time_minutes: number;
9
+ status: string;
10
+ }
11
+ export declare function toRecipeItem(r: RecipeRow): RecipeItem;
12
+ export interface RecipeHistoryStats {
13
+ count: number;
14
+ avgRating: number | null;
15
+ }
16
+ export interface RecipeDetail {
17
+ recipe: RecipeRow;
18
+ ingredients: IngredientRow[];
19
+ steps: StepRow[];
20
+ history?: RecipeHistoryStats | null;
21
+ }
22
+ export declare function recipeDetail(detail: RecipeDetail): {
23
+ item: Record<string, unknown>;
24
+ };
25
+ export declare function buildRecipeSearch(kind: string, items: RecipeItem[]): {
26
+ items: RecipeItem[];
27
+ total: number;
28
+ kind: string;
29
+ };
30
+ export declare function buildRecipeReceipt(message: string): {
31
+ ok: boolean;
32
+ message: string;
33
+ };
34
+ export interface CookingStep extends Record<string, unknown> {
35
+ sequence: number;
36
+ action: string;
37
+ ingredients?: Record<string, unknown>[];
38
+ }
39
+ export declare function buildCookingRun(args: {
40
+ recipe: RecipeItem;
41
+ steps: CookingStep[];
42
+ servings?: number;
43
+ history?: RecipeHistoryStats | null;
44
+ }): {
45
+ items: CookingStep[];
46
+ total: number;
47
+ recipe: RecipeItem;
48
+ servingsNote: string;
49
+ historyHint: string;
50
+ steps: CookingStep[];
51
+ };
52
+ export declare function buildShopping(args: {
53
+ items: ShoppingItem[];
54
+ recipes: string[];
55
+ servings?: number;
56
+ excludeOptional?: boolean;
57
+ }): {
58
+ items: ShoppingItem[];
59
+ total: number;
60
+ recipes: string[];
61
+ servings?: number;
62
+ excludeOptional: boolean;
63
+ };
64
+ export declare function buildHistoryRecord(message: string): {
65
+ ok: boolean;
66
+ message: string;
67
+ };
68
+ export declare function buildHistoryQuery(kind: string, items: Record<string, unknown>[]): {
69
+ items: Record<string, unknown>[];
70
+ total: number;
71
+ kind: string;
72
+ };
73
+ export declare function toHistoryItem(h: HistoryRow, recipeName?: string): Record<string, unknown>;
74
+ export interface HelpItem {
75
+ phrase: string;
76
+ key: string;
77
+ shape: string;
78
+ cli: string;
79
+ desc: string;
80
+ }
81
+ export declare function buildHelpItems(all: HelpItem[], q?: string): {
82
+ items: HelpItem[];
83
+ total: number;
84
+ };
85
+ //# sourceMappingURL=views.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/render/views.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAElG,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;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AAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;CAAE;AAEpG,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAkBhG"}
@@ -0,0 +1,93 @@
1
+ export function toRecipeItem(r) {
2
+ return {
3
+ id: r.id, name: r.name, description: r.description, difficulty: r.difficulty,
4
+ servings: r.servings, total_time_minutes: r.total_time_minutes, status: r.status,
5
+ };
6
+ }
7
+ // 单菜全貌 detail:基本 + 食材 + 步骤 + 历史统计 + 营养占位(一期只占位,不编数字)。
8
+ export function recipeDetail(detail) {
9
+ const ingredients = [...detail.ingredients].sort((a, b) => a.sequence - b.sequence).map((g) => ({ ...g }));
10
+ const steps = [...detail.steps].sort((a, b) => a.sequence - b.sequence).map((s) => ({ ...s }));
11
+ return {
12
+ item: {
13
+ ...toRecipeItem(detail.recipe),
14
+ photo_url: detail.recipe.photo_url,
15
+ source: detail.recipe.source,
16
+ source_url: detail.recipe.source_url,
17
+ created_at: detail.recipe.created_at,
18
+ updated_at: detail.recipe.updated_at,
19
+ ingredients,
20
+ steps,
21
+ history: detail.history ?? { count: 0, avgRating: null },
22
+ // 营养占位:一期不估算,显式标记未估算,不编数字冒充。
23
+ nutrition: { estimated: false, note: '营养估算一期占位(以实际食材称量为准)' },
24
+ },
25
+ };
26
+ }
27
+ // 搜菜/筛菜/全部:items + total + kind。
28
+ export function buildRecipeSearch(kind, items) {
29
+ return { items, total: items.length, kind };
30
+ }
31
+ // 写菜回执 receipt。
32
+ export function buildRecipeReceipt(message) {
33
+ return { ok: true, message };
34
+ }
35
+ // 开做 list:items 为步骤(内联食材)+ total;recipe/份数放大说明/历史提示作扩展字段(list 形只校验 items/total)。
36
+ export function buildCookingRun(args) {
37
+ const base = args.recipe.servings > 0 ? args.recipe.servings : 2;
38
+ const servings = args.servings ?? base;
39
+ const factor = Math.round((servings / base) * 100) / 100;
40
+ const servingsNote = servings === base
41
+ ? '按原份量 ' + base + ' 人份备料'
42
+ : '已按 ' + servings + ' 人份放大(原 ' + base + ' 人份,倍率 ' + factor + ',食材用量同倍)';
43
+ const h = args.history;
44
+ const historyHint = h && h.count > 0
45
+ ? '做过 ' + h.count + ' 次' + (h.avgRating !== null && h.avgRating !== undefined ? ',平均评分 ' + h.avgRating : '') + ';本次做完请走 chef.history.record 记录'
46
+ : '还没做过;本次做完请走 chef.history.record 记录';
47
+ return { items: args.steps, total: args.steps.length, recipe: args.recipe, servingsNote, historyHint, steps: args.steps };
48
+ }
49
+ // 采购行复用 fetch ShoppingItem(跨菜合并行:name/quantity/unit/recipes),不另建影子类型。
50
+ // 跨菜合并采购 list:items(fetch 合并行 name/quantity/unit/recipes)+ total + recipes(+servings/excludeOptional 回显)。
51
+ export function buildShopping(args) {
52
+ const out = { items: args.items, total: args.items.length, recipes: args.recipes, excludeOptional: args.excludeOptional === true };
53
+ if (args.servings !== undefined)
54
+ out.servings = args.servings;
55
+ return out;
56
+ }
57
+ // 记做菜回执 receipt。
58
+ export function buildHistoryRecord(message) {
59
+ return { ok: true, message };
60
+ }
61
+ // 查历史统一 list:timeline/stats/quality/backup 全作条目(单 key 单 shape=list)。
62
+ export function buildHistoryQuery(kind, items) {
63
+ return { items, total: items.length, kind };
64
+ }
65
+ export function toHistoryItem(h, recipeName) {
66
+ const out = { ...h };
67
+ if (recipeName !== undefined)
68
+ out.recipe_name = recipeName;
69
+ return out;
70
+ }
71
+ export function buildHelpItems(all, q) {
72
+ if (!q || !q.trim())
73
+ return { items: all, total: all.length };
74
+ const query = q;
75
+ const exact = all.filter((h) => query.includes(h.phrase) || h.phrase.includes(query.trim()));
76
+ if (exact.length)
77
+ return { items: exact, total: exact.length };
78
+ if (['搜', '找', '查', '寻'].some((c) => query.includes(c))) {
79
+ const rs = all.filter((h) => h.key.includes('recipe.search'));
80
+ if (rs.length)
81
+ return { items: rs, total: rs.length };
82
+ }
83
+ if (['做菜', '做饭', '下厨'].some((c) => query.includes(c))) {
84
+ const rs = all.filter((h) => h.key.includes('cooking.run'));
85
+ return { items: rs, total: rs.length };
86
+ }
87
+ if (['清单', '买菜'].some((c) => query.includes(c))) {
88
+ const rs = all.filter((h) => h.key.includes('shopping.query'));
89
+ return { items: rs, total: rs.length };
90
+ }
91
+ return { items: [], total: 0 };
92
+ }
93
+ //# sourceMappingURL=views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.js","sourceRoot":"","sources":["../../src/render/views.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,YAAY,CAAC,CAAY;IACvC,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU;QAC5E,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,kBAAkB,EAAE,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM;KACjF,CAAC;AACJ,CAAC;AAYD,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,MAAM,WAAW,GAAG,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3G,MAAM,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GA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0,0 +1,32 @@
1
+ {
2
+ "name": "skill-chef",
3
+ "version": "0.1.0",
4
+ "description": "私家大厨SKILL一期:取数+口径+渲染+出口(8 联动 key+cmd_read+SKILL+HELP+parity),依 link-core",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./fetch": "./dist/fetch/index.js",
11
+ "./policy": "./dist/policy/index.js",
12
+ "./render": "./dist/render/index.js",
13
+ "./cli": "./dist/cli/cmd_read.js"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "templates/*.html"
18
+ ],
19
+ "bin": {
20
+ "chef-cmd-read": "./dist/cli/cmd_read.js"
21
+ },
22
+ "dependencies": {
23
+ "base-link-core": "workspace:^0.1.0"
24
+ },
25
+ "engines": {
26
+ "node": ">=22.13"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc -b && node scripts/build-help.mjs",
30
+ "test": "node --test test/*.test.mjs"
31
+ }
32
+ }
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>开始做菜</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>开始做菜</h1>
11
+ <p class="cmd">chef-cmd-read chef.cooking.run</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>现找</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>现找</h1>
11
+ <p class="cmd">chef-cmd-read chef.help.lookup</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>做菜历史</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>做菜历史</h1>
11
+ <p class="cmd">chef-cmd-read chef.history.query</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>记录做菜</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>记录做菜</h1>
11
+ <p class="cmd">chef-cmd-read chef.history.record</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>搜菜</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>搜菜</h1>
11
+ <p class="cmd">chef-cmd-read chef.recipe.search</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>查看菜谱</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>查看菜谱</h1>
11
+ <p class="cmd">chef-cmd-read chef.recipe.view</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>加菜</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>加菜</h1>
11
+ <p class="cmd">chef-cmd-read chef.recipe.write</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>买菜清单</title>
6
+ <!--SHARED-CSS-->
7
+ </head>
8
+ <body>
9
+ <div class="page">
10
+ <h1>买菜清单</h1>
11
+ <p class="cmd">chef-cmd-read chef.shopping.query</p>
12
+ <!--CONTENT-->
13
+ </div>
14
+ <!--SHARED-HELPERS-->
15
+ </body>
16
+ </html>