@urielsh/prodify 0.1.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/.prodify/AGENTS.md +56 -0
- package/.prodify/README.md +10 -0
- package/.prodify/artifacts/01-understand.md +28 -0
- package/.prodify/artifacts/02-diagnose.md +26 -0
- package/.prodify/artifacts/03-architecture.md +30 -0
- package/.prodify/artifacts/04-plan.md +35 -0
- package/.prodify/artifacts/05-refactor.md +24 -0
- package/.prodify/artifacts/06-validate.md +17 -0
- package/.prodify/artifacts/README.md +6 -0
- package/.prodify/artifacts/architecture_spec.md +29 -0
- package/.prodify/artifacts/artifact-validation-design.md +276 -0
- package/.prodify/artifacts/cli-command-design.md +299 -0
- package/.prodify/artifacts/completed-steps-tracking.md +201 -0
- package/.prodify/artifacts/diagnostic_report.md +45 -0
- package/.prodify/artifacts/hardening-patch-summary.md +57 -0
- package/.prodify/artifacts/hardening-verification-report.md +48 -0
- package/.prodify/artifacts/implementation_summary.md +19 -0
- package/.prodify/artifacts/improvement-evaluation-spec.md +148 -0
- package/.prodify/artifacts/next-step-resolver-design.md +570 -0
- package/.prodify/artifacts/orientation_map.md +32 -0
- package/.prodify/artifacts/persona-removal-audit.md +106 -0
- package/.prodify/artifacts/planning-alignment-report.md +189 -0
- package/.prodify/artifacts/refactor-plan-template-hardening.md +83 -0
- package/.prodify/artifacts/refactor-validate-loop-design.md +231 -0
- package/.prodify/artifacts/refactor_plan.md +21 -0
- package/.prodify/artifacts/refactor_plan.strict-example.md +31 -0
- package/.prodify/artifacts/run-state-design.md +292 -0
- package/.prodify/artifacts/run-summary-spec.md +149 -0
- package/.prodify/artifacts/run_state.json +14 -0
- package/.prodify/artifacts/sample-repo-test-plan.md +129 -0
- package/.prodify/artifacts/status-output-spec.md +349 -0
- package/.prodify/artifacts/step-selection-design.md +251 -0
- package/.prodify/artifacts/task-dispatcher-design.md +266 -0
- package/.prodify/artifacts/task-header-audit.md +42 -0
- package/.prodify/artifacts/task-log-enhancement-spec.md +264 -0
- package/.prodify/artifacts/task-protocol-hardening-plan.md +68 -0
- package/.prodify/artifacts/task-self-validation-spec.md +171 -0
- package/.prodify/artifacts/task_log.json +160 -0
- package/.prodify/artifacts/template-usage-audit.md +20 -0
- package/.prodify/artifacts/validation_report.md +22 -0
- package/.prodify/contracts/README.md +3 -0
- package/.prodify/contracts/architecture.contract.json +42 -0
- package/.prodify/contracts/diagnose.contract.json +42 -0
- package/.prodify/contracts/plan.contract.json +42 -0
- package/.prodify/contracts/refactor.contract.json +45 -0
- package/.prodify/contracts/understand.contract.json +42 -0
- package/.prodify/contracts/validate.contract.json +52 -0
- package/.prodify/contracts-src/README.md +4 -0
- package/.prodify/contracts-src/architecture.contract.md +29 -0
- package/.prodify/contracts-src/diagnose.contract.md +29 -0
- package/.prodify/contracts-src/plan.contract.md +29 -0
- package/.prodify/contracts-src/refactor.contract.md +32 -0
- package/.prodify/contracts-src/understand.contract.md +29 -0
- package/.prodify/contracts-src/validate.contract.md +35 -0
- package/.prodify/metrics/README.md +4 -0
- package/.prodify/planning.md +13 -0
- package/.prodify/project.md +15 -0
- package/.prodify/rules/01-global-operating-rules.md +21 -0
- package/.prodify/rules/02-analysis-discipline.md +17 -0
- package/.prodify/rules/03-diagnosis-severity-rules.md +42 -0
- package/.prodify/rules/04-architecture-rules.md +27 -0
- package/.prodify/rules/05-planning-rules.md +23 -0
- package/.prodify/rules/06-refactor-rules.md +20 -0
- package/.prodify/rules/07-validation-rules.md +25 -0
- package/.prodify/rules/08-output-format-rules.md +20 -0
- package/.prodify/rules/09-template-usage-rules.md +11 -0
- package/.prodify/rules/10-artifact-flow-and-orchestration-rules.md +40 -0
- package/.prodify/rules/README.md +3 -0
- package/.prodify/rules/example-rule.md +4 -0
- package/.prodify/runtime-commands.md +57 -0
- package/.prodify/skills/README.md +8 -0
- package/.prodify/skills/domain/react-frontend.skill.json +34 -0
- package/.prodify/skills/domain/typescript-backend.skill.json +34 -0
- package/.prodify/skills/quality-policy/maintainability-review.skill.json +25 -0
- package/.prodify/skills/quality-policy/security-hardening.skill.json +32 -0
- package/.prodify/skills/quality-policy/test-hardening.skill.json +23 -0
- package/.prodify/skills/registry.json +16 -0
- package/.prodify/skills/stage-method/architecture-method.skill.json +22 -0
- package/.prodify/skills/stage-method/codebase-scanning.skill.json +22 -0
- package/.prodify/skills/stage-method/diagnosis-method.skill.json +22 -0
- package/.prodify/skills/stage-method/planning-method.skill.json +22 -0
- package/.prodify/skills/stage-method/refactoring-method.skill.json +22 -0
- package/.prodify/skills/stage-method/validation-method.skill.json +22 -0
- package/.prodify/state.json +30 -0
- package/.prodify/tasks/01-understand.md +83 -0
- package/.prodify/tasks/02-diagnose.md +67 -0
- package/.prodify/tasks/03-architecture.md +70 -0
- package/.prodify/tasks/04-plan.md +71 -0
- package/.prodify/tasks/05-refactor.md +61 -0
- package/.prodify/tasks/06-validate.md +69 -0
- package/.prodify/tasks/README.md +3 -0
- package/.prodify/tasks/example-task.md +13 -0
- package/.prodify/templates/01-understand.template.md +18 -0
- package/.prodify/templates/02-diagnose.template.md +18 -0
- package/.prodify/templates/03-architecture.template.md +18 -0
- package/.prodify/templates/04-plan.template.md +22 -0
- package/.prodify/templates/05-refactor.template.md +19 -0
- package/.prodify/templates/06-validate.template.md +16 -0
- package/.prodify/templates/README.md +3 -0
- package/.prodify/templates/architecture_spec.template.md +29 -0
- package/.prodify/templates/diagnostic_report.template.md +45 -0
- package/.prodify/templates/example.template.md +5 -0
- package/.prodify/templates/implementation_summary.template.md +19 -0
- package/.prodify/templates/orientation_map.template.md +32 -0
- package/.prodify/templates/refactor_plan.template.md +24 -0
- package/.prodify/templates/validation_report.template.md +22 -0
- package/.prodify/version.json +5 -0
- package/AGENTS.md +305 -0
- package/LICENSE +201 -0
- package/README.md +118 -0
- package/assets/presets/default/canonical/AGENTS.md +54 -0
- package/assets/presets/default/canonical/artifacts/README.md +6 -0
- package/assets/presets/default/canonical/contracts-src/README.md +4 -0
- package/assets/presets/default/canonical/contracts-src/architecture.contract.md +56 -0
- package/assets/presets/default/canonical/contracts-src/diagnose.contract.md +49 -0
- package/assets/presets/default/canonical/contracts-src/plan.contract.md +42 -0
- package/assets/presets/default/canonical/contracts-src/refactor.contract.md +54 -0
- package/assets/presets/default/canonical/contracts-src/understand.contract.md +56 -0
- package/assets/presets/default/canonical/contracts-src/validate.contract.md +64 -0
- package/assets/presets/default/canonical/metrics/README.md +4 -0
- package/assets/presets/default/canonical/planning.md +13 -0
- package/assets/presets/default/canonical/project.md +15 -0
- package/assets/presets/default/canonical/rules/README.md +3 -0
- package/assets/presets/default/canonical/rules/example-rule.md +4 -0
- package/assets/presets/default/canonical/runtime-commands.md +57 -0
- package/assets/presets/default/canonical/skills/README.md +8 -0
- package/assets/presets/default/canonical/skills/domain/react-frontend.skill.json +34 -0
- package/assets/presets/default/canonical/skills/domain/typescript-backend.skill.json +34 -0
- package/assets/presets/default/canonical/skills/quality-policy/maintainability-review.skill.json +25 -0
- package/assets/presets/default/canonical/skills/quality-policy/security-hardening.skill.json +32 -0
- package/assets/presets/default/canonical/skills/quality-policy/test-hardening.skill.json +23 -0
- package/assets/presets/default/canonical/skills/registry.json +16 -0
- package/assets/presets/default/canonical/skills/stage-method/architecture-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/codebase-scanning.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/diagnosis-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/planning-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/refactoring-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/validation-method.skill.json +22 -0
- package/assets/presets/default/canonical/state.json +30 -0
- package/assets/presets/default/canonical/tasks/README.md +3 -0
- package/assets/presets/default/canonical/tasks/example-task.md +13 -0
- package/assets/presets/default/canonical/templates/README.md +3 -0
- package/assets/presets/default/canonical/templates/example.template.md +5 -0
- package/assets/presets/default/preset.json +5 -0
- package/dist/cli.js +53 -0
- package/dist/commands/doctor.js +16 -0
- package/dist/commands/init.js +30 -0
- package/dist/commands/install.js +27 -0
- package/dist/commands/setup-agent.js +23 -0
- package/dist/commands/status.js +28 -0
- package/dist/commands/sync.js +29 -0
- package/dist/commands/update.js +18 -0
- package/dist/contracts/compiled-schema.js +37 -0
- package/dist/contracts/compiler.js +83 -0
- package/dist/contracts/freshness.js +52 -0
- package/dist/contracts/index.js +5 -0
- package/dist/contracts/parser.js +201 -0
- package/dist/contracts/schema.js +138 -0
- package/dist/contracts/source-schema.js +111 -0
- package/dist/core/agent-runtime.js +36 -0
- package/dist/core/agent-setup.js +111 -0
- package/dist/core/doctor.js +155 -0
- package/dist/core/errors.js +19 -0
- package/dist/core/flow-state.js +262 -0
- package/dist/core/fs.js +50 -0
- package/dist/core/install.js +44 -0
- package/dist/core/managed-files.js +106 -0
- package/dist/core/paths.js +56 -0
- package/dist/core/preset-validation.js +43 -0
- package/dist/core/prompt-builder.js +63 -0
- package/dist/core/repo-context.js +77 -0
- package/dist/core/repo-root.js +55 -0
- package/dist/core/skill-resolution.js +123 -0
- package/dist/core/state.js +220 -0
- package/dist/core/status.js +293 -0
- package/dist/core/sync.js +63 -0
- package/dist/core/targets.js +48 -0
- package/dist/core/upgrade.js +57 -0
- package/dist/core/validation.js +138 -0
- package/dist/core/version-checks.js +35 -0
- package/dist/generators/claude.js +14 -0
- package/dist/generators/codex.js +14 -0
- package/dist/generators/copilot.js +29 -0
- package/dist/generators/header.js +13 -0
- package/dist/generators/opencode.js +14 -0
- package/dist/generators/shared.js +37 -0
- package/dist/index.js +9 -0
- package/dist/legacy/targets.js +55 -0
- package/dist/presets/default.js +3 -0
- package/dist/presets/loader.js +34 -0
- package/dist/presets/version.js +18 -0
- package/dist/scoring/model.js +262 -0
- package/dist/skills/loader.js +40 -0
- package/dist/skills/schema.js +159 -0
- package/dist/types.js +1 -0
- package/docs/canonical-prodify-layout.md +87 -0
- package/docs/claude-support.md +22 -0
- package/docs/cli-doctor-spec.md +52 -0
- package/docs/cli-init-spec.md +70 -0
- package/docs/cli-install-agent-spec.md +48 -0
- package/docs/cli-sync-spec.md +40 -0
- package/docs/codex-support.md +24 -0
- package/docs/compatibility-targets.md +59 -0
- package/docs/copilot-support.md +30 -0
- package/docs/default-preset.md +47 -0
- package/docs/generated-file-headers.md +45 -0
- package/docs/generation-rules.md +94 -0
- package/docs/idempotency-guarantees.md +31 -0
- package/docs/managed-file-detection.md +45 -0
- package/docs/manual-edit-conflicts.md +37 -0
- package/docs/opencode-support.md +27 -0
- package/docs/ownership-rules.md +39 -0
- package/docs/path-resolution-rules.md +40 -0
- package/docs/preset-structure.md +49 -0
- package/docs/skill-system.md +67 -0
- package/docs/versioning-and-upgrade-strategy.md +40 -0
- package/package.json +22 -0
- package/src/README.md +11 -0
- package/src/cli.ts +61 -0
- package/src/commands/doctor.ts +20 -0
- package/src/commands/init.ts +37 -0
- package/src/commands/setup-agent.ts +28 -0
- package/src/commands/status.ts +34 -0
- package/src/commands/update.ts +23 -0
- package/src/contracts/README.md +10 -0
- package/src/contracts/compiled-schema.ts +42 -0
- package/src/contracts/compiler.ts +111 -0
- package/src/contracts/freshness.ts +58 -0
- package/src/contracts/index.ts +11 -0
- package/src/contracts/parser.ts +253 -0
- package/src/contracts/source-schema.ts +141 -0
- package/src/core/agent-runtime.ts +53 -0
- package/src/core/agent-setup.ts +147 -0
- package/src/core/doctor.ts +171 -0
- package/src/core/errors.ts +28 -0
- package/src/core/flow-state.ts +333 -0
- package/src/core/fs.ts +59 -0
- package/src/core/paths.ts +63 -0
- package/src/core/preset-validation.ts +47 -0
- package/src/core/prompt-builder.ts +73 -0
- package/src/core/repo-context.ts +93 -0
- package/src/core/repo-root.ts +74 -0
- package/src/core/skill-resolution.ts +151 -0
- package/src/core/state.ts +264 -0
- package/src/core/status.ts +372 -0
- package/src/core/targets.ts +53 -0
- package/src/core/upgrade.ts +66 -0
- package/src/core/validation.ts +233 -0
- package/src/core/version-checks.ts +40 -0
- package/src/index.ts +13 -0
- package/src/presets/default.ts +7 -0
- package/src/presets/loader.ts +46 -0
- package/src/presets/version.ts +31 -0
- package/src/scoring/model.ts +332 -0
- package/src/skills/loader.ts +58 -0
- package/src/skills/schema.ts +197 -0
- package/src/types.ts +329 -0
- package/tests/integration/cli-flows.test.js +347 -0
- package/tests/unit/agent-setup.test.js +81 -0
- package/tests/unit/cli.test.js +28 -0
- package/tests/unit/contracts.test.js +61 -0
- package/tests/unit/helpers.js +28 -0
- package/tests/unit/paths.test.js +52 -0
- package/tests/unit/preset-loader.test.js +37 -0
- package/tests/unit/scoring.test.js +65 -0
- package/tests/unit/self-hosted-workspace.test.js +22 -0
- package/tests/unit/skills.test.js +115 -0
- package/tests/unit/state-and-flow.test.js +120 -0
- package/tests/unit/targets.test.js +13 -0
- package/tests/unit/validation.test.js +73 -0
- package/tests/unit/version.test.js +24 -0
- package/tsconfig.json +23 -0
- package/urielsh-prodify-0.1.0.tgz +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Generated File Headers
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define a standard header block for every generated compatibility file.
|
|
5
|
+
|
|
6
|
+
## Required Header Content
|
|
7
|
+
Every generated file header must state:
|
|
8
|
+
- the file is generated by Prodify
|
|
9
|
+
- the canonical source file or files
|
|
10
|
+
- the agent target
|
|
11
|
+
- the command used to regenerate the file
|
|
12
|
+
- that manual edits may be overwritten
|
|
13
|
+
|
|
14
|
+
## Standard Markdown Header Template
|
|
15
|
+
|
|
16
|
+
```md
|
|
17
|
+
<!--
|
|
18
|
+
Generated by Prodify.
|
|
19
|
+
Target agent: <agent>
|
|
20
|
+
Canonical source: <relative path or comma-separated paths>
|
|
21
|
+
Regenerate with: prodify sync --agent <agent>
|
|
22
|
+
Manual edits may be overwritten.
|
|
23
|
+
-->
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage Rules
|
|
27
|
+
- The header must be the first content in the generated file.
|
|
28
|
+
- The header must use repository-relative paths.
|
|
29
|
+
- If multiple canonical sources are used, list them in deterministic order.
|
|
30
|
+
- The header must remain stable across repeated sync operations unless the source list or command changes.
|
|
31
|
+
|
|
32
|
+
## Header Variants
|
|
33
|
+
|
|
34
|
+
### Direct-Copy Targets
|
|
35
|
+
- Use the standard header.
|
|
36
|
+
- Follow immediately with the canonical markdown body.
|
|
37
|
+
|
|
38
|
+
### Transformed Targets
|
|
39
|
+
- Use the standard header.
|
|
40
|
+
- Keep the body valid for the destination format.
|
|
41
|
+
- Do not hide source provenance even when content is transformed.
|
|
42
|
+
|
|
43
|
+
## Compatibility Rule
|
|
44
|
+
- The header format must be valid inside markdown-based instruction files.
|
|
45
|
+
- HTML comment syntax is the default because it is broadly markdown-compatible and minimally intrusive.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Compatibility File Generation Rules
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Describe a possible future compatibility-file generation pipeline without treating it as active default behavior.
|
|
5
|
+
|
|
6
|
+
## Current Product Behavior
|
|
7
|
+
- The supported lifecycle bootstraps agents directly from `.prodify/AGENTS.md`.
|
|
8
|
+
- `prodify init` and `prodify update` do not generate compatibility files.
|
|
9
|
+
- The rules below are design notes for future or opt-in compatibility surfaces only.
|
|
10
|
+
|
|
11
|
+
## General Generation Pipeline
|
|
12
|
+
1. Resolve repository root.
|
|
13
|
+
2. Load canonical `.prodify/` sources required for the target.
|
|
14
|
+
3. Apply the target-specific mapping rules.
|
|
15
|
+
4. Prepend the standard generated-file header.
|
|
16
|
+
5. Normalize output formatting.
|
|
17
|
+
6. Write the managed compatibility file to the target path.
|
|
18
|
+
|
|
19
|
+
## Target Rules
|
|
20
|
+
|
|
21
|
+
### Codex
|
|
22
|
+
- Agent support status: `supported`
|
|
23
|
+
- Compatibility-file status: not enabled in the default flow
|
|
24
|
+
- Canonical sources:
|
|
25
|
+
- `.prodify/AGENTS.md`
|
|
26
|
+
- Output path:
|
|
27
|
+
- `AGENTS.md`
|
|
28
|
+
- Generation mode:
|
|
29
|
+
- direct copy with generated header
|
|
30
|
+
- Transformations:
|
|
31
|
+
- prepend standard generated header
|
|
32
|
+
- preserve markdown body exactly after the header
|
|
33
|
+
- Unsupported feature handling:
|
|
34
|
+
- do not imply this mode is active until a dedicated opt-in command exists
|
|
35
|
+
|
|
36
|
+
### Claude
|
|
37
|
+
- Agent support status: bootstrap path supported
|
|
38
|
+
- Compatibility-file status: planned
|
|
39
|
+
- Canonical sources:
|
|
40
|
+
- `.prodify/AGENTS.md`
|
|
41
|
+
- Output path:
|
|
42
|
+
- `CLAUDE.md`
|
|
43
|
+
- Generation mode:
|
|
44
|
+
- direct copy with generated header
|
|
45
|
+
- Transformations:
|
|
46
|
+
- prepend standard generated header
|
|
47
|
+
- optionally normalize the top-level title to match the output filename in a future revision
|
|
48
|
+
- Unsupported feature handling:
|
|
49
|
+
- emit a clear “planned target” note if generation is not yet enabled in the CLI
|
|
50
|
+
|
|
51
|
+
### Copilot
|
|
52
|
+
- Agent support status: bootstrap path supported
|
|
53
|
+
- Compatibility-file status: planned
|
|
54
|
+
- Canonical sources:
|
|
55
|
+
- `.prodify/AGENTS.md`
|
|
56
|
+
- `.prodify/project.md`
|
|
57
|
+
- Output path:
|
|
58
|
+
- `.github/copilot-instructions.md`
|
|
59
|
+
- Generation mode:
|
|
60
|
+
- transformed output with generated header
|
|
61
|
+
- Transformations:
|
|
62
|
+
- merge high-signal repository instructions from `.prodify/AGENTS.md`
|
|
63
|
+
- inject concise project context from `.prodify/project.md`
|
|
64
|
+
- omit orchestration details that are not useful in a static instruction file
|
|
65
|
+
- Unsupported feature handling:
|
|
66
|
+
- if required concise transformation rules are unavailable, stop instead of generating a lossy or ambiguous file
|
|
67
|
+
|
|
68
|
+
### OpenCode
|
|
69
|
+
- Agent support status: bootstrap path supported
|
|
70
|
+
- Compatibility-file status: experimental
|
|
71
|
+
- Canonical sources:
|
|
72
|
+
- `.prodify/AGENTS.md`
|
|
73
|
+
- Output path:
|
|
74
|
+
- `.opencode/AGENTS.md`
|
|
75
|
+
- Generation mode:
|
|
76
|
+
- direct copy with generated header
|
|
77
|
+
- Transformations:
|
|
78
|
+
- prepend standard generated header
|
|
79
|
+
- preserve canonical body by default
|
|
80
|
+
- Unsupported feature handling:
|
|
81
|
+
- clearly report the experimental status and provisional target path
|
|
82
|
+
|
|
83
|
+
## Shared Transformation Rules
|
|
84
|
+
- Generated files must keep markdown valid.
|
|
85
|
+
- Generated files must normalize line endings to LF.
|
|
86
|
+
- Generated files must preserve stable section order.
|
|
87
|
+
- Generation must be deterministic for identical inputs.
|
|
88
|
+
|
|
89
|
+
## Codex Reference Mapping
|
|
90
|
+
If compatibility-file generation is reintroduced, Codex remains the simplest reference mapping because it has:
|
|
91
|
+
- one canonical source file
|
|
92
|
+
- one explicit output path
|
|
93
|
+
- no required semantic transformation beyond the generated header
|
|
94
|
+
- a historically familiar repository-root instruction file pattern
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Idempotency Guarantees
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define what idempotent Prodify sync behavior means and how it is preserved.
|
|
5
|
+
|
|
6
|
+
## Idempotency Definition
|
|
7
|
+
For identical:
|
|
8
|
+
- canonical `.prodify/` sources
|
|
9
|
+
- generation rules
|
|
10
|
+
- target set
|
|
11
|
+
|
|
12
|
+
`prodify sync` must produce byte-identical generated files on repeated runs.
|
|
13
|
+
|
|
14
|
+
## Stability Constraints
|
|
15
|
+
- Section ordering must be deterministic.
|
|
16
|
+
- Multi-source canonical input order must be deterministic.
|
|
17
|
+
- Header field ordering must be deterministic.
|
|
18
|
+
- Line endings must be normalized to LF.
|
|
19
|
+
- Final newline behavior must be stable.
|
|
20
|
+
- Optional fingerprint metadata must be computed deterministically.
|
|
21
|
+
|
|
22
|
+
## Diff Prevention Rules
|
|
23
|
+
- Avoid timestamps in generated files.
|
|
24
|
+
- Avoid non-deterministic ordering from filesystem traversal.
|
|
25
|
+
- Avoid unstable whitespace changes.
|
|
26
|
+
- Do not rewrite unchanged managed files.
|
|
27
|
+
|
|
28
|
+
## Command Behavior
|
|
29
|
+
- A repeated `prodify sync` with unchanged inputs should report targets as unchanged.
|
|
30
|
+
- Meaningless diffs are a bug.
|
|
31
|
+
- `prodify doctor` should be able to confirm that a generated file already matches the expected output exactly.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Managed File Detection
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define how Prodify reliably identifies compatibility files it generated.
|
|
5
|
+
|
|
6
|
+
## Primary Detection Strategy
|
|
7
|
+
Prodify-managed files are identified by the standard generated-file header at the top of the file.
|
|
8
|
+
|
|
9
|
+
The header must include:
|
|
10
|
+
- `Generated by Prodify`
|
|
11
|
+
- target agent
|
|
12
|
+
- canonical source path or paths
|
|
13
|
+
- regenerate command
|
|
14
|
+
|
|
15
|
+
## Required Marker Semantics
|
|
16
|
+
- A file is managed only if all required header fields are present.
|
|
17
|
+
- Header fields must use repository-relative canonical source paths.
|
|
18
|
+
- Partial or malformed headers must not be treated as managed automatically.
|
|
19
|
+
|
|
20
|
+
## Optional Integrity Metadata
|
|
21
|
+
Prodify may include an additional metadata line in the header:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Body fingerprint: <stable hash>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If present, the fingerprint is computed from the generated body after the header is excluded.
|
|
28
|
+
|
|
29
|
+
## Detection Rules
|
|
30
|
+
|
|
31
|
+
### Managed
|
|
32
|
+
- Valid header present
|
|
33
|
+
- target maps to a known compatibility target
|
|
34
|
+
- canonical source paths are valid
|
|
35
|
+
|
|
36
|
+
### Unmanaged
|
|
37
|
+
- No Prodify header
|
|
38
|
+
- malformed header
|
|
39
|
+
- unknown target
|
|
40
|
+
- canonical source path cannot be resolved
|
|
41
|
+
|
|
42
|
+
## Reliability Rules
|
|
43
|
+
- Managed-file detection must be deterministic.
|
|
44
|
+
- Sync and doctor must use the same detection logic.
|
|
45
|
+
- Prodify must never silently “adopt” an unmanaged file based on loose heuristics.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Manual Edit Conflict Behavior
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define what happens when users manually edit generated compatibility files.
|
|
5
|
+
|
|
6
|
+
## Default Policy
|
|
7
|
+
- Canonical `.prodify/` files remain the source of truth.
|
|
8
|
+
- Manual edits to generated files are treated as drift unless explicitly adopted through canonical changes.
|
|
9
|
+
- `prodify sync` must not silently erase manual edits without first detecting the conflict.
|
|
10
|
+
|
|
11
|
+
## Conflict Detection
|
|
12
|
+
A manual-edit conflict exists when:
|
|
13
|
+
- a file is recognized as Prodify-managed
|
|
14
|
+
- the current file content does not match the expected generated output
|
|
15
|
+
- the difference cannot be explained only by canonical source changes already being applied in the regenerated output
|
|
16
|
+
|
|
17
|
+
## Default Sync Behavior
|
|
18
|
+
- Stop and report the conflict.
|
|
19
|
+
- Identify the file path and target agent.
|
|
20
|
+
- Instruct the user to either:
|
|
21
|
+
- move the change into `.prodify/`
|
|
22
|
+
- rerun with `--force`
|
|
23
|
+
- rerun with `--backup`
|
|
24
|
+
|
|
25
|
+
## Optional Resolution Modes
|
|
26
|
+
|
|
27
|
+
### `--force`
|
|
28
|
+
- Overwrite the managed generated file with the canonical output.
|
|
29
|
+
- No backup created automatically.
|
|
30
|
+
|
|
31
|
+
### `--backup`
|
|
32
|
+
- Write a backup copy before overwriting.
|
|
33
|
+
- Backup path should live under `.prodify/backups/` or another deterministic internal backup directory.
|
|
34
|
+
|
|
35
|
+
## Canonical Rule
|
|
36
|
+
- Conflict resolution must preserve the rule that canonical `.prodify/` content wins.
|
|
37
|
+
- Generated files must not become a shadow source of truth.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# OpenCode Support
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define the current OpenCode bootstrap path and the experimental compatibility-file surface.
|
|
5
|
+
|
|
6
|
+
## Current Supported Behavior
|
|
7
|
+
- Bootstrap path: `.prodify/AGENTS.md`
|
|
8
|
+
- Root or `.opencode/` compatibility file: not part of the default lifecycle
|
|
9
|
+
|
|
10
|
+
## Experimental Compatibility Surface
|
|
11
|
+
- Status: `experimental`
|
|
12
|
+
- Canonical source: `.prodify/AGENTS.md`
|
|
13
|
+
- Future target path if enabled: `.opencode/AGENTS.md`
|
|
14
|
+
- Default design: direct copy with generated header.
|
|
15
|
+
- Read `.prodify/AGENTS.md`.
|
|
16
|
+
- Prepend the standard generated-file header for target `opencode`.
|
|
17
|
+
- Write to `.opencode/AGENTS.md` only when the user explicitly opts into the experimental target.
|
|
18
|
+
|
|
19
|
+
## Limitations
|
|
20
|
+
- The target path is provisional until a live OpenCode integration confirms the contract.
|
|
21
|
+
- Experimental support should never be enabled implicitly.
|
|
22
|
+
- If the integration contract differs, Prodify must surface that mismatch instead of silently adapting.
|
|
23
|
+
|
|
24
|
+
## Placeholder Strategy
|
|
25
|
+
- Document the target and generation rule now.
|
|
26
|
+
- Keep CLI support opt-in and clearly labeled experimental.
|
|
27
|
+
- Prefer “not yet validated” over claiming current default support for compatibility-file generation.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Source vs Generated Ownership Rules
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define who owns canonical `.prodify/` files and how Prodify treats generated compatibility files.
|
|
5
|
+
|
|
6
|
+
## Ownership Model
|
|
7
|
+
|
|
8
|
+
### Canonical Files
|
|
9
|
+
- Users edit canonical files under `.prodify/`.
|
|
10
|
+
- Canonical files are the only durable source of truth for Prodify-managed guidance and workflow content.
|
|
11
|
+
- Prodify commands may create canonical files during `prodify init` or upgrade them during explicit upgrade operations.
|
|
12
|
+
|
|
13
|
+
### Generated Files
|
|
14
|
+
- Generated compatibility files are future or non-default derived artifacts.
|
|
15
|
+
- They must always be reproducible from canonical `.prodify/` sources.
|
|
16
|
+
- Users should not treat generated files as the place to make lasting changes.
|
|
17
|
+
|
|
18
|
+
## Overwrite Rules
|
|
19
|
+
- `prodify sync` may overwrite managed generated files.
|
|
20
|
+
- `prodify setup-agent <target>` must not write generated files into repositories.
|
|
21
|
+
- If compatibility-file generation is reintroduced later, it must remain explicit and separate from repo initialization.
|
|
22
|
+
- Prodify must not overwrite unmanaged files silently.
|
|
23
|
+
- If a target path exists but is not recognized as Prodify-managed, Prodify must stop unless an explicit override flag is provided.
|
|
24
|
+
|
|
25
|
+
## Standard Warning Header Policy
|
|
26
|
+
Every generated compatibility file must begin with a standard warning header that states:
|
|
27
|
+
- the file is generated by Prodify
|
|
28
|
+
- the canonical source file or files
|
|
29
|
+
- the command used to regenerate it
|
|
30
|
+
- that manual edits may be overwritten
|
|
31
|
+
|
|
32
|
+
## User Editing Rule
|
|
33
|
+
- Users should make durable changes in `.prodify/`.
|
|
34
|
+
- Manual edits to generated files are temporary and subject to conflict policy.
|
|
35
|
+
- If users need custom generated output, they should change canonical sources or supported overlay settings, not patch generated files directly.
|
|
36
|
+
|
|
37
|
+
## Source Of Truth Rule
|
|
38
|
+
- If canonical and generated content differ, canonical content wins.
|
|
39
|
+
- Generated content must be treated as disposable and reproducible.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Path Resolution Rules
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define deterministic repository-root detection and output-path behavior for Prodify commands.
|
|
5
|
+
|
|
6
|
+
## Repository Root Detection
|
|
7
|
+
Prodify must resolve the repository root using this order:
|
|
8
|
+
1. Explicit `--repo` argument, if provided.
|
|
9
|
+
2. Current working directory, if it contains `.prodify/`.
|
|
10
|
+
3. Nearest parent directory containing `.prodify/`.
|
|
11
|
+
4. Nearest parent directory containing `.git/`, if `.prodify/` has not yet been created and the command supports bootstrap behavior.
|
|
12
|
+
|
|
13
|
+
If no repository root can be resolved, the command must stop.
|
|
14
|
+
|
|
15
|
+
## Path Normalization Rules
|
|
16
|
+
- All stored paths must be repository-relative.
|
|
17
|
+
- Absolute input paths may be accepted, but they must be normalized back to repository-relative paths before being written into managed files or reports.
|
|
18
|
+
- Path comparison must use normalized separators and remove redundant `.` segments.
|
|
19
|
+
- Prodify must not write outside the resolved repository root.
|
|
20
|
+
|
|
21
|
+
## Target Output Rules
|
|
22
|
+
- Every compatibility target path must resolve relative to the repository root.
|
|
23
|
+
- Parent directories may be created automatically when the target path is managed by Prodify.
|
|
24
|
+
- Commands must verify whether the target path already exists before writing.
|
|
25
|
+
|
|
26
|
+
## Existing File Behavior
|
|
27
|
+
|
|
28
|
+
### Managed Existing File
|
|
29
|
+
- If the file has a valid Prodify managed-file header, Prodify may update it.
|
|
30
|
+
- Drift handling must follow the managed-file conflict policy.
|
|
31
|
+
|
|
32
|
+
### Unmanaged Existing File
|
|
33
|
+
- If the file exists without a valid managed-file header, Prodify must stop by default.
|
|
34
|
+
- An explicit override flag is required to replace or adopt the file.
|
|
35
|
+
- This is the unmanaged-file path and it must never be resolved implicitly.
|
|
36
|
+
|
|
37
|
+
## Conflict Behavior
|
|
38
|
+
- Managed files with detected manual edits should trigger the manual-edit conflict flow.
|
|
39
|
+
- Unmanaged files at agent target paths should block generation by default.
|
|
40
|
+
- Resolution must be explicit and deterministic; no silent adoption is allowed.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Preset Structure
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define how Prodify ships reusable preset packs that populate canonical `.prodify/` contents.
|
|
5
|
+
|
|
6
|
+
## Preset Directory Layout
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
presets/
|
|
10
|
+
<preset-name>/
|
|
11
|
+
preset.json
|
|
12
|
+
canonical/
|
|
13
|
+
AGENTS.md
|
|
14
|
+
project.md
|
|
15
|
+
planning.md
|
|
16
|
+
tasks/
|
|
17
|
+
rules/
|
|
18
|
+
templates/
|
|
19
|
+
overlays/
|
|
20
|
+
codex/
|
|
21
|
+
claude/
|
|
22
|
+
copilot/
|
|
23
|
+
opencode/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Layout Semantics
|
|
27
|
+
|
|
28
|
+
### `preset.json`
|
|
29
|
+
- preset name
|
|
30
|
+
- preset version
|
|
31
|
+
- schema version
|
|
32
|
+
- description
|
|
33
|
+
|
|
34
|
+
### `canonical/`
|
|
35
|
+
- base files copied into `.prodify/` by `prodify init`
|
|
36
|
+
- agent-neutral source-of-truth content
|
|
37
|
+
|
|
38
|
+
### `overlays/`
|
|
39
|
+
- optional agent-specific additions or transformations applied on top of the base canonical content
|
|
40
|
+
- may define target-specific snippets, not compatibility outputs themselves
|
|
41
|
+
|
|
42
|
+
## Default vs Agent-Specific Content
|
|
43
|
+
- The default preset provides a coherent base `.prodify/` installation.
|
|
44
|
+
- Agent overlays adjust the canonical starter content when a user explicitly chooses them.
|
|
45
|
+
- Overlays must never replace the principle that `.prodify/` remains canonical.
|
|
46
|
+
|
|
47
|
+
## Mapping Rule
|
|
48
|
+
- Presets populate canonical `.prodify/` files and folders.
|
|
49
|
+
- Compatibility files are still generated later by install or sync commands.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Contract-Bounded Skill System
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Prodify stages can use bounded skills to improve execution quality without weakening deterministic contracts.
|
|
6
|
+
|
|
7
|
+
The governing model is:
|
|
8
|
+
|
|
9
|
+
- contract defines required inputs, outputs, write boundaries, and success criteria
|
|
10
|
+
- validator decides pass or fail
|
|
11
|
+
- skill routing determines which stage-compatible skills may assist execution
|
|
12
|
+
|
|
13
|
+
## Ownership
|
|
14
|
+
|
|
15
|
+
- Stage routing lives in contract source frontmatter as `skill_routing`.
|
|
16
|
+
- Concrete skill definitions live in `.prodify/skills/`.
|
|
17
|
+
- `registry.json` is the discoverable manifest for product-owned skills.
|
|
18
|
+
|
|
19
|
+
## Skill Model
|
|
20
|
+
|
|
21
|
+
Every skill definition includes:
|
|
22
|
+
|
|
23
|
+
- `id`
|
|
24
|
+
- `name`
|
|
25
|
+
- `version`
|
|
26
|
+
- `category`
|
|
27
|
+
- `description`
|
|
28
|
+
- `intended_use`
|
|
29
|
+
- `stage_compatibility`
|
|
30
|
+
- optional `activation_conditions`
|
|
31
|
+
- `execution_guidance`
|
|
32
|
+
- optional `caution_guidance`
|
|
33
|
+
|
|
34
|
+
Supported categories:
|
|
35
|
+
|
|
36
|
+
- `stage-method`
|
|
37
|
+
- `domain`
|
|
38
|
+
- `quality-policy`
|
|
39
|
+
|
|
40
|
+
## Routing Model
|
|
41
|
+
|
|
42
|
+
Each compiled stage contract may include:
|
|
43
|
+
|
|
44
|
+
- `default_skills`
|
|
45
|
+
- `allowed_skills`
|
|
46
|
+
- `conditional_skills`
|
|
47
|
+
|
|
48
|
+
Conditional activation is explicit and deterministic. Current predicates can match:
|
|
49
|
+
|
|
50
|
+
- `language`
|
|
51
|
+
- `framework`
|
|
52
|
+
- `project_type`
|
|
53
|
+
- `architecture_pattern`
|
|
54
|
+
- `risk_signal`
|
|
55
|
+
|
|
56
|
+
## Determinism Rules
|
|
57
|
+
|
|
58
|
+
- Skills never override contract-required artifacts, allowed write paths, or validation.
|
|
59
|
+
- Stage-incompatible or unknown skills are rejected.
|
|
60
|
+
- Skill resolution is based on explicit repo context detection plus contract routing.
|
|
61
|
+
- Status reporting can show the stage, considered skills, active skills, and activation reasons.
|
|
62
|
+
|
|
63
|
+
## Current Examples
|
|
64
|
+
|
|
65
|
+
- `codebase-scanning` as a stage-method skill for `understand`
|
|
66
|
+
- `typescript-backend` as a domain skill activated when the repo language includes TypeScript
|
|
67
|
+
- `test-hardening` as a quality-policy skill for `refactor` and `validate`
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Versioning And Upgrade Strategy
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Define how Prodify versions canonical preset content and upgrades repositories over time.
|
|
5
|
+
|
|
6
|
+
## Version Storage
|
|
7
|
+
- Store Prodify metadata in `.prodify/version.json`.
|
|
8
|
+
- Minimum fields:
|
|
9
|
+
- `schema_version`
|
|
10
|
+
- `preset_name`
|
|
11
|
+
- `preset_version`
|
|
12
|
+
|
|
13
|
+
## Upgrade Model
|
|
14
|
+
- Upgrades operate on canonical `.prodify/` content first.
|
|
15
|
+
- Generated compatibility files are regenerated after canonical upgrades are complete.
|
|
16
|
+
- Upgrade logic must know the current preset version before attempting changes.
|
|
17
|
+
|
|
18
|
+
## Compatibility Checks
|
|
19
|
+
Before an upgrade, Prodify should verify:
|
|
20
|
+
- current `.prodify/version.json` is readable
|
|
21
|
+
- current preset version is known
|
|
22
|
+
- schema version is supported
|
|
23
|
+
- local canonical structure still matches expected upgrade preconditions
|
|
24
|
+
|
|
25
|
+
## Migration Surfacing
|
|
26
|
+
- If an upgrade needs a structural migration, Prodify must report it explicitly.
|
|
27
|
+
- The tool should tell the user:
|
|
28
|
+
- current version
|
|
29
|
+
- target version
|
|
30
|
+
- files to be changed
|
|
31
|
+
- whether manual review is required
|
|
32
|
+
|
|
33
|
+
## Generated File Behavior During Upgrade
|
|
34
|
+
- Generated compatibility files should not be hand-patched during upgrade.
|
|
35
|
+
- After canonical upgrade succeeds, `prodify sync` should regenerate managed targets deterministically.
|
|
36
|
+
|
|
37
|
+
## Safety Rules
|
|
38
|
+
- Do not rely on guesswork when a version is unknown.
|
|
39
|
+
- Stop if the repository has unsupported schema or missing required version metadata.
|
|
40
|
+
- Prefer explicit migration steps over implicit silent rewrites.
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@urielsh/prodify",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"prodify": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.json",
|
|
12
|
+
"prodify": "npm run build && node ./dist/index.js",
|
|
13
|
+
"test": "npm run build && node --test tests/unit/*.test.js tests/integration/*.test.js",
|
|
14
|
+
"test:unit": "npm run build && node --test tests/unit/*.test.js",
|
|
15
|
+
"test:integration": "npm run build && node --test tests/integration/*.test.js"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.15.30",
|
|
19
|
+
"ts-node": "^10.9.2",
|
|
20
|
+
"typescript": "^5.8.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Source Layout
|
|
2
|
+
|
|
3
|
+
The `src/` tree is organized by subsystem ownership.
|
|
4
|
+
|
|
5
|
+
- `commands/`: thin CLI orchestration entrypoints only
|
|
6
|
+
- `contracts/`: source parsing, schema ownership, compilation, and freshness
|
|
7
|
+
- `core/`: runtime state, workspace health, status/doctor/update orchestration, and stage validation
|
|
8
|
+
- `presets/`: canonical preset loading and version metadata
|
|
9
|
+
- `scoring/`: local repository scoring after validated execution
|
|
10
|
+
|
|
11
|
+
If a behavior changes the product model, its owning subsystem should be obvious from this layout before you read implementation details.
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { runDoctorCommand } from './commands/doctor.js';
|
|
2
|
+
import { runInitCommand } from './commands/init.js';
|
|
3
|
+
import { runSetupAgentCommand } from './commands/setup-agent.js';
|
|
4
|
+
import { runStatusCommand } from './commands/status.js';
|
|
5
|
+
import { runUpdateCommand } from './commands/update.js';
|
|
6
|
+
import { ProdifyError, toErrorMessage } from './core/errors.js';
|
|
7
|
+
import type { CommandContext, CommandHandler } from './types.js';
|
|
8
|
+
|
|
9
|
+
export const COMMANDS: Record<string, CommandHandler> = {
|
|
10
|
+
init: runInitCommand,
|
|
11
|
+
'setup-agent': runSetupAgentCommand,
|
|
12
|
+
status: runStatusCommand,
|
|
13
|
+
doctor: runDoctorCommand,
|
|
14
|
+
update: runUpdateCommand
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const PUBLIC_COMMANDS = ['init', 'setup-agent', 'status', 'doctor', 'update'] as const;
|
|
18
|
+
|
|
19
|
+
export function renderHelp(): string {
|
|
20
|
+
return [
|
|
21
|
+
'Prodify CLI',
|
|
22
|
+
'',
|
|
23
|
+
'Usage:',
|
|
24
|
+
' prodify setup-agent <codex|claude|copilot|opencode>',
|
|
25
|
+
' prodify init',
|
|
26
|
+
' prodify status',
|
|
27
|
+
' prodify doctor',
|
|
28
|
+
' prodify update',
|
|
29
|
+
'',
|
|
30
|
+
'Global agent setup is separate from per-repository init.',
|
|
31
|
+
'The primary flow is .prodify-first and contract-driven.'
|
|
32
|
+
].join('\n');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function runCli(argv: string[], context: Partial<CommandContext> = {}): Promise<number> {
|
|
36
|
+
const stdout = context.stdout ?? process.stdout;
|
|
37
|
+
const stderr = context.stderr ?? process.stderr;
|
|
38
|
+
const cwd = context.cwd ?? process.cwd();
|
|
39
|
+
|
|
40
|
+
if (argv.length === 0 || argv.includes('--help') || argv.includes('-h')) {
|
|
41
|
+
stdout.write(`${renderHelp()}\n`);
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const [commandName, ...rest] = argv;
|
|
46
|
+
const command = COMMANDS[commandName];
|
|
47
|
+
|
|
48
|
+
if (!command) {
|
|
49
|
+
stderr.write(`Unknown command: ${commandName}\n`);
|
|
50
|
+
stderr.write(`${renderHelp()}\n`);
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
return await command(rest, { cwd, stdout, stderr });
|
|
56
|
+
} catch (error) {
|
|
57
|
+
const message = toErrorMessage(error);
|
|
58
|
+
stderr.write(`${message}\n`);
|
|
59
|
+
return error instanceof ProdifyError ? error.exitCode : 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { resolveRepoRoot } from '../core/repo-root.js';
|
|
2
|
+
import { runDoctor } from '../core/doctor.js';
|
|
3
|
+
import type { CommandContext } from '../types.js';
|
|
4
|
+
|
|
5
|
+
export async function runDoctorCommand(args: string[], context: CommandContext): Promise<number> {
|
|
6
|
+
void args;
|
|
7
|
+
const repoRoot = await resolveRepoRoot({
|
|
8
|
+
cwd: context.cwd,
|
|
9
|
+
allowBootstrap: true
|
|
10
|
+
});
|
|
11
|
+
const result = await runDoctor(repoRoot);
|
|
12
|
+
|
|
13
|
+
context.stdout.write('Prodify Doctor\n');
|
|
14
|
+
for (const check of result.checks) {
|
|
15
|
+
const status = check.skipped ? 'SKIP' : check.ok ? 'PASS' : 'FAIL';
|
|
16
|
+
context.stdout.write(`${check.label}: ${status}${check.details ? ` - ${check.details}` : ''}\n`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return result.ok ? 0 : 1;
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { writeFileEnsuringDir } from '../core/fs.js';
|
|
2
|
+
import { resolveRepoRoot } from '../core/repo-root.js';
|
|
3
|
+
import { resolveRepoPath } from '../core/paths.js';
|
|
4
|
+
import { pathExists } from '../core/fs.js';
|
|
5
|
+
import { ProdifyError } from '../core/errors.js';
|
|
6
|
+
import { loadDefaultPreset } from '../presets/loader.js';
|
|
7
|
+
import { synchronizeRuntimeContracts } from '../contracts/compiler.js';
|
|
8
|
+
import type { CommandContext } from '../types.js';
|
|
9
|
+
|
|
10
|
+
export async function runInitCommand(args: string[], context: CommandContext): Promise<number> {
|
|
11
|
+
void args;
|
|
12
|
+
const repoRoot = await resolveRepoRoot({
|
|
13
|
+
cwd: context.cwd,
|
|
14
|
+
allowBootstrap: true
|
|
15
|
+
});
|
|
16
|
+
const prodifyDir = resolveRepoPath(repoRoot, '.prodify');
|
|
17
|
+
|
|
18
|
+
if (await pathExists(prodifyDir)) {
|
|
19
|
+
throw new ProdifyError('.prodify/ already exists. init stops rather than merging existing canonical files.', {
|
|
20
|
+
code: 'PRODIFY_ALREADY_EXISTS'
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const preset = await loadDefaultPreset();
|
|
25
|
+
|
|
26
|
+
for (const entry of preset.entries) {
|
|
27
|
+
await writeFileEnsuringDir(resolveRepoPath(repoRoot, entry.relativePath), entry.content);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
await synchronizeRuntimeContracts(repoRoot);
|
|
31
|
+
|
|
32
|
+
context.stdout.write(`Initialized Prodify in ${repoRoot}\n`);
|
|
33
|
+
context.stdout.write('Global agent setup is separate: run `prodify setup-agent <agent>` once per machine before using `$prodify-*` commands inside that agent\n');
|
|
34
|
+
context.stdout.write('Manual bootstrap starts by telling your agent to read .prodify/AGENTS.md\n');
|
|
35
|
+
context.stdout.write('Compiled runtime contracts were generated under .prodify/contracts/\n');
|
|
36
|
+
return 0;
|
|
37
|
+
}
|