genesis-compiler 1.3.3 → 1.4.1
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 +32 -13
- package/docs/templates.md +122 -0
- package/package.json +2 -1
- package/plugins/genesis/.codex-plugin/plugin.json +4 -2
- package/prompts/deslop.txt +10 -6
- package/prompts/start-existing-uninitialized.txt +14 -5
- package/prompts/start-new.txt +7 -0
- package/skills/genesis-deslop/SKILL.md +41 -20
- package/skills/genesis-deslop/agents/openai.yaml +2 -2
- package/skills/genesis-project/SKILL.md +5 -2
- package/src/cli.js +46 -5
- package/src/index/codex-hooks.js +4 -3
- package/src/index/collaboration.js +4 -0
- package/src/index/contracts.js +3 -0
- package/src/index/process.js +2 -0
- package/src/index/project-files.js +4 -9
- package/src/index/project-inspection.js +107 -0
- package/src/index/prompt.js +27 -1
- package/src/index/session-context.js +13 -2
- package/src/index/template-catalog.js +100 -0
- package/src/index/template-project.js +152 -0
- package/src/index/template-source.js +51 -0
- package/src/index.js +13 -2
package/README.md
CHANGED
|
@@ -63,6 +63,10 @@ completely or correctly explains the implementation.
|
|
|
63
63
|
|
|
64
64
|
## Quick start
|
|
65
65
|
|
|
66
|
+
For ready-made applications and the shared new/existing-project workflow, see
|
|
67
|
+
[Project opening and templates](docs/templates.md). Templates belong to Genesis
|
|
68
|
+
and work through the CLI or Vibe64's Preview pane.
|
|
69
|
+
|
|
66
70
|
Genesis requires Node.js 22 or newer and Git.
|
|
67
71
|
|
|
68
72
|
Install the framework-neutral compiler and the optional first-party technology
|
|
@@ -277,6 +281,11 @@ genesis collaboration set direct balanced expert conclusions "Be candid."
|
|
|
277
281
|
Genesis owns the supported choices and their concise expansions. Authored
|
|
278
282
|
project requirements receive one fixed framing sentence and are otherwise
|
|
279
283
|
preserved. They are omitted when the source says `- Nothing.`.
|
|
284
|
+
The configured style applies to progress updates as well as final answers,
|
|
285
|
+
with technical depth and terminology matched to the selected experience level.
|
|
286
|
+
Updates should describe actual progress, findings, decisions, or blockers,
|
|
287
|
+
rather than announce compliance with guidance or reassure the user about
|
|
288
|
+
unrelated behavior staying unchanged.
|
|
280
289
|
|
|
281
290
|
Persistent hosts should install `projectSessionContext()` once when a provider
|
|
282
291
|
conversation is created or refreshed. They may then generate task prompts with
|
|
@@ -442,21 +451,25 @@ turn, and the project skill keeps intentional Blueprint and affected Program
|
|
|
442
451
|
changes aligned there.
|
|
443
452
|
|
|
444
453
|
Deslop runs only when explicitly requested. With no stated scope it reviews the
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
454
|
+
agent's own changes for the current task across preceding turns, committed or
|
|
455
|
+
uncommitted. An explicit commit, first-parent count, or range takes precedence
|
|
456
|
+
regardless of authorship. The agent establishes ownership from task and edit
|
|
457
|
+
history, preserves unrelated edits and existing staging, and asks for scope
|
|
458
|
+
when ownership is unclear. A dirty worktree is allowed, and cleanup remains
|
|
459
|
+
uncommitted for review. Genesis supplies the behavior-preserving boundary and
|
|
449
460
|
scope rules. Selected Stack components add technology-specific Deslop guidance
|
|
450
461
|
without weakening or broadening that contract.
|
|
451
462
|
|
|
452
|
-
### Deslop
|
|
463
|
+
### Deslop your changes or specified commits
|
|
453
464
|
|
|
454
465
|
Inside Codex, OpenCode, or another skill-aware coding agent, ask directly:
|
|
455
466
|
|
|
456
467
|
```text
|
|
457
468
|
Deslop
|
|
469
|
+
Deslop the last commit
|
|
458
470
|
Deslop the last 5 commits
|
|
459
471
|
Deslop commit a1b2c3d
|
|
472
|
+
Deslop a1b2c3d..d4e5f6a
|
|
460
473
|
```
|
|
461
474
|
|
|
462
475
|
The installed `genesis-deslop` skill generates the canonical project prompt
|
|
@@ -469,8 +482,10 @@ selection, generate the same complete prompt explicitly:
|
|
|
469
482
|
|
|
470
483
|
```bash
|
|
471
484
|
genesis prompt --task deslop
|
|
485
|
+
genesis prompt --task deslop "Deslop the last commit"
|
|
472
486
|
genesis prompt --task deslop "Deslop the last 5 commits"
|
|
473
487
|
genesis prompt --task deslop "Deslop commit a1b2c3d"
|
|
488
|
+
genesis prompt --task deslop "Deslop a1b2c3d..d4e5f6a"
|
|
474
489
|
```
|
|
475
490
|
|
|
476
491
|
Give the printed prompt to the coding agent that has access to the repository.
|
|
@@ -482,10 +497,12 @@ Stack component. Project additions or overrides from
|
|
|
482
497
|
The main `genesis/stack.md` records component selection and durable project
|
|
483
498
|
operations; it intentionally does not duplicate installed guidance bodies.
|
|
484
499
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
500
|
+
The whole dirty diff is not automatically the agent's work. Deslop preserves
|
|
501
|
+
the user's and other agents' changes, including edits in the same files. With
|
|
502
|
+
no changes of its own for the task, it reports that there is nothing to clean
|
|
503
|
+
up; it does not silently select the latest commit. Its result is a normal
|
|
504
|
+
uncommitted diff for review and a later commit. It never amends selected commits,
|
|
505
|
+
silently fixes newly discovered defects, or runs as an automatic completion phase.
|
|
489
506
|
|
|
490
507
|
Projects can customize a selected technology through its matching file, such
|
|
491
508
|
as `genesis/stack/jskit.md`:
|
|
@@ -559,7 +576,8 @@ genesis prompt # implementation work
|
|
|
559
576
|
genesis prompt --task start # open a new or existing project conversation
|
|
560
577
|
genesis prompt --task adopt # import an existing project's complete contract
|
|
561
578
|
genesis prompt "Add filtering by note title"
|
|
562
|
-
genesis prompt --task deslop # clean up the
|
|
579
|
+
genesis prompt --task deslop # clean up the agent's own task changes
|
|
580
|
+
genesis prompt --task deslop "Deslop the last commit"
|
|
563
581
|
genesis prompt --task deslop "Deslop the last 5 commits"
|
|
564
582
|
genesis prompt --task deslop "Deslop commit a1b2c3d"
|
|
565
583
|
genesis prompt --task program # refresh explanation
|
|
@@ -586,9 +604,10 @@ The eight task types are deliberately explicit:
|
|
|
586
604
|
- `work` implements the Blueprint and optional request using current code,
|
|
587
605
|
Program, the selected engineering approach, selected Stack context, and
|
|
588
606
|
progressively loaded Agent Skills.
|
|
589
|
-
- `deslop` requests behavior-preserving cleanup of
|
|
590
|
-
|
|
591
|
-
|
|
607
|
+
- `deslop` explicitly requests behavior-preserving cleanup of the agent's own
|
|
608
|
+
task changes, committed or uncommitted. An explicit commit, first-parent
|
|
609
|
+
count, or range takes precedence. It preserves unrelated work and existing
|
|
610
|
+
staging, permits a dirty worktree, and leaves its result uncommitted.
|
|
592
611
|
- `program` edits only `genesis/program/` to explain the code that exists, with
|
|
593
612
|
selected Stack guidance available for technology-specific correctness.
|
|
594
613
|
- `blueprint` edits only `genesis/blueprint.md` from explicit user intent. It
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Project opening and templates
|
|
2
|
+
|
|
3
|
+
`genesis init` installs the portable Genesis documents, workflow skills, and
|
|
4
|
+
agent integration in an ordinary Git repository. It preserves existing source.
|
|
5
|
+
Initialization is a decision to use Genesis; it is not evidence that an existing
|
|
6
|
+
application has been described or that an application has been created.
|
|
7
|
+
|
|
8
|
+
`genesis inspect project --json` is a read-only opening inspection shared by
|
|
9
|
+
the CLI, session guidance, and hosts such as Vibe64:
|
|
10
|
+
|
|
11
|
+
| State | Evidence | Next step |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `new` | No content beyond known bootstrap files | Choose a template or create through conversation |
|
|
14
|
+
| `adoption` | Existing content with no Genesis, or initialized documents that still lack product/Stack description | Ask what the project does and what should run; work backwards from existing code into its documents |
|
|
15
|
+
| `ready` | Current format, valid core declarations and any present Program, existing source, product and Stack description | Continue ordinary work |
|
|
16
|
+
| `attention` | Unversioned/old/invalid/newer Genesis, malformed declarations, or broken Program source references | Use the specific diagnostic and `nextAction` for migration, repair, or a compiler update |
|
|
17
|
+
|
|
18
|
+
`genesis/version` is the format sentinel. Existing Genesis documents without it
|
|
19
|
+
are an unversioned migration case, never an empty project. The supported format
|
|
20
|
+
is independent of the npm package version. A Stack description can use selected
|
|
21
|
+
components or authored project contracts when no catalogue technology matches.
|
|
22
|
+
|
|
23
|
+
The exact bootstrap allowlist is `GENESIS_BOOTSTRAP_PATHS` in
|
|
24
|
+
`src/index/project-inspection.js`: the four core Markdown documents and version,
|
|
25
|
+
the two derived Cities, Genesis's Codex/OpenCode integration files, its managed
|
|
26
|
+
skills manifest, and the SKILL.md/openai.yaml pair for each of the three Genesis
|
|
27
|
+
workflow skills. Whole `.agents/`, `.codex/`, or `genesis/` directories are not
|
|
28
|
+
exempt. A README, `.gitignore`, application manifest, unfamiliar source file, or
|
|
29
|
+
custom agent tool counts as existing content. Ignored files also count, except
|
|
30
|
+
installed `node_modules` dependencies. Source recognition does not depend on a
|
|
31
|
+
language detector or an AI model.
|
|
32
|
+
|
|
33
|
+
Opening a session does not run verification, rebuild the source index, install
|
|
34
|
+
dependencies, prepare a database, or start the application. The inspection is
|
|
35
|
+
repeated as a small read when opening/resuming a session and when a host refreshes
|
|
36
|
+
its setup view. There is no persistent “ready” flag that can misclassify a later
|
|
37
|
+
Git import. Program source references are structural evidence; prose accuracy
|
|
38
|
+
still requires review against the implementation during relevant work.
|
|
39
|
+
|
|
40
|
+
## Choose a starter
|
|
41
|
+
|
|
42
|
+
Install the optional catalogue alongside the compiler:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm install --global genesis-compiler genesis-stack
|
|
46
|
+
git init
|
|
47
|
+
genesis init
|
|
48
|
+
genesis templates list
|
|
49
|
+
genesis templates apply official:jskit/public
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The first-party JSKIT repository is
|
|
53
|
+
[vibe64-dev/seed-jskit](https://github.com/vibe64-dev/seed-jskit). `public` supplies
|
|
54
|
+
an adaptive public app; `accounts` adds local accounts, private Home and MySQL.
|
|
55
|
+
Each branch is a complete, current Genesis project with actual application
|
|
56
|
+
source, dependency lockfile, setup/run contracts and focused checks.
|
|
57
|
+
|
|
58
|
+
Applying fetches the explicitly named branch once, resolves its commit and reads
|
|
59
|
+
its ordinary Git blobs into a temporary project. Genesis rejects links,
|
|
60
|
+
submodules, unsafe paths, dependencies and private dotenv files in the template.
|
|
61
|
+
It validates the prepared project before changing the destination. A project
|
|
62
|
+
lock serializes competing imports; the source and authored bootstrap files are
|
|
63
|
+
checked again immediately before the copy. An ordinary copy failure rolls back
|
|
64
|
+
written files. If a process is forcibly killed, inspect any partial work and the
|
|
65
|
+
Git-local `genesis-template.lock` before removing the abandoned lock and retrying;
|
|
66
|
+
Genesis never treats partial application code as an empty destination.
|
|
67
|
+
|
|
68
|
+
The destination keeps its Git history, remotes, branch, meaningful Blueprint,
|
|
69
|
+
collaboration/engineering choices, and authored Stack operation sections.
|
|
70
|
+
Template Stack components/packages are combined with existing selections;
|
|
71
|
+
existing complete operation sections take precedence. No dependency command,
|
|
72
|
+
database command, agent, or Git commit runs during import. The result reports
|
|
73
|
+
the resolved source repository, branch and commit; no provenance ledger is
|
|
74
|
+
written to the project. Review the ordinary diff and commit or use Vibe64 Save.
|
|
75
|
+
|
|
76
|
+
The application declares its actual operations in `genesis/stack.md`. CLI users
|
|
77
|
+
provide the declared runtimes and resources and execute those commands themselves
|
|
78
|
+
or with their agent. Vibe64 can provide runtimes, resource bindings, workspace
|
|
79
|
+
preparation and preview routing through its existing host facilities.
|
|
80
|
+
|
|
81
|
+
## Supply catalogues
|
|
82
|
+
|
|
83
|
+
A catalogue repository has `genesis.templates.json` at its branch root:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"schemaVersion": 1,
|
|
88
|
+
"templates": [{
|
|
89
|
+
"id": "jskit/public",
|
|
90
|
+
"technology": "jskit",
|
|
91
|
+
"name": "Company JSKIT app",
|
|
92
|
+
"description": "The company's public application starter.",
|
|
93
|
+
"repository": "https://github.com/example/seed-jskit.git",
|
|
94
|
+
"branch": "public"
|
|
95
|
+
}]
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Add explicit sources to either command, repeating the option for more sources:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
genesis templates list --template-source company=https://github.com/example/starters.git#main
|
|
103
|
+
genesis templates apply company:jskit/public --template-source company=https://github.com/example/starters.git#main
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Repositories use HTTPS; explicit local absolute paths are also accepted for
|
|
107
|
+
offline use and testing. The catalogue's technology matches a selected Stack
|
|
108
|
+
component in its template. Skills do not trigger template selection: one complete
|
|
109
|
+
template may select several components such as JSKIT, Node and MySQL.
|
|
110
|
+
|
|
111
|
+
An installed Stack package may ship the same file and declare
|
|
112
|
+
`"genesis": { "templates": { "namespace": "company", "path": "genesis.templates.json" } }`
|
|
113
|
+
in its package.json, alongside `stackPieces`. Project-recorded Stack packages
|
|
114
|
+
and explicit `--stack-package` packages contribute their catalogue data.
|
|
115
|
+
Namespaces must be unique. Competing providers remain separate choices, such as
|
|
116
|
+
`official:jskit/public` and `company:jskit/public`. An ambiguous unqualified ID
|
|
117
|
+
is rejected; source order never chooses a winner.
|
|
118
|
+
|
|
119
|
+
The JavaScript API exposes `inspectProject`, `listTemplates`, and `applyTemplate`.
|
|
120
|
+
Catalogue options accept `stackPackages` and `templateSources`; explicit source
|
|
121
|
+
records contain `namespace`, `repository`, and `branch`. Hosts configure those
|
|
122
|
+
sources themselves and accept only a selected template ID from their browser.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genesis-compiler",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An agent-independent prompt, multi-language code-index, cleanup, and verification companion with project agent guidance.",
|
|
6
6
|
"repository": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"bin",
|
|
27
27
|
"docs/assurance-model.md",
|
|
28
28
|
"docs/stack-components.md",
|
|
29
|
+
"docs/templates.md",
|
|
29
30
|
"docs/prompt-integration.md",
|
|
30
31
|
"prompts/blueprint.txt",
|
|
31
32
|
"prompts/adopt.txt",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genesis",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Makes Codex aware of optional Genesis adoption for existing projects.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mobily Enterprises"
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"longDescription": "Recommends the optional Genesis explanatory layer when Codex opens an existing project that has not adopted it.",
|
|
12
12
|
"developerName": "Mobily Enterprises",
|
|
13
13
|
"category": "Productivity",
|
|
14
|
-
"capabilities": [
|
|
14
|
+
"capabilities": [
|
|
15
|
+
"Read"
|
|
16
|
+
],
|
|
15
17
|
"defaultPrompt": [
|
|
16
18
|
"Adopt Genesis in this existing project"
|
|
17
19
|
]
|
package/prompts/deslop.txt
CHANGED
|
@@ -2,15 +2,19 @@ This Deslop task has already been rendered by Genesis. Do not generate another
|
|
|
2
2
|
Deslop prompt. Read and follow `.agents/skills/genesis-deslop/SKILL.md`
|
|
3
3
|
completely.
|
|
4
4
|
|
|
5
|
-
This is an explicitly requested behavior-preserving cleanup
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
This is an explicitly requested behavior-preserving cleanup. With no stated
|
|
6
|
+
scope, select your own changes for the current task across preceding turns,
|
|
7
|
+
committed or uncommitted. An explicit commit, first-parent count, or range in
|
|
8
|
+
USER REQUEST takes precedence regardless of who authored those changes.
|
|
9
|
+
Establish ownership from task and edit history; the entire dirty diff is not
|
|
10
|
+
automatically yours. If ownership is unclear, ask for scope. A dirty worktree
|
|
11
|
+
is allowed: preserve unrelated edits and existing staging, and leave the
|
|
12
|
+
cleanup as ordinary uncommitted work for review.
|
|
9
13
|
|
|
10
14
|
Apply the selected Stack cleanup guidance and applicable technology skills in
|
|
11
15
|
addition to the Genesis Deslop contract. Stack guidance may improve
|
|
12
|
-
technology-specific cleanup, but it cannot broaden the resolved
|
|
16
|
+
technology-specific cleanup, but it cannot broaden the resolved scope,
|
|
13
17
|
weaken behavior preservation, or turn this into another implementation pass.
|
|
14
18
|
|
|
15
|
-
Report the resolved
|
|
19
|
+
Report the resolved scope, what became simpler, files changed, checks actually
|
|
16
20
|
run, and any defect or gap deliberately left for follow-up.
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
This is an existing
|
|
2
|
-
|
|
3
|
-
or
|
|
1
|
+
This is an existing application that has not yet been described and configured
|
|
2
|
+
in Genesis. It may already have initialized but empty Genesis documents. Never
|
|
3
|
+
offer a template or replace its source. Ask what this project does and which
|
|
4
|
+
application, command, or output the person wants to run. Use answers already
|
|
5
|
+
given, and accept "inspect it for me" without requiring a technology choice.
|
|
6
|
+
Ask about ambiguity such as multiple applications only after inspecting evidence.
|
|
7
|
+
Recommend preparing the project for guided editing before
|
|
4
8
|
substantial work. Explain in product language that preparation preserves the
|
|
5
9
|
implementation while importing its current product, setup, run, data, preview,
|
|
6
10
|
and verification facts. Do not require the person to know Genesis terminology or
|
|
7
|
-
type a command.
|
|
8
|
-
|
|
11
|
+
type a command. When genesis.initialized is true, they have already opted into
|
|
12
|
+
Genesis; run the Genesis `adopt` operation and follow its prompt without requesting
|
|
13
|
+
that approval again. Otherwise, run it when they approve (including an explicit
|
|
14
|
+
request to set up this existing project). If they decline, continue normally and
|
|
15
|
+
do not repeat the recommendation.
|
|
16
|
+
Opening a session never requires tests, builds, dependency installation, database
|
|
17
|
+
preparation, or application verification.
|
package/prompts/start-new.txt
CHANGED
|
@@ -3,6 +3,13 @@ what is being built, who or what will use or invoke it, and the first observable
|
|
|
3
3
|
useful outcome. Ask at most three concise questions at a time, and do not repeat
|
|
4
4
|
facts already supplied by the user. A Stack choice is not product intent.
|
|
5
5
|
|
|
6
|
+
Offer a ready-made starting point through `genesis templates list` when helpful.
|
|
7
|
+
On an explicit choice, use `genesis templates apply <catalogue:technology/variant>`.
|
|
8
|
+
Each choice is one complete repository branch, not a template per selected Skill.
|
|
9
|
+
If multiple catalogues match, ask the user to choose a qualified identifier; never
|
|
10
|
+
guess a source. Applying a template preserves authored project intent and Git
|
|
11
|
+
history. Existing application source must go through adoption, never templates.
|
|
12
|
+
|
|
6
13
|
Use `availableStackPieces` to offer only relevant technology choices in product
|
|
7
14
|
language. Never silently select one. If the user names an unselected technology,
|
|
8
15
|
run the Genesis `stack list` operation first. For one exact match, ask whether to
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: genesis-deslop
|
|
3
|
-
description: Deslop
|
|
3
|
+
description: Deslop the agent's own task changes or explicitly selected commits through a behavior-preserving cleanup pass. Use when asked to Deslop, simplify current work, remove repeated helpers, clarify ownership, or align changed code with established project and technology patterns.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Genesis Deslop
|
|
7
7
|
|
|
8
|
-
Review and simplify
|
|
8
|
+
Review and simplify selected changes without changing product behavior. Deslop is
|
|
9
9
|
explicit: never run it merely because implementation finished.
|
|
10
10
|
|
|
11
11
|
Resolve the invocation before running the first Genesis operation. Do not use a
|
|
@@ -29,8 +29,11 @@ Genesis operation or `genesis --version` as an availability probe.
|
|
|
29
29
|
Successful invocation resolution is routine. Do not narrate whether Genesis is
|
|
30
30
|
project-pinned or on `PATH`, and never describe direct `PATH` use as a fallback.
|
|
31
31
|
Mention how the invocation was selected only when resolution fails or the user
|
|
32
|
-
explicitly asks.
|
|
33
|
-
|
|
32
|
+
explicitly asks.
|
|
33
|
+
|
|
34
|
+
Follow the configured Collaboration approach for user-facing updates, including
|
|
35
|
+
its technical depth and response length. Report concrete progress,
|
|
36
|
+
findings, or blockers; do not announce that you are following guidance.
|
|
34
37
|
|
|
35
38
|
## Load the effective project instructions once
|
|
36
39
|
|
|
@@ -49,25 +52,41 @@ to another agent and do not generate it again. This step composes the selected
|
|
|
49
52
|
Stack's technology-specific Deslop guidance and any project customization with
|
|
50
53
|
the portable contract below.
|
|
51
54
|
|
|
52
|
-
## Resolve the
|
|
55
|
+
## Resolve the cleanup scope
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
Inspect `git status --short` and the staged and unstaged diffs before editing.
|
|
58
|
+
A dirty worktree is allowed; a prior commit is not required. Preserve the
|
|
59
|
+
existing index and unrelated work. Do not stage, stash, commit, or discard
|
|
60
|
+
changes as a prerequisite or as part of cleanup.
|
|
57
61
|
|
|
58
62
|
Resolve the user's scope as follows:
|
|
59
63
|
|
|
60
|
-
- With no stated scope,
|
|
64
|
+
- With no stated scope, select only your own changes for the current task,
|
|
65
|
+
including preceding turns. This can include staged and unstaged edits,
|
|
66
|
+
new untracked files, and already-committed task changes. Identify ownership
|
|
67
|
+
from task and edit history, then confirm those changes against the current
|
|
68
|
+
source and Git diffs. Neither the entire
|
|
69
|
+
dirty diff, the latest commit, nor a Git author identity proves ownership.
|
|
70
|
+
- Preserve changes made by the user or other agents, including edits in the
|
|
71
|
+
same files. If ownership cannot be established, ask which changes to deslop. If there
|
|
72
|
+
are no changes of your own for this task, report that there is nothing to
|
|
73
|
+
deslop; do not silently select the latest commit or somebody else's work.
|
|
74
|
+
- An explicit commit, first-parent count, or range takes precedence over the
|
|
75
|
+
default, regardless of who authored those changes.
|
|
76
|
+
- “The last commit” means `HEAD` against its first parent.
|
|
61
77
|
- “The last N commits” means the net surviving change from the first parent
|
|
62
78
|
before those N commits through `HEAD`.
|
|
63
79
|
- A named commit means that commit against its first parent.
|
|
64
80
|
- An explicit commit range means exactly that range.
|
|
65
81
|
- A root commit uses Git's root-diff form because it has no parent.
|
|
66
82
|
|
|
67
|
-
Inspect the resolved
|
|
68
|
-
|
|
69
|
-
affected Program and Stack context.
|
|
70
|
-
diff for the selected committed
|
|
83
|
+
Inspect the resolved changes and paths, plus commit identities when applicable.
|
|
84
|
+
Review their diff, current source, direct call sites, relevant tests, and the
|
|
85
|
+
affected Program and Stack context. For an explicit committed scope, do not
|
|
86
|
+
substitute the ordinary working-tree diff for the selected committed diff.
|
|
87
|
+
Apply cleanup to the current source while preserving edits outside the scope.
|
|
88
|
+
If overlapping edits cannot be separated safely, ask about that overlap rather
|
|
89
|
+
than blocking solely because the repository is dirty.
|
|
71
90
|
|
|
72
91
|
## Apply the cleanup contract
|
|
73
92
|
|
|
@@ -81,7 +100,7 @@ operation to find existing public and internal functions before introducing or
|
|
|
81
100
|
consolidating an abstraction. Confirm every apparent duplicate in source and
|
|
82
101
|
its call sites.
|
|
83
102
|
|
|
84
|
-
Within the selected
|
|
103
|
+
Within the selected changes' intended behavior and scope, leave no
|
|
85
104
|
repeated helpers, no code that is unclear or hard to reason about, and no code
|
|
86
105
|
that goes against established patterns in the codebase. Remove unnecessary
|
|
87
106
|
wrappers, abandoned scaffolding, parallel framework plumbing, and speculative
|
|
@@ -89,9 +108,10 @@ abstractions. Consolidate ownership where one clear module is enough. Do not
|
|
|
89
108
|
optimize for tiny files or indirection; optimize for a small, obvious design
|
|
90
109
|
that a junior programmer can follow.
|
|
91
110
|
|
|
92
|
-
Cleanup is not a second implementation pass.
|
|
93
|
-
may occur;
|
|
94
|
-
|
|
111
|
+
Cleanup is not a second implementation pass. The selected changes limit where
|
|
112
|
+
cleanup may occur; sharing a file does not bring unrelated edits into scope or
|
|
113
|
+
authorize different behavior in that file. Deslop may reorganize behavior
|
|
114
|
+
already present; it may not complete, correct, or extend
|
|
95
115
|
behavior. If review reveals a defect, missing behavior, contract mismatch, or
|
|
96
116
|
test gap, report it as a follow-up finding and leave it unchanged, even when it
|
|
97
117
|
is inside a changed path or appears related to the preceding implementation. Do
|
|
@@ -100,7 +120,7 @@ not implement the finding or alter tests to accommodate it during Deslop.
|
|
|
100
120
|
Apply every technology-specific Deslop instruction supplied by the selected
|
|
101
121
|
Stack and load applicable official technology skills for framework and language
|
|
102
122
|
context. Stack guidance enriches this contract; it cannot weaken the
|
|
103
|
-
behavior-preserving boundary, change the selected
|
|
123
|
+
behavior-preserving boundary, change the selected scope, or authorize
|
|
104
124
|
unrelated implementation.
|
|
105
125
|
|
|
106
126
|
You may edit or delete implementation and test files when that is the clearest
|
|
@@ -115,5 +135,6 @@ create a second architecture or perform unrelated rewrites.
|
|
|
115
135
|
Leave the cleanup as ordinary uncommitted work for review and a later normal
|
|
116
136
|
commit. Never amend or rewrite the selected commits. Run focused checks when
|
|
117
137
|
useful. Final declared checks remain available through the Genesis `verify`
|
|
118
|
-
operation. Summarize the resolved
|
|
119
|
-
changed, checks actually run, and follow-up findings
|
|
138
|
+
operation. Summarize the resolved scope and any selected commit identities,
|
|
139
|
+
what became simpler, files changed, checks actually run, and follow-up findings
|
|
140
|
+
left unchanged.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Genesis Deslop"
|
|
3
|
-
short_description: "Clean up
|
|
4
|
-
default_prompt: "Use $genesis-deslop to Deslop the
|
|
3
|
+
short_description: "Clean up your task changes or specified commits"
|
|
4
|
+
default_prompt: "Use $genesis-deslop to Deslop your own changes for the current task."
|
|
@@ -46,8 +46,11 @@ Genesis operation or `genesis --version` as an availability probe.
|
|
|
46
46
|
Successful invocation resolution is routine. Do not narrate whether Genesis is
|
|
47
47
|
project-pinned or on `PATH`, and never describe direct `PATH` use as a fallback.
|
|
48
48
|
Mention how the invocation was selected only when resolution fails or the user
|
|
49
|
-
explicitly asks.
|
|
50
|
-
|
|
49
|
+
explicitly asks.
|
|
50
|
+
|
|
51
|
+
Follow the configured Collaboration approach for user-facing updates, including
|
|
52
|
+
its technical depth and response length. Report concrete progress,
|
|
53
|
+
findings, or blockers; do not announce that you are following guidance.
|
|
51
54
|
|
|
52
55
|
## Resolve explicit technology choices
|
|
53
56
|
|
package/src/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import { parseArgs } from 'node:util';
|
|
|
4
4
|
import {
|
|
5
5
|
addStack,
|
|
6
6
|
adoptProject,
|
|
7
|
+
applyTemplate,
|
|
7
8
|
check,
|
|
8
9
|
generatePrompt,
|
|
9
10
|
getContext,
|
|
@@ -13,9 +14,11 @@ import {
|
|
|
13
14
|
inspectEngineering,
|
|
14
15
|
inspectEnvironment,
|
|
15
16
|
inspectStackSection,
|
|
17
|
+
inspectProject,
|
|
16
18
|
installCodex,
|
|
17
19
|
listEngineeringProfiles,
|
|
18
20
|
listStackPieces,
|
|
21
|
+
listTemplates,
|
|
19
22
|
migrate,
|
|
20
23
|
setCollaboration,
|
|
21
24
|
setEngineeringProfile,
|
|
@@ -51,10 +54,13 @@ const USAGE = `Usage:
|
|
|
51
54
|
genesis engineering set <profile>
|
|
52
55
|
genesis stack list
|
|
53
56
|
genesis stack add <piece...>
|
|
57
|
+
genesis templates list
|
|
58
|
+
genesis templates apply <catalogue:technology/variant>
|
|
54
59
|
genesis context <path...>
|
|
55
60
|
genesis index [function-or-path...]
|
|
56
61
|
genesis migrate
|
|
57
62
|
genesis inspect environment
|
|
63
|
+
genesis inspect project
|
|
58
64
|
genesis inspect section <name>
|
|
59
65
|
genesis prompt [request...]
|
|
60
66
|
genesis prompt --task <start|adopt|work|deslop|program|blueprint|describe|review> [request...]
|
|
@@ -64,6 +70,7 @@ const USAGE = `Usage:
|
|
|
64
70
|
Options:
|
|
65
71
|
--project-root <path> Set the project root (default: current directory)
|
|
66
72
|
--stack-package <name> Add an installed external Stack package (repeatable)
|
|
73
|
+
--template-source <namespace=repository[#branch]> Add a template catalogue (repeatable)
|
|
67
74
|
--task <task> Select the prompt task (default: work)
|
|
68
75
|
--json Emit one machine-readable result
|
|
69
76
|
-h, --help Show this help
|
|
@@ -73,7 +80,7 @@ prompt to the agent you already use. Review all edits through the ordinary Git
|
|
|
73
80
|
diff, then run genesis verify for the Stack's concrete checks.
|
|
74
81
|
`;
|
|
75
82
|
|
|
76
|
-
const COMMANDS = new Set(['adopt', 'check', 'codex', 'collaboration', 'context', 'engineering', 'hook', 'index', 'init', 'inspect', 'migrate', 'prompt', 'stack', 'verify']);
|
|
83
|
+
const COMMANDS = new Set(['adopt', 'check', 'codex', 'collaboration', 'context', 'engineering', 'hook', 'index', 'init', 'inspect', 'migrate', 'prompt', 'stack', 'templates', 'verify']);
|
|
77
84
|
|
|
78
85
|
function parseCommand(argv) {
|
|
79
86
|
if (argv.length === 0 || argv.includes('--help') || argv.includes('-h') || argv[0] === 'help') {
|
|
@@ -91,6 +98,7 @@ function parseCommand(argv) {
|
|
|
91
98
|
json: { type: 'boolean', default: false },
|
|
92
99
|
'project-root': { type: 'string' },
|
|
93
100
|
'stack-package': { type: 'string', multiple: true, default: [] },
|
|
101
|
+
'template-source': { type: 'string', multiple: true, default: [] },
|
|
94
102
|
task: { type: 'string' },
|
|
95
103
|
},
|
|
96
104
|
});
|
|
@@ -101,13 +109,27 @@ function parseCommand(argv) {
|
|
|
101
109
|
json: parsed.values.json,
|
|
102
110
|
projectRoot: parsed.values['project-root'],
|
|
103
111
|
stackPackages: parsed.values['stack-package'],
|
|
112
|
+
templateSources: parsed.values['template-source'].map((source) => {
|
|
113
|
+
const separator = source.indexOf('=');
|
|
114
|
+
if (separator < 1) fail('CLI_TEMPLATE_SOURCE_INVALID', 'Use --template-source namespace=repository[#branch].');
|
|
115
|
+
const repositoryRef = source.slice(separator + 1);
|
|
116
|
+
const hash = repositoryRef.lastIndexOf('#');
|
|
117
|
+
return { namespace: source.slice(0, separator), repository: hash < 0 ? repositoryRef : repositoryRef.slice(0, hash), branch: hash < 0 ? 'main' : repositoryRef.slice(hash + 1) };
|
|
118
|
+
}),
|
|
104
119
|
task: parsed.values.task,
|
|
105
120
|
};
|
|
106
121
|
const operands = parsed.positionals;
|
|
122
|
+
if (options.templateSources.length && command !== 'templates') {
|
|
123
|
+
fail('CLI_OPTION_NOT_APPLICABLE', `Option --template-source is not applicable to ${command}.`);
|
|
124
|
+
}
|
|
107
125
|
if (options.task !== undefined && command !== 'prompt') {
|
|
108
126
|
fail('CLI_OPTION_NOT_APPLICABLE', `Option --task is not applicable to ${command}.`);
|
|
109
127
|
}
|
|
110
|
-
if (command === '
|
|
128
|
+
if (command === 'templates') {
|
|
129
|
+
if (!(operands[0] === 'list' && operands.length === 1) && !(operands[0] === 'apply' && operands.length === 2)) {
|
|
130
|
+
fail('CLI_TEMPLATE_ACTION_REQUIRED', 'Use templates list or templates apply <catalogue:technology/variant>.');
|
|
131
|
+
}
|
|
132
|
+
} else if (command === 'collaboration') {
|
|
111
133
|
const [action] = operands;
|
|
112
134
|
if (!['show', 'set'].includes(action)) {
|
|
113
135
|
fail('CLI_COLLABORATION_ACTION_REQUIRED', 'Command collaboration requires show or set.');
|
|
@@ -152,12 +174,12 @@ function parseCommand(argv) {
|
|
|
152
174
|
} else if (command === 'context' && operands.length === 0) {
|
|
153
175
|
fail('CONTEXT_PATH_REQUIRED', 'Command context requires at least one project path.');
|
|
154
176
|
} else if (command === 'inspect') {
|
|
155
|
-
const ordinaryInspection = operands.length === 1 && operands[0]
|
|
177
|
+
const ordinaryInspection = operands.length === 1 && ['environment', 'project'].includes(operands[0]);
|
|
156
178
|
const sectionInspection = operands.length >= 2 && operands[0] === 'section';
|
|
157
179
|
if (!ordinaryInspection && !sectionInspection) {
|
|
158
180
|
fail(
|
|
159
181
|
'CLI_INSPECT_TARGET_REQUIRED',
|
|
160
|
-
'Command inspect requires environment or section <name>.',
|
|
182
|
+
'Command inspect requires project, environment, or section <name>.',
|
|
161
183
|
);
|
|
162
184
|
}
|
|
163
185
|
} else if (command === 'hook' && (operands.length !== 1 || !['discover', 'session', 'turn'].includes(operands[0]))) {
|
|
@@ -256,6 +278,21 @@ function writeInspection(result) {
|
|
|
256
278
|
}
|
|
257
279
|
|
|
258
280
|
function writeResult(command, result) {
|
|
281
|
+
if (command === 'templates') {
|
|
282
|
+
if (result.templates) for (const entry of result.templates) line(process.stdout, `${entry.id}: ${entry.name} — ${entry.description}`);
|
|
283
|
+
else {
|
|
284
|
+
line(process.stdout, `Applied ${result.template.id} from ${result.source.repository} (${result.source.branch} at ${result.source.revision}).`);
|
|
285
|
+
namedItems('Changed files', result.changedFiles);
|
|
286
|
+
line(process.stdout, result.guidance);
|
|
287
|
+
}
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (command === 'inspect' && result.inspection === 'project') {
|
|
291
|
+
line(process.stdout, `Project: ${result.state}; source: ${result.content.kind}; Genesis: ${result.projectFormat.status}`);
|
|
292
|
+
line(process.stdout, `Next action: ${result.nextAction}. Templates: ${result.templateEligible ? 'available' : 'not applicable'}.`);
|
|
293
|
+
for (const diagnostic of result.diagnostics) line(process.stdout, `${diagnostic.code}: ${diagnostic.message}`);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
259
296
|
if (command === 'prompt') {
|
|
260
297
|
process.stdout.write(result.prompt.endsWith('\n') ? result.prompt : `${result.prompt}\n`);
|
|
261
298
|
return;
|
|
@@ -377,6 +414,10 @@ async function execute({ command, operands, options }, { signal } = {}) {
|
|
|
377
414
|
const projectRoot = options.projectRoot || process.cwd();
|
|
378
415
|
const stackPackages = await cliStackPackages(projectRoot, options.stackPackages || []);
|
|
379
416
|
if (command === 'init') return initialize({ projectRoot, stackPackages });
|
|
417
|
+
if (command === 'templates') {
|
|
418
|
+
const templateOptions = { projectRoot, stackPackages, templateSources: options.templateSources };
|
|
419
|
+
return operands[0] === 'list' ? listTemplates(templateOptions) : applyTemplate({ ...templateOptions, templateId: operands[1] });
|
|
420
|
+
}
|
|
380
421
|
if (command === 'migrate') return migrate({ projectRoot, stackPackages });
|
|
381
422
|
if (command === 'adopt') {
|
|
382
423
|
return adoptProject({ projectRoot, request: operands.join(' '), stackPackages });
|
|
@@ -455,7 +496,7 @@ async function execute({ command, operands, options }, { signal } = {}) {
|
|
|
455
496
|
}),
|
|
456
497
|
};
|
|
457
498
|
}
|
|
458
|
-
const inspections = { environment: inspectEnvironment };
|
|
499
|
+
const inspections = { environment: inspectEnvironment, project: inspectProject };
|
|
459
500
|
return {
|
|
460
501
|
inspection: operands[0],
|
|
461
502
|
...await inspections[operands[0]]({ projectRoot, stackPackages }),
|