td-ai-tools 1.2.0 → 1.2.2

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 (34) hide show
  1. package/package.json +1 -1
  2. package/skills/README.md +3 -0
  3. package/skills/client-overview/SKILL.md +93 -0
  4. package/skills/client-overview/agents/openai.yaml +4 -0
  5. package/skills/client-overview/scripts/branch_client_overview_context.py +317 -0
  6. package/skills/debugging-ios-webkit/SKILL.md +60 -0
  7. package/skills/debugging-ios-webkit/references/device.md +62 -0
  8. package/skills/debugging-ios-webkit/references/playwright.md +60 -0
  9. package/skills/debugging-ios-webkit/references/simulator.md +76 -0
  10. package/skills/debugging-ios-webkit/scripts/device_eval.py +62 -0
  11. package/skills/debugging-ios-webkit/scripts/device_experiment.py +99 -0
  12. package/skills/debugging-ios-webkit/scripts/device_snapshot.py +62 -0
  13. package/skills/record-changes/SKILL.md +3 -3
  14. package/skills/shopify-lint/SKILL.md +50 -0
  15. package/skills/shopify-lint/agents/openai.yaml +4 -0
  16. package/skills/shopify-lint/scripts/setup.sh +60 -0
  17. package/skills/shopify-lint/scripts/shopify_lint.py +259 -0
  18. package/skills/shopify-lint/tests/test_shopify_lint.py +137 -0
  19. package/skills/shopify-lint/theme-check-theory/.theme-check.example.yml +14 -0
  20. package/skills/shopify-lint/theme-check-theory/README.md +123 -0
  21. package/skills/shopify-lint/theme-check-theory/configs/recommended.yml +8 -0
  22. package/skills/shopify-lint/theme-check-theory/package-lock.json +1947 -0
  23. package/skills/shopify-lint/theme-check-theory/package.json +44 -0
  24. package/skills/shopify-lint/theme-check-theory/src/checks/unguarded-text-setting.test.ts +198 -0
  25. package/skills/shopify-lint/theme-check-theory/src/checks/unguarded-text-setting.ts +143 -0
  26. package/skills/shopify-lint/theme-check-theory/src/checks/unused-section-settings.test.ts +137 -0
  27. package/skills/shopify-lint/theme-check-theory/src/checks/unused-section-settings.ts +64 -0
  28. package/skills/shopify-lint/theme-check-theory/src/index.test.ts +20 -0
  29. package/skills/shopify-lint/theme-check-theory/src/index.ts +11 -0
  30. package/skills/shopify-lint/theme-check-theory/src/test-utils.ts +31 -0
  31. package/skills/shopify-lint/theme-check-theory/src/utils/ast.ts +126 -0
  32. package/skills/shopify-lint/theme-check-theory/tsconfig.build.json +10 -0
  33. package/skills/shopify-lint/theme-check-theory/tsconfig.json +15 -0
  34. package/skills/shopify-lint/theme-check-theory/vitest.config.ts +11 -0
@@ -0,0 +1,126 @@
1
+ import {
2
+ NodeTypes,
3
+ } from '@shopify/liquid-html-parser';
4
+ import type {
5
+ LiquidRawTag,
6
+ LiquidVariableLookup,
7
+ } from '@shopify/liquid-html-parser';
8
+ import {
9
+ findNodeAtLocation,
10
+ parseTree,
11
+ } from 'jsonc-parser';
12
+ import type { Node as JsonNode, ParseError } from 'jsonc-parser';
13
+
14
+ export type SettingScope = 'section' | 'block';
15
+
16
+ export type SettingDeclaration = {
17
+ id: string;
18
+ scope: SettingScope;
19
+ type: string;
20
+ startIndex: number;
21
+ endIndex: number;
22
+ };
23
+
24
+ export type SettingReference =
25
+ | { id: string; scope: SettingScope; dynamic: false }
26
+ | { id?: never; scope: SettingScope; dynamic: true };
27
+
28
+ /**
29
+ * Parses the one schema shape these checks care about and retains the source
30
+ * range of each id so diagnostics point at the declaration, not the full tag.
31
+ */
32
+ export function getSettingDeclarations(node: LiquidRawTag): SettingDeclaration[] | undefined {
33
+ if (node.name !== 'schema') return undefined;
34
+
35
+ const errors: ParseError[] = [];
36
+ const root = parseTree(node.body.value, errors, {
37
+ allowTrailingComma: false,
38
+ disallowComments: true,
39
+ });
40
+
41
+ if (!root || root.type !== 'object' || errors.length > 0) return undefined;
42
+
43
+ const declarations = collectSettings(
44
+ findNodeAtLocation(root, ['settings']),
45
+ 'section',
46
+ node.body.position.start,
47
+ );
48
+ const blocks = findNodeAtLocation(root, ['blocks']);
49
+
50
+ if (blocks?.type === 'array') {
51
+ for (const block of blocks.children ?? []) {
52
+ declarations.push(
53
+ ...collectSettings(
54
+ findNodeAtLocation(block, ['settings']),
55
+ 'block',
56
+ node.body.position.start,
57
+ ),
58
+ );
59
+ }
60
+ }
61
+
62
+ return declarations;
63
+ }
64
+
65
+ /**
66
+ * Returns only direct setting-object lookups. A non-string second lookup (or
67
+ * passing the whole settings object elsewhere) means static analysis cannot
68
+ * identify the selected setting.
69
+ */
70
+ export function getSettingReference(node: LiquidVariableLookup): SettingReference | undefined {
71
+ if (node.name !== 'section' && node.name !== 'block') return undefined;
72
+
73
+ const settingsLookup = node.lookups[0];
74
+ if (
75
+ settingsLookup?.type !== NodeTypes.String ||
76
+ settingsLookup.value !== 'settings'
77
+ ) {
78
+ return undefined;
79
+ }
80
+
81
+ const settingLookup = node.lookups[1];
82
+ if (!settingLookup) {
83
+ return { scope: node.name, dynamic: true };
84
+ }
85
+
86
+ if (settingLookup.type !== NodeTypes.String) {
87
+ return { scope: node.name, dynamic: true };
88
+ }
89
+
90
+ return {
91
+ id: settingLookup.value,
92
+ scope: node.name,
93
+ dynamic: false,
94
+ };
95
+ }
96
+
97
+ export function settingKey({ id, scope }: { id: string; scope: SettingScope }): string {
98
+ return `${scope}:${id}`;
99
+ }
100
+
101
+ function collectSettings(
102
+ settings: JsonNode | undefined,
103
+ scope: SettingScope,
104
+ schemaOffset: number,
105
+ ): SettingDeclaration[] {
106
+ if (settings?.type !== 'array') return [];
107
+
108
+ const declarations: SettingDeclaration[] = [];
109
+ for (const setting of settings.children ?? []) {
110
+ if (setting.type !== 'object') continue;
111
+
112
+ const id = findNodeAtLocation(setting, ['id']);
113
+ const type = findNodeAtLocation(setting, ['type']);
114
+ if (id?.type !== 'string' || type?.type !== 'string') continue;
115
+
116
+ declarations.push({
117
+ id: id.value,
118
+ scope,
119
+ type: type.value,
120
+ startIndex: schemaOffset + id.offset,
121
+ endIndex: schemaOffset + id.offset + id.length,
122
+ });
123
+ }
124
+
125
+ return declarations;
126
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src",
6
+ "sourceMap": true
7
+ },
8
+ "exclude": ["src/**/*.test.ts", "src/test-utils.ts"]
9
+ }
10
+
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "CommonJS",
5
+ "moduleResolution": "Node",
6
+ "declaration": true,
7
+ "esModuleInterop": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "types": ["node", "vitest/globals"]
12
+ },
13
+ "include": ["src/**/*.ts"]
14
+ }
15
+
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ coverage: {
6
+ include: ['src/**/*.ts'],
7
+ exclude: ['src/**/*.test.ts', 'src/test-utils.ts'],
8
+ },
9
+ },
10
+ });
11
+