prizmkit 1.1.190 → 1.1.192
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/bin/create-prizmkit.js +4 -4
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +150 -0
- package/bundled/adapters/antigravity/hooks-adapter.js +195 -0
- package/bundled/adapters/antigravity/paths.js +14 -0
- package/bundled/adapters/antigravity/rules-adapter.js +54 -0
- package/bundled/adapters/antigravity/skill-adapter.js +38 -0
- package/bundled/adapters/codex/skill-adapter.js +28 -8
- package/bundled/adapters/cursor/skill-adapter.js +13 -4
- package/bundled/adapters/pi/skill-adapter.js +28 -7
- package/bundled/dev-pipeline/.env.example +4 -12
- package/bundled/dev-pipeline/README.md +21 -15
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +3 -6
- package/bundled/dev-pipeline/prizmkit_runtime/atomic_io.py +48 -0
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +66 -23
- package/bundled/dev-pipeline/prizmkit_runtime/cli.py +10 -7
- package/bundled/dev-pipeline/prizmkit_runtime/commands.py +2 -21
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +29 -70
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +125 -67
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +89 -442
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +93 -49
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -3
- package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -6
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +49 -18
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +206 -151
- package/bundled/dev-pipeline/prizmkit_runtime/reset.py +2 -23
- package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +15 -134
- package/bundled/dev-pipeline/prizmkit_runtime/results.py +25 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +68 -83
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +15 -5
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -29
- package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +7 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +282 -217
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +124 -122
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +90 -9
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +369 -154
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +3 -3
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +2780 -0
- package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +27 -101
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +58 -4
- package/bundled/dev-pipeline/scripts/check-session-status.py +43 -19
- package/bundled/dev-pipeline/scripts/continuation.py +6 -4
- package/bundled/dev-pipeline/scripts/detect-stuck.py +28 -28
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +10 -7
- package/bundled/dev-pipeline/scripts/init-change-artifact.py +8 -2
- package/bundled/dev-pipeline/scripts/init-pipeline.py +14 -69
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +31 -2328
- package/bundled/dev-pipeline/scripts/patch-completion-notes.py +4 -24
- package/bundled/dev-pipeline/scripts/prompt_framework.py +56 -9
- package/bundled/dev-pipeline/scripts/status_common.py +591 -0
- package/bundled/dev-pipeline/scripts/update-bug-status.py +85 -463
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +227 -65
- package/bundled/dev-pipeline/scripts/update-feature-status.py +76 -509
- package/bundled/dev-pipeline/scripts/utils.py +10 -15
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +4 -4
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +7 -0
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -6
- package/bundled/dev-pipeline/templates/session-status-schema.json +2 -5
- package/bundled/dev-pipeline/tests/_helpers.py +418 -0
- package/bundled/dev-pipeline/tests/conftest.py +45 -1
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +1 -0
- package/bundled/dev-pipeline/tests/test_auto_skip.py +4 -69
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +126 -1
- package/bundled/dev-pipeline/tests/test_daemon_and_scripts.py +257 -0
- package/bundled/dev-pipeline/tests/test_e2e_pipeline_run.py +500 -0
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +59 -117
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +12 -10
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +561 -3094
- package/bundled/dev-pipeline/tests/test_recovery_workflow.py +7 -8
- package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -1
- package/bundled/dev-pipeline/tests/test_reset_modes.py +15 -27
- package/bundled/dev-pipeline/tests/test_reset_preserve.py +54 -139
- package/bundled/dev-pipeline/tests/test_runner_bookkeeping.py +766 -0
- package/bundled/dev-pipeline/tests/test_runner_lifecycle.py +1257 -0
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +97 -20
- package/bundled/dev-pipeline/tests/test_session_launch.py +1101 -0
- package/bundled/dev-pipeline/tests/test_stream_progress.py +585 -0
- package/bundled/dev-pipeline/tests/test_unified_cli.py +490 -2006
- package/bundled/dev-pipeline/tests/test_utils.py +3 -3
- package/bundled/rules/USAGE.md +1 -0
- package/bundled/skills/_metadata.json +9 -63
- package/bundled/skills/app-planner/SKILL.md +32 -303
- package/bundled/skills/app-planner/references/app-design-guide.md +0 -4
- package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
- package/bundled/skills/app-planner/references/project-brief-guide.md +14 -0
- package/bundled/skills/app-planner/references/project-conventions-discovery.md +4 -6
- package/bundled/skills/app-planner/references/project-state-detection.md +2 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +1 -2
- package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +4 -7
- package/bundled/skills/bug-planner/SKILL.md +54 -435
- package/bundled/skills/bug-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/bug-planner/references/input-formats.md +32 -0
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-planner/SKILL.md +60 -439
- package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
- package/bundled/skills/feature-planner/references/completeness-review.md +34 -0
- package/bundled/skills/feature-planner/references/decomposition-patterns.md +2 -2
- package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
- package/bundled/skills/feature-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/feature-planner/references/incremental-feature-planning.md +3 -1
- package/bundled/skills/feature-workflow/SKILL.md +1 -2
- package/bundled/skills/prizmkit/SKILL.md +7 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +14 -6
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +7 -4
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +16 -0
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +58 -20
- package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +25 -128
- package/bundled/skills/prizmkit-init/assets/project-brief-template.md +3 -3
- package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
- package/bundled/skills/prizmkit-plan/SKILL.md +6 -8
- package/bundled/skills/prizmkit-plan/references/clarify-guide.md +1 -1
- package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +5 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +6 -5
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +1 -13
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +6 -4
- package/bundled/skills/prizmkit-test/SKILL.md +25 -133
- package/bundled/skills/prizmkit-test/references/independent-test-review.md +5 -2
- package/bundled/skills/prizmkit-test/references/test-coverage-model.md +6 -0
- package/bundled/skills/prizmkit-workflow/SKILL.md +2 -3
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +4 -3
- package/bundled/skills/recovery-workflow/SKILL.md +7 -7
- package/bundled/skills/recovery-workflow/evals/evals.json +1 -1
- package/bundled/skills/recovery-workflow/references/detection.md +1 -3
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +0 -6
- package/bundled/templates/project-memory-template.md +1 -2
- package/package.json +1 -1
- package/src/ai-cli-launch.js +1 -1
- package/src/clean.js +40 -4
- package/src/config.js +64 -4
- package/src/detect-platform.js +10 -6
- package/src/external-skills.js +2 -2
- package/src/index.js +1 -0
- package/src/manifest.js +1 -1
- package/src/platforms.js +6 -2
- package/src/prompts.js +11 -3
- package/src/scaffold.js +87 -11
- package/src/upgrade.js +9 -3
- package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +0 -53
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +0 -649
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +0 -463
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +0 -1512
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -240
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +0 -266
- package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +0 -15
- package/bundled/dev-pipeline/templates/sections/refactor-mission.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +0 -16
- package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +0 -22
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +0 -19
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +0 -12
- package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -6
- package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +0 -52
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +0 -478
- package/bundled/skills/feature-planner/assets/evaluation-guide.md +0 -44
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +0 -219
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +0 -78
- package/bundled/skills/refactor-planner/SKILL.md +0 -467
- package/bundled/skills/refactor-planner/assets/planning-guide.md +0 -291
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +0 -187
- package/bundled/skills/refactor-planner/references/error-recovery.md +0 -45
- package/bundled/skills/refactor-planner/references/fast-path.md +0 -59
- package/bundled/skills/refactor-planner/references/generated-plan-review.md +0 -107
- package/bundled/skills/refactor-planner/references/planning-phases.md +0 -172
- package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +0 -230
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +0 -1120
- package/bundled/skills/refactor-workflow/SKILL.md +0 -205
package/bin/create-prizmkit.js
CHANGED
|
@@ -31,7 +31,7 @@ program
|
|
|
31
31
|
program
|
|
32
32
|
.command('install [directory]')
|
|
33
33
|
.description('Install PrizmKit into a project directory')
|
|
34
|
-
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, comma-separated list, or all')
|
|
34
|
+
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, antigravity, comma-separated list, or all')
|
|
35
35
|
.option('--runtime <runtime>', 'Runtime assets: python or auto; unix/windows are accepted as legacy aliases for python')
|
|
36
36
|
.option('--skills <suite>', 'Skill suite: core, minimal, or recommended:<type> (frontend/backend/fullstack/library)', 'core')
|
|
37
37
|
.option('--pipeline', 'Install dev-pipeline (default: true)')
|
|
@@ -43,7 +43,7 @@ program
|
|
|
43
43
|
.option('--open-cli-auto-download', 'Auto-download opencli extension if missing (default: true)')
|
|
44
44
|
.option('--no-open-cli-auto-download', 'Skip auto-download, show manual steps only')
|
|
45
45
|
.option('--rules <preset>', 'Rules preset: recommended, minimal, or none', 'recommended')
|
|
46
|
-
.option('--ai-cli <command>', 'AI CLI executable command (e.g. cbc, claude, codex, pi, agent)')
|
|
46
|
+
.option('--ai-cli <command>', 'AI CLI executable command (e.g. cbc, claude, codex, pi, agent, agy)')
|
|
47
47
|
.option('--headless-prompt-arg <arg>', 'Prompt injection argv token for a custom AI CLI (e.g. -p or -i)')
|
|
48
48
|
.option('--headless-extra-args <args>', 'Additional headless argv tokens for a custom AI CLI')
|
|
49
49
|
.option('--external-skills <names>', 'Comma-separated external skill names to install (e.g. find-skills,frontend-design)')
|
|
@@ -90,11 +90,11 @@ program
|
|
|
90
90
|
program
|
|
91
91
|
.command('config [directory]')
|
|
92
92
|
.description('Reconfigure existing PrizmKit installation (change platform, skills, rules, options)')
|
|
93
|
-
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, comma-separated list, or all')
|
|
93
|
+
.option('--platform <platform>', 'Target platform: codebuddy, claude, codex, pi, cursor, antigravity, comma-separated list, or all')
|
|
94
94
|
.option('--runtime <runtime>', 'Runtime assets: python or auto; unix/windows are accepted as legacy aliases for python')
|
|
95
95
|
.option('--skills <suite>', 'Skill suite: core, minimal, or recommended:<type>')
|
|
96
96
|
.option('--rules <preset>', 'Rules preset: recommended, minimal, or none')
|
|
97
|
-
.option('--ai-cli <command>', 'AI CLI executable command (e.g. cbc, claude, codex, pi, agent)')
|
|
97
|
+
.option('--ai-cli <command>', 'AI CLI executable command (e.g. cbc, claude, codex, pi, agent, agy)')
|
|
98
98
|
.option('--headless-prompt-arg <arg>', 'Prompt injection argv token for a custom AI CLI (e.g. -p or -i)')
|
|
99
99
|
.option('--headless-extra-args <args>', 'Additional headless argv tokens for a custom AI CLI')
|
|
100
100
|
.option('--pipeline', 'Enable dev-pipeline')
|
package/bundled/VERSION.json
CHANGED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* global process, require, __dirname */
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const os = require('node:os');
|
|
7
|
+
const path = require('node:path');
|
|
8
|
+
const crypto = require('node:crypto');
|
|
9
|
+
const { spawnSync } = require('node:child_process');
|
|
10
|
+
|
|
11
|
+
function readInput() {
|
|
12
|
+
try {
|
|
13
|
+
const raw = fs.readFileSync(0, 'utf8').trim();
|
|
14
|
+
if (!raw) return {};
|
|
15
|
+
const value = JSON.parse(raw);
|
|
16
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
17
|
+
} catch {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function writeOutput(value) {
|
|
23
|
+
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function resolveProjectRoot(input) {
|
|
27
|
+
if (input && typeof input.cwd === 'string' && input.cwd.trim() && fs.existsSync(input.cwd.trim())) {
|
|
28
|
+
return path.resolve(input.cwd.trim());
|
|
29
|
+
}
|
|
30
|
+
if (input && Array.isArray(input.workspacePaths)) {
|
|
31
|
+
for (const candidate of input.workspacePaths) {
|
|
32
|
+
if (typeof candidate === 'string' && candidate.trim() && fs.existsSync(candidate.trim())) {
|
|
33
|
+
return path.resolve(candidate.trim());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return path.resolve(__dirname, '..', '..', '..', '..');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function queueFilePath(projectRoot, conversationId) {
|
|
41
|
+
const conv = typeof conversationId === 'string' && conversationId.trim()
|
|
42
|
+
? conversationId.trim()
|
|
43
|
+
: 'default';
|
|
44
|
+
const digest = crypto
|
|
45
|
+
.createHash('sha256')
|
|
46
|
+
.update(`${projectRoot}\0${conv}`)
|
|
47
|
+
.digest('hex')
|
|
48
|
+
.slice(0, 24);
|
|
49
|
+
return path.join(os.tmpdir(), `prizmkit-agy-drift-${digest}.txt`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function systemMessageResponse(message) {
|
|
53
|
+
return {
|
|
54
|
+
injectSteps: [
|
|
55
|
+
{
|
|
56
|
+
systemMessage: {
|
|
57
|
+
systemMessage: message,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function sessionStart(input) {
|
|
65
|
+
const projectRoot = resolveProjectRoot(input);
|
|
66
|
+
if (fs.existsSync(path.join(projectRoot, '.prizmkit', 'prizm-docs', 'root.prizm'))) {
|
|
67
|
+
return systemMessageResponse(
|
|
68
|
+
'PrizmKit: read exact .prizmkit/prizm-docs/root.prizm first, then load only relevant pointed module documents. Use the project Skills in .agents/plugins/prizmkit/skills and Rules in .agents/plugins/prizmkit/rules.',
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return systemMessageResponse(
|
|
72
|
+
'PrizmKit: project documentation is not initialized. Use /prizmkit-init when project context bootstrap is required.',
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function extractCommand(input) {
|
|
77
|
+
const args = input && input.toolCall && input.toolCall.args && typeof input.toolCall.args === 'object'
|
|
78
|
+
? input.toolCall.args
|
|
79
|
+
: null;
|
|
80
|
+
if (args) {
|
|
81
|
+
if (typeof args.CommandLine === 'string') return args.CommandLine;
|
|
82
|
+
if (typeof args.command === 'string') return args.command;
|
|
83
|
+
}
|
|
84
|
+
const toolInput = input && input.tool_input && typeof input.tool_input === 'object'
|
|
85
|
+
? input.tool_input
|
|
86
|
+
: null;
|
|
87
|
+
if (toolInput && typeof toolInput.command === 'string') return toolInput.command;
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function postToolUse(input) {
|
|
92
|
+
const command = extractCommand(input);
|
|
93
|
+
if (!/\bgit\s+(commit|merge|rebase)\b/.test(command)) return {};
|
|
94
|
+
|
|
95
|
+
const projectRoot = resolveProjectRoot(input);
|
|
96
|
+
const runPythonHook = path.join(projectRoot, '.prizmkit', 'scripts', 'run-python-hook.cjs');
|
|
97
|
+
const driftScript = path.join(projectRoot, '.prizmkit', 'scripts', 'post-command-prizm-drift.py');
|
|
98
|
+
if (!fs.existsSync(runPythonHook) || !fs.existsSync(driftScript)) return {};
|
|
99
|
+
|
|
100
|
+
const result = spawnSync(
|
|
101
|
+
process.execPath,
|
|
102
|
+
[runPythonHook, driftScript],
|
|
103
|
+
{
|
|
104
|
+
cwd: projectRoot,
|
|
105
|
+
env: {
|
|
106
|
+
...process.env,
|
|
107
|
+
CLAUDE_TOOL_INPUT: JSON.stringify({ command }),
|
|
108
|
+
},
|
|
109
|
+
encoding: 'utf8',
|
|
110
|
+
timeout: 25000,
|
|
111
|
+
windowsHide: true,
|
|
112
|
+
},
|
|
113
|
+
);
|
|
114
|
+
const context = String(result.stdout || '').trim();
|
|
115
|
+
if (context) {
|
|
116
|
+
try {
|
|
117
|
+
fs.appendFileSync(queueFilePath(projectRoot, input && input.conversationId), `${context}\n`, 'utf8');
|
|
118
|
+
} catch {
|
|
119
|
+
// Non-blocking drift queue; PostToolUse must still return {}.
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function postInvocation(input) {
|
|
126
|
+
const projectRoot = resolveProjectRoot(input);
|
|
127
|
+
const qPath = queueFilePath(projectRoot, input && input.conversationId);
|
|
128
|
+
if (!fs.existsSync(qPath)) return {};
|
|
129
|
+
|
|
130
|
+
let queued = '';
|
|
131
|
+
try {
|
|
132
|
+
queued = fs.readFileSync(qPath, 'utf8').trim();
|
|
133
|
+
} catch {
|
|
134
|
+
queued = '';
|
|
135
|
+
} finally {
|
|
136
|
+
try {
|
|
137
|
+
fs.rmSync(qPath, { force: true });
|
|
138
|
+
} catch {
|
|
139
|
+
// Ignore temp queue cleanup error.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return queued ? systemMessageResponse(queued) : {};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const input = readInput();
|
|
146
|
+
const operation = process.argv[2] || '';
|
|
147
|
+
if (operation === 'session-start') writeOutput(sessionStart(input));
|
|
148
|
+
else if (operation === 'post-tool-use') writeOutput(postToolUse(input));
|
|
149
|
+
else if (operation === 'post-invocation') writeOutput(postInvocation(input));
|
|
150
|
+
else writeOutput({});
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/** Merge PrizmKit-owned Antigravity plugin hooks and manifest without replacing user entries. */
|
|
2
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
|
+
import { copyFile, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import {
|
|
7
|
+
HOOK_SCRIPT,
|
|
8
|
+
HOOKS_FILE,
|
|
9
|
+
HOOKS_OWNERSHIP_MARKER,
|
|
10
|
+
PLUGIN_MANIFEST,
|
|
11
|
+
PLUGIN_OWNERSHIP_MARKER,
|
|
12
|
+
} from './paths.js';
|
|
13
|
+
|
|
14
|
+
export const MANAGED_HOOK_KEY = 'prizmkit';
|
|
15
|
+
export const MANAGED_HOOK_MARKER = './hooks/prizmkit-hook.cjs';
|
|
16
|
+
export const DEFAULT_PLUGIN_DESCRIPTION =
|
|
17
|
+
'PrizmKit self-evolving autonomous development skills, rules, and lifecycle hooks';
|
|
18
|
+
|
|
19
|
+
const MANAGED_HOOK_SPEC = {
|
|
20
|
+
SessionStart: [
|
|
21
|
+
{
|
|
22
|
+
type: 'command',
|
|
23
|
+
command: `node ${MANAGED_HOOK_MARKER} session-start`,
|
|
24
|
+
timeout: 10,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
PostToolUse: [
|
|
28
|
+
{
|
|
29
|
+
matcher: 'run_command',
|
|
30
|
+
hooks: [
|
|
31
|
+
{
|
|
32
|
+
type: 'command',
|
|
33
|
+
command: `node ${MANAGED_HOOK_MARKER} post-tool-use`,
|
|
34
|
+
timeout: 30,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
PostInvocation: [
|
|
40
|
+
{
|
|
41
|
+
type: 'command',
|
|
42
|
+
command: `node ${MANAGED_HOOK_MARKER} post-invocation`,
|
|
43
|
+
timeout: 15,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function isObject(value) {
|
|
49
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function isManagedHook(value) {
|
|
53
|
+
try {
|
|
54
|
+
return JSON.stringify(value).includes(MANAGED_HOOK_MARKER);
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function mergeAntigravityHooks(existing = {}, managedSpec = MANAGED_HOOK_SPEC) {
|
|
61
|
+
if (!isObject(existing)) {
|
|
62
|
+
throw new Error('Cannot preserve malformed Antigravity hooks: root must be an object');
|
|
63
|
+
}
|
|
64
|
+
const next = {};
|
|
65
|
+
for (const [key, spec] of Object.entries(existing)) {
|
|
66
|
+
if (!isObject(spec)) {
|
|
67
|
+
throw new Error(`Cannot preserve malformed Antigravity hooks: ${key} must be an object`);
|
|
68
|
+
}
|
|
69
|
+
if (key === MANAGED_HOOK_KEY) continue;
|
|
70
|
+
next[key] = spec;
|
|
71
|
+
}
|
|
72
|
+
next[MANAGED_HOOK_KEY] = managedSpec;
|
|
73
|
+
return next;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function removeManagedAntigravityHooks(existing = {}) {
|
|
77
|
+
if (!isObject(existing)) {
|
|
78
|
+
throw new Error('Cannot preserve malformed Antigravity hooks: root must be an object');
|
|
79
|
+
}
|
|
80
|
+
const next = {};
|
|
81
|
+
for (const [key, spec] of Object.entries(existing)) {
|
|
82
|
+
if (!isObject(spec)) {
|
|
83
|
+
throw new Error(`Cannot preserve malformed Antigravity hooks: ${key} must be an object`);
|
|
84
|
+
}
|
|
85
|
+
if (key === MANAGED_HOOK_KEY || isManagedHook(spec)) continue;
|
|
86
|
+
next[key] = spec;
|
|
87
|
+
}
|
|
88
|
+
return next;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function readJsonObject(filePath, label) {
|
|
92
|
+
if (!existsSync(filePath)) return {};
|
|
93
|
+
try {
|
|
94
|
+
const parsed = JSON.parse(await readFile(filePath, 'utf8'));
|
|
95
|
+
if (!isObject(parsed)) {
|
|
96
|
+
throw new Error('root must be an object');
|
|
97
|
+
}
|
|
98
|
+
return parsed;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
throw new Error(`Cannot preserve malformed Antigravity ${label} at ${filePath}: ${error.message}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function isManagedPluginManifest(manifest) {
|
|
105
|
+
if (!isObject(manifest)) return false;
|
|
106
|
+
const allowedKeys = new Set(['name', 'description', 'version']);
|
|
107
|
+
return Object.keys(manifest).every(key => allowedKeys.has(key))
|
|
108
|
+
&& manifest.name === 'prizmkit'
|
|
109
|
+
&& manifest.description === DEFAULT_PLUGIN_DESCRIPTION;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export async function installHooks(targetRoot, options = {}) {
|
|
113
|
+
const hooksPath = path.join(targetRoot, HOOKS_FILE);
|
|
114
|
+
const scriptPath = path.join(targetRoot, HOOK_SCRIPT);
|
|
115
|
+
const hooksOwnershipPath = path.join(targetRoot, HOOKS_OWNERSHIP_MARKER);
|
|
116
|
+
const pluginPath = path.join(targetRoot, PLUGIN_MANIFEST);
|
|
117
|
+
const pluginOwnershipPath = path.join(targetRoot, PLUGIN_OWNERSHIP_MARKER);
|
|
118
|
+
const assetPath = fileURLToPath(new URL('./assets/prizmkit-hook.cjs', import.meta.url));
|
|
119
|
+
|
|
120
|
+
const hooksFileExisted = existsSync(hooksPath);
|
|
121
|
+
const pluginFileExisted = existsSync(pluginPath);
|
|
122
|
+
const existingHooks = await readJsonObject(hooksPath, 'hooks');
|
|
123
|
+
const existingPlugin = await readJsonObject(pluginPath, 'plugin manifest');
|
|
124
|
+
|
|
125
|
+
const mergedHooks = mergeAntigravityHooks(existingHooks);
|
|
126
|
+
const version = String(options.version || existingPlugin.version || '1.0.0');
|
|
127
|
+
const nextPlugin = (!pluginFileExisted || existsSync(pluginOwnershipPath))
|
|
128
|
+
? {
|
|
129
|
+
name: 'prizmkit',
|
|
130
|
+
description: DEFAULT_PLUGIN_DESCRIPTION,
|
|
131
|
+
version,
|
|
132
|
+
}
|
|
133
|
+
: {
|
|
134
|
+
...existingPlugin,
|
|
135
|
+
name: 'prizmkit',
|
|
136
|
+
description: existingPlugin.description || DEFAULT_PLUGIN_DESCRIPTION,
|
|
137
|
+
version,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
mkdirSync(path.dirname(hooksPath), { recursive: true });
|
|
141
|
+
mkdirSync(path.dirname(scriptPath), { recursive: true });
|
|
142
|
+
await writeFile(hooksPath, `${JSON.stringify(mergedHooks, null, 2)}\n`);
|
|
143
|
+
await writeFile(pluginPath, `${JSON.stringify(nextPlugin, null, 2)}\n`);
|
|
144
|
+
if (!hooksFileExisted) {
|
|
145
|
+
await writeFile(hooksOwnershipPath, 'PrizmKit created .agents/plugins/prizmkit/hooks.json\n');
|
|
146
|
+
}
|
|
147
|
+
if (!pluginFileExisted) {
|
|
148
|
+
await writeFile(pluginOwnershipPath, 'PrizmKit created .agents/plugins/prizmkit/plugin.json\n');
|
|
149
|
+
}
|
|
150
|
+
await copyFile(assetPath, scriptPath);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export async function removeHooks(targetRoot, dryRun = false) {
|
|
154
|
+
const hooksPath = path.join(targetRoot, HOOKS_FILE);
|
|
155
|
+
const scriptPath = path.join(targetRoot, HOOK_SCRIPT);
|
|
156
|
+
const hooksOwnershipPath = path.join(targetRoot, HOOKS_OWNERSHIP_MARKER);
|
|
157
|
+
const pluginPath = path.join(targetRoot, PLUGIN_MANIFEST);
|
|
158
|
+
const pluginOwnershipPath = path.join(targetRoot, PLUGIN_OWNERSHIP_MARKER);
|
|
159
|
+
const affected = [];
|
|
160
|
+
|
|
161
|
+
if (existsSync(hooksPath)) {
|
|
162
|
+
const existing = await readJsonObject(hooksPath, 'hooks');
|
|
163
|
+
const next = removeManagedAntigravityHooks(existing);
|
|
164
|
+
const removeCreatedFile = Object.keys(next).length === 0 && existsSync(hooksOwnershipPath);
|
|
165
|
+
if (removeCreatedFile || JSON.stringify(next) !== JSON.stringify(existing)) {
|
|
166
|
+
affected.push({ path: HOOKS_FILE, action: removeCreatedFile ? 'removed' : 'updated' });
|
|
167
|
+
if (!dryRun) {
|
|
168
|
+
if (removeCreatedFile) await rm(hooksPath, { force: true });
|
|
169
|
+
else await writeFile(hooksPath, `${JSON.stringify(next, null, 2)}\n`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (existsSync(pluginPath)) {
|
|
175
|
+
const existingPlugin = await readJsonObject(pluginPath, 'plugin manifest');
|
|
176
|
+
if (existsSync(pluginOwnershipPath) || isManagedPluginManifest(existingPlugin)) {
|
|
177
|
+
affected.push({ path: PLUGIN_MANIFEST, action: 'removed' });
|
|
178
|
+
if (!dryRun) await rm(pluginPath, { force: true });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (existsSync(scriptPath)) {
|
|
183
|
+
affected.push({ path: HOOK_SCRIPT, action: 'removed' });
|
|
184
|
+
if (!dryRun) await rm(scriptPath, { force: true });
|
|
185
|
+
}
|
|
186
|
+
if (existsSync(hooksOwnershipPath)) {
|
|
187
|
+
affected.push({ path: HOOKS_OWNERSHIP_MARKER, action: 'removed' });
|
|
188
|
+
if (!dryRun) await rm(hooksOwnershipPath, { force: true });
|
|
189
|
+
}
|
|
190
|
+
if (existsSync(pluginOwnershipPath)) {
|
|
191
|
+
affected.push({ path: PLUGIN_OWNERSHIP_MARKER, action: 'removed' });
|
|
192
|
+
if (!dryRun) await rm(pluginOwnershipPath, { force: true });
|
|
193
|
+
}
|
|
194
|
+
return affected;
|
|
195
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Antigravity workspace plugin path constants and conventions. */
|
|
2
|
+
export const PLATFORM_ID = 'antigravity';
|
|
3
|
+
export const CLI_COMMAND = 'agy';
|
|
4
|
+
export const PLUGIN_DIR = '.agents/plugins/prizmkit';
|
|
5
|
+
export const PLUGIN_MANIFEST = '.agents/plugins/prizmkit/plugin.json';
|
|
6
|
+
export const SKILLS_DIR = '.agents/plugins/prizmkit/skills';
|
|
7
|
+
export const RULES_DIR = '.agents/plugins/prizmkit/rules';
|
|
8
|
+
export const HOOKS_FILE = '.agents/plugins/prizmkit/hooks.json';
|
|
9
|
+
export const HOOK_SCRIPT = '.agents/plugins/prizmkit/hooks/prizmkit-hook.cjs';
|
|
10
|
+
export const HOOKS_OWNERSHIP_MARKER = '.agents/plugins/prizmkit/hooks/.prizmkit-created-hooks-json';
|
|
11
|
+
export const PLUGIN_OWNERSHIP_MARKER = '.agents/plugins/prizmkit/hooks/.prizmkit-created-plugin-json';
|
|
12
|
+
export const FRAMEWORK_RULE_FILE = 'prizmkit-framework.md';
|
|
13
|
+
export const SKILL_DEFINITION_FILE = 'SKILL.md';
|
|
14
|
+
export const SKILL_DIR_VAR = '${SKILL_DIR}';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Convert canonical PrizmKit guidance to Antigravity workspace plugin Rules. */
|
|
2
|
+
import { mkdirSync } from 'node:fs';
|
|
3
|
+
import { writeFile } from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
6
|
+
import { FRAMEWORK_RULE_FILE, RULES_DIR, SKILLS_DIR } from './paths.js';
|
|
7
|
+
|
|
8
|
+
export function convertToAntigravityRule(markdown, fallbackDescription) {
|
|
9
|
+
const { frontmatter, body } = parseFrontmatter(markdown);
|
|
10
|
+
const description = String(frontmatter.description || fallbackDescription || 'PrizmKit project guidance');
|
|
11
|
+
const globs = typeof frontmatter.globs === 'string' ? frontmatter.globs.trim() : '';
|
|
12
|
+
const ruleFrontmatter = globs
|
|
13
|
+
? {
|
|
14
|
+
trigger: 'glob',
|
|
15
|
+
globs,
|
|
16
|
+
description,
|
|
17
|
+
}
|
|
18
|
+
: {
|
|
19
|
+
trigger: 'always_on',
|
|
20
|
+
description,
|
|
21
|
+
};
|
|
22
|
+
return buildMarkdown(ruleFrontmatter, body);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function installRules(targetRoot, ruleFiles) {
|
|
26
|
+
const rulesDir = path.join(targetRoot, RULES_DIR);
|
|
27
|
+
mkdirSync(rulesDir, { recursive: true });
|
|
28
|
+
for (const rule of ruleFiles) {
|
|
29
|
+
const baseName = path.basename(rule.name);
|
|
30
|
+
await writeFile(
|
|
31
|
+
path.join(rulesDir, `${baseName}.md`),
|
|
32
|
+
convertToAntigravityRule(rule.content, rule.name),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function installFrameworkGuidance(targetRoot, templateContent) {
|
|
38
|
+
const rulesDir = path.join(targetRoot, RULES_DIR);
|
|
39
|
+
mkdirSync(rulesDir, { recursive: true });
|
|
40
|
+
const body = templateContent.replace(
|
|
41
|
+
'### Available Commands\nRun `/prizmkit` to see all available PrizmKit commands.',
|
|
42
|
+
`### Available PrizmKit Skills
|
|
43
|
+
Antigravity discovers project Skills from \`${SKILLS_DIR}/\`. Invoke them with \`/<name>\` (for example \`/prizmkit-plan\`).
|
|
44
|
+
|
|
45
|
+
- Start with \`/prizmkit\` to see all available PrizmKit skills.
|
|
46
|
+
- Skill assets and references live inside each \`${SKILLS_DIR}/<skill>/\` directory.
|
|
47
|
+
- PrizmKit behavioral rules live in \`${RULES_DIR}/\`; read the relevant Rule before commit, documentation, or context-loading work.
|
|
48
|
+
`,
|
|
49
|
+
);
|
|
50
|
+
await writeFile(
|
|
51
|
+
path.join(rulesDir, FRAMEWORK_RULE_FILE),
|
|
52
|
+
convertToAntigravityRule(body, 'PrizmKit framework guidance for Antigravity project sessions'),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Convert canonical PrizmKit Skills to Antigravity workspace plugin Skills. */
|
|
2
|
+
import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
3
|
+
import { SKILLS_DIR } from './paths.js';
|
|
4
|
+
|
|
5
|
+
function applyAntigravityInteractionCompatibility(content) {
|
|
6
|
+
const fallback =
|
|
7
|
+
"Use Antigravity's `ask_question` tool when it is available. If it is unavailable in the current surface, ask the same question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults.";
|
|
8
|
+
return content
|
|
9
|
+
.replace(
|
|
10
|
+
/Use `AskUserQuestion`; do not render path options as plain text\./g,
|
|
11
|
+
fallback,
|
|
12
|
+
)
|
|
13
|
+
.replace(
|
|
14
|
+
/Do NOT render options as plain text — the user must be able to click\/select\./g,
|
|
15
|
+
fallback,
|
|
16
|
+
)
|
|
17
|
+
.replace(
|
|
18
|
+
/Do NOT render options as plain text \(e\.g\., `\[A\] option \[B\] option`\) — the user must be able to click\/select, not type a letter\./g,
|
|
19
|
+
fallback,
|
|
20
|
+
)
|
|
21
|
+
.replace(/`AskUserQuestion`/g, "Antigravity's `ask_question` tool")
|
|
22
|
+
.replace(/\bAskUserQuestion\b/g, "Antigravity's `ask_question` tool");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function convertSkillReference(content, skillName) {
|
|
26
|
+
return applyAntigravityInteractionCompatibility(content)
|
|
27
|
+
.replace(/\$\{SKILL_DIR\}/g, `${SKILLS_DIR}/${skillName}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function convertSkill(skillContent, skillName) {
|
|
31
|
+
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
32
|
+
if (!frontmatter.name) frontmatter.name = skillName;
|
|
33
|
+
|
|
34
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
35
|
+
const note = `> Antigravity project install: Antigravity discovers this Skill from \`${SKILLS_DIR}/${skillName}/SKILL.md\`. Invoke it as \`/${skillName}\` when manual invocation is needed.\n>\n> Antigravity interaction compatibility: use Antigravity's \`ask_question\` tool when available. If the current surface does not expose it, ask the same required question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults. Only true headless runs with no conversational user may use documented conservative defaults.\n\n`;
|
|
36
|
+
|
|
37
|
+
return buildMarkdown(frontmatter, note + convertedBody);
|
|
38
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
10
10
|
import { SKILL_DEFINITION_FILE } from './paths.js';
|
|
11
11
|
import { existsSync, mkdirSync, cpSync, readdirSync } from 'node:fs';
|
|
12
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
12
|
+
import { readdir, readFile, writeFile } from 'node:fs/promises';
|
|
13
13
|
import path from 'path';
|
|
14
14
|
|
|
15
15
|
function toCodexSkillReference(commandName) {
|
|
@@ -35,17 +35,13 @@ function applyCodexInteractionCompatibility(content) {
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!frontmatter.name) frontmatter.name = skillName;
|
|
42
|
-
|
|
43
|
-
let convertedBody = applyCodexInteractionCompatibility(body).replace(
|
|
38
|
+
export function convertSkillReference(content, skillName) {
|
|
39
|
+
let converted = applyCodexInteractionCompatibility(content).replace(
|
|
44
40
|
/\$\{SKILL_DIR\}/g,
|
|
45
41
|
`.agents/skills/${skillName}`
|
|
46
42
|
);
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
converted = converted.replace(
|
|
49
45
|
/prizmkit\.(\w+)/g,
|
|
50
46
|
(_match, sub) => {
|
|
51
47
|
const commandName = `prizmkit-${sub.replace(/_/g, '-')}`;
|
|
@@ -53,11 +49,34 @@ export function convertSkill(skillContent, skillName) {
|
|
|
53
49
|
}
|
|
54
50
|
);
|
|
55
51
|
|
|
52
|
+
return converted;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function convertSkill(skillContent, skillName) {
|
|
56
|
+
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
57
|
+
|
|
58
|
+
if (!frontmatter.name) frontmatter.name = skillName;
|
|
59
|
+
|
|
60
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
61
|
+
|
|
56
62
|
const codexNote = `> Codex project install: an explicitly named PrizmKit Skill resolves to the same command name under \`.agents/skills/<command-name>/SKILL.md\`.\n>\n> Codex interaction compatibility: when this skill or any referenced PrizmKit file says \`AskUserQuestion\`, use Codex \`request_user_input\` if it is available. If the current Codex surface does not expose \`request_user_input\`, including Default mode, ask the same question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults. If a source instruction asks more questions than Codex allows in one call, split them into multiple calls while preserving order. Only true headless/non-interactive runs, such as \`codex exec\` automation with no conversational user available, may skip interaction and choose documented defaults; never silently choose defaults in an interactive session.\n\n`;
|
|
57
63
|
|
|
58
64
|
return buildMarkdown(frontmatter, codexNote + convertedBody);
|
|
59
65
|
}
|
|
60
66
|
|
|
67
|
+
async function convertReferenceMarkdownDir(dirPath, skillName) {
|
|
68
|
+
if (!existsSync(dirPath)) return;
|
|
69
|
+
for (const entry of await readdir(dirPath, { withFileTypes: true })) {
|
|
70
|
+
const entryPath = path.join(dirPath, entry.name);
|
|
71
|
+
if (entry.isDirectory()) {
|
|
72
|
+
await convertReferenceMarkdownDir(entryPath, skillName);
|
|
73
|
+
} else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
74
|
+
const raw = await readFile(entryPath, 'utf8');
|
|
75
|
+
await writeFile(entryPath, convertSkillReference(raw, skillName), 'utf8');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
61
80
|
export async function installSkill(corePath, targetRoot) {
|
|
62
81
|
const skillName = path.basename(corePath);
|
|
63
82
|
const targetDir = path.join(targetRoot, '.agents', 'skills', skillName);
|
|
@@ -80,5 +99,6 @@ export async function installSkill(corePath, targetRoot) {
|
|
|
80
99
|
);
|
|
81
100
|
}
|
|
82
101
|
}
|
|
102
|
+
await convertReferenceMarkdownDir(path.join(targetDir, 'references'), skillName);
|
|
83
103
|
}
|
|
84
104
|
}
|
|
@@ -4,7 +4,10 @@ import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
|
4
4
|
function applyCursorInteractionCompatibility(content) {
|
|
5
5
|
const fallback = 'Use Cursor\'s Ask Questions capability when it is available. If it is unavailable in the current surface, ask the same question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults.';
|
|
6
6
|
return content
|
|
7
|
-
.replace(
|
|
7
|
+
.replace(
|
|
8
|
+
/Use `AskUserQuestion`; do not render path options as plain text\./g,
|
|
9
|
+
fallback,
|
|
10
|
+
)
|
|
8
11
|
.replace(
|
|
9
12
|
/Do NOT render options as plain text — the user must be able to click\/select\./g,
|
|
10
13
|
fallback,
|
|
@@ -12,15 +15,21 @@ function applyCursorInteractionCompatibility(content) {
|
|
|
12
15
|
.replace(
|
|
13
16
|
/Do NOT render options as plain text \(e\.g\., `\[A\] option \[B\] option`\) — the user must be able to click\/select, not type a letter\./g,
|
|
14
17
|
fallback,
|
|
15
|
-
)
|
|
18
|
+
)
|
|
19
|
+
.replace(/`AskUserQuestion`/g, "Cursor's Ask Questions capability")
|
|
20
|
+
.replace(/\bAskUserQuestion\b/g, "Cursor's Ask Questions capability");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function convertSkillReference(content, skillName) {
|
|
24
|
+
return applyCursorInteractionCompatibility(content)
|
|
25
|
+
.replace(/\$\{SKILL_DIR\}/g, `.cursor/skills/${skillName}`);
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
export function convertSkill(skillContent, skillName) {
|
|
19
29
|
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
20
30
|
if (!frontmatter.name) frontmatter.name = skillName;
|
|
21
31
|
|
|
22
|
-
const convertedBody =
|
|
23
|
-
.replace(/\$\{SKILL_DIR\}/g, `.cursor/skills/${skillName}`);
|
|
32
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
24
33
|
const note = `> Cursor project install: Cursor discovers this Agent Skill from \`.cursor/skills/${skillName}/SKILL.md\`. Invoke it as \`/${skillName}\` when manual invocation is needed.\n>\n> Cursor interaction compatibility: use Cursor's Ask Questions capability when available. If the current Cursor surface does not expose it, ask the same required question directly in chat and wait for explicit user input. Tool unavailability is not permission to choose defaults. Only true headless runs with no conversational user may use documented conservative defaults.\n\n`;
|
|
25
34
|
|
|
26
35
|
return buildMarkdown(frontmatter, note + convertedBody);
|
|
@@ -2,18 +2,39 @@
|
|
|
2
2
|
import { parseFrontmatter, buildMarkdown } from '../shared/frontmatter.js';
|
|
3
3
|
|
|
4
4
|
function applyPiInteractionCompatibility(content) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const chatFallback =
|
|
6
|
+
'Ask the same options directly in chat and wait for an explicit answer. Do not choose defaults silently.';
|
|
7
|
+
return content
|
|
8
|
+
.replace(
|
|
9
|
+
/Use `AskUserQuestion`; do not render path options as plain text\./g,
|
|
10
|
+
chatFallback,
|
|
11
|
+
)
|
|
12
|
+
.replace(
|
|
13
|
+
/Do NOT render options as plain text[^\n]*\./g,
|
|
14
|
+
chatFallback,
|
|
15
|
+
)
|
|
16
|
+
.replace(/clickable options, never plain text; /g, 'explicit choices in chat; ')
|
|
17
|
+
.replace(/\(never plain text; /g, '(wait for explicit choice in chat; ')
|
|
18
|
+
.replace(
|
|
19
|
+
/`AskUserQuestion`/g,
|
|
20
|
+
'ask the same question directly in chat and wait for explicit user input',
|
|
21
|
+
)
|
|
22
|
+
.replace(
|
|
23
|
+
/\bAskUserQuestion\b/g,
|
|
24
|
+
'ask the same question directly in chat and wait for explicit user input',
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function convertSkillReference(content, skillName) {
|
|
29
|
+
return applyPiInteractionCompatibility(content)
|
|
30
|
+
.replace(/\/(prizmkit-[a-z0-9-]+)/g, '/skill:$1')
|
|
31
|
+
.replace(/\$\{SKILL_DIR\}/g, `.pi/skills/${skillName}`);
|
|
9
32
|
}
|
|
10
33
|
|
|
11
34
|
export function convertSkill(skillContent, skillName) {
|
|
12
35
|
const { frontmatter, body } = parseFrontmatter(skillContent);
|
|
13
36
|
if (!frontmatter.name) frontmatter.name = skillName;
|
|
14
|
-
const convertedBody =
|
|
15
|
-
.replace(/\/(prizmkit-[a-z0-9-]+)/g, '/skill:$1')
|
|
16
|
-
.replace(/\$\{SKILL_DIR\}/g, `.pi/skills/${skillName}`);
|
|
37
|
+
const convertedBody = convertSkillReference(body, skillName);
|
|
17
38
|
const note = `> Pi project install: invoke this skill with \`/skill:${skillName}\`. An explicitly named PrizmKit Skill uses \`/skill:<same-name>\` and its project definition at \`.pi/skills/<same-name>/SKILL.md\`.\n>\n> Pi interaction compatibility: in interactive sessions, ask required questions directly in chat and wait for explicit user input. Only true headless runs may use documented conservative defaults.\n\n`;
|
|
18
39
|
return buildMarkdown(frontmatter, note + convertedBody);
|
|
19
40
|
}
|