ts-procedures 5.2.0 → 5.3.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 +60 -0
- package/agent_config/bin/postinstall.mjs +105 -0
- package/agent_config/bin/setup.mjs +286 -0
- package/agent_config/claude-code/.claude-plugin/plugin.json +5 -0
- package/agent_config/claude-code/agents/ts-procedures-architect.md +173 -0
- package/agent_config/claude-code/skills/guide/SKILL.md +142 -0
- package/agent_config/claude-code/skills/guide/anti-patterns.md +502 -0
- package/agent_config/claude-code/skills/guide/api-reference.md +550 -0
- package/agent_config/claude-code/skills/guide/patterns.md +572 -0
- package/agent_config/claude-code/skills/review/SKILL.md +53 -0
- package/agent_config/claude-code/skills/review/checklist.md +141 -0
- package/agent_config/claude-code/skills/scaffold/SKILL.md +54 -0
- package/agent_config/claude-code/skills/scaffold/templates/express-rpc.md +134 -0
- package/agent_config/claude-code/skills/scaffold/templates/hono-rpc.md +139 -0
- package/agent_config/claude-code/skills/scaffold/templates/hono-stream.md +134 -0
- package/agent_config/claude-code/skills/scaffold/templates/procedure.md +77 -0
- package/agent_config/claude-code/skills/scaffold/templates/stream-procedure.md +113 -0
- package/agent_config/copilot/copilot-instructions.md +255 -0
- package/agent_config/cursor/cursorrules +255 -0
- package/agent_config/lib/install-claude.mjs +109 -0
- package/package.json +7 -2
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
2
|
+
import { join, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
7
|
+
const SKILLS_DIR = join(__dirname, '..', 'claude-code', 'skills');
|
|
8
|
+
const AGENTS_DIR = join(__dirname, '..', 'claude-code', 'agents');
|
|
9
|
+
|
|
10
|
+
function getPackageVersion() {
|
|
11
|
+
try {
|
|
12
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', '..', 'package.json'), 'utf-8'));
|
|
13
|
+
return pkg.version || 'unknown';
|
|
14
|
+
} catch {
|
|
15
|
+
return 'unknown';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function makeAutoHeader() {
|
|
20
|
+
const version = getPackageVersion();
|
|
21
|
+
return `<!-- Auto-generated by ts-procedures@${version}. Updated on npm install/update. Do not edit. -->\n\n`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function stripFrontmatter(content) {
|
|
25
|
+
const match = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)$/);
|
|
26
|
+
return match ? match[1].trim() : content.trim();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function ensureDir(dir) {
|
|
30
|
+
if (!existsSync(dir)) {
|
|
31
|
+
mkdirSync(dir, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Install Claude Code integration files into a project's .claude/ directory.
|
|
37
|
+
*
|
|
38
|
+
* Creates:
|
|
39
|
+
* .claude/rules/ts-procedures.md — Framework reference (always loaded in context)
|
|
40
|
+
* .claude/commands/ts-procedures-scaffold.md — Scaffold command (/project:ts-procedures-scaffold)
|
|
41
|
+
* .claude/commands/ts-procedures-review.md — Review command (/project:ts-procedures-review)
|
|
42
|
+
* .claude/agents/ts-procedures-architect.md — Architecture planning agent
|
|
43
|
+
*
|
|
44
|
+
* @param {string} projectRoot — Absolute path to the consuming project's root
|
|
45
|
+
* @returns {{ files: string[] }} — List of created/updated file paths (relative to projectRoot)
|
|
46
|
+
*/
|
|
47
|
+
export function installClaude(projectRoot) {
|
|
48
|
+
const claudeDir = join(projectRoot, '.claude');
|
|
49
|
+
const rulesDir = join(claudeDir, 'rules');
|
|
50
|
+
const commandsDir = join(claudeDir, 'commands');
|
|
51
|
+
const agentsDir = join(claudeDir, 'agents');
|
|
52
|
+
|
|
53
|
+
ensureDir(rulesDir);
|
|
54
|
+
ensureDir(commandsDir);
|
|
55
|
+
ensureDir(agentsDir);
|
|
56
|
+
|
|
57
|
+
const autoHeader = makeAutoHeader();
|
|
58
|
+
const files = [];
|
|
59
|
+
|
|
60
|
+
// 1. Rules file — framework reference (always loaded in context)
|
|
61
|
+
const guideSkill = readFileSync(join(SKILLS_DIR, 'guide', 'SKILL.md'), 'utf-8');
|
|
62
|
+
const guideBody = stripFrontmatter(guideSkill)
|
|
63
|
+
// Remove the "Supporting Files" section — replaced by "Detailed Reference" below
|
|
64
|
+
.replace(/\n## Supporting Files[\s\S]*$/, '');
|
|
65
|
+
|
|
66
|
+
const rulesContent = autoHeader + guideBody + `
|
|
67
|
+
|
|
68
|
+
## Detailed Reference
|
|
69
|
+
|
|
70
|
+
For complete API details, patterns, and anti-patterns, read the files in:
|
|
71
|
+
\`node_modules/ts-procedures/agent_config/claude-code/skills/guide/\`
|
|
72
|
+
|
|
73
|
+
- \`api-reference.md\` — Full API reference for Procedures, Create, CreateStream, errors, schema, HTTP implementations
|
|
74
|
+
- \`patterns.md\` — Prescribed patterns with code examples
|
|
75
|
+
- \`anti-patterns.md\` — Common mistakes to avoid with fixes
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
writeFileSync(join(rulesDir, 'ts-procedures.md'), rulesContent, 'utf-8');
|
|
79
|
+
files.push('.claude/rules/ts-procedures.md');
|
|
80
|
+
|
|
81
|
+
// 2. Scaffold command
|
|
82
|
+
const scaffoldSkill = readFileSync(join(SKILLS_DIR, 'scaffold', 'SKILL.md'), 'utf-8');
|
|
83
|
+
const scaffoldBody = stripFrontmatter(scaffoldSkill)
|
|
84
|
+
.replace(
|
|
85
|
+
'Read the template file from `templates/<type>.md` in this skill directory.',
|
|
86
|
+
'Read the template file from `node_modules/ts-procedures/agent_config/claude-code/skills/scaffold/templates/<type>.md`.'
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
writeFileSync(join(commandsDir, 'ts-procedures-scaffold.md'), autoHeader + scaffoldBody, 'utf-8');
|
|
90
|
+
files.push('.claude/commands/ts-procedures-scaffold.md');
|
|
91
|
+
|
|
92
|
+
// 3. Review command
|
|
93
|
+
const reviewSkill = readFileSync(join(SKILLS_DIR, 'review', 'SKILL.md'), 'utf-8');
|
|
94
|
+
const reviewBody = stripFrontmatter(reviewSkill)
|
|
95
|
+
.replaceAll(
|
|
96
|
+
'`checklist.md`',
|
|
97
|
+
'`node_modules/ts-procedures/agent_config/claude-code/skills/review/checklist.md`'
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
writeFileSync(join(commandsDir, 'ts-procedures-review.md'), autoHeader + reviewBody, 'utf-8');
|
|
101
|
+
files.push('.claude/commands/ts-procedures-review.md');
|
|
102
|
+
|
|
103
|
+
// 4. Architect agent
|
|
104
|
+
const architectAgent = readFileSync(join(AGENTS_DIR, 'ts-procedures-architect.md'), 'utf-8');
|
|
105
|
+
writeFileSync(join(agentsDir, 'ts-procedures-architect.md'), autoHeader + architectAgent, 'utf-8');
|
|
106
|
+
files.push('.claude/agents/ts-procedures-architect.md');
|
|
107
|
+
|
|
108
|
+
return { files };
|
|
109
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-procedures",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "A TypeScript RPC framework that creates type-safe, schema-validated procedure calls with a single function definition. Define your procedures once and get full type inference, runtime validation, and framework integration hooks.",
|
|
5
5
|
"main": "build/exports.js",
|
|
6
6
|
"types": "build/exports.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"ts-procedures-setup": "./agent_config/bin/setup.mjs"
|
|
10
|
+
},
|
|
8
11
|
"scripts": {
|
|
9
12
|
"build": "tsc",
|
|
10
13
|
"lint": "npx eslint src/ --quiet",
|
|
11
14
|
"prepublishOnly": "npm run lint && npm run build",
|
|
15
|
+
"postinstall": "node ./agent_config/bin/postinstall.mjs",
|
|
12
16
|
"test": "vitest run"
|
|
13
17
|
},
|
|
14
18
|
"exports": {
|
|
@@ -38,7 +42,8 @@
|
|
|
38
42
|
"files": [
|
|
39
43
|
"assets",
|
|
40
44
|
"build",
|
|
41
|
-
"src"
|
|
45
|
+
"src",
|
|
46
|
+
"agent_config"
|
|
42
47
|
],
|
|
43
48
|
"keywords": [
|
|
44
49
|
"typescript",
|