joycraft 0.6.15 → 0.6.16
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 +31 -13
- package/dist/{chunk-YE4LWG2O.js → chunk-G6WSFZQG.js} +2 -2
- package/dist/chunk-G6WSFZQG.js.map +1 -0
- package/dist/{chunk-XOMQIK4U.js → chunk-UEG5IO6Q.js} +6 -184
- package/dist/chunk-UEG5IO6Q.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/{init-LXSMLAY5.js → init-WPKDBQDN.js} +141 -55
- package/dist/init-WPKDBQDN.js.map +1 -0
- package/dist/{init-autofix-OZW5ITFI.js → init-autofix-ESN27L3W.js} +5 -3
- package/dist/{init-autofix-OZW5ITFI.js.map → init-autofix-ESN27L3W.js.map} +1 -1
- package/dist/{upgrade-P3JZS7NM.js → upgrade-LKX25GTT.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-XOMQIK4U.js.map +0 -1
- package/dist/chunk-YE4LWG2O.js.map +0 -1
- package/dist/init-LXSMLAY5.js.map +0 -1
- /package/dist/{upgrade-P3JZS7NM.js.map → upgrade-LKX25GTT.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
TEMPLATES
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UEG5IO6Q.js";
|
|
5
5
|
import {
|
|
6
6
|
LEGACY_VERSION_FILE,
|
|
7
7
|
STATE_PATH
|
|
@@ -107,7 +107,9 @@ function printSummary(result, dryRun, scenariosRepo) {
|
|
|
107
107
|
console.log(" 2. Create the scenarios repo (private):");
|
|
108
108
|
console.log(` gh repo create ${scenariosRepo} --private`);
|
|
109
109
|
console.log(` cp -r docs/templates/scenarios/* ../${scenariosRepo}/`);
|
|
110
|
-
console.log(` cd ../${scenariosRepo}
|
|
110
|
+
console.log(` cd ../${scenariosRepo}`);
|
|
111
|
+
console.log(" mv example-scenario.test.ts.template example-scenario.test.ts # rename starter so Vitest finds it");
|
|
112
|
+
console.log(` git add -A && git commit -m "init: scaffold" && git push`);
|
|
111
113
|
console.log("");
|
|
112
114
|
console.log(" 3. Add the same two secrets to the scenarios repo.");
|
|
113
115
|
console.log("");
|
|
@@ -116,4 +118,4 @@ function printSummary(result, dryRun, scenariosRepo) {
|
|
|
116
118
|
export {
|
|
117
119
|
initAutofix
|
|
118
120
|
};
|
|
119
|
-
//# sourceMappingURL=init-autofix-
|
|
121
|
+
//# sourceMappingURL=init-autofix-ESN27L3W.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/init-autofix.ts"],"sourcesContent":["import { mkdirSync, existsSync, writeFileSync } from 'node:fs';\nimport { join, resolve, basename, dirname } from 'node:path';\nimport { TEMPLATES } from './bundled-files.js';\nimport { STATE_PATH, LEGACY_VERSION_FILE } from './version.js';\n\nexport interface InitAutofixOptions {\n scenariosRepo?: string;\n appId?: string;\n force?: boolean;\n dryRun?: boolean;\n}\n\ninterface AutofixResult {\n created: string[];\n skipped: string[];\n}\n\nfunction ensureDir(dir: string): void {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n\n/**\n * Replace literal placeholders in content.\n * Replaces $KEY but intentionally leaves ${{ ... }} GitHub Actions expressions untouched —\n * the simple string replace of \"$KEY\" won't match \"${{\" since \"${{\" != \"$\" + \"KEY\".\n */\nfunction replacePlaceholders(content: string, vars: Record<string, string>): string {\n let result = content;\n for (const [key, value] of Object.entries(vars)) {\n // Only replace literal $KEY, not ${{ expressions }}\n // Use a regex that matches $KEY but not ${{\n result = result.replaceAll('$' + key, value);\n }\n return result;\n}\n\nexport async function initAutofix(dir: string, opts: InitAutofixOptions): Promise<void> {\n const targetDir = resolve(dir);\n\n // Check project is initialized. State now lives at the hidden path; also accept\n // a legacy root file so un-upgraded projects still pass.\n const initialized =\n existsSync(join(targetDir, STATE_PATH)) || existsSync(join(targetDir, LEGACY_VERSION_FILE));\n if (!initialized) {\n throw new Error('Project is not initialized. Run `npx joycraft init` first.');\n }\n\n const force = opts.force ?? false;\n const dryRun = opts.dryRun ?? false;\n\n // Determine placeholder values\n const scenariosRepo = opts.scenariosRepo ?? `${basename(targetDir)}-scenarios`;\n const appId = opts.appId; // may be undefined — leave $JOYCRAFT_APP_ID as-is if so\n\n const vars: Record<string, string> = {\n SCENARIOS_REPO: scenariosRepo,\n };\n if (appId !== undefined) {\n vars['JOYCRAFT_APP_ID'] = appId;\n }\n\n const result: AutofixResult = { created: [], skipped: [] };\n\n // Install workflow templates to .github/workflows/\n const workflowsDir = join(targetDir, '.github', 'workflows');\n for (const [key, rawContent] of Object.entries(TEMPLATES)) {\n if (!key.startsWith('workflows/')) continue;\n const filename = key.slice('workflows/'.length); // e.g. \"autofix.yml\"\n const destPath = join(workflowsDir, filename);\n const content = replacePlaceholders(rawContent, vars);\n\n if (dryRun) {\n result.created.push(destPath);\n continue;\n }\n\n if (existsSync(destPath) && !force) {\n result.skipped.push(destPath);\n continue;\n }\n\n ensureDir(dirname(destPath));\n writeFileSync(destPath, content, 'utf-8');\n result.created.push(destPath);\n }\n\n // Install scenario templates to docs/templates/scenarios/\n const scenariosTemplateDir = join(targetDir, 'docs', 'templates', 'scenarios');\n for (const [key, rawContent] of Object.entries(TEMPLATES)) {\n if (!key.startsWith('scenarios/')) continue;\n const relativePath = key.slice('scenarios/'.length); // e.g. \"README.md\" or \"workflows/run.yml\"\n const destPath = join(scenariosTemplateDir, relativePath);\n const content = replacePlaceholders(rawContent, vars);\n\n if (dryRun) {\n result.created.push(destPath);\n continue;\n }\n\n if (existsSync(destPath) && !force) {\n result.skipped.push(destPath);\n continue;\n }\n\n ensureDir(dirname(destPath));\n writeFileSync(destPath, content, 'utf-8');\n result.created.push(destPath);\n }\n\n printSummary(result, dryRun, scenariosRepo);\n}\n\nfunction printSummary(result: AutofixResult, dryRun: boolean, scenariosRepo: string): void {\n if (dryRun) {\n console.log('\\nDry run — these files would be created:\\n');\n for (const f of result.created) {\n console.log(` + ${f}`);\n }\n return;\n }\n\n console.log('\\nJoycraft Autofix initialized!\\n');\n\n if (result.created.length > 0) {\n console.log(` Created ${result.created.length} file(s):`);\n for (const f of result.created) {\n console.log(` + ${f}`);\n }\n }\n\n if (result.skipped.length > 0) {\n console.log(`\\n Skipped ${result.skipped.length} file(s) (already exist, use --force to overwrite):`);\n for (const f of result.skipped) {\n console.log(` - ${f}`);\n }\n }\n\n console.log('\\n Remaining setup:\\n');\n console.log(' 1. Add secrets to your main repo (Settings > Secrets and variables > Actions):');\n console.log(' JOYCRAFT_APP_PRIVATE_KEY — the .pem file from your GitHub App');\n console.log(' ANTHROPIC_API_KEY — your Anthropic API key');\n console.log('');\n console.log(' 2. Create the scenarios repo (private):');\n console.log(` gh repo create ${scenariosRepo} --private`);\n console.log(` cp -r docs/templates/scenarios/* ../${scenariosRepo}/`);\n console.log(` cd ../${scenariosRepo}
|
|
1
|
+
{"version":3,"sources":["../src/init-autofix.ts"],"sourcesContent":["import { mkdirSync, existsSync, writeFileSync } from 'node:fs';\nimport { join, resolve, basename, dirname } from 'node:path';\nimport { TEMPLATES } from './bundled-files.js';\nimport { STATE_PATH, LEGACY_VERSION_FILE } from './version.js';\n\nexport interface InitAutofixOptions {\n scenariosRepo?: string;\n appId?: string;\n force?: boolean;\n dryRun?: boolean;\n}\n\ninterface AutofixResult {\n created: string[];\n skipped: string[];\n}\n\nfunction ensureDir(dir: string): void {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n}\n\n/**\n * Replace literal placeholders in content.\n * Replaces $KEY but intentionally leaves ${{ ... }} GitHub Actions expressions untouched —\n * the simple string replace of \"$KEY\" won't match \"${{\" since \"${{\" != \"$\" + \"KEY\".\n */\nfunction replacePlaceholders(content: string, vars: Record<string, string>): string {\n let result = content;\n for (const [key, value] of Object.entries(vars)) {\n // Only replace literal $KEY, not ${{ expressions }}\n // Use a regex that matches $KEY but not ${{\n result = result.replaceAll('$' + key, value);\n }\n return result;\n}\n\nexport async function initAutofix(dir: string, opts: InitAutofixOptions): Promise<void> {\n const targetDir = resolve(dir);\n\n // Check project is initialized. State now lives at the hidden path; also accept\n // a legacy root file so un-upgraded projects still pass.\n const initialized =\n existsSync(join(targetDir, STATE_PATH)) || existsSync(join(targetDir, LEGACY_VERSION_FILE));\n if (!initialized) {\n throw new Error('Project is not initialized. Run `npx joycraft init` first.');\n }\n\n const force = opts.force ?? false;\n const dryRun = opts.dryRun ?? false;\n\n // Determine placeholder values\n const scenariosRepo = opts.scenariosRepo ?? `${basename(targetDir)}-scenarios`;\n const appId = opts.appId; // may be undefined — leave $JOYCRAFT_APP_ID as-is if so\n\n const vars: Record<string, string> = {\n SCENARIOS_REPO: scenariosRepo,\n };\n if (appId !== undefined) {\n vars['JOYCRAFT_APP_ID'] = appId;\n }\n\n const result: AutofixResult = { created: [], skipped: [] };\n\n // Install workflow templates to .github/workflows/\n const workflowsDir = join(targetDir, '.github', 'workflows');\n for (const [key, rawContent] of Object.entries(TEMPLATES)) {\n if (!key.startsWith('workflows/')) continue;\n const filename = key.slice('workflows/'.length); // e.g. \"autofix.yml\"\n const destPath = join(workflowsDir, filename);\n const content = replacePlaceholders(rawContent, vars);\n\n if (dryRun) {\n result.created.push(destPath);\n continue;\n }\n\n if (existsSync(destPath) && !force) {\n result.skipped.push(destPath);\n continue;\n }\n\n ensureDir(dirname(destPath));\n writeFileSync(destPath, content, 'utf-8');\n result.created.push(destPath);\n }\n\n // Install scenario templates to docs/templates/scenarios/\n const scenariosTemplateDir = join(targetDir, 'docs', 'templates', 'scenarios');\n for (const [key, rawContent] of Object.entries(TEMPLATES)) {\n if (!key.startsWith('scenarios/')) continue;\n const relativePath = key.slice('scenarios/'.length); // e.g. \"README.md\" or \"workflows/run.yml\"\n const destPath = join(scenariosTemplateDir, relativePath);\n const content = replacePlaceholders(rawContent, vars);\n\n if (dryRun) {\n result.created.push(destPath);\n continue;\n }\n\n if (existsSync(destPath) && !force) {\n result.skipped.push(destPath);\n continue;\n }\n\n ensureDir(dirname(destPath));\n writeFileSync(destPath, content, 'utf-8');\n result.created.push(destPath);\n }\n\n printSummary(result, dryRun, scenariosRepo);\n}\n\nfunction printSummary(result: AutofixResult, dryRun: boolean, scenariosRepo: string): void {\n if (dryRun) {\n console.log('\\nDry run — these files would be created:\\n');\n for (const f of result.created) {\n console.log(` + ${f}`);\n }\n return;\n }\n\n console.log('\\nJoycraft Autofix initialized!\\n');\n\n if (result.created.length > 0) {\n console.log(` Created ${result.created.length} file(s):`);\n for (const f of result.created) {\n console.log(` + ${f}`);\n }\n }\n\n if (result.skipped.length > 0) {\n console.log(`\\n Skipped ${result.skipped.length} file(s) (already exist, use --force to overwrite):`);\n for (const f of result.skipped) {\n console.log(` - ${f}`);\n }\n }\n\n console.log('\\n Remaining setup:\\n');\n console.log(' 1. Add secrets to your main repo (Settings > Secrets and variables > Actions):');\n console.log(' JOYCRAFT_APP_PRIVATE_KEY — the .pem file from your GitHub App');\n console.log(' ANTHROPIC_API_KEY — your Anthropic API key');\n console.log('');\n console.log(' 2. Create the scenarios repo (private):');\n console.log(` gh repo create ${scenariosRepo} --private`);\n console.log(` cp -r docs/templates/scenarios/* ../${scenariosRepo}/`);\n console.log(` cd ../${scenariosRepo}`);\n console.log(' mv example-scenario.test.ts.template example-scenario.test.ts # rename starter so Vitest finds it');\n console.log(` git add -A && git commit -m \"init: scaffold\" && git push`);\n console.log('');\n console.log(' 3. Add the same two secrets to the scenarios repo.');\n console.log('');\n console.log(' See README.md for the full setup guide.\\n');\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,WAAW,YAAY,qBAAqB;AACrD,SAAS,MAAM,SAAS,UAAU,eAAe;AAgBjD,SAAS,UAAU,KAAmB;AACpC,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,cAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,EACpC;AACF;AAOA,SAAS,oBAAoB,SAAiB,MAAsC;AAClF,MAA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,UAAQ,IAAI,6EAAwE;AACpF,UAAQ,IAAI,kEAA6D;AACzE,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,2CAA2C;AACvD,UAAQ,IAAI,yBAAyB,aAAa,YAAY;AAC9D,UAAQ,IAAI,8CAA8C,aAAa,GAAG;AAC1E,UAAQ,IAAI,gBAAgB,aAAa,EAAE;AAC3C,UAAQ,IAAI,2GAA2G;AACvH,UAAQ,IAAI,iEAAiE;AAC7E,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,sDAAsD;AAClE,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,6CAA6C;AAC3D;","names":[]}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
applyGitignoreProfile,
|
|
8
8
|
resolveGitignoreProfile,
|
|
9
9
|
validateGitignoreFlag
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-G6WSFZQG.js";
|
|
11
11
|
import {
|
|
12
12
|
CODEX_SKILLS,
|
|
13
13
|
PI_AGENTS,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
PI_SKILLS,
|
|
17
17
|
SKILLS,
|
|
18
18
|
TEMPLATES
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-UEG5IO6Q.js";
|
|
20
20
|
import {
|
|
21
21
|
HARNESSES,
|
|
22
22
|
LEGACY_CLAUDE_STATE_PATH,
|
|
@@ -555,4 +555,4 @@ Upgrade complete: ${parts.join(", ")}.`);
|
|
|
555
555
|
export {
|
|
556
556
|
upgrade
|
|
557
557
|
};
|
|
558
|
-
//# sourceMappingURL=upgrade-
|
|
558
|
+
//# sourceMappingURL=upgrade-LKX25GTT.js.map
|