@johndaskovsky/nightshift 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.
Files changed (41) hide show
  1. package/README.md +263 -0
  2. package/bin/nightshift.js +6 -0
  3. package/dist/cli/commands/init.d.ts +3 -0
  4. package/dist/cli/commands/init.d.ts.map +1 -0
  5. package/dist/cli/commands/init.js +97 -0
  6. package/dist/cli/commands/init.js.map +1 -0
  7. package/dist/cli/commands/update.d.ts +3 -0
  8. package/dist/cli/commands/update.d.ts.map +1 -0
  9. package/dist/cli/commands/update.js +92 -0
  10. package/dist/cli/commands/update.js.map +1 -0
  11. package/dist/cli/index.d.ts +4 -0
  12. package/dist/cli/index.d.ts.map +1 -0
  13. package/dist/cli/index.js +45 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/core/config-merger.d.ts +14 -0
  16. package/dist/core/config-merger.d.ts.map +1 -0
  17. package/dist/core/config-merger.js +70 -0
  18. package/dist/core/config-merger.js.map +1 -0
  19. package/dist/core/scaffolder.d.ts +24 -0
  20. package/dist/core/scaffolder.d.ts.map +1 -0
  21. package/dist/core/scaffolder.js +54 -0
  22. package/dist/core/scaffolder.js.map +1 -0
  23. package/dist/core/templates.d.ts +10 -0
  24. package/dist/core/templates.d.ts.map +1 -0
  25. package/dist/core/templates.js +30 -0
  26. package/dist/core/templates.js.map +1 -0
  27. package/dist/index.d.ts +5 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +5 -0
  30. package/dist/index.js.map +1 -0
  31. package/package.json +36 -0
  32. package/templates/agents/nightshift-dev.md +187 -0
  33. package/templates/agents/nightshift-manager.md +192 -0
  34. package/templates/agents/nightshift-qa.md +102 -0
  35. package/templates/commands/nightshift-add-task.md +96 -0
  36. package/templates/commands/nightshift-archive.md +67 -0
  37. package/templates/commands/nightshift-create.md +85 -0
  38. package/templates/commands/nightshift-start.md +78 -0
  39. package/templates/commands/nightshift-test-task.md +88 -0
  40. package/templates/commands/nightshift-update-table.md +81 -0
  41. package/templates/opencode.jsonc +92 -0
@@ -0,0 +1,96 @@
1
+ ---
2
+ description: Add a task to an existing Nightshift shift
3
+ ---
4
+
5
+ Add a new task file to a shift and update the table with a corresponding status column.
6
+
7
+ **Input**: The argument after `/nightshift-add-task` is the shift name, or omit to select interactively.
8
+
9
+ **Steps**
10
+
11
+ 1. **Select the shift**
12
+
13
+ If a name is provided, use it. Otherwise:
14
+ - List directories in `.nightshift/` (excluding `archive/`)
15
+ - If no shifts exist, report: "No active shifts. Use `/nightshift-create` first."
16
+ - If one shift exists, auto-select it
17
+ - If multiple shifts exist, use the **AskUserQuestion tool** to let the user pick
18
+
19
+ 2. **Get task details**
20
+
21
+ Use the **AskUserQuestion tool** (open-ended) to ask:
22
+ > "Describe this task. What should the agent do for each item? Include the tools needed, step-by-step instructions, and how to verify success."
23
+
24
+ From their description, derive:
25
+ - A kebab-case task name
26
+ - The Configuration section (tools list)
27
+ - The Steps section (numbered instructions)
28
+ - The Validation section (verification criteria)
29
+
30
+ 3. **Check for task name conflicts**
31
+
32
+ If a file `<task-name>.md` already exists in the shift directory, report the conflict and suggest a different name.
33
+
34
+ 4. **Create the task file**
35
+
36
+ Write `.nightshift/<shift-name>/<task-name>.md`:
37
+
38
+ ```markdown
39
+ ## Configuration
40
+
41
+ - tools: <tool1>, <tool2>
42
+
43
+ ## Steps
44
+
45
+ 1. <step description>
46
+ 2. <step description>
47
+ 3. <step description>
48
+
49
+ ## Validation
50
+
51
+ - <criterion 1>
52
+ - <criterion 2>
53
+ ```
54
+
55
+ 5. **Update table.csv**
56
+
57
+ Read `table.csv` and add a new column for this task:
58
+ - Column header: the task name (e.g., `create-page`)
59
+ - All existing rows get status `todo` in this column
60
+ - If the table is empty (header only), just add the column header
61
+
62
+ 6. **Update manager.md**
63
+
64
+ Add the task to the `## Task Order` section:
65
+ - If it's the first task, replace the placeholder text with `1. <task-name>`
66
+ - Otherwise, append as the next numbered item
67
+
68
+ 7. **Show result**
69
+
70
+ Present the created task file for review and show the updated state:
71
+
72
+ ```
73
+ ## Task Added: <task-name>
74
+
75
+ **Shift:** <shift-name>
76
+ **File:** `.nightshift/<shift-name>/<task-name>.md`
77
+
78
+ ### Configuration
79
+ - tools: <tools>
80
+
81
+ ### Steps
82
+ 1. ...
83
+
84
+ ### Validation
85
+ - ...
86
+
87
+ Table updated: <N> items now have `<task-name>: todo`
88
+ Manager updated: task order now includes `<task-name>`
89
+ ```
90
+
91
+ **Guardrails**
92
+ - Always create all three sections (Configuration, Steps, Validation)
93
+ - Initialize all existing table rows with `todo` for the new task column
94
+ - Update manager.md task order to include the new task
95
+ - Validate kebab-case task naming
96
+ - Never overwrite an existing task file
@@ -0,0 +1,67 @@
1
+ ---
2
+ description: Archive a completed Nightshift shift
3
+ ---
4
+
5
+ Move a completed (or partially completed) shift to the archive directory with a date prefix.
6
+
7
+ **Input**: The argument after `/nightshift-archive` is the shift name, or omit to select interactively.
8
+
9
+ **Steps**
10
+
11
+ 1. **Select the shift**
12
+
13
+ If a name is provided, use it. Otherwise:
14
+ - List directories in `.nightshift/` (excluding `archive/`)
15
+ - If no shifts exist, report: "No active shifts to archive."
16
+ - If one shift exists, auto-select it
17
+ - If multiple shifts exist, use the **AskUserQuestion tool** to let the user pick
18
+
19
+ 2. **Validate the shift exists**
20
+
21
+ Check `.nightshift/<name>/` exists. If not, report the error.
22
+
23
+ 3. **Check for incomplete items**
24
+
25
+ Read `table.csv` and check for items NOT in `done` status:
26
+ - If incomplete items exist, warn:
27
+ ```
28
+ Warning: Shift has incomplete items:
29
+ - X items with status "todo"
30
+ - Y items with status "failed"
31
+ - Z items with status "in_progress"
32
+ ```
33
+ Use the **AskUserQuestion tool** to confirm:
34
+ > "Archive anyway?"
35
+ Options: "Yes, archive with incomplete items" / "No, cancel"
36
+
37
+ - If user cancels, STOP
38
+
39
+ 4. **Check for archive name collision**
40
+
41
+ The target is `.nightshift/archive/YYYY-MM-DD-<name>/` using today's date.
42
+ - If the target already exists, report: "Archive target already exists: `.nightshift/archive/YYYY-MM-DD-<name>/`. Cannot overwrite."
43
+ - STOP if collision found
44
+
45
+ 5. **Move to archive**
46
+
47
+ Use bash to move the shift directory:
48
+ ```bash
49
+ mv .nightshift/<name> .nightshift/archive/YYYY-MM-DD-<name>
50
+ ```
51
+
52
+ 6. **Confirm**
53
+
54
+ ```
55
+ ## Shift Archived
56
+
57
+ **Shift:** <name>
58
+ **Location:** `.nightshift/archive/YYYY-MM-DD-<name>/`
59
+
60
+ All files preserved (manager.md, table.csv, task files).
61
+ ```
62
+
63
+ **Guardrails**
64
+ - Always use today's date in ISO YYYY-MM-DD format for the archive prefix
65
+ - Never overwrite an existing archive
66
+ - Warn about incomplete items but allow archiving with confirmation
67
+ - Preserve all files in the move (manager.md, table.csv, all task .md files)
@@ -0,0 +1,85 @@
1
+ ---
2
+ description: Create a new Nightshift shift with manager, table, and optional task files
3
+ ---
4
+
5
+ Create a new Nightshift shift — a structured unit of batch agent work.
6
+
7
+ **Input**: The argument after `/nightshift-create` is the shift name (kebab-case), or omit for interactive mode.
8
+
9
+ **Steps**
10
+
11
+ 1. **Get shift name**
12
+
13
+ If a name is provided as argument, use it. Otherwise, use the **AskUserQuestion tool** (open-ended) to ask:
14
+ > "What will this shift do? Describe the batch work and I'll derive a name."
15
+
16
+ Derive a kebab-case name from their description (e.g., "create promo example pages" -> `create-promo-examples`).
17
+
18
+ 2. **Validate the name**
19
+
20
+ - Must be kebab-case: lowercase letters, numbers, and hyphens only
21
+ - If invalid, report the error and ask for a valid name
22
+
23
+ 3. **Check for conflicts**
24
+
25
+ - If `.nightshift/<name>/` already exists, report: "Shift `<name>` already exists. Use `/nightshift-start <name>` to resume it."
26
+ - STOP if conflict found
27
+
28
+ 4. **Create the shift directory and files**
29
+
30
+ Create `.nightshift/<name>/` with these files:
31
+
32
+ **manager.md:**
33
+ ```markdown
34
+ ## Shift Configuration
35
+
36
+ - name: <name>
37
+ - created: <YYYY-MM-DD>
38
+
39
+ ## Task Order
40
+
41
+ (no tasks yet — use `/nightshift-add-task <name>` to add tasks)
42
+
43
+ ## Progress
44
+
45
+ - Total items: 0
46
+ - Completed: 0
47
+ - Failed: 0
48
+ - Remaining: 0
49
+ ```
50
+
51
+ **table.csv:**
52
+ ```
53
+ row
54
+ ```
55
+
56
+ (Just the header row with the `row` column — items and task columns added later.)
57
+
58
+ 5. **Ask about initial tasks**
59
+
60
+ Use the **AskUserQuestion tool** to ask:
61
+ > "Shift `<name>` created! Do you want to add a task now?"
62
+
63
+ Options: "Yes, add a task" / "No, I'll add tasks later"
64
+
65
+ If yes, guide them through `/nightshift-add-task <name>` flow (describe the task, create the file, update table and manager).
66
+
67
+ **Output**
68
+
69
+ ```
70
+ ## Shift Created: <name>
71
+
72
+ **Location:** `.nightshift/<name>/`
73
+ **Files:** manager.md, table.csv
74
+
75
+ ### Next Steps
76
+ - `/nightshift-add-task <name>` — add tasks to the shift
77
+ - `/nightshift-update-table <name>` — add items to the table
78
+ - `/nightshift-start <name>` — begin execution (after adding tasks and items)
79
+ ```
80
+
81
+ **Guardrails**
82
+ - Always validate kebab-case naming
83
+ - Never overwrite an existing shift
84
+ - Create both manager.md and table.csv even if no tasks or items are defined yet
85
+ - Use today's date (ISO YYYY-MM-DD) for the created field
@@ -0,0 +1,78 @@
1
+ ---
2
+ description: Start or resume execution of a Nightshift shift
3
+ ---
4
+
5
+ Begin or resume executing a Nightshift shift by invoking the manager agent.
6
+
7
+ **Input**: The argument after `/nightshift-start` is the shift name, or omit to select interactively.
8
+
9
+ **Steps**
10
+
11
+ 1. **Select the shift**
12
+
13
+ If a name is provided, use it. Otherwise:
14
+ - List directories in `.nightshift/` (excluding `archive/`)
15
+ - If no shifts exist, report: "No active shifts. Use `/nightshift-create` to create one."
16
+ - If one shift exists, auto-select it
17
+ - If multiple shifts exist, use the **AskUserQuestion tool** to let the user pick
18
+
19
+ 2. **Validate the shift exists**
20
+
21
+ - Check `.nightshift/<name>/` exists
22
+ - Check `manager.md` and `table.csv` exist within it
23
+ - If missing, report the error and suggest `/nightshift-create`
24
+
25
+ 3. **Check if shift is already complete**
26
+
27
+ Read `table.csv` and check if ALL item-task statuses are `done`:
28
+ - If complete: report "Shift `<name>` is already complete! All items are done." and suggest `/nightshift-archive <name>`
29
+ - If no items exist (table has only header): report "Shift has no items. Use `/nightshift-update-table <name>` to add items first."
30
+ - If no task columns exist: report "Shift has no tasks. Use `/nightshift-add-task <name>` to add tasks first."
31
+
32
+ 4. **Show pre-flight summary**
33
+
34
+ Read `manager.md` and `table.csv` to display:
35
+ ```
36
+ ## Starting Shift: <name>
37
+
38
+ **Tasks:** <task-1>, <task-2>, ...
39
+ **Items:** N total
40
+ **Status:** X done, Y failed, Z remaining
41
+
42
+ Beginning execution...
43
+ ```
44
+
45
+ 5. **Invoke the manager agent**
46
+
47
+ Use the **Task tool** to invoke the `nightshift-manager` subagent with:
48
+ ```
49
+ Execute Nightshift shift "<name>".
50
+
51
+ Shift directory: .nightshift/<name>/
52
+
53
+ Read manager.md for task order and configuration.
54
+ Read table.csv for item statuses.
55
+ Process all remaining items following the orchestration logic in your instructions.
56
+ ```
57
+
58
+ 6. **Report results**
59
+
60
+ After the manager completes, display the final status:
61
+ ```
62
+ ## Shift Execution Complete
63
+
64
+ **Shift:** <name>
65
+ **Completed:** N
66
+ **Failed:** N
67
+ **Remaining:** N
68
+
69
+ [If all done] All items complete! Archive with `/nightshift-archive <name>`
70
+ [If failures] Some items failed. Review table.csv for details.
71
+ [If remaining] Shift paused. Resume with `/nightshift-start <name>`
72
+ ```
73
+
74
+ **Guardrails**
75
+ - Always validate the shift directory structure before starting
76
+ - Show the pre-flight summary before invoking the manager
77
+ - Report results after the manager finishes
78
+ - Don't invoke the manager if there's nothing to process
@@ -0,0 +1,88 @@
1
+ ---
2
+ description: Run a single Nightshift task on a single table row for testing
3
+ ---
4
+
5
+ Execute a single task on one item for testing purposes — without modifying the table state.
6
+
7
+ **Input**: The argument after `/nightshift-test-task` is the shift name, or omit to select interactively.
8
+
9
+ **Steps**
10
+
11
+ 1. **Select the shift**
12
+
13
+ If a name is provided, use it. Otherwise:
14
+ - List directories in `.nightshift/` (excluding `archive/`)
15
+ - Auto-select if only one exists, otherwise prompt for selection
16
+
17
+ 2. **Select the task**
18
+
19
+ List task files (`.md` files excluding `manager.md`) in the shift directory.
20
+ - If one task exists, auto-select it
21
+ - If multiple tasks exist, use the **AskUserQuestion tool** to let the user pick
22
+
23
+ 3. **Select the row**
24
+
25
+ Read `table.csv` and show available rows. Use the **AskUserQuestion tool** to ask:
26
+ > "Which row do you want to test? Enter a row number."
27
+
28
+ Show a preview of the row's metadata columns to help them choose.
29
+
30
+ 4. **Execute the task (dev agent)**
31
+
32
+ Use the **Task tool** to invoke the `nightshift-dev` subagent with:
33
+ ```
34
+ You are executing Nightshift task "<task-name>" on a single item FOR TESTING.
35
+ Do NOT modify table.csv or manager.md.
36
+
37
+ ## Shift Directory
38
+ .nightshift/<shift-name>/
39
+
40
+ ## Task File
41
+ <full contents of task-name.md>
42
+
43
+ ## Item Data (Row <N>)
44
+ <all column values for this row>
45
+
46
+ Execute the steps and return structured results.
47
+ ```
48
+
49
+ 5. **Verify the task (qa agent)**
50
+
51
+ Use the **Task tool** to invoke the `nightshift-qa` subagent with:
52
+ ```
53
+ You are verifying Nightshift task "<task-name>" on a single item FOR TESTING.
54
+
55
+ ## Task Validation Criteria
56
+ <Validation section from task file>
57
+
58
+ ## Item Data (Row <N>)
59
+ <all column values>
60
+
61
+ ## Dev Results
62
+ <dev agent's returned results>
63
+
64
+ Check each criterion and return structured results.
65
+ ```
66
+
67
+ 6. **Display results (without updating table)**
68
+
69
+ ```
70
+ ## Test Results: <task-name> on Row <N>
71
+
72
+ ### Dev Execution
73
+ <step-by-step results from dev agent>
74
+
75
+ ### QA Verification
76
+ <per-criterion results from qa agent>
77
+
78
+ ### Overall: PASS / FAIL
79
+
80
+ Note: Table state was NOT modified. This was a test run only.
81
+ ```
82
+
83
+ **Guardrails**
84
+ - NEVER modify table.csv during a test run
85
+ - NEVER modify manager.md during a test run
86
+ - Always run both dev and qa agents to get the full picture
87
+ - Display detailed results so the user can debug task definitions
88
+ - Include the "test run only" note in output
@@ -0,0 +1,81 @@
1
+ ---
2
+ description: Make bulk changes to a Nightshift shift table
3
+ ---
4
+
5
+ Bulk modify the table.csv of a shift — add rows, update metadata, or reset failed items.
6
+
7
+ **Input**: The argument after `/nightshift-update-table` is the shift name, or omit to select interactively.
8
+
9
+ **Steps**
10
+
11
+ 1. **Select the shift**
12
+
13
+ If a name is provided, use it. Otherwise:
14
+ - List directories in `.nightshift/` (excluding `archive/`)
15
+ - Auto-select if only one exists, otherwise prompt for selection
16
+
17
+ 2. **Show current table state**
18
+
19
+ Read and display `table.csv` summary:
20
+ - Number of rows
21
+ - Column names
22
+ - Status distribution per task column (how many todo, done, failed, etc.)
23
+
24
+ 3. **Determine the operation**
25
+
26
+ Use the **AskUserQuestion tool** to ask:
27
+ > "What do you want to do?"
28
+
29
+ Options:
30
+ - "Add rows" — append new items to the table
31
+ - "Update metadata" — modify metadata column values
32
+ - "Reset failed items" — change `failed` statuses back to `todo`
33
+
34
+ 4. **Execute the operation**
35
+
36
+ **Add rows:**
37
+ - Ask user for the data (they can paste CSV, describe items, or point to a data source)
38
+ - Assign sequential row numbers continuing from the last row
39
+ - Set all task status columns to `todo` for new rows
40
+ - Append to table.csv
41
+
42
+ **Update metadata:**
43
+ - Ask which column and which rows to update
44
+ - Show a preview of the changes
45
+ - Confirm before applying
46
+ - Update the specified cells while preserving all status columns
47
+
48
+ **Reset failed items:**
49
+ - Ask which task column to reset (or all tasks)
50
+ - Show how many items will be reset
51
+ - Confirm before applying
52
+ - Change `failed` → `todo` for the specified task column(s)
53
+
54
+ 5. **Confirm destructive changes**
55
+
56
+ For operations that modify existing data (update metadata, reset failed):
57
+ - Show a summary: "This will change N cells in M rows"
58
+ - Use the **AskUserQuestion tool**: "Apply these changes?"
59
+ - Only proceed on confirmation
60
+
61
+ 6. **Update progress in manager.md**
62
+
63
+ After modifying the table, recalculate and update the `## Progress` section in manager.md with current counts.
64
+
65
+ 7. **Show result**
66
+
67
+ ```
68
+ ## Table Updated: <shift-name>
69
+
70
+ **Operation:** <what was done>
71
+ **Rows affected:** N
72
+ **Current state:** X total items, Y todo, Z done, W failed
73
+ ```
74
+
75
+ **Guardrails**
76
+ - Always confirm before modifying existing data
77
+ - Preserve row numbering continuity when adding rows
78
+ - Set all task columns to `todo` for new rows
79
+ - Never reorder existing rows
80
+ - Update manager.md progress after any change
81
+ - Show the user what will change before applying
@@ -0,0 +1,92 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "mcp": {},
4
+
5
+ // Global permissions for tools and MCP integrations
6
+ "permission": {
7
+ // File editing permissions
8
+ "edit": "allow",
9
+
10
+ // Bash command permissions (pattern-based)
11
+ "bash": {
12
+ "*": "ask",
13
+ "mkdir*": "allow",
14
+ "test*": "allow",
15
+ "cat*": "allow",
16
+ "head*": "allow",
17
+ "xargs*": "allow",
18
+ "curl*": "allow"
19
+ },
20
+
21
+ // Web fetch permissions
22
+ "webfetch": "allow"
23
+ },
24
+
25
+ // Agent configurations
26
+ "agent": {
27
+ // Nightshift manager — orchestrates shift execution
28
+ "nightshift-manager": {
29
+ "description": "Orchestrate a Nightshift shift: read manager.md and table.csv, delegate items to dev and qa agents, update status",
30
+ "mode": "subagent",
31
+ "tools": {
32
+ "write": true,
33
+ "edit": true,
34
+ "read": true,
35
+ "glob": true,
36
+ "grep": true,
37
+ "task": true
38
+ },
39
+ "permission": {
40
+ "bash": {
41
+ "*": "deny"
42
+ },
43
+ "task": {
44
+ "*": "deny",
45
+ "nightshift-dev": "allow",
46
+ "nightshift-qa": "allow"
47
+ }
48
+ }
49
+ },
50
+
51
+ // Nightshift dev — executes task steps on a single item
52
+ "nightshift-dev": {
53
+ "description": "Execute Nightshift task steps on a single table item and return structured results",
54
+ "mode": "subagent",
55
+ "tools": {
56
+ "write": true,
57
+ "edit": true,
58
+ "read": true,
59
+ "glob": true,
60
+ "grep": true,
61
+ "task": false,
62
+ "playwright_*": true
63
+ },
64
+ "permission": {
65
+ "bash": {
66
+ "*": "deny",
67
+ "mkdir*": "allow"
68
+ }
69
+ }
70
+ },
71
+
72
+ // Nightshift qa — verifies task completion
73
+ "nightshift-qa": {
74
+ "description": "Verify Nightshift task completion against validation criteria and report pass/fail",
75
+ "mode": "subagent",
76
+ "tools": {
77
+ "write": false,
78
+ "edit": false,
79
+ "read": true,
80
+ "glob": true,
81
+ "grep": true,
82
+ "task": false,
83
+ "playwright_*": true
84
+ },
85
+ "permission": {
86
+ "bash": {
87
+ "*": "deny"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }