@autosk/feature-dev 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wierdbytes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # @autosk/feature-dev
2
+
3
+ The shipped **reference workflow** for autoskd v2: a full feature-development
4
+ cycle wired to [`@autosk/pi-agent`](../pi-agent) roles and
5
+ [`@autosk/worktree`](../worktree) isolation. It replaces v1's
6
+ `feature-dev-generic` bootstrap (design
7
+ `docs/plans/20260612-Bun-Daemon-Extensions.md` §3.6, P6).
8
+
9
+ ## The workflow
10
+
11
+ ```text
12
+ dev ──▶ review ──▶ docs ──▶ validator ──▶ accept (human)
13
+ ▲ │ │
14
+ └────────┘────────────────────┘ (review→dev and validator→dev bounce-backs)
15
+ ```
16
+
17
+ | Step | Kind | Notes |
18
+ | ----------- | ----------------------------- | ------------------------------------------------------------ |
19
+ | `dev` | `piAgent` (name `dev`) | first step; implements the task |
20
+ | `review` | `piAgent` (name `review`) | thorough code review (`thinking: xhigh`); bounces back to `dev` |
21
+ | `docs` | `piAgent` (name `docs`) | documentation pass |
22
+ | `validator` | `piAgent` (name `validator`) | independent item-by-item verification; bounces back to `dev` |
23
+ | `accept` | `statusStep("human")` | the engine parks here for a human's final acceptance |
24
+
25
+ Each agent step is an inline `@autosk/pi-agent` value: the **step key is the
26
+ agent name** (`dev`/`review`/`docs`/`validator`), and registering the workflow
27
+ registers those agents — there is no separate agent registration.
28
+
29
+ - **Isolation:** `worktreeIsolation()` — each task runs in its own git worktree.
30
+ - **Visit cap:** `onTransit` rejects a bounce-back into `dev` once the task has
31
+ already entered `dev` `DEV_VISIT_CAP` (5) times — the 6th `dev` entry is
32
+ rejected (via `ctx.visits("dev")`), so a task that keeps failing review/
33
+ validation parks for a human instead of looping forever.
34
+
35
+ The role prompts live under [`prompts/`](./prompts) as `.md` files; the workflow
36
+ reads each one and seeds it into the corresponding pi agent as its `firstMessage`.
37
+
38
+ ## Discovery — how every project gets it
39
+
40
+ `feature-dev` is an **npm package** (declared via `package.json#autosk.extensions`).
41
+ The daemon installs it into `~/.autosk/packages/` on first run (see the
42
+ [extensions docs → First-run bootstrap](../../../docs/extensions.md#first-run-bootstrap))
43
+ and lists it in `~/.autosk/settings.json`, so every project can enroll into
44
+ `feature-dev` with **no per-project files**:
45
+
46
+ ```
47
+ project-local (.autosk/extensions) ▸ global (~/.autosk/extensions) ▸ npm (settings.json)
48
+ ```
49
+
50
+ A project- or global-level extension that registers a workflow/agent of the same
51
+ name **overrides** the npm one (first-registered wins). To enroll a task:
52
+
53
+ ```
54
+ autosk enroll <task-id> --workflow feature-dev
55
+ ```
56
+
57
+ ## Configuration
58
+
59
+ This package exposes no per-step config knobs of its own — the agent behaviour
60
+ is configured on the inline [`@autosk/pi-agent`](../pi-agent) step values (model,
61
+ thinking, extra args, …) inside `featureDevWorkflow()`. To customise, copy this
62
+ extension into `~/.autosk/extensions/` (or your project's `.autosk/extensions/`)
63
+ and edit the `piAgent({...})` / `featureDevWorkflow({...})` calls; your copy then
64
+ overrides the npm one.
65
+
66
+ ## Exports
67
+
68
+ - default export — the extension factory (registers the workflow, whose steps
69
+ carry the four inline agents).
70
+ - `featureDevWorkflow(options?)` → `WorkflowDefinition` (a factory; tests inject
71
+ a custom `isolation`).
72
+ - `DEV_VISIT_CAP` — the `dev` re-entry cap constant.
package/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ // Root entry re-export.
2
+ //
3
+ // The compiled `autoskd` (`bun build --compile`) resolves an on-disk
4
+ // extension's bare `@autosk/*` imports with a minimal resolver that only honors
5
+ // a ROOT-LEVEL `index.ts`/`index.js` — it ignores `package.json` `exports` /
6
+ // `main` and any subdir target. So this package keeps its sources under `src/`
7
+ // but exposes a root `index.ts` the standalone daemon can find. (Interpreted
8
+ // Bun honors `exports` directly; this shim is what makes the published package
9
+ // both discoverable as an extension and loadable by the compiled binary.)
10
+ export * from "./src/index.ts";
11
+ export { default } from "./src/index.ts";
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@autosk/feature-dev",
3
+ "version": "0.1.0",
4
+ "description": "feature-dev (dev → review → docs → validator → accept) wired to @autosk/pi-agent roles and worktree isolation.",
5
+ "license": "MIT",
6
+ "author": "wierdbytes",
7
+ "homepage": "https://github.com/wierdbytes/autosk#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/wierdbytes/autosk.git",
11
+ "directory": "daemon/extensions/feature-dev"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/wierdbytes/autosk/issues"
15
+ },
16
+ "keywords": [
17
+ "autosk",
18
+ "autosk-extension",
19
+ "workflow",
20
+ "feature-dev"
21
+ ],
22
+ "type": "module",
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "exports": {
27
+ ".": "./index.ts"
28
+ },
29
+ "types": "./index.ts",
30
+ "autosk": {
31
+ "extensions": ["./index.ts"]
32
+ },
33
+ "files": [
34
+ "index.ts",
35
+ "src/",
36
+ "prompts/",
37
+ "README.md"
38
+ ],
39
+ "dependencies": {
40
+ "@autosk/pi-agent": "^0.1.0",
41
+ "@autosk/sdk": "^0.1.0",
42
+ "@autosk/worktree": "^0.1.0"
43
+ },
44
+ "scripts": {
45
+ "typecheck": "tsc --noEmit -p tsconfig.json"
46
+ }
47
+ }
package/prompts/dev.md ADDED
@@ -0,0 +1,11 @@
1
+ You are the DEVELOPER.
2
+
3
+ You receive a task with a description and an implementation plan (see the task title + description and any comments). Your job:
4
+
5
+ 1. Read the description and the plan carefully.
6
+ 2. Implement the task strictly according to the plan, without deviating from it unless you have a concrete reason. If the plan conflicts with reality or is incomplete, record that in a comment and propose the smallest reasonable deviation.
7
+ 3. Make sure the code builds and local checks/tests pass.
8
+ 4. Do NOT touch project documentation at this step — that is the job of the dedicated `docs` step.
9
+ 5. If you are blocked by something external, file a blocker task and do not transit until the blocker is resolved.
10
+
11
+ When the implementation per the plan is complete and local checks pass, hand the task off to the `review` step. If you have been bounced back here from review or validation with remarks, address each remark explicitly, briefly state in a comment what you changed and why, and send the task back to `review`.
@@ -0,0 +1,13 @@
1
+ You are the DOCUMENTATION agent.
2
+
3
+ You receive the task and the final (post-review) implementation. Your job is to decide whether project documentation needs to be updated because of these changes:
4
+
5
+ - The top-level `README.md` and per-subproject READMEs.
6
+ - The contents of `docs/` (tutorials, design notes, diagrams).
7
+ - Doc comments on public APIs / CLI / config.
8
+ - Usage and configuration examples.
9
+ - `CHANGELOG` / release notes, if the project keeps them.
10
+
11
+ If updates are needed, make them directly in the repository as minimal focused commits and briefly list in a comment what was updated and where. If updates are NOT needed, explicitly record that with a comment like "docs: no changes required — <one-sentence reason>", so the validator and the human can see that documentation was considered, not skipped.
12
+
13
+ You do NOT reopen the discussion about the code itself — that is the job of `review`. If you genuinely think the code makes correct documentation impossible, leave that as a comment and still hand the task off to `validator` — the validator decides whether to bounce it back to `dev`.
@@ -0,0 +1,13 @@
1
+ You are the CODE REVIEWER.
2
+
3
+ You receive the task plus the changes the developer made on the previous step. Your job is a THOROUGH code review:
4
+
5
+ - Look for bugs, regressions, and hidden edge cases.
6
+ - Look for suboptimal solutions: redundant allocations, extra traversals, duplication, awkward abstractions.
7
+ - Check that the code follows the project's architecture and accepted style.
8
+ - Check that tests exist and are meaningful for the changed behaviour.
9
+ - Check error handling and logging.
10
+
11
+ Record every remark as a separate comment with specifics: file, line/function, what is wrong, what you propose. Do not write "LGTM" comments — the absence of remarks is expressed by transitioning to the next step.
12
+
13
+ If there are substantive remarks the developer must address, send the task back to `dev`. If the review found no blocking issues, send the task to `docs`.
@@ -0,0 +1,12 @@
1
+ You are the TASK VALIDATOR.
2
+
3
+ You receive the original conditions of the task (title + description + initial plan) and the final implementation (code + documentation changes + the comment trail from dev / review / docs). Your job is an independent item-by-item verification:
4
+
5
+ 1. Extract every requirement and acceptance criterion from the original task.
6
+ 2. For each item, check whether it is fully and correctly satisfied by the current implementation.
7
+ 3. Check that no adjacent functionality has regressed.
8
+ 4. Check that the documentation is consistent with the implementation (the `docs` step already did this — your check is independent).
9
+
10
+ If any item is unmet, partially met, or incorrectly met, send the task back to `dev` with a SPECIFIC list of what to finish (as comments on the task, one comment per item).
11
+
12
+ If all original conditions are fully and correctly met, with no regressions, and the documentation is consistent, transition the task to `accept` for a human's final acceptance.
package/src/index.ts ADDED
@@ -0,0 +1,87 @@
1
+ /**
2
+ * `@autosk/feature-dev` — the shipped reference workflow (plan §3.6, P6).
3
+ *
4
+ * A full feature-development cycle: `dev → review → docs → validator → accept`
5
+ * (human), with bounce-backs `review → dev` and `validator → dev`, a visit-cap
6
+ * guard in `onTransit` (via `ctx.visits("dev")`), and per-task git worktree
7
+ * isolation. It replaces v1's `feature-dev-generic` bootstrap; each agent step
8
+ * is an inline `@autosk/pi-agent` role seeded with that role's prompt (the step
9
+ * key IS the agent name), and `accept` is a `statusStep("human")` park step.
10
+ *
11
+ * Discovery: this package is published to npm and declared as an extension via
12
+ * `package.json#autosk.extensions`. The daemon installs it into
13
+ * `~/.autosk/packages/` on first run (ensureGlobalBootstrap) and lists it in
14
+ * `~/.autosk/settings.json`, so every project can enroll into `feature-dev` with
15
+ * no per-project files, while a project/global extension of the same name wins.
16
+ */
17
+
18
+ import { readFileSync } from "node:fs";
19
+ import { fileURLToPath } from "node:url";
20
+
21
+ import {
22
+ statusStep,
23
+ type AutoskAPI,
24
+ type IsolationProvider,
25
+ type StepTarget,
26
+ type TransitContext,
27
+ type WorkflowDefinition,
28
+ } from "@autosk/sdk";
29
+ import { piAgent } from "@autosk/pi-agent";
30
+ import { worktreeIsolation } from "@autosk/worktree";
31
+
32
+ /**
33
+ * The `dev` re-entry cap: a task may enter `dev` at most this many times before
34
+ * `onTransit` rejects the next bounce-back (the design's `max_visits` pattern,
35
+ * plan §3.6). `ctx.visits("dev")` counts PRIOR `dev` occupancies, so a transition
36
+ * INTO `dev` when `visits("dev") >= 5` is the 6th entry — rejected.
37
+ */
38
+ export const DEV_VISIT_CAP = 5;
39
+
40
+ /** Reads a role prompt (shipped under `prompts/`) to seed the agent's first message. */
41
+ function readPrompt(role: string): string {
42
+ return readFileSync(fileURLToPath(new URL(`../prompts/${role}.md`, import.meta.url)), "utf8");
43
+ }
44
+
45
+ /** Options for {@link featureDevWorkflow} (tests inject a test isolation double). */
46
+ export interface FeatureDevWorkflowOptions {
47
+ /** Isolation provider for the workflow. Default: `worktreeIsolation()`. */
48
+ isolation?: IsolationProvider;
49
+ }
50
+
51
+ /**
52
+ * The `feature-dev` workflow definition. A factory (not a const) so tests can
53
+ * swap the isolation provider (e.g. a fake, or a temp-home worktree) without
54
+ * touching the shipped default.
55
+ */
56
+ export function featureDevWorkflow(opts: FeatureDevWorkflowOptions = {}): WorkflowDefinition {
57
+ return {
58
+ name: "feature-dev",
59
+ description:
60
+ "Full feature-development cycle: dev → review → docs → validator → accept (human), " +
61
+ "with review→dev and validator→dev bounce-backs and per-task worktree isolation.",
62
+ firstStep: "dev",
63
+ steps: {
64
+ // Agents are inline: the step key (dev/review/docs/validator) IS the
65
+ // agent name, and registering the workflow registers these agents.
66
+ dev: piAgent({ firstMessage: readPrompt("dev") }),
67
+ review: piAgent({ thinking: "xhigh", firstMessage: readPrompt("review") }),
68
+ docs: piAgent({ firstMessage: readPrompt("docs") }),
69
+ validator: piAgent({ firstMessage: readPrompt("validator") }),
70
+ accept: statusStep("human"),
71
+ },
72
+ onTransit(ctx: TransitContext, to: StepTarget): void {
73
+ if ("step" in to && to.step === "dev" && ctx.visits("dev") >= DEV_VISIT_CAP) {
74
+ throw new Error(
75
+ `feature-dev: task ${ctx.taskId} bounced back to dev too many times ` +
76
+ `(${ctx.visits("dev")} prior dev runs, cap ${DEV_VISIT_CAP}) — parking for a human`,
77
+ );
78
+ }
79
+ },
80
+ isolation: opts.isolation ?? worktreeIsolation(),
81
+ };
82
+ }
83
+
84
+ /** The extension factory: registering the workflow registers its inline agents. */
85
+ export default function featureDevExtension(autosk: AutoskAPI): void {
86
+ autosk.registerWorkflow(featureDevWorkflow());
87
+ }