pi-mono-figma 0.2.1 → 0.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.
package/CHANGELOG.md
CHANGED
package/index.ts
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"./tool-result": "./src/tool-result.ts"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
18
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
19
|
+
"@earendil-works/pi-tui": "*",
|
|
20
20
|
"@sinclair/typebox": "*"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -3,8 +3,8 @@ import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
|
-
import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext } from "@
|
|
7
|
-
import { Key, matchesKey } from "@
|
|
6
|
+
import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { Key, matchesKey } from "@earendil-works/pi-tui";
|
|
8
8
|
import { Type } from "@sinclair/typebox";
|
|
9
9
|
import { ApiError } from "./errors.js";
|
|
10
10
|
import { MissingAuthTokenError, readAuthToken, setAuthTokenOverride, type ReadAuthTokenOptions } from "./auth.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-mono-figma",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Pi extension and skill for Figma design context tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"pi-common"
|
|
17
17
|
],
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@
|
|
19
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
20
20
|
"@sinclair/typebox": "*"
|
|
21
21
|
},
|
|
22
22
|
"pi": {
|
package/src/figma-schemas.ts
CHANGED
|
@@ -36,10 +36,17 @@ const FigmaNodeProcessingOptions = {
|
|
|
36
36
|
includeComponentInternals: Type.Optional(Type.Boolean({ description: "Expand component instance internals. Defaults to false." })),
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const RenderFormatSchema = Type.Union([Type.Literal("png"), Type.Literal("jpg"), Type.Literal("svg"), Type.Literal("pdf")], {
|
|
40
|
+
description: "Rendered asset format",
|
|
41
|
+
});
|
|
42
|
+
const FrameworkSchema = Type.Union([Type.Literal("react"), Type.Literal("html"), Type.Literal("vue"), Type.Literal("angular"), Type.Literal("react-native")]);
|
|
43
|
+
const StylingSchema = Type.Union([Type.Literal("css"), Type.Literal("css-modules"), Type.Literal("styled-components"), Type.Literal("tailwind"), Type.Literal("inline")]);
|
|
44
|
+
const AssetTypeSchema = Type.Union([Type.Literal("svgIcons"), Type.Literal("nodeRenders"), Type.Literal("imageFills")]);
|
|
45
|
+
|
|
39
46
|
const FigmaOptionalRenderOptions = {
|
|
40
47
|
renderImage: Type.Optional(Type.Boolean({ description: "Render the node and include image URL/local path in the response. Defaults to false." })),
|
|
41
48
|
outputDir: Type.Optional(Type.String({ description: "Optional directory for downloaded rendered image files. Omit unless the user requested persistent files; by default downloads go to an OS temp directory." })),
|
|
42
|
-
format: Type.Optional(
|
|
49
|
+
format: Type.Optional(RenderFormatSchema),
|
|
43
50
|
scale: Type.Optional(Type.Number({ description: "Render scale for bitmap formats", minimum: 0.01, maximum: 4 })),
|
|
44
51
|
};
|
|
45
52
|
|
|
@@ -63,8 +70,8 @@ export const FigmaImplementationContextParams = Type.Object({
|
|
|
63
70
|
nodeId: NodeIdSchema,
|
|
64
71
|
...FigmaNodeProcessingOptions,
|
|
65
72
|
...FigmaOptionalRenderOptions,
|
|
66
|
-
framework: Type.Optional(
|
|
67
|
-
styling: Type.Optional(
|
|
73
|
+
framework: Type.Optional(FrameworkSchema),
|
|
74
|
+
styling: Type.Optional(StylingSchema),
|
|
68
75
|
resolveTokens: Type.Optional(Type.Boolean({ description: "Resolve style and variable IDs into token names when possible. Defaults to true." })),
|
|
69
76
|
includeCodeSnippets: Type.Optional(Type.Boolean({ description: "Include compact starter snippets for the selected framework/styling target. Defaults to false." })),
|
|
70
77
|
maxResponseChars: MaxResponseCharsSchema,
|
|
@@ -96,7 +103,7 @@ export const FigmaRenderNodesParams = Type.Object({
|
|
|
96
103
|
fileKey: FileKeySchema,
|
|
97
104
|
nodeIds: NodeIdsSchema,
|
|
98
105
|
outputDir: Type.Optional(Type.String({ description: "Optional directory for downloaded image files. Omit unless the user requested persistent files; if omitted, an OS temp directory is created." })),
|
|
99
|
-
format: Type.Optional(
|
|
106
|
+
format: Type.Optional(RenderFormatSchema),
|
|
100
107
|
scale: Type.Optional(Type.Number({ description: "Render scale for bitmap formats", minimum: 0.01, maximum: 4 })),
|
|
101
108
|
download: Type.Optional(Type.Boolean({ description: "Download rendered assets locally. Defaults to true." })),
|
|
102
109
|
maxResponseChars: MaxResponseCharsSchema,
|
|
@@ -106,7 +113,7 @@ export const FigmaExtractAssetsParams = Type.Object({
|
|
|
106
113
|
fileKey: FileKeySchema,
|
|
107
114
|
nodeId: NodeIdSchema,
|
|
108
115
|
depth: Type.Optional(Type.Number({ description: "How many levels of node hierarchy to inspect for assets. Defaults to 3 and is capped at 4.", minimum: 1, maximum: 4 })),
|
|
109
|
-
assetTypes: Type.Optional(Type.Array(
|
|
116
|
+
assetTypes: Type.Optional(Type.Array(AssetTypeSchema, { description: "Asset categories to extract. Defaults to all supported categories." })),
|
|
110
117
|
outputDir: Type.Optional(Type.String({ description: "Optional directory for downloaded asset files. Omit unless the user requested persistent files; by default files go to an OS temp directory." })),
|
|
111
118
|
includeHidden: Type.Optional(Type.Boolean({ description: "Include hidden nodes while discovering assets. Defaults to false." })),
|
|
112
119
|
maxAssets: Type.Optional(Type.Number({ description: "Maximum assets to include in the manifest. Defaults to 80.", minimum: 1, maximum: 500 })),
|
|
@@ -126,8 +133,8 @@ export const FigmaComponentImplementationHintsParams = Type.Object({
|
|
|
126
133
|
fileKey: FileKeySchema,
|
|
127
134
|
nodeId: NodeIdSchema,
|
|
128
135
|
...FigmaNodeProcessingOptions,
|
|
129
|
-
framework: Type.Optional(
|
|
130
|
-
styling: Type.Optional(
|
|
136
|
+
framework: Type.Optional(FrameworkSchema),
|
|
137
|
+
styling: Type.Optional(StylingSchema),
|
|
131
138
|
includeCodeConnect: Type.Optional(Type.Boolean({ description: "Scan the local repo for Figma Code Connect mappings. Defaults to true." })),
|
|
132
139
|
includeSnippet: Type.Optional(Type.Boolean({ description: "Include starter framework snippet. Defaults to false." })),
|
|
133
140
|
rootDir: Type.Optional(Type.String({ description: "Optional local repo subdirectory for Code Connect scanning." })),
|
package/src/figma-tools.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { registerAuthConfigurator, runWithAuthRetry, type AuthConfiguratorOptions } from "pi-common/auth-config";
|
|
3
3
|
import { jsonToolResult, textToolResult } from "pi-common/tool-result";
|
|
4
4
|
import { FigmaClient, parseFigmaUrl } from "./figma-client.js";
|