@letta-ai/letta-code 0.27.2 → 0.27.3
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/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
#!/usr/bin/env npx
|
|
1
|
+
#!/usr/bin/env -S npx tsx
|
|
2
2
|
/**
|
|
3
3
|
* Skill Initializer - Creates a new skill from template
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* npx
|
|
6
|
+
* npx tsx init-skill.ts <skill-name> --path <path>
|
|
7
7
|
*
|
|
8
8
|
* Examples:
|
|
9
|
-
* npx
|
|
10
|
-
* npx
|
|
9
|
+
* npx tsx init-skill.ts my-new-skill --path .skills
|
|
10
|
+
* npx tsx init-skill.ts my-api-helper --path ~/.letta/skills
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
14
14
|
import { join, resolve } from "node:path";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
15
16
|
|
|
16
17
|
const SKILL_TEMPLATE = `---
|
|
17
18
|
name: {skill_name}
|
|
@@ -86,7 +87,7 @@ Files not intended to be loaded into context, but rather used within the output
|
|
|
86
87
|
**Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
|
|
87
88
|
`;
|
|
88
89
|
|
|
89
|
-
const EXAMPLE_SCRIPT = `#!/usr/bin/env npx
|
|
90
|
+
const EXAMPLE_SCRIPT = `#!/usr/bin/env -S npx tsx
|
|
90
91
|
/**
|
|
91
92
|
* Example helper script for {skill_name}
|
|
92
93
|
*
|
|
@@ -247,22 +248,27 @@ function initSkill(skillName: string, path: string): string | null {
|
|
|
247
248
|
return skillDir;
|
|
248
249
|
}
|
|
249
250
|
|
|
251
|
+
function isMainModule(): boolean {
|
|
252
|
+
const entrypoint = process.argv[1];
|
|
253
|
+
return entrypoint
|
|
254
|
+
? resolve(entrypoint) === fileURLToPath(import.meta.url)
|
|
255
|
+
: false;
|
|
256
|
+
}
|
|
257
|
+
|
|
250
258
|
// CLI entry point
|
|
251
|
-
if (
|
|
259
|
+
if (isMainModule()) {
|
|
252
260
|
const args = process.argv.slice(2);
|
|
253
261
|
|
|
254
262
|
if (args.length < 3 || args[1] !== "--path") {
|
|
255
|
-
console.log("Usage: npx
|
|
263
|
+
console.log("Usage: npx tsx init-skill.ts <skill-name> --path <path>");
|
|
256
264
|
console.log("\nSkill name requirements:");
|
|
257
265
|
console.log(" - Hyphen-case identifier (e.g., 'data-analyzer')");
|
|
258
266
|
console.log(" - Lowercase letters, digits, and hyphens only");
|
|
259
267
|
console.log(" - Max 64 characters");
|
|
260
268
|
console.log(" - Must match directory name exactly");
|
|
261
269
|
console.log("\nExamples:");
|
|
262
|
-
console.log(" npx
|
|
263
|
-
console.log(
|
|
264
|
-
" npx ts-node init-skill.ts my-api-helper --path ~/.letta/skills",
|
|
265
|
-
);
|
|
270
|
+
console.log(" npx tsx init-skill.ts my-new-skill --path .skills");
|
|
271
|
+
console.log(" npx tsx init-skill.ts my-api-helper --path ~/.letta/skills");
|
|
266
272
|
process.exit(1);
|
|
267
273
|
}
|
|
268
274
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#!/usr/bin/env npx
|
|
1
|
+
#!/usr/bin/env -S npx tsx
|
|
2
2
|
/**
|
|
3
3
|
* Skill Packager - Creates a distributable .skill file of a skill folder
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* npx
|
|
6
|
+
* npx tsx package-skill.ts <path/to/skill-folder> [output-directory]
|
|
7
7
|
*
|
|
8
8
|
* Example:
|
|
9
|
-
* npx
|
|
10
|
-
* npx
|
|
9
|
+
* npx tsx package-skill.ts .skills/my-skill
|
|
10
|
+
* npx tsx package-skill.ts .skills/my-skill ./dist
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
writeFileSync,
|
|
20
20
|
} from "node:fs";
|
|
21
21
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
22
|
+
import { fileURLToPath } from "node:url";
|
|
22
23
|
// Simple zip implementation using Node.js built-in zlib
|
|
23
24
|
// For a proper zip file, we'll create the structure manually
|
|
24
25
|
import { deflateSync } from "node:zlib";
|
|
@@ -238,17 +239,24 @@ function packageSkill(skillPath: string, outputDir?: string): string | null {
|
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
|
|
242
|
+
function isMainModule(): boolean {
|
|
243
|
+
const entrypoint = process.argv[1];
|
|
244
|
+
return entrypoint
|
|
245
|
+
? resolve(entrypoint) === fileURLToPath(import.meta.url)
|
|
246
|
+
: false;
|
|
247
|
+
}
|
|
248
|
+
|
|
241
249
|
// CLI entry point
|
|
242
|
-
if (
|
|
250
|
+
if (isMainModule()) {
|
|
243
251
|
const args = process.argv.slice(2);
|
|
244
252
|
|
|
245
253
|
if (args.length < 1) {
|
|
246
254
|
console.log(
|
|
247
|
-
"Usage: npx
|
|
255
|
+
"Usage: npx tsx package-skill.ts <path/to/skill-folder> [output-directory]",
|
|
248
256
|
);
|
|
249
257
|
console.log("\nExample:");
|
|
250
|
-
console.log(" npx
|
|
251
|
-
console.log(" npx
|
|
258
|
+
console.log(" npx tsx package-skill.ts .skills/my-skill");
|
|
259
|
+
console.log(" npx tsx package-skill.ts .skills/my-skill ./dist");
|
|
252
260
|
process.exit(1);
|
|
253
261
|
}
|
|
254
262
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
#!/usr/bin/env npx
|
|
1
|
+
#!/usr/bin/env -S npx tsx
|
|
2
2
|
/**
|
|
3
3
|
* Skill Validator - Validates skill structure and frontmatter
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* npx
|
|
6
|
+
* npx tsx validate-skill.ts <skill-directory>
|
|
7
7
|
*
|
|
8
8
|
* Example:
|
|
9
|
-
* npx
|
|
9
|
+
* npx tsx validate-skill.ts .skills/my-skill
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { existsSync, readFileSync } from "node:fs";
|
|
13
|
-
import { basename, join } from "node:path";
|
|
13
|
+
import { basename, join, resolve } from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
14
15
|
import { parse as parseYaml } from "yaml";
|
|
15
16
|
|
|
16
17
|
interface ValidationResult {
|
|
@@ -161,11 +162,18 @@ export function validateSkill(skillPath: string): ValidationResult {
|
|
|
161
162
|
};
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
function isMainModule(): boolean {
|
|
166
|
+
const entrypoint = process.argv[1];
|
|
167
|
+
return entrypoint
|
|
168
|
+
? resolve(entrypoint) === fileURLToPath(import.meta.url)
|
|
169
|
+
: false;
|
|
170
|
+
}
|
|
171
|
+
|
|
164
172
|
// CLI entry point
|
|
165
|
-
if (
|
|
173
|
+
if (isMainModule()) {
|
|
166
174
|
const args = process.argv.slice(2);
|
|
167
175
|
if (args.length !== 1) {
|
|
168
|
-
console.log("Usage: npx
|
|
176
|
+
console.log("Usage: npx tsx validate-skill.ts <skill-directory>");
|
|
169
177
|
process.exit(1);
|
|
170
178
|
}
|
|
171
179
|
|