Эх сурвалжийг харах

Add deepwork and clonedeps ignore file setup instructions

Alvin Unreal 3 долоо хоног өмнө
parent
commit
7d922c56b5

+ 10 - 5
docs/skills.md

@@ -106,11 +106,16 @@ Start it directly with:
 ```
 
 **How it works:**
-1. Orchestrator creates a session artifact at `.slim/deepwork/<task>.md`
-2. Draft plan → Oracle review → Revise until acceptable
-3. Create phased implementation plan → Oracle review
-4. Execute phase by phase with validation
-5. After each phase: validate → Oracle review → fix issues → continue
+1. Before planning, delegation, or state creation, inspect `.gitignore` and
+   `.ignore`; add only missing entries (without duplicates) for
+   `.slim/deepwork/` in `.gitignore` and `!.slim/deepwork/` plus
+   `!.slim/deepwork/**` in `.ignore`. This keeps state git-local while making it
+   readable to OpenCode.
+2. Orchestrator creates a session artifact at `.slim/deepwork/<task>.md`
+3. Draft plan → Oracle review → Revise until acceptable
+4. Create phased implementation plan → Oracle review
+5. Execute phase by phase with validation
+6. After each phase: validate → Oracle review → fix issues → continue
 
 **Key features:**
 - Persistent session state in markdown files

+ 11 - 0
src/hooks/deepwork/index.test.ts

@@ -57,6 +57,17 @@ describe('deepwork command hook', () => {
 
     expect(output.parts).toHaveLength(1);
     expect(output.parts[0].text).toContain('Use the deepwork skill');
+    expect(output.parts[0].text).toContain(
+      'before planning, delegation, or creating state',
+    );
+    expect(output.parts[0].text).toContain('.gitignore');
+    expect(output.parts[0].text).toContain('.ignore');
+    expect(output.parts[0].text).toContain('!.slim/deepwork/');
+    expect(output.parts[0].text).toContain('!.slim/deepwork/**');
+    expect(output.parts[0].text).toContain(
+      'add only missing entries without duplicates',
+    );
+    expect(output.parts[0].text).toContain('git-local yet OpenCode-readable');
     expect(output.parts[0].text).toContain('.slim/deepwork/');
     expect(output.parts[0].text).toContain('@oracle');
     expect(output.parts[0].text).toContain('simplify/readability');

+ 1 - 0
src/hooks/deepwork/index.ts

@@ -8,6 +8,7 @@ function activationPrompt(task: string): string {
     'Use the deepwork skill for this task. Treat it as a heavy coding session.',
     '',
     'Deepwork requirements:',
+    '- before planning, delegation, or creating state, inspect existing `.gitignore` and `.ignore`; add only missing entries without duplicates: `.gitignore` must contain `.slim/deepwork/`, and `.ignore` must contain `!.slim/deepwork/` and `!.slim/deepwork/**`; this keeps state git-local yet OpenCode-readable;',
     '- create/update a `.slim/deepwork/` progress file;',
     '- keep OpenCode todos synced with the current phase;',
     '- draft a plan and get `@oracle` review before implementation;',

+ 32 - 29
src/skills/clonedeps/SKILL.md

@@ -100,7 +100,37 @@ The orchestrator owns final approval. Before cloning:
 5. Ask for confirmation before network cloning unless the user explicitly asked
    to clone immediately.
 
-### Step 4: Clone Sources Manually
+### Step 4: Update Ignore Files
+
+Before cloning artifacts or cleaning cloned dependencies, inspect existing
+`.gitignore` and `.ignore`. Update the managed block in place when present;
+otherwise append it. Add only the missing exact lines below, never duplicate
+entries or modify unrelated rules. These blocks keep cloned artifacts git-local
+while the `.ignore` allowlist keeps them readable to OpenCode.
+
+`.gitignore`:
+
+```gitignore
+# BEGIN oh-my-opencode-slim clonedeps
+.slim/clonedeps/repos/
+# END oh-my-opencode-slim clonedeps
+```
+
+`.ignore`:
+
+```ignore
+# BEGIN oh-my-opencode-slim clonedeps
+!.slim/
+!.slim/clonedeps.json
+!.slim/clonedeps/
+!.slim/clonedeps/repos/
+!.slim/clonedeps/repos/**
+.slim/clonedeps/repos/**/.git/
+.slim/clonedeps/repos/**/.git/**
+# END oh-my-opencode-slim clonedeps
+```
+
+### Step 5: Clone Sources Manually
 
 Create one folder per source repository under:
 
@@ -135,7 +165,7 @@ Safe manual git pattern:
 
 Do not run dependency install/build/test scripts from cloned repositories.
 
-### Step 5: Write Local State
+### Step 6: Write Local State
 
 Write `.slim/clonedeps.json` so future agents know what exists:
 
@@ -173,33 +203,6 @@ Do not add `.slim/clonedeps.json` to `.gitignore`. It is small, reviewable
 project metadata that can be committed. Only the cloned repository contents
 under `.slim/clonedeps/repos/` should be ignored.
 
-### Step 6: Update Ignore Files
-
-Update `.gitignore` with an idempotent marker block:
-
-```gitignore
-# BEGIN oh-my-opencode-slim clonedeps
-.slim/clonedeps/repos/
-# END oh-my-opencode-slim clonedeps
-```
-
-Update `.ignore` so OpenCode can read the cloned source while git still ignores
-it:
-
-```ignore
-# BEGIN oh-my-opencode-slim clonedeps
-!.slim/
-!.slim/clonedeps.json
-!.slim/clonedeps/
-!.slim/clonedeps/repos/
-!.slim/clonedeps/repos/**
-.slim/clonedeps/repos/**/.git/
-.slim/clonedeps/repos/**/.git/**
-# END oh-my-opencode-slim clonedeps
-```
-
-Only edit content inside these marker blocks.
-
 ### Step 7: Register Dependency Source in AGENTS.md
 
 After successful cloning, update the repository root `AGENTS.md` so future

+ 8 - 2
src/skills/deepwork/SKILL.md

@@ -16,6 +16,10 @@ not as the default implementation worker.
 
 Required behavior:
 
+- before planning, delegation, or creating a deepwork state file, inspect the
+  existing `.gitignore` and `.ignore`; add only missing entries, without
+  duplicates, so `.gitignore` contains `.slim/deepwork/` and `.ignore` contains
+  `!.slim/deepwork/` and `!.slim/deepwork/**`;
 - keep OpenCode todos aligned with the active deepwork phase;
 - create and maintain a local markdown progress file under `.slim/deepwork/`;
 - write valuable research findings into that file as confirmed research context
@@ -65,8 +69,8 @@ Create a task-specific file such as:
 .slim/deepwork/<short-task-slug>.md
 ```
 
-Keep `.slim/deepwork/` out of git, but make it readable to OpenCode. Ensure the
-project ignore files include:
+Before creating this file—and before planning or delegation—inspect the existing
+`.gitignore` and `.ignore`. Add only missing entries and do not add duplicates:
 
 ```gitignore
 # .gitignore
@@ -79,6 +83,8 @@ project ignore files include:
 !.slim/deepwork/**
 ```
 
+These rules keep deepwork state git-local while allowing OpenCode to read it.
+
 Do not follow a rigid template. Choose whatever markdown structure best fits the
 work. The file only needs to remain useful as persistent session state and should
 capture, as applicable:

+ 14 - 7
src/skills/worktrees/SKILL.md

@@ -81,7 +81,11 @@ operation.
 
 ### 3. Ignore File Setup
 
-Before creating lanes, add or update managed marker blocks only.
+Before creating or cleaning lanes, inspect existing `.gitignore` and `.ignore`.
+Update the managed block in place when present; otherwise append it. Add only
+the missing exact lines below, never duplicate entries or modify unrelated
+rules. These blocks keep lane artifacts git-local while the `.ignore` allowlist
+keeps them readable to OpenCode.
 
 `.gitignore`:
 
@@ -111,7 +115,8 @@ Before creating lanes, add or update managed marker blocks only.
 1. Identify the task scope and determine a short `<slug>` for the worktree.
 2. Formulate a branch name. Default to `omos/<slug>` unless project/user conventions dictate otherwise.
 3. Validate repository safety. Ask the user for confirmation to initialize the lane.
-4. Ensure the managed ignore blocks are present.
+4. Before creating the lane, ensure the managed ignore blocks are present using
+   the Ignore File Setup rules above.
 5. Run:
    ```bash
    git worktree add -b <branch-name> .slim/worktrees/<slug> <base-commit/branch>
@@ -138,14 +143,16 @@ Before merging or integrating the worktree branch:
    checkout or the user-approved integration checkout.
 
 ### Phase 4: Cleanup & Pruning
-1. Ensure all changes are safely merged or archived.
-2. Confirm the worktree has no uncommitted changes.
-3. Request user approval to remove the worktree.
-4. Safely remove the worktree using:
+1. Before cleaning the lane, ensure the managed ignore blocks follow the Ignore
+   File Setup rules above.
+2. Ensure all changes are safely merged or archived.
+3. Confirm the worktree has no uncommitted changes.
+4. Request user approval to remove the worktree.
+5. Safely remove the worktree using:
    ```bash
    git worktree remove .slim/worktrees/<slug>
    ```
-5. Update `.slim/worktrees.json` to mark the lane as `archived` or remove it.
+6. Update `.slim/worktrees.json` to mark the lane as `archived` or remove it.
 
 ---